Zepheus.Zone.Game.Equip.WriteEquipStats C# (CSharp) Method

WriteEquipStats() public method

public WriteEquipStats ( Packet packet ) : void
packet Zepheus.FiestaLib.Networking.Packet
return void
        public void WriteEquipStats(Packet packet)
        {
            byte StatCount = 0;
            if (Str > 0) StatCount++;
            if (End > 0) StatCount++;
            if (Dex > 0) StatCount++;
            if (Spr > 0) StatCount++;
            if (Int > 0) StatCount++;

            packet.WriteUShort(ItemID);
            switch (this.SlotType)
            {
                case ItemSlot.Helm:
                case ItemSlot.Armor:
                case ItemSlot.Pants:
                case ItemSlot.Boots:
                // case ItemSlot.Bow: // Shield = same
                case ItemSlot.Weapon2:
                case ItemSlot.Weapon:
                    packet.WriteByte(this.Upgrades);   // Refinement
                    packet.WriteByte(0);
                    packet.WriteShort(0); // Or int?
                    packet.WriteShort(0);
                    if (this.SlotType == ItemSlot.Weapon || (this.SlotType == ItemSlot.Weapon2 && Info.TwoHand))
                    {
                        packet.WriteByte(0);
                        // Licence data
                        packet.WriteUShort(0xFFFF);    // Nr.1 - Mob ID
                        packet.WriteUInt(0);           // Nr.1 - Kill count
                        packet.WriteUShort(0xFFFF);    // Nr.2 - Mob ID
                        packet.WriteUInt(0);           // Nr.2 - Kill count
                        packet.WriteUShort(0xFFFF);    // Nr.3 - Mob ID
                        packet.WriteUInt(0);           // Nr.3 - Kill count
                        packet.WriteUShort(0xFFFF);        // UNK
                        packet.WriteString("", 16);    // First licence adder name
                    }
                    packet.WriteByte(0);
                    packet.WriteUInt(GetExpiringTime());               // Expiring time (1992027391 -  never expires)
                    //packet.WriteShort(0);
                    break;
                case ItemSlot.Pet:
                    packet.WriteByte(this.Upgrades);   // Pet Refinement Lol
                    packet.Fill(2, 0);                     // UNK
                    packet.WriteUInt(GetExpiringTime());               // Expiring time (1992027391 -  never expires)
                    packet.WriteUInt(0);               // Time? (1992027391 -  never expires)
                    break;
                case ItemSlot.Earings:
                case ItemSlot.Necklace:
                case ItemSlot.Ring:
                    packet.WriteUInt(GetExpiringTime());               // Expiring time (1992027391 -  never expires)
                    packet.WriteUInt(0);               // Time? (1992027391 -  never expires)
                    packet.WriteByte(this.Upgrades);   // Refinement
                    // Stats added while refining
                    packet.WriteUShort(0);             // it may be byte + byte too (some kind of counter when item downgrades)
                    packet.WriteUShort(0);             // STR
                    packet.WriteUShort(0);             // END
                    packet.WriteUShort(0);             // DEX
                    packet.WriteUShort(0);             // INT
                    packet.WriteUShort(0);             // SPR
                    break;
                case ItemSlot.CostumeWeapon:
                case ItemSlot.CostumeShield:
                    packet.WriteUInt(25000);           // Skin Durability
                    break;
                default:
                    packet.WriteUInt(GetExpiringTime());      // Expiring time (1992027391 -  never expires)
                    packet.WriteUInt(0);                        // Time? (1992027391 -  never expires)
                    break;
            }

            // Random stats data (Not those what were added in refinement)
            switch (this.SlotType)
            {                       // Stat count (StatCount << 1 | Visible(0 or 1 are stats shown or not))
                case ItemSlot.Earings:
                    packet.WriteByte((byte)(StatCount << 1 | 1));
                    break;
                case ItemSlot.Necklace:
                case ItemSlot.Ring:
                    packet.WriteByte((byte)(StatCount << 1 | 1));
                    break;
                case ItemSlot.Helm:
                case ItemSlot.Armor:
                case ItemSlot.Pants:
                case ItemSlot.Boots:
                case ItemSlot.Weapon2:
                case ItemSlot.Weapon:
                    packet.WriteByte((byte)(StatCount << 1 | 1));
                    break;
                case ItemSlot.Pet:          // Yes!! Its possible to give stats to pet also (It overrides default one(s)).
                    packet.WriteByte((byte)(StatCount << 1 | 1));
                    break;
            }
            // foreach stat
            //pPacket.WriteByte(type);              // Stat type ( 0 = STR, 1 = END, 2 = DEX, 3 = INT, 4 = SPR )
            //pPacket.WriteUShort(amount);          // Amount
            // end foreach
            if (Str > 0) { packet.WriteByte(0); packet.WriteUShort(Str); }
            if (End > 0) { packet.WriteByte(1); packet.WriteUShort(End); }
            if (Dex > 0) { packet.WriteByte(2); packet.WriteUShort(Dex); }
            if (Spr > 0) { packet.WriteByte(3); packet.WriteUShort(Spr); }
            if (Int > 0) { packet.WriteByte(4); packet.WriteUShort(Int); }
        }

Usage Example

Ejemplo n.º 1
0
        public static void ModifyEquipSlot(ZoneCharacter character, byte modifyslot, byte otherslot, Equip equip)
        {
            using (var packet = new Packet(SH12Type.ModifyEquipSlot))
            {
                packet.WriteByte(otherslot);
                packet.WriteByte(0x24); //aka the 'equipped' bool
                packet.WriteByte(modifyslot);

                if (equip == null)
                {
                    packet.WriteUShort(ushort.MaxValue);
                }
                else
                {
                    equip.WriteEquipStats(packet);
                }
                character.Client.SendPacket(packet);
            }
        }