|
好奇地从war3.map中找到一个J文件,里面有段jass,和元素3里一部分的好像,麻烦看看这段jass有什么用处?
[jass]
//===========================================================================
// Convert a integer id value into a 4-letter id code.
//
function DebugIdInteger2IdString takes integer value returns string
local string charMap = ".................................!.#$%&'()*+,-./0123456789:;<=>.@ABCDEFGHIJKLMNOPQRSTUVWXYZ[.]^_`abcdefghijklmnopqrstuvwxyz{|}~................................................................................................................................."
local string result = ""
local integer remainingValue = value
local integer charValue
local integer byteno
set byteno = 0
loop
set charValue = ModuloInteger(remainingValue, 256)
set remainingValue = remainingValue / 256
set result = SubString(charMap, charValue, charValue + 1) + result
set byteno = byteno + 1
exitwhen byteno == 4
endloop
return result
endfunction
//===========================================================================
function DebugUnitInfoEnum takes nothing returns nothing
local player thePlayer = GetTriggerPlayer()
local unit theUnit = GetEnumUnit()
local string message
set message = "Player" + I2S(GetPlayerId(GetOwningPlayer(theUnit)))
set message = message + " '" + DebugIdInteger2IdString(GetUnitTypeId(theUnit)) + "'"
set message = message + " " + GetUnitName(theUnit)
set message = message + " (" + R2SW(GetUnitX(theUnit), 0, 0) + ", " + R2SW(GetUnitY(theUnit), 0, 0)
set message = message + ": " + R2SW(GetUnitFacing(theUnit), 0, 0) + ") "
set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_HERO), " Hero", "")
set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_DEAD), " Dead", "")
set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_STRUCTURE), " Structure", "")
set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_GROUND), " Grnd", "")
set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_FLYING), " Air", "")
set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_ATTACKS_GROUND), " VsGrnd", "")
set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_ATTACKS_FLYING), " VsAir", "")
set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_MELEE_ATTACKER), " Melee", "")
set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_RANGED_ATTACKER), " Ranged", "")
set message = message + TertiaryStringOp(IsUnitType(theUnit, UNIT_TYPE_SUMMONED), " Summoned", "")
call DisplayTextToPlayer(thePlayer, 0, 0, message)
endfunction
//===========================================================================
[/jass] |
|