Fixes casting checks

This commit is contained in:
Kamron Batman 2018-08-19 01:38:55 +08:00
parent 7ea00fbf4f
commit 03dd5f1926
431 changed files with 5616 additions and 6250 deletions

View file

@ -9,8 +9,8 @@ namespace Server
{
public class HonorVirtue
{
private static readonly TimeSpan UseDelay = TimeSpan.FromMinutes( 5.0 );
private static readonly TimeSpan UseDelay = TimeSpan.FromMinutes( 5.0 );
public static void Initialize()
{
@ -88,9 +88,9 @@ namespace Server
pm.SendLocalizedMessage( 1063240, remainingMinutes.ToString() ); // You must wait ~1_HONOR_WAIT~ minutes before embracing honor again
return;
}
pm.SendGump( new HonorSelf( pm ) );
}
public static void ActivateEmbrace( PlayerMobile pm )
@ -111,7 +111,7 @@ namespace Server
pm.SendLocalizedMessage( 1063235 ); // You embrace your honor
Timer.DelayCall( TimeSpan.FromSeconds( duration ),
delegate() {
delegate {
pm.HonorActive = false;
pm.LastHonorUse = DateTime.UtcNow;
pm.SendLocalizedMessage( 1063236 ); // You no longer embrace your honor
@ -149,8 +149,8 @@ namespace Server
if ( target.Body.IsHuman && (cret == null || (!cret.AlwaysAttackable && !cret.AlwaysMurderer)) )
{
if( reg == null || reg.IsDisabled() )
{
if ( reg == null || reg.IsDisabled() )
{
//Allow honor on blue if Out of guardzone
}
else if ( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 )
@ -164,7 +164,7 @@ namespace Server
}
}
if( Core.ML && target is PlayerMobile )
if ( Core.ML && target is PlayerMobile )
{
source.SendLocalizedMessage( 1075614 ); // You cannot honor other players.
return;
@ -234,7 +234,7 @@ namespace Server
source.m_hontime = (DateTime.UtcNow + TimeSpan.FromMinutes( 40 ));
Timer.DelayCall( TimeSpan.FromMinutes( 40 ),
delegate() {
delegate {
if (source.m_hontime < DateTime.UtcNow && source.SentHonorContext != null)
{
Cancel();
@ -430,4 +430,4 @@ namespace Server
}
}
}
}
}

View file

@ -27,7 +27,7 @@ namespace Server
else
Resurrect( from );
}
else
else
from.SendLocalizedMessage( 1052015 ); // You cannot do that while hidden.
}
@ -132,9 +132,9 @@ namespace Server
{
int toGain;
if( from.Fame < 5000 )
if ( from.Fame < 5000 )
toGain = 500;
else if( from.Fame < 10000 )
else if ( from.Fame < 10000 )
toGain = 1000;
else
toGain = 2000;
@ -191,4 +191,4 @@ namespace Server
}
}
}
}
}

View file

