View Single Post
  #1  
Old 06-27-2010, 12:02 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default COMMITTED: Pass Corpse Name to EVENT_LOOT

The following changes allow the name of the corpse to be passed to perl in the EVENT_LOOT sub as $corpse in the NPC database name format such as "a_ra`tuk_screambringer" or "#Viarglug".

Code:
Index: zone/embparser.cpp
===================================================================
--- zone/embparser.cpp	(revision 1575)
+++ zone/embparser.cpp	(working copy)
@@ -594,6 +594,7 @@
 			Seperator *sep = new Seperator(data);
 			ExportVar(packagename.c_str(), "looted_id", sep->arg[0]);
 			ExportVar(packagename.c_str(), "looted_charges", sep->arg[1]);
+			ExportVar(packagename.c_str(), "corpse", sep->arg[2]);
 			safe_delete(sep);
 			break;
 		}
Index: zone/PlayerCorpse.cpp
===================================================================
--- zone/PlayerCorpse.cpp	(revision 1575)
+++ zone/PlayerCorpse.cpp	(working copy)
@@ -1057,9 +1057,12 @@
 		}
 
 #ifdef EMBPERL
-		char buf[24];
-		snprintf(buf, 23, "%d %d", inst->GetItem()->ID, inst->GetCharges());
-		buf[23] = '\0';
+		char buf[88];
+		char corpse_name[64];
+		strcpy(corpse_name, orgname);
+		EntityList::RemoveNumbers(corpse_name);
+		snprintf(buf, 87, "%d %d %s", inst->GetItem()->ID, inst->GetCharges(), corpse_name);
+		buf[87] = '\0';
 		((PerlembParser*)parse)->Event(EVENT_LOOT, 0, buf, (NPC*)NULL, client);
 #endif
Reply With Quote