From 9b514dfcb3f185d7f12024ec252eb3081b68cad3 Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Sat, 23 May 2020 09:28:09 +0200 Subject: Use account ID instead of character ID for IOT_CHAR in instance_force_destroy() --- src/map/instance.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map/instance.c b/src/map/instance.c index 1104b7e88..95b1b2baa 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -734,7 +734,7 @@ static void instance_force_destroy(struct map_session_data *sd) switch (instance->list[i].owner_type) { case IOT_CHAR: { - if (instance->list[i].owner_id != sd->status.char_id) + if (instance->list[i].owner_id != sd->status.account_id) continue; break; } -- cgit v1.2.3-60-g2f50 From 3c16038f18dbc639362fa60289eb115a1393b21b Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Sat, 23 May 2020 09:29:23 +0200 Subject: Remove nonexistent return value -3 from documentation of instance_create() function --- src/map/instance.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map/instance.c b/src/map/instance.c index 95b1b2baa..d2c0a229c 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -68,7 +68,7 @@ static bool instance_is_valid(int instance_id) /*-------------------------------------- * name : instance name * Return value could be - * -4 = already exists | -3 = no free instances | -2 = owner not found | -1 = invalid type + * -4 = already exists | -2 = owner not found | -1 = invalid type * On success return instance_id *--------------------------------------*/ static int instance_create(int owner_id, const char *name, enum instance_owner_type type) -- cgit v1.2.3-60-g2f50 From ffa957a81e3190a7e58f6e40b7113bd5be02d256 Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Sat, 23 May 2020 09:30:50 +0200 Subject: Show instancing window on login for party instances if instance state is INSTANCE_IDLE, too --- src/map/party.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/map/party.c b/src/map/party.c index 8eeae2215..a6f6b7774 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -353,8 +353,6 @@ static int party_recv_info(const struct party *sp, int char_id) clif->party_info(p,NULL); for( j = 0; j < p->instances; j++ ) { if( p->instance[j] >= 0 ) { - if( instance->list[p->instance[j]].idle_timer == INVALID_TIMER && instance->list[p->instance[j]].progress_timer == INVALID_TIMER ) - continue; clif->instance_join(sd->fd, p->instance[j]); break; } @@ -488,8 +486,6 @@ static void party_member_joined(struct map_session_data *sd) p->data[i].sd = sd; for( j = 0; j < p->instances; j++ ) { if( p->instance[j] >= 0 ) { - if( instance->list[p->instance[j]].idle_timer == INVALID_TIMER && instance->list[p->instance[j]].progress_timer == INVALID_TIMER ) - continue; clif->instance_join(sd->fd, p->instance[j]); break; } @@ -551,8 +547,6 @@ static int party_member_added(int party_id, int account_id, int char_id, int fla for( j = 0; j < p->instances; j++ ) { if( p->instance[j] >= 0 ) { - if( instance->list[p->instance[j]].idle_timer == INVALID_TIMER && instance->list[p->instance[j]].progress_timer == INVALID_TIMER ) - continue; clif->instance_join(sd->fd, p->instance[j]); break; } -- cgit v1.2.3-60-g2f50 From 079cc44b4251ebc695c052dc3b1053f31d4d69fa Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Sat, 23 May 2020 09:32:05 +0200 Subject: Show instancing window on login for guild instances, too --- src/map/guild.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/map/guild.c b/src/map/guild.c index 90f870f1c..a78ea169c 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -887,6 +887,12 @@ static void guild_member_joined(struct map_session_data *sd) channel->join(g->channel, sd, "", true); } + for (int j = 0; j < g->instances; j++) { + if (g->instance[j] >= 0) { + clif->instance_join(sd->fd, g->instance[j]); + break; + } + } } } @@ -940,6 +946,13 @@ static int guild_member_added(int guild_id, int account_id, int char_id, int fla channel->join(g->channel, sd, "", true); } + for (int i = 0; i < g->instances; i++) { + if (g->instance[i] >= 0) { + clif->instance_join(sd->fd, g->instance[i]); + break; + } + } + return 0; } -- cgit v1.2.3-60-g2f50 From 03df6173b91200102ef21a6d67ceaf55340f6a92 Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Sat, 23 May 2020 09:33:24 +0200 Subject: Show instancing window on login for character instances, too --- src/map/clif.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/map/clif.c b/src/map/clif.c index 649df3e33..eeb56ce0b 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11067,6 +11067,19 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) #if PACKETVER >= 20090218 quest->questinfo_refresh(sd); // NPC quest/event icon check. [Kisuka] #endif + + if (first_time) { + int i; + + ARR_FIND(0, instance->instances, i, instance->list[i].owner_type == IOT_CHAR && instance->list[i].owner_id == sd->status.account_id); + + if (i < instance->instances) { + sd->instances = 1; + CREATE(sd->instance, short, 1); + sd->instance[0] = instance->list[i].id; + clif->instance_join(sd->fd, instance->list[i].id); + } + } } /// Server's tick (ZC_NOTIFY_TIME). -- cgit v1.2.3-60-g2f50 From a4492b60cf9012e990233ff4689cbf1ef67274ba Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Sat, 23 May 2020 09:35:47 +0200 Subject: Update documentation of instance_create() script command * Fix some typos. * Add a paragraph about owner types and the corresponding owner ID to use. * Remove nonexistent return value -3 from example. --- doc/script_commands.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 2fc6a95e5..db37ef284 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -9664,13 +9664,19 @@ For examples of usage, see /doc/sample/npc_rodex.txt //===================================== --------------------------------------- -*instance_create("", {, }) +*instance_create("", {, }) -Create an instance using the name "" for the of -owner_type (when not provided, defaults to IOT_PARTY). Most instance_* +Creates an instance using the name "" for the of + (when not provided, defaults to IOT_PARTY). Most instance_* commands are used in conjunction with this command and depend on the ID this command returns. +Valid values: +- IOT_NONE (0) - can be any arbitrary number. +- IOT_CHAR (1) - is account ID. +- IOT_PARTY (2) - is party ID. +- IOT_GUILD (3) - is guild ID. + Example: // Store the Party ID of the invoking character. .@party_id = getcharid(CHAR_ID_PARTY); @@ -9681,11 +9687,9 @@ Example: // ... } else if (.@id == -2) { // Invalid Party ID // ... - } else if (.@id == -3) { // No free instances (MAX_INSTANCE exceeded) - // ... } else if (.@id == -4) { // Already exists // ... - } else (.@id < 0) { // Unspecified error while queuing instance. + } else if (.@id < 0) { // Unspecified error while queuing instance. // ... } -- cgit v1.2.3-60-g2f50