public bool ProcessJoinCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams) { try { SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode); if (sceneType != SceneUIClasses.Normal) { client.sendCmd(nID, "-21".ToString(), false); return(true); } if (!this.IsGongNengOpened(client, true)) { client.sendCmd(nID, "-2001".ToString(), false); return(true); } if (client.ClientData.SignUpGameType != 0) { client.sendCmd(nID, "-2002".ToString(), false); return(true); } if (KuaFuManager.getInstance().IsInCannotJoinKuaFuCopyTime(client)) { client.sendCmd(nID, "-2004".ToString(), false); return(true); } SystemXmlItem systemFuBenItem = null; if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(this._runtimeData.CopyID, out systemFuBenItem)) { client.sendCmd(nID, "-3".ToString(), false); return(true); } int minLevel = systemFuBenItem.GetIntValue("MinLevel", -1); int minZhuanSheng = systemFuBenItem.GetIntValue("MinZhuanSheng", -1); int levelLimit = minZhuanSheng * 100 + minLevel; if (client.ClientData.ChangeLifeCount * 100 + client.ClientData.Level < levelLimit) { client.sendCmd(nID, "-19".ToString(), false); return(true); } int oldCount = this.GetElementWarCount(client); if (oldCount >= systemFuBenItem.GetIntValue("FinishNumber", -1)) { client.sendCmd(nID, "-16".ToString(), false); return(true); } int result = 0; if (result > 0) { client.ClientData.SignUpGameType = 4; GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 1, 0, 0, 0, 4); } client.sendCmd <int>(nID, result, false); return(true); } catch (Exception ex) { DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false, false); } return(false); }
/// <summary> /// 罗兰城战攻防竞价申请指令处理 /// </summary> /// <param name="client"></param> /// <param name="nID"></param> /// <param name="bytes"></param> /// <param name="cmdParams"></param> /// <returns></returns> public bool ProcessTianTiJoinCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams) { try { SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode); if (sceneType != SceneUIClasses.Normal) { client.sendCmd(nID, StdErrorCode.Error_Denied_In_Current_Map); return(true); } if (!IsGongNengOpened(client, true)) { client.sendCmd(nID, StdErrorCode.Error_Not_In_valid_Time); return(true); } int result = StdErrorCode.Error_Not_In_valid_Time; int gropuIndex = client.ClientData.TianTiData.DuanWeiId; TimeSpan time = TimeUtil.NowDateTime().TimeOfDay; lock (RuntimeData.Mutex) { for (int i = 0; i < RuntimeData.TimePoints.Count - 1; i += 2) { if (time >= RuntimeData.TimePoints[i] && time < RuntimeData.TimePoints[i + 1]) { result = StdErrorCode.Error_Success; break; } } } if (result >= 0) { result = TianTiClient.getInstance().TianTiSignUp(client.strUserID, client.ClientData.RoleID, client.ClientData.ZoneID, (int)GameTypes.TianTi, gropuIndex, client.ClientData.CombatForce); if (result > 0) { client.ClientData.SignUpGameType = (int)GameTypes.TianTi; GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 1, 0, 0, 0, (int)GameTypes.TianTi); } } //发送结果给客户端 client.sendCmd(nID, result); return(true); } catch (Exception ex) { DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false); } return(false); }
/// <summary> /// 添加一个场景 /// </summary> public bool AddHuanYingSiYuanCopyScenes(GameClient client, CopyMap copyMap) { if (copyMap.MapCode == RuntimeData.MapCode) { int fuBenSeqId = copyMap.FuBenSeqID; int mapCode = copyMap.MapCode; lock (Mutex) { HuanYingSiYuanScene huanYingSiYuanScene = null; if (!HuanYingSiYuanSceneDict.TryGetValue(fuBenSeqId, out huanYingSiYuanScene)) { huanYingSiYuanScene = new HuanYingSiYuanScene(); huanYingSiYuanScene.CopyMap = copyMap; huanYingSiYuanScene.CleanAllInfo(); huanYingSiYuanScene.GameId = (int)Global.GetClientKuaFuServerLoginData(client).GameId; huanYingSiYuanScene.m_nMapCode = mapCode; huanYingSiYuanScene.CopyMapId = copyMap.CopyMapID; huanYingSiYuanScene.FuBenSeqId = fuBenSeqId; huanYingSiYuanScene.m_nPlarerCount = 1; HuanYingSiYuanSceneDict[fuBenSeqId] = huanYingSiYuanScene; } else { huanYingSiYuanScene.m_nPlarerCount++; } if (client.ClientData.BattleWhichSide == 1) { huanYingSiYuanScene.ScoreInfoData.Count1++; } else { huanYingSiYuanScene.ScoreInfoData.Count2++; } copyMap.IsKuaFuCopy = true; copyMap.SetRemoveTicks(TimeUtil.NOW() + RuntimeData.TotalSecs * TimeUtil.SECOND); GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_HYSY_SCORE_INFO, huanYingSiYuanScene.ScoreInfoData, huanYingSiYuanScene.CopyMap); } client.SceneContextData2 = new HuanYingSiYuanLianShaContextData(); //更新状态 HuanYingSiYuanClient.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.HuanYingSiYuan); return(true); } return(false); }
/// <summary> /// 添加一个场景 /// </summary> public bool AddTianTiCopyScenes(GameClient client, CopyMap copyMap, SceneUIClasses sceneType) { if (sceneType == SceneUIClasses.TianTi) { int fuBenSeqId = copyMap.FuBenSeqID; int mapCode = copyMap.MapCode; lock (RuntimeData.Mutex) { TianTiScene tianTiScene = null; if (!TianTiSceneDict.TryGetValue(fuBenSeqId, out tianTiScene)) { tianTiScene = new TianTiScene(); tianTiScene.CopyMap = copyMap; tianTiScene.CleanAllInfo(); tianTiScene.GameId = (int)Global.GetClientKuaFuServerLoginData(client).GameId; tianTiScene.m_nMapCode = mapCode; tianTiScene.CopyMapId = copyMap.CopyMapID; tianTiScene.FuBenSeqId = fuBenSeqId; tianTiScene.m_nPlarerCount = 1; TianTiSceneDict[fuBenSeqId] = tianTiScene; } else { tianTiScene.m_nPlarerCount++; } copyMap.IsKuaFuCopy = true; SaveClientBattleSide(tianTiScene, client); copyMap.SetRemoveTicks(TimeUtil.NOW() + RuntimeData.TotalSecs * TimeUtil.SECOND); if (tianTiScene.SuccessSide == -1) { client.sendCmd((int)TCPGameServerCmds.CMD_SPR_TIANTI_AWARD, new TianTiAwardsData() { Success = -1 }); } } //更新状态 TianTiClient.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.TianTi); return(true); } return(false); }
/// <summary> /// 添加一个场景 /// </summary> public bool AddCopyScene(GameClient client, CopyMap copyMap) { if (copyMap.MapCode == _runtimeData.MapID) { int fuBenSeqId = copyMap.FuBenSeqID; int mapCode = copyMap.MapCode; lock (_mutex) { CopyWolfSceneInfo newScene = null; if (!_runtimeData.SceneDict.TryGetValue(fuBenSeqId, out newScene)) { newScene = new CopyWolfSceneInfo(); newScene.CopyMapInfo = copyMap; newScene.CleanAllInfo(); newScene.GameId = Global.GetClientKuaFuServerLoginData(client).GameId; newScene.MapID = mapCode; newScene.CopyID = copyMap.CopyMapID; newScene.FuBenSeqId = fuBenSeqId; newScene.PlayerCount = 1; _runtimeData.SceneDict[fuBenSeqId] = newScene; } else { newScene.PlayerCount++; } client.ClientData.BattleWhichSide = _runtimeData.CampID; copyMap.IsKuaFuCopy = true; copyMap.SetRemoveTicks(TimeUtil.NOW() + _runtimeData.TotalSecs * TimeUtil.SECOND); GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, newScene.ScoreData, newScene.CopyMapInfo); } //更新状态 // ElementWarClient.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)_gameType); return(true); } return(false); }
public bool AddCopyScene(GameClient client, CopyMap copyMap) { bool result; if (copyMap.MapCode == this._runtimeData.MapID) { int fuBenSeqId = copyMap.FuBenSeqID; int mapCode = copyMap.MapCode; lock (CopyWolfManager._mutex) { CopyWolfSceneInfo newScene = null; if (!this._runtimeData.SceneDict.TryGetValue(fuBenSeqId, out newScene)) { newScene = new CopyWolfSceneInfo(); newScene.CopyMapInfo = copyMap; newScene.CleanAllInfo(); newScene.GameId = Global.GetClientKuaFuServerLoginData(client).GameId; newScene.MapID = mapCode; newScene.CopyID = copyMap.CopyMapID; newScene.FuBenSeqId = fuBenSeqId; newScene.PlayerCount = 1; this._runtimeData.SceneDict[fuBenSeqId] = newScene; } else { newScene.PlayerCount++; } client.ClientData.BattleWhichSide = this._runtimeData.CampID; copyMap.IsKuaFuCopy = true; copyMap.SetRemoveTicks(TimeUtil.NOW() + (long)(this._runtimeData.TotalSecs * 1000)); GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, newScene.ScoreData, newScene.CopyMapInfo); } GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, 11); result = true; } else { result = false; } return(result); }
/// <summary> /// 给奖励 /// </summary> public void GiveAwards(ElementWarScene scene) { try { FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID); if (fuBenMapItem == null) { return; } //FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(scene.FuBenSeqId); //if (null == fuBenInfoItem) return; //fuBenInfoItem.EndTicks = TimeUtil.NOW(); //int addFuBenNum = 1; //if (fuBenInfoItem.nDayOfYear != TimeUtil.NowDateTime().DayOfYear) // addFuBenNum = 0; //int usedSecs = (int)(scene.EndTime - scene.BeginTime); int zhanLi = 0; List <GameClient> objsList = scene.CopyMapInfo.GetClientsList(); if (objsList != null && objsList.Count > 0) { for (int n = 0; n < objsList.Count; ++n) { GameClient client = objsList[n]; if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID)) //确认角色仍然在线 { // 公式 long nExp = fuBenMapItem.Experience; int money = fuBenMapItem.Money1; int wave = scene.MonsterWaveOld; if (wave > 0) { wave -= 1; } int light = fuBenMapItem.LightAward + _runtimeData.AwardLight[wave]; if (nExp > 0) { GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false); } if (money > 0) { GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, string.Format(/**/ "副本{0}通关奖励", scene.CopyID), false); } if (light > 0) { GameManager.FluorescentGemMgr.AddFluorescentPoint(client, light, "元素试炼"); } ElementWarAwardsData awardsData = new ElementWarAwardsData() { Wave = scene.MonsterWaveOld, Exp = nExp, Money = money, Light = light }; AddElementWarCount(client); GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, (int)_gameType); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_ELEMENT_WAR_AWARD, awardsData); zhanLi += client.ClientData.CombatForce; Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1); } } } int roleCount = 0; if (objsList != null && objsList.Count > 0) { roleCount = objsList.Count; zhanLi = zhanLi / roleCount; } // ElementWarClient.getInstance().UpdateCopyPassEvent(scene.FuBenSeqId, roleCount, scene.MonsterWaveOld, zhanLi); } catch (System.Exception ex) { DataHelper.WriteExceptionLogEx(ex, "【元素试炼】清场调度异常"); } }
/// <summary> /// 给奖励 /// </summary> public void GiveAwards(HuanYingSiYuanScene huanYingSiYuanScene) { try { List <GameClient> objsList = huanYingSiYuanScene.CopyMap.GetClientsList(); if (objsList != null && objsList.Count > 0) { int nowDayId = Global.GetOffsetDayNow(); for (int n = 0; n < objsList.Count; ++n) { GameClient client = objsList[n]; if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID)) //确认角色仍然在线 { bool success = false; double nMultiple = 0.5; int awardsRate = 1; int count = 0; HuanYingSiYuanLianShaContextData clientLianShaContextData = client.SceneContextData2 as HuanYingSiYuanLianShaContextData; if (null != clientLianShaContextData && clientLianShaContextData.TotalScore >= RuntimeData.TempleMirageMinJiFen) { if (client.ClientData.BattleWhichSide == huanYingSiYuanScene.SuccessSide) { success = true; nMultiple = 1; //每日前3次享受10倍奖励 int dayid = Global.GetRoleParamsInt32FromDB(client, RoleParamName.HysySuccessDayId); if (dayid == nowDayId) { count = Global.GetRoleParamsInt32FromDB(client, RoleParamName.HysySuccessCount); if (count < RuntimeData.TempleMirageWinExtraNum) { awardsRate = RuntimeData.TempleMirageWinExtraRate; } } else { awardsRate = RuntimeData.TempleMirageWinExtraRate; } } } else { //达不到最低分数,无奖励,不计次 nMultiple = 0; awardsRate = 0; } // 公式 long nExp = (long)(RuntimeData.TempleMirageEXPAward * nMultiple * client.ClientData.ChangeLifeCount); int chengJiuaward = (int)(RuntimeData.TempleMirageAwardChengJiu * nMultiple); int shengWangaward = (int)(RuntimeData.TempleMirageAwardShengWang * nMultiple); if (nExp > 0) { GameManager.ClientMgr.ProcessRoleExperience(client, nExp * awardsRate, false); //GameManager.ClientMgr.NotifyAddExpMsg(client, nExp); //客户端自己提示,有显示"X10"的需求 } if (chengJiuaward > 0) { ChengJiuManager.AddChengJiuPoints(client, "幻影寺院获得成就", chengJiuaward * awardsRate, true, true); } if (shengWangaward > 0) { GameManager.ClientMgr.ModifyShengWangValue(client, shengWangaward * awardsRate, "幻影寺院获得声望"); } HuanYingSiYuanAwardsData awardsData = new HuanYingSiYuanAwardsData() { SuccessSide = huanYingSiYuanScene.SuccessSide, Exp = nExp, ShengWang = shengWangaward, ChengJiuAward = chengJiuaward, AwardsRate = awardsRate, }; if (success) { if (nMultiple > 0) { Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.HysySuccessDayId, nowDayId, true); Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.HysySuccessCount, count + 1, true); GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, (int)GameTypes.HuanYingSiYuan); if (huanYingSiYuanScene.ScoreInfoData.Score1 >= 1000 || huanYingSiYuanScene.ScoreInfoData.Score2 >= 1000) { //FaildCount记录为获得够1000分而获胜的人次 GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 0, 1, (int)GameTypes.HuanYingSiYuan); } } } else { //FaildCount记录为失败人次 //GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 0, 1); } client.sendCmd((int)TCPGameServerCmds.CMD_SPR_HYSY_AWARD, awardsData); } } } } catch (System.Exception ex) { DataHelper.WriteExceptionLogEx(ex, "幻影寺院清场调度异常"); } }
/// <summary> /// 给奖励 /// </summary> public void GiveAwards(TianTiScene tianTiScene) { try { DateTime now = TimeUtil.NowDateTime(); DateTime startTime = now.Subtract(RuntimeData.RefreshTime); //后退刷新时间,这样来保证不跨天计次 List <GameClient> objsList = tianTiScene.CopyMap.GetClientsList(); if (objsList != null && objsList.Count > 0) { int nowDayId = Global.GetOffsetDayNow(); for (int n = 0; n < objsList.Count; ++n) { GameClient client = objsList[n]; if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID)) //确认角色仍然在线 { RoleTianTiData roleTianTiData = client.ClientData.TianTiData; bool success = client.ClientData.BattleWhichSide == tianTiScene.SuccessSide; int selfDuanWeiId = roleTianTiData.DuanWeiId; TianTiRoleMiniData enemyMiniData = GetEnemyBattleSide(tianTiScene, client); int addDuanWeiJiFen = 0; int addLianShengJiFen = 0; int addRongYao = 0; int dayId = Global.GetOffsetDay(startTime); if (dayId != roleTianTiData.LastFightDayId) { roleTianTiData.LastFightDayId = dayId; roleTianTiData.TodayFightCount = 1; } else { roleTianTiData.TodayFightCount++; } //设置每日天梯积分获得上限为60万 if (roleTianTiData.DayDuanWeiJiFen < RuntimeData.MaxTianTiJiFen) { TianTiDuanWei tianTiDuanWei; if (success) { roleTianTiData.LianSheng++; roleTianTiData.SuccessCount++; if (RuntimeData.TianTiDuanWeiDict.TryGetValue(enemyMiniData.DuanWeiId, out tianTiDuanWei)) { //连胜后积分=基础积分*(1+Min(2,((连续胜利次数-1)* 0.2))) addDuanWeiJiFen = tianTiDuanWei.WinJiFen; addLianShengJiFen = (int)(tianTiDuanWei.WinJiFen * Math.Min(2, (roleTianTiData.LianSheng - 1) * 0.2)); if (roleTianTiData.TodayFightCount <= tianTiDuanWei.RongYaoNum) { addRongYao = tianTiDuanWei.WinRongYu; } } } else { roleTianTiData.LianSheng = 0; if (RuntimeData.TianTiDuanWeiDict.TryGetValue(roleTianTiData.DuanWeiId, out tianTiDuanWei)) { addDuanWeiJiFen = tianTiDuanWei.LoseJiFen; if (roleTianTiData.TodayFightCount <= tianTiDuanWei.RongYaoNum) { addRongYao = tianTiDuanWei.LoseRongYu; } } } if (addDuanWeiJiFen != 0) { roleTianTiData.DuanWeiJiFen += addDuanWeiJiFen + addLianShengJiFen; roleTianTiData.DuanWeiJiFen = Math.Max(0, roleTianTiData.DuanWeiJiFen); roleTianTiData.DayDuanWeiJiFen += addDuanWeiJiFen + addLianShengJiFen; roleTianTiData.DayDuanWeiJiFen = Math.Max(0, roleTianTiData.DayDuanWeiJiFen); Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.TianTiDayScore, roleTianTiData.DayDuanWeiJiFen, true); } } else { GameManager.ClientMgr.NotifyHintMsg(client, Global.GetLang("今日获得段位积分已达上限!")); } if (addRongYao != 0) { GameManager.ClientMgr.ModifyTianTiRongYaoValue(client, addRongYao, "天梯系统获得荣耀", true); } roleTianTiData.FightCount++; if (RuntimeData.DuanWeiJiFenRangeDuanWeiIdDict.TryGetValue(roleTianTiData.DuanWeiJiFen, out selfDuanWeiId)) { roleTianTiData.DuanWeiId = selfDuanWeiId; } TianTiAwardsData awardsData = new TianTiAwardsData(); awardsData.DuanWeiJiFen = addDuanWeiJiFen; awardsData.LianShengJiFen = addLianShengJiFen; awardsData.RongYao = addRongYao; awardsData.DuanWeiId = roleTianTiData.DuanWeiId; if (success) { awardsData.Success = 1; GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, (int)GameTypes.TianTi); } else { GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 0, 1, (int)GameTypes.TianTi); } client.sendCmd((int)TCPGameServerCmds.CMD_SPR_TIANTI_AWARD, awardsData); Global.sendToDB <int, RoleTianTiData>((int)TCPGameServerCmds.CMD_DB_TIANTI_UPDATE_ROLE_DATA, roleTianTiData, client.ServerId); TianTiLogItemData tianTiLogItemData = new TianTiLogItemData() { Success = awardsData.Success, ZoneId1 = client.ClientData.ZoneID, RoleName1 = client.ClientData.RoleName, ZoneId2 = enemyMiniData.ZoneId, RoleName2 = enemyMiniData.RoleName, DuanWeiJiFenAward = addDuanWeiJiFen + addLianShengJiFen, RongYaoAward = addRongYao, RoleId = client.ClientData.RoleID, EndTime = now, }; Global.sendToDB <int, TianTiLogItemData>((int)TCPGameServerCmds.CMD_DB_TIANTI_ADD_ZHANBAO_LOG, tianTiLogItemData, client.ServerId); TianTiPaiHangRoleData tianTiPaiHangRoleData = new TianTiPaiHangRoleData(); tianTiPaiHangRoleData.DuanWeiId = roleTianTiData.DuanWeiId; tianTiPaiHangRoleData.RoleId = roleTianTiData.RoleId; tianTiPaiHangRoleData.RoleName = client.ClientData.RoleName; tianTiPaiHangRoleData.Occupation = client.ClientData.Occupation; tianTiPaiHangRoleData.ZhanLi = client.ClientData.CombatForce; tianTiPaiHangRoleData.ZoneId = client.ClientData.ZoneID; tianTiPaiHangRoleData.DuanWeiJiFen = roleTianTiData.DuanWeiJiFen; RoleData4Selector roleInfo = Global.sendToDB <RoleData4Selector, string>((int)TCPGameServerCmds.CMD_SPR_GETROLEUSINGGOODSDATALIST, string.Format("{0}", client.ClientData.RoleID), client.ServerId); if (null != roleInfo || roleInfo.RoleID < 0) { tianTiPaiHangRoleData.RoleData4Selector = roleInfo; } PlayerJingJiData jingJiData = JingJiChangManager.getInstance().createJingJiData(client); TianTiRoleInfoData tianTiRoleInfoData = new TianTiRoleInfoData(); tianTiRoleInfoData.RoleId = tianTiPaiHangRoleData.RoleId; tianTiRoleInfoData.ZoneId = tianTiPaiHangRoleData.ZoneId; tianTiRoleInfoData.ZhanLi = tianTiPaiHangRoleData.ZhanLi; tianTiRoleInfoData.RoleName = tianTiPaiHangRoleData.RoleName; tianTiRoleInfoData.DuanWeiId = tianTiPaiHangRoleData.DuanWeiId; tianTiRoleInfoData.DuanWeiJiFen = tianTiPaiHangRoleData.DuanWeiJiFen; tianTiRoleInfoData.DuanWeiRank = tianTiPaiHangRoleData.DuanWeiRank; tianTiRoleInfoData.TianTiPaiHangRoleData = DataHelper.ObjectToBytes(tianTiPaiHangRoleData); tianTiRoleInfoData.PlayerJingJiMirrorData = DataHelper.ObjectToBytes(jingJiData); TianTiClient.getInstance().UpdateRoleInfoData(tianTiRoleInfoData); } } } } catch (System.Exception ex) { DataHelper.WriteExceptionLogEx(ex, "天梯系统清场调度异常"); } }
public void GiveAwards(ElementWarScene scene) { try { FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID); if (fuBenMapItem != null) { int zhanLi = 0; List <GameClient> objsList = scene.CopyMapInfo.GetClientsList(); if (objsList != null && objsList.Count > 0) { for (int i = 0; i < objsList.Count; i++) { GameClient client = objsList[i]; if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID)) { long nExp = (long)fuBenMapItem.Experience; int money = fuBenMapItem.Money1; int wave = scene.MonsterWaveOld; int light = fuBenMapItem.LightAward + this._runtimeData.AwardLight[wave]; int ysfm = fuBenMapItem.YuanSuFenMoaward + this._runtimeData.YuanSuShiLianAward2[wave]; if (nExp > 0L) { GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false, true, false, "none"); } if (money > 0) { GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, string.Format("副本{0}通关奖励", scene.CopyID), false); } if (light > 0) { GameManager.FluorescentGemMgr.AddFluorescentPoint(client, light, "元素试炼", true); } if (ysfm > 0) { GameManager.ClientMgr.ModifyYuanSuFenMoValue(client, ysfm, "元素试炼", true, false); } ElementWarAwardsData awardsData = new ElementWarAwardsData { Wave = scene.MonsterWaveOld, Exp = nExp, Money = money, Light = light, ysfm = ysfm }; this.AddElementWarCount(client); GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, 4); client.sendCmd <ElementWarAwardsData>(1015, awardsData, false); zhanLi += client.ClientData.CombatForce; Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1); } } } if (objsList != null && objsList.Count > 0) { int roleCount = objsList.Count; zhanLi /= roleCount; } } } catch (Exception ex) { DataHelper.WriteExceptionLogEx(ex, "【元素试炼】清场调度异常"); } }
/// <summary> /// 给奖励 /// </summary> public void GiveAwards(CopyWolfSceneInfo scene, int leftSecond) { try { FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID); if (fuBenMapItem == null) { return; } int zhanLi = 0; List <GameClient> objsList = scene.CopyMapInfo.GetClientsList(); if (objsList != null && objsList.Count > 0) { for (int n = 0; n < objsList.Count; ++n) { GameClient client = objsList[n]; if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID)) //确认角色仍然在线 { int wave = scene.MonsterWaveOld; if (wave > scene.MonsterWaveTotal) { wave = scene.MonsterWaveTotal; } int scoreMonster = scene.GetMonsterScore(client.ClientData.RoleID); int life = scene.ScoreData.FortLifeNow; int scoreAll = GetScore(scoreMonster, leftSecond, life); // 公式 long nExp = AwardExp(fuBenMapItem.Experience, scoreAll); int money = AwardGoldBind(fuBenMapItem.Money1, scoreAll); int wolfMoney = AwardWolfMoney(fuBenMapItem.WolfMoney, scoreAll); if (nExp > 0) { GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false); } if (money > 0) { GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, string.Format("副本{0}通关奖励", scene.CopyID), false); } if (wolfMoney > 0) { GameManager.ClientMgr.ModifyLangHunFenMoValue(client, wolfMoney, "狼魂要塞", true); } CopyWolfAwardsData awardsData = new CopyWolfAwardsData() { Wave = scene.MonsterWaveOld, Exp = nExp, Money = money, WolfMoney = wolfMoney, RoleScore = scene.GetMonsterScore(client.ClientData.RoleID) }; //AddElementWarCount(client); GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, (int)_gameType); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_AWARD, awardsData); zhanLi += client.ClientData.CombatForce; Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1); } } } int roleCount = 0; if (objsList != null && objsList.Count > 0) { roleCount = objsList.Count; zhanLi = zhanLi / roleCount; } // ElementWarClient.getInstance().UpdateCopyPassEvent(scene.FuBenSeqId, roleCount, scene.MonsterWaveOld, zhanLi); } catch (System.Exception ex) { DataHelper.WriteExceptionLogEx(ex, "【狼魂要塞】清场调度异常"); } }
public void GiveAwards(CopyWolfSceneInfo scene, int leftSecond) { try { FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID); if (fuBenMapItem != null) { int zhanLi = 0; List <GameClient> objsList = scene.CopyMapInfo.GetClientsList(); if (objsList != null && objsList.Count > 0) { for (int i = 0; i < objsList.Count; i++) { GameClient client = objsList[i]; if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID)) { int wave = scene.MonsterWaveOld; if (wave > scene.MonsterWaveTotal) { wave = scene.MonsterWaveTotal; } int scoreMonster = scene.GetMonsterScore(client.ClientData.RoleID); int life = scene.ScoreData.FortLifeNow; int scoreAll = this.GetScore(scoreMonster, leftSecond, life); long nExp = (long)this.AwardExp(fuBenMapItem.Experience, scoreAll); int money = this.AwardGoldBind(fuBenMapItem.Money1, scoreAll); int wolfMoney = this.AwardWolfMoney(fuBenMapItem.WolfMoney, scoreAll); if (nExp > 0L) { GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false, true, false, "none"); } if (money > 0) { GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, string.Format("副本{0}通关奖励", scene.CopyID), false); } if (wolfMoney > 0) { GameManager.ClientMgr.ModifyLangHunFenMoValue(client, wolfMoney, "狼魂要塞", true, true); } CopyWolfAwardsData awardsData = new CopyWolfAwardsData { Wave = scene.MonsterWaveOld, Exp = nExp, Money = money, WolfMoney = wolfMoney, RoleScore = scene.GetMonsterScore(client.ClientData.RoleID) }; GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, 11); client.sendCmd <CopyWolfAwardsData>(1026, awardsData, false); zhanLi += client.ClientData.CombatForce; Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1); } } } if (objsList != null && objsList.Count > 0) { int roleCount = objsList.Count; zhanLi /= roleCount; } } } catch (Exception ex) { DataHelper.WriteExceptionLogEx(ex, "【狼魂要塞】清场调度异常"); } }
/// <summary> /// 开始匹配 /// </summary> public bool ProcessJoinCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams) { try { SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode); if (sceneType != SceneUIClasses.Normal) { client.sendCmd(nID, StdErrorCode.Error_Denied_In_Current_Map.ToString()); return(true); } if (!IsGongNengOpened(client, true)) { client.sendCmd(nID, StdErrorCode.Error_Not_In_valid_Time.ToString()); return(true); } if (client.ClientData.SignUpGameType != (int)GameTypes.None) { client.sendCmd(nID, StdErrorCode.Error_Denied_In_Activity_Time.ToString()); return(true); } if (KuaFuManager.getInstance().IsInCannotJoinKuaFuCopyTime(client)) { client.sendCmd(nID, StdErrorCode.Error_Time_Punish.ToString()); return(true); } SystemXmlItem systemFuBenItem = null; if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(_runtimeData.CopyID, out systemFuBenItem)) { client.sendCmd(nID, StdErrorCode.Error_Config_Fault.ToString()); return(true); } int minLevel = systemFuBenItem.GetIntValue("MinLevel"); int minZhuanSheng = systemFuBenItem.GetIntValue("MinZhuanSheng"); int levelLimit = minZhuanSheng * 100 + minLevel; // 先判断等级 if (client.ClientData.ChangeLifeCount * 100 + client.ClientData.Level < levelLimit) { client.sendCmd(nID, StdErrorCode.Error_Level_Limit.ToString()); return(true); } // 判断剩余次数 int oldCount = GetElementWarCount(client); if (oldCount >= systemFuBenItem.GetIntValue("FinishNumber")) { client.sendCmd(nID, StdErrorCode.Error_No_Residue_Degree.ToString()); return(true); } int result = 0;// ElementWarClient.getInstance().SignUp(client.strUserID, client.ClientData.RoleID, client.ClientData.ZoneID, (int)_gameType, client.ClientData.CombatForce); if (result > 0) { client.ClientData.SignUpGameType = (int)_gameType; // 报名统计 GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 1, 0, 0, 0, (int)_gameType); } client.sendCmd(nID, result); return(true); } catch (Exception ex) { DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false); } return(false); }
/// <summary> /// 罗兰城战攻防竞价申请指令处理 /// </summary> /// <param name="client"></param> /// <param name="nID"></param> /// <param name="bytes"></param> /// <param name="cmdParams"></param> /// <returns></returns> public bool ProcessHuanYingSiYuanEnqueueCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams) { try { SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode); if (sceneType != SceneUIClasses.Normal) { client.sendCmd(nID, StdErrorCode.Error_Denied_In_Current_Map); return(true); } if (!IsGongNengOpened(client, true)) { client.sendCmd(nID, StdErrorCode.Error_Not_In_valid_Time); return(true); } int result = StdErrorCode.Error_Not_In_valid_Time; int gropuIndex = 1; TimeSpan time = TimeUtil.NowDateTime().TimeOfDay; lock (RuntimeData.Mutex) { for (int i = 0; i < RuntimeData.TimePoints.Count - 1; i += 2) { if (time >= RuntimeData.TimePoints[i] && time < RuntimeData.TimePoints[i + 1]) { result = StdErrorCode.Error_Success; break; } } if (result >= StdErrorCode.Error_Success) { if (!RuntimeData.Range2GroupIndexDict.TryGetValue(new RangeKey(Global.GetUnionLevel(client)), out gropuIndex)) { result = StdErrorCode.Error_Operation_Denied; //Error_Level_Limit } } } if (result >= 0) { result = HuanYingSiYuanClient.getInstance().HuanYingSiYuanSignUp(client.strUserID, client.ClientData.RoleID, client.ClientData.ZoneID, (int)GameTypes.HuanYingSiYuan, gropuIndex, client.ClientData.CombatForce); if (result == (int)KuaFuRoleStates.SignUp) { client.ClientData.SignUpGameType = (int)GameTypes.HuanYingSiYuan; GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 1, 0, 0, 0, (int)GameTypes.HuanYingSiYuan); } } //发送结果给客户端 client.sendCmd(nID, result); return(true); } catch (Exception ex) { DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false); } return(false); }