public static bool CanFuBenMapFallGoodsAutoGet(GameClient client) { int fuBenSeqID = client.ClientData.FuBenSeqID; FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID); bool result; if (null == fuBenInfoItem) { result = false; } else { SystemXmlItem systemFuBenItem = null; if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(fuBenInfoItem.FuBenID, out systemFuBenItem)) { result = false; } else { int copyType = systemFuBenItem.GetIntValue("CopyType", -1); result = (0 == copyType); } } return(result); }
/// <summary> /// 根据副本ID和地图编号, 当前所在的层数 /// </summary> /// <param name="fuBenID"></param> /// <returns></returns> public static int FindMapCodeIndexByFuBenID(int mapCode) { int fuBenID = FuBenManager.FindFuBenIDByMapCode(mapCode); if (fuBenID <= 0) { return(0); } //根据副本ID获取副本地图列表 List <int> mapCodeList = FindMapCodeListByFuBenID(fuBenID); if (null == mapCodeList) { return(0); } int findIndex = mapCodeList.IndexOf(mapCode); if (-1 == findIndex) { return(0); } return(findIndex + 1); }
public static void LoadFuBenMap() { XElement xml = null; string fileName = "Config/FuBenMap.xml"; try { xml = XElement.Load(Global.GameResPath(fileName)); if (null == xml) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } } catch (Exception) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } IEnumerable <XElement> nodes = xml.Elements(); foreach (XElement node in nodes) { SystemXmlItem systemXmlItem = new SystemXmlItem { XMLNode = node }; FuBenManager.ParseXmlItem(systemXmlItem); } }
public static int FindMapCodeIndexByFuBenID(int mapCode) { int fuBenID = FuBenManager.FindFuBenIDByMapCode(mapCode); int result; if (fuBenID <= 0) { result = 0; } else { List <int> mapCodeList = FuBenManager.FindMapCodeListByFuBenID(fuBenID); if (null == mapCodeList) { result = 0; } else { int findIndex = mapCodeList.IndexOf(mapCode); if (-1 == findIndex) { result = 0; } else { result = findIndex + 1; } } } return(result); }
public static int FindNextMapCodeByFuBenID(int mapCode) { int fuBenID = FuBenManager.FindFuBenIDByMapCode(mapCode); int result; if (fuBenID <= 0) { result = -1; } else { List <int> mapCodeList = FuBenManager.FindMapCodeListByFuBenID(fuBenID); if (null == mapCodeList) { result = -1; } else { int findIndex = mapCodeList.IndexOf(mapCode); if (-1 == findIndex) { result = -1; } else if (findIndex >= mapCodeList.Count - 1) { result = -1; } else { result = mapCodeList[findIndex + 1]; } } } return(result); }
public void AddDynamicMonsterZone(int mapCode) { bool isFuBenMap = FuBenManager.IsFuBenMap(mapCode); MonsterZone monsterZone = new MonsterZone { MapCode = mapCode, ID = this.MonsterDynamicZoneDict.Count + 10000, Code = -1, ToX = -1, ToY = -1, Radius = 300, TotalNum = 0, Timeslot = 1, IsFuBenMap = isFuBenMap, BirthType = 3, ConfigBirthType = -1, BirthTimePointList = null, BirthRate = 10000 }; monsterZone.PursuitRadius = 0; lock (this.InitMonsterZoneMutex) { this.MonsterDynamicZoneDict.Add(mapCode, monsterZone); this.MonsterZoneList.Add(monsterZone); if (isFuBenMap) { this.FuBenMonsterZoneList.Add(monsterZone); } this.AddMap2MonsterZoneDict(monsterZone); } }
public static bool IsFuBenMap(int mapCode) { bool isFuBenMap = FuBenManager.FindFuBenIDByMapCode(mapCode) > 0; if (Global.GetMapType(mapCode) == MapTypes.HuanYingSiYuan) { isFuBenMap = true; } return(isFuBenMap); }
/// <summary> /// 判断副本地图中奖励物品的绑定状态 /// </summary> /// <returns></returns> public static int GetFuBenMapAwardsGoodsBinding(int fuBenSeqID) { //查找一个副本顺序ID的信息项 FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID); if (null == fuBenInfoItem) { return(0); } return(fuBenInfoItem.GoodsBinding); }
public static void SendMsgToClientForGlodCopySceneMonsterWave(GameClient client, int nWave) { if (client != null) { int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode); if (fuBenID > 0) { string strcmd = string.Format("{0}:{1}", nWave, Data.Goldcopyscenedata.GoldCopySceneMonsterData.Count <KeyValuePair <int, GoldCopySceneMonster> >()); TCPOutPacket tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(Global._TCPManager.TcpOutPacketPool, strcmd, 628); Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket, true); } } }
/// <summary> /// 判断是否能自动领取副本地图中中的奖励 /// </summary> /// <returns></returns> public static bool CanAutoGetFuBenMapAwards(GameClient client) { int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode); if (fuBenID <= 0) { return(false); } if (client.ClientData.FuBenSeqID <= 0) { return(false); } FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(client.ClientData.FuBenSeqID); if (null == fuBenInfoItem) { return(false); } if (fuBenID != fuBenInfoItem.FuBenID) { return(false); } FuBenMapItem fuBenMapItem = FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode); if (null == fuBenMapItem) { return(false); } if (null == fuBenMapItem.GoodsDataList || fuBenMapItem.GoodsDataList.Count <= 0) { if (fuBenMapItem.Experience <= 0) { if (fuBenMapItem.Money1 <= 0) { return(false); } } } if (null == fuBenMapItem.GoodsDataList || fuBenMapItem.GoodsDataList.Count <= 0) { return(true); } return(false); }
/// <summary> // 通知客户端怪波数信息 /// </summary> public static void SendMsgToClientForGlodCopySceneMonsterWave(GameClient client, int nWave) { if (client != null) { int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode); if (fuBenID > 0) { string strcmd = string.Format("{0}:{1}", nWave, Data.Goldcopyscenedata.GoldCopySceneMonsterData.Count());//1.当前的波数 2.总波数 TCPOutPacket tcpOutPacket = null; tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(Global._TCPManager.TcpOutPacketPool, strcmd, (int)TCPGameServerCmds.CMD_SPR_GOLDCOPYSCENEMONSTERWAVE); Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket); } } }
public static void SendMsgToClientForGlodCopyScenePrepare(GameClient client, GoldCopyScene goldcopyscene) { if (client != null) { int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode); if (fuBenID > 0) { long ticks = TimeUtil.NOW(); int nTimer = (int)(((long)GlodCopySceneManager.m_PrepareTime - (ticks - goldcopyscene.m_StartTimer)) / 1000L); string strcmd = string.Format("{0}", nTimer); GameManager.ClientMgr.SendToClient(client, strcmd, 627); } } }
public static bool CanGetFuBenMapAwards(GameClient client) { int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode); bool result; if (fuBenID <= 0) { result = false; } else if (client.ClientData.FuBenSeqID <= 0) { result = false; } else { FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(client.ClientData.FuBenSeqID); if (null == fuBenInfoItem) { result = false; } else if (fuBenID != fuBenInfoItem.FuBenID) { result = false; } else { FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode); if (null == fuBenMapItem) { result = false; } else { if (fuBenMapItem.GoodsDataList == null || fuBenMapItem.GoodsDataList.Count <= 0) { if (fuBenMapItem.Experience <= 0) { if (fuBenMapItem.Money1 <= 0) { return(false); } } } result = true; } } } return(result); }
public static int GetFuBenMapAwardsGoodsBinding(int fuBenSeqID) { FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID); int result; if (null == fuBenInfoItem) { result = 0; } else { result = fuBenInfoItem.GoodsBinding; } return(result); }
/// <summary> /// 添加动态爆怪区域,每个地图有一个,所有参数都动态生成 /// </summary> /// <param name="mapCode"></param> public void AddDynamicMonsterZone(int mapCode) { //判断是否是副本地图 bool isFuBenMap = FuBenManager.IsFuBenMap(mapCode); MonsterZone monsterZone = new MonsterZone() { MapCode = mapCode, ID = MonsterDynamicZoneDict.Count + 10000, //动态配置 爆怪的区域ID,这个ID这样生成就可以 Code = -1, //动态配置---区域怪物ID,需要生成的时候动态配置 ToX = -1, //动态配置 ToY = -1, //动态配置 Radius = 300, //可以动态修改 TotalNum = 0, //动态 Timeslot = 1, IsFuBenMap = isFuBenMap, //意味着该区域的怪不管是在副本还说非副本,都由外部代码动态控制怪物的加载,怪物不会被程序定期循环复活 //同时该区域的怪物一旦死亡,直接销毁【将来或许需要加入一个针对这种类型的最大复活次数?】 BirthType = (int)MonsterBirthTypes.CrossMap, //这个字段非常重要,用于区分是动态刷怪区域还是 旧的系统怪区域!!!!!! ConfigBirthType = -1, //配置文件可没配置 BirthTimePointList = null, BirthRate = 10000, //必爆 }; //追踪范围,动态配置 monsterZone.PursuitRadius = 0; lock (InitMonsterZoneMutex) { //动态爆怪区域列表--->里面的怪物一旦死亡,移除 MonsterDynamicZoneDict.Add(mapCode, monsterZone); //加入列表 MonsterZoneList.Add(monsterZone); //如果是副本地图, 则加入副本爆怪区域列表 if (isFuBenMap) { FuBenMonsterZoneList.Add(monsterZone); } //加入爆怪区域 AddMap2MonsterZoneDict(monsterZone); } }
/// <summary> // 通知客户端 /// </summary> public static void SendMsgToClientForGlodCopyScenePrepare(GameClient client, GoldCopyScene goldcopyscene) { if (client != null) { int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode); if (fuBenID > 0) { string strcmd = ""; long ticks = TimeUtil.NOW(); // 当前tick int nTimer = (int)((m_PrepareTime - (ticks - goldcopyscene.m_StartTimer)) / 1000); strcmd = string.Format("{0}", nTimer); GameManager.ClientMgr.SendToClient(client, strcmd, (int)TCPGameServerCmds.CMD_SPR_GOLDCOPYSCENEPREPAREFIGHT); } } }
/// <summary> /// 判断副本地图中掉落的物品是否自动飞入背包 /// </summary> /// <returns></returns> public static bool CanFuBenMapFallGoodsAutoGet(GameClient client) { int fuBenSeqID = client.ClientData.FuBenSeqID; //查找一个副本顺序ID的信息项 FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID); if (null == fuBenInfoItem) { return(false); } //获取副本的数据 SystemXmlItem systemFuBenItem = null; if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(fuBenInfoItem.FuBenID, out systemFuBenItem)) { return(false); } int copyType = systemFuBenItem.GetIntValue("CopyType"); return(0 == copyType); }
/// <summary> /// 加载怪物 /// </summary> public void AddMapMonsters(int mapCode, GameMap gameMap) { //对于每一个地图,都要加入一个动态刷怪区域,用于动态刷怪管理 AddDynamicMonsterZone(mapCode); string fileName = string.Format("Map/{0}/Monsters.xml", mapCode); XElement xml = null; try { xml = XElement.Load(Global.ResPath(fileName)); } catch (Exception) { throw new Exception(string.Format("加载地图怪物配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } IEnumerable <XElement> monsterItems = xml.Elements("Monsters").Elements(); if (null == monsterItems) { return; } //判断是否是副本地图 bool isFuBenMap = FuBenManager.IsFuBenMap(mapCode); foreach (var monsterItem in monsterItems) { String timePoints = Global.GetSafeAttributeStr(monsterItem, "TimePoints"); int configBirthType = (int)Global.GetSafeAttributeLong(monsterItem, "BirthType"); int realBirthType = configBirthType; String realTimePoints = timePoints; int spawnMonstersAfterKaiFuDays = 0; int spawnMonstersDays = 0; List <BirthTimeForDayOfWeek> CreateMonstersDayOfWeek = new List <BirthTimeForDayOfWeek>(); List <BirthTimePoint> birthTimePointList = null; //对于开服多少天之后才开始刷怪,进行特殊配置 格式:开服多少天;连续刷多少天[负数0表示一直];刷怪方式0或1;0或1的配置 if ((int)MonsterBirthTypes.AfterKaiFuDays == configBirthType || (int)MonsterBirthTypes.AfterHeFuDays == configBirthType || (int)MonsterBirthTypes.AfterJieRiDays == configBirthType) { String[] arr = timePoints.Split(';'); if (4 != arr.Length) { throw new Exception(String.Format("地图{0}的类型4的刷怪配置参数个数不对!!!!", mapCode)); } spawnMonstersAfterKaiFuDays = int.Parse(arr[0]); spawnMonstersDays = int.Parse(arr[1]); realBirthType = int.Parse(arr[2]); realTimePoints = arr[3]; if ((int)MonsterBirthTypes.TimePoint != realBirthType && (int)MonsterBirthTypes.TimeSpan != realBirthType) { throw new Exception(String.Format("地图{0}的类型4的刷怪配置子类型不对!!!!", mapCode)); } } // MU新增 一周中的哪天刷 TimePoints 配置形式 周几,时间点|周几,时间点|周几,时间点... [1/10/2014 LiaoWei] if ((int)MonsterBirthTypes.CreateDayOfWeek == configBirthType) { String[] arrTime = timePoints.Split('|'); if (arrTime.Length > 0) { for (int nIndex = 0; nIndex < arrTime.Length; ++nIndex) { string sTimePoint = null; sTimePoint = arrTime[nIndex]; if (sTimePoint != null) { String[] sTime = null; sTime = sTimePoint.Split(','); if (sTime != null && sTime.Length == 2) { string sTimeString = null; int nDayOfWeek = -1; nDayOfWeek = int.Parse(sTime[0]); sTimeString = sTime[1]; if (nDayOfWeek != -1 && !string.IsNullOrEmpty(sTimeString)) { string[] fields2 = sTimeString.Split(':'); if (fields2.Length != 2) { continue; } string str1 = fields2[0].TrimStart('0'); string str2 = fields2[1].TrimStart('0'); BirthTimePoint birthTimePoint = new BirthTimePoint() { BirthHour = Global.SafeConvertToInt32(str1), BirthMinute = Global.SafeConvertToInt32(str2), }; BirthTimeForDayOfWeek BirthTimeTmp = new BirthTimeForDayOfWeek(); BirthTimeTmp.BirthDayOfWeek = nDayOfWeek; BirthTimeTmp.BirthTime = birthTimePoint; CreateMonstersDayOfWeek.Add(BirthTimeTmp); } } } } } } else { birthTimePointList = ParseBirthTimePoints(realTimePoints); } MonsterZone monsterZone = new MonsterZone() { MapCode = mapCode, ID = (int)Global.GetSafeAttributeLong(monsterItem, "ID"), Code = (int)Global.GetSafeAttributeLong(monsterItem, "Code"), ToX = (int)Global.GetSafeAttributeLong(monsterItem, "X") / gameMap.MapGridWidth, ToY = (int)Global.GetSafeAttributeLong(monsterItem, "Y") / gameMap.MapGridHeight, Radius = (int)Global.GetSafeAttributeLong(monsterItem, "Radius") / gameMap.MapGridWidth, TotalNum = (int)Global.GetSafeAttributeLong(monsterItem, "Num"), Timeslot = (int)Global.GetSafeAttributeLong(monsterItem, "Timeslot"), IsFuBenMap = isFuBenMap, BirthType = realBirthType, ConfigBirthType = configBirthType, SpawnMonstersAfterKaiFuDays = spawnMonstersAfterKaiFuDays, SpawnMonstersDays = spawnMonstersDays, SpawnMonstersDayOfWeek = CreateMonstersDayOfWeek, BirthTimePointList = birthTimePointList, BirthRate = (int)(Global.GetSafeAttributeDouble(monsterItem, "BirthRate") * 10000), }; XAttribute attrib = monsterItem.Attribute("PursuitRadius"); if (null != attrib) { monsterZone.PursuitRadius = (int)Global.GetSafeAttributeLong(monsterItem, "PursuitRadius"); } else { monsterZone.PursuitRadius = (int)Global.GetSafeAttributeLong(monsterItem, "Radius"); } lock (InitMonsterZoneMutex) { //加入列表 MonsterZoneList.Add(monsterZone); //如果是副本地图, 则加入副本爆怪区域列表 if (isFuBenMap) { FuBenMonsterZoneList.Add(monsterZone); } //加入爆怪区域 AddMap2MonsterZoneDict(monsterZone); } //加载静态的怪物信息 monsterZone.LoadStaticMonsterInfo(); //加载怪物 monsterZone.LoadMonsters();//暂时屏蔽怪物加载 } }
/// <summary> /// 处理用户的获取副本奖励 /// </summary> /// <param name="client"></param> public static bool ProcessFuBenMapAwards(GameClient client, bool notifyClient = false) { if (client.ClientData.FuBenSeqID < 0) { GameManager.ClientMgr.NotifyImportantMsg( Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("您当前的副本顺序ID错误")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox); return(false); } //如果已经获取过一次奖励,则不再提示奖励 //查找角色的ID+副本顺序ID对应地图编号的奖励领取状态 int awardState = GameManager.CopyMapMgr.FindAwardState(client.ClientData.RoleID, client.ClientData.FuBenSeqID, client.ClientData.MapCode); if (awardState > 0) { GameManager.ClientMgr.NotifyImportantMsg( Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("当前副本地图的奖励只能领取一次")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox); return(false); } int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode); if (fuBenID <= 0) { GameManager.ClientMgr.NotifyImportantMsg( Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("没有找到当前地图对应的副本配置")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox); return(false); } FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(client.ClientData.FuBenSeqID); if (null == fuBenInfoItem) { GameManager.ClientMgr.NotifyImportantMsg( Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("没有找到对应的内存副本信息")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox); return(false); } if (fuBenID != fuBenInfoItem.FuBenID) { GameManager.ClientMgr.NotifyImportantMsg( Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("副本ID错误,无法领取其他副本的奖励")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox); return(false); } FuBenMapItem fuBenMapItem = FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode); if (null == fuBenMapItem) { GameManager.ClientMgr.NotifyImportantMsg( Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("没有找到当前副本地图的奖励")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox); return(false); } CopyMap copyMap = null; copyMap = GameManager.CopyMapMgr.FindCopyMap(client.ClientData.MapCode); if (copyMap == null) { GameManager.ClientMgr.NotifyImportantMsg( Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("领取副本奖励出错")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox); return(false); } GameManager.CopyMapMgr.AddAwardState(client.ClientData.RoleID, client.ClientData.FuBenSeqID, client.ClientData.MapCode, 1); FuBenTongGuanData fubenTongGuanData = null; int nMaxTime = fuBenMapItem.MaxTime * 60; //分->秒 long startTicks = fuBenInfoItem.StartTicks; long endTicks = fuBenInfoItem.EndTicks; int nFinishTimer = (int)(endTicks - startTicks) / 1000; //毫秒->秒 int killedNum = 0; // copyMap.KilledNormalNum + copyMap.KilledBossNum; int nDieCount = fuBenInfoItem.nDieCount; //向客户的发放通关奖励 fubenTongGuanData = Global.GiveCopyMapGiftForScore(client, fuBenID, nMaxTime, nFinishTimer, killedNum, nDieCount, fuBenMapItem.Experience, fuBenMapItem.Money1, fuBenMapItem); if (fubenTongGuanData != null) { //发送奖励到客户端 TCPOutPacket tcpOutPacket = DataHelper.ObjectToTCPOutPacket <FuBenTongGuanData>(fubenTongGuanData, Global._TCPManager.TcpOutPacketPool, (int)TCPGameServerCmds.CMD_SPR_FUBENPASSNOTIFY); if (!Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket)) { //如果发送失败 } } /*if (null != fuBenMapItem.GoodsDataList) * { * //判断背包是否空间足够 * if (!Global.CanAddGoodsDataList(client, fuBenMapItem.GoodsDataList)) * { * GameManager.ClientMgr.NotifyImportantMsg( * Global._TCPManager.MySocketListener, * Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("背包中空格不足,请清理出足够的空格后,再获取副本地图的奖励")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, (int)HintErrCodeTypes.NoBagGrid); * return false; * } * } * * //添加角色的ID+副本顺序ID对应地图编号的奖励领取状态 * GameManager.CopyMapMgr.AddAwardState(client.ClientData.RoleID, client.ClientData.FuBenSeqID, client.ClientData.MapCode, 1); * * if (Global.FilterFallGoods(client)) //是否奖励物品 * { * //奖励用户物品 * if (null != fuBenMapItem.GoodsDataList) * { * for (int i = 0; i < fuBenMapItem.GoodsDataList.Count; i++) * { * //想DBServer请求加入某个新的物品到背包中 * //添加物品 * Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, * client, fuBenMapItem.GoodsDataList[i].GoodsID, fuBenMapItem.GoodsDataList[i].GCount, fuBenMapItem.GoodsDataList[i].Quality, "", fuBenMapItem.GoodsDataList[i].Forge_level, fuBenMapItem.GoodsDataList[i].Binding, 0, "", true, 1, "副本奖励物品", Global.ConstGoodsEndTime, fuBenMapItem.GoodsDataList[i].AddPropIndex, fuBenMapItem.GoodsDataList[i].BornIndex, fuBenMapItem.GoodsDataList[i].Lucky, fuBenMapItem.GoodsDataList[i].Strong); * } * } * } * * //奖励用户经验 * //异步写数据库,写入经验和级别 * int experience = fuBenMapItem.Experience; * * //处理角色经验 * GameManager.ClientMgr.ProcessRoleExperience(client, experience, true, false); * * //通知客户端 * if (notifyClient) * { * string msgText = string.Format(Global.GetLang("恭喜您通关本副本后,获得了{0}点经验奖励"), experience); * GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, * client, msgText, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox, 0); * } * * //判断如果是最后一层,则不显示 * int toNextMapCode = FuBenManager.FindNextMapCodeByFuBenID(client.ClientData.MapCode); * if (-1 == toNextMapCode) //最后一层? * { * //副本通关获取经验通知 * Global.BroadcastFuBenExperience(client, fuBenID, experience); * } * * //奖励用户金钱 * //异步写数据库,写入金钱 * int money = fuBenMapItem.Money1; * if (-1 != money) * { * //过滤金币奖励 * money = Global.FilterValue(client, money); * * //更新用户的铜钱 * GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, false); * * //GameManager.SystemServerEvents.AddEvent(string.Format("角色获取金钱, roleID={0}({1}), Money={2}, newMoney={3}", client.ClientData.RoleID, client.ClientData.RoleName, client.ClientData.Money1, money), EventLevels.Record); * }*/ Global.AddFuBenAwardEvent(client, fuBenID); return(true); }
/// <summary> /// 检查死亡的怪物是否为帮会副本boss并进行通关处理 /// </summary> public void ProcessMonsterDead(GameClient client, Monster monster) { // 怪物所在场景不是帮会地图 if (IsGuildCopyMap(monster.CurrentMapCode) == false) { return; } SystemXmlItem systemFuBenItem = null; if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(monster.CurrentMapCode, out systemFuBenItem)) { return; } if (null == systemFuBenItem) { return; } int nBossID = systemFuBenItem.GetIntValue("BossID"); // 不是boss if (nBossID != monster.MonsterInfo.ExtensionID) { return; } // 玩家没有帮会? GuildCopyMapDB data = GameManager.GuildCopyMapDBMgr.FindGuildCopyMapDB(client.ClientData.Faction); if (null == data) { LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == data), guildid={0}", client.ClientData.Faction)); return; } // 没有对应副本? CopyMap copyMap = GameManager.CopyMapMgr.FindCopyMap(monster.CurrentCopyMapID); if (null == copyMap) { LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == copyMap), CurrentCopyMapID={0}", monster.CurrentCopyMapID)); return; } // 没有奖励配置? FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(copyMap.FubenMapID, copyMap.MapCode); if (null == fuBenMapItem) { LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == fuBenMapItem), CopyMapID={0}, MapCode={1}", copyMap.FubenMapID, copyMap.MapCode)); return; } List <GameClient> objsList = copyMap.GetClientsList(); // 副本里没人? if (null == objsList || objsList.Count <= 0) { LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == objsList || objsList.Count <= 0), CurrentCopyMapID={0}", monster.CurrentCopyMapID)); return; } // 更新副本记录的状态 if (copyMap.FubenMapID >= data.FuBenID) { data.FuBenID = copyMap.FubenMapID; data.State = (int)GuildCopyMapState.Passed; if (copyMap.FubenMapID == GameManager.GuildCopyMapMgr.FirstGuildCopyMapOrder) { data.Killers = monster.WhoKillMeName; } else { data.Killers += ","; data.Killers += monster.WhoKillMeName; } } // 检查是否更新成功 bool result = GameManager.GuildCopyMapDBMgr.UpdateGuildCopyMapDB(data); if (false == result) { string logStr = @"GuildCopyMapManager::ProcessMonsterDead (false == result), data.GuildID={0}, data.FuBenID={1}, data.State={2}, data.OpenDay={3}, data.Killers={4}"; LogManager.WriteLog(LogTypes.Error, string.Format(logStr, data.GuildID, data.FuBenID, data.State, data.OpenDay, data.Killers)); return; } for (int i = 0; i < objsList.Count; i++) { //不在同一个地图上不参与分配 GameClient gc = objsList[i]; if (null == gc) { continue; } // 准备发奖 // 先检查上次领奖是不是本周~~ int nGuildCopyMapAwardDay = Global.GetRoleParamsInt32FromDB(gc, RoleParamName.GuildCopyMapAwardDay); DateTime AwardTime = Global.GetRealDate(nGuildCopyMapAwardDay); if (Global.BeginOfWeek(AwardTime) != Global.BeginOfWeek(DateTime.Now)) { // 不是这周领奖则重置玩家领奖记录 Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildCopyMapAwardFlag, 0, true); } int nGuildCopyMapAwardFlag = Global.GetRoleParamsInt32FromDB(gc, RoleParamName.GuildCopyMapAwardFlag); bool flag = GetGuildCopyMapAwardDayFlag(nGuildCopyMapAwardFlag, GetGuildCopyMapIndex(monster.CopyMapID), 1); // 领取过了 if (flag == true) { continue; } nGuildCopyMapAwardFlag = SetGuildCopyMapAwardDayFlag(nGuildCopyMapAwardFlag, GetGuildCopyMapIndex(monster.CopyMapID), 1); Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildCopyMapAwardFlag, nGuildCopyMapAwardFlag, true); Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildCopyMapAwardDay, Global.GetOffsetDay(DateTime.Now), true); // 发奖 Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildZhanGong, Global.GetRoleParamsInt32FromDB(gc, RoleParamName.GuildZhanGong) + fuBenMapItem.nZhanGongaward, true); GameManager.ClientMgr.NotifySelfParamsValueChange(gc, RoleCommonUseIntParamsIndexs.ZhanGong, fuBenMapItem.nZhanGongaward); } }
public void GiveAwards(WanMoXiaGuScene scene) { try { FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID); if (fuBenMapItem != null) { int usedSecs = (int)(scene.EndTime - scene.BeginTime); int zhanLi = 0; List <GameClient> objsList = scene.CopyMapInfo.GetClientsList().Distinct <GameClient>().ToList <GameClient>(); 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)) { zhanLi += client.ClientData.CombatForce; long nExp = (long)fuBenMapItem.Experience; int money = fuBenMapItem.Money1; int idx = this.RuntimeData.AwardList.Count - 1; int mul = this.RuntimeData.AwardList[idx][1]; for (int j = 0; j <= idx; j++) { if (usedSecs <= this.RuntimeData.AwardList[j][0]) { mul = this.RuntimeData.AwardList[j][1]; break; } } if (nExp > 0L) { GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false, true, false, "万魔峡谷通关奖励"); } if (money > 0) { GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, "万魔峡谷通关奖励", true); } List <GoodsData> goodsList = new List <GoodsData>(); if (null != fuBenMapItem.GoodsDataList) { for (int k = 0; k < fuBenMapItem.GoodsDataList.Count; k++) { GoodsData goodsData = new GoodsData(fuBenMapItem.GoodsDataList[k]); goodsData.GCount *= mul; goodsList.Add(goodsData); } } if (goodsList.Count > 0) { if (Global.CanAddGoodsDataList(client, goodsList)) { foreach (GoodsData goodsData in goodsList) { GoodsUtil.AddGoodsDBCommand(client, goodsData, true, 1, "万魔峡谷通关奖励", true); } } else { Global.UseMailGivePlayerAward2(client, goodsList, GLang.GetLang(4000, new object[0]), GLang.GetLang(4001, new object[0]), 0, 0, 0); } } WanMoXiaGuAwardsData awardsData = new WanMoXiaGuAwardsData { Success = scene.Success, UsedSecs = usedSecs, Exp = nExp, Money = money, AwardsGoods = goodsList }; client.sendCmd <WanMoXiaGuAwardsData>(1267, awardsData, false); 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(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 static void SendMsgToClientForExperienceCopyMapAward(GameClient client) { CopyMap tmpCopyMap = null; tmpCopyMap = m_ExperienceListCopyMaps[client.ClientData.FuBenSeqID]; if (tmpCopyMap == null) { return; } int fuBenSeqID = FuBenManager.FindFuBenSeqIDByRoleID(client.ClientData.RoleID); FuBenTongGuanData fubenTongGuanData = null; if (fuBenSeqID > 0) //如果副本不存在 { FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID); if (null != fuBenInfoItem) { fuBenInfoItem.EndTicks = DateTime.Now.Ticks / 10000; int addFuBenNum = 1; if (fuBenInfoItem.nDayOfYear != TimeUtil.NowDateTime().DayOfYear) { addFuBenNum = 0; } int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode); if (fuBenID > 0) { int usedSecs = (int)((fuBenInfoItem.EndTicks - fuBenInfoItem.StartTicks) / 1000); // 更新玩家通关时间信息 Global.UpdateFuBenDataForQuickPassTimer(client, fuBenID, usedSecs, addFuBenNum); // 给玩家物品 FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode); if (fuBenMapItem.Experience > 0 && fuBenMapItem.Money1 > 0) { int nMaxTime = fuBenMapItem.MaxTime * 60; //分->秒 long startTicks = fuBenInfoItem.StartTicks; long endTicks = fuBenInfoItem.EndTicks; int nFinishTimer = (int)(endTicks - startTicks) / 1000; //毫秒->秒 int killedNum = 0; // tmpCopyMap.KilledNormalNum + tmpCopyMap.KilledBossNum; int nDieCount = fuBenInfoItem.nDieCount; //向客户的发放通关奖励 fubenTongGuanData = Global.GiveCopyMapGiftForScore(client, fuBenID, nMaxTime, nFinishTimer, killedNum, nDieCount, fuBenMapItem.Experience, fuBenMapItem.Money1, fuBenMapItem); } GameManager.DBCmdMgr.AddDBCmd((int)TCPGameServerCmds.CMD_DB_ADDFUBENHISTDATA, string.Format("{0}:{1}:{2}:{3}", client.ClientData.RoleID, Global.FormatRoleName(client, client.ClientData.RoleName), fuBenID, usedSecs), null); int nLev = -1; SystemXmlItem systemFuBenItem = null; if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(fuBenID, out systemFuBenItem)) { nLev = systemFuBenItem.GetIntValue("FuBenLevel"); } //更新每日的通关副本的数量 GameManager.ClientMgr.UpdateRoleDailyData_FuBenNum(client, 1, nLev, false); //副本通关 //Global.BroadcastFuBenOk(client, usedSecs, fuBenID); } } } if (fubenTongGuanData != null) { //发送奖励到客户端 TCPOutPacket tcpOutPacket = DataHelper.ObjectToTCPOutPacket <FuBenTongGuanData>(fubenTongGuanData, Global._TCPManager.TcpOutPacketPool, (int)TCPGameServerCmds.CMD_SPR_FUBENPASSNOTIFY); if (!Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket)) { ; } } }
/// <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(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, "【元素试炼】清场调度异常"); } }
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, "【狼魂要塞】清场调度异常"); } }
public static void SendMsgToClientForExperienceCopyMapAward(GameClient client) { CopyMap tmpCopyMap = ExperienceCopySceneManager.m_ExperienceListCopyMaps[client.ClientData.FuBenSeqID]; if (tmpCopyMap != null) { int fuBenSeqID = FuBenManager.FindFuBenSeqIDByRoleID(client.ClientData.RoleID); FuBenTongGuanData fubenTongGuanData = null; if (fuBenSeqID > 0) { FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID); if (null != fuBenInfoItem) { fuBenInfoItem.EndTicks = TimeUtil.NOW(); int addFuBenNum = 1; if (fuBenInfoItem.nDayOfYear != TimeUtil.NowDateTime().DayOfYear) { addFuBenNum = 0; } int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode); if (fuBenID > 0) { int usedSecs = (int)((fuBenInfoItem.EndTicks - fuBenInfoItem.StartTicks) / 1000L); Global.UpdateFuBenDataForQuickPassTimer(client, fuBenID, usedSecs, addFuBenNum); FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode); if (fuBenMapItem.Experience > 0 && fuBenMapItem.Money1 > 0) { int nMaxTime = fuBenMapItem.MaxTime * 60; long startTicks = fuBenInfoItem.StartTicks; long endTicks = fuBenInfoItem.EndTicks; int nFinishTimer = (int)(endTicks - startTicks) / 1000; int killedNum = 0; int nDieCount = fuBenInfoItem.nDieCount; fubenTongGuanData = Global.GiveCopyMapGiftForScore(client, fuBenID, client.ClientData.MapCode, nMaxTime, nFinishTimer, killedNum, nDieCount, (int)((double)fuBenMapItem.Experience * fuBenInfoItem.AwardRate), (int)((double)fuBenMapItem.Money1 * fuBenInfoItem.AwardRate), fuBenMapItem, null); } GameManager.DBCmdMgr.AddDBCmd(10053, string.Format("{0}:{1}:{2}:{3}", new object[] { client.ClientData.RoleID, Global.FormatRoleName(client, client.ClientData.RoleName), fuBenID, usedSecs }), null, client.ServerId); int nLev = -1; SystemXmlItem systemFuBenItem = null; if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(fuBenID, out systemFuBenItem)) { nLev = systemFuBenItem.GetIntValue("FuBenLevel", -1); } GameManager.ClientMgr.UpdateRoleDailyData_FuBenNum(client, 1, nLev, false); } } } if (fubenTongGuanData != null) { TCPOutPacket tcpOutPacket = DataHelper.ObjectToTCPOutPacket <FuBenTongGuanData>(fubenTongGuanData, Global._TCPManager.TcpOutPacketPool, 521); if (!Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket, true)) { } } } }
//玩家杀死特殊BOSS public static bool OnKillMonster(GameClient client, Monster monster) { if (client.ClientData.FuBenID != LuoLanFaZhenFubenID) { return(false); } SingleLuoLanFaZhenFubenData fubenData = GetFubenData(client.ClientData.FuBenSeqID); if (null == fubenData) { return(false); } List <int> listMapCodes = null; bool bKillBoss = false; #if ___CC___FUCK___YOU___BB___ if (monster.XMonsterInfo.MonsterId == FinalBossID) //杀死的是否罗兰法阵的通关Boss { fubenData.FinalBossLeftNum = 0; bKillBoss = true; } else if (monster.XMonsterInfo.MonsterId == SpecialBossID) //杀死的是否罗兰法阵的特殊Boss { //是 FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(client.ClientData.FuBenSeqID); if (null == fuBenInfoItem) { return(false); } fubenData.SpecailBossLeftNum = 0; //改变奖励系数 //fuBenInfoItem.AwardRate = SpecialAwardRate; //广播消息给副本内所有玩家 string msg = StringUtil.substitute(Global.GetLang("『{0}』击杀了时空盗贼,令本次通关奖励翻倍!"), client.ClientData.RoleName); listMapCodes = CopyTeamManager.Instance().GetTeamCopyMapCodes(LuoLanFaZhenFubenID); if (null == listMapCodes) { return(false); } foreach (var mapCode in listMapCodes) { BroadMapMessage(msg, mapCode, client.ClientData.FuBenSeqID); } bKillBoss = true; } #else if (monster.MonsterInfo.ExtensionID == FinalBossID) //杀死的是否罗兰法阵的通关Boss { fubenData.FinalBossLeftNum = 0; bKillBoss = true; } else if (monster.MonsterInfo.ExtensionID == SpecialBossID) //杀死的是否罗兰法阵的特殊Boss { //是 FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(client.ClientData.FuBenSeqID); if (null == fuBenInfoItem) { return(false); } fubenData.SpecailBossLeftNum = 0; //改变奖励系数 //fuBenInfoItem.AwardRate = SpecialAwardRate; //广播消息给副本内所有玩家 string msg = StringUtil.substitute(Global.GetLang("『{0}』击杀了时空盗贼,令本次通关奖励翻倍!"), client.ClientData.RoleName); listMapCodes = CopyTeamManager.Instance().GetTeamCopyMapCodes(LuoLanFaZhenFubenID); if (null == listMapCodes) { return(false); } foreach (var mapCode in listMapCodes) { BroadMapMessage(msg, mapCode, client.ClientData.FuBenSeqID); } bKillBoss = true; } #endif //通知副本内所有玩家boss数量改变 if (bKillBoss) { //杀死了boss if (null == listMapCodes) { listMapCodes = CopyTeamManager.Instance().GetTeamCopyMapCodes(LuoLanFaZhenFubenID); } if (null == listMapCodes) { return(false); } //通知副本内所有玩家boss数量改变 string cmdData = string.Format("{0}:{1}:{2}:{3}:{4}", LuoLanFaZhenFubenID, FinalBossID, fubenData.FinalBossLeftNum, SpecialBossID, fubenData.SpecailBossLeftNum); foreach (var mapCode in listMapCodes) { BroadMapData((int)TCPGameServerCmds.CMD_SPR_FAZHEN_BOSS, cmdData, mapCode, client.ClientData.FuBenSeqID); } } return(true); }
public static bool IsLuoLanFaZhenMap(int mapcode) { return(null != FuBenManager.FindMapCodeByFuBenID(LuoLanFaZhenCopySceneManager.LuoLanFaZhenFubenID, mapcode)); }
public static bool OnKillMonster(GameClient client, Monster monster) { bool result; if (client.ClientData.FuBenID != LuoLanFaZhenCopySceneManager.LuoLanFaZhenFubenID) { result = false; } else { SingleLuoLanFaZhenFubenData fubenData = LuoLanFaZhenCopySceneManager.GetFubenData(client.ClientData.FuBenSeqID); if (null == fubenData) { result = false; } else { List <int> listMapCodes = null; bool bKillBoss = false; if (monster.MonsterInfo.ExtensionID == LuoLanFaZhenCopySceneManager.FinalBossID) { fubenData.FinalBossLeftNum = 0; bKillBoss = true; } else if (monster.MonsterInfo.ExtensionID == LuoLanFaZhenCopySceneManager.SpecialBossID) { FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(client.ClientData.FuBenSeqID); if (null == fuBenInfoItem) { return(false); } fubenData.SpecailBossLeftNum = 0; string msg = StringUtil.substitute(GLang.GetLang(98, new object[0]), new object[] { client.ClientData.RoleName }); listMapCodes = SingletonTemplate <CopyTeamManager> .Instance().GetTeamCopyMapCodes(LuoLanFaZhenCopySceneManager.LuoLanFaZhenFubenID); if (null == listMapCodes) { return(false); } foreach (int mapCode in listMapCodes) { LuoLanFaZhenCopySceneManager.BroadMapMessage(msg, mapCode, client.ClientData.FuBenSeqID); } bKillBoss = true; } if (bKillBoss) { if (null == listMapCodes) { listMapCodes = SingletonTemplate <CopyTeamManager> .Instance().GetTeamCopyMapCodes(LuoLanFaZhenCopySceneManager.LuoLanFaZhenFubenID); } if (null == listMapCodes) { return(false); } string cmdData = string.Format("{0}:{1}:{2}:{3}:{4}", new object[] { LuoLanFaZhenCopySceneManager.LuoLanFaZhenFubenID, LuoLanFaZhenCopySceneManager.FinalBossID, fubenData.FinalBossLeftNum, LuoLanFaZhenCopySceneManager.SpecialBossID, fubenData.SpecailBossLeftNum }); foreach (int mapCode in listMapCodes) { LuoLanFaZhenCopySceneManager.BroadMapData(760, cmdData, mapCode, client.ClientData.FuBenSeqID); } } result = true; } } return(result); }