Ejemplo n.º 1
0
        public override void EncodeData(IPacket packet)
        {
            packet.Encode <Point>(Position);
            packet.Encode <short>(Foothold);

            base.EncodeData(packet);
        }
Ejemplo n.º 2
0
 public override void EncodeData(IPacket packet)
 {
     packet.Encode <string>(_text);
     packet.Encode <int>(_def);
     packet.Encode <int>(_min);
     packet.Encode <int>(_max);
 }
Ejemplo n.º 3
0
        public override void EncodeData(IPacket packet)
        {
            packet.Encode <Point>(Position);
            packet.Encode <Point>(VPosition);

            base.EncodeData(packet);
        }
Ejemplo n.º 4
0
        public void EncodeItems(IPacket packet, DbChar flags = DbChar.All)
        {
            packet.Encode <byte>((byte)_trunk.SlotMax);
            packet.Encode <long>((long)flags);

            if (flags.HasFlag(DbChar.Money))
            {
                packet.Encode <int>(_trunk.Money);
            }
            new Dictionary <DbChar, ItemInventoryType>
            {
                [DbChar.ItemSlotEquip]   = ItemInventoryType.Equip,
                [DbChar.ItemSlotConsume] = ItemInventoryType.Consume,
                [DbChar.ItemSlotInstall] = ItemInventoryType.Install,
                [DbChar.ItemSlotEtc]     = ItemInventoryType.Etc,
                [DbChar.ItemSlotCash]    = ItemInventoryType.Cash
            }
            .Where(kv => flags.HasFlag(kv.Key))
            .ForEach(kv =>
            {
                var items = User.AccountData.Trunk.Items.Values
                            .Where(i => (ItemInventoryType)(i.TemplateID / 1000000) == kv.Value)
                            .ToList();

                packet.Encode <byte>((byte)items.Count);
                items.ForEach(i => i.Encode(packet));
            });
        }
Ejemplo n.º 5
0
        public static void Encode(this ItemSlotPet i, IPacket p)
        {
            p.Encode <byte>(3);

            i.EncodeBase(p);

            p.EncodeFixedString(i.PetName, 13);
            p.Encode <byte>(i.Level);
            p.Encode <short>(i.Tameness);
            p.Encode <byte>(i.Repleteness);

            if (i.DateDead == null)
            {
                p.Encode <long>(0);
            }
            else
            {
                p.Encode <DateTime>(i.DateDead.Value);
            }

            p.Encode <short>(i.PetAttribute);
            p.Encode <short>(i.PetSkill);
            p.Encode <int>(i.RemainLife);
            p.Encode <short>(i.Attribute);
        }
Ejemplo n.º 6
0
 public override void EncodeData(IPacket packet)
 {
     packet.Encode <string>(_text);
     packet.Encode <string>(_def);
     packet.Encode <short>(_cols);
     packet.Encode <short>(_rows);
 }
Ejemplo n.º 7
0
 public override void EncodeData(IPacket packet)
 {
     packet.Encode <string>(_text);
     packet.Encode <string>(_def);
     packet.Encode <short>(_lenMin);
     packet.Encode <short>(_lenMax);
 }
Ejemplo n.º 8
0
 public static void Encode(this CoupleRecord c, IPacket p)
 {
     p.Encode <int>(c.PairCharacterID);
     p.EncodeFixedString(c.PairCharacterName, 13);
     p.Encode <long>(c.SN);
     p.Encode <long>(c.PairSN);
 }
Ejemplo n.º 9
0
        protected override void EncodeData(IPacket packet)
        {
            packet.Encode <byte>(1);

            packet.Encode <bool>(Failed);
            packet.Encode <int>(Money);
            packet.Encode <short>(PremiumIPMesoBonus);
        }
        public void Encode(IPacket packet)
        {
            packet.Encode <byte>((byte)Type);
            packet.Encode <byte>((byte)_inventory);
            packet.Encode <short>(_slot);

            EncodeData(packet);
        }
