* compacted scripts. needs min rev 141 to run (skipping 'lsort'). deleted old scripts.

* added script func 'lsort'. more args will be added later.
This commit is contained in:
False.Genesis 2007-06-22 11:20:50 +00:00
parent 54e8361bad
commit 4845888fc3
46 changed files with 620 additions and 491 deletions

View File

@ -6,6 +6,7 @@ LOG * DefScript StartUp [${@version_short}]...
// first, load all scripts in patch 'scripts' with extension .def // first, load all scripts in patch 'scripts' with extension .def
SET,fcount ?{LGETFILES,scriptlist,def scripts} SET,fcount ?{LGETFILES,scriptlist,def scripts}
LSORT scriptlist
LOGDETAIL * Loading ${fcount} scripts. LOGDETAIL * Loading ${fcount} scripts.
// iterate over all files and load them; if counter i is equal to the amount of files we are done. // iterate over all files and load them; if counter i is equal to the amount of files we are done.
SET,i 0 SET,i 0

View File

@ -12,6 +12,9 @@
// other servers might be different // other servers might be different
cmdchar=. cmdchar=.
// MaNGOS does also accept ! as cmd identifier. put here all identifiers that can trigger a server command!
other_cmd_chars=.!
[#normal] [#normal]

210
bin/scripts/__core_chat.def Normal file
View File

@ -0,0 +1,210 @@
//-----------------------------------------------------------
#script=chan
//-----------------------------------------------------------
// Script to write on channels
// Arguments:
// ==========
// @def: text to write
// @0: channel name
// @1: language name/number
#permission=10
SET,lang ${@1}
DEFAULT,lang 0
SENDCHATMESSAGE,14,{${lang}},{${@def}},{${@0}}
UNSET lang
//-----------------------------------------------------------
#script=cmd
#permission=255
//-----------------------------------------------------------
// purpose: send a server command.
// args:
// @def: command to send
SAY ${#CMDCHAR}${@def}
//-----------------------------------------------------------
#script=reply
#permission=255
//-----------------------------------------------------------
// purpose: reply to the player that whispered last
SET,player ${@thiswhisper_name}
SET,lang ${@0}
DEFAULT,lang 0
SET,msg ${@def}
WHISPER,{${player}},{${lang}} ${msg}
UNSET player
UNSET lang
UNSET msg
//-----------------------------------------------------------
#script=s
#permission=0
//-----------------------------------------------------------
// is the char equal to the char we use for commands? does the player have a permission lvl below 255?
IF ?{AND,?{string_is_command ${@def}} ?{SMALLER,?{GETPLAYERPERM ${@thiscmd_name}} 255}}
// yes: say a warning and the command the player wanted to use
SAY ${@thiscmd_name}: no permission to use commands [${@def}]
RETURN false
ELSE
// no: say the text as usual.
SAY,{${@0}} ${@def}
RETURN true
ENDIF
//-----------------------------------------------------------
#script=say
#permission=255
//-----------------------------------------------------------
// purpose: say something. @0: language ID or name, @def: text to say
// setup some default values
SET,lang ${@0}
SET,msg ${@def}
DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction}
DEFAULT,lang ${#DEFAULTLANG}
LOGDEBUG * Saying '${msg}' in lang ${lang}
SENDCHATMESSAGE,0,${lang},{${msg}}
UNSET lang
UNSET msg
//-----------------------------------------------------------
#script=sayguild
#permission=255
//-----------------------------------------------------------
// purpose: say something to guild channel
// setup some default values
SET,lang ${@0}
SET,msg ${@def}
default,lang 0
LOGDEBUG * Saying '${msg}' in lang ${lang} to guild
SENDCHATMESSAGE,3,${lang},{${msg}}
UNSET lang
UNSET msg
//-----------------------------------------------------------
#script=sayitem
#permission=0
//-----------------------------------------------------------
// example script to "say" a clickable item
SAY ?{getchatitem ${@def}}
//-----------------------------------------------------------
#script=sayparty
#permission=255
//-----------------------------------------------------------
// purpose: say something to party channel
// setup some default values
SET,lang ${@0}
SET,msg ${@def}
default,lang 0
LOGDEBUG * Saying '${msg}' in lang ${lang} to party
SENDCHATMESSAGE,1,${lang},{${msg}}
UNSET lang
UNSET msg
//-----------------------------------------------------------
#script=sayred
//-----------------------------------------------------------
// example script how to output colored text
#permission=0
SAY,{${@0}} |cffFF0000${@def}
//-----------------------------------------------------------
#script=sayv
#permission=0
//-----------------------------------------------------------
// purpose: say the value of a variable
// args: @0: language ID or name, @def: var name
SET,vn #${@caller}::${@def}
SET,vl ${@0}
DEFAULT,vl 0
IF ?{NOT ?{ISSET ${vn}}}
SAY,{${vl}} * Var '${@def}' not defined.
ELSE
SET,vv ${${vn}}
SAY,{${vl}} * Var '${@def}' = '${vv}'
ENDIF
UNSET vv
UNSET vn
UNSET vl
//-----------------------------------------------------------
#script=whisper
#permission=255
//-----------------------------------------------------------
// purpose: whisper text to a player.
// args: @0: player name to whisper to; @1: language to use; @def: text
// setup some default values
SET,msg ${@def}
SET,player ${@0}
SET,lang ${@1}
DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction}
DEFAULT,lang ${#DEFAULTLANG}
LOGDEBUG * Whisp to '{${player}}' '{${msg}}' in lang '${lang}'
SENDCHATMESSAGE,6,{${lang}},{${msg}},{${player}}
UNSET lang
UNSET msg
UNSET player
//-------------------------------------------------------------
#script=yell
#permission=255
//-------------------------------------------------------------
// purpose: SHOUT!
// setup some default values
SET,lang ${@0}
SET,msg ${@def}
DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction}
DEFAULT,lang ${#DEFAULTLANG}
LOGDEBUG * Yelling '${msg}' in lang ${lang}
SENDCHATMESSAGE,5,${lang},{${msg}}
UNSET lang
UNSET msg
//-----------------------------------------------------------
#script=y
#permission=0
//-----------------------------------------------------------
// is the char equal to the char we use for commands? does the player have a permission lvl below 255?
IF ?{AND,?{string_is_command ${@def}} ?{SMALLER,?{GETPLAYERPERM ${@thiscmd_name}} 255}}
// yes: say a warning and the command the player wanted to use
YELL ${@thiscmd_name}: no permission to use commands [${@def}]
RETURN false
ELSE
// no: say the text as usual.
YELL,{${@0}} ${@def}
RETURN true
ENDIF

123
bin/scripts/__core_func.def Normal file
View File

@ -0,0 +1,123 @@
// core functions. required by other scripts to run!
#onload
log * Loading core scripts...
#/onload
//--------------------------------------------------------
#script=append
#permission=255
//--------------------------------------------------------
// usage: append text to a string.
// args:
// @def: text to append
// @0: variable to which the text should be appended
// get the var name if the original variable
SET,v #${@caller}::${@0}
// if it has not been set before, init it now
DEFAULT,${v}
// append to the original var. inner ${..} gets the var name, outer ${..} get the value of the var name we just got.
SET,${v} ${${v}}${@def}
// remove the name placeholder
UNSET v
//--------------------------------------------------------
#script=exloadscp
#permission=255
//--------------------------------------------------------
if ?{fileexists ${@def}}
loadscp,{${@0}} ${@def}
else
logdebug skipped loading of non-existent file '${@def}'
endif
//--------------------------------------------------------
#script=loadallscp
#permission=255
//--------------------------------------------------------
LOG * Loading SCP data storages...
// example:
// LOADSCP,test data/test.scp
// load default databases
LOADSCP,class data/scp/class.scp
LOADSCP,gender data/scp/gender.scp
LOADSCP,language data/scp/language.scp
LOADSCP,map data/scp/map.scp
LOADSCP,race data/scp/race.scp
// load extended databases if present.
EXLOADSCP,sound data/scp/sound.scp
EXLOADSCP,emote data/scp/emote.scp
LOG * SCP loaded.
//-------------------------------------------------
#script=string_is_command
#permission=255
//-------------------------------------------------
// purpose: detect if @def might be a server command.
// split all chars we have set in the config files to a list.
lsplit,#CMDCHARLIST ${#OTHER_CMD_CHARS}
// find out the first char of the string
SET,c ?{SUBSTR,1 ${@def}}
// does the char list contain our first char? if yes it can trigger a server command.
if ?{lcontains,#CMDCHARLIST ${c}}
unset c
return true
endif
unset c
return false
//--------------------------------------------------------
#script=normalize_name
#permission=255
//--------------------------------------------------------
// uppercases first char, lowercases rest
set,name ?{uppercase ?{substr,1 ${@def}}}
set,len ?{strlen ${@def}}
sub,len 1
append,name ?{lowercase ?{substr,${len},1 ${@def}}}
return ${name}
//---------------------------------------------------------
#script=globname
#permission=255
//---------------------------------------------------------
// purpose: returns the global name of a variable
// args: @def: var name, @0 (optional): name of the intended parent func
set,c ?{substr,1 ${@def}}
// it is a global var if the varname starts with # or there is no caller script
if ?{or,?{equal,# ${c}} ?{not ${@caller}}}
return ${@def}
endif
set,top ${@0}
default,top ${@caller}
return #${top}::${@def}
//---------------------------------------------------------
#script=getvar
#permission=255
//---------------------------------------------------------
// purpose: returns the value of a variable. if the variable hasnt been set return empty string.
set,top ${@caller}
default,top #
set,v ?{globname,${top} ${@def}}
unset top
out getvar: v=${v} -> ${${v}}
if ?{isset ${v}}
return ${${v}}
endif
return

View File

@ -1,26 +1,55 @@
// toleet.def
// ==========
// purpose: convert any text into leetspeak [1337sp34k]
// args:
// @def: the text to convert
// returns: leetspeak^^
// call it from script only
//-------------------------------------------------
#script=slap
#permission=255 #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
#permission=255
//------------------------------------------------
// purpose: convert any text into leetspeak [1337sp34k]
// args: @def: the text to convert
// returns: leetspeak^^
#onload #onload
// this can be used by other scripts to check if we have loaded this script // this can be used by other scripts to check if we have loaded this script
set,#HAVE_LEET true set,#HAVE_LEET true
#endonload #endonload
// --- Begin of main function ---
// empty the string where the leet will be stored // empty the string where the leet will be stored
set,str set,str
// total length of the string to convert // total length of the string to convert
set,l ?{strlen ${@def}} set,l ?{strlen ${@def}}
// position counter // position counter
set,x 0 set,x 0
@ -93,3 +122,5 @@ unset c
unset c2 unset c2
return ${str} return ${str}

View File

@ -0,0 +1,94 @@
// scripts used for configuration! DO NOT MODIFY unless you know what you do!!
#onload
log * Loading core scripts (internal config)...
#/onload
//--------------------------------------------------------
#script=exit
#permission=255
//--------------------------------------------------------
// just a name alternative
QUIT
//--------------------------------------------------------
#script=quit
#permission=255
//--------------------------------------------------------
// quit PseuWoW, say goodbye when logged in
IF ${@inworld}
SAY Terminating proc...
ENDIF
SHDN
//-----------------------------------------------
#script=cleanupvars
//-----------------------------------------------
// purpose: unset all variables that could be abused by someone
LOGDETAIL * Cleaning up variables...
UNSET #ACCPASS
UNSET #ACCNAME
LOGDETAIL * Dangerous variables removed.
//-----------------------------------------------
#script=config
#permission=255
//-----------------------------------------------
// Load all conf files from directory /conf/
// get all *.conf file names from /conf/ directory, store the names in list 'fl' and the amount in 'fcount'
SET,fcount ?{LGETFILES,fl,conf conf}
// sort the list, load conf files alphabetically.
LSORT fl
IF ?{NOT ${fcount}}
LOGERROR No conf file found! Can't load.
RETURN
ENDIF
LOG * Loading ${fcount} conf files.
// iterate over all files and load them; if counter i is equal to the amount of files we are done.
SET,i 0
LOOP
IF ?{EQUAL,${i} ${fcount}}
EXITLOOP
ENDIF
SET,fn ?{LINDEX,fl ${i}}
LOG * Loading conf file [ ${fn} ]
LOADCONF ${fn}
ADD,i 1
ENDLOOP
UNSET fcount
UNSET i
UNSET fn
LDELETE fl
// Apply the configuration
APPLYCONF
LOG * Configuration applied.
// Apply user permissions
APPLYPERMISSIONS
// remove dangerous variables
CLEANUPVARS
// if its not set in the conf file, default it to "." (WoWEmu & MaNGOS style)
DEFAULT,#CMDCHAR .
//--------------------------------------------------
#script=internal_perm
#permission=255
//--------------------------------------------------
// purpose: set script permissions for internal functions that cant be set otherwise.
// if you don't set a permission for a script manually, it will have permission 255 (highest)
LOG * Assigning permissions for internal functions...
// emotes are hard to abuse, allow for everyone
setscriptpermission,emote 0
// ... set more permissions here ...

View File

@ -0,0 +1,36 @@
//--------------------------------------------
#script=lcontains
#permission=255
//--------------------------------------------
// return true if any list element matches @def, else return false.
// @0: list name, @def: search string
set,i 0
set,l ?{globname ${@0}}
out list: ${l} - len: ?{llen ${l}}
if ?{not ?{llen ${l}}}
return
endif
set,result false
loop
out eq:?{equal,${i} ?{llen ${l}}} i:${i} len:?{llen ${l}}
if ?{equal,${i} ?{llen ${l}}}
exitloop
endif
set,elem ?{lindex,{${l}} ${i}}
if ?{equal,{${elem}} ${@def}}
set,result true
exitloop
endif
add,i 1
endloop
unset i
unset l
unset elem
return ${result}

View File

@ -0,0 +1,57 @@
//-----------------------------------------------
#script=getchatitem
#permission=255
//-----------------------------------------------
// expected args:
// @def: item id
// @0 (optional): color (in RGB hex format: 00FF00 = pure green)
// returns: clickable item link to use it chat messages
SET,i ${@def}
SET,color ${@0}
DEFAULT,i 0
TOINT,i ${i}
DEFAULT,color 6679FF
SET,link |cff${color}|Hitem:${i}:0:0:0|h[Item ${i}]|h|r
UNSET i
UNSET color
RETURN ${link}
//-----------------------------------------------
#script=makechatitem
#permission=255
//-----------------------------------------------
// purpose: write the text of a clickable item link into a variable
// expected args:
// @def: item id
// @0: variable name to write into
// @1 (optional): color (in hex format: 00FF00 = pure green)
SET,v #${@caller}::${target}
SET,{${v}} ?{getchatitem,{${@1}} ${@def}}
UNSET v
//-----------------------------------------------
#script=outv
#permission=0
//-----------------------------------------------
// purpose: output a variable's value to the console.
// usage: "outv x"
SET,vn #${@caller}::${@def}
IF ?{NOT ?{ISSET ${vn}}}
OUT * Var '${@def}' not defined.
RETURN
ENDIF
SET,vv ${${vn}}
OUT * Var '${@def}' = '${vv}'
UNSET vv
UNSET vn

View File

@ -0,0 +1,39 @@
// example file. wrap a few functions together.
//------------------------------------------------
#script=gc
//------------------------------------------------
// example script to write into channel "generalchat"
// usage: "gc bla bla..."
chan,generalchat ${@def}
//------------------------------------------------
#script=gcl
#permission=0
//------------------------------------------------
// write leetspeak to channel generalchat (see "gc" script)
// usage: "gcl moo, cow syndrome!"
gc ?{toleet ${@def}}
//------------------------------------------------
#script=selfheal
#permission=0
//------------------------------------------------
// purpose: heal self with full hp. GM-ONLY!!
// be sure you have this spell in your spellbook!
// DO NOT USE THIS SCRIPT IF YOU ARE NO GM!
// target self (the name we used to login)
TARGET ${#CHARNAME}
// 23965 = instant heal
CASTSPELL 23965
//------------------------------------------------
#script=sl
#permission=0
//------------------------------------------------
// say leetspeak text. gm-commands can't be executed this way
s,{${@0}} ?{toleet ${@def}}

View File

@ -1,15 +0,0 @@
#permission=255
// usage: append text to a string.
// args:
// @def: text to append
// @0: variable to which the text should be appended
// get the var name if the original variable
SET,v #${@caller}::${@0}
// if it has not been set before, init it now
DEFAULT,${v}
// append to the original var. inner ${..} gets the var name, outer ${..} get the value of the var name we just got.
SET,${v} ${${v}}${@def}
// remove the name placeholder
UNSET v

View File

@ -1,13 +0,0 @@
// Script to write on channels
// Arguments:
// ==========
// @def: text to write
// @0: channel name
// @1: language name/number
#permission=10
SET,lang ${@1}
DEFAULT,lang 0
SENDCHATMESSAGE,14,{${lang}},{${@def}},{${@0}}
UNSET lang

View File

@ -1,6 +0,0 @@
LOG * Cleaning up variables...
UNSET #ACCPASS
UNSET #ACCNAME
LOG * Dangerous variables removed.

View File

@ -1,7 +0,0 @@
#permission=255
// purpose: send a server command.
// args:
// @def: command to send
SAY ${#CMDCHAR}${@def}

View File

@ -1,35 +0,0 @@
#permission=255
// Load all conf files from directory /conf/
// get all *.conf file names from /conf/ directory, store the names in list 'fl' and the amount in 'fcount'
SET,fcount ?{LGETFILES,fl,conf conf}
LOGDETAIL * Loading ${fcount} conf files.
// iterate over all files and load them; if counter i is equal to the amount of files we are done.
SET,i 0
LOOP
IF ?{EQUAL,${i} ${fcount}}
EXITLOOP
ENDIF
SET,fn ?{LINDEX,fl ${i}}
LOG * Loading conf file [ ${fn} ]
LOADCONF ${fn}
ADD,i 1
ENDLOOP
UNSET fcount
UNSET i
UNSET fn
LDELETE fl
// Apply the configuration
APPLYCONF
LOG * Configuration applied.
// Apply user permissions
APPLYPERMISSIONS
// remove dangerous variables
CLEANUPVARS
// if its not set in the conf file, default it to "." (WoWEmu & MaNGOS style)
DEFAULT,#CMDCHAR .

View File

@ -1,19 +0,0 @@
#permission=255
// EXAMPLE SCRIPT!!!
// expected args:
// @def: variable name
// purpose: multiply a given variable with 3 and add 1
// this line is the most important part:
// get the name of the function calling this script,
// and modify its variable. note that we treat this variable as global!
// example: script "foo" has a variable x and calls this script with x as default argument.
// result: the variable name will be: "#foo::x"
set,v #${@caller}::${@def}
// v now stores the variable name of the var we want to change.
// side note: the # marks the var as global. if we didnt do this, the var name would be "example_3xadd1::foo::x"
// do some math
mul,{${v}} 3
add,{${v}} 1

View File

@ -1,22 +0,0 @@
#permission=255
// example script to explain how to use loops/ifs
set,x 0
loop
set,y 0
add,x 1
if ?{bigger,${x} 5}
exitloop
endif
loop
if ?{bigger,${y} 8}
exitloop
else
set,tmp ${x}
mul,tmp ${y}
out LOOP:${x}:${y} = ${tmp}
endif
add,y 1
endloop
endloop
out end if/loop test script

View File

@ -1,13 +0,0 @@
// EXAMPLE SCRIPT!!!
// purpose: demonstrate the #onload part that gets executed everytime the script is loaded
// result: on the first call the number '1001' will be written, 2nd call '1002', etc.
#permission=255
#onload
out Loading "loadtest.def" --[[
set,mytest 1000
out finished ]]--
#endonload
add,mytest 1
out ${mytest}

View File

@ -1,4 +0,0 @@
#permission=255
// just a name alternative
QUIT

View File

@ -1,6 +0,0 @@
#permission=255
if ?{fileexists ${@def}}
loadscp,{${@0}} ${@def}
else
logdebug skipped loading of non-existent file '${@def}'
endif

View File

@ -1,4 +0,0 @@
// example script to write into channel "generalchat"
// usage: "gc bla bla..."
chan,generalchat ${@def}

View File

@ -1,3 +0,0 @@
// write leetspeak to channel generalchat (see gc.def)
#permission=0
gc ?{toleet ${@def}}

View File

@ -1,18 +0,0 @@
#permission=255
// expected args:
// @def: item id
// @0 (optional): color (in RGB hex format: 00FF00 = pure green)
// returns: clickable item link
SET,i ${@def}
SET,color ${@0}
DEFAULT,i 0
TOINT,i ${i}
DEFAULT,color 6679FF
SET,link |cff${color}|Hitem:${i}:0:0:0|h[Item ${i}]|h|r
UNSET i
UNSET color
RETURN ${link}

View File

@ -1,51 +0,0 @@
#psermission=255
LOG * Assigning permissions for internal functions...
// default permission level for all internal script commands
set,p 255
// this is important because players could reset permissions for dangerous functions
SETSCRIPTPERMISSION,setscriptpermission 255
SETSCRIPTPERMISSION,out ${p}
SETSCRIPTPERMISSION,set ${p}
SETSCRIPTPERMISSION,default ${p}
SETSCRIPTPERMISSION,unset ${p}
SETSCRIPTPERMISSION,shdn ${p}
SETSCRIPTPERMISSION,loaddef ${p}
SETSCRIPTPERMISSION,reloaddef ${p}
SETSCRIPTPERMISSION,toint ${p}
SETSCRIPTPERMISSION,add ${p}
SETSCRIPTPERMISSION,sub ${p}
SETSCRIPTPERMISSION,mul ${p}
SETSCRIPTPERMISSION,div ${p}
SETSCRIPTPERMISSION,mod ${p}
SETSCRIPTPERMISSION,pow ${p}
SETSCRIPTPERMISSION,bitor ${p}
SETSCRIPTPERMISSION,bitand ${p}
SETSCRIPTPERMISSION,bitxor ${p}
SETSCRIPTPERMISSION,pause ${p}
// emotes are not relly dangerous, allow for all users
SETSCRIPTPERMISSION,emote 0
SETSCRIPTPERMISSION,savecache ${p}
SETSCRIPTPERMISSION,sendchatmessage ${p}
SETSCRIPTPERMISSION,joinchannel ${p}
SETSCRIPTPERMISSION,leavechannel ${p}
SETSCRIPTPERMISSION,loadconf ${p}
SETSCRIPTPERMISSION,applyconf ${p}
SETSCRIPTPERMISSION,applypermissions ${p}
SETSCRIPTPERMISSION,log ${p}
SETSCRIPTPERMISSION,logdetail ${p}
SETSCRIPTPERMISSION,logdebug ${p}
SETSCRIPTPERMISSION,target ${p}
SETSCRIPTPERMISSION,loadscp ${p}
SETSCRIPTPERMISSION,castspell ${p}
UNSET p
LOG * Permissions set.

View File

@ -1,27 +0,0 @@
// preloads the most important scripts
LOG * Loading DefScripts...
RELOADDEF _enterworld
RELOADDEF _leaveworld
RELOADDEF _nopermission
RELOADDEF _onwhisper
RELOADDEF cleanupvars
RELOADDEF internal_perm
RELOADDEF chan
RELOADDEF quit
RELOADDEF reply
RELOADDEF say
RELOADDEF yell
RELOADDEF whisper
RELOADDEF makechatitem
RELOADDEF gc
RELOADDEF sayred
RELOADDEF outv
RELOADDEF sayv
RELOADDEF s
RELOADDEF y
LOG * DefScripts loaded.

View File

@ -1,20 +0,0 @@
#permission=255
LOG * Loading SCP data storages...
// example:
// LOADSCP,test data/test.scp
// load default databases
LOADSCP,class data/scp/class.scp
LOADSCP,gender data/scp/gender.scp
LOADSCP,language data/scp/language.scp
LOADSCP,map data/scp/map.scp
LOADSCP,race data/scp/race.scp
// load extended databases if present.
EXLOADSCP,sound data/scp/sound.scp
EXLOADSCP,emote data/scp/emote.scp
LOG * SCP loaded.

View File

@ -1,21 +0,0 @@
#permission=255
// expected args:
// @def: item id
// @0: variable name to write into
// @1 (optional): color (in hex format: 00FF00 = pure green)
SET,i ${@def}
SET,target ${@0}
SET,color ${@1}
DEFAULT,i 0
TOINT,i ${i}
DEFAULT,target chatitem
DEFAULT,color 6679FF
SET,v #${@caller}::${target}
SET,${v} |cff${color}|Hitem:${i}:0:0:0|h[Item ${i}]|h|r
UNSET i
UNSET v
UNSET color
UNSET target

View File

@ -1,14 +0,0 @@
#permission=0
SET,vn #${@caller}::${@def}
IF ?{NOT ?{ISSET ${vn}}}
OUT * Var '${@def}' not defined.
RETURN
ENDIF
SET,vv ${${vn}}
OUT * Var '${@def}' = '${vv}'
UNSET vv
UNSET vn

View File

@ -1,5 +0,0 @@
#permission=255
IF ${@inworld}
SAY Terminating proc...
ENDIF
SHDN

View File

@ -1,12 +0,0 @@
#permission=255
SET,player ${@thiswhisper_name}
SET,lang ${@0}
DEFAULT,lang 0
SET,msg ${@def}
WHISPER,{${player}},{${lang}} ${msg}
UNSET player
UNSET lang
UNSET msg

View File

@ -1,20 +0,0 @@
#permission=0
// purpose: easy way for any player to make pseuwow say text.
// if it thinks the player is trying to use a server command it will not say it.
// args are the same as say.def
// only players whose permission is = 255 can use this script to say commands
// first find out the first char of the message string
SET,c ?{SUBSTR,1 ${@def}}
// is the char equal to the char we use for commands? does the player have a permission lvl below 255?
IF ?{AND,?{EQUAL,${c} {${#CMDCHAR}}} ?{SMALLER,?{GETPLAYERPERM ${@thiscmd_name}} 255}}
// yes: say a warning and the command the player wanted to use
SAY ${@thiscmd_name}: no permission to use commands [${@def}]
RETURN false
ELSE
// no: say the text as usual.
SAY,{${@0}} ${@def}
RETURN true
ENDIF

View File

@ -1,13 +0,0 @@
#permission=255
// setup some default values
SET,lang ${@0}
SET,msg ${@def}
DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction}
DEFAULT,lang ${#DEFAULTLANG}
LOGDEBUG * Saying '${msg}' in lang ${lang}
SENDCHATMESSAGE,0,${lang},{${msg}}
UNSET lang
UNSET msg

View File

@ -1,12 +0,0 @@
#permission=255
// setup some default values
SET,lang ${@0}
SET,msg ${@def}
default,lang 0
LOGDEBUG * Saying '${msg}' in lang ${lang}
SENDCHATMESSAGE,3,${lang},{${msg}}
UNSET lang
UNSET msg

View File

@ -1,8 +0,0 @@
// example script to "say" a clickable item (in WoW)
MAKECHATITEM,i ${@def}
SAY ${i}
UNSET i
// we could also use the following:
// SAY ?{GETCHATITEM ${@def}}

View File

@ -1,12 +0,0 @@
#permission=255
// setup some default values
SET,lang ${@0}
SET,msg ${@def}
default,lang 0
LOGDEBUG * Saying '${msg}' in lang ${lang}
SENDCHATMESSAGE,1,${lang},{${msg}}
UNSET lang
UNSET msg

View File

@ -1,4 +0,0 @@
// example script how to output colored text
#permission=0
SAY,${@0} |cffFF0000 ${@def}

View File

@ -1,17 +0,0 @@
#permission=0
SET,vn #${@caller}::${@def}
SET,vl ${@0}
DEFAULT,vl 0
IF ?{NOT ?{ISSET ${vn}}}
SAY,{${vl}} * Var '${@def}' not defined.
RETURN
ENDIF
SET,vv ${${vn}}
SAY,{${vl}} * Var '${@def}' = '${vv}'
UNSET vv
UNSET vn
UNSET vl

View File

@ -1,11 +0,0 @@
#permission=0
// purpose: heal self with full hp. GM-ONLY!!
// be sure you have this spell in your spellbook!
// DO NOT USE THIS SCRIPT IF YOU ARE NO GM!
// target self (the name we used to login)
TARGET ${#CHARNAME}
// 23965 = instant heal
CASTSPELL 23965

View File

@ -1,3 +0,0 @@
// say leetspeak text. gmcommands can't be executed this way
#permission=0
s,{${@0}} ?{toleet ${@def}}

View File

@ -1,31 +0,0 @@
// 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.
#permission=100
// 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 ?{uppercase ?{substr,1 ${@def}}}
set,len ?{strlen ${@def}}
sub,len 1
append,name ?{lowercase ?{substr,${len},1 ${@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}

View File

@ -1,16 +0,0 @@
#permissionn=255
// setup some default values
SET,msg ${@def}
SET,player ${@0}
SET,lang ${@1}
DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction}
DEFAULT,lang ${#DEFAULTLANG}
LOGDEBUG * Whisp to '{${player}}' '{${msg}}' in lang '${lang}'
SENDCHATMESSAGE,6,{${lang}},{${msg}},{${player}}
UNSET lang
UNSET msg
UNSET player

View File

@ -1,2 +0,0 @@
#permission=0
YELL,{${@0}} ${@def}

View File

@ -1,13 +0,0 @@
#permission=255
// setup some default values
SET,lang ${@0}
SET,msg ${@def}
DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction}
DEFAULT,lang ${#DEFAULTLANG}
LOGDEBUG * Yelling '${msg}' in lang ${lang}
SENDCHATMESSAGE,5,${lang},{${msg}}
UNSET lang
UNSET msg

View File

@ -107,6 +107,7 @@ void DefScriptPackage::_InitFunctions(void)
AddFunc("lclean",&DefScriptPackage::func_lclean); AddFunc("lclean",&DefScriptPackage::func_lclean);
AddFunc("lmclean",&DefScriptPackage::func_lmclean); AddFunc("lmclean",&DefScriptPackage::func_lmclean);
AddFunc("lerase",&DefScriptPackage::func_lerase); AddFunc("lerase",&DefScriptPackage::func_lerase);
AddFunc("lsort",&DefScriptPackage::func_lsort);
} }
void DefScriptPackage::AddFunc(std::string n,DefReturnResult (DefScriptPackage::*f)(CmdSet& Set)) void DefScriptPackage::AddFunc(std::string n,DefReturnResult (DefScriptPackage::*f)(CmdSet& Set))
@ -895,7 +896,6 @@ std::string DefScriptPackage::_NormalizeVarName(std::string vn_in, std::string s
global = true; global = true;
while(true) while(true)
{ {
if(vn.at(0)=='#') if(vn.at(0)=='#')
global = true; global = true;
if(vn.at(0)=='#' || vn.at(0)==':') if(vn.at(0)=='#' || vn.at(0)==':')
@ -903,6 +903,7 @@ std::string DefScriptPackage::_NormalizeVarName(std::string vn_in, std::string s
else else
break; break;
} }
if( (!global) && (vn.at(0)!='@') ) if( (!global) && (vn.at(0)!='@') )
vn=sn+"::"+vn; vn=sn+"::"+vn;

View File

@ -202,6 +202,7 @@ private:
DefReturnResult func_lclean(CmdSet&); DefReturnResult func_lclean(CmdSet&);
DefReturnResult func_lmclean(CmdSet&); DefReturnResult func_lmclean(CmdSet&);
DefReturnResult func_lerase(CmdSet&); DefReturnResult func_lerase(CmdSet&);
DefReturnResult func_lsort(CmdSet&);
// setup own function declarations here // setup own function declarations here
# include "DefScriptInterfaceInclude.h" # include "DefScriptInterfaceInclude.h"

View File

@ -1,6 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <algorithm>
#include "DefScript.h" #include "DefScript.h"
#include "DefScriptTools.h" #include "DefScriptTools.h"
@ -254,6 +255,16 @@ DefReturnResult DefScriptPackage::func_lerase(CmdSet& Set)
return r; return r;
} }
DefReturnResult DefScriptPackage::func_lsort(CmdSet& Set)
{
DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if(!l)
return false;
sort(l->begin(),l->end());
return true;
}

View File

@ -139,7 +139,6 @@ std::deque<std::string> GetFileList(std::string path)
while(files.size() && (files.front()=="." || files.front()=="..")) while(files.size() && (files.front()=="." || files.front()==".."))
files.pop_front(); files.pop_front();
return files; return files;
} }