Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 09-19-2010, 05:51 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,450
Default Destructable Objects

Here's a diff for it. HUGE thanks to Derision and Trevius for getting the packets figured out. This implements two database fields, which the SQL is listed below for as well.

destructable - this enables the object as being destructable

destructablestr - this is the object string that gets placed as an object. The only way to use this is if the client you are viewing it on has that eqg file, and if that client has that eqg file in its assets list. This is named qeynos_assets.txt for example, and contains a list of the object eqgs that contain the destructable object. The filename is what you put in destructablestr.

TODO: Make objects appear differently depending on a flag you set in the object itself. This is outlined in the diff comments and just requires a database field. This is so objects don't sink in the ground, or are too high above the ground.

TODO2: Add the object unknown opcode to perl.

NOTE: Objects' destructable appearance state depends on the appearance. This is outlined in the diff comments if you are curious about it.


SQL
Code:
 ALTER TABLE `npc_types` ADD COLUMN `destructable` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '' AFTER 
`unique_spawn_by_name`, ADD COLUMN `destructablestr` varchar(24) NOT NULL DEFAULT '' COMMENT '' AFTER `destructable`
Diff
Code:
Index: common/emu_oplist.h
===================================================================
--- common/emu_oplist.h	(revision 1666)
+++ common/emu_oplist.h	(working copy)
@@ -477,6 +477,7 @@
 N(OP_TradeBusy),
 N(OP_GuildUpdateURLAndChannel),
 N(OP_CameraEffect),
+N(OP_DestructableRelated),
 N(OP_SpellEffect),
 N(OP_DzQuit),
 N(OP_DzListTimers),
Index: common/eq_packet_structs.h
===================================================================
--- common/eq_packet_structs.h	(revision 1666)
+++ common/eq_packet_structs.h	(working copy)
@@ -313,6 +313,25 @@
              /*0348*/ Color_Struct colors[MAX_MATERIALS]; // Array elements correspond to struct equipment_colors above
          };
 /*0384*/ uint8  lfg;            // 0=off, 1=lfg on
+	bool DestructableObject;
+	char DestructableString1[64];
+	char DestructableString2[64];
+	char DestructableString3[64];
+	uint32 DestructableUnk1;
+	uint32 DestructableUnk2;
+	uint32 DestructableID1;
+	uint32 DestructableID2;
+	uint32 DestructableID3;
+	uint32 DestructableID4;
+	uint32 DestructableUnk3;
+	uint32 DestructableUnk4;
+	uint32 DestructableUnk5;
+	uint32 DestructableUnk6;
+	uint32 DestructableUnk7;
+	uint32 DestructableUnk8;
+	uint32 DestructableUnk9;
+	uint8 DestructableByte;
+
 /*0385*/
 
 };
Index: common/patches/SoD.cpp
===================================================================
--- common/patches/SoD.cpp	(revision 1666)
+++ common/patches/SoD.cpp	(working copy)
@@ -924,6 +924,29 @@
 	dest->FastQueuePacket(&in, ack_req);
 }
 
+const char LiveTent[] =
+{
+0x61, 0x5f, 0x4d, 0x69, 0x6e, 0x6f, 0x68, 0x74, 0x65, 0x6e, 0x5f, 0x74, 0x65, 0x6e, 0x74, 0x30,
+0x37, 0x00, 0xdb, 0x3b, 0x00, 0x00, 0x28, 0x00, 0x00, 0x20, 0x41, 0x01, 0x00, 0x00, 0x60, 0x1d,
+0xd1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x45, 0x53, 0x54, 0x5f, 0x54, 0x4e,
+0x54, 0x5f, 0x47, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x6e, 0x74, 0x00, 0x5a, 0x6f, 0x6e, 0x65, 0x41,
+0x63, 0x74, 0x6f, 0x72, 0x5f, 0x30, 0x31, 0x31, 0x38, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24,
+0x02, 0x00, 0x00, 0xb0, 0x07, 0x00, 0x00, 0xb1, 0x07, 0x00, 0x00, 0xb2, 0x07, 0x00, 0x00, 0xb3,
+0x07, 0x00, 0x00, 0x00, 0x9d, 0xf7, 0x13, 0x00, 0x00, 0x00, 0x00, 0x58, 0x9d, 0xf7, 0x13, 0x00,
+0x5b, 0xc5, 0x13, 0x60, 0x88, 0x12, 0x00, 0x66, 0x8f, 0x5a, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00,
+0x00, 0x00, 0xc0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0x08, 0x00,
+0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
+0x00, 0x00, 0x3e, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xe1, 0x07, 0x00, 0x27, 0x83, 0x3a, 0x02, 0xf7, 0x02,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
 ENCODE(OP_NewSpawn) {  ENCODE_FORWARD(OP_ZoneSpawns); }
 ENCODE(OP_ZoneEntry){  ENCODE_FORWARD(OP_ZoneSpawns); }
 ENCODE(OP_ZoneSpawns) {
@@ -967,7 +990,15 @@
 
 			if(strlen(emu->suffix))
 				PacketSize += strlen(emu->suffix) + 1;
-		
+
+			if(emu->DestructableObject)
+			{
+				PacketSize = PacketSize - 4;	// No bodytype
+				PacketSize += 53; // Fixed portion
+				PacketSize += strlen(emu->DestructableString1) + 1;
+				PacketSize += strlen(emu->DestructableString2) + 1;
+				PacketSize += strlen(emu->DestructableString3) + 1;
+			}
 			bool ShowName = 1;
 			if(emu->bodytype >= 66)
 			{
@@ -1000,7 +1031,15 @@
 			VARSTRUCT_ENCODE_STRING(Buffer, emu->name);
 			VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->spawnId);
 			VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->level);
-			VARSTRUCT_ENCODE_TYPE(float, Buffer, SpawnSize - 0.7);	// Eye Height?
+			if(emu->DestructableObject)
+			{
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x41200000);
+			}
+			else
+			{
+				VARSTRUCT_ENCODE_TYPE(float, Buffer, SpawnSize - 0.7);	// Eye Height?
+			}
+
 			VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC);
 
 			structs::Spawn_Struct_Bitfields *Bitfields = (structs::Spawn_Struct_Bitfields*)Buffer;
@@ -1023,6 +1062,12 @@
 
 			Bitfields->showname = ShowName;
 
+			if(emu->DestructableObject)
+			{
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x1d600000);
+				Buffer = Buffer -4;
+			}
+
 			Bitfields->ispet = emu->is_pet;
 
 			Buffer += sizeof(structs::Spawn_Struct_Bitfields);
@@ -1035,10 +1080,48 @@
 			if(strlen(emu->suffix))
 				OtherData = OtherData | 0x08;
 
+			if(emu->DestructableObject)
+				OtherData = OtherData | 0xd1;
+
 			VARSTRUCT_ENCODE_TYPE(uint8, Buffer, OtherData);
 
-			VARSTRUCT_ENCODE_TYPE(float, Buffer, -1);	// unknown3
+			if(emu->DestructableObject)
+			{
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x00000000);
+			}
+			else
+			{
+				VARSTRUCT_ENCODE_TYPE(float, Buffer, -1);	// unknown3
+			}
 			VARSTRUCT_ENCODE_TYPE(float, Buffer, 0);	// unknown4
+
+			if(emu->DestructableObject)
+			{
+				// Live has 0xe1 for OtherData
+				//
+				VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructableString1);
+				VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructableString2);
+				VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructableString3);
+
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableUnk1);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableUnk2);
+
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableID1);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableID2);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableID3);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableID4);
+
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableUnk3);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableUnk4);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableUnk5);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableUnk6);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableUnk7);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableUnk8);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructableUnk9);
+
+				VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->DestructableByte);
+			}
+
 			VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->size);
 			VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->face);
 			VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->walkspeed);
@@ -1056,8 +1139,16 @@
 
 			// Setting this next field to zero will cause a crash. Looking at ShowEQ, if it is zero, the bodytype field is not
 			// present. Will sort that out later.
-			VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 1);	// This is a properties count field
-			VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->bodytype);
+
+			if(!emu->DestructableObject)
+			{
+				VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 1);	// This is a properties count field
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->bodytype);
+			}
+			else
+			{
+				VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0);
+			}
 		
 			VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->curHp);
 			VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->haircolor);
@@ -1115,6 +1206,17 @@
 			Position->z = emu->z;
 			Position->deltaZ = emu->deltaZ;
 
+			if(emu->DestructableObject)
+			{
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x00000000);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x00000000);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x0007e1c3);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x023a8327);
+				VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x000002f7);
+
+				Buffer = Buffer -20;
+			}
+
 			Buffer += sizeof(structs::Spawn_Struct_Position);
 		
 			if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522))
@@ -1165,8 +1267,6 @@
 			}
 			Buffer += 33; // Unknown;
 
-			//_log(NET__ERROR, "Sending zone spawn for %s", emu->name);
-			//_hex(NET__ERROR, outapp->pBuffer, outapp->size);
 			dest->FastQueuePacket(&outapp, ack_req);
 	}
 	
Index: zone/beacon.cpp
===================================================================
--- zone/beacon.cpp	(revision 1666)
+++ zone/beacon.cpp	(working copy)
@@ -45,7 +45,7 @@
 :Mob
 (
 	NULL, NULL, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0,""
 ),
 		remove_timer(lifetime),
 		spell_timer(0)
Index: zone/client.cpp
===================================================================
--- zone/client.cpp	(revision 1666)
+++ zone/client.cpp	(working copy)
@@ -139,7 +139,9 @@
 	0,	// qglobal
 	0,	// slow_mitigation
 	0,	// maxlevel
-	0	// scalerate
+	0,	// scalerate
+	0, //destructableobject
+	"" //destructableobjectstr
 
 	),
 	//these must be listed in the order they appear in client.h
Index: zone/command.cpp
===================================================================
--- zone/command.cpp	(revision 1666)
+++ zone/command.cpp	(working copy)
@@ -860,6 +860,35 @@
 
 void command_optest(Client *c, const Seperator *sep)
 {
+	if(!c->GetTarget())
+		return;
+
+	EQApplicationPacket *outapp = new EQApplicationPacket(OP_DestructableRelated, 8);
+	char *Buffer = (char *)outapp->pBuffer;
+
+	VARSTRUCT_ENCODE_TYPE(uint32, Buffer, c->GetTarget()->GetID());
+	VARSTRUCT_ENCODE_TYPE(uint32, Buffer, atoi(sep->arg[1]));
+	
+	/*
+	 * EQApplicationPacket *outapp = new EQApplicationPacket(OP_TestBuff, 28);
+	char *Buffer = (char *)outapp->pBuffer;
+
+	VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x00000039);	// Effect type
+	VARSTRUCT_ENCODE_TYPE(uint32, Buffer, c->GetTarget()->GetID());
+	VARSTRUCT_ENCODE_TYPE(uint32, Buffer, c->GetTarget()->GetID());
+	VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x00001388);
+	VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x00000000);
+	VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x00000bb8);
+	VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x04990101);
+	*/
+
+	DumpPacket(outapp);
+	c->QueuePacket(outapp);
+	safe_delete(outapp);
+	return;
+
+
+
 	if(sep->IsNumber(1))
 	{
 		switch(atoi(sep->arg[1]))
Index: zone/mob.cpp
===================================================================
--- zone/mob.cpp	(revision 1666)
+++ zone/mob.cpp	(working copy)
@@ -104,7 +104,9 @@
 		 int8	in_qglobal,
 		 float	in_slow_mitigation,	// Allows for mobs to mitigate how much they are slowed.
 		 int8	in_maxlevel,
-		 int32	in_scalerate
+		 int32	in_scalerate,
+		 bool	in_destructableobject,
+		 const char * in_destructableobjectstr
 		 ) : 
 		attack_timer(2000),
 		attack_dw_timer(2000),
@@ -371,6 +373,11 @@
 	nimbus_effect3 = 0;
 
 	flymode = FlyMode3;
+
+	destructableobject = in_destructableobject;
+
+	if(in_destructableobjectstr)
+		strncpy(destructableobjectstr,in_destructableobjectstr,24);
 	// Pathing
 	PathingLOSState = UnknownLOS;
 	PathingLoopCount = 0;
@@ -818,7 +826,71 @@
 	}
 	
 	memset(ns->spawn.set_to_0xFF, 0xFF, sizeof(ns->spawn.set_to_0xFF));
+		if(IsNPC() && destructableobject)
+		{
+			ns->spawn.DestructableObject = true;
 	
+		// Changing the first string made it vanish, so it has some significance.
+			if(destructableobjectstr)
+			sprintf(ns->spawn.DestructableString1, destructableobjectstr);
+			// Changing the second string made no visible difference
+			sprintf(ns->spawn.DestructableString2, "%s", ns->spawn.name);
+			// Putting a string in the final one that was previously empty had no visible effect.
+			sprintf(ns->spawn.DestructableString3, "");
+		// Unk1 is 0x00000000 for zombie catapult
+		// Changing it to 0x0000ffff made it invisvible / untargetable
+		// 0x00000001 Visible
+		// 0x00000005 not visible
+		// 0x00000004 not visible
+		// 0x00000002 visible, but only one of two endpieces showing and crosspiece at an odd angle
+		// Maybe this corresponds to the state set with the #appearance commands.
+		ns->spawn.DestructableUnk1 = 0x00000000; // Was 0x00000000
+		// Next one was originally 0x000001f5;
+		// Changing it to 0x00000000 made it look like a human
+		// Changing it to 0x000001f0 made it look like a catapult
+		// Changing it to 0x000001e0 made it look like a catapult
+		// Changing it to 0x00000100 made it look like a catapult
+		// Changing it to 0x00000001 made it look like a catapult
+		ns->spawn.DestructableUnk2 = 0x00000224;
+		// These next 4 are mostly always sequential
+		// Originally they were 633, 634, 635, 636
+		// Changing them all to 633  - no visible effect.
+		// Changing them all to 636 - no visible effect.
+		// #appearance 44 1 makes it jump but no visible damage
+		// #appearance 44 2 makes it look completely broken but still visible
+		// #appearnace 44 3 makes it jump but not visible difference to 3
+		// #appearance 44 4 makes it disappear altogether
+		// #appearance 44 5 makes the client sad.
+		//
+		// Reversing the order of these four numbers and then using #appearance gain had no visible change.
+		//
+		// There is an opcode 0x301d live, 0x5ea1 SoD that seems to change whether the object is targetable or not.
+		//
+		// Setting these four ids to zero had no visible effect when the catapult spawned, nor when #appearance was used.
+		ns->spawn.DestructableID1 = 1968;
+		ns->spawn.DestructableID2 = 1969;
+		ns->spawn.DestructableID3 = 1970;
+		ns->spawn.DestructableID4 = 1971;
+		// Next one was originally 0x1ce45008, changing it to 0x00000000 made no visible difference
+		ns->spawn.DestructableUnk3 = 0x13f79d00;
+		// Next one was originally 0x1a68fe30, changing it to 0x00000000 made no visible difference
+		ns->spawn.DestructableUnk4 = 0x00000000;
+		// Next one was already 0x00000000
+		ns->spawn.DestructableUnk5 = 0x13f79d58;
+		// Next one was originally 0x005a69ec, changing it to 0x00000000 made no visible difference.
+		ns->spawn.DestructableUnk6 = 0x13c55b00;
+		// Next one was originally 0x1a68fe30, changing it to 0x00000000 made no visible difference.
+		ns->spawn.DestructableUnk7 = 0x00128860;
+		// Next one was originally 0x0059de6d, changing it to 0x00000000 made no visible difference.
+		ns->spawn.DestructableUnk8 = 0x005a8f66;
+		// Next one was originally 0x00000201, changing it to 0x00000000 made no visible difference.
+		// For the Minohten tents, 0x00000000 had them up in the air, whil 0x201 put them on the ground.
+		// Changing it it 0x00000001 makes the tent sink into the ground.
+		ns->spawn.DestructableUnk9 = 0x00000201;	// Needs to be 201 for tents
+		ns->spawn.DestructableByte = 0x00;
+
+		ns->spawn.flymode = 0;
+		}
 }
 
 void Mob::CreateDespawnPacket(EQApplicationPacket* app, bool Decay)
