summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorSusu <bruant.bastien@gmail.com>2013-06-07 20:03:32 +0200
committerSusu <bruant.bastien@gmail.com>2013-06-07 20:03:32 +0200
commitd73783f22b2bb881aab74524d153d89a5932a199 (patch)
treefeea3cd428cee18be3da9bf0bee6d4570d9cad02 /src/map/script.c
parentdc7f14c7dc9829061f8902354367bdc8467eb841 (diff)
downloadhercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.gz
hercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.bz2
hercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.xz
hercules-d73783f22b2bb881aab74524d153d89a5932a199.zip
Hercules Renewal Phase One : pc, party, map, timer
Added iPc, iParty, iMap, iTimer to HPM exported interfaces
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c866
1 files changed, 433 insertions, 433 deletions
diff --git a/src/map/script.c b/src/map/script.c
index bd7d1a7b5..9569e526d 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -363,7 +363,7 @@ static void script_reportsrc(struct script_state *st)
if( st->oid == 0 )
return; //Can't report source.
- bl = map_id2bl(st->oid);
+ bl = iMap->id2bl(st->oid);
if( bl == NULL )
return;
@@ -2013,7 +2013,7 @@ static void read_constdb(void)
char line[1024],name[1024],val[1024];
int type;
- sprintf(line, "%s/const.txt", db_path);
+ sprintf(line, "%s/const.txt", iMap->db_path);
fp=fopen(line, "r");
if(fp==NULL){
ShowError("can't read %s\n", line);
@@ -2280,7 +2280,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
/// If there is no player attached, the script is terminated.
TBL_PC *script_rid2sd(struct script_state *st) {
TBL_PC *sd;
- if( !( sd = map_id2sd(st->rid) ) ){
+ if( !( sd = iMap->id2sd(st->rid) ) ){
ShowError("script_rid2sd: fatal error ! player not attached!\n");
script_reportfunc(st);
script_reportsrc(st);
@@ -2335,7 +2335,7 @@ void get_val(struct script_state* st, struct script_data* data)
switch( prefix )
{
case '@':
- data->u.str = pc_readregstr(sd, data->u.num);
+ data->u.str = iPc->readregstr(sd, data->u.num);
break;
case '$':
data->u.str = mapreg_readregstr(data->u.num);
@@ -2394,13 +2394,13 @@ void get_val(struct script_state* st, struct script_data* data)
}
else if( reference_toparam(data) )
{
- data->u.num = pc_readparam(sd, reference_getparamtype(data));
+ data->u.num = iPc->readparam(sd, reference_getparamtype(data));
}
else
switch( prefix )
{
case '@':
- data->u.num = pc_readreg(sd, data->u.num);
+ data->u.num = iPc->readreg(sd, data->u.num);
break;
case '$':
data->u.num = mapreg_readreg(data->u.num);
@@ -2467,7 +2467,7 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
const char* str = (const char*)value;
switch (prefix) {
case '@':
- return pc_setregstr(sd, num, str);
+ return iPc->setregstr(sd, num, str);
case '$':
return mapreg_setregstr(num, str);
case '#':
@@ -2499,7 +2499,7 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
int val = (int)__64BPTRSIZE(value);
if(str_data[num&0x00ffffff].type == C_PARAM)
{
- if( pc_setparam(sd, str_data[num&0x00ffffff].val, val) == 0 )
+ if( iPc->setparam(sd, str_data[num&0x00ffffff].val, val) == 0 )
{
if( st != NULL )
{
@@ -2514,7 +2514,7 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
switch (prefix) {
case '@':
- return pc_setreg(sd, num, val);
+ return iPc->setreg(sd, num, val);
case '$':
return mapreg_setreg(num, val);
case '#':
@@ -2831,7 +2831,7 @@ void script_free_state(struct script_state* st)
ShowDebug("script_free_state: Previous script state lost (rid=%d, oid=%d, state=%d, bk_npcid=%d).\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid);
}
if( st->sleep.timer != INVALID_TIMER )
- delete_timer(st->sleep.timer, run_script_timer);
+ iTimer->delete_timer(st->sleep.timer, run_script_timer);
script_free_vars(st->stack->var_function);
pop_stack(st, 0, st->stack->sp);
aFree(st->stack->stack_data);
@@ -3355,7 +3355,7 @@ int run_script_timer(int tid, unsigned int tick, int id, intptr_t data)
{
struct script_state *st = (struct script_state *)data;
struct linkdb_node *node = (struct linkdb_node *)sleep_db;
- TBL_PC *sd = map_id2sd(st->rid);
+ TBL_PC *sd = iMap->id2sd(st->rid);
if((sd && sd->status.char_id != id) || (st->rid && !sd))
{ //Character mismatch. Cancel execution.
@@ -3384,7 +3384,7 @@ static void script_detach_state(struct script_state* st, bool dequeue_event)
{
struct map_session_data* sd;
- if(st->rid && (sd = map_id2sd(st->rid))!=NULL) {
+ if(st->rid && (sd = iMap->id2sd(st->rid))!=NULL) {
sd->st = st->bk_st;
sd->npc_id = st->bk_npcid;
sd->state.dialog = 0;
@@ -3423,7 +3423,7 @@ static void script_attach_state(struct script_state* st)
{
struct map_session_data* sd;
- if(st->rid && (sd = map_id2sd(st->rid))!=NULL)
+ if(st->rid && (sd = iMap->id2sd(st->rid))!=NULL)
{
if(st!=sd->st)
{
@@ -3461,7 +3461,7 @@ void run_script_main(struct script_state *st)
script_attach_state(st);
- nd = map_id2nd(st->oid);
+ nd = iMap->id2nd(st->oid);
if( nd && nd->bl.m >= 0 )
st->instance_id = map[nd->bl.m].instance_id;
else
@@ -3566,9 +3566,9 @@ void run_script_main(struct script_state *st)
//Restore previous script
script_detach_state(st, false);
//Delay execution
- sd = map_id2sd(st->rid); // Get sd since script might have attached someone while running. [Inkfish]
+ sd = iMap->id2sd(st->rid); // Get sd since script might have attached someone while running. [Inkfish]
st->sleep.charid = sd?sd->status.char_id:0;
- st->sleep.timer = add_timer(gettick()+st->sleep.tick,
+ st->sleep.timer = iTimer->add_timer(iTimer->gettick()+st->sleep.tick,
run_script_timer, st->sleep.charid, (intptr_t)st);
linkdb_insert(&sleep_db, (void*)__64BPTRSIZE(st->oid), st);
}
@@ -3587,7 +3587,7 @@ void run_script_main(struct script_state *st)
}
} else {
//Dispose of script.
- if ((sd = map_id2sd(st->rid))!=NULL) { //Restore previous stack and save char.
+ if ((sd = iMap->id2sd(st->rid))!=NULL) { //Restore previous stack and save char.
if(sd->state.using_fake_npc){
clif->clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
sd->state.using_fake_npc = 0;
@@ -3659,7 +3659,7 @@ int script_config_read(char *cfgName)
*/
static int db_script_free_code_sub(DBKey key, DBData *data, va_list ap)
{
- struct script_code *code = DB->data2ptr(data);
+ struct script_code *code = iDB->data2ptr(data);
if (code)
script_free_code(code);
return 0;
@@ -3706,14 +3706,14 @@ void script_cleararray_pc(struct map_session_data* sd, const char* varname, void
{
for( idx = 0; idx < SCRIPT_MAX_ARRAYSIZE; idx++ )
{
- pc_setregstr(sd, reference_uid(key, idx), (const char*)value);
+ iPc->setregstr(sd, reference_uid(key, idx), (const char*)value);
}
}
else
{
for( idx = 0; idx < SCRIPT_MAX_ARRAYSIZE; idx++ )
{
- pc_setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
+ iPc->setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
}
}
}
@@ -3741,11 +3741,11 @@ void script_setarray_pc(struct map_session_data* sd, const char* varname, uint8
if( is_string_variable(varname) )
{
- pc_setregstr(sd, reference_uid(key, idx), (const char*)value);
+ iPc->setregstr(sd, reference_uid(key, idx), (const char*)value);
}
else
{
- pc_setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
+ iPc->setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
}
if( refcache )
@@ -4103,7 +4103,7 @@ BUILDIN(menu)
* menus beyond this length crash the client (see bugreport:6402)
**/
if( StrBuf->Length(&buf) >= 2047 ) {
- struct npc_data * nd = map_id2nd(st->oid);
+ struct npc_data * nd = iMap->id2nd(st->oid);
char* menu;
CREATE(menu, char, 2048);
safestrncpy(menu, StrBuf->Value(&buf), 2047);
@@ -4159,7 +4159,7 @@ BUILDIN(menu)
st->state = END;
return false;
}
- pc_setreg(sd, add_str("@menu"), menu);
+ iPc->setreg(sd, add_str("@menu"), menu);
st->pos = script_getnum(st, i + 1);
st->state = GOTO;
}
@@ -4208,7 +4208,7 @@ BUILDIN(select)
* menus beyond this length crash the client (see bugreport:6402)
**/
if( StrBuf->Length(&buf) >= 2047 ) {
- struct npc_data * nd = map_id2nd(st->oid);
+ struct npc_data * nd = iMap->id2nd(st->oid);
char* menu;
CREATE(menu, char, 2048);
safestrncpy(menu, StrBuf->Value(&buf), 2047);
@@ -4236,7 +4236,7 @@ BUILDIN(select)
if( sd->npc_menu <= 0 )
break;// entry found
}
- pc_setreg(sd, add_str("@menu"), menu);
+ iPc->setreg(sd, add_str("@menu"), menu);
script_pushint(st, menu);
st->state = RUN;
}
@@ -4287,7 +4287,7 @@ BUILDIN(prompt)
* menus beyond this length crash the client (see bugreport:6402)
**/
if( StrBuf->Length(&buf) >= 2047 ) {
- struct npc_data * nd = map_id2nd(st->oid);
+ struct npc_data * nd = iMap->id2nd(st->oid);
char* menu;
CREATE(menu, char, 2048);
safestrncpy(menu, StrBuf->Value(&buf), 2047);
@@ -4307,7 +4307,7 @@ BUILDIN(prompt)
else if( sd->npc_menu == 0xff )
{// Cancel was pressed
sd->state.menu_or_input = 0;
- pc_setreg(sd, add_str("@menu"), 0xff);
+ iPc->setreg(sd, add_str("@menu"), 0xff);
script_pushint(st, 0xff);
st->state = RUN;
}
@@ -4323,7 +4323,7 @@ BUILDIN(prompt)
if( sd->npc_menu <= 0 )
break;// entry found
}
- pc_setreg(sd, add_str("@menu"), menu);
+ iPc->setreg(sd, add_str("@menu"), menu);
script_pushint(st, menu);
st->state = RUN;
}
@@ -4569,11 +4569,11 @@ BUILDIN(warp)
y = script_getnum(st,4);
if(strcmp(str,"Random")==0)
- ret = pc_randomwarp(sd,CLR_TELEPORT);
+ ret = iPc->randomwarp(sd,CLR_TELEPORT);
else if(strcmp(str,"SavePoint")==0 || strcmp(str,"Save")==0)
- ret = pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ ret = iPc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
else
- ret = pc_setpos(sd,mapindex_name2id(str),x,y,CLR_OUTSIGHT);
+ ret = iPc->setpos(sd,mapindex_name2id(str),x,y,CLR_OUTSIGHT);
if( ret ) {
ShowError("buildin_warp: moving player '%s' to \"%s\",%d,%d failed.\n", sd->status.name, str, x, y);
@@ -4597,7 +4597,7 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
y3 = va_arg(ap,int);
if(index == 0)
- pc_randomwarp((TBL_PC *)bl,CLR_TELEPORT);
+ iPc->randomwarp((TBL_PC *)bl,CLR_TELEPORT);
else if(x3 && y3) {
int max, tx, ty, j = 0;
@@ -4610,12 +4610,12 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
tx = rnd()%(x3-x2+1)+x2;
ty = rnd()%(y3-y2+1)+y2;
j++;
- } while( map_getcell(index,tx,ty,CELL_CHKNOPASS) && j < max );
+ } while( iMap->getcell(index,tx,ty,CELL_CHKNOPASS) && j < max );
- pc_setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
+ iPc->setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
}
else
- pc_setpos((TBL_PC *)bl,index,x2,y2,CLR_OUTSIGHT);
+ iPc->setpos((TBL_PC *)bl,index,x2,y2,CLR_OUTSIGHT);
return 0;
}
BUILDIN(areawarp)
@@ -4645,7 +4645,7 @@ BUILDIN(areawarp)
}
}
- if( (m = map_mapname2mapid(mapname)) < 0 )
+ if( (m = iMap->mapname2mapid(mapname)) < 0 )
return true;
if( strcmp(str,"Random") == 0 )
@@ -4653,7 +4653,7 @@ BUILDIN(areawarp)
else if( !(index=mapindex_name2id(str)) )
return true;
- map_foreachinarea(buildin_areawarp_sub, m,x0,y0,x1,y1, BL_PC, index,x2,y2,x3,y3);
+ iMap->foreachinarea(buildin_areawarp_sub, m,x0,y0,x1,y1, BL_PC, index,x2,y2,x3,y3);
return true;
}
@@ -4665,7 +4665,7 @@ static int buildin_areapercentheal_sub(struct block_list *bl,va_list ap)
int hp, sp;
hp = va_arg(ap, int);
sp = va_arg(ap, int);
- pc_percentheal((TBL_PC *)bl,hp,sp);
+ iPc->percentheal((TBL_PC *)bl,hp,sp);
return 0;
}
BUILDIN(areapercentheal)
@@ -4682,10 +4682,10 @@ BUILDIN(areapercentheal)
hp=script_getnum(st,7);
sp=script_getnum(st,8);
- if( (m=map_mapname2mapid(mapname))< 0)
+ if( (m=iMap->mapname2mapid(mapname))< 0)
return true;
- map_foreachinarea(buildin_areapercentheal_sub,m,x0,y0,x1,y1,BL_PC,hp,sp);
+ iMap->foreachinarea(buildin_areapercentheal_sub,m,x0,y0,x1,y1,BL_PC,hp,sp);
return true;
}
@@ -4706,17 +4706,17 @@ BUILDIN(warpchar)
y=script_getnum(st,4);
a=script_getnum(st,5);
- sd = map_charid2sd(a);
+ sd = iMap->charid2sd(a);
if( sd == NULL )
return true;
if(strcmp(str, "Random") == 0)
- pc_randomwarp(sd, CLR_TELEPORT);
+ iPc->randomwarp(sd, CLR_TELEPORT);
else
if(strcmp(str, "SavePoint") == 0)
- pc_setpos(sd, sd->status.save_point.map,sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
+ iPc->setpos(sd, sd->status.save_point.map,sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
else
- pc_setpos(sd, mapindex_name2id(str), x, y, CLR_TELEPORT);
+ iPc->setpos(sd, mapindex_name2id(str), x, y, CLR_TELEPORT);
return true;
}
@@ -4742,7 +4742,7 @@ BUILDIN(warpparty)
if ( script_hasdata(st,6) )
str2 = script_getstr(st,6);
- p = party_search(p_id);
+ p = iParty->search(p_id);
if(!p)
return true;
@@ -4790,20 +4790,20 @@ BUILDIN(warpparty)
{
case 0: // Random
if(!map[pl_sd->bl.m].flag.nowarp)
- pc_randomwarp(pl_sd,CLR_TELEPORT);
+ iPc->randomwarp(pl_sd,CLR_TELEPORT);
break;
case 1: // SavePointAll
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
break;
case 2: // SavePoint
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
case 3: // Leader
case 4: // m,x,y
if(!map[pl_sd->bl.m].flag.noreturn && !map[pl_sd->bl.m].flag.nowarp)
- pc_setpos(pl_sd,mapindex,x,y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,mapindex,x,y,CLR_TELEPORT);
break;
}
}
@@ -4851,19 +4851,19 @@ BUILDIN(warpguild)
{
case 0: // Random
if(!map[pl_sd->bl.m].flag.nowarp)
- pc_randomwarp(pl_sd,CLR_TELEPORT);
+ iPc->randomwarp(pl_sd,CLR_TELEPORT);
break;
case 1: // SavePointAll
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
break;
case 2: // SavePoint
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
case 3: // m,x,y
if(!map[pl_sd->bl.m].flag.noreturn && !map[pl_sd->bl.m].flag.nowarp)
- pc_setpos(pl_sd,mapindex_name2id(str),x,y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,mapindex_name2id(str),x,y,CLR_TELEPORT);
break;
}
}
@@ -4906,7 +4906,7 @@ BUILDIN(itemheal)
sd = script_rid2sd(st);
if (!sd) return true;
- pc_itemheal(sd,sd->itemid,hp,sp);
+ iPc->itemheal(sd,sd->itemid,hp,sp);
return true;
}
/*==========================================
@@ -4933,7 +4933,7 @@ BUILDIN(percentheal)
if( sd->sc.data[SC_EXTREMITYFIST2] )
sp = 0;
#endif
- pc_percentheal(sd,hp,sp);
+ iPc->percentheal(sd,hp,sp);
return true;
}
@@ -4956,7 +4956,7 @@ BUILDIN(jobchange)
if( sd == NULL )
return true;
- pc_jobchange(sd, job, upper);
+ iPc->jobchange(sd, job, upper);
}
return true;
@@ -4968,7 +4968,7 @@ BUILDIN(jobchange)
BUILDIN(jobname)
{
int class_=script_getnum(st,2);
- script_pushconststr(st, (char*)job_name(class_));
+ script_pushconststr(st, (char*)iPc->job_name(class_));
return true;
}
@@ -5530,7 +5530,7 @@ BUILDIN(setlook)
if( sd == NULL )
return true;
- pc_changelook(sd,type,val);
+ iPc->changelook(sd,type,val);
return true;
}
@@ -5719,7 +5719,7 @@ BUILDIN(checkweight)
script_pushint(st,0);
return false;
}
- slots = pc_inventoryblank(sd); //nb of empty slot
+ slots = iPc->inventoryblank(sd); //nb of empty slot
for(i=2; i<nbargs; i=i+2){
data = script_getdata(st,i);
@@ -5750,7 +5750,7 @@ BUILDIN(checkweight)
return true;
}
- switch( pc_checkadditem(sd, nameid, amount) )
+ switch( iPc->checkadditem(sd, nameid, amount) )
{
case ADDITEM_EXIST:
// item is already in inventory, but there is still space for the requested amount
@@ -5833,7 +5833,7 @@ BUILDIN(checkweight2)
fail = 1;
}
- slots = pc_inventoryblank(sd);
+ slots = iPc->inventoryblank(sd);
for(i=0; i<nb_it; i++){
nameid = (int32)__64BPTRSIZE(get_val2(st,reference_uid(id_it,idx_it+i),reference_getref(data_it)));
script_removetop(st, -1, 0);
@@ -5856,7 +5856,7 @@ BUILDIN(checkweight2)
fail = 1;
continue;
}
- switch( pc_checkadditem(sd, nameid, amount) ) {
+ switch( iPc->checkadditem(sd, nameid, amount) ) {
case ADDITEM_EXIST:
// item is already in inventory, but there is still space for the requested amount
break;
@@ -5932,7 +5932,7 @@ BUILDIN(getitem)
it.identify=itemdb_isidentified2(item_data);
if( script_hasdata(st,4) )
- sd=map_id2sd(script_getnum(st,4)); // <Account ID>
+ sd=iMap->id2sd(script_getnum(st,4)); // <Account ID>
else
sd=script_rid2sd(st); // Attached player
@@ -5950,11 +5950,11 @@ BUILDIN(getitem)
// if not pet egg
if (!pet_create_egg(sd, nameid))
{
- if ((flag = pc_additem(sd, &it, get_count, LOG_TYPE_SCRIPT)))
+ if ((flag = iPc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT)))
{
clif->additem(sd, 0, 0, flag);
- if( pc_candrop(sd,&it) )
- map_addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ if( iPc->candrop(sd,&it) )
+ iMap->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -5975,7 +5975,7 @@ BUILDIN(getitem2)
struct script_data *data;
if( script_hasdata(st,11) )
- sd=map_id2sd(script_getnum(st,11)); // <Account ID>
+ sd=iMap->id2sd(script_getnum(st,11)); // <Account ID>
else
sd=script_rid2sd(st); // Attached player
@@ -6048,11 +6048,11 @@ BUILDIN(getitem2)
// if not pet egg
if (!pet_create_egg(sd, nameid))
{
- if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT)))
+ if ((flag = iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT)))
{
clif->additem(sd, 0, 0, flag);
- if( pc_candrop(sd,&item_tmp) )
- map_addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ if( iPc->candrop(sd,&item_tmp) )
+ iMap->addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -6111,7 +6111,7 @@ BUILDIN(rentitem)
it.identify = 1;
it.expire_time = (unsigned int)(time(NULL) + seconds);
- if( (flag = pc_additem(sd, &it, 1, LOG_TYPE_SCRIPT)) )
+ if( (flag = iPc->additem(sd, &it, 1, LOG_TYPE_SCRIPT)) )
{
clif->additem(sd, 0, 0, flag);
return false;
@@ -6163,9 +6163,9 @@ BUILDIN(getnameditem)
data=script_getdata(st,3);
get_val(st,data);
if( data_isstring(data) ) //Char Name
- tsd=map_nick2sd(script->conv_str(st,data));
+ tsd=iMap->nick2sd(script->conv_str(st,data));
else //Char Id was given
- tsd=map_charid2sd(script->conv_num(st,data));
+ tsd=iMap->charid2sd(script->conv_num(st,data));
if( tsd == NULL )
{ //Failed
@@ -6180,7 +6180,7 @@ BUILDIN(getnameditem)
item_tmp.card[0]=CARD0_CREATE; //we don't use 255! because for example SIGNED WEAPON shouldn't get TOP10 BS Fame bonus [Lupus]
item_tmp.card[2]=tsd->status.char_id;
item_tmp.card[3]=tsd->status.char_id >> 16;
- if(pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT)) {
+ if(iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT)) {
script_pushint(st,0);
return true; //Failed to add item, we will not drop if they don't fit
}
@@ -6241,7 +6241,7 @@ BUILDIN(makeitem)
if (!sd) return true; //Failed...
m=sd->bl.m;
} else
- m=map_mapname2mapid(mapname);
+ m=iMap->mapname2mapid(mapname);
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid=nameid;
@@ -6250,7 +6250,7 @@ BUILDIN(makeitem)
else
item_tmp.identify=itemdb_isidentified2(item_data);
- map_addflooritem(&item_tmp,amount,m,x,y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,amount,m,x,y,0,0,0,0);
return true;
}
@@ -6272,7 +6272,7 @@ static void buildin_delitem_delete(struct map_session_data* sd, int idx, int* am
{// delete associated pet
intif_delete_petdata(MakeDWord(inv->card[1], inv->card[2]));
}
- pc_delitem(sd, idx, delamount, 0, 0, LOG_TYPE_SCRIPT);
+ iPc->delitem(sd, idx, delamount, 0, 0, LOG_TYPE_SCRIPT);
}
amount[0]-= delamount;
@@ -6411,7 +6411,7 @@ BUILDIN(delitem)
if( script_hasdata(st,4) )
{
int account_id = script_getnum(st,4);
- sd = map_id2sd(account_id); // <account id>
+ sd = iMap->id2sd(account_id); // <account id>
if( sd == NULL )
{
ShowError("script:delitem: player not found (AID=%d).\n", account_id);
@@ -6480,7 +6480,7 @@ BUILDIN(delitem2)
if( script_hasdata(st,11) )
{
int account_id = script_getnum(st,11);
- sd = map_id2sd(account_id); // <account id>
+ sd = iMap->id2sd(account_id); // <account id>
if( sd == NULL )
{
ShowError("script:delitem2: player not found (AID=%d).\n", account_id);
@@ -6566,7 +6566,7 @@ BUILDIN(disableitemuse)
/*==========================================
* return the basic stats of sd
- * chk pc_readparam for available type
+ * chk iPc->readparam for available type
*------------------------------------------*/
BUILDIN(readparam)
{
@@ -6575,7 +6575,7 @@ BUILDIN(readparam)
type=script_getnum(st,2);
if( script_hasdata(st,3) )
- sd=map_nick2sd(script_getstr(st,3));
+ sd=iMap->nick2sd(script_getstr(st,3));
else
sd=script_rid2sd(st);
@@ -6584,7 +6584,7 @@ BUILDIN(readparam)
return true;
}
- script_pushint(st,pc_readparam(sd,type));
+ script_pushint(st,iPc->readparam(sd,type));
return true;
}
@@ -6605,7 +6605,7 @@ BUILDIN(getcharid)
num = script_getnum(st,2);
if( script_hasdata(st,3) )
- sd=map_nick2sd(script_getstr(st,3));
+ sd=iMap->nick2sd(script_getstr(st,3));
else
sd=script_rid2sd(st);
@@ -6670,7 +6670,7 @@ BUILDIN(getpartyname)
party_id = script_getnum(st,2);
- if( ( p = party_search(party_id) ) != NULL )
+ if( ( p = iParty->search(party_id) ) != NULL )
{
script_pushstrcopy(st,p->party.name);
}
@@ -6694,7 +6694,7 @@ BUILDIN(getpartymember)
struct party_data *p;
int i,j=0,type=0;
- p=party_search(script_getnum(st,2));
+ p=iParty->search(script_getnum(st,2));
if( script_hasdata(st,3) )
type=script_getnum(st,3);
@@ -6734,7 +6734,7 @@ BUILDIN(getpartyleader)
if( script_hasdata(st,3) )
type=script_getnum(st,3);
- p=party_search(party_id);
+ p=iParty->search(party_id);
if (p) //Search leader
for(i = 0; i < MAX_PARTY && !p->party.member[i].leader; i++);
@@ -6847,7 +6847,7 @@ BUILDIN(strcharinfo)
script_pushstrcopy(st,sd->status.name);
break;
case 1:
- if( ( p = party_search(sd->status.party_id) ) != NULL ) {
+ if( ( p = iParty->search(sd->status.party_id) ) != NULL ) {
script_pushstrcopy(st,p->party.name);
} else {
script_pushconststr(st,"");
@@ -6887,7 +6887,7 @@ BUILDIN(strnpcinfo)
int num;
char *buf,*name=NULL;
- nd = map_id2nd(st->oid);
+ nd = iMap->id2nd(st->oid);
if (!nd) {
script_pushconststr(st, "");
return true;
@@ -6951,7 +6951,7 @@ BUILDIN(getequipid)
}
// get inventory position of item
- i = pc_checkequip(sd,equip[num]);
+ i = iPc->checkequip(sd,equip[num]);
if( i < 0 )
{
script_pushint(st,-1);
@@ -6989,7 +6989,7 @@ BUILDIN(getequipname)
}
// get inventory position of item
- i = pc_checkequip(sd,equip[num]);
+ i = iPc->checkequip(sd,equip[num]);
if( i < 0 )
{
script_pushconststr(st,"");
@@ -7108,7 +7108,7 @@ BUILDIN(getequipisequiped)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0)
script_pushint(st,1);
@@ -7135,7 +7135,7 @@ BUILDIN(getequipisenableref)
return true;
if( num > 0 && num <= ARRAYLENGTH(equip) )
- i = pc_checkequip(sd,equip[num-1]);
+ i = iPc->checkequip(sd,equip[num-1]);
if( i >= 0 && sd->inventory_data[i] && !sd->inventory_data[i]->flag.no_refine && !sd->status.inventory[i].expire_time )
script_pushint(st,1);
else
@@ -7161,7 +7161,7 @@ BUILDIN(getequipisidentify)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0)
script_pushint(st,sd->status.inventory[i].identify);
else
@@ -7187,7 +7187,7 @@ BUILDIN(getequiprefinerycnt)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0)
script_pushint(st,sd->status.inventory[i].refine);
else
@@ -7214,7 +7214,7 @@ BUILDIN(getequipweaponlv)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0 && sd->inventory_data[i])
script_pushint(st,sd->inventory_data[i]->wlv);
else
@@ -7240,7 +7240,7 @@ BUILDIN(getequippercentrefinery)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0 && sd->status.inventory[i].nameid && sd->status.inventory[i].refine < MAX_REFINE)
script_pushint(st,status_get_refine_chance(itemdb_wlv(sd->status.inventory[i].nameid), (int)sd->status.inventory[i].refine));
else
@@ -7263,7 +7263,7 @@ BUILDIN(successrefitem)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0) {
ep=sd->status.inventory[i].equip;
@@ -7271,7 +7271,7 @@ BUILDIN(successrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]);
sd->status.inventory[i].refine++;
- pc_unequipitem(sd,i,2); // status calc will happen in pc_equipitem() below
+ iPc->unequipitem(sd,i,2); // status calc will happen in iPc->equipitem() below
clif->refine(sd->fd,0,i,sd->status.inventory[i].refine);
clif->delitem(sd,i,1,3);
@@ -7280,7 +7280,7 @@ BUILDIN(successrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]);
clif->additem(sd,i,1,0);
- pc_equipitem(sd,i,ep);
+ iPc->equipitem(sd,i,ep);
clif->misceffect(&sd->bl,3);
if(sd->status.inventory[i].refine == 10 &&
sd->status.inventory[i].card[0] == CARD0_FORGE &&
@@ -7288,13 +7288,13 @@ BUILDIN(successrefitem)
){ // Fame point system [DracoRPG]
switch (sd->inventory_data[i]->wlv){
case 1:
- pc_addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
+ iPc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
break;
case 2:
- pc_addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
+ iPc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
break;
case 3:
- pc_addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
+ iPc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
break;
}
}
@@ -7317,13 +7317,13 @@ BUILDIN(failedrefitem)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0) {
sd->status.inventory[i].refine = 0;
- pc_unequipitem(sd,i,3); //recalculate bonus
+ iPc->unequipitem(sd,i,3); //recalculate bonus
clif->refine(sd->fd,1,i,sd->status.inventory[i].refine); //notify client of failure
- pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
clif->misceffect(&sd->bl,2); // display failure effect
}
@@ -7345,7 +7345,7 @@ BUILDIN(downrefitem)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i = pc_checkequip(sd,equip[num-1]);
+ i = iPc->checkequip(sd,equip[num-1]);
if(i >= 0) {
ep = sd->status.inventory[i].equip;
@@ -7353,7 +7353,7 @@ BUILDIN(downrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]);
sd->status.inventory[i].refine++;
- pc_unequipitem(sd,i,2); // status calc will happen in pc_equipitem() below
+ iPc->unequipitem(sd,i,2); // status calc will happen in iPc->equipitem() below
clif->refine(sd->fd,2,i,sd->status.inventory[i].refine = sd->status.inventory[i].refine - 2);
clif->delitem(sd,i,1,3);
@@ -7362,7 +7362,7 @@ BUILDIN(downrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]);
clif->additem(sd,i,1,0);
- pc_equipitem(sd,i,ep);
+ iPc->equipitem(sd,i,ep);
clif->misceffect(&sd->bl,2);
}
@@ -7383,10 +7383,10 @@ BUILDIN(delequip)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0) {
- pc_unequipitem(sd,i,3); //recalculate bonus
- pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ iPc->unequipitem(sd,i,3); //recalculate bonus
+ iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
}
return true;
@@ -7405,7 +7405,7 @@ BUILDIN(statusup)
if( sd == NULL )
return true;
- pc_statusup(sd,type);
+ iPc->statusup(sd,type);
return true;
}
@@ -7423,7 +7423,7 @@ BUILDIN(statusup2)
if( sd == NULL )
return true;
- pc_statusup2(sd,type,val);
+ iPc->statusup2(sd,type,val);
return true;
}
@@ -7477,16 +7477,16 @@ BUILDIN(bonus)
switch( script_lastdata(st)-2 ) {
case 1:
- pc_bonus(sd, type, val1);
+ iPc->bonus(sd, type, val1);
break;
case 2:
val2 = script_getnum(st,4);
- pc_bonus2(sd, type, val1, val2);
+ iPc->bonus2(sd, type, val1, val2);
break;
case 3:
val2 = script_getnum(st,4);
val3 = script_getnum(st,5);
- pc_bonus3(sd, type, val1, val2, val3);
+ iPc->bonus3(sd, type, val1, val2, val3);
break;
case 4:
if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) )
@@ -7496,7 +7496,7 @@ BUILDIN(bonus)
val3 = script_getnum(st,5);
val4 = script_getnum(st,6);
- pc_bonus4(sd, type, val1, val2, val3, val4);
+ iPc->bonus4(sd, type, val1, val2, val3, val4);
break;
case 5:
if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) )
@@ -7507,7 +7507,7 @@ BUILDIN(bonus)
val3 = script_getnum(st,5);
val4 = script_getnum(st,6);
val5 = script_getnum(st,7);
- pc_bonus5(sd, type, val1, val2, val3, val4, val5);
+ iPc->bonus5(sd, type, val1, val2, val3, val4, val5);
break;
default:
ShowDebug("buildin_bonus: unexpected number of arguments (%d)\n", (script_lastdata(st) - 1));
@@ -7543,7 +7543,7 @@ BUILDIN(autobonus)
if( script_hasdata(st,6) )
other_script = script_getstr(st,6);
- if( pc_addautobonus(sd->autobonus,ARRAYLENGTH(sd->autobonus),
+ if( iPc->addautobonus(sd->autobonus,ARRAYLENGTH(sd->autobonus),
bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[current_equip_item_index].equip,false) )
{
script_add_autobonus(bonus_script);
@@ -7580,7 +7580,7 @@ BUILDIN(autobonus2)
if( script_hasdata(st,6) )
other_script = script_getstr(st,6);
- if( pc_addautobonus(sd->autobonus2,ARRAYLENGTH(sd->autobonus2),
+ if( iPc->addautobonus(sd->autobonus2,ARRAYLENGTH(sd->autobonus2),
bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[current_equip_item_index].equip,false) )
{
script_add_autobonus(bonus_script);
@@ -7615,7 +7615,7 @@ BUILDIN(autobonus3)
if( script_hasdata(st,6) )
other_script = script_getstr(st,6);
- if( pc_addautobonus(sd->autobonus3,ARRAYLENGTH(sd->autobonus3),
+ if( iPc->addautobonus(sd->autobonus3,ARRAYLENGTH(sd->autobonus3),
bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[current_equip_item_index].equip,true) )
{
script_add_autobonus(bonus_script);
@@ -7651,7 +7651,7 @@ BUILDIN(skill)
level = script_getnum(st,3);
if( script_hasdata(st,4) )
flag = script_getnum(st,4);
- pc_skill(sd, id, level, flag);
+ iPc->skill(sd, id, level, flag);
return true;
}
@@ -7680,7 +7680,7 @@ BUILDIN(addtoskill)
level = script_getnum(st,3);
if( script_hasdata(st,4) )
flag = script_getnum(st,4);
- pc_skill(sd, id, level, flag);
+ iPc->skill(sd, id, level, flag);
return true;
}
@@ -7722,7 +7722,7 @@ BUILDIN(getskilllv)
return true;// no player attached, report source
id = ( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
- script_pushint(st, pc_checkskill(sd,id));
+ script_pushint(st, iPc->checkskill(sd,id));
return true;
}
@@ -7770,7 +7770,7 @@ BUILDIN(getgmlevel)
if( sd == NULL )
return true;// no player attached, report source
- script_pushint(st, pc_get_group_level(sd));
+ script_pushint(st, iPc->get_group_level(sd));
return true;
}
@@ -7891,9 +7891,9 @@ BUILDIN(setoption)
if( flag ){// Add option
if( option&OPTION_WEDDING && !battle_config.wedding_modifydisplay )
option &= ~OPTION_WEDDING;// Do not show the wedding sprites
- pc_setoption(sd, sd->sc.option|option);
+ iPc->setoption(sd, sd->sc.option|option);
} else// Remove option
- pc_setoption(sd, sd->sc.option&~option);
+ iPc->setoption(sd, sd->sc.option&~option);
return true;
}
@@ -7941,7 +7941,7 @@ BUILDIN(setcart)
if( script_hasdata(st,2) )
type = script_getnum(st,2);
- pc_setcart(sd, type);
+ iPc->setcart(sd, type);
return true;
}
@@ -7984,7 +7984,7 @@ BUILDIN(setfalcon)
if( script_hasdata(st,2) )
flag = script_getnum(st,2);
- pc_setfalcon(sd, flag);
+ iPc->setfalcon(sd, flag);
return true;
}
@@ -8026,7 +8026,7 @@ BUILDIN(setriding)
if( script_hasdata(st,2) )
flag = script_getnum(st,2);
- pc_setriding(sd, flag);
+ iPc->setriding(sd, flag);
return true;
}
@@ -8087,7 +8087,7 @@ BUILDIN(setmadogear)
if( script_hasdata(st,2) )
flag = script_getnum(st,2);
- pc_setmadogear(sd, flag);
+ iPc->setmadogear(sd, flag);
return true;
}
@@ -8113,7 +8113,7 @@ BUILDIN(savepoint)
y = script_getnum(st,4);
map = mapindex_name2id(str);
if( map )
- pc_setsavepoint(sd, map, x, y);
+ iPc->setsavepoint(sd, map, x, y);
return true;
}
@@ -8144,7 +8144,7 @@ BUILDIN(gettimetick) /* Asgard Version */
case 0:
default:
//type 0:(System Ticks)
- script_pushint(st,gettick());
+ script_pushint(st,iTimer->gettick());
break;
}
return true;
@@ -8360,7 +8360,7 @@ BUILDIN(getexp)
base = (int) cap_value(base * bonus, 0, INT_MAX);
job = (int) cap_value(job * bonus, 0, INT_MAX);
- pc_gainexp(sd, NULL, base, job, true);
+ iPc->gainexp(sd, NULL, base, job, true);
return true;
}
@@ -8397,7 +8397,7 @@ BUILDIN(guildchangegm)
guild_id = script_getnum(st,2);
name = script_getstr(st,3);
- sd=map_nick2sd(name);
+ sd=iMap->nick2sd(name);
if (!sd)
script_pushint(st,0);
@@ -8463,12 +8463,12 @@ BUILDIN(monster)
return false;
}
- sd = map_id2sd(st->rid);
+ sd = iMap->id2sd(st->rid);
if (sd && strcmp(mapn, "this") == 0)
m = sd->bl.m;
else {
- m = map_mapname2mapid(mapn);
+ m = iMap->mapname2mapid(mapn);
if (map[m].flag.src4instance && st->instance_id >= 0) { // Try to redirect to the instance map, not the src map
if ((m = instance->mapid2imapid(m, st->instance_id)) < 0) {
ShowError("buildin_monster: Trying to spawn monster (%d) on instance map (%s) without instance attached.\n", class_, mapn);
@@ -8558,12 +8558,12 @@ BUILDIN(areamonster)
}
}
- sd = map_id2sd(st->rid);
+ sd = iMap->id2sd(st->rid);
if (sd && strcmp(mapn, "this") == 0)
m = sd->bl.m;
else {
- m = map_mapname2mapid(mapn);
+ m = iMap->mapname2mapid(mapn);
if (map[m].flag.src4instance && st->instance_id >= 0) { // Try to redirect to the instance map, not the src map
if ((m = instance->mapid2imapid(m, st->instance_id)) < 0) {
ShowError("buildin_areamonster: Trying to spawn monster (%d) on instance map (%s) without instance attached.\n", class_, mapn);
@@ -8624,7 +8624,7 @@ BUILDIN(killmonster)
else
check_event(st, event);
- if( (m=map_mapname2mapid(mapname))<0 )
+ if( (m=iMap->mapname2mapid(mapname))<0 )
return true;
if( map[m].flag.src4instance && st->instance_id >= 0 && (m = instance->mapid2imapid(m, st->instance_id)) < 0 )
@@ -8632,14 +8632,14 @@ BUILDIN(killmonster)
if( script_hasdata(st,4) ) {
if ( script_getnum(st,4) == 1 ) {
- map_foreachinmap(buildin_killmonster_sub, m, BL_MOB, event ,allflag);
+ iMap->foreachinmap(buildin_killmonster_sub, m, BL_MOB, event ,allflag);
return true;
}
}
- map_freeblock_lock();
- map_foreachinmap(buildin_killmonster_sub_strip, m, BL_MOB, event ,allflag);
- map_freeblock_unlock();
+ iMap->freeblock_lock();
+ iMap->foreachinmap(buildin_killmonster_sub_strip, m, BL_MOB, event ,allflag);
+ iMap->freeblock_unlock();
return true;
}
@@ -8665,7 +8665,7 @@ BUILDIN(killmonsterall)
int16 m;
mapname=script_getstr(st,2);
- if( (m = map_mapname2mapid(mapname))<0 )
+ if( (m = iMap->mapname2mapid(mapname))<0 )
return true;
if( map[m].flag.src4instance && st->instance_id >= 0 && (m = instance->mapid2imapid(m, st->instance_id)) < 0 )
@@ -8673,12 +8673,12 @@ BUILDIN(killmonsterall)
if( script_hasdata(st,3) ) {
if ( script_getnum(st,3) == 1 ) {
- map_foreachinmap(buildin_killmonsterall_sub,m,BL_MOB);
+ iMap->foreachinmap(buildin_killmonsterall_sub,m,BL_MOB);
return true;
}
}
- map_foreachinmap(buildin_killmonsterall_sub_strip,m,BL_MOB);
+ iMap->foreachinmap(buildin_killmonsterall_sub_strip,m,BL_MOB);
return true;
}
@@ -8713,13 +8713,13 @@ BUILDIN(clone)
check_event(st, event);
- m = map_mapname2mapid(map);
+ m = iMap->mapname2mapid(map);
if (m < 0) return true;
- sd = map_charid2sd(char_id);
+ sd = iMap->charid2sd(char_id);
if (master_id) {
- msd = map_charid2sd(master_id);
+ msd = iMap->charid2sd(master_id);
if (msd)
master_id = msd->bl.id;
else
@@ -8755,7 +8755,7 @@ BUILDIN(donpcevent)
const char* event = script_getstr(st,2);
check_event(st, event);
if( !npc_event_do(event) ) {
- struct npc_data * nd = map_id2nd(st->oid);
+ struct npc_data * nd = iMap->id2nd(st->oid);
ShowDebug("NPCEvent '%s' not found! (source: %s)\n",event,nd?nd->name:"Unknown");
script_pushint(st, 0);
} else
@@ -8789,7 +8789,7 @@ BUILDIN(addtimer)
if( sd == NULL )
return true;
- pc_addeventtimer(sd,tick,event);
+ iPc->addeventtimer(sd,tick,event);
return true;
}
/*==========================================
@@ -8805,7 +8805,7 @@ BUILDIN(deltimer)
return true;
check_event(st, event);
- pc_deleventtimer(sd,event);
+ iPc->deleventtimer(sd,event);
return true;
}
/*==========================================
@@ -8823,7 +8823,7 @@ BUILDIN(addtimercount)
return true;
check_event(st, event);
- pc_addeventtimercount(sd,event,tick);
+ iPc->addeventtimercount(sd,event,tick);
return true;
}
@@ -8848,7 +8848,7 @@ BUILDIN(initnpctimer)
nd = npc_name2id(script->conv_str(st, data));
else if( data_isint(data) ) //Flag
{
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
flag = script->conv_num(st,data);
}
else
@@ -8858,7 +8858,7 @@ BUILDIN(initnpctimer)
}
}
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( !nd )
return true;
@@ -8896,7 +8896,7 @@ BUILDIN(startnpctimer)
nd = npc_name2id(script->conv_str(st, data));
else if( data_isint(data) ) //Flag
{
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
flag = script->conv_num(st,data);
}
else
@@ -8906,7 +8906,7 @@ BUILDIN(startnpctimer)
}
}
else
- nd=(struct npc_data *)map_id2bl(st->oid);
+ nd=(struct npc_data *)iMap->id2bl(st->oid);
if( !nd )
return true;
@@ -8942,7 +8942,7 @@ BUILDIN(stopnpctimer)
nd = npc_name2id(script->conv_str(st, data));
else if( data_isint(data) ) //Flag
{
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
flag = script->conv_num(st,data);
}
else
@@ -8952,7 +8952,7 @@ BUILDIN(stopnpctimer)
}
}
else
- nd=(struct npc_data *)map_id2bl(st->oid);
+ nd=(struct npc_data *)iMap->id2bl(st->oid);
if( !nd )
return true;
@@ -8974,7 +8974,7 @@ BUILDIN(getnpctimer)
if( script_hasdata(st,3) )
nd = npc_name2id(script_getstr(st,3));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( !nd || nd->bl.type != BL_NPC )
{
@@ -8989,7 +8989,7 @@ BUILDIN(getnpctimer)
case 1:
if( nd->u.scr.rid )
{
- sd = map_id2sd(nd->u.scr.rid);
+ sd = iMap->id2sd(nd->u.scr.rid);
if( !sd )
{
ShowError("buildin_getnpctimer: Attached player not found!\n");
@@ -9017,7 +9017,7 @@ BUILDIN(setnpctimer)
if( script_hasdata(st,3) )
nd = npc_name2id(script_getstr(st,3));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( !nd || nd->bl.type != BL_NPC )
{
@@ -9037,7 +9037,7 @@ BUILDIN(setnpctimer)
BUILDIN(attachnpctimer)
{
TBL_PC *sd;
- struct npc_data *nd = (struct npc_data *)map_id2bl(st->oid);
+ struct npc_data *nd = (struct npc_data *)iMap->id2bl(st->oid);
if( !nd || nd->bl.type != BL_NPC )
{
@@ -9047,7 +9047,7 @@ BUILDIN(attachnpctimer)
}
if( script_hasdata(st,2) )
- sd = map_nick2sd(script_getstr(st,2));
+ sd = iMap->nick2sd(script_getstr(st,2));
else
sd = script_rid2sd(st);
@@ -9073,7 +9073,7 @@ BUILDIN(detachnpctimer)
if( script_hasdata(st,2) )
nd = npc_name2id(script_getstr(st,2));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( !nd || nd->bl.type != BL_NPC )
{
@@ -9094,7 +9094,7 @@ BUILDIN(detachnpctimer)
*------------------------------------------*/
BUILDIN(playerattached)
{
- if(st->rid == 0 || map_id2sd(st->rid) == NULL)
+ if(st->rid == 0 || iMap->id2sd(st->rid) == NULL)
script_pushint(st,0);
else
script_pushint(st,st->rid);
@@ -9116,7 +9116,7 @@ BUILDIN(announce)
if (flag&0x0f) // Broadcast source or broadcast region defined
{
send_target target;
- struct block_list *bl = (flag&0x08) ? map_id2bl(st->oid) : (struct block_list *)script_rid2sd(st); // If bc_npc flag is set, use NPC as broadcast source
+ struct block_list *bl = (flag&0x08) ? iMap->id2bl(st->oid) : (struct block_list *)script_rid2sd(st); // If bc_npc flag is set, use NPC as broadcast source
if (bl == NULL)
return true;
@@ -9167,7 +9167,7 @@ BUILDIN(itemeffect) {
struct item_data *item_data;
nullpo_retr( 1, ( sd = script_rid2sd( st ) ) );
- nullpo_retr( 1, ( nd = (TBL_NPC *)map_id2bl( sd->npc_id ) ) );
+ nullpo_retr( 1, ( nd = (TBL_NPC *)iMap->id2bl( sd->npc_id ) ) );
data = script_getdata( st, 2 );
get_val( st, data );
@@ -9208,10 +9208,10 @@ BUILDIN(mapannounce)
int fontY = script_hasdata(st,9) ? script_getnum(st,9) : 0; // default fontY
int16 m;
- if ((m = map_mapname2mapid(mapname)) < 0)
+ if ((m = iMap->mapname2mapid(mapname)) < 0)
return true;
- map_foreachinmap(buildin_announce_sub, m, BL_PC,
+ iMap->foreachinmap(buildin_announce_sub, m, BL_PC,
mes, strlen(mes)+1, flag&0xf0, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
}
@@ -9233,10 +9233,10 @@ BUILDIN(areaannounce)
int fontY = script_hasdata(st,13) ? script_getnum(st,13) : 0; // default fontY
int16 m;
- if ((m = map_mapname2mapid(mapname)) < 0)
+ if ((m = iMap->mapname2mapid(mapname)) < 0)
return true;
- map_foreachinarea(buildin_announce_sub, m, x0, y0, x1, y1, BL_PC,
+ iMap->foreachinarea(buildin_announce_sub, m, x0, y0, x1, y1, BL_PC,
mes, strlen(mes)+1, flag&0xf0, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
}
@@ -9256,7 +9256,7 @@ BUILDIN(getusers)
case 0:
if(flag&0x8)
{// npc
- bl = map_id2bl(st->oid);
+ bl = iMap->id2bl(st->oid);
}
else if((sd = script_rid2sd(st))!=NULL)
{// pc
@@ -9269,7 +9269,7 @@ BUILDIN(getusers)
}
break;
case 1:
- val = map_getusers();
+ val = iMap->getusers();
break;
default:
ShowWarning("buildin_getusers: Unknown type %d.\n", flag);
@@ -9292,11 +9292,11 @@ BUILDIN(getusersname)
sd = script_rid2sd(st);
if (!sd) return true;
- group_level = pc_get_group_level(sd);
+ group_level = iPc->get_group_level(sd);
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && pc_get_group_level(pl_sd) > group_level)
+ if (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && iPc->get_group_level(pl_sd) > group_level)
continue; // skip hidden sessions
/* Temporary fix for bugreport:1023.
@@ -9321,7 +9321,7 @@ BUILDIN(getmapguildusers)
struct guild *g = NULL;
str=script_getstr(st,2);
gid=script_getnum(st,3);
- if ((m = map_mapname2mapid(str)) < 0) { // map id on this server (m == -1 if not in actual map-server)
+ if ((m = iMap->mapname2mapid(str)) < 0) { // map id on this server (m == -1 if not in actual map-server)
script_pushint(st,-1);
return true;
}
@@ -9345,7 +9345,7 @@ BUILDIN(getmapusers)
const char *str;
int16 m;
str=script_getstr(st,2);
- if( (m=map_mapname2mapid(str))< 0){
+ if( (m=iMap->mapname2mapid(str))< 0){
script_pushint(st,-1);
return true;
}
@@ -9369,11 +9369,11 @@ BUILDIN(getareausers)
y0=script_getnum(st,4);
x1=script_getnum(st,5);
y1=script_getnum(st,6);
- if( (m=map_mapname2mapid(str))< 0){
+ if( (m=iMap->mapname2mapid(str))< 0){
script_pushint(st,-1);
return true;
}
- map_foreachinarea(buildin_getareausers_sub,
+ iMap->foreachinarea(buildin_getareausers_sub,
m,x0,y0,x1,y1,BL_PC,&users);
script_pushint(st,users);
return true;
@@ -9416,11 +9416,11 @@ BUILDIN(getareadropitem)
}else
item=script->conv_num(st,data);
- if( (m=map_mapname2mapid(str))< 0){
+ if( (m=iMap->mapname2mapid(str))< 0){
script_pushint(st,-1);
return true;
}
- map_foreachinarea(buildin_getareadropitem_sub,
+ iMap->foreachinarea(buildin_getareadropitem_sub,
m,x0,y0,x1,y1,BL_ITEM,item,&amount);
script_pushint(st,amount);
return true;
@@ -9478,9 +9478,9 @@ BUILDIN(sc_start)
tick = script_getnum(st,3);
val1 = script_getnum(st,4);
if( script_hasdata(st,5) )
- bl = map_id2bl(script_getnum(st,5));
+ bl = iMap->id2bl(script_getnum(st,5));
else
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status_sc2skill(type) != 0 )
{// When there isn't a duration specified, try to get it from the skill_db
@@ -9489,7 +9489,7 @@ BUILDIN(sc_start)
if( potion_flag == 1 && potion_target )
{ //skill.c set the flags before running the script, this must be a potion-pitched effect.
- bl = map_id2bl(potion_target);
+ bl = iMap->id2bl(potion_target);
tick /= 2;// Thrown potions only last half.
val4 = 1;// Mark that this was a thrown sc_effect
}
@@ -9517,9 +9517,9 @@ BUILDIN(sc_start2)
val1 = script_getnum(st,4);
rate = script_getnum(st,5);
if( script_hasdata(st,6) )
- bl = map_id2bl(script_getnum(st,6));
+ bl = iMap->id2bl(script_getnum(st,6));
else
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status_sc2skill(type) != 0 )
{// When there isn't a duration specified, try to get it from the skill_db
@@ -9528,7 +9528,7 @@ BUILDIN(sc_start2)
if( potion_flag == 1 && potion_target )
{ //skill.c set the flags before running the script, this must be a potion-pitched effect.
- bl = map_id2bl(potion_target);
+ bl = iMap->id2bl(potion_target);
tick /= 2;// Thrown potions only last half.
val4 = 1;// Mark that this was a thrown sc_effect
}
@@ -9559,9 +9559,9 @@ BUILDIN(sc_start4)
val3 = script_getnum(st,6);
val4 = script_getnum(st,7);
if( script_hasdata(st,8) )
- bl = map_id2bl(script_getnum(st,8));
+ bl = iMap->id2bl(script_getnum(st,8));
else
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status_sc2skill(type) != 0 )
{// When there isn't a duration specified, try to get it from the skill_db
@@ -9570,7 +9570,7 @@ BUILDIN(sc_start4)
if( potion_flag == 1 && potion_target )
{ //skill.c set the flags before running the script, this must be a potion-pitched effect.
- bl = map_id2bl(potion_target);
+ bl = iMap->id2bl(potion_target);
tick /= 2;// Thrown potions only last half.
}
@@ -9590,12 +9590,12 @@ BUILDIN(sc_end)
type = script_getnum(st, 2);
if (script_hasdata(st, 3))
- bl = map_id2bl(script_getnum(st, 3));
+ bl = iMap->id2bl(script_getnum(st, 3));
else
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
if (potion_flag == 1 && potion_target) //##TODO how does this work [FlavioJS]
- bl = map_id2bl(potion_target);
+ bl = iMap->id2bl(potion_target);
if (!bl)
return true;
@@ -9642,9 +9642,9 @@ BUILDIN(getscrate)
type=script_getnum(st,2);
rate=script_getnum(st,3);
if( script_hasdata(st,4) ) //get for the bl assigned
- bl = map_id2bl(script_getnum(st,4));
+ bl = iMap->id2bl(script_getnum(st,4));
else
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
if (bl)
rate = status_get_sc_def(bl, (sc_type)type, 10000, 10000, 0);
@@ -9689,11 +9689,11 @@ BUILDIN(getstatus)
case 4: script_pushint(st, sd->sc.data[id]->val4); break;
case 5:
{
- struct TimerData* timer = (struct TimerData*)get_timer(sd->sc.data[id]->timer);
+ struct TimerData* timer = (struct TimerData*)iTimer->get_timer(sd->sc.data[id]->timer);
if( timer )
{// return the amount of time remaining
- script_pushint(st, timer->tick - gettick());
+ script_pushint(st, timer->tick - iTimer->gettick());
}
}
break;
@@ -9833,7 +9833,7 @@ BUILDIN(eaclass)
}
class_ = sd->status.class_;
}
- script_pushint(st,pc_jobid2mapid(class_));
+ script_pushint(st,iPc->jobid2mapid(class_));
return true;
}
@@ -9850,7 +9850,7 @@ BUILDIN(roclass)
else
sex = 1; //Just use male when not found.
}
- script_pushint(st,pc_mapid2jobid(class_, sex));
+ script_pushint(st,iPc->mapid2jobid(class_, sex));
return true;
}
@@ -9891,7 +9891,7 @@ BUILDIN(resetlvl)
if( sd == NULL )
return true;
- pc_resetlvl(sd,type);
+ iPc->resetlvl(sd,type);
return true;
}
/*==========================================
@@ -9901,7 +9901,7 @@ BUILDIN(resetstatus)
{
TBL_PC *sd;
sd=script_rid2sd(st);
- pc_resetstate(sd);
+ iPc->resetstate(sd);
return true;
}
@@ -9912,7 +9912,7 @@ BUILDIN(resetskill)
{
TBL_PC *sd;
sd=script_rid2sd(st);
- pc_resetskill(sd,1);
+ iPc->resetskill(sd,1);
return true;
}
@@ -9923,7 +9923,7 @@ BUILDIN(skillpointcount)
{
TBL_PC *sd;
sd=script_rid2sd(st);
- script_pushint(st,sd->status.skill_point + pc_resetskill(sd,2));
+ script_pushint(st,sd->status.skill_point + iPc->resetskill(sd,2));
return true;
}
@@ -9936,7 +9936,7 @@ BUILDIN(changebase)
int vclass;
if( script_hasdata(st,3) )
- sd=map_id2sd(script_getnum(st,3));
+ sd=iMap->id2sd(script_getnum(st,3));
else
sd=script_rid2sd(st);
@@ -9974,10 +9974,10 @@ BUILDIN(changesex)
TBL_PC *sd = NULL;
sd = script_rid2sd(st);
- pc_resetskill(sd,4);
+ iPc->resetskill(sd,4);
// to avoid any problem with equipment and invalid sex, equipment is unequiped.
for( i=0; i<EQI_MAX; i++ )
- if( sd->equip_index[i] >= 0 ) pc_unequipitem(sd, sd->equip_index[i], 3);
+ if( sd->equip_index[i] >= 0 ) iPc->unequipitem(sd, sd->equip_index[i], 3);
chrif_changesex(sd);
return true;
}
@@ -9987,7 +9987,7 @@ BUILDIN(changesex)
*------------------------------------------*/
BUILDIN(globalmes)
{
- struct block_list *bl = map_id2bl(st->oid);
+ struct block_list *bl = iMap->id2bl(st->oid);
struct npc_data *nd = (struct npc_data *)bl;
const char *name=NULL,*mes;
@@ -10024,7 +10024,7 @@ BUILDIN(waitingroom)
int minLvl = script_hasdata(st,7) ? script_getnum(st,7) : 1;
int maxLvl = script_hasdata(st,8) ? script_getnum(st,8) : MAX_LEVEL;
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( nd != NULL )
chat_createnpcchat(nd, title, limit, pub, trigger, ev, zeny, minLvl, maxLvl);
@@ -10041,7 +10041,7 @@ BUILDIN(delwaitingroom)
if( script_hasdata(st,2) )
nd = npc_name2id(script_getstr(st, 2));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( nd != NULL )
chat_deletenpcchat(nd);
return true;
@@ -10059,9 +10059,9 @@ BUILDIN(waitingroomkickall)
if( script_hasdata(st,2) )
nd = npc_name2id(script_getstr(st,2));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
- if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL )
+ if( nd != NULL && (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) != NULL )
chat_npckickall(cd);
return true;
}
@@ -10078,9 +10078,9 @@ BUILDIN(enablewaitingroomevent)
if( script_hasdata(st,2) )
nd = npc_name2id(script_getstr(st, 2));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
- if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL )
+ if( nd != NULL && (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) != NULL )
chat_enableevent(cd);
return true;
}
@@ -10097,9 +10097,9 @@ BUILDIN(disablewaitingroomevent)
if( script_hasdata(st,2) )
nd = npc_name2id(script_getstr(st, 2));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
- if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL )
+ if( nd != NULL && (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) != NULL )
chat_disableevent(cd);
return true;
}
@@ -10128,9 +10128,9 @@ BUILDIN(getwaitingroomstate)
if( script_hasdata(st,3) )
nd = npc_name2id(script_getstr(st, 3));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
- if( nd == NULL || (cd=(struct chat_data *)map_id2bl(nd->chat_id)) == NULL )
+ if( nd == NULL || (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL )
{
script_pushint(st, -1);
return true;
@@ -10175,8 +10175,8 @@ BUILDIN(warpwaitingpc)
struct chat_data* cd;
TBL_PC* sd;
- nd = (struct npc_data *)map_id2bl(st->oid);
- if( nd == NULL || (cd=(struct chat_data *)map_id2bl(nd->chat_id)) == NULL )
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
+ if( nd == NULL || (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL )
return true;
map_name = script_getstr(st,2);
@@ -10202,17 +10202,17 @@ BUILDIN(warpwaitingpc)
{// no zeny to cover set fee
break;
}
- pc_payzeny(sd, cd->zeny, LOG_TYPE_NPC, NULL);
+ iPc->payzeny(sd, cd->zeny, LOG_TYPE_NPC, NULL);
}
mapreg_setreg(reference_uid(add_str("$@warpwaitingpc"), i), sd->bl.id);
if( strcmp(map_name,"Random") == 0 )
- pc_randomwarp(sd,CLR_TELEPORT);
+ iPc->randomwarp(sd,CLR_TELEPORT);
else if( strcmp(map_name,"SavePoint") == 0 )
- pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
+ iPc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
else
- pc_setpos(sd, mapindex_name2id(map_name), x, y, CLR_OUTSIGHT);
+ iPc->setpos(sd, mapindex_name2id(map_name), x, y, CLR_OUTSIGHT);
}
mapreg_setreg(add_str("$@warpwaitingpcnum"), i);
return true;
@@ -10241,7 +10241,7 @@ BUILDIN(attachrid)
{
int rid = script_getnum(st,2);
- if (map_id2sd(rid) != NULL) {
+ if (iMap->id2sd(rid) != NULL) {
script_detach_rid(st);
st->rid = rid;
@@ -10264,7 +10264,7 @@ BUILDIN(detachrid)
*------------------------------------------*/
BUILDIN(isloggedin)
{
- TBL_PC* sd = map_id2sd(script_getnum(st,2));
+ TBL_PC* sd = iMap->id2sd(script_getnum(st,2));
if (script_hasdata(st,3) && sd &&
sd->status.char_id != script_getnum(st,3))
sd = NULL;
@@ -10286,7 +10286,7 @@ BUILDIN(setmapflagnosave)
str2=script_getstr(st,3);
x=script_getnum(st,4);
y=script_getnum(st,5);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
mapindex = mapindex_name2id(str2);
if(m >= 0 && mapindex) {
@@ -10307,7 +10307,7 @@ BUILDIN(getmapflag)
str=script_getstr(st,2);
i=script_getnum(st,3);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m >= 0) {
switch(i) {
case MF_NOMEMO: script_pushint(st,map[m].flag.nomemo); break;
@@ -10368,7 +10368,7 @@ BUILDIN(getmapflag)
static int script_mapflag_pvp_sub(struct block_list *bl,va_list ap) {
TBL_PC* sd = (TBL_PC*)bl;
if (sd->pvp_timer == INVALID_TIMER) {
- sd->pvp_timer = add_timer(gettick() + 200, pc_calc_pvprank_timer, sd->bl.id, 0);
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick() + 200, iPc->calc_pvprank_timer, sd->bl.id, 0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
sd->pvp_point = 5;
@@ -10401,7 +10401,7 @@ BUILDIN(setmapflag)
val = script_getnum(st, 4);
}
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m >= 0) {
switch(i) {
@@ -10414,7 +10414,7 @@ BUILDIN(setmapflag)
case MF_PVP:
map[m].flag.pvp = 1;
if( !battle_config.pk_mode ) {
- map_foreachinmap(script_mapflag_pvp_sub,m,BL_PC);
+ iMap->foreachinmap(script_mapflag_pvp_sub,m,BL_PC);
}
break;
case MF_PVP_NOPARTY: map[m].flag.pvp_noparty = 1; break;
@@ -10492,7 +10492,7 @@ BUILDIN(removemapflag)
if(script_hasdata(st,4)){
val=script_getnum(st,4);
}
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m >= 0) {
switch(i) {
case MF_NOMEMO: map[m].flag.nomemo = 0; break;
@@ -10545,7 +10545,7 @@ BUILDIN(removemapflag)
case MF_NOWARPTO: map[m].flag.nowarpto = 0; break;
case MF_NIGHTMAREDROP: map[m].flag.pvp_nightmaredrop = 0; break;
case MF_ZONE:
- map_zone_change2(m, map[m].prev_zone);
+ iMap->zone_change2(m, map[m].prev_zone);
break;
case MF_NOCOMMAND: map[m].nocommand = 0; break;
case MF_NODROP: map[m].flag.nodrop = 0; break;
@@ -10578,11 +10578,11 @@ BUILDIN(pvpon)
struct block_list bl;
str = script_getstr(st,2);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if( m < 0 || map[m].flag.pvp )
return true; // nothing to do
- map_zone_change2(m, strdb_get(zone_db, MAP_ZONE_PVP_NAME));
+ iMap->zone_change2(m, strdb_get(zone_db, MAP_ZONE_PVP_NAME));
map[m].flag.pvp = 1;
clif->map_property_mapall(m, MAPPROPERTY_FREEPVPZONE);
bl.type = BL_NUL;
@@ -10599,7 +10599,7 @@ BUILDIN(pvpon)
if( sd->bl.m != m || sd->pvp_timer != INVALID_TIMER )
continue; // not applicable
- sd->pvp_timer = add_timer(gettick()+200,pc_calc_pvprank_timer,sd->bl.id,0);
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+200,iPc->calc_pvprank_timer,sd->bl.id,0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
sd->pvp_point = 5;
@@ -10616,7 +10616,7 @@ static int buildin_pvpoff_sub(struct block_list *bl,va_list ap)
TBL_PC* sd = (TBL_PC*)bl;
clif->pvpset(sd, 0, 0, 2);
if (sd->pvp_timer != INVALID_TIMER) {
- delete_timer(sd->pvp_timer, pc_calc_pvprank_timer);
+ iTimer->delete_timer(sd->pvp_timer, iPc->calc_pvprank_timer);
sd->pvp_timer = INVALID_TIMER;
}
return 0;
@@ -10629,11 +10629,11 @@ BUILDIN(pvpoff)
struct block_list bl;
str=script_getstr(st,2);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m < 0 || !map[m].flag.pvp)
return true; //fixed Lupus
- map_zone_change2(m, map[m].prev_zone);
+ iMap->zone_change2(m, map[m].prev_zone);
map[m].flag.pvp = 0;
clif->map_property_mapall(m, MAPPROPERTY_NOTHING);
bl.type = BL_NUL;
@@ -10643,7 +10643,7 @@ BUILDIN(pvpoff)
if(battle_config.pk_mode) // disable ranking options if pk_mode is on [Valaris]
return true;
- map_foreachinmap(buildin_pvpoff_sub, m, BL_PC);
+ iMap->foreachinmap(buildin_pvpoff_sub, m, BL_PC);
return true;
}
@@ -10653,10 +10653,10 @@ BUILDIN(gvgon)
const char *str;
str=script_getstr(st,2);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m >= 0 && !map[m].flag.gvg) {
struct block_list bl;
- map_zone_change2(m, strdb_get(zone_db, MAP_ZONE_GVG_NAME));
+ iMap->zone_change2(m, strdb_get(zone_db, MAP_ZONE_GVG_NAME));
map[m].flag.gvg = 1;
clif->map_property_mapall(m, MAPPROPERTY_AGITZONE);
bl.type = BL_NUL;
@@ -10672,10 +10672,10 @@ BUILDIN(gvgoff)
const char *str;
str=script_getstr(st,2);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m >= 0 && map[m].flag.gvg) {
struct block_list bl;
- map_zone_change2(m, map[m].prev_zone);
+ iMap->zone_change2(m, map[m].prev_zone);
map[m].flag.gvg = 0;
clif->map_property_mapall(m, MAPPROPERTY_NOTHING);
bl.type = BL_NUL;
@@ -10705,7 +10705,7 @@ BUILDIN(emotion)
if (player) {
TBL_PC *sd = NULL;
if( script_hasdata(st,4) )
- sd = map_nick2sd(script_getstr(st,4));
+ sd = iMap->nick2sd(script_getstr(st,4));
else
sd = script_rid2sd(st);
if (sd)
@@ -10718,7 +10718,7 @@ BUILDIN(emotion)
clif->emotion(&nd->bl,type);
}
else
- clif->emotion(map_id2bl(st->oid),type);
+ clif->emotion(iMap->id2bl(st->oid),type);
return true;
}
@@ -10735,7 +10735,7 @@ static int buildin_maprespawnguildid_sub_pc(struct map_session_data* sd, va_list
(sd->status.guild_id != g_id && flag&2) || //Warp out outsiders
(sd->status.guild_id == 0) // Warp out players not in guild [Valaris]
)
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
return 1;
}
@@ -10755,46 +10755,46 @@ BUILDIN(maprespawnguildid)
int g_id=script_getnum(st,3);
int flag=script_getnum(st,4);
- int16 m=map_mapname2mapid(mapname);
+ int16 m=iMap->mapname2mapid(mapname);
if(m == -1)
return true;
//Catch ALL players (in case some are 'between maps' on execution time)
- map_foreachpc(buildin_maprespawnguildid_sub_pc,m,g_id,flag);
+ iMap->map_foreachpc(buildin_maprespawnguildid_sub_pc,m,g_id,flag);
if (flag&4) //Remove script mobs.
- map_foreachinmap(buildin_maprespawnguildid_sub_mob,m,BL_MOB);
+ iMap->foreachinmap(buildin_maprespawnguildid_sub_mob,m,BL_MOB);
return true;
}
BUILDIN(agitstart)
{
- if(agit_flag==1) return true; // Agit already Start.
- agit_flag=1;
+ if(iMap->agit_flag==1) return true; // Agit already Start.
+ iMap->agit_flag=1;
guild->agit_start();
return true;
}
BUILDIN(agitend)
{
- if(agit_flag==0) return true; // Agit already End.
- agit_flag=0;
+ if(iMap->agit_flag==0) return true; // Agit already End.
+ iMap->agit_flag=0;
guild->agit_end();
return true;
}
BUILDIN(agitstart2)
{
- if(agit2_flag==1) return true; // Agit2 already Start.
- agit2_flag=1;
+ if(iMap->agit2_flag==1) return true; // Agit2 already Start.
+ iMap->agit2_flag=1;
guild->agit2_start();
return true;
}
BUILDIN(agitend2)
{
- if(agit2_flag==0) return true; // Agit2 already End.
- agit2_flag=0;
+ if(iMap->agit2_flag==0) return true; // Agit2 already End.
+ iMap->agit2_flag=0;
guild->agit2_end();
return true;
}
@@ -10804,7 +10804,7 @@ BUILDIN(agitend2)
*------------------------------------------*/
BUILDIN(agitcheck)
{
- script_pushint(st,agit_flag);
+ script_pushint(st,iMap->agit_flag);
return true;
}
@@ -10813,7 +10813,7 @@ BUILDIN(agitcheck)
*------------------------------------------*/
BUILDIN(agitcheck2)
{
- script_pushint(st,agit2_flag);
+ script_pushint(st,iMap->agit2_flag);
return true;
}
@@ -10827,7 +10827,7 @@ BUILDIN(flagemblem)
if(g_id < 0) return true;
- nd = (TBL_NPC*)map_id2nd(st->oid);
+ nd = (TBL_NPC*)iMap->id2nd(st->oid);
if( nd == NULL ) {
ShowError("script:flagemblem: npc %d not found\n", st->oid);
} else if( nd->subtype != SCRIPT ) {
@@ -10946,7 +10946,7 @@ BUILDIN(getequipcardcnt)
num=script_getnum(st,2);
sd=script_rid2sd(st);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if (i < 0 || !sd->inventory_data[i]) {
script_pushint(st,0);
@@ -10978,7 +10978,7 @@ BUILDIN(successremovecards) {
int num = script_getnum(st,2);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if (i < 0 || !sd->inventory_data[i]) {
return true;
@@ -10996,9 +10996,9 @@ BUILDIN(successremovecards) {
item_tmp.nameid = sd->status.inventory[i].card[c];
item_tmp.identify = 1;
- if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // get back the cart in inventory
+ if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // get back the cart in inventory
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -11017,10 +11017,10 @@ BUILDIN(successremovecards) {
for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->status.inventory[i].card[j];
- pc_delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT);
- if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ //chk if can be spawn in inventory otherwise put on floor
+ iPc->delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT);
+ if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ //chk if can be spawn in inventory otherwise put on floor
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
clif->misceffect(&sd->bl,3);
@@ -11042,7 +11042,7 @@ BUILDIN(failedremovecards) {
int typefail = script_getnum(st,3);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if (i < 0 || !sd->inventory_data[i])
return true;
@@ -11063,9 +11063,9 @@ BUILDIN(failedremovecards) {
item_tmp.nameid = sd->status.inventory[i].card[c];
item_tmp.identify = 1;
- if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
+ if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -11073,7 +11073,7 @@ BUILDIN(failedremovecards) {
if(cardflag == 1) {
if(typefail == 0 || typefail == 2){ // destroy the item
- pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
}
if(typefail == 1){ // destroy the card
int flag;
@@ -11090,11 +11090,11 @@ BUILDIN(failedremovecards) {
for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->status.inventory[i].card[j];
- pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
- if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
+ if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
clif->misceffect(&sd->bl,2);
@@ -11125,7 +11125,7 @@ BUILDIN(mapwarp) // Added by RoVeRT
check_ID=script_getnum(st,7);
}
- if((m=map_mapname2mapid(mapname))< 0)
+ if((m=iMap->mapname2mapid(mapname))< 0)
return true;
if(!(index=mapindex_name2id(str)))
@@ -11138,23 +11138,23 @@ BUILDIN(mapwarp) // Added by RoVeRT
for( i=0; i < g->max_member; i++)
{
if(g->member[i].sd && g->member[i].sd->bl.m==m){
- pc_setpos(g->member[i].sd,index,x,y,CLR_TELEPORT);
+ iPc->setpos(g->member[i].sd,index,x,y,CLR_TELEPORT);
}
}
}
break;
case 2:
- p = party_search(check_ID);
+ p = iParty->search(check_ID);
if(p){
for(i=0;i<MAX_PARTY; i++){
if(p->data[i].sd && p->data[i].sd->bl.m == m){
- pc_setpos(p->data[i].sd,index,x,y,CLR_TELEPORT);
+ iPc->setpos(p->data[i].sd,index,x,y,CLR_TELEPORT);
}
}
}
break;
default:
- map_foreachinmap(buildin_areawarp_sub,m,BL_PC,index,x,y,0,0);
+ iMap->foreachinmap(buildin_areawarp_sub,m,BL_PC,index,x,y,0,0);
break;
}
@@ -11190,7 +11190,7 @@ BUILDIN(mobcount) // Added by RoVeRT
script_pushint(st,-1);
return true;
}
- } else if( (m = map_mapname2mapid(mapname)) < 0 ) {
+ } else if( (m = iMap->mapname2mapid(mapname)) < 0 ) {
script_pushint(st,-1);
return true;
}
@@ -11200,7 +11200,7 @@ BUILDIN(mobcount) // Added by RoVeRT
return true;
}
- script_pushint(st,map_foreachinmap(buildin_mobcount_sub, m, BL_MOB, event));
+ script_pushint(st,iMap->foreachinmap(buildin_mobcount_sub, m, BL_MOB, event));
return true;
}
@@ -11209,9 +11209,9 @@ BUILDIN(marriage)
{
const char *partner=script_getstr(st,2);
TBL_PC *sd=script_rid2sd(st);
- TBL_PC *p_sd=map_nick2sd(partner);
+ TBL_PC *p_sd=iMap->nick2sd(partner);
- if(sd==NULL || p_sd==NULL || pc_marriage(sd,p_sd) < 0){
+ if(sd==NULL || p_sd==NULL || iPc->marriage(sd,p_sd) < 0){
script_pushint(st,0);
return true;
}
@@ -11224,7 +11224,7 @@ BUILDIN(wedding_effect)
struct block_list *bl;
if(sd==NULL) {
- bl=map_id2bl(st->oid);
+ bl=iMap->id2bl(st->oid);
} else
bl=&sd->bl;
clif->wedding_effect(bl);
@@ -11233,7 +11233,7 @@ BUILDIN(wedding_effect)
BUILDIN(divorce)
{
TBL_PC *sd=script_rid2sd(st);
- if(sd==NULL || pc_divorce(sd) < 0){
+ if(sd==NULL || iPc->divorce(sd) < 0){
script_pushint(st,0);
return true;
}
@@ -11245,8 +11245,8 @@ BUILDIN(ispartneron)
{
TBL_PC *sd=script_rid2sd(st);
- if(sd==NULL || !pc_ismarried(sd) ||
- map_charid2sd(sd->status.partner_id) == NULL) {
+ if(sd==NULL || !iPc->ismarried(sd) ||
+ iMap->charid2sd(sd->status.partner_id) == NULL) {
script_pushint(st,0);
return true;
}
@@ -11311,8 +11311,8 @@ BUILDIN(warppartner)
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) {
+ if(sd==NULL || !iPc->ismarried(sd) ||
+ (p_sd=iMap->charid2sd(sd->status.partner_id)) == NULL) {
script_pushint(st,0);
return true;
}
@@ -11323,7 +11323,7 @@ BUILDIN(warppartner)
mapindex = mapindex_name2id(str);
if (mapindex) {
- pc_setpos(p_sd,mapindex,x,y,CLR_OUTSIGHT);
+ iPc->setpos(p_sd,mapindex,x,y,CLR_OUTSIGHT);
script_pushint(st,1);
} else
script_pushint(st,0);
@@ -11424,16 +11424,16 @@ BUILDIN(setwall)
shootable = script_getnum(st,7);
name = script_getstr(st,8);
- if( (m = map_mapname2mapid(map)) < 0 )
+ if( (m = iMap->mapname2mapid(map)) < 0 )
return true; // Invalid Map
- map_iwall_set(m, x, y, size, dir, shootable, name);
+ iMap->iwall_set(m, x, y, size, dir, shootable, name);
return true;
}
BUILDIN(delwall)
{
const char *name = script_getstr(st,2);
- map_iwall_remove(name);
+ iMap->iwall_remove(name);
return true;
}
@@ -11466,7 +11466,7 @@ BUILDIN(guardianinfo)
if( !gc->guardian[id].visible )
script_pushint(st,-1);
else
- if( (gd = map_id2md(gc->guardian[id].id)) == NULL )
+ if( (gd = iMap->id2md(gc->guardian[id].id)) == NULL )
script_pushint(st,-1);
else
{
@@ -11637,7 +11637,7 @@ BUILDIN(getequipcardid)
slot=script_getnum(st,3);
sd=script_rid2sd(st);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0 && slot>=0 && slot<4)
script_pushint(st,sd->status.inventory[i].card[slot]);
else
@@ -11662,7 +11662,7 @@ BUILDIN(petskillbonus)
if (pd->bonus)
{ //Clear previous bonus
if (pd->bonus->timer != INVALID_TIMER)
- delete_timer(pd->bonus->timer, pet_skill_bonus_timer);
+ iTimer->delete_timer(pd->bonus->timer, pet_skill_bonus_timer);
} else //init
pd->bonus = (struct pet_bonus *) aMalloc(sizeof(struct pet_bonus));
@@ -11678,7 +11678,7 @@ BUILDIN(petskillbonus)
if (battle_config.pet_equip_required && pd->pet.equip == 0)
pd->bonus->timer = INVALID_TIMER;
else
- pd->bonus->timer = add_timer(gettick()+pd->bonus->delay*1000, pet_skill_bonus_timer, sd->bl.id, 0);
+ pd->bonus->timer = iTimer->add_timer(iTimer->gettick()+pd->bonus->delay*1000, pet_skill_bonus_timer, sd->bl.id, 0);
return true;
}
@@ -11735,22 +11735,22 @@ BUILDIN(getinventorylist)
if(!sd) return true;
for(i=0;i<MAX_INVENTORY;i++){
if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount > 0){
- pc_setreg(sd,reference_uid(add_str("@inventorylist_id"), j),sd->status.inventory[i].nameid);
- pc_setreg(sd,reference_uid(add_str("@inventorylist_amount"), j),sd->status.inventory[i].amount);
- pc_setreg(sd,reference_uid(add_str("@inventorylist_equip"), j),sd->status.inventory[i].equip);
- pc_setreg(sd,reference_uid(add_str("@inventorylist_refine"), j),sd->status.inventory[i].refine);
- pc_setreg(sd,reference_uid(add_str("@inventorylist_identify"), j),sd->status.inventory[i].identify);
- pc_setreg(sd,reference_uid(add_str("@inventorylist_attribute"), j),sd->status.inventory[i].attribute);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_id"), j),sd->status.inventory[i].nameid);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_amount"), j),sd->status.inventory[i].amount);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_equip"), j),sd->status.inventory[i].equip);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_refine"), j),sd->status.inventory[i].refine);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_identify"), j),sd->status.inventory[i].identify);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_attribute"), j),sd->status.inventory[i].attribute);
for (k = 0; k < MAX_SLOTS; k++)
{
sprintf(card_var, "@inventorylist_card%d",k+1);
- pc_setreg(sd,reference_uid(add_str(card_var), j),sd->status.inventory[i].card[k]);
+ iPc->setreg(sd,reference_uid(add_str(card_var), j),sd->status.inventory[i].card[k]);
}
- pc_setreg(sd,reference_uid(add_str("@inventorylist_expire"), j),sd->status.inventory[i].expire_time);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_expire"), j),sd->status.inventory[i].expire_time);
j++;
}
}
- pc_setreg(sd,add_str("@inventorylist_count"),j);
+ iPc->setreg(sd,add_str("@inventorylist_count"),j);
return true;
}
@@ -11761,13 +11761,13 @@ BUILDIN(getskilllist)
if(!sd) return true;
for(i=0;i<MAX_SKILL;i++){
if(sd->status.skill[i].id > 0 && sd->status.skill[i].lv > 0){
- pc_setreg(sd,reference_uid(add_str("@skilllist_id"), j),sd->status.skill[i].id);
- pc_setreg(sd,reference_uid(add_str("@skilllist_lv"), j),sd->status.skill[i].lv);
- pc_setreg(sd,reference_uid(add_str("@skilllist_flag"), j),sd->status.skill[i].flag);
+ iPc->setreg(sd,reference_uid(add_str("@skilllist_id"), j),sd->status.skill[i].id);
+ iPc->setreg(sd,reference_uid(add_str("@skilllist_lv"), j),sd->status.skill[i].lv);
+ iPc->setreg(sd,reference_uid(add_str("@skilllist_flag"), j),sd->status.skill[i].flag);
j++;
}
}
- pc_setreg(sd,add_str("@skilllist_count"),j);
+ iPc->setreg(sd,add_str("@skilllist_count"),j);
return true;
}
@@ -11778,7 +11778,7 @@ BUILDIN(clearitem)
if(sd==NULL) return true;
for (i=0; i<MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_SCRIPT);
+ iPc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_SCRIPT);
}
}
return true;
@@ -11796,7 +11796,7 @@ BUILDIN(disguise)
id = script_getnum(st,2);
if (mobdb_checkid(id) || npcdb_checkid(id)) {
- pc_disguise(sd, id);
+ iPc->disguise(sd, id);
script_pushint(st,id);
} else
script_pushint(st,0);
@@ -11813,7 +11813,7 @@ BUILDIN(undisguise)
if (sd == NULL) return true;
if (sd->disguise != -1) {
- pc_disguise(sd, -1);
+ iPc->disguise(sd, -1);
script_pushint(st,0);
} else {
script_pushint(st,1);
@@ -11828,7 +11828,7 @@ BUILDIN(undisguise)
BUILDIN(classchange)
{
int _class,type;
- struct block_list *bl=map_id2bl(st->oid);
+ struct block_list *bl=iMap->id2bl(st->oid);
if(bl==NULL) return true;
@@ -11847,7 +11847,7 @@ BUILDIN(misceffect)
type=script_getnum(st,2);
if(st->oid && st->oid != fake_nd->bl.id) {
- struct block_list *bl = map_id2bl(st->oid);
+ struct block_list *bl = iMap->id2bl(st->oid);
if (bl)
clif->specialeffect(bl,type,AREA);
} else{
@@ -11909,17 +11909,17 @@ BUILDIN(playBGMall)
int x1 = script_getnum(st,6);
int y1 = script_getnum(st,7);
- map_foreachinarea(playBGM_sub, map_mapname2mapid(map), x0, y0, x1, y1, BL_PC, name);
+ iMap->foreachinarea(playBGM_sub, iMap->mapname2mapid(map), x0, y0, x1, y1, BL_PC, name);
}
else if( script_hasdata(st,3) )
{// entire map
const char* map = script_getstr(st,3);
- map_foreachinmap(playBGM_sub, map_mapname2mapid(map), BL_PC, name);
+ iMap->foreachinmap(playBGM_sub, iMap->mapname2mapid(map), BL_PC, name);
}
else
{// entire server
- map_foreachpc(&playBGM_foreachpc_sub, name);
+ iMap->map_foreachpc(&playBGM_foreachpc_sub, name);
}
return true;
@@ -11961,14 +11961,14 @@ BUILDIN(soundeffectall)
const char* name;
int type;
- bl = (st->rid) ? &(script_rid2sd(st)->bl) : map_id2bl(st->oid);
+ bl = (st->rid) ? &(script_rid2sd(st)->bl) : iMap->id2bl(st->oid);
if (!bl)
return true;
name = script_getstr(st,2);
type = script_getnum(st,3);
- //FIXME: enumerating map squares (map_foreach) is slower than enumerating the list of online players (map_foreachpc?) [ultramage]
+ //FIXME: enumerating map squares (iMap->foreach) is slower than enumerating the list of online players (iMap->foreachpc?) [ultramage]
if(!script_hasdata(st,4))
{ // area around
@@ -11978,7 +11978,7 @@ BUILDIN(soundeffectall)
if(!script_hasdata(st,5))
{ // entire map
const char* map = script_getstr(st,4);
- map_foreachinmap(soundeffect_sub, map_mapname2mapid(map), BL_PC, name, type);
+ iMap->foreachinmap(soundeffect_sub, iMap->mapname2mapid(map), BL_PC, name, type);
}
else
if(script_hasdata(st,8))
@@ -11988,7 +11988,7 @@ BUILDIN(soundeffectall)
int y0 = script_getnum(st,6);
int x1 = script_getnum(st,7);
int y1 = script_getnum(st,8);
- map_foreachinarea(soundeffect_sub, map_mapname2mapid(map), x0, y0, x1, y1, BL_PC, name, type);
+ iMap->foreachinarea(soundeffect_sub, iMap->mapname2mapid(map), x0, y0, x1, y1, BL_PC, name, type);
}
else
{
@@ -12013,7 +12013,7 @@ BUILDIN(petrecovery)
if (pd->recovery)
{ //Halt previous bonus
if (pd->recovery->timer != INVALID_TIMER)
- delete_timer(pd->recovery->timer, pet_recovery_timer);
+ iTimer->delete_timer(pd->recovery->timer, pet_recovery_timer);
} else //Init
pd->recovery = (struct pet_recovery *)aMalloc(sizeof(struct pet_recovery));
@@ -12041,9 +12041,9 @@ BUILDIN(petheal)
if (pd->s_skill->timer != INVALID_TIMER)
{
if (pd->s_skill->id)
- delete_timer(pd->s_skill->timer, pet_skill_support_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_skill_support_timer);
else
- delete_timer(pd->s_skill->timer, pet_heal_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_heal_timer);
}
} else //init memory
pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support));
@@ -12059,7 +12059,7 @@ BUILDIN(petheal)
if (battle_config.pet_equip_required && pd->pet.equip == 0)
pd->s_skill->timer = INVALID_TIMER;
else
- pd->s_skill->timer = add_timer(gettick()+pd->s_skill->delay*1000,pet_heal_timer,sd->bl.id,0);
+ pd->s_skill->timer = iTimer->add_timer(iTimer->gettick()+pd->s_skill->delay*1000,pet_heal_timer,sd->bl.id,0);
return true;
}
@@ -12135,9 +12135,9 @@ BUILDIN(petskillsupport)
if (pd->s_skill->timer != INVALID_TIMER)
{
if (pd->s_skill->id)
- delete_timer(pd->s_skill->timer, pet_skill_support_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_skill_support_timer);
else
- delete_timer(pd->s_skill->timer, pet_heal_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_heal_timer);
}
} else //init memory
pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support));
@@ -12152,7 +12152,7 @@ BUILDIN(petskillsupport)
if (battle_config.pet_equip_required && pd->pet.equip == 0)
pd->s_skill->timer = INVALID_TIMER;
else
- pd->s_skill->timer = add_timer(gettick()+pd->s_skill->delay*1000,pet_skill_support_timer,sd->bl.id,0);
+ pd->s_skill->timer = iTimer->add_timer(iTimer->gettick()+pd->s_skill->delay*1000,pet_skill_support_timer,sd->bl.id,0);
return true;
}
@@ -12182,7 +12182,7 @@ BUILDIN(skilleffect)
/// npcskilleffect "<skill name>",<level>,<x>,<y>
BUILDIN(npcskilleffect)
{
- struct block_list *bl= map_id2bl(st->oid);
+ struct block_list *bl= iMap->id2bl(st->oid);
uint16 skill_id=( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
uint16 skill_lv=script_getnum(st,3);
@@ -12190,7 +12190,7 @@ BUILDIN(npcskilleffect)
int y=script_getnum(st,5);
if (bl)
- clif->skill_poseffect(bl,skill_id,skill_lv,x,y,gettick());
+ clif->skill_poseffect(bl,skill_id,skill_lv,x,y,iTimer->gettick());
return true;
}
@@ -12200,7 +12200,7 @@ BUILDIN(npcskilleffect)
*------------------------------------------*/
BUILDIN(specialeffect)
{
- struct block_list *bl=map_id2bl(st->oid);
+ struct block_list *bl=iMap->id2bl(st->oid);
int type = script_getnum(st,2);
enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA;
@@ -12234,7 +12234,7 @@ BUILDIN(specialeffect2)
enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA;
if( script_hasdata(st,4) )
- sd = map_nick2sd(script_getstr(st,4));
+ sd = iMap->nick2sd(script_getstr(st,4));
if (sd)
clif->specialeffect(&sd->bl, type, target);
@@ -12257,7 +12257,7 @@ BUILDIN(nude)
if( sd->equip_index[ i ] >= 0 ) {
if( !calcflag )
calcflag = 1;
- pc_unequipitem( sd , sd->equip_index[ i ] , 2);
+ iPc->unequipitem( sd , sd->equip_index[ i ] , 2);
}
}
@@ -12289,7 +12289,7 @@ BUILDIN(atcommand)
memset(&dummy_sd, 0, sizeof(TBL_PC));
if (st->oid)
{
- struct block_list* bl = map_id2bl(st->oid);
+ struct block_list* bl = iMap->id2bl(st->oid);
memcpy(&dummy_sd.bl, bl, sizeof(struct block_list));
if (bl->type == BL_NPC)
safestrncpy(dummy_sd.status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
@@ -12423,7 +12423,7 @@ BUILDIN(getmercinfo)
{
char_id = script_getnum(st,3);
- if( ( sd = map_charid2sd(char_id) ) == NULL )
+ if( ( sd = iMap->charid2sd(char_id) ) == NULL )
{
ShowError("buildin_getmercinfo: No such character (char_id=%d).\n", char_id);
script_pushnil(st);
@@ -12546,7 +12546,7 @@ BUILDIN(message)
player = script_getstr(st,2);
msg = script_getstr(st,3);
- if((pl_sd=map_nick2sd((char *) player)) == NULL)
+ if((pl_sd=iMap->nick2sd((char *) player)) == NULL)
return true;
clif->message(pl_sd->fd, msg);
@@ -12561,7 +12561,7 @@ BUILDIN(npctalk)
const char* str;
char name[NAME_LENGTH], message[256];
- struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
+ struct npc_data* nd = (struct npc_data *)iMap->id2bl(st->oid);
str = script_getstr(st,2);
if(nd)
@@ -12582,7 +12582,7 @@ BUILDIN(npcspeed)
int speed;
speed = script_getnum(st,2);
- nd =(struct npc_data *)map_id2bl(st->oid);
+ nd =(struct npc_data *)iMap->id2bl(st->oid);
if( nd ) {
if( nd->ud == &npc_base_ud ) {
@@ -12598,7 +12598,7 @@ BUILDIN(npcspeed)
}
// make an npc walk to a position [Valaris]
BUILDIN(npcwalkto) {
- struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid);
+ struct npc_data *nd=(struct npc_data *)iMap->id2bl(st->oid);
int x=0,y=0;
x=script_getnum(st,2);
@@ -12624,7 +12624,7 @@ BUILDIN(npcwalkto) {
// stop an npc's movement [Valaris]
BUILDIN(npcstop)
{
- struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid);
+ struct npc_data *nd=(struct npc_data *)iMap->id2bl(st->oid);
if(nd) {
unit_stop_walking(&nd->bl,1|4);
@@ -12745,7 +12745,7 @@ BUILDIN(getmapxy)
switch (type){
case 0: //Get Character Position
if( script_hasdata(st,6) )
- sd=map_nick2sd(script_getstr(st,6));
+ sd=iMap->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12760,11 +12760,11 @@ BUILDIN(getmapxy)
if (nd)
bl = &nd->bl;
} else //In case the origin is not an npc?
- bl=map_id2bl(st->oid);
+ bl=iMap->id2bl(st->oid);
break;
case 2: //Get Pet Position
if(script_hasdata(st,6))
- sd=map_nick2sd(script_getstr(st,6));
+ sd=iMap->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12775,7 +12775,7 @@ BUILDIN(getmapxy)
break; //Not supported?
case 4: //Get Homun Position
if(script_hasdata(st,6))
- sd=map_nick2sd(script_getstr(st,6));
+ sd=iMap->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12784,7 +12784,7 @@ BUILDIN(getmapxy)
break;
case 5: //Get Mercenary Position
if(script_hasdata(st,6))
- sd=map_nick2sd(script_getstr(st,6));
+ sd=iMap->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12793,7 +12793,7 @@ BUILDIN(getmapxy)
break;
case 6: //Get Elemental Position
if(script_hasdata(st,6))
- sd=map_nick2sd(script_getstr(st,6));
+ sd=iMap->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12875,7 +12875,7 @@ BUILDIN(summon)
const char *str,*event="";
TBL_PC *sd;
struct mob_data *md;
- int tick = gettick();
+ int tick = iTimer->gettick();
sd=script_rid2sd(st);
if (!sd) return true;
@@ -12896,8 +12896,8 @@ BUILDIN(summon)
md->master_id=sd->bl.id;
md->special_state.ai = AI_ATTACK;
if( md->deletetimer != INVALID_TIMER )
- delete_timer(md->deletetimer, mob_timer_delete);
- md->deletetimer = add_timer(tick+(timeout>0?timeout*1000:60000),mob_timer_delete,md->bl.id,0);
+ iTimer->delete_timer(md->deletetimer, mob_timer_delete);
+ md->deletetimer = iTimer->add_timer(tick+(timeout>0?timeout*1000:60000),mob_timer_delete,md->bl.id,0);
mob_spawn (md); //Now it is ready for spawning.
clif->specialeffect(&md->bl,344,AREA);
sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000);
@@ -12910,13 +12910,13 @@ BUILDIN(summon)
*------------------------------------------*/
BUILDIN(isnight)
{
- script_pushint(st,(night_flag == 1));
+ script_pushint(st,(iMap->night_flag == 1));
return true;
}
BUILDIN(isday)
{
- script_pushint(st,(night_flag == 0));
+ script_pushint(st,(iMap->night_flag == 0));
return true;
}
@@ -13116,12 +13116,12 @@ BUILDIN(getrefine)
*-------------------------------------------------------*/
BUILDIN(night)
{
- if (night_flag != 1) map_night_timer(night_timer_tid, 0, 0, 1);
+ if (iMap->night_flag != 1) iPc->map_night_timer(iPc->night_timer_tid, 0, 0, 1);
return true;
}
BUILDIN(day)
{
- if (night_flag != 0) map_day_timer(day_timer_tid, 0, 0, 1);
+ if (iMap->night_flag != 0) iPc->map_day_timer(iPc->day_timer_tid, 0, 0, 1);
return true;
}
@@ -13138,9 +13138,9 @@ BUILDIN(unequip)
sd = script_rid2sd(st);
if( sd != NULL && num >= 1 && num <= ARRAYLENGTH(equip) )
{
- i = pc_checkequip(sd,equip[num-1]);
+ i = iPc->checkequip(sd,equip[num-1]);
if (i >= 0)
- pc_unequipitem(sd,i,1|2);
+ iPc->unequipitem(sd,i,1|2);
}
return true;
}
@@ -13161,7 +13161,7 @@ BUILDIN(equip)
}
ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == nameid );
if( i < MAX_INVENTORY )
- pc_equipitem(sd,i,item_data->equip);
+ iPc->equipitem(sd,i,item_data->equip);
return true;
}
@@ -14484,7 +14484,7 @@ BUILDIN(npcshopattach)
}
if (flag)
- nd->master_nd = ((struct npc_data *)map_id2bl(st->oid));
+ nd->master_nd = ((struct npc_data *)iMap->id2bl(st->oid));
else
nd->master_nd = NULL;
@@ -14618,7 +14618,7 @@ BUILDIN(checkvending) // check vending [Nab4]
TBL_PC *sd = NULL;
if(script_hasdata(st,2))
- sd = map_nick2sd(script_getstr(st,2));
+ sd = iMap->nick2sd(script_getstr(st,2));
else
sd = script_rid2sd(st);
@@ -14636,7 +14636,7 @@ BUILDIN(checkchatting) // check chatting [Marka]
TBL_PC *sd = NULL;
if(script_hasdata(st,2))
- sd = map_nick2sd(script_getstr(st,2));
+ sd = iMap->nick2sd(script_getstr(st,2));
else
sd = script_rid2sd(st);
@@ -14653,7 +14653,7 @@ BUILDIN(checkidle)
TBL_PC *sd = NULL;
if (script_hasdata(st, 2))
- sd = map_nick2sd(script_getstr(st, 2));
+ sd = iMap->nick2sd(script_getstr(st, 2));
else
sd = script_rid2sd(st);
@@ -14780,7 +14780,7 @@ BUILDIN(rid2name)
{
struct block_list *bl = NULL;
int rid = script_getnum(st,2);
- if((bl = map_id2bl(rid)))
+ if((bl = iMap->id2bl(rid)))
{
switch(bl->type) {
case BL_MOB: script_pushstrcopy(st,((TBL_MOB*)bl)->name); break;
@@ -14810,7 +14810,7 @@ BUILDIN(pcblockmove)
flag = script_getnum(st,3);
if(id)
- sd = map_id2sd(id);
+ sd = iMap->id2sd(id);
else
sd = script_rid2sd(st);
@@ -14830,12 +14830,12 @@ BUILDIN(pcfollow)
targetid = script_getnum(st,3);
if(id)
- sd = map_id2sd(id);
+ sd = iMap->id2sd(id);
else
sd = script_rid2sd(st);
if(sd)
- pc_follow(sd, targetid);
+ iPc->follow(sd, targetid);
return true;
}
@@ -14849,12 +14849,12 @@ BUILDIN(pcstopfollow)
id = script_getnum(st,2);
if(id)
- sd = map_id2sd(id);
+ sd = iMap->id2sd(id);
else
sd = script_rid2sd(st);
if(sd)
- pc_stop_following(sd);
+ iPc->stop_following(sd);
return true;
}
@@ -14871,7 +14871,7 @@ BUILDIN(unitwalk)
{
struct block_list* bl;
- bl = map_id2bl(script_getnum(st,2));
+ bl = iMap->id2bl(script_getnum(st,2));
if( bl == NULL )
{
script_pushint(st, 0);
@@ -14885,7 +14885,7 @@ BUILDIN(unitwalk)
else
{
int map_id = script_getnum(st,3);
- script_pushint(st, unit_walktobl(bl,map_id2bl(map_id),65025,1));
+ script_pushint(st, unit_walktobl(bl,iMap->id2bl(map_id),65025,1));
}
return true;
@@ -14896,7 +14896,7 @@ BUILDIN(unitwalk)
/// unitkill <unit_id>;
BUILDIN(unitkill)
{
- struct block_list* bl = map_id2bl(script_getnum(st,2));
+ struct block_list* bl = iMap->id2bl(script_getnum(st,2));
if( bl != NULL )
status_kill(bl);
@@ -14922,14 +14922,14 @@ BUILDIN(unitwarp)
y = (short)script_getnum(st,5);
if (!unit_id) //Warp the script's runner
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
else
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( strcmp(mapname,"this") == 0 )
map = bl?bl->m:-1;
else
- map = map_mapname2mapid(mapname);
+ map = iMap->mapname2mapid(mapname);
if( map >= 0 && bl != NULL )
script_pushint(st, unit_warp(bl,map,x,y,CLR_OUTSIGHT));
@@ -14954,7 +14954,7 @@ BUILDIN(unitattack)
int actiontype = 0;
// get unit
- unit_bl = map_id2bl(script_getnum(st,2));
+ unit_bl = iMap->id2bl(script_getnum(st,2));
if( unit_bl == NULL ) {
script_pushint(st, 0);
return true;
@@ -14964,11 +14964,11 @@ BUILDIN(unitattack)
get_val(st, data);
if( data_isstring(data) )
{
- TBL_PC* sd = map_nick2sd(script->conv_str(st, data));
+ TBL_PC* sd = iMap->nick2sd(script->conv_str(st, data));
if( sd != NULL )
target_bl = &sd->bl;
} else
- target_bl = map_id2bl(script->conv_num(st, data));
+ target_bl = iMap->id2bl(script->conv_num(st, data));
// request the attack
if( target_bl == NULL )
{
@@ -14983,7 +14983,7 @@ BUILDIN(unitattack)
switch( unit_bl->type )
{
case BL_PC:
- clif->pActionRequest_sub(((TBL_PC *)unit_bl), actiontype > 0 ? 0x07 : 0x00, target_bl->id, gettick());
+ clif->pActionRequest_sub(((TBL_PC *)unit_bl), actiontype > 0 ? 0x07 : 0x00, target_bl->id, iTimer->gettick());
script_pushint(st, 1);
return true;
case BL_MOB:
@@ -15011,7 +15011,7 @@ BUILDIN(unitstop)
unit_id = script_getnum(st,2);
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( bl != NULL )
{
unit_stop_attack(bl);
@@ -15035,7 +15035,7 @@ BUILDIN(unittalk)
unit_id = script_getnum(st,2);
message = script_getstr(st, 3);
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( bl != NULL )
{
struct StringBuf sbuf;
@@ -15063,7 +15063,7 @@ BUILDIN(unitemote)
unit_id = script_getnum(st,2);
emotion = script_getnum(st,3);
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( bl != NULL )
clif->emotion(bl, emotion);
@@ -15087,7 +15087,7 @@ BUILDIN(unitskilluseid)
skill_lv = script_getnum(st,4);
target_id = ( script_hasdata(st,5) ? script_getnum(st,5) : unit_id );
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( bl != NULL )
unit_skilluse_id(bl, target_id, skill_id, skill_lv);
@@ -15113,7 +15113,7 @@ BUILDIN(unitskillusepos)
skill_x = script_getnum(st,5);
skill_y = script_getnum(st,6);
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( bl != NULL )
unit_skilluse_pos(bl, skill_x, skill_y, skill_id, skill_lv);
@@ -15162,7 +15162,7 @@ BUILDIN(sleep2)
if( ticks <= 0 )
{// do nothing
- script_pushint(st, (map_id2sd(st->rid)!=NULL));
+ script_pushint(st, (iMap->id2sd(st->rid)!=NULL));
}
else if( !st->sleep.tick )
{// sleep for the target amount of time
@@ -15173,7 +15173,7 @@ BUILDIN(sleep2)
{// sleep time is over
st->state = RUN;
st->sleep.tick = 0;
- script_pushint(st, (map_id2sd(st->rid)!=NULL));
+ script_pushint(st, (iMap->id2sd(st->rid)!=NULL));
}
return true;
}
@@ -15197,7 +15197,7 @@ BUILDIN(awake)
if( (int)__64BPTRSIZE(node->key) == nd->bl.id )
{// sleep timer for the npc
struct script_state* tst = (struct script_state*)node->data;
- TBL_PC* sd = map_id2sd(tst->rid);
+ TBL_PC* sd = iMap->id2sd(tst->rid);
if( tst->sleep.timer == INVALID_TIMER )
{// already awake ???
@@ -15210,7 +15210,7 @@ BUILDIN(awake)
tst->rid = 0;
}
- delete_timer(tst->sleep.timer, run_script_timer);
+ iTimer->delete_timer(tst->sleep.timer, run_script_timer);
node = script_erase_sleepdb(node);
tst->sleep.timer = INVALID_TIMER;
if(tst->state != RERUNLINE)
@@ -15284,7 +15284,7 @@ BUILDIN(warpportal)
struct skill_unit_group* group;
struct block_list* bl;
- bl = map_id2bl(st->oid);
+ bl = iMap->id2bl(st->oid);
if( bl == NULL )
{
ShowError("script:warpportal: npc is needed\n");
@@ -15343,12 +15343,12 @@ BUILDIN(openauction)
/// @see cell_chk* constants in const.txt for the types
BUILDIN(checkcell)
{
- int16 m = map_mapname2mapid(script_getstr(st,2));
+ int16 m = iMap->mapname2mapid(script_getstr(st,2));
int16 x = script_getnum(st,3);
int16 y = script_getnum(st,4);
cell_chk type = (cell_chk)script_getnum(st,5);
- script_pushint(st, map_getcell(m, x, y, type));
+ script_pushint(st, iMap->getcell(m, x, y, type));
return true;
}
@@ -15360,7 +15360,7 @@ BUILDIN(checkcell)
/// @see cell_* constants in const.txt for the types
BUILDIN(setcell)
{
- int16 m = map_mapname2mapid(script_getstr(st,2));
+ int16 m = iMap->mapname2mapid(script_getstr(st,2));
int16 x1 = script_getnum(st,3);
int16 y1 = script_getnum(st,4);
int16 x2 = script_getnum(st,5);
@@ -15630,7 +15630,7 @@ BUILDIN(checkquest)
BUILDIN(showevent)
{
TBL_PC *sd = script_rid2sd(st);
- struct npc_data *nd = map_id2nd(st->oid);
+ struct npc_data *nd = iMap->id2nd(st->oid);
int state, color;
if( sd == NULL || nd == NULL )
@@ -15659,9 +15659,9 @@ BUILDIN(waitingroom2bg)
if( script_hasdata(st,7) )
nd = npc_name2id(script_getstr(st,7));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
- if( nd == NULL || (cd = (struct chat_data *)map_id2bl(nd->chat_id)) == NULL )
+ if( nd == NULL || (cd = (struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL )
{
script_pushint(st,0);
return true;
@@ -15720,7 +15720,7 @@ BUILDIN(waitingroom2bg_single)
y = script_getnum(st,5);
nd = npc_name2id(script_getstr(st,6));
- if( nd == NULL || (cd = (struct chat_data *)map_id2bl(nd->chat_id)) == NULL || cd->users <= 0 )
+ if( nd == NULL || (cd = (struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL || cd->users <= 0 )
return true;
if( (sd = cd->usersd[0]) == NULL )
@@ -15728,7 +15728,7 @@ BUILDIN(waitingroom2bg_single)
if( bg_team_join(bg_id, sd) )
{
- pc_setpos(sd, mapindex, x, y, CLR_TELEPORT);
+ iPc->setpos(sd, mapindex, x, y, CLR_TELEPORT);
script_pushint(st,1);
}
else
@@ -15790,7 +15790,7 @@ BUILDIN(bg_monster_set_team)
int id = script_getnum(st,2),
bg_id = script_getnum(st,3);
- if( (mbl = map_id2bl(id)) == NULL || mbl->type != BL_MOB )
+ if( (mbl = iMap->id2bl(id)) == NULL || mbl->type != BL_MOB )
return true;
md = (TBL_MOB *)mbl;
md->bg_id = bg_id;
@@ -15832,7 +15832,7 @@ BUILDIN(bg_getareausers)
bg_id = script_getnum(st,2);
str = script_getstr(st,3);
- if( (bg = bg_team_search(bg_id)) == NULL || (m = map_mapname2mapid(str)) < 0 )
+ if( (bg = bg_team_search(bg_id)) == NULL || (m = iMap->mapname2mapid(str)) < 0 )
{
script_pushint(st,0);
return true;
@@ -15862,7 +15862,7 @@ BUILDIN(bg_updatescore)
int16 m;
str = script_getstr(st,2);
- if( (m = map_mapname2mapid(str)) < 0 )
+ if( (m = iMap->mapname2mapid(str)) < 0 )
return true;
map[m].bgscore_lion = script_getnum(st,3);
@@ -15989,7 +15989,7 @@ BUILDIN(instance_detachmap) {
instance_id = st->instance_id;
else return true;
- if( (m = map_mapname2mapid(str)) < 0 || (m = instance->map2imap(m,instance_id)) < 0 ) {
+ if( (m = iMap->mapname2mapid(str)) < 0 || (m = instance->map2imap(m,instance_id)) < 0 ) {
ShowError("buildin_instance_detachmap: Trying to detach invalid map %s\n", str);
return true;
}
@@ -16074,7 +16074,7 @@ BUILDIN(instance_announce) {
return true;
for( i = 0; i < instances[instance_id].num_map; i++ )
- map_foreachinmap(buildin_announce_sub, instances[instance_id].map[i], BL_PC,
+ iMap->foreachinmap(buildin_announce_sub, instances[instance_id].map[i], BL_PC,
mes, strlen(mes)+1, flag&0xf0, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
@@ -16112,7 +16112,7 @@ BUILDIN(has_instance) {
str = script_getstr(st, 2);
- if( (m = map_mapname2mapid(str)) < 0 ) {
+ if( (m = iMap->mapname2mapid(str)) < 0 ) {
script_pushconststr(st, "");
return true;
}
@@ -16133,7 +16133,7 @@ BUILDIN(has_instance) {
if( i != sd->instances )
instance_id = sd->instance[i];
}
- if( instance_id == -1 && sd->status.party_id && (p = party_search(sd->status.party_id)) && p->instances ) {
+ if( instance_id == -1 && sd->status.party_id && (p = iParty->search(sd->status.party_id)) && p->instances ) {
for( i = 0; i < p->instances; i++ ) {
ARR_FIND(0, instances[p->instance[i]].num_map, j, map[instances[p->instance[i]].map[j]].instance_src_map == m);
if( j != instances[p->instance[i]].num_map )
@@ -16167,7 +16167,7 @@ static int buildin_instance_warpall_sub(struct block_list *bl,va_list ap) {
int x = va_arg(ap,int);
int y = va_arg(ap,int);
- pc_setpos(sd,mapindex,x,y,CLR_TELEPORT);
+ iPc->setpos(sd,mapindex,x,y,CLR_TELEPORT);
return 0;
}
@@ -16189,12 +16189,12 @@ BUILDIN(instance_warpall) {
else
return true;
- if( (m = map_mapname2mapid(mapn)) < 0 || (map[m].flag.src4instance && (m = instance->mapid2imapid(m, instance_id)) < 0) )
+ if( (m = iMap->mapname2mapid(mapn)) < 0 || (map[m].flag.src4instance && (m = instance->mapid2imapid(m, instance_id)) < 0) )
return true;
mapindex = map_id2index(m);
- map_foreachininstance(buildin_instance_warpall_sub, instance_id, BL_PC,mapindex,x,y);
+ iMap->foreachininstance(buildin_instance_warpall_sub, instance_id, BL_PC,mapindex,x,y);
return true;
}
@@ -16230,14 +16230,14 @@ BUILDIN(instance_check_party) {
party_id = script_getnum(st,2);
else return true;
- if( !(p = party_search(party_id)) ){
+ if( !(p = iParty->search(party_id)) ){
script_pushint(st, 0); // Returns false if party does not exist.
return true;
}
for( i = 0; i < MAX_PARTY; i++ )
if( (pl_sd = p->data[i].sd) )
- if(map_id2bl(pl_sd->bl.id)){
+ if(iMap->id2bl(pl_sd->bl.id)){
if(pl_sd->status.base_level < min){
script_pushint(st, 0);
return true;
@@ -16293,9 +16293,9 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
// 0:self, 1:target, 2:master, default:random
switch( target )
{
- case 0: tbl = map_id2bl(md->bl.id); break;
- case 1: tbl = map_id2bl(md->target_id); break;
- case 2: tbl = map_id2bl(md->master_id); break;
+ case 0: tbl = iMap->id2bl(md->bl.id); break;
+ case 1: tbl = iMap->id2bl(md->target_id); break;
+ case 2: tbl = iMap->id2bl(md->master_id); break;
default:tbl = battle->get_enemy(&md->bl, DEFAULT_ENEMY_TYPE(md),skill->get_range2(&md->bl, skill_id, skill_lv)); break;
}
@@ -16323,7 +16323,7 @@ BUILDIN(areamobuseskill)
int16 m;
int range,mobid,skill_id,skill_lv,casttime,emotion,target,cancel;
- if( (m = map_mapname2mapid(script_getstr(st,2))) < 0 ) {
+ if( (m = iMap->mapname2mapid(script_getstr(st,2))) < 0 ) {
ShowError("areamobuseskill: invalid map name.\n");
return true;
}
@@ -16343,7 +16343,7 @@ BUILDIN(areamobuseskill)
emotion = script_getnum(st,11);
target = script_getnum(st,12);
- map_foreachinrange(buildin_mobuseskill_sub, &center, range, BL_MOB, mobid, skill_id, skill_lv, casttime, cancel, emotion, target);
+ iMap->foreachinrange(buildin_mobuseskill_sub, &center, range, BL_MOB, mobid, skill_id, skill_lv, casttime, cancel, emotion, target);
return true;
}
@@ -16363,7 +16363,7 @@ BUILDIN(progressbar)
second = script_getnum(st,3);
sd->progressbar.npc_id = st->oid;
- sd->progressbar.timeout = gettick() + second*1000;
+ sd->progressbar.timeout = iTimer->gettick() + second*1000;
clif->progressbar(sd, strtol(color, (char **)NULL, 0), second);
return true;
@@ -16524,10 +16524,10 @@ BUILDIN(setdragon) {
if( (sd = script_rid2sd(st)) == NULL )
return true;
- if( !pc_checkskill(sd,RK_DRAGONTRAINING) || (sd->class_&MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT )
+ if( !iPc->checkskill(sd,RK_DRAGONTRAINING) || (sd->class_&MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT )
script_pushint(st,0);//Doesn't have the skill or it's not a Rune Knight
else if ( pc_isridingdragon(sd) ) {//Is mounted; release
- pc_setoption(sd, sd->sc.option&~OPTION_DRAGON);
+ iPc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
script_pushint(st,1);
} else {//Not mounted; Mount now.
unsigned int option = OPTION_DRAGON1;
@@ -16542,7 +16542,7 @@ BUILDIN(setdragon) {
option = OPTION_DRAGON1;
}
}
- pc_setoption(sd, sd->sc.option|option);
+ iPc->setoption(sd, sd->sc.option|option);
script_pushint(st,1);
}
return true;
@@ -16612,12 +16612,12 @@ BUILDIN(getcharip)
if( script_hasdata(st, 2) )
{
if (script_isstring(st, 2))
- sd = map_nick2sd(script_getstr(st, 2));
+ sd = iMap->nick2sd(script_getstr(st, 2));
else if (script_isint(st, 2) || script_getnum(st, 2))
{
int id;
id = script_getnum(st, 2);
- sd = (map_id2sd(id) ? map_id2sd(id) : map_charid2sd(id));
+ sd = (iMap->id2sd(id) ? iMap->id2sd(id) : iMap->charid2sd(id));
}
}
else
@@ -16803,7 +16803,7 @@ BUILDIN(useatcmd)
memset(&dummy_sd, 0, sizeof(TBL_PC));
if( st->oid )
{
- struct block_list* bl = map_id2bl(st->oid);
+ struct block_list* bl = iMap->id2bl(st->oid);
memcpy(&dummy_sd.bl, bl, sizeof(struct block_list));
if( bl->type == BL_NPC )
safestrncpy(dummy_sd.status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
@@ -16921,10 +16921,10 @@ BUILDIN(getrandgroupitem) {
for (i = 0; i < qty; i += get_count) {
// if not pet egg
if (!pet_create_egg(sd, nameid)) {
- if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT))) {
+ if ((flag = iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT))) {
clif->additem(sd, 0, 0, flag);
- if( pc_candrop(sd,&item_tmp) )
- map_addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ if( iPc->candrop(sd,&item_tmp) )
+ iMap->addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -16937,7 +16937,7 @@ BUILDIN(getrandgroupitem) {
static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap)
{
nullpo_ret(bl);
- map_clearflooritem(bl);
+ iMap->clearflooritem(bl);
return 0;
}
@@ -16949,19 +16949,19 @@ BUILDIN(cleanmap)
int16 x0 = 0, y0 = 0, x1 = 0, y1 = 0;
map = script_getstr(st, 2);
- m = map_mapname2mapid(map);
+ m = iMap->mapname2mapid(map);
if (!m)
return false;
if ((script_lastdata(st) - 2) < 4) {
- map_foreachinmap(atcommand_cleanfloor_sub, m, BL_ITEM);
+ iMap->foreachinmap(atcommand_cleanfloor_sub, m, BL_ITEM);
} else {
x0 = script_getnum(st, 3);
y0 = script_getnum(st, 4);
x1 = script_getnum(st, 5);
y1 = script_getnum(st, 6);
if (x0 > 0 && y0 > 0 && x1 > 0 && y1 > 0) {
- map_foreachinarea(atcommand_cleanfloor_sub, m, x0, y0, x1, y1, BL_ITEM);
+ iMap->foreachinarea(atcommand_cleanfloor_sub, m, x0, y0, x1, y1, BL_ITEM);
} else {
ShowError("cleanarea: invalid coordinate defined!\n");
return false;
@@ -16987,7 +16987,7 @@ BUILDIN(npcskill)
stat_point = script_getnum(st, 4);
npc_level = script_getnum(st, 5);
sd = script_rid2sd(st);
- nd = (struct npc_data *)map_id2bl(sd->npc_id);
+ nd = (struct npc_data *)iMap->id2bl(sd->npc_id);
if (stat_point > battle_config.max_third_parameter) {
ShowError("npcskill: stat point exceeded maximum of %d.\n",battle_config.max_third_parameter );
@@ -17090,7 +17090,7 @@ bool script_hqueue_add(int idx, int var) {
script->hq[idx].item[i] = var;
- if( var >= START_ACCOUNT_NUM && (sd = map_id2sd(var)) ) {
+ if( var >= START_ACCOUNT_NUM && (sd = iMap->id2sd(var)) ) {
for(i = 0; i < sd->queues_count; i++) {
if( sd->queues[i] == -1 ) {
break;
@@ -17134,7 +17134,7 @@ bool script_hqueue_remove(int idx, int var) {
struct map_session_data *sd;
script->hq[idx].item[i] = 0;
- if( var >= START_ACCOUNT_NUM && (sd = map_id2sd(var)) ) {
+ if( var >= START_ACCOUNT_NUM && (sd = iMap->id2sd(var)) ) {
for(i = 0; i < sd->queues_count; i++) {
if( sd->queues[i] == var ) {
break;
@@ -17212,7 +17212,7 @@ bool script_hqueue_del(int idx) {
int i;
for(i = 0; i < script->hq[idx].items; i++) {
- if( script->hq[idx].item[i] >= START_ACCOUNT_NUM && (sd = map_id2sd(script->hq[idx].item[i])) ) {
+ if( script->hq[idx].item[i] >= START_ACCOUNT_NUM && (sd = iMap->id2sd(script->hq[idx].item[i])) ) {
int j;
for(j = 0; j < sd->queues_count; j++) {
if( sd->queues[j] == script->hq[idx].item[i] ) {