You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.7 KiB
60 lines
1.7 KiB
struct Line
|
|
unit speaker
|
|
string speakerName
|
|
string content
|
|
integer begin
|
|
integer end
|
|
integer enemy
|
|
|
|
static method create takes integer begin, integer end returns thistype
|
|
local thistype l = thistype.allocate()
|
|
set l.begin = begin
|
|
set l.end = end
|
|
return l
|
|
endmethod
|
|
|
|
method foe takes nothing returns thistype
|
|
set this.enemy = 1
|
|
return this
|
|
endmethod
|
|
|
|
method setSpeak takes string speakerName, string content returns thistype
|
|
set this.speakerName = speakerName
|
|
set this.content = content
|
|
return this
|
|
endmethod
|
|
|
|
method setSpeak2 takes unit speaker, string content returns thistype
|
|
set this.speaker = speaker
|
|
set this.content = content
|
|
return this
|
|
endmethod
|
|
|
|
method getSpeaker takes integer enemy returns string
|
|
local string color = "|cff00ff00"
|
|
if enemy == 1 then
|
|
set color = "|cffff4000"
|
|
endif
|
|
if this.speaker != null then
|
|
if IsUnitType(this.speaker, UNIT_TYPE_HERO) then
|
|
return color + GetHeroProperName(this.speaker) + "|r"
|
|
else
|
|
return color + GetUnitName(this.speaker) + "|r"
|
|
endif
|
|
else
|
|
return color + this.speakerName + "|r"
|
|
endif
|
|
endmethod
|
|
|
|
|
|
method say takes nothing returns thistype
|
|
local string speaker = this.getSpeaker(this.enemy)
|
|
call DisplayTimedTextToPlayer(Player(0), SayPointX, SayPointY, this.getDuration(), speaker + ": " + this.content)
|
|
return this
|
|
endmethod
|
|
|
|
method getDuration takes nothing returns real
|
|
return I2R(this.end - this.begin)
|
|
endmethod
|
|
|
|
endstruct
|
|
|