Jump to content
Sign in to follow this  
keitenai

MVP tomb stone patch

Recommended Posts

Here's MVP tomb stone patch that i made compatible with 3ceam

 
 
 
Index: conf/battle/monster.conf
===================================================================
--- conf/battle/monster.conf	(revision 792)
+++ conf/battle/monster.conf	(working copy)
@@ -206,6 +206,11 @@
 // NOTE: This affects who gains the Castle when the Emperium is broken. 
 mob_npc_event_type: 1
 
+// Wheter or not to spawn the mvp tomb. (Default: no)
+// This is a renewal feature.
+// See http://irowiki.org/wiki/MVP#Gravestone
+mvp_tomb_enabled: yes
+
 // Time in milliseconds to actitave protection against Kill Steal
 // Set to 0 to disable it.
 // If this is activated and a player is using @noks, damage from others players (KS) not in the party
Index: src/map/battle.c
===================================================================
--- src/map/battle.c	(revision 792)
+++ src/map/battle.c	(working copy)
@@ -5914,6 +5914,7 @@
 	{ "mob_luk_status_def",                 &battle_config.mob_luk_sc_def,                  300,    1,      INT_MAX,        },
 	{ "pc_max_status_def",                  &battle_config.pc_max_sc_def,                   100,    0,      INT_MAX,        },
 	{ "mob_max_status_def",                 &battle_config.mob_max_sc_def,                  100,    0,      INT_MAX,        },
+	{ "mvp_tomb_enabled",					&battle_config.mvp_tomb_enabled,				1,      0,      1				},
 	{ "sg_miracle_skill_ratio",             &battle_config.sg_miracle_skill_ratio,          1,      0,      10000,          },
 	{ "sg_angel_skill_ratio",               &battle_config.sg_angel_skill_ratio,            10,     0,      10000,          },
 	{ "autospell_stacking",                 &battle_config.autospell_stacking,              0,      0,      1,              },
Index: src/map/battle.h
===================================================================
--- src/map/battle.h	(revision 792)
+++ src/map/battle.h	(working copy)
@@ -416,6 +416,7 @@
 
 	int mob_npc_event_type; //Determines on who the npc_event is executed. [Skotlex]
 	int mob_clear_delay; // [Valaris]
+	int mvp_tomb_enabled;
 
 	int character_size; // if riders have size=2, and baby class riders size=1 [Lupus]
 	int mob_max_skilllvl; // Max possible skill level [Lupus]
Index: src/map/map.h
===================================================================
--- src/map/map.h	(revision 792)
+++ src/map/map.h	(working copy)
@@ -243,7 +243,7 @@
 //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 { NPCTYPE_TOMB, WARP, SHOP, SCRIPT, CASHSHOP };
 
 enum {
 	RC_FORMLESS=0,	//NOTHING
Index: src/map/mob.c
===================================================================
--- src/map/mob.c	(revision 792)
+++ src/map/mob.c	(working copy)
@@ -102,6 +102,77 @@
 
 	return 0;
 }
+
+/*==========================================
+ *              MvP Tomb [GreenBox]
+ *------------------------------------------*/
+void mvptomb_create(struct mob_data *md, char *killer, time_t time)
+{
+	struct npc_data *nd;
+
+	if ( md->tomb_nid )
+		mvptomb_destroy(md);
+
+	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, "Tomb", sizeof(nd->name));
+
+	nd->class_ = 565;
+	nd->speed = 200;
+	nd->subtype = NPCTYPE_TOMB;
+
+	nd->u.tomb.md = md;
+	nd->u.tomb.kill_time = time;
+	
+	if (killer)
+		safestrncpy(nd->u.tomb.killer_name, killer, NAME_LENGTH);
+	else
+		nd->u.tomb.killer_name[0] = '\0';
+
+	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;
+
+	if ( (nd = map_id2nd(md->tomb_nid)) ) {
+		int m, i;
+
+		m = nd->bl.m;
+		
+		clif_clearunit_area(&nd->bl,CLR_OUTSIGHT);
+		
+		map_delblock(&nd->bl);
+
+		ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == nd );
+		if( !(i == map[m].npc_num) ) {
+			map[m].npc_num--;
+			map[m].npc[i] = map[m].npc[map[m].npc_num];
+			map[m].npc[map[m].npc_num] = NULL;
+		}
+
+		map_deliddb(&nd->bl);
+
+		aFree(nd);
+	}
+
+	md->tomb_nid = 0;
+}
+
 static int mobdb_searchname_array_sub(struct mob_db* mob, const char *str)
 {
 	if (mob == mob_dummy)
@@ -895,6 +966,10 @@
 		// 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);
 	clif_spawn(&md->bl);
 	skill_unit_move(&md->bl,tick,1);
@@ -2491,6 +2566,10 @@
 	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->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.
Index: src/map/mob.h
===================================================================
--- src/map/mob.h	(revision 792)
+++ src/map/mob.h	(working copy)
@@ -9,6 +9,7 @@
 #include "map.h" // struct status_data, struct view_data, struct mob_skill
 #include "status.h" // struct status data, struct status_change
 #include "unit.h" // unit_stop_walking(), unit_stop_attack()
+#include "npc.h"
 
 
 #define MAX_RANDOMMONSTER 4
@@ -149,7 +150,7 @@
 	int level;
 	int target_id,attacked_id;
 	int areanpc_id; //Required in OnTouchNPC (to avoid multiple area touchs)
-
+	int tomb_nid;
 	unsigned int next_walktime,last_thinktime,last_linktime,last_pcneartime;
 	short move_fail_count;
 	short lootitem_count;
@@ -277,6 +278,10 @@
 int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char *event, int master_id, int mode, int flag, unsigned int duration);
 int mob_clone_delete(struct mob_data *md);
 
