Exemplo n.º 1
0
 public static byte[] CharacterInfo(SocketClient Client)
 {
     int Length = 74 + 0 + Client.Character.Name.Length + 1;
     Writer PWR = new Writer(Length);
     PWR.Fill((ushort)Length, 0);
     PWR.Fill((ushort)1006, 2);
     PWR.Fill(Client.UniqueID, 4);
     PWR.Fill(Client.Character.FullModel, 8);
     PWR.Fill(Client.Character.HairStyle, 12);
     PWR.Fill(Client.Character.Silver, 14);
     PWR.Fill(Client.Character.CPs, 18);
     PWR.Fill(Client.Character.Experience, 22);
     PWR.Fill((ushort)5130, 42);
     PWR.Fill(Client.Character.Strength, 46);
     PWR.Fill(Client.Character.Agility, 48);
     PWR.Fill(Client.Character.Vitality, 50);
     PWR.Fill(Client.Character.Spirit, 52);
     PWR.Fill(Client.Character.StatPoints, 54);
     PWR.Fill(Client.Character.HitPoints, 56);
     PWR.Fill(Client.Character.Mana, 58);
     PWR.Fill(Client.Character.PKPoints, 60);
     PWR.Fill(Client.Character.Level, 62);
     PWR.Fill(Client.Character.Class, 63);
     PWR.Fill((byte)5, 64);
     PWR.Fill(Client.Character.RBCount, 65);
     PWR.Fill((byte)1, 66);
     PWR.Fill((byte)2, 67);
     PWR.Fill((byte)Client.Character.Name.Length, 68);
     PWR.Fill(Client.Character.Name, 69);
     return PWR.Bytes;
 }
Exemplo n.º 2
0
 public static byte[] ViewWarehouse(uint ActiveNPC)
 {
     Writer PWR = new Writer(16);
     PWR.Fill((ushort)16, 0);
     PWR.Fill((ushort)1102, 2);
     PWR.Fill((uint)ActiveNPC, 4);
     return PWR.Bytes;
 }
Exemplo n.º 3
0
 public static byte[] TeamPacket(uint UniqueID, Enums.TeamPacket Mode)
 {
     Writer PWR = new Writer(12);
     PWR.Fill((ushort)12, 0);
     PWR.Fill((ushort)1023, 2);
     PWR.Fill((uint)Mode, 4);
     PWR.Fill(UniqueID, 8);
     return PWR.Bytes;
 }
Exemplo n.º 4
0
 public static byte[] MapInfo(uint MapType, uint MapStatus)
 {
     Writer PWR = new Writer(16);
     PWR.Fill((ushort)16, 0);
     PWR.Fill((ushort)1110, 2);
     PWR.Fill(MapType, 4);
     PWR.Fill(MapType, 8);
     PWR.Fill(MapStatus, 12);
     return PWR.Bytes;
 }
Exemplo n.º 5
0
 public Item(uint ItemID)
 {
     Kernel.ItemTypes.TryGetValue(ItemID, out Info);
     writer = new Writer(48);
     writer.Fill((ushort)48, 0);
     writer.Fill((ushort)1008, 2);
     writer.Fill(ItemID, 8);
     writer.Fill(Info.MaxDurability, 14);
     Mode = Enums.ItemMode.Default;
 }
Exemplo n.º 6
0
 public static byte[] ProfPacket(uint ProfID, Profs.Prof Prof)
 {
     Writer PWR = new Writer(16);
     PWR.Fill((ushort)16, 0);
     PWR.Fill((ushort)1025, 2);
     PWR.Fill(ProfID, 4);
     PWR.Fill((uint)Prof.Level, 8);
     PWR.Fill(Prof.Experience, 12);
     return PWR.Bytes;
 }
Exemplo n.º 7
0
 public static byte[] SpellPacket(ushort ID, ushort Level, uint Experience)
 {
     Writer PWR = new Writer(12);
     PWR.Fill((ushort)12, 0);
     PWR.Fill((ushort)1103, 2);
     PWR.Fill(Experience, 4);
     PWR.Fill(ID, 8);
     PWR.Fill(Level, 10);
     return PWR.Bytes;
 }
Exemplo n.º 8
0
 public Item(ItemType Info)
 {
     this.Info = Info;
     writer = new Writer(48);
     writer.Fill((ushort)48, 0);
     writer.Fill((ushort)1008, 2);
     writer.Fill(Info.ID, 8);
     writer.Fill(Info.MaxDurability, 14);
     Mode = Enums.ItemMode.Default;
 }
