Beispiel #1
0
        public static void MHShop(MartialClient c, InPacket p)
        {
            byte[] decrypted = p.ReadBytes(80);

            int itemIdentificator = BitConverter.ToInt32(decrypted, 0);

            ShopItem shopItem = ItemShop.Instance.getShopItemData(itemIdentificator);

            if (shopItem == null)
            {
                Console.WriteLine("wrong id selected..");
                return;
            }

            if (c.getAccount().MHPoints < shopItem.getPrice())
            {
                Console.WriteLine("teh hacksorz..");
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            Console.WriteLine("si: {0} | {1} | {2} | {3}", itemIdentificator, shopItem.getItemID(), shopItem.getItemQuantity(), shopItem.getPrice());

            OutPacket op = new OutPacket(156);

            op.WriteInt(156);
            op.WriteShort(0x04);
            op.WriteShort(0x4b);
            op.WriteInt(1);
            op.WriteInt(chr.getuID());
            op.WriteInt(1);
            op.WriteRepeatedByte(1, 4);
            op.WriteRepeatedByte(1, 4);
            op.WriteInt(shopItem.getItemID());
            op.WriteInt(shopItem.getItemQuantity());
            op.WriteInt(shopItem.getItemID());
            op.WriteInt(shopItem.getItemQuantity());
            op.WriteInt(shopItem.getItemID());
            op.WriteInt(shopItem.getItemQuantity());
            op.WriteInt(shopItem.getItemID());
            op.WriteInt(shopItem.getItemQuantity());             // item quantity
            op.WriteRepeatedByte(1, 112);
            //op.Position = 152;
            //c.getAccount().MHPoints -= shopItem.getPrice();
            //op.WriteInt(shopItem.getPrice());
            c.WriteRawPacket(op.ToArray());

            Console.WriteLine(BitConverter.ToString(op.ToArray()));

            //TODO: Delivery items

            //System.Console.WriteLine("sent: {0}", System.BitConverter.ToString(op.ToArray()));
        }
Beispiel #2
0
        public byte[] npcSpawn(Character character)
        {
            OutPacket initNPCData = new OutPacket(615);

            initNPCData.WriteInt(615);
            initNPCData.WriteShort(0x04);
            initNPCData.WriteShort(0x04);
            initNPCData.WriteByte(0x01);
            initNPCData.WriteInt(character.getuID());
            initNPCData.WriteInt(character.getArea().getaID());
            initNPCData.WriteFloat(character.getPosition()[0]);
            initNPCData.WriteFloat(character.getPosition()[1]);
            initNPCData.WriteByte(3);
            initNPCData.WriteInt(this.uID);
            initNPCData.WriteInt();
            initNPCData.WritePaddedString(this.getName(), 16);
            initNPCData.Skip(18);
            initNPCData.WriteInt(this.getModule());
            initNPCData.Skip(10);
            initNPCData.WriteInt(this.getmID());
            initNPCData.Skip(16);
            initNPCData.WriteFloat(this.npcPosition[0]);
            initNPCData.WriteFloat(this.npcPosition[1]);
            initNPCData.Skip(502);
            initNPCData.WriteByte(0x22);
            initNPCData.WriteByte(0x08);
            return(initNPCData.ToArray());
        }
Beispiel #3
0
        public static void SendMessage(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook SendMessage handling while not being ingame.");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            int    messageType = p.ReadInt();          // identifier of message type maybe?
            string receiver    = p.ReadString(20);     // receiver name

            MiscFunctions.obscureString(receiver);
            if (!MySQLTool.NameTaken(receiver))
            {
                return;
            }
            int    messageLength = p.ReadInt();          // message length
            string message       = p.ReadString(messageLength);

            MiscFunctions.obscureString(message);

            OutPacket op = new OutPacket(20);

            op.WriteInt(20);
            op.WriteShort(4);
            op.WriteShort(0x53);
            op.WriteInt(718349825);
            op.WriteInt(chr.getuID());
            op.WriteInt(-1089732352);
            c.WriteRawPacket(op.ToArray());
        }
Beispiel #4
0
 public static byte[] RequestWorldList()
 {
     using (OutPacket p = new OutPacket(SendOps.WorldListRequest))
     {
         return(p.ToArray());
     }
 }
Beispiel #5
0
        public static void DeleteItem(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook deleteItem while not being ingame.");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            byte[] decrypted = p.ReadBytes(2);
            if (!chr.getInventory().removeItem(decrypted[1]))
            {
                Console.WriteLine("qq cant remove");
                return;
            }

            OutPacket op = new OutPacket(20);

            op.WriteInt(20);
            op.WriteShort(0x04);
            op.WriteShort(0x15);
            op.WriteInt();
            op.WriteInt(chr.getuID());
            op.WriteShort(0x01);
            op.WriteByte(decrypted[0]);
            op.WriteByte(decrypted[1]);
            c.WriteRawPacket(op.ToArray());
        }
Beispiel #6
0
        protected override void OnDisconnected()
        {
            if (account != null)
            {
                if (account.characters != null)
                {
                    CharacterFunctions.quitGameWorld(this);
                    foreach (Character character in account.characters.Values)
                    {
                        character.Save();
                    }
                    account.clearCharacters();
                }
            }

            OutPacket wayToHell = new OutPacket(9);

            wayToHell.WriteInt(9);
            wayToHell.WriteShort(3);
            wayToHell.WriteRepeatedByte(6, 3);             // just for lulz
            WriteRawPacket(wayToHell.ToArray());

            if (m_processor != null)
            {
                Logger.WriteLog(Logger.LogTypes.Disconnect, "[{0}] Client {1} disconnected.", m_processor.Label, Label);
                m_deathAction(this);
            }
        }
Beispiel #7
0
        public static void AttackDefendState(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Hooked playerState with null of activeCharacter");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            OutPacket op = new OutPacket(24);

            op.WriteInt(24);
            op.WriteShort(0x05);
            op.WriteShort(0x06);
            op.WriteByte(0x01);
            op.WriteByte(0x33);
            op.WriteByte(0x15);
            op.WriteByte(0x08);
            op.WriteInt(chr.getuID());
            op.WriteShort(p.ReadByte());
            op.WriteByte(0x10);
            op.WriteByte(0x29);

            WMap.Instance.getGrid(chr.getMap()).sendTo3x3Area(chr, chr.getArea(), op.ToArray());
        }
Beispiel #8
0
        public static void ViewInventory(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Hooked viewInventory with null of activeCharacter");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            OutPacket op = new OutPacket(28);

            op.WriteInt(28);
            op.WriteShort(0x04);
            op.WriteShort(0x1e);
            op.WriteInt(0x01);
            op.WriteInt(chr.getuID());
            op.WriteShort(0x01);
            op.WriteByte(0xf8);
            op.WriteByte(0x01);

            p.Skip(4);

            op.WriteBytes(p.ReadBytes(4));
            op.WriteByte(0x9e);
            op.WriteByte(0x0f);
            op.WriteByte(0xbf);
            c.WriteRawPacket(op.ToArray());
        }
Beispiel #9
0
        public static void UnknownStatimizer(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Hooked playerState with null of activeCharacter");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            OutPacket op = new OutPacket(24);

            op.WriteInt(24);
            op.WriteShort(4);
            op.WriteShort(47);
            op.WriteInt(1);
            op.WriteInt(chr.getuID());
            op.WriteByte();
            op.WriteByte();
            op.WriteByte(1);
            op.WriteByte();
            op.WriteByte();
            op.WriteByte();
            op.WriteByte();
            op.WriteByte();             // ok, there's some magic on those bytes, for ex. 3rd byte tells you, if you're able to trade in wild zone
            chr.getAccount().mClient.WriteRawPacket(op.ToArray());
        }
Beispiel #10
0
 public static byte[] Initiate()
 {
     using (OutPacket p = new OutPacket(SendOps.Initiate))
     {
         return(p.ToArray());
     }
 }
Beispiel #11
0
        public static byte[] Pong()
        {
            using (OutPacket p = new OutPacket(SendOps.Pong))
            {
                p.WriteInt(Environment.TickCount);

                return(p.ToArray());
            }
        }
Beispiel #12
0
        public static byte[] Validate()
        {
            using (OutPacket p = new OutPacket(SendOps.Validate))
            {
                p.WriteByte(Constants.Localisation);
                p.WriteUShort(Constants.MapleVersion);
                p.WriteShort(Constants.PatchLocation);

                return(p.ToArray());
            }
        }
Beispiel #13
0
        public static byte[] MapleChatMessage(string sender, string text)
        {
            using (OutPacket p = new OutPacket(SendOps.MapleChat))
            {
                p.WriteByte(6); // NOTE: Mode.
                p.WriteString(sender);
                p.WriteString(text);

                return(p.ToArray());
            }
        }
Beispiel #14
0
        public static byte[] SelectWorld(byte worldId, byte channelId)
        {
            using (OutPacket p = new OutPacket(SendOps.SelectWorld))
            {
                p.WriteByte(2); // NOTE: Connection Type.
                p.WriteByte(worldId);
                p.WriteByte(channelId);
                p.WriteBytes(10, 0, 0, 1); // NOTE: IPv4 Address.

                return(p.ToArray());
            }
        }
Beispiel #15
0
        public static byte[] SelectCharacter(string pic, int characterId)
        {
            using (OutPacket p = new OutPacket(SendOps.SelectCharacter))
            {
                p.WriteString(pic);
                p.WriteInt(characterId);
                p.WriteString("6-4-3-2-1-5");
                p.WriteEmpty(10);

                return(p.ToArray());
            }
        }
Beispiel #16
0
        public static byte[] JoinMapleChat(int chatId)
        {
            using (OutPacket p = new OutPacket(SendOps.MapleChat))
            {
                p.WriteByte(); // NOTE: Mode.
                p.WriteByte(); // NOTE: Unknown.
                p.WriteInt(chatId);
                p.WriteByte(); // NOTE: Unknown.

                return(p.ToArray());
            }
        }
Beispiel #17
0
        public static void MoveToInv(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook cargo -> inv while not being ingame.");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            byte fromCargoIndex = p.ReadByte();
            byte toInvSlot      = p.ReadByte();
            byte toInvLine      = p.ReadByte();
            byte toInvRow       = p.ReadByte();

            Cargo     cargo = chr.getCargo();
            Inventory inv   = chr.getInventory();

            Console.WriteLine("Cargo > {0} | {1} | {2} | {3}", fromCargoIndex, toInvSlot, toInvLine, toInvRow);

            cargo.updateCargo();

            if (!cargo.getCargoSaved().ContainsKey((byte)fromCargoIndex))
            {
                Console.WriteLine("Cannot moveItemToInv [item missing]");
                return;
            }
            Item itemF = cargo.getCargoSaved()[(byte)fromCargoIndex];

            if (!inv.moveFromCargo(itemF, fromCargoIndex, toInvRow, toInvLine))
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "do kurwy nendzy");
                return;
            }
            cargo.saveCargo();

            OutPacket op = new OutPacket(24);

            op.WriteInt(24);
            op.WriteShort(4);
            op.WriteShort(45);
            op.WriteInt(1);
            op.WriteInt(chr.getuID());
            op.WriteShort(1);
            op.WriteByte(fromCargoIndex);
            op.WriteByte(toInvSlot);
            op.WriteByte(toInvLine);
            op.WriteByte(toInvRow);
            op.WriteShort(-16625);
            c.WriteRawPacket(op.ToArray());
        }
Beispiel #18
0
        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);
        }
Beispiel #19
0
 public static byte[] Handshake()
 {
     using (OutPacket p = new OutPacket())
     {
         p.WriteShort(14);
         p.WriteShort(Constants.MajorVersion);
         p.WriteMapleString(Constants.MinorVersion);
         p.WriteBytes(Constants.RIV);
         p.WriteBytes(Constants.SIV);
         p.WriteByte(Constants.Locale);
         return(p.ToArray());
     }
 }
Beispiel #20
0
        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);
        }
Beispiel #21
0
        public static void Refresh(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Hooked guild.Refresh with null of activeCharacter");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            OutPacket op = new OutPacket(40);

            op.WriteInt(40);
            op.WriteShort(5);
            op.WriteShort(0x41);
            op.WriteInt(1);
            op.WriteShort(13413);
            c.WriteRawPacket(op.ToArray());

            op = new OutPacket(32);
            op.WriteInt(32);
            op.WriteShort(4);
            op.WriteShort(97);
            op.WriteInt(1);
            op.WriteShort(-15349);
            op.WriteShort((short)chr.getuID());
            op.WriteLong();
            op.WriteLong();
            c.WriteRawPacket(op.ToArray());

            op = new OutPacket(136);
            op.WriteInt(136);
            op.WriteShort(4);
            op.WriteShort(81);
            op.WriteInt(1);
            op.WriteShort(-15349);
            op.WriteShort((short)chr.getuID());
            op.WriteShort(1);
            op.WriteShort(30726);
            op.WriteString("PolishPoverty");
            c.WriteRawPacket(op.ToArray());

            op = new OutPacket(20);
            op.WriteInt(20);
            op.WriteInt(5);
            op.WriteInt(937683714);             // those values.. lelellele
            op.WriteInt(680);
            op.WriteInt(939117056);
            c.WriteRawPacket(op.ToArray());
        }
Beispiel #22
0
        public static byte[] MigrateIn()
        {
            using (OutPacket p = new OutPacket(SendOps.MigrateIn))
            {
                p.WriteInt(6); // TODO: World ID.
                p.WriteInt(MapleConnection.User.ID);
                p.WriteHexString("00 30 67 62 18 18");
                p.WriteInt(MapleConnection.User.HardwareID_1);
                p.WriteInt();
                p.WriteInt(MapleConnection.User.HardwareID_2);
                p.WriteLong(MapleConnection.User.SessionID);

                return(p.ToArray());
            }
        }
Beispiel #23
0
        public static void ShortcutBar(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook bar skill while not being ingame.");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            byte barIndex = p.ReadByte();
            byte actionID = p.ReadByte();

            p.Skip(2);
            int thingID = p.ReadInt();

            OutPacket op = new OutPacket(24);

            op.WriteInt(24);
            op.WriteShort(4);
            op.WriteShort(17);
            op.WriteInt(135595521);
            op.WriteInt(chr.getuID());
            op.WriteShort(1);
            op.WriteByte(barIndex);
            op.WriteByte(actionID);
            op.WriteInt(thingID);

            if (actionID >= 1 && actionID <= 4)
            {
                chr.getSkillBar().addToSkillBar(barIndex, thingID);
            }
            else if (actionID == 6)
            {
                chr.getSkillBar().addToSkillBar(barIndex, thingID + 256);
            }
            else if (actionID == 0)
            {
                chr.getSkillBar().removeFromSkillBar(barIndex);
            }
            else if (actionID == 5)
            {
                chr.getSkillBar().addToSkillBar(barIndex, thingID + 512);
            }

            c.WriteRawPacket(op.ToArray());
        }
Beispiel #24
0
        public byte[] npcSpawnChained(Character chr)
        {
            OutPacket initNPCData = new OutPacket(589);

            initNPCData.WriteByte(3);
            initNPCData.WriteInt(this.uID);
            initNPCData.WriteInt();
            initNPCData.WritePaddedString(this.getName(), 16);
            initNPCData.Skip(18);
            initNPCData.WriteInt(this.getModule());
            initNPCData.Skip(10);
            initNPCData.WriteInt(this.getmID());
            initNPCData.Skip(16);
            initNPCData.WriteFloat(this.npcPosition[0]);
            initNPCData.WriteFloat(this.npcPosition[1]);
            return(initNPCData.ToArray());
        }
Beispiel #25
0
        public static byte[] Login(string password, string authenticationToken)
        {
            using (OutPacket p = new OutPacket(SendOps.Login))
            {
                p.WriteString(password);
                p.WriteString(authenticationToken);
                p.WriteInt();
                p.WriteShort();
                p.WriteInt(MapleConnection.User.HardwareID_1);
                p.WriteInt();
                p.WriteInt(MapleConnection.User.HardwareID_2);
                p.WriteShort();
                p.WriteLong(2);

                return(p.ToArray());
            }
        }
Beispiel #26
0
        public byte[] GetHashPacket()
        {
            using (OutPacket outPacket = new OutPacket(0x0999))
            {
                foreach (string path in Directory.GetFiles(this.Config.MapleStoryPath))
                {
                    string extension = Path.GetExtension(path);
                    string name      = Path.GetFileNameWithoutExtension(path);

                    if (extension.ToLower().Contains("wz"))
                    {
                        outPacket.WriteString(name);
                        outPacket.WriteString(HashUtilities.GetMD5HashFromFile(path));
                    }
                }

                return(outPacket.ToArray());
            }
        }
Beispiel #27
0
        public byte[] getInitialPacket()
        {
            OutPacket p = new OutPacket(608);

            p.WriteInt(608);
            p.WriteShort(0x05);
            p.WriteShort(0x03);
            p.WriteInt(0x02);
            p.WriteInt(uID);
            p.WriteZero(48);
            p.WriteInt(this.mController.getData().getmID());
            p.WriteInt();
            p.WriteInt(curHP);
            p.WriteZero(8);
            p.WriteFloat(positionX);
            p.WriteFloat(positionY);
            //Console.WriteLine("mobid {0} mobuid {1} xcord {2} ycord {3} hp {4}", this.mController.getData().getmID(), uID, positionX, positionY, curHP);
            return(p.ToArray());
        }
