| | |
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | [XLua.LuaCallCSharp]
|
| | | public class PackModelInterface : Model, IBeforePlayerDataInitialize,IPlayerLoginOk
|
| | | [XLua.LuaCallCSharp]
|
| | | public class PackModelInterface : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
| | | {
|
| | | private ItemConfig tagChinModel;
|
| | | private FuncConfigConfig _equipGSFormula;
|
| | |
| | | private FuncConfigConfig _oneKeySellFunc;
|
| | | public int[] preciousItemType { get; private set; }
|
| | | private int[] drugIDs;
|
| | | public Dictionary<int,List<int>> betterEquipExceptDungeonDict { get; private set; }
|
| | | public Dictionary<int, List<int>> betterEquipExceptDungeonDict { get; private set; }
|
| | |
|
| | | private int[] onekeySellTypes;
|
| | | PlayerPackModel _playerPack;
|
| | | PlayerPackModel playerPack
|
| | | {
|
| | | PlayerPackModel playerPack {
|
| | | get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
|
| | | }
|
| | |
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel
|
| | | {
|
| | | get
|
| | | {
|
| | | ItemTipsModel itemTipsModel {
|
| | | get {
|
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
| | | }
|
| | | }
|
| | |
| | | private int[] pushItemIds;
|
| | | public int[] pushBuffTypeIds;
|
| | | private List<int> equipBaseAttrlist = new List<int>();
|
| | | public Dictionary<int, int> promptUseLimitDict { get; private set;}
|
| | | public Dictionary<int, int> promptUseLimitDict { get; private set; }
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | _equipGSFormula = Config.Instance.Get<FuncConfigConfig>("EquipGSFormula");
|
| | | equipBaseAttrlist.Clear();
|
| | | JsonData baseAttr = JsonMapper.ToObject(_equipGSFormula.Numerical2);
|
| | | if(baseAttr.IsArray)
|
| | | if (baseAttr.IsArray)
|
| | | {
|
| | | for (int i = 0;i < baseAttr.Count; i++)
|
| | | for (int i = 0; i < baseAttr.Count; i++)
|
| | | {
|
| | | equipBaseAttrlist.Add(int.Parse(baseAttr[i].ToString()));
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | _itemPush = Config.Instance.Get<FuncConfigConfig>("ItemPush");
|
| | | preciousItemType = ConfigParse.GetMultipleStr<int>(_itemPush.Numerical1);
|
| | |
|
| | |
| | | FuncConfigConfig betterEquipExcConfig = Config.Instance.Get<FuncConfigConfig>("GoodItemDungeon");
|
| | | betterEquipExceptDungeonDict = new Dictionary<int, List<int>>();
|
| | | JsonData excEquipData = JsonMapper.ToObject(betterEquipExcConfig.Numerical1);
|
| | | foreach(var dungeonId in excEquipData.Keys)
|
| | | foreach (var dungeonId in excEquipData.Keys)
|
| | | {
|
| | | List<int> idlist = new List<int>();
|
| | | betterEquipExceptDungeonDict.Add(int.Parse(dungeonId),idlist);
|
| | | for(int i = 0; i < excEquipData[dungeonId].Count; i++)
|
| | | betterEquipExceptDungeonDict.Add(int.Parse(dungeonId), idlist);
|
| | | for (int i = 0; i < excEquipData[dungeonId].Count; i++)
|
| | | {
|
| | | int itemId = int.Parse(excEquipData[dungeonId][i].ToString());
|
| | | idlist.Add(itemId);
|
| | |
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | |
| | |
|
| | | }
|
| | |
|
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | #region 计算装备评分
|
| | |
| | | /// 得到特殊属性的字典
|
| | | /// </summary>
|
| | | private Dictionary<AttrEnum, int> specAttrDic = new Dictionary<AttrEnum, int>();
|
| | | public int SetEquipScore(PackType type,int itemId,Dictionary<int, List<int>> useDataDic = null,bool isPreview = false)
|
| | | public int SetEquipScore(PackType type, int itemId, Dictionary<int, List<int>> useDataDic = null, bool isPreview = false)
|
| | | {
|
| | | specAttrDic.Clear();
|
| | | int id = itemId;
|
| | |
| | | switch (itemConfig.EquipPlace)
|
| | | {
|
| | | case 11:
|
| | | CalculateWingsLegendAttr(itemConfig,out legendIdlist, out legendValuelist);
|
| | | CalculateWingsLegendAttr(itemConfig, out legendIdlist, out legendValuelist);
|
| | | break;
|
| | | case 1:
|
| | | case 2:
|
| | |
| | | case 9:
|
| | | case 10:
|
| | | case 12:
|
| | | CalculateEquipLegendAttr(itemConfig,out legendIdlist,out legendValuelist);
|
| | | CalculateEquipLegendAttr(itemConfig, out legendIdlist, out legendValuelist);
|
| | | break;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | return GetEquipScore(type,id,specAttrDic);
|
| | | |
| | | return GetEquipScore(type, id, specAttrDic);
|
| | |
|
| | | }
|
| | |
|
| | | private void CalculateEquipLegendAttr(ItemConfig itemConfig,out List<int> legendIdlist, out List<int> legendValuelist)
|
| | | private void CalculateEquipLegendAttr(ItemConfig itemConfig, out List<int> legendIdlist, out List<int> legendValuelist)
|
| | | {
|
| | | legendIdlist = new List<int>();
|
| | | legendValuelist = new List<int>();
|
| | |
| | | {
|
| | | attrCnt = attrCntDict[attrCntKey][attrType];
|
| | | }
|
| | | for(int i = 0; i < attrIds.Count; i++)
|
| | | for (int i = 0; i < attrIds.Count; i++)
|
| | | {
|
| | | if(attrCnt > i)
|
| | | if (attrCnt > i)
|
| | | {
|
| | | legendIdlist.Add(attrIds[i]);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void CalculateWingsLegendAttr(ItemConfig itemConfig,out List<int> legendIdlist, out List<int> legendValuelist)
|
| | | private void CalculateWingsLegendAttr(ItemConfig itemConfig, out List<int> legendIdlist, out List<int> legendValuelist)
|
| | | {
|
| | | legendIdlist = new List<int>();
|
| | | legendValuelist = new List<int>();
|
| | |
| | | }
|
| | | if (attrValueDict.ContainsKey(itemConfig.LV))
|
| | | {
|
| | | var attrIdDict = attrValueDict[itemConfig.LV];
|
| | | var attrIdDict = attrValueDict[itemConfig.LV];
|
| | | foreach (var attrId in attrIdDict.Keys)
|
| | | {
|
| | | if(legendIdlist.Count < attrCnt)
|
| | | if (legendIdlist.Count < attrCnt)
|
| | | {
|
| | | legendIdlist.Add(attrId);
|
| | | legendValuelist.Add(attrIdDict[attrId][0]);
|
| | |
| | | private Dictionary<AttrEnum, int> _tagGsProValueDict;
|
| | | private Dictionary<string, string> _equipGSFormulaDict = new Dictionary<string, string>(); //key 公式参数 value 参数数值
|
| | | private float curProValue = 0;
|
| | | private int GetEquipScore(PackType type,int itemId, Dictionary<AttrEnum, int> specAttrDict)
|
| | | private int GetEquipScore(PackType type, int itemId, Dictionary<AttrEnum, int> specAttrDict)
|
| | | {
|
| | | tagChinModel = Config.Instance.Get<ItemConfig>(itemId);
|
| | | if (tagChinModel == null || !GeneralDefine.CompareEquipPlaces.Contains(tagChinModel.EquipPlace)) return 0;
|
| | | if (tagChinModel == null || !GeneralDefine.CompareEquipPlaces.Contains(tagChinModel.EquipPlace)) return 0;
|
| | |
|
| | | Equation.Instance.Clear();
|
| | | _tagGsProValueDict = EquipGSParamConfig.GetTagGsProValueDict(tagChinModel.LV, tagChinModel.ItemColor,tagChinModel.StarLevel);
|
| | | _tagGsProValueDict = EquipGSParamConfig.GetTagGsProValueDict(tagChinModel.LV, tagChinModel.ItemColor, tagChinModel.StarLevel);
|
| | | curEquipAttrDict.Clear();
|
| | | itemEffectDict.Clear();
|
| | | _equipGSFormulaDict.Clear();
|
| | |
| | |
|
| | | foreach (var key in itemEffectDict.Keys)
|
| | | {
|
| | | if(equipBaseAttrlist.Contains(key))
|
| | | if (equipBaseAttrlist.Contains(key))
|
| | | {
|
| | | switch ((AttrEnum)key)
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | foreach (AttrEnum attrType in specAttrDict.Keys)
|
| | | { |
| | | {
|
| | | switch (attrType)
|
| | | {
|
| | | case AttrEnum.ATKSPEED:
|
| | |
| | | curEquipAttrDict.Add(attrType, specAttrDict[attrType]);
|
| | | break;
|
| | | default:
|
| | | if(_tagGsProValueDict != null && _tagGsProValueDict.ContainsKey(attrType))
|
| | | if (_tagGsProValueDict != null && _tagGsProValueDict.ContainsKey(attrType))
|
| | | {
|
| | | curProValue = specAttrDict[attrType] * _tagGsProValueDict[attrType];
|
| | | curEquipAttrDict.Add(attrType, curProValue);
|
| | |
| | |
|
| | | if (_equipGSFormula != null)
|
| | | {
|
| | | foreach(var key in curEquipAttrDict.Keys)
|
| | | foreach (var key in curEquipAttrDict.Keys)
|
| | | {
|
| | | PlayerPropertyConfig propertyConfig = Config.Instance.Get<PlayerPropertyConfig>((int)key);
|
| | | if(propertyConfig != null)
|
| | | if (propertyConfig != null)
|
| | | {
|
| | | Equation.Instance.AddKeyValue(propertyConfig.Parameter, curEquipAttrDict[key]);
|
| | | }
|
| | | }
|
| | |
|
| | | EquipGSParamConfig gSParamModel = EquipGSParamConfig.GetTagGSModel(tagChinModel.LV, tagChinModel.ItemColor,tagChinModel.StarLevel);
|
| | | EquipGSParamConfig gSParamModel = EquipGSParamConfig.GetTagGSModel(tagChinModel.LV, tagChinModel.ItemColor, tagChinModel.StarLevel);
|
| | | if (gSParamModel != null)
|
| | | {
|
| | | Equation.Instance.AddKeyValue("AtkSpeedC", gSParamModel.AtkSpeedC);
|
| | | }
|
| | | else
|
| | | {
|
| | | Equation.Instance.AddKeyValue("AtkSpeedC",0);
|
| | | Equation.Instance.AddKeyValue("AtkSpeedC", 0);
|
| | | }
|
| | | DebugEx.Log("评分:" + Equation.Instance.Eval<double>(_equipGSFormula.Numerical1));
|
| | | if(type == PackType.rptDogzEquip || type == PackType.rptDogzItem)
|
| | | if (type == PackType.rptDogzEquip || type == PackType.rptDogzItem)
|
| | | {
|
| | | return Equation.Instance.Eval<int>(_equipGSFormula.Numerical3);
|
| | | }
|
| | |
| | | return 0;
|
| | | }
|
| | |
|
| | | private void ConvertAttrId(int attrId,int attrValue,Dictionary<int,int> keyValues)
|
| | | private void ConvertAttrId(int attrId, int attrValue, Dictionary<int, int> keyValues)
|
| | | {
|
| | | switch((AttrEnum)attrId)
|
| | | switch ((AttrEnum)attrId)
|
| | | {
|
| | | case AttrEnum.ATK:
|
| | | if(!keyValues.ContainsKey((int)AttrEnum.MinAtk))
|
| | | if (!keyValues.ContainsKey((int)AttrEnum.MinAtk))
|
| | | {
|
| | | keyValues.Add(((int)AttrEnum.MinAtk),attrValue);
|
| | | keyValues.Add(((int)AttrEnum.MinAtk), attrValue);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | #endregion
|
| | |
|
| | | #region 主界面物品弹框展示
|
| | | public event Action<PackType,string> GetPreciousItemEvent; //得到珍品 value 物品的实例ID
|
| | | public event Action<PackType, string> GetPreciousItemEvent; //得到珍品 value 物品的实例ID
|
| | |
|
| | | public void GetPreciousItem(ItemModel itemModel)
|
| | | {
|
| | |
| | | for (i = 0; i < preciousItemType.Length; i++)
|
| | | {
|
| | | if (itemModel.chinItemModel.Type == preciousItemType[i] && CheckPreciousCondition(itemModel))
|
| | | { |
| | | {
|
| | | if (GetPreciousItemEvent != null)
|
| | | {
|
| | | GetPreciousItemEvent(itemModel.packType,itemModel.itemInfo.ItemGUID);
|
| | | GetPreciousItemEvent(itemModel.packType, itemModel.itemInfo.ItemGUID);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | bool isReach = true;
|
| | | WindowSearchConfig windowSearch = Config.Instance.Get<WindowSearchConfig>((int)itemModel.chinItemModel.Jump);
|
| | | if(windowSearch != null)
|
| | | if (windowSearch != null)
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen(windowSearch.Lv) && windowSearch.Lv != 0)
|
| | | {
|
| | |
| | | return isReach;
|
| | | }
|
| | | }
|
| | | if(pushItemIds.Contains(itemModel.itemId))
|
| | | if (pushItemIds.Contains(itemModel.itemId))
|
| | | {
|
| | | int itemCnt = playerPack.GetItemCountByID(PackType.rptItem, itemModel.itemId) - itemModel.itemInfo.ItemCount;
|
| | | if (itemCnt > 0)
|
| | |
| | |
|
| | | }
|
| | |
|
| | | if(promptUseLimitDict.ContainsKey(itemModel.itemId))
|
| | | if (promptUseLimitDict.ContainsKey(itemModel.itemId))
|
| | | {
|
| | | int playerLv = PlayerDatas.Instance.baseData.LV;
|
| | | if(playerLv < promptUseLimitDict[itemModel.itemId])
|
| | | if (playerLv < promptUseLimitDict[itemModel.itemId])
|
| | | {
|
| | | isReach = false;
|
| | | return isReach;
|
| | |
| | | }
|
| | |
|
| | | ulong canUseCnt = 0;
|
| | | if(playerPack.IsReachUseLimit(itemModel.itemInfo.ItemGUID,out canUseCnt))
|
| | | if (playerPack.IsReachUseLimit(itemModel.itemInfo.ItemGUID, out canUseCnt))
|
| | | {
|
| | | isReach = false;
|
| | | return isReach;
|
| | | }
|
| | |
|
| | | bool isBox = false;
|
| | | bool isCanOpen = ModelCenter.Instance.GetModel<BoxGetItemModel>().CheckOpenBoxCondition(itemModel.itemId,out isBox);
|
| | | if(isBox)
|
| | | bool isCanOpen = ModelCenter.Instance.GetModel<BoxGetItemModel>().CheckOpenBoxCondition(itemModel.itemId, out isBox);
|
| | | if (isBox)
|
| | | {
|
| | | if(!isCanOpen)
|
| | | if (!isCanOpen)
|
| | | {
|
| | | isReach = false;
|
| | | return isReach;
|
| | | }
|
| | | }
|
| | |
|
| | | if(trialModel.trialTokens.Contains(itemModel.itemId))
|
| | | if (trialModel.trialTokens.Contains(itemModel.itemId))
|
| | | {
|
| | | if(!trialModel.IsAnySatisfyExchangeBetter(itemModel.itemId))
|
| | | if (!trialModel.IsAnySatisfyExchangeBetter(itemModel.itemId))
|
| | | {
|
| | | isReach = false;
|
| | | return isReach;
|
| | | }
|
| | | }
|
| | |
|
| | | if(playerPack.CheckIsDrugById(itemModel.itemId))
|
| | | if (playerPack.CheckIsDrugById(itemModel.itemId))
|
| | | {
|
| | | if(itemModel.chinItemModel.RealmLimit > PlayerDatas.Instance.baseData.realmLevel)
|
| | | if (itemModel.chinItemModel.RealmLimit > PlayerDatas.Instance.baseData.realmLevel)
|
| | | {
|
| | | isReach = false;
|
| | | return isReach;
|
| | |
| | | switch (itemModel.chinItemModel.Type)
|
| | | {
|
| | | case 8:
|
| | | if(buffDatas.BastBuff(itemModel.itemId))
|
| | | if (buffDatas.BastBuff(itemModel.itemId))
|
| | | {
|
| | | isReach = false;
|
| | | return isReach;
|
| | | }
|
| | | break;
|
| | | case 20:
|
| | | if(magicianModel.IsGodWeaponMaxLevelByItem(itemModel.itemId))
|
| | | if (magicianModel.IsGodWeaponMaxLevelByItem(itemModel.itemId))
|
| | | {
|
| | | isReach = false;
|
| | | return isReach;
|
| | |
| | | }
|
| | | break;
|
| | | case 39:
|
| | | if(!CheckIsBetterWings(itemModel))
|
| | | if (!CheckIsBetterWings(itemModel))
|
| | | {
|
| | | isReach = false;
|
| | | return isReach;
|
| | |
| | | break;
|
| | | }
|
| | |
|
| | | switch(itemModel.itemId)
|
| | | switch (itemModel.itemId)
|
| | | {
|
| | | case 951:
|
| | | if(!CheckIsExtendGrid(itemModel.itemId))
|
| | | if (!CheckIsExtendGrid(itemModel.itemId))
|
| | | {
|
| | | isReach = false;
|
| | | return isReach;
|
| | |
| | | {
|
| | | if (itemModel == null) return false;
|
| | |
|
| | | ItemModel putModel = playerPack.GetItemModelByIndex(PackType.rptEquip,(int)RoleEquipType.retWing);
|
| | | ItemModel putModel = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retWing);
|
| | | SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
|
| | | List<ItemModel> itemModels = null;
|
| | | if(singlePack != null)
|
| | | if (singlePack != null)
|
| | | {
|
| | | singlePack.GetItemCountByType((int)ItemType.Wings, out itemModels);
|
| | | }
|
| | | int[] composeTypes = itemModel.chinItemModel.JumpComposeCondi;
|
| | | bool isOpenCompose = false;
|
| | | if(composeTypes != null && composeTypes.Length >= 3)
|
| | | if (composeTypes != null && composeTypes.Length >= 3)
|
| | | {
|
| | | int first = composeTypes[0];
|
| | | int second = composeTypes[1];
|
| | | int third = composeTypes[2];
|
| | | ComposeWinModel.ComposeThirdTypeData thirdTypeData = null;
|
| | | composeModel.TryGetThirdTypeData(first,second,third,out thirdTypeData);
|
| | | if(thirdTypeData != null)
|
| | | composeModel.TryGetThirdTypeData(first, second, third, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | var itemCompound = thirdTypeData.itemCompound;
|
| | | if (itemCompound.levelNeed <= PlayerDatas.Instance.baseData.LV)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if(!isOpenCompose)
|
| | | if (!isOpenCompose)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
| | |
|
| | | if (itemModels != null)
|
| | | {
|
| | | for(int i = 0; i < itemModels.Count; i++)
|
| | | for (int i = 0; i < itemModels.Count; i++)
|
| | | {
|
| | | if(itemModels[i].chinItemModel.JobLimit/100 == PlayerDatas.Instance.baseData.Job)
|
| | | if (itemModels[i].chinItemModel.JobLimit / 100 == PlayerDatas.Instance.baseData.Job)
|
| | | {
|
| | | if(itemModels[i].chinItemModel.LV >= itemModel.chinItemModel.LV)
|
| | | if (itemModels[i].chinItemModel.LV >= itemModel.chinItemModel.LV)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
| | |
|
| | | int startLockIndex = singlePack.openGridCount - playerPack.InitBagGridCnt;
|
| | | FuncConfigConfig _tagFuncModel = Config.Instance.Get<FuncConfigConfig>("OpenBagItem");
|
| | | int haveCount = playerPack.GetItemCountByID(PackType.rptItem,itemId);
|
| | | int haveCount = playerPack.GetItemCountByID(PackType.rptItem, itemId);
|
| | | Equation.Instance.Clear();
|
| | | Equation.Instance.AddKeyValue("index", startLockIndex + 1);
|
| | | int needTool = Equation.Instance.Eval<int>(_tagFuncModel.Numerical2);
|
| | |
| | |
|
| | | public void OnGetEquip(ItemModel model)
|
| | | {
|
| | | if (model.packType != PackType.rptItem |
| | | || (model.chinItemModel.EquipPlace <= 0|| model.chinItemModel.EquipPlace > 12) |
| | | if (model.packType != PackType.rptItem
|
| | | || (model.chinItemModel.EquipPlace <= 0 || model.chinItemModel.EquipPlace > 12)
|
| | | || (model.chinItemModel.JobLimit / 100 != PlayerDatas.Instance.baseData.Job
|
| | | && model.chinItemModel.Type != (int)ItemType.Necklaces |
| | | && model.chinItemModel.Type != (int)ItemType.Necklaces
|
| | | && model.chinItemModel.Type != (int)ItemType.FairyEquip
|
| | | && model.chinItemModel.Type != (int)ItemType.SpiritAnimal))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if(betterEquipExceptDungeonDict.ContainsKey(PlayerDatas.Instance.baseData.MapID))
|
| | | if (betterEquipExceptDungeonDict.ContainsKey(PlayerDatas.Instance.baseData.MapID))
|
| | | {
|
| | | if(betterEquipExceptDungeonDict[PlayerDatas.Instance.baseData.MapID].Contains(model.itemInfo.ItemID))
|
| | | if (betterEquipExceptDungeonDict[PlayerDatas.Instance.baseData.MapID].Contains(model.itemInfo.ItemID))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | {
|
| | | remainTime = cool.GetRemainTime();
|
| | | }
|
| | | |
| | |
|
| | | if (remainTime >= 0 && remainTime < 120 && model.chinItemModel.ExpireTime > 0)
|
| | | {
|
| | | return;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private bool CheckIsBetterEquip(int curScore,int putOnScore = 0)
|
| | | private bool CheckIsBetterEquip(int curScore, int putOnScore = 0)
|
| | | {
|
| | | |
| | | if(putOnScore <= 0)
|
| | |
|
| | | if (putOnScore <= 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
|
| | | if(curScore > putOnScore)
|
| | | if (curScore > putOnScore)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
| | |
|
| | | public event Action<PackType, string> RefreshPickItemEvent; //捡起的物品
|
| | |
|
| | | public void RefreshPickItem(PackType type,string guid)
|
| | | public void RefreshPickItem(PackType type, string guid)
|
| | | {
|
| | | if (type != PackType.rptItem) return;
|
| | |
|
| | | if (RefreshPickItemEvent != null)
|
| | | {
|
| | | RefreshPickItemEvent(type,guid);
|
| | | RefreshPickItemEvent(type, guid);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | if (singlePack == null) return RealmBetterDict;
|
| | |
|
| | | int realmLv = PlayerDatas.Instance.baseData.realmLevel;
|
| | | Dictionary<int,ItemModel> pairs = singlePack.GetPackModelIndexDict();
|
| | | foreach(var model in pairs.Values)
|
| | | Dictionary<int, ItemModel> pairs = singlePack.GetPackModelIndexDict();
|
| | | foreach (var model in pairs.Values)
|
| | | {
|
| | | if(model.chinItemModel.EquipPlace > 0
|
| | | if (model.chinItemModel.EquipPlace > 0
|
| | | && model.chinItemModel.EquipPlace != (int)RoleEquipType.retSpiritAnimal
|
| | | && model.chinItemModel.RealmLimit <= realmLv
|
| | | && !IsOverdue(model.itemInfo.ItemGUID,model.itemId,model.useDataDict)
|
| | | && IsFightUp(model.itemId,model.equipScore) == 1)
|
| | | && !IsOverdue(model.itemInfo.ItemGUID, model.itemId, model.useDataDict)
|
| | | && IsFightUp(model.itemId, model.equipScore) == 1)
|
| | | {
|
| | | if(!RealmBetterDict.ContainsKey(model.EquipPlace))
|
| | | if (!RealmBetterDict.ContainsKey(model.EquipPlace))
|
| | | {
|
| | | RealmBetterDict.Add(model.EquipPlace,model);
|
| | | RealmBetterDict.Add(model.EquipPlace, model);
|
| | | }
|
| | | else
|
| | | {
|
| | | if(model.equipScore > RealmBetterDict[model.EquipPlace].equipScore)
|
| | | if (model.equipScore > RealmBetterDict[model.EquipPlace].equipScore)
|
| | | {
|
| | | RealmBetterDict[model.EquipPlace] = model;
|
| | | }
|
| | |
| | | Dictionary<int, ItemModel> pairs = singlePack.GetPackModelIndexDict();
|
| | | foreach (var model in pairs.Values)
|
| | | {
|
| | | if(playerPack.CheckIsDrugById(model.itemId))
|
| | | if (playerPack.CheckIsDrugById(model.itemId))
|
| | | {
|
| | | AttrFruitConfig fruitConfig = Config.Instance.Get<AttrFruitConfig>(model.itemId);
|
| | | if (!playerPack.IsReachMaxUseDrug(fruitConfig)
|
| | |
| | | SinglePackModel singlePack = playerPack.GetSinglePackModel(type);
|
| | | int openCount = chooseGridCount - singlePack.openGridCount;
|
| | | int index = 0;
|
| | | switch(type)
|
| | | switch (type)
|
| | | {
|
| | | case PackType.rptItem:
|
| | | index = chooseGridCount - playerPack.InitBagGridCnt;
|
| | |
| | | index = chooseGridCount - playerPack.InitDepotGridCnt;
|
| | | break;
|
| | | }
|
| | | itemTipsModel.SetExtendGirdModel(openCount,index, type);
|
| | | itemTipsModel.SetExtendGirdModel(openCount, index, type);
|
| | | WindowCenter.Instance.Open<ExtendWin>();
|
| | | }
|
| | |
|
| | |
| | | /// <summary>
|
| | | /// 物品使用时间限制
|
| | | /// </summary>
|
| | | public void SetItemEffectCDTime(string guid, int itemID, int getTime,int serverSurplusTime)
|
| | | public void SetItemEffectCDTime(string guid, int itemID, int getTime, int serverSurplusTime)
|
| | | {
|
| | | double time = GetTimeOffest(TimeUtility.GetTime((uint)getTime));
|
| | | if (time < 0)
|
| | |
| | | KnapsackTimeCDMgr.Instance.UnRegister(guid);
|
| | | return;
|
| | | }
|
| | | double remainTime = itemConfig.ExpireTime - time;
|
| | | KnapsackTimeCDMgr.Instance.Register(guid,itemID,remainTime, serverSurplusTime);
|
| | | double remainTime = (serverSurplusTime > 0 ? serverSurplusTime : itemConfig.ExpireTime) - time;
|
| | | KnapsackTimeCDMgr.Instance.Register(guid, itemID, remainTime);
|
| | | }
|
| | |
|
| | | public double GetTimeOffest(DateTime getTime)
|
| | |
| | | public void GetOneKeySellModel()
|
| | | {
|
| | | SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
|
| | | if ( singlePack == null)
|
| | | if (singlePack == null)
|
| | | return;
|
| | |
|
| | | _sellItemlist.Clear();
|
| | |
| | | ItemModel itemModel = _packModelDict[key];
|
| | | if (drugIDs.Contains(itemModel.itemInfo.ItemID))
|
| | | {
|
| | | if(!_lifePotionDict.ContainsKey(itemModel.chinItemModel.LV))
|
| | | if (!_lifePotionDict.ContainsKey(itemModel.chinItemModel.LV))
|
| | | {
|
| | | List<ItemModel> modellist = new List<ItemModel>();
|
| | | modellist.Add(itemModel);
|
| | | _lifePotionDict.Add(itemModel.chinItemModel.LV,modellist);
|
| | | _lifePotionDict.Add(itemModel.chinItemModel.LV, modellist);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | {
|
| | | SinglePackModel equipPack = playerPack.GetSinglePackModel(PackType.rptEquip);
|
| | | ItemModel model = null;
|
| | | if(equipPack != null)
|
| | | if (equipPack != null)
|
| | | {
|
| | | model = equipPack.GetItemModelByIndex(key);
|
| | | }
|
| | |
| | | List<int> drugLvlist = new List<int>();
|
| | | drugLvlist.AddRange(_lifePotionDict.Keys.ToList());
|
| | | drugLvlist.Sort();
|
| | | for(int i = drugLvlist.Count - 1; i > -1; i--)
|
| | | for (int i = drugLvlist.Count - 1; i > -1; i--)
|
| | | {
|
| | | if(drugLvlist[i] > playerLv)
|
| | | if (drugLvlist[i] > playerLv)
|
| | | {
|
| | | _lifePotionDict.Remove(drugLvlist[i]);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | foreach(var list in _lifePotionDict.Values)
|
| | | foreach (var list in _lifePotionDict.Values)
|
| | | {
|
| | | for(int i = 0; i < list.Count; i++)
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | _sellItemlist.Add(list[i]);
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | //得到满足出售条件的装备列表
|
| | | public void GetCanSellEquipList(ItemModel model)
|
| | | {
|
| | | |
| | |
|
| | | if (model.chinItemModel.EquipPlace == 0 || !onekeySellTypes.Contains(model.chinItemModel.Type))
|
| | | return;
|
| | |
|
| | |
| | | /// 整理包裹物品
|
| | | /// </summary>
|
| | | /// <param name="type"></param>
|
| | | public bool isPackResetOk { get; set;}
|
| | | public bool isPackResetOk { get; set; }
|
| | | public void SendPackResetQuest(PackType type)
|
| | | {
|
| | | if (lookLineIndex > -1)
|
| | | {
|
| | | SetLookIndex(null);
|
| | | SetLookIndex(null);
|
| | | }
|
| | |
|
| | | if (KnapSackWin.titleType == KnapsackFuncTitle.bag)
|
| | | {
|
| | | playerPack.isPlayBetterEquipEffect = true;
|
| | | playerPack.isPlayBetterEquipEffect = true;
|
| | | }
|
| | |
|
| | | SinglePackModel singlePack = playerPack.GetSinglePackModel(type);
|
| | |
| | | packReset.ItemBeginIndex = 0;
|
| | | packReset.ItemEndIndex = (ushort)(singlePack.openGridCount - 1);
|
| | | GameNetSystem.Instance.SendInfo(packReset); //整理物品
|
| | | if(type == PackType.rptItem)
|
| | | if (type == PackType.rptItem)
|
| | | {
|
| | | isPackResetOk = false;
|
| | | }
|
| | |
| | | public bool CheckBetterEquip(RoleEquipType ignoreType)
|
| | | {
|
| | | SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptEquip);
|
| | | if(singlePack != null)
|
| | | if (singlePack != null)
|
| | | {
|
| | | Dictionary<int, ItemModel> putOnDic = singlePack.GetPackModelIndexDict();
|
| | | foreach (var key in putOnDic.Keys)
|
| | |
| | | for (i = 1; i < 13; i++)
|
| | | {
|
| | | List<ItemModel> itemlist = GetSameEquipPlacelist(i);
|
| | | if(itemlist.Count > 0)
|
| | | if (itemlist.Count > 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
| | | {
|
| | | var itemPackage = playerPack.GetSinglePackModel(PackType.rptItem);
|
| | | var allItems = itemPackage.GetPackModelIndexDict();
|
| | | ItemModel putModel = playerPack.GetItemModelByIndex(PackType.rptEquip,equipPlace);
|
| | | equipPlace = (equipPlace == 9 || equipPlace == 10) ? 9 : equipPlace;
|
| | | ItemModel putModel = playerPack.GetItemModelByIndex(PackType.rptEquip, equipPlace);
|
| | | equipPlace = (equipPlace == 9 || equipPlace == 10) ? 9 : equipPlace;
|
| | | var guid = string.Empty;
|
| | | var equips = new List<string>();
|
| | | var score = putModel == null ? 0 : putModel.equipScore;
|
| | | var job = PlayerDatas.Instance.baseData.Job;
|
| | | foreach (var item in allItems.Values)
|
| | | {
|
| | | if(item.chinItemModel.EquipPlace == equipPlace)
|
| | | if (item.chinItemModel.EquipPlace == equipPlace)
|
| | | {
|
| | | if (!IsOverdue(item.itemInfo.ItemGUID, item.itemId,item.useDataDict)
|
| | | if (!IsOverdue(item.itemInfo.ItemGUID, item.itemId, item.useDataDict)
|
| | | && (item.chinItemModel.JobLimit == 0 || (item.chinItemModel.JobLimit / 100) == job) && item.equipScore > score)
|
| | | {
|
| | | guid = item.itemInfo.ItemGUID;
|
| | |
| | | if (!itemModelDict.ContainsKey(equipPlace))
|
| | | {
|
| | | Dictionary<int, ItemModel> dict = new Dictionary<int, ItemModel>();
|
| | | if (IsFightUp(itemModel.itemId,itemModel.equipScore) == 1)
|
| | | if (IsFightUp(itemModel.itemId, itemModel.equipScore) == 1)
|
| | | {
|
| | | dict.Add(itemModel.itemInfo.ItemPlace, itemModel);
|
| | | itemModelDict.Add(equipPlace, dict);
|
| | |
| | | {
|
| | | wingsQualitys = null;
|
| | | wingsRefineExps = null;
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(itemId); |
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(itemId);
|
| | | wingRefineQualityDict = WingRefineAttrConfig.GetWingsQualityModel(itemConfig.LV);
|
| | | if(useDataDic != null)
|
| | | if (useDataDic != null)
|
| | | {
|
| | | if(useDataDic.ContainsKey(42) && wingRefineQualityDict != null)
|
| | | if (useDataDic.ContainsKey(42) && wingRefineQualityDict != null)
|
| | | {
|
| | | wingsQualitys = wingRefineQualityDict.Keys.ToArray();
|
| | | wingsRefineExps = wingRefineQualityDict.Values.ToArray();
|
| | |
| | | }
|
| | | #endregion
|
| | |
|
| | | |
| | |
|
| | | //设置玩家货币显示
|
| | | public string OnChangeCoinsUnit(ulong value)
|
| | | {
|
| | |
| | | if (chinItemModel != null)
|
| | | {
|
| | | if (chinItemModel.EquipPlace < 1 || chinItemModel.EquipPlace > 12) return 0;
|
| | | ItemModel model = playerPack.GetItemModelByIndex(PackType.rptEquip,chinItemModel.EquipPlace);
|
| | | ItemModel model = playerPack.GetItemModelByIndex(PackType.rptEquip, chinItemModel.EquipPlace);
|
| | | if (chinItemModel.EquipPlace == (int)RoleEquipType.retFairyCan)
|
| | | {
|
| | | ItemModel fairyModel2 = playerPack.GetItemModelByIndex(PackType.rptEquip,(int)RoleEquipType.retFairyCan2);
|
| | | ItemModel fairyModel2 = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retFairyCan2);
|
| | | if (fairyModel2 != null)
|
| | | {
|
| | | if (model != null)
|
| | |
| | | }
|
| | |
|
| | | #region 物品是否过期
|
| | | public bool IsOverdue(string guid,int itemId,Dictionary<int, List<int>> useDataDict = null)
|
| | | public bool IsOverdue(string guid, int itemId, Dictionary<int, List<int>> useDataDict = null)
|
| | | {
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(itemId);
|
| | | if (itemConfig == null) return false;
|
| | |
| | | List<int> itemEffectTime = null;
|
| | | if (useDataDict != null)
|
| | | {
|
| | | if(useDataDict.ContainsKey((int)ItemUseDataKey.Def_IudetCreateTime))
|
| | | if (useDataDict.ContainsKey((int)ItemUseDataKey.Def_IudetCreateTime))
|
| | | {
|
| | | itemEffectTime = useDataDict[(int)ItemUseDataKey.Def_IudetCreateTime];
|
| | | itemEffectTime = useDataDict[(int)ItemUseDataKey.Def_IudetCreateTime];
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (itemEffectTime != null && itemEffectTime[0] != 0)
|
| | | {
|
| | | if (cool== null || cool.GetRemainTime()<= 0)
|
| | | if (cool == null || cool.GetRemainTime() <= 0)
|
| | | {
|
| | | return true;
|
| | | }
|