Beispiel #1
0
        public static GoodsData GiveOneMeditateGood(GameClient client)
        {
            int       packageID = Global.GetMingXiangPackageID(client);
            GoodsData result;

            if (0 == packageID)
            {
                result = null;
            }
            else
            {
                List <GoodsData> AwardGoodsList = GoodsBaoXiang.FetchGoodListBaseFallPacketID(client, packageID, 1, FallAlgorithm.BaoXiang);
                if (AwardGoodsList == null || AwardGoodsList.Count == 0)
                {
                    result = null;
                }
                else
                {
                    GoodsData tmpGoodsData = AwardGoodsList[0];
                    tmpGoodsData.Site = 1;
                    int dbRet = GoodsUtil.AddGoodsDBCommand(client, tmpGoodsData, false, 0, "冥想", true);
                    tmpGoodsData.Id = dbRet;
                    int totalTime = Global.GetRoleParamsInt32FromDB(client, "MeditateTime");
                    EventLogManager.AddRoleMeditateEvent(client, (long)(totalTime / 1000), GoodsUtil.GetMeditateBagGoodsCnt(client), Global.NewGoodsDataPropString(tmpGoodsData));
                    result = tmpGoodsData;
                }
            }
            return(result);
        }
Beispiel #2
0
        public List <int> GetUsingEquipAppend()
        {
            List <int> result = new List <int>();

            lock (this.WeaponStrongList)
            {
                foreach (GoodsData goodsdata in this.WeaponStrongList)
                {
                    if (goodsdata != null && goodsdata.Using > 0)
                    {
                        result.Add(goodsdata.AppendPropLev);
                    }
                }
            }
            lock (this.EquipList)
            {
                foreach (GoodsData goodsdata in this.EquipList)
                {
                    if (goodsdata != null && goodsdata.Using > 0)
                    {
                        int nCategories = Global.GetGoodsCatetoriy(goodsdata.GoodsID);
                        if (nCategories != 9 && nCategories != 10 && !GoodsUtil.GetGoodsTypeInfo(nCategories).FashionGoods&& nCategories != 8)
                        {
                            result.Add(goodsdata.AppendPropLev);
                        }
                    }
                }
            }
            return(result);
        }
Beispiel #3
0
        public static void ProcessMeditateGoods(GameClient client)
        {
            int GetRewardTime = Global.GetMingXiangGoodsInterval(client);
            int givenGoodsCnt = GoodsUtil.GetMeditateBagGoodsCnt(client);
            int totalTime     = client.ClientData.MeditateTime;
            int leaveTime     = Global.GMax(0, totalTime - givenGoodsCnt * GetRewardTime);

            if (leaveTime >= GetRewardTime)
            {
                int cnt      = leaveTime / GetRewardTime;
                int addCount = 0;
                for (int i = 0; i < cnt; i++)
                {
                    if (givenGoodsCnt + 1 > Data.OfflineRW_ItemLimit)
                    {
                        LogManager.WriteLog(LogTypes.Info, string.Format("角色冥想背包超过{2}了,角色ID = {0} ,角色roleid = {1}", client.strUserID, client.ClientData.RoleID, Data.OfflineRW_ItemLimit), null, true);
                        break;
                    }
                    if (null != GoodsUtil.GiveOneMeditateGood(client))
                    {
                        givenGoodsCnt++;
                        addCount++;
                    }
                }
                LogManager.WriteLog(LogTypes.Info, string.Format("玩家登陆的时候,冥想背包物品添加{3}个,现有{2}个,角色ID = {0} ,角色roleid = {1}", new object[]
                {
                    client.strUserID,
                    client.ClientData.RoleID,
                    givenGoodsCnt,
                    addCount
                }), null, true);
            }
        }
Beispiel #4
0
        public static GoodsData GetResGoodsData(MoneyTypes type, int gcount)
        {
            GoodsData result;

            if (gcount <= 0)
            {
                result = null;
            }
            else
            {
                int goodsID = GoodsUtil.GetResGoodsID(type);
                if (goodsID == 0)
                {
                    result = null;
                }
                else
                {
                    GoodsData goodsData = new GoodsData
                    {
                        GoodsID = goodsID,
                        GCount  = gcount
                    };
                    result = goodsData;
                }
            }
            return(result);
        }
Beispiel #5
0
 public static int GetMeditateBagGoodsCnt(GameClient client)
 {
     if (null == client.ClientData.MeditateGoodsDataList)
     {
         client.ClientData.MeditateGoodsDataList = GoodsUtil.GetGoodsListBySiteFromDB(client, 1);
     }
     if (null == client.ClientData.MeditateGoodsDataList)
     {
         client.ClientData.MeditateGoodsDataList = new List <GoodsData>();
     }
     return(client.ClientData.MeditateGoodsDataList.Count);
 }
Beispiel #6
0
        public static int GetIdleSlotOfBag(GameClient client, int site)
        {
            int idelPos           = 0;
            List <GoodsData> list = null;

            if (site == 1)
            {
                list = client.ClientData.FuWenGoodsDataList;
            }
            int result;

            if (null == list)
            {
                result = idelPos;
            }
            else
            {
                List <int> usedBagIndex = new List <int>();
                for (int i = 0; i < list.Count; i++)
                {
                    if (usedBagIndex.IndexOf(list[i].BagIndex) < 0)
                    {
                        usedBagIndex.Add(list[i].BagIndex);
                    }
                }
                int totalCount = GoodsUtil.GetMaxBagCount(site);
                for (int j = 0; j < totalCount; j++)
                {
                    if (usedBagIndex.IndexOf(j) < 0)
                    {
                        idelPos = j;
                        break;
                    }
                }
                result = idelPos;
            }
            return(result);
        }
Beispiel #7
0
        public int GetUsingEquipAllForge()
        {
            int nForgeLevel = 0;

            foreach (GoodsData goodsdata in this.WeaponStrongList)
            {
                if (goodsdata != null && goodsdata.Using > 0)
                {
                    nForgeLevel += goodsdata.Forge_level;
                }
            }
            foreach (GoodsData goodsdata in this.EquipList)
            {
                if (goodsdata != null && goodsdata.Using > 0)
                {
                    int nCategories = Global.GetGoodsCatetoriy(goodsdata.GoodsID);
                    if (nCategories != 9 && nCategories != 10 && !GoodsUtil.GetGoodsTypeInfo(nCategories).FashionGoods&& nCategories != 8)
                    {
                        nForgeLevel += goodsdata.Forge_level;
                    }
                }
            }
            return(nForgeLevel);
        }
Beispiel #8
0
        public int GetUsingEquipAllAppendPropLeva()
        {
            int nAllAppendPropLeva = 0;

            foreach (GoodsData goodsdata in this.WeaponStrongList)
            {
                if (goodsdata != null && goodsdata.Using > 0)
                {
                    nAllAppendPropLeva += goodsdata.AppendPropLev;
                }
            }
            foreach (GoodsData goodsdata in this.EquipList)
            {
                if (goodsdata != null && goodsdata.Using > 0)
                {
                    int nCategories = Global.GetGoodsCatetoriy(goodsdata.GoodsID);
                    if (nCategories != 9 && nCategories != 10 && !GoodsUtil.GetGoodsTypeInfo(nCategories).FashionGoods&& nCategories != 8)
                    {
                        nAllAppendPropLeva += goodsdata.AppendPropLev;
                    }
                }
            }
            return(nAllAppendPropLeva);
        }
        public bool ProcessJingLingYuanSuJueXingUpgradeCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
        {
            try
            {
                if (!CheckHelper.CheckCmdLengthAndRole(client, nID, cmdParams, 4))
                {
                    return(false);
                }
                int result      = 0;
                int yuanSuType  = Convert.ToInt32(cmdParams[1]);
                int shuXingType = Convert.ToInt32(cmdParams[2]);
                int useShenYou  = Convert.ToInt32(cmdParams[3]);
                int newID       = 0;
                JingLingYuanSuJueXingData jueXingData = client.ClientData.JingLingYuanSuJueXingData;
                if (jueXingData == null || jueXingData.ActiveIDs == null)
                {
                    jueXingData           = new JingLingYuanSuJueXingData();
                    jueXingData.ActiveIDs = new int[6];
                }
                int idx = (yuanSuType - 1) * 2 + shuXingType - 1;
                if (idx < 0 || idx >= jueXingData.ActiveIDs.Length)
                {
                    result = -18;
                }
                else
                {
                    int currentLevel = 0;
                    int currentID    = jueXingData.ActiveIDs[idx];
                    JingLingYuanSuInfo currentLevelInfo = null;
                    JingLingYuanSuInfo nextLevelInfo    = null;
                    JingLingYuanSuInfo preLevelInfo     = null;
                    lock (this.RuntimeData.Mutex)
                    {
                        if (currentID > 0)
                        {
                            if (this.RuntimeData.YuanSuInfoDict.Value.TryGetValue(currentID, out currentLevelInfo))
                            {
                                if (currentLevelInfo.YuanSuType != yuanSuType || currentLevelInfo.ShuXingType != shuXingType)
                                {
                                    result = -3;
                                    goto IL_4AB;
                                }
                                currentLevel = currentLevelInfo.QiangHuaLevel;
                            }
                        }
                        int nextLevel = currentLevel + 1;
                        int preLevel  = currentLevel - 1;
                        foreach (JingLingYuanSuInfo info in this.RuntimeData.YuanSuInfoDict.Value.Values)
                        {
                            if (info.YuanSuType == yuanSuType && info.ShuXingType == shuXingType)
                            {
                                if (info.QiangHuaLevel == currentLevel)
                                {
                                    currentLevelInfo = info;
                                }
                                else if (info.QiangHuaLevel == nextLevel)
                                {
                                    nextLevelInfo = info;
                                }
                                else if (info.QiangHuaLevel == preLevel)
                                {
                                    preLevelInfo = info;
                                }
                            }
                        }
                    }
                    if (currentLevelInfo == null)
                    {
                        result = -3;
                    }
                    else
                    {
                        newID = currentLevelInfo.ID;
                        if (nextLevelInfo == null)
                        {
                            result = -23;
                        }
                        else if (client.ClientData.MoneyData[144] < (long)currentLevelInfo.JieXingCurrency)
                        {
                            result = -47;
                        }
                        else if (!GoodsUtil.CheckHasGoodsList(client, currentLevelInfo.NeedGoods, false))
                        {
                            result = -6;
                        }
                        else
                        {
                            if (useShenYou > 0)
                            {
                                if (!GoodsUtil.CheckHasGoodsList(client, currentLevelInfo.Failtofail, false))
                                {
                                    result = -6;
                                    goto IL_4AB;
                                }
                            }
                            if (!GameManager.ClientMgr.ModifyYuanSuJueXingShiValue(client, -currentLevelInfo.JieXingCurrency, "精灵元素觉醒", true, true, false))
                            {
                                result = -47;
                            }
                            else
                            {
                                string strCostList = "";
                                if (!GoodsUtil.CostGoodsList(client, currentLevelInfo.NeedGoods, false, ref strCostList, "精灵元素觉醒"))
                                {
                                }
                                if (useShenYou > 0)
                                {
                                    if (!GoodsUtil.CostGoodsList(client, currentLevelInfo.Failtofail, false, ref strCostList, "精灵元素觉醒"))
                                    {
                                    }
                                }
                                bool   upLevel = false;
                                double rnd     = Global.GetRandom();
                                if (rnd <= currentLevelInfo.Success)
                                {
                                    upLevel = true;
                                }
                                int newLevel;
                                if (upLevel)
                                {
                                    newID    = nextLevelInfo.ID;
                                    newLevel = nextLevelInfo.QiangHuaLevel;
                                    jueXingData.ActiveIDs[idx] = newID;
                                }
                                else
                                {
                                    if (useShenYou > 0 || null == preLevelInfo)
                                    {
                                        result = 6;
                                        goto IL_4AB;
                                    }
                                    newID    = preLevelInfo.ID;
                                    newLevel = preLevelInfo.QiangHuaLevel;
                                    jueXingData.ActiveIDs[idx] = newID;
                                }
                                if (jueXingData.ActiveType == yuanSuType)
                                {
                                    JingLingYuanSuJueXingManager.getInstance().RefreshProps(client, false);
                                    client.delayExecModule.SetDelayExecProc(new DelayExecProcIds[]
                                    {
                                        DelayExecProcIds.NotifyRefreshProps
                                    });
                                }
                                EventLogManager.AddRoleEvent(client, OpTypes.Upgrade, OpTags.Trace, LogRecordType.JingLingYuanSuJueXing, new object[]
                                {
                                    currentID,
                                    currentLevel,
                                    newID,
                                    newLevel,
                                    currentLevelInfo.JieXingCurrency,
                                    useShenYou,
                                    strCostList
                                });
                                result = Global.sendToDB <int, RoleDataCmdT <JingLingYuanSuJueXingData> >(1452, new RoleDataCmdT <JingLingYuanSuJueXingData>(client.ClientData.RoleID, jueXingData), client.ServerId);
                            }
                        }
                    }
                }
IL_4AB:
                client.sendCmd(nID, string.Format("{0}:{1}:{2}", result, newID, useShenYou), false);
                return(true);
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("JingLingYuanSuJueXing :: 激活觉醒石错误。rid:{0}, ex:{1}", client.ClientData.RoleID, ex.Message), null, true);
            }
            return(false);
        }
