Code Cleanup & Fixes Warnings (#74)
This commit is contained in:
parent
e11d1f3ad9
commit
57b14ad690
143 changed files with 2960 additions and 3427 deletions
|
|
@ -550,19 +550,21 @@ namespace Server.Engines.ConPVP
|
|||
else if (m_Path.Count > 0)
|
||||
MoveToWorld(m_Path.Last);
|
||||
|
||||
int myZ = Map.GetAverageZ(X, Y);
|
||||
int myZ = Map?.GetAverageZ(X, Y) ?? 0;
|
||||
|
||||
StaticTile[] statics = Map.Tiles.GetStaticTiles(X, Y, true);
|
||||
for (int j = 0; j < statics.Length; j++)
|
||||
{
|
||||
StaticTile t = statics[j];
|
||||
StaticTile[] statics = Map?.Tiles?.GetStaticTiles(X, Y, true);
|
||||
|
||||
ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
|
||||
height = id.CalcHeight;
|
||||
if (statics != null)
|
||||
for (int j = 0; j < statics.Length; j++)
|
||||
{
|
||||
StaticTile t = statics[j];
|
||||
|
||||
if (t.Z + height > myZ && t.Z + height <= Z)
|
||||
myZ = t.Z + height;
|
||||
}
|
||||
ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
|
||||
height = id.CalcHeight;
|
||||
|
||||
if (t.Z + height > myZ && t.Z + height <= Z)
|
||||
myZ = t.Z + height;
|
||||
}
|
||||
|
||||
IPooledEnumerable<Item> eable = GetItemsInRange(0);
|
||||
foreach (Item item in eable)
|
||||
|
|
@ -1428,8 +1430,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if (m_Bomb != null && Controller != null)
|
||||
{
|
||||
if (m_UnhideCallback == null)
|
||||
m_UnhideCallback = UnhideBomb;
|
||||
m_UnhideCallback ??= UnhideBomb;
|
||||
m_Bomb.Visible = false;
|
||||
m_Bomb.MoveToWorld(Controller.BombHome, Controller.Map);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(Utility.RandomMinMax(5, 15)), m_UnhideCallback);
|
||||
|
|
@ -1504,7 +1505,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private void DelayBounce_Callback(Mobile mob, Container corpse)
|
||||
{
|
||||
DuelPlayer dp = mob is PlayerMobile mobile ? mobile.DuelPlayer : null;
|
||||
DuelPlayer dp = (mob as PlayerMobile)?.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
|
|
@ -1722,7 +1723,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < m_Context.Participants.Count; ++i)
|
||||
{
|
||||
if (!(m_Context.Participants[i] is Participant p) || p.Players == null)
|
||||
Participant p = m_Context.Participants[i];
|
||||
|
||||
if (p?.Players == null)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
|
|
@ -1736,7 +1739,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if (i == winner.TeamID)
|
||||
if (i == winner?.TeamID)
|
||||
continue;
|
||||
|
||||
if (p.Players != null)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
|
|
@ -113,6 +114,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
CTFTeamInfo teamInfo = entries[i] as CTFTeamInfo;
|
||||
|
||||
if (teamInfo == null)
|
||||
continue;
|
||||
|
||||
AddImage(30, 70 + i * 75, 10152);
|
||||
AddImage(30, 85 + i * 75, 10151);
|
||||
AddImage(30, 100 + i * 75, 10151);
|
||||
|
|
@ -878,7 +882,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private void DelayBounce_Callback(Mobile mob, Container corpse)
|
||||
{
|
||||
DuelPlayer dp = mob is PlayerMobile mobile ? mobile.DuelPlayer : null;
|
||||
DuelPlayer dp = (mob as PlayerMobile)?.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
|
|
@ -943,15 +947,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (ourFlagCarrier != null && GetTeamInfo(ourFlagCarrier) == teamInfo)
|
||||
{
|
||||
for (int j = 0; j < ourFlagCarrier.Aggressors.Count; ++j)
|
||||
{
|
||||
if (!(ourFlagCarrier.Aggressors[j] is AggressorInfo aggr) ||
|
||||
aggr.Defender != ourFlagCarrier || aggr.Attacker != mob)
|
||||
continue;
|
||||
|
||||
if (ourFlagCarrier.Aggressors.Any(aggr => aggr.Defender == ourFlagCarrier && aggr.Attacker == mob))
|
||||
playerInfo.Score += 2; // helped defend guy capturing enemy flag
|
||||
break;
|
||||
}
|
||||
|
||||
if (mob.Map == ourFlagCarrier.Map && ourFlagCarrier.InRange(mob, 12))
|
||||
playerInfo.Score += 1; // helped defend guy capturing enemy flag
|
||||
|
|
@ -1143,7 +1140,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if (i == winner.TeamID)
|
||||
if (i == winner?.TeamID)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
|
|
@ -1151,7 +1148,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()
|
||||
|
|
|
|||
|
|
@ -521,7 +521,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private void DelayBounce_Callback(Mobile mob, Container corpse)
|
||||
{
|
||||
DuelPlayer dp = mob is PlayerMobile mobile ? mobile.DuelPlayer : null;
|
||||
DuelPlayer dp = (mob as PlayerMobile)?.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
|
|
|
|||
|
|
@ -171,8 +171,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
King = m;
|
||||
|
||||
if (m_KingTimer == null)
|
||||
m_KingTimer = new KingTimer(this);
|
||||
m_KingTimer ??= new KingTimer(this);
|
||||
m_KingTimer.Stop();
|
||||
m_KingTimer.StartHillTicker();
|
||||
|
||||
|
|
@ -450,11 +449,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBorderedText(160 + 10, 85 + i * 75, 100, 20, "Captures:", 0xFFC000, BlackColor32);
|
||||
AddBorderedText(160 + 15, 105 + i * 75, 100, 20, teamInfo.Captures.ToString("N0"), 0xFFC000, BlackColor32);
|
||||
|
||||
string leader = null;
|
||||
if (teamInfo.Leader != null)
|
||||
leader = teamInfo.Leader.Name;
|
||||
if (leader == null)
|
||||
leader = "(none)";
|
||||
string leader = teamInfo.Leader?.Name ?? "(none)";
|
||||
|
||||
AddBorderedText(235 + 10, 85 + i * 75, 250, 20, "Leader:", 0xFFC000, BlackColor32);
|
||||
AddBorderedText(235 + 15, 105 + i * 75, 250, 20, leader, 0xFFC000, BlackColor32);
|
||||
|
|
@ -893,7 +888,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private void DelayBounce_Callback(Mobile mob, Container corpse)
|
||||
{
|
||||
DuelPlayer dp = mob is PlayerMobile mobile ? mobile.DuelPlayer : null;
|
||||
DuelPlayer dp = (mob as PlayerMobile)?.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
|
|
@ -1113,7 +1108,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < m_Context.Participants.Count; ++i)
|
||||
{
|
||||
if (!(m_Context.Participants[i] is Participant p) || p.Players == null)
|
||||
Participant p = m_Context.Participants[i];
|
||||
if (p.Players == null)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue