using CommonLang;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XmdsCommonServer.XLS.Data;
using XmdsCommonSkill.Plugin.CardSkill;

namespace XmdsCommonServer.Plugin.Base
{
	//技能相关全局信息
	public class XmdsGlobalData
	{
		public static readonly XmdsSkillValue DefaultValue = new XmdsSkillValue("", false);

		/// <summary>
		/// 技能天赋信息
		/// </summary>
		private static HashMap<int, XmdsSkillValue> mTalentInfo = new HashMap<int, XmdsSkillValue>();

		/** 技能破定值 */
		private static HashMap<int, int> mSkillBreakShieldValue = new HashMap<int, int>();

		//玩家天赋数据,重进游戏保存
		// private static HashMap<string, JSGPlayerCardModule> mPlayerCardModuleMaps = new HashMap<string, JSGPlayerCardModule>();

		public static void PutTalentData(int skillID, XmdsSkillValue data)
		{
			if(data.GetValue(1) > 0 || data.GetValue(2) > 0)
			{
				mTalentInfo.Put(skillID, data);
			}			
		}

		public static XmdsSkillValue GetTalentData(int skillID)
		{
			XmdsSkillValue outData;
			mTalentInfo.TryGetValue(skillID, out outData);
			return (outData == null) ? DefaultValue : outData;
		}

		/** 记录技能破定信息 */
		public static void PutSkillBreakShieldValue(int skillId, int value)
		{
			mSkillBreakShieldValue.Put(skillId, value);
		}

		public static int GetSkillBreakShieldValue(int skillId)
		{
			return mSkillBreakShieldValue.Get(skillId);
		}

		// public static JSGPlayerCardModule GetPlayerCardModule(XmdsVirtual player)
		// {
		// 	if(player == null || string.IsNullOrEmpty(player.mUnit.PlayerUUID))
		// 	{
		// 		return null;
		// 	}
		//
		// 	JSGPlayerCardModule module = mPlayerCardModuleMaps.Get(player.mUnit.PlayerUUID);
		// 	if(module == null)
		// 	{
		// 		module = new JSGPlayerCardModule(player);
		// 		mPlayerCardModuleMaps.Put(player.mUnit.PlayerUUID, module);
		// 	}
		//
		// 	return module;
		// }
	}
}