public RegressActiveOpcode ProcessRegressAcitveGetStoreInfo(GameClient client, out Dictionary <int, int> GoodInfo)
        {
            GoodInfo = null;
            RegressActiveOpen   iflAct = HuodongCachingMgr.GetRegressActiveOpen();
            RegressActiveOpcode result;

            if (iflAct == null || !iflAct.InActivityTime())
            {
                result = RegressActiveOpcode.RegressActiveOpenErr;
            }
            else
            {
                DateTime nowDateTime = TimeUtil.NowDateTime();
                string   CurrDate    = new DateTime(nowDateTime.Year, nowDateTime.Month, nowDateTime.Day, nowDateTime.Hour, nowDateTime.Minute, nowDateTime.Second).ToString("yyyy-MM-dd HH:mm:ss");
                int      CDate       = Global.GetOffsetDay(DateTime.Parse(CurrDate)) - Global.GetOffsetDay(DateTime.Parse(iflAct.FromDate));
                if (CDate < 0)
                {
                    result = RegressActiveOpcode.RegressActiveStoreCheckDayFail;
                }
                else
                {
                    string stage  = string.Format("{0}_{1}", Global.GetOffsetDay(DateTime.Parse(iflAct.FromDate)), Global.GetOffsetDay(DateTime.Parse(iflAct.ToDate)));
                    string strcmd = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, CDate, stage);
                    GoodInfo = Global.sendToDB <Dictionary <int, int>, string>(14133, strcmd, 0);
                    result   = RegressActiveOpcode.RegressActiveSucc;
                }
            }
            return(result);
        }
        public bool InActivityTime()
        {
            JieriActivityConfig config = HuodongCachingMgr.GetJieriActivityConfig();
            bool result;

            if (null == config)
            {
                result = false;
            }
            else if (!config.InList(41))
            {
                result = false;
            }
            else
            {
                JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                if (null == activity)
                {
                    result = false;
                }
                else if (!activity.InActivityTime())
                {
                    result = false;
                }
                else
                {
                    DateTime startTime = DateTime.Parse(this.StartDate);
                    DateTime endTime   = DateTime.Parse(this.EndDate);
                    result = (TimeUtil.NowDateTime() >= startTime && TimeUtil.NowDateTime() <= endTime);
                }
            }
            return(result);
        }
        public double GetMult()
        {
            double result;

            if (this.Effective == 0)
            {
                result = 0.0;
            }
            else
            {
                JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                if (null == activity)
                {
                    result = 0.0;
                }
                else if (!activity.InActivityTime())
                {
                    result = 0.0;
                }
                else if (!this.InActivityTime())
                {
                    result = 0.0;
                }
                else if (this.Multiplying < 1.0)
                {
                    result = 0.0;
                }
                else
                {
                    result = this.Multiplying;
                }
            }
            return(result);
        }
Beispiel #4
0
 private void _OnChangeNameSuccess(int roleId, string oldName, string newName)
 {
     if (!string.IsNullOrEmpty(oldName) && !string.IsNullOrEmpty(newName))
     {
         RoleName2IDs.OnChangeName(roleId, oldName, newName);
         MarryLogic.OnChangeName(roleId, oldName, newName);
         GameManager.ArenaBattleMgr.OnChangeName(roleId, oldName, newName);
         if (LuoLanChengZhanManager.getInstance().GetLuoLanChengZhuRoleID() == roleId)
         {
             LuoLanChengZhanManager.getInstance().OnChangeName(roleId, oldName, newName);
         }
         GameManager.BloodCastleCopySceneMgr.OnChangeName(roleId, oldName, newName);
         GameManager.DaimonSquareCopySceneMgr.OnChangeName(roleId, oldName, newName);
         GameManager.BattleMgr.OnChangeName(roleId, oldName, newName);
         GameManager.AngelTempleMgr.OnChangeName(roleId, oldName, newName);
         MonsterBossManager.OnChangeName(roleId, oldName, newName);
         JieRiGiveKingActivity gkAct = HuodongCachingMgr.GetJieriGiveKingActivity();
         if (gkAct != null)
         {
             gkAct.OnChangeName(roleId, oldName, newName);
         }
         JieRiRecvKingActivity rkAct = HuodongCachingMgr.GetJieriRecvKingActivity();
         if (rkAct != null)
         {
             rkAct.OnChangeName(roleId, oldName, newName);
         }
         AllyManager.getInstance().UnionLeaderChangName(roleId, oldName, newName);
         JunTuanManager.getInstance().OnRoleChangName(roleId, oldName, newName);
         CompManager.getInstance().OnChangeName(roleId, oldName, newName);
         RebornManager.getInstance().OnChangeName(roleId, oldName, newName);
     }
 }
Beispiel #5
0
        public static List <CallPetConfig> GetCallPetConfigList(bool freeCall)
        {
            List <CallPetConfig> result;

            lock (CallPetManager._CallPetMutex)
            {
                if (freeCall)
                {
                    result = CallPetManager.FreeCallPetConfigList;
                }
                else
                {
                    SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity();
                    if (spAct != null && spAct.IsChouJiangOpen(SpecPActivityChouJiangType.TeQuanBuHuo))
                    {
                        result = CallPetManager.TeQuanCallPetConfigList;
                    }
                    else
                    {
                        JieRiFuLiActivity act           = HuodongCachingMgr.GetJieriFuLiActivity();
                        object            o_placeholder = null;
                        if (act != null && act.IsOpened(EJieRiFuLiType.CallPetReplace, out o_placeholder))
                        {
                            result = CallPetManager.HuoDongCallPetConfigList;
                        }
                        else
                        {
                            result = CallPetManager.CallPetConfigList;
                        }
                    }
                }
            }
            return(result);
        }
Beispiel #6
0
        /// <summary>
        /// 加载配置文件,支持热加载
        /// </summary>
        public void LoadConfig()
        {
            Dictionary <int, _DayAward> tmpDict = new Dictionary <int, _DayAward>();

            try
            {
                XElement xml = XElement.Load(Global.GameResPath(SevenDayConsts.LoginConfig)).Element("GiftList");
                foreach (var xmlItem in xml.Elements())
                {
                    int       day   = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                    _DayAward award = new _DayAward();

                    // 通用奖励
                    string goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                    if (!string.IsNullOrEmpty(goodsIDs))
                    {
                        string[] fields = goodsIDs.Split('|');
                        if (fields.Length <= 0)
                        {
                            LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}活动配置文件中的物品配置项失败", SevenDayConsts.LoginConfig));
                        }
                        else
                        {
                            award.AllAward.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, SevenDayConsts.LoginConfig);
                        }
                    }

                    // 职业奖励
                    goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                    if (!string.IsNullOrEmpty(goodsIDs))
                    {
                        string[] fields = goodsIDs.Split('|');
                        if (fields.Length <= 0)
                        {
                            LogManager.WriteLog(LogTypes.Warning, SevenDayConsts.LoginConfig);
                        }
                        else
                        {
                            award.OccAward.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, SevenDayConsts.LoginConfig);
                        }
                    }

                    // 限时奖励
                    string timeGoods = Global.GetSafeAttributeStr(xmlItem, "GoodsThr");
                    string timeList  = Global.GetSafeAttributeStr(xmlItem, "EffectiveTime");
                    award.TimeAward.Init(timeGoods, timeList, SevenDayConsts.LoginConfig + " 时效性物品");

                    tmpDict[day] = award;
                }

                lock (ConfigMutex)
                {
                    DayAwardDict = tmpDict;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("七日登录活动加载配置失败{0}", SevenDayConsts.LoginConfig), ex);
            }
        }
Beispiel #7
0
        /// <summary>
        /// 检查用户PK之王领奖状态
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public bool CheckHeFuPKKing(GameClient client)
        {
            HeFuPKKingActivity activity = HuodongCachingMgr.GetHeFuPKKingActivity();

            if (null == activity)
            {
                return(false);
            }
            // 检查是否在允许领取的时间内
            if (!activity.InAwardTime())
            {
                return(false);
            }

            bool bFlush = false;

            while (true)
            {
                // 判断玩家是不是战场之神
                if (client.ClientData.RoleID != HuodongCachingMgr.GetHeFuPKKingRoleID())
                {
                    break;
                }

                // 判断是否已经领取
                int nFlag = Global.GetRoleParamsInt32FromDB(client, RoleParamName.HeFuPKKingFlag);
                if (nFlag == 0)
                {
                    bFlush = true;
                    break;
                }
                break;
            }
            return(AddFlushIconState((ushort)ActivityTipTypes.HeFuPKKing, bFlush));;
        }
        private void ProcessAddRoleExperience(GameClient client)
        {
            long exp = this.GetBattleExpByLevel(client, client.ClientData.Level);

            if (exp > 0L)
            {
                double awardmuti = 0.0;
                JieRiMultAwardActivity jieriact = HuodongCachingMgr.GetJieRiMultAwardActivity();
                if (null != jieriact)
                {
                    JieRiMultConfig config = jieriact.GetConfig(2);
                    if (null != config)
                    {
                        awardmuti += config.GetMult();
                    }
                }
                SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity();
                if (null != spAct)
                {
                    awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_Battle);
                }
                awardmuti = Math.Max(1.0, awardmuti);
                exp       = (long)((double)exp * awardmuti);
                GameManager.ClientMgr.ProcessRoleExperience(client, exp, true, false, false, "none");
            }
        }
        public override bool GiveAward(GameClient client, int _params)
        {
            AwardItem myAwardItem = null;

            if (this.AwardDict.ContainsKey(_params))
            {
                myAwardItem = this.AwardDict[_params];
            }
            bool result;

            if (null == myAwardItem)
            {
                result = false;
            }
            else
            {
                client.ClientData.ClearAwardRecord((RoleAwardMsg)this.ActivityType);
                WeedEndInputActivity act = HuodongCachingMgr.GetWeekEndInputActivity();
                if (null != act)
                {
                    act.GiveAward(client, myAwardItem.MinAwardCondionValue);
                }
                bool ret = base.GiveAward(client, myAwardItem);
                GameManager.ClientMgr.NotifyGetAwardMsg(client, (RoleAwardMsg)this.ActivityType, "");
                result = ret;
            }
            return(result);
        }
