Fixes casting checks
This commit is contained in:
parent
7ea00fbf4f
commit
03dd5f1926
431 changed files with 5616 additions and 6250 deletions
|
|
@ -197,9 +197,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( info.IsSwitched( 1 ) )
|
||||
{
|
||||
PlayerMobile pm = m_Challenged as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(m_Challenged is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
if ( pm.DuelContext != null )
|
||||
|
|
@ -254,25 +252,15 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
foreach ( Gump g in ns.Gumps )
|
||||
{
|
||||
if ( g is ParticipantGump )
|
||||
if ( g is ParticipantGump pg && pg.Participant == m_Participant )
|
||||
{
|
||||
ParticipantGump pg = (ParticipantGump)g;
|
||||
|
||||
if ( pg.Participant == m_Participant )
|
||||
{
|
||||
m_Challenger.SendGump( new ParticipantGump( m_Challenger, m_Context, m_Participant ) );
|
||||
break;
|
||||
}
|
||||
m_Challenger.SendGump( new ParticipantGump( m_Challenger, m_Context, m_Participant ) );
|
||||
break;
|
||||
}
|
||||
else if ( g is DuelContextGump )
|
||||
if ( g is DuelContextGump dcg && dcg.Context == m_Context )
|
||||
{
|
||||
DuelContextGump dcg = (DuelContextGump)g;
|
||||
|
||||
if ( dcg.Context == m_Context )
|
||||
{
|
||||
m_Challenger.SendGump( new DuelContextGump( m_Challenger, m_Context ) );
|
||||
break;
|
||||
}
|
||||
m_Challenger.SendGump( new DuelContextGump( m_Challenger, m_Context ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -294,4 +282,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -615,12 +615,8 @@ namespace Server.Engines.ConPVP
|
|||
List<Mobile> pets = new List<Mobile>();
|
||||
|
||||
foreach ( Mobile mob in facet.GetMobilesInBounds( m_Bounds ) ) {
|
||||
BaseCreature pet = mob as BaseCreature;
|
||||
|
||||
if ( pet != null && pet.Controlled && pet.ControlMaster != null ) {
|
||||
if ( m_Players.Contains( pet.ControlMaster ) ) {
|
||||
pets.Add( pet );
|
||||
}
|
||||
if ( mob is BaseCreature pet && pet.Controlled && pet.ControlMaster != null && m_Players.Contains( pet.ControlMaster ) ) {
|
||||
pets.Add( pet );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -826,4 +822,4 @@ namespace Server.Engines.ConPVP
|
|||
return a.CompareTo( b );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,15 +55,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if ( m_EventGame != null )
|
||||
return m_EventGame.CantDoAnything( mob );
|
||||
else
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsFreeConsume( Mobile mob )
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if ( pm == null || pm.DuelContext == null || pm.DuelContext.m_EventGame == null )
|
||||
if ( !(mob is PlayerMobile pm) || pm.DuelContext?.m_EventGame == null )
|
||||
return false;
|
||||
|
||||
return pm.DuelContext.m_EventGame.FreeConsume;
|
||||
|
|
@ -76,14 +74,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public static bool AllowSpecialMove( Mobile from, string name, SpecialMove move )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return true;
|
||||
|
||||
DuelContext dc = pm.DuelContext;
|
||||
|
||||
return (dc == null || dc.InstAllowSpecialMove( from, name, move ));
|
||||
// No DuelContext, or InstaAllowSpecialMove
|
||||
return dc?.InstAllowSpecialMove( from, name, move ) != false;
|
||||
}
|
||||
|
||||
public bool InstAllowSpecialMove( Mobile from, string name, SpecialMove move )
|
||||
|
|
@ -102,9 +99,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
string title = null;
|
||||
|
||||
if( move is NinjaMove )
|
||||
if ( move is NinjaMove )
|
||||
title = "Bushido";
|
||||
else if( move is SamuraiMove )
|
||||
else if ( move is SamuraiMove )
|
||||
title = "Ninjitsu";
|
||||
|
||||
|
||||
|
|
@ -133,7 +130,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
string title = null, option = null;
|
||||
|
||||
if( spell is ArcanistSpell )
|
||||
if ( spell is ArcanistSpell )
|
||||
{
|
||||
title = "Spellweaving";
|
||||
option = spell.Name;
|
||||
|
|
@ -158,9 +155,9 @@ namespace Server.Engines.ConPVP
|
|||
title = "Bushido";
|
||||
option = spell.Name;
|
||||
}
|
||||
else if( spell is MagerySpell )
|
||||
else if ( spell is MagerySpell magerySpell )
|
||||
{
|
||||
switch( ((MagerySpell)spell).Circle )
|
||||
switch( magerySpell.Circle )
|
||||
{
|
||||
case SpellCircle.First: title = "1st Circle"; break;
|
||||
case SpellCircle.Second: title = "2nd Circle"; break;
|
||||
|
|
@ -172,7 +169,7 @@ namespace Server.Engines.ConPVP
|
|||
case SpellCircle.Eighth: title = "8th Circle"; break;
|
||||
}
|
||||
|
||||
option = spell.Name;
|
||||
option = magerySpell.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -206,14 +203,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public static bool AllowSpecialAbility( Mobile from, string name, bool message )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return true;
|
||||
|
||||
DuelContext dc = pm.DuelContext;
|
||||
|
||||
return ( dc == null || dc.InstAllowSpecialAbility( from, name, message ) );
|
||||
// No DuelContext or InstAllowSpecialAbility
|
||||
return dc?.InstAllowSpecialAbility( from, name, message ) != false;
|
||||
}
|
||||
|
||||
public bool InstAllowSpecialAbility( Mobile from, string name, bool message )
|
||||
|
|
@ -223,7 +219,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
||||
if ( pl == null || pl.Eliminated )
|
||||
if ( pl?.Eliminated != false )
|
||||
return true;
|
||||
|
||||
if ( CantDoAnything( from ) )
|
||||
|
|
@ -245,10 +241,8 @@ namespace Server.Engines.ConPVP
|
|||
if ( !m_Ruleset.GetOption( "Weapons", "Wrestling" ) )
|
||||
return false;
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)item;
|
||||
|
||||
if ( armor.ProtectionLevel > ArmorProtectionLevel.Regular && !m_Ruleset.GetOption( "Armor", "Magical" ) )
|
||||
return false;
|
||||
|
||||
|
|
@ -258,10 +252,8 @@ namespace Server.Engines.ConPVP
|
|||
if ( armor is BaseShield && !m_Ruleset.GetOption( "Armor", "Shields" ) )
|
||||
return false;
|
||||
}
|
||||
else if ( item is BaseWeapon )
|
||||
else if ( item is BaseWeapon weapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)item;
|
||||
|
||||
if ( (weapon.DamageLevel > WeaponDamageLevel.Regular || weapon.AccuracyLevel > WeaponAccuracyLevel.Regular) && !m_Ruleset.GetOption( "Weapons", "Magical" ) )
|
||||
return false;
|
||||
|
||||
|
|
@ -353,9 +345,9 @@ namespace Server.Engines.ConPVP
|
|||
title = "Items";
|
||||
option = "Bandages";
|
||||
}
|
||||
else if ( item is TrappableContainer )
|
||||
else if ( item is TrappableContainer container )
|
||||
{
|
||||
if ( ((TrappableContainer)item).TrapType != TrapType.None )
|
||||
if ( container.TrapType != TrapType.None )
|
||||
{
|
||||
title = "Items";
|
||||
option = "Trapped Containers";
|
||||
|
|
@ -402,12 +394,12 @@ namespace Server.Engines.ConPVP
|
|||
from.SendMessage( "You may not use this item before the duel begins." );
|
||||
return false;
|
||||
}
|
||||
else if ( item is BasePotion && !(item is BaseExplosionPotion) && !(item is BaseRefreshPotion) && IsSuddenDeath )
|
||||
if ( item is BasePotion && !(item is BaseExplosionPotion) && !(item is BaseRefreshPotion) && IsSuddenDeath )
|
||||
{
|
||||
from.SendMessage( 0x22, "You may not drink potions in sudden death." );
|
||||
return false;
|
||||
}
|
||||
else if ( item is Bandage && IsSuddenDeath )
|
||||
if ( item is Bandage && IsSuddenDeath )
|
||||
{
|
||||
from.SendMessage( 0x22, "You may not use bandages in sudden death." );
|
||||
return false;
|
||||
|
|
@ -529,14 +521,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Requip( Mobile from, Container cont )
|
||||
{
|
||||
Corpse corpse = cont as Corpse;
|
||||
|
||||
if ( corpse == null )
|
||||
if ( !(cont is Corpse corpse) )
|
||||
return;
|
||||
|
||||
List<Item> items = new List<Item>( corpse.Items );
|
||||
|
||||
bool gathered = false;
|
||||
bool didntFit = false;
|
||||
|
||||
Container pack = from.Backpack;
|
||||
|
|
@ -544,20 +533,14 @@ namespace Server.Engines.ConPVP
|
|||
for ( int i = 0; !didntFit && i < items.Count; ++i )
|
||||
{
|
||||
Item item = items[i];
|
||||
Point3D loc = item.Location;
|
||||
|
||||
if ( (item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable )
|
||||
continue;
|
||||
|
||||
if ( pack != null )
|
||||
{
|
||||
pack.DropItem( item );
|
||||
gathered = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
didntFit = true;
|
||||
}
|
||||
}
|
||||
|
||||
corpse.Carved = true;
|
||||
|
|
@ -578,10 +561,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
from.PlaySound( 0x3E3 );
|
||||
|
||||
if ( gathered && !didntFit )
|
||||
from.SendLocalizedMessage( 1062471 ); // You quickly gather all of your belongings.
|
||||
else if ( gathered && didntFit )
|
||||
from.SendLocalizedMessage( 1062472 ); // You gather some of your belongings. The rest remain on the corpse.
|
||||
if (didntFit)
|
||||
from.SendLocalizedMessage(1062472); // You gather some of your belongings. The rest remain on the corpse.
|
||||
else
|
||||
from.SendLocalizedMessage(1062471); // You quickly gather all of your belongings.
|
||||
|
||||
}
|
||||
|
||||
public void Refresh( Mobile mob, Container cont )
|
||||
|
|
@ -590,15 +574,11 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
mob.Resurrect();
|
||||
|
||||
DeathRobe robe = mob.FindItemOnLayer( Layer.OuterTorso ) as DeathRobe;
|
||||
|
||||
if ( robe != null )
|
||||
if ( mob.FindItemOnLayer( Layer.OuterTorso ) is DeathRobe robe )
|
||||
robe.Delete();
|
||||
|
||||
if ( cont is Corpse )
|
||||
if ( cont is Corpse corpse )
|
||||
{
|
||||
Corpse corpse = (Corpse) cont;
|
||||
|
||||
for ( int i = 0; i < corpse.EquipItems.Count; ++i )
|
||||
{
|
||||
Item item = corpse.EquipItems[i];
|
||||
|
|
@ -774,13 +754,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
DuelPlayer pl = (DuelPlayer)p.Players[j];
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
if ( pl == null )
|
||||
continue;
|
||||
|
||||
if ( pl.Mobile is PlayerMobile )
|
||||
((PlayerMobile)pl.Mobile).DuelPlayer = null;
|
||||
if ( pl.Mobile is PlayerMobile mobile )
|
||||
mobile.DuelPlayer = null;
|
||||
|
||||
for ( int k = 0; k < types.Length; ++k )
|
||||
pl.Mobile.CloseGump( types[k] );
|
||||
|
|
@ -822,10 +802,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public DuelPlayer Find( Mobile mob )
|
||||
{
|
||||
if ( mob is PlayerMobile )
|
||||
if ( mob is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)mob;
|
||||
|
||||
if ( pm.DuelContext == this )
|
||||
return pm.DuelPlayer;
|
||||
|
||||
|
|
@ -985,15 +963,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public static bool CheckSuddenDeath( Mobile mob )
|
||||
{
|
||||
if ( mob is PlayerMobile )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)mob;
|
||||
|
||||
if ( pm.DuelPlayer != null && !pm.DuelPlayer.Eliminated && pm.DuelContext != null && pm.DuelContext.IsSuddenDeath )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return mob is PlayerMobile pm && pm.DuelPlayer?.Eliminated == false && pm.DuelContext?.IsSuddenDeath == true;
|
||||
}
|
||||
|
||||
public void ActivateSuddenDeath()
|
||||
|
|
@ -1134,10 +1104,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private static void vli_ot( Mobile from, object obj )
|
||||
{
|
||||
if ( obj is PlayerMobile )
|
||||
if ( obj is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)obj;
|
||||
|
||||
Ladder ladder = Ladder.Instance;
|
||||
|
||||
if ( ladder == null )
|
||||
|
|
@ -1176,9 +1144,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private static void EventSink_Login( LoginEventArgs e )
|
||||
{
|
||||
PlayerMobile pm = e.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(e.Mobile is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
DuelContext dc = pm.DuelContext;
|
||||
|
|
@ -1202,9 +1168,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private static void ViewLadder_OnTarget( Mobile from, object obj, object state )
|
||||
{
|
||||
if ( obj is PlayerMobile )
|
||||
if ( obj is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)obj;
|
||||
Ladder ladder = (Ladder)state;
|
||||
|
||||
LadderEntry entry = ladder.Find( pm );
|
||||
|
|
@ -1216,10 +1181,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
pm.PrivateOverheadMessage( MessageType.Regular, pm.SpeechHue, true, String.Format( text, from==pm?"You":"They" ), from.NetState );
|
||||
}
|
||||
else if ( obj is Mobile )
|
||||
else if ( obj is Mobile mob )
|
||||
{
|
||||
Mobile mob = (Mobile)obj;
|
||||
|
||||
if ( mob.Body.IsHuman )
|
||||
mob.PrivateOverheadMessage( MessageType.Regular, mob.SpeechHue, false, "I'm not a duelist, and quite frankly, I resent the implication.", from.NetState );
|
||||
else
|
||||
|
|
@ -1236,9 +1199,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( e.Handled )
|
||||
return;
|
||||
|
||||
PlayerMobile pm = e.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(e.Mobile is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
if ( Insensitive.Contains( e.Speech, "i wish to duel" ) )
|
||||
|
|
@ -1388,25 +1349,15 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
foreach ( Gump g in ns.Gumps )
|
||||
{
|
||||
if ( g is ParticipantGump )
|
||||
if (g is ParticipantGump pg && pg.Participant == p)
|
||||
{
|
||||
ParticipantGump pg = (ParticipantGump)g;
|
||||
|
||||
if ( pg.Participant == p )
|
||||
{
|
||||
init.SendGump( new ParticipantGump( init, dc, p ) );
|
||||
break;
|
||||
}
|
||||
init.SendGump( new ParticipantGump( init, dc, p ) );
|
||||
break;
|
||||
}
|
||||
else if ( g is DuelContextGump )
|
||||
if ( g is DuelContextGump dcg && dcg.Context == dc )
|
||||
{
|
||||
DuelContextGump dcg = (DuelContextGump)g;
|
||||
|
||||
if ( dcg.Context == dc )
|
||||
{
|
||||
init.SendGump( new DuelContextGump( init, dc ) );
|
||||
break;
|
||||
}
|
||||
init.SendGump( new DuelContextGump( init, dc ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1433,31 +1384,22 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( ns != null )
|
||||
{
|
||||
bool send=true;
|
||||
bool send = true;
|
||||
|
||||
foreach ( Gump g in ns.Gumps )
|
||||
{
|
||||
if ( g is ParticipantGump )
|
||||
if ( g is ParticipantGump pg && pg.Participant == p )
|
||||
{
|
||||
ParticipantGump pg = (ParticipantGump)g;
|
||||
|
||||
if ( pg.Participant == p )
|
||||
{
|
||||
init.SendGump( new ParticipantGump( init, dc, p ) );
|
||||
send=false;
|
||||
break;
|
||||
}
|
||||
init.SendGump( new ParticipantGump( init, dc, p ) );
|
||||
send=false;
|
||||
break;
|
||||
}
|
||||
else if ( g is DuelContextGump )
|
||||
{
|
||||
DuelContextGump dcg = (DuelContextGump)g;
|
||||
|
||||
if ( dcg.Context == dc )
|
||||
{
|
||||
init.SendGump( new DuelContextGump( init, dc ) );
|
||||
send=false;
|
||||
break;
|
||||
}
|
||||
if ( g is DuelContextGump dcg && dcg.Context == dc )
|
||||
{
|
||||
init.SendGump( new DuelContextGump( init, dc ) );
|
||||
send=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1468,9 +1410,8 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( pm.DuelContext.m_Countdown != null )
|
||||
pm.DuelContext.m_Countdown.Stop();
|
||||
pm.DuelContext.m_Countdown= null;
|
||||
pm.DuelContext.m_Countdown?.Stop();
|
||||
pm.DuelContext.m_Countdown = null;
|
||||
|
||||
pm.DuelContext.m_StartedReadyCountdown=false;
|
||||
p.Broadcast( 0x22, null, "{0} has yielded.", "You have yielded." );
|
||||
|
|
@ -1492,31 +1433,21 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( ns != null )
|
||||
{
|
||||
bool send=true;
|
||||
bool send = true;
|
||||
|
||||
foreach ( Gump g in ns.Gumps )
|
||||
{
|
||||
if ( g is ParticipantGump )
|
||||
if ( g is ParticipantGump pg && pg.Participant == p )
|
||||
{
|
||||
ParticipantGump pg = (ParticipantGump)g;
|
||||
|
||||
if ( pg.Participant == p )
|
||||
{
|
||||
init.SendGump( new ParticipantGump( init, dc, p ) );
|
||||
send=false;
|
||||
break;
|
||||
}
|
||||
init.SendGump( new ParticipantGump( init, dc, p ) );
|
||||
send=false;
|
||||
break;
|
||||
}
|
||||
else if ( g is DuelContextGump )
|
||||
if ( g is DuelContextGump dcg && dcg.Context == dc )
|
||||
{
|
||||
DuelContextGump dcg = (DuelContextGump)g;
|
||||
|
||||
if ( dcg.Context == dc )
|
||||
{
|
||||
init.SendGump( new DuelContextGump( init, dc ) );
|
||||
send=false;
|
||||
break;
|
||||
}
|
||||
init.SendGump( new DuelContextGump( init, dc ) );
|
||||
send=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1705,10 +1636,10 @@ namespace Server.Engines.ConPVP
|
|||
TransformationSpellHelper.RemoveContext( mob, true );
|
||||
AnimalForm.RemoveContext( mob, true );
|
||||
|
||||
if( DisguiseTimers.IsDisguised( mob ) )
|
||||
if ( DisguiseTimers.IsDisguised( mob ) )
|
||||
DisguiseTimers.StopTimer( mob );
|
||||
|
||||
if( !mob.CanBeginAction( typeof( PolymorphSpell ) ) )
|
||||
if ( !mob.CanBeginAction( typeof( PolymorphSpell ) ) )
|
||||
{
|
||||
mob.BodyMod = 0;
|
||||
mob.HueMod = -1;
|
||||
|
|
@ -1727,8 +1658,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public static void CancelSpell( Mobile mob )
|
||||
{
|
||||
if ( mob.Spell is Spells.Spell )
|
||||
((Spells.Spell)mob.Spell).Disturb( Spells.DisturbType.Kill );
|
||||
if ( mob.Spell is Spell spell )
|
||||
spell.Disturb( DisturbType.Kill );
|
||||
|
||||
Targeting.Target.Cancel( mob );
|
||||
}
|
||||
|
|
@ -2529,9 +2460,7 @@ namespace Server.Engines.ConPVP
|
|||
m_GateFacet = m_Initiator.Map;
|
||||
}
|
||||
|
||||
ExitTeleporter tp = arena.Teleporter as ExitTeleporter;
|
||||
|
||||
if ( tp == null )
|
||||
if ( !(arena.Teleporter is ExitTeleporter tp) )
|
||||
{
|
||||
arena.Teleporter = tp = new ExitTeleporter();
|
||||
tp.MoveToWorld( arena.GateOut == Point3D.Zero ? arena.Outside : arena.GateOut, arena.Facet );
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private Mobile FindOwner( object parent )
|
||||
{
|
||||
if ( parent is Item )
|
||||
return ( (Item) parent ).RootParent as Mobile;
|
||||
if ( parent is Item item )
|
||||
return item.RootParent as Mobile;
|
||||
|
||||
if ( parent is Mobile )
|
||||
return (Mobile) parent;
|
||||
if ( parent is Mobile mobile )
|
||||
return mobile;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -282,8 +282,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( obj is Mobile )
|
||||
pt.Z += 10;
|
||||
else if ( obj is Item )
|
||||
pt.Z += ((Item)obj).ItemData.CalcHeight + 1;
|
||||
else if ( obj is Item item )
|
||||
pt.Z += item.ItemData.CalcHeight + 1;
|
||||
|
||||
m_Flying = true;
|
||||
this.Visible = false;
|
||||
|
|
@ -317,12 +317,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( zdiff < 0 )
|
||||
return false;
|
||||
else if ( zdiff < 12 )
|
||||
if ( zdiff < 12 )
|
||||
return true;
|
||||
else if ( zdiff < 16 )
|
||||
if ( zdiff < 16 )
|
||||
return Utility.RandomBool(); // 50% chance
|
||||
else
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void DoAnim( Point3D start, Point3D end, Map map )
|
||||
|
|
@ -604,10 +604,10 @@ namespace Server.Engines.ConPVP
|
|||
continue;
|
||||
|
||||
area.Free();
|
||||
if ( i is BRGoal )
|
||||
if ( i is BRGoal goal )
|
||||
{
|
||||
Point3D oldLoc = new Point3D( this.GetWorldLocation() );
|
||||
if ( CheckScore( (BRGoal)i, m_Thrower, 3 ) )
|
||||
if ( CheckScore( goal, m_Thrower, 3 ) )
|
||||
DoAnim( oldLoc, point, this.Map );
|
||||
else
|
||||
HitObject( point, loc.Z, height );
|
||||
|
|
@ -939,9 +939,7 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
this.Hue = 0x84C;
|
||||
|
||||
BRBomb b = m.Backpack.FindItemByType( typeof( BRBomb ), true ) as BRBomb;
|
||||
|
||||
if ( b != null )
|
||||
if ( m.Backpack.FindItemByType( typeof( BRBomb ), true ) is BRBomb b )
|
||||
b.CheckScore( this, m, 7 );
|
||||
|
||||
return true;
|
||||
|
|
@ -1321,9 +1319,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( mob == null )
|
||||
return null;
|
||||
|
||||
BRPlayerInfo val = m_Players[mob] as BRPlayerInfo;
|
||||
|
||||
if ( val == null )
|
||||
if ( !(m_Players[mob] is BRPlayerInfo val) )
|
||||
m_Players[mob] = val = new BRPlayerInfo( this, mob );
|
||||
|
||||
return val;
|
||||
|
|
@ -1623,15 +1619,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public int GetTeamID( Mobile mob )
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
{
|
||||
if ( mob is BaseCreature )
|
||||
return ((BaseCreature)mob).Team - 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
if ( !(mob is PlayerMobile pm) )
|
||||
return mob is BaseCreature creature ? creature.Team - 1 : -1;
|
||||
|
||||
if ( pm.DuelContext == null || pm.DuelContext != m_Context )
|
||||
return -1;
|
||||
|
|
@ -1644,12 +1633,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public int GetColor( Mobile mob )
|
||||
{
|
||||
BRTeamInfo teamInfo = GetTeamInfo( mob );
|
||||
|
||||
if ( teamInfo != null )
|
||||
return teamInfo.Color;
|
||||
|
||||
return -1;
|
||||
return GetTeamInfo( mob )?.Color ?? -1;
|
||||
}
|
||||
|
||||
private void ApplyHues( Participant p, int hueOverride )
|
||||
|
|
@ -1674,8 +1658,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer dp = null;
|
||||
|
||||
if ( mob is PlayerMobile )
|
||||
dp = ( mob as PlayerMobile ).DuelPlayer;
|
||||
if ( mob is PlayerMobile mobile )
|
||||
dp = mobile.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions( mob );
|
||||
|
||||
|
|
@ -1896,9 +1880,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
{
|
||||
Participant p = m_Context.Participants[i] as Participant;
|
||||
|
||||
if ( p == null || p.Players == null )
|
||||
if ( !(m_Context.Participants[i] is Participant p) || p.Players == null )
|
||||
continue;
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
|
|
@ -1915,7 +1897,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( i == winner.TeamID )
|
||||
continue;
|
||||
|
||||
if ( p != null && p.Players != null )
|
||||
if ( p.Players != null )
|
||||
{
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -1942,15 +1924,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
ReturnBomb();
|
||||
|
||||
if( m_Bomb != null )
|
||||
m_Bomb.Delete();
|
||||
m_Bomb?.Delete();
|
||||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
ApplyHues( m_Context.Participants[i] as Participant, -1 );
|
||||
|
||||
if ( m_FinishTimer != null )
|
||||
m_FinishTimer.Stop();
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
m_FinishTimer = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -448,10 +448,8 @@ namespace Server.Engines.ConPVP
|
|||
from.LocalOverheadMessage( MessageType.Regular, 0x26, false, "Those are not my cookies." );
|
||||
}
|
||||
}
|
||||
else if ( obj is Mobile )
|
||||
else if ( obj is Mobile passTo )
|
||||
{
|
||||
Mobile passTo = obj as Mobile;
|
||||
|
||||
CTFTeamInfo passTeam = m_TeamInfo.Game.GetTeamInfo( passTo );
|
||||
|
||||
if ( passTo == from )
|
||||
|
|
@ -481,11 +479,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private Mobile FindOwner( object parent )
|
||||
{
|
||||
if ( parent is Item )
|
||||
return ( (Item) parent ).RootParent as Mobile;
|
||||
if ( parent is Item item )
|
||||
return item.RootParent as Mobile;
|
||||
|
||||
if ( parent is Mobile )
|
||||
return (Mobile) parent;
|
||||
if ( parent is Mobile mobile )
|
||||
return mobile;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -969,9 +967,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public int GetTeamID( Mobile mob )
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(mob is PlayerMobile pm) )
|
||||
return -1;
|
||||
|
||||
if ( pm.DuelContext == null || pm.DuelContext != m_Context )
|
||||
|
|
@ -1015,8 +1011,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer dp = null;
|
||||
|
||||
if ( mob is PlayerMobile )
|
||||
dp = ( mob as PlayerMobile ).DuelPlayer;
|
||||
if ( mob is PlayerMobile mobile )
|
||||
dp = mobile.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions( mob );
|
||||
|
||||
|
|
@ -1088,9 +1084,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
for ( int j = 0; j < ourFlagCarrier.Aggressors.Count; ++j )
|
||||
{
|
||||
AggressorInfo aggr = ourFlagCarrier.Aggressors[j] as AggressorInfo;
|
||||
|
||||
if ( aggr == null || aggr.Defender != ourFlagCarrier || aggr.Attacker != mob )
|
||||
if ( !(ourFlagCarrier.Aggressors[j] is AggressorInfo aggr) || aggr.Defender != ourFlagCarrier || aggr.Attacker != mob )
|
||||
continue;
|
||||
|
||||
playerInfo.Score += 2; // helped defend guy capturing enemy flag
|
||||
|
|
|
|||
|
|
@ -604,9 +604,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public int GetTeamID( Mobile mob )
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(mob is PlayerMobile pm) )
|
||||
return -1;
|
||||
|
||||
if ( pm.DuelContext == null || pm.DuelContext != m_Context )
|
||||
|
|
@ -620,12 +618,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public int GetColor( Mobile mob )
|
||||
{
|
||||
DDTeamInfo teamInfo = GetTeamInfo( mob );
|
||||
|
||||
if ( teamInfo != null )
|
||||
return teamInfo.Color;
|
||||
|
||||
return -1;
|
||||
return GetTeamInfo( mob )?.Color ?? -1;
|
||||
}
|
||||
|
||||
private void ApplyHues( Participant p, int hueOverride )
|
||||
|
|
@ -650,8 +643,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer dp = null;
|
||||
|
||||
if ( mob is PlayerMobile )
|
||||
dp = ( mob as PlayerMobile ).DuelPlayer;
|
||||
if ( mob is PlayerMobile mobile )
|
||||
dp = mobile.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions( mob );
|
||||
|
||||
|
|
@ -748,9 +741,7 @@ namespace Server.Engines.ConPVP
|
|||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color );
|
||||
|
||||
if ( m_FinishTimer != null )
|
||||
m_FinishTimer.Stop();
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
m_FinishTimer = Timer.DelayCall( m_Controller.Duration, new TimerCallback( Finish_Callback ) );
|
||||
}
|
||||
|
||||
|
|
@ -766,10 +757,7 @@ namespace Server.Engines.ConPVP
|
|||
teams.Add( teamInfo );
|
||||
}
|
||||
|
||||
teams.Sort( delegate( DDTeamInfo a, DDTeamInfo b )
|
||||
{
|
||||
return b.Score - a.Score;
|
||||
} );
|
||||
teams.Sort((a, b) => b.Score - a.Score);
|
||||
|
||||
Tournament tourny = m_Context.m_Tournament;
|
||||
|
||||
|
|
@ -897,7 +885,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DuelPlayer dp = p.Players[j];
|
||||
|
||||
if ( dp != null && dp.Mobile != null )
|
||||
if ( dp?.Mobile != null )
|
||||
{
|
||||
dp.Mobile.CloseGump( typeof( DDBoardGump ) );
|
||||
dp.Mobile.SendGump( new DDBoardGump( dp.Mobile, this ) );
|
||||
|
|
@ -952,9 +940,7 @@ namespace Server.Engines.ConPVP
|
|||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
ApplyHues( m_Context.Participants[i] as Participant, -1 );
|
||||
|
||||
if ( m_FinishTimer != null )
|
||||
m_FinishTimer.Stop();
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
m_FinishTimer = null;
|
||||
}
|
||||
|
||||
|
|
@ -981,14 +967,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Alert( "Domination averted!" );
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
m_Controller.PointA.SetNonCaptureHue();
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
m_Controller.PointB.SetNonCaptureHue();
|
||||
|
||||
if ( m_CaptureTimer != null )
|
||||
m_CaptureTimer.Stop();
|
||||
m_Controller.PointA?.SetNonCaptureHue();
|
||||
m_Controller.PointB?.SetNonCaptureHue();
|
||||
m_CaptureTimer?.Stop();
|
||||
m_CaptureTimer = null;
|
||||
}
|
||||
|
||||
|
|
@ -1012,8 +993,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( team == null )
|
||||
{
|
||||
m_Capturable = true;
|
||||
if ( m_CaptureTimer != null )
|
||||
m_CaptureTimer.Stop();
|
||||
m_CaptureTimer?.Stop();
|
||||
m_CaptureTimer = null;
|
||||
return;
|
||||
}
|
||||
|
|
@ -1022,11 +1002,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Alert( "{0} is dominating... {1}", team.Name, 10 - m_CapStage );
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
m_Controller.PointA.SetCaptureHue( m_CapStage );
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
m_Controller.PointB.SetCaptureHue( m_CapStage );
|
||||
m_Controller.PointA?.SetCaptureHue( m_CapStage );
|
||||
m_Controller.PointB?.SetCaptureHue( m_CapStage );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -673,9 +673,7 @@ namespace Server.Engines.ConPVP
|
|||
if (mob == null)
|
||||
return null;
|
||||
|
||||
KHPlayerInfo val = m_Players[mob] as KHPlayerInfo;
|
||||
|
||||
if (val == null)
|
||||
if (!(m_Players[mob] is KHPlayerInfo val))
|
||||
m_Players[mob] = val = new KHPlayerInfo(this, mob);
|
||||
|
||||
return val;
|
||||
|
|
@ -978,15 +976,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public int GetTeamID(Mobile mob)
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if (pm == null)
|
||||
{
|
||||
if (mob is BaseCreature)
|
||||
return ((BaseCreature)mob).Team - 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
if (!(mob is PlayerMobile pm))
|
||||
return mob is BaseCreature creature ? creature.Team - 1 : -1;
|
||||
|
||||
if (pm.DuelContext == null || pm.DuelContext != m_Context)
|
||||
return -1;
|
||||
|
|
@ -999,12 +990,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public int GetColor(Mobile mob)
|
||||
{
|
||||
KHTeamInfo teamInfo = GetTeamInfo(mob);
|
||||
|
||||
if (teamInfo != null)
|
||||
return teamInfo.Color;
|
||||
|
||||
return -1;
|
||||
return GetTeamInfo(mob)?.Color ?? -1;
|
||||
}
|
||||
|
||||
private void ApplyHues(Participant p, int hueOverride)
|
||||
|
|
@ -1029,8 +1015,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer dp = null;
|
||||
|
||||
if (mob is PlayerMobile)
|
||||
dp = (mob as PlayerMobile).DuelPlayer;
|
||||
if (mob is PlayerMobile mobile)
|
||||
dp = mobile.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
|
|
@ -1252,16 +1238,14 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < m_Context.Participants.Count; ++i)
|
||||
{
|
||||
Participant p = m_Context.Participants[i] as Participant;
|
||||
|
||||
if (p == null || p.Players == null)
|
||||
if (!(m_Context.Participants[i] is Participant p) || p.Players == null)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
DuelPlayer dp = p.Players[j];
|
||||
|
||||
if (dp != null && dp.Mobile != null)
|
||||
if (dp?.Mobile != null)
|
||||
{
|
||||
dp.Mobile.CloseGump(typeof(KHBoardGump));
|
||||
dp.Mobile.SendGump(new KHBoardGump(dp.Mobile, this));
|
||||
|
|
@ -1271,7 +1255,7 @@ namespace Server.Engines.ConPVP
|
|||
if (i == winner.TeamID)
|
||||
continue;
|
||||
|
||||
if (p != null && p.Players != null)
|
||||
if (p?.Players != null)
|
||||
{
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
|
|
@ -1304,9 +1288,8 @@ namespace Server.Engines.ConPVP
|
|||
for (int i = 0; i < m_Context.Participants.Count; ++i)
|
||||
ApplyHues(m_Context.Participants[i] as Participant, -1);
|
||||
|
||||
if (m_FinishTimer != null)
|
||||
m_FinishTimer.Stop();
|
||||
m_FinishTimer = null;
|
||||
m_FinishTimer?.Stop();
|
||||
m_FinishTimer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,10 +19,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public DuelPlayer Find( Mobile mob )
|
||||
{
|
||||
if ( mob is PlayerMobile )
|
||||
if ( mob is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)mob;
|
||||
|
||||
if ( pm.DuelContext == m_Context && pm.DuelPlayer.Participant == this )
|
||||
return pm.DuelPlayer;
|
||||
|
||||
|
|
@ -229,8 +227,8 @@ namespace Server.Engines.ConPVP
|
|||
m_Mobile = mob;
|
||||
m_Participant = p;
|
||||
|
||||
if ( mob is PlayerMobile )
|
||||
((PlayerMobile)mob).DuelPlayer = this;
|
||||
if ( mob is PlayerMobile mobile )
|
||||
mobile.DuelPlayer = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Server.Engines.ConPVP
|
|||
private DuelContext m_Context;
|
||||
private Participant m_Participant;
|
||||
|
||||
public Mobile From{ get{ return m_From; } }
|
||||
public Mobile From{ get{ return m_From; } }
|
||||
public DuelContext Context{ get{ return m_Context; } }
|
||||
public Participant Participant{ get{ return m_Participant; } }
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ namespace Server.Engines.ConPVP
|
|||
count = 4;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
|
||||
int height = 35 + 10 + 22 + 22 + 30 + 22 + 2 + (count * 22) + 2 + 30;
|
||||
|
||||
AddBackground( 0, 0, 300, height, 9250 );
|
||||
|
|
@ -203,9 +203,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( index < 0 || index >= m_Participant.Players.Length )
|
||||
return;
|
||||
|
||||
Mobile mob = targeted as Mobile;
|
||||
|
||||
if ( mob == null )
|
||||
if ( !(targeted is Mobile mob) )
|
||||
{
|
||||
from.SendMessage( "That is not a player." );
|
||||
}
|
||||
|
|
@ -222,9 +220,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(mob is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
if ( pm.DuelContext != null )
|
||||
|
|
@ -247,4 +243,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,9 +209,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 1: // okay
|
||||
{
|
||||
PlayerMobile pm = m_From as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(m_From is PlayerMobile pm) )
|
||||
break;
|
||||
|
||||
pm.DuelPlayer.Ready = true;
|
||||
|
|
@ -232,4 +230,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ namespace Server.Engines.ConPVP
|
|||
"Suprise Attack"
|
||||
} ) );
|
||||
|
||||
if( Core.ML )
|
||||
if ( Core.ML )
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Spellweaving", new string[]
|
||||
{
|
||||
|
|
@ -280,7 +280,7 @@ namespace Server.Engines.ConPVP
|
|||
} ) );
|
||||
}
|
||||
|
||||
if( Core.SE )
|
||||
if ( Core.SE )
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Items", new RulesetLayout[]
|
||||
{
|
||||
|
|
@ -342,7 +342,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
// Set up default rulesets
|
||||
|
||||
if( !Core.AOS )
|
||||
if ( !Core.AOS )
|
||||
{
|
||||
#region Mage 5x
|
||||
Ruleset m5x = new Ruleset( m_Root );
|
||||
|
|
@ -785,4 +785,4 @@ namespace Server.Engines.ConPVP
|
|||
children[i].m_Parent = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,15 +39,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
|
||||
if ( pm == null && m is BaseCreature )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
if ( pm == null && m is BaseCreature bc && bc.Summoned )
|
||||
pm = bc.SummonMaster as PlayerMobile;
|
||||
|
||||
if ( bc.Summoned )
|
||||
pm = bc.SummonMaster as PlayerMobile;
|
||||
}
|
||||
|
||||
if ( pm != null && pm.DuelContext != null && pm.DuelContext.StartedBeginCountdown )
|
||||
if ( pm?.DuelContext != null && pm.DuelContext.StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
if ( DuelContext.CheckCombat( m ) )
|
||||
|
|
|
|||
|
|
@ -163,9 +163,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
|
||||
}
|
||||
else if ( m_Tournament != null )
|
||||
else
|
||||
{
|
||||
Tournament tourny = m_Tournament.Tournament;
|
||||
Tournament tourny = m_Tournament?.Tournament;
|
||||
|
||||
if ( tourny != null )
|
||||
{
|
||||
|
|
@ -194,60 +194,46 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
case TournamentStage.Inactive:
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x35, false, "The tournament is closed.", from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x35, false, "The tournament is closed.", from.NetState );
|
||||
|
||||
break;
|
||||
}
|
||||
case TournamentStage.Signup:
|
||||
{
|
||||
Ladder ladder = Ladder.Instance;
|
||||
LadderEntry entry = ladder?.Find( from );
|
||||
|
||||
if ( ladder != null )
|
||||
if ( entry != null && Ladder.GetLevel( entry.Experience ) < tourny.LevelRequirement )
|
||||
{
|
||||
LadderEntry entry = ladder.Find( from );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x35, false, "You have not yet proven yourself a worthy dueler.", from.NetState );
|
||||
|
||||
if ( entry != null && Ladder.GetLevel( entry.Experience ) < tourny.LevelRequirement )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
{
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x35, false, "You have not yet proven yourself a worthy dueler.", from.NetState );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( tourny.IsFactionRestricted && Faction.Find( from ) == null )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
{
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x35, false, "Only those who have declared their faction allegiance may participate.", from.NetState );
|
||||
}
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x35, false, "Only those who have declared their faction allegiance may participate.", from.NetState );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ( from.HasGump( typeof( AcceptTeamGump ) ) )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "You must first respond to the offer I've given you.", from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "You must first respond to the offer I've given you.", from.NetState );
|
||||
}
|
||||
else if ( from.HasGump( typeof( AcceptDuelGump ) ) )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "You must first cancel your duel offer.", from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "You must first cancel your duel offer.", from.NetState );
|
||||
}
|
||||
else if ( from is PlayerMobile && ((PlayerMobile)from).DuelContext != null )
|
||||
else if ( from is PlayerMobile mobile && mobile.DuelContext != null )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "You are already participating in a duel.", from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "You are already participating in a duel.", mobile.NetState );
|
||||
}
|
||||
else if ( !tourny.HasParticipant( from ) )
|
||||
{
|
||||
|
|
@ -256,9 +242,9 @@ namespace Server.Engines.ConPVP
|
|||
from.CloseGump( typeof( ConfirmSignupGump ) );
|
||||
from.SendGump( new ConfirmSignupGump( from, m_Registrar, tourny, players ) );
|
||||
}
|
||||
else if ( m_Registrar != null )
|
||||
else
|
||||
{
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x35, false, "You have already entered this tournament.", from.NetState );
|
||||
}
|
||||
|
||||
|
|
@ -642,7 +628,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Mobile mob = (Mobile)m_Players[i];
|
||||
|
||||
LadderEntry entry = ( ladder == null ? null : ladder.Find( mob ) );
|
||||
LadderEntry entry = ladder?.Find( mob );
|
||||
|
||||
if ( entry != null && Ladder.GetLevel( entry.Experience ) < tourny.LevelRequirement )
|
||||
{
|
||||
|
|
@ -663,18 +649,15 @@ namespace Server.Engines.ConPVP
|
|||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
return;
|
||||
}
|
||||
else if ( tourny.IsFactionRestricted && Faction.Find( mob ) == null )
|
||||
if ( tourny.IsFactionRestricted && Faction.Find( mob ) == null )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
{
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x35, false, "Only those who have declared their faction allegiance may participate.", from.NetState );
|
||||
}
|
||||
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;
|
||||
}
|
||||
else if ( tourny.HasParticipant( mob ) )
|
||||
if ( tourny.HasParticipant( mob ) )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
{
|
||||
|
|
@ -693,20 +676,17 @@ namespace Server.Engines.ConPVP
|
|||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
return;
|
||||
}
|
||||
else if ( mob is PlayerMobile && ((PlayerMobile)mob).DuelContext != null )
|
||||
if ( mob is PlayerMobile mobile && mobile.DuelContext != null )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
if ( mob == from )
|
||||
{
|
||||
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, String.Format( "{0} is already assigned to a duel. They must yield it before joining this tournament.", mob.Name ), from.NetState );
|
||||
}
|
||||
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, String.Format( "{0} is already assigned to a duel. They must yield it before joining this tournament.", mobile.Name ), from.NetState );
|
||||
}
|
||||
|
||||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
|
|
@ -766,15 +746,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private void AddPlayer_OnTarget( Mobile from, object obj )
|
||||
{
|
||||
Mobile mob = obj as Mobile;
|
||||
|
||||
if ( mob == null || mob == from )
|
||||
if ( !(obj is Mobile mob) || mob == from )
|
||||
{
|
||||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "Excuse me?", from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "Excuse me?", from.NetState );
|
||||
}
|
||||
else if ( !mob.Player )
|
||||
{
|
||||
|
|
@ -789,73 +766,63 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They ignore your invitation.", from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They ignore your invitation.", from.NetState );
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(mob is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
if ( pm.DuelContext != null )
|
||||
{
|
||||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They are already assigned to another duel.", from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They are already assigned to another duel.", from.NetState );
|
||||
}
|
||||
else if ( mob.HasGump( typeof( AcceptTeamGump ) ) )
|
||||
{
|
||||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They have already been offered a partnership.", from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They have already been offered a partnership.", from.NetState );
|
||||
}
|
||||
else if ( mob.HasGump( typeof( ConfirmSignupGump ) ) )
|
||||
{
|
||||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They are already trying to join this tournament.", from.NetState );
|
||||
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 ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "You have already named them as a team member.", from.NetState );
|
||||
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 ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They have already entered this tournament.", from.NetState );
|
||||
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 ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "Your team is full.", from.NetState );
|
||||
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 ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x59, false, String.Format( "As you command m'{0}. I've given your offer to {1}.", from.Female ? "Lady" : "Lord", mob.Name ), from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x59, false, String.Format( "As you command m'{0}. I've given your offer to {1}.", from.Female ? "Lady" : "Lord", mob.Name ), from.NetState );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1144,50 +1111,43 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( info.IsSwitched( 1 ) )
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(mob is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
if ( AcceptDuelGump.IsIgnored( mob, from ) || mob.Blessed )
|
||||
{
|
||||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They ignore your invitation.", from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They ignore your invitation.", from.NetState );
|
||||
}
|
||||
else if ( pm.DuelContext != null )
|
||||
{
|
||||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They are already assigned to another duel.", from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They are already assigned to another duel.", from.NetState );
|
||||
}
|
||||
else if ( m_Players.Contains( mob ) )
|
||||
{
|
||||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "You have already named them as a team member.", from.NetState );
|
||||
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 ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "They have already entered this tournament.", from.NetState );
|
||||
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 ) );
|
||||
|
||||
if ( m_Registrar != null )
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "Your team is full.", from.NetState );
|
||||
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x22, false, "Your team is full.", from.NetState );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3094,9 +3054,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( m_Tournament.TournyType != TournyType.Standard && part.Players.Count == 1 )
|
||||
{
|
||||
PlayerMobile pm = part.Players[0] as PlayerMobile;
|
||||
|
||||
if ( pm != null && pm.DuelPlayer != null )
|
||||
if ( part.Players[0] is PlayerMobile pm && pm.DuelPlayer != null )
|
||||
name = Color( name, pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666 );
|
||||
}
|
||||
|
||||
|
|
@ -3107,9 +3065,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
case TournyBracketGumpType.Participant_Info:
|
||||
{
|
||||
TournyParticipant part = obj as TournyParticipant;
|
||||
|
||||
if ( part == null )
|
||||
if ( !(obj is TournyParticipant part) )
|
||||
break;
|
||||
|
||||
AddPage( 0 );
|
||||
|
|
@ -3130,9 +3086,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( m_Tournament.TournyType != TournyType.Standard )
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if ( pm != null && pm.DuelPlayer != null )
|
||||
if ( mob is PlayerMobile pm && pm.DuelPlayer != null )
|
||||
name = Color( name, pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666 );
|
||||
}
|
||||
|
||||
|
|
@ -3171,13 +3125,11 @@ namespace Server.Engines.ConPVP
|
|||
AddLeftArrow( 25, 11, ToButtonID( 0, 3 ) );
|
||||
AddHtml( 25, 35, 250, 20, Center( "Participants" ), false, false );
|
||||
|
||||
Mobile mob = obj as Mobile;
|
||||
|
||||
if ( mob == null )
|
||||
if ( !(obj is Mobile mob) )
|
||||
break;
|
||||
|
||||
Ladder ladder = Ladder.Instance;
|
||||
LadderEntry entry = ( ladder == null ? null : ladder.Find( mob ) );
|
||||
LadderEntry entry = ladder?.Find( mob );
|
||||
|
||||
AddHtml( 25, 53, 250, 20, String.Format( "Name: {0}", mob.Name ), false, false );
|
||||
AddHtml( 25, 73, 250, 20, String.Format( "Guild: {0}", mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]" ), false, false );
|
||||
|
|
@ -3204,7 +3156,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for ( int i = 0; i < count; ++i, y += 18 )
|
||||
{
|
||||
PyramidLevel level = (PyramidLevel)m_List[index + i];
|
||||
// PyramidLevel level = (PyramidLevel)m_List[index + i];
|
||||
|
||||
AddRightArrow( 25, y, ToButtonID( 3, index + i ), "Round #" + (index + i + 1) );
|
||||
}
|
||||
|
|
@ -3219,9 +3171,7 @@ namespace Server.Engines.ConPVP
|
|||
AddLeftArrow( 25, 11, ToButtonID( 0, 2 ) );
|
||||
AddHtml( 25, 35, 250, 20, Center( "Rounds" ), false, false );
|
||||
|
||||
PyramidLevel level = m_Object as PyramidLevel;
|
||||
|
||||
if ( level == null )
|
||||
if ( !(m_Object is PyramidLevel level) )
|
||||
break;
|
||||
|
||||
if ( m_List == null )
|
||||
|
|
@ -3343,9 +3293,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
case TournyBracketGumpType.Match_Info:
|
||||
{
|
||||
TournyMatch match = obj as TournyMatch;
|
||||
|
||||
if ( match == null )
|
||||
if ( !(obj is TournyMatch match) )
|
||||
break;
|
||||
|
||||
int ct = ( m_Tournament.TournyType == TournyType.FreeForAll ? 2 : match.Participants.Count );
|
||||
|
|
@ -3358,7 +3306,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
AddHtml( 25, 53, 250, 20, String.Format( "Winner: {0}", match.Winner == null ? "N/A" : match.Winner.NameList ), false, false );
|
||||
AddHtml( 25, 73, 250, 20, String.Format( "State: {0}", match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting" ), false, false );
|
||||
AddHtml( 25, 93, 250, 20, String.Format( "Participants:" ), false, false );
|
||||
AddHtml( 25, 93, 250, 20, "Participants:", false, false );
|
||||
|
||||
if ( m_Tournament.TournyType == TournyType.Standard )
|
||||
{
|
||||
|
|
@ -3465,9 +3413,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
case 5:
|
||||
{
|
||||
TournyMatch match = m_Object as TournyMatch;
|
||||
|
||||
if ( match == null )
|
||||
if ( !(m_Object is TournyMatch match) )
|
||||
break;
|
||||
|
||||
for ( int i = 0; i < m_Tournament.Pyramid.Levels.Count; ++i )
|
||||
|
|
@ -3531,9 +3477,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Type != TournyBracketGumpType.Participant_Info )
|
||||
break;
|
||||
|
||||
TournyParticipant part = m_Object as TournyParticipant;
|
||||
|
||||
if ( part != null && index >= 0 && index < part.Players.Count )
|
||||
if ( m_Object is TournyParticipant part && index >= 0 && index < part.Players.Count )
|
||||
m_From.SendGump( new TournamentBracketGump( m_From, m_Tournament, TournyBracketGumpType.Player_Info, null, 0, part.Players[index] ) );
|
||||
|
||||
break;
|
||||
|
|
@ -3543,9 +3487,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Type != TournyBracketGumpType.Round_Info )
|
||||
break;
|
||||
|
||||
PyramidLevel level = m_Object as PyramidLevel;
|
||||
|
||||
if ( level == null )
|
||||
if ( !(m_Object is PyramidLevel level) )
|
||||
break;
|
||||
|
||||
if ( index == 0 )
|
||||
|
|
@ -3567,9 +3509,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Type != TournyBracketGumpType.Match_Info )
|
||||
break;
|
||||
|
||||
TournyMatch match = m_Object as TournyMatch;
|
||||
|
||||
if ( match != null && index >= 0 && index < match.Participants.Count )
|
||||
if ( m_Object is TournyMatch match && index >= 0 && index < match.Participants.Count )
|
||||
m_From.SendGump( new TournamentBracketGump( m_From, m_Tournament, TournyBracketGumpType.Participant_Info, null, 0, match.Participants[index] ) );
|
||||
|
||||
break;
|
||||
|
|
@ -3602,9 +3542,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
|
||||
}
|
||||
else if ( m_Tournament != null )
|
||||
else
|
||||
{
|
||||
Tournament tourny = m_Tournament.Tournament;
|
||||
Tournament tourny = m_Tournament?.Tournament;
|
||||
|
||||
if ( tourny != null )
|
||||
{
|
||||
|
|
@ -3648,4 +3588,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue