|
@@ -11,6 +11,7 @@
|
|
#include "../common/malloc.h"
|
|
#include "../common/malloc.h"
|
|
|
|
|
|
#include "clif.h"
|
|
#include "clif.h"
|
|
|
|
+#include "guild.h"
|
|
#include "instance.h"
|
|
#include "instance.h"
|
|
#include "map.h"
|
|
#include "map.h"
|
|
#include "npc.h"
|
|
#include "npc.h"
|
|
@@ -30,7 +31,8 @@ struct instance_data instance_data[MAX_INSTANCE_DATA];
|
|
struct instance_db {
|
|
struct instance_db {
|
|
unsigned short id; ///< Instance ID
|
|
unsigned short id; ///< Instance ID
|
|
StringBuf *name; ///< Instance name
|
|
StringBuf *name; ///< Instance name
|
|
- unsigned int limit; ///< Duration limit
|
|
|
|
|
|
+ unsigned int limit, ///< Duration limit
|
|
|
|
+ timeout; ///< Timeout limit
|
|
struct {
|
|
struct {
|
|
StringBuf *mapname; ///< Mapname, the limit should be MAP_NAME_LENGTH_EXT
|
|
StringBuf *mapname; ///< Mapname, the limit should be MAP_NAME_LENGTH_EXT
|
|
unsigned short x, y; ///< Map coordinates
|
|
unsigned short x, y; ///< Map coordinates
|
|
@@ -59,6 +61,34 @@ static uint16 instance_name2id(const char *instance_name) {
|
|
return (uint16)strdb_uiget(InstanceNameDB,instance_name);
|
|
return (uint16)strdb_uiget(InstanceNameDB,instance_name);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * Search for a sd of an Instance
|
|
|
|
+ * @param instance_id: Instance ID
|
|
|
|
+ * @param sd: Player data to attach
|
|
|
|
+ * @param target: Target display type
|
|
|
|
+ */
|
|
|
|
+void instance_getsd(unsigned short instance_id, struct map_session_data **sd, enum send_target *target) {
|
|
|
|
+ switch(instance_data[instance_id].mode) {
|
|
|
|
+ case IM_NONE:
|
|
|
|
+ (*sd) = NULL;
|
|
|
|
+ (*target) = SELF;
|
|
|
|
+ break;
|
|
|
|
+ case IM_GUILD:
|
|
|
|
+ (*sd) = guild_getavailablesd(guild_search(instance_data[instance_id].owner_id));
|
|
|
|
+ (*target) = GUILD;
|
|
|
|
+ break;
|
|
|
|
+ case IM_PARTY:
|
|
|
|
+ (*sd) = party_getavailablesd(party_search(instance_data[instance_id].owner_id));
|
|
|
|
+ (*target) = PARTY;
|
|
|
|
+ break;
|
|
|
|
+ case IM_CHAR:
|
|
|
|
+ (*sd) = map_id2sd(instance_data[instance_id].owner_id);
|
|
|
|
+ (*target) = SELF;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+}
|
|
|
|
+
|
|
/*==========================================
|
|
/*==========================================
|
|
* Searches for an instance name in the database
|
|
* Searches for an instance name in the database
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
@@ -80,23 +110,42 @@ static int instance_delete_timer(int tid, unsigned int tick, int id, intptr_t da
|
|
}
|
|
}
|
|
|
|
|
|
/*==========================================
|
|
/*==========================================
|
|
- * Create subscription timer for party
|
|
|
|
|
|
+ * Create subscription timer
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
static int instance_subscription_timer(int tid, unsigned int tick, int id, intptr_t data)
|
|
static int instance_subscription_timer(int tid, unsigned int tick, int id, intptr_t data)
|
|
{
|
|
{
|
|
int i, ret;
|
|
int i, ret;
|
|
- int instance_id = instance_wait.id[0];
|
|
|
|
- struct party_data *p;
|
|
|
|
|
|
+ unsigned short instance_id = instance_wait.id[0];
|
|
|
|
+ struct map_session_data *sd = NULL;
|
|
|
|
+ struct party_data *p = NULL;
|
|
|
|
+ struct guild *g = NULL;
|
|
|
|
+ enum instance_mode mode;
|
|
|
|
|
|
- if(instance_wait.count == 0 || instance_id <= 0)
|
|
|
|
|
|
+ if(instance_wait.count == 0 || instance_id == 0)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
// Check that maps have been added
|
|
// Check that maps have been added
|
|
ret = instance_addmap(instance_id);
|
|
ret = instance_addmap(instance_id);
|
|
-
|
|
|
|
- // If no maps are created, tell party to wait
|
|
|
|
- if(ret == 0 && ( p = party_search( instance_data[instance_id].party_id ) ) != NULL)
|
|
|
|
- clif_instance_changewait( party_getavailablesd( p ), 0xffff, 1 );
|
|
|
|
|
|
+ mode = instance_data[instance_id].mode;
|
|
|
|
+
|
|
|
|
+ switch(mode) {
|
|
|
|
+ case IM_NONE:
|
|
|
|
+ break;
|
|
|
|
+ case IM_CHAR:
|
|
|
|
+ if (ret == 0 && (sd = map_id2sd(instance_data[instance_id].owner_id)) != NULL) // If no maps are created, tell player to wait
|
|
|
|
+ clif_instance_changewait(instance_id, 0xffff);
|
|
|
|
+ break;
|
|
|
|
+ case IM_PARTY:
|
|
|
|
+ if (ret == 0 && (p = party_search(instance_data[instance_id].owner_id)) != NULL) // If no maps are created, tell party to wait
|
|
|
|
+ clif_instance_changewait(instance_id, 0xffff);
|
|
|
|
+ break;
|
|
|
|
+ case IM_GUILD:
|
|
|
|
+ if (ret == 0 && (g = guild_search(instance_data[instance_id].owner_id)) != NULL) // If no maps are created, tell guild to wait
|
|
|
|
+ clif_instance_changewait(instance_id, 0xffff);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
|
|
instance_wait.count--;
|
|
instance_wait.count--;
|
|
memmove(&instance_wait.id[0],&instance_wait.id[1],sizeof(instance_wait.id[0])*instance_wait.count);
|
|
memmove(&instance_wait.id[0],&instance_wait.id[1],sizeof(instance_wait.id[0])*instance_wait.count);
|
|
@@ -104,9 +153,9 @@ static int instance_subscription_timer(int tid, unsigned int tick, int id, intpt
|
|
|
|
|
|
for(i = 0; i < instance_wait.count; i++) {
|
|
for(i = 0; i < instance_wait.count; i++) {
|
|
if( instance_data[instance_wait.id[i]].state == INSTANCE_IDLE &&
|
|
if( instance_data[instance_wait.id[i]].state == INSTANCE_IDLE &&
|
|
- ( p = party_search( instance_data[instance_wait.id[i]].party_id ) ) != NULL
|
|
|
|
|
|
+ ((mode == IM_CHAR && sd != NULL) || (mode == IM_GUILD && g != NULL) || (mode == IM_PARTY && p != NULL))
|
|
){
|
|
){
|
|
- clif_instance_changewait( party_getavailablesd( p ), i + 1, 1 );
|
|
|
|
|
|
+ clif_instance_changewait(instance_id, i + 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -119,12 +168,11 @@ static int instance_subscription_timer(int tid, unsigned int tick, int id, intpt
|
|
}
|
|
}
|
|
|
|
|
|
/*==========================================
|
|
/*==========================================
|
|
- * Adds timer back to party entering instance
|
|
|
|
|
|
+ * Adds timer back to members entering instance
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-static int instance_startkeeptimer(struct instance_data *im, short instance_id)
|
|
|
|
|
|
+static int instance_startkeeptimer(struct instance_data *im, unsigned short instance_id)
|
|
{
|
|
{
|
|
struct instance_db *db;
|
|
struct instance_db *db;
|
|
- struct party_data *p;
|
|
|
|
|
|
|
|
nullpo_retr(0, im);
|
|
nullpo_retr(0, im);
|
|
|
|
|
|
@@ -139,9 +187,24 @@ static int instance_startkeeptimer(struct instance_data *im, short instance_id)
|
|
im->keep_limit = (unsigned int)time(NULL) + db->limit;
|
|
im->keep_limit = (unsigned int)time(NULL) + db->limit;
|
|
im->keep_timer = add_timer(gettick()+db->limit*1000, instance_delete_timer, instance_id, 0);
|
|
im->keep_timer = add_timer(gettick()+db->limit*1000, instance_delete_timer, instance_id, 0);
|
|
|
|
|
|
- // Notify party of the added instance timer
|
|
|
|
- if( ( p = party_search( im->party_id ) ) != NULL )
|
|
|
|
- clif_instance_status( party_getavailablesd( p ), StringBuf_Value(db->name), im->keep_limit, im->idle_limit, 1 );
|
|
|
|
|
|
+ switch(im->mode) {
|
|
|
|
+ case IM_NONE:
|
|
|
|
+ break;
|
|
|
|
+ case IM_CHAR:
|
|
|
|
+ if (map_id2sd(im->owner_id) != NULL) // Notify player of the added instance timer
|
|
|
|
+ clif_instance_status(instance_id, im->keep_limit, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ case IM_PARTY:
|
|
|
|
+ if (party_search(im->owner_id) != NULL) // Notify party of the added instance timer
|
|
|
|
+ clif_instance_status(instance_id, im->keep_limit, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ case IM_GUILD:
|
|
|
|
+ if (guild_search(im->owner_id) != NULL) // Notify guild of the added instance timer
|
|
|
|
+ clif_instance_status(instance_id, im->keep_limit, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -150,10 +213,9 @@ static int instance_startkeeptimer(struct instance_data *im, short instance_id)
|
|
* Creates idle timer
|
|
* Creates idle timer
|
|
* Default before instance destroy is 5 minutes
|
|
* Default before instance destroy is 5 minutes
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-static int instance_startidletimer(struct instance_data *im, short instance_id)
|
|
|
|
|
|
+static int instance_startidletimer(struct instance_data *im, unsigned short instance_id)
|
|
{
|
|
{
|
|
struct instance_db *db;
|
|
struct instance_db *db;
|
|
- struct party_data *p;
|
|
|
|
|
|
|
|
nullpo_retr(1, im);
|
|
nullpo_retr(1, im);
|
|
|
|
|
|
@@ -161,16 +223,30 @@ static int instance_startidletimer(struct instance_data *im, short instance_id)
|
|
if(im->idle_timer != INVALID_TIMER)
|
|
if(im->idle_timer != INVALID_TIMER)
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
|
|
+ if ((db = instance_searchtype_db(im->type)) == NULL)
|
|
|
|
+ return 1;
|
|
|
|
+
|
|
// Add the timer
|
|
// Add the timer
|
|
im->idle_limit = (unsigned int)time(NULL) + INSTANCE_LIMIT/1000;
|
|
im->idle_limit = (unsigned int)time(NULL) + INSTANCE_LIMIT/1000;
|
|
im->idle_timer = add_timer(gettick()+INSTANCE_LIMIT, instance_delete_timer, instance_id, 0);
|
|
im->idle_timer = add_timer(gettick()+INSTANCE_LIMIT, instance_delete_timer, instance_id, 0);
|
|
|
|
|
|
- // Notify party of added instance timer
|
|
|
|
- if( ( p = party_search( im->party_id ) ) != NULL &&
|
|
|
|
- ( db = instance_searchtype_db( im->type ) ) != NULL
|
|
|
|
- )
|
|
|
|
- {
|
|
|
|
- clif_instance_status( party_getavailablesd( p ), StringBuf_Value(db->name), im->keep_limit, im->idle_limit, 1 );
|
|
|
|
|
|
+ switch(im->mode) {
|
|
|
|
+ case IM_NONE:
|
|
|
|
+ break;
|
|
|
|
+ case IM_CHAR:
|
|
|
|
+ if (map_id2sd(im->owner_id) != NULL && instance_searchtype_db(im->type) != NULL) // Notify player of added instance timer
|
|
|
|
+ clif_instance_status(instance_id, im->keep_limit, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ case IM_PARTY:
|
|
|
|
+ if (party_search(im->owner_id) != NULL && instance_searchtype_db(im->type) != NULL) // Notify party of added instance timer
|
|
|
|
+ clif_instance_status(instance_id, im->keep_limit, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ case IM_GUILD:
|
|
|
|
+ if (guild_search(im->owner_id) != NULL && instance_searchtype_db(im->type) != NULL) // Notify guild of added instance timer
|
|
|
|
+ clif_instance_status(instance_id, im->keep_limit, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return 1;
|
|
}
|
|
}
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -179,10 +255,8 @@ static int instance_startidletimer(struct instance_data *im, short instance_id)
|
|
/*==========================================
|
|
/*==========================================
|
|
* Delete the idle timer
|
|
* Delete the idle timer
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-static int instance_stopidletimer(struct instance_data *im)
|
|
|
|
|
|
+static int instance_stopidletimer(struct instance_data *im, unsigned short instance_id)
|
|
{
|
|
{
|
|
- struct party_data *p;
|
|
|
|
-
|
|
|
|
nullpo_retr(0, im);
|
|
nullpo_retr(0, im);
|
|
|
|
|
|
// No timer
|
|
// No timer
|
|
@@ -194,9 +268,24 @@ static int instance_stopidletimer(struct instance_data *im)
|
|
delete_timer(im->idle_timer, instance_delete_timer);
|
|
delete_timer(im->idle_timer, instance_delete_timer);
|
|
im->idle_timer = INVALID_TIMER;
|
|
im->idle_timer = INVALID_TIMER;
|
|
|
|
|
|
- // Notify the party
|
|
|
|
- if( ( p = party_search( im->party_id ) ) != NULL )
|
|
|
|
- clif_instance_changestatus( party_getavailablesd( p ), 0, im->idle_limit, 1 );
|
|
|
|
|
|
+ switch(im->mode) {
|
|
|
|
+ case IM_NONE:
|
|
|
|
+ break;
|
|
|
|
+ case IM_CHAR:
|
|
|
|
+ if (map_id2sd(im->owner_id) != NULL) // Notify the player
|
|
|
|
+ clif_instance_changestatus(instance_id, 0, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ case IM_PARTY:
|
|
|
|
+ if (party_search(im->owner_id) != NULL) // Notify the party
|
|
|
|
+ clif_instance_changestatus(instance_id, 0, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ case IM_GUILD:
|
|
|
|
+ if (guild_search(im->owner_id) != NULL) // Notify the guild
|
|
|
|
+ clif_instance_changestatus(instance_id, 0, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -247,46 +336,84 @@ void instance_addnpc(struct instance_data *im)
|
|
/*--------------------------------------
|
|
/*--------------------------------------
|
|
* name : instance name
|
|
* name : instance name
|
|
* Return value could be
|
|
* Return value could be
|
|
- * -4 = no free instances | -3 = already exists | -2 = party not found | -1 = invalid type
|
|
|
|
|
|
+ * -4 = no free instances | -3 = already exists | -2 = character/party/guild not found | -1 = invalid type
|
|
* On success return instance_id
|
|
* On success return instance_id
|
|
*--------------------------------------*/
|
|
*--------------------------------------*/
|
|
-int instance_create(int party_id, const char *name)
|
|
|
|
-{
|
|
|
|
- short i;
|
|
|
|
|
|
+int instance_create(int owner_id, const char *name, enum instance_mode mode) {
|
|
struct instance_db *db = instance_searchname_db(name);
|
|
struct instance_db *db = instance_searchname_db(name);
|
|
- struct party_data *p = party_search(party_id);
|
|
|
|
-
|
|
|
|
- if(db == NULL)
|
|
|
|
- return -1;
|
|
|
|
-
|
|
|
|
- if( p == NULL )
|
|
|
|
- return -2;
|
|
|
|
-
|
|
|
|
- if( p->instance_id )
|
|
|
|
- return -3; // Party already instancing
|
|
|
|
|
|
+ struct map_session_data *sd = NULL;
|
|
|
|
+ struct party_data *p = NULL;
|
|
|
|
+ struct guild *g = NULL;
|
|
|
|
+ unsigned short i;
|
|
|
|
+
|
|
|
|
+ nullpo_retr(-1, db);
|
|
|
|
+
|
|
|
|
+ switch(mode) {
|
|
|
|
+ case IM_NONE:
|
|
|
|
+ break;
|
|
|
|
+ case IM_CHAR:
|
|
|
|
+ if ((sd = map_id2sd(owner_id)) == NULL) {
|
|
|
|
+ ShowError("instance_create: character %d not found for instance '%s'.\n", owner_id, name);
|
|
|
|
+ return -2;
|
|
|
|
+ }
|
|
|
|
+ if (sd->instance_id)
|
|
|
|
+ return -3; // Player already instancing
|
|
|
|
+ break;
|
|
|
|
+ case IM_PARTY:
|
|
|
|
+ if ((p = party_search(owner_id)) == NULL) {
|
|
|
|
+ ShowError("instance_create: party %d not found for instance '%s'.\n", owner_id, name);
|
|
|
|
+ return -2;
|
|
|
|
+ }
|
|
|
|
+ if (p->instance_id)
|
|
|
|
+ return -3; // Party already instancing
|
|
|
|
+ break;
|
|
|
|
+ case IM_GUILD:
|
|
|
|
+ if ((g = guild_search(owner_id)) == NULL) {
|
|
|
|
+ ShowError("instance_create: guild %d not found for instance '%s'.\n", owner_id, name);
|
|
|
|
+ return -2;
|
|
|
|
+ }
|
|
|
|
+ if (g->instance_id)
|
|
|
|
+ return -3; // Guild already instancing
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ ShowError("instance_create: unknown mode %u for owner_id %d and name %s.\n", mode, owner_id, name);
|
|
|
|
+ return -2;
|
|
|
|
+ }
|
|
|
|
|
|
// Searching a Free Instance
|
|
// Searching a Free Instance
|
|
- // 0 is ignored as this mean "no instance" on maps
|
|
|
|
|
|
+ // 0 is ignored as this means "no instance" on maps
|
|
ARR_FIND(1, MAX_INSTANCE_DATA, i, instance_data[i].state == INSTANCE_FREE);
|
|
ARR_FIND(1, MAX_INSTANCE_DATA, i, instance_data[i].state == INSTANCE_FREE);
|
|
if( i >= MAX_INSTANCE_DATA )
|
|
if( i >= MAX_INSTANCE_DATA )
|
|
return -4;
|
|
return -4;
|
|
|
|
|
|
instance_data[i].type = db->id;
|
|
instance_data[i].type = db->id;
|
|
instance_data[i].state = INSTANCE_IDLE;
|
|
instance_data[i].state = INSTANCE_IDLE;
|
|
- instance_data[i].party_id = p->party.party_id;
|
|
|
|
|
|
+ instance_data[i].owner_id = owner_id;
|
|
|
|
+ instance_data[i].mode = mode;
|
|
instance_data[i].keep_limit = 0;
|
|
instance_data[i].keep_limit = 0;
|
|
instance_data[i].keep_timer = INVALID_TIMER;
|
|
instance_data[i].keep_timer = INVALID_TIMER;
|
|
instance_data[i].idle_limit = 0;
|
|
instance_data[i].idle_limit = 0;
|
|
instance_data[i].idle_timer = INVALID_TIMER;
|
|
instance_data[i].idle_timer = INVALID_TIMER;
|
|
instance_data[i].regs.vars = i64db_alloc(DB_OPT_RELEASE_DATA);
|
|
instance_data[i].regs.vars = i64db_alloc(DB_OPT_RELEASE_DATA);
|
|
instance_data[i].regs.arrays = NULL;
|
|
instance_data[i].regs.arrays = NULL;
|
|
|
|
+ safestrncpy(instance_data[i].name, name, sizeof(instance_data[i].name));
|
|
memset(instance_data[i].map, 0, sizeof(instance_data[i].map));
|
|
memset(instance_data[i].map, 0, sizeof(instance_data[i].map));
|
|
|
|
|
|
- p->instance_id = i;
|
|
|
|
|
|
+ switch(mode) {
|
|
|
|
+ case IM_CHAR:
|
|
|
|
+ sd->instance_id = i;
|
|
|
|
+ break;
|
|
|
|
+ case IM_PARTY:
|
|
|
|
+ p->instance_id = i;
|
|
|
|
+ break;
|
|
|
|
+ case IM_GUILD:
|
|
|
|
+ g->instance_id = i;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
|
|
- instance_wait.id[instance_wait.count++] = p->instance_id;
|
|
|
|
|
|
+ instance_wait.id[instance_wait.count++] = i;
|
|
|
|
|
|
- clif_instance_create( party_getavailablesd( p ), name, instance_wait.count, 1);
|
|
|
|
|
|
+ clif_instance_create(i, instance_wait.count);
|
|
|
|
|
|
instance_subscription_timer(0,0,0,0);
|
|
instance_subscription_timer(0,0,0,0);
|
|
|
|
|
|
@@ -298,24 +425,23 @@ int instance_create(int party_id, const char *name)
|
|
/*--------------------------------------
|
|
/*--------------------------------------
|
|
* Adds maps to the instance
|
|
* Adds maps to the instance
|
|
*--------------------------------------*/
|
|
*--------------------------------------*/
|
|
-int instance_addmap(short instance_id)
|
|
|
|
|
|
+int instance_addmap(unsigned short instance_id)
|
|
{
|
|
{
|
|
int i, m;
|
|
int i, m;
|
|
int cnt_map = 0;
|
|
int cnt_map = 0;
|
|
struct instance_data *im;
|
|
struct instance_data *im;
|
|
struct instance_db *db;
|
|
struct instance_db *db;
|
|
- struct party_data *p;
|
|
|
|
|
|
|
|
- if(instance_id <= 0)
|
|
|
|
|
|
+ if (instance_id == 0)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
im = &instance_data[instance_id];
|
|
im = &instance_data[instance_id];
|
|
|
|
|
|
// If the instance isn't idle, we can't do anything
|
|
// If the instance isn't idle, we can't do anything
|
|
- if(im->state != INSTANCE_IDLE)
|
|
|
|
|
|
+ if (im->state != INSTANCE_IDLE)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- if((db = instance_searchtype_db(im->type)) == NULL)
|
|
|
|
|
|
+ if ((db = instance_searchtype_db(im->type)) == NULL)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
// Set to busy, update timers
|
|
// Set to busy, update timers
|
|
@@ -343,9 +469,24 @@ int instance_addmap(short instance_id)
|
|
// Create NPCs on all maps
|
|
// Create NPCs on all maps
|
|
instance_addnpc(im);
|
|
instance_addnpc(im);
|
|
|
|
|
|
- // Inform party members of the created instance
|
|
|
|
- if( (p = party_search( im->party_id ) ) != NULL )
|
|
|
|
- clif_instance_status( party_getavailablesd( p ), StringBuf_Value(db->name), im->keep_limit, im->idle_limit, 1);
|
|
|
|
|
|
+ switch(im->mode) {
|
|
|
|
+ case IM_NONE:
|
|
|
|
+ break;
|
|
|
|
+ case IM_CHAR:
|
|
|
|
+ if (map_id2sd(im->owner_id) != NULL) // Inform player of the created instance
|
|
|
|
+ clif_instance_status(instance_id, im->keep_limit, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ case IM_PARTY:
|
|
|
|
+ if (party_search(im->owner_id) != NULL) // Inform party members of the created instance
|
|
|
|
+ clif_instance_status(instance_id, im->keep_limit, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ case IM_GUILD:
|
|
|
|
+ if (guild_search(im->owner_id) != NULL) // Inform guild members of the created instance
|
|
|
|
+ clif_instance_status(instance_id, im->keep_limit, im->idle_limit);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
|
|
return cnt_map;
|
|
return cnt_map;
|
|
}
|
|
}
|
|
@@ -357,7 +498,7 @@ int instance_addmap(short instance_id)
|
|
* instance_id : where to search
|
|
* instance_id : where to search
|
|
* result : mapid of map "name" in this instance
|
|
* result : mapid of map "name" in this instance
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int instance_mapname2mapid(const char *name, short instance_id)
|
|
|
|
|
|
+int instance_mapname2mapid(const char *name, unsigned short instance_id)
|
|
{
|
|
{
|
|
struct instance_data *im;
|
|
struct instance_data *im;
|
|
int m = map_mapname2mapid(name);
|
|
int m = map_mapname2mapid(name);
|
|
@@ -371,7 +512,7 @@ int instance_mapname2mapid(const char *name, short instance_id)
|
|
|
|
|
|
strcpy(iname,name);
|
|
strcpy(iname,name);
|
|
|
|
|
|
- if(instance_id <= 0 || instance_id > MAX_INSTANCE_DATA)
|
|
|
|
|
|
+ if(instance_id == 0 || instance_id > MAX_INSTANCE_DATA)
|
|
return m;
|
|
return m;
|
|
|
|
|
|
im = &instance_data[instance_id];
|
|
im = &instance_data[instance_id];
|
|
@@ -395,14 +536,17 @@ int instance_mapname2mapid(const char *name, short instance_id)
|
|
/*==========================================
|
|
/*==========================================
|
|
* Removes a instance, all its maps and npcs.
|
|
* Removes a instance, all its maps and npcs.
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int instance_destroy(short instance_id)
|
|
|
|
|
|
+int instance_destroy(unsigned short instance_id)
|
|
{
|
|
{
|
|
struct instance_data *im;
|
|
struct instance_data *im;
|
|
- struct party_data *p;
|
|
|
|
|
|
+ struct map_session_data *sd = NULL;
|
|
|
|
+ struct party_data *p = NULL;
|
|
|
|
+ struct guild *g = NULL;
|
|
int i, type = 0;
|
|
int i, type = 0;
|
|
unsigned int now = (unsigned int)time(NULL);
|
|
unsigned int now = (unsigned int)time(NULL);
|
|
|
|
+ enum instance_mode mode;
|
|
|
|
|
|
- if(instance_id <= 0 || instance_id > MAX_INSTANCE_DATA)
|
|
|
|
|
|
+ if(instance_id == 0 || instance_id > MAX_INSTANCE_DATA)
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
im = &instance_data[instance_id];
|
|
im = &instance_data[instance_id];
|
|
@@ -410,6 +554,33 @@ int instance_destroy(short instance_id)
|
|
if(im->state == INSTANCE_FREE)
|
|
if(im->state == INSTANCE_FREE)
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
|
|
+ mode = im->mode;
|
|
|
|
+ switch(mode) {
|
|
|
|
+ case IM_NONE:
|
|
|
|
+ break;
|
|
|
|
+ case IM_CHAR:
|
|
|
|
+ if ((sd = map_id2sd(im->owner_id)) == NULL) {
|
|
|
|
+ ShowError("instance_destroy: character %d not found for instance '%s'.\n", im->owner_id, im->name);
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case IM_PARTY:
|
|
|
|
+ if ((p = party_search(im->owner_id)) == NULL) {
|
|
|
|
+ ShowError("instance_destroy: party %d not found for instance '%s'.\n", im->owner_id, im->name);
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case IM_GUILD:
|
|
|
|
+ if ((g = guild_search(im->owner_id)) == NULL) {
|
|
|
|
+ ShowError("instance_destroy: guild %d not found for instance '%s'.\n", im->owner_id, im->name);
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ ShowError("instance_destroy: unknown owner type %u for owner_id %d and name %s.\n", mode, im->owner_id, im->name);
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
if(im->state == INSTANCE_IDLE) {
|
|
if(im->state == INSTANCE_IDLE) {
|
|
for(i = 0; i < instance_wait.count; i++) {
|
|
for(i = 0; i < instance_wait.count; i++) {
|
|
if(instance_wait.id[i] == instance_id) {
|
|
if(instance_wait.id[i] == instance_id) {
|
|
@@ -419,8 +590,8 @@ int instance_destroy(short instance_id)
|
|
|
|
|
|
for(i = 0; i < instance_wait.count; i++)
|
|
for(i = 0; i < instance_wait.count; i++)
|
|
if(instance_data[instance_wait.id[i]].state == INSTANCE_IDLE)
|
|
if(instance_data[instance_wait.id[i]].state == INSTANCE_IDLE)
|
|
- if((p = party_search(instance_data[instance_wait.id[i]].party_id)) != NULL)
|
|
|
|
- clif_instance_changewait( party_getavailablesd( p ), i+1, 1);
|
|
|
|
|
|
+ if ((mode == IM_CHAR && sd != NULL) || (mode == IM_PARTY && p != NULL) || (mode == IM_GUILD && g != NULL))
|
|
|
|
+ clif_instance_changewait(instance_id, i + 1);
|
|
|
|
|
|
if(instance_wait.count)
|
|
if(instance_wait.count)
|
|
instance_wait.timer = add_timer(gettick()+INSTANCE_INTERVAL, instance_subscription_timer, 0, 0);
|
|
instance_wait.timer = add_timer(gettick()+INSTANCE_INTERVAL, instance_subscription_timer, 0, 0);
|
|
@@ -451,13 +622,18 @@ int instance_destroy(short instance_id)
|
|
im->idle_timer = INVALID_TIMER;
|
|
im->idle_timer = INVALID_TIMER;
|
|
}
|
|
}
|
|
|
|
|
|
- if((p = party_search(im->party_id))) {
|
|
|
|
|
|
+ if (mode == IM_CHAR)
|
|
|
|
+ sd->instance_id = 0;
|
|
|
|
+ else if (mode == IM_PARTY)
|
|
p->instance_id = 0;
|
|
p->instance_id = 0;
|
|
|
|
+ else if (mode == IM_GUILD)
|
|
|
|
+ g->instance_id = 0;
|
|
|
|
|
|
|
|
+ if (mode != IM_NONE) {
|
|
if(type)
|
|
if(type)
|
|
- clif_instance_changestatus( party_getavailablesd( p ), type, 0, 1 );
|
|
|
|
|
|
+ clif_instance_changestatus(instance_id, type, 0);
|
|
else
|
|
else
|
|
- clif_instance_changewait( party_getavailablesd( p ), 0xffff, 1 );
|
|
|
|
|
|
+ clif_instance_changewait(instance_id, 0xffff);
|
|
}
|
|
}
|
|
|
|
|
|
if( im->regs.vars ) {
|
|
if( im->regs.vars ) {
|
|
@@ -478,61 +654,78 @@ int instance_destroy(short instance_id)
|
|
/*==========================================
|
|
/*==========================================
|
|
* Allows a user to enter an instance
|
|
* Allows a user to enter an instance
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int instance_enter(struct map_session_data *sd, const char *name)
|
|
|
|
|
|
+int instance_enter(struct map_session_data *sd, unsigned short instance_id, const char *name)
|
|
{
|
|
{
|
|
struct instance_db *db = instance_searchname_db(name);
|
|
struct instance_db *db = instance_searchname_db(name);
|
|
|
|
|
|
- if(db == NULL)
|
|
|
|
- return 3;
|
|
|
|
|
|
+ nullpo_retr(-1, sd);
|
|
|
|
+ nullpo_retr(3, db);
|
|
|
|
|
|
- return instance_enter_position(sd, name, db->enter.x, db->enter.y);
|
|
|
|
|
|
+ return instance_enter_position(sd, instance_id, name, db->enter.x, db->enter.y);
|
|
}
|
|
}
|
|
|
|
|
|
/*==========================================
|
|
/*==========================================
|
|
* Warp a user into instance
|
|
* Warp a user into instance
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int instance_enter_position(struct map_session_data *sd, const char *name, short x, short y)
|
|
|
|
|
|
+int instance_enter_position(struct map_session_data *sd, unsigned short instance_id, const char *name, short x, short y)
|
|
{
|
|
{
|
|
- struct instance_data *im;
|
|
|
|
|
|
+ struct instance_data *im = &instance_data[instance_id];
|
|
struct instance_db *db = instance_searchname_db(name);
|
|
struct instance_db *db = instance_searchname_db(name);
|
|
- struct party_data *p;
|
|
|
|
- int m;
|
|
|
|
|
|
+ struct party_data *p = NULL;
|
|
|
|
+ struct guild *g = NULL;
|
|
|
|
+ int16 m;
|
|
|
|
|
|
nullpo_retr(-1, sd);
|
|
nullpo_retr(-1, sd);
|
|
|
|
+ nullpo_retr(3, db);
|
|
|
|
+
|
|
|
|
+ switch(instance_data[instance_id].mode) {
|
|
|
|
+ case IM_NONE:
|
|
|
|
+ break;
|
|
|
|
+ case IM_CHAR:
|
|
|
|
+ if (sd->instance_id == 0) // Player must have an instance
|
|
|
|
+ return 2;
|
|
|
|
+ if (im->owner_id != sd->status.account_id)
|
|
|
|
+ return 3;
|
|
|
|
+ break;
|
|
|
|
+ case IM_PARTY:
|
|
|
|
+ if (sd->status.party_id == 0) // Character must be in instance party
|
|
|
|
+ return 1;
|
|
|
|
+ if ((p = party_search(sd->status.party_id)) == NULL)
|
|
|
|
+ return 1;
|
|
|
|
+ if (p->instance_id == 0) // Party must have an instance
|
|
|
|
+ return 2;
|
|
|
|
+ if (im->owner_id != p->party.party_id)
|
|
|
|
+ return 3;
|
|
|
|
+ break;
|
|
|
|
+ case IM_GUILD:
|
|
|
|
+ if (sd->status.guild_id == 0) // Character must be in instance guild
|
|
|
|
+ return 1;
|
|
|
|
+ if ((g = guild_search(sd->status.guild_id)) == NULL)
|
|
|
|
+ return 1;
|
|
|
|
+ if (g->instance_id == 0) // Guild must have an instance
|
|
|
|
+ return 2;
|
|
|
|
+ if (im->owner_id != g->guild_id)
|
|
|
|
+ return 3;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
|
|
- // Character must be in instance party
|
|
|
|
- if(sd->status.party_id == 0)
|
|
|
|
- return 1;
|
|
|
|
- if((p = party_search(sd->status.party_id)) == NULL)
|
|
|
|
- return 1;
|
|
|
|
-
|
|
|
|
- // Party must have an instance
|
|
|
|
- if(p->instance_id == 0)
|
|
|
|
- return 2;
|
|
|
|
-
|
|
|
|
- if(db == NULL)
|
|
|
|
- return 3;
|
|
|
|
-
|
|
|
|
- im = &instance_data[p->instance_id];
|
|
|
|
- if(im->party_id != p->party.party_id)
|
|
|
|
|
|
+ if (im->state != INSTANCE_BUSY)
|
|
return 3;
|
|
return 3;
|
|
- if(im->state != INSTANCE_BUSY)
|
|
|
|
- return 3;
|
|
|
|
- if(im->type != db->id)
|
|
|
|
|
|
+ if (im->type != db->id)
|
|
return 3;
|
|
return 3;
|
|
|
|
|
|
// Does the instance match?
|
|
// Does the instance match?
|
|
- if((m = instance_mapname2mapid(StringBuf_Value(db->enter.mapname), p->instance_id)) < 0)
|
|
|
|
|
|
+ if ((m = instance_mapname2mapid(StringBuf_Value(db->enter.mapname), instance_id)) < 0)
|
|
return 3;
|
|
return 3;
|
|
|
|
|
|
- if(pc_setpos(sd, map_id2index(m), x, y, CLR_OUTSIGHT))
|
|
|
|
|
|
+ if (pc_setpos(sd, map_id2index(m), x, y, CLR_OUTSIGHT))
|
|
return 3;
|
|
return 3;
|
|
|
|
|
|
// If there was an idle timer, let's stop it
|
|
// If there was an idle timer, let's stop it
|
|
- instance_stopidletimer(im);
|
|
|
|
|
|
+ instance_stopidletimer(im, instance_id);
|
|
|
|
|
|
// Now we start the instance timer
|
|
// Now we start the instance timer
|
|
- instance_startkeeptimer(im, p->instance_id);
|
|
|
|
|
|
+ instance_startkeeptimer(im, instance_id);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -540,14 +733,14 @@ int instance_enter_position(struct map_session_data *sd, const char *name, short
|
|
/*==========================================
|
|
/*==========================================
|
|
* Request some info about the instance
|
|
* Request some info about the instance
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int instance_reqinfo(struct map_session_data *sd, short instance_id)
|
|
|
|
|
|
+int instance_reqinfo(struct map_session_data *sd, unsigned short instance_id)
|
|
{
|
|
{
|
|
struct instance_data *im;
|
|
struct instance_data *im;
|
|
struct instance_db *db;
|
|
struct instance_db *db;
|
|
|
|
|
|
nullpo_retr(1, sd);
|
|
nullpo_retr(1, sd);
|
|
|
|
|
|
- if(instance_id <= 0 || instance_id > MAX_INSTANCE_DATA)
|
|
|
|
|
|
+ if(instance_id == 0 || instance_id > MAX_INSTANCE_DATA)
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
im = &instance_data[instance_id];
|
|
im = &instance_data[instance_id];
|
|
@@ -561,12 +754,12 @@ int instance_reqinfo(struct map_session_data *sd, short instance_id)
|
|
|
|
|
|
for(i = 0; i < instance_wait.count; i++) {
|
|
for(i = 0; i < instance_wait.count; i++) {
|
|
if(instance_wait.id[i] == instance_id) {
|
|
if(instance_wait.id[i] == instance_id) {
|
|
- clif_instance_create(sd, StringBuf_Value(db->name), i+1, 0);
|
|
|
|
|
|
+ clif_instance_create(instance_id, i + 1);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if(im->state == INSTANCE_BUSY) // Give info on the instance if busy
|
|
} else if(im->state == INSTANCE_BUSY) // Give info on the instance if busy
|
|
- clif_instance_status(sd, StringBuf_Value(db->name), im->keep_limit, im->idle_limit, 0);
|
|
|
|
|
|
+ clif_instance_status(instance_id, im->keep_limit, im->idle_limit);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -574,11 +767,11 @@ int instance_reqinfo(struct map_session_data *sd, short instance_id)
|
|
/*==========================================
|
|
/*==========================================
|
|
* Add players to the instance (for timers)
|
|
* Add players to the instance (for timers)
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int instance_addusers(short instance_id)
|
|
|
|
|
|
+int instance_addusers(unsigned short instance_id)
|
|
{
|
|
{
|
|
struct instance_data *im;
|
|
struct instance_data *im;
|
|
|
|
|
|
- if(instance_id <= 0 || instance_id > MAX_INSTANCE_DATA)
|
|
|
|
|
|
+ if(instance_id == 0 || instance_id > MAX_INSTANCE_DATA)
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
im = &instance_data[instance_id];
|
|
im = &instance_data[instance_id];
|
|
@@ -586,7 +779,7 @@ int instance_addusers(short instance_id)
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
// Stop the idle timer if we had one
|
|
// Stop the idle timer if we had one
|
|
- instance_stopidletimer(im);
|
|
|
|
|
|
+ instance_stopidletimer(im, instance_id);
|
|
|
|
|
|
// Start the instance keep timer
|
|
// Start the instance keep timer
|
|
instance_startkeeptimer(im, instance_id);
|
|
instance_startkeeptimer(im, instance_id);
|
|
@@ -597,12 +790,12 @@ int instance_addusers(short instance_id)
|
|
/*==========================================
|
|
/*==========================================
|
|
* Delete players from the instance (for timers)
|
|
* Delete players from the instance (for timers)
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int instance_delusers(short instance_id)
|
|
|
|
|
|
+int instance_delusers(unsigned short instance_id)
|
|
{
|
|
{
|
|
struct instance_data *im;
|
|
struct instance_data *im;
|
|
int i, idle = 0;
|
|
int i, idle = 0;
|
|
|
|
|
|
- if(instance_id <= 0 || instance_id > MAX_INSTANCE_DATA)
|
|
|
|
|
|
+ if(instance_id == 0 || instance_id > MAX_INSTANCE_DATA)
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
im = &instance_data[instance_id];
|
|
im = &instance_data[instance_id];
|
|
@@ -637,8 +830,8 @@ static bool instance_readdb_sub(char* str[], int columns, int current)
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
- if (mapindex_name2id(str[3]) == 0) {
|
|
|
|
- ShowError("instance_readdb_sub: Invalid map '%s' as entrance map.\n", str[3]);
|
|
|
|
|
|
+ if (mapindex_name2id(str[4]) == 0) {
|
|
|
|
+ ShowError("instance_readdb_sub: Invalid map '%s' as entrance map.\n", str[4]);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -662,12 +855,13 @@ static bool instance_readdb_sub(char* str[], int columns, int current)
|
|
|
|
|
|
StringBuf_AppendStr(db->name, str[1]);
|
|
StringBuf_AppendStr(db->name, str[1]);
|
|
db->limit = atoi(str[2]);
|
|
db->limit = atoi(str[2]);
|
|
- StringBuf_AppendStr(db->enter.mapname, str[3]);
|
|
|
|
- db->enter.x = atoi(str[4]);
|
|
|
|
- db->enter.y = atoi(str[5]);
|
|
|
|
|
|
+ db->timeout = atoi(str[3]);
|
|
|
|
+ StringBuf_AppendStr(db->enter.mapname, str[4]);
|
|
|
|
+ db->enter.x = atoi(str[5]);
|
|
|
|
+ db->enter.y = atoi(str[6]);
|
|
|
|
|
|
//Instance maps
|
|
//Instance maps
|
|
- for (i = 6; i < columns; i++) {
|
|
|
|
|
|
+ for (i = 7; i < columns; i++) {
|
|
if (strlen(str[i])) {
|
|
if (strlen(str[i])) {
|
|
if (mapindex_name2id(str[i]) == 0) {
|
|
if (mapindex_name2id(str[i]) == 0) {
|
|
ShowWarning("instance_readdb_sub: Invalid map '%s' in maplist, skipping...\n", str[i]);
|
|
ShowWarning("instance_readdb_sub: Invalid map '%s' in maplist, skipping...\n", str[i]);
|
|
@@ -675,7 +869,7 @@ static bool instance_readdb_sub(char* str[], int columns, int current)
|
|
}
|
|
}
|
|
RECREATE(db->maplist, StringBuf *, db->maplist_count+1);
|
|
RECREATE(db->maplist, StringBuf *, db->maplist_count+1);
|
|
db->maplist[db->maplist_count] = StringBuf_Malloc();
|
|
db->maplist[db->maplist_count] = StringBuf_Malloc();
|
|
- if (strcmpi(str[i], str[3]) == 0)
|
|
|
|
|
|
+ if (strcmpi(str[i], str[4]) == 0)
|
|
defined = true;
|
|
defined = true;
|
|
StringBuf_AppendStr(db->maplist[db->maplist_count], str[i]);
|
|
StringBuf_AppendStr(db->maplist[db->maplist_count], str[i]);
|
|
db->maplist_count++;
|
|
db->maplist_count++;
|
|
@@ -732,7 +926,7 @@ void instance_readdb(void) {
|
|
int f;
|
|
int f;
|
|
|
|
|
|
for (f = 0; f<ARRAYLENGTH(filename); f++) {
|
|
for (f = 0; f<ARRAYLENGTH(filename); f++) {
|
|
- sv_readdb(db_path, filename[f], ',', 7, 7+MAX_MAP_PER_INSTANCE, -1, &instance_readdb_sub, f);
|
|
|
|
|
|
+ sv_readdb(db_path, filename[f], ',', 8, 8+MAX_MAP_PER_INSTANCE, -1, &instance_readdb_sub, f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -754,7 +948,7 @@ void do_reload_instance(void)
|
|
struct instance_db *db;
|
|
struct instance_db *db;
|
|
struct s_mapiterator* iter;
|
|
struct s_mapiterator* iter;
|
|
struct map_session_data *sd;
|
|
struct map_session_data *sd;
|
|
- int i;
|
|
|
|
|
|
+ unsigned short i;
|
|
|
|
|
|
for( i = 1; i < MAX_INSTANCE_DATA; i++ ) {
|
|
for( i = 1; i < MAX_INSTANCE_DATA; i++ ) {
|
|
im = &instance_data[i];
|
|
im = &instance_data[i];
|
|
@@ -775,10 +969,14 @@ void do_reload_instance(void)
|
|
for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
|
|
for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
|
|
if(sd && map[sd->bl.m].instance_id) {
|
|
if(sd && map[sd->bl.m].instance_id) {
|
|
struct party_data *p;
|
|
struct party_data *p;
|
|
- if(!(p = party_search(sd->status.party_id)) || p->instance_id != map[sd->bl.m].instance_id) // Someone not in party is on instance map
|
|
|
|
|
|
+ struct guild *g;
|
|
|
|
+
|
|
|
|
+ if (instance_data[map[sd->bl.m].instance_id].mode == IM_PARTY && (!(p = party_search(sd->status.party_id)) || p->instance_id != map[sd->bl.m].instance_id)) // Someone not in party is on instance map
|
|
|
|
+ continue;
|
|
|
|
+ if (instance_data[map[sd->bl.m].instance_id].mode == IM_GUILD && (!(g = guild_search(sd->status.guild_id)) || g->instance_id != map[sd->bl.m].instance_id)) // Someone not in guild is on instance map
|
|
continue;
|
|
continue;
|
|
im = &instance_data[p->instance_id];
|
|
im = &instance_data[p->instance_id];
|
|
- if((db = instance_searchtype_db(im->type)) != NULL && !instance_enter(sd,StringBuf_Value(db->name))) { // All good
|
|
|
|
|
|
+ if((db = instance_searchtype_db(im->type)) != NULL && !instance_enter(sd, i, StringBuf_Value(db->name))) { // All good
|
|
clif_displaymessage(sd->fd, msg_txt(sd,515)); // Instance has been reloaded
|
|
clif_displaymessage(sd->fd, msg_txt(sd,515)); // Instance has been reloaded
|
|
instance_reqinfo(sd,p->instance_id);
|
|
instance_reqinfo(sd,p->instance_id);
|
|
} else // Something went wrong
|
|
} else // Something went wrong
|