public void AddCopyScene(GameClient client, CopyMap copyMap, SceneUIClasses sceneType) { if (copyMap.MapCode == this.MapCode) { int fuBenSeqId = copyMap.FuBenSeqID; int mapCode = copyMap.MapCode; lock (this.copyDict) { MoRiJudgeCopy copy = null; if (!this.copyDict.TryGetValue(fuBenSeqId, out copy)) { copy = new MoRiJudgeCopy(); copy.MyCopyMap = copyMap; copy.GameId = Global.GetClientKuaFuServerLoginData(client).GameId; copy.StateTimeData.GameType = 3; copy.StartTime = TimeUtil.NowDateTime(); copy.EndTime = copy.StartTime.AddMinutes((double)this.CopyMaxAliveMinutes); copy.LimitKillCount = 0; copy.RoleCount = 1; copy.Passed = false; this.copyDict[fuBenSeqId] = copy; } else { copy.RoleCount++; } } FuBenManager.AddFuBenSeqID(client.ClientData.RoleID, copyMap.FuBenSeqID, 0, copyMap.FubenMapID); copyMap.IsKuaFuCopy = true; copyMap.SetRemoveTicks(TimeUtil.NOW() + (long)((this.CopyMaxAliveMinutes + 3) * 60000)); GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, 3); } }
/// <summary> /// 添加副本 /// </summary> /// <param name="client"></param> /// <param name="copyMap"></param> /// <param name="sceneType"></param> public void AddCopyScenes(GameClient client, CopyMap copyMap, SceneUIClasses sceneType) { if (sceneType != SceneUIClasses.CoupleArena) { return; } int fuBenSeqId = copyMap.FuBenSeqID; int mapCode = copyMap.MapCode; lock (Mutex) { CoupleArenaCopyScene scene = null; if (!this.FuBenSeq2CopyScenes.TryGetValue(fuBenSeqId, out scene)) { scene = new CoupleArenaCopyScene(); scene.GameId = (int)Global.GetClientKuaFuServerLoginData(client).GameId; scene.FuBenSeq = fuBenSeqId; scene.MapCode = mapCode; scene.CopyMap = copyMap; FuBenSeq2CopyScenes[fuBenSeqId] = scene; } scene.EnterRoleSide[client.ClientData.RoleID] = client.ClientData.BattleWhichSide; copyMap.IsKuaFuCopy = true; copyMap.SetRemoveTicks(TimeUtil.NOW() + (WarCfg.WaitSec + WarCfg.FightSec + WarCfg.ClearSec + 120) * TimeUtil.SECOND); GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, (int)GameTypes.CoupleArena); } }
/// <summary> /// 返回声望勋章数据 /// </summary> /// <returns></returns> public static PrestigeMedalData GetPrestigeMedalData(GameClient client) { // 如果1.4.1的功能没开放 if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot4Dot1)) { return(null); } //开放等级 声望4阶 if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.PrestigeMedal)) { return(null); } PrestigeMedalData prestigeMedalData = client.ClientData.prestigeMedalData; if (prestigeMedalData == null) { PrestigeMedalBasicData basic = null; prestigeMedalData = new PrestigeMedalData(); List <int> data = Global.GetRoleParamsIntListFromDB(client, RoleParamName.PrestigeMedal); if (data == null || data.Count <= 0) { basic = GetPrestigeMedalBasicDataByID(_defaultMedalID); prestigeMedalData.RoleID = client.ClientData.RoleID; prestigeMedalData.MedalID = basic.MedalID; ModifyPrestigeMedalData(client, prestigeMedalData, true); } else { prestigeMedalData.RoleID = client.ClientData.RoleID; prestigeMedalData.MedalID = data[0]; prestigeMedalData.LifeAdd = data[1]; prestigeMedalData.AttackAdd = data[2]; prestigeMedalData.DefenseAdd = data[3]; prestigeMedalData.HitAdd = data[4]; if (prestigeMedalData.MedalID > _prestigeMedalBasicList.Count) { prestigeMedalData.UpResultType = 3; basic = GetPrestigeMedalBasicDataByID(_prestigeMedalBasicList.Count); } else { basic = GetPrestigeMedalBasicDataByID(prestigeMedalData.MedalID); } } prestigeMedalData.Diamond = GetPrestigeMedalDiamond(client, GetPrestigeMedalUpCount(client)); prestigeMedalData.Prestige = basic.PrestigeCost; client.ClientData.prestigeMedalData = prestigeMedalData; } prestigeMedalData.PrestigeLeft = GameManager.ClientMgr.GetShengWangValue(client); return(prestigeMedalData); }
private bool IsGongNengOpened(GameClient client, bool bHint = true) { if (!GameManager.VersionSystemOpenMgr.IsVersionSystemOpen(VersionSystemOpenKey.MoRiJudge)) { return(false); } return(GlobalNew.IsGongNengOpened(client, GongNengIDs.MoRiJudge, bHint)); }
/// <summary> /// 处理塔罗牌升级或激活 /// </summary> /// <param name="client"></param> /// <param name="goodID"></param> /// <param name="partCount"></param> /// <returns></returns> public ETarotResult ProcessTarotUpCmd(GameClient client, int goodID) { //判断功能是否开启 if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.TarotCard)) { return(ETarotResult.NotOpen); } TarotSystemData tarotData = client.ClientData.TarotData; //获取要升级的塔罗牌数据 TarotCardData currentTarot = tarotData.TarotCardDatas.Find(x => x.GoodId == goodID); if (currentTarot == null) { //激活 currentTarot = new TarotCardData(); currentTarot.GoodId = goodID; tarotData.TarotCardDatas.Add(currentTarot); } //判断是否可以升级 if (currentTarot.Level >= TarotMaxLevelDict[goodID]) { return(ETarotResult.MaxLevel); } //获取下级塔罗牌对应配置模板 TarotTemplate nextTemp = TarotTemplates.Find(x => x.GoodsID == goodID && x.Level == currentTarot.Level + 1); if (nextTemp == null) { return(ETarotResult.Error); } //判断背包碎片是否足够 var hasPartCount = Global.GetTotalGoodsCountByID(client, nextTemp.NeedGoodID); if (hasPartCount < nextTemp.NeedPartCount) { return(ETarotResult.NeedPart); } //使用物品 优先使用绑定物品 bool usedBinding = false; bool usedTimeLimited = false; if (Global.UseGoodsBindOrNot(client, nextTemp.NeedGoodID, nextTemp.NeedPartCount, true, out usedBinding, out usedTimeLimited) < 1) { return(ETarotResult.NeedPart); } //处理升级 currentTarot.Level += 1; //更新玩家数据 UpdataPalyerTarotAttr(client); //向DB服更新数据 UpdateTarotData2DB(client, currentTarot, null); return(ETarotResult.Success); }
private string GetItemName(string strGoods) { try { return(Global.GetGoodsName(GlobalNew.ParseGoodsData(strGoods))); } catch { } return("道具"); }
public static void initSetPrestigeMedalProps(GameClient client) { if (!GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot4Dot1)) { if (GlobalNew.IsGongNengOpened(client, GongNengIDs.PrestigeMedal, false)) { PrestigeMedalData PrestigeMedalData = PrestigeMedalManager.GetPrestigeMedalData(client); PrestigeMedalManager.SetPrestigeMedalProps(client, PrestigeMedalData); } } }
public static bool IfZhuHunPerfect(GameClient client) { bool result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.WingZhuHun, false)) { result = false; } else { ZhuLingZhuHunLimit i = ZhuLingZhuHunManager.GetLimit(client.ClientData.MyWingData.WingID); result = (i != null && client.ClientData.MyWingData.ZhuHunNum >= i.ZhuHunLimit); } return(result); }
/// <summary> /// 设置塔罗牌上阵位置 (0=为上阵) /// </summary> /// <param name="client"></param> /// <param name="goodID"></param> /// <param name="pos"></param> /// <returns></returns> public ETarotResult ProcessSetTarotPosCmd(GameClient client, int goodID, byte pos) { //判断功能是否开启 if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.TarotCard)) { return(ETarotResult.NotOpen); } //判断位置是否合法 if (pos < 0 || pos > 6) { return(ETarotResult.Error); } TarotSystemData tarotData = client.ClientData.TarotData; //获取塔罗牌数据 TarotCardData currentTarot = tarotData.TarotCardDatas.Find(x => x.GoodId == goodID); if (currentTarot == null) { return(ETarotResult.Error); } if (currentTarot.Postion == pos) { return(ETarotResult.Error); } //上阵 if (pos > 0) { //判断当前卡牌是否已在阵上 if (currentTarot.Postion > 0) { return(ETarotResult.Error); } //判断装备的位置是否为空 TarotCardData targetTarot = tarotData.TarotCardDatas.Find(x => x.Postion == pos); if (targetTarot != null) { targetTarot.Postion = 0; } } currentTarot.Postion = pos; //更新玩家塔罗牌加成属性 UpdataPalyerTarotAttr(client); //向DB服更新数据 UpdateTarotData2DB(client, currentTarot, null); return(ETarotResult.Success); }
public static bool HasFinishedPreTask(GameClient client, SystemXmlItem fubenItem) { bool result; if (client == null || fubenItem == null) { result = false; } else { int copyTab = fubenItem.GetIntValue("TabID", -1); int needTask = GlobalNew.GetFuBenTabNeedTask(copyTab); result = (needTask <= client.ClientData.MainTaskID); } return(result); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = true; GongNengIDs gongnengId = (GongNengIDs)Convert.ToInt32(arg); if (!GlobalNew.IsGongNengOpened(client, gongnengId, false)) { bOK = false; } if (!bOK) { failedMsg = string.Format("物品对应的功能没有开启", new object[0]); } return(bOK); }
/// <summary> /// 是否完成了副本的前置任务 /// </summary> public static bool HasFinishedPreTask(GameClient client, SystemXmlItem fubenItem) { if (client == null || fubenItem == null) { return(false); } int copyTab = fubenItem.GetIntValue("TabID"); int needTask = GlobalNew.GetFuBenTabNeedTask(copyTab); if (needTask > client.ClientData.MainTaskID) { return(false); } return(true); }
public static bool IsGongNengOpened(GameClient client) { // 如果2.0的功能没开放 if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System2Dot0)) { return(false); } if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.PetSkill)) { return(false); } if (!GameManager.VersionSystemOpenMgr.IsVersionSystemOpen(VersionSystemOpenKey.PetSkill)) { return(false); } return(true); }
public TarotManager.ETarotResult ProcessSetTarotPosCmd(GameClient client, int goodID, byte pos) { TarotManager.ETarotResult result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.TarotCard, false)) { result = TarotManager.ETarotResult.NotOpen; } else if (pos < 0 || pos > 6) { result = TarotManager.ETarotResult.Error; } else { TarotSystemData tarotData = client.ClientData.TarotData; TarotCardData currentTarot = tarotData.TarotCardDatas.Find((TarotCardData x) => x.GoodId == goodID); if (currentTarot == null) { result = TarotManager.ETarotResult.Error; } else if (currentTarot.Postion == pos) { result = TarotManager.ETarotResult.Error; } else { if (pos > 0) { if (currentTarot.Postion > 0) { return(TarotManager.ETarotResult.Error); } TarotCardData targetTarot = tarotData.TarotCardDatas.Find((TarotCardData x) => x.Postion == pos); if (targetTarot != null) { targetTarot.Postion = 0; } } currentTarot.Postion = pos; this.UpdataPalyerTarotAttr(client); TarotManager.UpdateTarotData2DB(client, currentTarot, null); result = TarotManager.ETarotResult.Success; } } return(result); }
/// <summary> /// 设置声望勋章属性 /// </summary> /// <param name="client"></param> public static void initSetPrestigeMedalProps(GameClient client) { // 如果1.4.1的功能没开放 if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot4Dot1)) { return; } //开放等级 声望4阶 if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.PrestigeMedal)) { return; } PrestigeMedalData PrestigeMedalData = GetPrestigeMedalData(client); SetPrestigeMedalProps(client, PrestigeMedalData); }
public TarotManager.ETarotResult ProcessTarotUpCmd(GameClient client, int goodID) { TarotManager.ETarotResult result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.TarotCard, false)) { result = TarotManager.ETarotResult.NotOpen; } else { TarotSystemData tarotData = client.ClientData.TarotData; TarotCardData currentTarot = tarotData.TarotCardDatas.Find((TarotCardData x) => x.GoodId == goodID); if (currentTarot == null) { currentTarot = new TarotCardData(); currentTarot.GoodId = goodID; tarotData.TarotCardDatas.Add(currentTarot); } if (currentTarot.Level >= TarotManager.TarotMaxLevelDict[goodID]) { result = TarotManager.ETarotResult.MaxLevel; } else { TarotManager.TarotTemplate nextTemp = TarotManager.TarotTemplates.Find((TarotManager.TarotTemplate x) => x.GoodsID == goodID && x.Level == currentTarot.Level + 1); if (nextTemp == null) { result = TarotManager.ETarotResult.Error; } else if (currentTarot.TarotMoney < nextTemp.NeedPartCount) { result = TarotManager.ETarotResult.NeedPart; } else { currentTarot.TarotMoney -= nextTemp.NeedPartCount; currentTarot.Level++; this.UpdataPalyerTarotAttr(client); TarotManager.UpdateTarotData2DB(client, currentTarot, null); result = TarotManager.ETarotResult.Success; } } } return(result); }
// 添加一个末日审判副本 public void AddCopyScene(GameClient client, CopyMap copyMap, SceneUIClasses sceneType) { if (copyMap.MapCode == this.MapCode) { int fuBenSeqId = copyMap.FuBenSeqID; int mapCode = copyMap.MapCode; lock (copyDict) { MoRiJudgeCopy copy = null; if (!copyDict.TryGetValue(fuBenSeqId, out copy)) { copy = new MoRiJudgeCopy(); copy.MyCopyMap = copyMap; copy.GameId = Global.GetClientKuaFuServerLoginData(client).GameId; copy.StateTimeData.GameType = (int)GameTypes.MoRiJudge; // 副本的统计信息 copy.StartTime = TimeUtil.NowDateTime(); copy.EndTime = copy.StartTime.AddMinutes(this.CopyMaxAliveMinutes); copy.LimitKillCount = 0; copy.RoleCount = 1; copy.Passed = false; copyDict[fuBenSeqId] = copy; } else { copy.RoleCount++; } } FuBenManager.AddFuBenSeqID(client.ClientData.RoleID, copyMap.FuBenSeqID, 0, copyMap.FubenMapID); copyMap.IsKuaFuCopy = true; // 增加清除时间 copyMap.SetRemoveTicks(TimeUtil.NOW() + (this.CopyMaxAliveMinutes + 3) * TimeUtil.MINITE); //更新状态 // MoRiJudgeClient.getInstance().GameFuBenRoleChangeState(client.ClientData.RoleID, (int)KuaFuRoleStates.StartGame); // 开始游戏统计 GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, (int)GameTypes.MoRiJudge); } }
public bool processCmd(GameClient client, string[] cmdParams) { int nID = (int)this.CmdID; bool result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.ZhuanHuan, true)) { result = true; } else if (this.CmdID == TCPGameServerCmds.CMD_SPR_EXEC_LIANZHI) { int type = Global.SafeConvertToInt32(cmdParams[1]); int count = Global.SafeConvertToInt32(cmdParams[2]); result = LianZhiManager.GetInstance().ExecLianZhi(client, type, count); } else { result = (this.CmdID == TCPGameServerCmds.CMD_SPR_QUERY_LIANZHICOUNT && LianZhiManager.GetInstance().QueryLianZhiCount(client)); } return(result); }
/// <summary> /// 获取天赋数据 /// </summary> private static TalentData GetTalentData(GameClient client) { //开放 if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.Talent)) { return(null); } // 如果1.6的功能没开放 if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot6)) { return(null); } client.ClientData.MyTalentData.IsOpen = true; client.ClientData.MyTalentData.SkillOneValue = client.ClientData.MyTalentPropData.SkillOneValue; client.ClientData.MyTalentData.SkillAllValue = client.ClientData.MyTalentPropData.SkillAllValue; client.ClientData.MyTalentData.Occupation = client.ClientData.Occupation; return(client.ClientData.MyTalentData); }
public static bool CopyHistoryData(List <KFBoCaoHistoryData> sData, out List <KFBoCaoHistoryData> rData) { rData = new List <KFBoCaoHistoryData>(); try { foreach (KFBoCaoHistoryData item in sData) { KFBoCaoHistoryData data = new KFBoCaoHistoryData(); if (GlobalNew.Copy <KFBoCaoHistoryData>(item, ref data)) { rData.Add(data); } } return(true); } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true); } return(false); }
private static bool Load_DuiHuanShangCheng(out List <DuiHuanShangChengConfig> _DuiHuanShangChengCgfList) { _DuiHuanShangChengCgfList = new List <DuiHuanShangChengConfig>(); try { XElement xml = CheckHelper.LoadXml(Global.GameResPath("Config/DuiHuanShangCheng.xml"), true); if (null == xml) { LogManager.WriteLog(LogTypes.Fatal, string.Format("读取 {0} null == xml", "Config/DuiHuanShangCheng.xml"), null, true); return(false); } IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { if (null != xmlItem) { DuiHuanShangChengConfig myData = new DuiHuanShangChengConfig(); myData.ID = (int)Global.GetSafeAttributeLong(xmlItem, "ID"); myData.DaiBiJiaGe = (int)Global.GetSafeAttributeLong(xmlItem, "DaiBiJiaGe"); myData.MeiRiShangXianDan = (int)Global.GetSafeAttributeLong(xmlItem, "MeiRiShangXianDan"); myData.Name = Global.GetSafeAttributeStr(xmlItem, "Name"); myData.WuPinID = Global.GetSafeAttributeStr(xmlItem, "WuPinID"); if (null == GlobalNew.ParseGoodsData(myData.WuPinID)) { LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析 WuPinID={1} err", "Config/DuiHuanShangCheng.xml", myData.WuPinID), null, true); } else { _DuiHuanShangChengCgfList.Add(myData); } } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/DuiHuanShangCheng.xml", ex.Message), null, true); return(false); } return(true); }
private static TalentData GetTalentData(GameClient client) { TalentData result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.Talent, false)) { result = null; } else if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot6)) { result = null; } else { client.ClientData.MyTalentData.IsOpen = true; client.ClientData.MyTalentData.SkillOneValue = client.ClientData.MyTalentPropData.SkillOneValue; client.ClientData.MyTalentData.SkillAllValue = client.ClientData.MyTalentPropData.SkillAllValue; client.ClientData.MyTalentData.Occupation = client.ClientData.Occupation; result = client.ClientData.MyTalentData; } return(result); }
public static bool Copy2AuctionItemS2C(GoldAuctionItem sData, out AuctionItemS2C rData, string Seach, int Color) { rData = new AuctionItemS2C(); try { rData.Goods = GlobalNew.ParseGoodsData(sData.StrGoods); int goodsID = rData.Goods.GoodsID; if (!string.IsNullOrEmpty(Seach)) { List <int> goodsIDs = Global.StringToIntList(Seach, '#'); if (goodsIDs.Find((int x) => x == goodsID) < 1) { return(false); } } int color = Global.GetEquipColor(rData.Goods); if (Color > 0 && (1 << color - 1 & Color) == 0) { return(false); } rData.BuyRoleId = sData.BuyerData.m_RoleID; rData.Price = sData.BuyerData.Value; rData.AuctionItemKey = string.Format("{0}|{1}", sData.ProductionTime.Replace(':', ','), sData.AuctionSource); AuctionConfig cfg = GoldAuctionConfigModel.GetAuctionConfig(sData.AuctionSource); if (null != cfg) { rData.MaxPrice = (long)cfg.MaxPrice; rData.UnitPrice = (long)cfg.UnitPrice; } rData.LastTime = TimeUtil.GetDiffTimeSeconds(DateTime.Parse(sData.AuctionTime).AddHours((double)sData.LifeTime), TimeUtil.NowDateTime(), false); return(true); } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true); } return(false); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; bool result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.GamePayerRolePartChiBang, true)) { result = false; } else { if (client != null && client.ClientData.MyWingData != null && !string.IsNullOrEmpty(arg)) { List <int> iArgList = Global.StringToIntList(arg, '|'); if (iArgList.Count == 2) { if (client.ClientData.MyWingData.WingID < iArgList[0] || (client.ClientData.MyWingData.WingID == iArgList[0] && client.ClientData.MyWingData.ForgeLevel < iArgList[1])) { bOK = true; } } else if (iArgList.Count == 1) { if (client.ClientData.MyWingData.WingID < iArgList[0]) { bOK = true; } } } if (!bOK) { failedMsg = GLang.GetLang(8019, new object[0]); } result = bOK; } return(result); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; bool result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.GamePayerRolePartXingZuo, true)) { result = false; } else { if (!GameManager.StarConstellationMgr.IfStarConstellationPerfect(client)) { bOK = true; } if (!bOK) { failedMsg = GLang.GetLang(8014, new object[0]); } result = bOK; } return result; }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; bool result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.GamePayerRolePartChiBang, true)) { result = false; } else { if (!MUWingsManager.IfWingPerfect(client)) { bOK = true; } else if (!LingYuManager.IfLingYuPerfect(client)) { bOK = true; } else if (!ZhuLingZhuHunManager.IfZhuLingPerfect(client)) { bOK = true; } else if (!ZhuLingZhuHunManager.IfZhuHunPerfect(client)) { bOK = true; } if (!bOK) { failedMsg = GLang.GetLang(8018, new object[0]); } result = bOK; } return(result); }
public static double GetZhuHunPct(GameClient client) { double pct = 0.0; double result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.WingZhuHun, false)) { result = pct; } else { ZhuLingZhuHunLimit i = ZhuLingZhuHunManager.GetLimit(client.ClientData.MyWingData.WingID); if (i == null) { result = pct; } else { pct = (double)client.ClientData.MyWingData.ZhuHunNum / (double)i.ZhuHunLimit; result = pct; } } return(result); }
private bool ProcessMoRiJudgeJoin(GameClient client, int nID, byte[] bytes, string[] cmdParams) { try { SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode); if (sceneType != SceneUIClasses.Normal) { client.sendCmd(nID, -21, false); return(true); } if (!this.IsGongNengOpened(client, true)) { client.sendCmd(nID, -2001, false); return(true); } if (client.ClientData.SignUpGameType != 0) { client.sendCmd(nID, -2002, false); return(true); } if (KuaFuManager.getInstance().IsInCannotJoinKuaFuCopyTime(client)) { client.sendCmd(nID, -2004, false); return(true); } SystemXmlItem systemFuBenItem = null; if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(70000, out systemFuBenItem)) { client.sendCmd(nID, -3, false); return(true); } int minLevel = systemFuBenItem.GetIntValue("MinLevel", -1); int maxLevel = systemFuBenItem.GetIntValue("MaxLevel", -1); int nMinZhuanSheng = systemFuBenItem.GetIntValue("MinZhuanSheng", -1); int nMaxZhuanSheng = systemFuBenItem.GetIntValue("MaxZhuanSheng", -1); if (client.ClientData.ChangeLifeCount < nMinZhuanSheng || (client.ClientData.ChangeLifeCount == nMinZhuanSheng && client.ClientData.Level < minLevel)) { client.sendCmd(nID, "-19".ToString(), false); return(true); } if (client.ClientData.ChangeLifeCount > nMaxZhuanSheng || (client.ClientData.ChangeLifeCount == nMaxZhuanSheng && client.ClientData.Level > maxLevel)) { client.sendCmd(nID, "-19".ToString(), false); return(true); } FuBenData fuBenData = Global.GetFuBenData(client, 70000); if (fuBenData != null && fuBenData.FinishNum >= systemFuBenItem.GetIntValue("FinishNumber", -1)) { client.sendCmd(nID, "-16".ToString(), false); return(true); } int result = 0; if (result == 1) { client.ClientData.SignUpGameType = 3; GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 1, 0, 0, 0, 3); } client.sendCmd(nID, result.ToString(), false); return(true); } catch (Exception ex) { DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false, false); } return(false); }
public void TimerProc() { long nowMs = TimeUtil.NOW(); if (nowMs >= this.NextHeartBeatMs) { this.NextHeartBeatMs = nowMs + 1020L; List <MoRiJudgeCopy> copyList = null; lock (this.copyDict) { copyList = this.copyDict.Values.ToList <MoRiJudgeCopy>(); } if (copyList != null && copyList.Count > 0) { foreach (MoRiJudgeCopy judgeCopy in copyList) { lock (judgeCopy) { if (judgeCopy.m_eStatus == GameSceneStatuses.STATUS_NULL) { judgeCopy.m_eStatus = GameSceneStatuses.STATUS_PREPARE; judgeCopy.CurrStateBeginMs = nowMs; judgeCopy.DeadlineMs = nowMs + (long)(this.CopyMaxAliveMinutes * 60 * 1000); judgeCopy.StateTimeData.State = 2; judgeCopy.StateTimeData.EndTicks = judgeCopy.DeadlineMs; GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, judgeCopy.StateTimeData, judgeCopy.MyCopyMap); } else if (judgeCopy.m_eStatus == GameSceneStatuses.STATUS_PREPARE) { if (nowMs >= judgeCopy.CurrStateBeginMs + 1500L) { judgeCopy.m_eStatus = GameSceneStatuses.STATUS_BEGIN; judgeCopy.CurrStateBeginMs = nowMs; } } else if (judgeCopy.m_eStatus == GameSceneStatuses.STATUS_BEGIN) { if (nowMs >= judgeCopy.DeadlineMs || (nowMs >= judgeCopy.CurrStateBeginMs + 90000L && judgeCopy.RoleCount <= 0)) { judgeCopy.m_eStatus = GameSceneStatuses.STATUS_END; judgeCopy.CurrStateBeginMs = nowMs; break; } int nextMonsterIdx = -1; if (judgeCopy.CurrMonsterIdx == -1) { nextMonsterIdx = 0; } else if (judgeCopy.MonsterList[judgeCopy.CurrMonsterIdx].DeathMs > 0L && nowMs >= judgeCopy.MonsterList[judgeCopy.CurrMonsterIdx].DeathMs + 1300L) { nextMonsterIdx = judgeCopy.CurrMonsterIdx + 1; } if (nextMonsterIdx != -1) { if (nextMonsterIdx >= this.BossConfigList.Count) { judgeCopy.m_eStatus = GameSceneStatuses.STATUS_END; judgeCopy.CurrStateBeginMs = nowMs; } else { this.FlushMonster(judgeCopy, nextMonsterIdx); } } } else if (judgeCopy.m_eStatus == GameSceneStatuses.STATUS_END) { GameManager.CopyMapMgr.KillAllMonster(judgeCopy.MyCopyMap); judgeCopy.EndTime = TimeUtil.NowDateTime(); int roleCount = 0; List <GameClient> clientList = judgeCopy.MyCopyMap.GetClientsList(); if (clientList != null && clientList.Count > 0) { int combatSum = 0; foreach (GameClient client in clientList) { roleCount++; combatSum += client.ClientData.CombatForce; if (judgeCopy.Passed) { GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, 3); } else { GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 0, 1, 3); } } if (roleCount > 0) { int combatAvg = combatSum / roleCount; } if (judgeCopy.Passed) { GameManager.CopyMapMgr.CopyMapPassAwardForAll(clientList[0], judgeCopy.MyCopyMap, false); } } judgeCopy.m_eStatus = GameSceneStatuses.STATUS_AWARD; judgeCopy.CurrStateBeginMs = nowMs; judgeCopy.StateTimeData.State = 3; judgeCopy.StateTimeData.EndTicks = nowMs + 30000L; GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, judgeCopy.StateTimeData, judgeCopy.MyCopyMap); } else if (judgeCopy.m_eStatus == GameSceneStatuses.STATUS_AWARD) { if (nowMs >= judgeCopy.CurrStateBeginMs + 30000L) { lock (this.copyDict) { this.copyDict.Remove(judgeCopy.MyCopyMap.FuBenSeqID); } try { List <GameClient> clientList = judgeCopy.MyCopyMap.GetClientsList(); if (clientList != null) { foreach (GameClient client in clientList) { KuaFuManager.getInstance().GotoLastMap(client); } } } catch (Exception ex) { DataHelper.WriteExceptionLogEx(ex, "末日审判清场调度异常"); } } } } } } } }
private bool IsGongNengOpened(GameClient client, bool bHint = true) { return(GameManager.VersionSystemOpenMgr.IsVersionSystemOpen("MoRiShenPan") && GlobalNew.IsGongNengOpened(client, GongNengIDs.MoRiJudge, bHint)); }