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,170 +1,184 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Harvest;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Engines.Harvest;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public interface IAxe
|
||||
{
|
||||
bool Axe( Mobile from, BaseAxe axe );
|
||||
}
|
||||
public interface IAxe
|
||||
{
|
||||
bool Axe(Mobile from, BaseAxe axe);
|
||||
}
|
||||
|
||||
public abstract class BaseAxe : BaseMeleeWeapon
|
||||
{
|
||||
public override int DefHitSound => 0x232;
|
||||
public override int DefMissSound => 0x23A;
|
||||
public abstract class BaseAxe : BaseMeleeWeapon
|
||||
{
|
||||
private bool m_ShowUsesRemaining;
|
||||
|
||||
public override SkillName DefSkill => SkillName.Swords;
|
||||
public override WeaponType DefType => WeaponType.Axe;
|
||||
public override WeaponAnimation DefAnimation => WeaponAnimation.Slash2H;
|
||||
private int m_UsesRemaining;
|
||||
|
||||
public virtual HarvestSystem HarvestSystem => Lumberjacking.System;
|
||||
public BaseAxe(int itemID) : base(itemID)
|
||||
{
|
||||
m_UsesRemaining = 150;
|
||||
}
|
||||
|
||||
private int m_UsesRemaining;
|
||||
private bool m_ShowUsesRemaining;
|
||||
public BaseAxe(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set { m_UsesRemaining = value; InvalidateProperties(); }
|
||||
}
|
||||
public override int DefHitSound => 0x232;
|
||||
public override int DefMissSound => 0x23A;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool ShowUsesRemaining
|
||||
{
|
||||
get => m_ShowUsesRemaining;
|
||||
set { m_ShowUsesRemaining = value; InvalidateProperties(); }
|
||||
}
|
||||
public override SkillName DefSkill => SkillName.Swords;
|
||||
public override WeaponType DefType => WeaponType.Axe;
|
||||
public override WeaponAnimation DefAnimation => WeaponAnimation.Slash2H;
|
||||
|
||||
public virtual int GetUsesScalar()
|
||||
{
|
||||
if ( Quality == WeaponQuality.Exceptional )
|
||||
return 200;
|
||||
public virtual HarvestSystem HarvestSystem => Lumberjacking.System;
|
||||
|
||||
return 100;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get => m_UsesRemaining;
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void UnscaleDurability()
|
||||
{
|
||||
base.UnscaleDurability();
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool ShowUsesRemaining
|
||||
{
|
||||
get => m_ShowUsesRemaining;
|
||||
set
|
||||
{
|
||||
m_ShowUsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
int scale = GetUsesScalar();
|
||||
public virtual int GetUsesScalar()
|
||||
{
|
||||
if (Quality == WeaponQuality.Exceptional)
|
||||
return 200;
|
||||
|
||||
m_UsesRemaining = ((m_UsesRemaining * 100) + (scale - 1)) / scale;
|
||||
InvalidateProperties();
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
|
||||
public override void ScaleDurability()
|
||||
{
|
||||
base.ScaleDurability();
|
||||
public override void UnscaleDurability()
|
||||
{
|
||||
base.UnscaleDurability();
|
||||
|
||||
int scale = GetUsesScalar();
|
||||
int scale = GetUsesScalar();
|
||||
|
||||
m_UsesRemaining = ((m_UsesRemaining * scale) + 99) / 100;
|
||||
InvalidateProperties();
|
||||
}
|
||||
m_UsesRemaining = (m_UsesRemaining * 100 + (scale - 1)) / scale;
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public BaseAxe( int itemID ) : base( itemID )
|
||||
{
|
||||
m_UsesRemaining = 150;
|
||||
}
|
||||
public override void ScaleDurability()
|
||||
{
|
||||
base.ScaleDurability();
|
||||
|
||||
public BaseAxe( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
int scale = GetUsesScalar();
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( HarvestSystem == null || Deleted )
|
||||
return;
|
||||
m_UsesRemaining = (m_UsesRemaining * scale + 99) / 100;
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
Point3D loc = GetWorldLocation();
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (HarvestSystem == null || Deleted)
|
||||
return;
|
||||
|
||||
if ( !from.InLOS( loc ) || !from.InRange( loc, 2 ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3E9, 1019045 ); // I can't reach that
|
||||
return;
|
||||
}
|
||||
Point3D loc = GetWorldLocation();
|
||||
|
||||
if ( !IsAccessibleTo( from ) )
|
||||
{
|
||||
PublicOverheadMessage( MessageType.Regular, 0x3E9, 1061637 ); // You are not allowed to access this.
|
||||
return;
|
||||
}
|
||||
if (!from.InLOS(loc) || !from.InRange(loc, 2))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !(HarvestSystem is Mining) )
|
||||
from.SendLocalizedMessage( 1010018 ); // What do you want to use this item on?
|
||||
if (!IsAccessibleTo(from))
|
||||
{
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3E9, 1061637); // You are not allowed to access this.
|
||||
return;
|
||||
}
|
||||
|
||||
HarvestSystem.BeginHarvesting( from, this );
|
||||
}
|
||||
if (!(HarvestSystem is Mining))
|
||||
from.SendLocalizedMessage(1010018); // What do you want to use this item on?
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
HarvestSystem.BeginHarvesting(from, this);
|
||||
}
|
||||
|
||||
if ( HarvestSystem != null )
|
||||
BaseHarvestTool.AddContextMenuEntries( from, this, list, HarvestSystem );
|
||||
}
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
if (HarvestSystem != null)
|
||||
BaseHarvestTool.AddContextMenuEntries(from, this, list, HarvestSystem);
|
||||
}
|
||||
|
||||
writer.Write( (int) 2 ); // version
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (bool) m_ShowUsesRemaining );
|
||||
writer.Write(2); // version
|
||||
|
||||
writer.Write( (int) m_UsesRemaining );
|
||||
}
|
||||
writer.Write(m_ShowUsesRemaining);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
writer.Write(m_UsesRemaining);
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
m_ShowUsesRemaining = reader.ReadBool();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
if ( m_UsesRemaining < 1 )
|
||||
m_UsesRemaining = 150;
|
||||
int version = reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
m_ShowUsesRemaining = reader.ReadBool();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
if (m_UsesRemaining < 1)
|
||||
m_UsesRemaining = 150;
|
||||
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1 )
|
||||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Core.AOS && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded && attacker.Skills[SkillName.Anatomy].Value >= 80 && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() && Engines.ConPVP.DuelContext.AllowSpecialAbility(attacker, "Concussion Blow", false))
|
||||
{
|
||||
StatMod mod = defender.GetStatMod( "Concussion" );
|
||||
public override void OnHit(Mobile attacker, Mobile defender, double damageBonus = 1)
|
||||
{
|
||||
base.OnHit(attacker, defender, damageBonus);
|
||||
|
||||
if ( mod == null )
|
||||
{
|
||||
defender.SendMessage( "You receive a concussion blow!" );
|
||||
defender.AddStatMod( new StatMod( StatType.Int, "Concussion", -(defender.RawInt / 2), TimeSpan.FromSeconds( 30.0 ) ) );
|
||||
if (!Core.AOS && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded &&
|
||||
attacker.Skills[SkillName.Anatomy].Value >= 80 &&
|
||||
attacker.Skills[SkillName.Anatomy].Value / 400.0 >= Utility.RandomDouble() &&
|
||||
DuelContext.AllowSpecialAbility(attacker, "Concussion Blow", false))
|
||||
{
|
||||
StatMod mod = defender.GetStatMod("Concussion");
|
||||
|
||||
attacker.SendMessage( "You deliver a concussion blow!" );
|
||||
attacker.PlaySound( 0x308 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mod == null)
|
||||
{
|
||||
defender.SendMessage("You receive a concussion blow!");
|
||||
defender.AddStatMod(new StatMod(StatType.Int, "Concussion", -(defender.RawInt / 2),
|
||||
TimeSpan.FromSeconds(30.0)));
|
||||
|
||||
attacker.SendMessage("You deliver a concussion blow!");
|
||||
attacker.PlaySound(0x308);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue