Changes properties to use automatic property initializers
This commit is contained in:
parent
f0a48ad431
commit
06fa31a7bf
623 changed files with 13072 additions and 19304 deletions
|
|
@ -145,16 +145,14 @@ namespace Server.Items
|
|||
{
|
||||
private class TilesAndEffect
|
||||
{
|
||||
private int[] m_Tiles;
|
||||
private Type m_Effect;
|
||||
public int[] Tiles { get; }
|
||||
|
||||
public int[] Tiles => m_Tiles;
|
||||
public Type Effect => m_Effect;
|
||||
public Type Effect { get; }
|
||||
|
||||
public TilesAndEffect( int[] tiles, Type effect )
|
||||
{
|
||||
m_Tiles = tiles;
|
||||
m_Effect = effect;
|
||||
Tiles = tiles;
|
||||
Effect = effect;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -285,19 +283,17 @@ namespace Server.Items
|
|||
return null;
|
||||
}
|
||||
|
||||
private Point3D m_Location;
|
||||
private Map m_Map;
|
||||
private Mobile m_From;
|
||||
public Point3D Location { get; }
|
||||
|
||||
public Point3D Location => m_Location;
|
||||
public Map Map => m_Map;
|
||||
public Mobile From => m_From;
|
||||
public Map Map { get; }
|
||||
|
||||
public Mobile From { get; }
|
||||
|
||||
public GreenThornsEffect( Point3D location, Map map, Mobile from ) : base( TimeSpan.FromSeconds( 2.5 ) )
|
||||
{
|
||||
m_Location = location;
|
||||
m_Map = map;
|
||||
m_From = from;
|
||||
Location = location;
|
||||
Map = map;
|
||||
From = from;
|
||||
|
||||
Priority = TimerPriority.TwoFiftyMS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,13 +117,11 @@ namespace Server.Items
|
|||
|
||||
private class OrangePetalsContext
|
||||
{
|
||||
private Timer m_Timer;
|
||||
|
||||
public Timer Timer => m_Timer;
|
||||
public Timer Timer { get; }
|
||||
|
||||
public OrangePetalsContext( Timer timer )
|
||||
{
|
||||
m_Timer = timer;
|
||||
Timer = timer;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,15 +141,13 @@ namespace Server.Engines.Plants
|
|||
return notBrightFirst & notBrightSecond;
|
||||
}
|
||||
|
||||
private int m_Hue;
|
||||
private int m_Name;
|
||||
private PlantHue m_PlantHue;
|
||||
private int m_GumpHue;
|
||||
public int Hue { get; }
|
||||
|
||||
public int Hue => m_Hue;
|
||||
public int Name => m_Name;
|
||||
public PlantHue PlantHue => m_PlantHue;
|
||||
public int GumpHue => m_GumpHue;
|
||||
public int Name { get; }
|
||||
|
||||
public PlantHue PlantHue { get; }
|
||||
|
||||
public int GumpHue { get; }
|
||||
|
||||
private PlantHueInfo( int hue, int name, PlantHue plantHue ) : this( hue, name, plantHue, hue )
|
||||
{
|
||||
|
|
@ -157,30 +155,30 @@ namespace Server.Engines.Plants
|
|||
|
||||
private PlantHueInfo( int hue, int name, PlantHue plantHue, int gumpHue )
|
||||
{
|
||||
m_Hue = hue;
|
||||
m_Name = name;
|
||||
m_PlantHue = plantHue;
|
||||
m_GumpHue = gumpHue;
|
||||
Hue = hue;
|
||||
Name = name;
|
||||
PlantHue = plantHue;
|
||||
GumpHue = gumpHue;
|
||||
}
|
||||
|
||||
public bool IsCrossable()
|
||||
{
|
||||
return IsCrossable( m_PlantHue );
|
||||
return IsCrossable( PlantHue );
|
||||
}
|
||||
|
||||
public bool IsBright()
|
||||
{
|
||||
return IsBright( m_PlantHue );
|
||||
return IsBright( PlantHue );
|
||||
}
|
||||
|
||||
public PlantHue GetNotBright()
|
||||
{
|
||||
return GetNotBright( m_PlantHue );
|
||||
return GetNotBright( PlantHue );
|
||||
}
|
||||
|
||||
public bool IsPrimary()
|
||||
{
|
||||
return IsPrimary( m_PlantHue );
|
||||
return IsPrimary( PlantHue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,23 +38,15 @@ namespace Server.Engines.Plants
|
|||
*/
|
||||
private static readonly bool ShowContainerType = true;
|
||||
|
||||
private PlantSystem m_PlantSystem;
|
||||
|
||||
private PlantStatus m_PlantStatus;
|
||||
private PlantType m_PlantType;
|
||||
private PlantHue m_PlantHue;
|
||||
private bool m_ShowType;
|
||||
|
||||
private SecureLevel m_Level;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get => m_Level;
|
||||
set => m_Level = value;
|
||||
}
|
||||
public SecureLevel Level { get; set; }
|
||||
|
||||
public PlantSystem PlantSystem => m_PlantSystem;
|
||||
public PlantSystem PlantSystem { get; private set; }
|
||||
|
||||
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
||||
|
||||
|
|
@ -80,8 +72,8 @@ namespace Server.Engines.Plants
|
|||
return;
|
||||
|
||||
double ratio;
|
||||
if ( m_PlantSystem != null )
|
||||
ratio = (double) m_PlantSystem.Hits / m_PlantSystem.MaxHits;
|
||||
if ( PlantSystem != null )
|
||||
ratio = (double) PlantSystem.Hits / PlantSystem.MaxHits;
|
||||
else
|
||||
ratio = 1.0;
|
||||
|
||||
|
|
@ -89,19 +81,19 @@ namespace Server.Engines.Plants
|
|||
|
||||
if ( m_PlantStatus >= PlantStatus.DecorativePlant )
|
||||
{
|
||||
m_PlantSystem = null;
|
||||
PlantSystem = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_PlantSystem == null )
|
||||
m_PlantSystem = new PlantSystem( this, false );
|
||||
if ( PlantSystem == null )
|
||||
PlantSystem = new PlantSystem( this, false );
|
||||
|
||||
int hits = (int)( m_PlantSystem.MaxHits * ratio );
|
||||
int hits = (int)( PlantSystem.MaxHits * ratio );
|
||||
|
||||
if ( hits == 0 && m_PlantStatus > PlantStatus.BowlOfDirt )
|
||||
m_PlantSystem.Hits = hits + 1;
|
||||
PlantSystem.Hits = hits + 1;
|
||||
else
|
||||
m_PlantSystem.Hits = hits;
|
||||
PlantSystem.Hits = hits;
|
||||
}
|
||||
|
||||
Update();
|
||||
|
|
@ -173,9 +165,7 @@ namespace Server.Engines.Plants
|
|||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Reproduces => PlantHueInfo.CanReproduce( PlantHue ) && PlantTypeInfo.CanReproduce( PlantType );
|
||||
|
||||
private static ArrayList m_Instances = new ArrayList();
|
||||
|
||||
public static ArrayList Plants => m_Instances;
|
||||
public static ArrayList Plants { get; } = new ArrayList();
|
||||
|
||||
[Constructible]
|
||||
public PlantItem() : this( false )
|
||||
|
|
@ -188,10 +178,10 @@ namespace Server.Engines.Plants
|
|||
Weight = 1.0;
|
||||
|
||||
m_PlantStatus = PlantStatus.BowlOfDirt;
|
||||
m_PlantSystem = new PlantSystem( this, fertileDirt );
|
||||
m_Level = SecureLevel.Owner;
|
||||
PlantSystem = new PlantSystem( this, fertileDirt );
|
||||
Level = SecureLevel.Owner;
|
||||
|
||||
m_Instances.Add( this );
|
||||
Plants.Add( this );
|
||||
}
|
||||
|
||||
public PlantItem( Serial serial ) : base( serial )
|
||||
|
|
@ -257,9 +247,9 @@ namespace Server.Engines.Plants
|
|||
string args;
|
||||
|
||||
if ( ShowContainerType )
|
||||
args = $"#{GetLocalizedContainerType()}\t#{m_PlantSystem.GetLocalizedDirtStatus()}";
|
||||
args = $"#{GetLocalizedContainerType()}\t#{PlantSystem.GetLocalizedDirtStatus()}";
|
||||
else
|
||||
args = $"#{m_PlantSystem.GetLocalizedDirtStatus()}";
|
||||
args = $"#{PlantSystem.GetLocalizedDirtStatus()}";
|
||||
|
||||
list.Add( 1060830, args ); // a ~1_val~ of ~2_val~ dirt
|
||||
}
|
||||
|
|
@ -275,7 +265,7 @@ namespace Server.Engines.Plants
|
|||
else if ( m_PlantStatus >= PlantStatus.FullGrownPlant )
|
||||
{
|
||||
list.Add( typeInfo.GetPlantLabelFullGrown( hueInfo ),
|
||||
$"#{m_PlantSystem.GetLocalizedHealth()}\t#{hueInfo.Name}\t#{typeInfo.Name}");
|
||||
$"#{PlantSystem.GetLocalizedHealth()}\t#{hueInfo.Name}\t#{typeInfo.Name}");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -283,9 +273,9 @@ namespace Server.Engines.Plants
|
|||
|
||||
if ( ShowContainerType )
|
||||
args =
|
||||
$"#{GetLocalizedContainerType()}\t#{m_PlantSystem.GetLocalizedDirtStatus()}\t#{m_PlantSystem.GetLocalizedHealth()}";
|
||||
$"#{GetLocalizedContainerType()}\t#{PlantSystem.GetLocalizedDirtStatus()}\t#{PlantSystem.GetLocalizedHealth()}";
|
||||
else
|
||||
args = $"#{m_PlantSystem.GetLocalizedDirtStatus()}\t#{m_PlantSystem.GetLocalizedHealth()}";
|
||||
args = $"#{PlantSystem.GetLocalizedDirtStatus()}\t#{PlantSystem.GetLocalizedHealth()}";
|
||||
|
||||
if ( m_ShowType )
|
||||
{
|
||||
|
|
@ -348,7 +338,7 @@ namespace Server.Engines.Plants
|
|||
{
|
||||
from.SendLocalizedMessage( 1080389, "#" + GetLocalizedPlantStatus().ToString() ); // This bowl of dirt already has a ~1_val~ in it!
|
||||
}
|
||||
else if ( m_PlantSystem.Water < 2 )
|
||||
else if ( PlantSystem.Water < 2 )
|
||||
{
|
||||
LabelTo( from, 1061920 ); // The dirt needs to be softened first.
|
||||
}
|
||||
|
|
@ -362,7 +352,7 @@ namespace Server.Engines.Plants
|
|||
|
||||
PlantStatus = PlantStatus.Seed;
|
||||
|
||||
m_PlantSystem.Reset( false );
|
||||
PlantSystem.Reset( false );
|
||||
|
||||
LabelTo( from, 1061922 ); // You plant the seed in the bowl of dirt.
|
||||
}
|
||||
|
|
@ -377,7 +367,7 @@ namespace Server.Engines.Plants
|
|||
else
|
||||
{
|
||||
PlantStatus = PlantStatus.BowlOfDirt;
|
||||
m_PlantSystem.Reset( true );
|
||||
PlantSystem.Reset( true );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -410,7 +400,7 @@ namespace Server.Engines.Plants
|
|||
return;
|
||||
|
||||
beverage.Quantity--;
|
||||
m_PlantSystem.Water++;
|
||||
PlantSystem.Water++;
|
||||
|
||||
from.PlaySound( 0x4E );
|
||||
LabelTo( from, 1061858 ); // You soften the dirt with water.
|
||||
|
|
@ -464,31 +454,31 @@ namespace Server.Engines.Plants
|
|||
|
||||
if ( effect == PotionEffect.PoisonGreater || effect == PotionEffect.PoisonDeadly )
|
||||
{
|
||||
if ( m_PlantSystem.IsFullPoisonPotion )
|
||||
if ( PlantSystem.IsFullPoisonPotion )
|
||||
full = true;
|
||||
else if ( !testOnly )
|
||||
m_PlantSystem.PoisonPotion++;
|
||||
PlantSystem.PoisonPotion++;
|
||||
}
|
||||
else if ( effect == PotionEffect.CureGreater )
|
||||
{
|
||||
if ( m_PlantSystem.IsFullCurePotion )
|
||||
if ( PlantSystem.IsFullCurePotion )
|
||||
full = true;
|
||||
else if ( !testOnly )
|
||||
m_PlantSystem.CurePotion++;
|
||||
PlantSystem.CurePotion++;
|
||||
}
|
||||
else if ( effect == PotionEffect.HealGreater )
|
||||
{
|
||||
if ( m_PlantSystem.IsFullHealPotion )
|
||||
if ( PlantSystem.IsFullHealPotion )
|
||||
full = true;
|
||||
else if ( !testOnly )
|
||||
m_PlantSystem.HealPotion++;
|
||||
PlantSystem.HealPotion++;
|
||||
}
|
||||
else if ( effect == PotionEffect.StrengthGreater )
|
||||
{
|
||||
if ( m_PlantSystem.IsFullStrengthPotion )
|
||||
if ( PlantSystem.IsFullStrengthPotion )
|
||||
full = true;
|
||||
else if ( !testOnly )
|
||||
m_PlantSystem.StrengthPotion++;
|
||||
PlantSystem.StrengthPotion++;
|
||||
}
|
||||
else if ( effect == PotionEffect.PoisonLesser || effect == PotionEffect.Poison || effect == PotionEffect.CureLesser || effect == PotionEffect.Cure ||
|
||||
effect == PotionEffect.HealLesser || effect == PotionEffect.Heal || effect == PotionEffect.Strength )
|
||||
|
|
@ -518,7 +508,7 @@ namespace Server.Engines.Plants
|
|||
|
||||
writer.Write( (int) 2 ); // version
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
writer.Write( (int) Level );
|
||||
|
||||
writer.Write( (int) m_PlantStatus );
|
||||
writer.Write( (int) m_PlantType );
|
||||
|
|
@ -526,7 +516,7 @@ namespace Server.Engines.Plants
|
|||
writer.Write( (bool) m_ShowType );
|
||||
|
||||
if ( m_PlantStatus < PlantStatus.DecorativePlant )
|
||||
m_PlantSystem.Save( writer );
|
||||
PlantSystem.Save( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -540,13 +530,13 @@ namespace Server.Engines.Plants
|
|||
case 2:
|
||||
case 1:
|
||||
{
|
||||
m_Level = (SecureLevel)reader.ReadInt();
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
if ( version < 1 )
|
||||
m_Level = SecureLevel.CoOwners;
|
||||
Level = SecureLevel.CoOwners;
|
||||
|
||||
m_PlantStatus = (PlantStatus)reader.ReadInt();
|
||||
m_PlantType = (PlantType)reader.ReadInt();
|
||||
|
|
@ -554,7 +544,7 @@ namespace Server.Engines.Plants
|
|||
m_ShowType = reader.ReadBool();
|
||||
|
||||
if ( m_PlantStatus < PlantStatus.DecorativePlant )
|
||||
m_PlantSystem = new PlantSystem( this, reader );
|
||||
PlantSystem = new PlantSystem( this, reader );
|
||||
|
||||
if ( version < 2 && PlantHueInfo.IsCrossable( m_PlantHue ) )
|
||||
m_PlantHue |= PlantHue.Reproduces;
|
||||
|
|
@ -563,14 +553,14 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
m_Instances.Add( this );
|
||||
Plants.Add( this );
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
m_Instances.Remove( this );
|
||||
Plants.Remove( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,24 +28,22 @@ namespace Server.Engines.Plants
|
|||
return null;
|
||||
}
|
||||
|
||||
private PlantType m_PlantType;
|
||||
private PlantHue m_PlantHue;
|
||||
private Type m_ResourceType;
|
||||
public PlantType PlantType { get; }
|
||||
|
||||
public PlantType PlantType => m_PlantType;
|
||||
public PlantHue PlantHue => m_PlantHue;
|
||||
public Type ResourceType => m_ResourceType;
|
||||
public PlantHue PlantHue { get; }
|
||||
|
||||
public Type ResourceType { get; }
|
||||
|
||||
private PlantResourceInfo( PlantType plantType, PlantHue plantHue, Type resourceType )
|
||||
{
|
||||
m_PlantType = plantType;
|
||||
m_PlantHue = plantHue;
|
||||
m_ResourceType = resourceType;
|
||||
PlantType = plantType;
|
||||
PlantHue = plantHue;
|
||||
ResourceType = resourceType;
|
||||
}
|
||||
|
||||
public Item CreateResource()
|
||||
{
|
||||
return (Item)Activator.CreateInstance( m_ResourceType );
|
||||
return (Item)Activator.CreateInstance( ResourceType );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,12 +27,6 @@ namespace Server.Engines.Plants
|
|||
{
|
||||
public static readonly TimeSpan CheckDelay = TimeSpan.FromHours( 23.0 );
|
||||
|
||||
private PlantItem m_Plant;
|
||||
private bool m_FertileDirt;
|
||||
|
||||
private DateTime m_NextGrowth;
|
||||
private PlantGrowthIndicator m_GrowthIndicator;
|
||||
|
||||
private int m_Water;
|
||||
|
||||
private int m_Hits;
|
||||
|
|
@ -45,7 +39,6 @@ namespace Server.Engines.Plants
|
|||
private int m_HealPotion;
|
||||
private int m_StrengthPotion;
|
||||
|
||||
private bool m_Pollinated;
|
||||
private PlantType m_SeedType;
|
||||
private PlantHue m_SeedHue;
|
||||
private int m_AvailableSeeds;
|
||||
|
|
@ -54,17 +47,13 @@ namespace Server.Engines.Plants
|
|||
private int m_AvailableResources;
|
||||
private int m_LeftResources;
|
||||
|
||||
public PlantItem Plant => m_Plant;
|
||||
public PlantItem Plant { get; }
|
||||
|
||||
public bool FertileDirt
|
||||
{
|
||||
get => m_FertileDirt;
|
||||
set => m_FertileDirt = value;
|
||||
}
|
||||
public bool FertileDirt { get; set; }
|
||||
|
||||
public DateTime NextGrowth => m_NextGrowth;
|
||||
public DateTime NextGrowth { get; private set; }
|
||||
|
||||
public PlantGrowthIndicator GrowthIndicator => m_GrowthIndicator;
|
||||
public PlantGrowthIndicator GrowthIndicator { get; private set; }
|
||||
|
||||
public bool IsFullWater => m_Water >= 4;
|
||||
|
||||
|
|
@ -80,7 +69,7 @@ namespace Server.Engines.Plants
|
|||
else
|
||||
m_Water = value;
|
||||
|
||||
m_Plant.InvalidateProperties();
|
||||
Plant.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,13 +89,13 @@ namespace Server.Engines.Plants
|
|||
m_Hits = value;
|
||||
|
||||
if ( m_Hits == 0 )
|
||||
m_Plant.Die();
|
||||
Plant.Die();
|
||||
|
||||
m_Plant.InvalidateProperties();
|
||||
Plant.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public int MaxHits => 10 + (int)m_Plant.PlantStatus * 2;
|
||||
public int MaxHits => 10 + (int)Plant.PlantStatus * 2;
|
||||
|
||||
public PlantHealth Health
|
||||
{
|
||||
|
|
@ -246,21 +235,17 @@ namespace Server.Engines.Plants
|
|||
|
||||
public bool HasMaladies => Infestation > 0 || Fungus > 0 || Poison > 0 || Disease > 0 || Water != 2;
|
||||
|
||||
public bool PollenProducing => m_Plant.IsCrossable && m_Plant.PlantStatus >= PlantStatus.FullGrownPlant;
|
||||
public bool PollenProducing => Plant.IsCrossable && Plant.PlantStatus >= PlantStatus.FullGrownPlant;
|
||||
|
||||
public bool Pollinated
|
||||
{
|
||||
get => m_Pollinated;
|
||||
set => m_Pollinated = value;
|
||||
}
|
||||
public bool Pollinated { get; set; }
|
||||
|
||||
public PlantType SeedType
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Pollinated )
|
||||
if ( Pollinated )
|
||||
return m_SeedType;
|
||||
return m_Plant.PlantType;
|
||||
return Plant.PlantType;
|
||||
}
|
||||
set => m_SeedType = value;
|
||||
}
|
||||
|
|
@ -269,9 +254,9 @@ namespace Server.Engines.Plants
|
|||
{
|
||||
get
|
||||
{
|
||||
if ( m_Pollinated )
|
||||
if ( Pollinated )
|
||||
return m_SeedHue;
|
||||
return m_Plant.PlantHue;
|
||||
return Plant.PlantHue;
|
||||
}
|
||||
set => m_SeedHue = value;
|
||||
}
|
||||
|
|
@ -302,11 +287,11 @@ namespace Server.Engines.Plants
|
|||
|
||||
public PlantSystem( PlantItem plant, bool fertileDirt )
|
||||
{
|
||||
m_Plant = plant;
|
||||
m_FertileDirt = fertileDirt;
|
||||
Plant = plant;
|
||||
FertileDirt = fertileDirt;
|
||||
|
||||
m_NextGrowth = DateTime.UtcNow + CheckDelay;
|
||||
m_GrowthIndicator = PlantGrowthIndicator.None;
|
||||
NextGrowth = DateTime.UtcNow + CheckDelay;
|
||||
GrowthIndicator = PlantGrowthIndicator.None;
|
||||
m_Hits = MaxHits;
|
||||
m_LeftSeeds = 8;
|
||||
m_LeftResources = 8;
|
||||
|
|
@ -314,8 +299,8 @@ namespace Server.Engines.Plants
|
|||
|
||||
public void Reset( bool potions )
|
||||
{
|
||||
m_NextGrowth = DateTime.UtcNow + CheckDelay;
|
||||
m_GrowthIndicator = PlantGrowthIndicator.None;
|
||||
NextGrowth = DateTime.UtcNow + CheckDelay;
|
||||
GrowthIndicator = PlantGrowthIndicator.None;
|
||||
|
||||
Hits = MaxHits;
|
||||
m_Infestation = 0;
|
||||
|
|
@ -331,7 +316,7 @@ namespace Server.Engines.Plants
|
|||
m_StrengthPotion = 0;
|
||||
}
|
||||
|
||||
m_Pollinated = false;
|
||||
Pollinated = false;
|
||||
m_AvailableSeeds = 0;
|
||||
m_LeftSeeds = 8;
|
||||
|
||||
|
|
@ -426,24 +411,24 @@ namespace Server.Engines.Plants
|
|||
|
||||
public void DoGrowthCheck()
|
||||
{
|
||||
if ( !m_Plant.IsGrowable )
|
||||
if ( !Plant.IsGrowable )
|
||||
return;
|
||||
|
||||
if ( DateTime.UtcNow < m_NextGrowth )
|
||||
if ( DateTime.UtcNow < NextGrowth )
|
||||
{
|
||||
m_GrowthIndicator = PlantGrowthIndicator.Delay;
|
||||
GrowthIndicator = PlantGrowthIndicator.Delay;
|
||||
return;
|
||||
}
|
||||
|
||||
m_NextGrowth = DateTime.UtcNow + CheckDelay;
|
||||
NextGrowth = DateTime.UtcNow + CheckDelay;
|
||||
|
||||
if ( !m_Plant.ValidGrowthLocation )
|
||||
if ( !Plant.ValidGrowthLocation )
|
||||
{
|
||||
m_GrowthIndicator = PlantGrowthIndicator.InvalidLocation;
|
||||
GrowthIndicator = PlantGrowthIndicator.InvalidLocation;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_Plant.PlantStatus == PlantStatus.BowlOfDirt)
|
||||
if ( Plant.PlantStatus == PlantStatus.BowlOfDirt)
|
||||
{
|
||||
if ( Water > 2 || Utility.RandomDouble() < 0.9 )
|
||||
Water--;
|
||||
|
|
@ -540,51 +525,51 @@ namespace Server.Engines.Plants
|
|||
|
||||
Hits -= damage;
|
||||
|
||||
return m_Plant.IsGrowable && m_Plant.PlantStatus != PlantStatus.BowlOfDirt;
|
||||
return Plant.IsGrowable && Plant.PlantStatus != PlantStatus.BowlOfDirt;
|
||||
}
|
||||
|
||||
private void Grow()
|
||||
{
|
||||
if ( Health < PlantHealth.Healthy )
|
||||
{
|
||||
m_GrowthIndicator = PlantGrowthIndicator.NotHealthy;
|
||||
GrowthIndicator = PlantGrowthIndicator.NotHealthy;
|
||||
}
|
||||
else if ( m_FertileDirt && m_Plant.PlantStatus <= PlantStatus.Stage5 && Utility.RandomDouble() < 0.1 )
|
||||
else if ( FertileDirt && Plant.PlantStatus <= PlantStatus.Stage5 && Utility.RandomDouble() < 0.1 )
|
||||
{
|
||||
int curStage = (int)m_Plant.PlantStatus;
|
||||
m_Plant.PlantStatus = (PlantStatus)( curStage + 2 );
|
||||
int curStage = (int)Plant.PlantStatus;
|
||||
Plant.PlantStatus = (PlantStatus)( curStage + 2 );
|
||||
|
||||
m_GrowthIndicator = PlantGrowthIndicator.DoubleGrown;
|
||||
GrowthIndicator = PlantGrowthIndicator.DoubleGrown;
|
||||
}
|
||||
else if ( m_Plant.PlantStatus < PlantStatus.Stage9 )
|
||||
else if ( Plant.PlantStatus < PlantStatus.Stage9 )
|
||||
{
|
||||
int curStage = (int)m_Plant.PlantStatus;
|
||||
m_Plant.PlantStatus = (PlantStatus)( curStage + 1 );
|
||||
int curStage = (int)Plant.PlantStatus;
|
||||
Plant.PlantStatus = (PlantStatus)( curStage + 1 );
|
||||
|
||||
m_GrowthIndicator = PlantGrowthIndicator.Grown;
|
||||
GrowthIndicator = PlantGrowthIndicator.Grown;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( Pollinated && LeftSeeds > 0 && m_Plant.Reproduces )
|
||||
if ( Pollinated && LeftSeeds > 0 && Plant.Reproduces )
|
||||
{
|
||||
LeftSeeds--;
|
||||
AvailableSeeds++;
|
||||
}
|
||||
|
||||
if ( LeftResources > 0 && PlantResourceInfo.GetInfo( m_Plant.PlantType, m_Plant.PlantHue ) != null )
|
||||
if ( LeftResources > 0 && PlantResourceInfo.GetInfo( Plant.PlantType, Plant.PlantHue ) != null )
|
||||
{
|
||||
LeftResources--;
|
||||
AvailableResources++;
|
||||
}
|
||||
|
||||
m_GrowthIndicator = PlantGrowthIndicator.Grown;
|
||||
GrowthIndicator = PlantGrowthIndicator.Grown;
|
||||
}
|
||||
|
||||
if ( m_Plant.PlantStatus >= PlantStatus.Stage9 && !Pollinated )
|
||||
if ( Plant.PlantStatus >= PlantStatus.Stage9 && !Pollinated )
|
||||
{
|
||||
Pollinated = true;
|
||||
SeedType = m_Plant.PlantType;
|
||||
SeedHue = m_Plant.PlantHue;
|
||||
SeedType = Plant.PlantType;
|
||||
SeedHue = Plant.PlantHue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -592,11 +577,11 @@ namespace Server.Engines.Plants
|
|||
{
|
||||
double infestationChance = 0.30 - StrengthPotion * 0.075 + ( Water - 2 ) * 0.10;
|
||||
|
||||
PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo( m_Plant.PlantType );
|
||||
PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo( Plant.PlantType );
|
||||
if ( typeInfo.Flowery )
|
||||
infestationChance += 0.10;
|
||||
|
||||
if ( PlantHueInfo.IsBright( m_Plant.PlantHue ) )
|
||||
if ( PlantHueInfo.IsBright( Plant.PlantHue ) )
|
||||
infestationChance += 0.10;
|
||||
|
||||
if ( Utility.RandomDouble() < infestationChance )
|
||||
|
|
@ -630,10 +615,10 @@ namespace Server.Engines.Plants
|
|||
{
|
||||
writer.Write( (int) 2 ); // version
|
||||
|
||||
writer.Write( (bool) m_FertileDirt );
|
||||
writer.Write( (bool) FertileDirt );
|
||||
|
||||
writer.Write( (DateTime) m_NextGrowth );
|
||||
writer.Write( (int) m_GrowthIndicator );
|
||||
writer.Write( (DateTime) NextGrowth );
|
||||
writer.Write( (int) GrowthIndicator );
|
||||
|
||||
writer.Write( (int) m_Water );
|
||||
|
||||
|
|
@ -647,7 +632,7 @@ namespace Server.Engines.Plants
|
|||
writer.Write( (int) m_HealPotion );
|
||||
writer.Write( (int) m_StrengthPotion );
|
||||
|
||||
writer.Write( (bool) m_Pollinated );
|
||||
writer.Write( (bool) Pollinated );
|
||||
writer.Write( (int) m_SeedType );
|
||||
writer.Write( (int) m_SeedHue );
|
||||
writer.Write( (int) m_AvailableSeeds );
|
||||
|
|
@ -659,18 +644,18 @@ namespace Server.Engines.Plants
|
|||
|
||||
public PlantSystem( PlantItem plant, GenericReader reader )
|
||||
{
|
||||
m_Plant = plant;
|
||||
Plant = plant;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_FertileDirt = reader.ReadBool();
|
||||
FertileDirt = reader.ReadBool();
|
||||
|
||||
if ( version >= 1 )
|
||||
m_NextGrowth = reader.ReadDateTime();
|
||||
NextGrowth = reader.ReadDateTime();
|
||||
else
|
||||
m_NextGrowth = reader.ReadDeltaTime();
|
||||
NextGrowth = reader.ReadDeltaTime();
|
||||
|
||||
m_GrowthIndicator = (PlantGrowthIndicator)reader.ReadInt();
|
||||
GrowthIndicator = (PlantGrowthIndicator)reader.ReadInt();
|
||||
|
||||
m_Water = reader.ReadInt();
|
||||
|
||||
|
|
@ -684,7 +669,7 @@ namespace Server.Engines.Plants
|
|||
m_HealPotion = reader.ReadInt();
|
||||
m_StrengthPotion = reader.ReadInt();
|
||||
|
||||
m_Pollinated = reader.ReadBool();
|
||||
Pollinated = reader.ReadBool();
|
||||
m_SeedType = (PlantType)reader.ReadInt();
|
||||
m_SeedHue = (PlantHue)reader.ReadInt();
|
||||
m_AvailableSeeds = reader.ReadInt();
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ namespace Server.Engines.Plants
|
|||
if ( m_PlantLabelPlant != -1 )
|
||||
return m_PlantLabelPlant;
|
||||
|
||||
if ( m_ContainsPlant )
|
||||
if ( ContainsPlant )
|
||||
return hueInfo.IsBright() ? 1060832 : 1060831; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~
|
||||
return hueInfo.IsBright() ? 1061887 : 1061888; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~ ~6_val~
|
||||
}
|
||||
|
|
@ -266,7 +266,7 @@ namespace Server.Engines.Plants
|
|||
if ( m_PlantLabelFullGrown != -1 )
|
||||
return m_PlantLabelFullGrown;
|
||||
|
||||
if ( m_ContainsPlant )
|
||||
if ( ContainsPlant )
|
||||
return hueInfo.IsBright() ? 1061891 : 1061889; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~
|
||||
return hueInfo.IsBright() ? 1061892 : 1061890; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~ plant
|
||||
}
|
||||
|
|
@ -295,16 +295,6 @@ namespace Server.Engines.Plants
|
|||
return hueInfo.IsBright() ? 1113493 : 1113492; // ~1_amount~ [bright] ~2_color~ ~3_type~ seeds
|
||||
}
|
||||
|
||||
private int m_ItemID;
|
||||
private int m_OffsetX;
|
||||
private int m_OffsetY;
|
||||
private PlantType m_PlantType;
|
||||
private bool m_ContainsPlant;
|
||||
private bool m_Flowery;
|
||||
private bool m_Crossable;
|
||||
private bool m_Reproduces;
|
||||
private PlantCategory m_PlantCategory;
|
||||
|
||||
// Cliloc overrides
|
||||
private int m_PlantLabelSeed;
|
||||
private int m_PlantLabelPlant;
|
||||
|
|
@ -313,17 +303,25 @@ namespace Server.Engines.Plants
|
|||
private int m_SeedLabel;
|
||||
private int m_SeedLabelPlural;
|
||||
|
||||
public int ItemID => m_ItemID;
|
||||
public int OffsetX => m_OffsetX;
|
||||
public int OffsetY => m_OffsetY;
|
||||
public PlantType PlantType => m_PlantType;
|
||||
public PlantCategory PlantCategory => m_PlantCategory;
|
||||
public int Name => ( m_ItemID < 0x4000 ) ? 1020000 + m_ItemID : 1078872 + m_ItemID;
|
||||
public int ItemID { get; }
|
||||
|
||||
public bool ContainsPlant => m_ContainsPlant;
|
||||
public bool Flowery => m_Flowery;
|
||||
public bool Crossable => m_Crossable;
|
||||
public bool Reproduces => m_Reproduces;
|
||||
public int OffsetX { get; }
|
||||
|
||||
public int OffsetY { get; }
|
||||
|
||||
public PlantType PlantType { get; }
|
||||
|
||||
public PlantCategory PlantCategory { get; }
|
||||
|
||||
public int Name => ( ItemID < 0x4000 ) ? 1020000 + ItemID : 1078872 + ItemID;
|
||||
|
||||
public bool ContainsPlant { get; }
|
||||
|
||||
public bool Flowery { get; }
|
||||
|
||||
public bool Crossable { get; }
|
||||
|
||||
public bool Reproduces { get; }
|
||||
|
||||
private PlantTypeInfo( int itemID, int offsetX, int offsetY, PlantType plantType, bool containsPlant, bool flowery, bool crossable, bool reproduces, PlantCategory plantCategory )
|
||||
: this( itemID, offsetX, offsetY, plantType, containsPlant, flowery, crossable, reproduces, plantCategory, -1, -1, -1, -1, -1, -1 )
|
||||
|
|
@ -332,15 +330,15 @@ namespace Server.Engines.Plants
|
|||
|
||||
private PlantTypeInfo( int itemID, int offsetX, int offsetY, PlantType plantType, bool containsPlant, bool flowery, bool crossable, bool reproduces, PlantCategory plantCategory, int plantLabelSeed, int plantLabelPlant, int plantLabelFullGrown, int plantLabelDecorative, int seedLabel, int seedLabelPlural )
|
||||
{
|
||||
m_ItemID = itemID;
|
||||
m_OffsetX = offsetX;
|
||||
m_OffsetY = offsetY;
|
||||
m_PlantType = plantType;
|
||||
m_ContainsPlant = containsPlant;
|
||||
m_Flowery = flowery;
|
||||
m_Crossable = crossable;
|
||||
m_Reproduces = reproduces;
|
||||
m_PlantCategory = plantCategory;
|
||||
ItemID = itemID;
|
||||
OffsetX = offsetX;
|
||||
OffsetY = offsetY;
|
||||
PlantType = plantType;
|
||||
ContainsPlant = containsPlant;
|
||||
Flowery = flowery;
|
||||
Crossable = crossable;
|
||||
Reproduces = reproduces;
|
||||
PlantCategory = plantCategory;
|
||||
m_PlantLabelSeed = plantLabelSeed;
|
||||
m_PlantLabelPlant = plantLabelPlant;
|
||||
m_PlantLabelFullGrown = plantLabelFullGrown;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue