summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c319
1 files changed, 156 insertions, 163 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 56b7974c7..6805dbff2 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -1943,9 +1943,9 @@ enum {RUN = 0,STOP,END,RERUNLINE,GOTO,RETFUNC};
/// Returns the player attached to this script, identified by the rid.
/// If there is no player attached, the script is terminated.
-struct map_session_data *script_rid2sd(struct script_state *st)
+TBL_PC *script_rid2sd(struct script_state *st)
{
- struct map_session_data *sd=map_id2sd(st->rid);
+ TBL_PC *sd=map_id2sd(st->rid);
if(!sd){
ShowError("script_rid2sd: fatal error ! player not attached!\n");
st->state = END;
@@ -1959,7 +1959,7 @@ struct map_session_data *script_rid2sd(struct script_state *st)
*------------------------------------------*/
int get_val(struct script_state* st, struct script_data* data)
{
- struct map_session_data* sd = NULL;
+ TBL_PC* sd = NULL;
char *name, prefix, postfix;
if(!data_isreference(data)) return 0;
@@ -2049,7 +2049,7 @@ void* get_val2(struct script_state* st, int num, struct linkdb_node** ref)
* Stores the value of a script variable
* Return value is 0 on fail, 1 on success.
*------------------------------------------*/
-static int set_reg(struct script_state* st, struct map_session_data* sd, int num, char* name, void* value, struct linkdb_node** ref)
+static int set_reg(struct script_state* st, TBL_PC* sd, int num, char* name, void* value, struct linkdb_node** ref)
{
char prefix = name[0]; char postfix = name[strlen(name)-1];
@@ -2111,7 +2111,7 @@ static int set_reg(struct script_state* st, struct map_session_data* sd, int num
}
}
-int set_var(struct map_session_data* sd, char* name, void* val)
+int set_var(TBL_PC* sd, char* name, void* val)
{
return set_reg(NULL, sd, add_str(name), name, val, NULL);
}
@@ -2727,7 +2727,7 @@ void run_script_main(struct script_state *st);
void run_script(struct script_code *rootscript,int pos,int rid,int oid)
{
struct script_state *st;
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
if(rootscript==NULL || pos<0)
return;
@@ -2799,7 +2799,7 @@ int run_script_timer(int tid, unsigned int tick, int id, int data)
{
struct script_state *st = (struct script_state *)data;
struct linkdb_node *node = (struct linkdb_node *)sleep_db;
- struct map_session_data *sd = map_id2sd(st->rid);
+ TBL_PC *sd = map_id2sd(st->rid);
if((sd && sd->status.char_id != id) || (st->rid && !sd))
{ //Character mismatch. Cancel execution.
@@ -2829,7 +2829,7 @@ void run_script_main(struct script_state *st)
int c;
int cmdcount=script_config.check_cmdcount;
int gotocount=script_config.check_gotocount;
- struct map_session_data *sd;
+ TBL_PC *sd;
//For backing up purposes
struct script_state *bk_st = NULL;
int bk_npcid = 0;
@@ -4200,9 +4200,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(sleep2,"i"),
BUILDIN_DEF(awake,"s"),
BUILDIN_DEF(getvariableofnpc,"rs"),
- // [blackhole89] -->
BUILDIN_DEF(warpportal,"iisii"),
- // <--- [blackhole89]
BUILDIN_DEF2(homunculus_evolution,"homevolution",""), //[orn]
BUILDIN_DEF(eaclass,"*"), //[Skotlex]
BUILDIN_DEF(roclass,"i*"), //[Skotlex]
@@ -4222,15 +4220,10 @@ struct script_function buildin_func[] = {
/// mes "<message>";
BUILDIN_FUNC(mes)
{
- TBL_PC* sd;
- const char* msg;
-
- sd = script_rid2sd(st);
+ TBL_PC* sd = script_rid2sd(st);
if( sd == NULL )
return 1;
-
- msg = script_getstr(st, 2);
- clif_scriptmes(sd, st->oid, msg);
+ clif_scriptmes(sd, st->oid, script_getstr(st, 2));
return 0;
}
@@ -4769,7 +4762,7 @@ BUILDIN_FUNC(warp)
{
int x,y;
const char *str;
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
nullpo_retr(0, sd);
@@ -4800,9 +4793,9 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
x=va_arg(ap,int);
y=va_arg(ap,int);
if(map == 0)
- pc_randomwarp((struct map_session_data *)bl,3);
+ pc_randomwarp((TBL_PC *)bl,3);
else
- pc_setpos((struct map_session_data *)bl,map,x,y,0);
+ pc_setpos((TBL_PC *)bl,map,x,y,0);
return 0;
}
BUILDIN_FUNC(areawarp)
@@ -4846,7 +4839,7 @@ BUILDIN_FUNC(warpchar)
{
int x,y,a,i;
const char *str;
- struct map_session_data *sd, **pl_allsd;
+ TBL_PC *sd, **pl_allsd;
int users;
str=script_getstr(st,2);
@@ -4887,7 +4880,7 @@ BUILDIN_FUNC(warpparty)
int p_id;
int i;
unsigned short mapindex;
- struct map_session_data *pl_sd;
+ TBL_PC *pl_sd;
struct party_data *p=NULL;
str=script_getstr(st,2);
x=script_getnum(st,3);
@@ -4970,9 +4963,9 @@ BUILDIN_FUNC(warpguild)
const char *str;
int g;
int i;
- struct map_session_data *pl_sd, **pl_allsd;
+ TBL_PC *pl_sd, **pl_allsd;
int users;
- struct map_session_data *sd;
+ TBL_PC *sd;
str=script_getstr(st,2);
x=script_getnum(st,3);
y=script_getnum(st,4);
@@ -5054,7 +5047,7 @@ BUILDIN_FUNC(warpguild)
*/
BUILDIN_FUNC(heal)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
int hp,sp;
sd = script_rid2sd(st);
@@ -5071,7 +5064,7 @@ BUILDIN_FUNC(heal)
*/
BUILDIN_FUNC(itemheal)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
int hp,sp;
hp=script_getnum(st,2);
@@ -5148,7 +5141,7 @@ BUILDIN_FUNC(jobname)
*/
BUILDIN_FUNC(input)
{
- struct map_session_data *sd = script_rid2sd(st);
+ TBL_PC *sd = script_rid2sd(st);
struct script_data *data = script_getdata(st,2);
int num = data->u.num;
char *name=str_buf+str_data[num&0x00ffffff].str;
@@ -5193,7 +5186,7 @@ BUILDIN_FUNC(input)
*/
BUILDIN_FUNC(set)
{
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
int num=st->stack->stack_data[st->start+2].u.num;
char *name=str_buf+str_data[num&0x00ffffff].str;
char prefix=*name;
@@ -5226,7 +5219,7 @@ BUILDIN_FUNC(set)
*/
BUILDIN_FUNC(setarray)
{
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
int num=st->stack->stack_data[st->start+2].u.num;
char *name=str_buf+str_data[num&0x00ffffff].str;
char prefix=*name;
@@ -5256,7 +5249,7 @@ BUILDIN_FUNC(setarray)
*/
BUILDIN_FUNC(cleararray)
{
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
int num=st->stack->stack_data[st->start+2].u.num;
char *name=str_buf+str_data[num&0x00ffffff].str;
char prefix=*name;
@@ -5287,7 +5280,7 @@ BUILDIN_FUNC(cleararray)
*/
BUILDIN_FUNC(copyarray)
{
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
int num=st->stack->stack_data[st->start+2].u.num;
char *name=str_buf+str_data[num&0x00ffffff].str;
char prefix=*name;
@@ -5376,7 +5369,7 @@ BUILDIN_FUNC(getarraysize)
*/
BUILDIN_FUNC(deletearray)
{
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
int num=st->stack->stack_data[st->start+2].u.num;
char *name=str_buf+str_data[num&0x00ffffff].str;
char prefix=*name;
@@ -5488,7 +5481,7 @@ BUILDIN_FUNC(viewpoint)
BUILDIN_FUNC(countitem)
{
int nameid=0,count=0,i;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct script_data *data;
@@ -5533,7 +5526,7 @@ BUILDIN_FUNC(countitem2)
{
int nameid=0,count=0,i;
int iden,ref,attr,c1,c2,c3,c4;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct script_data *data;
@@ -5593,7 +5586,7 @@ BUILDIN_FUNC(checkweight)
{
int nameid=0,amount,i;
unsigned long weight;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct script_data *data;
sd = script_rid2sd(st);
@@ -5642,7 +5635,7 @@ BUILDIN_FUNC(getitem)
{
int nameid,amount,flag = 0;
struct item it;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct script_data *data;
data=script_getdata(st,2);
@@ -5720,7 +5713,7 @@ BUILDIN_FUNC(getitem2)
int iden,ref,attr,c1,c2,c3,c4;
struct item_data *item_data;
struct item item_tmp;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct script_data *data;
sd = script_rid2sd(st);
@@ -5807,7 +5800,7 @@ BUILDIN_FUNC(getnameditem)
{
int nameid;
struct item item_tmp;
- struct map_session_data *sd, *tsd;
+ TBL_PC *sd, *tsd;
struct script_data *data;
sd = script_rid2sd(st);
@@ -5915,7 +5908,7 @@ BUILDIN_FUNC(makeitem)
if(strcmp(mapname,"this")==0)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
sd = script_rid2sd(st);
if (!sd) return 0; //Failed...
m=sd->bl.m;
@@ -5947,7 +5940,7 @@ BUILDIN_FUNC(makeitem)
BUILDIN_FUNC(delitem)
{
int nameid=0,amount,i,important_item=0;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct script_data *data;
sd = script_rid2sd(st);
@@ -6052,7 +6045,7 @@ BUILDIN_FUNC(delitem2)
{
int nameid=0,amount,i=0;
int iden,ref,attr,c1,c2,c3,c4;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct script_data *data;
sd = script_rid2sd(st);
@@ -6125,7 +6118,7 @@ BUILDIN_FUNC(delitem2)
*/
BUILDIN_FUNC(enableitemuse)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
if (sd)
sd->npc_item_flag = st->oid;
@@ -6134,7 +6127,7 @@ BUILDIN_FUNC(enableitemuse)
BUILDIN_FUNC(disableitemuse)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
if (sd)
sd->npc_item_flag = 0;
@@ -6148,7 +6141,7 @@ BUILDIN_FUNC(disableitemuse)
BUILDIN_FUNC(readparam)
{
int type;
- struct map_session_data *sd;
+ TBL_PC *sd;
type=script_getnum(st,2);
if( script_hasdata(st,3) )
@@ -6172,7 +6165,7 @@ BUILDIN_FUNC(readparam)
BUILDIN_FUNC(getcharid)
{
int num;
- struct map_session_data *sd;
+ TBL_PC *sd;
num=script_getnum(st,2);
if( script_hasdata(st,3) )
@@ -6377,7 +6370,7 @@ BUILDIN_FUNC(getguildmaster)
BUILDIN_FUNC(getguildmasterid)
{
char *master;
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
int guild_id=script_getnum(st,2);
master=buildin_getguildmaster_sub(guild_id);
if(master!=0){
@@ -6398,7 +6391,7 @@ BUILDIN_FUNC(getguildmasterid)
*/
BUILDIN_FUNC(strcharinfo)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
int num;
char *buf;
@@ -6444,7 +6437,7 @@ unsigned int equip[10]={EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT
BUILDIN_FUNC(getequipid)
{
int i,num;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct item_data* item;
sd=script_rid2sd(st);
@@ -6474,7 +6467,7 @@ BUILDIN_FUNC(getequipid)
BUILDIN_FUNC(getequipname)
{
int i,num;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct item_data* item;
char *buf;
@@ -6503,7 +6496,7 @@ BUILDIN_FUNC(getequipname)
BUILDIN_FUNC(getbrokenid)
{
int i,num,id=0,brokencounter=0;
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
@@ -6531,7 +6524,7 @@ BUILDIN_FUNC(repair)
{
int i,num;
int repaircounter=0;
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
@@ -6560,7 +6553,7 @@ BUILDIN_FUNC(repair)
BUILDIN_FUNC(getequipisequiped)
{
int i,num;
- struct map_session_data *sd;
+ TBL_PC *sd;
num=script_getnum(st,2);
sd=script_rid2sd(st);
@@ -6585,7 +6578,7 @@ BUILDIN_FUNC(getequipisequiped)
BUILDIN_FUNC(getequipisenableref)
{
int i,num;
- struct map_session_data *sd;
+ TBL_PC *sd;
num=script_getnum(st,2);
sd=script_rid2sd(st);
@@ -6607,7 +6600,7 @@ BUILDIN_FUNC(getequipisenableref)
BUILDIN_FUNC(getequipisidentify)
{
int i,num;
- struct map_session_data *sd;
+ TBL_PC *sd;
num=script_getnum(st,2);
sd=script_rid2sd(st);
@@ -6627,7 +6620,7 @@ BUILDIN_FUNC(getequipisidentify)
BUILDIN_FUNC(getequiprefinerycnt)
{
int i,num;
- struct map_session_data *sd;
+ TBL_PC *sd;
num=script_getnum(st,2);
sd=script_rid2sd(st);
@@ -6647,7 +6640,7 @@ BUILDIN_FUNC(getequiprefinerycnt)
BUILDIN_FUNC(getequipweaponlv)
{
int i,num;
- struct map_session_data *sd;
+ TBL_PC *sd;
num=script_getnum(st,2);
sd=script_rid2sd(st);
@@ -6667,7 +6660,7 @@ BUILDIN_FUNC(getequipweaponlv)
BUILDIN_FUNC(getequippercentrefinery)
{
int i,num;
- struct map_session_data *sd;
+ TBL_PC *sd;
num=script_getnum(st,2);
sd=script_rid2sd(st);
@@ -6687,7 +6680,7 @@ BUILDIN_FUNC(getequippercentrefinery)
BUILDIN_FUNC(successrefitem)
{
int i,num,ep;
- struct map_session_data *sd;
+ TBL_PC *sd;
num=script_getnum(st,2);
sd=script_rid2sd(st);
@@ -6740,7 +6733,7 @@ BUILDIN_FUNC(successrefitem)
BUILDIN_FUNC(failedrefitem)
{
int i,num;
- struct map_session_data *sd;
+ TBL_PC *sd;
num=script_getnum(st,2);
sd=script_rid2sd(st);
@@ -6770,7 +6763,7 @@ BUILDIN_FUNC(failedrefitem)
BUILDIN_FUNC(statusup)
{
int type;
- struct map_session_data *sd;
+ TBL_PC *sd;
type=script_getnum(st,2);
sd=script_rid2sd(st);
@@ -6785,7 +6778,7 @@ BUILDIN_FUNC(statusup)
BUILDIN_FUNC(statusup2)
{
int type,val;
- struct map_session_data *sd;
+ TBL_PC *sd;
type=script_getnum(st,2);
val=script_getnum(st,3);
@@ -7331,7 +7324,7 @@ BUILDIN_FUNC(openstorage)
BUILDIN_FUNC(guildopenstorage)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
int ret;
ret = storage_guild_storageopen(sd);
script_pushint(st,ret);
@@ -7345,7 +7338,7 @@ BUILDIN_FUNC(guildopenstorage)
BUILDIN_FUNC(itemskill)
{
int id,lv;
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
id=script_getnum(st,2);
lv=script_getnum(st,3);
@@ -7365,7 +7358,7 @@ BUILDIN_FUNC(itemskill)
BUILDIN_FUNC(produce)
{
int trigger;
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
trigger=script_getnum(st,2);
clif_skill_produce_mix_list(sd, trigger);
@@ -7377,7 +7370,7 @@ BUILDIN_FUNC(produce)
*/
BUILDIN_FUNC(makepet)
{
- struct map_session_data *sd = script_rid2sd(st);
+ TBL_PC *sd = script_rid2sd(st);
int id,pet_id;
id=script_getnum(st,2);
@@ -7403,7 +7396,7 @@ BUILDIN_FUNC(makepet)
*/
BUILDIN_FUNC(getexp)
{
- struct map_session_data *sd = script_rid2sd(st);
+ TBL_PC *sd = script_rid2sd(st);
int base=0,job=0;
base=script_getnum(st,2);
@@ -7422,7 +7415,7 @@ BUILDIN_FUNC(getexp)
*/
BUILDIN_FUNC(guildgetexp)
{
- struct map_session_data *sd = script_rid2sd(st);
+ TBL_PC *sd = script_rid2sd(st);
int exp;
exp = script_getnum(st,2);
@@ -7440,7 +7433,7 @@ BUILDIN_FUNC(guildgetexp)
*/
BUILDIN_FUNC(guildchangegm)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
int guild_id;
const char *name;
@@ -7569,7 +7562,7 @@ BUILDIN_FUNC(killmonsterall)
*/
BUILDIN_FUNC(clone)
{
- struct map_session_data *sd, *msd=NULL;
+ TBL_PC *sd, *msd=NULL;
int char_id,master_id=0,x,y, mode = 0, flag = 0, m;
unsigned int duration = 0;
const char *map,*event="";
@@ -7801,7 +7794,7 @@ BUILDIN_FUNC(stopnpctimer)
BUILDIN_FUNC(getnpctimer)
{
struct npc_data *nd;
- struct map_session_data *sd;
+ TBL_PC *sd;
int type=script_getnum(st,2);
int val=0;
if( script_hasdata(st,3) )
@@ -7860,7 +7853,7 @@ BUILDIN_FUNC(setnpctimer)
*/
BUILDIN_FUNC(attachnpctimer)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
struct npc_data *nd;
nd=(struct npc_data *)map_id2bl(st->oid);
@@ -8021,7 +8014,7 @@ BUILDIN_FUNC(getusers)
*/
BUILDIN_FUNC(getusersname)
{
- struct map_session_data *sd, *pl_sd = NULL, **pl_allsd;
+ TBL_PC *sd, *pl_sd = NULL, **pl_allsd;
int i=0,disp_num=1, users;
sd = script_rid2sd(st);
@@ -8404,7 +8397,7 @@ BUILDIN_FUNC(debugmes)
BUILDIN_FUNC(catchpet)
{
int pet_id;
- struct map_session_data *sd;
+ TBL_PC *sd;
pet_id= script_getnum(st,2);
sd=script_rid2sd(st);
pet_catch_process1(sd,pet_id);
@@ -8417,7 +8410,7 @@ BUILDIN_FUNC(catchpet)
*/
BUILDIN_FUNC(homunculus_evolution)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
if ( sd->hd && sd->hd->homunculusDB->evo_class && sd->hd->homunculus.intimacy > 91000 ) {
return !merc_hom_evolution(sd->hd) ;
@@ -8433,7 +8426,7 @@ BUILDIN_FUNC(eaclass)
if( script_hasdata(st,2) )
class_ = script_getnum(st,2);
else {
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
if (!sd) {
script_pushint(st,-1);
@@ -8452,7 +8445,7 @@ BUILDIN_FUNC(roclass)
if( script_hasdata(st,3) )
sex = script_getnum(st,3);
else {
- struct map_session_data *sd;
+ TBL_PC *sd;
if (st->rid && (sd=script_rid2sd(st)))
sex = sd->status.sex;
else
@@ -8468,7 +8461,7 @@ BUILDIN_FUNC(roclass)
*/
BUILDIN_FUNC(birthpet)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
clif_sendegg(sd);
return 0;
@@ -8480,7 +8473,7 @@ BUILDIN_FUNC(birthpet)
*/
BUILDIN_FUNC(resetlvl)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
int type=script_getnum(st,2);
@@ -8494,7 +8487,7 @@ BUILDIN_FUNC(resetlvl)
*/
BUILDIN_FUNC(resetstatus)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
pc_resetstate(sd);
return 0;
@@ -8506,7 +8499,7 @@ BUILDIN_FUNC(resetstatus)
*/
BUILDIN_FUNC(resetskill)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
pc_resetskill(sd,1);
return 0;
@@ -8518,7 +8511,7 @@ BUILDIN_FUNC(resetskill)
*/
BUILDIN_FUNC(skillpointcount)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
script_pushint(st,sd->status.skill_point + pc_resetskill(sd,2));
return 0;
@@ -8530,7 +8523,7 @@ BUILDIN_FUNC(skillpointcount)
*/
BUILDIN_FUNC(changebase)
{
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
int vclass;
if( script_hasdata(st,3) )
@@ -8568,7 +8561,7 @@ BUILDIN_FUNC(changebase)
*/
BUILDIN_FUNC(changesex)
{
- struct map_session_data *sd = NULL;
+ TBL_PC *sd = NULL;
sd = script_rid2sd(st);
if (sd->status.sex == 0) {
@@ -8767,7 +8760,7 @@ BUILDIN_FUNC(warpwaitingpc)
const char *str;
struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid);
struct chat_data *cd;
- struct map_session_data *sd;
+ TBL_PC *sd;
if(nd==NULL || (cd=(struct chat_data *)map_id2bl(nd->chat_id))==NULL )
return 0;
@@ -9167,7 +9160,7 @@ BUILDIN_FUNC(pvpon)
{
int m,i,users;
const char *str;
- struct map_session_data *pl_sd=NULL, **pl_allsd;
+ TBL_PC *pl_sd=NULL, **pl_allsd;
str=script_getstr(st,2);
m = map_mapname2mapid(str);
@@ -9273,7 +9266,7 @@ BUILDIN_FUNC(emotion)
player=script_getnum(st,3);
if (player) {
- struct map_session_data *sd = script_rid2sd(st);
+ TBL_PC *sd = script_rid2sd(st);
if (sd)
clif_emotion(&sd->bl,type);
} else
@@ -9286,7 +9279,7 @@ static int buildin_maprespawnguildid_sub_pc(DBKey key, void *data, va_list ap)
int m=va_arg(ap,int);
int g_id=va_arg(ap,int);
int flag=va_arg(ap,int);
- struct map_session_data *sd = (TBL_PC*)data;
+ TBL_PC *sd = (TBL_PC*)data;
if(!sd || sd->bl.m != m)
return 0;
@@ -9545,7 +9538,7 @@ BUILDIN_FUNC(requestguildinfo)
BUILDIN_FUNC(getequipcardcnt)
{
int i,num;
- struct map_session_data *sd;
+ TBL_PC *sd;
int c=MAX_SLOTS;
num=script_getnum(st,2);
@@ -9574,7 +9567,7 @@ BUILDIN_FUNC(getequipcardcnt)
BUILDIN_FUNC(successremovecards)
{
int i,j,num,cardflag=0,flag;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct item item_tmp;
int c=MAX_SLOTS;
@@ -9642,7 +9635,7 @@ BUILDIN_FUNC(successremovecards)
BUILDIN_FUNC(failedremovecards)
{
int i,j,num,cardflag=0,flag,typefail;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct item item_tmp;
int c=MAX_SLOTS;
@@ -9836,8 +9829,8 @@ BUILDIN_FUNC(mobcount) // Added by RoVeRT
BUILDIN_FUNC(marriage)
{
const char *partner=script_getstr(st,2);
- struct map_session_data *sd=script_rid2sd(st);
- struct map_session_data *p_sd=map_nick2sd(partner);
+ TBL_PC *sd=script_rid2sd(st);
+ TBL_PC *p_sd=map_nick2sd(partner);
if(sd==NULL || p_sd==NULL || pc_marriage(sd,p_sd) < 0){
script_pushint(st,0);
@@ -9848,7 +9841,7 @@ BUILDIN_FUNC(marriage)
}
BUILDIN_FUNC(wedding_effect)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
struct block_list *bl;
if(sd==NULL) {
@@ -9860,7 +9853,7 @@ BUILDIN_FUNC(wedding_effect)
}
BUILDIN_FUNC(divorce)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if(sd==NULL || pc_divorce(sd) < 0){
script_pushint(st,0);
return 0;
@@ -9871,8 +9864,8 @@ BUILDIN_FUNC(divorce)
BUILDIN_FUNC(ispartneron)
{
- struct map_session_data *sd=script_rid2sd(st);
- struct map_session_data *p_sd=NULL;
+ TBL_PC *sd=script_rid2sd(st);
+ TBL_PC *p_sd=NULL;
if(sd==NULL || !pc_ismarried(sd) ||
(p_sd=map_charid2sd(sd->status.partner_id)) == NULL) {
@@ -9886,7 +9879,7 @@ BUILDIN_FUNC(ispartneron)
BUILDIN_FUNC(getpartnerid)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if (sd == NULL) {
script_pushint(st,0);
return 0;
@@ -9898,7 +9891,7 @@ BUILDIN_FUNC(getpartnerid)
BUILDIN_FUNC(getchildid)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if (sd == NULL) {
script_pushint(st,0);
return 0;
@@ -9910,7 +9903,7 @@ BUILDIN_FUNC(getchildid)
BUILDIN_FUNC(getmotherid)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if (sd == NULL) {
script_pushint(st,0);
return 0;
@@ -9922,7 +9915,7 @@ BUILDIN_FUNC(getmotherid)
BUILDIN_FUNC(getfatherid)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if (sd == NULL) {
script_pushint(st,0);
return 0;
@@ -9937,8 +9930,8 @@ BUILDIN_FUNC(warppartner)
int x,y;
unsigned short mapindex;
const char *str;
- struct map_session_data *sd=script_rid2sd(st);
- struct map_session_data *p_sd=NULL;
+ TBL_PC *sd=script_rid2sd(st);
+ TBL_PC *p_sd=NULL;
if(sd==NULL || !pc_ismarried(sd) ||
(p_sd=map_charid2sd(sd->status.partner_id)) == NULL) {
@@ -10054,7 +10047,7 @@ BUILDIN_FUNC(guardian)
BUILDIN_FUNC(guardianinfo)
{
int guardian=script_getnum(st,2);
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
struct guild_castle *gc=guild_mapname2gc(map[sd->bl.m].name);
if (guardian < 0 || guardian >= MAX_GUARDIANS || gc==NULL)
@@ -10224,7 +10217,7 @@ BUILDIN_FUNC(setiteminfo)
BUILDIN_FUNC(getequipcardid)
{
int i,num,slot;
- struct map_session_data *sd;
+ TBL_PC *sd;
num=script_getnum(st,2);
slot=script_getnum(st,3);
@@ -10247,7 +10240,7 @@ BUILDIN_FUNC(petskillbonus)
{
struct pet_data *pd;
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if(sd==NULL || sd->pd==NULL)
return 0;
@@ -10285,7 +10278,7 @@ BUILDIN_FUNC(petloot)
{
int max;
struct pet_data *pd;
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if(sd==NULL || sd->pd==NULL)
return 0;
@@ -10320,7 +10313,7 @@ BUILDIN_FUNC(petloot)
*/
BUILDIN_FUNC(getinventorylist)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
unsigned char card_var[NAME_LENGTH];
int i,j=0,k;
@@ -10347,7 +10340,7 @@ BUILDIN_FUNC(getinventorylist)
BUILDIN_FUNC(getskilllist)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
int i,j=0;
if(!sd) return 0;
for(i=0;i<MAX_SKILL;i++){
@@ -10364,7 +10357,7 @@ BUILDIN_FUNC(getskilllist)
BUILDIN_FUNC(clearitem)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
int i;
if(sd==NULL) return 0;
for (i=0; i<MAX_INVENTORY; i++) {
@@ -10386,7 +10379,7 @@ BUILDIN_FUNC(clearitem)
BUILDIN_FUNC(disguise)
{
int id;
- struct map_session_data* sd = script_rid2sd(st);
+ TBL_PC* sd = script_rid2sd(st);
if (sd == NULL) return 0;
id = script_getnum(st,2);
@@ -10405,7 +10398,7 @@ BUILDIN_FUNC(disguise)
*------------------------------------------*/
BUILDIN_FUNC(undisguise)
{
- struct map_session_data* sd = script_rid2sd(st);
+ TBL_PC* sd = script_rid2sd(st);
if (sd == NULL) return 0;
if (sd->disguise) {
@@ -10450,7 +10443,7 @@ BUILDIN_FUNC(misceffect)
if (bl)
clif_misceffect2(bl,type);
} else{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if(sd)
clif_misceffect2(&sd->bl,type);
}
@@ -10464,7 +10457,7 @@ BUILDIN_FUNC(soundeffect)
{
// Redundn
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
const char *name;
int type=0;
@@ -10492,7 +10485,7 @@ int soundeffect_sub(struct block_list* bl,va_list ap)
name = va_arg(ap,char *);
type = va_arg(ap,int);
- clif_soundeffect((struct map_session_data *)bl, bl, name, type);
+ clif_soundeffect((TBL_PC *)bl, bl, name, type);
return 0;
}
@@ -10538,7 +10531,7 @@ BUILDIN_FUNC(soundeffectall)
BUILDIN_FUNC(petrecovery)
{
struct pet_data *pd;
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if(sd==NULL || sd->pd==NULL)
return 0;
@@ -10567,7 +10560,7 @@ BUILDIN_FUNC(petrecovery)
BUILDIN_FUNC(petheal)
{
struct pet_data *pd;
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if(sd==NULL || sd->pd==NULL)
return 0;
@@ -10608,7 +10601,7 @@ BUILDIN_FUNC(petheal)
BUILDIN_FUNC(petskillattack)
{
struct pet_data *pd;
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if(sd==NULL || sd->pd==NULL)
return 0;
@@ -10633,7 +10626,7 @@ BUILDIN_FUNC(petskillattack)
BUILDIN_FUNC(petskillattack2)
{
struct pet_data *pd;
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if(sd==NULL || sd->pd==NULL)
return 0;
@@ -10658,7 +10651,7 @@ BUILDIN_FUNC(petskillattack2)
BUILDIN_FUNC(petskillsupport)
{
struct pet_data *pd;
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if(sd==NULL || sd->pd==NULL)
return 0;
@@ -10697,7 +10690,7 @@ BUILDIN_FUNC(petskillsupport)
*/
BUILDIN_FUNC(skilleffect)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
int skillid=script_getnum(st,2);
int skilllv=script_getnum(st,3);
@@ -10745,7 +10738,7 @@ BUILDIN_FUNC(specialeffect)
BUILDIN_FUNC(specialeffect2)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if(sd==NULL)
return 0;
@@ -10762,7 +10755,7 @@ BUILDIN_FUNC(specialeffect2)
BUILDIN_FUNC(nude)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
int i,calcflag=0;
if(sd==NULL)
@@ -10791,7 +10784,7 @@ BUILDIN_FUNC(nude)
BUILDIN_FUNC(atcommand)
{
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
const char *cmd;
cmd = script_getstr(st,2);
@@ -10806,9 +10799,9 @@ BUILDIN_FUNC(atcommand)
}
is_atcommand_sub(sd->fd, sd, cmd, 99);
} else { //Use a dummy character.
- struct map_session_data dummy_sd;
+ TBL_PC dummy_sd;
struct block_list *bl = NULL;
- memset(&dummy_sd, 0, sizeof(struct map_session_data));
+ memset(&dummy_sd, 0, sizeof(TBL_PC));
if (st->oid) bl = map_id2bl(st->oid);
if (bl) {
memcpy(&dummy_sd.bl, bl, sizeof(struct block_list));
@@ -10828,7 +10821,7 @@ BUILDIN_FUNC(atcommand)
BUILDIN_FUNC(charcommand)
{
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
const char *cmd;
cmd = script_getstr(st,2);
@@ -10844,9 +10837,9 @@ BUILDIN_FUNC(charcommand)
}
is_charcommand_sub(sd->fd, sd, cmd,99);
} else { //Use a dummy character.
- struct map_session_data dummy_sd;
+ TBL_PC dummy_sd;
struct block_list *bl = NULL;
- memset(&dummy_sd, 0, sizeof(struct map_session_data));
+ memset(&dummy_sd, 0, sizeof(TBL_PC));
if (st->oid) bl = map_id2bl(st->oid);
if (bl) {
memcpy(&dummy_sd.bl, bl, sizeof(struct block_list));
@@ -10871,7 +10864,7 @@ BUILDIN_FUNC(charcommand)
*/
BUILDIN_FUNC(dispbottom)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
const char *message;
message=script_getstr(st,2);
if(sd)
@@ -10886,7 +10879,7 @@ BUILDIN_FUNC(dispbottom)
*/
BUILDIN_FUNC(recovery)
{
- struct map_session_data *sd, **all_sd;
+ TBL_PC *sd, **all_sd;
int i = 0, users;
all_sd = map_getallusers(&users);
@@ -10910,7 +10903,7 @@ BUILDIN_FUNC(recovery)
*/
BUILDIN_FUNC(getpetinfo)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
struct pet_data *pd;
int type=script_getnum(st,2);
@@ -10955,7 +10948,7 @@ BUILDIN_FUNC(getpetinfo)
*/
BUILDIN_FUNC(checkequipedcard)
{
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
int n,i,c=0;
c=script_getnum(st,2);
@@ -11014,7 +11007,7 @@ BUILDIN_FUNC(getmapmobs)
str=script_getstr(st,2);
if(strcmp(str,"this")==0){
- struct map_session_data *sd=script_rid2sd(st);
+ TBL_PC *sd=script_rid2sd(st);
if(sd)
m=sd->bl.m;
else{
@@ -11072,9 +11065,9 @@ BUILDIN_FUNC(movenpc)
BUILDIN_FUNC(message)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
const char *msg,*player;
- struct map_session_data *pl_sd = NULL;
+ TBL_PC *pl_sd = NULL;
sd = script_rid2sd(st);
@@ -11119,7 +11112,7 @@ BUILDIN_FUNC(npctalk)
BUILDIN_FUNC(hasitems)
{
int i;
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
@@ -11183,7 +11176,7 @@ BUILDIN_FUNC(npcstop)
BUILDIN_FUNC(getlook)
{
int type,val;
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
type=script_getnum(st,2);
@@ -11229,7 +11222,7 @@ BUILDIN_FUNC(getsavepoint)
{
int x,y,type;
char *mapname;
- struct map_session_data *sd;
+ TBL_PC *sd;
sd=script_rid2sd(st);
@@ -11281,7 +11274,7 @@ BUILDIN_FUNC(getsavepoint)
BUILDIN_FUNC(getmapxy)
{
struct block_list *bl = NULL;
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
int num;
char *name;
@@ -11415,7 +11408,7 @@ BUILDIN_FUNC(summon)
{
int _class, timeout=0;
const char *str,*event="";
- struct map_session_data *sd;
+ TBL_PC *sd;
struct mob_data *md;
int tick = gettick();
@@ -11470,7 +11463,7 @@ BUILDIN_FUNC(isday)
#if 0
BUILDIN_FUNC(isequipped)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
int i, j, k, id = 1;
int ret = -1;
@@ -11531,7 +11524,7 @@ BUILDIN_FUNC(isequipped)
*/
BUILDIN_FUNC(isequippedcnt)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
int i, j, k, id = 1;
int ret = 0;
@@ -11584,7 +11577,7 @@ BUILDIN_FUNC(isequippedcnt)
*/
BUILDIN_FUNC(isequipped)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
int i, j, k, id = 1;
int index, flag;
int ret = -1;
@@ -11672,7 +11665,7 @@ BUILDIN_FUNC(isequipped)
*/
BUILDIN_FUNC(cardscnt)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
int i, k, id = 1;
int ret = 0;
int index;
@@ -11714,7 +11707,7 @@ BUILDIN_FUNC(cardscnt)
*/
BUILDIN_FUNC(getrefine)
{
- struct map_session_data *sd;
+ TBL_PC *sd;
if ((sd = script_rid2sd(st))!= NULL)
script_pushint(st,sd->status.inventory[current_equip_item_index].refine);
else
@@ -11734,9 +11727,9 @@ BUILDIN_FUNC(adopt)
const char *parent2 = script_getstr(st,3);
const char *child = script_getstr(st,4);
- struct map_session_data *p1_sd = map_nick2sd(parent1);
- struct map_session_data *p2_sd = map_nick2sd(parent2);
- struct map_session_data *c_sd = map_nick2sd(child);
+ TBL_PC *p1_sd = map_nick2sd(parent1);
+ TBL_PC *p2_sd = map_nick2sd(parent2);
+ TBL_PC *c_sd = map_nick2sd(child);
if (!p1_sd || !p2_sd || !c_sd ||
p1_sd->status.base_level < 70 ||
@@ -11771,7 +11764,7 @@ BUILDIN_FUNC(unequip)
{
int i;
size_t num;
- struct map_session_data *sd;
+ TBL_PC *sd;
num = script_getnum(st,2) - 1;
sd=script_rid2sd(st);
@@ -11787,7 +11780,7 @@ BUILDIN_FUNC(unequip)
BUILDIN_FUNC(equip)
{
int nameid=0,i;
- struct map_session_data *sd;
+ TBL_PC *sd;
struct item_data *item_data;
sd = script_rid2sd(st);
@@ -11956,7 +11949,7 @@ BUILDIN_FUNC(checkcell)
// <--- [zBuffer] List of mathematics commands
// [zBuffer] List of dynamic var commands --->
-void setd_sub(struct script_state *st, struct map_session_data *sd, char *varname, int elem, void *value, struct linkdb_node **ref)
+void setd_sub(struct script_state *st, TBL_PC *sd, char *varname, int elem, void *value, struct linkdb_node **ref)
{
set_reg(st, sd, add_str(varname)+(elem<<24), varname, value, ref);
return;
@@ -11964,7 +11957,7 @@ void setd_sub(struct script_state *st, struct map_session_data *sd, char *varnam
BUILDIN_FUNC(setd)
{
- struct map_session_data *sd=NULL;
+ TBL_PC *sd=NULL;
char varname[100];
const char *value, *buffer;
int elem;
@@ -11993,7 +11986,7 @@ BUILDIN_FUNC(query_sql)
const char *query;
int num, i = 0,j, nb_rows;
struct { char * dst_var_name; char type; } row[32];
- struct map_session_data *sd = (st->rid)? script_rid2sd(st) : NULL;
+ TBL_PC *sd = (st->rid)? script_rid2sd(st) : NULL;
query = script_getstr(st,2);
strcpy(tmp_sql, query);
@@ -12102,7 +12095,7 @@ BUILDIN_FUNC(getd)
// Pet stat [Lance]
BUILDIN_FUNC(petstat)
{
- struct map_session_data *sd = NULL;
+ TBL_PC *sd = NULL;
struct pet_data *pd;
char *tmp;
int flag = script_getnum(st,2);
@@ -12141,7 +12134,7 @@ BUILDIN_FUNC(petstat)
BUILDIN_FUNC(callshop)
{
- struct map_session_data *sd = NULL;
+ TBL_PC *sd = NULL;
struct npc_data *nd;
const char *shopname;
int flag = 0;
@@ -12496,7 +12489,7 @@ BUILDIN_FUNC(getmonsterinfo)
BUILDIN_FUNC(checkvending) // check vending [Nab4]
{
- struct map_session_data *sd = NULL;
+ TBL_PC *sd = NULL;
if(script_hasdata(st,2))
sd = map_nick2sd(script_getstr(st,2));
@@ -12514,7 +12507,7 @@ BUILDIN_FUNC(checkvending) // check vending [Nab4]
BUILDIN_FUNC(checkchatting) // check chatting [Marka]
{
- struct map_session_data *sd = NULL;
+ TBL_PC *sd = NULL;
if(script_hasdata(st,2))
sd = map_nick2sd(script_getstr(st,2));
@@ -12607,7 +12600,7 @@ BUILDIN_FUNC(rid2name)
BUILDIN_FUNC(pcblockmove)
{
int id, flag;
- struct map_session_data *sd = NULL;
+ TBL_PC *sd = NULL;
id = script_getnum(st,2);
flag = script_getnum(st,3);
@@ -12626,7 +12619,7 @@ BUILDIN_FUNC(pcblockmove)
BUILDIN_FUNC(pcfollow)
{
int id, targetid;
- struct map_session_data *sd = NULL;
+ TBL_PC *sd = NULL;
id = script_getnum(st,2);
@@ -12646,7 +12639,7 @@ BUILDIN_FUNC(pcfollow)
BUILDIN_FUNC(pcstopfollow)
{
int id;
- struct map_session_data *sd = NULL;
+ TBL_PC *sd = NULL;
id = script_getnum(st,2);
@@ -12703,7 +12696,7 @@ BUILDIN_FUNC(getmobdata)
int num, id;
char *name;
struct mob_data *md = NULL;
- struct map_session_data *sd = st->rid?map_id2sd(st->rid):NULL;
+ TBL_PC *sd = st->rid?map_id2sd(st->rid):NULL;
id = script_getnum(st,2);
if(!(md = (struct mob_data *)map_id2bl(id)) || md->bl.type != BL_MOB || !data_isreference(script_getdata(st,3)) ){
@@ -12874,7 +12867,7 @@ BUILDIN_FUNC(mobassist)
get_val(st, data);
if( data_isstring(data) )
{
- struct map_session_data* sd = map_nick2sd(conv_str(st, data));
+ TBL_PC* sd = map_nick2sd(conv_str(st, data));
if( sd != NULL )
target_bl = &sd->bl;
}
@@ -13026,7 +13019,7 @@ BUILDIN_FUNC(unitattack)
get_val(st, data);
if( data_isstring(data) )
{
- struct map_session_data* sd = map_nick2sd(conv_str(st, data));
+ TBL_PC* sd = map_nick2sd(conv_str(st, data));
if( sd != NULL )
target_bl = &sd->bl;
} else