Pārlūkot izejas kodu

Opcodes now set in spawn serialize

LethalEncounter 4 gadi atpakaļ
vecāks
revīzija
51bf3ab479

+ 8 - 10
EQ2/source/WorldServer/Commands/Commands.h

@@ -74,16 +74,14 @@ extern map<int16,OpcodeManager*>EQOpcodeManager;
 #define CHANNEL_OOC			32
 //#define CHANNEL_AUCTION		30
 
-#define CLASSIC_CLIENT_CHANNEL_SAY			10
-#define CLASSIC_CLIENT_CHANNEL_SHOUT		11
-#define CLASSIC_CLIENT_CHANNEL_EMOTE		12
-#define CLASSIC_CLIENT_CHANNEL_GROUP		26
-#define CLASSIC_CLIENT_CHANNEL_RAID			27
-#define CLASSIC_CLIENT_CHANNEL_GUILD		32
-#define CLASSIC_CLIENT_CHANNEL_OFFICER		33
-#define CLASSIC_CLIENT_CHANNEL_SAYTARGET	40 // you say to xxx
-#define CLASSIC_CLIENT_CHANNEL_TELL			41 // you tell xxx
-#define CLASSIC_CLIENT_CHANNEL_OOC			49
+#define CLASSIC_CLIENT_CHANNEL_GROUP		14
+#define CLASSIC_CLIENT_CHANNEL_RAID			15
+#define CLASSIC_CLIENT_CHANNEL_GUILD		17
+#define CLASSIC_CLIENT_CHANNEL_SAYTARGET	21 // you say to xxx
+#define CLASSIC_CLIENT_CHANNEL_TELL			22 // you tell xxx
+#define CLASSIC_CLIENT_CHANNEL_OOC			25
+#define CLASSIC_CLIENT_CHANNEL_AUCTION		26
+#define CLASSIC_CLIENT_CHANNEL_BROADCAST	61
 
 #define CHANNEL_GAME_TEXT					1
 #define CHANNEL_DEFAULT						2

+ 0 - 1
EQ2/source/WorldServer/GroundSpawn.cpp

@@ -44,7 +44,6 @@ GroundSpawn::~GroundSpawn(){
 }
 
 EQ2Packet* GroundSpawn::serialize(Player* player, int16 version){
-	opcode = EQOpcodeManager[GetOpcodeVersion(version)]->EmuToEQ(OP_EqCreateGhostCmd);
 	return spawn_serialize(player, version);
 }
 

+ 0 - 1
EQ2/source/WorldServer/NPC.cpp

@@ -140,7 +140,6 @@ void NPC::Initialize(){
 }
 
 EQ2Packet* NPC::serialize(Player* player, int16 version){
-	opcode = EQOpcodeManager[GetOpcodeVersion(version)]->EmuToEQ(OP_EqCreateGhostCmd);
 	return spawn_serialize(player, version);
 }
 

+ 0 - 1
EQ2/source/WorldServer/Object.cpp

@@ -40,7 +40,6 @@ Object::~Object(){
 }
 
 EQ2Packet* Object::serialize(Player* player, int16 version){
-	opcode = EQOpcodeManager[GetOpcodeVersion(version)]->EmuToEQ(OP_EqCreateGhostCmd);
 	return spawn_serialize(player, version);
 }
 

+ 0 - 1
EQ2/source/WorldServer/Player.cpp

@@ -191,7 +191,6 @@ Player::~Player(){
 }
 
 EQ2Packet* Player::serialize(Player* player, int16 version){
-	opcode = EQOpcodeManager[GetOpcodeVersion(version)]->EmuToEQ(OP_EqCreateGhostCmd);
 	return spawn_serialize(player, version);
 }
 

+ 0 - 1
EQ2/source/WorldServer/Sign.cpp

@@ -59,7 +59,6 @@ int32 Sign::GetWidgetID(){
 }
 
 EQ2Packet* Sign::serialize(Player* player, int16 version){
-	opcode = EQOpcodeManager[GetOpcodeVersion(version)]->EmuToEQ(OP_EqCreateSignWidgetCmd);
 	return spawn_serialize(player, version);
 }
 

+ 18 - 4
EQ2/source/WorldServer/Spawn.cpp

