| | |
| | |
|
| | | public class ItemLogicUtility : Singleton<ItemLogicUtility>
|
| | | {
|
| | | private string dogzGSFormula;
|
| | | private string normalGSFormula;
|
| | | private Dictionary<int, string> specialSpiritPropertyFormula = new Dictionary<int, string>();
|
| | | Dictionary<int, int> specialSpiritPropertyMaxLevels;
|
| | |
|
| | | private int[] preciousItemTypes;
|
| | | private int[] preciousItemIDs; // 不展示的物品ID
|
| | | public int[] drugIDs;
|
| | | private int[] onekeySellTypes;
|
| | | private int[] pushItemIds;
|
| | |
|
| | | private int lsItemCnt; // 背包中的灵石数量
|
| | |
|
| | | private List<int> equipBaseProperties = new List<int>();
|
| | | private Dictionary<int, int> promptUseLimitDict;
|
| | | private Dictionary<int, List<int>> betterEquipExceptDungeonDict;
|
| | | Dictionary<int, int> equipSkillScores = new Dictionary<int, int>();
|
| | |
|
| | | PackManager packModel { get { return PackManager.Instance; } }
|
| | |
| | | public void Init()
|
| | | {
|
| | | var GSFormulaConfig = FuncConfigConfig.Get("EquipGSFormula");
|
| | | dogzGSFormula = GSFormulaConfig.Numerical3;
|
| | | normalGSFormula = GSFormulaConfig.Numerical1;
|
| | |
|
| | | var json = JsonMapper.ToObject(FuncConfigConfig.Get("OutOfPrintValue").Numerical2);
|
| | | foreach (var key in json.Keys)
|
| | | {
|
| | | specialSpiritPropertyFormula[int.Parse(key)] = json[key].ToString();
|
| | | }
|
| | | specialSpiritPropertyMaxLevels = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("OutOfPrintValueDes").Numerical1);
|
| | | var equipSkillScoreJson = JsonMapper.ToObject(GSFormulaConfig.Numerical4);
|
| | | foreach (var key in equipSkillScoreJson.Keys)
|
| | | {
|
| | |
| | | equipBaseProperties.Add(int.Parse(baseAttr[i].ToString()));
|
| | | }
|
| | | }
|
| | | lsItemCnt = int.Parse(FuncConfigConfig.Get("LingshiShowCount").Numerical1);
|
| | |
|
| | | preciousItemTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("ItemPush").Numerical1);
|
| | | promptUseLimitDict = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("NoPromptUsetItem").Numerical1);
|
| | | preciousItemIDs = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("ItemPush").Numerical3);
|
| | | drugIDs = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("LifePotionlist").Numerical1);
|
| | |
|
| | | onekeySellTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("OneKeySellItemType").Numerical1);
|
| | |
|
| | | pushItemIds = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("IntroductionItem").Numerical1);
|
| | |
|
| | | betterEquipExceptDungeonDict = new Dictionary<int, List<int>>();
|
| | | var excEquipData = JsonMapper.ToObject(FuncConfigConfig.Get("GoodItemDungeon").Numerical1);
|
| | | foreach (var dungeonId in excEquipData.Keys)
|
| | | {
|
| | | var itemIds = new List<int>();
|
| | | betterEquipExceptDungeonDict.Add(int.Parse(dungeonId), itemIds);
|
| | | for (var i = 0; i < excEquipData[dungeonId].Count; i++)
|
| | | {
|
| | | var itemId = int.Parse(excEquipData[dungeonId][i].ToString());
|
| | | itemIds.Add(itemId);
|
| | | }
|
| | | }
|
| | |
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
|
| | | }
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region 主界面物品弹框展示
|
| | | public event Action<PackType, string> GetPreciousItemEvent; //得到珍品 value 物品的实例ID
|
| | | public event Action<PackType, string> GetExpItemEvent; //得到经验物品 value 物品的实例ID
|
| | | public void RecommendItem(ItemModel item)
|
| | | {
|
| | | if (item.packType != PackType.Item)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (!preciousItemTypes.Contains(item.config.Type))
|
| | | {
|
| | | int mapId = PlayerDatas.Instance.baseData.MapID;
|
| | | var drugList = packModel.GetDrugIDListByDungeonID(mapId);
|
| | | if (drugList == null)
|
| | | return;
|
| | | if (!drugList.Contains(item.config.ID))
|
| | | return;
|
| | | }
|
| | |
|
| | | if (item.config.Type == 145 && item.config.CDTime > 0)
|
| | | {
|
| | | var createTime = item.GetUseDataFirstValue((int)ItemUseDataKey.createTime);
|
| | | if (createTime > 0)
|
| | | {
|
| | | DateTime useTime;
|
| | | if (item.config.CDTypeEx == 1)
|
| | | {
|
| | | //itemConfig.CDTime 为天,过0点可用
|
| | | useTime = TimeUtility.GetTime((uint)createTime).AddDays(item.config.CDTime);
|
| | | useTime = TimeUtility.GetDayStartTime(useTime.Year, useTime.Month, useTime.Day);
|
| | | }
|
| | | else
|
| | | {
|
| | | useTime = TimeUtility.GetTime((uint)createTime).AddSeconds(item.config.CDTime);
|
| | | }
|
| | | if (TimeUtility.ServerNow < useTime)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (preciousItemIDs != null && preciousItemIDs.Contains(item.config.ID))
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (item.config.ID == packModel.lsItemID)
|
| | | {
|
| | | int tmpCnt = PlayerDatas.Instance.baseData.LV < 50 ? 5 : lsItemCnt;
|
| | | if (packModel.GetItemCountByID(PackType.Item, packModel.lsItemID) < tmpCnt)
|
| | | return;
|
| | | }
|
| | | //if (item.isAuction)
|
| | | //{
|
| | | // return;
|
| | | //}
|
| | |
|
| | | if (item.config.UseLV > PlayerDatas.Instance.baseData.LV)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (IsOverdue(item.guid))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | // if (!IsAbleToUse(item))
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | |
|
| | | if (IsSpiritWeapon(item.itemId))
|
| | | {
|
| | | if (IsFightUp(item.itemId, item.score) != 1)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | if (item.config.Type == 13)
|
| | | {
|
| | | // 经验丹特殊处理,优先显示
|
| | | if (GetExpItemEvent != null)
|
| | | {
|
| | | GetExpItemEvent(item.packType, item.guid);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (GetPreciousItemEvent != null)
|
| | | {
|
| | | GetPreciousItemEvent(item.packType, item.guid);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | // bool IsAbleToUse(ItemModel item)
|
| | | // {
|
| | | // var windowSearch = WindowSearchConfig.Get(item.config.Jump);
|
| | | // if (windowSearch != null)
|
| | | // {
|
| | | // if (!FuncOpen.Instance.IsFuncOpen(windowSearch.Lv) && windowSearch.Lv != 0)
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // }
|
| | |
|
| | | // if (pushItemIds.Contains(item.itemId))
|
| | | // {
|
| | | // var itemCnt = packModel.GetItemCountByID(PackType.Item, item.itemId) - item.count;
|
| | | // if (itemCnt > 0)
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // if (item.preItemCount > 0)
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // }
|
| | | // }
|
| | |
|
| | | // if (promptUseLimitDict.ContainsKey(item.itemId))
|
| | | // {
|
| | | // var playerLv = PlayerDatas.Instance.baseData.LV;
|
| | | // if (playerLv < promptUseLimitDict[item.itemId])
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // }
|
| | |
|
| | | // ulong canUseCnt = 0;
|
| | | // if (packModel.IsReachUseLimit(item.guid, out canUseCnt))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | |
|
| | | // bool isBox = false;
|
| | | // bool isCanOpen = ModelCenter.Instance.GetModel<BoxGetItemModel>().CheckOpenBoxCondition(item.itemId, out isBox);
|
| | | // if (isBox)
|
| | | // {
|
| | | // if (!isCanOpen)
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // }
|
| | |
|
| | | // //if (trialModel.trialTokens.Contains(item.itemId))
|
| | | // //{
|
| | | // // if (!trialModel.IsAnySatisfyExchangeBetter(item.itemId))
|
| | | // // {
|
| | | // // return false;
|
| | | // // }
|
| | | // //}
|
| | |
|
| | | // if (packModel.CheckIsDrugById(item.itemId))
|
| | | // {
|
| | | // if (item.config.RealmLimit > PlayerDatas.Instance.baseData.realmLevel)
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // }
|
| | |
|
| | | // var fruitConfig = AttrFruitConfig.Get(item.itemId);
|
| | | // if (fruitConfig != null && fruitConfig.FuncID == 2)
|
| | | // {
|
| | | // if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BlastFurnace))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // }
|
| | |
|
| | | // switch (item.config.Type)
|
| | | // {
|
| | | // case 8:
|
| | | // if (buffDatas.BastBuff(item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 20:
|
| | | // if (magicianModel.IsGodWeaponMaxLevelByItem(item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 21:
|
| | | // if (!mountDatas.IsHint(HorseEnum.HorseDan, item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 22:
|
| | | // if (!mountDatas.IsHint(HorseEnum.HorseStone, item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 41:
|
| | | // if (!mountDatas.IsHint(HorseEnum.HorseDebris, item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 26:
|
| | | // if (!petDatas.IsHint(PetEnum.PetDebris, item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 27:
|
| | | // if (!petDatas.IsHint(PetEnum.PetDan, item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 28:
|
| | | // if (!petDatas.IsHint(PetEnum.PetStone, item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 25:
|
| | | // if (!ModelCenter.Instance.GetModel<EquipGemModel>().IsBetterGem(item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 39:
|
| | | // if (!IsBetterWings(item))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 52:
|
| | | // if (!strengthDatas.IsHint(item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 55:
|
| | | // if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BlastFurnace))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // var alchemyId = 0;
|
| | | // if (alchemyModel.TryGetAlchemyByStudyMaterial(item.itemId, out alchemyId))
|
| | | // {
|
| | | // var alchemyConfig = AlchemyConfig.Get(alchemyId);
|
| | | // int alchemingId;
|
| | | // if (alchemyModel.IsStoveAlcheming((AlchemyType)alchemyConfig.AlchemType, out alchemingId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // if (alchemyModel.IsGraspRecipe(alchemyId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // var studyError = 0;
|
| | | // if (!alchemyModel.TryLearn(alchemyId, out studyError))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // }
|
| | | // break;
|
| | | // case 127:
|
| | | // var error = 0;
|
| | | // bool isHaveMakeNum = ItemOperateUtility.Instance.CanUseItem(item.guid, 1, out error);
|
| | | // int remainNum = CrossServerOneVsOnePlayerInfo.Instance.GetDayRemainNum();
|
| | | // if (!CrossServerOneVsOnePKSeason.Instance.isSatisfyMatch
|
| | | // || remainNum > 0
|
| | | // || !isHaveMakeNum)
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // default:
|
| | | // break;
|
| | | // }
|
| | |
|
| | | // switch (item.itemId)
|
| | | // {
|
| | | // case 951:
|
| | | // if (!CheckIsExtendGrid(item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // break;
|
| | | // case 952:
|
| | | // return false;
|
| | | // break;
|
| | |
|
| | | // }
|
| | |
|
| | | // return true;
|
| | | // }
|
| | |
|
| | | // private bool IsBetterWings(ItemModel item)
|
| | | // {
|
| | | // if (item == null)
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | |
|
| | | // var putModel = packModel.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
|
| | | // var singlePack = packModel.GetSinglePack(PackType.Item);
|
| | | // if (singlePack == null)
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | |
|
| | | // int[] composeTypes = item.config.JumpComposeCondi;
|
| | | // bool isOpenCompose = false;
|
| | | // 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)
|
| | | // {
|
| | | // var itemCompound = thirdTypeData.itemCompound;
|
| | | // if (itemCompound.levelNeed <= PlayerDatas.Instance.baseData.LV)
|
| | | // {
|
| | | // isOpenCompose = true;
|
| | | // }
|
| | | // }
|
| | | // }
|
| | |
|
| | | // if (!isOpenCompose)
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | |
|
| | | // if (putModel != null && putModel.config.LV >= item.config.LV)
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | |
|
| | | // var itemModels = packModel.GetItems(PackType.Item, new SinglePack.FilterParams()
|
| | | // {
|
| | | // itemTypes = new List<int>() { (int)ItemType.Equip_Wing }
|
| | | // });
|
| | |
|
| | | // if (itemModels != null)
|
| | | // {
|
| | | // for (int i = 0; i < itemModels.Count; i++)
|
| | | // {
|
| | | // if (IsJobCompatibleItem(itemModels[i].itemId))
|
| | | // {
|
| | | // if (itemModels[i].config.LV >= item.config.LV)
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | // }
|
| | | // }
|
| | | // }
|
| | |
|
| | | // return true;
|
| | | // }
|
| | |
|
| | | |
| | | private bool CheckIsExtendGrid(int itemId)
|
| | | {
|
| | | SinglePack singlePack = packModel.GetSinglePack(PackType.Item);
|
| | |
| | | // }
|
| | | // return RealmDruglist;
|
| | | // }
|
| | | #endregion
|
| | |
|
| | | #region 物品处于CD中的逻辑处理
|
| | |
|