Sfoglia il codice sorgente

TS bench and recipe List Fixes

TS bench and recipe List Fixes
Required world list XML update as well Should be included
this will fix 1 items of Issue #467 Tradeskill stations should restrict recipes( these basics take care of standard devices found in starting cities will need some work for house and summoned devices)
PS. i really hope i dont screw this up
Robert Allen 2 anni fa
parent
commit
062b61c22e

+ 1 - 1
EQ2/source/WorldServer/Items/Items.cpp

@@ -2166,7 +2166,7 @@ void Item::serialize(PacketStruct* packet, bool show_name, Player* player, int16
 		packet->setSubstructDataByName("footer", "footer_unknown2", 0);// remove defualt
 	}
 	else{
-		packet->setSubstructDataByName("footer", "required_level", generic_info.tradeskill_default_level);		
+		packet->setSubstructDataByName("footer", "required_level", generic_info.tradeskill_default_level * 10);		
 		packet->setSubstructDataByName("footer", "footer_unknown2", 0);//remove default
 	}
 	if(slot_data.size() > 0){

+ 2 - 1
EQ2/source/WorldServer/Recipes/Recipe.cpp

@@ -74,6 +74,7 @@ Recipe::Recipe(Recipe *in){
 	technique = in->GetTechnique();
 	knowledge = in->GetKnowledge();
 	classes = in->GetClasses();
+	device_sub_type = in-> GetDevice_Sub_Type();
 	unknown2 = in->GetUnknown2();
 	unknown3 = in->GetUnknown3();
 	unknown4 = in->GetUnknown4();
@@ -315,7 +316,7 @@ EQ2Packet * Recipe::SerializeRecipe(Client *client, Recipe *recipe, bool display
 	else
 		packet->setSubstructDataByName("info_header", "show_popup", 1);
 	if(packet_type > 0)
-		packet->setSubstructDataByName("info_header", "packettype", packet_type*256 + 0xFE);
+		packet->setSubstructDataByName("info_header", "packettype", GetItemPacketType(packet->GetVersion()));
 	else
 		if(version == 1096)
 			packet->setSubstructDataByName("info_header", "packettype",0x35FE);

+ 3 - 0
EQ2/source/WorldServer/Recipes/Recipe.h

@@ -57,6 +57,7 @@ public:
 	void SetTechnique(int32 technique) {this->technique = technique;}
 	void SetKnowledge(int32 knowledge) {this->knowledge = knowledge;}
 	void SetClasses(int32 classes) {this->classes = classes;}
+	void SetDevice_Sub_Type(int8 device_sub_type) {this->device_sub_type = device_sub_type;}
 	void SetUnknown2(int32 unknown2) {this->unknown2 = unknown2;}
 	void SetUnknown3(int32 unknown3) {this->unknown3 = unknown3;}
 	void SetUnknown4(int32 unknown4) {this->unknown4 = unknown4;}
@@ -98,6 +99,7 @@ public:
 	*/
 	return item->generic_info.tradeskill_classes < 4 || (1 << class_id) & item->generic_info.tradeskill_classes;
 	}
+	int8 GetDevice_Sub_Type() {return device_sub_type;}
 	int32 GetUnknown2() {return unknown2;}
 	int32 GetUnknown3() {return unknown3;}
 	int32 GetUnknown4() {return unknown4;}
@@ -144,6 +146,7 @@ private:
 	int32 skill;
 	int32 technique;
 	int32 knowledge;
+	int8 device_sub_type;
 	int32 classes;
 	int32 unknown2;
 	int32 unknown3;

+ 29 - 8
EQ2/source/WorldServer/client.cpp

@@ -9762,7 +9762,17 @@ void Client::SendRecipeList() {
 	map<int32, Recipe*>::iterator itr;
 	Recipe* recipe;
 	int16 i = 0;
+	int index = 0;
+	for (itr = recipes->begin(); itr != recipes->end(); itr++) {
+		recipe = itr->second;
+		auto res = std::find(devices.begin(), devices.end(), recipe->GetDevice());
 
+		if (res != devices.end())
+			index = res - devices.begin();
+		else
+			devices.push_back(recipe->GetDevice());
+	}
+	
 	packet->setArrayLengthByName("num_recipes", recipes->size());
 	for (itr = recipes->begin(); itr != recipes->end(); itr++) {
 		recipe = itr->second;
@@ -9771,10 +9781,18 @@ void Client::SendRecipeList() {
 		packet->setArrayDataByName("level", recipe->GetLevel(), i);
 		packet->setArrayDataByName("icon", recipe->GetIcon(), i);
 		packet->setArrayDataByName("classes", recipe->GetClasses(), i);
-		packet->setArrayDataByName("skill", recipe->GetSkill(), i);
+		//packet->setArrayDataByName("skill", recipe->GetSkill(), i);
 		packet->setArrayDataByName("technique", recipe->GetTechnique(), i);
 		packet->setArrayDataByName("knowledge", recipe->GetKnowledge(), i);
-		packet->setArrayDataByName("unknown2", recipe->GetUnknown2(), i);
+
+		
+		auto recipe_device = std::find(devices.begin(), devices.end(), recipe->GetDevice());
+		if (recipe_device != devices.end())
+			packet->setArrayDataByName("device_type", recipe_device - devices.begin(), i);
+		else
+		{//TODO error should never get here
+		}
+		packet->setArrayDataByName("device_sub_type", recipe->GetDevice_Sub_Type(), i);
 		packet->setArrayDataByName("recipe_name", recipe->GetName(), i);
 		packet->setArrayDataByName("recipe_book", recipe->GetBook(), i);
 		packet->setArrayDataByName("unknown3", recipe->GetUnknown3(), i);
@@ -9791,6 +9809,7 @@ void Client::SendRecipeList() {
 void Client::ShowRecipeBook() {
 	PacketStruct* packet = 0;
 	Spawn* target = 0;
+	int index = 0;
 	if (!(target = player->GetTarget())) {
 		SimpleMessage(CHANNEL_COLOR_YELLOW, "You do not have a tradeskill device targeted");
 		return;
@@ -9805,15 +9824,17 @@ void Client::ShowRecipeBook() {
 
 	packet->setDataByName("device", target->GetName());
 	packet->setDataByName("unknown1", 1);
-
-	if (((Object*)target)->GetDeviceID() > 0) {
-		int32 deviceID = (int32)pow(2.0, (double)((Object*)target)->GetDeviceID());
+	auto res = std::find(devices.begin(), devices.end(), target->GetName());
+	if (res != devices.end()){
+		index = res - devices.begin();
+		int32 deviceID = 0;
+		deviceID  |= 1UL << index;
 		//LogWrite(TRADESKILL__ERROR, 0, "Tradeskills", "GetDeviceID() = %u, deviceID = %u", ((Object*)target)->GetDeviceID(), deviceID);
-		packet->setDataByName("unknown2", 8);
+		packet->setDataByName("unknown2", devices.size());
 		packet->setDataByName("unknown3", deviceID);
 	}
-
-	//packet->PrintPacket();
+	else 
+		packet->setDataByName("unknown2", devices.size());
 	QueuePacket(packet->serialize());
 	safe_delete(packet);
 }

+ 1 - 0
EQ2/source/WorldServer/client.h

@@ -696,6 +696,7 @@ private:
 	Mutex MItemDetails;
 	Mutex MSpellDetails;
 	bool disable_save;
+	vector< string > devices;
 };
 
 class ClientList {

+ 4 - 4
server/WorldStructs.xml

@@ -16243,12 +16243,12 @@ to zero and treated like placeholders." />
   <Data ElementName="level" Type="int8" Size="1" />
   <Data ElementName="unknown1" Type="int8" size="1" />
   <Data ElementName="icon" Type="int16" Size="1" />
-  <Data ElementName="unknown1a" Type="int8" Size="2" />
-  <Data ElementName="classes" Type="int32" Size="1" />
-  <Data ElementName="skill" Type="int32" Size="1" />
+  <Data ElementName="unknown1a" Type="int8" Size="1" />
+  <Data ElementName="device_sub_type" Type="int8" Size="1" />
+  <Data ElementName="classes" Type="int64" Size="1" />
   <Data ElementName="technique" Type="int32" Size="1" />
   <Data ElementName="knowledge" Type="int32" Size="1" />
-  <Data ElementName="unknown2" Type="int32" Size="1" />
+  <Data ElementName="device_type" Type="int32" Size="1" />
   <Data ElementName="recipe_name" Type="EQ2_16Bit_String" />
   <Data ElementName="recipe_book" Type="EQ2_16Bit_String" />
   <Data ElementName="unknown3" Type="int8" Size="1" />