// Copyright © 2017-2018 Atomic Software, LLC. All Rights Reserved.
// See LICENSE.md for full license information.

using Atom.Core.Collections;
using Atom.Core.Extensions;
using Atom.Core.Game.GameObjects.Items;
using Atom.Core.Game.Tutorial;
using Atom.Core.Mathematics;
using System;

namespace Atom.Core.Game.GameObjects.Characters
{
    /// <summary>
    /// The simple character class is used by the WM server because it
    /// contains WM-specific properties that are not used by the zone server.
    /// It also consumes more memory (for now).
    /// </summary>
    public class SimpleCharacter
    {
        public int CharNo { get; set; }
        public string Name { get; set; }
        public byte Slot { get; set; }
        public byte Level { get; set; }
        public byte Hair { get; set; }
        public byte HairColor { get; set; }
        public byte Face { get; set; }
        public CharacterClass Class { get; set; }
        public CharacterClass BaseClass => Class.GetBaseClass();
        public Gender Gender { get; set; }
        public Dictionary<ItemSlot, ushort> EquippedItems { get; set; }
        public string MapIndx { get; set; }
        public int X { get; set; }
        public int Y { get; set; }
        public int KQHandle { get; set; }
        public string KQMapIndx { get; set; }
        public Vector2 KQPosition { get; set; }
        public DateTime KQDate { get; set; }
        public int HP { get; set; }
        public int SP { get; set; }
        public int HPStone { get; set; }
        public int SPStone { get; set; }
        public long Money { get; set; }
        public long EXP { get; set; }
        public Dictionary<ushort, int> ItemLots { get; set; }
        public TutorialState TutorialState { get; set; }
        public byte TutorialStep { get; set; }
        public bool IsDeleted { get; set; }
        public DateTime DeletedDate { get; set; }
        public ushort FriendPoints { get; set; }
        public List<ushort> Skills { get; set; }
        public List<int> Quests { get; set; }
        public Dictionary<byte, Shortcut> Shortcuts { get; set; }
        public byte[] ShortcutData { get; set; }
        public byte[] KeyMappingData { get; set; }
        public byte[] GameSettingsData { get; set; }
        public byte[] ShortcutSizeData { get; set; }
        public byte[] WindowPosData { get; set; }

        public SimpleCharacter()
        {
            EquippedItems = new Dictionary<ItemSlot, ushort>();
            ItemLots = new Dictionary<ushort, int>();
            Skills = new List<ushort>();
            Quests = new List<int>();
            Shortcuts = new Dictionary<byte, Shortcut>();
        }

        public bool ShouldChangeName()
        {
            return false;
        }

        public ushort GetEquippedItem(ItemSlot itemSlot)
        {
            return !EquippedItems.ContainsKey(itemSlot) ? ushort.MaxValue : EquippedItems[itemSlot];
        }
    }
}
