More cast conversion fixes

This commit is contained in:
Kamron Batman 2018-09-06 18:07:42 -07:00
parent 3f45bd57b9
commit aba9452161
46 changed files with 359 additions and 506 deletions

View file

@ -123,9 +123,9 @@ namespace Server.Items
{
m.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
}
else if ( m_TargetMap == Map.Felucca && m is PlayerMobile && ((PlayerMobile)m).Young )
else if ( m_TargetMap == Map.Felucca && m is PlayerMobile mobile && mobile.Young )
{
m.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young.
mobile.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young.
}
else if ( (m.Kills >= 5 && m_TargetMap != Map.Felucca) || ( m_TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0 ) || ( m_TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0 ) || ( m_TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0 ) )
{
@ -160,7 +160,7 @@ namespace Server.Items
writer.Write( m_Target );
writer.Write( m_TargetMap );
// Version 1
writer.Write( m_bDispellable );
}
@ -461,4 +461,4 @@ namespace Server.Items
m_Gate.EndConfirmation( m_From );
}
}
}
}

View file

@ -217,82 +217,75 @@ namespace Server.Items
public override bool OnDragDrop( Mobile from, Item item )
{
if ( item is BasePotion )
{
BasePotion pot = (BasePotion)item;
int toHold = Math.Min( 100 - m_Held, pot.Amount );
if ( toHold <= 0 )
{
from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
return false;
}
else if ( m_Held == 0 )
{
#region Mondain's Legacy
if ( (int) pot.PotionEffect >= (int) PotionEffect.Invisibility )
{
from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
return false;
}
#endregion
if ( GiveBottle( from, toHold ) )
{
m_Type = pot.PotionEffect;
Held = toHold;
from.PlaySound( 0x240 );
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
item.Consume( toHold );
if ( !item.Deleted )
item.Bounce( from );
return true;
}
else
{
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
return false;
}
}
else if ( pot.PotionEffect != m_Type )
{
from.SendLocalizedMessage( 502236 ); // You decide that it would be a bad idea to mix different types of potions.
return false;
}
else
{
if ( GiveBottle( from, toHold ) )
{
Held += toHold;
from.PlaySound( 0x240 );
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
item.Consume( toHold );
if ( !item.Deleted )
item.Bounce( from );
return true;
}
else
{
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
return false;
}
}
}
else
if (!(item is BasePotion pot))
{
from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
return false;
}
int toHold = Math.Min( 100 - m_Held, pot.Amount );
if ( toHold <= 0 )
{
from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
return false;
}
if ( m_Held == 0 )
{
#region Mondain's Legacy
if ( (int) pot.PotionEffect >= (int) PotionEffect.Invisibility )
{
from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
return false;
}
#endregion
if ( GiveBottle( from, toHold ) )
{
m_Type = pot.PotionEffect;
Held = toHold;
from.PlaySound( 0x240 );
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
pot.Consume( toHold );
if ( !pot.Deleted )
pot.Bounce( from );
return true;
}
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
return false;
}
if ( pot.PotionEffect != m_Type )
{
from.SendLocalizedMessage( 502236 ); // You decide that it would be a bad idea to mix different types of potions.
return false;
}
if ( GiveBottle( from, toHold ) )
{
Held += toHold;
from.PlaySound( 0x240 );
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
pot.Consume( toHold );
if ( !pot.Deleted )
pot.Bounce( from );
return true;
}
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
return false;
}
public bool GiveBottle( Mobile m, int amount )