/// <summary> // 刷B怪 /// </summary> public void CreateMonsterBBloodCastScene(int mapid, BloodCastleDataInfo bcDataTmp, BloodCastleScene bcTmp) { int monsterID = bcDataTmp.NeedKillMonster2ID; string[] sfields = bcDataTmp.NeedCreateMonster2Pos.Split(','); int nPosX = Global.SafeConvertToInt32(sfields[0]); int nPosY = Global.SafeConvertToInt32(sfields[1]); GameMap gameMap = null; if (!GameManager.MapMgr.DictMaps.TryGetValue(bcDataTmp.MapCode, out gameMap)) { LogManager.WriteLog(LogTypes.Error, string.Format("血色城堡报错 地图配置 ID = {0}", bcDataTmp.MapCode)); return; } int gridX = gameMap.CorrectWidthPointToGridPoint(nPosX) / gameMap.MapGridWidth; int gridY = gameMap.CorrectHeightPointToGridPoint(nPosY) / gameMap.MapGridHeight; int gridNum = gameMap.CorrectPointToGrid(bcDataTmp.NeedCreateMonster2Radius); for (int i = 0; i < bcDataTmp.NeedCreateMonster2Num; ++i) { GameManager.MonsterZoneMgr.AddDynamicMonsters(mapid, monsterID, -1, 1, gridX, gridY, gridNum, bcDataTmp.NeedCreateMonster2PursuitRadius); } return; }
/// <summary> // 完成血色堡垒 /// </summary> public void CompleteBloodCastScene(GameClient client, BloodCastleScene bsInfo, BloodCastleDataInfo bsData) { int nFlag = Global.GetRoleParamsInt32FromDB(client, RoleParamName.BloodCastleSceneFinishFlag); if (nFlag != 1) { // 保存完成状态 Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.BloodCastleSceneFinishFlag, 1, true); } }
/// <summary> // 给奖励 -- 第二个版本 /// </summary> static public void GiveAwardBloodCastScene2(GameClient client, int nMultiple) { int nSceneID = Global.GetRoleParamsInt32FromDB(client, RoleParamName.BloodCastleSceneid); int nFlag = Global.GetRoleParamsInt32FromDB(client, RoleParamName.BloodCastleSceneFinishFlag); BloodCastleDataInfo bcDataTmp = null; if (!Data.BloodCastleDataInfoList.TryGetValue(nSceneID, out bcDataTmp)) { return; } // 如果提交了任务(就是提交了水晶棺物品) 就给大家奖励 if (nFlag == 1) { string[] sItem = bcDataTmp.AwardItem2; if (null != sItem && sItem.Length > 0) { for (int i = 0; i < sItem.Length; i++) { if (string.IsNullOrEmpty(sItem[i].Trim())) { continue; } string[] sFields = sItem[i].Split(','); if (string.IsNullOrEmpty(sFields[i].Trim())) { continue; } int nGoodsID = Convert.ToInt32(sFields[0].Trim()); int nGoodsNum = Convert.ToInt32(sFields[1].Trim()); int nBinding = Convert.ToInt32(sFields[2].Trim()); GoodsData goodsData = new GoodsData() { Id = -1, GoodsID = nGoodsID, Using = 0, Forge_level = 0, Starttime = "1900-01-01 12:00:00", Endtime = Global.ConstGoodsEndTime, Site = 0, Quality = (int)GoodsQuality.White, Props = "", GCount = nGoodsNum, Binding = nBinding, Jewellist = "", BagIndex = 0, AddPropIndex = 0, BornIndex = 0, Lucky = 0, Strong = 0, ExcellenceInfo = 0, AppendPropLev = 0, ChangeLifeLevForEquip = 0, }; string sMsg = "血色堡垒奖励--统一奖励"; if (!Global.CanAddGoodsNum(client, nGoodsNum)) { for (int j = 0; j < nGoodsNum; ++j) { Global.UseMailGivePlayerAward(client, goodsData, "血色堡垒奖励", sMsg); } } else { Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, nGoodsID, nGoodsNum, goodsData.Quality, "", goodsData.Forge_level, goodsData.Binding, 0, "", true, 1, sMsg, goodsData.Endtime); } } } } // 根据积分以及公式给奖励(经验) if (client.ClientData.BloodCastleAwardPoint > 0) { // 公式 int nExp = nMultiple * client.ClientData.BloodCastleAwardPoint * bcDataTmp.ExpModulus; int nMoney = client.ClientData.BloodCastleAwardPoint * bcDataTmp.MoneyModulus; if (nExp > 0) { GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false); } if (nMoney > 0) { GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nMoney, "血色城堡奖励二", false); } //GameManager.ClientMgr.AddUserYinLiang(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nMoney); // 存盘 if (client.ClientData.BloodCastleAwardPoint > client.ClientData.BloodCastleAwardTotalPoint) { client.ClientData.BloodCastleAwardTotalPoint = client.ClientData.BloodCastleAwardPoint; } if (client.ClientData.BloodCastleAwardPoint > m_nTotalPointValue) { SetTotalPointInfo(client.ClientData.RoleName, client.ClientData.BloodCastleAwardPoint); } // 清空 client.ClientData.BloodCastleAwardPoint = 0; Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.BloodCastlePlayerPoint, client.ClientData.BloodCastleAwardPoint, true); } }
/// <summary> // 杀死了怪 /// </summary> public void KillMonsterABloodCastScene(GameClient client, Monster monster) { BloodCastleDataInfo bcDataTmp = Data.BloodCastleDataInfoList[client.ClientData.MapCode]; BloodCastleScene bcTmp = GetBloodCastleListScenes(client.ClientData.MapCode); if (bcTmp == null || bcDataTmp == null) { return; } if (bcTmp.m_bEndFlag == true) { return; } // 给玩家积分 client.ClientData.BloodCastleAwardPoint += monster.MonsterInfo.BloodCastJiFen; // 节省性能 当杀够1000分时 做存储 if (client.ClientData.BloodCastleAwardPoint - client.ClientData.BloodCastleAwardPointTmp >= 1000) { client.ClientData.BloodCastleAwardPointTmp = client.ClientData.BloodCastleAwardPoint; Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.BloodCastlePlayerPoint, client.ClientData.BloodCastleAwardPoint, true); } string strcmd = string.Format("{0}:{1}", client.ClientData.RoleID, client.ClientData.BloodCastleAwardPoint); GameManager.ClientMgr.SendToClient(client, strcmd, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLECOMBATPOINT); if (monster.MonsterInfo.VLevel >= bcDataTmp.NeedKillMonster1Level && bcTmp.m_bKillMonsterAStatus == 0) { int killedMonster = Interlocked.Increment(ref bcTmp.m_nKillMonsterACount); GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERSTATUS, 0, bcTmp.m_nKillMonsterACount, 1); // 杀死桥上的怪 数量/50 显示杀怪状态 if (killedMonster == bcDataTmp.NeedKillMonster1Num) { // 杀死A怪的数量已经达到限额 通知客户端 面前的阻挡消失 玩家可以离开桥 攻击城门了 GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERAHASDONE); GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERSTATUS, 0, 0, 2); // 杀死吊桥怪 0/1 -- 显示杀怪状态 bcTmp.m_bKillMonsterAStatus = 1; } } if (monster.MonsterInfo.ExtensionID == bcDataTmp.GateID) { CreateMonsterBBloodCastScene(bcTmp.m_nMapCode, bcDataTmp, bcTmp); // 把B怪刷出来吧 GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERSTATUS, 0, 1, 2); // 杀死吊桥怪 1/1 -- 显示杀怪状态 GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERSTATUS, 0, 0, 3); // 杀死巫师怪 0/8 -- 显示杀怪状态 } if (monster.MonsterInfo.ExtensionID == bcDataTmp.NeedKillMonster2ID && bcTmp.m_bKillMonsterBStatus == 0) { int killedMonster = Interlocked.Increment(ref bcTmp.m_nKillMonsterBCount); GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERSTATUS, 0, bcTmp.m_nKillMonsterBCount, 3); // 杀死巫师怪 数量/8 -- 显示杀怪状态 if (killedMonster == bcDataTmp.NeedKillMonster2Num) { // 把水晶棺刷出来 int monsterID = bcDataTmp.CrystalID; string[] sfields = bcDataTmp.CrystalPos.Split(','); int nPosX = Global.SafeConvertToInt32(sfields[0]); int nPosY = Global.SafeConvertToInt32(sfields[1]); GameMap gameMap = null; if (!GameManager.MapMgr.DictMaps.TryGetValue(bcDataTmp.MapCode, out gameMap)) { LogManager.WriteLog(LogTypes.Error, string.Format("血色城堡报错 地图配置 ID = {0}", bcDataTmp.MapCode)); return; } int gridX = gameMap.CorrectWidthPointToGridPoint(nPosX) / gameMap.MapGridWidth; int gridY = gameMap.CorrectHeightPointToGridPoint(nPosY) / gameMap.MapGridHeight; GameManager.MonsterZoneMgr.AddDynamicMonsters(bcTmp.m_nMapCode, monsterID, -1, 1, gridX, gridY, 0); GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERSTATUS, 0, 0, 4); // 杀死水晶棺 0/1 -- 显示杀怪状态 bcTmp.m_bKillMonsterBStatus = 1; } } if (monster.MonsterInfo.ExtensionID == bcDataTmp.CrystalID) { GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERSTATUS, 0, 1, 4); // 杀死水晶棺 1/1 -- 显示杀怪状态 GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERSTATUS, 0, 0, 5); // 采集雕像 0/1 -- 显示杀怪状态 } if (monster.MonsterInfo.ExtensionID == bcDataTmp.DiaoXiangID) { GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERSTATUS, 0, 1, 5); // 采集雕像 1/1 -- 显示杀怪状态 GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERSTATUS, 0, 1, 6); // 提交大天使武器 1/1 -- 显示杀怪状态 } // 刷雕像 if (monster.MonsterInfo.ExtensionID == bcDataTmp.CrystalID) { int monsterID = bcDataTmp.DiaoXiangID; string[] sfields = bcDataTmp.DiaoXiangPos.Split(','); int nPosX = Global.SafeConvertToInt32(sfields[0]); int nPosY = Global.SafeConvertToInt32(sfields[1]); GameMap gameMap = null; if (!GameManager.MapMgr.DictMaps.TryGetValue(bcDataTmp.MapCode, out gameMap)) { return; } int gridX = gameMap.CorrectWidthPointToGridPoint(nPosX) / gameMap.MapGridWidth; int gridY = gameMap.CorrectHeightPointToGridPoint(nPosY) / gameMap.MapGridHeight; GameManager.MonsterZoneMgr.AddDynamicMonsters(bcDataTmp.MapCode, monsterID, -1, 1, gridX, gridY, 0); } return; }
/// <summary> // 心跳处理 /// </summary> public void HeartBeatBloodCastScene() { //int[] nArray = GameManager.systemParamsList.GetParamValueIntArrayByName("BloodCastleMapCodeID"); foreach (var BloodCastleScenes in m_BloodCastleListScenes) { //for (int i = 0; i < nArray.Length; ++i) //{ BloodCastleDataInfo bcDataTmp = Data.BloodCastleDataInfoList[BloodCastleScenes.Key]; BloodCastleScene bcTmp = GetBloodCastleListScenes(BloodCastleScenes.Key); if (bcTmp == null || bcDataTmp == null) { continue; } int nRoleNum = 0; nRoleNum = GameManager.ClientMgr.GetMapClientsCount(bcTmp.m_nMapCode); if (nRoleNum <= 0) { if (bcTmp.m_eStatus == BloodCastleStatus.FIGHT_STATUS_BEGIN) { // 做清空处理 比如 所有动态刷出的怪 都delete掉 CleanBloodCastScene(bcTmp.m_nMapCode); bcTmp.CleanAllInfo(); bcTmp.m_nMapCode = BloodCastleScenes.Key; } //continue; } // 区分时段 注意 每个时段都要计时 // 当前tick long ticks = DateTime.Now.Ticks / 10000; if (bcTmp.m_eStatus == BloodCastleStatus.FIGHT_STATUS_NULL) // 如果处于空状态 -- 是否要切换到准备状态 { bool bPushMsg = false; if (Global.CanEnterBloodCastleOnTime(bcDataTmp.BeginTime, 0 /*bcDataTmp.PrepareTime*/)) { bcTmp.m_eStatus = BloodCastleStatus.FIGHT_STATUS_PREPARE; bcTmp.m_lPrepareTime = DateTime.Now.Ticks / 10000; //触发血色城堡事件 GlobalEventSource.getInstance().fireEvent(XueSeChengBaoBaseEventObject.CreateStatusEvent((int)bcTmp.m_eStatus)); // 消息推送 int nNow = DateTime.Now.DayOfYear; if (bPushMsg && m_nPushMsgDayID != nNow) { //Global.DayActivityTiggerPushMessage((int)SpecialActivityTypes.BloodCastle); Global.UpdateDBGameConfigg(GameConfigNames.BloodCastlePushMsgDayID, nNow.ToString()); m_nPushMsgDayID = nNow; } } } else if (bcTmp.m_eStatus == BloodCastleStatus.FIGHT_STATUS_PREPARE) // 场景战斗状态切换 { if (ticks >= (bcTmp.m_lPrepareTime + (bcDataTmp.PrepareTime * 1000))) { // 准备战斗 通知客户端 面前的阻挡消失 玩家可以上桥上去杀怪了 bcTmp.m_eStatus = BloodCastleStatus.FIGHT_STATUS_BEGIN; bcTmp.m_lBeginTime = DateTime.Now.Ticks / 10000; int nTimer = (int)((bcDataTmp.DurationTime * 1000 - (ticks - bcTmp.m_lBeginTime)) / 1000); GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, BloodCastleScenes.Key, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEBEGINFIGHT, nTimer); // 战斗结束倒计时 // 把城门刷出来 int monsterID = bcDataTmp.GateID; string[] sfields = bcDataTmp.GatePos.Split(','); int nPosX = Global.SafeConvertToInt32(sfields[0]); int nPosY = Global.SafeConvertToInt32(sfields[1]); GameMap gameMap = null; if (!GameManager.MapMgr.DictMaps.TryGetValue(bcDataTmp.MapCode, out gameMap)) { LogManager.WriteLog(LogTypes.Error, string.Format("血色城堡报错 地图配置 ID = {0}", bcDataTmp.MapCode)); return; } int gridX = gameMap.CorrectWidthPointToGridPoint(nPosX) / gameMap.MapGridWidth; int gridY = gameMap.CorrectHeightPointToGridPoint(nPosY) / gameMap.MapGridHeight; //System.Console.WriteLine("liaowei是帅哥 血色堡垒{0}里 刷城门怪了--1!!!", BloodCastleScenes.Key); GameManager.MonsterZoneMgr.AddDynamicMonsters(BloodCastleScenes.Key, monsterID, -1, 1, gridX, gridY, 0); GameManager.ClientMgr.NotifyBloodCastleMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcTmp.m_nMapCode, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEKILLMONSTERSTATUS, 0, 0, 1); // 杀死桥上的怪 0/50 -- 显示杀怪状态 //触发血色城堡事件 GlobalEventSource.getInstance().fireEvent(XueSeChengBaoBaseEventObject.CreateStatusEvent((int)bcTmp.m_eStatus)); } } else if (bcTmp.m_eStatus == BloodCastleStatus.FIGHT_STATUS_BEGIN) // 战斗开始 { if (ticks >= (bcTmp.m_lBeginTime + (bcDataTmp.DurationTime * 1000))) { bcTmp.m_eStatus = BloodCastleStatus.FIGHT_STATUS_END; bcTmp.m_lEndTime = DateTime.Now.Ticks / 10000; //触发血色城堡事件 GlobalEventSource.getInstance().fireEvent(XueSeChengBaoBaseEventObject.CreateStatusEvent((int)bcTmp.m_eStatus)); } } else if (bcTmp.m_eStatus == BloodCastleStatus.FIGHT_STATUS_END) // 战斗结束 { // 血色堡垒结束战斗 客户端显示倒计时界面 int nTimer = (int)((bcDataTmp.LeaveTime * 1000 - (ticks - bcTmp.m_lEndTime)) / 1000); if (bcTmp.m_bEndFlag == false) { // 剩余时间奖励 long nTimerInfo = 0; nTimerInfo = bcTmp.m_lEndTime - bcTmp.m_lBeginTime; long nRemain = 0; nRemain = ((bcDataTmp.DurationTime * 1000) - nTimerInfo) / 1000; if (nRemain >= bcDataTmp.DurationTime) { nRemain = bcDataTmp.DurationTime / 2; } int nTimeAward = 0; nTimeAward = (int)(bcDataTmp.TimeModulus * nRemain); if (nTimeAward < 0) { nTimeAward = 0; } GameManager.ClientMgr.NotifyBloodCastleMsgEndFight(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, BloodCastleScenes.Key, (int)TCPGameServerCmds.CMD_SPR_BLOODCASTLEENDFIGHT, nTimer, nTimeAward); } if (ticks >= (bcTmp.m_lEndTime + (bcDataTmp.LeaveTime * 1000))) { // 清场 List <Object> objsList = GameManager.ClientMgr.GetMapClients(BloodCastleScenes.Key); if (objsList != null) { for (int n = 0; n < objsList.Count; ++n) { GameClient c = objsList[n] as GameClient; if (c == null) { continue; } if (c.ClientData.MapCode != BloodCastleScenes.Key) { continue; } // 完成该血色堡垒 //CompleteBloodCastScene(c, bcTmp, bcDataTmp); // 根据公式和积分奖励经验 注释掉 //GiveAwardBloodCastScene(c); // 退出场景 int toMapCode = GameManager.MainMapCode; //主城ID 防止意外 int toPosX = -1; int toPosY = -1; if (MapTypes.Normal == Global.GetMapType(c.ClientData.LastMapCode)) { if (GameManager.BattleMgr.BattleMapCode != c.ClientData.LastMapCode || GameManager.ArenaBattleMgr.BattleMapCode != c.ClientData.LastMapCode) { toMapCode = c.ClientData.LastMapCode; toPosX = c.ClientData.LastPosX; toPosY = c.ClientData.LastPosY; } } GameMap gameMap = null; if (GameManager.MapMgr.DictMaps.TryGetValue(toMapCode, out gameMap)) { c.ClientData.bIsInBloodCastleMap = false; GameManager.ClientMgr.NotifyChangeMap(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, c, toMapCode, toPosX, toPosY, -1); } } } CleanBloodCastScene(BloodCastleScenes.Key); bcTmp.CleanAllInfo(); bcTmp.m_nMapCode = BloodCastleScenes.Key; } } //} } return; }
/// <summary> /// 获得剩余次数 /// </summary> /// <param name="type"></param> /// <returns></returns> private static int GetLeftCountByType(GameClient client, int type, int copyId) { int leftnum = 0; switch ((CandoType)type) { case CandoType.DailyTask: { DailyTaskData dailyTaskData = Global.FindDailyTaskDataByTaskClass(client, 8); if (null == dailyTaskData) { return(Global.MaxDailyTaskNumForMU); } int maxnum = Global.GetMaxDailyTaskNum(client, 8, dailyTaskData); //获取最大日常任务次数 leftnum = maxnum - dailyTaskData.RecNum; } break; case CandoType.StoryCopy: case CandoType.GoldCopy: case CandoType.GroupCopy: case CandoType.EXPCopy: { SystemXmlItem systemFuBenItem = null; if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(copyId, out systemFuBenItem)) { return(-1); } int total = systemFuBenItem.GetIntValue("EnterNumber"); if (type == (int)CandoType.StoryCopy || type == (int)CandoType.GroupCopy) { total = systemFuBenItem.GetIntValue("FinishNumber"); } if (type == (int)CandoType.GoldCopy || type == (int)CandoType.EXPCopy) { int[] nAddNum = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPJinBiFuBenNum"); if (type == (int)CandoType.EXPCopy) { nAddNum = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPJinYanFuBenNum"); } if (client.ClientData.VipLevel > 0 && client.ClientData.VipLevel <= (int)VIPEumValue.VIPENUMVALUE_MAXLEVEL && nAddNum != null && nAddNum.Length > 0 && nAddNum.Length <= 13) { total = total + nAddNum[client.ClientData.VipLevel]; } } FuBenData tmpfubdata = Global.GetFuBenData(client, copyId); if (null != tmpfubdata) { leftnum = total - tmpfubdata.EnterNum; } else { return(total); } } break; case CandoType.DemonSquare: { int nMapID = Global.GetDaimonSquareCopySceneIDForRole(client); DaimonSquareDataInfo bcDataTmp = null; Data.DaimonSquareDataInfoList.TryGetValue(nMapID, out bcDataTmp); int nDate = DateTime.Now.DayOfYear; // 当前时间 int nCount = Global.QueryDayActivityEnterCountToDB(client, client.ClientData.RoleID, nDate, (int)SpecialActivityTypes.DemoSque); if (nCount < 0) { nCount = 0; } int nVipLev = client.ClientData.VipLevel; int nNum = 0; int[] nArry = null; nArry = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPEnterDaimonSquareCountAddValue"); if (nVipLev > 0 && nArry != null && nArry[nVipLev] > 0) { nNum = nArry[nVipLev]; } leftnum = bcDataTmp.MaxEnterNum + nNum - nCount; } break; case CandoType.AngelTemple: { DateTime now = DateTime.Now; string nowTime = DateTime.Now.ToString("HH:mm"); List <string> timePointsList = GameManager.AngelTempleMgr.m_AngelTempleData.BeginTime; leftnum = 0; for (int i = 0; i < timePointsList.Count; i++) { DateTime staticTime = DateTime.Parse(timePointsList[i]); DateTime perpareTime = staticTime.AddMinutes((double)(GameManager.AngelTempleMgr.m_AngelTempleData.PrepareTime / 60)); if (now <= perpareTime) { leftnum += 1; } } } break; case CandoType.BloodCity: { int nMapID = Global.GetBloodCastleCopySceneIDForRole(client); BloodCastleDataInfo bcDataTmp = null; if (!Data.BloodCastleDataInfoList.TryGetValue(nMapID, out bcDataTmp)) { break; } int nDate = DateTime.Now.DayOfYear; // 当前时间 int nType = (int)SpecialActivityTypes.BloodCastle; // 血色堡垒 int nCount = Global.QueryDayActivityEnterCountToDB(client, client.ClientData.RoleID, nDate, nType); if (nCount < 0) { nCount = 0; } // VIP检测 int nVipLev = client.ClientData.VipLevel; int nNum = 0; int[] nArry = null; nArry = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPEnterBloodCastleCountAddValue"); if (nVipLev > 0 && nArry != null && nArry[nVipLev] > 0) { nNum = nArry[nVipLev]; } leftnum = bcDataTmp.MaxEnterNum + nNum - nCount; } break; case CandoType.Arena: { leftnum = JingJiChangManager.getInstance().GetLeftEnterCount(client); } break; case CandoType.OldBattlefield: { //古墓 古战场 剩余时间 BufferData bufferData = Global.GetBufferDataByID(client, (int)BufferItemTypes.GuMuTimeLimit); leftnum = (int)(bufferData.BufferVal - bufferData.BufferSecs); } break; case CandoType.PartWar: { leftnum = GameManager.BattleMgr.LeftEnterCount(); } break; case CandoType.PKKing: { leftnum = GameManager.ArenaBattleMgr.LeftEnterCount(); } break; case CandoType.WanmoTower: { leftnum = 1; if (SweepWanMotaManager.GetSweepCount(client) >= SweepWanMotaManager.nWanMoTaMaxSweepNum) { leftnum = 0; } } break; case CandoType.TaofaTaskCanDo: { DailyTaskData dailyTaskData = Global.FindDailyTaskDataByTaskClass(client, (int)TaskClasses.TaofaTask); if (null == dailyTaskData) { return(Global.MaxTaofaTaskNumForMU); } int maxnum = Global.GetMaxDailyTaskNum(client, (int)TaskClasses.TaofaTask, dailyTaskData); //获取最大讨伐任务次数 leftnum = maxnum - dailyTaskData.RecNum; } break; case CandoType.CrystalCollectCanDo: { //获取剩余水晶采集次数 int temp = 0; CaiJiLogic.ReqCaiJiLastNum(client, 0, out temp); leftnum = temp; } break; } return(leftnum); }
private static int GetLeftCountByType(GameClient client, int type, int copyId) { int leftnum = 0; switch (type) { case 1: { DailyTaskData dailyTaskData = Global.FindDailyTaskDataByTaskClass(client, 8); if (null == dailyTaskData) { return(10); } int maxnum = Global.GetMaxDailyTaskNum(client, 8, dailyTaskData); leftnum = maxnum - dailyTaskData.RecNum; goto IL_4AC; } case 5: { int nMapID = Global.GetDaimonSquareCopySceneIDForRole(client); DaimonSquareDataInfo bcDataTmp = null; Data.DaimonSquareDataInfoList.TryGetValue(nMapID, out bcDataTmp); int nDate = TimeUtil.NowDateTime().DayOfYear; int nCount = Global.QueryDayActivityEnterCountToDB(client, client.ClientData.RoleID, nDate, 2); if (nCount < 0) { nCount = 0; } int nVipLev = client.ClientData.VipLevel; int nNum = 0; int[] nArry = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPEnterDaimonSquareCountAddValue", ','); if (nVipLev > 0 && nArry != null && nArry[nVipLev] > 0) { nNum = nArry[nVipLev]; } leftnum = bcDataTmp.MaxEnterNum + nNum - nCount; goto IL_4AC; } case 6: { int nMapID = Global.GetBloodCastleCopySceneIDForRole(client); BloodCastleDataInfo bcDataTmp2 = null; if (!Data.BloodCastleDataInfoList.TryGetValue(nMapID, out bcDataTmp2)) { goto IL_4AC; } int nDate = TimeUtil.NowDateTime().DayOfYear; int nType = 1; int nCount = Global.QueryDayActivityEnterCountToDB(client, client.ClientData.RoleID, nDate, nType); if (nCount < 0) { nCount = 0; } int nVipLev = client.ClientData.VipLevel; int nNum = 0; int[] nArry = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPEnterBloodCastleCountAddValue", ','); if (nVipLev > 0 && nArry != null && nArry[nVipLev] > 0) { nNum = nArry[nVipLev]; } leftnum = bcDataTmp2.MaxEnterNum + nNum - nCount; goto IL_4AC; } case 7: { DateTime now = TimeUtil.NowDateTime(); string nowTime = TimeUtil.NowDateTime().ToString("HH:mm"); List <string> timePointsList = GameManager.AngelTempleMgr.m_AngelTempleData.BeginTime; leftnum = 0; for (int i = 0; i < timePointsList.Count; i++) { DateTime perpareTime = DateTime.Parse(timePointsList[i]).AddMinutes((double)(GameManager.AngelTempleMgr.m_AngelTempleData.PrepareTime / 60)); if (now <= perpareTime) { leftnum++; } } goto IL_4AC; } case 8: leftnum = 1; if (SweepWanMotaManager.GetSweepCount(client) >= SweepWanMotaManager.nWanMoTaMaxSweepNum) { leftnum = 0; } goto IL_4AC; case 9: { BufferData bufferData = Global.GetBufferDataByID(client, 34); leftnum = (int)(bufferData.BufferVal - (long)bufferData.BufferSecs); goto IL_4AC; } case 10: leftnum = GameManager.BattleMgr.LeftEnterCount(); goto IL_4AC; case 11: leftnum = GameManager.ArenaBattleMgr.LeftEnterCount(); goto IL_4AC; case 13: leftnum = JingJiChangManager.getInstance().GetLeftEnterCount(client); goto IL_4AC; case 15: { DailyTaskData dailyTaskData = Global.FindDailyTaskDataByTaskClass(client, 9); if (null == dailyTaskData) { return(Global.MaxTaofaTaskNumForMU); } int maxnum = Global.GetMaxDailyTaskNum(client, 9, dailyTaskData); leftnum = maxnum - dailyTaskData.RecNum; goto IL_4AC; } case 16: { int temp = 0; CaiJiLogic.ReqCaiJiLastNum(client, 0, out temp); leftnum = temp; goto IL_4AC; } case 19: leftnum = HuanYingSiYuanManager.getInstance().GetLeftCount(client); goto IL_4AC; } if (copyId > 0) { SystemXmlItem systemFuBenItem = null; if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(copyId, out systemFuBenItem)) { return(-1); } int enternum = systemFuBenItem.GetIntValue("EnterNumber", -1); int finishnum = systemFuBenItem.GetIntValue("FinishNumber", -1); int total = (enternum < finishnum) ? finishnum : enternum; if (type == 4 || type == 3) { int[] nAddNum = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPJinBiFuBenNum", ','); if (type == 3) { nAddNum = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPJinYanFuBenNum", ','); } if (client.ClientData.VipLevel > 0 && client.ClientData.VipLevel <= VIPEumValue.VIPENUMVALUE_MAXLEVEL && nAddNum != null && nAddNum.Length > VIPEumValue.VIPENUMVALUE_MAXLEVEL) { total += nAddNum[client.ClientData.VipLevel]; } } FuBenData tmpfubdata = Global.GetFuBenData(client, copyId); if (null == tmpfubdata) { return(total); } leftnum = total - tmpfubdata.EnterNum; } IL_4AC: return(leftnum); }