Code cleanup (#195)
This commit is contained in:
parent
b476bcfd24
commit
0926b5abaa
86 changed files with 740 additions and 1635 deletions
|
|
@ -96,13 +96,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public Tournament Tournament => m_Tournament;
|
||||
|
||||
private bool CantDoAnything(Mobile mob)
|
||||
{
|
||||
if (m_EventGame != null)
|
||||
return m_EventGame.CantDoAnything(mob);
|
||||
|
||||
return false;
|
||||
}
|
||||
private bool CantDoAnything(Mobile mob) => m_EventGame?.CantDoAnything(mob) == true;
|
||||
|
||||
public static bool IsFreeConsume(Mobile mob)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -215,14 +215,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
int zdiff = myLoc.Z - m.Z;
|
||||
|
||||
if (zdiff < 0)
|
||||
return false;
|
||||
if (zdiff < 12)
|
||||
return true;
|
||||
if (zdiff < 16)
|
||||
return Utility.RandomBool(); // 50% chance
|
||||
|
||||
return false;
|
||||
return zdiff >= 0 && (zdiff < 12 || zdiff < 16 && Utility.RandomBool());
|
||||
}
|
||||
|
||||
private void DoAnim(Point3D start, Point3D end, Map map)
|
||||
|
|
@ -1648,12 +1641,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < teams.Count; ++i)
|
||||
{
|
||||
TrophyRank rank = TrophyRank.Bronze;
|
||||
|
||||
if (i == 0)
|
||||
rank = TrophyRank.Gold;
|
||||
else if (i == 1)
|
||||
rank = TrophyRank.Silver;
|
||||
TrophyRank rank = i switch
|
||||
{
|
||||
0 => TrophyRank.Gold,
|
||||
1 => TrophyRank.Silver,
|
||||
_ => TrophyRank.Bronze
|
||||
};
|
||||
|
||||
BRPlayerInfo leader = teams[i].Leader;
|
||||
|
||||
|
|
@ -1747,7 +1740,8 @@ namespace Server.Engines.ConPVP
|
|||
p.Players[j].Eliminated = true;
|
||||
}
|
||||
|
||||
m_Context.Finish(m_Context.Participants[winner.TeamID]);
|
||||
if (winner != null)
|
||||
m_Context.Finish(m_Context.Participants[winner.TeamID]);
|
||||
}
|
||||
|
||||
public override void OnStop()
|
||||
|
|
|
|||
|
|
@ -170,10 +170,8 @@ namespace Server.Engines.ConPVP
|
|||
return 50;
|
||||
if (xp >= 2500)
|
||||
return 10 + (xp - 2500) / 500;
|
||||
if (xp < 0)
|
||||
xp = 0;
|
||||
|
||||
return m_ShortLevels[xp / 100];
|
||||
return m_ShortLevels[Math.Max(xp, 0) / 100];
|
||||
}
|
||||
|
||||
public static void GetLevelInfo(int level, out int xpBase, out int xpAdvance)
|
||||
|
|
|
|||
|
|
@ -78,10 +78,7 @@ namespace Server.Engines.ConPVP
|
|||
sb.Append(mob.Name);
|
||||
}
|
||||
|
||||
if (sb.Length == 0)
|
||||
return "Empty";
|
||||
|
||||
return sb.ToString();
|
||||
return sb.Length == 0 ? "Empty" : sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -149,24 +149,14 @@ namespace Server.Engines.ConPVP
|
|||
public int ParticipantsPerMatch
|
||||
{
|
||||
get => m_ParticipantsPerMatch;
|
||||
set
|
||||
{
|
||||
if (value < 2) value = 2;
|
||||
else if (value > 10) value = 10;
|
||||
m_ParticipantsPerMatch = value;
|
||||
}
|
||||
set => m_ParticipantsPerMatch = Math.Clamp(value, 2, 10);
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int PlayersPerParticipant
|
||||
{
|
||||
get => m_PlayersPerParticipant;
|
||||
set
|
||||
{
|
||||
if (value < 1) value = 1;
|
||||
else if (value > 10) value = 10;
|
||||
m_PlayersPerParticipant = value;
|
||||
}
|
||||
set => m_PlayersPerParticipant = Math.Clamp(value, 1, 10);
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
|
|||
|
|
@ -74,10 +74,7 @@ namespace Server.Engines.ConPVP
|
|||
sb.Append(mob.Name);
|
||||
}
|
||||
|
||||
if (sb.Length == 0)
|
||||
return "Empty";
|
||||
|
||||
return sb.ToString();
|
||||
return sb.Length == 0 ? "Empty" : sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -103,4 +100,4 @@ namespace Server.Engines.ConPVP
|
|||
AddLog("Match lost.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue