summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/socket.c6
-rw-r--r--src/map/atcommand.c6
-rw-r--r--src/map/battle.c17
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/itemdb.h2
-rw-r--r--src/map/npc.c7
-rw-r--r--src/map/pc.c5
-rw-r--r--src/map/script.c673
-rw-r--r--src/map/script.h3
-rw-r--r--src/map/skill.c20
-rw-r--r--src/map/status.c116
-rw-r--r--src/map/status.h68
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc12
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc3
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc81
15 files changed, 640 insertions, 385 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index 87575f5c3..f67c3d074 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -254,7 +254,11 @@ fd_set readfds;
// Maximum packet size in bytes, which the client is able to handle.
// Larger packets cause a buffer overflow and stack corruption.
-static size_t socket_max_client_packet = 24576;
+#if PACKETVER >= 20131223
+static size_t socket_max_client_packet = 0xFFFF;
+#else
+static size_t socket_max_client_packet = 0x6000;
+#endif
#ifdef SHOW_SERVER_STATS
// Data I/O statistics
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 889deac49..b284323fd 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1531,7 +1531,7 @@ ACMD(help) {
}
// Display help contents
- clif->message(fd, tinfo->help);
+ clif->messageln(fd, tinfo->help);
return true;
}
@@ -10092,8 +10092,8 @@ void atcommand_config_read(const char* config_filename) {
if( commandinfo->help == NULL ) {
const char *str = libconfig->setting_get_string(command);
size_t len = strlen(str);
- commandinfo->help = aMalloc( len * sizeof(char) );
- safestrncpy(commandinfo->help, str, len);
+ commandinfo->help = aMalloc(len + 1);
+ safestrncpy(commandinfo->help, str, len + 1);
}
}
}
diff --git a/src/map/battle.c b/src/map/battle.c
index c0c2e29cc..b19e13438 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1188,9 +1188,9 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_
else if( cardfix != 1000 )
damage = damage * cardfix / 1000;
#else
- if ( (cflag & 1) && cardfix_ != 100 )
- damage += damage * (cardfix - 100) / 100;
- else if ( cardfix != 100 )
+ if ((cflag & 1) && cardfix_ != 100)
+ damage += damage * (cardfix_ - 100) / 100;
+ else if (cardfix != 100)
damage += damage * (cardfix - 100) / 100;
#endif
}
@@ -5833,6 +5833,17 @@ void battle_reflect_damage(struct block_list *target, struct block_list *src, st
delay += 100;/* gradual increase so the numbers don't clip in the client */
}
+ if (sc->data[SC_MVPCARD_ORCLORD]) {
+ NORMALIZE_RDAMAGE(damage * sc->data[SC_MVPCARD_ORCLORD]->val1 / 100);
+
+ rdelay = clif->delay_damage(tick + delay, src, src, status_get_amotion(src), status_get_dmotion(src), rdamage, 1, BDT_ENDURE);
+
+ if (tsd)
+ battle->drain(tsd, src, rdamage, rdamage, status_get_race(src), 0);
+ battle->delay_damage(tick, wd->amotion, target, src, 0, CR_REFLECTSHIELD, 0, rdamage, ATK_DEF, rdelay, true);
+
+ delay += 100;
+ }
}
if( ( ssc = status->get_sc(src) ) ) {
if( ssc->data[SC_INSPIRATION] ) {
diff --git a/src/map/clif.c b/src/map/clif.c
index 6fb7dd04e..63a36fa62 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1043,7 +1043,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu
p.font = (sd) ? sd->status.font : 0;
#endif
#if PACKETVER >= 20150000 //actual 20120221
- if( bl->type == BL_MOB ) {
+ if (bl->type == BL_MOB && battle_config.show_monster_hp_bar) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
p.isBoss = ( ((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss ) ? 1 : 0;
@@ -1174,7 +1174,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
p.font = (sd) ? sd->status.font : 0;
#endif
#if PACKETVER >= 20150000 //actual 20120221
- if( bl->type == BL_MOB ) {
+ if (bl->type == BL_MOB && battle_config.show_monster_hp_bar) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
p.isBoss = ( ((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss ) ? 1 : 0;
@@ -1256,7 +1256,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
p.font = (sd) ? sd->status.font : 0;
#endif
#if PACKETVER >= 20150000 //actual 20120221
- if( bl->type == BL_MOB ) {
+ if (bl->type == BL_MOB && battle_config.show_monster_hp_bar) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
p.isBoss = ( ((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss ) ? 1 : 0;
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index c804e4b4f..f508f5c1d 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -535,6 +535,8 @@ struct item_data {
#define itemdb_iscashfood(n) ((n) >= ITEMID_STR_DISH10_ && (n) <= ITEMID_VIT_DISH10_)
#define itemdb_is_GNbomb(n) ((n) >= ITEMID_APPLE_BOMB && (n) <= ITEMID_VERY_HARD_LUMP)
#define itemdb_is_GNthrowable(n) ((n) >= ITEMID_MYSTERIOUS_POWDER && (n) <= ITEMID_BLACK_THING_TO_THROW)
+#define itemdb_is_shadowequip(n) ((n) & (EQP_SHADOW_ARMOR|EQP_SHADOW_WEAPON|EQP_SHADOW_SHIELD|EQP_SHADOW_SHOES|EQP_SHADOW_ACC_R|EQP_SHADOW_ACC_L))
+#define itemdb_is_costumeequip(n) ((n) & (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))
//Item trade restrictions [Skotlex]
#define itemdb_isdropable(item, gmlv) (itemdb->isrestricted((item), (gmlv), 0, itemdb->isdropable_sub))
diff --git a/src/map/npc.c b/src/map/npc.c
index 82365efba..9af6de518 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -313,8 +313,13 @@ int npc_rr_secure_timeout_timer(int tid, int64 tick, int id, intptr_t data) {
* This guy's been idle for longer than allowed, close him.
**/
clif->scriptclose(sd,sd->npc_id);
- clif->scriptclear(sd,sd->npc_id);
sd->npc_idle_timer = INVALID_TIMER;
+ /**
+ * We will end the script ourselves, client will request to end it again if it have dialog,
+ * however it will be ignored, workaround for client stuck if NPC have no dialog. [hemagx]
+ **/
+ sd->state.dialog = 0;
+ npc->scriptcont(sd, sd->npc_id, true);
} else //Create a new instance of ourselves to continue
sd->npc_idle_timer = timer->add(timer->gettick() + (SECURE_NPCTIMEOUT_INTERVAL*1000),npc->secure_timeout_timer,sd->bl.id,0);
#endif
diff --git a/src/map/pc.c b/src/map/pc.c
index 567348d20..43d320a80 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -928,6 +928,11 @@ int pc_isequip(struct map_session_data *sd,int n)
if(item == NULL)
return 0;
+#if PACKETVER <= 20100707
+ if (itemdb_is_shadowequip(item->equip) || itemdb_is_costumeequip(item->equip))
+ return 0;
+#endif
+
if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))
return 1;
diff --git a/src/map/script.c b/src/map/script.c
index 401b0308a..fedfc895c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2644,6 +2644,36 @@ TBL_PC *script_rid2sd(struct script_state *st) {
return sd;
}
+TBL_PC *script_id2sd(struct script_state *st, int account_id) {
+ TBL_PC *sd;
+ if ((sd = map->id2sd(account_id)) == NULL) {
+ ShowWarning("script_id2sd: Player with account ID '%d' not found!\n", account_id);
+ script->reportfunc(st);
+ script->reportsrc(st);
+ }
+ return sd;
+}
+
+TBL_PC *script_charid2sd(struct script_state *st, int char_id) {
+ TBL_PC *sd;
+ if ((sd = map->charid2sd(char_id)) == NULL) {
+ ShowWarning("script_charid2sd: Player with char ID '%d' not found!\n", char_id);
+ script->reportfunc(st);
+ script->reportsrc(st);
+ }
+ return sd;
+}
+
+TBL_PC *script_nick2sd(struct script_state *st, const char *name) {
+ TBL_PC *sd;
+ if ((sd = map->nick2sd(name)) == NULL) {
+ ShowWarning("script_nick2sd: Player name '%s' not found!\n", name);
+ script->reportfunc(st);
+ script->reportsrc(st);
+ }
+ return sd;
+}
+
char *get_val_npcscope_str(struct script_state* st, struct reg_db *n, struct script_data* data) {
if (n)
return (char*)i64db_get(n->vars, reference_getuid(data));
@@ -5928,8 +5958,8 @@ BUILDIN(warpchar) {
y=script_getnum(st,4);
a=script_getnum(st,5);
- sd = map->charid2sd(a);
- if( sd == NULL )
+ sd = script->charid2sd(st, a);
+ if (sd == NULL)
return true;
if(strcmp(str, "Random") == 0)
@@ -6975,8 +7005,8 @@ BUILDIN(checkweight2)
TBL_PC *sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
data_it = script_getdata(st, 2);
data_nb = script_getdata(st, 3);
@@ -7117,12 +7147,12 @@ BUILDIN(getitem) {
offset += 1;
}
- if( script_hasdata(st,4+offset) )
- sd=map->id2sd(script_getnum(st,4+offset)); // <Account ID>
+ if (script_hasdata(st,4+offset))
+ sd = script->id2sd(st, script_getnum(st,4+offset)); // <Account ID>
else
sd=script->rid2sd(st); // Attached player
- if( sd == NULL ) // no target
+ if (sd == NULL) // no target
return true;
//Check if it's stackable.
@@ -7163,12 +7193,12 @@ BUILDIN(getitem2)
offset += 1;
}
- if( script_hasdata(st,11+offset) )
- sd=map->id2sd(script_getnum(st,11+offset)); // <Account ID>
+ if (script_hasdata(st,11+offset))
+ sd = script->id2sd(st, script_getnum(st,11+offset)); // <Account ID>
else
sd=script->rid2sd(st); // Attached player
- if( sd == NULL ) // no target
+ if (sd == NULL) // no target
return true;
if( script_isstringtype(st, 2) ) {
@@ -7334,12 +7364,12 @@ BUILDIN(getnameditem) {
return true;
}
- if( script_isstringtype(st, 3) ) //Char Name
- tsd=map->nick2sd(script_getstr(st, 3));
+ if (script_isstringtype(st, 3)) //Char Name
+ tsd = script->nick2sd(st, script_getstr(st, 3));
else //Char Id was given
- tsd=map->charid2sd(script_getnum(st, 3));
+ tsd = script->charid2sd(st, script_getnum(st, 3));
- if( tsd == NULL ) {
+ if (tsd == NULL) {
//Failed
script_pushint(st,0);
return true;
@@ -7583,11 +7613,10 @@ BUILDIN(delitem) {
if (script_hasdata(st,4)) {
int account_id = script_getnum(st,4);
- sd = map->id2sd(account_id); // <account id>
+ sd = script->id2sd(st, account_id); // <account id>
if (sd == NULL) {
- ShowError("script:delitem: player not found (AID=%d).\n", account_id);
st->state = END;
- return false;
+ return true;
}
} else {
sd = script->rid2sd(st);// attached player
@@ -7640,11 +7669,10 @@ BUILDIN(delitem2) {
if (script_hasdata(st,11)) {
int account_id = script_getnum(st,11);
- sd = map->id2sd(account_id); // <account id>
+ sd = script->id2sd(st, account_id); // <account id>
if (sd == NULL) {
- ShowError("script:delitem2: player not found (AID=%d).\n", account_id);
st->state = END;
- return false;
+ return true;
}
} else {
sd = script->rid2sd(st);// attached player
@@ -7724,12 +7752,12 @@ BUILDIN(readparam) {
TBL_PC *sd;
type=script_getnum(st,2);
- if( script_hasdata(st,3) )
- sd=map->nick2sd(script_getstr(st,3));
+ if (script_hasdata(st,3))
+ sd = script->nick2sd(st, script_getstr(st,3));
else
sd=script->rid2sd(st);
- if(sd==NULL) {
+ if (sd == NULL) {
script_pushint(st,-1);
return true;
}
@@ -8936,8 +8964,8 @@ BUILDIN(guildskill) {
struct guild_skill gd_skill;
sd = script->rid2sd(st);
- if( sd == NULL )
- return false; // no player attached, report source
+ if (sd == NULL)
+ return true; // no player attached, report source
if( (gd = sd->guild) == NULL )
return true;
@@ -9035,7 +9063,7 @@ BUILDIN(getgroupid)
sd = script->rid2sd(st);
if (sd == NULL)
- return false; // no player attached, report source
+ return true; // no player attached, report source
script_pushint(st, pc_get_group_id(sd));
return true;
@@ -9414,8 +9442,8 @@ BUILDIN(savepoint) {
TBL_PC* sd;
sd = script->rid2sd(st);
- if( sd == NULL )
- return false;// no player attached, report source
+ if (sd == NULL)
+ return true; // no player attached, report source
str = script_getstr(st,2);
x = script_getnum(st,3);
@@ -9699,9 +9727,9 @@ BUILDIN(guildchangegm) {
guild_id = script_getnum(st,2);
name = script_getstr(st,3);
- sd=map->nick2sd(name);
+ sd = script->nick2sd(st, name);
- if (!sd)
+ if (sd == NULL)
script_pushint(st,0);
else
script_pushint(st,guild->gm_change(guild_id, sd));
@@ -10020,16 +10048,16 @@ BUILDIN(clone) {
m = map->mapname2mapid(mapname);
if (m < 0) return true;
- sd = map->charid2sd(char_id);
+ sd = script->charid2sd(st, char_id);
if (master_id) {
msd = map->charid2sd(master_id);
- if (msd)
+ if (msd != NULL)
master_id = msd->bl.id;
else
master_id = 0;
}
- if (sd) //Return ID of newly crafted clone.
+ if (sd != NULL) //Return ID of newly crafted clone.
script_pushint(st,mob->clone_spawn(sd, m, x, y, event, master_id, mode, flag, 1000*duration));
else //Failed to create clone.
script_pushint(st,0);
@@ -10266,16 +10294,14 @@ BUILDIN(getnpctimer) {
switch( type ) {
case 0: val = (int)npc->gettimerevent_tick(nd); break; // FIXME: change this to int64 when we'll support 64 bit script values
case 1:
- if( nd->u.scr.rid ) {
- sd = map->id2sd(nd->u.scr.rid);
- if( !sd ) {
- ShowError("buildin_getnpctimer: Attached player not found!\n");
+ if (nd->u.scr.rid) {
+ sd = script->id2sd(st, nd->u.scr.rid);
+ if (sd == NULL)
break;
- }
val = (sd->npc_timer_id != INVALID_TIMER);
- }
- else
+ } else {
val = (nd->u.scr.timerid != INVALID_TIMER);
+ }
break;
case 2: val = nd->u.scr.timeramount; break;
}
@@ -10321,16 +10347,14 @@ BUILDIN(attachnpctimer) {
return false;
}
- if( script_hasdata(st,2) )
- sd = map->nick2sd(script_getstr(st,2));
+ if (script_hasdata(st,2))
+ sd = script->nick2sd(st, script_getstr(st,2));
else
sd = script->rid2sd(st);
- if( !sd )
- {
+ if (sd == NULL) {
script_pushint(st,1);
- ShowWarning("attachnpctimer: Invalid player.\n");
- return false;
+ return true;
}
nd->u.scr.rid = sd->bl.id;
@@ -10438,8 +10462,8 @@ BUILDIN(itemeffect) {
struct item_data *item_data;
sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
nd = (TBL_NPC *)map->id2bl(sd->npc_id);
if( nd == NULL )
@@ -10639,9 +10663,9 @@ BUILDIN(getareausers)
idx = 3;
} else {
TBL_PC *sd = script->rid2sd(st);
- if (!sd) {
+ if (sd == NULL) {
script_pushint(st, -1);
- return false;
+ return true;
}
m = sd->bl.m;
}
@@ -11195,10 +11219,9 @@ BUILDIN(resetlvl)
*------------------------------------------*/
BUILDIN(resetstatus)
{
- TBL_PC *sd;
- sd=script->rid2sd(st);
- if( sd == NULL )
- return false;
+ TBL_PC *sd = script->rid2sd(st);
+ if (sd == NULL)
+ return true;
pc->resetstate(sd);
return true;
}
@@ -11206,11 +11229,11 @@ BUILDIN(resetstatus)
/*==========================================
* script command resetskill
*------------------------------------------*/
-BUILDIN(resetskill) {
- TBL_PC *sd;
- sd=script->rid2sd(st);
- if( sd == NULL )
- return false;
+BUILDIN(resetskill)
+{
+ TBL_PC *sd = script->rid2sd(st);
+ if (sd == NULL)
+ return true;
pc->resetskill(sd, PCRESETSKILL_RESYNC);
return true;
}
@@ -11218,11 +11241,11 @@ BUILDIN(resetskill) {
/*==========================================
* Counts total amount of skill points.
*------------------------------------------*/
-BUILDIN(skillpointcount) {
- TBL_PC *sd;
- sd=script->rid2sd(st);
- if( sd == NULL )
- return false;
+BUILDIN(skillpointcount)
+{
+ TBL_PC *sd = script->rid2sd(st);
+ if (sd == NULL)
+ return true;
script_pushint(st,sd->status.skill_point + pc->resetskill(sd, PCRESETSKILL_RECOUNT));
return true;
}
@@ -11234,12 +11257,12 @@ BUILDIN(changebase) {
TBL_PC *sd=NULL;
int vclass;
- if( script_hasdata(st,3) )
- sd=map->id2sd(script_getnum(st,3));
+ if (script_hasdata(st,3))
+ sd = script->id2sd(st, script_getnum(st,3));
else
sd=script->rid2sd(st);
- if(sd == NULL)
+ if (sd == NULL)
return true;
vclass = script_getnum(st,2);
@@ -11279,7 +11302,7 @@ BUILDIN(changesex)
{
TBL_PC *sd = prepareChangeSex(st);
if (sd == NULL)
- return false;
+ return true;
chrif->changesex(sd, true);
return true;
}
@@ -11291,7 +11314,7 @@ BUILDIN(changecharsex)
{
TBL_PC *sd = prepareChangeSex(st);
if (sd == NULL)
- return false;
+ return true;
chrif->changesex(sd, false);
return true;
}
@@ -12019,13 +12042,13 @@ BUILDIN(emotion) {
if( script_hasdata(st,3) )
player=script_getnum(st,3);
- if (player) {
+ if (player != 0) {
TBL_PC *sd = NULL;
- if( script_hasdata(st,4) )
- sd = map->nick2sd(script_getstr(st,4));
+ if (script_hasdata(st,4))
+ sd = script->nick2sd(st, script_getstr(st,4));
else
sd = script->rid2sd(st);
- if (sd)
+ if (sd != NULL)
clif->emotion(&sd->bl,type);
} else if( script_hasdata(st,4) ) {
TBL_NPC *nd = npc->name2id(script_getstr(st,4));
@@ -12250,10 +12273,10 @@ BUILDIN(getequipcardcnt)
int count;
num=script_getnum(st,2);
- sd=script->rid2sd(st);
+ sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
if (num > 0 && num <= ARRAYLENGTH(script->equip))
i=pc->checkequip(sd,script->equip[num-1]);
@@ -12285,11 +12308,11 @@ BUILDIN(successremovecards)
{
int i=-1,c,cardflag=0;
- TBL_PC* sd = script->rid2sd(st);
+ TBL_PC *sd = script->rid2sd(st);
int num = script_getnum(st,2);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
if (num > 0 && num <= ARRAYLENGTH(script->equip))
i=pc->checkequip(sd,script->equip[num-1]);
@@ -12356,12 +12379,12 @@ BUILDIN(failedremovecards)
{
int i=-1,c,cardflag=0;
- TBL_PC* sd = script->rid2sd(st);
+ TBL_PC *sd = script->rid2sd(st);
int num = script_getnum(st,2);
int typefail = script_getnum(st,3);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
if (num > 0 && num <= ARRAYLENGTH(script->equip))
i=pc->checkequip(sd,script->equip[num-1]);
@@ -12509,8 +12532,8 @@ BUILDIN(mobcount) {
if( strcmp(mapname, "this") == 0 ) {
struct map_session_data *sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
m = sd->bl.m;
} else if( (m = map->mapname2mapid(mapname)) < 0 ) {
@@ -12531,9 +12554,9 @@ BUILDIN(mobcount) {
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 = script->nick2sd(st, partner);
- if(sd==NULL || p_sd==NULL || pc->marriage(sd,p_sd) < 0) {
+ if (sd == NULL || p_sd == NULL || pc->marriage(sd,p_sd) < 0) {
script_pushint(st,0);
return true;
}
@@ -12541,11 +12564,11 @@ BUILDIN(marriage) {
return true;
}
BUILDIN(wedding_effect) {
- TBL_PC *sd=script->rid2sd(st);
+ TBL_PC *sd = script->rid2sd(st);
struct block_list *bl;
- if( sd == NULL )
- return false; //bl=map->id2bl(st->oid);
+ if (sd == NULL)
+ return true; //bl=map->id2bl(st->oid);
bl=&sd->bl;
clif->wedding_effect(bl);
@@ -12575,28 +12598,31 @@ BUILDIN(ispartneron) {
return true;
}
-BUILDIN(getpartnerid) {
- TBL_PC *sd=script->rid2sd(st);
- if( sd == NULL )
- return false;
+BUILDIN(getpartnerid)
+{
+ TBL_PC *sd = script->rid2sd(st);
+ if (sd == NULL)
+ return true;
script_pushint(st,sd->status.partner_id);
return true;
}
-BUILDIN(getchildid) {
- TBL_PC *sd=script->rid2sd(st);
- if( sd == NULL )
- return false;
+BUILDIN(getchildid)
+{
+ TBL_PC *sd = script->rid2sd(st);
+ if (sd == NULL)
+ return true;
script_pushint(st,sd->status.child);
return true;
}
-BUILDIN(getmotherid) {
- TBL_PC *sd=script->rid2sd(st);
- if( sd == NULL )
- return false;
+BUILDIN(getmotherid)
+{
+ TBL_PC *sd = script->rid2sd(st);
+ if (sd == NULL)
+ return true;
script_pushint(st,sd->status.mother);
return true;
@@ -12605,7 +12631,7 @@ BUILDIN(getmotherid) {
BUILDIN(getfatherid) {
TBL_PC *sd=script->rid2sd(st);
if( sd == NULL )
- return false;
+ return true;
script_pushint(st,sd->status.father);
return true;
@@ -12619,8 +12645,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 || !pc->ismarried(sd)
+ || (p_sd = script->charid2sd(st, sd->status.partner_id)) == NULL) {
script_pushint(st,0);
return true;
}
@@ -12929,10 +12955,10 @@ BUILDIN(getequipcardid)
num=script_getnum(st,2);
slot=script_getnum(st,3);
- sd=script->rid2sd(st);
+ sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
if (num > 0 && num <= ARRAYLENGTH(script->equip))
i=pc->checkequip(sd,script->equip[num-1]);
@@ -13439,10 +13465,10 @@ BUILDIN(skilleffect) {
uint16 skill_id=( script_isstringtype(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
uint16 skill_lv=script_getnum(st,3);
- sd=script->rid2sd(st);
+ sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
/* ensure we're standing because the following packet causes the client to virtually set the char to stand,
* which leaves the server thinking it still is sitting. */
@@ -13511,12 +13537,12 @@ BUILDIN(specialeffect2) {
int type = script_getnum(st,2);
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));
+ if (script_hasdata(st,4))
+ sd = script->nick2sd(st, script_getstr(st,4));
else
sd = script->rid2sd(st);
- if (sd)
+ if (sd != NULL)
clif->specialeffect(&sd->bl, type, target);
return true;
@@ -13560,8 +13586,8 @@ BUILDIN(atcommand) {
if (st->rid) {
sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
fd = sd->fd;
} else { //Use a dummy character.
sd = dummy_sd = pc->get_dummy_sd();
@@ -13698,10 +13724,9 @@ BUILDIN(getmercinfo)
if (script_hasdata(st,3)) {
int char_id = script_getnum(st,3);
- if ((sd = map->charid2sd(char_id)) == NULL) {
- ShowError("buildin_getmercinfo: No such character (char_id=%d).\n", char_id);
+ if ((sd = script->charid2sd(st, char_id)) == NULL) {
script_pushnil(st);
- return false;
+ return true;
}
} else {
if ((sd = script->rid2sd(st)) == NULL)
@@ -13742,10 +13767,10 @@ BUILDIN(getmercinfo)
BUILDIN(checkequipedcard)
{
int n,i,c=0;
- TBL_PC *sd=script->rid2sd(st);
+ TBL_PC *sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
c = script_getnum(st,2);
@@ -13816,7 +13841,7 @@ BUILDIN(message) {
player = script_getstr(st,2);
msg = script_getstr(st,3);
- if((pl_sd=map->nick2sd((char *) player)) == NULL)
+ if ((pl_sd = script->nick2sd(st, (char*)player)) == NULL)
return true;
clif->message(pl_sd->fd, msg);
@@ -14009,14 +14034,12 @@ BUILDIN(getnpcclass)
*------------------------------------------*/
BUILDIN(getlook)
{
- int type,val;
- TBL_PC *sd;
- sd=script->rid2sd(st);
- if( sd == NULL )
- return false;
+ int type,val = -1;
+ TBL_PC *sd = script->rid2sd(st);
+ if (sd == NULL)
+ return true;
type=script_getnum(st,2);
- val = -1;
switch(type) {
case LOOK_HAIR: val = sd->status.hair; break; //1
case LOOK_WEAPON: val = sd->status.weapon; break; //2
@@ -14039,12 +14062,11 @@ BUILDIN(getlook)
*------------------------------------------*/
BUILDIN(getsavepoint)
{
- TBL_PC* sd;
int type;
+ TBL_PC *sd = script->rid2sd(st);
- sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
type = script_getnum(st,2);
@@ -14132,58 +14154,95 @@ BUILDIN(getmapxy)
switch (type) {
case 0: //Get Character Position
- if( script_hasdata(st,6) )
- sd=map->nick2sd(script_getstr(st,6));
- else
- sd=script->rid2sd(st);
+ if (script_hasdata(st,6)) {
+ if (script_isstringtype(st,6))
+ sd = map->nick2sd(script_getstr(st,6));
+ else
+ sd = map->id2sd(script_getnum(st,6));
+ } else {
+ sd = script->rid2sd(st);
+ }
if (sd)
bl = &sd->bl;
break;
case 1: //Get NPC Position
- if( script_hasdata(st,6) )
- {
+ if (script_hasdata(st,6)) {
struct npc_data *nd;
- nd=npc->name2id(script_getstr(st,6));
+ if (script_isstringtype(st,6))
+ nd = npc->name2id(script_getstr(st,6));
+ else
+ nd = map->id2nd(script_getnum(st,6));
if (nd)
bl = &nd->bl;
- } else //In case the origin is not an npc?
- bl=map->id2bl(st->oid);
+ } else {
+ //In case the origin is not an npc?
+ bl = map->id2bl(st->oid);
+ }
break;
case 2: //Get Pet Position
- if(script_hasdata(st,6))
- sd=map->nick2sd(script_getstr(st,6));
- else
- sd=script->rid2sd(st);
+ if (script_hasdata(st,6)) {
+ if (script_isstringtype(st,6))
+ sd = map->nick2sd(script_getstr(st,6));
+ else {
+ bl = map->id2bl(script_getnum(st,6));
+ break;
+ }
+ } else {
+ sd = script->rid2sd(st);
+ }
if (sd && sd->pd)
bl = &sd->pd->bl;
break;
case 3: //Get Mob Position
- break; //Not supported?
+ if (script_hasdata(st,6)) {
+ if (script_isstringtype(st,6))
+ break;
+ bl = map->id2bl(script_getnum(st,6));
+ }
+ break;
case 4: //Get Homun Position
- if(script_hasdata(st,6))
- sd=map->nick2sd(script_getstr(st,6));
- else
- sd=script->rid2sd(st);
+ if (script_hasdata(st,6)) {
+ if (script_isstringtype(st,6)) {
+ sd = map->nick2sd(script_getstr(st,6));
+ } else {
+ bl = map->id2bl(script_getnum(st,6));
+ break;
+ }
+ } else {
+ sd = script->rid2sd(st);
+ }
if (sd && sd->hd)
bl = &sd->hd->bl;
break;
case 5: //Get Mercenary Position
- if(script_hasdata(st,6))
- sd=map->nick2sd(script_getstr(st,6));
- else
- sd=script->rid2sd(st);
+ if (script_hasdata(st,6)) {
+ if (script_isstringtype(st,6)) {
+ sd = map->nick2sd(script_getstr(st,6));
+ } else {
+ bl = map->id2bl(script_getnum(st,6));
+ break;
+ }
+ } else {
+ sd = script->rid2sd(st);
+ }
if (sd && sd->md)
bl = &sd->md->bl;
break;
case 6: //Get Elemental Position
- if(script_hasdata(st,6))
- sd=map->nick2sd(script_getstr(st,6));
- else
- sd=script->rid2sd(st);
+ if (script_hasdata(st,6)) {
+ if (script_isstringtype(st,6)) {
+ sd = map->nick2sd(script_getstr(st,6));
+ } else {
+ bl = map->id2bl(script_getnum(st,6));
+ break;
+ }
+ } else {
+ sd = script->rid2sd(st);
+ }
if (sd && sd->ed)
bl = &sd->ed->bl;
@@ -14246,11 +14305,10 @@ BUILDIN(getmapxy)
BUILDIN(logmes)
{
const char *str;
- TBL_PC* sd;
+ TBL_PC *sd = script->rid2sd(st);
- sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
str = script_getstr(st,2);
logs->npc(sd,str);
@@ -14307,13 +14365,12 @@ BUILDIN(isnight) {
*------------------------------------------------*/
BUILDIN(isequippedcnt)
{
- TBL_PC *sd;
int i, j, k, id = 1;
int ret = 0;
+ TBL_PC *sd = script->rid2sd(st);
- sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
for (i=0; id!=0; i++) {
script_fetch(st,i+2, id);
@@ -14357,17 +14414,15 @@ BUILDIN(isequippedcnt)
*------------------------------------------------*/
BUILDIN(isequipped)
{
- TBL_PC *sd;
int i, j, k, id = 1;
int index, flag;
int ret = -1;
//Original hash to reverse it when full check fails.
unsigned int setitem_hash = 0, setitem_hash2 = 0;
+ TBL_PC *sd = script->rid2sd(st);
- sd = script->rid2sd(st);
-
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
setitem_hash = sd->bonus.setitem_hash;
setitem_hash2 = sd->bonus.setitem_hash2;
@@ -14437,16 +14492,15 @@ BUILDIN(isequipped)
* Check how many given inserted cards in the CURRENT
* weapon - used for 2/15's cards patch [Lupus]
*------------------------------------------------*/
-BUILDIN(cardscnt) {
- TBL_PC *sd;
+BUILDIN(cardscnt)
+{
int i, k, id = 1;
int ret = 0;
int index;
+ TBL_PC *sd = script->rid2sd(st);
- sd = script->rid2sd(st);
-
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
for (i=0; id!=0; i++) {
script_fetch(st,i+2, id);
@@ -14480,12 +14534,12 @@ BUILDIN(cardscnt) {
* Returns the refined number of the current item, or an
* item with inventory index specified
*-------------------------------------------------------*/
-BUILDIN(getrefine) {
- TBL_PC *sd;
+BUILDIN(getrefine)
+{
+ TBL_PC *sd = script->rid2sd(st);
- sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
script_pushint(st,sd->status.inventory[status->current_equip_item_index].refine);
return true;
@@ -14575,11 +14629,9 @@ BUILDIN(equip2)
{
int i,nameid,ref,attr,c0,c1,c2,c3;
struct item_data *item_data;
- TBL_PC *sd;
-
- sd = script->rid2sd(st);
+ TBL_PC *sd = script->rid2sd(st);
- if ( sd == NULL ) {
+ if (sd == NULL) {
script_pushint(st,0);
return true;
}
@@ -14866,17 +14918,14 @@ BUILDIN(explode)
const char delimiter = script_getstr(st, 4)[0];
int32 id;
size_t len = strlen(str);
- int i = 0, j = 0;
+ int i = 0, j = 0, k = 0;
int start;
- char *temp;
- const char* name;
+ char *temp = NULL;
+ const char *name;
TBL_PC* sd = NULL;
- temp = (char*)aMalloc(len + 1);
-
- if( !data_isreference(data) )
- {
+ if (!data_isreference(data)) {
ShowError("script:explode: not a variable\n");
script->reportdata(data);
st->state = END;
@@ -14887,36 +14936,39 @@ BUILDIN(explode)
start = reference_getindex(data);
name = reference_getname(data);
- if( !is_string_variable(name) )
- {
+ if (!is_string_variable(name)) {
ShowError("script:explode: not string array\n");
script->reportdata(data);
st->state = END;
return false;// data type mismatch
}
- if( not_server_variable(*name) )
- {
+ if (not_server_variable(*name)) {
sd = script->rid2sd(st);
- if( sd == NULL )
+ if (sd == NULL)
return true;// no player attached
}
- while(str[i] != '\0') {
- if(str[i] == delimiter && start < SCRIPT_MAX_ARRAYSIZE-1) { //break at delimiter but ignore after reaching last array index
+ temp = aMalloc(len + 1);
+
+ for (i = 0; str[i] != '\0'; i++) {
+ if (str[i] == delimiter && (int64)start + k < (int64)(SCRIPT_MAX_ARRAYSIZE-1)) { // FIXME[Haru]: SCRIPT_MAX_ARRAYSIZE should really be unsigned (and INT32_MAX)
+ //break at delimiter but ignore after reaching last array index
temp[j] = '\0';
- script->set_reg(st, sd, reference_uid(id, start++), name, (void*)temp, reference_getref(data));
+ script->set_reg(st, sd, reference_uid(id, start + k), name, (void*)temp, reference_getref(data));
+ k++;
j = 0;
- ++i;
} else {
- temp[j++] = str[i++];
+ temp[j++] = str[i];
}
}
//set last string
temp[j] = '\0';
- script->set_reg(st, sd, reference_uid(id, start), name, (void*)temp, reference_getref(data));
+ script->set_reg(st, sd, reference_uid(id, start + k), name, (void*)temp, reference_getref(data));
aFree(temp);
+
+ script_pushint(st, k + 1);
return true;
}
@@ -15814,13 +15866,13 @@ BUILDIN(petstat)
BUILDIN(callshop)
{
- TBL_PC *sd = NULL;
struct npc_data *nd;
const char *shopname;
int flag = 0;
- sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ TBL_PC *sd = script->rid2sd(st);
+
+ if (sd == NULL)
+ return true;
shopname = script_getstr(st, 2);
if( script_hasdata(st,3) )
flag = script_getnum(st,3);
@@ -16174,12 +16226,12 @@ BUILDIN(checkvending) // check vending [Nab4]
{
TBL_PC *sd = NULL;
- if(script_hasdata(st,2))
- sd = map->nick2sd(script_getstr(st,2));
+ if (script_hasdata(st,2))
+ sd = script->nick2sd(st, script_getstr(st,2));
else
sd = script->rid2sd(st);
- if(sd)
+ if (sd != NULL)
script_pushint(st, sd->state.autotrade ? 2 : sd->state.vending);
else
script_pushint(st,0);
@@ -16191,12 +16243,12 @@ BUILDIN(checkvending) // check vending [Nab4]
BUILDIN(checkchatting) {
TBL_PC *sd = NULL;
- if(script_hasdata(st,2))
- sd = map->nick2sd(script_getstr(st,2));
+ if (script_hasdata(st,2))
+ sd = script->nick2sd(st, script_getstr(st,2));
else
sd = script->rid2sd(st);
- if(sd)
+ if (sd != NULL)
script_pushint(st,(sd->chatID != 0));
else
script_pushint(st,0);
@@ -16208,11 +16260,11 @@ BUILDIN(checkidle) {
TBL_PC *sd = NULL;
if (script_hasdata(st, 2))
- sd = map->nick2sd(script_getstr(st, 2));
+ sd = script->nick2sd(st, script_getstr(st, 2));
else
sd = script->rid2sd(st);
- if (sd)
+ if (sd != NULL)
script_pushint(st, DIFF_TICK32(sockt->last_tick, sd->idletime)); // TODO: change this to int64 when we'll support 64 bit script values
else
script_pushint(st, 0);
@@ -16313,12 +16365,12 @@ BUILDIN(pcblockmove) {
id = script_getnum(st,2);
flag = script_getnum(st,3);
- if(id)
- sd = map->id2sd(id);
+ if (id != 0)
+ sd = script->id2sd(st, id);
else
sd = script->rid2sd(st);
- if(sd)
+ if (sd != NULL)
sd->state.blockedmove = flag > 0;
return true;
@@ -16331,12 +16383,12 @@ BUILDIN(pcfollow) {
id = script_getnum(st,2);
targetid = script_getnum(st,3);
- if(id)
- sd = map->id2sd(id);
+ if (id != 0)
+ sd = script->id2sd(st, id);
else
sd = script->rid2sd(st);
- if(sd)
+ if (sd != NULL)
pc->follow(sd, targetid);
return true;
@@ -16349,12 +16401,12 @@ BUILDIN(pcstopfollow)
id = script_getnum(st,2);
- if(id)
- sd = map->id2sd(id);
+ if (id != 0)
+ sd = script->id2sd(st, id);
else
sd = script->rid2sd(st);
- if(sd)
+ if (sd != NULL)
pc->stop_following(sd);
return true;
@@ -16363,6 +16415,33 @@ BUILDIN(pcstopfollow)
// [zBuffer] List of mob control commands --->
//## TODO always return if the request/whatever was successfull [FlavioJS]
+BUILDIN(getunittype) {
+ struct block_list* bl;
+ int value;
+
+ bl = map->id2bl(script_getnum(st,2));
+
+ if (!bl) {
+ ShowWarning("buildin_getunittype: Error in finding object GID %d!\n", script_getnum(st,2));
+ script_pushint(st,-1);
+ return false;
+ }
+
+ switch (bl->type) {
+ case BL_PC: value = 0; break;
+ case BL_NPC: value = 1; break;
+ case BL_PET: value = 2; break;
+ case BL_MOB: value = 3; break;
+ case BL_HOM: value = 4; break;
+ case BL_MER: value = 5; break;
+ case BL_ELEM: value = 6; break;
+ default: value = -1; break;
+ }
+
+ script_pushint(st, value);
+ return true;
+}
+
/// Makes the unit walk to target position or target id
/// Returns if it was successfull
///
@@ -16460,12 +16539,13 @@ BUILDIN(unitattack) {
return true;
}
- if( script_isstringtype(st, 3) ) {
- TBL_PC* sd = map->nick2sd(script_getstr(st, 3));
- if( sd != NULL )
+ if (script_isstringtype(st, 3)) {
+ TBL_PC* sd = script->nick2sd(st, script_getstr(st, 3));
+ if (sd != NULL)
target_bl = &sd->bl;
- } else
+ } else {
target_bl = map->id2bl(script_getnum(st, 3));
+ }
// request the attack
if( target_bl == NULL )
{
@@ -17130,13 +17210,14 @@ BUILDIN(questinfo)
return true;
}
-BUILDIN(setquest) {
- struct map_session_data *sd = script->rid2sd(st);
+BUILDIN(setquest)
+{
unsigned short i;
int quest_id;
+ struct map_session_data *sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
quest_id = script_getnum(st, 2);
@@ -17161,8 +17242,8 @@ BUILDIN(erasequest)
{
struct map_session_data *sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
if (script_hasdata(st, 3)) {
int quest_id;
@@ -17184,8 +17265,8 @@ BUILDIN(completequest)
{
struct map_session_data *sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
if (script_hasdata(st, 3)) {
int quest_id;
@@ -17203,23 +17284,24 @@ BUILDIN(completequest)
return true;
}
-BUILDIN(changequest) {
+BUILDIN(changequest)
+{
struct map_session_data *sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
quest->change(sd, script_getnum(st, 2),script_getnum(st, 3));
return true;
}
-BUILDIN(questactive) {
+BUILDIN(questactive)
+{
struct map_session_data *sd = script->rid2sd(st);
int qid, i;
if (sd == NULL) {
- ShowError("questactive: no player attached!");
- return false;
+ return true;
}
qid = script_getnum(st, 2);
@@ -17239,13 +17321,14 @@ BUILDIN(questactive) {
return true;
}
-BUILDIN(questprogress) {
+BUILDIN(questprogress)
+{
struct map_session_data *sd = script->rid2sd(st);
enum quest_check_type type = HAVEQUEST;
int quest_progress = 0;
if (sd == NULL)
- return false;
+ return true;
if (script_hasdata(st, 3))
type = (enum quest_check_type)script_getnum(st, 3);
@@ -18282,20 +18365,27 @@ BUILDIN(getcharip) {
struct map_session_data* sd = NULL;
/* check if a character name is specified */
- if( script_hasdata(st, 2) ) {
+ if (script_hasdata(st, 2)) {
if (script_isstringtype(st, 2)) {
sd = map->nick2sd(script_getstr(st, 2));
} else {
int id = script_getnum(st, 2);
sd = (map->id2sd(id) ? map->id2sd(id) : map->charid2sd(id));
}
- } else {
- sd = script->rid2sd(st);
+ } else if ((sd = script->rid2sd(st)) == NULL) {
+ script_pushconststr(st, "");
+ return true;
}
- /* check for sd and IP */
- if (!sd || !sockt->session[sd->fd]->client_addr)
- {
+ if (sd == NULL) {
+ ShowWarning("buildin_getcharip: Player not found!\n");
+ script_pushconststr(st, "");
+ script->reportfunc(st);
+ return false;
+ }
+
+ /* check for IP */
+ if (!sockt->session[sd->fd]->client_addr) {
script_pushconststr(st, "");
return true;
}
@@ -18346,13 +18436,13 @@ BUILDIN(freeloop) {
BUILDIN(sit) {
struct map_session_data *sd = NULL;
- if( script_hasdata(st, 2) )
- sd = map->nick2sd(script_getstr(st, 2));
+ if (script_hasdata(st, 2))
+ sd = script->nick2sd(st, script_getstr(st, 2));
else
sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
if (!pc_issit(sd))
{
@@ -18366,13 +18456,13 @@ BUILDIN(sit) {
BUILDIN(stand) {
struct map_session_data *sd = NULL;
- if( script_hasdata(st, 2) )
- sd = map->nick2sd(script_getstr(st, 2));
+ if (script_hasdata(st, 2))
+ sd = script->nick2sd(st, script_getstr(st, 2));
else
sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
if (pc_issit(sd))
{
@@ -18386,13 +18476,13 @@ BUILDIN(stand) {
BUILDIN(issit) {
struct map_session_data *sd = NULL;
- if( script_hasdata(st, 2) )
- sd = map->nick2sd(script_getstr(st, 2));
+ if (script_hasdata(st, 2))
+ sd = script->nick2sd(st, script_getstr(st, 2));
else
sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
if (pc_issit(sd))
script_pushint(st, 1);
@@ -18502,10 +18592,10 @@ BUILDIN(useatcmd) {
cmd = script_getstr(st,2);
- if( st->rid ) {
+ if (st->rid) {
sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
fd = sd->fd;
} else {
// Use a dummy character.
@@ -18683,21 +18773,17 @@ BUILDIN(cleanmap)
/* Cast a skill on the attached player.
* npcskill <skill id>, <skill lvl>, <stat point>, <NPC level>;
* npcskill "<skill name>", <skill lvl>, <stat point>, <NPC level>; */
-BUILDIN(npcskill) {
- uint16 skill_id;
- unsigned short skill_level;
- unsigned int stat_point;
- unsigned int npc_level;
+BUILDIN(npcskill)
+{
struct npc_data *nd;
- struct map_session_data *sd;
-
- skill_id = script_isstringtype(st, 2) ? skill->name2id(script_getstr(st, 2)) : script_getnum(st, 2);
- skill_level = script_getnum(st, 3);
- stat_point = script_getnum(st, 4);
- npc_level = script_getnum(st, 5);
+ uint16 skill_id = script_isstringtype(st, 2) ? skill->name2id(script_getstr(st, 2)) : script_getnum(st, 2);
+ unsigned short skill_level = script_getnum(st, 3);
+ unsigned int stat_point = script_getnum(st, 4);
+ unsigned int npc_level = script_getnum(st, 5);
+ struct map_session_data *sd = script->rid2sd(st);
- if( !(sd = script->rid2sd(st)) )
- return false;
+ if (sd == NULL)
+ return true;
nd = (struct npc_data *)map->id2bl(sd->npc_id);
@@ -18783,12 +18869,12 @@ BUILDIN(montransform) {
if (script_hasdata(st, 8))
val4 = script_getnum(st, 8);
- if( tick != 0 ) {
- struct map_session_data *sd = map->id2sd(bl->id);
+ if (tick != 0) {
+ struct map_session_data *sd = script->id2sd(st, bl->id);
struct mob_db *monster = mob->db(mob_id);
char msg[CHAT_SIZE_MAX];
- if( !sd )
+ if (sd == NULL)
return true;
if( battle_config.mon_trans_disable_in_gvg && map_flag_gvg2(sd->bl.m) ) {
@@ -19348,12 +19434,12 @@ BUILDIN(bg_join_team) {
struct map_session_data *sd;
int team_id = script_getnum(st, 2);
- if( script_hasdata(st, 3) )
- sd = map->id2sd(script_getnum(st, 3));
+ if (script_hasdata(st, 3))
+ sd = script->id2sd(st, script_getnum(st, 3));
else
sd = script->rid2sd(st);
- if( !sd )
+ if (sd == NULL)
script_pushint(st, -1);
else
script_pushint(st,bg->team_join(team_id, sd)?0:1);
@@ -19373,10 +19459,10 @@ BUILDIN(bg_join_team) {
BUILDIN(countbound)
{
int i, type, j=0, k=0;
- TBL_PC *sd;
+ TBL_PC *sd = script->rid2sd(st);
- if( (sd = script->rid2sd(st)) == NULL )
- return false;
+ if (sd == NULL)
+ return true;
type = script_hasdata(st,2)?script_getnum(st,2):0;
@@ -19409,11 +19495,10 @@ BUILDIN(checkbound)
{
int i, nameid = script_getnum(st,2);
int bound_type = 0;
- TBL_PC *sd;
+ TBL_PC *sd = script->rid2sd(st);
- sd = script->rid2sd(st);
- if( sd == NULL )
- return false;
+ if (sd == NULL)
+ return true;
if( !(itemdb->exists(nameid)) ){
ShowError("script_checkbound: Invalid item ID = %d\n", nameid);
@@ -20382,6 +20467,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(pcblockmove,"ii"),
// <--- [zBuffer] List of player cont commands
// [zBuffer] List of mob control commands --->
+ BUILDIN_DEF(getunittype,"i"),
BUILDIN_DEF(unitwalk,"ii?"),
BUILDIN_DEF(unitkill,"i"),
BUILDIN_DEF(unitwarp,"isii"),
@@ -20790,6 +20876,9 @@ void script_defaults(void) {
script->conv_num = conv_num;
script->conv_str = conv_str;
script->rid2sd = script_rid2sd;
+ script->id2sd = script_id2sd;
+ script->charid2sd = script_charid2sd;
+ script->nick2sd = script_nick2sd;
script->detach_rid = script_detach_rid;
script->push_val = push_val;
script->get_val = get_val;
diff --git a/src/map/script.h b/src/map/script.h
index c47956eeb..36b7edef3 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -647,6 +647,9 @@ struct script_interface {
int (*conv_num) (struct script_state *st,struct script_data *data);
const char* (*conv_str) (struct script_state *st,struct script_data *data);
TBL_PC *(*rid2sd) (struct script_state *st);
+ TBL_PC *(*id2sd) (struct script_state *st, int account_id);
+ TBL_PC *(*charid2sd) (struct script_state *st, int char_id);
+ TBL_PC *(*nick2sd) (struct script_state *st, const char *name);
void (*detach_rid) (struct script_state* st);
struct script_data* (*push_val)(struct script_stack* stack, enum c_op type, int64 val, struct reg_db *ref);
struct script_data *(*get_val) (struct script_state* st, struct script_data* data);
diff --git a/src/map/skill.c b/src/map/skill.c
index 39579156f..8d97409fb 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -14343,6 +14343,8 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
req.sp -= req.sp * sc->data[SC_TELEKINESIS_INTENSE]->val2 / 100;
if (sc->data[SC_TARGET_ASPD])
req.sp -= req.sp * sc->data[SC_TARGET_ASPD]->val1 / 100;
+ if (sc->data[SC_MVPCARD_MISTRESS])
+ req.sp -= req.sp * sc->data[SC_MVPCARD_MISTRESS]->val1 / 100;
}
req.zeny = skill->dbs->db[idx].zeny[skill_lv-1];
@@ -14422,22 +14424,24 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
if (itemid_isgemstone(req.itemid[i]) && skill_id != HW_GANBANTEIN) {
if (sd->special_state.no_gemstone) {
// All gem skills except Hocus Pocus and Ganbantein can cast for free with Mistress card [helvetica]
- if( skill_id != SA_ABRACADABRA )
+ if (skill_id != SA_ABRACADABRA)
req.itemid[i] = req.amount[i] = 0;
- else if( --req.amount[i] < 1 )
+ else if (--req.amount[i] < 1)
req.amount[i] = 1; // Hocus Pocus always use at least 1 gem
}
- if(sc && sc->data[SC_INTOABYSS])
- {
- if( skill_id != SA_ABRACADABRA )
+ if (sc && sc->data[SC_INTOABYSS]) {
+ if (skill_id != SA_ABRACADABRA)
req.itemid[i] = req.amount[i] = 0;
- else if( --req.amount[i] < 1 )
+ else if (--req.amount[i] < 1)
req.amount[i] = 1; // Hocus Pocus always use at least 1 gem
}
+ if (sc && sc->data[SC_MVPCARD_MISTRESS]) {
+ req.itemid[i] = req.amount[i] = 0;
+ }
}
- if( skill_id >= HT_SKIDTRAP && skill_id <= HT_TALKIEBOX && pc->checkskill(sd, RA_RESEARCHTRAP) > 0){
+ if (skill_id >= HT_SKIDTRAP && skill_id <= HT_TALKIEBOX && pc->checkskill(sd, RA_RESEARCHTRAP) > 0) {
int16 item_index;
- if ((item_index = pc->search_inventory(sd,req.itemid[i])) == INDEX_NOT_FOUND
+ if ((item_index = pc->search_inventory(sd, req.itemid[i])) == INDEX_NOT_FOUND
|| sd->status.inventory[item_index].amount < req.amount[i]
) {
req.itemid[i] = ITEMID_TRAP_ALLOY;
diff --git a/src/map/status.c b/src/map/status.c
index f4fd04467..9f7465da0 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -860,6 +860,12 @@ void initChangeTables(void) {
status->dbs->IconChangeTable[SC_GEFFEN_MAGIC3] = SI_GEFFEN_MAGIC3;
status->dbs->IconChangeTable[SC_FENRIR_CARD] = SI_FENRIR_CARD;
+ // MVP Scrolls
+ status->dbs->IconChangeTable[SC_MVPCARD_TAOGUNKA] = SI_MVPCARD_TAOGUNKA;
+ status->dbs->IconChangeTable[SC_MVPCARD_MISTRESS] = SI_MVPCARD_MISTRESS;
+ status->dbs->IconChangeTable[SC_MVPCARD_ORCHERO] = SI_MVPCARD_ORCHERO;
+ status->dbs->IconChangeTable[SC_MVPCARD_ORCLORD] = SI_MVPCARD_ORCLORD;
+
// Mercenary Bonus Effects
status->dbs->IconChangeTable[SC_MER_FLEE] = SI_MER_FLEE;
status->dbs->IconChangeTable[SC_MER_ATK] = SI_MER_ATK;
@@ -953,13 +959,23 @@ void initChangeTables(void) {
status->dbs->IconChangeTable[SC_REBOUND] = SI_REBOUND;
status->dbs->IconChangeTable[SC_ALL_RIDING] = SI_ALL_RIDING;
status->dbs->IconChangeTable[SC_MONSTER_TRANSFORM] = SI_MONSTER_TRANSFORM;
+
+ // Costumes
status->dbs->IconChangeTable[SC_MOONSTAR] = SI_MOONSTAR;
status->dbs->IconChangeTable[SC_SUPER_STAR] = SI_SUPER_STAR;
status->dbs->IconChangeTable[SC_STRANGELIGHTS] = SI_STRANGELIGHTS;
status->dbs->IconChangeTable[SC_DECORATION_OF_MUSIC] = SI_DECORATION_OF_MUSIC;
status->dbs->IconChangeTable[SC_LJOSALFAR] = SI_LJOSALFAR;
status->dbs->IconChangeTable[SC_MERMAID_LONGING] = SI_MERMAID_LONGING;
-
+ status->dbs->IconChangeTable[SC_HAT_EFFECT] = SI_HAT_EFFECT;
+ status->dbs->IconChangeTable[SC_FLOWERSMOKE] = SI_FLOWERSMOKE;
+ status->dbs->IconChangeTable[SC_FSTONE] = SI_FSTONE;
+ status->dbs->IconChangeTable[SC_HAPPINESS_STAR] = SI_HAPPINESS_STAR;
+ status->dbs->IconChangeTable[SC_MAPLE_FALLS] = SI_MAPLE_FALLS;
+ status->dbs->IconChangeTable[SC_TIME_ACCESSORY] = SI_TIME_ACCESSORY;
+ status->dbs->IconChangeTable[SC_MAGICAL_FEATHER] = SI_MAGICAL_FEATHER;
+ status->dbs->IconChangeTable[SC_BLOSSOM_FLUTTERING] = SI_BLOSSOM_FLUTTERING;
+
// Other SC which are not necessarily associated to skills.
status->dbs->ChangeFlagTable[SC_ATTHASTE_POTION1] = SCB_ASPD;
status->dbs->ChangeFlagTable[SC_ATTHASTE_POTION2] = SCB_ASPD;
@@ -1008,7 +1024,6 @@ void initChangeTables(void) {
status->dbs->ChangeFlagTable[SC_ARMOR_RESIST] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_ATKER_BLOOD] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_WALKSPEED] |= SCB_SPEED;
- status->dbs->ChangeFlagTable[SC_ITEMSCRIPT] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_TARGET_BLOOD] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_TARGET_ASPD] |= SCB_MAXSP;
status->dbs->ChangeFlagTable[SC_ATKER_ASPD] |= SCB_MAXHP | SCB_ALL;
@@ -1096,13 +1111,27 @@ void initChangeTables(void) {
status->dbs->ChangeFlagTable[SC_GEFFEN_MAGIC3] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_FENRIR_CARD] |= SCB_MATK | SCB_ALL;
- // Costume
+ // MVP Scrolls
+ status->dbs->ChangeFlagTable[SC_MVPCARD_TAOGUNKA] |= SCB_MAXHP | SCB_DEF | SCB_MDEF;
+ status->dbs->ChangeFlagTable[SC_MVPCARD_MISTRESS] |= SCB_ALL;
+ status->dbs->ChangeFlagTable[SC_MVPCARD_ORCHERO] |= SCB_ALL;
+ status->dbs->ChangeFlagTable[SC_MVPCARD_ORCLORD] |= SCB_ALL;
+
+ // Costumes
status->dbs->ChangeFlagTable[SC_MOONSTAR] |= SCB_NONE;
status->dbs->ChangeFlagTable[SC_SUPER_STAR] |= SCB_NONE;
status->dbs->ChangeFlagTable[SC_STRANGELIGHTS] |= SCB_NONE;
status->dbs->ChangeFlagTable[SC_DECORATION_OF_MUSIC] |= SCB_NONE;
status->dbs->ChangeFlagTable[SC_LJOSALFAR] |= SCB_NONE;
status->dbs->ChangeFlagTable[SC_MERMAID_LONGING] |= SCB_NONE;
+ status->dbs->ChangeFlagTable[SC_HAT_EFFECT] |= SCB_NONE;
+ status->dbs->ChangeFlagTable[SC_FLOWERSMOKE] |= SCB_NONE;
+ status->dbs->ChangeFlagTable[SC_FSTONE] |= SCB_NONE;
+ status->dbs->ChangeFlagTable[SC_HAPPINESS_STAR] |= SCB_NONE;
+ status->dbs->ChangeFlagTable[SC_MAPLE_FALLS] |= SCB_NONE;
+ status->dbs->ChangeFlagTable[SC_TIME_ACCESSORY] |= SCB_NONE;
+ status->dbs->ChangeFlagTable[SC_MAGICAL_FEATHER] |= SCB_NONE;
+ status->dbs->ChangeFlagTable[SC_BLOSSOM_FLUTTERING] |= SCB_NONE;
/* status->dbs->DisplayType Table [Ind/Hercules] */
status->dbs->DisplayType[SC_ALL_RIDING] = true;
@@ -1127,12 +1156,22 @@ void initChangeTables(void) {
status->dbs->DisplayType[SC_BLOOD_SUCKER] = true;
status->dbs->DisplayType[SC__SHADOWFORM] = true;
status->dbs->DisplayType[SC_MONSTER_TRANSFORM] = true;
+
+ // Costumes
status->dbs->DisplayType[SC_MOONSTAR] = true;
status->dbs->DisplayType[SC_SUPER_STAR] = true;
status->dbs->DisplayType[SC_STRANGELIGHTS] = true;
status->dbs->DisplayType[SC_DECORATION_OF_MUSIC] = true;
status->dbs->DisplayType[SC_LJOSALFAR] = true;
status->dbs->DisplayType[SC_MERMAID_LONGING] = true;
+ status->dbs->DisplayType[SC_HAT_EFFECT] = true;
+ status->dbs->DisplayType[SC_FLOWERSMOKE] = true;
+ status->dbs->DisplayType[SC_FSTONE] = true;
+ status->dbs->DisplayType[SC_HAPPINESS_STAR] = true;
+ status->dbs->DisplayType[SC_MAPLE_FALLS] = true;
+ status->dbs->DisplayType[SC_TIME_ACCESSORY] = true;
+ status->dbs->DisplayType[SC_MAGICAL_FEATHER] = true;
+ status->dbs->DisplayType[SC_BLOSSOM_FLUTTERING] = true;
if( !battle_config.display_hallucination ) //Disable Hallucination.
status->dbs->IconChangeTable[SC_ILLUSION] = SI_BLANK;
@@ -2530,12 +2569,6 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
}
}
- if( sc->count && sc->data[SC_ITEMSCRIPT] ) {
- struct item_data *data = itemdb->exists(sc->data[SC_ITEMSCRIPT]->val1);
- if( data && data->script )
- script->run_use_script(sd, data, 0);
- }
-
status->calc_pc_additional(sd, opt);
if( sd->pd ) { // Pet Bonus
@@ -5149,14 +5182,16 @@ defType status_calc_def(struct block_list *bl, struct status_change *sc, int def
def += sc->data[SC_SHIELDSPELL_REF]->val2;
if (sc->data[SC_PRESTIGE])
def += sc->data[SC_PRESTIGE]->val1;
- if (sc->data[SC_VOLCANIC_ASH] && (bl->type==BL_MOB)) {
- if (status_get_race(bl)==RC_PLANT)
+ if (sc->data[SC_VOLCANIC_ASH] && (bl->type == BL_MOB)) {
+ if (status_get_race(bl) == RC_PLANT)
def /= 2;
}
if (sc->data[SC_UNLIMIT])
return 1;
if (sc->data[SC_ARMORSCROLL])
def += sc->data[SC_ARMORSCROLL]->val1;
+ if (sc->data[SC_MVPCARD_TAOGUNKA])
+ def -= sc->data[SC_MVPCARD_TAOGUNKA]->val2;
return (defType)cap_value(def,DEFTYPE_MIN,DEFTYPE_MAX);
}
@@ -5287,6 +5322,8 @@ defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int md
return 1;
if (sc->data[SC_FREYJASCROLL])
mdef += sc->data[SC_FREYJASCROLL]->val1;
+ if (sc->data[SC_MVPCARD_TAOGUNKA])
+ mdef -= sc->data[SC_MVPCARD_TAOGUNKA]->val3;
return (defType)cap_value(mdef,DEFTYPE_MIN,DEFTYPE_MAX);
}
@@ -5891,6 +5928,8 @@ unsigned int status_calc_maxhp(struct block_list *bl, struct status_change *sc,
maxhp += maxhp * sc->data[SC_SOULSCROLL]->val1 / 100;
if (sc->data[SC_ATKER_ASPD])
maxhp += maxhp * sc->data[SC_ATKER_ASPD]->val1 / 100;
+ if (sc->data[SC_MVPCARD_TAOGUNKA])
+ maxhp += maxhp * sc->data[SC_MVPCARD_TAOGUNKA]->val1 / 100;
return (unsigned int)cap_value(maxhp,1,UINT_MAX);
}
@@ -6754,9 +6793,11 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ
if (sc) {
if (sc->data[SC_SCRESIST])
- sc_def += sc->data[SC_SCRESIST]->val1*100; //Status resist
+ sc_def += sc->data[SC_SCRESIST]->val1 * 100; //Status resist
else if (sc->data[SC_SIEGFRIED])
- sc_def += sc->data[SC_SIEGFRIED]->val3*100; //Status resistance.
+ sc_def += sc->data[SC_SIEGFRIED]->val3 * 100; //Status resistance.
+ if (sc && sc->data[SC_MVPCARD_ORCHERO])
+ sc_def += sc->data[SC_MVPCARD_ORCHERO]->val1 * 100;
}
//When tick def not set, reduction is the same for both.
@@ -9474,31 +9515,6 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
if (battle_config.sc_castcancel&bl->type)
unit->skillcastcancel(bl, 0);
break;
- /* */
- case SC_ITEMSCRIPT:
- if( sd ) {
- switch( val1 ) {
- case ITEMID_PHREEONI_CARD:
- clif->status_change(bl, SI_FOOD_BASICHIT, 1, tick, 0, 0, 0);
- break;
- case ITEMID_GHOSTRING_CARD:
- clif->status_change(bl,SI_ARMOR_PROPERTY,1,tick,0,0,0);
- break;
- case ITEMID_TAO_GUNKA_CARD:
- clif->status_change(bl,SI_MVPCARD_TAOGUNKA,1,tick,0,0,0);
- break;
- case ITEMID_MISTRESS_CARD:
- clif->status_change(bl,SI_MVPCARD_MISTRESS,1,tick,0,0,0);
- break;
- case ITEMID_ORC_HERO_CARD:
- clif->status_change(bl,SI_MVPCARD_ORCHERO,1,tick,0,0,0);
- break;
- case ITEMID_ORC_LOAD_CARD:
- clif->status_change(bl,SI_MVPCARD_ORCLORD,1,tick,0,0,0);
- break;
- }
- }
- break;
}
// Set option as needed.
@@ -10365,30 +10381,6 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
if( sce->val2 )
status_change_end(bl, (sc_type)sce->val2, INVALID_TIMER);
break;
- case SC_ITEMSCRIPT:
- if( sd ) {
- switch( sce->val1 ) {
- case ITEMID_PHREEONI_CARD:
- clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_FOOD_BASICHIT);
- break;
- case ITEMID_GHOSTRING_CARD:
- clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_ARMOR_PROPERTY);
- break;
- case ITEMID_TAO_GUNKA_CARD:
- clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_MVPCARD_TAOGUNKA);
- break;
- case ITEMID_MISTRESS_CARD:
- clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_MVPCARD_MISTRESS);
- break;
- case ITEMID_ORC_HERO_CARD:
- clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_MVPCARD_ORCHERO);
- break;
- case ITEMID_ORC_LOAD_CARD:
- clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_MVPCARD_ORCLORD);
- break;
- }
- }
- break;
case SC_OVERED_BOOST:
switch( bl->type ){
case BL_HOM:
diff --git a/src/map/status.h b/src/map/status.h
index 695b5f3cf..2bf3c0a57 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -390,8 +390,8 @@ typedef enum sc_type {
//SC_DEFRATIOATK,
//SC_HPDRAIN,
//SC_SKILLATKBONUS,
- SC_ITEMSCRIPT = 290,
- SC_S_LIFEPOTION,
+ //SC_ITEMSCRIPT,
+ SC_S_LIFEPOTION = 291,
SC_L_LIFEPOTION,
SC_CASH_PLUSONLYJOBEXP,
//SC_IGNOREDEF,
@@ -793,6 +793,21 @@ typedef enum sc_type {
SC_CUP_OF_BOZA,
SC_OVERLAPEXPUP,
SC_MORA_BUFF,
+
+ // MVP Scrolls
+ SC_MVPCARD_TAOGUNKA,
+ SC_MVPCARD_MISTRESS,
+ SC_MVPCARD_ORCHERO,
+ SC_MVPCARD_ORCLORD,
+
+ SC_HAT_EFFECT,
+ SC_FLOWERSMOKE,
+ SC_FSTONE, // 620
+ SC_HAPPINESS_STAR,
+ SC_MAPLE_FALLS,
+ SC_TIME_ACCESSORY,
+ SC_MAGICAL_FEATHER,
+ SC_BLOSSOM_FLUTTERING,
SC_MAX, //Automatically updated max, used in for's to check we are within bounds.
} sc_type;
@@ -1398,7 +1413,16 @@ enum si_type {
SI_ODINS_POWER = 583,
SI_STYLE_CHANGE = 584,
SI_SONIC_CLAW_POSTDELAY = 585,
- /* IDs 586 - 595 Currently Unused */
+ //SI_ = 586,
+ //SI_ = 587,
+ //SI_ = 588,
+ //SI_ = 589,
+ //SI_ = 590,
+ //SI_ = 591,
+ //SI_ = 592,
+ //SI_ = 593,
+ //SI_ = 594,
+ //SI_ = 595,
SI_SILVERVEIN_RUSH_POSTDELAY = 596,
SI_MIDNIGHT_FRENZY_POSTDELAY = 597,
SI_GOLDENE_FERSE = 598,
@@ -1629,7 +1653,10 @@ enum si_type {
//SI_MTF_RANGEATK2 = 818,
//SI_MTF_ASPD2 = 819,
//SI_MTF_MATK2 = 820,
- /* IDs 821 - 824 Currently Unused */
+ //SI_SHOW_NPCHPBAR = 821,
+ SI_FLOWERSMOKE = 822,
+ SI_FSTONE = 823,
+ //SI_DAILYSENDMAILCNT = 824,
//SI_QSCARABA = 825,
SI_LJOSALFAR = 826,
//SI_PAD_READER_KNIGHT = 827,
@@ -1650,18 +1677,35 @@ enum si_type {
//SI_PAD_READER_GUNSLINGER = 842,
//SI_PAD_READER_SUPERNOVICE = 843,
//SI_ESSENCE_OF_TIME = 844,
-
- /* IDs 845 - 859 Currently Unused */
+ //SI_MINIGAME_ROULETTE = 845,
+ //SI_MINIGAME_GOLD_POINT = 846,
+ //SI_MINIGAME_SILVER_POINT = 847,
+ //SI_MINIGAME_BRONZE_POINT = 848,
+ SI_HAPPINESS_STAR = 849,
+
+ //SI_SUMMEREVENT01 = 850,
+ //SI_SUMMEREVENT02 = 851,
+ //SI_SUMMEREVENT03 = 852,
+ //SI_SUMMEREVENT04 = 853,
+ //SI_SUMMEREVENT05 = 854,
+ //SI_MINIGAME_ROULETTE_BONUS_ITEM = 855,
+ //SI_DRESS_UP = 856,
+ SI_MAPLE_FALLS = 857,
+ //SI_ALL_NIFLHEIM_RECALL = 858,
+ //SI_ = 859,
//SI_MTF_MARIONETTE = 860,
//SI_MTF_LUDE = 861,
//SI_MTF_CRUISER = 862,
SI_MERMAID_LONGING = 863,
- /* IDs 864 Currently Unused */
+ SI_MAGICAL_FEATHER = 864,
//SI_DRACULA_CARD = 865,
- /* ID 866 Currently Unused */
+ //SI_ = 866,
//SI_LIMIT_POWER_BOOSTER = 867,
- /* IDs 868 - 871 Currently Unused */
- //SI_TIME_ACCESSORY = 872,
+ //SI_ = 868,
+ //SI_ = 869,
+ //SI_ = 870,
+ //SI_ = 871,
+ SI_TIME_ACCESSORY = 872,
//SI_EP16_DEF = 873,
//SI_NORMAL_ATKED_SP = 874,
//SI_BODYSTATE_STONECURSE = 875,
@@ -1684,7 +1728,7 @@ enum si_type {
//SI_CHERRY_BLOSSOM_CAKE = 892,
//SI_SU_STOOP = 893,
//SI_CATNIPPOWDER = 894,
- /* ID 895 Currently Unused */
+ SI_BLOSSOM_FLUTTERING = 895,
//SI_SV_ROOTTWIST = 896,
//SI_ATTACK_PROPERTY_NOTHING = 897,
//SI_ATTACK_PROPERTY_WATER = 898,
@@ -1724,7 +1768,7 @@ enum si_type {
//SI_HELM_ASIR = 931,
//SI_HELM_URJ = 932,
//SI_SUHIDE = 933,
- /* ID 934 Currently Unused */
+ //SI_ = 934,
//SI_DORAM_BUF_01 = 935,
//SI_DORAM_BUF_02 = 936,
//SI_SPRITEMABLE = 937,
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 59844e766..92b2d4bd5 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -4456,6 +4456,12 @@ struct {
struct HPMHookPoint *HP_script_conv_str_post;
struct HPMHookPoint *HP_script_rid2sd_pre;
struct HPMHookPoint *HP_script_rid2sd_post;
+ struct HPMHookPoint *HP_script_id2sd_pre;
+ struct HPMHookPoint *HP_script_id2sd_post;
+ struct HPMHookPoint *HP_script_charid2sd_pre;
+ struct HPMHookPoint *HP_script_charid2sd_post;
+ struct HPMHookPoint *HP_script_nick2sd_pre;
+ struct HPMHookPoint *HP_script_nick2sd_post;
struct HPMHookPoint *HP_script_detach_rid_pre;
struct HPMHookPoint *HP_script_detach_rid_post;
struct HPMHookPoint *HP_script_push_val_pre;
@@ -10275,6 +10281,12 @@ struct {
int HP_script_conv_str_post;
int HP_script_rid2sd_pre;
int HP_script_rid2sd_post;
+ int HP_script_id2sd_pre;
+ int HP_script_id2sd_post;
+ int HP_script_charid2sd_pre;
+ int HP_script_charid2sd_post;
+ int HP_script_nick2sd_pre;
+ int HP_script_nick2sd_post;
int HP_script_detach_rid_pre;
int HP_script_detach_rid_post;
int HP_script_push_val_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index bc78fe8b4..4a18d529d 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2282,6 +2282,9 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(script->conv_num, HP_script_conv_num) },
{ HP_POP(script->conv_str, HP_script_conv_str) },
{ HP_POP(script->rid2sd, HP_script_rid2sd) },
+ { HP_POP(script->id2sd, HP_script_id2sd) },
+ { HP_POP(script->charid2sd, HP_script_charid2sd) },
+ { HP_POP(script->nick2sd, HP_script_nick2sd) },
{ HP_POP(script->detach_rid, HP_script_detach_rid) },
{ HP_POP(script->push_val, HP_script_push_val) },
{ HP_POP(script->get_val, HP_script_get_val) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 4c828dc56..8f6ec125b 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -59445,6 +59445,87 @@ TBL_PC* HP_script_rid2sd(struct script_state *st) {
}
return retVal___;
}
+TBL_PC* HP_script_id2sd(struct script_state *st, int account_id) {
+ int hIndex = 0;
+ TBL_PC* retVal___ = NULL;
+ if( HPMHooks.count.HP_script_id2sd_pre ) {
+ TBL_PC* (*preHookFunc) (struct script_state *st, int *account_id);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_id2sd_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_id2sd_pre[hIndex].func;
+ retVal___ = preHookFunc(st, &account_id);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.id2sd(st, account_id);
+ }
+ if( HPMHooks.count.HP_script_id2sd_post ) {
+ TBL_PC* (*postHookFunc) (TBL_PC* retVal___, struct script_state *st, int *account_id);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_id2sd_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_id2sd_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, st, &account_id);
+ }
+ }
+ return retVal___;
+}
+TBL_PC* HP_script_charid2sd(struct script_state *st, int char_id) {
+ int hIndex = 0;
+ TBL_PC* retVal___ = NULL;
+ if( HPMHooks.count.HP_script_charid2sd_pre ) {
+ TBL_PC* (*preHookFunc) (struct script_state *st, int *char_id);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_charid2sd_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_charid2sd_pre[hIndex].func;
+ retVal___ = preHookFunc(st, &char_id);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.charid2sd(st, char_id);
+ }
+ if( HPMHooks.count.HP_script_charid2sd_post ) {
+ TBL_PC* (*postHookFunc) (TBL_PC* retVal___, struct script_state *st, int *char_id);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_charid2sd_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_charid2sd_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, st, &char_id);
+ }
+ }
+ return retVal___;
+}
+TBL_PC* HP_script_nick2sd(struct script_state *st, const char *name) {
+ int hIndex = 0;
+ TBL_PC* retVal___ = NULL;
+ if( HPMHooks.count.HP_script_nick2sd_pre ) {
+ TBL_PC* (*preHookFunc) (struct script_state *st, const char *name);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_nick2sd_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_nick2sd_pre[hIndex].func;
+ retVal___ = preHookFunc(st, name);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.nick2sd(st, name);
+ }
+ if( HPMHooks.count.HP_script_nick2sd_post ) {
+ TBL_PC* (*postHookFunc) (TBL_PC* retVal___, struct script_state *st, const char *name);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_nick2sd_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_nick2sd_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, st, name);
+ }
+ }
+ return retVal___;
+}
void HP_script_detach_rid(struct script_state *st) {
int hIndex = 0;
if( HPMHooks.count.HP_script_detach_rid_pre ) {