Beispiel #1
0
 public static void ProcessChangeTeamName(GameClient client, bool needBroad = false)
 {
     try
     {
         if (ZhuanShengShiLian.IsZhuanShengShiLianCopyScene(client.ClientData.MapCode))
         {
             ZSSLScene mapInfo;
             if (ZhuanShengShiLian.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out mapInfo))
             {
                 TeamData td = GameManager.TeamMgr.FindData(client.ClientData.TeamID);
                 if (null != td)
                 {
                     string newName = "";
                     long   tID     = ZhuanShengShiLian.GetGUID(client.ClientData.TeamID, client.ClientData.RoleID);
                     lock (td)
                     {
                         if (td.LeaderRoleID == client.ClientData.RoleID)
                         {
                             return;
                         }
                         TeamMemberData member = td.GetLeader();
                         if (null == member)
                         {
                             return;
                         }
                         newName = member.RoleName;
                     }
                     BHAttackLog tAttackLog;
                     lock (ZhuanShengShiLian.ZhuanShengRunTimeData.Mutex)
                     {
                         if (null == mapInfo.AttackLog)
                         {
                             return;
                         }
                         if (!mapInfo.AttackLog.BHInjure.TryGetValue(tID, out tAttackLog))
                         {
                             return;
                         }
                         tAttackLog.BHName = newName;
                     }
                     if (needBroad)
                     {
                         int  myRank  = mapInfo.AttackLog.BHAttackRank.FindIndex((BHAttackLog x) => object.ReferenceEquals(x, tAttackLog));
                         bool top5Chg = myRank >= 0 && myRank < 5;
                         ZhuanShengShiLian.BroadBossLife(mapInfo, client, top5Chg);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Error, string.Format("ZhuanShengShiLian :: 处理清除角色伤害记录异常。", new object[0]), ex, true);
     }
 }
Beispiel #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);
     }
 }