Beispiel #10
0
        /// <summary>
        /// 处理王城的归属--->只考虑帮会ID,不考虑具体角色
        /// </summary>
        private static void HandleHuangChengResultEx(bool isBattleOver = false)
        {
            if (WangZuBHid <= 0)
            {
                if (isBattleOver)
                {
                    //处理王城战流产
                    HandleWangChengFailed();
                }
                return; //谁也当不成王族
            }


            //处理领地战的结果
            JunQiManager.HandleLingDiZhanResultByMapCode((int)LingDiIDs.HuangGong, Global.GetHuangGongMapCode(), WangZuBHid, true, false);

            //夺取王城的提示
            Global.BroadcastHuangChengOkHintEx(WangZuBHName, isBattleOver);

            //通知GameServer同步帮会的所属和范围
            JunQiManager.NotifySyncBangHuiJunQiItemsDict(null);

            if (isBattleOver)
            {
                //设置合服后的王城霸主
                HuodongCachingMgr.UpdateHeFuWCKingBHID(WangZuBHid);
            }
        }
Beispiel #11
0
        /// <summary>
        /// 为获胜的角色增加Buffer和标识
        /// </summary>
        /// <param name="client"></param>
        /// <param name="bufferType"></param>
        private void AddBattleBufferAndFlags(GameClient client)
        {
            //Buffer参数
            double[] actionParams = new double[2];
            actionParams[0] = 60.0 * 24.0 * 60 - 1200; //24个小时的buffer时间 -- 改成 23小时40分钟
            actionParams[1] = 2000800;                 //BUFFER 物品id

            client.ClientData.BattleNameStart = DateTime.Now.Ticks / 10000;
            client.ClientData.BattleNameIndex = 1;

            //移除攻击类型buffer
            Global.RemoveBufferData(client, (int)BufferItemTypes.TimeAddAttack);
            Global.RemoveBufferData(client, (int)BufferItemTypes.TimeAddDSAttack);
            Global.RemoveBufferData(client, (int)BufferItemTypes.TimeAddMAttack);

            //更新BufferData
            Global.UpdateBufferData(client, BufferItemTypes.PKKingBuffer, actionParams);

            //异步写数据库,写入当前的血战地府称号信息
            GameManager.DBCmdMgr.AddDBCmd((int)TCPGameServerCmds.CMD_DB_UPDATEBATTLENAME,
                                          string.Format("{0}:{1}:{2}", client.ClientData.RoleID, client.ClientData.BattleNameStart, client.ClientData.BattleNameIndex),
                                          null);

            //通知血战地府称号的信息
            GameManager.ClientMgr.NotifyRoleBattleNameInfo(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);

            //血战地府称号次数更新
            GameManager.ClientMgr.UpdateBattleNum(client, 1, false);

            //设置合服后的PK王
            HuodongCachingMgr.UpdateHeFuPKKingRoleID(client.ClientData.RoleID);
        }
Beispiel #12
0
        private static bool JugeSucess(int mergeItemID, CacheMergeItem cacheMergeItem, int addSuccessPercent)
        {
            int    randNum   = Global.GetRandomNumber(0, 101);
            double awardmuti = 0.0;

            if (50 == mergeItemID)
            {
                JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                if (null != activity)
                {
                    JieRiMultConfig config = activity.GetConfig(13);
                    if (null != config)
                    {
                        awardmuti += config.GetMult();
                    }
                }
                SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity();
                if (null != spAct)
                {
                    awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_MergeFruit);
                }
            }
            awardmuti = Math.Max(1.0, awardmuti);
            int successRate = (int)((double)cacheMergeItem.SuccessRate * awardmuti);

            return(randNum <= successRate + addSuccessPercent);
        }
Beispiel #13
0
        /// <summary>
        /// 判断是否成功
        /// </summary>
        /// <param name="cacheMergeItem"></param>
        /// <returns></returns>
        private static bool JugeSucess(int mergeItemID, CacheMergeItem cacheMergeItem, int addSuccessPercent)
        {
            int randNum = Global.GetRandomNumber(0, 101);

            double awardmuti = 1.0;

            if (50 == mergeItemID)
            {
                // 合服果实
                JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                if (null != activity)
                {
                    JieRiMultConfig config = activity.GetConfig((int)MultActivityType.MergeFruitCoe);
                    if (null != config)
                    {
                        awardmuti += config.GetMult();
                    }
                }
            }

            int successRate = (int)(cacheMergeItem.SuccessRate * awardmuti);

            if (randNum <= (successRate + addSuccessPercent))
            {
                return(true);
            }

            return(false);
        }
Beispiel #14
0
        /// <summary>
        /// 加载送礼窗口中的活动送礼配置文件
        /// </summary>
        /// <returns></returns>
        private static int ReloadXmlFile_config_gifts_activities()
        {
            //礼品码数据,用于缓存
            Global._activitiesData = null;

            //重置送礼活动的项,强迫下次使用时重新加载
            return(HuodongCachingMgr.ResetSongLiItem());
        }
Beispiel #15
0
        public void LoadConfig()
        {
            Dictionary <int, SevenDayLoginAct._DayAward> tmpDict = new Dictionary <int, SevenDayLoginAct._DayAward>();

            try
            {
                XElement xml = XElement.Load(Global.GameResPath("Config/SevenDay/SevenDayLogin.xml")).Element("GiftList");
                foreach (XElement xmlItem in xml.Elements())
                {
                    int day = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                    SevenDayLoginAct._DayAward award = new SevenDayLoginAct._DayAward();
                    string goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                    if (!string.IsNullOrEmpty(goodsIDs))
                    {
                        string[] fields = goodsIDs.Split(new char[]
                        {
                            '|'
                        });
                        if (fields.Length <= 0)
                        {
                            LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}活动配置文件中的物品配置项失败", "Config/SevenDay/SevenDayLogin.xml"), null, true);
                        }
                        else
                        {
                            award.AllAward.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "Config/SevenDay/SevenDayLogin.xml");
                        }
                    }
                    goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                    if (!string.IsNullOrEmpty(goodsIDs))
                    {
                        string[] fields = goodsIDs.Split(new char[]
                        {
                            '|'
                        });
                        if (fields.Length <= 0)
                        {
                            LogManager.WriteLog(LogTypes.Warning, "Config/SevenDay/SevenDayLogin.xml", null, true);
                        }
                        else
                        {
                            award.OccAward.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "Config/SevenDay/SevenDayLogin.xml");
                        }
                    }
                    string timeGoods = Global.GetSafeAttributeStr(xmlItem, "GoodsThr");
                    string timeList  = Global.GetSafeAttributeStr(xmlItem, "EffectiveTime");
                    award.TimeAward.Init(timeGoods, timeList, "Config/SevenDay/SevenDayLogin.xml 时效性物品");
                    tmpDict[day] = award;
                }
                lock (this.ConfigMutex)
                {
                    this.DayAwardDict = tmpDict;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("七日登录活动加载配置失败{0}", "Config/SevenDay/SevenDayLogin.xml"), ex, true);
            }
        }
Beispiel #16
0
        /// <summary>
        /// 节日累计消费
        /// <summary>
        public bool CheckJieRiLeiJiXF(GameClient client)
        {
            JieRiTotalConsumeActivity activity = HuodongCachingMgr.GetJieRiTotalConsumeActivity();

            if (null == activity)
            {
                return(false);
            }
            if (!activity.InAwardTime())
            {
                return(false);
            }

            bool bFlush = false;

            while (true)
            {
                string[] dbFields = null;
                // 向DB申请数据
                TCPProcessCmdResults retcmd = Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                                       (int)TCPGameServerCmds.CMD_SPR_QUERYJIERITOTALCONSUME, Global.GetActivityRequestCmdString(ActivityTypes.JieriTotalConsume, client), out dbFields);
                if (null == dbFields)
                {
                    break;
                }

                // hasgettimes |= (1 << (extTag - 1));
                // strcmd = string.Format("{0}:{1}:{2}:{3}", 1, roleID, roleYuanBaoInPeriod, hasgettimes);
                if (null == dbFields || 4 != dbFields.Length)
                {
                    break;
                }

                int roleYuanBaoInPeriod = Convert.ToInt32(dbFields[2]);
                int hasgettimes         = Convert.ToInt32(dbFields[3]);

                foreach (KeyValuePair <int, AwardItem> item in activity.AwardItemDict)
                {
                    // 满足领取条件
                    if (roleYuanBaoInPeriod >= item.Value.MinAwardCondionValue)
                    {
                        // 判断是否领取
                        int nValue = Global.GetIntSomeBit(hasgettimes, item.Key - 1);
                        // 发现有一天没领取
                        if (nValue == 0)
                        {
                            bFlush = true;
                            break;
                        }
                    }
                }

                break;
            }

            return(AddFlushIconState((ushort)ActivityTipTypes.JieRiLeiJiXF, bFlush));
        }
Beispiel #17
0
        /// <summary>
        /// 节日累计登陆
        /// </summary>
        public bool CheckJieRiTotalLogin(GameClient client)
        {
            JieRiDengLuActivity activity = HuodongCachingMgr.GetJieRiDengLuActivity();

            if (null == activity)
            {
                return(false);
            }
            if (!activity.InAwardTime())
            {
                return(false);
            }

            bool bFlush = false;

            while (true)
            {
                string[] dbFields = null;
                // 向DB申请数据
                TCPProcessCmdResults retcmd = Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                                       (int)TCPGameServerCmds.CMD_SPR_QUERYJIERIDENGLU, Global.GetActivityRequestCmdString(ActivityTypes.JieriDengLuHaoLi, client), out dbFields);
                if (null == dbFields)
                {
                    break;
                }

                // hasgettimes |= (1 << (extTag - 1));
                // strcmd = string.Format("{0}:{1}:{2}:{3}", 1, roleID, hasgettimes, dengLuTimes);
                if (null == dbFields || 4 != dbFields.Length)
                {
                    break;
                }

                int hasgettimes = Convert.ToInt32(dbFields[2]);
                int dengLuTimes = Convert.ToInt32(dbFields[3]);

                // 依次检查是否有满足条件的没领取的奖励
                for (int i = 0; i < dengLuTimes; i++)
                {
                    if (activity.GetAward(client, i + 1) == null)
                    {
                        continue;
                    }

                    int nValue = Global.GetIntSomeBit(hasgettimes, i);
                    // 发现有一天没领取
                    if (nValue == 0)
                    {
                        bFlush = true;
                        break;
                    }
                }
                break;
            }

            return(AddFlushIconState((ushort)ActivityTipTypes.JieRiTotalLogin, bFlush));
        }
Beispiel #18
0
        public virtual bool InActivityTime()
        {
            if (this.IsHeFuActivity(this.ActivityType))
            {
                HeFuActivityConfig config = HuodongCachingMgr.GetHeFuActivityConfing();
                if (null == config)
                {
                    return(false);
                }
                if (!config.InList(this.ActivityType))
                {
                    return(false);
                }
            }
            if (this.IsJieRiActivity(this.ActivityType))
            {
                JieriActivityConfig config2 = HuodongCachingMgr.GetJieriActivityConfig();
                if (null == config2)
                {
                    return(false);
                }
                if (!config2.InList(this.ActivityType))
                {
                    return(false);
                }
            }
            if (this.IsThemeActivity(this.ActivityType))
            {
                ThemeActivityConfig config3 = HuodongCachingMgr.GetThemeActivityConfig();
                if (config3 == null || config3.ActivityOpenVavle <= 0)
                {
                    return(false);
                }
                if (!config3.InList(this.ActivityType))
                {
                    return(false);
                }
                int endData = config3.GetEndData(this.ActivityType);
                if (endData > 0 && TimeUtil.NowDateTime() > Global.GetKaiFuTime().AddDays((double)endData))
                {
                    return(false);
                }
            }
            bool result;

            if (string.IsNullOrEmpty(this.FromDate) || string.IsNullOrEmpty(this.ToDate))
            {
                result = false;
            }
            else
            {
                DateTime startTime = DateTime.Parse(this.FromDate);
                DateTime endTime   = DateTime.Parse(this.ToDate);
                result = (TimeUtil.NowDateTime() >= startTime && TimeUtil.NowDateTime() <= endTime);
            }
            return(result);
        }
Beispiel #19
0
        private void _OnChangeNameSuccess(int roleId, string oldName, string newName)
        {
            if (string.IsNullOrEmpty(oldName) || string.IsNullOrEmpty(newName))
            {
                return;
            }

            // 改名成功后,GameServer需要处理的事情
            RoleName2IDs.OnChangeName(roleId, oldName, newName);

            // 通知配偶, 更新婚宴缓存角色名
            MarryLogic.OnChangeName(roleId, oldName, newName);

            // 通知pk之王,有人改名,用于判断是否更新pk之王雕像,pk之王最高分名字
            GameManager.ArenaBattleMgr.OnChangeName(roleId, oldName, newName);

            // 罗兰城主
            if (LuoLanChengZhanManager.getInstance().GetLuoLanChengZhuRoleID() == roleId)
            {
                // 重新显示罗兰城主的时候,重新加载罗兰城主角色id
                LuoLanChengZhanManager.getInstance().OnChangeName(roleId, oldName, newName);
            }

            // 血色城堡更新最高积分者名字
            GameManager.BloodCastleCopySceneMgr.OnChangeName(roleId, oldName, newName);

            // 恶魔广场更新最高积分者名字
            GameManager.DaimonSquareCopySceneMgr.OnChangeName(roleId, oldName, newName);

            // 阵营战
            GameManager.BattleMgr.OnChangeName(roleId, oldName, newName);

            // 天使神殿
            GameManager.AngelTempleMgr.OnChangeName(roleId, oldName, newName);

            // boss击杀记录
            MonsterBossManager.OnChangeName(roleId, oldName, newName);

            // 节日赠送排行榜
            Logic.ActivityNew.JieRiGiveKingActivity gkAct = HuodongCachingMgr.GetJieriGiveKingActivity();
            if (gkAct != null)
            {
                gkAct.OnChangeName(roleId, oldName, newName);
            }

            // 节日收取排行榜
            Logic.ActivityNew.JieRiRecvKingActivity rkAct = HuodongCachingMgr.GetJieriRecvKingActivity();
            if (rkAct != null)
            {
                rkAct.OnChangeName(roleId, oldName, newName);
            }

            AllyManager.getInstance().UnionLeaderChangName(roleId, oldName, newName);
        }
Beispiel #20
0
        public TCPProcessCmdResults HandleClientQueryPlatChargeKing(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPRandKey tcpRandKey, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
        {
            tcpOutPacket = null;
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(data, 0, count);
            }
            catch (Exception) //解析错误
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}", (TCPGameServerCmds)nID));

                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", (int)TCPGameServerCmds.CMD_DB_ERR_RETURN);
                return(TCPProcessCmdResults.RESULT_DATA);
            }

            try
            {
                string[] fields = cmdData.Split(':');
                if (fields.Length != 1)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Recv={1}, CmdData={2}",
                                                                      (TCPGameServerCmds)nID, fields.Length, cmdData));

                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", (int)TCPGameServerCmds.CMD_DB_ERR_RETURN);
                    return(TCPProcessCmdResults.RESULT_DATA);
                }

                int roleID = Convert.ToInt32(fields[0]);

                GameClient client = GameManager.ClientMgr.FindClient(socket);
                if (null == client || client.ClientData.RoleID != roleID)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket), roleID));
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }

                JieriPlatChargeKing act = HuodongCachingMgr.GetJieriPlatChargeKingActivity();
                if (act != null)
                {
                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, DataHelper.ObjectToBytes <List <InputKingPaiHangData> >(act.RealRankList), nID);
                }

                return(TCPProcessCmdResults.RESULT_DATA);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, "", false);
            }

            tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", (int)TCPGameServerCmds.CMD_DB_ERR_RETURN);
            return(TCPProcessCmdResults.RESULT_DATA);
        }
        private string _Excute_Handle_UC(GameClient client, string param)
        {
            int result = 0;
            PlatFuLiBaseData fuliBaseData;

            lock (this.ConfigMutex)
            {
                this.PlatFuLiBaseDataDict.TryGetValue(SpecialPlatformType.UC.ToString(), out fuliBaseData);
            }
            string result2;

            if (fuliBaseData == null || !this.AliGiftsSwitch)
            {
                result  = -3;
                result2 = string.Format("{0}", result);
            }
            else if (!Global.CanAddGoodsDataList(client, ((UCPlatFuLiData)fuliBaseData).myAwardItem.GoodsDataList))
            {
                result  = -100;
                result2 = string.Format("{0}", result);
            }
            else
            {
                DateTime now        = TimeUtil.NowDateTime();
                DateTime startTime  = new DateTime(now.Year, now.Month, now.Day);
                DateTime endTime    = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);
                string   beginStr   = startTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(':', '$');
                string   endStr     = endTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(':', '$');
                string   keyFuLiStr = string.Format("fuli_{0}_{1}_{2}", beginStr, endStr, SpecialPlatformType.UC.ToString());
                string[] dbResult   = Global.QeuryUserActivityInfo(client, keyFuLiStr, 1000, "0");
                if (dbResult == null || dbResult.Length == 0)
                {
                    result  = -15;
                    result2 = string.Format("{0}", result);
                }
                else
                {
                    int hasGetTimes = Global.SafeConvertToInt32(dbResult[3]);
                    if (hasGetTimes > 0)
                    {
                        result  = -200;
                        result2 = string.Format("{0}", result);
                    }
                    else
                    {
                        HuodongCachingMgr.GiveAward(client, fuliBaseData.myAwardItem, "UC平台福利");
                        hasGetTimes = 1;
                        Global.UpdateUserActivityInfo(client, keyFuLiStr, 1000, (long)hasGetTimes, now.ToString("yyyy-MM-dd HH$mm$ss"));
                        result2 = string.Format("{0}", result);
                    }
                }
            }
            return(result2);
        }
        public override bool HasEnoughBagSpaceForAwardGoods(GameClient client, int nBtnIndex)
        {
            int needSpace            = 0;
            WeedEndInputActivity act = HuodongCachingMgr.GetWeekEndInputActivity();

            if (null != act)
            {
                needSpace = act.GetNeedGoodsSpace(client, this.AwardDict[nBtnIndex].MinAwardCondionValue);
            }
            needSpace += this.AwardDict[nBtnIndex].GoodsDataList.Count;
            return(Global.CanAddGoodsNum(client, needSpace));
        }
