diff options
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 76 |
1 files changed, 58 insertions, 18 deletions
diff --git a/src/map/script.c b/src/map/script.c index b9a826b93..8a3744f27 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11282,7 +11282,9 @@ BUILDIN(getunits) if (not_server_variable(*name)) { sd = script->rid2sd(st); + if (sd == NULL) { + script_pushint(st, 0); return true; // player variable but no player attached } } @@ -13006,7 +13008,8 @@ int script_mapflag_pvp_sub(struct block_list *bl, va_list ap) sd = BL_UCAST(BL_PC, bl); if (sd->pvp_timer == INVALID_TIMER) { - sd->pvp_timer = timer->add(timer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0); + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0); sd->pvp_rank = 0; sd->pvp_lastusers = 0; sd->pvp_point = 5; @@ -13245,7 +13248,8 @@ BUILDIN(pvpon) if( sd->bl.m != m || sd->pvp_timer != INVALID_TIMER ) continue; // not applicable - sd->pvp_timer = timer->add(timer->gettick()+200,pc->calc_pvprank_timer,sd->bl.id,0); + if (!map->list[m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200,pc->calc_pvprank_timer,sd->bl.id,0); sd->pvp_rank = 0; sd->pvp_lastusers = 0; sd->pvp_point = 5; @@ -18155,7 +18159,7 @@ BUILDIN(setpcblock) if ((type & PCBLOCK_IMMUNE) != 0) sd->block_action.immune = state; - if ((type & PCBLOCK_SITSTAND) != 0) + if ((type & PCBLOCK_SITSTAND) != 0) sd->block_action.sitstand = state; if ((type & PCBLOCK_COMMANDS) != 0) @@ -21156,6 +21160,7 @@ BUILDIN(instance_create) const char *name; int owner_id, res; int type = IOT_PARTY; + struct map_session_data *sd = map->id2sd(st->rid); name = script_getstr(st, 2); owner_id = script_getnum(st, 3); @@ -21168,22 +21173,43 @@ BUILDIN(instance_create) } res = instance->create(owner_id, name, (enum instance_owner_type) type); - if( res == -4 ) { // Already exists - script_pushint(st, -1); - return true; - } else if( res < 0 ) { + if (sd != NULL) { + switch (res) { + case -4: // Already exists + clif->msgtable_str(sd, MSG_MDUNGEON_SUBSCRIPTION_ERROR_DUPLICATE, name); + break; + case -3: // No free instances + clif->msgtable_str(sd, MSG_MDUNGEON_SUBSCRIPTION_ERROR_EXIST, name); + break; + case -2: // Invalid type + clif->msgtable_str(sd, MSG_MDUNGEON_SUBSCRIPTION_ERROR_RIGHT, name); + break; + case -1: // Unknown + clif->msgtable_str(sd, MSG_MDUNGEON_SUBSCRIPTION_ERROR_UNKNOWN, name); + break; + default: + if (res < 0) + ShowError("buildin_instance_create: failed to unknown reason [%d].\n", res); + } + } else { const char *err; - switch(res) { - case -3: err = "No free instances"; break; - case -2: err = "Invalid party ID"; break; - case -1: err = "Invalid type"; break; - default: err = "Unknown"; break; + switch (res) { + case -3: + err = "No free instances"; + break; + case -2: + err = "Invalid party ID"; + break; + case -1: + err = "Invalid type"; + break; + default: + err = "Unknown"; + break; } - ShowError("buildin_instance_create: %s [%d].\n", err, res); - script_pushint(st, -2); - return true; + if (res < 0) + ShowError("buildin_instance_create: %s [%d].\n", err, res); } - script_pushint(st, res); return true; } @@ -23856,7 +23882,7 @@ bool rodex_sendmail_sub(struct script_state* st, struct rodex_message *msg) { const char *sender_name, *title, *body; - if (!strcmp(script->getfuncname(st), "rodex_sendmail_acc2")) + if (strcmp(script->getfuncname(st), "rodex_sendmail_acc") == 0 || strcmp(script->getfuncname(st), "rodex_sendmail_acc2") == 0) msg->receiver_accountid = script_getnum(st, 2); else msg->receiver_id = script_getnum(st, 2); @@ -24159,6 +24185,19 @@ BUILDIN(hateffect) return true; } +BUILDIN(openstylist) +{ + struct map_session_data *sd = script_rid2sd(st); + + if (sd == NULL) + return false; + +#if PACKETVER >= 20150128 + clif->open_ui(sd, CZ_STYLIST_UI); +#endif + return true; +} + /** * Adds a built-in script function. * @@ -24875,6 +24914,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(rodex_sendmail2, "isss?????????????????????????????????????????"), BUILDIN_DEF2(rodex_sendmail2, "rodex_sendmail_acc2", "isss?????????????????????????????????????????"), BUILDIN_DEF(airship_respond, "i"), + BUILDIN_DEF(openstylist,""), BUILDIN_DEF(_,"s"), BUILDIN_DEF2(_, "_$", "s"), @@ -25249,7 +25289,7 @@ void script_hardcoded_constants(void) script->set_constant("MST_AROUND3", MST_AROUND3, false, false); script->set_constant("MST_AROUND4", MST_AROUND4, false, false); script->set_constant("MST_AROUND", MST_AROUND , false, false); - + script->constdb_comment("pc block constants, use with *setpcblock* and *checkpcblock*"); script->set_constant("PCBLOCK_NONE", PCBLOCK_NONE, false, false); script->set_constant("PCBLOCK_MOVE", PCBLOCK_MOVE, false, false); |