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.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index ee5bda342..896b97103 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -125,6 +125,60 @@ static int mobdb_searchname_array_sub(struct mob_db* mob, const char *str)
}
/*==========================================
+ * MvP Tomb [GreenBox]
+ *------------------------------------------*/
+void mvptomb_create(struct mob_data *md, char *killer, time_t time)
+{
+ struct npc_data *nd;
+
+ CREATE(nd, struct npc_data, 1);
+
+ nd->bl.id = md->tomb_nid = npc_get_new_npc_id();
+
+ nd->ud.dir = md->ud.dir;
+ nd->bl.m = md->bl.m;
+ nd->bl.x = md->bl.x;
+ nd->bl.y = md->bl.y;
+ nd->bl.type = BL_NPC;
+
+ safestrncpy(nd->name, msg_txt(656), sizeof(nd->name));
+
+ nd->class_ = 565;
+ nd->speed = 200;
+ nd->subtype = TOMB;
+
+ nd->u.tomb.md = md;
+ nd->u.tomb.kill_time = time;
+
+ if (killer)
+ nd->u.tomb.killer_name = aStrdup(killer); // Don't rely that killer name will be available all time
+ else
+ nd->u.tomb.killer_name = NULL;
+
+ map_addnpc(nd->bl.m, nd);
+ map_addblock(&nd->bl);
+ status_set_viewdata(&nd->bl, nd->class_);
+ status_change_init(&nd->bl);
+ unit_dataset(&nd->bl);
+ clif_spawn(&nd->bl);
+}
+
+void mvptomb_destroy(struct mob_data *md)
+{
+ struct npc_data *nd = (struct npc_data *)map_id2bl(md->tomb_nid);
+
+ if (nd)
+ {
+ if (nd->u.tomb.killer_name)
+ aFree(nd->u.tomb.killer_name);
+
+ npc_unload(nd);
+ }
+
+ md->tomb_nid = 0;
+}
+
+/*==========================================
* Founds up to N matches. Returns number of matches [Skotlex]
*------------------------------------------*/
int mobdb_searchname_array(struct mob_db** data, int size, const char *str)
@@ -916,6 +970,10 @@ int mob_spawn (struct mob_data *md)
// Added for carts, falcons and pecos for cloned monsters. [Valaris]
md->sc.option = md->db->option;
+ // MvP tomb [GreenBox]
+ if (md->tomb_nid)
+ mvptomb_destroy(md);
+
map_addblock(&md->bl);
if( map[md->bl.m].users )
clif_spawn(&md->bl);
@@ -2505,6 +2563,10 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if(!md->spawn) //Tell status_damage to remove it from memory.
return 5; // Note: Actually, it's 4. Oh well...
+ // MvP tomb [GreenBox]
+ if (battle_config.mvp_tomb_enabled && md->spawn->state.boss)
+ mvptomb_create(md, mvp_sd ? mvp_sd->status.name : NULL, time(NULL));
+
if( !rebirth )
mob_setdelayspawn(md); //Set respawning.
return 3; //Remove from map.