Beispiel #28
0
        public static void MoveFromInv(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook cargo -> inv while not being ingame.");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            byte managementType = p.ReadByte();
            byte fromInvIndex   = p.ReadByte();
            byte toCargoSlot    = p.ReadByte();
            byte toCargoLine    = p.ReadByte();
            byte toCargoRow     = p.ReadByte();

            Cargo cargo = chr.getCargo();

            Console.WriteLine("Cargo > {0} | {1} | {2} | {3} | {4}", managementType, fromInvIndex, toCargoSlot, toCargoLine, toCargoRow);
            if (!cargo.insertItemFromInventory(chr.getInventory(), fromInvIndex, toCargoRow, toCargoLine))
            {
                Console.WriteLine("da fuaaark");
                return;
            }

            OutPacket op = new OutPacket(24);

            op.WriteInt(24);
            op.WriteShort(4);
            op.WriteShort(44);
            op.WriteInt(1);
            op.WriteInt(chr.getuID());
            op.WriteShort(1);
            op.WriteByte(managementType);
            op.WriteByte(fromInvIndex);
            op.WriteByte(toCargoSlot);
            op.WriteByte(toCargoLine);
            op.WriteByte(toCargoRow);
            op.WriteByte(42);
            c.WriteRawPacket(op.ToArray());
        }
Beispiel #29
0
        public static void SellToNPC(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook sellToNPC while not being ingame.");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            byte[] decrypted = p.ReadBytes(9);

            Item item = new Item();

            if (!chr.getInventory().sellItem(decrypted[5], decrypted[8], item))
            {
                Console.WriteLine("sell to npc teh problemz");
                return;
            }

            if (payedItems.Contains(item.getItemID()))
            {
                ItemData itemData  = ItemDataCache.Instance.getItemData(item.getItemID());
                int      itemPrice = itemData.getNpcPrice() * decrypted[8];
                chr.setCoin(chr.getCoin() + itemPrice);
            }

            OutPacket op = new OutPacket(32);

            op.WriteInt(32);
            op.WriteShort(0x04);
            op.WriteShort(0x14);
            op.WriteInt(0x01);
            op.WriteInt(chr.getuID());
            op.WriteShort(0x01);
            op.WriteByte(0x01);
            op.WriteByte(decrypted[5]);
            op.WriteInt(decrypted[8]);
            op.WriteLong(chr.getCoin());
            c.WriteRawPacket(op.ToArray());
        }
Beispiel #30
0
        public static void Move(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook cargo movement while not being ingame.");
                c.Close();
                return;
            }

            byte      fromCargoIndex  = p.ReadByte();
            short     unknownMovement = p.ReadShort();
            byte      toCargoSlot     = p.ReadByte();
            byte      toCargoLine     = p.ReadByte();
            byte      toCargoRow      = p.ReadByte();
            Character chr             = c.getAccount().activeCharacter;
            Cargo     cargo           = chr.getCargo();

            Console.WriteLine("Cargo > {0} | {1} | {2} | {3}", fromCargoIndex, toCargoSlot, toCargoLine, toCargoRow);

            if (!cargo.moveItem(fromCargoIndex, toCargoSlot, toCargoRow, toCargoLine))
            {
                Console.WriteLine("problem with move item");
                return;
            }

            OutPacket op = new OutPacket(24);

            op.WriteInt(24);
            op.WriteShort(4);
            op.WriteShort(46);
            op.WriteInt(1);
            op.WriteInt(chr.getuID());
            op.WriteShort(1);
            op.WriteByte(fromCargoIndex);
            op.WriteShort(unknownMovement);
            op.WriteByte(toCargoSlot);
            op.WriteByte(toCargoLine);
            op.WriteByte(toCargoRow);
            c.WriteRawPacket(op.ToArray());
        }
        public override void Dispatch(InPacket inPacket)
        {
            if (inPacket.OperationCode == Program.ServerIP)
            {
                ushort status = inPacket.ReadUShort();
                ushort status2 = inPacket.ReadUShort();
                byte[] ip = inPacket.ReadBytes(4);
                ushort port = inPacket.ReadUShort();
                byte[] leftover = inPacket.ReadLeftoverBytes();

                Program.IP = string.Format("{0}.{1}.{2}.{3}", ip[0], ip[1], ip[2], ip[3]);
                Program.Port = port;

                using (OutPacket outPacket = new OutPacket(Program.ServerIP))
                {
                    outPacket.WriteUShort(status);
                    outPacket.WriteUShort(status2);
                    outPacket.WriteBytes(127, 0, 0, 1);
                    outPacket.WriteUShort(8484);
                    outPacket.WriteBytes(leftover);

                    if (ClientSession.Instance != null)
                    {
                        ClientSession.Instance.Send(outPacket.ToArray());
                    }
                }
            }
            else
            {
                using (OutPacket outPacket = new OutPacket(inPacket))
                {
                    if (ClientSession.Instance != null)
                    {
                        ClientSession.Instance.Send(outPacket.ToArray());
                    }
                }
            }
        }