123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514 |
- using Newtonsoft.Json.Linq;
- using System.Collections.Generic;
- using UnityEngine;
- /// <summary>
- /// 玩家装备仓库集合
- /// </summary>
- public class GameCollectEquips
- {
- /// <summary>
- /// 装备集合
- /// </summary>
- public Dictionary<int, UserEquipmentVo> equipments = new Dictionary<int, UserEquipmentVo>();
- /// <summary>
- /// 武器记录
- /// </summary>
- public List<string> weaponRecord = new List<string>();
- /// <summary>
- /// 查询当前英雄可用的装备列表
- /// </summary>
- /// <param name="heroTypeid"></param>
- /// <returns></returns>
- public List<UserEquipmentVo> FindUseableEquips(int heroTypeid)
- {
- var li = new List<UserEquipmentVo>();
- 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<Dictionary<int, UserEquipmentVo>>();
- 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());
- }
- }
- }
- }
- /// <summary>
- /// 玩家装备数据结构
- /// </summary>
- public class UserEquipmentVo : ItemVo
- {
- /// <summary>
- /// 模板id
- /// </summary>
- //public new int typeId;
- /// <summary>
- /// 装备英雄的id, 默认0
- /// </summary>
- public int herouid;
- // todo: 其它字段带补充(后期加入强化后 --王刚2020年1月2日14:13:59)
- #region 暂空
- /// <summary>
- /// 当前星级
- /// </summary>
- public int starLevel;
- /// <summary>
- /// 当前星级上限
- /// </summary>
- public int maxStar;
- /// <summary>
- /// 当前等级
- /// </summary>
- //public new int level;
- /// <summary>
- /// 当前经验
- /// </summary>
- public int exp;
- /// <summary>
- /// 下一等级经验
- /// </summary>
- 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;
- }
- }
- /// <summary>
- /// 是否锁定(锁定后不会被误卖)
- /// </summary>
- public int isLocked;
- /// <summary>
- /// 是否使用中(装备)
- /// </summary>
- public int WhoIsUsing { get { return this.herouid; } }
- /// <summary>
- /// 等级
- /// </summary>
- public int level { get; set; }
- /// <summary>
- /// 消耗的道具----突破
- /// </summary>
- public List<ItemVo> costItem_tupo
- {
- get
- {
- List<ItemVo> list = new List<ItemVo>();
- 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;
- }
- }
- /// <summary>
- /// 总览属性
- /// </summary>
- public Dictionary<EHeroProperties, int> baseAttr
- {
- get
- {
- Dictionary<EHeroProperties, int> attr = new Dictionary<EHeroProperties, int>();
- 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;
- }
- }
- /// <summary>
- /// 突破后属性变化值
- /// </summary>
- public Dictionary<EHeroProperties, int> changeAttr
- {
- get
- {
- Dictionary<EHeroProperties, int> attr = new Dictionary<EHeroProperties, int>();
- 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;
- }
- }
- /// <summary>
- /// 当前星级限制的等级
- /// </summary>
- 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;
- }
- }
- /// <summary>
- /// 突破的玩家等级限制
- /// </summary>
- 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;
- }
- }
- /// <summary>
- /// 突破后的星级等级限制
- /// </summary>
- 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;
- }
- }
- /// <summary>
- /// 是不是升级按钮 true:是
- /// </summary>
- 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;
- }
- }
- /// <summary>
- /// 升级需要的材料道具
- /// </summary>
- public List<ItemVo> costItem_Upgrade
- {
- get
- {
- List<ItemVo> list = new List<ItemVo>();
- if (this.starLevel >= 5)
- {
- return list;
- }
- List<sm_item_stones_type> stonelist = sm_item_stones_type.getItemStoneList(Enum_CostItemStonesType.Wuqi);
- if (stonelist.Count == 0)
- {
- return list;
- }
- Dictionary<string, ItemVo> collectItemDic = UserProxy.Instance.player.collectItem.collectItemDic;
- foreach (sm_item_stones_type item in stonelist)
- {
- string typeId = item.typeId.ToString();
- foreach (KeyValuePair<string, ItemVo> 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;
- }
- }
- /// <summary>
- ///
- /// </summary>
- 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
- /// <summary>
- /// 获取装备的Mo(基础数据), 武器扩展数据请继续.GetWeaponExt();
- /// </summary>
- /// <returns></returns>
- public sm_item_base EquipMo()
- {
- return sm_item_base.GetMoById(int.Parse(this.typeId));
- }
- #region-------->武器商店
- /// <summary>
- /// 是否已经售罄 true:是
- /// </summary>
- public bool isSellOut { get; set; }
- //{
- // get
- // {
- // UserProxy.Instance.player.weaponReward
- // return false;
- // }
- //}
- /// <summary>
- /// 售价
- /// </summary>
- public int cost { get; set; }
- public int limitNum
- {
- get
- {
- return 1;
- }
- }
- #endregion
- }
|