diff options
author | greenboxal2 <greenboxal2@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-04-21 14:00:23 +0000 |
---|---|---|
committer | greenboxal2 <greenboxal2@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-04-21 14:00:23 +0000 |
commit | 7475d4859a56a988fc36372a277c0c007d0123a5 (patch) | |
tree | 34cab3771144109052aeb96ed6c64779d354663b /src | |
parent | 8877d3c6dcd9dbd203fd72924b60f3dcf448e5e9 (diff) | |
download | hercules-7475d4859a56a988fc36372a277c0c007d0123a5.tar.gz hercules-7475d4859a56a988fc36372a277c0c007d0123a5.tar.bz2 hercules-7475d4859a56a988fc36372a277c0c007d0123a5.tar.xz hercules-7475d4859a56a988fc36372a277c0c007d0123a5.zip |
Added mvp tomb system.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15908 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/battle.h | 2 | ||||
-rw-r--r-- | src/map/map.h | 2 | ||||
-rw-r--r-- | src/map/mob.c | 62 | ||||
-rw-r--r-- | src/map/mob.h | 2 | ||||
-rw-r--r-- | src/map/npc.c | 27 | ||||
-rw-r--r-- | src/map/npc.h | 5 |
7 files changed, 100 insertions, 1 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 86297f271..cb470f938 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5209,6 +5209,7 @@ static const struct _battle_data { { "max_baby_third_parameter", &battle_config.max_baby_third_parameter, 108, 10, 10000, }, { "atcommand_max_stat_bypass", &battle_config.atcommand_max_stat_bypass, 0, 0, 100, }, { "skill_amotion_leniency", &battle_config.skill_amotion_leniency, 90, 0, 100 }, + { "mvp_tomb_enabled", &battle_config.mvp_tomb_enabled, 1, 0, 1 }, }; diff --git a/src/map/battle.h b/src/map/battle.h index 3e779c212..f8f0a10d7 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -472,6 +472,8 @@ extern struct Battle_Config int max_third_parameter; int max_baby_third_parameter; int atcommand_max_stat_bypass; + + int mvp_tomb_enabled; } battle_config; void do_init_battle(void); diff --git a/src/map/map.h b/src/map/map.h index b78e71b0c..a92a22884 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -241,7 +241,7 @@ enum bl_type { //For common mapforeach calls. Since pets cannot be affected, they aren't included here yet. #define BL_CHAR (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM) -enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP }; +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; enum { RC_FORMLESS=0, 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. diff --git a/src/map/mob.h b/src/map/mob.h index a93cb04e3..4caf0148c 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -167,6 +167,8 @@ struct mob_data { * Used to flag summon deletions, saves a worth amount of memory **/ bool can_summon : 1; + + int tomb_nid; }; diff --git a/src/map/npc.c b/src/map/npc.c index 661406c95..d0defdf88 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1078,6 +1078,31 @@ int npc_globalmessage(const char* name, const char* mes) return 0; } +// MvP tomb [GreenBox] +void run_tomb(struct map_session_data* sd, struct npc_data* nd) +{ + char buffer[200]; + char time[10]; + + strftime(time, sizeof(time), "%H:%M", localtime(&nd->u.tomb.kill_time)); + + // TODO: Find exact color? + snprintf(buffer, sizeof(buffer), msg_txt(657), nd->u.tomb.md->db->name); + clif_scriptmes(sd, nd->bl.id, buffer); + + clif_scriptmes(sd, nd->bl.id, msg_txt(658)); + + snprintf(buffer, sizeof(buffer), msg_txt(659), time); + clif_scriptmes(sd, nd->bl.id, buffer); + + clif_scriptmes(sd, nd->bl.id, msg_txt(660)); + + snprintf(buffer, sizeof(buffer), msg_txt(661), nd->u.tomb.killer_name ? nd->u.tomb.killer_name : "Unknown"); + clif_scriptmes(sd, nd->bl.id, buffer); + + clif_scriptclose(sd, nd->bl.id); +} + /*========================================== * クリック時のNPC処理 *------------------------------------------*/ @@ -1107,6 +1132,8 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd) case SCRIPT: run_script(nd->u.scr.script,0,sd->bl.id,nd->bl.id); break; + case TOMB: + run_tomb(sd,nd); } return 0; diff --git a/src/map/npc.h b/src/map/npc.h index 5e5bcb41a..47f6117d9 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -62,6 +62,11 @@ struct npc_data { short x,y; // destination coords unsigned short mapindex; // destination map } warp; + struct { + struct mob_data *md; + time_t kill_time; + char *killer_name; + } tomb; } u; }; |