Ejemplo n.º 1
0
        //this is only ever sent to MainPlayer (avatar handles other players)
        private void _handlePaperdollAgree(Packet pkt)
        {
            if (OnPlayerPaperdollChange == null)
            {
                return;
            }

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

            PaperdollEquipData data = new PaperdollEquipData(pkt, false);

            OnPlayerPaperdollChange(data);
        }
Ejemplo n.º 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 _playerPaperdollChange(PaperdollEquipData _data)
 {
     Character c;
     if (!_data.ItemWasUnequipped)
     {
         ItemRecord rec = World.Instance.EIF.GetItemRecordByID(_data.ItemID);
         //update inventory
         (c = World.Instance.MainPlayer.ActiveCharacter).UpdateInventoryItem(_data.ItemID, _data.ItemAmount);
         //equip item
         c.EquipItem(rec.Type, (short) rec.ID, (short) rec.DollGraphic, true, (sbyte) _data.SubLoc);
         //add to paperdoll dialog
         if (EOPaperdollDialog.Instance != null)
             EOPaperdollDialog.Instance.SetItem(rec.GetEquipLocation() + _data.SubLoc, rec);
     }
     else
     {
         c = World.Instance.MainPlayer.ActiveCharacter;
         //update inventory
         c.UpdateInventoryItem(_data.ItemID, 1, true); //true: add to existing quantity
         //unequip item
         c.UnequipItem(World.Instance.EIF.GetItemRecordByID(_data.ItemID).Type, _data.SubLoc);
     }
     c.UpdateStatsAfterEquip(_data);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
        //this is only ever sent to MainPlayer (avatar handles other players)
        private void _handlePaperdollAgree(Packet pkt)
        {
            if (OnPlayerPaperdollChange == null) return;

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

            PaperdollEquipData data = new PaperdollEquipData(pkt, false);
            OnPlayerPaperdollChange(data);
        }
Ejemplo n.º 6
0
        public void UpdateStatsAfterEquip(PaperdollEquipData data)
        {
            Stats.SetMaxHP(data.MaxHP);
            Stats.SetMaxTP(data.MaxTP);

            Stats.SetStr(data.Str);
            Stats.SetInt(data.Int);
            Stats.SetWis(data.Wis);
            Stats.SetAgi(data.Agi);
            Stats.SetCon(data.Con);
            Stats.SetCha(data.Cha);

            Stats.SetMinDam(data.MinDam);
            Stats.SetMaxDam(data.MaxDam);
            Stats.SetAccuracy(data.Accuracy);
            Stats.SetEvade(data.Evade);
            Stats.SetArmor(data.Armor);
        }
Ejemplo n.º 7
0
		public void UpdateStatsAfterEquip(PaperdollEquipData data)
		{
			Stats.MaxHP = data.MaxHP;
			Stats.MaxTP = data.MaxTP;

			Stats.Str = data.Str;
			Stats.Int = data.Int;
			Stats.Wis = data.Wis;
			Stats.Agi = data.Agi;
			Stats.Con = data.Con;
			Stats.Cha = data.Cha;

			Stats.MinDam = data.MinDam;
			Stats.MaxDam = data.MaxDam;
			Stats.Accuracy = data.Accuracy;
			Stats.Evade = data.Evade;
			Stats.Armor = data.Armor;
		}