Пример #1
0
 private static void HandleHuangChengResult()
 {
     if (HuangChengManager.HuangDiRoleID <= 0)
     {
         HuangChengManager.HandleHuangChengFailed();
     }
     else
     {
         GameClient otherClient = GameManager.ClientMgr.FindClient(HuangChengManager.HuangDiRoleID);
         if (null == otherClient)
         {
             HuangChengManager.HandleHuangChengFailed();
         }
         else if (otherClient.ClientData.Faction <= 0)
         {
             HuangChengManager.HandleHuangChengFailed();
         }
         else if (otherClient.ClientData.BHZhiWu != 1)
         {
             HuangChengManager.HandleHuangChengFailed();
         }
         else
         {
             JunQiManager.HandleLingDiZhanResultByMapCode(2, Global.GetHuangChengMapCode(), otherClient.ClientData.Faction, true, false);
             HuangChengManager.ProcessHuangChengFightingEndAwards(otherClient.ClientData.Faction);
             Global.BroadcastHuangChengOkHint(otherClient);
             JunQiManager.NotifySyncBangHuiJunQiItemsDict(null);
         }
     }
 }
Пример #2
0
 private static void HandleHuangChengFailed()
 {
     JunQiManager.HandleLingDiZhanResultByMapCode(2, Global.GetHuangChengMapCode(), 0, true, false);
     HuangChengManager.ProcessHuangChengFightingEndAwards(-1);
     Global.BroadcastHuangChengFailedHint();
     JunQiManager.NotifySyncBangHuiJunQiItemsDict(null);
 }
Пример #3
0
 public static void HandleOutMapHuangDiRoleChanging()
 {
     if (HuangChengManager.HuangDiRoleID > 0)
     {
         GameClient client = GameManager.ClientMgr.FindClient(HuangChengManager.HuangDiRoleID);
         if (client == null || client.ClientData.MapCode != Global.GetHuangChengMapCode())
         {
             HuangChengManager.HandleDeadHuangDiRoleChanging(null);
         }
     }
 }
Пример #4
0
 public static void HandleLeaveMapHuangDiRoleChanging(GameClient client)
 {
     if (HuangChengManager.HuangDiRoleID > 0)
     {
         if (client.ClientData.RoleID == HuangChengManager.HuangDiRoleID)
         {
             if (HuangChengManager.WaitingHuangChengResult)
             {
                 HuangChengManager.HandleDeadHuangDiRoleChanging(null);
             }
         }
     }
 }
Пример #5
0
        /// <summary>
        /// 处理拥有皇帝特效的角色死亡,而失去皇帝特效的事件
        /// </summary>
        public static void HandleDeadHuangDiRoleChanging(GameClient client)
        {
            if (null != client)
            {
                if (client.ClientData.RoleID != HuangDiRoleID)
                {
                    return;
                }

                if ((int)LingDiIDs.HuangCheng != JunQiManager.GetLingDiIDBy2MapCode(client.ClientData.MapCode))
                {
                    return;
                }

                if (!IsInHuangChengFightingTime())
                {
                    return;
                }

                //皇帝产生了
                if (!WaitingHuangChengResult)
                {
                    return;
                }
            }

            int oldHuangDiRoleID = 0;

            //先锁定互斥,防止重复安插的操作
            lock (HuangChengManager.SheLiZhiYuanMutex)
            {
                //处理提取舍利之源的操作
                oldHuangDiRoleID = HuangChengManager.ProcessTakeSheLiZhiYuan(0, "", "");
            }

            if (oldHuangDiRoleID > 0)
            {
                GameClient oldClient = GameManager.ClientMgr.FindClient(oldHuangDiRoleID);
                if (null != oldClient)
                {
                    //从buffer数据到列表删除指定的临时Buffer
                    Global.RemoveBufferData(oldClient, (int)BufferItemTypes.SheLiZhiYuan);
                }
            }

            //通知在线的所有人(不限制地图)皇帝角色ID变更消息
            GameManager.ClientMgr.NotifyAllChgHuangDiRoleIDMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, oldHuangDiRoleID, HuangChengManager.GetHuangDiRoleID());

            //通知地图数据变更信息
            NotifyAllHuangChengMapInfoData();
        }
