summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c60
1 files changed, 43 insertions, 17 deletions
diff --git a/src/map/script.c b/src/map/script.c
index fd9dab81e..ceb97ba54 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
}
}
@@ -18157,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)
@@ -21158,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);
@@ -21170,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;
}
@@ -23858,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);
@@ -24168,7 +24192,9 @@ BUILDIN(openstylist)
if (sd == NULL)
return false;
- clif->open_ui(sd, STYLIST_UI);
+#if PACKETVER >= 20150128
+ clif->open_ui(sd, CZ_STYLIST_UI);
+#endif
return true;
}
@@ -25263,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);