public static void Equip(MartialClient c, InPacket p) { if (c.getAccount().activeCharacter == null) { Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook equip while not being ingame."); c.Close(); return; } Character chr = c.getAccount().activeCharacter; byte changeType = p.ReadByte(); byte[] swapSlots = p.ReadBytes(2); if (changeType == (byte)0x00) { if (!chr.getEquipment().swapEquips(swapSlots[0], swapSlots[1])) { Logger.LogCheat(Logger.HackTypes.Equip, c, "Attempted to swap weapons, while one of them or even both are null."); c.Close(); return; } WMap.Instance.getGrid(chr.getMap()).sendTo3x3Area(chr, chr.getArea(), CharacterPackets.getExtEquipPacket(chr, swapSlots[0], chr.getEquipment().getEquipments()[swapSlots[0]].getItemID())); WMap.Instance.getGrid(chr.getMap()).sendTo3x3Area(chr, chr.getArea(), CharacterPackets.getExtEquipPacket(chr, swapSlots[1], chr.getEquipment().getEquipments()[swapSlots[1]].getItemID())); } else { if (!chr.getInventory().equipItem(swapSlots[0], swapSlots[1], chr.getEquipment())) { Console.WriteLine("so sorz : >"); return; } WMap.Instance.getGrid(chr.getMap()).sendTo3x3Area(chr, chr.getArea(), CharacterPackets.getExtEquipPacket(chr, swapSlots[1], chr.getEquipment().getEquipments()[swapSlots[1]].getItemID())); } OutPacket op = new OutPacket(24); op.WriteInt(24); op.WriteShort(0x04); op.WriteShort(0x0c); op.WriteInt(135593729); op.WriteInt(c.getAccount().activeCharacter.getuID()); op.WriteShort(0x01); op.WriteByte(changeType); op.WriteBytes(swapSlots); c.WriteRawPacket(op.ToArray()); CharacterFunctions.calculateCharacterStatistics(chr); }
public static void MoveOrUnequip(MartialClient c, InPacket p) { Console.WriteLine("move or unequip"); if (c.getAccount().activeCharacter == null) { Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook invManag while not being ingame."); c.Close(); return; } Character chr = c.getAccount().activeCharacter; byte[] decrypted = p.ReadBytes(12); byte[] amountByte = { decrypted[8], decrypted[9], decrypted[10], decrypted[11] }; int amount = BitTools.byteArrayToInt(amountByte); if (decrypted[0] == (byte)0x00) { if (!chr.getInventory().unequipItem(decrypted[1], decrypted[4], decrypted[3], chr.getEquipment())) { Console.WriteLine("problem with unequipItem"); return; } WMap.Instance.getGrid(chr.getMap()).sendTo3x3Area(chr, chr.getArea(), CharacterPackets.getExtEquipPacket(chr, decrypted[1], 0)); } else { if (!chr.getInventory().moveItem(decrypted[1], decrypted[2], amount, decrypted[4], decrypted[3])) { Console.WriteLine("problem with move item"); return; } } OutPacket op = new OutPacket(28); op.WriteInt(28); op.WriteShort(0x04); op.WriteShort(0x10); op.WriteInt(); op.WriteInt(c.getAccount().activeCharacter.getuID()); op.WriteShort(0x01); op.WriteBytes(new byte[] { decrypted[0], decrypted[1], decrypted[2], decrypted[3], decrypted[4] }); op.WriteByte(); op.WriteBytes(new byte[] { decrypted[8], decrypted[9], decrypted[10], decrypted[11] }); c.WriteRawPacket(op.ToArray()); CharacterFunctions.calculateCharacterStatistics(chr); }