Exemplo n.º 1
0
        public void Decode(Packet packet)
        {
            CharacterStat = new GW_CharacterStat();
            CharacterStat.Decode(packet);

            AvatarLook = new AvatarLook();
            // Newer versions do not really use this
#if USING_AVATARLOOK_ENCODE
            AvatarLook.Decode(packet);
#else
            for (var i = 0; i < Constants.EquipSlots.MaxSlotIndex; i++)
            {
                AvatarLook.HairEquip[i]   = 0;
                AvatarLook.UnseenEquip[i] = 0;
            }

            byte slot = 0;

            while ((slot = packet.ReadByte()) != 0)
            {
                int itemid = packet.ReadInt();
                AvatarLook.HairEquip[slot] = itemid;
            }

            while ((slot = packet.ReadByte()) != 0)
            {
                int itemid = packet.ReadInt();
                AvatarLook.UnseenEquip[slot] = itemid;
            }
#endif
        }
Exemplo n.º 2
0
        public void Load(GW_CharacterStat cs, int[] equips, int[] equipsCash, bool putCashInUnseen)
        {
            Gender       = cs.Gender;
            Skin         = cs.Skin;
            Face         = cs.Face;
            HairEquip[0] = cs.Hair;

            if (putCashInUnseen)
            {
                for (byte i = 1; i < Constants.EquipSlots.MaxSlotIndex; i++)
                {
                    HairEquip[i]   = equips[i];
                    UnseenEquip[i] = equipsCash[i];
                }
            }
            else
            {
                for (byte i = 1; i < Constants.EquipSlots.MaxSlotIndex; i++)
                {
                    bool isWeaponSlot = false;

                    isWeaponSlot = i == (byte)Constants.EquipSlots.Slots.Weapon;

                    int equipId = 0;
                    if (!isWeaponSlot && equipsCash[i] != 0)
                    {
                        // Actual bug in Wvs: resetting HairEquip twice
                        equipId = HairEquip[i] = equipsCash[i];
                    }
                    else
                    {
                        equipId = equips[i];
                    }

                    HairEquip[i] = equipId;

                    if (!isWeaponSlot && equips[i] != 0 && equipsCash[i] != 0)
                    {
                        UnseenEquip[i] = equips[i];
                    }
                    else
                    {
                        UnseenEquip[i] = 0;
                    }
                }
            }

            WeaponStickerID = equipsCash[(byte)Constants.EquipSlots.Slots.Weapon];
        }