Exemplo n.º 1
0
 public static void OnCreateTeamCopyRoleLog(GameClient client)
 {
     try
     {
         if (ZhuanShengShiLian.IsZhuanShengShiLianCopyScene(client.ClientData.MapCode))
         {
             ZSSLScene mapInfo;
             if (ZhuanShengShiLian.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out mapInfo))
             {
                 lock (ZhuanShengShiLian.ZhuanShengRunTimeData.Mutex)
                 {
                     BossAttackLog bossAttackLog = mapInfo.AttackLog;
                     if (null != bossAttackLog)
                     {
                         long        tID_Role        = ZhuanShengShiLian.GetGUID(0, client.ClientData.RoleID);
                         long        tID_Team        = ZhuanShengShiLian.GetGUID(client.ClientData.TeamID, client.ClientData.RoleID);
                         BHAttackLog tAttackLog_Role = null;
                         if (bossAttackLog.BHInjure.TryGetValue(tID_Role, out tAttackLog_Role))
                         {
                             bossAttackLog.BHInjure.Remove(tID_Role);
                         }
                         if (null != tAttackLog_Role)
                         {
                             bossAttackLog.BHInjure[tID_Team] = tAttackLog_Role;
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Error, string.Format("ZhuanShengShiLian :: 处理拷贝角色伤害记录异常。", new object[0]), ex, true);
     }
 }
Exemplo n.º 2
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);
     }
 }
Exemplo n.º 3
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);
     }
 }
Exemplo n.º 4
0
 public static void BroadBossLife(ZSSLScene mapInfo, GameClient client, bool Top5Chg)
 {
     if (null != mapInfo.AttackLog)
     {
         BossLifeLog bossLifeLog = new BossLifeLog();
         bossLifeLog.InjureSum = mapInfo.AttackLog.InjureSum;
         if (null != mapInfo.AttackLog.BHAttackRank)
         {
             int countLimit = Global.GMin(mapInfo.AttackLog.BHAttackRank.Count, 5);
             bossLifeLog.BHAttackRank = mapInfo.AttackLog.BHAttackRank.GetRange(0, countLimit);
         }
         List <GameClient> objsList = mapInfo.m_CopyMap.GetClientsList();
         if (objsList != null && objsList.Count > 0)
         {
             for (int i = 0; i < objsList.Count; i++)
             {
                 GameClient c = objsList[i];
                 if (c != null)
                 {
                     if (!Top5Chg && null != client)
                     {
                         if (client.ClientData.TeamID > 0 && client.ClientData.TeamID != c.ClientData.TeamID)
                         {
                             goto IL_189;
                         }
                         if (c.ClientData.RoleID != client.ClientData.RoleID)
                         {
                             goto IL_189;
                         }
                     }
                     if (null != mapInfo.AttackLog.BHInjure)
                     {
                         long tID = ZhuanShengShiLian.GetGUID(c.ClientData.TeamID, c.ClientData.RoleID);
                         mapInfo.AttackLog.BHInjure.TryGetValue(tID, out bossLifeLog.SelfBHAttack);
                     }
                     c.sendCmd <BossLifeLog>(1906, bossLifeLog, false);
                 }
                 IL_189 :;
             }
         }
     }
 }
Exemplo n.º 5
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);
     }
 }