Skip to content

Commit

Permalink
we endup here, submit for someone who really want a reference
Browse files Browse the repository at this point in the history
  • Loading branch information
zz committed Dec 26, 2023
1 parent 6a9708d commit bda50ae
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 8 deletions.
Binary file added 20231210.webp
Binary file not shown.
29 changes: 21 additions & 8 deletions HermesProxy/World/Client/PacketHandlers/UpdateHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void HandleUpdateObject(WorldPacket packet)
ReadMovementUpdateBlock(packet, guid, null, i);
break;
}
case UpdateTypeLegacy.CreateObject1:
case UpdateTypeLegacy.CreateObject1://type of packet when create update message
{
var oldGuid = packet.ReadPackedGuid();

Expand All @@ -95,7 +95,7 @@ void HandleUpdateObject(WorldPacket packet)
if (!GetSession().GameState.ObjectSpawnCount.ContainsKey(oldGuid))
GetSession().GameState.ObjectSpawnCount.Add(oldGuid, 0);
else if (oldGuid.GetHighType() == HighGuidType.GameObject && GetSession().GameState.DespawnedGameObjects.Contains(oldGuid))
GetSession().GameState.IncrementObjectSpawnCounter(oldGuid);
GetSession().GameState.IncrementObjectSpawnCounter(oldGuid);
}

var guid = oldGuid.To128(GetSession().GameState);
Expand All @@ -121,22 +121,35 @@ void HandleUpdateObject(WorldPacket packet)

if (updateData.Guid == GetSession().GameState.CurrentPlayerGuid)
GetSession().GameState.CurrentPlayerStorage.CompletedQuests.WriteAllCompletedIntoArray(updateData.ActivePlayerData.QuestCompleted);

if (guid.IsItem() && updateData.ObjectData.EntryID != null &&
!GameData.ItemTemplates.ContainsKey((uint)updateData.ObjectData.EntryID))
!GameData.ItemTemplates.ContainsKey((uint)updateData.ObjectData.EntryID))
{
missingItemTemplates.Add((uint)updateData.ObjectData.EntryID);
}

if (updateData.CreateData.MoveInfo != null || !guid.IsWorldObject() )
{
//if (updateData.CreateData.MoveInfo != null || !guid.IsWorldObject()))//
//{
//updateObject.ObjectUpdates.Add(updateData);//zz 20231209 2210 modern client crash because of this
//if (auraUpdate.Auras.Count != 0)
// auraUpdates.Add(auraUpdate);
//}
//if (updateData.CreateData.MoveInfo != null &&
// (guid.IsCreature() || guid.IsPlayer() || guid.IsItem() /*|| guid.IsTransport()*/)
// )//zz 20231209 2224 can log in now, modern client crash because of IsTransport
// {
// updateObject.ObjectUpdates.Add(updateData);
// if (auraUpdate.Auras.Count != 0)
// auraUpdates.Add(auraUpdate);
//}
if (updateData.CreateData.MoveInfo != null && guid.IsWorldObject())//zz 20231209 22333 some object has motion info but crash client
{
updateObject.ObjectUpdates.Add(updateData);
if (auraUpdate.Auras.Count != 0)
auraUpdates.Add(auraUpdate);
}
else
Log.Print(LogType.Error, $"Broken create1 without position for {guid}");

break;
}
case UpdateTypeLegacy.CreateObject2:
Expand Down Expand Up @@ -278,7 +291,7 @@ void HandleUpdateObject(WorldPacket packet)
if (updateObject.ObjectUpdates.Count != 0 ||
updateObject.DestroyedGuids.Count != 0 ||
updateObject.OutOfRangeGuids.Count != 0)
SendPacketToClient(updateObject);
SendPacketToClient(updateObject);////crash client

foreach (var auraUpdate in auraUpdates)
SendPacketToClient(auraUpdate);
Expand Down
11 changes: 11 additions & 0 deletions HermesProxy/World/Client/WorldClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@ private async Task ReceiveLoop()
header.Read(headerBuffer);
ushort packetSize = header.Size;

//todo large data
if ((headerBuffer[0] & 0x80) != 0)
{
// need to resize the buffer
byte temp = headerBuffer[0];
//ReserveData(5);
//ReceiveData[0] = (byte)((0x7f & temp));

//Remaining = 4;
}

if (packetSize != 0)
{
byte[] buffer = new byte[packetSize];
Expand Down
17 changes: 17 additions & 0 deletions HermesProxy/World/WowGuid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@ public ObjectType GetObjectType()
}

public bool IsWorldObject()
{
switch (GetHighType())
{
case HighGuidType.Player:
//case HighGuidType.Transport: //zztodo, crash modern client while update object
//case HighGuidType.MOTransport://zztodo, crash modern client while update object
case HighGuidType.Creature:
//case HighGuidType.Vehicle://zztodo, crash modern client while update object
case HighGuidType.Pet:
case HighGuidType.GameObject:
case HighGuidType.DynamicObject:
case HighGuidType.Corpse:
return true;
}
return false;
}
public bool IsMotionObject()
{
switch (GetHighType())
{
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# stop here
20231210, can login using 335 server, 253/114 client
newer client wont be easy at this moment
```
coolzoom — 10/12/2023 20:43
?? im thinking whether it is possible for me try to port the update field from the 3.4.0 47168 to hermes https://github.com/RioMcBoo/CypherCoreClassicWOTLK. i recall there is something that prevented you from supporting newer classic era clients, probably something totally changed after a specific version?
brotalnia — 11/12/2023 02:20
yes they switched to completely different update field system in patch 8.1, 1.14.3 and 2.5.4
so whole update building code has to be rewritten
its not just different indexes for fields, its a different system
much worse than the original system in my opinion
```


# HermesProxy ![Build](https://github.com/WowLegacyCore/HermesProxy/actions/workflows/Build_Proxy.yml/badge.svg)

This project enables play on existing legacy WoW emulation cores using the modern clients. It serves as a translation layer, converting all network traffic to the appropriate format each side can understand.
Expand Down

0 comments on commit bda50ae

Please sign in to comment.