* added script to support /me-like emotes (scriptname is "me")
* changed the permission system: now a script cant be used as game command f no permission is explicitly set
* implemented threadsafe CLI queue to solve crashes with short-intervalled events that ran on 2 threads
* fixed name return at "getitemprotovalue" script
* iplemented DrawObject class and a Mgr for those objects; they will ease object drawing once implemented. the Mgr works under control of the GUI thread and is threadsafe.
* implemented auto-loading of SCP files if a name-tag is present somewhere in the file ("#dbname=...") and no explicit db name was passed to "loadscp" script.
* changed internal ObjMgr storage to std::map (instead of list) for faster access
* fixed call of "_enterworld" script
* fixed handling of MyCharacter(), which could cause crashes after newly changes
* fixed GetFileList() func in tools.cpp (this fixes also related "lgetfiles" script func). now it will only parse files, not directories. might still need some fixing for linux.
126 lines
2.9 KiB
Modula-2
126 lines
2.9 KiB
Modula-2
|
|
|
|
//-------------------------------------------------
|
|
#script=slap
|
|
#permission=255
|
|
//-------------------------------------------------
|
|
// purpose: let a player fly. (at least works on MaNGOS)
|
|
// args: @def: player name
|
|
// returns: guid of the targeted player, else false. empty string if we are not in the world.
|
|
|
|
// we can use this script only if we are in the world
|
|
if ?{not ${@inworld}}
|
|
logerror Can't slap anything if i am not in the world!
|
|
return
|
|
endif
|
|
|
|
// normalize player name. first char uppercased, rest lowercased.
|
|
set,name ?{normalize_name ${@def}}
|
|
|
|
// target the player. if targeting was successful, cast spell "Knockback 500".
|
|
set,t ?{target ${name}}
|
|
if ${t}
|
|
logdebug slapping player '${name}'
|
|
castspell 11027
|
|
target
|
|
else
|
|
logerror Can't target player '${name}'
|
|
endif
|
|
|
|
unset name
|
|
|
|
return ${t}
|
|
|
|
|
|
|
|
//------------------------------------------------
|
|
#script=toleet
|
|
//------------------------------------------------
|
|
// purpose: convert any text into leetspeak [1337sp34k]
|
|
// args: @def: the text to convert
|
|
// returns: leetspeak^^
|
|
|
|
#onload
|
|
// this can be used by other scripts to check if we have loaded this script
|
|
set,#HAVE_LEET true
|
|
#endonload
|
|
|
|
// empty the string where the leet will be stored
|
|
set,str
|
|
// total length of the string to convert
|
|
set,l ?{strlen ${@def}}
|
|
// position counter
|
|
set,x 0
|
|
|
|
loop
|
|
|
|
// check if we have reached the end of the string
|
|
if ?{bigger,${x} ${l}}
|
|
exitloop
|
|
endif
|
|
|
|
// c stores current char (@def at position x); c2 is the same char but always lowercased
|
|
set,c ?{substr,1,${x} ${@def}}
|
|
set,c2 ?{lowercase ${c}}
|
|
|
|
// conversion functions:
|
|
|
|
// note that "+" is a variable name here!
|
|
// it will store the "new" char if c/c2 could be converted
|
|
|
|
if ?{equal,${c2} a}
|
|
set,+ 4
|
|
endif
|
|
if ?{equal,${c2} e}
|
|
set,+ 3
|
|
endif
|
|
if ?{equal,${c2} i}
|
|
set,+ !
|
|
endif
|
|
if ?{equal,${c2} l}
|
|
set,+ 1
|
|
endif
|
|
if ?{equal,${c2} t}
|
|
set,+ 7
|
|
endif
|
|
if ?{equal,${c2} s}
|
|
set,+ 5
|
|
endif
|
|
if ?{equal,${c2} o}
|
|
set,+ 0
|
|
endif
|
|
if ?{equal,${c2} f}
|
|
set,+ ph
|
|
endif
|
|
if ?{equal,${c2} h}
|
|
set,+ #
|
|
endif
|
|
if ?{equal,${c} Z}
|
|
set,+ 7
|
|
endif
|
|
if ?{equal,${c} R}
|
|
set,+ 2
|
|
endif
|
|
if ?{equal,${c} B}
|
|
set,+ <3
|
|
endif
|
|
|
|
// if var "+" is still empty, default it to our current char
|
|
default,+ ${c}
|
|
// and append it to the final output
|
|
append,str ${+}
|
|
// finally delete it again
|
|
unset +
|
|
// and increase the counter by 1
|
|
add,x 1
|
|
endloop
|
|
|
|
unset l
|
|
unset x
|
|
unset c
|
|
unset c2
|
|
|
|
return ${str}
|
|
|
|
|