using Snxxz.UI;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using TableConfig;
|
using LitJson;
|
|
namespace Snxxz.UI
|
{
|
public class PackModelInterface : Model, IBeforePlayerDataInitialize,IPlayerLoginOk
|
{
|
private ItemConfig tagChinModel;
|
private FuncConfigConfig _equipGSFormula;
|
private FuncConfigConfig _itemPush;
|
private FuncConfigConfig _drugIDFunc;
|
private FuncConfigConfig _oneKeySellFunc;
|
public int[] preciousItemType { get; private set; }
|
private int[] drugIDs;
|
public Dictionary<int,List<int>> betterEquipExceptDungeonDict { get; private set; }
|
|
private int[] onekeySellTypes;
|
PlayerPackModel _playerPack;
|
PlayerPackModel playerPack
|
{
|
get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
|
}
|
|
ItemTipsModel _itemTipsModel;
|
ItemTipsModel itemTipsModel
|
{
|
get
|
{
|
return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
}
|
}
|
|
PlayerBuffDatas buffDatas { get { return ModelCenter.Instance.GetModel<PlayerBuffDatas>(); } }
|
PlayerMountDatas mountDatas { get { return ModelCenter.Instance.GetModel<PlayerMountDatas>(); } }
|
PlayerPetDatas petDatas { get { return ModelCenter.Instance.GetModel<PlayerPetDatas>(); } }
|
PlayerStrengthengDatas strengthDatas { get { return ModelCenter.Instance.GetModel<PlayerStrengthengDatas>(); } }
|
MagicianModel magicianModel { get { return ModelCenter.Instance.GetModel<MagicianModel>(); } }
|
TrialDungeonModel trialModel { get { return ModelCenter.Instance.GetModel<TrialDungeonModel>(); } }
|
|
private int[] pushItemIds;
|
public int[] pushBuffTypeIds;
|
private List<int> equipBaseAttrlist = new List<int>();
|
public override void Init()
|
{
|
_equipGSFormula = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("EquipGSFormula");
|
equipBaseAttrlist.Clear();
|
JsonData baseAttr = JsonMapper.ToObject(_equipGSFormula.Numerical2);
|
if(baseAttr.IsArray)
|
{
|
for (int i = 0;i < baseAttr.Count; i++)
|
{
|
equipBaseAttrlist.Add(int.Parse(baseAttr[i].ToString()));
|
}
|
}
|
|
_itemPush = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("ItemPush");
|
preciousItemType = ConfigParse.GetMultipleStr<int>(_itemPush.Numerical1);
|
_drugIDFunc = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("LifePotionlist");
|
drugIDs = ConfigParse.GetMultipleStr<int>(_drugIDFunc.Numerical1);
|
_oneKeySellFunc = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("OneKeySellItemType");
|
onekeySellTypes = ConfigParse.GetMultipleStr<int>(_oneKeySellFunc.Numerical1);
|
FuncConfigConfig funcConfig = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("IntroductionItem");
|
pushItemIds = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1);
|
pushBuffTypeIds = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical2);
|
FuncConfigConfig betterEquipExcConfig = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("GoodItemDungeon");
|
betterEquipExceptDungeonDict = new Dictionary<int, List<int>>();
|
JsonData excEquipData = JsonMapper.ToObject(betterEquipExcConfig.Numerical1);
|
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++)
|
{
|
int itemId = int.Parse(excEquipData[dungeonId][i].ToString());
|
idlist.Add(itemId);
|
}
|
}
|
}
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
isPackResetOk = true;
|
itemModelDict.Clear();
|
itemEffectCDDict.Clear();
|
itemEffectTimelist.Clear();
|
}
|
|
public void OnPlayerLoginOk()
|
{
|
|
}
|
|
|
public override void UnInit()
|
{
|
|
}
|
|
#region 计算装备评分
|
/// <summary>
|
/// 得到特殊属性的字典
|
/// </summary>
|
private Dictionary<AttrEnum, int> specAttrDic = new Dictionary<AttrEnum, int>();
|
public int SetEquipScore(int itemId,Dictionary<int, List<int>> useDataDic = null,bool isPreview = false)
|
{
|
specAttrDic.Clear();
|
int id = itemId;
|
ItemConfig itemConfig = ConfigManager.Instance.GetTemplate<ItemConfig>(itemId);
|
if (CheckIsCustomItem(itemConfig))
|
{
|
AppointItemConfig appointItemConfig = ConfigManager.Instance.GetTemplate<AppointItemConfig>(itemId);
|
SetCustomAttrData(appointItemConfig);
|
id = itemConfig.EffectValueA1;
|
}
|
else
|
{
|
if (isPreview)
|
{
|
List<int> legendIdlist = new List<int>();
|
List<int> legendValuelist = new List<int>();
|
if (itemTipsModel.legendAttrIDPreviewDict.ContainsKey(itemConfig.EquipPlace))
|
{
|
foreach (var attrType in itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace].Keys)
|
{
|
switch (attrType)
|
{
|
case LegendAttrType.Pursuit:
|
legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
|
break;
|
case LegendAttrType.Fixed:
|
legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
|
break;
|
}
|
}
|
}
|
int i = 0;
|
for (i = 0; i < legendIdlist.Count; i++)
|
{
|
if (itemTipsModel.legendAttrColorValuePreviewDict.ContainsKey(legendIdlist[i]))
|
{
|
if (itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.ItemColor))
|
{
|
legendValuelist.Add(itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]][itemConfig.ItemColor]);
|
}
|
}
|
else if (itemTipsModel.legendAttrLvValuePreviewDict.ContainsKey(legendIdlist[i]))
|
{
|
if (itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.LV))
|
{
|
legendValuelist.Add(itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]][itemConfig.LV]);
|
}
|
}
|
}
|
|
if (legendIdlist.Count == legendValuelist.Count)
|
{
|
SetLegendData(legendIdlist, legendValuelist);
|
}
|
}
|
else
|
{
|
if (useDataDic != null)
|
{
|
if (useDataDic.ContainsKey((int)ItemUseDataKey.Def_IudetLegendAttrID))
|
{
|
SetLegendData(useDataDic[(int)ItemUseDataKey.Def_IudetLegendAttrID], useDataDic[(int)ItemUseDataKey.Def_IudetLegendAttrValue]);
|
}
|
|
if (useDataDic.ContainsKey((int)ItemUseDataKey.Def_IudetOutOfPrintAttrID))
|
{
|
SetExhaustedData(useDataDic[(int)ItemUseDataKey.Def_IudetOutOfPrintAttrID], useDataDic[(int)ItemUseDataKey.Def_IudetOutOfPrintAttrValue]);
|
}
|
|
}
|
}
|
}
|
return GetEquipScore(id,specAttrDic);
|
|
}
|
|
#region 预览定制属性逻辑处理
|
public bool CheckIsCustomItem(ItemConfig itemConfig)
|
{
|
if (itemConfig == null) return false;
|
|
if (itemConfig.Effect1 == 220)
|
{
|
return true;
|
}
|
return false;
|
}
|
|
/// <summary>
|
/// 设置定制属性的数据
|
/// </summary>
|
private void SetCustomAttrData(AppointItemConfig appointItemConfig)
|
{
|
if (appointItemConfig == null)
|
return;
|
|
List<int> legendIdlist = null;
|
List<int> legendValuelist = null;
|
List<int> exhaustedIdlist = null;
|
List<int> exhaustedValuelist = null;
|
int i = 0;
|
if (appointItemConfig.LegendAttrID.Length > 0)
|
{
|
legendIdlist = new List<int>();
|
legendValuelist = new List<int>();
|
for (i = 0; i < appointItemConfig.LegendAttrID.Length; i++)
|
{
|
legendIdlist.Add(appointItemConfig.LegendAttrID[i]);
|
legendValuelist.Add(appointItemConfig.LegendAttrValue[i]);
|
}
|
}
|
|
if (appointItemConfig.OutOfPrintAttr.Length > 0)
|
{
|
exhaustedIdlist = new List<int>();
|
exhaustedValuelist = new List<int>();
|
for (i = 0; i < appointItemConfig.OutOfPrintAttr.Length; i++)
|
{
|
exhaustedIdlist.Add(appointItemConfig.OutOfPrintAttr[i]);
|
exhaustedValuelist.Add(appointItemConfig.OutOfPrintAttrValue[i]);
|
}
|
}
|
SetLegendData(legendIdlist, legendValuelist);
|
SetExhaustedData(exhaustedIdlist, exhaustedValuelist);
|
}
|
#endregion
|
/// <summary>
|
/// 设置传奇属性数据
|
/// </summary>
|
/// <param name="ids"></param>
|
/// <param name="values"></param>
|
private void SetLegendData(List<int> ids, List<int> values)
|
{
|
if (ids == null || ids.Count < 1) return;
|
int i = 0;
|
for (i = 0; i < ids.Count; i++)
|
{
|
SetSpecAttrlist(ids[i], values[i]);
|
}
|
}
|
|
/// <summary>
|
/// 设置绝版属性数据
|
/// </summary>
|
/// <param name="ids"></param>
|
/// <param name="values"></param>
|
private void SetExhaustedData(List<int> ids, List<int> values)
|
{
|
if (ids == null || ids.Count < 1) return;
|
int i = 0;
|
for (i = 0; i < ids.Count; i++)
|
{
|
SetSpecAttrlist(ids[i], values[i]);
|
}
|
|
}
|
|
private void SetSpecAttrlist(int attrId, int attrValue)
|
{
|
AttrEnum attrEnum = (AttrEnum)attrId;
|
if (!specAttrDic.ContainsKey(attrEnum))
|
{
|
specAttrDic.Add(attrEnum, attrValue);
|
}
|
else
|
{
|
specAttrDic[attrEnum] = attrValue;
|
}
|
}
|
|
/// <summary>
|
/// 得到装备的评分
|
/// </summary>
|
/// <param name="itemId"></param>
|
/// <returns></returns>
|
private Dictionary<int, int> itemEffectDict = new Dictionary<int, int>();
|
private Dictionary<AttrEnum, float> curEquipAttrDict = new Dictionary<AttrEnum, float>(); //存储当前装备属性对应的数值 key 属性 value 属性值
|
private Dictionary<AttrEnum, int> _tagGsProValueDict;
|
private Dictionary<string, string> _equipGSFormulaDict = new Dictionary<string, string>(); //key 公式参数 value 参数数值
|
private float curProValue = 0;
|
private int GetEquipScore(int itemId, Dictionary<AttrEnum, int> specAttrDict)
|
{
|
tagChinModel = ConfigManager.Instance.GetTemplate<ItemConfig>(itemId);
|
if (tagChinModel == null || tagChinModel.EquipPlace == 0
|
|| tagChinModel.EquipPlace > 12)
|
return 0;
|
|
Equation.Instance.Clear();
|
_tagGsProValueDict = EquipGSParamConfig.GetTagGsProValueDict(tagChinModel.LV, tagChinModel.ItemColor,tagChinModel.StarLevel);
|
curEquipAttrDict.Clear();
|
itemEffectDict.Clear();
|
_equipGSFormulaDict.Clear();
|
|
try
|
{
|
if (tagChinModel.Effect1 != 0)
|
itemEffectDict.Add(tagChinModel.Effect1, tagChinModel.EffectValueA1);
|
if (tagChinModel.Effect2 != 0)
|
itemEffectDict.Add(tagChinModel.Effect2, tagChinModel.EffectValueA2);
|
if (tagChinModel.Effect3 != 0)
|
itemEffectDict.Add(tagChinModel.Effect3, tagChinModel.EffectValueA3);
|
if (tagChinModel.Effect4 != 0)
|
itemEffectDict.Add(tagChinModel.Effect4, tagChinModel.EffectValueA4);
|
if (tagChinModel.Effect5 != 0)
|
itemEffectDict.Add(tagChinModel.Effect5, tagChinModel.EffectValueA5);
|
|
}
|
catch (Exception ex)
|
{
|
DebugEx.Log(ex.ToString());
|
}
|
|
|
foreach (var key in itemEffectDict.Keys)
|
{
|
if(equipBaseAttrlist.Contains(key))
|
{
|
switch ((AttrEnum)key)
|
{
|
case AttrEnum.ATKSPEED:
|
case AttrEnum.OnlyFinalHurt:
|
case AttrEnum.PVPAtkBackHP:
|
curEquipAttrDict.Add((AttrEnum)key, itemEffectDict[key]);
|
break;
|
default:
|
if (_tagGsProValueDict != null && _tagGsProValueDict.ContainsKey((AttrEnum)key))
|
{
|
curProValue = itemEffectDict[key] * _tagGsProValueDict[(AttrEnum)key];
|
curEquipAttrDict.Add((AttrEnum)key, curProValue);
|
}
|
else
|
{
|
curEquipAttrDict.Add((AttrEnum)key, itemEffectDict[key]);
|
}
|
break;
|
}
|
}
|
}
|
|
foreach (AttrEnum attrType in specAttrDict.Keys)
|
{
|
switch (attrType)
|
{
|
case AttrEnum.ATKSPEED:
|
case AttrEnum.OnlyFinalHurt:
|
case AttrEnum.PVPAtkBackHP:
|
curEquipAttrDict.Add(attrType, specAttrDict[attrType]);
|
break;
|
default:
|
if(_tagGsProValueDict != null && _tagGsProValueDict.ContainsKey(attrType))
|
{
|
curProValue = specAttrDict[attrType] * _tagGsProValueDict[attrType];
|
curEquipAttrDict.Add(attrType, curProValue);
|
}
|
else
|
{
|
curEquipAttrDict.Add(attrType, specAttrDict[attrType]);
|
}
|
break;
|
}
|
}
|
|
if (_equipGSFormula != null)
|
{
|
foreach(var key in curEquipAttrDict.Keys)
|
{
|
PlayerPropertyConfig propertyConfig = ConfigManager.Instance.GetTemplate<PlayerPropertyConfig>((int)key);
|
if(propertyConfig != null)
|
{
|
Equation.Instance.AddKeyValue(propertyConfig.Parameter, curEquipAttrDict[key]);
|
}
|
}
|
|
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);
|
}
|
DebugEx.Log("评分:" + Equation.Instance.Eval<double>(_equipGSFormula.Numerical1));
|
return Equation.Instance.Eval<int>(_equipGSFormula.Numerical1);
|
}
|
return 0;
|
}
|
#endregion
|
|
#region 主界面物品弹框展示
|
public event Action<PackType,string> GetPreciousItemEvent; //得到珍品 value 物品的实例ID
|
|
public void GetPreciousItem(ItemModel itemModel)
|
{
|
if (itemModel.packType != PackType.rptItem) return;
|
|
if (itemModel.chinItemModel.UseLV > PlayerDatas.Instance.baseData.LV) return;
|
|
bool isOverdue = IsOverdue(itemModel.itemInfo.ItemGUID, itemModel.itemInfo.ItemID, itemModel.useDataDict);
|
if (isOverdue)
|
{
|
return;
|
}
|
|
if (preciousItemType != null)
|
{
|
int i = 0;
|
for (i = 0; i < preciousItemType.Length; i++)
|
{
|
if (itemModel.chinItemModel.Type == preciousItemType[i] && CheckPreciousCondition(itemModel))
|
{
|
if (GetPreciousItemEvent != null)
|
{
|
GetPreciousItemEvent(itemModel.packType,itemModel.itemInfo.ItemGUID);
|
}
|
}
|
}
|
}
|
}
|
|
public bool CheckPreciousCondition(ItemModel itemModel)
|
{
|
bool isReach = true;
|
WindowSearchConfig windowSearch = ConfigManager.Instance.GetTemplate<WindowSearchConfig>((int)itemModel.chinItemModel.Jump);
|
if(windowSearch != null)
|
{
|
if (!FuncOpen.Instance.IsFuncOpen(windowSearch.Lv) && windowSearch.Lv != 0)
|
{
|
isReach = false;
|
return isReach;
|
}
|
}
|
if(pushItemIds.Contains(itemModel.itemId))
|
{
|
int itemCnt = playerPack.GetItemCountByID(PackType.rptItem, itemModel.itemId) - itemModel.itemInfo.ItemCount;
|
if (itemCnt > 0)
|
{
|
isReach = false;
|
return isReach;
|
}
|
else
|
{
|
if (itemModel.preItemCount > 0)
|
{
|
isReach = false;
|
return isReach;
|
}
|
}
|
|
}
|
|
ulong canUseCnt = 0;
|
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)
|
{
|
if(!isCanOpen)
|
{
|
isReach = false;
|
return isReach;
|
}
|
}
|
|
if(trialModel.trialTokens.Contains(itemModel.itemId))
|
{
|
if(!trialModel.IsAnySatisfyExchangeBetter(itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
}
|
|
switch (itemModel.chinItemModel.Type)
|
{
|
case 8:
|
if(buffDatas.BastBuff(itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
case 20:
|
if(magicianModel.IsGodWeaponMaxLevelByItem(itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
case 21:
|
if (!mountDatas.IsHint(HorseEnum.HorseDan, itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
case 22:
|
if (!mountDatas.IsHint(HorseEnum.HorseStone, itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
case 41:
|
if (!mountDatas.IsHint(HorseEnum.HorseDebris, itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
case 26:
|
if (!petDatas.IsHint(PetEnum.PetDebris, itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
case 27:
|
if (!petDatas.IsHint(PetEnum.PetDan, itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
case 28:
|
if (!petDatas.IsHint(PetEnum.PetStone, itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
case 25:
|
if (!ModelCenter.Instance.GetModel<GemModel>().SatisfyBetter(itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
case 52:
|
if (!strengthDatas.IsHint(itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
default:
|
break;
|
}
|
|
switch(itemModel.itemId)
|
{
|
case 951:
|
if(!CheckIsExtendGrid(itemModel.itemId))
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
case 952:
|
int willTime = HangUpSetModel.Instance.offlinePluginTime + itemModel.chinItemModel.EffectValueA1;
|
if (HangUpSetModel.Instance.offlinePluginTime >= HangUpSetModel.Instance.maxOfflinePluginTime)
|
{
|
isReach = false;
|
return isReach;
|
}
|
break;
|
|
}
|
|
return isReach;
|
}
|
|
private bool CheckIsExtendGrid(int itemId)
|
{
|
SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
|
if (singlePack == null) return false;
|
|
int startLockIndex = singlePack.openGridCount - GetInitGridCount(PackType.rptItem);
|
FuncConfigConfig _tagFuncModel = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("OpenBagItem");
|
int haveCount = playerPack.GetItemCountByID(PackType.rptItem,itemId);
|
Equation.Instance.Clear();
|
Equation.Instance.AddKeyValue("index", startLockIndex + 1);
|
int needTool = Equation.Instance.Eval<int>(_tagFuncModel.Numerical2);
|
if (haveCount >= needTool)
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
public event Action<string> RefreshGetBetterEquipEvent; //得到更好的装备 value 物品的实例ID
|
|
public void OnGetEquip(ItemModel model)
|
{
|
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.FairyEquip
|
&& model.chinItemModel.Type != (int)ItemType.SpiritAnimal))
|
{
|
return;
|
}
|
|
if(betterEquipExceptDungeonDict.ContainsKey(PlayerDatas.Instance.baseData.MapID))
|
{
|
if(betterEquipExceptDungeonDict[PlayerDatas.Instance.baseData.MapID].Contains(model.itemInfo.ItemID))
|
{
|
return;
|
}
|
}
|
|
SetGetBetterEquipEvent(model);
|
}
|
|
private void SetGetBetterEquipEvent(ItemModel model)
|
{
|
List<int> itemEffectTime = model.GetUseDataModel((int)ItemUseDataKey.Def_IudetCreateTime);
|
if (itemEffectTime != null)
|
{
|
if (itemEffectTime[0] != 0)
|
{
|
ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(model.itemInfo.ItemGUID);
|
double remainTime = 0;
|
if (cool != null)
|
{
|
remainTime = cool.GetRemainTime();
|
}
|
|
if (remainTime >= 0 && remainTime < 120 && model.chinItemModel.ExpireTime > 0)
|
{
|
return;
|
}
|
}
|
}
|
ItemModel equipItemModel = null;
|
SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptEquip);
|
int putOnScore = 0;
|
if (model.chinItemModel.EquipPlace != 9)
|
{
|
if (singlePack != null)
|
{
|
equipItemModel = singlePack.GetItemModelByIndex(model.chinItemModel.EquipPlace);
|
if (equipItemModel != null)
|
{
|
putOnScore = equipItemModel.equipScore;
|
}
|
|
if (CheckIsBetterEquip(model.equipScore, putOnScore))
|
{
|
if (PlayerDatas.Instance.baseData.LV >= 200)
|
{
|
if (model.EquipPlace > (int)RoleEquipType.retWeapon2 && model.EquipPlace < (int)RoleEquipType.retNeck)
|
{
|
if (equipItemModel != null && equipItemModel.chinItemModel.ItemColor > model.chinItemModel.ItemColor)
|
{
|
return;
|
}
|
}
|
}
|
if (RefreshGetBetterEquipEvent != null)
|
{
|
RefreshGetBetterEquipEvent(model.itemInfo.ItemGUID);
|
}
|
}
|
|
}
|
}
|
else
|
{
|
if (singlePack != null)
|
{
|
equipItemModel = singlePack.GetItemModelByIndex(model.chinItemModel.EquipPlace);
|
if (equipItemModel != null)
|
{
|
putOnScore = equipItemModel.equipScore;
|
}
|
bool isbetter = CheckIsBetterEquip(model.equipScore, putOnScore);
|
if (!isbetter)
|
{
|
equipItemModel = singlePack.GetItemModelByIndex(10);
|
if (equipItemModel != null)
|
{
|
putOnScore = equipItemModel.equipScore;
|
}
|
isbetter = CheckIsBetterEquip(model.equipScore, putOnScore);
|
}
|
|
if (isbetter)
|
{
|
if (RefreshGetBetterEquipEvent != null)
|
{
|
RefreshGetBetterEquipEvent(model.itemInfo.ItemGUID);
|
}
|
}
|
}
|
}
|
}
|
|
private bool CheckIsBetterEquip(int curScore,int putOnScore = 0)
|
{
|
|
if(putOnScore <= 0)
|
{
|
return true;
|
}
|
|
if(curScore > putOnScore)
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
public event Action<PackType, string> RefreshPickItemEvent; //捡起的物品
|
|
public void RefreshPickItem(PackType type,string guid)
|
{
|
if (type != PackType.rptItem) return;
|
|
if (RefreshPickItemEvent != null)
|
{
|
RefreshPickItemEvent(type,guid);
|
}
|
}
|
|
Dictionary<int, ItemModel> RealmBetterDict = new Dictionary<int, ItemModel>();
|
public Dictionary<int, ItemModel> CheckBetterEquipByRealm()
|
{
|
RealmBetterDict.Clear();
|
SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
|
if (singlePack == null) return RealmBetterDict;
|
|
int realmLv = PlayerDatas.Instance.baseData.realmLevel;
|
Dictionary<int,ItemModel> pairs = singlePack.GetPackModelIndexDict();
|
foreach(var model in pairs.Values)
|
{
|
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)
|
{
|
if(!RealmBetterDict.ContainsKey(model.EquipPlace))
|
{
|
RealmBetterDict.Add(model.EquipPlace,model);
|
}
|
else
|
{
|
if(model.equipScore > RealmBetterDict[model.EquipPlace].equipScore)
|
{
|
RealmBetterDict[model.EquipPlace] = model;
|
}
|
}
|
}
|
}
|
return RealmBetterDict;
|
}
|
#endregion
|
|
#region 解锁格子
|
|
public int GetInitGridCount(PackType type)
|
{
|
FuncConfigConfig initGridCount = null;
|
if (type == PackType.rptItem)
|
initGridCount = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("InitBagCellCount");
|
else if (type == PackType.rptWarehouse)
|
initGridCount = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("InitDepotCellCount");
|
|
return int.Parse(initGridCount.Numerical1);
|
}
|
|
public void OpenGrid(int chooseGridCount, PackType type)
|
{
|
SinglePackModel singlePack = playerPack.GetSinglePackModel(type);
|
int openCount = chooseGridCount - singlePack.openGridCount;
|
int index = chooseGridCount - GetInitGridCount(type);
|
itemTipsModel.SetExtendGirdModel(openCount,index, type);
|
WindowCenter.Instance.Open<ExtendWin>();
|
}
|
|
#endregion
|
|
#region 物品处于CD中的逻辑处理
|
|
private Dictionary<string, double> itemEffectCDDict = new Dictionary<string, double>(); //key 物品实例ID
|
private List<string> itemEffectTimelist = new List<string>(); //key 物品实例ID
|
/// <summary>
|
/// 物品使用时间限制
|
/// </summary>
|
public void SetItemEffectCDTime(string guid, int itemID, int getTime)
|
{
|
double time = GetTimeOffest(TimeUtility.GetTime((uint)getTime));
|
if (time < 0)
|
{
|
time = 0;
|
}
|
itemEffectTimelist.Add(guid);
|
ItemConfig itemConfig = ConfigManager.Instance.GetTemplate<ItemConfig>(itemID);
|
if (time >= itemConfig.ExpireTime)
|
{
|
KnapsackTimeCDMgr.Instance.UnRegister(guid);
|
return;
|
}
|
double remainTime = itemConfig.ExpireTime - time;
|
KnapsackTimeCDMgr.Instance.Register(guid,itemID,remainTime);
|
}
|
|
public double GetTimeOffest(DateTime getTime)
|
{
|
DebugEx.Log("现在时间:" + TimeUtility.ServerNow + "获得时间:" + getTime);
|
//TimeUtility.SyncServerTime();
|
TimeSpan t = TimeUtility.ServerNow - getTime;
|
DebugEx.Log("时间差:" + t.TotalSeconds);
|
return t.TotalSeconds;
|
}
|
|
public List<string> GetItemEffectTimelist()
|
{
|
return itemEffectTimelist;
|
}
|
|
#endregion
|
|
#region 设置可以一键出售的物品数据
|
|
private int playerLv;
|
private Dictionary<int, List<ItemModel>> _lifePotionDict = new Dictionary<int, List<ItemModel>>(); //key 药水等级
|
private List<int> _sellItemScorelist = new List<int>();
|
private Dictionary<int, Dictionary<int, List<ItemModel>>> _sameIndexEquipDict = new Dictionary<int, Dictionary<int, List<ItemModel>>>(); //存储相同装备位的装备
|
// private _sameEquipScoreDict = new Dictionary<int, List<ItemModel>>(); //存储相同ID中相同装备评分的装备
|
private Dictionary<int, ItemModel> _packModelDict;
|
private List<ItemModel> _sellItemlist = new List<ItemModel>();
|
|
public List<ItemModel> GetSellItemList()
|
{
|
GetOneKeySellModel();
|
_sellItemlist.Sort(SetSellItemOrder);
|
return _sellItemlist;
|
}
|
|
public int SetSellItemOrder(ItemModel startModel, ItemModel endModel)
|
{
|
bool startIsEquip = IsEquip(startModel);
|
bool endIsEquip = IsEquip(endModel);
|
if (startIsEquip.CompareTo(endIsEquip) != 0) return -startIsEquip.CompareTo(endIsEquip);
|
int order1 = startModel.chinItemModel.Type;
|
int order2 = endModel.chinItemModel.Type;
|
if (order1.CompareTo(order2) != 0) return order1.CompareTo(order2);
|
int color1 = startModel.chinItemModel.ItemColor;
|
int color2 = endModel.chinItemModel.ItemColor;
|
if (color1.CompareTo(color2) != 0) return -color1.CompareTo(color2);
|
int code1 = startModel.itemInfo.ItemID;
|
int code2 = endModel.itemInfo.ItemID;
|
if (code1.CompareTo(code2) != 0) return -code1.CompareTo(code2);
|
return 0;
|
}
|
|
public bool IsEquip(ItemModel model)
|
{
|
if (model.chinItemModel.EquipPlace != 0)
|
return true;
|
else
|
return false;
|
}
|
|
public void GetOneKeySellModel()
|
{
|
SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
|
if ( singlePack == null)
|
return;
|
|
_sellItemlist.Clear();
|
_lifePotionDict.Clear();
|
_sameIndexEquipDict.Clear();
|
_sellItemScorelist.Clear();
|
playerLv = PlayerDatas.Instance.baseData.LV;
|
_packModelDict = singlePack.GetPackModelIndexDict();
|
foreach (var key in _packModelDict.Keys)
|
{
|
GetCanSellEquipList(_packModelDict[key]);
|
ItemModel itemModel = _packModelDict[key];
|
if (drugIDs.Contains(itemModel.itemInfo.ItemID))
|
{
|
if(!_lifePotionDict.ContainsKey(itemModel.chinItemModel.LV))
|
{
|
List<ItemModel> modellist = new List<ItemModel>();
|
modellist.Add(itemModel);
|
_lifePotionDict.Add(itemModel.chinItemModel.LV,modellist);
|
}
|
else
|
{
|
_lifePotionDict[itemModel.chinItemModel.LV].Add(itemModel);
|
}
|
}
|
}
|
|
#region 得到可以出售的装备
|
foreach (var key in _sameIndexEquipDict.Keys)
|
{
|
_sellItemScorelist = _sameIndexEquipDict[key].Keys.ToList();
|
_sellItemScorelist.Sort();
|
if (_sellItemScorelist.Count > 0)
|
{
|
int score = 0;
|
int curJob = PlayerDatas.Instance.baseData.Job;
|
for (score = _sellItemScorelist.Count - 1; score > -1; score--)
|
{
|
SinglePackModel equipPack = playerPack.GetSinglePackModel(PackType.rptEquip);
|
ItemModel model = null;
|
if(equipPack != null)
|
{
|
model = equipPack.GetItemModelByIndex(key);
|
}
|
|
List<ItemModel> modellist = _sameIndexEquipDict[key][_sellItemScorelist[score]];
|
int i = 0;
|
bool remainBetter = true;
|
for (i = 0; i < modellist.Count; i++)
|
{
|
double joblimit = Math.Floor((double)modellist[i].chinItemModel.JobLimit / 100);
|
if (model != null)
|
{
|
if (remainBetter)
|
{
|
if (model.equipScore < _sellItemScorelist[score] && curJob == joblimit)
|
{
|
_sameIndexEquipDict[key].Remove(_sellItemScorelist[score]);
|
remainBetter = false;
|
break;
|
}
|
}
|
|
}
|
else
|
{
|
if (curJob == joblimit)
|
{
|
if (remainBetter)
|
{
|
_sameIndexEquipDict[key].Remove(_sellItemScorelist[score]);
|
remainBetter = false;
|
break;
|
}
|
}
|
}
|
}
|
|
if (!remainBetter)
|
{
|
break;
|
}
|
|
}
|
int j = 0;
|
for (j = 0; j < _sellItemScorelist.Count; j++)
|
{
|
|
if (_sameIndexEquipDict[key].ContainsKey(_sellItemScorelist[j]))
|
{
|
int k = 0;
|
List<ItemModel> sellModlelist = _sameIndexEquipDict[key][_sellItemScorelist[j]];
|
for (k = 0; k < sellModlelist.Count; k++)
|
{
|
_sellItemlist.Add(sellModlelist[k]);
|
}
|
}
|
}
|
|
}
|
|
}
|
#endregion
|
|
List<int> drugLvlist = new List<int>();
|
drugLvlist.AddRange(_lifePotionDict.Keys.ToList());
|
drugLvlist.Sort();
|
for(int i = drugLvlist.Count - 1; i > -1; i--)
|
{
|
if(drugLvlist[i] > playerLv)
|
{
|
_lifePotionDict.Remove(drugLvlist[i]);
|
}
|
else
|
{
|
_lifePotionDict.Remove(drugLvlist[i]);
|
break;
|
}
|
}
|
|
foreach(var list in _lifePotionDict.Values)
|
{
|
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;
|
|
Dictionary<int, List<ItemModel>> sameScoreDict;
|
List<ItemModel> sameScorelist;
|
|
if (model.chinItemModel.ItemColor < 3)
|
{
|
if (!_sameIndexEquipDict.ContainsKey(model.chinItemModel.EquipPlace))
|
{
|
sameScoreDict = new Dictionary<int, List<ItemModel>>();
|
sameScorelist = new List<ItemModel>();
|
sameScorelist.Add(model);
|
sameScoreDict.Add(model.equipScore, sameScorelist);
|
_sameIndexEquipDict.Add(model.chinItemModel.EquipPlace, sameScoreDict);
|
|
}
|
else
|
{
|
if (_sameIndexEquipDict[model.chinItemModel.EquipPlace].ContainsKey(model.equipScore))
|
{
|
_sameIndexEquipDict[model.chinItemModel.EquipPlace][model.equipScore].Add(model);
|
}
|
else
|
{
|
sameScorelist = new List<ItemModel>();
|
sameScorelist.Add(model);
|
_sameIndexEquipDict[model.chinItemModel.EquipPlace].Add(model.equipScore, sameScorelist);
|
}
|
|
}
|
}
|
|
|
}
|
|
#endregion
|
|
#region 发送请求
|
/// <summary>
|
/// 一键出售物品的请求
|
/// </summary>
|
/// <param name="_oneKeySelllist"></param>
|
public void SendOneKeySellQuest(List<ItemModel> _oneKeySelllist)
|
{
|
if (!isPackResetOk) return;
|
|
byte[] itemIndexs = new byte[_oneKeySelllist.Count];
|
int i = 0;
|
for (i = 0; i < _oneKeySelllist.Count; i++)
|
{
|
itemIndexs[i] = (byte)_oneKeySelllist[i].itemInfo.ItemPlace;
|
}
|
CA311_tagCMSellItem sellItem = new CA311_tagCMSellItem();
|
sellItem.PackType = (int)PackType.rptItem;
|
sellItem.Count = (byte)_oneKeySelllist.Count;
|
sellItem.ItemIndex = itemIndexs;
|
GameNetSystem.Instance.SendInfo(sellItem);
|
}
|
|
/// <summary>
|
/// 整理包裹物品
|
/// </summary>
|
/// <param name="type"></param>
|
public bool isPackResetOk { get; set;}
|
public void SendPackResetQuest(PackType type)
|
{
|
if (lookLineIndex > -1)
|
{
|
SetLookIndex(null);
|
}
|
|
if (KnapSackWin.titleType == KnapsackFuncTitle.bag)
|
{
|
playerPack.isPlayBetterEquipEffect = true;
|
}
|
|
SinglePackModel singlePack = playerPack.GetSinglePackModel(type);
|
if (singlePack != null)
|
{
|
C070F_tagCItemPackReset packReset = new C070F_tagCItemPackReset();
|
packReset.Type = (byte)type;
|
packReset.ItemBeginIndex = 0;
|
packReset.ItemEndIndex = (ushort)(singlePack.openGridCount - 1);
|
GameNetSystem.Instance.SendInfo(packReset); //整理物品
|
if(type == PackType.rptItem)
|
{
|
isPackResetOk = false;
|
}
|
}
|
}
|
#endregion
|
|
#region 查看某个位置的物品
|
public event Action lookEquipEvent;
|
private int _lookLineIndex = -1;
|
public int lookLineIndex { get { return _lookLineIndex; } private set { _lookLineIndex = value; } }
|
|
public string lookItemGUID { get; private set; }
|
|
public void SetLookIndex(string guid, int singleRowCount = 5)
|
{
|
|
if (string.IsNullOrEmpty(guid) || guid == "")
|
{
|
lookLineIndex = -1;
|
}
|
else
|
{
|
int index = playerPack.GetItemModelByGUID(guid).itemInfo.ItemPlace;
|
lookLineIndex = index / singleRowCount;
|
lookItemGUID = guid;
|
}
|
|
if (lookEquipEvent != null)
|
{
|
lookEquipEvent();
|
}
|
|
}
|
#endregion
|
|
#region 判断是否有更好的装备替换
|
/// <summary>
|
/// 过滤装备位判断
|
/// </summary>
|
/// <param name="ignoreType"></param>
|
/// <returns></returns>
|
public bool CheckBetterEquip(RoleEquipType ignoreType)
|
{
|
SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptEquip);
|
if(singlePack != null)
|
{
|
Dictionary<int, ItemModel> putOnDic = singlePack.GetPackModelIndexDict();
|
foreach (var key in putOnDic.Keys)
|
{
|
if ((RoleEquipType)key == ignoreType)
|
{
|
continue;
|
}
|
if (key < 13)
|
{
|
List<ItemModel> itemlist = GetSameEquipPlacelist(key);
|
int i = 0;
|
for (i = 0; i < itemlist.Count; i++)
|
{
|
bool isOverdue = IsOverdue(itemlist[i].itemInfo.ItemGUID, itemlist[i].itemInfo.ItemID, itemlist[i].useDataDict);
|
if (itemlist[i].equipScore > putOnDic[key].equipScore && !isOverdue)
|
{
|
return true;
|
}
|
}
|
}
|
}
|
}
|
else
|
{
|
int i = 1;
|
for (i = 1; i < 13; i++)
|
{
|
List<ItemModel> itemlist = GetSameEquipPlacelist(i);
|
if(itemlist.Count > 0)
|
{
|
return true;
|
}
|
}
|
}
|
return false;
|
}
|
|
private List<ItemModel> GetSameEquipPlacelist(int equipPlace)
|
{
|
List<ItemModel> modellist = new List<ItemModel>();
|
Dictionary<int, ItemModel> dic = null;
|
SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
|
if (singlePack != null)
|
{
|
dic = singlePack.GetPackModelIndexDict();
|
foreach (var model in dic.Values)
|
{
|
if (model.chinItemModel.EquipPlace == equipPlace)
|
{
|
double equipJob = Math.Floor((double)model.chinItemModel.JobLimit / 100);
|
if (equipJob == 0 || equipJob == PlayerDatas.Instance.baseData.Job)
|
{
|
modellist.Add(model);
|
}
|
}
|
}
|
}
|
return modellist;
|
}
|
|
#endregion
|
|
#region 背包整理后好的同类型最好的装备
|
public Dictionary<int, Dictionary<int, ItemModel>> itemModelDict = new Dictionary<int, Dictionary<int, ItemModel>>(); // key1 装备位置索引 key2 背包位置索引
|
public void SetBagSortBetterEquipList(ItemModel itemModel)
|
{
|
if (itemModel == null || itemModel.packType != PackType.rptItem) return;
|
|
if (!IsCanPutOn(itemModel)) return;
|
|
int equipPlace = itemModel.chinItemModel.EquipPlace;
|
SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptEquip);
|
ItemModel putOnModel = null;
|
if (singlePack != null)
|
{
|
putOnModel = singlePack.GetItemModelByIndex(equipPlace);
|
}
|
if (!itemModelDict.ContainsKey(equipPlace))
|
{
|
Dictionary<int, ItemModel> dict = new Dictionary<int, ItemModel>();
|
if (putOnModel == null)
|
{
|
dict.Add(itemModel.itemInfo.ItemPlace, itemModel);
|
itemModelDict.Add(equipPlace, dict);
|
}
|
else
|
{
|
if (itemModel.equipScore > putOnModel.equipScore)
|
{
|
dict.Add(itemModel.itemInfo.ItemPlace, itemModel);
|
itemModelDict.Add(equipPlace, dict);
|
}
|
}
|
}
|
else
|
{
|
if(putOnModel == null)
|
{
|
if (!itemModelDict[equipPlace].ContainsKey(itemModel.itemInfo.ItemPlace))
|
{
|
itemModelDict[equipPlace].Add(itemModel.itemInfo.ItemPlace, itemModel);
|
}
|
}
|
else
|
{
|
if (itemModel.equipScore > putOnModel.equipScore)
|
{
|
itemModelDict[equipPlace].Add(itemModel.itemInfo.ItemPlace, itemModel);
|
}
|
}
|
}
|
|
}
|
|
public ItemModel GetBagSortBetterEquip(int equipPlace, int index)
|
{
|
ItemModel itemModel = null;
|
if (itemModelDict.ContainsKey(equipPlace))
|
{
|
itemModelDict[equipPlace].TryGetValue(index, out itemModel);
|
}
|
return itemModel;
|
}
|
|
public bool IsCanPutOn(ItemModel itemModel)
|
{
|
double equipJob = Math.Floor((double)itemModel.chinItemModel.JobLimit / 100);
|
int playerJob = PlayerDatas.Instance.baseData.Job;
|
int equipPlace = itemModel.chinItemModel.EquipPlace;
|
if (equipPlace == 0 || equipPlace > 12) return false;
|
if (equipJob != 0 && equipJob != playerJob) return false;
|
|
List<int> putOnlimitList = itemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetCancelUseLimit);
|
if (putOnlimitList != null)
|
{
|
if (putOnlimitList[0] == 1)
|
{
|
return true;
|
}
|
}
|
|
return CheckPutOnLimit(itemModel.itemId);
|
}
|
|
private bool CheckPutOnLimit(int itemId)
|
{
|
int playerLv = PlayerDatas.Instance.baseData.LV;
|
ItemConfig itemConfig = ConfigManager.Instance.GetTemplate<ItemConfig>(itemId);
|
if (itemConfig == null) return false;
|
|
if (itemConfig.EquipPlace != (int)RoleEquipType.retWing)
|
{
|
if (itemConfig.UseLV > playerLv) return false;
|
float sumOffsetPoint = 0;
|
float offset = 0;
|
if (itemConfig.LimitSTR != 0)
|
{
|
offset = itemConfig.LimitSTR - UIHelper.GetPropertyMapPlayerData(AttrEnum.POWER);
|
sumOffsetPoint += offset;
|
}
|
|
if (itemConfig.LimitPHY != 0)
|
{
|
offset = itemConfig.LimitPHY - UIHelper.GetPropertyMapPlayerData(AttrEnum.AGILITY);
|
sumOffsetPoint += offset;
|
}
|
|
if (itemConfig.LimitPNE != 0)
|
{
|
offset = itemConfig.LimitPNE - UIHelper.GetPropertyMapPlayerData(AttrEnum.MENTALITY);
|
sumOffsetPoint += offset;
|
}
|
|
if (sumOffsetPoint <= PlayerDatas.Instance.baseData.FreePoint)
|
{
|
if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.AddPoint))
|
{
|
return true;
|
}
|
}
|
|
return false;
|
}
|
|
else
|
{
|
var _realmLv = 1;
|
GeneralConfig.Instance.wingEquipLimits.TryGetValue(itemId, out _realmLv);
|
var needRealmConfig = ConfigManager.Instance.GetTemplate<RealmConfig>(_realmLv);
|
var curRealmConfig = ConfigManager.Instance.GetTemplate<RealmConfig>(PlayerDatas.Instance.baseData.realmLevel);
|
|
if (PlayerDatas.Instance.baseData.realmLevel < _realmLv)
|
{
|
return false;
|
}
|
else
|
{
|
return true;
|
}
|
}
|
}
|
#endregion
|
|
#region 得到物品的品质颜色
|
private Dictionary<int, int> wingRefineQualityDict;
|
private int[] wingsQualitys;
|
private int[] wingsRefineExps;
|
public int GetItemQuality(int itemId, Dictionary<int, List<int>> useDataDic = null)
|
{
|
wingsQualitys = null;
|
wingsRefineExps = null;
|
ItemConfig itemConfig = ConfigManager.Instance.GetTemplate<ItemConfig>(itemId);
|
wingRefineQualityDict = WingRefineAttrConfig.GetWingsQualityModel(itemConfig.LV);
|
if(useDataDic != null)
|
{
|
if(useDataDic.ContainsKey(42) && wingRefineQualityDict != null)
|
{
|
wingsQualitys = wingRefineQualityDict.Keys.ToArray();
|
wingsRefineExps = wingRefineQualityDict.Values.ToArray();
|
int i = 0;
|
for (i = wingsRefineExps.Length - 1; i > -1; i--)
|
{
|
if (useDataDic[42][0] >= wingsRefineExps[i])
|
{
|
return wingsQualitys[i];
|
}
|
}
|
}
|
}
|
return itemConfig.ItemColor;
|
}
|
#endregion
|
|
|
//设置玩家货币显示
|
public string OnChangeCoinsUnit(ulong value)
|
{
|
|
string strCoins = value.ToString();
|
if (strCoins.Length > 4 && strCoins.Length < 9)
|
{
|
double coins = Math.Floor((double)value / 10000);
|
strCoins = coins + Language.Get("KnapS114");
|
}
|
else if (strCoins.Length >= 9 && strCoins.Length < 13)
|
{
|
double coins = Math.Floor((double)value / 100000000);
|
strCoins = coins + Language.Get("KnapS115");
|
}
|
else if (strCoins.Length >= 13 && strCoins.Length < 19)
|
{
|
double coins = Math.Floor((double)value / 1000000000000);
|
strCoins = coins + Language.Get("KnapS126");
|
}
|
else if (strCoins.Length >= 19)
|
{
|
MessageWin.Inst.ShowFixedTip(Language.Get("KnapS127"));
|
}
|
return strCoins;
|
}
|
|
/// <summary>
|
/// 装备是否可以提升战力
|
/// </summary>
|
/// <param name="_itemID"></param>
|
/// <param name="_score"></param>
|
/// <returns></returns>
|
public int IsFightUp(int _itemID, int _score)//-1低级,0不是本职业,1更好
|
{
|
ItemConfig chinItemModel = ConfigManager.Instance.GetTemplate<ItemConfig>(_itemID);
|
if (chinItemModel != null)
|
{
|
if (chinItemModel.Type < 101 || chinItemModel.Type >= 110) return 0;
|
ItemModel model = playerPack.GetItemModelByIndex(PackType.rptEquip,chinItemModel.EquipPlace);
|
if (chinItemModel.EquipPlace == (int)RoleEquipType.retFairyCan)
|
{
|
ItemModel fairyModel2 = playerPack.GetItemModelByIndex(PackType.rptEquip,(int)RoleEquipType.retFairyCan2);
|
if (fairyModel2 != null)
|
{
|
if (model != null)
|
{
|
if (fairyModel2.equipScore < model.equipScore)
|
{
|
model = fairyModel2;
|
}
|
}
|
}
|
else
|
{
|
model = fairyModel2;
|
}
|
}
|
int equipScore1 = 0;
|
if (model != null)
|
{
|
equipScore1 = (int)model.equipScore;
|
}
|
|
int playerJob = PlayerDatas.Instance.baseData.Job;
|
|
if (playerJob == Math.Floor((double)chinItemModel.JobLimit / 100) || chinItemModel.JobLimit == 0)
|
{
|
if (equipScore1 > _score)
|
return -1;
|
else if (equipScore1 < _score)
|
return 1;
|
else
|
return 0;
|
}
|
else
|
{
|
return 0;
|
}
|
}
|
return 0;
|
}
|
|
#region 物品是否过期
|
public bool IsOverdue(string guid,int itemId,Dictionary<int, List<int>> useDataDict = null)
|
{
|
ItemConfig itemConfig = ConfigManager.Instance.GetTemplate<ItemConfig>(itemId);
|
if (itemConfig == null) return false;
|
|
if (itemConfig.ExpireTime > 0)
|
{
|
ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(guid);
|
switch ((EquipReduceType)itemConfig.EndureReduceType)
|
{
|
case EquipReduceType.Def_EquipReduceType_Time:
|
if (guid != "")
|
{
|
List<int> itemEffectTime = null;
|
if (useDataDict != null)
|
{
|
if(useDataDict.ContainsKey((int)ItemUseDataKey.Def_IudetCreateTime))
|
{
|
itemEffectTime = useDataDict[(int)ItemUseDataKey.Def_IudetCreateTime];
|
}
|
}
|
|
if (itemEffectTime != null && itemEffectTime[0] != 0)
|
{
|
if (cool== null || cool.GetRemainTime()<= 0)
|
{
|
return true;
|
}
|
}
|
}
|
break;
|
|
case EquipReduceType.Def_EquipReduceType_RTimeItem:
|
if (guid != "")
|
{
|
if (cool == null || cool.GetRemainTime() <= 0)
|
{
|
return true;
|
}
|
}
|
break;
|
|
}
|
}
|
|
return false;
|
}
|
#endregion
|
}
|
}
|