public static void SellStart_Req(InPacket lea, Client c) { string Name = lea.ReadString(40); var chr = c.Character; //if (!(chr.MapX == 1 && chr.MapY == 51) && !(chr.MapX == 1 && chr.MapY == 52) && !(chr.MapX == 1 && chr.MapY == 53) && !(chr.MapX == 1 && chr.MapY == 54) && !(chr.MapX == 1 && chr.MapY == 55)) // return; Map map = MapFactory.GetMap(chr.MapX, chr.MapY); CharacterShop PlayerShop = new CharacterShop(Name); for (int i = 0; i < 12; i++) { int SourceType = lea.ReadShort(); int SourceSlot = lea.ReadShort(); int Quantity = lea.ReadInt(); int Price = lea.ReadInt(); Item Source = chr.Items.getItem((byte)SourceType, (byte)SourceSlot); if (Source != null) { PlayerShop.Add(new ShopData(Source.ItemID, Quantity, SourceType, SourceSlot, (byte)i, Source.Spirit, Source.Level1, Source.Level2, Source.Level3, Source.Level4, Source.Level5, Source.Level6, Source.Level7, Source.Level8, Source.Level9, Source.Level10, Source.Fusion, Source.IsLocked, Source.Icon, Source.Term, Price)); } } chr.Shop = PlayerShop; foreach (Character All in map.Characters) { PlayerShopPacket.SellStart(All.Client, chr, Name); } }
protected override void Dispatch(InPacket inPacket) { try { #if DEBUG Log.Hex("<<< Received (0x{0:X2}) packet from {1}: ", inPacket.Content, inPacket.OperationCode, this.Title); #endif if (inPacket.OperationCode == (ushort)ClientOpcode.SERVER) { short Header = inPacket.ReadShort(); // Read header inPacket.ReadInt(); // Original length + CRC inPacket.ReadInt(); #if DEBUG Log.Debug("^^^--- <<< Received opcode (0x{0:X}): ", Header); #endif switch ((ClientOpcode)Header) { case ClientOpcode.MYCHAR_INFO_REQ: Log.Debug("Send >> CharHandler.MyChar_Info_Req"); CharHandler.MyChar_Info_Req(inPacket, this); break; case ClientOpcode.CREATE_MYCHAR_REQ: Log.Debug("Send >> CharHandler.Create_MyChar_Req"); CharHandler.Create_MyChar_Req(inPacket, this); break; case ClientOpcode.CHECK_SAMENAME_REQ: Log.Debug("Send >> CharHandler.Check_SameName_Req"); CharHandler.Check_SameName_Req(inPacket, this); break; case ClientOpcode.DELETE_MYCHAR_REQ: Log.Debug("Send >> CharHandler.Delete_MyChar_Req"); CharHandler.Delete_MyChar_Req(inPacket, this); break; case ClientOpcode.CREATE_PREVIEW_REQ: Log.Debug("Send >> CharHandler.Create_Preview_Req"); CharHandler.Create_Preview_Req(inPacket, this); break; case ClientOpcode.CHAR_PAGE2_REQ: Log.Debug("Send >> CharHandler.Char_page2_preview "); CharHandler.Char_page2_preview(inPacket, this); break; } } } catch (HackException e) { Log.Warn("Hack from {0}: \n{1}", this.Account.Username, e.ToString()); } catch (Exception e) { Log.Error("Unhandled exception from {0}: \n{1}", this.Title, e.ToString()); } }
public static void HandleSetField(MapleConnection connection, InPacket packet) { connection.Character = new Character(); ushort loopCount = packet.ReadUShort(); for (int i = 0; i < loopCount; i++) { packet.ReadLong(); } int gameServerId = packet.ReadInt(); packet.ReadByte(); packet.ReadInt(); connection.Character.PortalCount = packet.ReadByte(); packet.ReadInt(); bool characterData = packet.ReadBool(); if (characterData) { HelpPacket.DecodeCharacterData(connection.Character, packet); } else { } Main.Instance.SetField(new Bitmap(1500, 2000)); }
public static void p_Jump_c(InPacket lea, Client c) { if (c == null || lea.Available < 16) { return; } int CharacterID = lea.ReadInt(); lea.ReadInt(); float PositionX = BitConverter.ToSingle(BitConverter.GetBytes(lea.ReadInt()), 0); float PositionY = BitConverter.ToSingle(BitConverter.GetBytes(lea.ReadInt()), 0); Character find = null; foreach (Character findCharacter in MapFactory.AllCharacters) { if (CharacterID == findCharacter.CharacterID) { find = findCharacter; break; } } if (find != null) { find.PlayerX = ((short)PositionX); find.PlayerY = ((short)PositionY); } //Console.WriteLine("Player New Pos X:{0}, Y:{1}", c.Character.PlayerX, c.Character.PlayerY); }
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()); }
public static void p_Damage_c(InPacket lea, Client c) { int CharacterID = lea.ReadInt(); short Damage = lea.ReadShort(); short Unk = lea.ReadShort(); float PositionX = BitConverter.ToSingle(BitConverter.GetBytes(lea.ReadInt()), 0); float PositionY = BitConverter.ToSingle(BitConverter.GetBytes(lea.ReadInt()), 0); var chr = c.Character; if (chr == null) { if (chr.CharacterID == CharacterID) { } else { return; } } if (Damage > 0) { chr.Hp -= Damage; } if (PositionX != 0) { chr.PlayerX = ((short)PositionX); } }
public static void p_Move_c(InPacket lea, Client c) { if (c == null || lea.Available < 17) { return; } int CharacterID = lea.ReadInt(); float PositionX = BitConverter.ToSingle(BitConverter.GetBytes(lea.ReadInt()), 0); float PositionY = BitConverter.ToSingle(BitConverter.GetBytes(lea.ReadInt()), 0); int Speed = lea.ReadInt(); // start = 00 00 40 40 , end = 00 00 00 00 int Direction = lea.ReadByte(); // right = 01 , left = FF Character find = null; foreach (Character findCharacter in MapFactory.AllCharacters) { if (CharacterID == findCharacter.CharacterID) { find = findCharacter; break; } } if (find != null && Speed == 0) { find.PlayerX = ((short)PositionX); find.PlayerY = ((short)PositionY); //Console.WriteLine("Player New Pos X:{0}, Y:{1}", c.Character.PlayerX, c.Character.PlayerY); } //Console.WriteLine("Player {0} Move To {1} X:{2}, Y:{3}", Speed == 0 ? "End" : "Start", MoveDirection == 1 ? "Right" : "Left", PositionX, PositionY); }
public static void Buy_Req(InPacket lea, Client c) { int CharacterID = lea.ReadInt(); int ItemID = lea.ReadInt(); int Slot = lea.ReadShort(); int Quantity = lea.ReadShort(); var chr = c.Character; try { Map map = MapFactory.GetMap(chr.MapX, chr.MapY); Character Seller = null; foreach (Character find in map.Characters) { if (find.CharacterID == CharacterID) { Seller = find; } } ShopData Item = Seller.Shop.Find(i => ItemID == i.ItemID && Slot == i.TargetSlot); byte Type = InventoryType.getItemType(ItemID); byte FreeSlot = chr.Items.GetNextFreeSlot((InventoryType.ItemType)Type); if (Item.Quantity < Quantity || Item == null) { PlayerShopPacket.Buy(c, 0); return; } chr.Money -= (Item.Price * Quantity); InventoryPacket.getInvenMoney(c, chr.Money, -(Item.Price * Quantity)); chr.Items.Add(new Item(Item.ItemID, (short)Quantity, Item.Spirit, Item.Level1, Item.Level2, Item.Level3, Item.Level4, Item.Level5, Item.Level6, Item.Level7, Item.Level8, Item.Level9, Item.Level10, Item.Fusion, Item.IsLocked, Item.Icon, Item.Term, Type, FreeSlot)); InventoryHandler.UpdateInventory(c, Type); //Seller.Shop.Remove(Item); Seller.Items.Remove((byte)Item.SourceType, (byte)Item.SourceSlot); Seller.Items.Add(new Item(Item.ItemID, (short)(Item.Quantity - Quantity), Item.Spirit, Item.Level1, Item.Level2, Item.Level3, Item.Level4, Item.Level5, Item.Level6, Item.Level7, Item.Level8, Item.Level9, Item.Level10, Item.Fusion, Item.IsLocked, Item.Icon, Item.Term, (byte)Item.SourceType, (byte)Item.SourceSlot)); Item.Quantity = Item.Quantity - Quantity; Seller.Shop.Money += (Item.Price * Quantity); Seller.Money += (Item.Price * Quantity); PlayerShopPacket.ShopInfo(c, Seller, CharacterID); InventoryHandler.UpdateInventory(Seller.Client, (byte)Item.SourceType); PlayerShopPacket.SellInfo(Seller.Client); InventoryPacket.getInvenMoney(Seller.Client, Seller.Money, Item.Price * Quantity); PlayerShopPacket.Buy(c, 1); } catch { PlayerShopPacket.Buy(c, 0); return; } }
public static void OnMobMove(MapleClient client, InPacket iPacket) { int objectID = iPacket.ReadInt(); Mob mob; try { mob = client.Character.ControlledMobs[objectID]; } catch (KeyNotFoundException) { return; } short moveAction = iPacket.ReadShort(); bool cheatResult = (iPacket.ReadByte() & 0xF) != 0; byte centerSplit = iPacket.ReadByte(); int illegalVelocity = iPacket.ReadInt(); byte unknown = iPacket.ReadByte(); iPacket.ReadInt(); Movements movements = Movements.Decode(iPacket); Movement lastMovement = movements[movements.Count - 1]; mob.Position = lastMovement.Position; mob.Foothold = lastMovement.Foothold; mob.Stance = lastMovement.Stance; using (OutPacket oPacket = new OutPacket(SendOps.MobCtrlAck)) { oPacket .WriteInt(objectID) .WriteShort(moveAction) .WriteBool(cheatResult) .WriteShort() // NOTE: Mob mana. .WriteByte() // NOTE: Ability ID. .WriteByte(); // NOTE: Ability level. client.Send(oPacket); } using (OutPacket oPacket = new OutPacket(SendOps.MobMove)) { oPacket .WriteInt(objectID) .WriteBool(cheatResult) .WriteByte(centerSplit) .WriteInt(illegalVelocity); movements.Encode(oPacket); client.Character.Map.Broadcast(oPacket, client.Character); } }
public static void Dismantle_Req(InPacket lea, Client c) { int Type = lea.ReadInt(); int Slot = lea.ReadInt(); var chr = c.Character; Item Item = chr.Items.getItem((byte)Type, (byte)Slot); Item.IsLocked = 0; InventoryHandler.UpdateInventory(c, (byte)Type); }
public void Gacha_Action(ClientSession cs, InPacket ip) { int CharID = ip.ReadInt(); int Set = ip.ReadInt(); int Level = ip.ReadInt(); int Gema = ip.ReadInt(); int rndItems = RandomItems.Next(30); int rndUID = RandomItems.Next(873604976); if (Level == 30) { percent30(rndItems, Set); } if (Level == 40) { percent30(rndItems, Set); } if (Level == 50) { percent30(rndItems, Set); } if (Level == 60) { percent30(rndItems, Set); } if (Level == 70) { percent50(rndItems, Set); } if (Level == 80) { percent50(rndItems, Set); } using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_GACHA_ACTION_ACK)) { oPacket.WriteInt(0); oPacket.WriteInt(CharID); oPacket.WriteInt(Gema); oPacket.WriteHexString("00 00 00 01 34 12 27 47 00 00 00 03 00 00 00 03 00 00 FF FF 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 00 00 00 00 00 00 00 00 00 01 8E 8E 00 00 00 01 34 12 24 65 00 00 00 3A 00 00 00 3A 00 02 00 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 01"); oPacket.WriteInt(SortedItem); //00 09 92 5A oPacket.WriteInt(1); oPacket.WriteInt(rndUID); //34 12 27 70 oPacket.WriteHexString("00 00 00 02 00 00 00 02"); oPacket.WriteInt(Level); oPacket.WriteHexString("00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 00 00 00 00 00 00 00 00 00"); oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); LogFactory.GetLog("GACHA ACTION").LogHex("", ip.ToArray()); } }
public static void PvPInviteResponses(InPacket lea, Client c) { int CharacterID = lea.ReadInt(); int Respons = lea.ReadInt(); Map map = MapFactory.GetMap(c.Character.MapX, c.Character.MapY); PvPPacket.PvPInviteResponses(c.Character.Competitor.Client, CharacterID, Respons); if (Respons == 1) { PvPPacket.PvPStart(c, c.Character.CharacterID, c.Character.Competitor.CharacterID); PvPPacket.PvPStart(c.Character.Competitor.Client, c.Character.CharacterID, c.Character.Competitor.CharacterID); } }
private void OnCharacterEntriesResponse(InPacket inPacket) { int accountId = inPacket.ReadInt(); List <byte[]> entries = new List <byte[]>(); while (inPacket.Available > 0) { entries.Add(inPacket.ReadBytes(inPacket.ReadInt())); } this.World.CharacterListPool.Enqueue(accountId, entries); }
public static void GiveStorageMoney(InPacket lea, Client gc) { var chr = gc.Character; int money = lea.ReadInt(); int unk = lea.ReadInt(); chr.Storages.getStorages()[0].Money -= money; chr.Storages.getStorages()[0].Save(); chr.Money += money; chr.Save(); InventoryPacket.getInvenMoney(gc, chr.Money, money); StoragePacket.getStoreMoney(gc); }
public override void OnPacket(InPacket iPacket) { try { iPacket.Decrypt(CRYPT_KEY); GameOpcodes uOpcode = (GameOpcodes)iPacket.ReadShort(); int uSize = iPacket.ReadInt(); bool isCompress = iPacket.ReadBool(); int cSize = 0; if (isCompress == true) { cSize = iPacket.ReadInt(); LogFactory.GetLog("Main").LogInfo("Pacote comprimido {0}({1})", (int)uOpcode, uOpcode.ToString()); } else { LogFactory.GetLog("Main").LogInfo("Packet {0}({1})", (int)uOpcode, uOpcode.ToString()); } LogFactory.GetLog("Main").LogHex("Pacote", iPacket.ToArray()); switch (uOpcode) { case GameOpcodes.HEART_BIT_NOT: OnHeartBeatNot(); break; case GameOpcodes.EVENT_INVITE_REQ: //31 EVENT_FRIEND_LIST_REQ MsgUser.FriendList(this, iPacket); break; case GameOpcodes.EVENT_LEAVE_ROOM_ACK: //34 ADD_FRIEND MsgUser.Add(this, iPacket); break; default: { LogFactory.GetLog("Main").LogWarning("Pacote indefinido foi recebida. Opcode: {0}({1})", (int)uOpcode, uOpcode.ToString()); LogFactory.GetLog("Main").LogHex("Pacote", iPacket.ToArray()); break; } } } catch (Exception e) { LogFactory.GetLog("Main").LogFatal(e); Close(); } }
public override void OnPacket(InPacket iPacket) { try { iPacket.Decrypt(CRYPT_KEY); CenterOpcodes uOpcode = (CenterOpcodes)iPacket.ReadShort(); int uSize = iPacket.ReadInt(); bool isCompress = iPacket.ReadBool(); int cSize = 0; if (isCompress == true) { cSize = iPacket.ReadInt(); LogFactory.GetLog("Main").LogInfo("Pacote comprimido {0}({1})", (int)uOpcode, uOpcode.ToString()); } else { LogFactory.GetLog("Main").LogInfo("Packet {0}({1})", (int)uOpcode, uOpcode.ToString()); } LogFactory.GetLog("Main").LogHex("Pacote", iPacket.ToArray()); switch (uOpcode) { case CenterOpcodes.HEART_BIT_NOT: OnHeartBeatNot(); break; case CenterOpcodes.ENU_CLIENT_CONTENTS_FIRST_INIT_INFO_REQ: MyLoading.NotifyContentInfo(this); break; case CenterOpcodes.ENU_VERIFY_ACCOUNT_REQ: MyUser.OnLogin(this, iPacket); break; default: { LogFactory.GetLog("Main").LogWarning("Pacote indefinido foi recebida. Opcode: {0}({1})", (int)uOpcode, uOpcode.ToString()); LogFactory.GetLog("Main").LogHex("Pacote", iPacket.ToArray()); break; } } } catch (Exception e) { LogFactory.GetLog("Main").LogError(e.ToString()); Close(); } }
public static void OnCreateNewCharacter(MapleClient c, InPacket p) { string name = p.ReadMapleString(); if (Database.Instance.NameAvailable(name)) { Character character = new Character(name); character.AccountId = c.Account.AccountId; character.CharId = Database.Instance.GetNewCharacterId(); character.Level = 1; character.HP = 50; character.MaxHP = 50; character.MP = 5; character.MaxMP = 5; character.Face = p.ReadInt(); character.Hair = p.ReadInt() + p.ReadInt(); character.SkinColor = (byte)p.ReadInt(); int top = p.ReadInt(); int bottom = p.ReadInt(); int shoes = p.ReadInt(); int weapon = p.ReadInt(); character.Inventory[InventorySlot.Equipped].Items.Add(-5, new Item(top)); character.Inventory[InventorySlot.Equipped].Items.Add(-6, new Item(bottom)); character.Inventory[InventorySlot.Equipped].Items.Add(-7, new Item(shoes)); character.Inventory[InventorySlot.Equipped].Items.Add(-11, new Item(weapon)); character.Str = p.ReadByte(); character.Dex = p.ReadByte(); character.Int = p.ReadByte(); character.Luk = p.ReadByte(); c.Characters.Add(character); Database.Instance.Save <Character>(Database.Characters, character); using (OutPacket packet = new OutPacket(SendOps.CreateNewCharacterResult)) { packet.WriteByte(); PacketCreator.Helper.AddCharacterData(packet, character); PacketCreator.Helper.AddCharaterLook(packet, character); packet.WriteBool(false); //rank packet.WriteZero(24); c.Send(packet); } } else { using (OutPacket packet = new OutPacket(SendOps.CheckDuplicatedIDResult)) { packet.WriteMapleString(name); packet.WriteBool(true); c.Send(packet); } } }
public void RemoveMission(ClientSession cs, InPacket ip) { int missionUID = ip.ReadInt(); int missionID = ip.ReadInt(); using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_REMOVE_MISSION_ACK)) { oPacket.WriteInt(0); oPacket.WriteInt(missionID); oPacket.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); DataSet ds = new DataSet(); Database.Query(ref ds, "DELETE FROM `gc`.`missions` WHERE `LoginUID` = '{0}' AND `MissionID` = '{1}'", cs.LoginUID, missionID); } }
public static void HandleCharacterSelection(MapleClient client, InPacket iPacket) { int characterID = iPacket.ReadInt(); string macAddresses = iPacket.ReadMapleString(); // TODO: Do something with these. LoginHandler.MigrateClient(client, characterID); }
public static void HandleMapleChat(MapleConnection connection, InPacket packet) { MapleChatMode mode = (MapleChatMode)packet.ReadByte(); switch (mode) { case MapleChatMode.InviteReceive: { if (MapleChat.Instance != null) { return; // NOTE: Invite is automatically ignored while being in a chat session. } string sender = packet.ReadString(); byte unknown1 = packet.ReadByte(); MapleChat.ID = packet.ReadInt(); byte unknown2 = packet.ReadByte(); DialogResult result = Main.Instance.Notify(sender + " has invited you to a chat. Would you like to join?", "Maple Chat", 0, false, true); if (result == DialogResult.Yes) { connection.Send(SocialPacket.JoinMapleChat(MapleChat.ID)); } } break; case MapleChatMode.InviteSent: { } break; } }
public static void PartyInviteResponses(InPacket lea, Client c) { int Respons = lea.ReadInt(); if (Respons == 0) { PartyPacket.PartyInviteResponses(c.Character.Party.getMembers()[0].Character.Client, Respons); Member find = null; foreach (var chr in c.Character.Party.getMembers()) { if (chr.Character.CharacterID == c.Character.CharacterID) { find = chr; break; } } foreach (var chr in c.Character.Party.getMembers()) { if (chr.Character.CharacterID != c.Character.CharacterID) { chr.Character.Party.getMembers().Remove(find); } } c.Character.Party.getMembers().Clear(); } else if (Respons == 1) { PartyPacket.PartyInviteResponses(c, Respons); foreach (var chr in c.Character.Party.getMembers()) { PartyPacket.PartyUpdate(chr.Character.Client); } } }
public static void MoveItemToStorage(InPacket lea, Client gc) { int SourceType = lea.ReadShort(); int SourceSlot = lea.ReadShort(); int TargetType = lea.ReadShort(); int TargetSlot = lea.ReadShort(); int Quantity = lea.ReadInt(); var chr = gc.Character; Storage Target = chr.Storages.GetItem((byte)TargetType, (byte)TargetSlot); Item Source = chr.Items.getItem((byte)SourceType, (byte)SourceSlot); if (Target != null || Source.ItemID / 100000 == 86 || Source.ItemID / 100000 == 87 || Source.ItemID / 100000 == 92 || Source.ItemID / 100000 == 94 || Source.ItemID / 100000 == 95) { return; } chr.Storages.Add(new Storage(Source.ItemID, Quantity, Source.Spirit, Source.Level1, Source.Level2, Source.Level3, Source.Level4, Source.Level5, Source.Level6, Source.Level7, Source.Level8, Source.Level9, Source.Level10, Source.Fusion, Source.IsLocked, Source.Icon, Source.Term, TargetType, TargetSlot, 0)); chr.Items.Remove((byte)SourceType, (byte)SourceSlot, Quantity); chr.Save(); StoragePacket.getStoreInfo(gc); InventoryHandler.UpdateInventory(gc, (byte)SourceType); }
public static void HandleMigrateCashShop(MapleClient client, InPacket iPacket) { int accountID; int characterID = iPacket.ReadInt(); if ((accountID = MasterServer.Instance.Shop.Migrations.Validate(client.Host, characterID)) == -1) { client.Close(); return; } using (DatabaseQuery query = Database.Query("SELECT * FROM `accounts` WHERE `account_id` = @account_id", new MySqlParameter("account_id", accountID))) { query.NextRow(); client.Account = new Account(query); } using (DatabaseQuery query = Database.Query("SELECT * FROM `characters` WHERE `character_id` = @character_id", new MySqlParameter("character_id", characterID))) { query.NextRow(); client.Character = new Character(client, query); } client.Character.Initialize(true); }
public static void OnTransferFieldRequest(MapleClient client, InPacket iPacket) { byte portals = iPacket.ReadByte(); if (portals != client.Character.Portals) { return; } int destinationID = iPacket.ReadInt(); switch (destinationID) { case -1: { string label = iPacket.ReadMapleString(); Portal portal; try { portal = client.Character.Map.Portals[label]; } catch (KeyNotFoundException) { return; } client.Character.ChangeMap(portal.Data.DestinationMap, portal.Link.ID); } break; } }
//Preview Character 2019-08-25 14:54 public static void Create_Preview_Req(InPacket lea, Client gc) { // [Original]: [05 01] [0B 00] [14 00 24 01] [01 00] 00 00 01 00 58 03 01 00 00 00 int unknown1 = lea.ReadInt(); // 01 00 CharPacket.Create_Preview_Ack(gc, unknown1); }
public static void TradePutItem(InPacket lea, Client c) { var chr = c.Character; int SourceType = lea.ReadShort(); int SourceSlot = lea.ReadShort(); int Quantity = lea.ReadInt(); if (SourceType == 0x64 && SourceSlot == 0x64) { // Money欄位 chr.Money -= Quantity; chr.Trade.Money = Quantity; InventoryPacket.getInvenMoney(c, chr.Money, -Quantity); TradePacket.TradePutItem(c); TradePacket.TradePutItem(chr.Trader.Client); return; } Item Source = chr.Items.getItem((byte)SourceType, (byte)SourceSlot); chr.Trade.SourceQuantity.Add(Source.Quantity); if (Source != null) { chr.Trade.Item.Add(Source); chr.Trade.TargetQuantity.Add((short)Quantity); chr.Items.Remove((byte)SourceType, (byte)SourceSlot, Quantity); InventoryHandler.UpdateInventory(c, (byte)SourceType); TradePacket.TradePutItem(c); TradePacket.TradePutItem(chr.Trader.Client); } }
public static void HandleNpcMove(MapleClient client, InPacket iPacket) { int objectID = iPacket.ReadInt(); Npc npc; try { npc = client.Character.ControlledNpcs[objectID]; } catch (KeyNotFoundException) { return; } byte a = iPacket.ReadByte(); byte b = iPacket.ReadByte(); Movements movements = null; using (OutPacket oPacket = new OutPacket(SendOps.NpcMove)) { oPacket .WriteInt(npc.ObjectID) .WriteByte(a) .WriteByte(b); if (npc.Data.IsMoving) { movements = Movements.Decode(iPacket); movements.Encode(oPacket); } client.Character.Map.Broadcast(oPacket); } }
public static void Gifts_Req(InPacket lea, Client c) { int ItemID = lea.ReadInt(); string ItemName = lea.ReadString(62); string CharacterName = lea.ReadString(20); int Type = 1; if (CashShopFactory.GetItemData(ItemID) == null) { return; } c.Account.GamePoints -= CashShopFactory.GetItemData(ItemID).BargainPrice; c.Account.Save(); dynamic datum = new Datum("gifts"); datum.name = CharacterName; datum.itemID = ItemID; datum.itemName = ItemName; datum.receive = 0; datum.Insert(); CashShopPacket.Gifts(c, Type); CashShopPacket.MgameCash(c); CashShopPacket.GuiHonCash(c); }
public static void p_Attack_c(InPacket lea, Client c) { if (c == null || lea.Available < 4) { return; } int CharacterID = lea.ReadInt(); Character find = null; foreach (Character findCharacter in MapFactory.AllCharacters) { if (CharacterID == findCharacter.CharacterID) { find = findCharacter; break; } } if (find != null && find.IsHiding == true) { Map Map = MapFactory.GetMap(find.MapX, find.MapY); find.IsHiding = false; foreach (Character All in Map.Characters) { StatusPacket.Hide(All.Client, find, 0); } } }
public static void p_Warp_c(InPacket lea, Client c) { if (/*c == null || */ lea.Available < 4) { return; } int CharacterID = lea.ReadInt(); Character find = null; foreach (Character findCharacter in MapFactory.AllCharacters) { if (CharacterID == findCharacter.CharacterID) { find = findCharacter; break; } } if (find != null) { Map Map = MapFactory.GetMap(find.MapX, find.MapY); if (Map.Characters.Contains(find)) { Map.Characters.Remove(find); foreach (Character All in Map.Characters) { MapPacket.removeUser(All.Client, CharacterID); } Log.Inform("(P_WARP_C) CharacterID = {0} , MapX = {1} , MapY = {2}", CharacterID, find.MapX, find.MapY); } } }