private static void OnDropItemRequested(int client, PacketReader reader)
 {
     const int oldLen08 = 0x0E;
     const int newLen08 = 0x0F;
     if (reader.Size != oldLen08 && reader.Size != newLen08)
         return;
     int serial8 = reader.ReadInt32();
     int x8 = reader.ReadInt16();
     int y8 = reader.ReadInt16();
     int z8 = reader.ReadSByte();
     int container8;
     if (reader.Size == newLen08)
         reader.ReadByte(); // Grid location
     container8 = reader.ReadInt32();
     OutgoingPackets.OnDropItemRequested(client, serial8, x8, y8, z8, container8);
 }
Exemplo n.º 2
0
 private static void OnStandardGump(int client, PacketReader reader)
 {
     int serial24 = reader.ReadInt32();
     int id24 = reader.ReadInt16();
     IncomingPackets.OnStandardGump(client, serial24, id24);
 }
Exemplo n.º 3
0
 private static void OnSound(int client, PacketReader reader)
 {
     byte flags = reader.ReadByte();
     int effect54 = reader.ReadInt16();
     int vol54 = reader.ReadInt16();
     int x54 = reader.ReadInt16();
     int y54 = reader.ReadInt16();
     int z54 = reader.ReadInt16();
     IncomingPackets.OnSound(client, flags, effect54, vol54, x54, y54, z54);
 }
Exemplo n.º 4
0
        private static void OnServerList(int client, PacketReader reader)
        {
            reader.ReadByte(); // BYTE 0x00
            int count = reader.ReadInt16();
            ServerInfo[] si = new ServerInfo[count];

            for (int i = 0; i < count; i++)
            {
                reader.ReadInt16(); // index
                si[i] = new ServerInfo();
                si[i].Name = reader.ReadString(32);
                si[i].PercentFull = reader.ReadByte();
                si[i].Timezone = reader.ReadByte();
                si[i].IP = reader.ReadUInt32();
            }

            IncomingPackets.OnServerList(client, si);
        }
Exemplo n.º 5
0
        private static void OnProperties(int client, PacketReader reader)
        {
            reader.ReadInt16(); // WORD 0x01
            int serial = reader.ReadInt32();
            reader.ReadInt16(); // WORD 0x00
            int hash = reader.ReadInt32();
            Property p;
            StringBuilder propertyText = new StringBuilder();
            List<Property> propertyList = new List<Property>();
            string named6 = "";
            bool nameSet = false, first = true;
            int lastCliloc = -1;

            for (; ; )
            {
                p = new Property();
                p.Cliloc = reader.ReadInt32();
                if (p.Cliloc == 0)
                    break;
                if (!first) propertyText.Append("\r\n");
                int len = reader.ReadInt16();
                if (len > 0)
                {
                    //TODO: Fix the below two lines to use reader.ReadUnicodeString();
                    p.Arguments = UnicodeEncoding.Unicode.GetString(reader.Data, reader.Index, len).Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    reader.Seek(len, SeekOrigin.Current);

                    p.Text = Cliloc.GetLocalString(p.Cliloc, p.Arguments);
                    if (!nameSet)
                    {
                        named6 = p.Text;
                        nameSet = true;
                    }
                }
                else
                {
                    p.Text = Cliloc.GetProperty(p.Cliloc);
                    if (!nameSet)
                    {
                        named6 = p.Text;
                        nameSet = true;
                    }
                }

                if (lastCliloc != -1)
                {
                    if (lastCliloc != p.Cliloc)
                    {
                        propertyList.Add(p);
                        propertyText.Append(p.Text);
                    }
                }
                else
                {
                    propertyList.Add(p);
                    propertyText.Append(p.Text);
                }
                lastCliloc = p.Cliloc;
                first = false;
            }

            IncomingPackets.OnProperties(client, serial, named6, propertyList.ToArray(), propertyText.ToString());
        }
Exemplo n.º 6
0
 private static void OnMobileUpdated(int client, PacketReader reader)
 {
     int serial = reader.ReadInt32();
     int id = reader.ReadInt16();
     reader.ReadByte(); // BYTE 0x00;
     int hue = reader.ReadInt16();
     int status = reader.ReadByte();
     int x = reader.ReadInt16();
     int y = reader.ReadInt16();
     reader.ReadInt16(); // WORD 0x00;
     int direction = reader.ReadByte() & 0x07;
     int z = reader.ReadSByte();
     IncomingPackets.OnMobileUpdated(client, serial, id, hue, status, x, y, z, direction);
 }