Beispiel #23
0
        /// <summary>
        /// 判断现在是否能刷怪,主要针对原始刷怪类型为4的配置进行开服后多少天的刷怪控制
        /// 如果不能刷怪,则外部需要系统强行杀死所有本区域的怪
        /// </summary>
        /// <returns></returns>
        public Boolean CanTodayReloadMonsters()
        {
            if (SpawnMonstersAfterKaiFuDays <= 0 && SpawnMonstersDays <= 0)
            {
                return(true);
            }

            DateTime kaifuTime = Global.GetKaiFuTime();

            if (ConfigBirthType == (int)MonsterBirthTypes.AfterHeFuDays)
            {
                // 检查是否开启了该活动
                HeFuActivityConfig config = HuodongCachingMgr.GetHeFuActivityConfing();
                if (null == config)
                {
                    return(false);
                }
                if (!config.InList((int)ActivityTypes.HeFuBossAttack))
                {
                    return(false);
                }

                kaifuTime = Global.GetHefuStartDay();
            }
            else if (ConfigBirthType == (int)MonsterBirthTypes.AfterJieRiDays)
            {
                // 检查是否开启了该活动
                JieriActivityConfig config = HuodongCachingMgr.GetJieriActivityConfig();
                if (null == config)
                {
                    return(false);
                }
                if (!config.InList((int)ActivityTypes.JieriBossAttack))
                {
                    return(false);
                }

                kaifuTime = Global.GetJieriStartDay();
            }

            DateTime now        = TimeUtil.NowDateTime();
            int      days2Kaifu = Global.GetDaysSpanNum(now, kaifuTime) + 1;

            if (SpawnMonstersAfterKaiFuDays <= 0 || days2Kaifu >= SpawnMonstersAfterKaiFuDays)
            {
                if (SpawnMonstersDays <= 0 || days2Kaifu < SpawnMonstersDays + SpawnMonstersAfterKaiFuDays)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #24
0
        /// <summary>
        /// 检查合服登陆豪礼领取标记
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public bool CheckHeFuLogin(GameClient client)
        {
            HeFuLoginActivity activity = HuodongCachingMgr.GetHeFuLoginActivity();

            if (null == activity)
            {
                return(false);
            }

            // 检查是否在允许领取的时间内
            if (!activity.InAwardTime())
            {
                return(false);
            }

            bool bFlush = false;

            while (true)
            {
                int nFlag  = Global.GetRoleParamsInt32FromDB(client, RoleParamName.HeFuLoginFlag);
                int nValue = Global.GetIntSomeBit(nFlag, (int)HeFuLoginFlagTypes.HeFuLogin_Login);
                // 是否在活动期间登陆过
                if (nValue == 0)
                {
                    break;
                }

                // 检查是否已经领取普通奖励
                nValue = Global.GetIntSomeBit(nFlag, (int)HeFuLoginFlagTypes.HeFuLogin_NormalAward);
                if (nValue == 0)
                {
                    bFlush = true;
                    break;
                }

                // 如果普通奖励已经领取则检测是否领取vip奖励
                nValue = Global.GetIntSomeBit(nFlag, (int)HeFuLoginFlagTypes.HeFuLogin_VIPAward);
                // 没领取判断是不是vip
                if (nValue == 0)
                {
                    // 判断玩家是不是VIP
                    if (Global.IsVip(client))
                    {
                        bFlush = true;
                        break;
                    }
                }
                break;
            }

            return(AddFlushIconState((ushort)ActivityTipTypes.HeFuLogin, bFlush));;
        }
Beispiel #25
0
        /// <summary>
        /// 检查用户合服充值豪礼状态
        /// 会向GameDBServer申请数据库查询,请避免在同一时间点一起申请
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public bool CheckHeFuRecharge(GameClient client)
        {
            int currday = Global.GetOffsetDay(DateTime.Now);
            int hefuday = Global.GetOffsetDay(Global.GetHefuStartDay());

            // 活动开始的第一天没有数据
            if (currday == hefuday)
            {
                return(false);
            }
            HeFuRechargeActivity activity = HuodongCachingMgr.GetHeFuRechargeActivity();

            if (null == activity)
            {
                return(false);
            }
            if (!activity.InActivityTime() && !activity.InAwardTime())
            {
                return(false);
            }

            bool bFlush = false;

            while (true)
            {
                string[] dbFields = null;
                // 向DB申请数据
                TCPProcessCmdResults retcmd = Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, (int)TCPGameServerCmds.CMD_DB_QUERY_REPAYACTIVEINFO, string.Format("{0}:{1}:{2}:{3}", client.ClientData.RoleID, (int)ActivityTypes.HeFuRecharge, hefuday, activity.strcoe), out dbFields);
                if (null == dbFields)
                {
                    break;
                }

                if (null == dbFields || 1 != dbFields.Length)
                {
                    break;
                }

                string[] strrebate = dbFields[0].Split('|');
                if (1 > dbFields.Length)
                {
                    break;
                }

                bFlush = Convert.ToInt32(strrebate[0]) > 0;
                break;
            }

            return(AddFlushIconState((ushort)ActivityTipTypes.HeFuRecharge, bFlush));
        }
        public RegressActiveOpcode ProcessRegressSignInfo(GameClient client, out Dictionary <int, int> SignInfo)
        {
            SignInfo = new Dictionary <int, int>();
            RegressActiveOpcode result;

            if (!client.strUserID.Equals(client.strUserID))
            {
                result = RegressActiveOpcode.RegressActiveSignGetInfoFail;
            }
            else
            {
                RegressActiveOpen iflAct = HuodongCachingMgr.GetRegressActiveOpen();
                if (iflAct == null || !iflAct.InActivityTime())
                {
                    result = RegressActiveOpcode.RegressActiveOpenErr;
                }
                else
                {
                    string stage      = string.Format("{0}_{1}", Global.GetOffsetDay(DateTime.Parse(iflAct.FromDate)), Global.GetOffsetDay(DateTime.Parse(iflAct.ToDate)));
                    string GetInfoStr = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, 111, stage);
                    Dictionary <string, string> SignInfoStr = Global.sendToDB <Dictionary <string, string>, string>(14132, GetInfoStr, 0);
                    if (SignInfoStr == null)
                    {
                        result = RegressActiveOpcode.RegressActiveSignSelectFail;
                    }
                    else
                    {
                        DateTime nowDateTime = TimeUtil.NowDateTime();
                        int      ThisDay     = Global.GetOffsetDay(nowDateTime);
                        string   SignStrInfo;
                        Dictionary <int, int> Info = this.ProcessSignInfo(SignInfoStr, ThisDay, out SignStrInfo);
                        if (Info == null)
                        {
                            result = RegressActiveOpcode.RegressActiveGetSignInfoErr;
                        }
                        else if (Info.Count > SignInfoStr.Count)
                        {
                            result = RegressActiveOpcode.RegressActiveGetSignInfoErr;
                        }
                        else
                        {
                            Dictionary <int, int> Dict = this.ChangeData(SignInfoStr, Info);
                            SignInfo = Dict;
                            result   = RegressActiveOpcode.RegressActiveSucc;
                        }
                    }
                }
            }
            return(result);
        }
        public TCPProcessCmdResults ProcessQueryJieRiMeiRiPlatChargeKingCmd(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPRandKey tcpRandKey, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
        {
            tcpOutPacket = null;
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(data, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}", (TCPGameServerCmds)nID), null, true);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767);
                return(TCPProcessCmdResults.RESULT_DATA);
            }
            try
            {
                string[] fields = cmdData.Split(new char[]
                {
                    ':'
                });
                if (fields.Length != 1)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Recv={1}, CmdData={2}", (TCPGameServerCmds)nID, fields.Length, cmdData), null, true);
                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767);
                    return(TCPProcessCmdResults.RESULT_DATA);
                }
                int        roleID = Convert.ToInt32(fields[0]);
                GameClient client = GameManager.ClientMgr.FindClient(socket);
                if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                JieriPlatChargeKingEverydayData myData = null;
                JieriPlatChargeKingEveryDay     act    = HuodongCachingMgr.GetJieriPCKingEveryDayActivity();
                if (act != null)
                {
                    myData = act.BuildQueryDataForClient(client);
                }
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, DataHelper.ObjectToBytes <JieriPlatChargeKingEverydayData>(myData), nID);
                return(TCPProcessCmdResults.RESULT_DATA);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, "", false, false);
            }
            tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767);
            return(TCPProcessCmdResults.RESULT_DATA);
        }
