summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 35c9ed1aa..2cd82e4d1 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -459,6 +459,12 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int
int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai) {
struct mob_data* md = NULL;
int count, lv;
+ bool no_guardian_data = false;
+
+ if( ai && ai&0x200 ) {
+ no_guardian_data = true;
+ ai &=~ 0x200;
+ }
if (m < 0 || amount <= 0)
return 0; // invalid input
@@ -472,7 +478,7 @@ int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const
if (!md)
continue;
- if (class_ == MOBID_EMPERIUM) {
+ if (class_ == MOBID_EMPERIUM && !no_guardian_data) {
struct guild_castle* gc = guild->mapindex2gc(map_id2index(m));
struct guild* g = (gc) ? guild->search(gc->guild_id) : NULL;
if (gc) {
@@ -581,7 +587,7 @@ int mob_spawn_guardian_sub(int tid, int64 tick, int id, intptr_t data) {
if (g == NULL)
{ //Liberate castle, if the guild is not found this is an error! [Skotlex]
ShowError("mob_spawn_guardian_sub: Couldn't load guild %d!\n", (int)data);
- if (md->class_ == MOBID_EMPERIUM)
+ if (md->class_ == MOBID_EMPERIUM && md->guardian_data)
{ //Not sure this is the best way, but otherwise we'd be invoking this for ALL guardians spawned later on.
md->guardian_data->guild_id = 0;
if (md->guardian_data->castle->guild_id) //Free castle up.
@@ -2512,7 +2518,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
logs->mvpdrop(mvp_sd, md->class_, log_mvp);
}
- if (type&2 && !sd && md->class_ == MOBID_EMPERIUM)
+ if (type&2 && !sd && md->class_ == MOBID_EMPERIUM && md->guardian_data)
//Emperium destroyed by script. Discard mvp character. [Skotlex]
mvp_sd = NULL;