コード例 #1
0
 public static void ProcessClearRoleLog(GameClient client)
 {
     try
     {
         if (ZhuanShengShiLian.IsZhuanShengShiLianCopyScene(client.ClientData.MapCode))
         {
             ZSSLScene mapInfo;
             if (ZhuanShengShiLian.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out mapInfo))
             {
                 long     tID    = ZhuanShengShiLian.GetGUID(client.ClientData.TeamID, client.ClientData.RoleID);
                 int      leader = -1;
                 TeamData td     = GameManager.TeamMgr.FindData(client.ClientData.TeamID);
                 if (null != td)
                 {
                     leader = td.LeaderRoleID;
                 }
                 bool top5Chg = false;
                 lock (ZhuanShengShiLian.ZhuanShengRunTimeData.Mutex)
                 {
                     BossAttackLog bossAttackLog = mapInfo.AttackLog;
                     if (null == bossAttackLog)
                     {
                         return;
                     }
                     BHAttackLog tAttackLog;
                     if (bossAttackLog.BHInjure.TryGetValue(tID, out tAttackLog))
                     {
                         if (leader == -1)
                         {
                             tAttackLog.BHInjure = 0L;
                             bossAttackLog.BHInjure.Remove(tID);
                         }
                         else
                         {
                             long roleInjure = 0L;
                             if (tAttackLog.RoleInjure.TryGetValue(client.ClientData.RoleID, out roleInjure))
                             {
                                 tAttackLog.RoleInjure.Remove(client.ClientData.RoleID);
                                 tAttackLog.BHInjure -= roleInjure;
                                 if (tAttackLog.BHInjure <= 0L)
                                 {
                                     bossAttackLog.BHInjure.Remove(tID);
                                 }
                             }
                         }
                         top5Chg = ZhuanShengShiLian.TrySortAttackRank(bossAttackLog, tAttackLog);
                     }
                 }
                 ZhuanShengShiLian.BroadBossLife(mapInfo, client, top5Chg);
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Error, string.Format("ZhuanShengShiLian :: 处理清除角色伤害记录异常。", new object[0]), ex, true);
     }
 }
コード例 #2
0
 public static void ProcessAttack(GameClient client, Monster monster, int injure)
 {
     try
     {
         if (injure > 0)
         {
             long     tID   = ZhuanShengShiLian.GetGUID(client.ClientData.TeamID, client.ClientData.RoleID);
             string   tName = client.ClientData.RoleName;
             TeamData td    = GameManager.TeamMgr.FindData(client.ClientData.TeamID);
             if (null != td)
             {
                 lock (td)
                 {
                     TeamMemberData member = td.GetLeader();
                     if (null != member)
                     {
                         tName = member.RoleName;
                     }
                 }
             }
             ZSSLScene mapInfo;
             if (ZhuanShengShiLian.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out mapInfo))
             {
                 bool top5Chg = false;
                 lock (ZhuanShengShiLian.ZhuanShengRunTimeData.Mutex)
                 {
                     BossAttackLog bossAttackLog = mapInfo.AttackLog;
                     if (null == bossAttackLog)
                     {
                         bossAttackLog = new BossAttackLog
                         {
                             InjureSum    = 0L,
                             BHInjure     = new Dictionary <long, BHAttackLog>(),
                             BHAttackRank = new List <BHAttackLog>()
                         };
                     }
                     BHAttackLog bhAttackLog;
                     if (!bossAttackLog.BHInjure.TryGetValue(tID, out bhAttackLog))
                     {
                         bhAttackLog = new BHAttackLog
                         {
                             BHName     = tName,
                             BHInjure   = 0L,
                             RoleInjure = new Dictionary <int, long>()
                         };
                         bossAttackLog.BHInjure[tID] = 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;
                     top5Chg = ZhuanShengShiLian.TrySortAttackRank(bossAttackLog, bhAttackLog);
                     bossAttackLog.InjureSum += (long)injure;
                 }
                 ZhuanShengShiLian.BroadBossLife(mapInfo, client, top5Chg);
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Error, string.Format("ZhuanShengShiLian :: 处理攻击boss异常。", new object[0]), ex, true);
     }
 }