Beispiel #28
0
        public int GetIPointsLeftMergeNum(GameClient client, int index)
        {
            JieriIPointsExchgActivity instance = HuodongCachingMgr.GetJieriIPointsExchgActivity();
            int result;

            if (null == instance)
            {
                result = 0;
            }
            else
            {
                IPointsExchgData ExchgData = null;
                this.AwardItemDict.TryGetValue(index, out ExchgData);
                if (ExchgData == null)
                {
                    result = 0;
                }
                else
                {
                    DateTime startTime            = DateTime.Parse(this.FromDate);
                    int      currday              = Global.GetOffsetDay(startTime);
                    int      lastday              = 0;
                    int      count                = 0;
                    string   strFlag              = "InputPointExchg" + index;
                    string   JieRiIPointExchgFlag = Global.GetRoleParamByName(client, strFlag);
                    if (null != JieRiIPointExchgFlag)
                    {
                        string[] fields = JieRiIPointExchgFlag.Split(new char[]
                        {
                            ','
                        });
                        if (2 == fields.Length)
                        {
                            lastday = Convert.ToInt32(fields[0]);
                            count   = Convert.ToInt32(fields[1]);
                        }
                    }
                    if (currday == lastday)
                    {
                        result = ExchgData.DayMaxTimes - count;
                    }
                    else
                    {
                        result = ExchgData.DayMaxTimes;
                    }
                }
            }
            return(result);
        }
        public RegressActiveOpcode ProcessRegressAcitveDayBuy(GameClient client, int Role, int Level, out Dictionary <int, int> ZhiGouDict)
        {
            ZhiGouDict = null;
            RegressActiveOpen   iflAct = HuodongCachingMgr.GetRegressActiveOpen();
            RegressActiveOpcode result;
            string Regtime;

            if (iflAct == null || !iflAct.InActivityTime())
            {
                result = RegressActiveOpcode.RegressActiveOpenErr;
            }
            else if (!iflAct.CanGiveAward())
            {
                result = RegressActiveOpcode.RegressActiveNotIn;
            }
            else if (!UserRegressActiveManager.GetRegressMinRegtime(client, out Regtime) || Regtime == null || Regtime.Equals(""))
            {
                result = RegressActiveOpcode.RegressActiveGetRegTime;
            }
            else
            {
                int ConfID;
                int CaleLevel = iflAct.GetUserActiveFile(Regtime, out ConfID);
                if (0 == CaleLevel)
                {
                    result = RegressActiveOpcode.RegressActiveGetFile;
                }
                else if (CaleLevel != Level)
                {
                    result = RegressActiveOpcode.RegressActiveGetFile;
                }
                else
                {
                    Dictionary <int, int> ZhiGouInfoDict = new Dictionary <int, int>();
                    RegressActiveDayBuy   act            = HuodongCachingMgr.GetRegressActiveDayBuy();
                    if (null == act)
                    {
                        result = RegressActiveOpcode.RegressActiveBuyGetInfoErr;
                    }
                    else
                    {
                        ZhiGouInfoDict = act.BuildRegressZhiGouInfoForClient(client);
                        ZhiGouDict     = ZhiGouInfoDict;
                        result         = RegressActiveOpcode.RegressActiveSucc;
                    }
                }
            }
            return(result);
        }
Beispiel #30
0
        public bool CanGetAnyAward(GameClient client)
        {
            DanBiChongZhiActivity instance = HuodongCachingMgr.GetDanBiChongZhiActivity();
            string sCmd = "";

            if (null != instance)
            {
                sCmd = string.Format("{0}:{1}:{2}:{3}", new object[]
                {
                    client.ClientData.RoleID,
                    instance.FromDate.Replace(':', '$'),
                    instance.ToDate.Replace(':', '$'),
                    instance.DBQueryInfoCmd()
                });
            }
            Dictionary <string, string> danBiDicInfo = Global.sendToDB <Dictionary <string, string>, string>(947, sCmd, client.ServerId);

            if (danBiDicInfo != null && danBiDicInfo.Count <KeyValuePair <string, string> >() > 0)
            {
                lock (this.DanBiChongZhiAwardDic)
                {
                    foreach (KeyValuePair <int, DanBiChongZhiAwardDetail> item in this.DanBiChongZhiAwardDic)
                    {
                        string key   = string.Format("{0}_{1}", item.Value.MinYuanBao, item.Value.MaxYuanBao);
                        string value = null;
                        if (danBiDicInfo.TryGetValue(key, out value))
                        {
                            string[] fileds = value.Split(new char[]
                            {
                                '_'
                            });
                            if (fileds.Length == 2)
                            {
                                int canGetCount = Convert.ToInt32(fileds[0]);
                                int getCount    = Convert.ToInt32(fileds[1]);
                                int maxCount    = item.Value.SinglePurchase;
                                if (canGetCount > getCount && getCount < maxCount)
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }