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()); }
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()); }
public static void regenrMonster(Client c, Monster Monster) { using (OutPacket plew = new OutPacket(ServerOpcode.MON_REGEN)) { plew.WriteInt(0); // length + CRC plew.WriteInt(0); plew.WriteInt(Monster.MonsterID); plew.WriteByte(Monster.Level); plew.WriteByte(Monster.AddEffect); plew.WriteByte(Monster.Direction); plew.WriteByte(Monster.MoveType); plew.WriteShort(Monster.PositionX); plew.WriteShort(Monster.PositionY); plew.WriteShort(0); plew.WriteShort(0); plew.WriteInt(Monster.HP); plew.WriteShort(Monster.OriginalID); plew.WriteShort(Monster.Attack1); plew.WriteShort(Monster.Attack2); plew.WriteShort(Monster.CrashAttack); plew.WriteShort(Monster.Defense); plew.WriteShort(Monster.AttackType); // Byte plew.WriteShort(0x630); plew.WriteShort(0); c.Send(plew); } }
public static void AddCharaterLook(OutPacket p, Character c) { foreach (var kvp in c.Inventory[InventorySlot.Equipped].Items) { if (kvp.Key < -100) { continue; } p.WriteByte((byte)Math.Abs(kvp.Key)); p.WriteInt(kvp.Value.ItemId); } p.WriteByte(); foreach (var kvp in c.Inventory[InventorySlot.Equipped].Items) { if (kvp.Key > -100) { continue; } p.WriteByte((byte)Math.Abs(kvp.Key)); p.WriteInt(kvp.Value.ItemId); } p.WriteByte(); }
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()); }
public static void ServerList_Ack(Client c) { using (var plew = new OutPacket(LoginServerOpcode.SERVERLIST_ACK)) { for (int i = 0; i < 13; i++) { plew.WriteByte(0xFF); } plew.WriteInt(LoginServer.Worlds.Count); // 伺服器數量 foreach (World world in LoginServer.Worlds) { plew.WriteShort(world.ID); // 伺服器順序 plew.WriteInt(world.Channel); // 頻道數量 for (int i = 0; i < 18; i++) { plew.WriteShort(i + 1); plew.WriteShort(i + 1); plew.WriteString(ServerConstants.SERVER_IP); plew.WriteInt(14101 + i); plew.WriteInt(i < world.Count ? world[i].LoadProportion : 0); // 玩家數量 plew.WriteInt(ServerConstants.CHANNEL_LOAD); // 頻道人數上限 plew.WriteInt(12); // 標章類型 plew.WriteInt(0); plew.WriteByte(i < world.Count ? 1 : 2); plew.WriteInt(14199); } } c.Send(plew); } }
public static void ServerList_Ack(Client c) { using (var plew = new OutPacket(LoginServerOpcode.SERVERLIST_ACK)) { for (int i = 0; i < 13; i++) { plew.WriteByte(0xFF); } plew.WriteInt(LoginServer.Worlds.Count); // 伺服器數量 Number of servers Log.Inform("Number of servers LoginServer.Worlds.Count : {0}", LoginServer.Worlds.Count); foreach (World world in LoginServer.Worlds) { Log.Inform("Server order world.ID : {0}", world.ID); Log.Inform("Number of channels world.Channel : {0}", world.Channel); plew.WriteShort(world.ID); // 伺服器順序 Server order plew.WriteInt(world.Channel); // 頻道數量 Number of channels for (int i = 0; i < 18; i++) { plew.WriteShort(i + 1); plew.WriteShort(i + 1); plew.WriteString(ServerConstants.SERVER_IP); plew.WriteInt(15101 + i); plew.WriteInt(i < world.Count ? world[i].LoadProportion : 0); // Number of players plew.WriteInt(ServerConstants.CHANNEL_LOAD); // Maximum number of channels plew.WriteInt(12); // 標章類型 Stamp type plew.WriteInt(0); plew.WriteByte(i < world.Count ? 1 : 2); plew.WriteInt(15199); } } c.Send(plew); } }
public static void AddCharacterData(OutPacket p, Character c) { p.WriteInt(c.CharId); p.WritePaddedString(c.Name, 13); p.WriteByte(c.Gender); p.WriteByte(c.SkinColor); p.WriteInt(c.Face); p.WriteInt(c.Hair); p.WriteLong(); //pet p.WriteByte(c.Level); p.WriteShort(c.Job); p.WriteShort(c.Str); p.WriteShort(c.Dex); p.WriteShort(c.Int); p.WriteShort(c.Luk); p.WriteShort(c.HP); p.WriteShort(c.MaxHP); p.WriteShort(c.MP); p.WriteShort(c.MaxMP); p.WriteShort(c.AP); p.WriteShort(c.SP); p.WriteInt(c.EXP); p.WriteShort(c.Fame); p.WriteInt(c.MapId); p.WriteByte(c.SpawnPoint); p.WriteZero(16); }
public static void UpdateStat(Client c) { using (OutPacket plew = new OutPacket(ServerOpcode.CHAR_STATUP_ACK)) { var chr = c.Character; Dictionary <InventoryType.EquipType, int> equip = InventoryPacket.getEquip(chr); plew.WriteInt(0); // length + CRC plew.WriteInt(0); plew.WriteShort(chr.MaxHp); plew.WriteShort(chr.MaxMp); plew.WriteShort(chr.Str); plew.WriteShort(chr.Dex); plew.WriteShort(chr.Vit); plew.WriteShort(chr.Int); plew.WriteShort(chr.MaxAttack); plew.WriteShort(chr.Attack); plew.WriteShort(chr.MaxMagic); plew.WriteShort(chr.Magic); plew.WriteShort(chr.Defense); plew.WriteByte(equip.ContainsKey(InventoryType.EquipType.Weapon) ? ItemFactory.weaponData[equip[InventoryType.EquipType.Weapon]].Speed : 0); // 攻擊速度 plew.WriteByte(equip.ContainsKey(InventoryType.EquipType.Weapon) ? ItemFactory.weaponData[equip[InventoryType.EquipType.Weapon]].AttackRange : 0); // 攻擊距離 plew.WriteShort(chr.Avoid); plew.WriteShort(chr.AbilityBonus); plew.WriteShort(chr.SkillBonus); plew.WriteShort(chr.UpgradeStr); plew.WriteShort(chr.UpgradeDex); plew.WriteShort(chr.UpgradeVit); plew.WriteShort(chr.UpgradeInt); plew.WriteShort(chr.UpgradeAttack); plew.WriteShort(chr.UpgradeMagic); plew.WriteShort(chr.UpgradeDefense); c.Send(plew); } }
public static void ServerList_Ack(Client c) { using (var plew = new OutPacket(LoginServerOpcode.SERVERLIST_ACK)) { for (int i = 0; i < 13; i++) { plew.WriteByte(0xFF); } plew.WriteInt(LoginServer.Worlds.Count); // Number of servers foreach (World world in LoginServer.Worlds) { plew.WriteShort(world.ID); // Server order plew.WriteInt(world.Channel); // Number of channels for (int i = 0; i < 8; i++) { plew.WriteShort(i + 1); plew.WriteShort(i + 1); plew.WriteString(ServerConstants.SERVER_IP); plew.WriteInt(15101 + i); plew.WriteInt(i < world.Count ? world[i].LoadProportion : 0); // Number of players plew.WriteInt(ServerConstants.CHANNEL_LOAD); // Maximum number of channels plew.WriteInt(2); // Type of seal plew.WriteInt(0); plew.WriteByte(i < world.Count ? 1 : 4); // Channel open plew.WriteInt(15199); } } c.Send(plew); } }
public static void getStatusInfo(Client c) { using (OutPacket plew = new OutPacket(ServerOpcode.CHAR_ALL)) { var chr = c.Character; Dictionary <InventoryType.EquipType, int> equip = InventoryPacket.getEquip(chr); plew.WriteInt(0); // length + CRC plew.WriteInt(0); plew.WriteString(chr.Name, 20); plew.WriteString(chr.Title, 20); plew.WriteByte(chr.Gender); plew.WriteByte(chr.Level); plew.WriteByte(chr.Class); plew.WriteByte(chr.ClassLevel); plew.WriteByte(chr.Guild); plew.WriteByte(0); plew.WriteShort(chr.MaxHp); plew.WriteShort(chr.Hp); plew.WriteShort(chr.MaxMp); plew.WriteInt(chr.Mp); plew.WriteInt(GameConstants.getExpNeededForLevel(chr.Level)); plew.WriteInt(0); plew.WriteInt(chr.Exp); plew.WriteInt(0); plew.WriteShort(chr.Rank); plew.WriteShort(chr.MaxFury); // 憤怒值(Max) plew.WriteShort(chr.Fury); // 憤怒值 plew.WriteByte(3); plew.WriteByte(chr.JumpHeight); // 跳躍高度 plew.WriteShort(chr.Str); // 力量 plew.WriteShort(chr.Dex); // 精力 plew.WriteShort(chr.Vit); // 氣力 plew.WriteShort(chr.Int); // 智力 plew.WriteShort(chr.MaxAttack); // 攻擊力(Max) plew.WriteShort(chr.Attack); // 攻擊力(Min) plew.WriteShort(chr.MaxMagic); // 魔攻力(Max) plew.WriteShort(chr.Magic); // 魔攻力(Min) plew.WriteShort(chr.Defense); // 防禦力 plew.WriteByte(equip.ContainsKey(InventoryType.EquipType.Weapon) ? ItemFactory.weaponData[equip[InventoryType.EquipType.Weapon]].Speed : 0); // 攻擊速度 [Speed] plew.WriteByte(equip.ContainsKey(InventoryType.EquipType.Weapon) ? ItemFactory.weaponData[equip[InventoryType.EquipType.Weapon]].AttackRange : 0); // 攻擊距離 plew.WriteShort(chr.Avoid); // 迴避率 plew.WriteShort(chr.AbilityBonus); // 能力上升值 plew.WriteShort(chr.SkillBonus); // 技能上升值 plew.WriteShort(chr.UpgradeStr); // 力量+ plew.WriteShort(chr.UpgradeDex); // 敏捷+ plew.WriteShort(chr.UpgradeVit); // 氣力+ plew.WriteShort(chr.UpgradeInt); // 智力+ plew.WriteShort(chr.UpgradeAttack); // 攻擊力+ plew.WriteShort(chr.UpgradeMagic); // 魔攻力+ plew.WriteShort(chr.UpgradeDefense); // 防禦力+ plew.WriteShort(0); plew.WriteShort(0); // Not read c.Send(plew); } }
public static void getInvenPet5(Client c) { using (OutPacket plew = new OutPacket(ServerOpcode.INVEN_PET5)) { var chr = c.Character; plew.WriteInt(0); // length + CRC plew.WriteInt(0); for (byte i = 0; i < 24; i++) { // 寵物編號 plew.WriteInt(chr.Pets.ItemID((byte)InventoryType.ItemType.Pet5, i)); } for (byte i = 0; i < 24; i++) { // 寵物名稱 plew.WriteString(chr.Pets.Name((byte)InventoryType.ItemType.Pet5, i), 20); } for (byte i = 0; i < 24; i++) { // 寵物等級 plew.WriteByte(chr.Pets.Level((byte)InventoryType.ItemType.Pet5, i)); } for (byte i = 0; i < 24; i++) { // 寵物血量 plew.WriteInt(chr.Pets.Hp((byte)InventoryType.ItemType.Pet5, i)); } for (byte i = 0; i < 24; i++) { // 寵物經驗值 plew.WriteInt(chr.Pets.Exp((byte)InventoryType.ItemType.Pet5, i)); } for (int i = 0; i < 24; i++) { // plew.WriteInt(chr.Pets.Mp((byte)InventoryType.ItemType.Pet5, i)); } for (int i = 0; i < 24; i++) { // 截止日期 plew.WriteInt(-1); } for (byte i = 0; i < 24; i++) { // plew.WriteShort(chr.Pets.ItemID((byte)InventoryType.ItemType.Pet5, i) == 0 ? 0 : 1); } for (int i = 0; i < 24; i++) { // plew.WriteInt(0); } for (int i = 0; i < 24; i++) { // 物品Lock plew.WriteByte(0); } for (int i = 0; i < 24; i++) { // plew.WriteInt(0); } for (int i = 0; i < 24; i++) { // 物品Icon plew.WriteShort(0); } c.Send(plew); } }
public override void Serialize(OutPacket packet) { packet.WriteByte(Type); packet.WriteShort((short)Position.X); packet.WriteShort((short)Position.Y); packet.WriteByte(Newstate); packet.WriteShort((byte)Duration); }
public new void Serialize(OutPacket packet) { packet.WriteByte(Type); packet.WriteShort((short)Position.X); packet.WriteShort((short)Position.Y); packet.WriteShort((short)PixelsPerSecond.X); packet.WriteShort((short)PixelsPerSecond.Y); packet.WriteByte(Newstate); }
private static void AddCharEntry(OutPacket p, MapleCharacter chr) { AddCharStats(p, chr); AddCharLook(p, chr, false); p.WriteByte(0x00); if (chr.Job == MapleJob.Gm) { p.WriteByte(0x02); } }
public override void Serialize(OutPacket packet) { packet.WriteByte(Type); packet.WriteShort((short)Position.X); packet.WriteShort((short)Position.Y); packet.WriteShort((short)PixelsPerSecond.X); packet.WriteShort((short)PixelsPerSecond.Y); packet.WriteShort(Unk); packet.WriteByte(Newstate); packet.WriteShort(Duration); }
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()); } }
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()); } }
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()); }
public static void updateSkillLevel(Client c, short skillBonus, byte type, byte slot, byte level) { using (OutPacket plew = new OutPacket(ServerOpcode.SKILL_LEVELUP_ACK)) { plew.WriteInt(0); // length + CRC plew.WriteInt(0); plew.WriteShort(skillBonus); plew.WriteByte(type); plew.WriteByte(slot); plew.WriteByte(level); c.Send(plew); } }
public static void getCharactersData(OutPacket plew, Character chr) { plew.WriteString(chr != null ? chr.Name : "", 20); plew.WriteString(chr != null ? chr.Title : "", 20); plew.WriteByte(chr != null ? chr.Gender : 0); plew.WriteByte(chr != null ? chr.Level : 0); plew.WriteByte(chr != null ? chr.Class : 0); plew.WriteByte(chr != null ? chr.ClassLevel : 0); plew.WriteByte(0); plew.WriteByte(0); plew.WriteByte(0); plew.WriteByte(0); plew.WriteShort(0); plew.WriteShort(0); Dictionary <InventoryType.EquipType, int> equip = getEquip(chr); plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Weapon) ? equip[InventoryType.EquipType.Weapon] : 0); // 武器[Weapon] 8010101 plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Outfit) ? equip[InventoryType.EquipType.Outfit] : 0); // [Outfit] 8160351 plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Face) ? equip[InventoryType.EquipType.Face] : 0); // 臉下[face2] 9410021 plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Face2) ? equip[InventoryType.EquipType.Face2] : 0); // 臉上[face] 8710013 plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Hat) ? equip[InventoryType.EquipType.Hat] : 0); // 帽子[hat] 8610011 plew.WriteInt(chr != null ? chr.Eyes : 0); // 眼睛[eye] 9110011 plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Mantle) ? equip[InventoryType.EquipType.Mantle] : 0); // 服裝[outfit] 9510081 plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Dress) ? equip[InventoryType.EquipType.Dress] : 0); // 披風[mantle] 8493122 plew.WriteInt(chr != null ? chr.Hair : 0); // 頭髮[Hair] 9010011 }
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()); }
public static OutPacket ServerList(int[] channelUserLogged) { using (var packet = new OutPacket(SendOpcodes.Serverlist)) { packet.WriteByte(0); //serverid packet.WriteMapleString(ServerSettings.ServerName); packet.WriteByte(0x03); //0: 正常 1: 火爆 2: 热 3: 新开 packet.WriteMapleString(ServerSettings.ServerName); //eventmsg packet.WriteByte(0x64); packet.WriteByte(0x00); packet.WriteByte(0x64); packet.WriteByte(0x00); packet.WriteByte(ServerSettings.ChannelCount); packet.WriteInt(500); for (var i = 0; i < ServerSettings.ChannelCount; i++) { var load = channelUserLogged[i]; packet.WriteMapleString(ServerSettings.ServerName + "-" + (i + 1)); packet.WriteInt(load); packet.WriteByte(0x00); //serverid packet.WriteShort((short)i); } packet.WriteShort(0); return(packet); } }
public static void PartyUpdate(Client c) { using (OutPacket plew = new OutPacket(ServerOpcode.PARTY_UPDATE)) { var chr = c.Character; plew.WriteInt(0); // length + CRC plew.WriteInt(0); for (int i = 0; i < 6; i++) { // 個人 + 其他 5 名隊員 plew.WriteInt(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.CharacterID : -1); plew.WriteShort(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.Level : 0); plew.WriteString((i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.Name : ""), 20); plew.WriteShort(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.MaxHp : 0); plew.WriteShort(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.Hp : 0); plew.WriteShort(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.MaxMp : 0); plew.WriteShort(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.Mp : 0); // 尚未確認 plew.WriteHexString("1F 40"); plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[0] : 0); plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[1] : 0); plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[2] : 0); plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[3] : 0); plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[0] : 0); plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[1] : 0); plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[2] : 0); plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[3] : 0); } c.Send(plew); } }
public static void UpdateQuest(Client c, int MonsterCount, int QuestID, byte StateA, byte StateB) { using (OutPacket plew = new OutPacket(ServerOpcode.QUEST_UPDATE)) { plew.WriteInt(0); // length + CRC plew.WriteInt(0); plew.WriteInt(MonsterCount); plew.WriteInt(0); plew.WriteInt(0); plew.WriteShort(QuestID); plew.WriteByte(StateA); plew.WriteByte(StateB); c.Send(plew); } }
public static void AddInventory(OutPacket p, Character c) { p.WriteInt(c.Meso); //cash equips p.WriteByte(0); //reg equips p.WriteByte(0); for (int i = InventorySlot.Equip; i < InventorySlot.Equipped; i++) { p.WriteByte(c.Inventory[i].SlotLimit); //invetory items p.WriteByte(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()); }
public static void HandleWorldSelect(MapleClient client, InPacket iPacket) { iPacket.Skip(1); client.World = iPacket.ReadByte(); client.Channel = iPacket.ReadByte(); byte characterCount = (byte)(long)Database.Scalar("SELECT COUNT(*) FROM `characters` WHERE `account_id` = @account_id", new MySqlParameter("@account_id", client.Account.ID)); using (OutPacket oPacket = new OutPacket(SendOps.SelectWorldResult)) { oPacket .WriteBool(false) .WriteByte(characterCount); if (characterCount > 0) { using (DatabaseQuery query = Database.Query("SELECT * FROM `characters` WHERE `account_id` = @account_id AND `world_id` = @world_id", new MySqlParameter("@account_id", client.Account.ID), new MySqlParameter("world_id", client.World))) { while (query.NextRow()) { LoginHandler.AddCharacterEntry(oPacket, query); } } } oPacket .WriteByte(2) .WriteInt(3); // TODO: Account specific character creation slots. For now, use default 3. client.Send(oPacket); } }
/// <summary> /// Sends the initial patch data packet to the socket. /// </summary> /// <param name="version">The version's information</param> /// <param name="patchLocation">The patch data URL</param> public void SendPatchData(Version version, string patchLocation) { //F**k!!!!! Random rnd = new Random(); uint val_first = 0; //(uint)rnd.Next(); uint val_second = 0; //(uint)rnd.Next() ; using (OutPacket outPacket = new OutPacket()) { outPacket.WriteHexString("80 05 2B 28"); // NOTE: Header. Do not change. Probably typeid() of handler. outPacket.WriteShort(version.Localisation); outPacket.WriteShort(version.Major); outPacket.WriteShort(version.Minor); outPacket.WriteString(patchLocation); outPacket.WriteInt((int)val_first); // NOTE: IV Keys. Should we do random stuffs? outPacket.WriteInt((int)val_second); outPacket.WriteByte(0xE0); // NOTE: Some stuff used on Region / Service Area. outPacket.WriteHexString("03 00 09 03 00 00 03 00 00 00 00 00 83 A3 E5 47 00 00 15 00 0D 00 00 00 03 00 00 00 00 00 65"); this.Send(outPacket); } riv = val_first ^ val_second; siv = val_first ^ val_second; }
public void OnChangeEquipInRoom(ClientSession cs, InPacket ip) { if (cs.CurrentRoom == null) { return; } using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_CHANGE_LOOK_EQUIP_NOT)) { oPacket.WriteInt(cs.LoginUID); oPacket.WriteInt(cs.MyCharacter.MyChar.Length); for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++) { oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType); oPacket.WriteInt(0); // 00 00 00 00 } for (int i = 0; i < 6; i++) { if (cs.CurrentRoom.Slot[i].Active == true) { oPacket.CompressAndAssemble(cs.CurrentRoom.Slot[i].cs.CRYPT_KEY, cs.CurrentRoom.Slot[i].cs.CRYPT_HMAC, cs.CurrentRoom.Slot[i].cs.CRYPT_PREFIX, cs.CurrentRoom.Slot[i].cs.CRYPT_COUNT); cs.CurrentRoom.Slot[i].cs.Send(oPacket); oPacket.CancelAssemble(); } } } }