@@ -113,7 +113,6 @@ Spawn::Spawn(){
 	pickup_item_id = 0;
 	pickup_unique_item_id = 0;
 	disable_sounds = false;
-	opcode = 0;
 }
 
 Spawn::~Spawn(){
@@ -599,7 +598,14 @@ EQ2Packet* Spawn::spawn_serialize(Player* player, int16 version, int16 offset, i
 
 	memcpy(ptr, &oversized_packet, sizeof(oversized_packet));
 	ptr += sizeof(oversized_packet);
-	opcode = EQOpcodeManager[GetOpcodeVersion(version)]->EmuToEQ(OP_EqCreateGhostCmd);
+
+	int16 opcode = 0;
+	if(IsWidget())
+		opcode = EQOpcodeManager[GetOpcodeVersion(version)]->EmuToEQ(OP_EqCreateWidgetCmd);
+	else if(IsSign())
+		opcode = EQOpcodeManager[GetOpcodeVersion(version)]->EmuToEQ(OP_EqCreateSignWidgetCmd);
+	else
+		opcode = EQOpcodeManager[GetOpcodeVersion(version)]->EmuToEQ(OP_EqCreateGhostCmd);
 	memcpy(ptr, &opcode, sizeof(opcode));
 	ptr += sizeof(opcode);
 
@@ -878,6 +884,10 @@ EQ2Packet* Spawn::player_position_update_packet(Player* player, int16 version){
 	ptr += sizeof(int8);
 	memcpy(ptr, &opcode_val, sizeof(int16));
 	ptr += sizeof(int16);
+	if (version <= 283) {
+		int32 timestamp = Timer::GetCurrentTime2();
+		memcpy(ptr, &timestamp, sizeof(int32));
+	}
 	ptr += sizeof(int32);
 	ptr += info_size;
 	memcpy(ptr, pos_changes, tmp_pos_packet_size);
@@ -2590,11 +2600,13 @@ void Spawn::ProcessMovement(bool isSpawnListLocked){
 		Spawn* boat = 0;
 		if(boat_id > 0)
 			boat = GetZone()->GetSpawnByID(boat_id, isSpawnListLocked);
-		if(boat){
+
+		//TODO: MAYBE do this for real boats, not lifts... GetWidgetTypeNameByTypeID
+		/*if(boat){
 			SetX(boat->GetX() + player->GetBoatX());
 			SetY(boat->GetY() + player->GetBoatY());
 			SetZ(boat->GetZ() + player->GetBoatZ());
-		}
+		}*/
 		return;
 	}
 
@@ -3464,6 +3476,8 @@ void Spawn::CopySpawnAppearance(Spawn* spawn){
 
 void Spawn::SetY(float y, bool updateFlags, bool disableYMapCheck)
 {
+	if (IsPlayer())
+		cout << "sdfsd\n";
 	SetPos(&appearance.pos.Y, y, updateFlags);
 	if (!disableYMapCheck)
 		FixZ();

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

@@ -978,7 +978,6 @@ public:
 	int16				size;
 	int32				faction_id;
 	int8				oversized_packet; //0xff
-	int16				opcode;
 	int32				id;
 	int8				unknown1;
 	int32				unknown2;

+ 1 - 2
EQ2/source/WorldServer/Widget.cpp

@@ -69,8 +69,7 @@ int32 Widget::GetWidgetID(){
 	return widget_id;
 }
 
-EQ2Packet* Widget::serialize(Player* player, int16 version){
-	opcode = EQOpcodeManager[GetOpcodeVersion(version)]->EmuToEQ(OP_EqCreateWidgetCmd);
+EQ2Packet* Widget::serialize(Player* player, int16 version){	
 	return spawn_serialize(player, version);
 }
 

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

@@ -1652,6 +1652,7 @@ bool Client::HandlePacket(EQApplicationPacket* app) {
 				}
 				else
 					player->PrepareIncomingMovementPacket(app->size - offset, app->pBuffer + offset, version);
+				player_pos_changed = true;
 				//DumpPacket(app);
 			}
 		}

+ 24 - 40
EQ2/source/WorldServer/zoneserver.cpp

@@ -3154,46 +3154,30 @@ void ZoneServer::HandleChatMessage(Client* client, Spawn* from, const char* to,
 	if ((!distance || from->GetDistance(client->GetPlayer()) <= distance) && (!from || !client->GetPlayer()->IsIgnored(from->GetName()))) {
 		if (client->GetVersion() <= 283) {
 			switch (channel) {
-			case CHANNEL_SAY: {
-				channel = CLASSIC_CLIENT_CHANNEL_SAY;
-				break;
-			}
-			case CHANNEL_SHOUT: {
-				channel = CLASSIC_CLIENT_CHANNEL_SHOUT;
-				break;
-			}
-			case CHANNEL_EMOTE: {
-				channel = CLASSIC_CLIENT_CHANNEL_EMOTE;
-				break;
-			}
-			case CHANNEL_GROUP: {
-				channel = CLASSIC_CLIENT_CHANNEL_GROUP;
-				break;
-			}
-			case CHANNEL_RAID: {
-				channel = CLASSIC_CLIENT_CHANNEL_RAID;
-				break;
-			}
-			case CHANNEL_GUILD: {
-				channel = CLASSIC_CLIENT_CHANNEL_GUILD;
-				break;
-			}
-			case CHANNEL_OFFICER: {
-				channel = CLASSIC_CLIENT_CHANNEL_OFFICER;
-				break;
-			}
-			case CHANNEL_SAYTARGET: {
-				channel = CLASSIC_CLIENT_CHANNEL_SAYTARGET;
-				break;
-			}
-			case CHANNEL_TELL: {
-				channel = CLASSIC_CLIENT_CHANNEL_TELL;
-				break;
-			}
-			case CHANNEL_OOC: {
-				channel = CLASSIC_CLIENT_CHANNEL_OOC;
-				break;
-			}
+				case CHANNEL_GROUP: {
+					channel = CLASSIC_CLIENT_CHANNEL_GROUP;
+					break;
+				}
+				case CHANNEL_RAID: {
+					channel = CLASSIC_CLIENT_CHANNEL_RAID;
+					break;
+				}
+				case CHANNEL_GUILD: {
+					channel = CLASSIC_CLIENT_CHANNEL_GUILD;
+					break;
+				}
+				case CHANNEL_SAYTARGET: {
+					channel = CLASSIC_CLIENT_CHANNEL_SAYTARGET;
+					break;
+				}
+				case CHANNEL_TELL: {
+					channel = CLASSIC_CLIENT_CHANNEL_TELL;
+					break;
+				}
+				case CHANNEL_OOC: {
+					channel = CLASSIC_CLIENT_CHANNEL_OOC;
+					break;
+				}
 			}
 		}
 		PacketStruct* packet = configReader.getStruct("WS_HearChat", client->GetVersion());