コード例 #1
0
        /// <summary>
        /// 发放活动奖励
        /// </summary>
        private void GiveLangHunLingYuAwards(LangHunLingYuScene scene)
        {
            LangHunLingYuAwardsData successAwardsData = new LangHunLingYuAwardsData();
            LangHunLingYuAwardsData faildAwardsData   = new LangHunLingYuAwardsData();

            successAwardsData.Success            = 1;
            successAwardsData.AwardsItemDataList = scene.LevelInfo.Award.Items;
            foreach (var copyMap in scene.CopyMapDict.Values)
            {
                List <GameClient> objList = copyMap.GetClientsList();
                foreach (var client in objList)
                {
                    LangHunLingYuAwardsData awardsData = client.ClientData.Faction == scene.LongTaOwnerData.OwnerBHid ? successAwardsData : faildAwardsData;
                    if (awardsData.AwardsItemDataList != null)
                    {
                        // 判断背包空闲格子是否足够
                        if (Global.CanAddGoodsNum(client, awardsData.AwardsItemDataList.Count))
                        {
                            foreach (var item in awardsData.AwardsItemDataList)
                            {
                                Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, item.GoodsID, item.GoodsNum, 0, "", item.Level, item.Binding, 0,
                                                         "", true, 1, /**/ "圣域争霸胜利奖励", Global.ConstGoodsEndTime, 0, 0, item.IsHaveLuckyProp, 0, item.ExcellencePorpValue, item.AppendLev);
                            }
                        }
                        else
                        {
                            Global.UseMailGivePlayerAward2(client, awardsData.AwardsItemDataList, Global.GetLang("圣域争霸胜利奖励"), Global.GetLang("圣域争霸胜利奖励"));
                        }

                        EventLogManager.AddRoleEvent(client, OpTypes.GiveAwards, OpTags.LangHunLingYu, LogRecordType.IntValue2, client.ClientData.Faction, awardsData.Success);
                    }

                    client.sendCmd((int)TCPGameServerCmds.CMD_SPR_LANGHUNLINGYU_AWARD, awardsData);
                }
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: QingGongYanManager.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 参加庆功宴
        /// </summary>
        public QingGongYanResult JoinQingGongYan(GameClient client)
        {
            if (null == QingGongYanNpc)
            {
                return(QingGongYanResult.OutTime);
            }

            QingGongYanInfo InfoData = GetInfoData();

            if (null == InfoData)
            {
                return(QingGongYanResult.OutTime);
            }

            int JoinCount = GameManager.GameConfigMgr.GetGameConfigItemInt(GameConfigNames.QGYJoinCount, 0);

            if (JoinCount > 0)
            {
                if (JoinCount >= InfoData.TotalNum)
                {
                    return(QingGongYanResult.TotalNotEnough);
                }
            }

            // 检查参加所需金币是否足够
            if (InfoData.JoinBindJinBi > 0)
            {
                if (InfoData.JoinBindJinBi > Global.GetTotalBindTongQianAndTongQianVal(client))
                {
                    return(QingGongYanResult.MoneyNotEnough);
                }
            }

            String QingGongYanJoinFlag = Global.GetRoleParamByName(client, RoleParamName.QingGongYanJoinFlag);
            int    currDay             = Global.GetOffsetDay(TimeUtil.NowDateTime());
            int    lastJoinDay         = 0;
            int    joinCount           = 0;

            // day:count
            if (null != QingGongYanJoinFlag)
            {
                string[] fields = QingGongYanJoinFlag.Split(',');
                if (2 == fields.Length)
                {
                    lastJoinDay = Convert.ToInt32(fields[0]);
                    joinCount   = Convert.ToInt32(fields[1]);
                }
            }

            if (currDay != lastJoinDay)
            {
                joinCount = 0;
            }


            if (InfoData.SingleNum > 0)
            {
                if (joinCount >= InfoData.SingleNum)
                {
                    return(QingGongYanResult.CountNotEnough);
                }
            }

            // 扣除参加所需金币
            if (InfoData.JoinBindJinBi > 0)
            {
                if (!Global.SubBindTongQianAndTongQian(client, InfoData.JoinBindJinBi, "参加庆功宴"))
                {
                    return(QingGongYanResult.MoneyNotEnough);
                }
            }

            // 玩家计数
            string roleParam = currDay.ToString() + "," + (joinCount + 1).ToString();

            Global.UpdateRoleParamByName(client, RoleParamName.QingGongYanJoinFlag, roleParam, true);

            // 参加全局计数叠加
            // 由于这里是异步操作,数量可能会少
            Global.UpdateDBGameConfigg(GameConfigNames.QGYJoinCount, (JoinCount + 1).ToString());
            GameManager.GameConfigMgr.SetGameConfigItem(GameConfigNames.QGYJoinCount, (JoinCount + 1).ToString());
            // 记录缴纳的
            int JoinMoney = GameManager.GameConfigMgr.GetGameConfigItemInt(GameConfigNames.QGYJoinMoney, 0);

            Global.UpdateDBGameConfigg(GameConfigNames.QGYJoinMoney, (JoinMoney + InfoData.JoinBindJinBi).ToString());
            GameManager.GameConfigMgr.SetGameConfigItem(GameConfigNames.QGYJoinMoney, (JoinMoney + InfoData.JoinBindJinBi).ToString());

            // 发奖
            if (InfoData.ExpAward > 0)
            {
                GameManager.ClientMgr.ProcessRoleExperience(client, InfoData.ExpAward);
            }

            if (InfoData.XingHunAward > 0)
            {
                GameManager.ClientMgr.ModifyStarSoulValue(client, InfoData.XingHunAward, "庆功宴", true, true);
            }

            if (InfoData.ZhanGongAward > 0)
            {
                int nZhanGong = InfoData.ZhanGongAward;
                if (GameManager.ClientMgr.AddBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ref nZhanGong, AddBangGongTypes.BG_QGY))
                {
                    //[bing] 记录战功增加流向log
                    if (0 != nZhanGong)
                    {
                        GameManager.logDBCmdMgr.AddDBLogInfo(-1, "战功", "罗兰宴会领取", "系统", client.ClientData.RoleName, "增加", nZhanGong, client.ClientData.ZoneID, client.strUserID, client.ClientData.BangGong, client.ServerId);
                    }
                }
                GameManager.SystemServerEvents.AddEvent(string.Format("角色获取帮贡, roleID={0}({1}), BangGong={2}, newBangGong={3}", client.ClientData.RoleID, client.ClientData.RoleName, client.ClientData.BangGong, nZhanGong), EventLevels.Record);
            }

            // log it
            GameManager.logDBCmdMgr.AddDBLogInfo(-1, "参加庆功宴", "", "", client.ClientData.RoleName, "", 1, client.ClientData.ZoneID, client.strUserID, -1, client.ServerId);
            EventLogManager.AddRoleEvent(client, OpTypes.Join, OpTags.QingGongYan, LogRecordType.OffsetDayId, currDay);

            return(QingGongYanResult.Success);
        }
コード例 #4
0
ファイル: QingGongYanManager.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 举办庆功宴
        /// </summary>
        public QingGongYanResult HoldQingGongYan(GameClient client, int index, int onlyCheck = 0)
        {
            // 是不是王城占领者
            if (!Global.IsKingCityLeader(client))
            {
                return(QingGongYanResult.NotKing);
            }

            QingGongYanInfo InfoData = GetQingGongYanConfig(index);

            if (null == InfoData)
            {
                return(QingGongYanResult.ErrorParam);
            }

            /// 此时是否能够开启庆功宴
            if (InfoData.IfBanTime(TimeUtil.NowDateTime()))
            {
                return(QingGongYanResult.OutTime);
            }

            int DBStartDay = GameManager.GameConfigMgr.GetGameConfigItemInt(GameConfigNames.QGYStartDay, 0);
            int currDay    = Global.GetOffsetDay(TimeUtil.NowDateTime());

            //  如果今天有庆功宴 并且庆功宴结束时间还没到 提示已经申请
            if (DBStartDay == currDay && TimeUtil.NowDateTime() <= DateTime.Parse(InfoData.OverTime))
            {
                return(QingGongYanResult.RepeatHold);
            }

            // 计算申请之后,庆功宴的举办时间
            int startDay = 0;

            // 在庆功宴开始时间之前,就在今天开启
            if (TimeUtil.NowDateTime() < DateTime.Parse(InfoData.BeginTime))
            {
                startDay = currDay;
            }
            // 否则在明天开启
            else
            {
                startDay = currDay + 1;
            }

            // 如果计算出来的举办时间和数据库的举办时间相同,则返回已经申请
            if (startDay == DBStartDay)
            {
                return(QingGongYanResult.RepeatHold);
            }

            // 检查举办所需金币是否足够
            if (InfoData.HoldBindJinBi > 0)
            {
                if (InfoData.HoldBindJinBi > Global.GetTotalBindTongQianAndTongQianVal(client))
                {
                    return(QingGongYanResult.MoneyNotEnough);
                }
            }

            if (onlyCheck > 0)
            {
                return(QingGongYanResult.CheckSuccess);
            }

            // 扣除举办所需金币
            if (InfoData.HoldBindJinBi > 0)
            {
                if (!Global.SubBindTongQianAndTongQian(client, InfoData.HoldBindJinBi, "举办庆功宴"))
                {
                    return(QingGongYanResult.MoneyNotEnough);
                }
            }

            Global.UpdateDBGameConfigg(GameConfigNames.QGYRoleID, client.ClientData.RoleID.ToString());
            GameManager.GameConfigMgr.SetGameConfigItem(GameConfigNames.QGYRoleID, client.ClientData.RoleID.ToString());

            BangHuiMiniData bangHuiMiniData = Global.GetBangHuiMiniData(client.ClientData.Faction);

            if (null != bangHuiMiniData)
            {
                Global.UpdateDBGameConfigg(GameConfigNames.QGYGuildName, bangHuiMiniData.BHName);
                GameManager.GameConfigMgr.SetGameConfigItem(GameConfigNames.QGYGuildName, bangHuiMiniData.BHName);
            }
            else
            {
                Global.UpdateDBGameConfigg(GameConfigNames.QGYGuildName, "");
                GameManager.GameConfigMgr.SetGameConfigItem(GameConfigNames.QGYGuildName, "");
            }

            GameManager.GameConfigMgr.SetGameConfigItem(GameConfigNames.QGYGuildName, client.ClientData.RoleName);
            Global.UpdateDBGameConfigg(GameConfigNames.QGYStartDay, startDay.ToString());
            GameManager.GameConfigMgr.SetGameConfigItem(GameConfigNames.QGYStartDay, startDay.ToString());
            Global.UpdateDBGameConfigg(GameConfigNames.QGYGrade, index.ToString());
            GameManager.GameConfigMgr.SetGameConfigItem(GameConfigNames.QGYGrade, index.ToString());
            Global.UpdateDBGameConfigg(GameConfigNames.QGYJoinCount, "0");
            GameManager.GameConfigMgr.SetGameConfigItem(GameConfigNames.QGYJoinCount, "0");
            Global.UpdateDBGameConfigg(GameConfigNames.QGYJoinMoney, "0");
            GameManager.GameConfigMgr.SetGameConfigItem(GameConfigNames.QGYJoinMoney, "0");

            // 为了合服,要记录举办人花了多少金币
            Global.UpdateDBGameConfigg(GameConfigNames.QGYJuBanMoney, InfoData.HoldBindJinBi.ToString());
            GameManager.GameConfigMgr.SetGameConfigItem(GameConfigNames.QGYJuBanMoney, InfoData.HoldBindJinBi.ToString());

            // log it...
            GameManager.logDBCmdMgr.AddDBLogInfo(-1, "举办庆功宴", startDay.ToString(), "", client.ClientData.RoleName, "", index, client.ClientData.ZoneID, client.strUserID, -1, client.ServerId);
            EventLogManager.AddRoleEvent(client, OpTypes.Hold, OpTags.QingGongYan, LogRecordType.OffsetDayId, startDay);

            return(QingGongYanResult.Success);
        }
コード例 #5
0
ファイル: ArtifactManager.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 神器再造
        /// </summary>
        /// <param name="client"></param>
        /// <param name="equipID"></param>
        /// <returns></returns>
        public static ArtifactResultData UpArtifact(GameClient client, int equipID, bool isUseBind)
        {
            ArtifactResultData result = new ArtifactResultData();

            #region 检查
            //神器再造功能开放
            bool isOpen = GlobalNew.IsGongNengOpened(client, GongNengIDs.Artifact);
            if (!isOpen)
            {
                result.State = (int)ArtifactResultType.EnoOpen;
                return(result);
            }

            // 从背包中找装备
            GoodsData equipData = Global.GetGoodsByDbID(client, equipID);
            if (equipData == null)
            {
                result.State = (int)ArtifactResultType.EnoEquip;
                return(result);
            }

            //类型检测Categoriy=0-6、11-21的道具
            int  catetoriy      = Global.GetGoodsCatetoriy(equipData.GoodsID);
            bool isCanCatetoriy = (catetoriy >= 0 && catetoriy <= 6) || (catetoriy >= 11 && catetoriy <= 21);
            if (!isCanCatetoriy)
            {
                result.State = (int)ArtifactResultType.EcantUp;
                return(result);
            }

            //Suit=10
            SystemXmlItem systemGoods = null;
            if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(equipData.GoodsID, out systemGoods))
            {
                result.State = (int)ArtifactResultType.EnoEquip;
                return(result);
            }

            int nSuitID = systemGoods.GetIntValue("SuitID");
            if (nSuitID < ARTIFACT_SUIT)
            {
                result.State = (int)ArtifactResultType.EcantUp;
                return(result);
            }

            //神器基本数据
            ArtifactData artifactDataBasic = GetArtifactDataByNeedId(equipData.GoodsID);
            if (artifactDataBasic == null)
            {
                result.State = (int)ArtifactResultType.EcantUp;
                return(result);
            }

            //再造点
            bool enoughZaiZao = Global.IsRoleHasEnoughMoney(client, artifactDataBasic.NeedZaiZao, (int)MoneyTypes.ZaiZao) > 0;
            if (!enoughZaiZao)
            {
                result.State = (int)ArtifactResultType.EnoZaiZao;
                return(result);
            }

            //绑定金币
            int goldBind = Global.GetTotalBindTongQianAndTongQianVal(client);;
            if (artifactDataBasic.NeedGoldBind > goldBind)
            {
                result.State = (int)ArtifactResultType.EnoGold;
                return(result);
            }

            //材料——成功扣除
            foreach (var d in artifactDataBasic.NeedMaterial)
            {
                int materialId = d.Key;
                int count      = d.Value;

                int totalCount = Global.GetTotalGoodsCountByID(client, materialId);
                if (totalCount < count)
                {
                    result.State = (int)ArtifactResultType.EnoMaterial;
                    return(result);
                }
            }

            //材料——失败扣除
            foreach (var d in artifactDataBasic.FailMaterial)
            {
                int materialId = d.Key;
                int count      = d.Value;

                int totalCount = Global.GetTotalGoodsCountByID(client, materialId);
                if (totalCount < count)
                {
                    result.State = (int)ArtifactResultType.EnoMaterial;
                    return(result);
                }
            }

            //背包已满
            int freeBagIndex = Global.GetIdleSlotOfBagGoods(client);
            if (freeBagIndex < 0)
            {
                result.State = (int)ArtifactResultType.EnoBag;
                return(result);
            }
            #endregion

            #region 扣除

            //扣除绑定金币
            if (!Global.SubBindTongQianAndTongQian(client, artifactDataBasic.NeedGoldBind, "神器再造"))
            {
                result.State = (int)ArtifactResultType.EnoGold;
                return(result);
            }

            //几率
            //bool isSuccess = true;
            bool isSuccess = false;
            int  failCount = Global.GetRoleParamsInt32FromDB(client, RoleParamName.ArtifactFailCount); //失败次数
            int  failMax   = (int)GameManager.systemParamsList.GetParamValueIntByName("ZaiZaoBaoDi");
            if (failCount >= failMax)
            {
                isSuccess = true;
                failCount = 0;
                SetArtifactFailCount(client, failCount);
            }
            else
            {
                int rate = Global.GetRandomNumber(0, 100);
                if (rate < artifactDataBasic.SuccessRate)
                {
                    isSuccess = true;
                    failCount = 0;
                    SetArtifactFailCount(client, failCount);
                }
            }

            bool useBind      = false;
            bool useTimeLimit = false;
            //失败------------------------------------------------------------------------
            if (!isSuccess)
            {
                //扣除材料
                foreach (var d in artifactDataBasic.FailMaterial)
                {
                    int materialId = d.Key;
                    int count      = d.Value;

                    bool isOk = Global.UseGoodsBindOrNot(client, materialId, count, isUseBind, out useBind, out useTimeLimit) >= 1;
                    if (!isOk)
                    {
                        result.State = (int)ArtifactResultType.EnoMaterial;
                        return(result);
                    }
                }

                failCount++;
                Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.ArtifactFailCount, failCount, true);

                GameManager.logDBCmdMgr.AddDBLogInfo(artifactDataBasic.NewEquitID, artifactDataBasic.ArtifactName, "神器再造失败", client.ClientData.RoleName, client.ClientData.RoleName, "再造", 1, client.ClientData.ZoneID, client.strUserID, -1, client.ServerId, equipData);

                EventLogManager.AddRoleEvent(client, OpTypes.Trace, OpTags.ShenQiZaiZao, LogRecordType.ShenQiZaiZao, artifactDataBasic.NewEquitID, 0, failCount);

                result.State = (int)ArtifactResultType.Fail;
                return(result);
            }

            //成功------------------------------------------------------------------------
            //扣除材料
            foreach (var d in artifactDataBasic.NeedMaterial)
            {
                int materialId = d.Key;
                int count      = d.Value;

                bool oneUseBind      = false;
                bool oneUseTimeLimit = false;
                bool isOk            = Global.UseGoodsBindOrNot(client, materialId, count, isUseBind, out oneUseBind, out oneUseTimeLimit) >= 1;
                if (!isOk)
                {
                    result.State = (int)ArtifactResultType.EnoMaterial;
                    return(result);
                }

                useBind      = useBind || oneUseBind;
                useTimeLimit = useTimeLimit || oneUseTimeLimit;
            }

            //扣除再造点
            GameManager.ClientMgr.ModifyZaiZaoValue(client, -artifactDataBasic.NeedZaiZao, "神器再造", true, true);

            EventLogManager.AddRoleEvent(client, OpTypes.Trace, OpTags.ShenQiZaiZao, LogRecordType.ShenQiZaiZao, artifactDataBasic.NewEquitID, 1, 0);

            #endregion

            #region 再造

            int        _Forge_level    = equipData.Forge_level;    //强化等级
            int        _AppendPropLev  = equipData.AppendPropLev;  //追加等级
            int        _Lucky          = equipData.Lucky;          //幸运属性
            int        _ExcellenceInfo = equipData.ExcellenceInfo; //卓越属性
            List <int> _WashProps      = equipData.WashProps;      //培养属性
            int        _Binding        = equipData.Binding;        //绑定状态
            if (useBind)
            {
                _Binding = 1;
            }

            //扣除原有的装备
            if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool,
                                                      Global._TCPManager.TcpOutPacketPool, client, equipID, false))
            {
                result.State = (int)ArtifactResultType.EdelEquip;
                return(result);
            }

            //给予新的装备
            int nItemDBID = Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client,
                                                     artifactDataBasic.NewEquitID, 1,
                                                     equipData.Quality, //
                                                     "",
                                                     _Forge_level,
                                                     _Binding,
                                                     0,
                                                     equipData.Jewellist, //""
                                                     false,
                                                     1,
                                                     /**/ "神器再造",
                                                     Global.ConstGoodsEndTime,
                                                     equipData.AddPropIndex, //0, //
                                                     equipData.BornIndex,    //
                                                     _Lucky,
                                                     0,
                                                     _ExcellenceInfo,
                                                     _AppendPropLev,
                                                     equipData.ChangeLifeLevForEquip,//0, //
                                                     _WashProps);

            if (nItemDBID < 0)
            {
                result.State = (int)ArtifactResultType.EaddEquip;
                return(result);
            }

            #endregion

            // 玩家【用户名字】勇往直前,勇不可挡,通过了万魔塔第XX层!
            string broadcastMsg = StringUtil.substitute(Global.GetLang("玩家【{0}】成功进行了神器再造,获得了{2}阶装备【{1}】!"),
                                                        Global.FormatRoleName(client, client.ClientData.RoleName), artifactDataBasic.ArtifactName, nSuitID + 1);
            //播放用户行为消息
            Global.BroadcastRoleActionMsg(client, RoleActionsMsgTypes.HintMsg, broadcastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint);

            result.State     = (int)ArtifactResultType.Success;
            result.EquipDbID = nItemDBID;
            result.Bind      = _Binding;
            return(result);
        }