@ -21,7 +21,7 @@ namespace Server
public static void OnVirtueUsed( Mobile from )
{
if( from.Alive )
if ( from.Alive )
{
from.SendLocalizedMessage( 1054034 ); // Target the Champion Idol of the Champion you wish to challenge!.
from.Target = new InternalTarget();
@ -32,14 +32,14 @@ namespace Server
{
PlayerMobile pm = from as PlayerMobile;
if( pm == null )
if ( pm == null )
return;
try
{
if( (pm.LastValorLoss + LossDelay) < DateTime.UtcNow )
if ( (pm.LastValorLoss + LossDelay) < DateTime.UtcNow )
{
if( VirtueHelper.Atrophy( from, VirtueName.Valor, LossAmount ) )
if ( VirtueHelper.Atrophy( from, VirtueName.Valor, LossAmount ) )
from.SendLocalizedMessage( 1054040 ); // You have lost some Valor.
pm.LastValorLoss = DateTime.UtcNow;
@ -54,18 +54,18 @@ namespace Server
{
IdolOfTheChampion idol = targ as IdolOfTheChampion;
if( idol == null || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted )
if ( idol == null || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted )
from.SendLocalizedMessage( 1054035 ); // You must target a Champion Idol to challenge the Champion's spawn!
else if( from.Hidden )
else if ( from.Hidden )
from.SendLocalizedMessage( 1052015 ); // You cannot do that while hidden.
else if( idol.Spawn.HasBeenAdvanced )
else if ( idol.Spawn.HasBeenAdvanced )
from.SendLocalizedMessage( 1054038 ); // The Champion of this region has already been challenged!
else
{
VirtueLevel vl = VirtueHelper.GetLevel( from, VirtueName.Valor );
if( idol.Spawn.Active )
if ( idol.Spawn.Active )
{
if( idol.Spawn.Champion != null ) //TODO: Message?
if ( idol.Spawn.Champion != null ) //TODO: Message?
return;
int needed, consumed;
@ -95,7 +95,7 @@ namespace Server
}
}
if( from.Virtues.GetValue( (int)VirtueName.Valor ) >= needed )
if ( from.Virtues.GetValue( (int)VirtueName.Valor ) >= needed )
{
VirtueHelper.Atrophy( from, VirtueName.Valor, consumed );
from.SendLocalizedMessage( 1054037 ); // Your challenge is heard by the Champion of this region! Beware its wrath!
@ -107,7 +107,7 @@ namespace Server
}
else
{
if( vl == VirtueLevel.Knight )
if ( vl == VirtueLevel.Knight )
{
VirtueHelper.Atrophy( from, VirtueName.Valor, 11000 );
from.SendLocalizedMessage( 1054037 ); // Your challenge is heard by the Champion of this region! Beware its wrath!
@ -135,4 +135,4 @@ namespace Server
}
}
}
}
}

View file

@ -133,19 +133,19 @@ namespace Server
if ( value < 4000 )
return 2402;
if( value >= 30000 )
if ( value >= 30000 )
value = 20000; //Sanity
int vl;
if( value < 10000 )
if ( value < 10000 )
vl = 0;
else if( value >= 20000 && index == 5)
else if ( value >= 20000 && index == 5)
vl = 2;
else if( value >= 21000 && index != 1)
else if ( value >= 21000 && index != 1)
vl = 2;
else if( value >= 22000 && index == 1)
else if ( value >= 22000 && index == 1)
vl = 2;
else
vl = 1;

View file

@ -53,10 +53,10 @@ namespace Server
public static int GetMaxAmount( VirtueName virtue )
{
if( virtue == VirtueName.Honor )
if ( virtue == VirtueName.Honor )
return 20000;
if( virtue == VirtueName.Sacrifice )
if ( virtue == VirtueName.Sacrifice )
return 22000;
return 21000;
@ -71,7 +71,7 @@ namespace Server
if ( current >= maxAmount )
return false;
if( (current + amount) >= maxAmount )
if ( (current + amount) >= maxAmount )
amount = maxAmount - current;
VirtueLevel oldLevel = GetLevel( from, virtue );
@ -92,7 +92,7 @@ namespace Server
{
int current = from.Virtues.GetValue( (int)virtue );
if( (current - amount) >= 0 )
if ( (current - amount) >= 0 )
from.Virtues.SetValue( (int)virtue, current - amount );
else
from.Virtues.SetValue( (int)virtue, 0 );

View file

@ -41,11 +41,11 @@ namespace Server
int valueDesc;
int dots;
if( value < 4000 )
if ( value < 4000 )
dots = value / 400;
else if( value < 10000 )
else if ( value < 10000 )
dots = (value - 4000) / 600;
else if( value < maxValue )
else if ( value < maxValue )
dots = (value - 10000) / ((maxValue-10000)/10);
else
dots = 10;
@ -54,21 +54,21 @@ namespace Server
AddImage( 95 + (i * 17), 50, i < dots ? 2362 : 2360 );
if( value < 1 )
if ( value < 1 )
valueDesc = 1052044; // You have not started on the path of this Virtue.
else if( value < 400 )
else if ( value < 400 )
valueDesc = 1052045; // You have barely begun your journey through the path of this Virtue.
else if( value < 2000 )
else if ( value < 2000 )
valueDesc = 1052046; // You have progressed in this Virtue, but still have much to do.
else if( value < 3600 )
else if ( value < 3600 )
valueDesc = 1052047; // Your journey through the path of this Virtue is going well.
else if( value < 4000 )
else if ( value < 4000 )
valueDesc = 1052048; // You feel very close to achieving your next path in this Virtue.
else if( dots < 1 )
else if ( dots < 1 )
valueDesc = 1052049; // You have achieved a path in this Virtue.
else if( dots < 9 )
else if ( dots < 9 )
valueDesc = 1052047; // Your journey through the path of this Virtue is going well.
else if( dots < 10 )
else if ( dots < 10 )
valueDesc = 1052048; // You feel very close to achieving your next path in this Virtue.
else
valueDesc = 1052050; // You have achieved the highest path in this Virtue.
@ -95,7 +95,7 @@ namespace Server
{
m_Beholder.SendGump( new VirtueInfoGump( m_Beholder, m_Virtue, m_Desc, m_Page ) );
if( m_Page != null )
if ( m_Page != null )
state.Send( new LaunchBrowser( m_Page ) ); //No message about web browser starting on OSI
break;
}
@ -107,4 +107,4 @@ namespace Server
}
}
}
}
}