Пример #6
0
        public bool GotoMap(GameClient client, int toMapCode, int toPosX = -1, int toPosY = -1, int direction = -1)
        {
            bool ret = false;

            if (null != client)
            {
                if (client.ClientData.CurrentLifeV <= 0)
                {
                    return(ret);
                }
                int oldMapCode = client.ClientData.MapCode;
                if (JunQiManager.GetLingDiIDBy2MapCode(client.ClientData.MapCode) == 2)
                {
                    HuangChengManager.HandleLeaveMapHuangDiRoleChanging(client);
                }
                if (!Global.CanEnterIfMapIsGuMu(client, toMapCode))
                {
                    return(false);
                }
                if (toMapCode < 0)
                {
                    GameManager.ClientMgr.NotifyOthersGoBack(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toPosX, toPosY, direction);
                }
                else
                {
                    bool execGoToMap = true;
                    if (JunQiManager.GetLingDiIDBy2MapCode(toMapCode) > 0 && toMapCode != GameManager.MainMapCode)
                    {
                    }
                    if (execGoToMap)
                    {
                        GameMap gameMap = null;
                        if (GameManager.MapMgr.DictMaps.TryGetValue(toMapCode, out gameMap))
                        {
                            ret = true;
                            if (oldMapCode != toMapCode)
                            {
                                GameManager.ClientMgr.NotifyChangeMap(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toMapCode, toPosX, toPosY, direction, 0);
                            }
                            else
                            {
                                client.ClientData.CurrentAction = 0;
                                GameManager.ClientMgr.NotifyOthersGoBack(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toPosX, toPosY, direction);
                            }
                            Global.UpdateDayActivityEnterCountToDB(client, client.ClientData.RoleID, TimeUtil.NowDateTime().DayOfYear, 6, 1);
                        }
                    }
                }
            }
            return(ret);
        }
Пример #7
0
        public static int ProcessTakeSheLiZhiYuan(int roleID, string roleName, string bhName, bool sendToOtherLine = true)
        {
            int oldHuangDiRoleID = HuangChengManager.HuangDiRoleID;

            HuangChengManager.HuangDiRoleID    = roleID;
            HuangChengManager.HuangDiRoleName  = roleName;
            HuangChengManager.HuangDiBHName    = bhName;
            HuangChengManager.HuangDiRoleTicks = TimeUtil.NOW();
            if (sendToOtherLine)
            {
                HuangChengManager.NotifySyncHuanDiRoleInfo(oldHuangDiRoleID, roleID, roleName, bhName);
            }
            return(oldHuangDiRoleID);
        }
Пример #8
0
        /// <summary>
        /// 加载参数配置文件
        /// </summary>
        /// <returns></returns>
        private static int ReloadXmlFile_config_systemparams()
        {
            int ret = GameManager.systemParamsList.ReloadLoadParamsList();

            //解析插旗战的日期和时间
            JunQiManager.ParseWeekDaysTimes();

            //解析皇城战的日期和时间
            HuangChengManager.ParseWeekDaysTimes();

            //解析王城战的日期和时间
            WangChengManager.ParseWeekDaysTimes();

            //重置皇城地图编号
            Global.ResetHuangChengMapCode();

            //重置皇宫的地图编号
            Global.ResetHuangGongMapCode();

            //坐骑的名称
            Global.HorseNamesList = null;

            //坐骑的速度
            Global.HorseSpeedList = null;

            //生肖竞猜配置
            GameManager.ShengXiaoGuessMgr.ReloadConfig();

            //古墓配置
            Global.InitGuMuMapCodes();
            Global.InitVipGumuExpMultiple();

            //充值限制掉落的时间项
            GameManager.GoodsPackMgr.ResetLimitTimeRange();

            //缓存的二锅头物品列表
            Global.ErGuoTouGoodsIDList = null;

            //绑定铜钱符每日使用次数列表缓存
            Global._VipUseBindTongQianGoodsIDNum = null;

            //自动给予的物品的
            GameManager.AutoGiveGoodsIDList = null;

            //加载采集配置
            CaiJiLogic.LoadConfig();

            return(ret);
        }
Пример #9
0
        public static HuangChengMapInfoData GetHuangChengMapInfoData(GameClient client)
        {
            int lingDiID = JunQiManager.GetLingDiIDBy2MapCode(client.ClientData.MapCode);
            HuangChengMapInfoData result;

            if (lingDiID != 2)
            {
                result = null;
            }
            else
            {
                result = HuangChengManager.FormatHuangChengMapInfoData();
            }
            return(result);
        }
Пример #10
0
        public static bool IsInHuangChengFightingTime()
        {
            DateTime now       = TimeUtil.NowDateTime();
            int      weekDayID = (int)now.DayOfWeek;
            bool     result;

            if (!HuangChengManager.IsDayOfWeek(weekDayID))
            {
                result = false;
            }
            else
            {
                int endMinute = 0;
                result = Global.JugeDateTimeInTimeRange(now, HuangChengManager.HuangChengZhanFightingDayTimes, out endMinute, false);
            }
            return(result);
        }
Пример #11
0
 public static void ProcessHuangChengZhanResult()
 {
     if (Global.GetBangHuiFightingLineID() == GameManager.ServerLineID)
     {
         if (HuangChengZhanStates.None == HuangChengManager.HuangChengZhanState)
         {
             if (HuangChengManager.IsInHuangChengFightingTime())
             {
                 HuangChengManager.HuangChengZhanState     = HuangChengZhanStates.Fighting;
                 HuangChengManager.HuangDiRoleTicks        = TimeUtil.NOW();
                 HuangChengManager.WaitingHuangChengResult = true;
                 HuangChengManager.NotifyAllHuangChengMapInfoData();
                 HuangChengManager.HandleOutMapHuangDiRoleChanging();
             }
         }
         else if (HuangChengManager.IsInHuangChengFightingTime())
         {
             if (HuangChengManager.WaitingHuangChengResult)
             {
                 HuangChengManager.HandleOutMapHuangDiRoleChanging();
                 if (HuangChengManager.HuangDiRoleID > 0)
                 {
                     long ticks = TimeUtil.NOW();
                     if (ticks - HuangChengManager.HuangDiRoleTicks > (long)HuangChengManager.MaxHavingSheLiZhiYuanSecs)
                     {
                         HuangChengManager.WaitingHuangChengResult = false;
                         HuangChengManager.HandleHuangChengResult();
                         HuangChengManager.NotifyAllHuangChengMapInfoData();
                     }
                 }
             }
         }
         else
         {
             HuangChengManager.HuangChengZhanState = HuangChengZhanStates.None;
             if (HuangChengManager.WaitingHuangChengResult)
             {
                 HuangChengManager.WaitingHuangChengResult = false;
                 HuangChengManager.HandleHuangChengResult();
                 HuangChengManager.NotifyAllHuangChengMapInfoData();
             }
         }
     }
 }
Пример #12
0
        private static void ProcessRoleBangGongAwards(GameClient client, bool success)
        {
            int bangGong = HuangChengManager.GetBangGongAwards(client, success);

            if (bangGong > 0)
            {
                if (GameManager.ClientMgr.AddBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ref bangGong, AddBangGongTypes.None, 0))
                {
                    if (0 != bangGong)
                    {
                        GameManager.logDBCmdMgr.AddDBLogInfo(-1, "战功", "皇城战结束时的奖励", "系统", client.ClientData.RoleName, "增加", bangGong, 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,
                    bangGong
                }), EventLevels.Record);
            }
        }
Пример #13
0
        public static void HandleDeadHuangDiRoleChanging(GameClient client)
        {
            if (null != client)
            {
                if (client.ClientData.RoleID != HuangChengManager.HuangDiRoleID)
                {
                    return;
                }
                if (2 != JunQiManager.GetLingDiIDBy2MapCode(client.ClientData.MapCode))
                {
                    return;
                }
                if (!HuangChengManager.IsInHuangChengFightingTime())
                {
                    return;
                }
                if (!HuangChengManager.WaitingHuangChengResult)
                {
                    return;
                }
            }
            int oldHuangDiRoleID = 0;

            lock (HuangChengManager.SheLiZhiYuanMutex)
            {
                oldHuangDiRoleID = HuangChengManager.ProcessTakeSheLiZhiYuan(0, "", "", true);
            }
            if (oldHuangDiRoleID > 0)
            {
                GameClient oldClient = GameManager.ClientMgr.FindClient(oldHuangDiRoleID);
                if (null != oldClient)
                {
                    Global.RemoveBufferData(oldClient, 14);
                }
            }
            GameManager.ClientMgr.NotifyAllChgHuangDiRoleIDMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, oldHuangDiRoleID, HuangChengManager.GetHuangDiRoleID());
            HuangChengManager.NotifyAllHuangChengMapInfoData();
        }
Пример #14
0
        private static void ProcessHuangChengFightingEndAwards(int huangDiBHID)
        {
            List <object> objsList = GameManager.ClientMgr.GetMapClients(Global.GetHuangChengMapCode());

            if (null != objsList)
            {
                long nowTicks = TimeUtil.NOW();
                for (int i = 0; i < objsList.Count; i++)
                {
                    GameClient c = objsList[i] as GameClient;
                    if (c != null)
                    {
                        if (c.ClientData.CurrentLifeV > 0)
                        {
                            if (HuangChengManager.CanGetAWards(c, nowTicks))
                            {
                                HuangChengManager.ProcessRoleExperienceAwards(c, huangDiBHID == c.ClientData.Faction);
                                HuangChengManager.ProcessRoleBangGongAwards(c, huangDiBHID == c.ClientData.Faction);
                            }
                        }
                    }
                }
            }
        }
Пример #15
0
        /// <summary>
        /// 传送到地图,toMapCode 小于0 或者等于当前地图id,则进行本地图移动
        /// </summary>
        /// <param name="client"></param>
        /// <param name="toMapCode"></param>
        /// <returns></returns>
        public Boolean GotoMap(GameClient client, int toMapCode, int toPosX = -1, int toPosY = -1, int direction = -1)
        {
            Boolean ret = false;

            //传送到某个地图上去
            if (null != client)
            {
                if (client.ClientData.CurrentLifeV <= 0) //如果已经死亡,则不允许传送
                {
                    return(ret);
                }

                int oldMapCode = client.ClientData.MapCode;

                if (JunQiManager.GetLingDiIDBy2MapCode(client.ClientData.MapCode) == (int)LingDiIDs.HuangCheng) //如果现在是皇城,则判断是否收回舍利
                {
                    //处理拥有皇帝特效的角色离开皇城地图,而失去皇帝特效的事件
                    HuangChengManager.HandleLeaveMapHuangDiRoleChanging(client);
                }

                if (!Global.CanEnterIfMapIsGuMu(client, toMapCode))//古墓挂机地图过滤判断
                {
                    return(false);
                }

                //如果小于0,则回到当前地图
                if (toMapCode < 0) //回当前图
                {
                    GameManager.ClientMgr.NotifyOthersGoBack(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toPosX, toPosY, direction);
                }
                else
                {
                    bool execGoToMap = true;
                    if (JunQiManager.GetLingDiIDBy2MapCode(toMapCode) > 0 && toMapCode != GameManager.MainMapCode) //如果是要进入领地的地图
                    {
                        /*
                         * if (Global.GetBangHuiFightingLineID() != GameManager.ServerLineID)
                         * {
                         *  execGoToMap = false;
                         *
                         *  string mapName = Global.GetMapName(toMapCode);
                         *  GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                         *      client, StringUtil.substitute(Global.GetLang("只有从『{0}』线才能进入『{1}』地图"), Global.GetBangHuiFightingLineID(), mapName),
                         *      GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox);
                         * }
                         */
                    }

                    if (execGoToMap)
                    {
                        GameMap gameMap = null;
                        if (GameManager.MapMgr.DictMaps.TryGetValue(toMapCode, out gameMap)) //确认地图编号是否有效
                        {
                            ret = true;

                            //如果不同地图,就进行地图切换传送
                            if (oldMapCode != toMapCode)
                            {
                                GameManager.ClientMgr.NotifyChangeMap(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                      client, toMapCode, toPosX, toPosY, direction);
                            }
                            else
                            {
                                //如果在同一个地图,就进行位置移动
                                GameManager.ClientMgr.NotifyOthersGoBack(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toPosX, toPosY, direction);
                            }
                            //保存到数据库
                            Global.UpdateDayActivityEnterCountToDB(client, client.ClientData.RoleID, DateTime.Now.DayOfYear, (int)SpecialActivityTypes.OldBattlefield, 1);
                        }
                    }
                }
            }

            return(ret);
        }