Exemplo n.º 7
0
 private static void OnMobileMoving(int client, PacketReader reader)
 {
     int serial77 = reader.ReadInt32();
     int id77 = reader.ReadInt16();
     int x77 = reader.ReadInt16();
     int y77 = reader.ReadInt16();
     int z77 = reader.ReadSByte();
     int direction77 = reader.ReadByte() & 0x07;
     int hue77 = reader.ReadInt16();
     int status77 = reader.ReadByte();
     int noto77 = reader.ReadByte();
     IncomingPackets.OnMobileMoving(client, serial77, id77, x77, y77, z77, direction77, hue77, status77, noto77);
 }
Exemplo n.º 8
0
 private static void OnManaUpdated(int client, PacketReader reader)
 {
     int seriala2 = reader.ReadInt32();
     int maxMana = reader.ReadInt16();
     int mana = reader.ReadInt16();
     IncomingPackets.OnManaUpdated(client, seriala2, maxMana, mana);
 }
Exemplo n.º 9
0
        private static void OnContainerContents(int client, PacketReader reader)
        {
            if (reader.Size == 5)
                return;

            bool oldStyle = false;
            int count = reader.ReadInt16();

            if (((reader.Size - 5) / 20) != count)
                oldStyle = true;

            ItemCollection container = null;

            for (int i = 0; i < count; i++)
            {
                int serial = reader.ReadInt32();
                int id = reader.ReadInt16();
                reader.ReadByte(); // Item ID Offset
                int amount = reader.ReadInt16();
                int x = reader.ReadInt16();
                int y = reader.ReadInt16();
                int grid = 0;
                if (!oldStyle)
                    grid = reader.ReadByte();
                int containerSerial = reader.ReadInt32();
                int hue = reader.ReadInt16();

                if (container == null) container = new ItemCollection(client, containerSerial, count);

                Item item3c = new Item(serial, containerSerial);
                item3c.ID = id;
                item3c.Count = amount;
                item3c.Hue = hue;
                item3c.Grid = grid;
                item3c.X = x;
                item3c.Y = y;
                container.Add(item3c);
            }

            if (container != null)
                IncomingPackets.OnContainerContents(client, container);
        }
Exemplo n.º 10
0
 private static void OnASCIIMessage(int client, PacketReader reader)
 {
     JournalEntry je1c = new JournalEntry();
     je1c.serial = reader.ReadInt32();
     je1c.id = reader.ReadInt16();
     je1c.speechType = (JournalSpeech)reader.ReadByte();
     je1c.speechHue = reader.ReadInt16();
     je1c.speechFont = reader.ReadInt16();
     je1c.name = reader.ReadString(30);
     je1c.text = reader.ReadString();
     IncomingPackets.OnText(client, je1c);
     General.OnJournalEntry(client, je1c);
 }
 private static void OnDragItemRequested(int client, PacketReader reader)
 {
     int serial7 = reader.ReadInt32();
     int amount7 = reader.ReadInt16();
     OutgoingPackets.OnDragItemRequested(client, serial7, amount7);
 }
        private static void OnUnicodeSpeech( int client, PacketReader reader )
        {
            byte messagetype = reader.ReadByte();
            int color = reader.ReadInt16();
            int font = reader.ReadInt16();
            string lang = reader.ReadString( 4 );
            string text;

            int[] keywords;

            if ((messagetype & 0xC0) != 0)
            {
                int value = reader.ReadInt16();
                int count = ( value & 0xFFF0 ) >> 4;
                int hold = value & 0xF;

                if (count < 0 || count > 50)
                    return;

                List<int> keyList = new List<int>();

                for (int i = 0; i < count; ++i)
                {
                    int speechID;

                    if (( i & 1 ) == 0)
                    {
                        hold <<= 8;
                        hold |= reader.ReadByte();
                        speechID = hold;
                        hold = 0;
                    }
                    else
                    {
                        value = reader.ReadInt16();
                        speechID = ( value & 0xFFF0 ) >> 4;
                        hold = value & 0xF;
                    }

                    if (!keyList.Contains( speechID ))
                        keyList.Add( speechID );
                }

                text = reader.ReadStringSafe();

                keywords = keyList.ToArray();
            }
            else
            {
                keywords = new int[0];
                text = reader.ReadUnicodeStringSafe();
            }
            OutgoingPackets.OnUnicodeSpeech( client, messagetype, color, font, lang, keywords, text );
        }
 private static void OnSkillLockChanged(int client, PacketReader reader)
 {
     int skillID3a = reader.ReadInt16();
     LockStatus lockStatus3a = (LockStatus)reader.ReadByte();
     OutgoingPackets.OnSkillLockChanged(client, skillID3a, lockStatus3a);
 }
Exemplo n.º 14
0
        public static PacketFilterInfo Deserialize( byte[] bytes )
        {
            PacketReader reader = new PacketReader( bytes, bytes.Length, false );
            byte pid = reader.ReadByte();
            int numconditions = reader.ReadInt16();

            List<PacketFilterCondition> conditions = new List<PacketFilterCondition>();

            for (int i = 0; i < numconditions; i++)
            {
                int pos = reader.ReadInt16();
                int blen = reader.ReadInt16();
                byte[] bytes2 = new byte[blen];
                bytes2 = reader.ReadByteArray( blen );
                int len = reader.ReadInt16();
                conditions.Add( new PacketFilterCondition( pos, bytes2, len ) );
            }

            if (conditions.Count == 0)
                return new PacketFilterInfo( pid, null );

            return new PacketFilterInfo( pid, conditions.ToArray() );
        }
Exemplo n.º 15
0
        private static void OnProperties(int client, PacketReader reader)
        {
            reader.ReadInt16(); // WORD 0x01
            int serial = reader.ReadInt32();

            reader.ReadInt16(); // WORD 0x00
            int             hash = reader.ReadInt32();
            Property        p;
            StringBuilder   propertyText = new StringBuilder();
            List <Property> propertyList = new List <Property>();
            string          named6 = "";
            bool            nameSet = false, first = true;
            int             lastCliloc = -1;

            for (; ;)
            {
                p        = new Property();
                p.Cliloc = reader.ReadInt32();
                if (p.Cliloc == 0)
                {
                    break;
                }
                if (!first)
                {
                    propertyText.Append("\r\n");
                }
                int len = reader.ReadInt16();
                if (len > 0)
                {
                    //TODO: Fix the below two lines to use reader.ReadUnicodeString();
                    p.Arguments = UnicodeEncoding.Unicode.GetString(reader.Data, reader.Index, len).Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    reader.Seek(len, SeekOrigin.Current);

                    p.Text = Cliloc.GetLocalString(p.Cliloc, p.Arguments);
                    if (!nameSet)
                    {
                        named6  = p.Text;
                        nameSet = true;
                    }
                }
                else
                {
                    p.Text = Cliloc.GetProperty(p.Cliloc);
                    if (!nameSet)
                    {
                        named6  = p.Text;
                        nameSet = true;
                    }
                }

                if (lastCliloc != -1)
                {
                    if (lastCliloc != p.Cliloc)
                    {
                        propertyList.Add(p);
                        propertyText.Append(p.Text);
                    }
                }
                else
                {
                    propertyList.Add(p);
                    propertyText.Append(p.Text);
                }
                lastCliloc = p.Cliloc;
                first      = false;
            }

            IncomingPackets.OnProperties(client, serial, named6, propertyList.ToArray(), propertyText.ToString());
        }
Exemplo n.º 16
0
        private static void OnContextMenu(int client, PacketReader reader)
        {
            int type = reader.ReadInt16();
            int serial = reader.ReadInt32();
            int len = reader.ReadByte();

            ContextEntry[] ce = new ContextEntry[len];
            int entry, cliloc, flags, hue;

            switch (type)
            {
                case 1: // Old Type
                    for (int x = 0; x < len; x++)
                    {
                        entry = reader.ReadInt16();
                        cliloc = reader.ReadInt16() + 3000000;
                        flags = reader.ReadInt16();
                        hue = 0;

                        if ((flags & 0x20) == 0x20)
                            hue = reader.ReadInt16();

                        string text = Cliloc.GetProperty(cliloc);
                        ce[x] = new ContextEntry(client, entry, serial, text, flags, hue);
                    }
                    IncomingPackets.OnContextMenu(client, ce);
                    break;
                case 2: // KR -> SA3D -> 2D post 7.0.0.0
                    for (int x = 0; x < len; x++)
                    {
                        cliloc = reader.ReadInt32();
                        entry = reader.ReadInt16();
                        flags = reader.ReadInt16();
                        hue = 0;

                        if ((flags & 0x20) == 0x20)
                            hue = reader.ReadInt16();

                        string text = Cliloc.GetProperty(cliloc);
                        ce[x] = new ContextEntry(client, entry, serial, text, flags, hue);
                    }
                    IncomingPackets.OnContextMenu(client, ce);
                    break;
            }
        }
Exemplo n.º 17
0
 private static void OnLocalizedText(int client, PacketReader reader)
 {
     JournalEntry jec1 = new JournalEntry();
     jec1.serial = reader.ReadInt32();
     jec1.id = reader.ReadInt16();
     jec1.speechType = (JournalSpeech)reader.ReadByte();
     if (jec1.speechType == JournalSpeech.Yell)
     {
         Log.LogDataMessage(client, reader.Data, "Incoming encoded C1 packet:\r\n");
         return;
     }
     jec1.speechHue = reader.ReadInt16();
     jec1.speechFont = reader.ReadInt16();
     int messagec1 = reader.ReadInt32();
     jec1.name = reader.ReadString(30);
     //TODO: Fix the below two lines to use reader.ReadUnicodeString();
     string[] argumentsc1 = UnicodeEncoding.Unicode.GetString(reader.Data, 48, reader.Size - 50).Split('\t');
     jec1.text = Cliloc.GetLocalString(messagec1, argumentsc1);
     IncomingPackets.OnLocalizedText(client, jec1);
     General.OnJournalEntry(client, jec1);
 }
Exemplo n.º 18
0
 private static void OnDamage(int client, PacketReader reader)
 {
     int serial = reader.ReadInt32();
     int damage = reader.ReadInt16();
     IncomingPackets.OnDamage(client, serial, damage);
 }
Exemplo n.º 19
0
 private static void OnMobileIncoming(int client, PacketReader reader)
 {
     int serial78 = reader.ReadInt32();
     ItemCollection container78 = new ItemCollection(serial78, 125);
     Mobile mob78 = new Mobile(serial78, client);
     mob78.myID = reader.ReadInt16();
     mob78.myX = reader.ReadInt16();
     mob78.myY = reader.ReadInt16();
     mob78.myZ = reader.ReadSByte();
     mob78.myDirection = reader.ReadByte() & 0x07;
     mob78.myHue = reader.ReadInt16();
     mob78.myStatus = reader.ReadByte();
     mob78.myNotoriety = reader.ReadByte();
     Item item;
     for (; ; )
     {
         int itemSerial = reader.ReadInt32();
         if (itemSerial == 0)
             break;
         item = new Item(itemSerial);
         item.Owner = serial78;
         item.ID = reader.ReadInt16();
         item.Layer = (Layer)reader.ReadByte();
         ClientInfo ci;
         ClientInfoCollection.GetClient(client, out ci);
         if (ci.UseNewMobileIncoming)
         {
             item.myHue = reader.ReadInt16();
         }
         else
         {
             if ((item.myID & 0x8000) != 0)
             {
                 item.myID ^= 0x8000;
                 item.myHue = reader.ReadInt16();
             }
         }
         container78.Add( item );
     }
     IncomingPackets.OnEquippedMobAdded(client, mob78, container78);
 }
Exemplo n.º 20
0
        private static void OnExtendedCommand(int client, PacketReader reader)
        {
            int command = reader.ReadInt16();

            PacketHandler handler = GetExtendedHandler(command);
            if (handler != null)
                handler.OnReceive(client, reader);
        }
Exemplo n.º 21
0
 private static void OnMobileStatus(int client, PacketReader reader)
 {
     int length11 = reader.Size;
     int serial = reader.ReadInt32();
     string name = reader.ReadString(30);
     int hits = reader.ReadInt16();
     int maxHits = reader.ReadInt16();
     reader.ReadByte(); // Allow Name Change
     byte features = reader.ReadByte();
     int sex = 2;
     if (length11 > 43) sex = reader.ReadByte();
     if (length11 <= 44)
     {
         IncomingPackets.OnShortStatus(client, serial, name, hits, maxHits, sex);
     }
     else
     {
         PlayerStatus ps = new PlayerStatus();
         ps.Name = name;
         ps.Health = hits;
         ps.MaxHealth = maxHits;
         ps.Sex = sex;
         ps.Features = features;
         ps.Str = reader.ReadInt16();
         ps.Dex = reader.ReadInt16();
         ps.Int = reader.ReadInt16();
         ps.Stamina = reader.ReadInt16();
         ps.MaxStamina = reader.ReadInt16();
         ps.Mana = reader.ReadInt16();
         ps.MaxMana = reader.ReadInt16();
         ps.Gold = reader.ReadInt32();
         ps.PhysicalResist = reader.ReadInt16();
         ps.Weight = reader.ReadInt16();
         switch (features)
         {
             case 3:
                 ps.StatCap = reader.ReadInt16();
                 ps.Followers = reader.ReadByte();
                 ps.MaxFollowers = reader.ReadByte();
                 break;
             case 4:
                 ps.StatCap = reader.ReadInt16();
                 ps.Followers = reader.ReadByte();
                 ps.MaxFollowers = reader.ReadByte();
                 ps.FireResist = reader.ReadInt16();
                 ps.ColdResist = reader.ReadInt16();
                 ps.PoisonResist = reader.ReadInt16();
                 ps.EnergyResist = reader.ReadInt16();
                 ps.Luck = reader.ReadInt16();
                 ps.MinDamage = reader.ReadInt16();
                 ps.MaxDamage = reader.ReadInt16();
                 ps.TithingPoints = reader.ReadInt32();
                 break;
             case 5:
                 ps.MaxWeight = reader.ReadInt16();
                 ps.Race = reader.ReadByte();
                 ps.StatCap = reader.ReadInt16();
                 ps.Followers = reader.ReadByte();
                 ps.MaxFollowers = reader.ReadByte();
                 ps.FireResist = reader.ReadInt16();
                 ps.ColdResist = reader.ReadInt16();
                 ps.PoisonResist = reader.ReadInt16();
                 ps.EnergyResist = reader.ReadInt16();
                 ps.Luck = reader.ReadInt16();
                 ps.MinDamage = reader.ReadInt16();
                 ps.MaxDamage = reader.ReadInt16();
                 ps.TithingPoints = reader.ReadInt32();
                 break;
             case 6:
                 ps.MaxWeight = reader.ReadInt16();
                 ps.Race = reader.ReadByte();
                 ps.StatCap = reader.ReadInt16();
                 ps.Followers = reader.ReadByte();
                 ps.MaxFollowers = reader.ReadByte();
                 ps.FireResist = reader.ReadInt16();
                 ps.ColdResist = reader.ReadInt16();
                 ps.PoisonResist = reader.ReadInt16();
                 ps.EnergyResist = reader.ReadInt16();
                 ps.Luck = reader.ReadInt16();
                 ps.MinDamage = reader.ReadInt16();
                 ps.MaxDamage = reader.ReadInt16();
                 ps.TithingPoints = reader.ReadInt32();
                 ps.MaxPhysicalResist = reader.ReadInt16();
                 ps.MaxFireResist = reader.ReadInt16();
                 ps.MaxColdResist = reader.ReadInt16();
                 ps.MaxPoisonResist = reader.ReadInt16();
                 ps.MaxEnergyResist = reader.ReadInt16();
                 ps.DefenseChanceIncrease = reader.ReadInt16();
                 reader.ReadInt16();
                 ps.HitChanceIncrease = reader.ReadInt16();
                 ps.SwingSpeedIncrease = reader.ReadInt16();
                 ps.DamageIncrease = reader.ReadInt16();
                 ps.LowerReagentCost = reader.ReadInt16();
                 ps.SpellDamageIncrease = reader.ReadInt16();
                 ps.FasterCastRecovery = reader.ReadInt16();
                 ps.FasterCasting = reader.ReadInt16();
                 ps.LowerManaCost = reader.ReadInt16();
                 break;
         }
         IncomingPackets.OnLongStatus(client, serial, ps);
     }
 }
Exemplo n.º 22
0
 private static void OnGenericGump(int client, PacketReader reader)
 {
     int serialb0 = reader.ReadInt32();
     int idb0 = reader.ReadInt32();
     int xb0 = reader.ReadInt32();
     int yb0 = reader.ReadInt32();
     int layoutLenb0 = reader.ReadInt16();
     string layoutb0 = reader.ReadString(layoutLenb0);
     int linesb0 = reader.ReadInt16();
     string[] textb0 = new string[linesb0];
     int textLenb0;
     for (int x = 0; x < linesb0; x++)
     {
         textLenb0 = reader.ReadInt16() * 2;
         textb0[x] = reader.ReadUnicodeString(textLenb0);
     }
     IncomingPackets.OnGenericGump(client, serialb0, idb0, xb0, yb0, layoutb0, textb0);
 }
Exemplo n.º 23
0
 private static void OnMoveRejected(int client, PacketReader reader)
 {
     int sequence21 = reader.ReadByte();
     int x21 = reader.ReadInt16();
     int y21 = reader.ReadInt16();
     int direction21 = reader.ReadByte();
     int z21 = reader.ReadSByte();
     IncomingPackets.OnMoveRejected(client, sequence21, x21, y21, z21, direction21);
 }
Exemplo n.º 24
0
 private static void OnHealthUpdated(int client, PacketReader reader)
 {
     int seriala1 = reader.ReadInt32();
     int maxHealth = reader.ReadInt16();
     int health = reader.ReadInt16();
     IncomingPackets.OnHealthUpdated(client, seriala1, maxHealth, health);
 }
Exemplo n.º 25
0
 private static void OnSAWorldItem(int client, PacketReader reader)
 {
     reader.ReadInt16(); // WORD 0x01
     byte type = reader.ReadByte(); // Data Type (0x00 = use TileData, 0x01 = use BodyData, 0x02 = use MultiData)
     int serialf3 = reader.ReadInt32();
     Item itemf3 = new Item(serialf3);
     itemf3.ArtDataID = type;
     itemf3.ID = reader.ReadInt16();
     itemf3.Direction = reader.ReadByte();
     itemf3.Count = reader.ReadInt16();
     reader.ReadInt16(); // Second Amount?
     itemf3.X = reader.ReadInt16();
     itemf3.Y = reader.ReadInt16();
     itemf3.Z = reader.ReadSByte();
     itemf3.Light = reader.ReadByte();
     itemf3.Hue = reader.ReadInt16();
     itemf3.Flags = reader.ReadByte();
     IncomingPackets.OnWorldItemAdded(client, itemf3);
 }
Exemplo n.º 26
0
 private static void OnInitializePlayer(int client, PacketReader reader)
 {
     int serial = reader.ReadInt32();
     PlayerMobile mobile = new PlayerMobile(serial, client);
     reader.ReadInt32(); // DWORD 0
     mobile.myID = reader.ReadInt16();
     mobile.myX = reader.ReadInt16();
     mobile.myY = reader.ReadInt16();
     mobile.myZ = reader.ReadInt16();
     mobile.myDirection = reader.ReadByte();
     IncomingPackets.OnPlayerInitialized(client, mobile);
 }
