using Newtonsoft.Json.Linq; using System.Collections.Generic; using UnityEngine; /// /// 玩家装备仓库集合 /// public class GameCollectEquips { /// /// 装备集合 /// public Dictionary equipments = new Dictionary(); /// /// 武器记录 /// public List weaponRecord = new List(); /// /// 查询当前英雄可用的装备列表 /// /// /// public List FindUseableEquips(int heroTypeid) { var li = new List(); foreach (var kv in equipments) { var mo = sm_item_weapon.GetMoById(int.Parse(kv.Value.typeId)); if (null != mo) { string[] heroList = mo.hero_id.Split(','); foreach (string hero_id in heroList) { if (hero_id == heroTypeid.ToString()) { li.Add(kv.Value); } } } } return li; } public void InitItemData(JObject store) { if (store["equipment"] != null) { // {uid:{typeId:"",level:x,...},uid:{...},...} equipments = store["equipment"].ToObject>(); foreach (var kv in equipments) { kv.Value.uid = kv.Key.ToString(); } } if (store["weaponRecord"] != null) { this.weaponRecord.Clear(); JArray arr = JArray.Parse(store["weaponRecord"].ToString()); foreach (JToken id in arr) { this.weaponRecord.Add(id.ToString()); } } } } /// /// 玩家装备数据结构 /// public class UserEquipmentVo : ItemVo { /// /// 模板id /// //public new int typeId; /// /// 装备英雄的id, 默认0 /// public int herouid; // todo: 其它字段带补充(后期加入强化后 --王刚2020年1月2日14:13:59) #region 暂空 /// /// 当前星级 /// public int starLevel; /// /// 当前星级上限 /// public int maxStar; /// /// 当前等级 /// //public new int level; /// /// 当前经验 /// public int exp; /// /// 下一等级经验 /// public int nextExp { get { if (this.starLimitLv == this.level) { return exp; } //var mo = GameConfigData.Ins.Getweapon_levelexpMo(this.level+1); var mo = GameConfigData.Ins.Getweapon_levelexpMo(EquipMo().quality, this.level + 1); if (mo != null) { return mo.requiredExp; } var lastMo = GameConfigData.Ins.Getweapon_levelexpMo(EquipMo().quality, this.level); if (lastMo != null) { return lastMo.requiredExp; } return 0; } } /// /// 是否锁定(锁定后不会被误卖) /// public int isLocked; /// /// 是否使用中(装备) /// public int WhoIsUsing { get { return this.herouid; } } /// /// 等级 /// public int level { get; set; } /// /// 消耗的道具----突破 /// public List costItem_tupo { get { List list = new List(); if (this.starLevel >= 5) { return list; } sm_weaponextra_level mo = sm_weaponextra_level.GetMoById(int.Parse(this.typeId), this.starLevel + 1); string[] sList = mo.costItems.Split(';'); foreach (string item in sList) { string[] str = item.Split(','); ItemVo vo = new ItemVo(); vo.typeId = str[0]; vo.count = int.Parse(str[1]); list.Add(vo); } //ItemVo itVo = new ItemVo(); //itVo.typeId = mo.segID.ToString(); //itVo.count = mo.segNum; //list.Add(itVo); return list; } } /// /// 总览属性 /// public Dictionary baseAttr { get { Dictionary attr = new Dictionary(); sm_weaponextra_level mo = sm_weaponextra_level.GetMoById(int.Parse(this.typeId), this.starLevel); //生命 int hp = mo.hp + (this.level - 1) * mo.hpRate; //Debug.Log("当前等级-----hp--------" + hp); //float addHp = hp + hp * (1.0f*this.Mo().GetYanlingExt().additional_hpUpperlimit/100); if (hp != 0) { attr[EHeroProperties.HP] = hp; } int mp = mo.nengliangzhi + (this.level - 1) * mo.nengliangzhiRate; if (mp != 0) { attr[EHeroProperties.NENGLIANGZHI] = mp; } //暴击 int crit = mo.baoji + (this.level - 1) * mo.baojiRate; //Debug.Log("当前等级-----crit--------" + crit); //float addCrit = crit + crit * 1.0f * this.Mo().GetYanlingExt().additional_critDamage/100; if (crit != 0) { attr[EHeroProperties.CRICITAL] = crit; } //物理攻击 int phyAtk = mo.wuligongji + (this.level - 1) * mo.wuligongjiRate; //Debug.Log("当前等级-------phyAtk------" + phyAtk); //float addPhyAtk = phyAtk + phyAtk * 1.0f * this.Mo().GetYanlingExt().additional_phyDamage/100; if (phyAtk != 0) { attr[EHeroProperties.WULIGONGJI] = phyAtk; } //防御护甲 int phyDef = mo.fangyuhujia + (this.level - 1) * mo.fangyuhujiaRate; //Debug.Log("当前等级-----phyDef--------" + phyDef); //float addPhyDef = phyDef + phyDef * 1.0f * this.Mo().GetYanlingExt().additional_phyDefend/100; if (phyDef != 0) { attr[EHeroProperties.FANGYUHUJIA] = phyDef; } //攻击速度--废弃 //int atkSpeed = mo.gongjisudu + (this.level - 1) * mo.gongjisuduRate; //Debug.Log("当前等级----atkSpeed---------" + atkSpeed); //float addAtkSpeed = atkSpeed + atkSpeed * 1.0f * this.Mo().GetYanlingExt().additional_atkSpeed/100; //if (atkSpeed != 0) //{ // attr[EHeroProperties.ATKSPEED] = atkSpeed; //} //法术强度 int fashuqiangdu = mo.fashuqiangdu + (this.level - 1) * mo.fashuqiangduRate; if (fashuqiangdu != 0) { attr[EHeroProperties.FASHUQIANGDU] = fashuqiangdu; } //魔法抗性 int mofakangxing = mo.mofakangxing + (this.level - 1) * mo.mofakangxingRate; if (mofakangxing != 0) { attr[EHeroProperties.MOFAKANGXING] = mofakangxing; } int yanli = mo.yanli + (this.level - 1) * mo.yanliRate; if (yanli != 0) { attr[EHeroProperties.YANLI] = yanli; } return attr; } } /// /// 突破后属性变化值 /// public Dictionary changeAttr { get { Dictionary attr = new Dictionary(); int nextStar = this.starLevel + 1; if (this.starLevel >= 5) { nextStar = 5; } sm_weaponextra_level mo = sm_weaponextra_level.GetMoById(int.Parse(this.typeId), nextStar); //生命 int hp = mo.hp + (this.level - 1) * mo.hpRate; if (hp != 0) { attr[EHeroProperties.HP] = hp; } int mp = mo.nengliangzhi + (this.level - 1) * mo.nengliangzhiRate; if (mp != 0) { attr[EHeroProperties.NENGLIANGZHI] = mp; } //暴击 int crit = mo.baoji + (this.level - 1) * mo.baojiRate; if (crit != 0) { attr[EHeroProperties.CRICITAL] = crit; } //物理攻击 int phyAtk = mo.wuligongji + (this.level - 1) * mo.wuligongjiRate; if (phyAtk != 0) { attr[EHeroProperties.WULIGONGJI] = phyAtk; } //防御护甲 int phyDef = mo.fangyuhujia + (this.level - 1) * mo.fangyuhujiaRate; if (phyDef != 0) { attr[EHeroProperties.FANGYUHUJIA] = phyDef; } //攻击速度 //int atkSpeed = mo.gongjisudu + (this.level - 1) * mo.gongjisuduRate; //if (atkSpeed != 0) //{ // attr[EHeroProperties.ATKSPEED] = atkSpeed; //} //法术强度 int fashuqiangdu = mo.fashuqiangdu + (this.level - 1) * mo.fashuqiangduRate; if (fashuqiangdu != 0) { attr[EHeroProperties.FASHUQIANGDU] = fashuqiangdu; } //魔法抗性 int mofakangxing = mo.mofakangxing + (this.level - 1) * mo.mofakangxingRate; if (mofakangxing != 0) { attr[EHeroProperties.MOFAKANGXING] = mofakangxing; } int yanli = mo.yanli + (this.level - 1) * mo.yanliRate; if (yanli != 0) { attr[EHeroProperties.YANLI] = yanli; } return attr; } } /// /// 当前星级限制的等级 /// public int starLimitLv { get { sm_weaponextra_level mo = sm_weaponextra_level.GetMoById(int.Parse(this.typeId), this.starLevel); if (mo == null) { return 0; } return mo.promoteLv; } } /// /// 突破的玩家等级限制 /// public int userLimitLv { get { if (this.starLevel >= 5) { return 0; } sm_weaponextra_level mo = sm_weaponextra_level.GetMoById(int.Parse(this.typeId), this.starLevel + 1); return mo.userlvLimit; } } /// /// 突破后的星级等级限制 /// public int lastStarLimitLv_Tupo { get { if (this.starLevel >= 5) { return 0; } sm_weaponextra_level mo = sm_weaponextra_level.GetMoById(int.Parse(this.typeId), this.starLevel + 1); if (mo == null) { return 0; } return mo.promoteLv; } } /// /// 是不是升级按钮 true:是 /// public bool isUpgrade { get { if (this.starLevel >= 5) { return true; } //&& UserProxy.Instance.player.baseInfo.level >= sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).userlvLimit if (this.level >= this.starLimitLv) { return false; } return true; } } /// /// 升级需要的材料道具 /// public List costItem_Upgrade { get { List list = new List(); if (this.starLevel >= 5) { return list; } List stonelist = sm_item_stones_type.getItemStoneList(Enum_CostItemStonesType.Wuqi); if (stonelist.Count == 0) { return list; } Dictionary collectItemDic = UserProxy.Instance.player.collectItem.collectItemDic; foreach (sm_item_stones_type item in stonelist) { string typeId = item.typeId.ToString(); foreach (KeyValuePair kv in collectItemDic) { if (kv.Value.typeId == typeId) { ItemVo itVo = new ItemVo(); itVo.typeId = typeId; itVo.count = kv.Value.count; list.Add(itVo); } } } return list; } } /// /// /// public int costGold_tupo { get { if (this.starLevel >= 5) { return 0; } sm_weaponextra_level mo = sm_weaponextra_level.GetMoById(int.Parse(this.typeId), this.starLevel + 1); return mo.gold; } } #endregion /// /// 获取装备的Mo(基础数据), 武器扩展数据请继续.GetWeaponExt(); /// /// public sm_item_base EquipMo() { return sm_item_base.GetMoById(int.Parse(this.typeId)); } #region-------->武器商店 /// /// 是否已经售罄 true:是 /// public bool isSellOut { get; set; } //{ // get // { // UserProxy.Instance.player.weaponReward // return false; // } //} /// /// 售价 /// public int cost { get; set; } public int limitNum { get { return 1; } } #endregion }