Code Cleanup & Fixes Warnings (#74)
This commit is contained in:
parent
e11d1f3ad9
commit
57b14ad690
143 changed files with 2960 additions and 3427 deletions
|
|
@ -46,7 +46,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(ItemType == null ? null : ItemType.FullName);
|
||||
writer.Write(ItemType?.FullName);
|
||||
|
||||
writer.WriteEncodedInt(AmountCur);
|
||||
writer.WriteEncodedInt(Number);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(ItemType == null ? null : ItemType.FullName);
|
||||
writer.Write(ItemType?.FullName);
|
||||
|
||||
writer.Write(RequireExceptional);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
{
|
||||
if (m_Cache == null)
|
||||
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||
m_Cache ??= new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||
|
||||
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
|
||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||
|
|
@ -112,7 +111,7 @@ namespace Server.Engines.BulkOrders
|
|||
public void Serialize(IGenericWriter writer )
|
||||
{
|
||||
writer.Write( m_Amount );
|
||||
writer.Write( Details.Type == null ? null : Details.Type.FullName );
|
||||
writer.Write( Details.Type?.FullName );
|
||||
writer.Write( Details.Number );
|
||||
writer.Write( Details.Graphic );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ namespace Server.Engines.BulkOrders
|
|||
switch (Utility.Random(14))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Farmer);
|
||||
break;
|
||||
case 1:
|
||||
|
|
|
|||
|
|
@ -357,7 +357,13 @@ namespace Server.Engines.BulkOrders
|
|||
int[][][] goldTable = m_GoldTable;
|
||||
|
||||
int typeIndex = ComputeType(type, itemCount);
|
||||
int quanIndex = quantity == 20 ? 2 : quantity == 15 ? 1 : 0;
|
||||
int quanIndex = quantity switch
|
||||
{
|
||||
20 => 2,
|
||||
15 => 1,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
int mtrlIndex = material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite
|
||||
? 1 + (material - BulkMaterialType.DullCopper)
|
||||
: 0;
|
||||
|
|
@ -599,11 +605,28 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
int[][][] goldTable = Core.AOS ? m_AosGoldTable : m_OldGoldTable;
|
||||
|
||||
int typeIndex = (itemCount == 6 ? 3 : itemCount == 5 ? 2 : itemCount == 4 ? 1 : 0) * 2 + (exceptional ? 1 : 0);
|
||||
int quanIndex = quantity == 20 ? 2 : quantity == 15 ? 1 : 0;
|
||||
int mtrlIndex = material == BulkMaterialType.Barbed ? 3 :
|
||||
material == BulkMaterialType.Horned ? 2 :
|
||||
material == BulkMaterialType.Spined ? 1 : 0;
|
||||
int typeIndex = itemCount switch
|
||||
{
|
||||
6 => 3,
|
||||
5 => 2,
|
||||
4 => 1,
|
||||
_ => 0
|
||||
} * 2 + (exceptional ? 1 : 0);
|
||||
|
||||
int quanIndex = quantity switch
|
||||
{
|
||||
20 => 2,
|
||||
15 => 1,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
int mtrlIndex = material switch
|
||||
{
|
||||
BulkMaterialType.Barbed => 3,
|
||||
BulkMaterialType.Horned => 2,
|
||||
BulkMaterialType.Spined => 1,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
int gold = goldTable[typeIndex][quanIndex][mtrlIndex];
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ namespace Server.Engines.BulkOrders
|
|||
writer.Write(0); // version
|
||||
|
||||
writer.Write(m_AmountCur);
|
||||
writer.Write(Type == null ? null : Type.FullName);
|
||||
writer.Write(Type?.FullName);
|
||||
writer.Write(m_Number);
|
||||
writer.Write(Graphic);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ namespace Server.Engines.BulkOrders
|
|||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
double chance = item.GetSuccessChance(m, null, system, false, out allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace Server.Engines.BulkOrders
|
|||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
double chance = item.GetSuccessChance(m, null, system, false, out allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -331,12 +331,10 @@ namespace Server.Engines.CannedEvil
|
|||
killer.SendLocalizedMessage(1049524); // You have received a scroll of power!
|
||||
|
||||
if (killer.Alive)
|
||||
{
|
||||
killer.AddToBackpack(scroll);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (killer?.Corpse.Deleted == false)
|
||||
if (killer.Corpse.Deleted == false)
|
||||
killer.Corpse.DropItem(scroll);
|
||||
else
|
||||
killer.AddToBackpack(scroll);
|
||||
|
|
|
|||
|
|
@ -6,11 +6,8 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
public ChatMessagePacket(Mobile who, int number, string param1, string param2) : base(0xB2)
|
||||
{
|
||||
if (param1 == null)
|
||||
param1 = string.Empty;
|
||||
|
||||
if (param2 == null)
|
||||
param2 = string.Empty;
|
||||
param1 ??= string.Empty;
|
||||
param2 ??= string.Empty;
|
||||
|
||||
EnsureCapacity(13 + (param1.Length + param2.Length) * 2);
|
||||
|
||||
|
|
@ -25,4 +22,4 @@ namespace Server.Engines.Chat
|
|||
m_Stream.WriteBigUniNull(param2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,52 +163,48 @@ namespace Server.Engines.ConPVP
|
|||
string title = null;
|
||||
string option;
|
||||
|
||||
if (spell is ArcanistSpell)
|
||||
switch (spell)
|
||||
{
|
||||
title = "Spellweaving";
|
||||
option = spell.Name;
|
||||
}
|
||||
else if (spell is PaladinSpell)
|
||||
{
|
||||
title = "Chivalry";
|
||||
option = spell.Name;
|
||||
}
|
||||
else if (spell is NecromancerSpell)
|
||||
{
|
||||
title = "Necromancy";
|
||||
option = spell.Name;
|
||||
}
|
||||
else if (spell is NinjaSpell)
|
||||
{
|
||||
title = "Ninjitsu";
|
||||
option = spell.Name;
|
||||
}
|
||||
else if (spell is SamuraiSpell)
|
||||
{
|
||||
title = "Bushido";
|
||||
option = spell.Name;
|
||||
}
|
||||
else if (spell is MagerySpell magerySpell)
|
||||
{
|
||||
title = magerySpell.Circle switch
|
||||
{
|
||||
SpellCircle.First => "1st Circle",
|
||||
SpellCircle.Second => "2nd Circle",
|
||||
SpellCircle.Third => "3rd Circle",
|
||||
SpellCircle.Fourth => "4th Circle",
|
||||
SpellCircle.Fifth => "5th Circle",
|
||||
SpellCircle.Sixth => "6th Circle",
|
||||
SpellCircle.Seventh => "7th Circle",
|
||||
SpellCircle.Eighth => "8th Circle",
|
||||
_ => title
|
||||
};
|
||||
case ArcanistSpell _:
|
||||
title = "Spellweaving";
|
||||
option = spell.Name;
|
||||
break;
|
||||
case PaladinSpell _:
|
||||
title = "Chivalry";
|
||||
option = spell.Name;
|
||||
break;
|
||||
case NecromancerSpell _:
|
||||
title = "Necromancy";
|
||||
option = spell.Name;
|
||||
break;
|
||||
case NinjaSpell _:
|
||||
title = "Ninjitsu";
|
||||
option = spell.Name;
|
||||
break;
|
||||
case SamuraiSpell _:
|
||||
title = "Bushido";
|
||||
option = spell.Name;
|
||||
break;
|
||||
case MagerySpell magerySpell:
|
||||
title = magerySpell.Circle switch
|
||||
{
|
||||
SpellCircle.First => "1st Circle",
|
||||
SpellCircle.Second => "2nd Circle",
|
||||
SpellCircle.Third => "3rd Circle",
|
||||
SpellCircle.Fourth => "4th Circle",
|
||||
SpellCircle.Fifth => "5th Circle",
|
||||
SpellCircle.Sixth => "6th Circle",
|
||||
SpellCircle.Seventh => "7th Circle",
|
||||
SpellCircle.Eighth => "8th Circle",
|
||||
_ => null
|
||||
};
|
||||
|
||||
option = magerySpell.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
title = "Other Spell";
|
||||
option = spell.Name;
|
||||
option = magerySpell.Name;
|
||||
break;
|
||||
default:
|
||||
title = "Other Spell";
|
||||
option = spell.Name;
|
||||
break;
|
||||
}
|
||||
|
||||
if (title == null || option == null || Ruleset.GetOption(title, option))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -10,533 +10,533 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class ConfirmSignupGump : Gump
|
||||
{
|
||||
private const int BlackColor32 = 0x000008;
|
||||
private const int LabelColor32 = 0xFFFFFF;
|
||||
private Mobile m_From;
|
||||
private List<Mobile> m_Players;
|
||||
private Mobile m_Registrar;
|
||||
private Tournament m_Tournament;
|
||||
|
||||
public ConfirmSignupGump(Mobile from, Mobile registrar, Tournament tourney, List<Mobile> players) : base(50, 50)
|
||||
public class ConfirmSignupGump : Gump
|
||||
{
|
||||
m_From = from;
|
||||
m_Registrar = registrar;
|
||||
m_Tournament = tourney;
|
||||
m_Players = players;
|
||||
private const int BlackColor32 = 0x000008;
|
||||
private const int LabelColor32 = 0xFFFFFF;
|
||||
private Mobile m_From;
|
||||
private List<Mobile> m_Players;
|
||||
private Mobile m_Registrar;
|
||||
private Tournament m_Tournament;
|
||||
|
||||
m_From.CloseGump<AcceptTeamGump>();
|
||||
m_From.CloseGump<AcceptDuelGump>();
|
||||
m_From.CloseGump<DuelContextGump>();
|
||||
m_From.CloseGump<ConfirmSignupGump>();
|
||||
|
||||
#region Rules
|
||||
|
||||
Ruleset ruleset = tourney.Ruleset;
|
||||
Ruleset basedef = ruleset.Base;
|
||||
|
||||
int height = 185 + 60 + 12;
|
||||
|
||||
int changes = 0;
|
||||
|
||||
BitArray defs;
|
||||
|
||||
if (ruleset.Flavors.Count > 0)
|
||||
public ConfirmSignupGump(Mobile from, Mobile registrar, Tournament tourney, List<Mobile> players) : base(50, 50)
|
||||
{
|
||||
defs = new BitArray(basedef.Options);
|
||||
m_From = from;
|
||||
m_Registrar = registrar;
|
||||
m_Tournament = tourney;
|
||||
m_Players = players;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
m_From.CloseGump<AcceptTeamGump>();
|
||||
m_From.CloseGump<AcceptDuelGump>();
|
||||
m_From.CloseGump<DuelContextGump>();
|
||||
m_From.CloseGump<ConfirmSignupGump>();
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
else
|
||||
{
|
||||
defs = basedef.Options;
|
||||
}
|
||||
#region Rules
|
||||
|
||||
BitArray opts = ruleset.Options;
|
||||
Ruleset ruleset = tourney.Ruleset;
|
||||
Ruleset basedef = ruleset.Base;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
if (defs[i] != opts[i])
|
||||
++changes;
|
||||
int height = 185 + 60 + 12;
|
||||
|
||||
height += changes * 22;
|
||||
int changes = 0;
|
||||
|
||||
height += 10 + 22 + 25 + 25;
|
||||
BitArray defs;
|
||||
|
||||
if (tourney.PlayersPerParticipant > 1)
|
||||
height += 36 + tourney.PlayersPerParticipant * 20;
|
||||
|
||||
#endregion
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
//AddBackground( 0, 0, 400, 220, 9150 );
|
||||
AddBackground(1, 1, 398, height, 3600);
|
||||
//AddBackground( 16, 15, 369, 189, 9100 );
|
||||
|
||||
AddImageTiled(16, 15, 369, height - 29, 3604);
|
||||
AddAlphaRegion(16, 15, 369, height - 29);
|
||||
|
||||
AddImage(215, -43, 0xEE40);
|
||||
//AddImage( 330, 141, 0x8BA );
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (tourney.TourneyType == TourneyType.FreeForAll)
|
||||
{
|
||||
sb.Append("FFA");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-Team");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.Faction)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-Team Faction");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
if (ruleset.Flavors.Count > 0)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
defs = new BitArray(basedef.Options);
|
||||
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
}
|
||||
|
||||
if (tourney.EventController != null)
|
||||
sb.Append(' ').Append(tourney.EventController.Title);
|
||||
|
||||
sb.Append(" Tournament Signup");
|
||||
|
||||
AddBorderedText(22, 22, 294, 20, Center(sb.ToString()), LabelColor32, BlackColor32);
|
||||
AddBorderedText(22, 50, 294, 40, "You have requested to join the tournament. Do you accept the rules?", 0xB0C868,
|
||||
BlackColor32);
|
||||
|
||||
AddImageTiled(32, 88, 264, 1, 9107);
|
||||
AddImageTiled(42, 90, 264, 1, 9157);
|
||||
|
||||
#region Rules
|
||||
|
||||
int y = 100;
|
||||
|
||||
var groupText = tourney.GroupType switch
|
||||
{
|
||||
GroupingType.HighVsLow => "High vs Low",
|
||||
GroupingType.Nearest => "Closest opponent",
|
||||
GroupingType.Random => "Random",
|
||||
_ => null
|
||||
};
|
||||
|
||||
AddBorderedText(35, y, 190, 20, $"Grouping: {groupText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
var tieText = tourney.TieType switch
|
||||
{
|
||||
TieType.Random => "Random",
|
||||
TieType.Highest => "Highest advances",
|
||||
TieType.Lowest => "Lowest advances",
|
||||
TieType.FullAdvancement => (tourney.ParticipantsPerMatch == 2 ? "Both advance" : "Everyone advances"),
|
||||
TieType.FullElimination => (tourney.ParticipantsPerMatch == 2 ? "Both eliminated" : "Everyone eliminated"),
|
||||
_ => null
|
||||
};
|
||||
|
||||
AddBorderedText(35, y, 190, 20, $"Tiebreaker: {tieText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
string sdText = "Off";
|
||||
|
||||
if (tourney.SuddenDeath > TimeSpan.Zero)
|
||||
{
|
||||
sdText = $"{(int)tourney.SuddenDeath.TotalMinutes}:{tourney.SuddenDeath.Seconds:D2}";
|
||||
|
||||
if (tourney.SuddenDeathRounds > 0)
|
||||
sdText = $"{sdText} (first {tourney.SuddenDeathRounds} rounds)";
|
||||
else
|
||||
sdText = $"{sdText} (all rounds)";
|
||||
}
|
||||
{
|
||||
defs = basedef.Options;
|
||||
}
|
||||
|
||||
AddBorderedText(35, y, 240, 20, $"Sudden Death: {sdText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
y += 6;
|
||||
AddImageTiled(32, y - 1, 264, 1, 9107);
|
||||
AddImageTiled(42, y + 1, 264, 1, 9157);
|
||||
y += 6;
|
||||
|
||||
AddBorderedText(35, y, 190, 20, $"Ruleset: {basedef.Title}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddBorderedText(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}", LabelColor32, BlackColor32);
|
||||
|
||||
y += 4;
|
||||
|
||||
if (changes > 0)
|
||||
{
|
||||
AddBorderedText(35, y, 190, 20, "Modifications:", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
BitArray opts = ruleset.Options;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
if (defs[i] != opts[i])
|
||||
++changes;
|
||||
|
||||
height += changes * 22;
|
||||
|
||||
height += 10 + 22 + 25 + 25;
|
||||
|
||||
if (tourney.PlayersPerParticipant > 1)
|
||||
height += 36 + tourney.PlayersPerParticipant * 20;
|
||||
|
||||
#endregion
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
//AddBackground( 0, 0, 400, 220, 9150 );
|
||||
AddBackground(1, 1, 398, height, 3600);
|
||||
//AddBackground( 16, 15, 369, 189, 9100 );
|
||||
|
||||
AddImageTiled(16, 15, 369, height - 29, 3604);
|
||||
AddAlphaRegion(16, 15, 369, height - 29);
|
||||
|
||||
AddImage(215, -43, 0xEE40);
|
||||
//AddImage( 330, 141, 0x8BA );
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (tourney.TourneyType == TourneyType.FreeForAll)
|
||||
{
|
||||
sb.Append("FFA");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-Team");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.Faction)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-Team Faction");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
{
|
||||
string name = ruleset.Layout.FindByIndex(i);
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
|
||||
if (name != null) // sanity
|
||||
{
|
||||
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
|
||||
AddBorderedText(60, y, 165, 22, name, LabelColor32, BlackColor32);
|
||||
}
|
||||
|
||||
y += 22;
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddBorderedText(35, y, 190, 20, "Modifications: None", LabelColor32, BlackColor32);
|
||||
}
|
||||
|
||||
if (tourney.EventController != null)
|
||||
sb.Append(' ').Append(tourney.EventController.Title);
|
||||
|
||||
sb.Append(" Tournament Signup");
|
||||
|
||||
AddBorderedText(22, 22, 294, 20, Center(sb.ToString()), LabelColor32, BlackColor32);
|
||||
AddBorderedText(22, 50, 294, 40, "You have requested to join the tournament. Do you accept the rules?", 0xB0C868,
|
||||
BlackColor32);
|
||||
|
||||
AddImageTiled(32, 88, 264, 1, 9107);
|
||||
AddImageTiled(42, 90, 264, 1, 9157);
|
||||
|
||||
#region Rules
|
||||
|
||||
int y = 100;
|
||||
|
||||
var groupText = tourney.GroupType switch
|
||||
{
|
||||
GroupingType.HighVsLow => "High vs Low",
|
||||
GroupingType.Nearest => "Closest opponent",
|
||||
GroupingType.Random => "Random",
|
||||
_ => null
|
||||
};
|
||||
|
||||
AddBorderedText(35, y, 190, 20, $"Grouping: {groupText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
}
|
||||
|
||||
#endregion
|
||||
var tieText = tourney.TieType switch
|
||||
{
|
||||
TieType.Random => "Random",
|
||||
TieType.Highest => "Highest advances",
|
||||
TieType.Lowest => "Lowest advances",
|
||||
TieType.FullAdvancement => (tourney.ParticipantsPerMatch == 2 ? "Both advance" : "Everyone advances"),
|
||||
TieType.FullElimination => (tourney.ParticipantsPerMatch == 2 ? "Both eliminated" : "Everyone eliminated"),
|
||||
_ => null
|
||||
};
|
||||
|
||||
#region Team
|
||||
AddBorderedText(35, y, 190, 20, $"Tiebreaker: {tieText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
string sdText = "Off";
|
||||
|
||||
if (tourney.SuddenDeath > TimeSpan.Zero)
|
||||
{
|
||||
sdText = $"{(int)tourney.SuddenDeath.TotalMinutes}:{tourney.SuddenDeath.Seconds:D2}";
|
||||
|
||||
if (tourney.SuddenDeathRounds > 0)
|
||||
sdText = $"{sdText} (first {tourney.SuddenDeathRounds} rounds)";
|
||||
else
|
||||
sdText = $"{sdText} (all rounds)";
|
||||
}
|
||||
|
||||
AddBorderedText(35, y, 240, 20, $"Sudden Death: {sdText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
y += 6;
|
||||
AddImageTiled(32, y - 1, 264, 1, 9107);
|
||||
AddImageTiled(42, y + 1, 264, 1, 9157);
|
||||
y += 6;
|
||||
|
||||
AddBorderedText(35, y, 190, 20, $"Ruleset: {basedef.Title}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddBorderedText(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}", LabelColor32, BlackColor32);
|
||||
|
||||
y += 4;
|
||||
|
||||
if (changes > 0)
|
||||
{
|
||||
AddBorderedText(35, y, 190, 20, "Modifications:", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
if (defs[i] != opts[i])
|
||||
{
|
||||
string name = ruleset.Layout.FindByIndex(i);
|
||||
|
||||
if (name != null) // sanity
|
||||
{
|
||||
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
|
||||
AddBorderedText(60, y, 165, 22, name, LabelColor32, BlackColor32);
|
||||
}
|
||||
|
||||
y += 22;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddBorderedText(35, y, 190, 20, "Modifications: None", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Team
|
||||
|
||||
if (tourney.PlayersPerParticipant > 1)
|
||||
{
|
||||
y += 8;
|
||||
AddImageTiled(32, y - 1, 264, 1, 9107);
|
||||
AddImageTiled(42, y + 1, 264, 1, 9157);
|
||||
y += 8;
|
||||
|
||||
AddBorderedText(35, y, 190, 20, "Your Team", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < players.Count; ++i, y += 20)
|
||||
{
|
||||
if (i == 0)
|
||||
AddImage(35, y, 0xD2);
|
||||
else
|
||||
AddGoldenButton(35, y, 1 + i);
|
||||
|
||||
AddBorderedText(60, y, 200, 20, players[i].Name, LabelColor32, BlackColor32);
|
||||
}
|
||||
|
||||
for (int i = players.Count; i < tourney.PlayersPerParticipant; ++i, y += 20)
|
||||
{
|
||||
if (i == 0)
|
||||
AddImage(35, y, 0xD2);
|
||||
else
|
||||
AddGoldenButton(35, y, 1 + i);
|
||||
|
||||
AddBorderedText(60, y, 200, 20, "(Empty)", LabelColor32, BlackColor32);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
if (tourney.PlayersPerParticipant > 1)
|
||||
{
|
||||
y += 8;
|
||||
AddImageTiled(32, y - 1, 264, 1, 9107);
|
||||
AddImageTiled(42, y + 1, 264, 1, 9157);
|
||||
y += 8;
|
||||
|
||||
AddBorderedText(35, y, 190, 20, "Your Team", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
AddRadio(24, y, 9727, 9730, true, 1);
|
||||
AddBorderedText(60, y + 5, 250, 20, "Yes, I wish to join the tournament.", LabelColor32, BlackColor32);
|
||||
y += 35;
|
||||
|
||||
for (int i = 0; i < players.Count; ++i, y += 20)
|
||||
{
|
||||
if (i == 0)
|
||||
AddImage(35, y, 0xD2);
|
||||
else
|
||||
AddGoldenButton(35, y, 1 + i);
|
||||
AddRadio(24, y, 9727, 9730, false, 2);
|
||||
AddBorderedText(60, y + 5, 250, 20, "No, I do not wish to join.", LabelColor32, BlackColor32);
|
||||
y += 35;
|
||||
|
||||
AddBorderedText(60, y, 200, 20, players[i].Name, LabelColor32, BlackColor32);
|
||||
}
|
||||
|
||||
for (int i = players.Count; i < tourney.PlayersPerParticipant; ++i, y += 20)
|
||||
{
|
||||
if (i == 0)
|
||||
AddImage(35, y, 0xD2);
|
||||
else
|
||||
AddGoldenButton(35, y, 1 + i);
|
||||
|
||||
AddBorderedText(60, y, 200, 20, "(Empty)", LabelColor32, BlackColor32);
|
||||
}
|
||||
y -= 3;
|
||||
AddButton(314, y, 247, 248, 1);
|
||||
}
|
||||
|
||||
#endregion
|
||||
public string Center(string text) => $"<CENTER>{text}</CENTER>";
|
||||
|
||||
y += 8;
|
||||
AddImageTiled(32, y - 1, 264, 1, 9107);
|
||||
AddImageTiled(42, y + 1, 264, 1, 9157);
|
||||
y += 8;
|
||||
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
|
||||
AddRadio(24, y, 9727, 9730, true, 1);
|
||||
AddBorderedText(60, y + 5, 250, 20, "Yes, I wish to join the tournament.", LabelColor32, BlackColor32);
|
||||
y += 35;
|
||||
|
||||
AddRadio(24, y, 9727, 9730, false, 2);
|
||||
AddBorderedText(60, y + 5, 250, 20, "No, I do not wish to join.", LabelColor32, BlackColor32);
|
||||
y += 35;
|
||||
|
||||
y -= 3;
|
||||
AddButton(314, y, 247, 248, 1);
|
||||
}
|
||||
|
||||
public string Center(string text) => $"<CENTER>{text}</CENTER>";
|
||||
|
||||
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
|
||||
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
|
||||
{
|
||||
AddColoredText(x - 1, y - 1, width, height, text, borderColor);
|
||||
AddColoredText(x - 1, y + 1, width, height, text, borderColor);
|
||||
AddColoredText(x + 1, y - 1, width, height, text, borderColor);
|
||||
AddColoredText(x + 1, y + 1, width, height, text, borderColor);
|
||||
AddColoredText(x, y, width, height, text, color);
|
||||
}
|
||||
|
||||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1 && info.IsSwitched(1))
|
||||
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
|
||||
{
|
||||
Tournament tourney = m_Tournament;
|
||||
Mobile from = m_From;
|
||||
AddColoredText(x - 1, y - 1, width, height, text, borderColor);
|
||||
AddColoredText(x - 1, y + 1, width, height, text, borderColor);
|
||||
AddColoredText(x + 1, y - 1, width, height, text, borderColor);
|
||||
AddColoredText(x + 1, y + 1, width, height, text, borderColor);
|
||||
AddColoredText(x, y, width, height, text, color);
|
||||
}
|
||||
|
||||
switch (tourney.Stage)
|
||||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1 && info.IsSwitched(1))
|
||||
{
|
||||
case TournamentStage.Fighting:
|
||||
Tournament tourney = m_Tournament;
|
||||
Mobile from = m_From;
|
||||
|
||||
switch (tourney.Stage)
|
||||
{
|
||||
if (m_Registrar != null)
|
||||
case TournamentStage.Fighting:
|
||||
{
|
||||
if (m_Tournament.HasParticipant(from))
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "Excuse me? You are already signed up.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "The tournament has already begun. You are too late to signup now.",
|
||||
from.NetState);
|
||||
}
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
if (m_Tournament.HasParticipant(from))
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "Excuse me? You are already signed up.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "The tournament has already begun. You are too late to signup now.",
|
||||
from.NetState);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TournamentStage.Inactive:
|
||||
{
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "The tournament is closed.", from.NetState);
|
||||
|
||||
break;
|
||||
}
|
||||
case TournamentStage.Signup:
|
||||
{
|
||||
if (m_Players.Count != tourney.PlayersPerParticipant)
|
||||
{
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "You have not yet chosen your team.", from.NetState);
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
break;
|
||||
}
|
||||
|
||||
Ladder ladder = Ladder.Instance;
|
||||
|
||||
for (int i = 0; i < m_Players.Count; ++i)
|
||||
case TournamentStage.Inactive:
|
||||
{
|
||||
Mobile mob = m_Players[i];
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "The tournament is closed.", from.NetState);
|
||||
|
||||
LadderEntry entry = ladder?.Find(mob);
|
||||
|
||||
if (entry != null && Ladder.GetLevel(entry.Experience) < tourney.LevelRequirement)
|
||||
{
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "You have not yet proven yourself a worthy dueler.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, $"{mob.Name} has not yet proven themselves a worthy dueler.",
|
||||
from.NetState);
|
||||
}
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
}
|
||||
|
||||
if (tourney.IsFactionRestricted && Faction.Find(mob) == null)
|
||||
break;
|
||||
}
|
||||
case TournamentStage.Signup:
|
||||
{
|
||||
if (m_Players.Count != tourney.PlayersPerParticipant)
|
||||
{
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "Only those who have declared their faction allegiance may participate.",
|
||||
from.NetState);
|
||||
0x35, false, "You have not yet chosen your team.", from.NetState);
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
if (tourney.HasParticipant(mob))
|
||||
Ladder ladder = Ladder.Instance;
|
||||
|
||||
for (int i = 0; i < m_Players.Count; ++i)
|
||||
{
|
||||
if (m_Registrar != null)
|
||||
Mobile mob = m_Players[i];
|
||||
|
||||
LadderEntry entry = ladder?.Find(mob);
|
||||
|
||||
if (entry != null && Ladder.GetLevel(entry.Experience) < tourney.LevelRequirement)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "You have already entered this tournament.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, $"{mob.Name} has already entered this tournament.", from.NetState);
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "You have not yet proven yourself a worthy dueler.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, $"{mob.Name} has not yet proven themselves a worthy dueler.",
|
||||
from.NetState);
|
||||
}
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
}
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
if (tourney.IsFactionRestricted && Faction.Find(mob) == null)
|
||||
{
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "Only those who have declared their faction allegiance may participate.",
|
||||
from.NetState);
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
}
|
||||
|
||||
if (tourney.HasParticipant(mob))
|
||||
{
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "You have already entered this tournament.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, $"{mob.Name} has already entered this tournament.", from.NetState);
|
||||
}
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob is PlayerMobile mobile && mobile.DuelContext != null)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false,
|
||||
"You are already assigned to a duel. You must yield it before joining this tournament.",
|
||||
from.NetState);
|
||||
else
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false,
|
||||
$"{mobile.Name} is already assigned to a duel. They must yield it before joining this tournament.",
|
||||
from.NetState);
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mob is PlayerMobile mobile && mobile.DuelContext != null)
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false,
|
||||
"You are already assigned to a duel. You must yield it before joining this tournament.",
|
||||
from.NetState);
|
||||
string fmt;
|
||||
|
||||
if (tourney.PlayersPerParticipant == 1)
|
||||
fmt =
|
||||
"As you say m'{0}. I've written your name to the bracket. The tournament will begin {1}.";
|
||||
else if (tourney.PlayersPerParticipant == 2)
|
||||
fmt =
|
||||
"As you wish m'{0}. The tournament will begin {1}, but first you must name your partner.";
|
||||
else
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false,
|
||||
$"{mobile.Name} is already assigned to a duel. They must yield it before joining this tournament.",
|
||||
from.NetState);
|
||||
fmt = "As you wish m'{0}. The tournament will begin {1}, but first you must name your team.";
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
string timeUntil;
|
||||
int minutesUntil = (int)Math.Round((tourney.SignupStart + tourney.SignupPeriod - DateTime.UtcNow)
|
||||
.TotalMinutes);
|
||||
|
||||
if (minutesUntil == 0)
|
||||
timeUntil = "momentarily";
|
||||
else
|
||||
timeUntil = $"in {minutesUntil} minute{(minutesUntil == 1 ? "" : "s")}";
|
||||
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, string.Format(fmt, from.Female ? "Lady" : "Lord", timeUntil), from.NetState);
|
||||
}
|
||||
|
||||
TourneyParticipant part = new TourneyParticipant(from);
|
||||
part.Players.Clear();
|
||||
part.Players.AddRange(m_Players);
|
||||
|
||||
tourney.Participants.Add(part);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID > 1)
|
||||
{
|
||||
int index = info.ButtonID - 1;
|
||||
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
string fmt;
|
||||
|
||||
if (tourney.PlayersPerParticipant == 1)
|
||||
fmt =
|
||||
"As you say m'{0}. I've written your name to the bracket. The tournament will begin {1}.";
|
||||
else if (tourney.PlayersPerParticipant == 2)
|
||||
fmt =
|
||||
"As you wish m'{0}. The tournament will begin {1}, but first you must name your partner.";
|
||||
else
|
||||
fmt = "As you wish m'{0}. The tournament will begin {1}, but first you must name your team.";
|
||||
|
||||
string timeUntil;
|
||||
int minutesUntil = (int)Math.Round((tourney.SignupStart + tourney.SignupPeriod - DateTime.UtcNow)
|
||||
.TotalMinutes);
|
||||
|
||||
if (minutesUntil == 0)
|
||||
timeUntil = "momentarily";
|
||||
else
|
||||
timeUntil = $"in {minutesUntil} minute{(minutesUntil == 1 ? "" : "s")}";
|
||||
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, string.Format(fmt, from.Female ? "Lady" : "Lord", timeUntil), from.NetState);
|
||||
}
|
||||
|
||||
TourneyParticipant part = new TourneyParticipant(from);
|
||||
part.Players.Clear();
|
||||
part.Players.AddRange(m_Players);
|
||||
|
||||
tourney.Participants.Add(part);
|
||||
|
||||
break;
|
||||
if (index > 0 && index < m_Players.Count)
|
||||
{
|
||||
m_Players.RemoveAt(index);
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
}
|
||||
else if (m_Players.Count < m_Tournament.PlayersPerParticipant)
|
||||
{
|
||||
m_From.BeginTarget(12, false, TargetFlags.None, AddPlayer_OnTarget);
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID > 1)
|
||||
|
||||
private void AddPlayer_OnTarget(Mobile from, object obj)
|
||||
{
|
||||
int index = info.ButtonID - 1;
|
||||
|
||||
if (index > 0 && index < m_Players.Count)
|
||||
{
|
||||
m_Players.RemoveAt(index);
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
}
|
||||
else if (m_Players.Count < m_Tournament.PlayersPerParticipant)
|
||||
{
|
||||
m_From.BeginTarget(12, false, TargetFlags.None, AddPlayer_OnTarget);
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddPlayer_OnTarget(Mobile from, object obj)
|
||||
{
|
||||
if (!(obj is Mobile mob) || mob == from)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "Excuse me?", from.NetState);
|
||||
}
|
||||
else if (!mob.Player)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
if (mob.Body.IsHuman)
|
||||
mob.SayTo(from, 1005443); // Nay, I would rather stay here and watch a nail rust.
|
||||
else
|
||||
mob.SayTo(from, 1005444); // The creature ignores your offer.
|
||||
}
|
||||
else if (AcceptDuelGump.IsIgnored(mob, from) || mob.Blessed)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They ignore your invitation.", from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(mob is PlayerMobile pm))
|
||||
return;
|
||||
|
||||
if (pm.DuelContext != null)
|
||||
if (!(obj is Mobile mob) || mob == from)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They are already assigned to another duel.", from.NetState);
|
||||
0x22, false, "Excuse me?", from.NetState);
|
||||
}
|
||||
else if (mob.HasGump<AcceptTeamGump>())
|
||||
else if (!mob.Player)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
if (mob.Body.IsHuman)
|
||||
mob.SayTo(from, 1005443); // Nay, I would rather stay here and watch a nail rust.
|
||||
else
|
||||
mob.SayTo(from, 1005444); // The creature ignores your offer.
|
||||
}
|
||||
else if (AcceptDuelGump.IsIgnored(mob, from) || mob.Blessed)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They have already been offered a partnership.", from.NetState);
|
||||
}
|
||||
else if (mob.HasGump<ConfirmSignupGump>())
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They are already trying to join this tournament.", from.NetState);
|
||||
}
|
||||
else if (m_Players.Contains(mob))
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "You have already named them as a team member.", from.NetState);
|
||||
}
|
||||
else if (m_Tournament.HasParticipant(mob))
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They have already entered this tournament.", from.NetState);
|
||||
}
|
||||
else if (m_Players.Count >= m_Tournament.PlayersPerParticipant)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "Your team is full.", from.NetState);
|
||||
0x22, false, "They ignore your invitation.", from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
mob.SendGump(new AcceptTeamGump(from, mob, m_Tournament, m_Registrar, m_Players));
|
||||
if (!(mob is PlayerMobile pm))
|
||||
return;
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x59, false,
|
||||
$"As you command m'{(from.Female ? "Lady" : "Lord")}. I've given your offer to {mob.Name}.",
|
||||
from.NetState);
|
||||
if (pm.DuelContext != null)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They are already assigned to another duel.", from.NetState);
|
||||
}
|
||||
else if (mob.HasGump<AcceptTeamGump>())
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They have already been offered a partnership.", from.NetState);
|
||||
}
|
||||
else if (mob.HasGump<ConfirmSignupGump>())
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They are already trying to join this tournament.", from.NetState);
|
||||
}
|
||||
else if (m_Players.Contains(mob))
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "You have already named them as a team member.", from.NetState);
|
||||
}
|
||||
else if (m_Tournament.HasParticipant(mob))
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They have already entered this tournament.", from.NetState);
|
||||
}
|
||||
else if (m_Players.Count >= m_Tournament.PlayersPerParticipant)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "Your team is full.", from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
mob.SendGump(new AcceptTeamGump(from, mob, m_Tournament, m_Registrar, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x59, false,
|
||||
$"As you command m'{(from.Female ? "Lady" : "Lord")}. I've given your offer to {mob.Name}.",
|
||||
from.NetState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,9 @@ namespace Server.Engines.ConPVP
|
|||
from.CloseGump<ParticipantGump>();
|
||||
|
||||
RulesetLayout depthCounter = page;
|
||||
int depth = 0;
|
||||
|
||||
while (depthCounter != null)
|
||||
{
|
||||
++depth;
|
||||
depthCounter = depthCounter.Parent;
|
||||
}
|
||||
|
||||
int count = page.Children.Length + page.Options.Length;
|
||||
|
||||
|
|
|
|||
|
|
@ -350,9 +350,10 @@ namespace Server.Engines.ConPVP
|
|||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"));
|
||||
|
||||
// List<PyramidLevel> levelsList = m_List != null
|
||||
// ? Utility.CastListCovariant<object, PyramidLevel>(m_List)
|
||||
// : new List<PyramidLevel>(tourney.Pyramid.Levels);
|
||||
|
||||
// List<PyramidLevel> levelsList = m_List != null
|
||||
// ? Utility.CastListCovariant<object, PyramidLevel>(m_List)
|
||||
// : new List<PyramidLevel>(tourney.Pyramid.Levels);
|
||||
|
||||
StartPage(out int index, out int count, out int y, 12);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
Ladder = new Ladder();
|
||||
|
||||
if (Ladder.Instance == null)
|
||||
Ladder.Instance = Ladder;
|
||||
Ladder.Instance ??= Ladder;
|
||||
}
|
||||
|
||||
public LadderController(Serial serial) : base(serial)
|
||||
|
|
|
|||
|
|
@ -81,8 +81,7 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAdded(parent);
|
||||
|
||||
if (Owner == null)
|
||||
Owner = RootParent as Mobile;
|
||||
Owner ??= RootParent as Mobile;
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
@ -111,4 +110,4 @@ namespace Server.Items
|
|||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,9 +154,8 @@ namespace Server.Engines.Craft
|
|||
if (context != null)
|
||||
resIndex = m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex;
|
||||
|
||||
bool allRequiredSkills = true;
|
||||
double chance = m_CraftItem.GetSuccessChance(m_From, resIndex > -1 ? res.GetAt(resIndex).ItemType : null,
|
||||
m_CraftSystem, false, ref allRequiredSkills);
|
||||
m_CraftSystem, false, out _);
|
||||
double excepChance = m_CraftItem.GetExceptionalChance(m_CraftSystem, chance, m_From);
|
||||
|
||||
if (chance < 0.0)
|
||||
|
|
|
|||
|
|
@ -682,12 +682,12 @@ namespace Server.Engines.Craft
|
|||
|
||||
public bool CheckSkills(Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
|
||||
ref bool allRequiredSkills) =>
|
||||
CheckSkills(from, typeRes, craftSystem, ref quality, ref allRequiredSkills, true);
|
||||
CheckSkills(from, typeRes, craftSystem, ref quality, out allRequiredSkills, true);
|
||||
|
||||
public bool CheckSkills(Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
|
||||
ref bool allRequiredSkills, bool gainSkills)
|
||||
out bool allRequiredSkills, bool gainSkills)
|
||||
{
|
||||
double chance = GetSuccessChance(from, typeRes, craftSystem, gainSkills, ref allRequiredSkills);
|
||||
double chance = GetSuccessChance(from, typeRes, craftSystem, gainSkills, out allRequiredSkills);
|
||||
|
||||
if (GetExceptionalChance(craftSystem, chance, from) > Utility.RandomDouble())
|
||||
quality = 2;
|
||||
|
|
@ -696,7 +696,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
|
||||
public double GetSuccessChance(Mobile from, Type typeRes, CraftSystem craftSystem, bool gainSkills,
|
||||
ref bool allRequiredSkills)
|
||||
out bool allRequiredSkills)
|
||||
{
|
||||
double minMainSkill = 0.0;
|
||||
double maxMainSkill = 0.0;
|
||||
|
|
@ -750,8 +750,8 @@ namespace Server.Engines.Craft
|
|||
if (RequiredExpansion == Expansion.None ||
|
||||
from.NetState?.SupportsExpansion(RequiredExpansion) == true)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);
|
||||
bool allRequiredSkills;
|
||||
double chance = GetSuccessChance(from, typeRes, craftSystem, false, out allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
|
|
@ -1100,7 +1100,7 @@ namespace Server.Engines.Craft
|
|||
int quality = 1;
|
||||
bool allRequiredSkills = true;
|
||||
|
||||
m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, ref allRequiredSkills, false);
|
||||
m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, out allRequiredSkills, false);
|
||||
|
||||
CraftContext context = m_CraftSystem.GetContext(m_From);
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,7 @@ namespace Server.Engines.Craft
|
|||
if (craftItem == null || craftItem.Resources.Count == 0)
|
||||
return EnhanceResult.BadItem;
|
||||
|
||||
bool allRequiredSkills = false;
|
||||
if (craftItem.GetSuccessChance(from, resType, craftSystem, false, ref allRequiredSkills) <= 0.0)
|
||||
if (craftItem.GetSuccessChance(from, resType, craftSystem, false, out _) <= 0.0)
|
||||
return EnhanceResult.NoSkill;
|
||||
|
||||
CraftResourceInfo info = CraftResources.GetInfo(resource);
|
||||
|
|
@ -322,4 +321,4 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,18 +149,18 @@ namespace Server.Engines.Craft
|
|||
public override void InitCraftList()
|
||||
{
|
||||
/*
|
||||
Synthax for a SIMPLE craft item
|
||||
Syntax for a SIMPLE craft item
|
||||
AddCraft( ObjectType, Group, MinSkill, MaxSkill, ResourceType, Amount, Message )
|
||||
|
||||
ObjectType : The type of the object you want to add to the build list.
|
||||
Group : The group in wich the object will be showed in the craft menu.
|
||||
MinSkill : The minimum of skill value
|
||||
MaxSkill : The maximum of skill value
|
||||
Group : The group in which the object will be showed in the craft menu.
|
||||
MinSkill : The minimum of skill value
|
||||
MaxSkill : The maximum of skill value
|
||||
ResourceType : The type of the resource the mobile need to create the item
|
||||
Amount : The amount of the ResourceType it need to create the item
|
||||
Message : String or Int for Localized. The message that will be sent to the mobile, if the specified resource is missing.
|
||||
Amount : The amount of the ResourceType it need to create the item
|
||||
Message : String or Int for Localized. The message that will be sent to the mobile, if the specified resource is missing.
|
||||
|
||||
Synthax for a COMPLEXE craft item. A complexe item is an item that need either more than
|
||||
Syntax for a COMPLEX craft item. A complex item is an item that need either more than
|
||||
only one skill, or more than only one resource.
|
||||
|
||||
Coming soon....
|
||||
|
|
@ -183,7 +183,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
#endregion
|
||||
|
||||
int index = -1;
|
||||
int index;
|
||||
|
||||
#region Platemail
|
||||
|
||||
|
|
|
|||
|
|
@ -898,8 +898,7 @@ namespace Server.Factions
|
|||
|
||||
public static void HandleDeath(Mobile victim, Mobile killer)
|
||||
{
|
||||
if (killer == null)
|
||||
killer = victim.FindMostRecentDamager(true);
|
||||
killer ??= victim.FindMostRecentDamager(true);
|
||||
|
||||
PlayerState killerState = PlayerState.Find(killer);
|
||||
Container killerPack = killer?.Backpack;
|
||||
|
|
|
|||
|
|
@ -260,8 +260,7 @@ namespace Server.Factions
|
|||
|
||||
public void OnGivenSilverTo(Mobile mob)
|
||||
{
|
||||
if (SilverGiven == null)
|
||||
SilverGiven = new List<SilverGivenEntry>();
|
||||
SilverGiven ??= new List<SilverGivenEntry>();
|
||||
|
||||
SilverGiven.Add(new SilverGivenEntry(mob));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ namespace Server.Factions
|
|||
|
||||
public void ConstructGuardLists()
|
||||
{
|
||||
GuardDefinition[] defs = Owner == null ? new GuardDefinition[0] : Owner.Definition.Guards;
|
||||
GuardDefinition[] defs = Owner?.Definition.Guards ?? new GuardDefinition[0];
|
||||
|
||||
GuardLists = new List<GuardList>();
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Server.Engines.Harvest
|
|||
new MutateEntry(0.0, 125.0, -2375.0, false, typeof(PrizedFish), typeof(WondrousFish), typeof(TrulyRareFish),
|
||||
typeof(PeculiarFish)),
|
||||
new MutateEntry(0.0, 105.0, -420.0, false, typeof(Boots), typeof(Shoes), typeof(Sandals), typeof(ThighBoots)),
|
||||
new MutateEntry(0.0, 200.0, -200.0, false, new Type[1] { null })
|
||||
new MutateEntry(0.0, 200.0, -200.0, false, new Type[] { null })
|
||||
};
|
||||
|
||||
private static int[] m_WaterTiles =
|
||||
|
|
|
|||
|
|
@ -145,8 +145,7 @@ namespace Server.Engines.Help
|
|||
|
||||
public static void Save()
|
||||
{
|
||||
if (List == null)
|
||||
List = Load();
|
||||
List ??= Load();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
public static void EnsureExistence()
|
||||
{
|
||||
if (m_Instance == null)
|
||||
m_Instance = new MLQuestPersistence();
|
||||
m_Instance ??= new MLQuestPersistence();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
|
|
@ -55,4 +54,4 @@ namespace Server.Engines.MLQuests
|
|||
MLQuest.Deserialize(reader, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -433,8 +433,7 @@ namespace Server.Engines.MLQuests
|
|||
foreach (BaseObjectiveInstance objective in instance.Objectives)
|
||||
if (!objective.Expired && objective is KillObjectiveInstance kill)
|
||||
{
|
||||
if (type == null)
|
||||
type = mob.GetType();
|
||||
type ??= mob.GetType();
|
||||
|
||||
if (kill.AddKill(mob, type))
|
||||
{
|
||||
|
|
@ -477,8 +476,7 @@ namespace Server.Engines.MLQuests
|
|||
instance.Quester = quester;
|
||||
}
|
||||
|
||||
if (deliverInstance == null)
|
||||
deliverInstance = instance;
|
||||
deliverInstance ??= instance;
|
||||
|
||||
break; // don't return, we may have to complete more deliveries
|
||||
}
|
||||
|
|
@ -563,8 +561,7 @@ namespace Server.Engines.MLQuests
|
|||
* Save first quest that reaches the CanOffer call.
|
||||
* If no quests are valid at all, return this quest for displaying the CanOffer error message.
|
||||
*/
|
||||
if (fallback == null)
|
||||
fallback = quest;
|
||||
fallback ??= quest;
|
||||
|
||||
if (quest.CanOffer(quester, pm, context, false))
|
||||
m_EligiblePool.Add(quest);
|
||||
|
|
|
|||
|
|
@ -100,9 +100,8 @@ namespace Server.Engines.MLQuests.Mobiles
|
|||
|
||||
if (m.CanSee(this) && m.InLOS(this) && m.CanBeginAction(this))
|
||||
{
|
||||
if (shoutPacket == null)
|
||||
shoutPacket = Packet.Acquire(new MessageLocalized(Serial, Body, MessageType.Regular, 946, 3,
|
||||
1078099, Name, "")); // Double Click On Me For Help!
|
||||
shoutPacket ??= Packet.Acquire(new MessageLocalized(Serial, Body, MessageType.Regular, 946, 3,
|
||||
1078099, Name, "")); // Double Click On Me For Help!
|
||||
|
||||
state.Send(shoutPacket);
|
||||
}
|
||||
|
|
@ -135,4 +134,4 @@ namespace Server.Engines.MLQuests.Mobiles
|
|||
Frozen = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,6 @@ namespace Server.PathAlgorithms.SlowAStar
|
|||
switch (i)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
x = 0;
|
||||
y = -1;
|
||||
break;
|
||||
|
|
@ -272,4 +271,4 @@ namespace Server.PathAlgorithms.SlowAStar
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,8 +84,7 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
else
|
||||
{
|
||||
if (PlantSystem == null)
|
||||
PlantSystem = new PlantSystem(this, false);
|
||||
PlantSystem ??= new PlantSystem(this, false);
|
||||
|
||||
int hits = (int)(PlantSystem.MaxHits * ratio);
|
||||
|
||||
|
|
|
|||
|
|
@ -326,18 +326,15 @@ namespace Server.Engines.Quests
|
|||
|
||||
if (completed && restartDelay > TimeSpan.Zero || !completed && restartDelay == TimeSpan.MaxValue)
|
||||
{
|
||||
List<QuestRestartInfo> doneQuests = From.DoneQuests;
|
||||
|
||||
if (doneQuests == null)
|
||||
From.DoneQuests = doneQuests = new List<QuestRestartInfo>();
|
||||
From.DoneQuests ??= new List<QuestRestartInfo>();
|
||||
|
||||
bool found = false;
|
||||
|
||||
Type ourQuestType = GetType();
|
||||
|
||||
for (int i = 0; i < doneQuests.Count; ++i)
|
||||
for (int i = 0; i < From.DoneQuests.Count; ++i)
|
||||
{
|
||||
QuestRestartInfo restartInfo = doneQuests[i];
|
||||
QuestRestartInfo restartInfo = From.DoneQuests[i];
|
||||
|
||||
if (restartInfo.QuestType == ourQuestType)
|
||||
{
|
||||
|
|
@ -348,7 +345,7 @@ namespace Server.Engines.Quests
|
|||
}
|
||||
|
||||
if (!found)
|
||||
doneQuests.Add(new QuestRestartInfo(ourQuestType, restartDelay));
|
||||
From.DoneQuests.Add(new QuestRestartInfo(ourQuestType, restartDelay));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,8 +293,7 @@ namespace Server.Mobiles
|
|||
|
||||
public void Defrag()
|
||||
{
|
||||
if (Entries == null)
|
||||
Entries = new List<SpawnerEntry>();
|
||||
Entries ??= new List<SpawnerEntry>();
|
||||
|
||||
for (int i = 0; i < Entries.Count; ++i)
|
||||
Entries[i].Defrag(this);
|
||||
|
|
@ -302,8 +301,6 @@ namespace Server.Mobiles
|
|||
|
||||
public void OnTick()
|
||||
{
|
||||
// DoTimer( m_Spawned.Count >= m_Count );
|
||||
|
||||
if (m_Group)
|
||||
{
|
||||
Defrag();
|
||||
|
|
@ -318,15 +315,6 @@ namespace Server.Mobiles
|
|||
Spawn();
|
||||
}
|
||||
|
||||
/*
|
||||
if ( m_Running && m_Timer != null )
|
||||
{
|
||||
if ( m_Spawned.Count >= m_Count && m_Timer.Running )
|
||||
DoTimer( true );
|
||||
else if ( m_Spawned.Count < m_Count && !m_Timer.Running )
|
||||
DoTimer( false );
|
||||
}
|
||||
*/
|
||||
DoTimer();
|
||||
}
|
||||
|
||||
|
|
@ -915,8 +903,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (SpawnerType.GetType(typeName) == null)
|
||||
{
|
||||
if (m_WarnTimer == null)
|
||||
m_WarnTimer = new WarnTimer();
|
||||
m_WarnTimer ??= new WarnTimer();
|
||||
|
||||
m_WarnTimer.Add(Location, Map, typeName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ namespace Server.Misc
|
|||
|
||||
//This is the Exponentional regression with only 2 datapoints.
|
||||
//A log. func would also work, but it didn't make as much sense.
|
||||
//This function isn't OSI exact beign that I don't know OSI's func they used ;p
|
||||
//This function isn't OSI exact being that I don't know OSI's func they used ;p
|
||||
int x = pm.ToTTotalMonsterFame;
|
||||
|
||||
//const double A = 8.63316841 * Math.Pow( 10, -4 );
|
||||
|
|
|
|||
|
|
@ -372,8 +372,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
state.Mobile.ProcessDelta();
|
||||
|
||||
if (p == null)
|
||||
p = Packet.Acquire(new UpdateStatueAnimation(this, 1, m_Animation, m_Frames));
|
||||
p ??= Packet.Acquire(new UpdateStatueAnimation(this, 1, m_Animation, m_Frames));
|
||||
|
||||
state.Send(p);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue