Example #1
0
        // Player changes appearance (clothes, hair, etc)
        private void _handleAvatarAgree(Packet pkt)
        {
            short      playerID = pkt.GetShort();
            AvatarSlot slot     = (AvatarSlot)pkt.GetChar();

            switch (slot)
            {
            case AvatarSlot.Clothes:
            {
                AvatarData newRenderData = new AvatarData(
                    playerID,
                    slot,
                    pkt.GetChar() == 0,                                      //sound
                    pkt.GetShort(),                                          //boots
                    pkt.GetShort(),                                          //armor
                    pkt.GetShort(),                                          //hat
                    pkt.GetShort(),                                          //weapon
                    pkt.GetShort()                                           //shield
                    );
                if (OnPlayerAvatarChange != null)
                {
                    OnPlayerAvatarChange(newRenderData);
                }
            }
            break;

            case AvatarSlot.Hair:
            {
                if (pkt.GetChar() != 0)
                {
                    return;                                                     //subloc -- not sure what this does
                }
                AvatarData data = new AvatarData(playerID, slot, pkt.GetChar(), pkt.GetChar());
                if (OnPlayerAvatarChange != null)
                {
                    OnPlayerAvatarChange(data);
                }
            }
            break;

            case AvatarSlot.HairColor:
            {
                if (pkt.GetChar() != 0)
                {
                    return;                                                     //subloc -- not sure what this does
                }
                AvatarData data = new AvatarData(playerID, slot, 0, pkt.GetChar());
                if (OnPlayerAvatarChange != null)
                {
                    OnPlayerAvatarChange(data);
                }
            }
            break;
            }
        }
Example #2
0
        //this is only ever sent to MainPlayer (avatar handles other players)
        private void _handlePaperdollRemove(Packet 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)
            {
                OnPlayerAvatarChange(renderData);
            }

            PaperdollEquipData data = new PaperdollEquipData(pkt, true);

            OnPlayerPaperdollChange(data);
        }
 private void _playerAvatarChange(AvatarData _data)
 {
     switch (_data.Slot)
     {
         case AvatarSlot.Clothes:
             World.Instance.ActiveMapRenderer.UpdateOtherPlayerRenderData(_data.ID, _data.Sound, new CharRenderData
             {
                 boots = _data.Boots,
                 armor = _data.Armor,
                 hat = _data.Hat,
                 shield = _data.Shield,
                 weapon = _data.Weapon
             });
             break;
         case AvatarSlot.Hair:
             World.Instance.ActiveMapRenderer.UpdateOtherPlayerHairData(_data.ID, _data.HairColor, _data.HairStyle);
             break;
         case AvatarSlot.HairColor:
             World.Instance.ActiveMapRenderer.UpdateOtherPlayerHairData(_data.ID, _data.HairColor);
             break;
     }
 }
Example #4
0
        //this is only ever sent to MainPlayer (avatar handles other players)
        private void _handlePaperdollRemove(Packet 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)
                OnPlayerAvatarChange(renderData);

            PaperdollEquipData data = new PaperdollEquipData(pkt, true);
            OnPlayerPaperdollChange(data);
        }
Example #5
0
		// Player changes appearance (clothes, hair, etc)
		private void _handleAvatarAgree(Packet pkt)
		{
			short playerID = pkt.GetShort();
			AvatarSlot slot = (AvatarSlot)pkt.GetChar();
			switch (slot)
			{
				case AvatarSlot.Clothes:
					{
						AvatarData newRenderData = new AvatarData(
							playerID,
							slot,
							pkt.GetChar() == 0,  //sound
							pkt.GetShort(),      //boots
							pkt.GetShort(),      //armor
							pkt.GetShort(),      //hat
							pkt.GetShort(),      //weapon
							pkt.GetShort()       //shield
						);
						if (OnPlayerAvatarChange != null)
							OnPlayerAvatarChange(newRenderData);
					}
					break;
				case AvatarSlot.Hair:
					{
						if (pkt.GetChar() != 0) return; //subloc -- not sure what this does
						AvatarData data = new AvatarData(playerID, slot, pkt.GetChar(), pkt.GetChar());
						if (OnPlayerAvatarChange != null)
							OnPlayerAvatarChange(data);
					}
					break;
				case AvatarSlot.HairColor:
					{
						if (pkt.GetChar() != 0) return; //subloc -- not sure what this does
						AvatarData data = new AvatarData(playerID, slot, 0, pkt.GetChar());
						if (OnPlayerAvatarChange != null)
							OnPlayerAvatarChange(data);
					}
					break;
			}
		}