コード例 #6
0
        public QingGongYanResult HoldQingGongYan(GameClient client, int index, int onlyCheck = 0)
        {
            QingGongYanResult result;

            if (!Global.IsKingCityLeader(client))
            {
                result = QingGongYanResult.NotKing;
            }
            else
            {
                QingGongYanInfo InfoData = this.GetQingGongYanConfig(index);
                if (null == InfoData)
                {
                    result = QingGongYanResult.ErrorParam;
                }
                else if (InfoData.IfBanTime(TimeUtil.NowDateTime()))
                {
                    result = QingGongYanResult.OutTime;
                }
                else
                {
                    int DBStartDay = GameManager.GameConfigMgr.GetGameConfigItemInt("qinggongyan_startday", 0);
                    int currDay    = Global.GetOffsetDay(TimeUtil.NowDateTime());
                    if (DBStartDay == currDay && TimeUtil.NowDateTime() <= DateTime.Parse(InfoData.OverTime))
                    {
                        result = QingGongYanResult.RepeatHold;
                    }
                    else
                    {
                        int startDay;
                        if (TimeUtil.NowDateTime() < DateTime.Parse(InfoData.BeginTime))
                        {
                            startDay = currDay;
                        }
                        else
                        {
                            startDay = currDay + 1;
                        }
                        if (startDay == DBStartDay)
                        {
                            result = QingGongYanResult.RepeatHold;
                        }
                        else
                        {
                            if (InfoData.HoldBindJinBi > 0)
                            {
                                if (InfoData.HoldBindJinBi > Global.GetTotalBindTongQianAndTongQianVal(client))
                                {
                                    return(QingGongYanResult.MoneyNotEnough);
                                }
                            }
                            if (onlyCheck > 0)
                            {
                                result = QingGongYanResult.CheckSuccess;
                            }
                            else
                            {
                                if (InfoData.HoldBindJinBi > 0)
                                {
                                    if (!Global.SubBindTongQianAndTongQian(client, InfoData.HoldBindJinBi, "举办庆功宴"))
                                    {
                                        return(QingGongYanResult.MoneyNotEnough);
                                    }
                                }
                                Global.UpdateDBGameConfigg("qinggongyan_roleid", client.ClientData.RoleID.ToString());
                                GameManager.GameConfigMgr.SetGameConfigItem("qinggongyan_roleid", client.ClientData.RoleID.ToString());
                                BangHuiMiniData bangHuiMiniData = Global.GetBangHuiMiniData(client.ClientData.Faction, 0);
                                if (null != bangHuiMiniData)
                                {
                                    Global.UpdateDBGameConfigg("qinggongyan_guildname", bangHuiMiniData.BHName);
                                    GameManager.GameConfigMgr.SetGameConfigItem("qinggongyan_guildname", bangHuiMiniData.BHName);
                                }
                                else
                                {
                                    Global.UpdateDBGameConfigg("qinggongyan_guildname", "");
                                    GameManager.GameConfigMgr.SetGameConfigItem("qinggongyan_guildname", "");
                                }
                                GameManager.GameConfigMgr.SetGameConfigItem("qinggongyan_guildname", client.ClientData.RoleName);
                                Global.UpdateDBGameConfigg("qinggongyan_startday", startDay.ToString());
                                GameManager.GameConfigMgr.SetGameConfigItem("qinggongyan_startday", startDay.ToString());
                                Global.UpdateDBGameConfigg("qinggongyan_grade", index.ToString());
                                GameManager.GameConfigMgr.SetGameConfigItem("qinggongyan_grade", index.ToString());
                                Global.UpdateDBGameConfigg("qinggongyan_joincount", "0");
                                GameManager.GameConfigMgr.SetGameConfigItem("qinggongyan_joincount", "0");
                                Global.UpdateDBGameConfigg("qinggongyan_joinmoney", "0");
                                GameManager.GameConfigMgr.SetGameConfigItem("qinggongyan_joinmoney", "0");
                                Global.UpdateDBGameConfigg("qinggongyan_jubanmoney", InfoData.HoldBindJinBi.ToString());
                                GameManager.GameConfigMgr.SetGameConfigItem("qinggongyan_jubanmoney", InfoData.HoldBindJinBi.ToString());
                                GameManager.logDBCmdMgr.AddDBLogInfo(-1, "举办庆功宴", startDay.ToString(), "", client.ClientData.RoleName, "", index, client.ClientData.ZoneID, client.strUserID, -1, client.ServerId, null);
                                EventLogManager.AddRoleEvent(client, OpTypes.Hold, OpTags.QingGongYan, LogRecordType.OffsetDayId, new object[]
                                {
                                    startDay
                                });
                                result = QingGongYanResult.Success;
                            }
                        }
                    }
                }
            }
            return(result);
        }
コード例 #7
0
        public QingGongYanResult JoinQingGongYan(GameClient client)
        {
            QingGongYanResult result;

            if (null == this.QingGongYanNpc)
            {
                result = QingGongYanResult.OutTime;
            }
            else
            {
                QingGongYanInfo InfoData = this.GetInfoData();
                if (null == InfoData)
                {
                    result = QingGongYanResult.OutTime;
                }
                else
                {
                    int JoinCount = GameManager.GameConfigMgr.GetGameConfigItemInt("qinggongyan_joincount", 0);
                    if (JoinCount > 0)
                    {
                        if (JoinCount >= InfoData.TotalNum)
                        {
                            return(QingGongYanResult.TotalNotEnough);
                        }
                    }
                    if (InfoData.JoinBindJinBi > 0)
                    {
                        if (InfoData.JoinBindJinBi > Global.GetTotalBindTongQianAndTongQianVal(client))
                        {
                            return(QingGongYanResult.MoneyNotEnough);
                        }
                    }
                    string QingGongYanJoinFlag = Global.GetRoleParamByName(client, "QingGongYanJoinFlag");
                    int    currDay             = Global.GetOffsetDay(TimeUtil.NowDateTime());
                    int    lastJoinDay         = 0;
                    int    joinCount           = 0;
                    if (null != QingGongYanJoinFlag)
                    {
                        string[] fields = QingGongYanJoinFlag.Split(new char[]
                        {
                            ','
                        });
                        if (2 == fields.Length)
                        {
                            lastJoinDay = Convert.ToInt32(fields[0]);
                            joinCount   = Convert.ToInt32(fields[1]);
                        }
                    }
                    if (currDay != lastJoinDay)
                    {
                        joinCount = 0;
                    }
                    if (InfoData.SingleNum > 0)
                    {
                        if (joinCount >= InfoData.SingleNum)
                        {
                            return(QingGongYanResult.CountNotEnough);
                        }
                    }
                    if (InfoData.JoinBindJinBi > 0)
                    {
                        if (!Global.SubBindTongQianAndTongQian(client, InfoData.JoinBindJinBi, "参加庆功宴"))
                        {
                            return(QingGongYanResult.MoneyNotEnough);
                        }
                    }
                    string roleParam = currDay.ToString() + "," + (joinCount + 1).ToString();
                    Global.UpdateRoleParamByName(client, "QingGongYanJoinFlag", roleParam, true);
                    Global.UpdateDBGameConfigg("qinggongyan_joincount", (JoinCount + 1).ToString());
                    GameManager.GameConfigMgr.SetGameConfigItem("qinggongyan_joincount", (JoinCount + 1).ToString());
                    int JoinMoney = GameManager.GameConfigMgr.GetGameConfigItemInt("qinggongyan_joinmoney", 0);
                    Global.UpdateDBGameConfigg("qinggongyan_joinmoney", (JoinMoney + InfoData.JoinBindJinBi).ToString());
                    GameManager.GameConfigMgr.SetGameConfigItem("qinggongyan_joinmoney", (JoinMoney + InfoData.JoinBindJinBi).ToString());
                    if (InfoData.ExpAward > 0)
                    {
                        GameManager.ClientMgr.ProcessRoleExperience(client, (long)InfoData.ExpAward, true, true, false, "none");
                    }
                    if (InfoData.XingHunAward > 0)
                    {
                        GameManager.ClientMgr.ModifyStarSoulValue(client, InfoData.XingHunAward, "庆功宴", true, true);
                    }
                    if (InfoData.ZhanGongAward > 0)
                    {
                        int nZhanGong = InfoData.ZhanGongAward;
                        if (GameManager.ClientMgr.AddBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ref nZhanGong, AddBangGongTypes.BG_QGY, 0))
                        {
                            if (0 != nZhanGong)
                            {
                                GameManager.logDBCmdMgr.AddDBLogInfo(-1, "战功", "罗兰宴会领取", "系统", client.ClientData.RoleName, "增加", nZhanGong, client.ClientData.ZoneID, client.strUserID, client.ClientData.BangGong, client.ServerId, null);
                            }
                        }
                        GameManager.SystemServerEvents.AddEvent(string.Format("角色获取帮贡, roleID={0}({1}), BangGong={2}, newBangGong={3}", new object[]
                        {
                            client.ClientData.RoleID,
                            client.ClientData.RoleName,
                            client.ClientData.BangGong,
                            nZhanGong
                        }), EventLevels.Record);
                    }
                    GameManager.logDBCmdMgr.AddDBLogInfo(-1, "参加庆功宴", "", "", client.ClientData.RoleName, "", 1, client.ClientData.ZoneID, client.strUserID, -1, client.ServerId, null);
                    EventLogManager.AddRoleEvent(client, OpTypes.Join, OpTags.QingGongYan, LogRecordType.OffsetDayId, new object[]
                    {
                        currDay
                    });
                    result = QingGongYanResult.Success;
                }
            }
            return(result);
        }