Пример #16
0
        private static void ProcessRoleExperienceAwards(GameClient client, bool success)
        {
            int experience = HuangChengManager.GetExperienceAwards(client, success);

            GameManager.ClientMgr.ProcessRoleExperience(client, (long)experience, true, false, false, "none");
        }
Пример #17
0
        /// <summary>
        /// 加载参数配置文件
        /// </summary>
        /// <returns></returns>
        private static int ReloadXmlFile_config_systemparams()
        {
            int ret = GameManager.systemParamsList.ReloadLoadParamsList();

            //解析插旗战的日期和时间
            JunQiManager.ParseWeekDaysTimes();

            if (GameManager.OPT_ChengZhanType == 0)
            {
                //解析皇城战的日期和时间
                HuangChengManager.ParseWeekDaysTimes();

                //解析王城战的日期和时间
                WangChengManager.ParseWeekDaysTimes();
            }

            //重新读取罗兰城战配置文件
            LuoLanChengZhanManager.getInstance().InitConfig();

            //重置皇城地图编号
            Global.ResetHuangChengMapCode();

            //重置皇宫的地图编号
            Global.ResetHuangGongMapCode();

            //坐骑的名称
            Global.HorseNamesList = null;

            //坐骑的速度
            Global.HorseSpeedList = null;

            //生肖竞猜配置
            GameManager.ShengXiaoGuessMgr.ReloadConfig();

            //古墓配置
            Global.InitGuMuMapCodes();
            Global.InitVipGumuExpMultiple();

            //充值限制掉落的时间项
            GameManager.GoodsPackMgr.ResetLimitTimeRange();

            //缓存的二锅头物品列表
            Global.ErGuoTouGoodsIDList = null;

            //绑定铜钱符每日使用次数列表缓存
            Global._VipUseBindTongQianGoodsIDNum = null;

            //自动给予的物品的
            GameManager.AutoGiveGoodsIDList = null;

            //加载采集配置
            CaiJiLogic.LoadConfig();

            // 加载魔剑士静态数据 [XSea 2015/4/14]
            GameManager.MagicSwordMgr.LoadMagicSwordData();

            // 加载梅林魔法书静态数据 [XSea 2015/6/19]
            GameManager.MerlinMagicBookMgr.LoadMerlinSystemParamsConfigData();

            // LogGoods
            Global.LoadItemLogMark();

            // logTradeGoods
            Global.LoadLogTradeGoods();

            //强化最大等级相关配置
            Global.LoadForgeSystemParams();

            // 副本惩罚时间
            KuaFuManager.getInstance().InitCopyTime();

            // 魂石精华的经验配置
            SoulStoneManager.Instance().LoadJingHuaExpConfig();

            // 加载需要记录日志的怪物
            MonsterAttackerLogManager.Instance().LoadRecordMonsters();

            // 玩家创建角色限制管理
            CreateRoleLimitManager.Instance().LoadConfig();

            SpeedUpTickCheck.Instance().LoadConfig();

            NameManager.Instance().LoadConfig();

            CoupleArenaManager.Instance().InitSystenParams();

            return(ret);
        }
Пример #18
0
        public static void NotifyAllHuangChengMapInfoData()
        {
            HuangChengMapInfoData huangChengMapInfoData = HuangChengManager.FormatHuangChengMapInfoData();

            GameManager.ClientMgr.NotifyAllHuangChengMapInfoData(Global.GetHuangChengMapCode(), huangChengMapInfoData);
        }