Beispiel #10
0
 public static void LoadConfig()
 {
     try
     {
         double[] args0 = GameManager.systemParamsList.GetParamValueDoubleArrayByName("ZhanDouLiAlertLog", ',');
         if (args0 != null && args0.Length == 2 && args0[0] >= 100000.0 && args0[1] >= 0.1)
         {
             Data.CombatForceLogMinValue = (long)args0[0];
             Data.CombatForceLogPercent  = args0[1];
         }
         Data.LoadUseridWhiteList();
         Data.LoadSystemParamsValues();
         Data.SettingsDict.Load(Global.GameResPath("Config/Settings.xml"), "Maps");
         int iWithRname = (int)GameManager.systemParamsList.GetParamValueIntByName("LogWithRname", -1);
         Global.WithRname             = (iWithRname == 1);
         Data.ZhuTiID                 = GameManager.GameConfigMgr.GetGameConfigItemInt("zhuti", 0);
         Data.FightStateTime          = (long)((int)GameManager.systemParamsList.GetParamValueIntByName("FightStateTime", 6000));
         Data.CheckTimeBoost          = (GameManager.systemParamsList.GetParamValueIntByName("CheckTimeBoost", 1) > 0L);
         Data.CheckPositionCheat      = ((GameManager.systemParamsList.GetParamValueIntByName("CheckPositionCheat", 1) & 1L) != 0L);
         Data.CheckPositionCheatSpeed = ((GameManager.systemParamsList.GetParamValueIntByName("CheckPositionCheat", 1) & 2L) != 0L);
         Data.IgnoreClientPos         = ((GameManager.systemParamsList.GetParamValueIntByName("CheckPositionCheat", 1) & 4L) != 0L);
         LogManager.DisableLogTypes(GameManager.systemParamsList.GetParamValueIntArrayByName("DisableLogTypes", ','));
         Data.SyncTimeByClient           = GameManager.systemParamsList.GetParamValueIntByName("SyncTimeByClient", 750);
         Data.MaxServerClientTimeDiff    = GameManager.systemParamsList.GetParamValueIntByName("MaxServerClientTimeDiff", 300);
         Data.RoleOccupationMaxCount     = (int)GameManager.systemParamsList.GetParamValueIntByName("PurchaseOccupationNum", 1);
         Data.OpChangeLifeCount          = (int)GameManager.systemParamsList.GetParamValueIntByName("OpChangeLifeCount", 100);
         Data.NotifyLiXianAwardMin       = (int)GameManager.systemParamsList.GetParamValueIntByName("OfflineRW_Auto", 1440);
         Data.OfflineRW_ItemLimit        = (int)GameManager.systemParamsList.GetParamValueIntByName("OfflineRW_ItemLimit", 30);
         Data.OpenData.paimaihangjinbi   = (int)GameManager.systemParamsList.GetParamValueIntByName("paimaihangjinbi", 1);
         Data.OpenData.paimaihangzuanshi = (int)GameManager.systemParamsList.GetParamValueIntByName("paimaihangzuanshi", 1);
         Data.OpenData.paimaihangmobi    = (int)GameManager.systemParamsList.GetParamValueIntByName("paimaihangmobi", 0);
         Data.OpenData.bangzuan          = (int)GameManager.systemParamsList.GetParamValueIntByName("bangzuan", 1);
         Data.OpenData.zuanshi           = (int)GameManager.systemParamsList.GetParamValueIntByName("zuanshi", 1);
         Data.OpenData.mobi = (int)GameManager.systemParamsList.GetParamValueIntByName("mobi", 0);
         Data.OpenData.paimaijiemianmobi = (int)GameManager.systemParamsList.GetParamValueIntByName("paimaijiemianmobi", 0);
         Data.LuoLanKingGongGaoCD        = (long)((int)GameManager.systemParamsList.GetParamValueIntByName("LuoLanKingGongGaoCD", 120));
         int           plat = (int)GameCoreInterface.getinstance().GetPlatformType();
         List <string> p0   = GameManager.systemParamsList.GetParamValueStringListByName("LogLifeRecoverOpen", '|');
         if (p0 != null)
         {
             ClientCmdCheck.MinLogAddLifeV       = 2147483647L;
             ClientCmdCheck.MinLogAddLifePercent = 100L;
             ClientCmdCheck.MapCodes.Clear();
             foreach (string p in p0)
             {
                 int[] p2 = Global.String2IntArray(p, ',');
                 lock (ClientCmdCheck.MapCodes)
                 {
                     if (p2[0] == plat && p2[1] > 0)
                     {
                         double[] p3 = GameManager.systemParamsList.GetParamValueDoubleArrayByName("LogLifeRecoverNum", ',');
                         int[]    p4 = GameManager.systemParamsList.GetParamValueIntArrayByName("LogLifeRecoverMap", ',');
                         if (p3 != null && p3.Length >= 2)
                         {
                             ClientCmdCheck.MinLogAddLifeV       = (long)((int)Math.Max(p3[0], 10000.0));
                             ClientCmdCheck.MinLogAddLifePercent = (long)((int)Math.Max(p3[1] * 100.0, 16.0));
                         }
                         if (p4 != null && p4.Length >= 1)
                         {
                             foreach (int mapCode in p4)
                             {
                                 ClientCmdCheck.MapCodes.Add(mapCode);
                             }
                         }
                         break;
                     }
                 }
             }
         }
         Data.LoadEquipDelay = (GameManager.systemParamsList.GetParamValueIntByName("LoadEquipDelay", 1) != 0L);
         Data.LoadExtPropThreshold();
         GoodsUtil.LoadConfig();
         Data.LoadChannelNameConfig();
         Data.LoadKuaFuWorldCmds();
         Data.LoadLianZhanConfig();
         Data.LoadMapOptimizeFlags();
     }
     catch (Exception ex)
     {
         LogManager.WriteException(ex.ToString());
     }
     GameManager.OnceDestroyCopyMapNum = (int)GameManager.systemParamsList.GetParamValueIntByName("OnceDestroyCopyMapNum", 100);
 }
Beispiel #11
0
        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);
        }
Beispiel #12
0
        public static GoodsTypeInfo GetGoodsTypeInfoByGoodsId(int goodsId)
        {
            int type = Global.GetGoodsCatetoriy(goodsId);

            return(GoodsUtil.GetGoodsTypeInfo(type));
        }
Beispiel #13
0
 public static long GetLastGiveMeditateTime(GameClient client)
 {
     return((long)(GoodsUtil.GetMeditateBagGoodsCnt(client) * Global.GetMingXiangGoodsInterval(client)));
 }
Beispiel #14
0
        private bool ProcessBianShenStarUpCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
        {
            int result = 0;
            BianShenUpdateResultData resultData   = new BianShenUpdateResultData();
            RoleBianShenData         BianShenData = client.ClientData.BianShenData;
            BianShenUpdateResultData requestData  = DataHelper.BytesToObject <BianShenUpdateResultData>(bytes, 0, bytes.Length);
            int  type     = requestData.Type;
            int  zuanshi  = requestData.ZuanShi;
            int  auto     = requestData.Auto;
            long nowTicks = TimeUtil.NOW();

            if (!this.IsGongNengOpened(client))
            {
                result = -400;
            }
            else
            {
                string strCostList = "";
                lock (this.RuntimeData.Mutex)
                {
                    List <BianShenStarInfo> list;
                    if (BianShenData.BianShen != requestData.BianShen)
                    {
                        result = -18;
                    }
                    else if (!this.RuntimeData.BianShenUpDict.TryGetValue(client.ClientData.Occupation, out list))
                    {
                        result = -400;
                    }
                    else if (BianShenData.BianShen >= list.Count - 1)
                    {
                        result = -23;
                    }
                    else
                    {
                        BianShenStarInfo starInfo  = list[BianShenData.BianShen];
                        BianShenStarInfo starInfo2 = list[BianShenData.BianShen + 1];
                        if (starInfo == null || starInfo2 == null)
                        {
                            result = -3;
                        }
                        else if (!GoodsUtil.CostGoodsList(client, starInfo.NeedGoods, false, ref strCostList, "变身升级"))
                        {
                            result = -6;
                        }
                        else
                        {
                            int exp = starInfo.GoodsExp;
                            if (Global.GetRandom() < starInfo.ExpCritRate)
                            {
                                exp = (int)((double)exp * starInfo.ExpCritTimes);
                            }
                            BianShenData.Exp += exp;
                            if (BianShenData.Exp >= starInfo.UpExp)
                            {
                                BianShenData.BianShen++;
                                BianShenData.Exp -= starInfo.UpExp;
                            }
                            Global.SendToDB <RoleDataCmdT <RoleBianShenData> >(1449, new RoleDataCmdT <RoleBianShenData>(client.ClientData.RoleID, BianShenData), client.ServerId);
                            if (BianShenData.BianShen > requestData.BianShen)
                            {
                                client.ClientData.PropsCacheManager.SetExtProps(new object[]
                                {
                                    PropsSystemTypes.BianShen,
                                    starInfo2.ExtPropValues
                                });
                                client.delayExecModule.SetDelayExecProc(new DelayExecProcIds[]
                                {
                                    DelayExecProcIds.RecalcProps,
                                    DelayExecProcIds.NotifyRefreshProps
                                });
                                EventLogManager.AddBianShenEvent(client, type, (zuanshi > 0) ? 1 : 0, exp, starInfo.Level, starInfo2.Level, BianShenData.Exp, strCostList);
                            }
                            else
                            {
                                EventLogManager.AddBianShenEvent(client, type, (zuanshi > 0) ? 1 : 0, exp, starInfo.Level, starInfo.Level, BianShenData.Exp, strCostList);
                            }
                        }
                    }
                }
            }
            resultData.Result   = result;
            resultData.BianShen = BianShenData.BianShen;
            resultData.Exp      = BianShenData.Exp;
            resultData.Auto     = auto;
            resultData.Type     = type;
            client.sendCmd <BianShenUpdateResultData>(nID, resultData, false);
            return(true);
        }
