Пример #1
0
        public EMagicSwordTowardType GetMagicSwordTypeByWeapon(int nOccu, List <GoodsData> list, GameClient client = null)
        {
            EMagicSwordTowardType result;

            lock (list)
            {
                EMagicSwordTowardType eType = EMagicSwordTowardType.EMST_Strength;
                if (!this.IsMagicSword(nOccu))
                {
                    result = EMagicSwordTowardType.EMST_Not;
                }
                else if (list == null || list.Count <= 0)
                {
                    result = eType;
                }
                else
                {
                    SystemXmlItem    systemGoods = null;
                    List <GoodsData> WeaponList  = new List <GoodsData>();
                    List <GoodsData> BaseWeap    = new List <GoodsData>();
                    List <GoodsData> RebornWeap  = new List <GoodsData>();
                    GoodsData        goodsData;
                    for (int i = 0; i < list.Count; i++)
                    {
                        goodsData = list[i];
                        if (null != goodsData)
                        {
                            int GoodId = goodsData.GoodsID;
                            if (RebornEquip.IsRebornEquipShengQi(GoodId) || RebornEquip.IsRebornEquipShengWu(GoodId))
                            {
                                RebornWeap.Add(goodsData);
                            }
                            else
                            {
                                BaseWeap.Add(goodsData);
                            }
                        }
                    }
                    if (client == null)
                    {
                        if (BaseWeap == null || BaseWeap.Count <= 0)
                        {
                            return(eType);
                        }
                        goodsData = RebornEquip.GetMagicWeaponGoods(BaseWeap, true);
                    }
                    else
                    {
                        SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode);
                        if (sceneType != SceneUIClasses.ChongShengMap)
                        {
                            if (client.ClientData.RebornShowEquip == 0)
                            {
                                goodsData = RebornEquip.GetMagicWeaponGoods(BaseWeap, true);
                            }
                            else
                            {
                                if (client.ClientData.PropStrength >= client.ClientData.PropIntelligence)
                                {
                                    return(EMagicSwordTowardType.EMST_Strength);
                                }
                                return(EMagicSwordTowardType.EMST_Intelligence);
                            }
                        }
                        else
                        {
                            if (client.ClientData.PropStrength >= client.ClientData.PropIntelligence)
                            {
                                return(EMagicSwordTowardType.EMST_Strength);
                            }
                            return(EMagicSwordTowardType.EMST_Intelligence);
                        }
                    }
                    if (null == goodsData)
                    {
                        result = eType;
                    }
                    else if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsData.GoodsID, out systemGoods))
                    {
                        result = eType;
                    }
                    else
                    {
                        int nStrength     = systemGoods.GetIntValue("Strength", -1);
                        int nIntelligence = systemGoods.GetIntValue("Intelligence", -1);
                        eType  = ((nStrength >= nIntelligence) ? EMagicSwordTowardType.EMST_Strength : EMagicSwordTowardType.EMST_Intelligence);
                        result = eType;
                    }
                }
            }
            return(result);
        }
Пример #2
0
        public bool CanUseMagicOfMagicSword(GameClient client, int nMagicID)
        {
            bool result;

            if (null == client)
            {
                result = false;
            }
            else if (client.buffManager.IsBuffEnabled(121))
            {
                result = true;
            }
            else if (!this.IsMagicSword(client))
            {
                result = true;
            }
            else if (!this.IsVersionSystemOpenOfMagicSword())
            {
                result = false;
            }
            else
            {
                SystemXmlItem systemMagics = null;
                if (!GameManager.SystemMagicsMgr.SystemXmlItemDict.TryGetValue(nMagicID, out systemMagics))
                {
                    result = false;
                }
                else
                {
                    int nMagicDamageType = systemMagics.GetIntValue("DamageType", -1);
                    if (nMagicDamageType < 0)
                    {
                        result = true;
                    }
                    else
                    {
                        switch (nMagicDamageType)
                        {
                        case 1:
                            if (nMagicID != 10000)
                            {
                                switch (nMagicID)
                                {
                                case 10088:
                                case 10089:
                                case 10090:
                                case 10091:
                                    break;

                                default:
                                    goto IL_122;
                                }
                            }
                            return(true);

                        case 2:
                            if (nMagicID != 10100)
                            {
                                switch (nMagicID)
                                {
                                case 10188:
                                case 10189:
                                case 10190:
                                case 10191:
                                    break;

                                default:
                                    goto IL_122;
                                }
                            }
                            return(true);
                        }
IL_122:
                        List <GoodsData> WeaponList = client.UsingEquipMgr.GetWeaponEquipList();
                        lock (WeaponList)
                        {
                            if (WeaponList == null || WeaponList.Count <= 0)
                            {
                                result = false;
                            }
                            else
                            {
                                List <GoodsData> BaseWeap   = new List <GoodsData>();
                                List <GoodsData> RebornWeap = new List <GoodsData>();
                                foreach (GoodsData it in WeaponList)
                                {
                                    if (RebornEquip.IsRebornEquipShengQi(it.GoodsID) || RebornEquip.IsRebornEquipShengWu(it.GoodsID))
                                    {
                                        RebornWeap.Add(it);
                                    }
                                    else
                                    {
                                        BaseWeap.Add(it);
                                    }
                                }
                                SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode);
                                GoodsData      goods;
                                if (sceneType != SceneUIClasses.ChongShengMap)
                                {
                                    if (client.ClientData.RebornShowEquip == 0)
                                    {
                                        goods = RebornEquip.GetMagicWeaponGoods(BaseWeap, true);
                                    }
                                    else
                                    {
                                        goods = RebornEquip.GetMagicWeaponGoods(RebornWeap, false);
                                    }
                                }
                                else
                                {
                                    goods = RebornEquip.GetMagicWeaponGoods(RebornWeap, false);
                                }
                                if (goods == null)
                                {
                                    result = false;
                                }
                                else
                                {
                                    SystemXmlItem systemGoods = null;
                                    if (RebornEquip.IsRebornEquipShengQi(goods.GoodsID) || RebornEquip.IsRebornEquipShengWu(goods.GoodsID))
                                    {
                                        if (client.ClientData.PropStrength >= client.ClientData.PropIntelligence)
                                        {
                                            RebornEquipXmlStruct REMap;
                                            if (!RebornEquip.EquipSQSW.TryGetValue(goods.GoodsID, out REMap))
                                            {
                                                return(false);
                                            }
                                            if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(REMap.LMJSModGoodID, out systemGoods))
                                            {
                                                return(false);
                                            }
                                        }
                                        else
                                        {
                                            RebornEquipXmlStruct REMap;
                                            if (!RebornEquip.EquipSQSW.TryGetValue(goods.GoodsID, out REMap))
                                            {
                                                return(false);
                                            }
                                            if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(REMap.FMJSModGoodID, out systemGoods))
                                            {
                                                return(false);
                                            }
                                        }
                                    }
                                    else if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goods.GoodsID, out systemGoods))
                                    {
                                        return(false);
                                    }
                                    int nStrength         = systemGoods.GetIntValue("Strength", -1);
                                    int nIntelligence     = systemGoods.GetIntValue("Intelligence", -1);
                                    int nWeaponDamageType = (nStrength >= nIntelligence) ? 1 : 2;
                                    if (nWeaponDamageType == nMagicDamageType)
                                    {
                                        result = true;
                                    }
                                    else
                                    {
                                        LogManager.WriteLog(LogTypes.Warning, string.Format("武器与技能类型不符,无法释放技能: RoleID={0}, 武器id{1}, 武器类型{2}, 技能id{3}, 技能类型{4}", new object[]
                                        {
                                            client.ClientData.RoleID,
                                            goods.GoodsID,
                                            nWeaponDamageType,
                                            nMagicID,
                                            nMagicDamageType
                                        }), null, true);
                                        result = false;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }