public void SetDisplayItemsFromRenderData(CharRenderData newRenderData)
 {
     EquipItem(ItemType.Boots, (short)(OldWorld.Instance.EIF.Data.SingleOrDefault(x => x.Type == ItemType.Boots && x.DollGraphic == newRenderData.boots) ?? new EIFRecord()).ID, newRenderData.boots, true);
     EquipItem(ItemType.Armor, (short)(OldWorld.Instance.EIF.Data.SingleOrDefault(x => x.Type == ItemType.Armor && x.DollGraphic == newRenderData.armor) ?? new EIFRecord()).ID, newRenderData.armor, true);
     EquipItem(ItemType.Hat, (short)(OldWorld.Instance.EIF.Data.SingleOrDefault(x => x.Type == ItemType.Hat && x.DollGraphic == newRenderData.hat) ?? new EIFRecord()).ID, newRenderData.hat, true);
     EquipItem(ItemType.Shield, (short)(OldWorld.Instance.EIF.Data.SingleOrDefault(x => x.Type == ItemType.Shield && x.DollGraphic == newRenderData.shield) ?? new EIFRecord()).ID, newRenderData.shield, true);
     EquipItem(ItemType.Weapon, (short)(OldWorld.Instance.EIF.Data.SingleOrDefault(x => x.Type == ItemType.Weapon && x.DollGraphic == newRenderData.weapon) ?? new EIFRecord()).ID, newRenderData.weapon, true);
 }
        public OldCharacter(PacketAPI api, int id, CharRenderData data)
        {
            m_packetAPI = api;
            ID          = id;
            RenderData  = data ?? new CharRenderData();

            Inventory = new List <InventoryItem>();
            Spells    = new List <InventorySpell>();
            PaperDoll = new short[(int)EquipLocation.PAPERDOLL_MAX];
        }
        public OldCharacter()
        {
            //mock all members with non-null fields
            //PacketAPI cannot be mocked...
            Inventory = new List <InventoryItem>();
            Spells    = new List <InventorySpell>();
            PaperDoll = new short[(int)EquipLocation.PAPERDOLL_MAX];

            Stats      = new CharStatData();
            RenderData = new CharRenderData();

            Name = PaddedGuildTag = GuildName = GuildRankStr = "";
        }
        //constructs a character from a packet sent from the server
        public OldCharacter(PacketAPI api, CharacterData data)
        {
            //initialize lists
            m_packetAPI = api;

            Inventory = new List <InventoryItem>();
            Spells    = new List <InventorySpell>();
            PaperDoll = new short[(int)EquipLocation.PAPERDOLL_MAX];

            Name = data.Name;

            ID         = data.ID;
            CurrentMap = data.Map;
            X          = data.X;
            Y          = data.Y;

            PaddedGuildTag = data.GuildTag;

            RenderData = new CharRenderData
            {
                facing    = data.Direction,
                level     = data.Level,
                gender    = data.Gender,
                hairstyle = data.HairStyle,
                haircolor = data.HairColor,
                race      = data.Race
            };

            Stats = new CharStatData
            {
                MaxHP = data.MaxHP,
                HP    = data.HP,
                MaxTP = data.MaxTP,
                TP    = data.TP
            };

            EquipItem(ItemType.Boots, 0, data.Boots, true);
            EquipItem(ItemType.Armor, 0, data.Armor, true);
            EquipItem(ItemType.Hat, 0, data.Hat, true);
            EquipItem(ItemType.Shield, 0, data.Shield, true);
            EquipItem(ItemType.Weapon, 0, data.Weapon, true);

            RenderData.SetSitting(data.Sitting);
            RenderData.SetHidden(data.Hidden);
        }