Index: zone/mob.h
===================================================================
--- zone/mob.h	(revision 1666)
+++ zone/mob.h	(working copy)
@@ -425,7 +425,9 @@
 		int8	in_qglobal,
 		float	in_slow_mitigation,	// Allows for mobs to mitigate how much they are slowed.
 		int8	in_maxlevel,
-		int32	in_scalerate
+		int32	in_scalerate,
+		bool	in_destructableobject,
+		const char*	in_destructableobjectstr
 	);
 	virtual ~Mob();
 
@@ -1302,6 +1304,10 @@
 	bool m_hasPartialSpellRune;
 	bool m_hasDeathSaveChance;
 	int	flymode;
+
+	bool	destructableobject;
+	char	destructableobjectstr[24];
+
 	int QGVarDuration(const char *fmt);
 	void InsertQuestGlobal(int charid, int npcid, int zoneid, const char *name, const char *value, int expdate);
 
Index: zone/npc.cpp
===================================================================
--- zone/npc.cpp	(revision 1666)
+++ zone/npc.cpp	(working copy)
@@ -109,7 +109,9 @@
 	  d->qglobal,
 	  d->slow_mitigation,
 	  d->maxlevel,
-	  d->scalerate ),
+	  d->scalerate ,
+	  d->destructable,
+	  d->destructablestr),
 	attacked_timer(CombatEventTimer_expire),
 	swarm_timer(100),
 	classattack_timer(1000),
@@ -343,6 +345,8 @@
 		ldon_trap_detected = 0;
 	}
 	qGlobals = NULL;
+	destructableobject = d->destructable;
+	strcpy(destructableobjectstr, d->destructablestr);
 	guard_x_saved = 0;
 	guard_y_saved = 0;
 	guard_z_saved = 0;
Index: zone/npc.h
===================================================================
--- zone/npc.h	(revision 1666)
+++ zone/npc.h	(working copy)
@@ -306,6 +306,8 @@
 
 	uint32 GetAdventureTemplate() const { return adventure_template_id; }
 
+	bool IsDestuctableObject() { return destructableobject; }
+
 protected:
 	
 	const NPCType*	NPCTypedata;
Index: zone/PlayerCorpse.cpp
===================================================================
--- zone/PlayerCorpse.cpp	(revision 1666)
+++ zone/PlayerCorpse.cpp	(working copy)
@@ -198,7 +198,7 @@
 	 in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0,
 	 in_npc->GetTexture(),in_npc->GetHelmTexture(),
 	 0,0,0,0,0,0,0,0,0,
-	 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0,0,0),
+	 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0,0,0,0,""),
 	 corpse_decay_timer(in_decaytime),
 	corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
 	corpse_graveyard_timer(0),
@@ -303,7 +303,9 @@
 	0,	// qglobal
 	0,	// slow_mitigation
 	0,	// maxlevel
-	0	// scalerate
+	0,	// scalerate
+	0, //destr obj
+	"" //destr obj
 ),
 	corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
 	corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
@@ -413,7 +415,7 @@
  : Mob("Unnamed_Corpse","",0,0,in_gender, in_race, in_class, BT_Humanoid, in_deity, in_level,0, in_size, 0, in_heading, in_x, in_y, in_z,0,in_texture,in_helmtexture,
 	 0,0,0,0,0,0,0,0,0,
 	 0,0,0,0,0,0,0,0,0,0,0,0xff,
-	 0,0,0,0,0,0,0,0,0,0),
+	 0,0,0,0,0,0,0,0,0,0,0,""),
 	corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
 	corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
 	corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)),
Index: zone/zonedb.cpp
===================================================================
--- zone/zonedb.cpp	(revision 1666)
+++ zone/zonedb.cpp	(working copy)
@@ -1095,7 +1095,9 @@
 			"npc_types.maxlevel,"
 			"npc_types.scalerate,"
 			"npc_types.private_corpse,"
-			"npc_types.unique_spawn_by_name";
+			"npc_types.unique_spawn_by_name,"
+			"npc_types.destructable,"
+			"npc_types.destructablestr";
 
 		MakeAnyLenString(&query, "%s FROM npc_types WHERE id=%d", basic_query, id);
 