Ejemplo n.º 11
0
 public static void Encode(this FriendRecord f, IPacket p)
 {
     p.Encode <int>(f.PairCharacterID);
     p.EncodeFixedString(f.PairCharacterName, 13);
     p.Encode <long>(f.SN);
     p.Encode <long>(f.PairSN);
     p.Encode <int>(f.FriendItemID);
 }
Ejemplo n.º 12
0
 public void Encode(IPacket packet)
 {
     packet.Encode <short>(Option);
     packet.Encode <int>(TemplateID);
     packet.Encode <int>(DateExpire.HasValue
         ? (int)(DateExpire.Value - DateTime.Now).TotalMilliseconds
         : int.MaxValue);
 }
Ejemplo n.º 13
0
        public void Encode(IPacket packet)
        {
            packet.Encode <Point>(Position);
            packet.Encode <Point>(VPosition);

            packet.Encode <byte>((byte)_fragments.Count);
            _fragments.ForEach(f => f.Encode(packet));
        }
Ejemplo n.º 14
0
        protected override void EncodeData(IPacket packet)
        {
            packet.Encode <int>(_skillTemplateID);
            packet.Encode <byte>(0);
            packet.Encode <byte>(_skillLevel);

            _additional?.Invoke(packet);
        }
Ejemplo n.º 15
0
 public static void EncodeExtendSP(this Character c, IPacket p)
 {
     p.Encode <byte>((byte)c.ExtendSP.Count);
     c.ExtendSP.ForEach(kv =>
     {
         p.Encode <byte>(kv.Key);
         p.Encode <byte>(kv.Value);
     });
 }
Ejemplo n.º 16
0
 protected override void EncodeData(IPacket packet)
 {
     packet.Encode <byte>((byte)_entries.Count);
     _entries.ForEach(e =>
     {
         packet.Encode <int>(e.Item1);
         packet.Encode <int>(e.Item2);
     });
 }
        public void Encode(IPacket packet)
        {
            packet.Encode <byte>(0); // SpeakerTypeID
            packet.Encode <int>(Speaker.TemplateID);
            packet.Encode <byte>((byte)Type);
            packet.Encode <byte>((byte)Speaker.ParamType);

            EncodeData(packet);
        }
Ejemplo n.º 18
0
 protected override void EncodeData(IPacket packet)
 {
     if (Speaker.Param.HasFlag(ScriptMessageParam.NPCReplacedByNPC))
     {
         packet.Encode <int>(Speaker.TemplateID);
     }
     packet.Encode <string>(_text);
     packet.Encode <bool>(_prev);
     packet.Encode <bool>(_next);
 }
Ejemplo n.º 19
0
 public override void EncodeData(IPacket packet)
 {
     if (Speaker.ParamType.HasFlag(SpeakerParamType.NPCReplacedByNPC))
     {
         packet.Encode <int>(Speaker.TemplateID);
     }
     packet.Encode <string>(_text);
     packet.Encode <bool>(_prev);
     packet.Encode <bool>(_next);
 }
Ejemplo n.º 20
0
 public static void EncodeBase(this ItemSlot i, IPacket p)
 {
     p.Encode <int>(i.TemplateID);
     p.Encode <bool>(i.CashItemSN.HasValue);
     if (i.CashItemSN.HasValue)
     {
         p.Encode <long>(i.CashItemSN.Value);
     }
     p.Encode <DateTime>(i.DateExpire ?? ItemConstants.Permanent);
 }
Ejemplo n.º 21
0
 public void Encode(IPacket packet)
 {
     packet.Encode <short>((short)_records.Count);
     _records.ForEach(kv =>
     {
         packet.Encode <int>(kv.Key);
         packet.Encode <int>(kv.Value.Level);
         packet.Encode <int>(kv.Value.MasterLevel);
         packet.Encode <DateTime>(kv.Value.DateExpire ?? ItemConstants.Permanent);
     });
 }
Ejemplo n.º 22
0
        public override void EncodeData(IPacket packet)
        {
            packet.Encode <Point>(Position);
            packet.Encode <Point>(VPosition);
            packet.Encode <short>(Foothold);
            if (Attribute == MovePathAttribute.FallDown)
            {
                packet.Encode <short>(FallStartFoothold);
            }
            packet.Encode <Point>(Offset);

            base.EncodeData(packet);
        }
Ejemplo n.º 23
0
        public static void Encode(this ItemSlotBundle i, IPacket p)
        {
            p.Encode <byte>(2);

            i.EncodeBase(p);

            p.Encode <short>(i.Number);
            p.Encode <string>(i.Title);
            p.Encode <short>(i.Attribute);

            if (ItemConstants.IsRechargeableItem(i.TemplateID))
            {
                p.Encode <long>(0);
            }
        }
Ejemplo n.º 24
0
        public static void EncodeForRemote(IPacket 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
        }
Ejemplo n.º 25
0
        public void Encode(IPacket packet)
        {
            var operations = _inventories.Values.SelectMany(v => v.Operations).ToList();

            packet.Encode<byte>((byte) operations.Count);
            operations.ForEach(o => o.Encode(packet));
        }
Ejemplo n.º 26
0
        public void SendPacket(IPacket packet)
        {
            try {
                packet.Encode();
                MemoryStream packetBlock = new MemoryStream();
                Int32        packetLen   = sizeof(Int32) + (Int32)packet.GetStream().Length;

                Byte[] packetHeader = BitConverter.GetBytes(packetLen);
                PacketObfuscation.EncodeHeader(ref packetHeader, (int)packetHeader.Length);
                packetBlock.Write(packetHeader, 0, (Int32)packetHeader.Length);

                Byte[] packetData = packet.GetStream().ToArray();
                PacketObfuscation.EncodeData(ref packetData, (int)packetData.Length);
                packetBlock.Write(packetData, 0, (Int32)packetData.Length);

                Byte[] packetBytes = packetBlock.ToArray();
                _Stream.Write(packetBytes, 0, (int)packetBlock.Length);
                _Stream.Flush();
            } catch (Exception e) {
                if (IsConnected())
                {
                    MessageBox.Show("잘못된 처리: " + e.ToString(), "error", MessageBoxButtons.OK);
                    Application.Exit();
                }
            }
        }
Ejemplo n.º 27
0
        public void EncodeRemote(IPacket packet, int size)
        {
            switch (size)
            {
            case 1:
                packet.Encode <byte>((byte)Option);
                break;

            case 2:
                packet.Encode <short>(Option);
                break;

            case 4:
                packet.Encode <int>(Option);
                break;
            }
        }
Ejemplo n.º 28
0
 public static void SendPacket(IWebSocketConnection connection, IPacket packet)
 {
     lock (_sync)
     {
         var msg = packet.Encode();
         connection.Send(msg);
     }
 }
Ejemplo n.º 29
0
        public static void EncodeRemote(this IDictionary <TemporaryStatType, TemporaryStat> stats, IPacket packet)
        {
            stats.EncodeMask(packet);

            TemporaryStatOrder.EncodingOrderRemote.ForEach(kv =>
            {
                if (!stats.ContainsKey(kv.Key))
                {
                    return;
                }
                kv.Value.Invoke(stats[kv.Key], packet);
            });

            packet.Encode <byte>(0); // nDefenseAtt
            packet.Encode <byte>(0); // nDefenseState

            EncodeTwoState(stats, packet);
        }
Ejemplo n.º 30
0
 public void EncodeData(IPacket packet)
 {
     packet.Encode <int>(Item.TemplateID);
     packet.Encode <string>(Item.PetName);
     packet.Encode <long>(Item.CashItemSN ?? 0);
     packet.Encode <Point>(Position);
     packet.Encode <byte>(MoveAction);
     packet.Encode <short>(Foothold);
     packet.Encode <bool>(NameTag);
     packet.Encode <bool>(ChatBalloon);
 }