Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -1,174 +1,181 @@
|
|||
using System;
|
||||
using Server.Targeting;
|
||||
using Server.Engines.Harvest;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ProspectorsTool : BaseBashing, IUsesRemaining
|
||||
{
|
||||
private int m_UsesRemaining;
|
||||
public class ProspectorsTool : BaseBashing, IUsesRemaining
|
||||
{
|
||||
private int m_UsesRemaining;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set { m_UsesRemaining = value; InvalidateProperties(); }
|
||||
}
|
||||
[Constructible]
|
||||
public ProspectorsTool() : base(0xFB4)
|
||||
{
|
||||
Weight = 9.0;
|
||||
UsesRemaining = 50;
|
||||
}
|
||||
|
||||
public bool ShowUsesRemaining{ get => true;
|
||||
set{} }
|
||||
public ProspectorsTool(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1049065; // prospector's tool
|
||||
public override int LabelNumber => 1049065; // prospector's tool
|
||||
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.CrushingBlow;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.ShadowStrike;
|
||||
public override WeaponAbility PrimaryAbility => WeaponAbility.CrushingBlow;
|
||||
public override WeaponAbility SecondaryAbility => WeaponAbility.ShadowStrike;
|
||||
|
||||
public override int AosStrengthReq => 40;
|
||||
public override int AosMinDamage => 13;
|
||||
public override int AosMaxDamage => 15;
|
||||
public override int AosSpeed => 33;
|
||||
public override int AosStrengthReq => 40;
|
||||
public override int AosMinDamage => 13;
|
||||
public override int AosMaxDamage => 15;
|
||||
public override int AosSpeed => 33;
|
||||
|
||||
public override int OldStrengthReq => 10;
|
||||
public override int OldMinDamage => 6;
|
||||
public override int OldMaxDamage => 8;
|
||||
public override int OldSpeed => 33;
|
||||
public override int OldStrengthReq => 10;
|
||||
public override int OldMinDamage => 6;
|
||||
public override int OldMaxDamage => 8;
|
||||
public override int OldSpeed => 33;
|
||||
|
||||
[Constructible]
|
||||
public ProspectorsTool() : base( 0xFB4 )
|
||||
{
|
||||
Weight = 9.0;
|
||||
UsesRemaining = 50;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public ProspectorsTool( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public bool ShowUsesRemaining
|
||||
{
|
||||
get => true;
|
||||
set { }
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) || Parent == from )
|
||||
from.Target = new InternalTarget( this );
|
||||
else
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack) || Parent == from)
|
||||
from.Target = new InternalTarget(this);
|
||||
else
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
||||
public void Prospect( Mobile from, object toProspect )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) && Parent != from )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
public void Prospect(Mobile from, object toProspect)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack) && Parent != from)
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
HarvestSystem system = Mining.System;
|
||||
HarvestSystem system = Mining.System;
|
||||
|
||||
int tileID;
|
||||
Map map;
|
||||
Point3D loc;
|
||||
int tileID;
|
||||
Map map;
|
||||
Point3D loc;
|
||||
|
||||
if ( !system.GetHarvestDetails( from, this, toProspect, out tileID, out map, out loc ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049048 ); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
if (!system.GetHarvestDetails(from, this, toProspect, out tileID, out map, out loc))
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
HarvestDefinition def = system.GetDefinition( tileID );
|
||||
HarvestDefinition def = system.GetDefinition(tileID);
|
||||
|
||||
if ( def == null || def.Veins.Length <= 1 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049048 ); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
if (def == null || def.Veins.Length <= 1)
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
HarvestBank bank = def.GetBank( map, loc.X, loc.Y );
|
||||
HarvestBank bank = def.GetBank(map, loc.X, loc.Y);
|
||||
|
||||
if ( bank == null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049048 ); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
if (bank == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
HarvestVein vein = bank.Vein, defaultVein = bank.DefaultVein;
|
||||
HarvestVein vein = bank.Vein, defaultVein = bank.DefaultVein;
|
||||
|
||||
if ( vein == null || defaultVein == null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049048 ); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
if (vein == null || defaultVein == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( vein != defaultVein )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049049 ); // That ore looks to be prospected already.
|
||||
return;
|
||||
}
|
||||
if (vein != defaultVein)
|
||||
{
|
||||
from.SendLocalizedMessage(1049049); // That ore looks to be prospected already.
|
||||
return;
|
||||
}
|
||||
|
||||
int veinIndex = Array.IndexOf( def.Veins, vein );
|
||||
int veinIndex = Array.IndexOf(def.Veins, vein);
|
||||
|
||||
if ( veinIndex < 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049048 ); // You cannot use your prospector tool on that.
|
||||
}
|
||||
else if ( veinIndex >= (def.Veins.Length - 1) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049061 ); // You cannot improve valorite ore through prospecting.
|
||||
}
|
||||
else
|
||||
{
|
||||
bank.Vein = def.Veins[veinIndex + 1];
|
||||
from.SendLocalizedMessage( 1049050 + veinIndex );
|
||||
if (veinIndex < 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that.
|
||||
}
|
||||
else if (veinIndex >= def.Veins.Length - 1)
|
||||
{
|
||||
from.SendLocalizedMessage(1049061); // You cannot improve valorite ore through prospecting.
|
||||
}
|
||||
else
|
||||
{
|
||||
bank.Vein = def.Veins[veinIndex + 1];
|
||||
from.SendLocalizedMessage(1049050 + veinIndex);
|
||||
|
||||
--UsesRemaining;
|
||||
--UsesRemaining;
|
||||
|
||||
if ( UsesRemaining <= 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049062 ); // You have used up your prospector's tool.
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (UsesRemaining <= 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1049062); // You have used up your prospector's tool.
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
writer.Write( (int) m_UsesRemaining );
|
||||
}
|
||||
writer.Write(1); // version
|
||||
writer.Write(m_UsesRemaining);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_UsesRemaining = 50;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_UsesRemaining = 50;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ProspectorsTool m_Tool;
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ProspectorsTool m_Tool;
|
||||
|
||||
public InternalTarget( ProspectorsTool tool ) : base( 2, true, TargetFlags.None )
|
||||
{
|
||||
m_Tool = tool;
|
||||
}
|
||||
public InternalTarget(ProspectorsTool tool) : base(2, true, TargetFlags.None)
|
||||
{
|
||||
m_Tool = tool;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
m_Tool.Prospect( from, targeted );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
m_Tool.Prospect(from, targeted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue