public override bool HandleException(ref CONTEXT ctx, ProcessDebugger pd) { bool skip = false; var pPacket = ctx.Edi; var len = ctx.Edx; var packet = pd.ReadBytes(pPacket, (int)len); //MessageBox.Show(packet.ToString()); switch ((GameServerPacket)packet[0]) { case GameServerPacket.RemoveGroundUnit: { if (!Game.Settings.ReceivePacketHack.ItemTracker.EnablePickit.IsEnabled()) { break; } Game.ItemGoneHandler(packet); break; } case GameServerPacket.GameObjectModeChange: { if (!Game.Settings.ReceivePacketHack.NoTownPortalAnim.IsEnabled()) { break; } // no portal anim #1 var pUnit = Game.FindUnit(BitConverter.ToUInt32(packet, 2), (UnitType)packet[1]); if (pUnit != 0) { var unit = pd.Read <UnitAny>(pUnit); if (unit.dwTxtFileNo == 0x3B) { skip = true; } } break; } case GameServerPacket.PlayerReassign: { if (!Game.Settings.ReceivePacketHack.BlockFlash.IsEnabled() && !Game.Settings.ReceivePacketHack.FastTele.IsEnabled() && !Game.Settings.ReceivePacketHack.ItemTracker.EnablePickit.IsEnabled()) { break; } var unitType = (UnitType)packet[1]; if (unitType != UnitType.Player) { break; } var pPlayer = Game.GetPlayerUnit(); if (pPlayer == 0) { break; } var unit = pd.Read <UnitAny>(pPlayer); if (BitConverter.ToUInt32(packet, 2) == unit.dwUnitId) { if (Game.Settings.ReceivePacketHack.ItemTracker.EnablePickit.IsEnabled()) { Game.CurrentX = BitConverter.ToUInt16(packet, 6); Game.CurrentY = BitConverter.ToUInt16(packet, 8); Task.Factory.StartNew(() => Game.OnRelocaton()); } // no flash if (Game.Settings.ReceivePacketHack.BlockFlash.IsEnabled()) { pd.WriteByte(pPacket + 10, 0); } // fast teleport if (Game.Settings.ReceivePacketHack.FastTele.IsEnabled() && !allowableModes.Contains((PlayerMode)unit.dwMode)) { unit.dwFrameRemain = 0; pd.Write <UnitAny>(pPlayer, unit); } } break; } case GameServerPacket.Unknown18: case GameServerPacket.PlayerLifeManaChange: { if (!Game.Settings.Chicken.Enabled || Game.chickening) { break; } var life = BitConverter.ToUInt16(packet, 1); var mana = BitConverter.ToUInt16(packet, 3); Task.Factory.StartNew(() => Game.TryChicken(life, mana, false)); break; } case GameServerPacket.GameObjectAssignment: { if ((UnitType)packet[1] == UnitType.Object && BitConverter.ToUInt16(packet, 6) == 0x3B) { // no portal anim #2 if (Game.Settings.ReceivePacketHack.NoTownPortalAnim.IsEnabled()) { pd.WriteByte(pPacket + 12, 2); } UnitAny unit; if (Game.backToTown && Game.GetPlayerUnit(out unit)) { if (!Game.IsInTown()) { var path = pd.Read <Path>(unit.pPath); if (Misc.Distance(path.xPos, path.yPos, BitConverter.ToUInt16(packet, 8), BitConverter.ToUInt16(packet, 10)) < 10) { Task.Factory.StartNew(() => Game.Interact(BitConverter.ToUInt32(packet, 2), UnitType.Object)); } } Game.backToTown = false; } } break; } case GameServerPacket.PlayerInfomation: // event message { var type = packet[1]; var infoType = packet[2]; var relationType = packet[7]; if (type == 0x7 && infoType == 8 && relationType == 3) { if (!Game.Settings.Chicken.ChickenOnHostility.IsEnabled() || Game.chickening) { break; } Task.Factory.StartNew(() => Game.TryChicken(0, 0, true)); } break; } case GameServerPacket.WorldItemAction: case GameServerPacket.OwnedItemAction: { skip = !Game.ItemActionHandler(packet); break; } case GameServerPacket.DelayedState: { // skip delay between entering portals if (Game.Settings.ReceivePacketHack.NoTownPortalAnim.IsEnabled() && packet[6] == 102) { skip = true; } break; } case GameServerPacket.TriggerSound: { if (Game.Settings.ReceivePacketHack.ItemTracker.EnablePickit.IsEnabled()) { if (packet[1] == 0 && packet[6] == 0x17) { Game.Pickit.Disable(PickitDisableReason.InventoryFull); } } break; } case GameServerPacket.AttributeByte: case GameServerPacket.AttributeWord: case GameServerPacket.AttributeDWord: { var attr = (StatType)packet[1]; uint val = 0; switch ((GameServerPacket)packet[0]) { case GameServerPacket.AttributeByte: val = (uint)packet[2]; break; case GameServerPacket.AttributeWord: val = BitConverter.ToUInt16(packet, 2); break; case GameServerPacket.AttributeDWord: val = (uint)((packet[5] << 16) | (packet[4] << 8) | packet[3]); break; } Game.PlayerInfo.SetStat(attr, val); break; } case GameServerPacket.StateNotification: { /*var uid = BitConverter.ToUInt32(packet, 1); * var attr = (StatType)packet[5]; * var value = BitConverter.ToUInt32(packet, 6); * * UnitAny player; * if (!Game.GetPlayerUnit(out player)) * break; * * if (player.dwUnitId != uid) * break; * * Game.PlayerInfo.SetStat(attr, value);*/ break; } } if (!skip) { ctx.Ecx = ctx.Edi; ctx.Eip += 2; } else { ctx.Esp += 4; ctx.Eip += 7; ctx.Eax = 0; } return(true); }