Exemplo n.º 27
0
        private static void OnSkillsList(int client, PacketReader reader)
        {
            byte type = reader.ReadByte();
            int id = reader.ReadInt16();
            int value = reader.ReadInt16();
            int baseValue = reader.ReadInt16();
            LockStatus lockStatus = (LockStatus)reader.ReadByte();
            int skillCap = 1000;                            //
            if (reader.Size != 11)                          // UOSteam doesn't send skillcap on changing locks in their UI
                skillCap = reader.ReadInt16();              // So we kludge it and default to 100 skillcap
            if (reader.Size == 11 || reader.Size == 13)     // 11 from UOSteam on lock change
            {
                IncomingPackets.OnSkillUpdate(client, id, (float)value / 10, (float)baseValue / 10, lockStatus, (float)skillCap / 10);
            }
            else
            {
                SkillInfo si = new SkillInfo();
                si.Value = (float)value / 10;
                si.BaseValue = (float)baseValue / 10;
                si.LockStatus = lockStatus;
                si.SkillCap = (float)skillCap / 10;
                si.ID = id - 1;

                List<SkillInfo> skillInfoList = new List<SkillInfo>(128);

                skillInfoList.Add(si);

                for (; ; )
                {
                    id = reader.ReadInt16();
                    if (id == 0) break;
                    value = reader.ReadInt16();
                    baseValue = reader.ReadInt16();
                    lockStatus = (LockStatus)reader.ReadByte();
                    skillCap = reader.ReadInt16();

                    si = new SkillInfo();
                    si.Value = (float)value / 10;
                    si.BaseValue = (float)baseValue / 10;
                    si.LockStatus = lockStatus;
                    si.SkillCap = (float)skillCap / 10;
                    si.ID = id - 1;
                    skillInfoList.Add(si);
                }

                IncomingPackets.OnSkillList(client, skillInfoList.ToArray());
            }
        }
Exemplo n.º 28
0
 private static void OnItemAddedToContainer(int client, PacketReader reader)
 {
     const int expectedLen25a = 0x14;
     const int expectedLen25b = 0x15;
     if (reader.Size != expectedLen25a && reader.Size != expectedLen25b)
         return;
     int serial25 = reader.ReadInt32();
     int id25 = reader.ReadInt16();
     reader.ReadByte();
     int count25 = reader.ReadInt16();
     int x = reader.ReadInt16();
     int y = reader.ReadInt16();
     if (reader.Size == expectedLen25b)
         reader.ReadByte(); // BYTE Grid Location
     int containerSerial25 = reader.ReadInt32();
     int hue25 = reader.ReadInt16();
     Item item25 = new Item(serial25, containerSerial25);
     item25.ID = id25;
     item25.Count = count25;
     item25.Hue = hue25;
     item25.X = x;
     item25.Y = y;
     IncomingPackets.OnItemAddedToContainer(client, item25);
 }
Exemplo n.º 29
0
 private static void OnStaminaUpdated(int client, PacketReader reader)
 {
     int seriala3 = reader.ReadInt32();
     int maxStamina = reader.ReadInt16();
     int stamina = reader.ReadInt16();
     IncomingPackets.OnStaminaUpdated(client, seriala3, maxStamina, stamina);
 }
Exemplo n.º 30
0
        private static void OnItemEquipped(int client, PacketReader reader)
        {
            int serial = reader.ReadInt32();
            int id = reader.ReadInt16();
            reader.ReadByte(); // BYTE 0x00
            int layer = reader.ReadByte();
            int mobileSerial = reader.ReadInt32();
            int hue = reader.ReadInt16();

            IncomingPackets.OnItemEquipped(client, serial, id, (Layer)layer, mobileSerial, hue);
        }
Exemplo n.º 31
0
 private static void OnUnicodeText(int client, PacketReader reader)
 {
     JournalEntry jeae = new JournalEntry();
     jeae.serial = reader.ReadInt32();
     jeae.id = reader.ReadInt16();
     jeae.speechType = (JournalSpeech)reader.ReadByte();
     jeae.speechHue = reader.ReadInt16();
     jeae.speechFont = reader.ReadInt16();
     jeae.speechLanguage = reader.ReadString(4);
     jeae.name = reader.ReadString(30);
     jeae.text = reader.ReadUnicodeString();
     IncomingPackets.OnUnicodeText(client, jeae);
     General.OnJournalEntry(client, jeae);
 }