Exemplo n.º 9
0
 public static byte[] SyncPacket(uint UniqueID, Enums.SyncType SyncType, uint Value)
 {
     Writer PWR = new Writer(20);
     PWR.Fill((ushort)20, 0);
     PWR.Fill((ushort)1017, 2);
     PWR.Fill(UniqueID, 4);
     PWR.Fill((uint)1, 8);
     PWR.Fill((uint)SyncType, 12);
     PWR.Fill(Value, 16);
     return PWR.Bytes;
 }
Exemplo n.º 10
0
 public static byte[] NPCTalk(int UK1, int ID, int LinkBack, int DT)
 {
     Writer PWR = new Writer(16);
     PWR.Fill((ushort)16, 0);
     PWR.Fill((ushort)2032, 2);
     PWR.Fill((uint)UK1, 4);
     PWR.Fill((ushort)ID, 8);
     PWR.Fill((byte)LinkBack, 10);
     PWR.Fill((byte)DT, 11);
     PWR.Fill((uint)0, 12);
     return PWR.Bytes;
 }
Exemplo n.º 11
0
 public static byte[] ItemUsage(uint UniqueID, uint ID, uint dwParam, uint dwExtraInfo)
 {
     Writer PWR = new Writer(24);
     PWR.Fill((ushort)24, 0);
     PWR.Fill((ushort)1009, 2);
     PWR.Fill(UniqueID, 4);
     PWR.Fill(dwParam, 8);
     PWR.Fill(ID, 12);
     PWR.Fill(Environment.TickCount, 16);
     PWR.Fill(dwExtraInfo, 20);
     return PWR.Bytes;
 }
Exemplo n.º 12
0
 public static byte[] MobMove(uint UID, byte Direction)
 {
     Writer PWR = new Writer(16);
     PWR.Fill((ushort)16, 0);
     PWR.Fill((ushort)1005, 2);
     PWR.Fill((uint)UID, 4);
     PWR.Fill((byte)Direction, 8);
     PWR.Fill((byte)1, 9);
     PWR.Fill((ushort)0, 10);
     PWR.Fill((int)Environment.TickCount, 12);
     return PWR.Bytes;
 }
Exemplo n.º 13
0
 public static byte[] StringPacket(uint UID, byte Type, byte Number, string name)
 {
     Writer PWR = new Writer(13 + name.Length);
     PWR.Fill((ushort)(13 + name.Length), 0);
     PWR.Fill((ushort)1015, 2);
     PWR.Fill(UID, 4);
     PWR.Fill(Type, 8);
     PWR.Fill(Number, 9);
     PWR.Fill((byte)name.Length, 10);
     PWR.Fill(name, 11);
     return PWR.Bytes;
 }
Exemplo n.º 14
0
 public static byte[] AddToTeamPacket(string Name, uint UniqueID, uint Model, ushort MaxHitPoints, ushort HitPoints)
 {
     Writer PWR = new Writer(36);
     PWR.Fill((ushort)36, 0);
     PWR.Fill((ushort)1026, 2);
     PWR.Fill((byte)Name.Length, 5);
     PWR.Fill(Name, 8);
     PWR.Fill(UniqueID, 24);
     PWR.Fill(Model, 28);
     PWR.Fill(MaxHitPoints, 32);
     PWR.Fill(HitPoints, 34);
     return PWR.Bytes;
 }
Exemplo n.º 15
0
 public static byte[] ItemDrop(Items.FloorItem I, ushort X, ushort Y, bool Remove)
 {
     Writer PWR = new Writer(21);
     PWR.Fill((ushort)21, 0);
     PWR.Fill((ushort)1101, 2);
     PWR.Fill(I.UniqueID, 4);
     PWR.Fill(I.ItemID, 8);
     PWR.Fill(X, 12);
     PWR.Fill(Y, 14);
     PWR.Fill((byte)(Remove ? 2 : 1), 16);
     PWR.Fill(Environment.TickCount, 17);
     return PWR.Bytes;
 }
Exemplo n.º 16
0
 public static byte[] Attack(uint AttackerUID, uint AttackedUID, ushort AttackedX, ushort AttackedY, uint Damage, Enums.AttackType AttackType)
 {
     Writer PWR = new Writer(28);
     PWR.Fill((ushort)28, 0);
     PWR.Fill((ushort)1022, 2);
     PWR.Fill(AttackerUID, 8);
     PWR.Fill(AttackedUID, 12);
     PWR.Fill(AttackedX, 16);
     PWR.Fill(AttackedY, 18);
     PWR.Fill((uint)AttackType, 20);
     PWR.Fill(Damage, 24);
     return PWR.Bytes;
 }
Exemplo n.º 17
0
 public static byte[] NPCTalk(byte LinkBack, byte DT, string Text)
 {
     Writer PWR = new Writer(16 + Text.Length);
     PWR.Fill((ushort)(16 + Text.Length), 0);
     PWR.Fill((ushort)2032, 2);
     PWR.Fill((uint)0, 4);
     PWR.Fill((byte)LinkBack, 10);
     PWR.Fill((byte)DT, 11);
     PWR.Fill((byte)1, 12);
     PWR.Fill((byte)Text.Length, 13);
     PWR.Fill(Text, 14);
     return PWR.Bytes;
 }
Exemplo n.º 18
0
 public static byte[] GeneralData(uint UniqueID, uint Value1, ushort Value2, ushort Value3, ushort Value4, Enums.GeneralData Type)
 {
     Writer PWR = new Writer(28);
     PWR.Fill((ushort)28, 0);
     PWR.Fill((ushort)1010, 2);
     PWR.Fill((int)Environment.TickCount, 4);
     PWR.Fill((uint)UniqueID, 8);
     PWR.Fill((uint)Value1, 12);
     PWR.Fill((ushort)Value2, 16);
     PWR.Fill((ushort)Value3, 18);
     PWR.Fill((ushort)Value4, 20);
     PWR.Fill((ushort)Type, 22);
     PWR.Fill((uint)0, 24);
     return PWR.Bytes;
 }
Exemplo n.º 19
0
 public static byte[] SingleSpellUse(uint EntityUID, uint TargetUID, uint Damage, ushort SkillID, ushort SkillLevel, ushort X, ushort Y)
 {
     Writer PWR = new Writer(28);
     PWR.Fill((ushort)28, 0);
     PWR.Fill((ushort)1105, 2);
     PWR.Fill(EntityUID, 4);
     PWR.Fill(X, 8);
     PWR.Fill(Y, 10);
     PWR.Fill(SkillID, 12);
     PWR.Fill(SkillLevel, 14);
     PWR.Fill((uint)1, 16);
     PWR.Fill(TargetUID, 20);
     PWR.Fill(Damage, 24);
     return PWR.Bytes;
 }
Exemplo n.º 20
0
 public static byte[] AddWHItem(uint NPC, Items.Item Item)
 {
     Writer PWR = new Writer(32);
     PWR.Fill((ushort)32, 0);
     PWR.Fill((ushort)1102, 2);
     PWR.Fill(NPC, 4);
     PWR.Fill((uint)1, 12);
     PWR.Fill(Item.UniqueID, 16);
     PWR.Fill(Item.Info.ID, 20);
     PWR.Fill(Item.SocketOne, 25);
     PWR.Fill(Item.SocketTwo, 26);
     PWR.Fill(Item.Plus, 29);
     PWR.Fill(Item.Bless, 30);
     PWR.Fill(Item.Enchant, 32);
     return PWR.Bytes;
 }
Exemplo n.º 21
0
        public Item(FloorItem Item)
        {
            Kernel.ItemTypes.TryGetValue(Item.ItemID, out Info);
            writer = new Writer(48);
            writer.Fill((ushort)48, 0);
            writer.Fill((ushort)1008, 2);
            writer.Fill(Item.ItemID, 8);
            writer.Fill(Info.MaxDurability, 14);
            Mode = Enums.ItemMode.Default;

            this.Durability = Item.Durability;
            this.SocketOne = Item.SocketOne;
            this.SocketTwo = Item.SocketTwo;
            this.Plus = Item.Plus;
            this.Bless = Item.Bless;
            this.Enchant = Item.Enchant;
        }
Exemplo n.º 22
0
 public static byte[] MessagePacket(string Message, string From, string To, Enums.ChatType ChatType)
 {
     int Length = 32 + From.Length + To.Length + Message.Length + 1;
     Writer PWR = new Writer(Length);
     PWR.Fill((ushort)Length, 0);
     PWR.Fill((ushort)1004, 2);
     PWR.Fill((uint)0, 4);
     PWR.Fill((uint)ChatType, 8);
     PWR.Fill((byte)4, 24);
     PWR.Fill((byte)From.Length, 25);
     PWR.Fill(From, 26);
     PWR.Fill((byte)To.Length, 26 + From.Length);
     PWR.Fill(To, 27 + From.Length);
     PWR.Fill((byte)Message.Length, 28 + From.Length + To.Length);
     PWR.Fill(Message, 29 + From.Length + To.Length);
     return PWR.Bytes;
 }
