public int _CanUsingEquip(GameClient client, GoodsData goodsData, int toBagIndex, SystemXmlItem systemGoods = null) { if (null == systemGoods) { if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsData.GoodsID, out systemGoods)) { return(-1); } } int categoriy = systemGoods.GetIntValue("Categoriy", -1); if (!RebornEquip.IsRebornEquip(goodsData.GoodsID)) { if ((categoriy < 0 || categoriy >= 49) && categoriy != 340) { return(-2); } } else { if (categoriy < 30 || categoriy > 38) { return(-2); } int Suit = systemGoods.GetIntValue("ToReborn", -1); int Level = systemGoods.GetIntValue("ToRebornLevel", -1); if (client.ClientData.RebornCount < Suit && client.ClientData.RebornLevel < Level) { return(-4); } if (goodsData.GCount <= 0) { return(-5); } } int nHandType = systemGoods.GetIntValue("HandType", -1); if (categoriy < 22 && categoriy >= 11) { int nActionType = systemGoods.GetIntValue("ActionType", -1); int nRet = WeaponAdornManager.VerifyWeaponCanEquip(Global.CalcOriginalOccupationID(client), nHandType, nActionType, this.EquipDict); if (nRet < 0) { return(nRet); } } if (categoriy <= 38 && categoriy >= 37) { int nRet = RebornEquip.VerifyWeaponCanEquip(client.UsingEquipMgr.EquipDict); if (nRet < 0) { return(nRet); } } bool is2Dot2Disable = GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System2Dot2); List <GoodsData> list = null; int result; if (!this.EquipDict.TryGetValue(categoriy, out list)) { if (categoriy == 23 && !is2Dot2Disable) { result = OrnamentManager.getInstance()._CanUsingOrnament(client, toBagIndex, list); } else if (categoriy == 9 || categoriy == 10) { result = this._CanUsingChongWu(categoriy); } else if (GoodsUtil.CanEquip(categoriy, goodsData.Site)) { result = 0; } else { result = 0; } } else { int nCount = list.Count; if (categoriy < 22 && categoriy >= 11) { if (nHandType == 2 || GameManager.MagicSwordMgr.IsMagicSword(client)) { if (nCount >= 2) { return(-3); } return(0); } } else if (categoriy == 6) { if (nCount >= 2) { return(-3); } return(0); } else if (categoriy == 36) { if (nCount >= 2) { return(-3); } return(0); } else if (categoriy == 9 || categoriy == 10) { int nRet = this._CanUsingChongWu(categoriy); if (nRet < 0) { return(nRet); } } else if (categoriy == 23 && !is2Dot2Disable) { return(OrnamentManager.getInstance()._CanUsingOrnament(client, toBagIndex, list)); } result = ((list.Count < 1) ? 0 : -3); } return(result); }
/// <summary> /// 能否佩戴装备 /// </summary> /// <param name="goodsData"></param> /// <returns></returns> public int _CanUsingEquip(GameClient client, GoodsData goodsData, int toBagIndex, SystemXmlItem systemGoods = null) { if (null == systemGoods) { if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsData.GoodsID, out systemGoods)) { return(-1); } } int categoriy = systemGoods.GetIntValue("Categoriy"); if (categoriy < 0 || categoriy >= (int)ItemCategories.EquipMax) { return(-2); } /*if ((int)ItemCategories.Ring == categoriy || (int)ItemCategories.Bracelet == categoriy) * { * //这样的戒指和手镯无法佩戴上,所以也是非法的 * if (toBagIndex < 0 || toBagIndex > 1) * { * return -55; * } * }*/ // 校验武器是否能装备,不管是否穿戴过,都要进行验证[7/12/2013 ChenXiaojun] int nHandType = systemGoods.GetIntValue("HandType"); if (categoriy < (int)ItemCategories.HuFu && categoriy >= (int)ItemCategories.WuQi_Jian) { int nActionType = systemGoods.GetIntValue("ActionType"); // 进行穿戴类型验证 int nRet = WeaponAdornManager.VerifyWeaponCanEquip(Global.CalcOriginalOccupationID(client), nHandType, nActionType, EquipDict); if (nRet < 0) { return(nRet); } } List <GoodsData> list = null; if (!EquipDict.TryGetValue(categoriy, out list)) { return(_CanUsingChongWu(categoriy)); } else // MU 增加逻辑 [11/19/2013 LiaoWei] { // 如果是武器 int nCount = list.Count; if (categoriy < (int)ItemCategories.HuFu && categoriy >= (int)ItemCategories.WuQi_Jian) { if (nHandType == (int)WeaponHandType.WHT_BOTHTYPE) { if (nCount >= 2) { return(-3); } else { return(0); } } } // 如果是戒指 else if (categoriy == (int)ItemCategories.JieZhi) { if (nCount >= 2) { return(-3); } else { return(0); } } // 如果是宠物 else if (categoriy == (int)ItemCategories.ShouHuChong || categoriy == (int)ItemCategories.ChongWu) { int nRet = _CanUsingChongWu(categoriy); if (nRet < 0) { return(nRet); } } } /* if ((int)ItemCategories.Ring == categoriy || (int)ItemCategories.Bracelet == categoriy) * { * //蕴神灵戒 只能佩戴一个,特殊处理下 * if ((goodsData.GoodsID >= 1305000 && goodsData.GoodsID <= 1305003) && null != list) * { * for (int i = 0; i < list.Count; i++) * { * if ((list[i].GoodsID >= 1305000 && list[i].GoodsID <= 1305003)) * { * return -44; * } * } * } * * //腾云手镯 只能佩戴一个,特殊处理下 * if ((goodsData.GoodsID >= 1303000 && goodsData.GoodsID <= 1303003) && null != list) * { * for (int i = 0; i < list.Count; i++) * { * if ((list[i].GoodsID >= 1303000 && list[i].GoodsID <= 1303003)) * { * return -444; * } * } * } * * if (list.Count >= 2) * { * return -3; * } * * for (int i = 0; i < list.Count; i++) * { * if (toBagIndex == list[i].BagIndex) * { * return -4; //不能重复的使用 * } * } * * return 0; * }*/ return((list.Count < 1) ? 0 : -3); }