Skip to content

Commit

Permalink
allow NPCs to still appear while connected to EOSERV/ETHEOS
Browse files Browse the repository at this point in the history
  • Loading branch information
sorokya committed Mar 28, 2022
1 parent db82164 commit 0e81e93
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions EOLib/PacketHandlers/MapInfoHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ IEIFFileProvider eifFileProvider

public override bool HandlePacket(IPacket packet)
{
var num_entities = packet.ReadChar();
var numOfEntities = packet.ReadChar();

if (packet.PeekByte() == 0xFF)
{
packet.ReadByte();
for (var i = 0; i < num_entities; i++)
for (var i = 0; i < numOfEntities; i++)
{
var character = _characterFromPacketFactory.CreateCharacter(packet);
if (_currentMapStateRepository.Characters.ContainsKey(character.ID))
Expand All @@ -58,7 +58,7 @@ public override bool HandlePacket(IPacket packet)
}
}

while (num_entities > 0 && packet.ReadPosition < packet.Length)
while (packet.ReadPosition < packet.Length)
{
var npc = _npcFromPacketFactory.CreateNPC(packet);
_currentMapStateRepository.NPCs.RemoveWhere(n => n.Index == npc.Index);
Expand Down

0 comments on commit 0e81e93

Please sign in to comment.