Exemplo n.º 32
0
        private static void OnMobileStatus(int client, PacketReader reader)
        {
            int    length11 = reader.Size;
            int    serial   = reader.ReadInt32();
            string name     = reader.ReadString(30);
            int    hits     = reader.ReadInt16();
            int    maxHits  = reader.ReadInt16();

            reader.ReadByte(); // Allow Name Change
            byte features = reader.ReadByte();
            int  sex      = 2;

            if (length11 > 43)
            {
                sex = reader.ReadByte();
            }
            if (length11 <= 44)
            {
                IncomingPackets.OnShortStatus(client, serial, name, hits, maxHits, sex);
            }
            else
            {
                PlayerStatus ps = new PlayerStatus();
                ps.Name           = name;
                ps.Health         = hits;
                ps.MaxHealth      = maxHits;
                ps.Sex            = sex;
                ps.Features       = features;
                ps.Str            = reader.ReadInt16();
                ps.Dex            = reader.ReadInt16();
                ps.Int            = reader.ReadInt16();
                ps.Stamina        = reader.ReadInt16();
                ps.MaxStamina     = reader.ReadInt16();
                ps.Mana           = reader.ReadInt16();
                ps.MaxMana        = reader.ReadInt16();
                ps.Gold           = reader.ReadInt32();
                ps.PhysicalResist = reader.ReadInt16();
                ps.Weight         = reader.ReadInt16();
                switch (features)
                {
                case 3:
                    ps.StatCap      = reader.ReadInt16();
                    ps.Followers    = reader.ReadByte();
                    ps.MaxFollowers = reader.ReadByte();
                    break;

                case 4:
                    ps.StatCap       = reader.ReadInt16();
                    ps.Followers     = reader.ReadByte();
                    ps.MaxFollowers  = reader.ReadByte();
                    ps.FireResist    = reader.ReadInt16();
                    ps.ColdResist    = reader.ReadInt16();
                    ps.PoisonResist  = reader.ReadInt16();
                    ps.EnergyResist  = reader.ReadInt16();
                    ps.Luck          = reader.ReadInt16();
                    ps.MinDamage     = reader.ReadInt16();
                    ps.MaxDamage     = reader.ReadInt16();
                    ps.TithingPoints = reader.ReadInt32();
                    break;

                case 5:
                    ps.MaxWeight     = reader.ReadInt16();
                    ps.Race          = reader.ReadByte();
                    ps.StatCap       = reader.ReadInt16();
                    ps.Followers     = reader.ReadByte();
                    ps.MaxFollowers  = reader.ReadByte();
                    ps.FireResist    = reader.ReadInt16();
                    ps.ColdResist    = reader.ReadInt16();
                    ps.PoisonResist  = reader.ReadInt16();
                    ps.EnergyResist  = reader.ReadInt16();
                    ps.Luck          = reader.ReadInt16();
                    ps.MinDamage     = reader.ReadInt16();
                    ps.MaxDamage     = reader.ReadInt16();
                    ps.TithingPoints = reader.ReadInt32();
                    break;

                case 6:
                    ps.MaxWeight             = reader.ReadInt16();
                    ps.Race                  = reader.ReadByte();
                    ps.StatCap               = reader.ReadInt16();
                    ps.Followers             = reader.ReadByte();
                    ps.MaxFollowers          = reader.ReadByte();
                    ps.FireResist            = reader.ReadInt16();
                    ps.ColdResist            = reader.ReadInt16();
                    ps.PoisonResist          = reader.ReadInt16();
                    ps.EnergyResist          = reader.ReadInt16();
                    ps.Luck                  = reader.ReadInt16();
                    ps.MinDamage             = reader.ReadInt16();
                    ps.MaxDamage             = reader.ReadInt16();
                    ps.TithingPoints         = reader.ReadInt32();
                    ps.MaxPhysicalResist     = reader.ReadInt16();
                    ps.MaxFireResist         = reader.ReadInt16();
                    ps.MaxColdResist         = reader.ReadInt16();
                    ps.MaxPoisonResist       = reader.ReadInt16();
                    ps.MaxEnergyResist       = reader.ReadInt16();
                    ps.DefenseChanceIncrease = reader.ReadInt16();
                    reader.ReadInt16();
                    ps.HitChanceIncrease   = reader.ReadInt16();
                    ps.SwingSpeedIncrease  = reader.ReadInt16();
                    ps.DamageIncrease      = reader.ReadInt16();
                    ps.LowerReagentCost    = reader.ReadInt16();
                    ps.SpellDamageIncrease = reader.ReadInt16();
                    ps.FasterCastRecovery  = reader.ReadInt16();
                    ps.FasterCasting       = reader.ReadInt16();
                    ps.LowerManaCost       = reader.ReadInt16();
                    break;
                }
                IncomingPackets.OnLongStatus(client, serial, ps);
            }
        }