Beispiel #15
0
 public void GiveAwards(WanMoXiaGuScene scene)
 {
     try
     {
         FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID);
         if (fuBenMapItem != null)
         {
             int usedSecs = (int)(scene.EndTime - scene.BeginTime);
             int zhanLi   = 0;
             List <GameClient> objsList = scene.CopyMapInfo.GetClientsList().Distinct <GameClient>().ToList <GameClient>();
             if (objsList != null && objsList.Count > 0)
             {
                 for (int i = 0; i < objsList.Count; i++)
                 {
                     GameClient client = objsList[i];
                     if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID))
                     {
                         zhanLi += client.ClientData.CombatForce;
                         long nExp  = (long)fuBenMapItem.Experience;
                         int  money = fuBenMapItem.Money1;
                         int  idx   = this.RuntimeData.AwardList.Count - 1;
                         int  mul   = this.RuntimeData.AwardList[idx][1];
                         for (int j = 0; j <= idx; j++)
                         {
                             if (usedSecs <= this.RuntimeData.AwardList[j][0])
                             {
                                 mul = this.RuntimeData.AwardList[j][1];
                                 break;
                             }
                         }
                         if (nExp > 0L)
                         {
                             GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false, true, false, "万魔峡谷通关奖励");
                         }
                         if (money > 0)
                         {
                             GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, "万魔峡谷通关奖励", true);
                         }
                         List <GoodsData> goodsList = new List <GoodsData>();
                         if (null != fuBenMapItem.GoodsDataList)
                         {
                             for (int k = 0; k < fuBenMapItem.GoodsDataList.Count; k++)
                             {
                                 GoodsData goodsData = new GoodsData(fuBenMapItem.GoodsDataList[k]);
                                 goodsData.GCount *= mul;
                                 goodsList.Add(goodsData);
                             }
                         }
                         if (goodsList.Count > 0)
                         {
                             if (Global.CanAddGoodsDataList(client, goodsList))
                             {
                                 foreach (GoodsData goodsData in goodsList)
                                 {
                                     GoodsUtil.AddGoodsDBCommand(client, goodsData, true, 1, "万魔峡谷通关奖励", true);
                                 }
                             }
                             else
                             {
                                 Global.UseMailGivePlayerAward2(client, goodsList, GLang.GetLang(4000, new object[0]), GLang.GetLang(4001, new object[0]), 0, 0, 0);
                             }
                         }
                         WanMoXiaGuAwardsData awardsData = new WanMoXiaGuAwardsData
                         {
                             Success     = scene.Success,
                             UsedSecs    = usedSecs,
                             Exp         = nExp,
                             Money       = money,
                             AwardsGoods = goodsList
                         };
                         client.sendCmd <WanMoXiaGuAwardsData>(1267, awardsData, false);
                         Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1);
                     }
                 }
             }
             if (objsList != null && objsList.Count > 0)
             {
                 int roleCount = objsList.Count;
                 zhanLi /= roleCount;
             }
         }
     }
     catch (Exception ex)
     {
         DataHelper.WriteExceptionLogEx(ex, "【万魔峡谷】清场调度异常");
     }
 }
Beispiel #16
0
        private bool ProcessExecuteBianShenCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
        {
            int  result   = 0;
            long nowTicks = TimeUtil.NOW();

            if (!this.CanBianShenByMap(client))
            {
                result = -21;
            }
            else if (client.ClientData.IsDongJie())
            {
                result = -500;
            }
            else
            {
                ExtData extData = ExtDataManager.GetClientExtData(client);
                if (nowTicks < extData.BianShenCDTicks)
                {
                    result = -2007;
                }
                else if (!this.IsGongNengOpened(client) || client.ClientData.HideGM > 0)
                {
                    result = -12;
                }
                else
                {
                    ZuoQiManager.getInstance().RoleDisMount(client, true);
                    long             cdTime       = (long)(this.RuntimeData.BianShenCDSecs * 1000);
                    int              durationTime = 0;
                    int              skillLevel   = 1;
                    double[]         props        = null;
                    List <int>       skillIDList  = null;
                    BianShenStarInfo starInfo;
                    lock (this.RuntimeData.Mutex)
                    {
                        if (!this.RuntimeData.BianShenStarDict.Value.TryGetValue(client.ClientData.BianShenData.BianShen, out starInfo))
                        {
                            result = -20;
                            goto IL_4E7;
                        }
                        skillLevel = starInfo.Level;
                    }
                    string strCostList = "";
                    long   dayAndCount = client.ClientData.MoneyData[147];
                    int    dayid       = (int)(dayAndCount / 10000L);
                    int    dayCount    = (int)(dayAndCount % 10000L);
                    if (dayid != TimeUtil.GetOffsetDayNow())
                    {
                        dayCount = 0;
                        dayid    = TimeUtil.GetOffsetDayNow();
                    }
                    if (dayCount < this.RuntimeData.FreeNum)
                    {
                        dayCount++;
                        dayAndCount = (long)(dayid * 10000 + dayCount);
                        client.ClientData.MoneyData[147] = dayAndCount;
                        Global.SaveRoleParamsInt64ValueToDB(client, "10216", dayAndCount, true);
                        GameManager.ClientMgr.NotifySelfPropertyValue(client, 147, dayAndCount);
                    }
                    else if (!GoodsUtil.CostGoodsList(client, this.RuntimeData.NeedGoods, false, ref strCostList, "变身"))
                    {
                        result = -6;
                        goto IL_4E7;
                    }
                    int       damageType = OccupationUtil.GetOccuDamageType(client.ClientData.OccupationIndex);
                    GoodsData goodsData  = client.UsingEquipMgr.GetGoodsDataByCategoriy(client, 28);
                    if (null != goodsData)
                    {
                        FashionBagData fashionBagData = FashionManager.getInstance().GetFashionBagData(client, goodsData);
                        if (fashionBagData != null && fashionBagData.FasionTab == 7)
                        {
                            if (damageType == 1)
                            {
                                skillIDList = fashionBagData.MagicSkill;
                            }
                            else
                            {
                                skillIDList = fashionBagData.AttackSkill;
                            }
                            durationTime = fashionBagData.BianShenDuration;
                            if (fashionBagData.BianShenEffect > 0)
                            {
                                lock (this.RuntimeData.Mutex)
                                {
                                    FashionEffectInfo info;
                                    if (this.RuntimeData.FashionEffectInfoDict.Value.TryGetValue(fashionBagData.BianShenEffect, out info))
                                    {
                                        props = info.ExtPropValues;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        durationTime = starInfo.Duration;
                        if (damageType == 1)
                        {
                            skillIDList = starInfo.MagicSkill;
                        }
                        else
                        {
                            skillIDList = starInfo.AttackSkill;
                        }
                    }
                    if (null != skillIDList)
                    {
                        lock (client.ClientData.SkillDataList)
                        {
                            using (List <int> .Enumerator enumerator = skillIDList.GetEnumerator())
                            {
                                while (enumerator.MoveNext())
                                {
                                    int       skillID     = enumerator.Current;
                                    SkillData mySkillData = client.ClientData.SkillDataList.Find((SkillData x) => x.SkillID == skillID);
                                    if (null == mySkillData)
                                    {
                                        SkillData skillData = new SkillData();
                                        skillData.SkillID    = skillID;
                                        skillData.SkillLevel = skillLevel;
                                        client.ClientData.SkillDataList.Add(skillData);
                                    }
                                    else if (mySkillData.SkillLevel != skillLevel)
                                    {
                                        mySkillData.SkillLevel = skillLevel;
                                    }
                                }
                            }
                        }
                    }
                    extData.skillIDList     = skillIDList;
                    extData.BianShenCDTicks = nowTicks + cdTime + (long)(durationTime * 1000);
                    extData.BianShenCdTime  = cdTime;
                    extData.BianShenToTicks = nowTicks + (long)(durationTime * 1000);
                    client.buffManager.SetStatusBuff(121, nowTicks, (long)(durationTime * 1000), 0L);
                    this.OnBianShenStateChange(client, true, client.ClientData.BianShenData.BianShen, durationTime, props);
                    GameManager.ClientMgr.NotifySkillCDTime(client, -1, extData.BianShenCDTicks, false);
                }
            }
IL_4E7:
            client.sendCmd <int>(nID, result, false);
            return(true);
        }
Beispiel #17
0
 public static void LoadConfig()
 {
     GoodsUtil.LoadGetGoodsXml();
     int[] list  = GameManager.systemParamsList.GetParamValueIntArrayByName("HorseEquipBarOpen", ',');
     int[] list2 = GameManager.systemParamsList.GetParamValueIntArrayByName("HorseEquipMeltingOpen", ',');
     lock (GoodsUtil.GoodsTypeInfoDict)
     {
         for (int i = 40; i <= 45; i++)
         {
             GoodsTypeInfo typeInfo;
             if (GoodsUtil.GoodsTypeInfoDict.TryGetValue(i, out typeInfo))
             {
                 typeInfo.Categriory = 40;
                 typeInfo.GoodsType  = 2;
                 int idx = i - 40;
                 if (list != null && idx < list.Length && list[idx] == 1)
                 {
                     typeInfo.IsEquip = true;
                 }
                 for (int j = 0; j < 15; j++)
                 {
                     if (list2 != null && j < list2.Length && list2[j] == 1)
                     {
                         typeInfo.Operations[j] = true;
                         if (j == 10)
                         {
                             typeInfo.OperationsTypeList[j] = new List <int>();
                             for (int k = 40; k <= 45; k++)
                             {
                                 typeInfo.OperationsTypeList[j].Add(k);
                             }
                         }
                         else
                         {
                             typeInfo.OperationsTypeList[j] = new List <int>
                             {
                                 i
                             };
                         }
                     }
                 }
             }
         }
         for (int i = 11; i <= 21; i++)
         {
             GoodsTypeInfo typeInfo;
             if (GoodsUtil.GoodsTypeInfoDict.TryGetValue(i, out typeInfo))
             {
                 typeInfo.Categriory = i;
                 typeInfo.GoodsType  = 1;
                 typeInfo.IsEquip    = true;
                 for (int j = 0; j < 15; j++)
                 {
                     typeInfo.Operations[j]         = true;
                     typeInfo.OperationsTypeList[j] = new List <int>();
                     for (int k = 11; k <= 21; k++)
                     {
                         typeInfo.OperationsTypeList[j].Add(k);
                     }
                     if (j == 10)
                     {
                         for (int k = 0; k <= 6; k++)
                         {
                             typeInfo.OperationsTypeList[j].Add(k);
                         }
                     }
                 }
             }
         }
         for (int i = 0; i <= 6; i++)
         {
             GoodsTypeInfo typeInfo;
             if (GoodsUtil.GoodsTypeInfoDict.TryGetValue(i, out typeInfo))
             {
                 typeInfo.Categriory = i;
                 typeInfo.GoodsType  = 1;
                 typeInfo.IsEquip    = true;
                 for (int j = 0; j < 15; j++)
                 {
                     typeInfo.Operations[j] = true;
                     if (j == 10)
                     {
                         typeInfo.OperationsTypeList[j] = new List <int>();
                         for (int k = 0; k <= 6; k++)
                         {
                             typeInfo.OperationsTypeList[j].Add(k);
                         }
                         for (int k = 11; k <= 21; k++)
                         {
                             typeInfo.OperationsTypeList[j].Add(k);
                         }
                     }
                     else
                     {
                         typeInfo.OperationsTypeList[j] = new List <int>
                         {
                             i
                         };
                     }
                 }
             }
         }
         for (int i = 37; i <= 38; i++)
         {
             GoodsTypeInfo typeInfo;
             if (GoodsUtil.GoodsTypeInfoDict.TryGetValue(i, out typeInfo))
             {
                 typeInfo.Categriory = i;
                 typeInfo.GoodsType  = 1;
                 typeInfo.IsEquip    = true;
                 for (int j = 0; j < 15; j++)
                 {
                     typeInfo.Operations[j]         = true;
                     typeInfo.OperationsTypeList[j] = new List <int>();
                     for (int k = 37; k <= 38; k++)
                     {
                         typeInfo.OperationsTypeList[j].Add(k);
                     }
                 }
             }
         }
         for (int i = 30; i <= 36; i++)
         {
             GoodsTypeInfo typeInfo;
             if (GoodsUtil.GoodsTypeInfoDict.TryGetValue(i, out typeInfo))
             {
                 typeInfo.Categriory = i;
                 typeInfo.GoodsType  = 1;
                 typeInfo.IsEquip    = true;
                 for (int j = 100; j < 101; j++)
                 {
                     typeInfo.Operations[j] = true;
                 }
             }
         }
     }
 }