public static void ProcessAddMonster(Monster monster) { try { DateTime now = TimeUtil.NowDateTime(); if ((now - MoYuLongXue.MoYuRunTimeData.LastBirthTimePoint).TotalMinutes > 1.0) { Global.BroadcastRoleActionMsg(null, RoleActionsMsgTypes.HintMsg, string.Format(GLang.GetLang(4004, new object[0]), monster.MonsterInfo.VSName), true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.HintAndBox, 0, 0, 100, 100); MoYuLongXue.MoYuRunTimeData.LastBirthTimePoint = now; } NPC npc = null; int mapCode = 0; int leftCount = 0; lock (MoYuLongXue.MoYuRunTimeData.Mutex) { MoYuMonsterInfo moYuInfo; if (!MoYuLongXue.MoYuRunTimeData.MonsterXmlDict.TryGetValue(monster.MonsterInfo.ExtensionID, out moYuInfo)) { return; } mapCode = moYuInfo.MapCode; MoYuLongXue.MoYuRunTimeData.BossAttackLogDict[monster.RoleID] = new BossAttackLog { InjureSum = 0L, BHInjure = new Dictionary <long, BHAttackLog>(), BHAttackRank = new List <BHAttackLog>() }; leftCount = MoYuLongXue.MoYuRunTimeData.BossAttackLogDict.Count; npc = NPCGeneralManager.FindNPC(moYuInfo.MapCode, moYuInfo.NpcID); } if (null != npc) { npc.ShowNpc = false; GameManager.ClientMgr.NotifyMySelfDelNPCBy9Grid(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, npc); } List <GameClient> clientList = GameManager.ClientMgr.GetMapGameClients(mapCode); foreach (GameClient client in clientList) { client.sendCmd <int>(1907, leftCount, false); } MoYuLongXue.NotifyBossLogBy9Grid(monster); } catch (Exception ex) { LogManager.WriteLog(LogTypes.Error, string.Format("MoYuLongXue :: 处理场景刷新怪物异常。", new object[0]), ex, true); } }
public static void NotifyBossLogBy9Grid(Monster monster) { lock (MoYuLongXue.MoYuRunTimeData.Mutex) { List <object> objsList = Global.GetAll9GridObjects(monster); for (int i = 0; i < objsList.Count; i++) { GameClient client = objsList[i] as GameClient; if (null != client) { BossLifeLog bossLifeLog = MoYuLongXue.GetBossAttackLog(client.ClientData.Faction, monster.RoleID); if (null != bossLifeLog) { (objsList[i] as GameClient).sendCmd <BossLifeLog>(1906, bossLifeLog, false); } } } } }
public static void ProcessAttack(GameClient client, Monster monster, int injure) { try { lock (MoYuLongXue.MoYuRunTimeData.Mutex) { if (!MoYuLongXue.MoYuRunTimeData.MonsterXmlDict.ContainsKey(monster.MonsterInfo.ExtensionID)) { return; } BossAttackLog bossAttackLog; if (!MoYuLongXue.MoYuRunTimeData.BossAttackLogDict.TryGetValue(monster.RoleID, out bossAttackLog)) { bossAttackLog = new BossAttackLog { InjureSum = 0L, BHInjure = new Dictionary <long, BHAttackLog>(), BHAttackRank = new List <BHAttackLog>() }; MoYuLongXue.MoYuRunTimeData.BossAttackLogDict[monster.RoleID] = bossAttackLog; } if (client.ClientData.Faction > 0) { BHAttackLog bhAttackLog; if (!bossAttackLog.BHInjure.TryGetValue((long)client.ClientData.Faction, out bhAttackLog)) { bhAttackLog = new BHAttackLog { BHID = client.ClientData.Faction, BHName = client.ClientData.BHName, BHInjure = 0L, RoleInjure = new Dictionary <int, long>() }; bossAttackLog.BHInjure[(long)client.ClientData.Faction] = bhAttackLog; bossAttackLog.BHAttackRank.Add(bhAttackLog); } if (!bhAttackLog.RoleInjure.ContainsKey(client.ClientData.RoleID)) { bhAttackLog.RoleInjure[client.ClientData.RoleID] = 0L; } Dictionary <int, long> roleInjure; int roleID; (roleInjure = bhAttackLog.RoleInjure)[roleID = client.ClientData.RoleID] = roleInjure[roleID] + (long)injure; bhAttackLog.BHInjure += (long)injure; bossAttackLog.BHAttackRank.Sort(delegate(BHAttackLog x, BHAttackLog y) { int result; if (x.BHInjure > y.BHInjure) { result = -1; } else if (x.BHInjure < y.BHInjure) { result = 1; } else { result = 0; } return(result); }); } bossAttackLog.InjureSum += (long)injure; } MoYuLongXue.NotifyBossLogBy9Grid(monster); } catch (Exception ex) { LogManager.WriteLog(LogTypes.Error, string.Format("MoYuLongXue :: 处理攻击boss异常。", new object[0]), ex, true); } }