|
前言:我的函数库基本是七凑八凑凑来的。。。参考了画中人,橙zi,剑魔等人的函数库以及血戳的一些虚无的协助才写出来的
[jass]//初始化这个系统
//function InitYuko takes nothing returns nothing
globals
group group126
sound sound126
texttag texttag126
timer timer126
lightning lightning126
unit unit126
effect effect126
trigger trigger126
real msg_x=0.2
real msg_y=0.05
real msg_time=30
gamecache Amamiya
handle array DataSystem
trigger DStrigger
boolean array IsUsing
integer length = 5000
integer head
integer array stack
integer SL
endglobals
//Return Bug
function H2I takes handle h returns integer
return h
return GetRandomInt(126,621)
endfunction
function H2S takes handle h returns string
return I2S(H2I(h))
endfunction
function H2L takes handle h returns location
return h
return null
endfunction
function S2I2 takes string s returns integer
return s
return GetRandomInt(126,621)
endfunction
function I2S2 takes integer s returns string
return s
return null
endfunction
function I2U takes integer i returns unit
return i
return null
endfunction
function I2Trg takes integer i returns trigger
return i
return null
endfunction
function I2Tm takes integer i returns timer
return i
return null
endfunction
function I2It takes integer i returns item
return i
return null
endfunction
//Check X and Y
function CheckX takes real x returns real
local real r=GetRectMinX(bj_mapInitialPlayableArea)+50
if(x<r)then
return r
endif
set r=GetRectMaxX(bj_mapInitialPlayableArea)-50
if(x>r)then
return r
endif
return x
endfunction
function CheckY takes real y returns real
local real r=GetRectMinY(bj_mapInitialPlayableArea)+50
if(y<r)then
return r
endif
set r=GetRectMaxY(bj_mapInitialPlayableArea)-50
if(y>r)then
return r
endif
return y
endfunction
function SetX takes unit u,real distance,real facing returns nothing
call SetUnitX( u, CheckX(GetUnitX(u) + distance*(Cos(facing)) * bj_DEGTORAD ))
endfunction
function SetY takes unit u,real distance,real facing returns nothing
call SetUnitY( u, CheckY(GetUnitY(u) + distance*(Sin(facing)) * bj_DEGTORAD ))
endfunction
//RandomColor
function RandomColor takes string s returns string
local string hex = "0123456789abcdef"
local string color = null
local string id = null
local integer a = 0
local integer b = 0
loop
set b = GetRandomInt(1,16)
set id = SubString( hex, b - 1, b )
set color = color + id
set a = a + 1
exitwhen a == 6
endloop
set id = null
return "|cff" + color + s + "|r"
endfunction
//Messages
function Message takes string msg returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(),msg_x,msg_y,msg_time,msg)
endfunction
function RedMsg takes string msg returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(),msg_x,msg_y,msg_time,"|cffff0000"+msg)
endfunction
function GreenMsg takes string msg returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(),msg_x,msg_y,msg_time,"|cff00ff00"+msg)
endfunction
function YellowMsg takes string msg returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(),msg_x,msg_y,msg_time,"|cffffff00"+msg)
endfunction
function BlueMessage takes string msg returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(),msg_x,msg_y,msg_time,"|cff0000ff"+msg)
endfunction
function ErrorMsg takes player ForPlayer, string msg returns nothing
if (GetLocalPlayer() == ForPlayer) then
call ClearTextMessages()
call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
call PlaySound( "InterfaceError" )
endif
endfunction
function RedGreenMsg takes string arg1,string arg2 returns nothing
call Message("|cffff0000"+arg1+"|r|cff00ff00"+arg2)
endfunction
function RedYellowMsg takes string arg1,string arg2 returns nothing
call Message("|cffff0000"+arg1+"|r|cffffff00"+arg2)
endfunction
function RedBlueMsg takes string arg1,string arg2 returns nothing
call Message("|cffff0000"+arg1+"|r|cff0000ff"+arg2)
endfunction
function RedWhiteMsg takes string arg1,string arg2 returns nothing
call Message("|cffff0000"+arg1+"|r"+arg2)
endfunction
function GreenWhiteMsg takes string arg1,string arg2 returns nothing
call Message("|cff00ff00"+arg1+"|r"+arg2)
endfunction
function GreenYellowMsg takes string arg1,string arg2 returns nothing
call Message("|cff00ff00"+arg1+"|r|cffffff00"+arg2)
endfunction
function WhiteRedMsg takes string arg1,string arg2 returns nothing
call Message(arg1+"|cffff0000"+arg2)
endfunction
function WhiteYellowMsg takes string arg1,string arg2 returns nothing
call Message(arg1+"|cffffff00"+arg2)
endfunction
function WhiteBlueMsg takes string arg1,string arg2 returns nothing
call Message(arg1+"|cff0000ff"+arg2)
endfunction
function WhiteGreenMsg takes string arg1,string arg2 returns nothing
call Message(arg1+"|cff00ff00"+arg2)
endfunction
//GameCache
function SetHandleInt takes handle h,string s,integer i returns nothing
if i==0 then
call FlushStoredInteger(Amamiya,H2S(h),s)
else
call StoreInteger(Amamiya,H2S(h),s,i)
endif
endfunction
function SetHandleReal takes handle h,string s,real i returns nothing
if i==0 then
call FlushStoredReal(Amamiya,H2S(h),s)
else
call StoreReal(Amamiya,H2S(h),s,i)
endif
endfunction
function SetHandleString takes handle h, string s, string z returns nothing
if z==null then
call FlushStoredString(Amamiya,H2S(h),s)
else
call StoreString(Amamiya, H2S(h), s, z)
endif
endfunction
function SetHandleHandle takes handle h, string s, handle value returns nothing
if value==null then
call FlushStoredInteger(Amamiya,H2S(h),s)
else
call StoreInteger(Amamiya, H2S(h), s, H2I(value))
endif
endfunction
function GetHandleInt takes handle h,string s returns integer
return GetStoredInteger(Amamiya,H2S(h),s)
endfunction
function GetHandleReal takes handle h,string s returns real
return GetStoredReal(Amamiya,H2S(h),s)
endfunction
function GetHandleString takes handle h,string s returns string
return GetStoredString(Amamiya,H2S(h),s)
endfunction
function GetHandleUnit takes handle h, string s returns unit
return GetStoredInteger(Amamiya, H2S(h), s)
return null
endfunction
function GetHandleTimer takes handle h, string s returns timer
return GetStoredInteger(Amamiya, H2S(h), s)
return null
endfunction
function GetHandleGroup takes handle h, string s returns group
return GetStoredInteger(Amamiya, H2S(h), s)
return null
endfunction
function GetHandleEffect takes handle h, string s returns effect
return GetStoredInteger(Amamiya, H2S(h), s)
return null
endfunction
function FlushHandle takes handle h returns nothing
call FlushStoredMission(Amamiya,H2S(h))
endfunction[/jass] |
|