public byte[] CreateCharacter(int accountId, byte worldId, bool isMaster, byte[] data) { using (OutPacket outPacket = new OutPacket(InteroperabilityMessage.CharacterCreationRequest)) { outPacket.WriteInt(accountId); outPacket.WriteByte(worldId); outPacket.WriteBool(isMaster); outPacket.WriteBytes(data); this.RandomChannel.Send(outPacket); } return(this.CharacterCreationPool.Dequeue(accountId)); }
public bool SendCommandSync(int channel, string command, JToken payload) { var packet = new OutPacket { channel = channel, command = command, payload = payload }; var encoding = new UTF8Encoding(); var rawData = encoding.GetBytes(JsonConvert.SerializeObject(packet)); return(SendData(rawData)); }
public static void Encode(this ItemSlot i, OutPacket p) { p.Encode <int>(i.TemplateID); p.Encode <bool>(false); if (i.DateExpire == null) { p.Encode <long>(0); } else { p.Encode <DateTime>(i.DateExpire.Value); } }
public static void SendCommand(string target, string command, string payload) { var packet = new OutPacket { target = target, command = command, payload = payload }; var encoding = new UTF8Encoding(); var rawData = encoding.GetBytes(JsonUtility.ToJson(packet)); SendData(rawData); }
public Task ModifySkill(Action <ModifySkillContext> action = null, bool exclRequest = false) { var context = new ModifySkillContext(Character); action?.Invoke(context); ValidateStat(); using (var p = new OutPacket(GameSendOperations.ChangeSkillRecordResult)) { p.Encode <bool>(exclRequest); context.Encode(p); p.Encode <bool>(true); return(SendPacket(p)); } }
/// <summary> /// 添加一个输出包 /// </summary> /// <param name="outPacket">The out packet.</param> /// <param name="monitor">The monitor. true为同步发送,false为异步发送</param> public void Send(OutPacket outPacket, bool monitor) { //记录发送历史 policy.PutSent(outPacket); //outPacketQueue.Enqueue(outPacket); if (monitor) { SendData(this.socket, outPacket); } else { BeginSendData(this.socket, outPacket); } }
public void Migrate(bool valid, short port) { using (OutPacket oPacket = new OutPacket(SendOps.MigrateCommand)) { oPacket .WriteBool(valid) .WriteBytes(new byte[4] { 127, 0, 0, 1 }) .WriteShort(port); this.Send(oPacket); } }
/// <summary>通过指定port发送一个包 /// <remark>abu 2008-03-07 </remark> /// </summary> /// <param name="packet">The packet.</param> /// <param name="port">The port.</param> /// <param name="monitor">if set to <c>true</c> [monitor].</param> public void SendPacket(OutPacket packet, string port, bool monitor) { if (QQClient.QQUser.IsLoggedIn) { if (QQClient.ConnectionManager.EnsureConnection(port, true)) { QQClient.ConnectionManager.ConnectionPool.Send(port, packet, monitor); } else { OnLostConnection(new QQEventArgs <InPacket, OutPacket>(QQClient, null, packet)); } } }
private void OnMigrateIn(InPacket packet) { var characterID = packet.Decode <int>(); if (!WvsGame.PendingMigrations.Remove(characterID)) { Channel.CloseAsync(); return; } using (var db = _container.GetInstance <DataContext>()) { var character = db.Characters .Include(c => c.Data) .ThenInclude(a => a.Account) .Include(c => c.FunctionKeys) .Include(c => c.Inventories) .ThenInclude(c => c.Items) .Include(c => c.SkillRecords) .Single(c => c.ID == characterID); character.Data.Account.State = AccountState.LoggedIn; db.Update(character); db.SaveChanges(); var field = WvsGame.FieldFactory.Get(character.FieldID); var fieldUser = new FieldUser(this, character); Random = new Rand32(0x0, 0x0, 0x0); FieldUser = fieldUser; field.Enter(fieldUser); using (var p = new OutPacket(GameSendOperations.FuncKeyMappedInit)) { var functionKeys = character.FunctionKeys; p.Encode <bool>(false); for (var i = 0; i < 90; i++) { var functionKey = functionKeys.SingleOrDefault(f => f.Key == i); p.Encode <byte>(functionKey?.Type ?? 0); p.Encode <int>(functionKey?.Action ?? 0); } SendPacket(p); } } }
public static void Encode(this ItemSlotBundle i, OutPacket p) { p.Encode <byte>(2); (i as ItemSlot).Encode(p); p.Encode <short>(i.Number); p.Encode <string>(i.Title); p.Encode <short>(i.Attribute); if (ItemInfo.IsRechargeableItem(i.TemplateID)) { p.Encode <long>(0); } }
public static void UpdateExp(Client c) { using (OutPacket plew = new OutPacket(ServerOpcode.CHAR_LVEXP)) { var chr = c.Character; plew.WriteInt(0); // length + CRC plew.WriteInt(0); plew.WriteInt(chr.Level); plew.WriteInt(chr.Exp); plew.WriteInt(0); plew.WriteInt(0); plew.WriteInt(0); 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 ClearDropItem(Client c, int cid, int oid, int iid) { using (OutPacket plew = new OutPacket(ServerOpcode.CLEAR_DROP_ITEM)) { // 4D 00 4E 00 // + 0 plew.WriteInt(0); // length + CRC // + 4 plew.WriteInt(0); // + 8 plew.WriteInt(cid); // 角色 id // + 12 plew.WriteInt(oid); // 掉落 id // + 16 plew.WriteInt(iid); // 物品 id // + 20 plew.WriteHexString("00 01 FF FF"); // + 24 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 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 void DoYellChat() { Log("Yell: "); var message = Game.UI.ReadLine(); var response = new OutPacket(WorldCommand.CMSG_MESSAGECHAT); response.Write((uint)ChatMessageType.Yell); var race = Game.World.SelectedCharacter.Race; var language = race.IsHorde() ? Language.Orcish : Language.Common; response.Write((uint)language); response.Write(message.ToCString()); Game.SendPacket(response); }
public override void Exit() { if (LoggedIn) { OutPacket logout = new OutPacket(WorldCommand.CMSG_LOGOUT_REQUEST); SendPacket(logout); loggedOutEvent.WaitOne(); } else { Connected = false; LoggedIn = false; Running = false; } }
private void OnUserEmotion(InPacket packet) { var emotion = packet.Decode <int>(); var duration = packet.Decode <int>(); var byItemOption = packet.Decode <bool>(); using (var p = new OutPacket(GameSendOperations.UserEmotion)) { p.Encode <int>(ID); p.Encode <int>(emotion); p.Encode <int>(duration); p.Encode <bool>(byItemOption); Field.BroadcastPacket(this, p); } }
public override void Encode(OutPacket packet) { base.Encode(packet); switch (_item) { case ItemSlotEquip equip: equip.Encode(packet); break; case ItemSlotBundle bundle: bundle.Encode(packet); break; } }
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()); } }
public void CompleteMission(ClientSession cs, InPacket ip) { int missionID = ip.ReadInt(); using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_COMPLETE_MISSION_ACK)) { oPacket.WriteInt(0); oPacket.WriteInt(missionID); oPacket.WriteHexString("00 00 01 F8 00 00 00 11 00 00 00 01 00 00 22 B0 00 00 00 01 30 B2 5C A2 00 00 00 09 00 00 00 09 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 57 AD 34 74 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 00 0D 00 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 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 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 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 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 4E 00 00 00 07 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 08 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 09 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0A 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0B 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0C 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0D 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0E 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0F 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 10 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 11 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 12 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 27 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 28 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 29 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 2A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 37 00 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 51 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 54 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 56 00 00 00 00 00 00 00 00 00 00 00 00 00 00 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 59 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5A 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 5B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 A0"); 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 override async Task Exit() { if (LoggedIn) { OutPacket logout = new OutPacket(WorldCommand.CMSG_LOGOUT_REQUEST); SendPacket(logout); await loggedOutEvent.Task; } else { Connected = false; LoggedIn = false; Running = false; } }
public static void PartyHpUpdate(Client c) { using (OutPacket plew = new OutPacket(ServerOpcode.PARTY_HP_UPDATE)) { var chr = c.Character; plew.WriteInt(0); // length + CRC plew.WriteInt(0); plew.WriteInt(chr.CharacterID); plew.WriteShort(chr.MaxHp); plew.WriteShort(chr.Hp); plew.WriteShort(chr.MaxMp); plew.WriteShort(chr.Mp); // 尚未確認 c.Send(plew); } }
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 EncodeForRemote(OutPacket packet, ICollection <TemporaryStatEntry> stats) { EncodeMask(packet, stats); var dictionary = stats.ToDictionary(s => s.Type, s => s); dictionary.GetValueOrDefault(TemporaryStatType.Speed)?.EncodeRemote(packet, 1); dictionary.GetValueOrDefault(TemporaryStatType.ComboCounter)?.EncodeRemote(packet, 1); dictionary.GetValueOrDefault(TemporaryStatType.WeaponCharge)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.Stun)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.Darkness)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.Seal)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.Weakness)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.Curse)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.Poison)?.EncodeRemote(packet, 2); dictionary.GetValueOrDefault(TemporaryStatType.Poison)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.ShadowPartner)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.Morph)?.EncodeRemote(packet, 2); dictionary.GetValueOrDefault(TemporaryStatType.Ghost)?.EncodeRemote(packet, 2); dictionary.GetValueOrDefault(TemporaryStatType.Attract)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.SpiritJavelin)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.BanMap)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.Barrier)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.DojangShield)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.ReverseInput)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.RespectPImmune)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.RespectMImmune)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.DefenseAtt)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.DefenseState)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.RepeatEffect)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.StopPortion)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.StopMotion)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.Fear)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.MagicShield)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.Frozen)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.SuddenDeath)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.FinalCut)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.Cyclone)?.EncodeRemote(packet, 1); dictionary.GetValueOrDefault(TemporaryStatType.Mechanic)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.DarkAura)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.BlueAura)?.EncodeRemote(packet, 4); dictionary.GetValueOrDefault(TemporaryStatType.YellowAura)?.EncodeRemote(packet, 4); packet.Encode <byte>(0); // nDefenseAtt packet.Encode <byte>(0); // nDefenseState // TODO: TwoState }
public static void Encode(this ItemSlotEquip i, OutPacket p) { p.Encode <byte>(1); (i as ItemSlot).Encode(p); p.Encode <byte>(i.RUC); p.Encode <byte>(i.CUC); p.Encode <short>(i.STR); p.Encode <short>(i.DEX); p.Encode <short>(i.INT); p.Encode <short>(i.LUK); p.Encode <short>(i.MaxHP); p.Encode <short>(i.MaxMP); p.Encode <short>(i.PAD); p.Encode <short>(i.MAD); p.Encode <short>(i.PDD); p.Encode <short>(i.MDD); p.Encode <short>(i.ACC); p.Encode <short>(i.EVA); p.Encode <short>(i.Craft); p.Encode <short>(i.Speed); p.Encode <short>(i.Jump); p.Encode <string>(i.Title); p.Encode <short>(i.Attribute); p.Encode <byte>(i.LevelUpType); p.Encode <byte>(i.Level); p.Encode <int>(i.EXP); p.Encode <int>(i.Durability); p.Encode <int>(i.IUC); p.Encode <byte>(i.Grade); p.Encode <byte>(i.CHUC); p.Encode <short>(i.Option1); p.Encode <short>(i.Option2); p.Encode <short>(i.Option3); p.Encode <short>(i.Socket1); p.Encode <short>(i.Socket2); p.Encode <long>(0); p.Encode <long>(0); p.Encode <int>(0); }
public static void getStoreInfo(Client c) { using (OutPacket plew = new OutPacket(ServerOpcode.STORE_INFO)) { var chr = c.Character; plew.WriteInt(0); // length + CRC plew.WriteInt(0); plew.WriteInt(0); for (byte i = 0; i < 46; i++) { plew.WriteInt(chr.Storages.ItemID(InventoryType.ItemType.Equip, i)); plew.WriteByte(chr.Storages.Fusion(InventoryType.ItemType.Equip, i)); plew.WriteByte(chr.Storages.Level1(InventoryType.ItemType.Equip, i)); plew.WriteByte(chr.Storages.Level2(InventoryType.ItemType.Equip, i)); plew.WriteByte(chr.Storages.Level3(InventoryType.ItemType.Equip, i)); plew.WriteByte(chr.Storages.Level4(InventoryType.ItemType.Equip, i)); plew.WriteByte(chr.Storages.Level5(InventoryType.ItemType.Equip, i)); plew.WriteByte(chr.Storages.Level6(InventoryType.ItemType.Equip, i)); plew.WriteByte(chr.Storages.Level7(InventoryType.ItemType.Equip, i)); plew.WriteByte(chr.Storages.Level8(InventoryType.ItemType.Equip, i)); plew.WriteByte(chr.Storages.Level9(InventoryType.ItemType.Equip, i)); plew.WriteByte(chr.Storages.Level10(InventoryType.ItemType.Equip, i)); plew.WriteByte(0); plew.WriteShort(chr.Storages.Spirit(InventoryType.ItemType.Equip, i)); // 封印量 v2 + 16 plew.WriteShort(chr.Storages.IsLocked(InventoryType.ItemType.Equip, i)); // Lock v2 + 18 plew.WriteInt(chr.Storages.Quantity(InventoryType.ItemType.Equip, i)); plew.WriteInt(0); plew.WriteInt(-1); plew.WriteInt(0); // 力量 plew.WriteInt(0); plew.WriteInt(0); // 提煉所剩回數 plew.WriteInt(0); plew.WriteInt(0); plew.WriteShort(0); // 未知 plew.WriteInt(0); plew.WriteInt(0); plew.WriteInt(0); plew.WriteInt(0); plew.WriteInt(0); plew.WriteShort(0); plew.WriteInt(0); plew.WriteInt(0); plew.WriteInt(0); } c.Send(plew); } }
public void Encode(OutPacket packet) { packet.Encode <byte>(ID); packet.Encode <string>(Name); packet.Encode <byte>(State); packet.Encode <string>(EventDesc); packet.Encode <short>(EventEXP); packet.Encode <short>(EventDrop); packet.Encode <bool>(BlockCharCreation); packet.Encode <byte>((byte)Channels.Count); foreach (var channelInformation in Channels) { channelInformation.Encode(packet); } }
public static void EncodeMask(OutPacket packet, ICollection <TemporaryStatEntry> stats) { var mask = new int[4]; stats.ForEach(s => { var flag = 1 << ((int)s.Type % 0x20); var index = (int)s.Type / 32; mask[index] |= flag; }); for (var i = 4; i > 0; i--) { packet.Encode <int>(mask[i - 1]); } }
public void NotifySHAFile(ClientSession cs) { using (OutPacket oPacket = new OutPacket(CenterOpcodes.ENU_SHAFILENAME_LIST_ACK)) { oPacket.WriteInt(0); oPacket.WriteInt(SHAFileList.Length); for (int i = 0; i <= SHAFileList.Length - 1; i++) { oPacket.WriteInt(SHAFileList[i].Length * 2); oPacket.WriteUnicodeString(SHAFileList[i]); } oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } }
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()); } } } }
protected override void Write(OutPacket data) { }