+// MvP Tomb System
+void mvptomb_create(struct mob_data *md, char *killer, time_t time);
+void mvptomb_destroy(struct mob_data *md);
+
 void mob_reload(void);
 
 #endif /* _MOB_H_ */
Index: src/map/npc.c
===================================================================
--- src/map/npc.c	(revision 792)
+++ src/map/npc.c	(working copy)
@@ -1087,13 +1087,40 @@
 		clif_cashshop_show(sd,nd);
 		break;
 	case SCRIPT:
-		run_script(nd->u.scr.script,0,sd->bl.id,nd->bl.id);
-		break;
+			run_script(nd->u.scr.script,0,sd->bl.id,nd->bl.id);
+			break;
+		case NPCTYPE_TOMB:
+			npc_tomb(sd,nd);
 	}
 
 	return 0;
 }
 
+// MvP tomb [GreenBox]
+int npc_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));
+	snprintf(buffer, sizeof(buffer), "[ ^0000EE%s^000000 ]", nd->u.tomb.md->db->name);
+		clif_scriptmes(sd, nd->bl.id, buffer);
+		clif_scriptmes(sd, nd->bl.id, "Has met its demise");
+		snprintf(buffer, sizeof(buffer), "Time of death : ^EE0000%s^000000", time);
+		clif_scriptmes(sd, nd->bl.id, buffer);
+		clif_scriptmes(sd, nd->bl.id, "^FFFFFF_^000000");
+		clif_scriptmes(sd, nd->bl.id, "Defeated by");
+		snprintf(buffer, sizeof(buffer), "[ ^0000EE%s^000000 ]", nd->u.tomb.killer_name[0] ? nd->u.tomb.killer_name : "Unknown"); 
+		clif_scriptmes(sd, nd->bl.id, buffer);
+		clif_scriptclose(sd, nd->bl.id);
+	return 0;
+}
+
 /*==========================================
  *
  *------------------------------------------*/
Index: src/map/npc.h
===================================================================
--- src/map/npc.h	(revision 792)
+++ src/map/npc.h	(working copy)
@@ -62,6 +62,11 @@
 			short x,y; // destination coords
 			unsigned short mapindex; // destination map
 		} warp;
+		struct {
+			struct mob_data *md;
+			time_t kill_time;
+			char killer_name[NAME_LENGTH];
+		} tomb;
 	} u;
 };
 
@@ -160,6 +165,7 @@
 int npc_duplicate4instance(struct npc_data *snd, int m);
 int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int points);
 int npc_cashshop_buylist(struct map_session_data* sd, int n, unsigned short* item_list, int points);
+int npc_tomb(struct map_session_data* sd, struct npc_data* nd);
 
 extern struct npc_data* fake_nd;
 
Index: src/map/unit.c
===================================================================
--- src/map/unit.c	(revision 792)
+++ src/map/unit.c	(working copy)
@@ -2435,6 +2435,8 @@
 			}
 			if( mob_is_clone(md->class_) )
 				mob_clone_delete(md);
+			if( md->tomb_nid )
+				mvptomb_destroy(md);
 			break;
 		}
 		case BL_HOM:

 

Enjoy! :D

Edited by keitenai

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.