public Dictionary <uint, List <GameCmd.EquipPos> > StructEquipPartInlayData() { uint em = (uint)EquipPartMode.AttackPart; for (GameCmd.EquipPos i = GameCmd.EquipPos.EquipPos_Hat; i < GameCmd.EquipPos.EquipPos_Max; i++) { em = (uint)GetEquipModeByEquipPos(i); if (em == (uint)EquipPartMode.None) { continue; } if (!m_dicInlayParts.ContainsKey(em)) { List <GameCmd.EquipPos> epsList = new List <GameCmd.EquipPos>(); epsList.Add(i); m_dicInlayParts.Add(em, epsList); } else { if (!m_dicInlayParts[em].Contains(i)) { m_dicInlayParts[em].Add(i); } } } return(m_dicInlayParts); }
/// <summary> /// 判断当前装备位置是不是可以强化 /// </summary> /// <param name="pos"></param> /// <returns></returns> public bool JudgeEquipPosCanStrengthen(GameCmd.EquipPos pos) { //部位的当前强化等级<主角当前等级 bool isStrengthMax = emgr.IsGridStrengthenMax(pos); bool moneyEnough = false; bool itemEnough = false; EquipDefine.LocalGridStrengthenData next = emgr.GetNextStrengthDataByPos(pos); if (next != null) { ClientMoneyType type = (ClientMoneyType)next.MoneyCostData.ID; uint num = next.MoneyCostData.Num; moneyEnough = MainPlayerHelper.GetMoneyNumByType(type) >= num; //满足下面要求的 道具 的数量 int matchItemNum = 0; for (int i = 0; i < next.ItemCostDatas.Count; i++) { uint itemID = next.ItemCostDatas[i].ID; uint itemNum = next.ItemCostDatas[i].Num; int holdNum = DataManager.Manager <ItemManager>().GetItemNumByBaseId(itemID); if (holdNum >= itemNum) { matchItemNum++; } } itemEnough = matchItemNum == next.ItemCostDatas.Count; } return(itemEnough && moneyEnough); }
public Dictionary <GameCmd.GemType, GemInlayUpdateData> StructGemInlayDatas(GameCmd.EquipPos pos) { //可镶嵌数据 if (null == mdicCanInlayDatas) { mdicCanInlayDatas = new Dictionary <GameCmd.GemType, GemInlayUpdateData>(); } //mdicCanInlayDatas.Clear(); //获取可镶嵌宝石列表 if (null == mlstCanInlayGemType) { mlstCanInlayGemType = new List <GameCmd.GemType>(); } mlstCanInlayGemType.Clear(); mlstCanInlayGemType.AddRange(emgr.GeCanInlaytGemTypeByPos(pos)); if (subTypes.Count == 0) { subTypes.Add((uint)ItemDefine.ItemMaterialSubType.Gem); } if (gemItemList == null) { gemItemList = new List <uint>(); gemItemList.AddRange(imgr.GetItemByType(GameCmd.ItemBaseType.ItemBaseType_Material, subTypes, GameCmd.PACKAGETYPE.PACKAGETYPE_MAIN)); gemQwThisIDsChanged = false; } else { if (gemQwThisIDsChanged) { gemItemList.Clear(); gemItemList.AddRange(imgr.GetItemByType(GameCmd.ItemBaseType.ItemBaseType_Material, subTypes, GameCmd.PACKAGETYPE.PACKAGETYPE_MAIN)); gemQwThisIDsChanged = false; } } GemInlayUpdateData gemInlayUpdateData = null; for (int i = 0; i < mlstCanInlayGemType.Count; i++) { if (mdicCanInlayDatas.ContainsKey(mlstCanInlayGemType[i])) { gemInlayUpdateData = mdicCanInlayDatas[mlstCanInlayGemType[i]]; if (null != gemInlayUpdateData) { if (!gemInlayUpdateData.m_lstGemQwThisIDList.Equals(gemItemList)) { gemInlayUpdateData.StructData(gemItemList); } } } else { gemInlayUpdateData = new GemInlayUpdateData(mlstCanInlayGemType[i]); mdicCanInlayDatas.Add(mlstCanInlayGemType[i], gemInlayUpdateData); } } return(mdicCanInlayDatas); }
/// <summary> /// 请求强化格子 /// </summary> /// <param name="strengthenAll">是不是强化所有</param> /// <param name="pos">单个强化</param> public void GridStrengthenReq(bool strengthenAll, GameCmd.EquipPos pos = EquipPos.EquipPos_None) { stEquipStrengthenItemWorkUserCmd_CS cmd = new stEquipStrengthenItemWorkUserCmd_CS() { equip_pos = pos, all_intensify = strengthenAll, }; SendCmd(cmd); }
/// <summary> /// 从装备格上卸下宝石 /// </summary> /// <param name="pos"></param> /// <param name="equipGridIndex"></param> public void GemUnloadReq(GameCmd.EquipPos pos, uint equipGridIndex) { stGemUninlayItemWorkUserCmd_CS cmd = new stGemUninlayItemWorkUserCmd_CS() { equip_index = equipGridIndex, equippos = pos, }; SendCmd(cmd); }
/// <summary> /// 宝石合成响应 /// </summary> /// <param name="msg"></param> // [Execute] ////public void OnGemComposeRes(stGemComposeItemWorkUserCmd_CS msg) ////{ //// DataManager.Manager<EquipManager>().OnGemCompose(msg.gemid); ////} /// <summary> /// 宝石镶嵌请求 /// </summary> /// <param name="euquipIndex"></param> /// <param name="gemBaseId"></param> public void InlayGemReq(GameCmd.EquipPos pos, uint equipIndex, uint gemBaseId) { stGemInlayItemWorkUserCmd_CS cmd = new stGemInlayItemWorkUserCmd_CS() { equippos = pos, equip_index = equipIndex, gemid = gemBaseId, }; SendCmd(cmd); }
public bool HaveGemCanImprove(GameCmd.EquipPos pos, GameCmd.GemType gemType) { for (EquipManager.EquipGridIndexType i = EquipManager.EquipGridIndexType.First; i < EquipManager.EquipGridIndexType.Max; i++) { if (JudgeEquipPosCanInlay(pos, i, gemType)) { return(true); } } return(false); }
/// <summary> /// 物品合成请求 /// </summary> /// <param name="itemId">物品id</param> /// <param name="composeType">合成类型</param> public void ItemComposeReq(uint itemId, uint composeType, GameCmd.EquipPos pos = EquipPos.EquipPos_None, uint gemPosIndex = 0) { stComposeItemWorkUserCmd_CS cmd = new stComposeItemWorkUserCmd_CS() { composetype = composeType, itemid = itemId, equip_pos = pos, gem_pos_index = gemPosIndex, }; SendCmd(cmd); }
public bool JudgeEquipPosCanInlay(GameCmd.EquipPos pos, EquipManager.EquipGridIndexType index, GameCmd.GemType gemType) { uint inlayBaseId = 0; int matchNum = 0; if (!emgr.IsUnlockEquipGridIndex(index)) { return(false); } else if (emgr.TryGetEquipGridInlayGem(pos, index, out inlayBaseId)) { Gem InlayItem = DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <Gem>(inlayBaseId, ItemDefine.ItemDataType.Gem); //镶嵌的宝石小与背包的宝石? StructGemInlayDatas(pos); GemInlayUpdateData updateData = GetGemInlayUpdateData(gemType); if (null != updateData) { updateData.HaveGemCanInlay = false; uint canInlayBaseId = 0; if (null != updateData && updateData.TryGetCanInlayGem(out canInlayBaseId)) { Gem canInlayItem = DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <Gem>(canInlayBaseId, ItemDefine.ItemDataType.Gem); if (InlayItem != null && canInlayItem != null) { bool higher = canInlayItem.FightPowerNum > InlayItem.FightPowerNum; if (higher) { matchNum++; updateData.HaveGemCanInlay = true; } } } } } else { StructGemInlayDatas(pos); GemInlayUpdateData updateData = GetGemInlayUpdateData(gemType); if (null != updateData) { updateData.HaveGemCanInlay = false; uint canInlayBaseId = 0; if (null != updateData && updateData.TryGetCanInlayGem(out canInlayBaseId)) { matchNum++; updateData.HaveGemCanInlay = true; } } } return(matchNum > 0); }
public bool EquipPosCanInlay(GameCmd.EquipPos pos, EquipManager.EquipGridIndexType index) { if (null == mlstCanInlayGemType) { mlstCanInlayGemType = new List <GameCmd.GemType>(); } mlstCanInlayGemType.Clear(); mlstCanInlayGemType.AddRange(emgr.GeCanInlaytGemTypeByPos(pos)); for (int x = 0; x < mlstCanInlayGemType.Count; x++) { if (JudgeEquipPosCanInlay(pos, index, mlstCanInlayGemType[x])) { return(true); } } return(false); }
public EquipPartMode GetEquipModeByEquipPos(GameCmd.EquipPos ep) { EquipPartMode em = EquipPartMode.None; //圣魂、官印、披风无法镶嵌 if (ep == GameCmd.EquipPos.EquipPos_SoulOne || ep == GameCmd.EquipPos.EquipPos_SoulTwo || ep == GameCmd.EquipPos.EquipPos_Office || ep == GameCmd.EquipPos.EquipPos_Capes) { em = EquipPartMode.None; } else if (ep == GameCmd.EquipPos.EquipPos_Equip || ep == GameCmd.EquipPos.EquipPos_AdornlOne || ep == GameCmd.EquipPos.EquipPos_AdornlTwo || ep == GameCmd.EquipPos.EquipPos_Shield) { em = EquipPartMode.AttackPart; } else { em = EquipPartMode.DefendPart; } return(em); }
public void OnGridStrengthenCompelte(bool strengthenAll, GameCmd.EquipPos pos) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENT_GRIDSTRENGTHENLVCHANGED, strengthenAll); }
List <uint> GetPushList(BaseItem bi = null) { EquipManager em = DataManager.Manager <EquipManager>(); if (em == null) { return(null); } Dictionary <GameCmd.EquipType, List <BaseEquip> > dic = GetWillCompareDic(bi); //Array enumArray = Enum.GetValues(typeof(GameCmd.EquipType)); //for (int i = 0; i < enumArray.Length; i++) //{ // GameCmd.EquipType type = (GameCmd.EquipType)enumArray.GetValue(i); // List<BaseEquip> wareList = em.GetEquipsByPackageType(PACKAGETYPE.PACKAGETYPE_EQUIP, type); // List<BaseEquip> packageList = em.GetEquipsByPackageType(PACKAGETYPE.PACKAGETYPE_MAIN, type); // wareList.AddRange(packageList); // //if(type == EquipType.EquipType_AdornlOne) // //{ // // int a = 10; // //} // List<BaseEquip> tempList = GetSortList(wareList); // dic.Add(type, tempList); //} List <uint> pushList = new List <uint>(); Array posenumArray = Enum.GetValues(typeof(GameCmd.EquipPos)); for (int i = 0; i < posenumArray.Length; i++) { GameCmd.EquipPos pos = (GameCmd.EquipPos)posenumArray.GetValue(i); if (pos != null) { EquipType type = em.GetEquipTypeByEquipPos(pos); if (type == EquipType.EquipType_AdornlOne || type == EquipType.EquipType_SoulOne || type == EquipType.EquipType_None) { continue; } if (!dic.ContainsKey(type)) { continue; } List <BaseEquip> allList = dic[type]; if (allList == null) { continue; } uint posEquipID = 0; for (int m = 0; m < allList.Count; m++) { BaseEquip tempEquip = allList[m]; if (em.IsWearEquip(tempEquip.QWThisID)) { continue; } if (em.IsEquipPos(pos, out posEquipID)) { ItemManager im = DataManager.Manager <ItemManager>(); BaseEquip wareEquip = im.GetBaseItemByQwThisId(posEquipID) as BaseEquip; if (wareEquip.Power < tempEquip.Power) { pushList.Add(tempEquip.QWThisID); allList.RemoveAt(m); break; } } else { pushList.Add(tempEquip.QWThisID); allList.RemoveAt(m); break; } } } } //处理戒指和圣魂 if (type == EquipType.EquipType_AdornlOne || type ==EquipType.EquipType_SoulOne) if (dic.ContainsKey(EquipType.EquipType_AdornlOne)) { List <BaseEquip> adornList = dic[EquipType.EquipType_AdornlOne]; if (adornList != null) { for (int i = 0; i < adornList.Count; i++) { if (i > 1) { break; } BaseEquip temp = adornList[i]; if (!em.IsWearEquip(temp.QWThisID)) { pushList.Add(temp.QWThisID); } } } } if (dic.ContainsKey(EquipType.EquipType_SoulOne)) { List <BaseEquip> soulList = dic[EquipType.EquipType_SoulOne]; if (soulList != null) { for (int i = 0; i < soulList.Count; i++) { if (i > 1) { break; } BaseEquip temp = soulList[i]; if (!em.IsWearEquip(temp.QWThisID)) { pushList.Add(temp.QWThisID); } } } } return(pushList); }