Browse Source

Added mvp tomb system.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15908 54d463be-8e91-2dee-dedb-b68131a5f0ec
greenboxal2 13 years ago
parent
commit
1ccea559bf
9 changed files with 113 additions and 1 deletions
  1. 4 0
      conf/battle/monster.conf
  2. 9 0
      conf/msg_athena.conf
  3. 1 0
      src/map/battle.c
  4. 2 0
      src/map/battle.h
  5. 1 1
      src/map/map.h
  6. 62 0
      src/map/mob.c
  7. 2 0
      src/map/mob.h
  8. 27 0
      src/map/npc.c
  9. 5 0
      src/map/npc.h

+ 4 - 0
conf/battle/monster.conf

@@ -197,3 +197,7 @@ ksprotection: 0
 
 
 // Should MVP slaves retain their target when summoned back to their master?
 // Should MVP slaves retain their target when summoned back to their master?
 mob_slave_keep_target: yes
 mob_slave_keep_target: yes
+
+// Wheter or not to spawn the mvp tomb.
+// See http://irowiki.org/wiki/MVP#Gravestone
+mvp_tomb_enabled: yes

+ 9 - 0
conf/msg_athena.conf

@@ -571,5 +571,14 @@
 654: Oboro
 654: Oboro
 655: Unknown Job
 655: Unknown Job
 
 
+// MvP Tomb
+// Added here so it can be easily translated
+656: Tomb
+657: [ ^EE0000%s^000000 ]
+658: Has met its demise
+659: Time of death : ^EE0000%s^000000
+660: Defeated by
+661: [^EE0000%s^000000]
+
 //Custom translations
 //Custom translations
 import: conf/import/msg_conf.txt
 import: conf/import/msg_conf.txt

+ 1 - 0
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,          },
 	{ "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,            },          
 	{ "atcommand_max_stat_bypass",          &battle_config.atcommand_max_stat_bypass,       0,      0,      100,            },          
 	{ "skill_amotion_leniency",             &battle_config.skill_amotion_leniency,          90,     0,      100				},
 	{ "skill_amotion_leniency",             &battle_config.skill_amotion_leniency,          90,     0,      100				},
+	{ "mvp_tomb_enabled",					&battle_config.mvp_tomb_enabled,				1,      0,      1				},
 };
 };
 
 
 
 

+ 2 - 0
src/map/battle.h

@@ -472,6 +472,8 @@ extern struct Battle_Config
 	int max_third_parameter;
 	int max_third_parameter;
 	int max_baby_third_parameter;
 	int max_baby_third_parameter;
 	int atcommand_max_stat_bypass;
 	int atcommand_max_stat_bypass;
+
+	int mvp_tomb_enabled;
 } battle_config;
 } battle_config;
 
 
 void do_init_battle(void);
 void do_init_battle(void);

+ 1 - 1
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.
 //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)
 #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 {
 enum {
 	RC_FORMLESS=0,
 	RC_FORMLESS=0,

+ 62 - 0
src/map/mob.c

@@ -124,6 +124,60 @@ static int mobdb_searchname_array_sub(struct mob_db* mob, const char *str)
 	return strcmpi(mob->jname,str);
 	return strcmpi(mob->jname,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]
  * Founds up to N matches. Returns number of matches [Skotlex]
  *------------------------------------------*/
  *------------------------------------------*/
@@ -916,6 +970,10 @@ int mob_spawn (struct mob_data *md)
 		// Added for carts, falcons and pecos for cloned monsters. [Valaris]
 		// Added for carts, falcons and pecos for cloned monsters. [Valaris]
 		md->sc.option = md->db->option;
 		md->sc.option = md->db->option;
 
 
+	// MvP tomb [GreenBox]
+	if (md->tomb_nid)
+		mvptomb_destroy(md);
+
 	map_addblock(&md->bl);
 	map_addblock(&md->bl);
 	if( map[md->bl.m].users )
 	if( map[md->bl.m].users )
 		clif_spawn(&md->bl);
 		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.
 	if(!md->spawn) //Tell status_damage to remove it from memory.
 		return 5; // Note: Actually, it's 4. Oh well...
 		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 )
 	if( !rebirth )
 		mob_setdelayspawn(md); //Set respawning.
 		mob_setdelayspawn(md); //Set respawning.
 	return 3; //Remove from map.
 	return 3; //Remove from map.

+ 2 - 0
src/map/mob.h

@@ -167,6 +167,8 @@ struct mob_data {
 	 * Used to flag summon deletions, saves a worth amount of memory
 	 * Used to flag summon deletions, saves a worth amount of memory
 	 **/
 	 **/
 	bool can_summon : 1;
 	bool can_summon : 1;
+
+	int tomb_nid;
 };
 };
 
 
 
 

+ 27 - 0
src/map/npc.c

@@ -1078,6 +1078,31 @@ int npc_globalmessage(const char* name, const char* mes)
 	return 0;
 	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);
+}
+
 /*==========================================
 /*==========================================
  * ƒNƒŠƒbƒNŽž‚ÌNPC�ˆ—�
  * ƒNƒŠƒbƒNŽž‚ÌNPC�ˆ—�
  *------------------------------------------*/
  *------------------------------------------*/
@@ -1107,6 +1132,8 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd)
 	case SCRIPT:
 	case SCRIPT:
 		run_script(nd->u.scr.script,0,sd->bl.id,nd->bl.id);
 		run_script(nd->u.scr.script,0,sd->bl.id,nd->bl.id);
 		break;
 		break;
+	case TOMB:
+		run_tomb(sd,nd);
 	}
 	}
 
 
 	return 0;
 	return 0;

+ 5 - 0
src/map/npc.h

@@ -62,6 +62,11 @@ struct npc_data {
 			short x,y; // destination coords
 			short x,y; // destination coords
 			unsigned short mapindex; // destination map
 			unsigned short mapindex; // destination map
 		} warp;
 		} warp;
+		struct {
+			struct mob_data *md;
+			time_t kill_time;
+			char *killer_name;
+		} tomb;
 	} u;
 	} u;
 };
 };