Пример #1
0
        //this is only ever sent to MainPlayer (avatar handles other players)
        private void _handlePaperdollAgree(OldPacket pkt)
        {
            if (OnPlayerPaperdollChange == null)
            {
                return;
            }

            //see PlayerAvatarChangeHandler
            //_handleAvatarAgree(pkt); //same logic in the beginning of the packet

            PaperdollEquipData data = new PaperdollEquipData(pkt, false);

            OnPlayerPaperdollChange(data);
        }
Пример #2
0
        //this is only ever sent to MainPlayer (avatar handles other players)
        private void _handlePaperdollRemove(OldPacket pkt)
        {
            if (OnPlayerPaperdollChange == null)
            {
                return;
            }

            //the $strip command does this wrong (adding 0's in), somehow the original client is smart enough to figure it out
            //normally would put this block in the _handleAvatarAgree
            short      playerID = pkt.GetShort();
            AvatarSlot slot     = (AvatarSlot)pkt.GetChar();
            bool       sound    = pkt.GetChar() == 0; //sound : 0

            short boots = pkt.GetShort();

            if (pkt.Length != 45)
            {
                pkt.Skip(sizeof(short) * 3);                   //three 0s
            }
            short armor = pkt.GetShort();

            if (pkt.Length != 45)
            {
                pkt.Skip(sizeof(short));                   // one 0
            }
            short hat = pkt.GetShort();
            short shield, weapon;

            if (pkt.Length != 45)
            {
                shield = pkt.GetShort();
                weapon = pkt.GetShort();
            }
            else
            {
                weapon = pkt.GetShort();
                shield = pkt.GetShort();
            }

            AvatarData renderData = new AvatarData(playerID, slot, sound, boots, armor, hat, weapon, shield);
            //if (OnPlayerAvatarChange != null) //see PlayerAvatarChangeHandler
            //    OnPlayerAvatarChange(renderData);

            PaperdollEquipData data = new PaperdollEquipData(pkt, true);

            OnPlayerPaperdollChange(data);
        }