Exemplo n.º 23
0
 public Monster(MonsterType Info, Mapping.MobSpawn Spawn)
 {
     this.Info = Info;
     this.Spawn = Spawn;
     UniqueID = Increments.NextMonsterUID;
     packetWriter = new Writer(82 + Info.Name.Length);
     packetWriter.Fill((ushort)82 + Info.Name.Length, 0);
     packetWriter.Fill((ushort)1014, 2);
     packetWriter.Fill(UniqueID, 4);
     packetWriter.Fill(Info.Model, 8);
     packetWriter.Fill(Info.Level, 50);
     packetWriter.Fill((byte)0x64, 59);
     packetWriter.Fill((byte)1, 80);
     packetWriter.Fill((byte)Info.Name.Length, 81);
     packetWriter.Fill(Info.Name, 82);
     HitPoints = Info.MaxHealth;
     Facing = (Enums.ConquerAngle)Program.Random.Next(0, 7);
 }
Exemplo n.º 24
0
        public static void LoadNPCs()
        {
            Database db = new Database("C:/db/npcs.s3db");
            using (DataTable DT = db.GetDataTable("SELECT `UniqueID`, `Name`, `Type`, `Facing`, `MapID`, `X`, `Y` FROM `npcs`"))
            {
                for (int i = 0; i < DT.Rows.Count; i++)
                {
                    DataRow dr = DT.Rows[i];
                    Entities.NPC npc = new Entities.NPC();
                    npc.UniqueID = Convert.ToUInt32(dr.ItemArray[0]);
                    npc.Name = dr.ItemArray[1].ToString();
                    npc.Type = Convert.ToUInt16(dr.ItemArray[2]);
                    npc.Facing = (Enums.ConquerAngle)Convert.ToByte(dr.ItemArray[3]);
                    npc.X = Convert.ToUInt16(dr.ItemArray[5]);
                    npc.Y = Convert.ToUInt16(dr.ItemArray[6]);

                    int Len = 20;
                    if (npc.Name != "Unknown") { Len += npc.Name.Length; }
                    Writer PWR = new Writer(Len);
                    PWR.Fill((ushort)Len, 0);
                    PWR.Fill((ushort)2030, 2);
                    PWR.Fill((uint)npc.UniqueID, 4);
                    PWR.Fill((ushort)npc.X, 8);
                    PWR.Fill((ushort)npc.Y, 10);
                    PWR.Fill((ushort)npc.Type, 12);
                    PWR.Fill((byte)npc.Facing, 14);
                    PWR.Fill((ushort)0, 16);
                    if (npc.Name != "Unknown")
                    {
                        PWR.Fill((byte)1, 18);
                        PWR.Fill((byte)npc.Name.Length, 19);
                        PWR.Fill(npc.Name, 20);
                    }
                    npc.ToBytes = PWR.Bytes;
                    Mapping.Map m;
                    if (Kernel.Maps.TryGetValue(Convert.ToUInt32(dr.ItemArray[4]), out m))
                        m.Insert(npc);
                }
            }
            db.Dispose();
        }
Exemplo n.º 25
0
 public static byte[] ViewWarehouse(uint ActiveNPC, ConcurrentBag<Items.Item> Items)
 {
     int Len = 16 + (20 * Items.Count);
     Writer PWR = new Writer(Len);
     PWR.Fill((ushort)Len, 0);
     PWR.Fill((ushort)1102, 2);
     PWR.Fill((uint)ActiveNPC, 4);
     PWR.Fill((uint)Items.Count, 12);
     byte i = 0;
     foreach (Items.Item I in Items)
     {
         int extra = i * 20;
         PWR.Fill((uint)I.UniqueID, (16 + extra));
         PWR.Fill((uint)I.Info.ID, (20 + extra));
         PWR.Fill((byte)I.SocketOne, (25 + extra));
         PWR.Fill((byte)I.SocketTwo, (26 + extra));
         PWR.Fill((byte)I.Plus, (29 + extra));
         PWR.Fill((byte)I.Bless, (30 + extra));
         PWR.Fill((byte)I.Enchant, (32 + extra));
         i++;
     }
     return PWR.Bytes;
 }
Exemplo n.º 26
0
 public SkillUsePacket(uint AttackerUID, int MaxTargets)
 {
     this.Writer = new Writer(20 + (Math.Min(50, MaxTargets) * 12));
     this.Writer.Fill((ushort)1105, 2);
     this.Writer.Fill(AttackerUID, 4);
 }