@@ -1265,6 +1267,8 @@
 				tmpNPCType->scalerate = atoi(row[r++]);
 				tmpNPCType->private_corpse = atoi(row[r++]) == 1 ? true : false;
 				tmpNPCType->unique_spawn_by_name = atoi(row[r++]) == 1 ? true : false;
+				tmpNPCType->destructable = atoi(row[r++]) == 1 ? true : false;
+				strncpy(tmpNPCType->destructablestr, row[r++], 24);
 
 				// If NPC with duplicate NPC id already in table,
 				// free item we attempted to add.
Index: zone/zonedump.h
===================================================================
--- zone/zonedump.h	(revision 1666)
+++ zone/zonedump.h	(working copy)
@@ -117,6 +117,8 @@
 	int32	scalerate;
 	bool	private_corpse;
 	bool	unique_spawn_by_name;
+	bool	destructable;
+	char	destructablestr[24];
 };
 
 struct ZSDump_Spawn2 {

Last edited by trevius; 09-23-2011 at 06:43 AM..
Reply With Quote
  #2  
Old 09-19-2010, 05:53 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,450
Default

Here's a picture, just for laughs.

Reply With Quote
  #3  
Old 09-19-2010, 09:07 AM
Kayen
Developer
 
Join Date: Mar 2009
Location: -
Posts: 228
Default

Pft where is my thanks for complaining to Trev that I wanted destructible objects and then gm summoning him on top of where one should be to motivate him to figure out the opt codes!

Just joking! This is great news.

Kayen
GM Storm Haven
Reply With Quote
  #4  
Old 09-20-2010, 08:48 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Haha, to be honest, I didn't do any of the work on Destructible items yet. I just asked Derision about the work he had done, as I was planning to see if I could help to get them working. I don't think there is too much left to do after seeing the work Derision has done. We just need to add in a few new DB fields and make some stuff to handle them properly.

I don't know much about destructible objects, but here are some points on what I have learned so far from messing with them:

1. Destructible objects have 5 states of appearances which can be seen by doing #appearance 44 0 to 4. Appearance 0 is the non-damaged version, and 4 is fully destroyed. Do not use appearance 5 or higher, as that will crash the client!

2. The new opcode named OP_DestructibleRelated changes the object from being targetable to being untargetable. This can be made into a Perl command, but we will also need some way for new players who zone in to see the object as untargetable as well. I think we will need to play with the struct a bit to see how to set the spawn to be untargetable from the start so we can set that field for new players zoning in after the object has been set this way. One cool thing about this new opcode is that it also works on normal NPCs. If it is used on a normal NPC, it removes them from your target and makes them untargetable. It is almost like they are toggled to bodytype 11 in real-time. If there is a way to change them back to being targetable again, I think this opcode could have some other potentially nice uses (maybe anti-hack stuff and possibly other uses).

3. The destruction animations can be done in any order, and also can be done in reverse.

4. These objects all have collision, which I think makes them more useful than some other types of zone objects.

5. Since the objects are essentially NPCs, they can be moved with a #summon. This is pretty cool. It makes me wonder what would happen if you set one on a pathing grid lol!

6. Each destructable object has 4 variable length string fields. I assume we can use the name and lastname field of normal NPCs for 2 of those strings, but we will probably need at least 1 or 2 new fields to be able to handle these properly. There are still at least a few fields we don't undertand yet, so there will probably need to be some other fields as well. I noticed a couple of fields that were set to 100, and I assume one of them may be object size.

At this point, I think the plan is to add destructible objects to the npc_types table. This makes sense, because they are essentially NPCs and even use the same opcode as NPCs do for spawning them. It is also the easiest way to manage them, since they need to be loaded like an NPC anyway.

Here are some notes on what I think we still need:

1. We need a way to set the damage states automatically based on HP percentages like maybe having them changes appearances every 25% (100% = 0, 75% = 1, 50% = 2, 25% = 3, 0% = 4). I believe that the appearance fields I added to NPCs a while back should be able to work for destructible objects as well, but will need to review that later to be sure. This should allow them to show the correct appearance state when new players zone in.

2. We need a way to set them non-targetable for new players zoning in after the OP_DestructibleRelated opcode is sent.

3. Optional would be to add a perl command to send the new OP_DestructibleRelated opcode (I can add this in like 2 seconds).

4. It may not be required, but we should try to identify some more of the unknown fields if possible.

I don't have a ton of time to work on this atm, but if no one else commits some stuff for destructible objects like what was submitted here, I will try to get to it when I have more time. I really appreciate Derision sharing the work he has done on them to this point. With his work, I think destructible objects should be functional and on the SVN pretty soon one way or another

EDIT: Wanted to note that the patch Secrets posted will probably break any existing corpses. So, for any servers that leave corpses with items on them, be warned that patching this will basically poof any existing corpses on your server (or make them inaccessible anyway).
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 09-20-2010 at 12:00 PM..
Reply With Quote
  #5  
Old 09-27-2010, 08:27 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Seems like adding the code to replace existing objects in a zone with a destructible object should be easy enough to get going as it doesn't matter much what is set, it just takes over the object initially and everything looks ok. The only thing keeping this from being submitted is figuring out what is required to get new destructible objects that don't already exist to be able to spawn properly. So far, I haven't had too much luck in figuring those out completely. I was able to confirm that DestructableUnk1 is the setting for how damaged the object is. Unfortunately, for the example I was using (from oceangreenvillage), I wasn't able to get it to show up at all unless it was set to a value of 1 or higher (up to 4). That is one of the issues left to figure out.

The next issue is to figure out why they appear to be spawning about 5 units lower than they should, which puts them partially underground. I don't have any reference to how they should look on Live, but I am pretty sure they shouldn't be partially underground like that.

The final issue is to figure out why the collector may be collecting a size that is not the same size they should appear in-game. It is hard to be sure if this is really an issue or not though. I am using tents in mesa to compare as I spawned them to not replace the existing tents and they were all set to size 6 as they were collected, but the tents they are supposed to replace are actually size 5. This may just be due to SOE being lazy and using a generic setting since the size issue does not happen when they are actually replacing the existing objects as it takes on that object's attributes.

One other thing that I was able to confirm is that the last 2 fields are actually in the wrong order. It is an int8 then an int32, not int32 then int8. They are generally set like 0x01 and 0x00000002.

Either way, I am holding off on working on these more for a while. If anyone else wants to, feel free. My main concern with adding these is that we get all of the required fields added to the npc_types table so collects for them only need to be done once in order to have all of the info we will need for any destructible object. I know we will definitely need a new string field for the 3rd destructible string. I think we will need at least 1 or 2 other fields for the DestructableUnk1 and maybe the one noted as "// eye height?" in the normal part of the struct.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #6  
Old 09-27-2010, 11:17 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Couldn't you just offset them 5 units above where they should be and figure it out later? =p
Reply With Quote
  #7  
Old 09-22-2011, 11:42 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Late response, but no, it doesn't work that way. It works more like an NPC where the client will try to put them at the level it thinks they should be unless they have flymode on.

Anyway, I started work on this again and committed the work in this thread. It is mostly the stuff that Derision had done already, but with a few modifications. It definitely needs more work, but it is a start. I figured I would bump this thread and will start posting more details of what needs to be worked out still as well as looking for feedback. Since I never played Live when destructible objects existed, I don't know any more about them than what I have read.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #8  
Old 09-23-2011, 06:41 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

It has been so long since I messed with these destructible objects that I am having to redo a lot of the testing I originally did to figure everything out. There are still quite a few things that need to be worked on before the system can be considered fully functional. Until everything is worked out, I would recommend not investing too much time into setting up destructible objects, as there is likely to be changes to a field or 2.

Here is my current list of what needs to be done (many things are the same from my last list in this same thread):

1. Destructible Objects still need to be added to SoF and UF clients.

2. The OP_Untargetable opcode needs to be found for SoF and UF clients and added to the appropriate files.

3. The damaged level appearance needs to be set for new clients that enter the zone. I think we can just use _appearance to hold the damage level appearance. We probably set it by doing something like this:
Code:
ns->spawn.DestructibleAppearance = static_cast<EmuAppearance>(_appearance);
It would also need to be changed every time the appearance is changed while the object is damaged.

4. We need to set the damage states automatically based on HP percentages. Maybe having them changes appearances every 25% (100% = 0, 75% = 1, 50% = 2, 25% = 3, 0% = 4). We can probably handle this in the SetHP() or SendHPUpdate() functions easy enough. - DONE

5. Replacing an existing object with a destructible object currently isn't working with how I have it implemented so far. I forget offhand what actually sets that, but I think it is the 3rd string (ie. "ZoneActor_01186"). If so, then we will need 1 more string field added to the npc_types table, which I was trying to avoid.

6. If new field (or more) is needed to be added to the npc_types table, it would be good to find a better way of adding fields so it doesn't break player corpses every time due to adding more fields to mob.

7. The new OP_Untargetable opcode needs code to support it. It will be easy enough to add a function that can send it. It will also be easy to add a Perl function for sending it. This packet is cool, because it works on normal NPCs as well. If we can figure out how to make it return the NPC to targetable again, it could be very useful. We could then send it anytime bodytype is changed to type 11 or any other untargetable type, and send it again when they change to a targetable type again so targetable could be toggled on an NPC without repopping it, which is currently not possible. - PARTIALLY DONE

8. Since the bodytype is not sent for destructible objects, we would need some way for new clients zoning in to also see the object as untargetable after OP_Untargetable has been sent. We could just check when the entity list is sent if the NPC is a destructible object and then if it is set to untargetable, and send that packet if so. - DONE

Extra Notes:

Even once destructible objects are fully functional, we will still need the packet collector tool to be updated to parse the information into the right fields. This shouldn't be worked on until it is more final, though (mainly a note for Derision if he sees this).

Currently, I have the luclinface field in npc_types set to handle the damage level of the object when it spawns. Ideally, we would have a new field for this, but again, I was trying to avoid having to add any new fields.

Good zones to test and work on or play with destructible objects are devastation or mesa, but there are definitely others too.

I definitely plan to do more work on this, but if anyone else wants to help out, please feel free, as there is a lot left to do
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 09-23-2011 at 02:27 PM..
Reply With Quote
  #9  
Old 09-23-2011, 02:14 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Trev, if you have to use hacks to avoid new fields. Add the new fields.
Reply With Quote
  #10  
Old 11-22-2011, 10:33 AM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default

Since I have not played live in 8+ years, what are destructible object in the game ?
Reply With Quote
  #11  
Old 11-22-2011, 09:55 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

They are basically like a cross between objects and NPCs. They look like objects, and in some cases they can actually replace an existing object in a zone such as a tent or wall. But, you can target them and attack them and they get more and more destructed looking the more you damage them until they finally crumble completely to the ground when you kill/destroy them.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #12  
Old 11-22-2011, 11:41 PM
KingMort
Banned
 
Join Date: Sep 2006
Posts: 841
Default

So is there a list of all useable Destructable object races ?
Reply With Quote
  #13  
Old 11-22-2011, 11:52 PM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default

EQ really needed something like this a long time ago.
Reply With Quote
  #14  
Old 11-23-2011, 01:18 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Quote:
Originally Posted by KingMort View Post
So is there a list of all useable Destructable object races ?
No, they don't really work like that. Each zone that is able to have them already has a limited list of them that will work there and it is different from zone to zone similar to NPC races loading from zone to zone. Though, I am not sure exactly how or where we get a list of available models that are available per zone. The only way I know of is using packet collects, and they show NPCs with the model strings we need for destructible objects such as "DEST_TNT_G". So, you can go to "mesa" and spawn an NPC with the last name of "DEST_TNT_G" and have it set to "o" for special attacks, and it should spawn as a destructible tent.

I am sure there is some way to figure out which models work in which zone, but I don't know how yet. The only way to get them is from collects. The best zone for destructible object examples is devastation, which has tons of them. I figure once the destructible object stuff is all completely worked out, the collector can be adjusted to collect destructible objects properly so we can add them to the DB.

As noted in my last update post in this thread, there is still more to do before destructible objects are complete. I am actually trying to work on getting rid of the player_corpse table blob currently, but hopefully I can get back to finishing these off sometime.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:51 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3