Ejemplo n.º 1
0
        public static bool TryGenerateNewHuangChengBangHui()
        {
            int  newBHid = WangChengManager.GetTheOnlyOneBangHui();
            bool result;

            if (newBHid <= 0 || WangChengManager.WangZuBHid == newBHid)
            {
                WangChengManager.LastTheOnlyOneBangHui = -1;
                result = false;
            }
            else if (WangChengManager.LastTheOnlyOneBangHui != newBHid)
            {
                WangChengManager.LastTheOnlyOneBangHui     = newBHid;
                WangChengManager.BangHuiTakeHuangGongTicks = TimeUtil.NOW();
                result = false;
            }
            else
            {
                if (WangChengManager.LastTheOnlyOneBangHui > 0)
                {
                    long ticks = TimeUtil.NOW();
                    if (ticks - WangChengManager.BangHuiTakeHuangGongTicks > (long)WangChengManager.MaxTakingHuangGongSecs)
                    {
                        WangChengManager.WangZuBHid = WangChengManager.LastTheOnlyOneBangHui;
                        WangChengManager.UpdateWangZuBHNameFromDBServer(newBHid);
                        return(true);
                    }
                }
                result = false;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static void ParseWeekDaysTimes()
        {
            string WangChengZhanWeekDays_str = GameManager.systemParamsList.GetParamValueByName("WangChengZhanWeekDays");

            if (!string.IsNullOrEmpty(WangChengZhanWeekDays_str))
            {
                string[] WangChengZhanWeekDays_fields = WangChengZhanWeekDays_str.Split(new char[]
                {
                    ','
                });
                int[] weekDays = new int[WangChengZhanWeekDays_fields.Length];
                for (int i = 0; i < WangChengZhanWeekDays_fields.Length; i++)
                {
                    weekDays[i] = Global.SafeConvertToInt32(WangChengZhanWeekDays_fields[i]);
                }
                if (weekDays.Length > 0 && weekDays[0] >= 0)
                {
                    WangChengManager.WangChengZhanWeekDaysByConfig = true;
                    WangChengManager.WangChengZhanWeekDays         = weekDays;
                }
            }
            string wangChengZhanFightingDayTimes_str = GameManager.systemParamsList.GetParamValueByName("WangChengZhanFightingDayTimes");

            WangChengManager.WangChengZhanFightingDayTimes = Global.ParseDateTimeRangeStr(wangChengZhanFightingDayTimes_str);
            WangChengManager.MaxTakingHuangGongSecs        = (int)GameManager.systemParamsList.GetParamValueIntByName("MaxTakingHuangGongSecs", -1);
            WangChengManager.MaxTakingHuangGongSecs       *= 1000;
            Global.UpdateWangChengZhanWeekDays(true);
            WangChengManager.NotifyAllWangChengMapInfoData();
        }
Ejemplo n.º 3
0
        public static string GetNextCityBattleTime()
        {
            string unKown = GLang.GetLang(43, new object[0]);
            int    day    = TimeUtil.NowDateTime().DayOfYear;
            BangHuiLingDiItemData lingDiItem = JunQiManager.GetItemByLingDiID(6);
            string result;

            if (null == lingDiItem)
            {
                result = unKown;
            }
            else
            {
                Dictionary <int, int> warRequestMap = WangChengManager.GetWarRequstMap(lingDiItem.WarRequest);
                List <DateTime>       lsDays        = new List <DateTime>();
                for (int i = 0; i < warRequestMap.Count; i++)
                {
                    DateTime dt   = TimeUtil.NowDateTime();
                    int      span = warRequestMap.Values.ElementAt(i) - day;
                    if (span >= 0)
                    {
                        dt = dt.AddDays((double)span);
                    }
                    else
                    {
                        int yearNext = dt.Year + 1;
                        dt = DateTime.Parse(string.Format("{0}-01-01", yearNext)).AddDays((double)(warRequestMap.Values.ElementAt(i) - 1));
                    }
                    lsDays.Add(dt);
                }
                lsDays.Sort(delegate(DateTime l, DateTime r)
                {
                    int result2;
                    if (l.Ticks < r.Ticks)
                    {
                        result2 = -1;
                    }
                    else if (l.Ticks > r.Ticks)
                    {
                        result2 = 1;
                    }
                    else
                    {
                        result2 = 0;
                    }
                    return(result2);
                });
                if (lsDays.Count > 0)
                {
                    DateTime nextDate = lsDays[0];
                    if (WangChengManager.WangChengZhanFightingDayTimes != null && WangChengManager.WangChengZhanFightingDayTimes.Length > 0)
                    {
                        return(lsDays[0].ToString("yyyy-MM-dd " + string.Format("{0:00}:{1:00}", WangChengManager.WangChengZhanFightingDayTimes[0].FromHour, WangChengManager.WangChengZhanFightingDayTimes[0].FromMinute)));
                    }
                }
                result = unKown;
            }
            return(result);
        }
Ejemplo n.º 4
0
        public static bool GetNextCityBattleTimeAndBangHui(out string dayTime, out string bangHuiName)
        {
            dayTime     = GLang.GetLang(43, new object[0]);
            bangHuiName = GLang.GetLang(568, new object[0]);
            int warDay;
            int bangHuiID;

            return(WangChengManager.GetNextCityBattleTimeAndBangHui(out warDay, out bangHuiID) && WangChengManager.GetWarTimeStringAndBHName(warDay, bangHuiID, out dayTime, out bangHuiName));
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 返回王城争霸的时间和申请帮会列表信息,逗号隔开
 /// </summary>
 /// <returns></returns>
 public String GetCityBattleTimeAndBangHuiListString()
 {
     if (GameManager.OPT_ChengZhanType == 0)
     {
         return(WangChengManager.GetCityBattleTimeAndBangHuiListString());
     }
     else
     {
         return(LuoLanChengZhanManager.getInstance().GetCityBattleTimeAndBangHuiListString());
     }
 }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        public static bool IsExistCityWarToday()
        {
            int day = TimeUtil.NowDateTime().DayOfYear;
            BangHuiLingDiItemData lingDiItem = JunQiManager.GetItemByLingDiID(6);
            bool result;

            if (null == lingDiItem)
            {
                result = false;
            }
            else
            {
                Dictionary <int, int> warRequestMap = WangChengManager.GetWarRequstMap(lingDiItem.WarRequest);
                result = warRequestMap.ContainsValue(day);
            }
            return(result);
        }
Ejemplo n.º 8
0
        public static bool IsInWangChengFightingTime()
        {
            DateTime now       = TimeUtil.NowDateTime();
            int      weekDayID = (int)now.DayOfWeek;
            bool     result;

            if (!WangChengManager.IsDayOfWeek(weekDayID))
            {
                result = false;
            }
            else
            {
                int endMinute = 0;
                result = Global.JugeDateTimeInTimeRange(now, WangChengManager.WangChengZhanFightingDayTimes, out endMinute, false);
            }
            return(result);
        }
Ejemplo n.º 9
0
 private static void HandleHuangChengResultEx(bool isBattleOver = false)
 {
     if (WangChengManager.WangZuBHid <= 0)
     {
         if (isBattleOver)
         {
             WangChengManager.HandleWangChengFailed();
         }
     }
     else
     {
         JunQiManager.HandleLingDiZhanResultByMapCode(6, Global.GetHuangGongMapCode(), WangChengManager.WangZuBHid, true, false);
         Global.BroadcastHuangChengOkHintEx(WangChengManager.WangZuBHName, isBattleOver);
         JunQiManager.NotifySyncBangHuiJunQiItemsDict(null);
         if (isBattleOver)
         {
             HuodongCachingMgr.UpdateHeFuWCKingBHID(WangChengManager.WangZuBHid);
         }
     }
 }
Ejemplo n.º 10
0
        public static WangChengMapInfoData FormatWangChengMapInfoData()
        {
            string nextBattleTime = GLang.GetLang(43, new object[0]);
            long   endTime        = 0L;

            if (WangChengZhanStates.None == WangChengManager.WangChengZhanState)
            {
                nextBattleTime = WangChengManager.GetNextCityBattleTime();
            }
            else
            {
                endTime = WangChengManager.GetBattleEndMs();
            }
            return(new WangChengMapInfoData
            {
                FightingEndTime = endTime,
                FightingState = (WangChengManager.WaitingHuangChengResult ? 1 : 0),
                NextBattleTime = nextBattleTime,
                WangZuBHName = WangChengManager.WangZuBHName,
                WangZuBHid = WangChengManager.WangZuBHid
            });
        }
Ejemplo n.º 11
0
        protected static void RemoveTodayInWarRequest()
        {
            int day = TimeUtil.NowDateTime().DayOfYear;
            BangHuiLingDiItemData lingDiItem = JunQiManager.GetItemByLingDiID(6);

            if (null != lingDiItem)
            {
                Dictionary <int, int> warRequestMap = WangChengManager.GetWarRequstMap(lingDiItem.WarRequest);
                if (warRequestMap.ContainsValue(day))
                {
                    for (int i = 0; i < warRequestMap.Count; i++)
                    {
                        if (warRequestMap.Values.ElementAt(i) == day)
                        {
                            warRequestMap.Remove(warRequestMap.Keys.ElementAt(i));
                            break;
                        }
                    }
                    string nowWarRequest = WangChengManager.GeWarRequstString(warRequestMap);
                    WangChengManager.SetCityWarRequestToDBServer(6, nowWarRequest);
                }
            }
        }
Ejemplo n.º 12
0
 public static void ProcessWangChengZhanResult()
 {
     Global.UpdateWangChengZhanWeekDays(false);
     if (WangChengZhanStates.None == WangChengManager.WangChengZhanState)
     {
         if (WangChengManager.IsInWangChengFightingTime())
         {
             WangChengManager.WangChengZhanState        = WangChengZhanStates.Fighting;
             WangChengManager.BangHuiTakeHuangGongTicks = TimeUtil.NOW();
             WangChengManager.WaitingHuangChengResult   = true;
             WangChengManager.NotifyAllWangChengMapInfoData();
             Global.BroadcastHuangChengBattleStart();
         }
     }
     else if (WangChengManager.IsInWangChengFightingTime())
     {
         bool ret = WangChengManager.TryGenerateNewHuangChengBangHui();
         if (ret)
         {
             WangChengManager.HandleHuangChengResultEx(false);
             WangChengManager.NotifyAllWangChengMapInfoData();
         }
         else
         {
             WangChengManager.ProcessTimeAddRoleExp();
         }
     }
     else
     {
         WangChengManager.WangChengZhanState      = WangChengZhanStates.None;
         WangChengManager.WaitingHuangChengResult = false;
         WangChengManager.TryGenerateNewHuangChengBangHui();
         WangChengManager.HandleHuangChengResultEx(true);
         WangChengManager.NotifyAllWangChengMapInfoData();
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 返回王城争霸的时间和申请帮会列表信息,逗号隔开
 /// </summary>
 /// <returns></returns>
 public String GetCityBattleTimeAndBangHuiListString()
 {
     return(WangChengManager.GetCityBattleTimeAndBangHuiListString());
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 返回最近一次的王城争霸时间
 /// </summary>
 /// <returns></returns>
 public void GetNextCityBattleTimeAndBangHui(out Boolean result, out String sTime, out String sBangHui)
 {
     result = WangChengManager.GetNextCityBattleTimeAndBangHui(out sTime, out sBangHui);
 }
Ejemplo n.º 15
0
        public static void NotifyAllWangChengMapInfoData()
        {
            WangChengMapInfoData wangChengMapInfoData = WangChengManager.FormatWangChengMapInfoData();

            GameManager.ClientMgr.NotifyAllWangChengMapInfoData(wangChengMapInfoData);
        }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
0
        public static void NotifyClientWangChengMapInfoData(GameClient client)
        {
            WangChengMapInfoData wangChengMapInfoData = WangChengManager.GetWangChengMapInfoData(client);

            GameManager.ClientMgr.NotifyWangChengMapInfoData(client, wangChengMapInfoData);
        }
Ejemplo n.º 18
0
        public static string GetCityBattleTimeAndBangHuiListString()
        {
            string result;

            if (WangChengManager.WangChengZhanFightingDayTimes == null || WangChengManager.WangChengZhanFightingDayTimes.Length <= 0)
            {
                result = "";
            }
            else
            {
                int day = TimeUtil.NowDateTime().DayOfYear;
                BangHuiLingDiItemData lingDiItem = JunQiManager.GetItemByLingDiID(6);
                if (null == lingDiItem)
                {
                    result = "";
                }
                else
                {
                    Dictionary <int, int> warRequestMap = WangChengManager.GetWarRequstMap(lingDiItem.WarRequest);
                    List <DateTime>       lsDays        = new List <DateTime>();
                    for (int i = 0; i < warRequestMap.Count; i++)
                    {
                        DateTime dt   = TimeUtil.NowDateTime();
                        int      span = warRequestMap.Values.ElementAt(i) - day;
                        if (span >= 0)
                        {
                            dt = dt.AddDays((double)span);
                        }
                        else
                        {
                            int yearNext = dt.Year + 1;
                            dt = DateTime.Parse(string.Format("{0}-01-01", yearNext)).AddDays((double)(warRequestMap.Values.ElementAt(i) - 1));
                        }
                        lsDays.Add(dt);
                    }
                    lsDays.Sort(delegate(DateTime l, DateTime r)
                    {
                        int result2;
                        if (l.Ticks < r.Ticks)
                        {
                            result2 = -1;
                        }
                        else if (l.Ticks > r.Ticks)
                        {
                            result2 = 1;
                        }
                        else
                        {
                            result2 = 0;
                        }
                        return(result2);
                    });
                    string timeBangHuiString = "";
                    int    index             = 0;
                    while (index < lsDays.Count && index < 10)
                    {
                        int dayID = lsDays[index].DayOfYear;
                        for (int i = 0; i < warRequestMap.Count; i++)
                        {
                            if (dayID == warRequestMap.Values.ElementAt(i))
                            {
                                int    bangHuiID = warRequestMap.Keys.ElementAt(i);
                                string strTime;
                                string strBH;
                                WangChengManager.GetWarTimeStringAndBHName(dayID, bangHuiID, out strTime, out strBH);
                                if (timeBangHuiString.Length > 0)
                                {
                                    timeBangHuiString += ",";
                                }
                                timeBangHuiString += string.Format("{0},{1}", strTime, strBH);
                                break;
                            }
                        }
                        index++;
                    }
                    result = timeBangHuiString;
                }
            }
            return(result);
        }
Ejemplo n.º 19
0
 public static WangChengMapInfoData GetWangChengMapInfoData(GameClient client)
 {
     return(WangChengManager.FormatWangChengMapInfoData());
 }
Ejemplo n.º 20
0
        public static bool GetNextCityBattleTimeAndBangHui(out int dayID, out int bangHuiID)
        {
            dayID     = -1;
            bangHuiID = -1;
            int day = TimeUtil.NowDateTime().DayOfYear;
            BangHuiLingDiItemData lingDiItem = JunQiManager.GetItemByLingDiID(6);
            bool result;

            if (null == lingDiItem)
            {
                result = false;
            }
            else
            {
                Dictionary <int, int> warRequestMap = WangChengManager.GetWarRequstMap(lingDiItem.WarRequest);
                List <DateTime>       lsDays        = new List <DateTime>();
                for (int i = 0; i < warRequestMap.Count; i++)
                {
                    DateTime dt   = TimeUtil.NowDateTime();
                    int      span = warRequestMap.Values.ElementAt(i) - day;
                    if (span >= 0)
                    {
                        dt = dt.AddDays((double)span);
                    }
                    else
                    {
                        int yearNext = dt.Year + 1;
                        dt = DateTime.Parse(string.Format("{0}-01-01", yearNext)).AddDays((double)(warRequestMap.Values.ElementAt(i) - 1));
                    }
                    lsDays.Add(dt);
                }
                lsDays.Sort(delegate(DateTime l, DateTime r)
                {
                    int result2;
                    if (l.Ticks < r.Ticks)
                    {
                        result2 = -1;
                    }
                    else if (l.Ticks > r.Ticks)
                    {
                        result2 = 1;
                    }
                    else
                    {
                        result2 = 0;
                    }
                    return(result2);
                });
                if (lsDays.Count > 0)
                {
                    DateTime nextDate = lsDays[0];
                    if (WangChengManager.WangChengZhanFightingDayTimes != null && WangChengManager.WangChengZhanFightingDayTimes.Length > 0)
                    {
                        dayID = nextDate.DayOfYear;
                        for (int i = 0; i < warRequestMap.Count; i++)
                        {
                            if (dayID == warRequestMap.Values.ElementAt(i))
                            {
                                bangHuiID = warRequestMap.Keys.ElementAt(i);
                                return(true);
                            }
                        }
                        return(false);
                    }
                }
                result = false;
            }
            return(result);
        }