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
|
|
@ -2,128 +2,128 @@ using System.Collections.Generic;
|
|||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public abstract class BaseMonolith : BaseSystemController
|
||||
{
|
||||
private Town m_Town;
|
||||
private Faction m_Faction;
|
||||
private Sigil m_Sigil;
|
||||
public abstract class BaseMonolith : BaseSystemController
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private Sigil m_Sigil;
|
||||
private Town m_Town;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public Sigil Sigil
|
||||
{
|
||||
get => m_Sigil;
|
||||
set
|
||||
{
|
||||
if ( m_Sigil == value )
|
||||
return;
|
||||
public BaseMonolith(Town town, Faction faction) : base(0x1183)
|
||||
{
|
||||
Movable = false;
|
||||
Town = town;
|
||||
Faction = faction;
|
||||
Monoliths.Add(this);
|
||||
}
|
||||
|
||||
m_Sigil = value;
|
||||
public BaseMonolith(Serial serial) : base(serial)
|
||||
{
|
||||
Monoliths.Add(this);
|
||||
}
|
||||
|
||||
if ( m_Sigil?.LastMonolith != null && m_Sigil.LastMonolith != this && m_Sigil.LastMonolith.Sigil == m_Sigil )
|
||||
m_Sigil.LastMonolith.Sigil = null;
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Sigil Sigil
|
||||
{
|
||||
get => m_Sigil;
|
||||
set
|
||||
{
|
||||
if (m_Sigil == value)
|
||||
return;
|
||||
|
||||
if ( m_Sigil != null )
|
||||
m_Sigil.LastMonolith = this;
|
||||
m_Sigil = value;
|
||||
|
||||
UpdateSigil();
|
||||
}
|
||||
}
|
||||
if (m_Sigil?.LastMonolith != null && m_Sigil.LastMonolith != this && m_Sigil.LastMonolith.Sigil == m_Sigil)
|
||||
m_Sigil.LastMonolith.Sigil = null;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public Town Town
|
||||
{
|
||||
get => m_Town;
|
||||
set
|
||||
{
|
||||
m_Town = value;
|
||||
OnTownChanged();
|
||||
}
|
||||
}
|
||||
if (m_Sigil != null)
|
||||
m_Sigil.LastMonolith = this;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
Hue = m_Faction?.Definition.HuePrimary ?? 0;
|
||||
}
|
||||
}
|
||||
UpdateSigil();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnLocationChange( Point3D oldLocation )
|
||||
{
|
||||
base.OnLocationChange( oldLocation );
|
||||
UpdateSigil();
|
||||
}
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Town Town
|
||||
{
|
||||
get => m_Town;
|
||||
set
|
||||
{
|
||||
m_Town = value;
|
||||
OnTownChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnMapChange()
|
||||
{
|
||||
base.OnMapChange();
|
||||
UpdateSigil();
|
||||
}
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
Hue = m_Faction?.Definition.HuePrimary ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void UpdateSigil()
|
||||
{
|
||||
if ( m_Sigil == null || m_Sigil.Deleted )
|
||||
return;
|
||||
public static List<BaseMonolith> Monoliths{ get; set; } = new List<BaseMonolith>();
|
||||
|
||||
m_Sigil.MoveToWorld( new Point3D( X, Y, Z + 18 ), Map );
|
||||
}
|
||||
public override void OnLocationChange(Point3D oldLocation)
|
||||
{
|
||||
base.OnLocationChange(oldLocation);
|
||||
UpdateSigil();
|
||||
}
|
||||
|
||||
public virtual void OnTownChanged()
|
||||
{
|
||||
}
|
||||
public override void OnMapChange()
|
||||
{
|
||||
base.OnMapChange();
|
||||
UpdateSigil();
|
||||
}
|
||||
|
||||
public BaseMonolith( Town town, Faction faction ) : base( 0x1183 )
|
||||
{
|
||||
Movable = false;
|
||||
Town = town;
|
||||
Faction = faction;
|
||||
Monoliths.Add( this );
|
||||
}
|
||||
public virtual void UpdateSigil()
|
||||
{
|
||||
if (m_Sigil == null || m_Sigil.Deleted)
|
||||
return;
|
||||
|
||||
public BaseMonolith( Serial serial ) : base( serial )
|
||||
{
|
||||
Monoliths.Add( this );
|
||||
}
|
||||
m_Sigil.MoveToWorld(new Point3D(X, Y, Z + 18), Map);
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
Monoliths.Remove( this );
|
||||
}
|
||||
public virtual void OnTownChanged()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
Monoliths.Remove(this);
|
||||
}
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
Town.WriteReference( writer, m_Town );
|
||||
Faction.WriteReference( writer, m_Faction );
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write( (Item) m_Sigil );
|
||||
}
|
||||
Town.WriteReference(writer, m_Town);
|
||||
Faction.WriteReference(writer, m_Faction);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
writer.Write(m_Sigil);
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Town = Town.ReadReference( reader );
|
||||
Faction = Faction.ReadReference( reader );
|
||||
m_Sigil = reader.ReadItem() as Sigil;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
|
||||
public static List<BaseMonolith> Monoliths { get; set; } = new List<BaseMonolith>();
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Town = Town.ReadReference(reader);
|
||||
Faction = Faction.ReadReference(reader);
|
||||
m_Sigil = reader.ReadItem() as Sigil;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +1,64 @@
|
|||
namespace Server.Factions
|
||||
{
|
||||
public abstract class BaseSystemController : Item
|
||||
{
|
||||
private int m_LabelNumber;
|
||||
public abstract class BaseSystemController : Item
|
||||
{
|
||||
private int m_LabelNumber;
|
||||
|
||||
public virtual int DefaultLabelNumber => base.LabelNumber;
|
||||
public new virtual string DefaultName => null;
|
||||
public BaseSystemController(int itemID) : base(itemID)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_LabelNumber > 0 )
|
||||
return m_LabelNumber;
|
||||
public BaseSystemController(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
return DefaultLabelNumber;
|
||||
}
|
||||
}
|
||||
public virtual int DefaultLabelNumber => base.LabelNumber;
|
||||
public new virtual string DefaultName => null;
|
||||
|
||||
public virtual void AssignName( TextDefinition name )
|
||||
{
|
||||
if ( name != null && name.Number > 0 )
|
||||
{
|
||||
m_LabelNumber = name.Number;
|
||||
Name = null;
|
||||
}
|
||||
else if ( name?.String != null )
|
||||
{
|
||||
m_LabelNumber = 0;
|
||||
Name = name.String;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LabelNumber = 0;
|
||||
Name = DefaultName;
|
||||
}
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_LabelNumber > 0)
|
||||
return m_LabelNumber;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
return DefaultLabelNumber;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseSystemController( int itemID ) : base( itemID )
|
||||
{
|
||||
}
|
||||
public virtual void AssignName(TextDefinition name)
|
||||
{
|
||||
if (name != null && name.Number > 0)
|
||||
{
|
||||
m_LabelNumber = name.Number;
|
||||
Name = null;
|
||||
}
|
||||
else if (name?.String != null)
|
||||
{
|
||||
m_LabelNumber = 0;
|
||||
Name = name.String;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LabelNumber = 0;
|
||||
Name = DefaultName;
|
||||
}
|
||||
|
||||
public BaseSystemController( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,101 +3,102 @@ using Server.Network;
|
|||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class FactionStone : BaseSystemController
|
||||
{
|
||||
private Faction m_Faction;
|
||||
public class FactionStone : BaseSystemController
|
||||
{
|
||||
private Faction m_Faction;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
[Constructible]
|
||||
public FactionStone() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
AssignName( m_Faction?.Definition.FactionStoneName );
|
||||
}
|
||||
}
|
||||
[Constructible]
|
||||
public FactionStone(Faction faction) : base(0xEDC)
|
||||
{
|
||||
Movable = false;
|
||||
Faction = faction;
|
||||
}
|
||||
|
||||
public override string DefaultName => "faction stone";
|
||||
public FactionStone(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public FactionStone() : this( null )
|
||||
{
|
||||
}
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
|
||||
[Constructible]
|
||||
public FactionStone( Faction faction ) : base( 0xEDC )
|
||||
{
|
||||
Movable = false;
|
||||
Faction = faction;
|
||||
}
|
||||
AssignName(m_Faction?.Definition.FactionStoneName);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_Faction == null )
|
||||
return;
|
||||
public override string DefaultName => "faction stone";
|
||||
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
}
|
||||
else if ( FactionGump.Exists( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042160 ); // You already have a faction menu open.
|
||||
}
|
||||
else if ( from is PlayerMobile mobile )
|
||||
{
|
||||
Faction existingFaction = Faction.Find( mobile );
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Faction == null)
|
||||
return;
|
||||
|
||||
if ( existingFaction == m_Faction || mobile.AccessLevel >= AccessLevel.GameMaster )
|
||||
{
|
||||
PlayerState pl = PlayerState.Find( mobile );
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
}
|
||||
else if (FactionGump.Exists(from))
|
||||
{
|
||||
from.SendLocalizedMessage(1042160); // You already have a faction menu open.
|
||||
}
|
||||
else if (from is PlayerMobile mobile)
|
||||
{
|
||||
Faction existingFaction = Faction.Find(mobile);
|
||||
|
||||
if ( pl != null && pl.IsLeaving )
|
||||
mobile.SendLocalizedMessage( 1005051 ); // You cannot use the faction stone until you have finished quitting your current faction
|
||||
else
|
||||
mobile.SendGump( new FactionStoneGump( mobile, m_Faction ) );
|
||||
}
|
||||
else if ( existingFaction != null )
|
||||
{
|
||||
// TODO: Validate
|
||||
mobile.SendLocalizedMessage( 1005053 ); // This is not your faction stone!
|
||||
}
|
||||
else
|
||||
{
|
||||
mobile.SendGump( new JoinStoneGump( mobile, m_Faction ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (existingFaction == m_Faction || mobile.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(mobile);
|
||||
|
||||
public FactionStone( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
if (pl != null && pl.IsLeaving)
|
||||
mobile.SendLocalizedMessage(
|
||||
1005051); // You cannot use the faction stone until you have finished quitting your current faction
|
||||
else
|
||||
mobile.SendGump(new FactionStoneGump(mobile, m_Faction));
|
||||
}
|
||||
else if (existingFaction != null)
|
||||
{
|
||||
// TODO: Validate
|
||||
mobile.SendLocalizedMessage(1005053); // This is not your faction stone!
|
||||
}
|
||||
else
|
||||
{
|
||||
mobile.SendGump(new JoinStoneGump(mobile, m_Faction));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write(0); // version
|
||||
|
||||
Faction.WriteReference( writer, m_Faction );
|
||||
}
|
||||
Faction.WriteReference(writer, m_Faction);
|
||||
}
|
||||
|
||||
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 0:
|
||||
{
|
||||
Faction = Faction.ReadReference( reader );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Faction = Faction.ReadReference(reader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,77 +3,77 @@ using Server.Network;
|
|||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class JoinStone : BaseSystemController
|
||||
{
|
||||
private Faction m_Faction;
|
||||
public class JoinStone : BaseSystemController
|
||||
{
|
||||
private Faction m_Faction;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
[Constructible]
|
||||
public JoinStone() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
Hue = m_Faction?.Definition.HueJoin ?? 0;
|
||||
AssignName( m_Faction?.Definition.SignupName );
|
||||
}
|
||||
}
|
||||
[Constructible]
|
||||
public JoinStone(Faction faction) : base(0xEDC)
|
||||
{
|
||||
Movable = false;
|
||||
Faction = faction;
|
||||
}
|
||||
|
||||
public override string DefaultName => "faction signup stone";
|
||||
public JoinStone(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public JoinStone() : this( null )
|
||||
{
|
||||
}
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
|
||||
[Constructible]
|
||||
public JoinStone( Faction faction ) : base( 0xEDC )
|
||||
{
|
||||
Movable = false;
|
||||
Faction = faction;
|
||||
}
|
||||
Hue = m_Faction?.Definition.HueJoin ?? 0;
|
||||
AssignName(m_Faction?.Definition.SignupName);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_Faction == null )
|
||||
return;
|
||||
public override string DefaultName => "faction signup stone";
|
||||
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
else if ( FactionGump.Exists( from ) )
|
||||
from.SendLocalizedMessage( 1042160 ); // You already have a faction menu open.
|
||||
else if ( Faction.Find( from ) == null && from is PlayerMobile mobile )
|
||||
mobile.SendGump( new JoinStoneGump( mobile, m_Faction ) );
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Faction == null)
|
||||
return;
|
||||
|
||||
public JoinStone( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
else if (FactionGump.Exists(from))
|
||||
from.SendLocalizedMessage(1042160); // You already have a faction menu open.
|
||||
else if (Faction.Find(from) == null && from is PlayerMobile mobile)
|
||||
mobile.SendGump(new JoinStoneGump(mobile, m_Faction));
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write(0); // version
|
||||
|
||||
Faction.WriteReference( writer, m_Faction );
|
||||
}
|
||||
Faction.WriteReference(writer, m_Faction);
|
||||
}
|
||||
|
||||
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 0:
|
||||
{
|
||||
Faction = Faction.ReadReference( reader );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Faction = Faction.ReadReference(reader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +1,59 @@
|
|||
using System;
|
||||
|
||||
namespace Server {
|
||||
public sealed class BloodRose : PowerFactionItem {
|
||||
public override string DefaultName => "blood rose";
|
||||
namespace Server
|
||||
{
|
||||
public sealed class BloodRose : PowerFactionItem
|
||||
{
|
||||
public BloodRose()
|
||||
: base(Utility.RandomList(6378, 9035))
|
||||
{
|
||||
Hue = 2118;
|
||||
}
|
||||
|
||||
public BloodRose()
|
||||
: base( Utility.RandomList( 6378, 9035 ) ) {
|
||||
Hue = 2118;
|
||||
}
|
||||
public BloodRose(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BloodRose( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
public override string DefaultName => "blood rose";
|
||||
|
||||
public override bool Use( Mobile from ) {
|
||||
if ( from.GetStatMod( "blood-rose" ) == null ) {
|
||||
from.PlaySound( Utility.Random( 0x3A, 3 ) );
|
||||
public override bool Use(Mobile from)
|
||||
{
|
||||
if (from.GetStatMod("blood-rose") == null)
|
||||
{
|
||||
from.PlaySound(Utility.Random(0x3A, 3));
|
||||
|
||||
if ( from.Body.IsHuman && !from.Mounted ) {
|
||||
from.Animate( 34, 5, 1, true, false, 0 );
|
||||
}
|
||||
if (from.Body.IsHuman && !from.Mounted) from.Animate(34, 5, 1, true, false, 0);
|
||||
|
||||
int amount = Utility.Dice( 3, 3, 3 );
|
||||
int time = Utility.RandomMinMax( 5, 30 );
|
||||
int amount = Utility.Dice(3, 3, 3);
|
||||
int time = Utility.RandomMinMax(5, 30);
|
||||
|
||||
from.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist );
|
||||
from.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
|
||||
|
||||
from.PlaySound( 0x1EE );
|
||||
from.AddStatMod( new StatMod( StatType.All, "blood-rose", amount, TimeSpan.FromMinutes( time ) ) );
|
||||
from.PlaySound(0x1EE);
|
||||
from.AddStatMod(new StatMod(StatType.All, "blood-rose", amount, TimeSpan.FromMinutes(time)));
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.
|
||||
from.SendLocalizedMessage(
|
||||
1062927); // You have eaten one of these recently and eating another would provide no benefit.
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +1,67 @@
|
|||
using System;
|
||||
|
||||
namespace Server {
|
||||
public sealed class ClarityPotion : PowerFactionItem {
|
||||
public override string DefaultName => "clarity potion";
|
||||
namespace Server
|
||||
{
|
||||
public sealed class ClarityPotion : PowerFactionItem
|
||||
{
|
||||
public ClarityPotion()
|
||||
: base(3628)
|
||||
{
|
||||
Hue = 1154;
|
||||
}
|
||||
|
||||
public ClarityPotion()
|
||||
: base( 3628 ) {
|
||||
Hue = 1154;
|
||||
}
|
||||
public ClarityPotion(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public ClarityPotion( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
public override string DefaultName => "clarity potion";
|
||||
|
||||
public override bool Use( Mobile from ) {
|
||||
if ( from.BeginAction( typeof( ClarityPotion ) ) ) {
|
||||
int amount = Utility.Dice( 3, 3, 3 );
|
||||
int time = Utility.RandomMinMax( 5, 30 );
|
||||
public override bool Use(Mobile from)
|
||||
{
|
||||
if (from.BeginAction(typeof(ClarityPotion)))
|
||||
{
|
||||
int amount = Utility.Dice(3, 3, 3);
|
||||
int time = Utility.RandomMinMax(5, 30);
|
||||
|
||||
from.PlaySound( 0x2D6 );
|
||||
from.PlaySound(0x2D6);
|
||||
|
||||
if ( from.Body.IsHuman ) {
|
||||
from.Animate( 34, 5, 1, true, false, 0 );
|
||||
}
|
||||
if (from.Body.IsHuman) from.Animate(34, 5, 1, true, false, 0);
|
||||
|
||||
from.FixedParticles( 0x375A, 10, 15, 5011, EffectLayer.Head );
|
||||
from.PlaySound( 0x1EB );
|
||||
from.FixedParticles(0x375A, 10, 15, 5011, EffectLayer.Head);
|
||||
from.PlaySound(0x1EB);
|
||||
|
||||
StatMod mod = from.GetStatMod( "Concussion" );
|
||||
StatMod mod = from.GetStatMod("Concussion");
|
||||
|
||||
if ( mod != null ) {
|
||||
from.RemoveStatMod( "Concussion" );
|
||||
from.Mana -= mod.Offset;
|
||||
}
|
||||
if (mod != null)
|
||||
{
|
||||
from.RemoveStatMod("Concussion");
|
||||
from.Mana -= mod.Offset;
|
||||
}
|
||||
|
||||
from.PlaySound( 0x1EE );
|
||||
from.AddStatMod( new StatMod( StatType.Int, "clarity-potion", amount, TimeSpan.FromMinutes( time ) ) );
|
||||
from.PlaySound(0x1EE);
|
||||
from.AddStatMod(new StatMod(StatType.Int, "clarity-potion", amount, TimeSpan.FromMinutes(time)));
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromMinutes( time ), delegate {
|
||||
from.EndAction( typeof( ClarityPotion ) );
|
||||
} );
|
||||
Timer.DelayCall(TimeSpan.FromMinutes(time), delegate { from.EndAction(typeof(ClarityPotion)); });
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +1,51 @@
|
|||
using Server.Factions;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server {
|
||||
public sealed class GemOfEmpowerment : PowerFactionItem {
|
||||
public override string DefaultName => "gem of empowerment";
|
||||
namespace Server
|
||||
{
|
||||
public sealed class GemOfEmpowerment : PowerFactionItem
|
||||
{
|
||||
public GemOfEmpowerment()
|
||||
: base(7955)
|
||||
{
|
||||
Hue = 1154;
|
||||
}
|
||||
|
||||
public GemOfEmpowerment()
|
||||
: base( 7955 ) {
|
||||
Hue = 1154;
|
||||
}
|
||||
public GemOfEmpowerment(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public GemOfEmpowerment( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
public override string DefaultName => "gem of empowerment";
|
||||
|
||||
public override bool Use( Mobile from ) {
|
||||
if ( Faction.ClearSkillLoss( from ) ) {
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 2219, false, "The gem shatters as you invoke its power." );
|
||||
from.PlaySound( 909 );
|
||||
public override bool Use(Mobile from)
|
||||
{
|
||||
if (Faction.ClearSkillLoss(from))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 2219, false, "The gem shatters as you invoke its power.");
|
||||
from.PlaySound(909);
|
||||
|
||||
from.FixedEffect( 0x373A, 10, 30 );
|
||||
from.PlaySound( 0x209 );
|
||||
from.FixedEffect(0x373A, 10, 30);
|
||||
from.PlaySound(0x209);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,151 +1,186 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Factions;
|
||||
using System.IO;
|
||||
using Server.Factions;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server {
|
||||
public abstract class PowerFactionItem : Item {
|
||||
public abstract bool Use( Mobile mob );
|
||||
namespace Server
|
||||
{
|
||||
public abstract class PowerFactionItem : Item
|
||||
{
|
||||
private static WeightedItem[] _items =
|
||||
{
|
||||
new WeightedItem(30, typeof(GemOfEmpowerment)),
|
||||
new WeightedItem(25, typeof(BloodRose)),
|
||||
new WeightedItem(20, typeof(ClarityPotion)),
|
||||
new WeightedItem(15, typeof(UrnOfAscension)),
|
||||
new WeightedItem(10, typeof(StormsEye))
|
||||
};
|
||||
|
||||
private sealed class DestructionTimer : Timer {
|
||||
private Mobile _mobile;
|
||||
public PowerFactionItem(int itemId)
|
||||
: base(itemId)
|
||||
{
|
||||
}
|
||||
|
||||
private bool _screamed;
|
||||
public PowerFactionItem(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public DestructionTimer( Mobile mob )
|
||||
: base( TimeSpan.FromSeconds( 5 ), TimeSpan.FromSeconds( 0.1 ), 10 ) {
|
||||
_mobile = mob;
|
||||
}
|
||||
public abstract bool Use(Mobile mob);
|
||||
|
||||
protected override void OnTick() {
|
||||
if ( _mobile.Alive ) {
|
||||
if ( !_screamed ) {
|
||||
_screamed = true;
|
||||
public static void CheckSpawn(Mobile killer, Mobile victim)
|
||||
{
|
||||
if (killer != null && victim != null)
|
||||
{
|
||||
PlayerState ps = PlayerState.Find(victim);
|
||||
|
||||
_mobile.PlaySound( _mobile.Female ? 814 : 1088 );
|
||||
_mobile.PublicOverheadMessage( Network.MessageType.Regular, 2118, false, "Aaaaah!" );
|
||||
}
|
||||
if (ps != null)
|
||||
{
|
||||
int chance = ps.Rank.Rank;
|
||||
|
||||
_mobile.Damage( Utility.Dice( 2, 6, 0 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (chance > Utility.Random(100))
|
||||
{
|
||||
int weight = 0;
|
||||
|
||||
private sealed class WeightedItem {
|
||||
public int Weight { get; }
|
||||
foreach (WeightedItem item in _items) weight += item.Weight;
|
||||
|
||||
public Type Type { get; }
|
||||
weight = Utility.Random(weight);
|
||||
|
||||
public WeightedItem( int weight, Type type ) {
|
||||
Weight = weight;
|
||||
Type = type;
|
||||
}
|
||||
foreach (WeightedItem item in _items)
|
||||
{
|
||||
if (weight < item.Weight)
|
||||
{
|
||||
Item obj = item.Construct();
|
||||
|
||||
public Item Construct() {
|
||||
return Activator.CreateInstance( Type ) as Item;
|
||||
}
|
||||
}
|
||||
if (obj != null)
|
||||
{
|
||||
killer.AddToBackpack(obj);
|
||||
|
||||
private static WeightedItem[] _items = {
|
||||
new WeightedItem( 30, typeof( GemOfEmpowerment ) ),
|
||||
new WeightedItem( 25, typeof( BloodRose ) ),
|
||||
new WeightedItem( 20, typeof( ClarityPotion ) ),
|
||||
new WeightedItem( 15, typeof( UrnOfAscension ) ),
|
||||
new WeightedItem( 10, typeof( StormsEye ) )
|
||||
};
|
||||
killer.SendSound(1470);
|
||||
killer.LocalOverheadMessage(
|
||||
MessageType.Regular, 2119, false,
|
||||
"You notice a strange item on the corpse, and decide to pick it up."
|
||||
);
|
||||
|
||||
public static void CheckSpawn( Mobile killer, Mobile victim ) {
|
||||
if ( killer != null && victim != null ) {
|
||||
PlayerState ps = PlayerState.Find( victim );
|
||||
try
|
||||
{
|
||||
using (StreamWriter op = new StreamWriter("faction-power-items.log", true))
|
||||
{
|
||||
op.WriteLine("{0}\t{1}\t{2}\t{3}", DateTime.UtcNow, killer, victim, obj);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if ( ps != null ) {
|
||||
int chance = ps.Rank.Rank;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( chance > Utility.Random( 100 ) ) {
|
||||
int weight = 0;
|
||||
weight -= item.Weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( WeightedItem item in _items ) {
|
||||
weight += item.Weight;
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
|
||||
}
|
||||
else if (from is PlayerMobile mobile && mobile.DuelContext != null)
|
||||
{
|
||||
mobile.SendMessage("You can't use that.");
|
||||
}
|
||||
else if (Faction.Find(from) == null)
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 2119, false,
|
||||
"The object vanishes from your hands as you touch it.");
|
||||
|
||||
weight = Utility.Random( weight );
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0),
|
||||
delegate
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 2118, false,
|
||||
"You feel a strange tingling sensation throughout your body.");
|
||||
});
|
||||
|
||||
foreach ( WeightedItem item in _items )
|
||||
{
|
||||
if ( weight < item.Weight ) {
|
||||
Item obj = item.Construct();
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(4.0),
|
||||
delegate { from.LocalOverheadMessage(MessageType.Regular, 2118, false, "Your skin begins to burn."); });
|
||||
|
||||
if ( obj != null ) {
|
||||
killer.AddToBackpack( obj );
|
||||
new DestructionTimer(from).Start();
|
||||
Delete();
|
||||
|
||||
killer.SendSound( 1470 );
|
||||
killer.LocalOverheadMessage(
|
||||
Network.MessageType.Regular, 2119, false,
|
||||
"You notice a strange item on the corpse, and decide to pick it up."
|
||||
);
|
||||
//from.SendMessage( "You must be in a faction to use this item." );
|
||||
}
|
||||
else if (Use(from))
|
||||
{
|
||||
from.RevealingAction();
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
using ( StreamWriter op = new StreamWriter( "faction-power-items.log", true ) ) {
|
||||
op.WriteLine( "{0}\t{1}\t{2}\t{3}", DateTime.UtcNow, killer, victim, obj );
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
break;
|
||||
}
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
weight -= item.Weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
public override void OnDoubleClick( Mobile from ) {
|
||||
if ( !IsChildOf( from.Backpack ) ) {
|
||||
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
|
||||
} else if ( from is PlayerMobile mobile && mobile.DuelContext != null ) {
|
||||
mobile.SendMessage( "You can't use that." );
|
||||
} else if ( Faction.Find( from ) == null ) {
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 2119, false, "The object vanishes from your hands as you touch it." );
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), delegate {
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 2118, false, "You feel a strange tingling sensation throughout your body." );
|
||||
} );
|
||||
private sealed class DestructionTimer : Timer
|
||||
{
|
||||
private Mobile _mobile;
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 4.0 ), delegate {
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 2118, false, "Your skin begins to burn." );
|
||||
} );
|
||||
private bool _screamed;
|
||||
|
||||
new DestructionTimer( from ).Start();
|
||||
Delete();
|
||||
public DestructionTimer(Mobile mob)
|
||||
: base(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(0.1), 10)
|
||||
{
|
||||
_mobile = mob;
|
||||
}
|
||||
|
||||
//from.SendMessage( "You must be in a faction to use this item." );
|
||||
} else if ( Use( from ) ) {
|
||||
from.RevealingAction();
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (_mobile.Alive)
|
||||
{
|
||||
if (!_screamed)
|
||||
{
|
||||
_screamed = true;
|
||||
|
||||
public PowerFactionItem( int itemId )
|
||||
: base( itemId ) {
|
||||
}
|
||||
_mobile.PlaySound(_mobile.Female ? 814 : 1088);
|
||||
_mobile.PublicOverheadMessage(MessageType.Regular, 2118, false, "Aaaaah!");
|
||||
}
|
||||
|
||||
public PowerFactionItem( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
_mobile.Damage(Utility.Dice(2, 6, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
private sealed class WeightedItem
|
||||
{
|
||||
public WeightedItem(int weight, Type type)
|
||||
{
|
||||
Weight = weight;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
public int Weight{ get; }
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
public Type Type{ get; }
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public Item Construct()
|
||||
{
|
||||
return Activator.CreateInstance(Type) as Item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,106 +1,115 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Spells;
|
||||
using Server.Factions;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server {
|
||||
public sealed class StormsEye : PowerFactionItem {
|
||||
public override string DefaultName => "storms eye";
|
||||
namespace Server
|
||||
{
|
||||
public sealed class StormsEye : PowerFactionItem
|
||||
{
|
||||
public StormsEye()
|
||||
: base(3967)
|
||||
{
|
||||
Hue = 1165;
|
||||
}
|
||||
|
||||
public StormsEye()
|
||||
: base( 3967 ) {
|
||||
Hue = 1165;
|
||||
}
|
||||
public StormsEye(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public StormsEye( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
public override string DefaultName => "storms eye";
|
||||
|
||||
public override bool Use( Mobile user ) {
|
||||
if ( Movable ) {
|
||||
user.BeginTarget( 12, true, Targeting.TargetFlags.None, delegate( Mobile from, object obj ) {
|
||||
if ( Movable && !Deleted ) {
|
||||
if ( obj is IPoint3D pt ) {
|
||||
SpellHelper.GetSurfaceTop( ref pt );
|
||||
public override bool Use(Mobile user)
|
||||
{
|
||||
if (Movable)
|
||||
user.BeginTarget(12, true, TargetFlags.None, delegate(Mobile from, object obj)
|
||||
{
|
||||
if (Movable && !Deleted)
|
||||
if (obj is IPoint3D pt)
|
||||
{
|
||||
SpellHelper.GetSurfaceTop(ref pt);
|
||||
|
||||
Point3D origin = new Point3D( pt );
|
||||
Map facet = from.Map;
|
||||
Point3D origin = new Point3D(pt);
|
||||
Map facet = from.Map;
|
||||
|
||||
if ( facet != null && facet.CanFit( pt.X, pt.Y, pt.Z, 16, false, false, true ) ) {
|
||||
Movable = false;
|
||||
if (facet != null && facet.CanFit(pt.X, pt.Y, pt.Z, 16, false, false, true))
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
Effects.SendMovingEffect(
|
||||
from, new Entity( Serial.Zero, origin, facet ),
|
||||
ItemID & 0x3FFF, 7, 0, false, false, Hue - 1, 0
|
||||
);
|
||||
Effects.SendMovingEffect(
|
||||
from, new Entity(Serial.Zero, origin, facet),
|
||||
ItemID & 0x3FFF, 7, 0, false, false, Hue - 1, 0
|
||||
);
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), delegate {
|
||||
Delete();
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.5), delegate
|
||||
{
|
||||
Delete();
|
||||
|
||||
Effects.PlaySound( origin, facet, 530 );
|
||||
Effects.PlaySound( origin, facet, 263 );
|
||||
Effects.PlaySound(origin, facet, 530);
|
||||
Effects.PlaySound(origin, facet, 263);
|
||||
|
||||
Effects.SendLocationEffect(
|
||||
origin, facet,
|
||||
14284, 96, 1, 0, 2
|
||||
);
|
||||
Effects.SendLocationEffect(
|
||||
origin, facet,
|
||||
14284, 96, 1, 0, 2
|
||||
);
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), delegate {
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate
|
||||
{
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
|
||||
foreach ( Mobile mob in facet.GetMobilesInRange( origin, 12 ) ) {
|
||||
if ( from.CanBeHarmful( mob, false ) && mob.InLOS( new Point3D( origin, origin.Z + 1 ) ) ) {
|
||||
if ( Faction.Find( mob ) != null ) {
|
||||
targets.Add( mob );
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Mobile mob in facet.GetMobilesInRange(origin, 12))
|
||||
if (from.CanBeHarmful(mob, false) &&
|
||||
mob.InLOS(new Point3D(origin, origin.Z + 1)))
|
||||
if (Faction.Find(mob) != null)
|
||||
targets.Add(mob);
|
||||
|
||||
foreach ( Mobile mob in targets ) {
|
||||
int damage = ( mob.Hits * 6 ) / 10;
|
||||
foreach (Mobile mob in targets)
|
||||
{
|
||||
int damage = mob.Hits * 6 / 10;
|
||||
|
||||
if ( !mob.Player && damage < 10 ) {
|
||||
damage = 10;
|
||||
} else if ( damage > 75 ) {
|
||||
damage = 75;
|
||||
}
|
||||
if (!mob.Player && damage < 10)
|
||||
damage = 10;
|
||||
else if (damage > 75) damage = 75;
|
||||
|
||||
Effects.SendMovingEffect(
|
||||
new Entity( Serial.Zero, new Point3D( origin, origin.Z + 4 ), facet ), mob,
|
||||
14068, 1, 32, false, false, 1111, 2
|
||||
);
|
||||
Effects.SendMovingEffect(
|
||||
new Entity(Serial.Zero, new Point3D(origin, origin.Z + 4), facet), mob,
|
||||
14068, 1, 32, false, false, 1111, 2
|
||||
);
|
||||
|
||||
from.DoHarmful( mob );
|
||||
from.DoHarmful(mob);
|
||||
|
||||
SpellHelper.Damage( TimeSpan.FromSeconds( 0.50 ), mob, from, damage / 3, 0, 0, 0, 0, 100 );
|
||||
SpellHelper.Damage( TimeSpan.FromSeconds( 0.70 ), mob, from, damage / 3, 0, 0, 0, 0, 100 );
|
||||
SpellHelper.Damage( TimeSpan.FromSeconds( 1.00 ), mob, from, damage / 3, 0, 0, 0, 0, 100 );
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(0.50), mob, from, damage / 3, 0, 0, 0, 0,
|
||||
100);
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(0.70), mob, from, damage / 3, 0, 0, 0, 0,
|
||||
100);
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(1.00), mob, from, damage / 3, 0, 0, 0, 0,
|
||||
100);
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), delegate {
|
||||
mob.PlaySound( 0x1FB );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.50), delegate { mob.PlaySound(0x1FB); });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +1,69 @@
|
|||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Factions;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server {
|
||||
public sealed class UrnOfAscension : PowerFactionItem {
|
||||
public override string DefaultName => "urn of ascension";
|
||||
namespace Server
|
||||
{
|
||||
public sealed class UrnOfAscension : PowerFactionItem
|
||||
{
|
||||
public UrnOfAscension()
|
||||
: base(9246)
|
||||
{
|
||||
}
|
||||
|
||||
public UrnOfAscension()
|
||||
: base( 9246 ) {
|
||||
}
|
||||
public UrnOfAscension(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public UrnOfAscension( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
public override string DefaultName => "urn of ascension";
|
||||
|
||||
public override bool Use( Mobile from ) {
|
||||
Faction ourFaction = Faction.Find( from );
|
||||
public override bool Use(Mobile from)
|
||||
{
|
||||
Faction ourFaction = Faction.Find(from);
|
||||
|
||||
bool used = false;
|
||||
bool used = false;
|
||||
|
||||
foreach ( Mobile mob in from.GetMobilesInRange( 8 ) ) {
|
||||
if ( mob.Player && !mob.Alive && from.InLOS( mob ) ) {
|
||||
if ( Faction.Find( mob ) != ourFaction ) {
|
||||
continue;
|
||||
}
|
||||
foreach (Mobile mob in from.GetMobilesInRange(8))
|
||||
if (mob.Player && !mob.Alive && from.InLOS(mob))
|
||||
{
|
||||
if (Faction.Find(mob) != ourFaction) continue;
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( mob );
|
||||
BaseHouse house = BaseHouse.FindHouseAt(mob);
|
||||
|
||||
if ( house == null || ( house.IsFriend( from ) || house.IsFriend( mob ) ) ) {
|
||||
Faction.ClearSkillLoss( mob );
|
||||
if (house == null || house.IsFriend(from) || house.IsFriend(mob))
|
||||
{
|
||||
Faction.ClearSkillLoss(mob);
|
||||
|
||||
mob.SendGump( new ResurrectGump( mob, from, ResurrectMessage.Generic ) );
|
||||
used = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
mob.SendGump(new ResurrectGump(mob, from, ResurrectMessage.Generic));
|
||||
used = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( used ) {
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 2219, false, "The urn shatters as you invoke its power." );
|
||||
from.PlaySound( 64 );
|
||||
if (used)
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 2219, false, "The urn shatters as you invoke its power.");
|
||||
from.PlaySound(64);
|
||||
|
||||
Effects.PlaySound( from.Location, from.Map, 1481 );
|
||||
}
|
||||
Effects.PlaySound(from.Location, from.Map, 1481);
|
||||
}
|
||||
|
||||
return used;
|
||||
}
|
||||
return used;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,420 +1,458 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using System.Collections.Generic;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class Sigil : BaseSystemController
|
||||
{
|
||||
public const int OwnershipHue = 0xB;
|
||||
|
||||
// ?? time corrupting faction has to return the sigil before corruption time resets ?
|
||||
public static readonly TimeSpan CorruptionGrace = TimeSpan.FromMinutes( (Core.SE) ? 30.0 : 15.0 );
|
||||
|
||||
// Sigil must be held at a stronghold for this amount of time in order to become corrupted
|
||||
public static readonly TimeSpan CorruptionPeriod = ( (Core.SE) ? TimeSpan.FromHours( 10.0 ) : TimeSpan.FromHours( 24.0 ) );
|
||||
|
||||
// After a sigil has been corrupted it must be returned to the town within this period of time
|
||||
public static readonly TimeSpan ReturnPeriod = TimeSpan.FromHours( 1.0 );
|
||||
|
||||
// Once it's been returned the corrupting faction owns the town for this period of time
|
||||
public static readonly TimeSpan PurificationPeriod = TimeSpan.FromDays( 3.0 );
|
||||
|
||||
private Town m_Town;
|
||||
private Faction m_Corrupted;
|
||||
private Faction m_Corrupting;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public DateTime LastStolen { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public DateTime GraceStart { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public DateTime CorruptionStart { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public DateTime PurificationStart { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public Town Town
|
||||
{
|
||||
get => m_Town;
|
||||
set{ m_Town = value; Update(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public Faction Corrupted
|
||||
{
|
||||
get => m_Corrupted;
|
||||
set{ m_Corrupted = value; Update(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public Faction Corrupting
|
||||
{
|
||||
get => m_Corrupting;
|
||||
set{ m_Corrupting = value; Update(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public BaseMonolith LastMonolith { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public bool IsBeingCorrupted => ( LastMonolith is StrongholdMonolith && LastMonolith.Faction == m_Corrupting && m_Corrupting != null );
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public bool IsCorrupted => ( m_Corrupted != null );
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public bool IsPurifying => ( PurificationStart != DateTime.MinValue );
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public bool IsCorrupting => ( m_Corrupting != null && m_Corrupting != m_Corrupted );
|
||||
|
||||
public void Update()
|
||||
{
|
||||
ItemID = m_Town?.Definition.SigilID ?? 0x1869;
|
||||
|
||||
if ( m_Town == null )
|
||||
AssignName( null );
|
||||
else if ( IsCorrupted || IsPurifying )
|
||||
AssignName( m_Town.Definition.CorruptedSigilName );
|
||||
else
|
||||
AssignName( m_Town.Definition.SigilName );
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
if ( IsCorrupted )
|
||||
TextDefinition.AddTo( list, m_Corrupted.Definition.SigilControl );
|
||||
else
|
||||
list.Add( 1042256 ); // This sigil is not corrupted.
|
||||
|
||||
if ( IsCorrupting )
|
||||
list.Add( 1042257 ); // This sigil is in the process of being corrupted.
|
||||
else if ( IsPurifying )
|
||||
list.Add( 1042258 ); // This sigil has recently been corrupted, and is undergoing purification.
|
||||
else
|
||||
list.Add( 1042259 ); // This sigil is not in the process of being corrupted.
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
if ( IsCorrupted )
|
||||
{
|
||||
if ( m_Corrupted.Definition.SigilControl.Number > 0 )
|
||||
LabelTo( from, m_Corrupted.Definition.SigilControl.Number );
|
||||
else if ( m_Corrupted.Definition.SigilControl.String != null )
|
||||
LabelTo( from, m_Corrupted.Definition.SigilControl.String );
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo( from, 1042256 ); // This sigil is not corrupted.
|
||||
}
|
||||
|
||||
if ( IsCorrupting )
|
||||
LabelTo( from, 1042257 ); // This sigil is in the process of being corrupted.
|
||||
else if ( IsPurifying )
|
||||
LabelTo( from, 1042258 ); // This sigil has been recently corrupted, and is undergoing purification.
|
||||
else
|
||||
LabelTo( from, 1042259 ); // This sigil is not in the process of being corrupted.
|
||||
}
|
||||
|
||||
public override bool CheckLift( Mobile from, Item item, ref LRReason reject )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005225 ); // You must use the stealing skill to pick up the sigil
|
||||
return false;
|
||||
}
|
||||
|
||||
private Mobile FindOwner( object parent )
|
||||
{
|
||||
if ( parent is Item item )
|
||||
return item.RootParent as Mobile;
|
||||
|
||||
if ( parent is Mobile mobile )
|
||||
return mobile;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
base.OnAdded( parent );
|
||||
|
||||
Mobile mob = FindOwner( parent );
|
||||
|
||||
if ( mob != null )
|
||||
mob.SolidHueOverride = OwnershipHue;
|
||||
}
|
||||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
base.OnRemoved( parent );
|
||||
|
||||
Mobile mob = FindOwner( parent );
|
||||
|
||||
if ( mob != null )
|
||||
mob.SolidHueOverride = -1;
|
||||
}
|
||||
|
||||
public Sigil( Town town ) : base( 0x1869 )
|
||||
{
|
||||
Movable = false;
|
||||
Town = town;
|
||||
|
||||
Sigils.Add( this );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.BeginTarget( 1, false, Targeting.TargetFlags.None, Sigil_OnTarget );
|
||||
from.SendLocalizedMessage( 1042251 ); // Click on a sigil monolith or player
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ExistsOn( Mobile mob )
|
||||
{
|
||||
Container pack = mob.Backpack;
|
||||
|
||||
return ( pack?.FindItemByType( typeof( Sigil ) ) != null );
|
||||
}
|
||||
|
||||
private void BeginCorrupting( Faction faction )
|
||||
{
|
||||
m_Corrupting = faction;
|
||||
CorruptionStart = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
private void ClearCorrupting()
|
||||
{
|
||||
m_Corrupting = null;
|
||||
CorruptionStart = DateTime.MinValue;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan TimeUntilCorruption
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( !IsBeingCorrupted )
|
||||
return TimeSpan.Zero;
|
||||
|
||||
TimeSpan ts = ( CorruptionStart + CorruptionPeriod ) - DateTime.UtcNow;
|
||||
|
||||
if ( ts < TimeSpan.Zero )
|
||||
ts = TimeSpan.Zero;
|
||||
|
||||
return ts;
|
||||
}
|
||||
}
|
||||
|
||||
private void Sigil_OnTarget( Mobile from, object obj )
|
||||
{
|
||||
if ( Deleted || !IsChildOf( from.Backpack ) )
|
||||
return;
|
||||
|
||||
#region Give To Mobile
|
||||
if ( obj is Mobile )
|
||||
{
|
||||
if ( obj is PlayerMobile targ )
|
||||
{
|
||||
Faction toFaction = Faction.Find( targ );
|
||||
Faction fromFaction = Faction.Find( from );
|
||||
|
||||
if ( toFaction == null )
|
||||
from.SendLocalizedMessage( 1005223 ); // You cannot give the sigil to someone not in a faction
|
||||
else if ( fromFaction != toFaction )
|
||||
from.SendLocalizedMessage( 1005222 ); // You cannot give the sigil to someone not in your faction
|
||||
else if ( ExistsOn( targ ) )
|
||||
from.SendLocalizedMessage( 1005220 ); // You cannot give this sigil to someone who already has a sigil
|
||||
else if ( !targ.Alive )
|
||||
from.SendLocalizedMessage( 1042248 ); // You cannot give a sigil to a dead person.
|
||||
else if ( from.NetState != null && targ.NetState != null )
|
||||
{
|
||||
Container pack = targ.Backpack;
|
||||
|
||||
pack?.DropItem( this );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1005221 ); //You cannot give the sigil to them
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
else if ( obj is BaseMonolith )
|
||||
{
|
||||
#region Put in Stronghold
|
||||
if ( obj is StrongholdMonolith sm )
|
||||
{
|
||||
if ( sm.Faction == null || sm.Faction != Faction.Find( from ) )
|
||||
from.SendLocalizedMessage( 1042246 ); // You can't place that on an enemy monolith
|
||||
else if ( sm.Town == null || sm.Town != m_Town )
|
||||
from.SendLocalizedMessage( 1042247 ); // That is not the correct faction monolith
|
||||
else
|
||||
{
|
||||
sm.Sigil = this;
|
||||
|
||||
Faction newController = sm.Faction;
|
||||
Faction oldController = m_Corrupting;
|
||||
|
||||
if ( oldController == null )
|
||||
{
|
||||
if ( m_Corrupted != newController )
|
||||
BeginCorrupting( newController );
|
||||
}
|
||||
else if ( GraceStart > DateTime.MinValue && (GraceStart + CorruptionGrace) < DateTime.UtcNow )
|
||||
{
|
||||
if ( m_Corrupted != newController )
|
||||
BeginCorrupting( newController ); // grace time over, reset period
|
||||
else
|
||||
ClearCorrupting();
|
||||
|
||||
GraceStart = DateTime.MinValue;
|
||||
}
|
||||
else if ( newController == oldController )
|
||||
{
|
||||
GraceStart = DateTime.MinValue; // returned within grace period
|
||||
}
|
||||
else if ( GraceStart == DateTime.MinValue )
|
||||
{
|
||||
GraceStart = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
PurificationStart = DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Put in Town
|
||||
else if ( obj is TownMonolith tm )
|
||||
{
|
||||
if ( tm.Town == null || tm.Town != m_Town )
|
||||
from.SendLocalizedMessage( 1042245 ); // This is not the correct town sigil monolith
|
||||
else if ( m_Corrupted == null || m_Corrupted != Faction.Find( from ) )
|
||||
from.SendLocalizedMessage( 1042244 ); // Your faction did not corrupt this sigil. Take it to your stronghold.
|
||||
else
|
||||
{
|
||||
tm.Sigil = this;
|
||||
|
||||
m_Corrupting = null;
|
||||
PurificationStart = DateTime.UtcNow;
|
||||
CorruptionStart = DateTime.MinValue;
|
||||
|
||||
m_Town.Capture( m_Corrupted );
|
||||
m_Corrupted = null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1005224 ); // You can't use the sigil on that
|
||||
}
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
public Sigil( Serial serial ) : base( serial )
|
||||
{
|
||||
Sigils.Add( this );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
Town.WriteReference( writer, m_Town );
|
||||
Faction.WriteReference( writer, m_Corrupted );
|
||||
Faction.WriteReference( writer, m_Corrupting );
|
||||
|
||||
writer.Write( (Item) LastMonolith );
|
||||
|
||||
writer.Write( LastStolen );
|
||||
writer.Write( GraceStart );
|
||||
writer.Write( CorruptionStart );
|
||||
writer.Write( PurificationStart );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Town = Town.ReadReference( reader );
|
||||
m_Corrupted = Faction.ReadReference( reader );
|
||||
m_Corrupting = Faction.ReadReference( reader );
|
||||
|
||||
LastMonolith = reader.ReadItem() as BaseMonolith;
|
||||
|
||||
LastStolen = reader.ReadDateTime();
|
||||
GraceStart = reader.ReadDateTime();
|
||||
CorruptionStart = reader.ReadDateTime();
|
||||
PurificationStart = reader.ReadDateTime();
|
||||
|
||||
Update();
|
||||
|
||||
if ( RootParent is Mobile mob )
|
||||
mob.SolidHueOverride = OwnershipHue;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReturnHome()
|
||||
{
|
||||
BaseMonolith monolith = LastMonolith;
|
||||
|
||||
if ( monolith == null && m_Town != null )
|
||||
monolith = m_Town.Monolith;
|
||||
|
||||
if ( monolith != null && !monolith.Deleted )
|
||||
monolith.Sigil = this;
|
||||
|
||||
return ( monolith != null && !monolith.Deleted );
|
||||
}
|
||||
|
||||
public override void OnParentDeleted(IEntity parent)
|
||||
{
|
||||
base.OnParentDeleted( parent );
|
||||
|
||||
ReturnHome();
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
public class Sigil : BaseSystemController
|
||||
{
|
||||
public const int OwnershipHue = 0xB;
|
||||
|
||||
// ?? time corrupting faction has to return the sigil before corruption time resets ?
|
||||
public static readonly TimeSpan CorruptionGrace = TimeSpan.FromMinutes(Core.SE ? 30.0 : 15.0);
|
||||
|
||||
// Sigil must be held at a stronghold for this amount of time in order to become corrupted
|
||||
public static readonly TimeSpan CorruptionPeriod = Core.SE ? TimeSpan.FromHours(10.0) : TimeSpan.FromHours(24.0);
|
||||
|
||||
// After a sigil has been corrupted it must be returned to the town within this period of time
|
||||
public static readonly TimeSpan ReturnPeriod = TimeSpan.FromHours(1.0);
|
||||
|
||||
// Once it's been returned the corrupting faction owns the town for this period of time
|
||||
public static readonly TimeSpan PurificationPeriod = TimeSpan.FromDays(3.0);
|
||||
private Faction m_Corrupted;
|
||||
private Faction m_Corrupting;
|
||||
|
||||
private Town m_Town;
|
||||
|
||||
public Sigil(Town town) : base(0x1869)
|
||||
{
|
||||
Movable = false;
|
||||
Town = town;
|
||||
|
||||
Sigils.Add(this);
|
||||
}
|
||||
|
||||
public Sigil(Serial serial) : base(serial)
|
||||
{
|
||||
Sigils.Add(this);
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public DateTime LastStolen{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public DateTime GraceStart{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public DateTime CorruptionStart{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public DateTime PurificationStart{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Town Town
|
||||
{
|
||||
get => m_Town;
|
||||
set
|
||||
{
|
||||
m_Town = value;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Faction Corrupted
|
||||
{
|
||||
get => m_Corrupted;
|
||||
set
|
||||
{
|
||||
m_Corrupted = value;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Faction Corrupting
|
||||
{
|
||||
get => m_Corrupting;
|
||||
set
|
||||
{
|
||||
m_Corrupting = value;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public BaseMonolith LastMonolith{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public bool IsBeingCorrupted => LastMonolith is StrongholdMonolith && LastMonolith.Faction == m_Corrupting &&
|
||||
m_Corrupting != null;
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public bool IsCorrupted => m_Corrupted != null;
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public bool IsPurifying => PurificationStart != DateTime.MinValue;
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public bool IsCorrupting => m_Corrupting != null && m_Corrupting != m_Corrupted;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeSpan TimeUntilCorruption
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsBeingCorrupted)
|
||||
return TimeSpan.Zero;
|
||||
|
||||
TimeSpan ts = CorruptionStart + CorruptionPeriod - DateTime.UtcNow;
|
||||
|
||||
if (ts < TimeSpan.Zero)
|
||||
ts = TimeSpan.Zero;
|
||||
|
||||
return ts;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Sigil> Sigils{ get; } = new List<Sigil>();
|
||||
|
||||
public void Update()
|
||||
{
|
||||
ItemID = m_Town?.Definition.SigilID ?? 0x1869;
|
||||
|
||||
if (m_Town == null)
|
||||
AssignName(null);
|
||||
else if (IsCorrupted || IsPurifying)
|
||||
AssignName(m_Town.Definition.CorruptedSigilName);
|
||||
else
|
||||
AssignName(m_Town.Definition.SigilName);
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (IsCorrupted)
|
||||
TextDefinition.AddTo(list, m_Corrupted.Definition.SigilControl);
|
||||
else
|
||||
list.Add(1042256); // This sigil is not corrupted.
|
||||
|
||||
if (IsCorrupting)
|
||||
list.Add(1042257); // This sigil is in the process of being corrupted.
|
||||
else if (IsPurifying)
|
||||
list.Add(1042258); // This sigil has recently been corrupted, and is undergoing purification.
|
||||
else
|
||||
list.Add(1042259); // This sigil is not in the process of being corrupted.
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
if (IsCorrupted)
|
||||
{
|
||||
if (m_Corrupted.Definition.SigilControl.Number > 0)
|
||||
LabelTo(from, m_Corrupted.Definition.SigilControl.Number);
|
||||
else if (m_Corrupted.Definition.SigilControl.String != null)
|
||||
LabelTo(from, m_Corrupted.Definition.SigilControl.String);
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, 1042256); // This sigil is not corrupted.
|
||||
}
|
||||
|
||||
if (IsCorrupting)
|
||||
LabelTo(from, 1042257); // This sigil is in the process of being corrupted.
|
||||
else if (IsPurifying)
|
||||
LabelTo(from, 1042258); // This sigil has been recently corrupted, and is undergoing purification.
|
||||
else
|
||||
LabelTo(from, 1042259); // This sigil is not in the process of being corrupted.
|
||||
}
|
||||
|
||||
public override bool CheckLift(Mobile from, Item item, ref LRReason reject)
|
||||
{
|
||||
from.SendLocalizedMessage(1005225); // You must use the stealing skill to pick up the sigil
|
||||
return false;
|
||||
}
|
||||
|
||||
private Mobile FindOwner(object parent)
|
||||
{
|
||||
if (parent is Item item)
|
||||
return item.RootParent as Mobile;
|
||||
|
||||
if (parent is Mobile mobile)
|
||||
return mobile;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
base.OnAdded(parent);
|
||||
|
||||
Mobile mob = FindOwner(parent);
|
||||
|
||||
if (mob != null)
|
||||
mob.SolidHueOverride = OwnershipHue;
|
||||
}
|
||||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
base.OnRemoved(parent);
|
||||
|
||||
Mobile mob = FindOwner(parent);
|
||||
|
||||
if (mob != null)
|
||||
mob.SolidHueOverride = -1;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack))
|
||||
{
|
||||
from.BeginTarget(1, false, TargetFlags.None, Sigil_OnTarget);
|
||||
from.SendLocalizedMessage(1042251); // Click on a sigil monolith or player
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ExistsOn(Mobile mob)
|
||||
{
|
||||
Container pack = mob.Backpack;
|
||||
|
||||
return pack?.FindItemByType(typeof(Sigil)) != null;
|
||||
}
|
||||
|
||||
private void BeginCorrupting(Faction faction)
|
||||
{
|
||||
m_Corrupting = faction;
|
||||
CorruptionStart = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
private void ClearCorrupting()
|
||||
{
|
||||
m_Corrupting = null;
|
||||
CorruptionStart = DateTime.MinValue;
|
||||
}
|
||||
|
||||
private void Sigil_OnTarget(Mobile from, object obj)
|
||||
{
|
||||
if (Deleted || !IsChildOf(from.Backpack))
|
||||
return;
|
||||
|
||||
#region Give To Mobile
|
||||
|
||||
if (obj is Mobile)
|
||||
{
|
||||
if (obj is PlayerMobile targ)
|
||||
{
|
||||
Faction toFaction = Faction.Find(targ);
|
||||
Faction fromFaction = Faction.Find(from);
|
||||
|
||||
if (toFaction == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1005223); // You cannot give the sigil to someone not in a faction
|
||||
}
|
||||
else if (fromFaction != toFaction)
|
||||
{
|
||||
from.SendLocalizedMessage(1005222); // You cannot give the sigil to someone not in your faction
|
||||
}
|
||||
else if (ExistsOn(targ))
|
||||
{
|
||||
from.SendLocalizedMessage(1005220); // You cannot give this sigil to someone who already has a sigil
|
||||
}
|
||||
else if (!targ.Alive)
|
||||
{
|
||||
from.SendLocalizedMessage(1042248); // You cannot give a sigil to a dead person.
|
||||
}
|
||||
else if (from.NetState != null && targ.NetState != null)
|
||||
{
|
||||
Container pack = targ.Backpack;
|
||||
|
||||
pack?.DropItem(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1005221); //You cannot give the sigil to them
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
else if (obj is BaseMonolith)
|
||||
{
|
||||
#region Put in Stronghold
|
||||
|
||||
if (obj is StrongholdMonolith sm)
|
||||
{
|
||||
if (sm.Faction == null || sm.Faction != Faction.Find(from))
|
||||
{
|
||||
from.SendLocalizedMessage(1042246); // You can't place that on an enemy monolith
|
||||
}
|
||||
else if (sm.Town == null || sm.Town != m_Town)
|
||||
{
|
||||
from.SendLocalizedMessage(1042247); // That is not the correct faction monolith
|
||||
}
|
||||
else
|
||||
{
|
||||
sm.Sigil = this;
|
||||
|
||||
Faction newController = sm.Faction;
|
||||
Faction oldController = m_Corrupting;
|
||||
|
||||
if (oldController == null)
|
||||
{
|
||||
if (m_Corrupted != newController)
|
||||
BeginCorrupting(newController);
|
||||
}
|
||||
else if (GraceStart > DateTime.MinValue && GraceStart + CorruptionGrace < DateTime.UtcNow)
|
||||
{
|
||||
if (m_Corrupted != newController)
|
||||
BeginCorrupting(newController); // grace time over, reset period
|
||||
else
|
||||
ClearCorrupting();
|
||||
|
||||
GraceStart = DateTime.MinValue;
|
||||
}
|
||||
else if (newController == oldController)
|
||||
{
|
||||
GraceStart = DateTime.MinValue; // returned within grace period
|
||||
}
|
||||
else if (GraceStart == DateTime.MinValue)
|
||||
{
|
||||
GraceStart = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
PurificationStart = DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Put in Town
|
||||
|
||||
else if (obj is TownMonolith tm)
|
||||
{
|
||||
if (tm.Town == null || tm.Town != m_Town)
|
||||
{
|
||||
from.SendLocalizedMessage(1042245); // This is not the correct town sigil monolith
|
||||
}
|
||||
else if (m_Corrupted == null || m_Corrupted != Faction.Find(from))
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1042244); // Your faction did not corrupt this sigil. Take it to your stronghold.
|
||||
}
|
||||
else
|
||||
{
|
||||
tm.Sigil = this;
|
||||
|
||||
m_Corrupting = null;
|
||||
PurificationStart = DateTime.UtcNow;
|
||||
CorruptionStart = DateTime.MinValue;
|
||||
|
||||
m_Town.Capture(m_Corrupted);
|
||||
m_Corrupted = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1005224); // You can't use the sigil on that
|
||||
}
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
Town.WriteReference(writer, m_Town);
|
||||
Faction.WriteReference(writer, m_Corrupted);
|
||||
Faction.WriteReference(writer, m_Corrupting);
|
||||
|
||||
writer.Write(LastMonolith);
|
||||
|
||||
writer.Write(LastStolen);
|
||||
writer.Write(GraceStart);
|
||||
writer.Write(CorruptionStart);
|
||||
writer.Write(PurificationStart);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Town = Town.ReadReference(reader);
|
||||
m_Corrupted = Faction.ReadReference(reader);
|
||||
m_Corrupting = Faction.ReadReference(reader);
|
||||
|
||||
LastMonolith = reader.ReadItem() as BaseMonolith;
|
||||
|
||||
LastStolen = reader.ReadDateTime();
|
||||
GraceStart = reader.ReadDateTime();
|
||||
CorruptionStart = reader.ReadDateTime();
|
||||
PurificationStart = reader.ReadDateTime();
|
||||
|
||||
Update();
|
||||
|
||||
if (RootParent is Mobile mob)
|
||||
mob.SolidHueOverride = OwnershipHue;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReturnHome()
|
||||
{
|
||||
BaseMonolith monolith = LastMonolith;
|
||||
|
||||
if (monolith == null && m_Town != null)
|
||||
monolith = m_Town.Monolith;
|
||||
|
||||
if (monolith != null && !monolith.Deleted)
|
||||
monolith.Sigil = this;
|
||||
|
||||
return monolith != null && !monolith.Deleted;
|
||||
}
|
||||
|
||||
public override void OnParentDeleted(IEntity parent)
|
||||
{
|
||||
base.OnParentDeleted(parent);
|
||||
|
||||
ReturnHome();
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
Sigils.Remove(this);
|
||||
}
|
||||
|
||||
Sigils.Remove( this );
|
||||
}
|
||||
public override void Delete()
|
||||
{
|
||||
if (ReturnHome())
|
||||
return;
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
if ( ReturnHome() )
|
||||
return;
|
||||
|
||||
base.Delete();
|
||||
}
|
||||
|
||||
public static List<Sigil> Sigils { get; } = new List<Sigil>();
|
||||
}
|
||||
}
|
||||
base.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +1,51 @@
|
|||
namespace Server.Factions
|
||||
{
|
||||
public class Silver : Item
|
||||
{
|
||||
public override double DefaultWeight => 0.02;
|
||||
public class Silver : Item
|
||||
{
|
||||
[Constructible]
|
||||
public Silver() : this(1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Silver() : this( 1 )
|
||||
{
|
||||
}
|
||||
[Constructible]
|
||||
public Silver(int amountFrom, int amountTo) : this(Utility.RandomMinMax(amountFrom, amountTo))
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Silver( int amountFrom, int amountTo ) : this( Utility.RandomMinMax( amountFrom, amountTo ) )
|
||||
{
|
||||
}
|
||||
[Constructible]
|
||||
public Silver(int amount) : base(0xEF0)
|
||||
{
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Silver( int amount ) : base( 0xEF0 )
|
||||
{
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
}
|
||||
public Silver(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public Silver( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override double DefaultWeight => 0.02;
|
||||
|
||||
public override int GetDropSound()
|
||||
{
|
||||
if ( Amount <= 1 )
|
||||
return 0x2E4;
|
||||
if ( Amount <= 5 )
|
||||
return 0x2E5;
|
||||
return 0x2E6;
|
||||
}
|
||||
public override int GetDropSound()
|
||||
{
|
||||
if (Amount <= 1)
|
||||
return 0x2E4;
|
||||
if (Amount <= 5)
|
||||
return 0x2E5;
|
||||
return 0x2E6;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +1,38 @@
|
|||
namespace Server.Factions
|
||||
{
|
||||
public class StrongholdMonolith : BaseMonolith
|
||||
{
|
||||
public override int DefaultLabelNumber => 1041042; // A Faction Sigil Monolith
|
||||
public class StrongholdMonolith : BaseMonolith
|
||||
{
|
||||
public StrongholdMonolith() : this(null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnTownChanged()
|
||||
{
|
||||
AssignName( Town?.Definition.StrongholdMonolithName );
|
||||
}
|
||||
public StrongholdMonolith(Town town, Faction faction) : base(town, faction)
|
||||
{
|
||||
}
|
||||
|
||||
public StrongholdMonolith() : this( null, null )
|
||||
{
|
||||
}
|
||||
public StrongholdMonolith(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public StrongholdMonolith( Town town, Faction faction ) : base( town, faction )
|
||||
{
|
||||
}
|
||||
public override int DefaultLabelNumber => 1041042; // A Faction Sigil Monolith
|
||||
|
||||
public StrongholdMonolith( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override void OnTownChanged()
|
||||
{
|
||||
AssignName(Town?.Definition.StrongholdMonolithName);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +1,38 @@
|
|||
namespace Server.Factions
|
||||
{
|
||||
public class TownMonolith : BaseMonolith
|
||||
{
|
||||
public override int DefaultLabelNumber => 1041403; // A Faction Town Sigil Monolith
|
||||
public class TownMonolith : BaseMonolith
|
||||
{
|
||||
public TownMonolith() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnTownChanged()
|
||||
{
|
||||
AssignName( Town?.Definition.TownMonolithName );
|
||||
}
|
||||
public TownMonolith(Town town) : base(town, null)
|
||||
{
|
||||
}
|
||||
|
||||
public TownMonolith() : this( null )
|
||||
{
|
||||
}
|
||||
public TownMonolith(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public TownMonolith( Town town ) : base( town, null )
|
||||
{
|
||||
}
|
||||
public override int DefaultLabelNumber => 1041403; // A Faction Town Sigil Monolith
|
||||
|
||||
public TownMonolith( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override void OnTownChanged()
|
||||
{
|
||||
AssignName(Town?.Definition.TownMonolithName);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,83 +2,83 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class TownStone : BaseSystemController
|
||||
{
|
||||
private Town m_Town;
|
||||
public class TownStone : BaseSystemController
|
||||
{
|
||||
private Town m_Town;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public Town Town
|
||||
{
|
||||
get => m_Town;
|
||||
set
|
||||
{
|
||||
m_Town = value;
|
||||
[Constructible]
|
||||
public TownStone() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
AssignName( m_Town?.Definition.TownStoneName );
|
||||
}
|
||||
}
|
||||
[Constructible]
|
||||
public TownStone(Town town) : base(0xEDE)
|
||||
{
|
||||
Movable = false;
|
||||
Town = town;
|
||||
}
|
||||
|
||||
public override string DefaultName => "faction town stone";
|
||||
public TownStone(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public TownStone() : this( null )
|
||||
{
|
||||
}
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Town Town
|
||||
{
|
||||
get => m_Town;
|
||||
set
|
||||
{
|
||||
m_Town = value;
|
||||
|
||||
[Constructible]
|
||||
public TownStone( Town town ) : base( 0xEDE )
|
||||
{
|
||||
Movable = false;
|
||||
Town = town;
|
||||
}
|
||||
AssignName(m_Town?.Definition.TownStoneName);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_Town == null )
|
||||
return;
|
||||
public override string DefaultName => "faction town stone";
|
||||
|
||||
Faction faction = Faction.Find( from );
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Town == null)
|
||||
return;
|
||||
|
||||
if ( faction == null && from.AccessLevel < AccessLevel.GameMaster )
|
||||
return; // TODO: Message?
|
||||
Faction faction = Faction.Find(from);
|
||||
|
||||
if ( m_Town.Owner == null || ( from.AccessLevel < AccessLevel.GameMaster && faction != m_Town.Owner ) )
|
||||
from.SendLocalizedMessage( 1010332 ); // Your faction does not control this town
|
||||
else if ( !m_Town.Owner.IsCommander( from ) )
|
||||
from.SendLocalizedMessage( 1005242 ); // Only faction Leaders can use townstones
|
||||
else if ( FactionGump.Exists( from ) )
|
||||
from.SendLocalizedMessage( 1042160 ); // You already have a faction menu open.
|
||||
else if ( from is PlayerMobile mobile )
|
||||
mobile.SendGump( new TownStoneGump( mobile, m_Town.Owner, m_Town ) );
|
||||
}
|
||||
if (faction == null && from.AccessLevel < AccessLevel.GameMaster)
|
||||
return; // TODO: Message?
|
||||
|
||||
public TownStone( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
if (m_Town.Owner == null || from.AccessLevel < AccessLevel.GameMaster && faction != m_Town.Owner)
|
||||
from.SendLocalizedMessage(1010332); // Your faction does not control this town
|
||||
else if (!m_Town.Owner.IsCommander(from))
|
||||
from.SendLocalizedMessage(1005242); // Only faction Leaders can use townstones
|
||||
else if (FactionGump.Exists(from))
|
||||
from.SendLocalizedMessage(1042160); // You already have a faction menu open.
|
||||
else if (from is PlayerMobile mobile)
|
||||
mobile.SendGump(new TownStoneGump(mobile, m_Town.Owner, m_Town));
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write(0); // version
|
||||
|
||||
Town.WriteReference( writer, m_Town );
|
||||
}
|
||||
Town.WriteReference(writer, m_Town);
|
||||
}
|
||||
|
||||
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 0:
|
||||
{
|
||||
Town = Town.ReadReference( reader );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Town = Town.ReadReference(reader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,264 +4,261 @@ using Server.Network;
|
|||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public enum AllowedPlacing
|
||||
{
|
||||
Everywhere,
|
||||
public enum AllowedPlacing
|
||||
{
|
||||
Everywhere,
|
||||
|
||||
AnyFactionTown,
|
||||
ControlledFactionTown,
|
||||
FactionStronghold
|
||||
}
|
||||
AnyFactionTown,
|
||||
ControlledFactionTown,
|
||||
FactionStronghold
|
||||
}
|
||||
|
||||
public abstract class BaseFactionTrap : BaseTrap
|
||||
{
|
||||
private Timer m_Concealing;
|
||||
public abstract class BaseFactionTrap : BaseTrap
|
||||
{
|
||||
private Timer m_Concealing;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Faction Faction { get; set; }
|
||||
public BaseFactionTrap(Faction f, Mobile m, int itemID) : base(itemID)
|
||||
{
|
||||
Visible = false;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Placer { get; set; }
|
||||
Faction = f;
|
||||
TimeOfPlacement = DateTime.UtcNow;
|
||||
Placer = m;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime TimeOfPlacement { get; set; }
|
||||
public BaseFactionTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual int EffectSound => 0;
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Faction Faction{ get; set; }
|
||||
|
||||
public virtual int SilverFromDisarm => 100;
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Placer{ get; set; }
|
||||
|
||||
public virtual int MessageHue => 0;
|
||||
|
||||
public virtual int AttackMessage => 0;
|
||||
public virtual int DisarmMessage => 0;
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime TimeOfPlacement{ get; set; }
|
||||
|
||||
public virtual AllowedPlacing AllowedPlacing => AllowedPlacing.Everywhere;
|
||||
public virtual int EffectSound => 0;
|
||||
|
||||
public virtual TimeSpan ConcealPeriod => TimeSpan.FromMinutes( 1.0 );
|
||||
public virtual int SilverFromDisarm => 100;
|
||||
|
||||
public virtual TimeSpan DecayPeriod
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( Core.AOS )
|
||||
return TimeSpan.FromDays( 1.0 );
|
||||
public virtual int MessageHue => 0;
|
||||
|
||||
return TimeSpan.MaxValue; // no decay
|
||||
}
|
||||
}
|
||||
public virtual int AttackMessage => 0;
|
||||
public virtual int DisarmMessage => 0;
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( !IsEnemy( from ) )
|
||||
return;
|
||||
public virtual AllowedPlacing AllowedPlacing => AllowedPlacing.Everywhere;
|
||||
|
||||
Conceal();
|
||||
|
||||
DoVisibleEffect();
|
||||
Effects.PlaySound( Location, Map, EffectSound );
|
||||
DoAttackEffect( from );
|
||||
public virtual TimeSpan ConcealPeriod => TimeSpan.FromMinutes(1.0);
|
||||
|
||||
int silverToAward = ( from.Alive ? 20 : 40 );
|
||||
public virtual TimeSpan DecayPeriod
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Core.AOS)
|
||||
return TimeSpan.FromDays(1.0);
|
||||
|
||||
if ( silverToAward > 0 && Placer != null && Faction != null )
|
||||
{
|
||||
PlayerState victimState = PlayerState.Find( from );
|
||||
return TimeSpan.MaxValue; // no decay
|
||||
}
|
||||
}
|
||||
|
||||
if ( victimState != null && victimState.CanGiveSilverTo( Placer ) && victimState.KillPoints > 0 )
|
||||
{
|
||||
int silverGiven = Faction.AwardSilver( Placer, silverToAward );
|
||||
public override void OnTrigger(Mobile from)
|
||||
{
|
||||
if (!IsEnemy(from))
|
||||
return;
|
||||
|
||||
if ( silverGiven > 0 )
|
||||
{
|
||||
// TODO: Get real message
|
||||
if ( from.Alive )
|
||||
Placer.SendMessage( "You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name );
|
||||
else
|
||||
Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
|
||||
}
|
||||
|
||||
victimState.OnGivenSilverTo( Placer );
|
||||
}
|
||||
}
|
||||
|
||||
from.LocalOverheadMessage( MessageType.Regular, MessageHue, AttackMessage );
|
||||
}
|
||||
Conceal();
|
||||
|
||||
public abstract void DoVisibleEffect();
|
||||
public abstract void DoAttackEffect( Mobile m );
|
||||
DoVisibleEffect();
|
||||
Effects.PlaySound(Location, Map, EffectSound);
|
||||
DoAttackEffect(from);
|
||||
|
||||
public virtual int IsValidLocation()
|
||||
{
|
||||
return IsValidLocation( GetWorldLocation(), Map );
|
||||
}
|
||||
int silverToAward = from.Alive ? 20 : 40;
|
||||
|
||||
public virtual int IsValidLocation( Point3D p, Map m )
|
||||
{
|
||||
if ( m == null )
|
||||
return 502956; // You cannot place a trap on that.
|
||||
|
||||
if ( Core.ML )
|
||||
{
|
||||
foreach( Item item in m.GetItemsInRange( p, 0 ) )
|
||||
{
|
||||
if ( item is BaseFactionTrap trap && trap.Faction == Faction )
|
||||
return 1075263; // There is already a trap belonging to your faction at this location.;
|
||||
}
|
||||
}
|
||||
if (silverToAward > 0 && Placer != null && Faction != null)
|
||||
{
|
||||
PlayerState victimState = PlayerState.Find(from);
|
||||
|
||||
switch( AllowedPlacing )
|
||||
{
|
||||
case AllowedPlacing.FactionStronghold:
|
||||
{
|
||||
StrongholdRegion region = (StrongholdRegion) Region.Find( p, m ).GetRegion( typeof( StrongholdRegion ) );
|
||||
if (victimState != null && victimState.CanGiveSilverTo(Placer) && victimState.KillPoints > 0)
|
||||
{
|
||||
int silverGiven = Faction.AwardSilver(Placer, silverToAward);
|
||||
|
||||
if ( region != null && region.Faction == Faction )
|
||||
return 0;
|
||||
if (silverGiven > 0)
|
||||
{
|
||||
// TODO: Get real message
|
||||
if (from.Alive)
|
||||
Placer.SendMessage("You have earned {0} silver pieces because {1} fell for your trap.",
|
||||
silverGiven, from.Name);
|
||||
else
|
||||
Placer.SendLocalizedMessage(1042736,
|
||||
$"{silverGiven} silver\t{from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
|
||||
}
|
||||
|
||||
return 1010355; // This trap can only be placed in your stronghold
|
||||
}
|
||||
case AllowedPlacing.AnyFactionTown:
|
||||
{
|
||||
Town town = Town.FromRegion( Region.Find( p, m ) );
|
||||
victimState.OnGivenSilverTo(Placer);
|
||||
}
|
||||
}
|
||||
|
||||
if ( town != null )
|
||||
return 0;
|
||||
from.LocalOverheadMessage(MessageType.Regular, MessageHue, AttackMessage);
|
||||
}
|
||||
|
||||
return 1010356; // This trap can only be placed in a faction town
|
||||
}
|
||||
case AllowedPlacing.ControlledFactionTown:
|
||||
{
|
||||
Town town = Town.FromRegion( Region.Find( p, m ) );
|
||||
|
||||
if ( town != null && town.Owner == Faction )
|
||||
return 0;
|
||||
|
||||
return 1010357; // This trap can only be placed in a town your faction controls
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
base.OnMovement( m, oldLocation );
|
||||
|
||||
if ( !CheckDecay() && CheckRange( m.Location, oldLocation, 6 ) )
|
||||
{
|
||||
if ( Faction.Find( m ) != null && ((m.Skills[SkillName.DetectHidden].Value - 80.0) / 20.0) > Utility.RandomDouble() )
|
||||
PrivateOverheadLocalizedMessage( m, 1010154, MessageHue, "", "" ); // [Faction Trap]
|
||||
}
|
||||
}
|
||||
public abstract void DoVisibleEffect();
|
||||
public abstract void DoAttackEffect(Mobile m);
|
||||
|
||||
public void PrivateOverheadLocalizedMessage( Mobile to, int number, int hue, string name, string args )
|
||||
{
|
||||
NetState ns = to?.NetState;
|
||||
public virtual int IsValidLocation()
|
||||
{
|
||||
return IsValidLocation(GetWorldLocation(), Map);
|
||||
}
|
||||
|
||||
ns?.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, hue, 3, number, name, args ) );
|
||||
}
|
||||
public virtual int IsValidLocation(Point3D p, Map m)
|
||||
{
|
||||
if (m == null)
|
||||
return 502956; // You cannot place a trap on that.
|
||||
|
||||
public BaseFactionTrap( Faction f, Mobile m, int itemID ) : base( itemID )
|
||||
{
|
||||
Visible = false;
|
||||
|
||||
Faction = f;
|
||||
TimeOfPlacement = DateTime.UtcNow;
|
||||
Placer = m;
|
||||
}
|
||||
|
||||
public BaseFactionTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool CheckDecay()
|
||||
{
|
||||
TimeSpan decayPeriod = DecayPeriod;
|
||||
if (Core.ML)
|
||||
foreach (Item item in m.GetItemsInRange(p, 0))
|
||||
if (item is BaseFactionTrap trap && trap.Faction == Faction)
|
||||
return 1075263; // There is already a trap belonging to your faction at this location.;
|
||||
|
||||
if ( decayPeriod == TimeSpan.MaxValue )
|
||||
return false;
|
||||
switch (AllowedPlacing)
|
||||
{
|
||||
case AllowedPlacing.FactionStronghold:
|
||||
{
|
||||
StrongholdRegion region = (StrongholdRegion)Region.Find(p, m).GetRegion(typeof(StrongholdRegion));
|
||||
|
||||
if ( (TimeOfPlacement + decayPeriod) < DateTime.UtcNow )
|
||||
{
|
||||
Timer.DelayCall( TimeSpan.Zero, Delete );
|
||||
return true;
|
||||
}
|
||||
if (region != null && region.Faction == Faction)
|
||||
return 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
return 1010355; // This trap can only be placed in your stronghold
|
||||
}
|
||||
case AllowedPlacing.AnyFactionTown:
|
||||
{
|
||||
Town town = Town.FromRegion(Region.Find(p, m));
|
||||
|
||||
public virtual void BeginConceal()
|
||||
{
|
||||
m_Concealing?.Stop();
|
||||
if (town != null)
|
||||
return 0;
|
||||
|
||||
m_Concealing = Timer.DelayCall( ConcealPeriod, Conceal );
|
||||
}
|
||||
return 1010356; // This trap can only be placed in a faction town
|
||||
}
|
||||
case AllowedPlacing.ControlledFactionTown:
|
||||
{
|
||||
Town town = Town.FromRegion(Region.Find(p, m));
|
||||
|
||||
public virtual void Conceal()
|
||||
{
|
||||
m_Concealing?.Stop();
|
||||
if (town != null && town.Owner == Faction)
|
||||
return 0;
|
||||
|
||||
m_Concealing = null;
|
||||
return 1010357; // This trap can only be placed in a town your faction controls
|
||||
}
|
||||
}
|
||||
|
||||
if ( !Deleted )
|
||||
Visible = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void OnMovement(Mobile m, Point3D oldLocation)
|
||||
{
|
||||
base.OnMovement(m, oldLocation);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
if (!CheckDecay() && CheckRange(m.Location, oldLocation, 6))
|
||||
if (Faction.Find(m) != null &&
|
||||
(m.Skills[SkillName.DetectHidden].Value - 80.0) / 20.0 > Utility.RandomDouble())
|
||||
PrivateOverheadLocalizedMessage(m, 1010154, MessageHue, "", ""); // [Faction Trap]
|
||||
}
|
||||
|
||||
Faction.WriteReference( writer, Faction );
|
||||
writer.Write( (Mobile) Placer );
|
||||
writer.Write( (DateTime) TimeOfPlacement );
|
||||
public void PrivateOverheadLocalizedMessage(Mobile to, int number, int hue, string name, string args)
|
||||
{
|
||||
NetState ns = to?.NetState;
|
||||
|
||||
if ( Visible )
|
||||
BeginConceal();
|
||||
}
|
||||
ns?.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, hue, 3, number, name, args));
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public virtual bool CheckDecay()
|
||||
{
|
||||
TimeSpan decayPeriod = DecayPeriod;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
if (decayPeriod == TimeSpan.MaxValue)
|
||||
return false;
|
||||
|
||||
Faction = Faction.ReadReference( reader );
|
||||
Placer = reader.ReadMobile();
|
||||
TimeOfPlacement = reader.ReadDateTime();
|
||||
if (TimeOfPlacement + decayPeriod < DateTime.UtcNow)
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.Zero, Delete);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Visible )
|
||||
BeginConceal();
|
||||
return false;
|
||||
}
|
||||
|
||||
CheckDecay();
|
||||
}
|
||||
public virtual void BeginConceal()
|
||||
{
|
||||
m_Concealing?.Stop();
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
if ( Faction != null && Faction.Traps.Contains( this ) )
|
||||
Faction.Traps.Remove( this );
|
||||
m_Concealing = Timer.DelayCall(ConcealPeriod, Conceal);
|
||||
}
|
||||
|
||||
base.OnDelete();
|
||||
}
|
||||
public virtual void Conceal()
|
||||
{
|
||||
m_Concealing?.Stop();
|
||||
|
||||
public virtual bool IsEnemy( Mobile mob )
|
||||
{
|
||||
if ( mob.Hidden && mob.AccessLevel > AccessLevel.Player )
|
||||
return false;
|
||||
m_Concealing = null;
|
||||
|
||||
if ( !mob.Alive || mob.IsDeadBondedPet )
|
||||
return false;
|
||||
if (!Deleted)
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
Faction faction = Faction.Find( mob, true );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
if ( faction == null && mob is BaseFactionGuard guard )
|
||||
faction = guard.Faction;
|
||||
writer.Write(0); // version
|
||||
|
||||
if ( faction == null )
|
||||
return false;
|
||||
Faction.WriteReference(writer, Faction);
|
||||
writer.Write(Placer);
|
||||
writer.Write(TimeOfPlacement);
|
||||
|
||||
return ( faction != Faction );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Visible)
|
||||
BeginConceal();
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Faction = Faction.ReadReference(reader);
|
||||
Placer = reader.ReadMobile();
|
||||
TimeOfPlacement = reader.ReadDateTime();
|
||||
|
||||
if (Visible)
|
||||
BeginConceal();
|
||||
|
||||
CheckDecay();
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
if (Faction != null && Faction.Traps.Contains(this))
|
||||
Faction.Traps.Remove(this);
|
||||
|
||||
base.OnDelete();
|
||||
}
|
||||
|
||||
public virtual bool IsEnemy(Mobile mob)
|
||||
{
|
||||
if (mob.Hidden && mob.AccessLevel > AccessLevel.Player)
|
||||
return false;
|
||||
|
||||
if (!mob.Alive || mob.IsDeadBondedPet)
|
||||
return false;
|
||||
|
||||
Faction faction = Faction.Find(mob, true);
|
||||
|
||||
if (faction == null && mob is BaseFactionGuard guard)
|
||||
faction = guard.Faction;
|
||||
|
||||
if (faction == null)
|
||||
return false;
|
||||
|
||||
return faction != Faction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,109 +1,123 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public abstract class BaseFactionTrapDeed : Item, ICraftable
|
||||
{
|
||||
public abstract Type TrapType{ get; }
|
||||
public abstract class BaseFactionTrapDeed : Item, ICraftable
|
||||
{
|
||||
private Faction m_Faction;
|
||||
|
||||
private Faction m_Faction;
|
||||
public BaseFactionTrapDeed(int itemID) : base(itemID)
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
public BaseFactionTrapDeed(bool createdFromDeed) : this(0x14F0)
|
||||
{
|
||||
}
|
||||
|
||||
if ( m_Faction != null )
|
||||
Hue = m_Faction.Definition.HuePrimary;
|
||||
}
|
||||
}
|
||||
public BaseFactionTrapDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseFactionTrapDeed( int itemID ) : base( itemID )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
public abstract Type TrapType{ get; }
|
||||
|
||||
public BaseFactionTrapDeed( bool createdFromDeed ) : this( 0x14F0 )
|
||||
{
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
|
||||
public BaseFactionTrapDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
if (m_Faction != null)
|
||||
Hue = m_Faction.Definition.HuePrimary;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual BaseFactionTrap Construct( Mobile from )
|
||||
{
|
||||
try{ return Activator.CreateInstance( TrapType, new object[]{ m_Faction, from } ) as BaseFactionTrap; }
|
||||
catch{ return null; }
|
||||
}
|
||||
#region ICraftable Members
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
Faction faction = Faction.Find( from );
|
||||
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue)
|
||||
{
|
||||
ItemID = 0x14F0;
|
||||
Faction = Faction.Find(from);
|
||||
|
||||
if ( faction == null )
|
||||
from.SendLocalizedMessage( 1010353, "", 0x23 ); // Only faction members may place faction traps
|
||||
else if ( faction != m_Faction )
|
||||
from.SendLocalizedMessage( 1010354, "", 0x23 ); // You may only place faction traps created by your faction
|
||||
else if ( faction.Traps.Count >= faction.MaximumTraps )
|
||||
from.SendLocalizedMessage( 1010358, "", 0x23 ); // Your faction already has the maximum number of traps placed
|
||||
else
|
||||
{
|
||||
BaseFactionTrap trap = Construct( from );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( trap == null )
|
||||
return;
|
||||
#endregion
|
||||
|
||||
int message = trap.IsValidLocation( from.Location, from.Map );
|
||||
public virtual BaseFactionTrap Construct(Mobile from)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Activator.CreateInstance(TrapType, m_Faction, from) as BaseFactionTrap;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if ( message > 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( message, "", 0x23 );
|
||||
trap.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1010360 ); // You arm the trap and carefully hide it from view
|
||||
trap.MoveToWorld( from.Location, from.Map );
|
||||
faction.Traps.Add( trap );
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
Faction faction = Faction.Find(from);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
if (faction == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1010353, "", 0x23); // Only faction members may place faction traps
|
||||
}
|
||||
else if (faction != m_Faction)
|
||||
{
|
||||
from.SendLocalizedMessage(1010354, "", 0x23); // You may only place faction traps created by your faction
|
||||
}
|
||||
else if (faction.Traps.Count >= faction.MaximumTraps)
|
||||
{
|
||||
from.SendLocalizedMessage(1010358, "", 0x23); // Your faction already has the maximum number of traps placed
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseFactionTrap trap = Construct(from);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
if (trap == null)
|
||||
return;
|
||||
|
||||
Faction.WriteReference( writer, m_Faction );
|
||||
}
|
||||
int message = trap.IsValidLocation(from.Location, from.Map);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
if (message > 0)
|
||||
{
|
||||
from.SendLocalizedMessage(message, "", 0x23);
|
||||
trap.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1010360); // You arm the trap and carefully hide it from view
|
||||
trap.MoveToWorld(from.Location, from.Map);
|
||||
faction.Traps.Add(trap);
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
m_Faction = Faction.ReadReference( reader );
|
||||
}
|
||||
#region ICraftable Members
|
||||
writer.Write(0); // version
|
||||
|
||||
public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
|
||||
{
|
||||
ItemID = 0x14F0;
|
||||
Faction = Faction.Find( from );
|
||||
Faction.WriteReference(writer, m_Faction);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Faction = Faction.ReadReference(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,83 +2,83 @@ using System;
|
|||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class FactionExplosionTrap : BaseFactionTrap
|
||||
{
|
||||
public override int LabelNumber => 1044599; // faction explosion trap
|
||||
public class FactionExplosionTrap : BaseFactionTrap
|
||||
{
|
||||
[Constructible]
|
||||
public FactionExplosionTrap() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public override int AttackMessage => 1010543; // You are enveloped in an explosion of fire!
|
||||
public override int DisarmMessage => 1010539; // You carefully remove the pressure trigger and disable the trap.
|
||||
public override int EffectSound => 0x307;
|
||||
public override int MessageHue => 0x78;
|
||||
public FactionExplosionTrap(Faction f) : this(f, null)
|
||||
{
|
||||
}
|
||||
|
||||
public override AllowedPlacing AllowedPlacing => AllowedPlacing.AnyFactionTown;
|
||||
public FactionExplosionTrap(Faction f, Mobile m) : base(f, m, 0x11C1)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DoVisibleEffect()
|
||||
{
|
||||
Effects.SendLocationEffect( GetWorldLocation(), Map, 0x36BD, 15, 10 );
|
||||
}
|
||||
public FactionExplosionTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DoAttackEffect( Mobile m )
|
||||
{
|
||||
m.Damage( Utility.Dice( 6, 10, 40 ), m );
|
||||
}
|
||||
public override int LabelNumber => 1044599; // faction explosion trap
|
||||
|
||||
[Constructible]
|
||||
public FactionExplosionTrap() : this( null )
|
||||
{
|
||||
}
|
||||
public override int AttackMessage => 1010543; // You are enveloped in an explosion of fire!
|
||||
public override int DisarmMessage => 1010539; // You carefully remove the pressure trigger and disable the trap.
|
||||
public override int EffectSound => 0x307;
|
||||
public override int MessageHue => 0x78;
|
||||
|
||||
public FactionExplosionTrap( Faction f ) : this( f, null )
|
||||
{
|
||||
}
|
||||
public override AllowedPlacing AllowedPlacing => AllowedPlacing.AnyFactionTown;
|
||||
|
||||
public FactionExplosionTrap( Faction f, Mobile m ) : base( f, m, 0x11C1 )
|
||||
{
|
||||
}
|
||||
public override void DoVisibleEffect()
|
||||
{
|
||||
Effects.SendLocationEffect(GetWorldLocation(), Map, 0x36BD, 15, 10);
|
||||
}
|
||||
|
||||
public FactionExplosionTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override void DoAttackEffect(Mobile m)
|
||||
{
|
||||
m.Damage(Utility.Dice(6, 10, 40), m);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
public class FactionExplosionTrapDeed : BaseFactionTrapDeed
|
||||
{
|
||||
public override Type TrapType => typeof( FactionExplosionTrap );
|
||||
public override int LabelNumber => 1044603; // faction explosion trap deed
|
||||
public class FactionExplosionTrapDeed : BaseFactionTrapDeed
|
||||
{
|
||||
public FactionExplosionTrapDeed() : base(0x36D2)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionExplosionTrapDeed() : base( 0x36D2 )
|
||||
{
|
||||
}
|
||||
public FactionExplosionTrapDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionExplosionTrapDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override Type TrapType => typeof(FactionExplosionTrap);
|
||||
public override int LabelNumber => 1044603; // faction explosion trap deed
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,83 +2,83 @@ using System;
|
|||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class FactionGasTrap : BaseFactionTrap
|
||||
{
|
||||
public override int LabelNumber => 1044598; // faction gas trap
|
||||
public class FactionGasTrap : BaseFactionTrap
|
||||
{
|
||||
[Constructible]
|
||||
public FactionGasTrap() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public override int AttackMessage => 1010542; // A noxious green cloud of poison gas envelops you!
|
||||
public override int DisarmMessage => 502376; // The poison leaks harmlessly away due to your deft touch.
|
||||
public override int EffectSound => 0x230;
|
||||
public override int MessageHue => 0x44;
|
||||
public FactionGasTrap(Faction f) : this(f, null)
|
||||
{
|
||||
}
|
||||
|
||||
public override AllowedPlacing AllowedPlacing => AllowedPlacing.FactionStronghold;
|
||||
public FactionGasTrap(Faction f, Mobile m) : base(f, m, 0x113C)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DoVisibleEffect()
|
||||
{
|
||||
Effects.SendLocationEffect( Location, Map, 0x3709, 28, 10, 0x1D3, 5 );
|
||||
}
|
||||
public FactionGasTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DoAttackEffect( Mobile m )
|
||||
{
|
||||
m.ApplyPoison( m, Poison.Lethal );
|
||||
}
|
||||
public override int LabelNumber => 1044598; // faction gas trap
|
||||
|
||||
[Constructible]
|
||||
public FactionGasTrap() : this( null )
|
||||
{
|
||||
}
|
||||
public override int AttackMessage => 1010542; // A noxious green cloud of poison gas envelops you!
|
||||
public override int DisarmMessage => 502376; // The poison leaks harmlessly away due to your deft touch.
|
||||
public override int EffectSound => 0x230;
|
||||
public override int MessageHue => 0x44;
|
||||
|
||||
public FactionGasTrap( Faction f ) : this( f, null )
|
||||
{
|
||||
}
|
||||
public override AllowedPlacing AllowedPlacing => AllowedPlacing.FactionStronghold;
|
||||
|
||||
public FactionGasTrap( Faction f, Mobile m ) : base( f, m, 0x113C )
|
||||
{
|
||||
}
|
||||
public override void DoVisibleEffect()
|
||||
{
|
||||
Effects.SendLocationEffect(Location, Map, 0x3709, 28, 10, 0x1D3, 5);
|
||||
}
|
||||
|
||||
public FactionGasTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override void DoAttackEffect(Mobile m)
|
||||
{
|
||||
m.ApplyPoison(m, Poison.Lethal);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
public class FactionGasTrapDeed : BaseFactionTrapDeed
|
||||
{
|
||||
public override Type TrapType => typeof( FactionGasTrap );
|
||||
public override int LabelNumber => 1044602; // faction gas trap deed
|
||||
public class FactionGasTrapDeed : BaseFactionTrapDeed
|
||||
{
|
||||
public FactionGasTrapDeed() : base(0x11AB)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionGasTrapDeed() : base( 0x11AB )
|
||||
{
|
||||
}
|
||||
public FactionGasTrapDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionGasTrapDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override Type TrapType => typeof(FactionGasTrap);
|
||||
public override int LabelNumber => 1044602; // faction gas trap deed
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,83 +2,83 @@ using System;
|
|||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class FactionSawTrap : BaseFactionTrap
|
||||
{
|
||||
public override int LabelNumber => 1041047; // faction saw trap
|
||||
public class FactionSawTrap : BaseFactionTrap
|
||||
{
|
||||
[Constructible]
|
||||
public FactionSawTrap() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public override int AttackMessage => 1010544; // The blade cuts deep into your skin!
|
||||
public override int DisarmMessage => 1010540; // You carefully dismantle the saw mechanism and disable the trap.
|
||||
public override int EffectSound => 0x218;
|
||||
public override int MessageHue => 0x5A;
|
||||
public FactionSawTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override AllowedPlacing AllowedPlacing => AllowedPlacing.ControlledFactionTown;
|
||||
public FactionSawTrap(Faction f) : this(f, null)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DoVisibleEffect()
|
||||
{
|
||||
Effects.SendLocationEffect( Location, Map, 0x11AD, 25, 10 );
|
||||
}
|
||||
public FactionSawTrap(Faction f, Mobile m) : base(f, m, 0x11AC)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DoAttackEffect( Mobile m )
|
||||
{
|
||||
m.Damage( Utility.Dice( 6, 10, 40 ), m );
|
||||
}
|
||||
public override int LabelNumber => 1041047; // faction saw trap
|
||||
|
||||
[Constructible]
|
||||
public FactionSawTrap() : this( null )
|
||||
{
|
||||
}
|
||||
public override int AttackMessage => 1010544; // The blade cuts deep into your skin!
|
||||
public override int DisarmMessage => 1010540; // You carefully dismantle the saw mechanism and disable the trap.
|
||||
public override int EffectSound => 0x218;
|
||||
public override int MessageHue => 0x5A;
|
||||
|
||||
public FactionSawTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override AllowedPlacing AllowedPlacing => AllowedPlacing.ControlledFactionTown;
|
||||
|
||||
public FactionSawTrap( Faction f ) : this( f, null )
|
||||
{
|
||||
}
|
||||
public override void DoVisibleEffect()
|
||||
{
|
||||
Effects.SendLocationEffect(Location, Map, 0x11AD, 25, 10);
|
||||
}
|
||||
|
||||
public FactionSawTrap( Faction f, Mobile m ) : base( f, m, 0x11AC )
|
||||
{
|
||||
}
|
||||
public override void DoAttackEffect(Mobile m)
|
||||
{
|
||||
m.Damage(Utility.Dice(6, 10, 40), m);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
public class FactionSawTrapDeed : BaseFactionTrapDeed
|
||||
{
|
||||
public override Type TrapType => typeof( FactionSawTrap );
|
||||
public override int LabelNumber => 1044604; // faction saw trap deed
|
||||
public class FactionSawTrapDeed : BaseFactionTrapDeed
|
||||
{
|
||||
public FactionSawTrapDeed() : base(0x1107)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionSawTrapDeed() : base( 0x1107 )
|
||||
{
|
||||
}
|
||||
public FactionSawTrapDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionSawTrapDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override Type TrapType => typeof(FactionSawTrap);
|
||||
public override int LabelNumber => 1044604; // faction saw trap deed
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,83 +2,86 @@ using System;
|
|||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class FactionSpikeTrap : BaseFactionTrap
|
||||
{
|
||||
public override int LabelNumber => 1044601; // faction spike trap
|
||||
public class FactionSpikeTrap : BaseFactionTrap
|
||||
{
|
||||
[Constructible]
|
||||
public FactionSpikeTrap() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public override int AttackMessage => 1010545; // Large spikes in the ground spring up piercing your skin!
|
||||
public override int DisarmMessage => 1010541; // You carefully dismantle the trigger on the spikes and disable the trap.
|
||||
public override int EffectSound => 0x22E;
|
||||
public override int MessageHue => 0x5A;
|
||||
public FactionSpikeTrap(Faction f) : this(f, null)
|
||||
{
|
||||
}
|
||||
|
||||
public override AllowedPlacing AllowedPlacing => AllowedPlacing.ControlledFactionTown;
|
||||
public FactionSpikeTrap(Faction f, Mobile m) : base(f, m, 0x11A0)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DoVisibleEffect()
|
||||
{
|
||||
Effects.SendLocationEffect( Location, Map, 0x11A4, 12, 6 );
|
||||
}
|
||||
public FactionSpikeTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DoAttackEffect( Mobile m )
|
||||
{
|
||||
m.Damage( Utility.Dice( 6, 10, 40 ), m );
|
||||
}
|
||||
public override int LabelNumber => 1044601; // faction spike trap
|
||||
|
||||
[Constructible]
|
||||
public FactionSpikeTrap() : this( null )
|
||||
{
|
||||
}
|
||||
public override int AttackMessage => 1010545; // Large spikes in the ground spring up piercing your skin!
|
||||
|
||||
public FactionSpikeTrap( Faction f ) : this( f, null )
|
||||
{
|
||||
}
|
||||
public override int DisarmMessage =>
|
||||
1010541; // You carefully dismantle the trigger on the spikes and disable the trap.
|
||||
|
||||
public FactionSpikeTrap( Faction f, Mobile m ) : base( f, m, 0x11A0 )
|
||||
{
|
||||
}
|
||||
public override int EffectSound => 0x22E;
|
||||
public override int MessageHue => 0x5A;
|
||||
|
||||
public FactionSpikeTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override AllowedPlacing AllowedPlacing => AllowedPlacing.ControlledFactionTown;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void DoVisibleEffect()
|
||||
{
|
||||
Effects.SendLocationEffect(Location, Map, 0x11A4, 12, 6);
|
||||
}
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
public override void DoAttackEffect(Mobile m)
|
||||
{
|
||||
m.Damage(Utility.Dice(6, 10, 40), m);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public class FactionSpikeTrapDeed : BaseFactionTrapDeed
|
||||
{
|
||||
public override Type TrapType => typeof( FactionSpikeTrap );
|
||||
public override int LabelNumber => 1044605; // faction spike trap deed
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
public FactionSpikeTrapDeed() : base( 0x11A5 )
|
||||
{
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public FactionSpikeTrapDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public class FactionSpikeTrapDeed : BaseFactionTrapDeed
|
||||
{
|
||||
public FactionSpikeTrapDeed() : base(0x11A5)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public FactionSpikeTrapDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
public override Type TrapType => typeof(FactionSpikeTrap);
|
||||
public override int LabelNumber => 1044605; // faction spike trap deed
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +1,71 @@
|
|||
namespace Server.Factions
|
||||
{
|
||||
public class FactionTrapRemovalKit : Item
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Charges { get; set; }
|
||||
public class FactionTrapRemovalKit : Item
|
||||
{
|
||||
[Constructible]
|
||||
public FactionTrapRemovalKit() : base(7867)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Charges = 25;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041508; // a faction trap removal kit
|
||||
public FactionTrapRemovalKit(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public FactionTrapRemovalKit() : base( 7867 )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Charges = 25;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Charges{ get; set; }
|
||||
|
||||
public void ConsumeCharge( Mobile consumer )
|
||||
{
|
||||
--Charges;
|
||||
public override int LabelNumber => 1041508; // a faction trap removal kit
|
||||
|
||||
if ( Charges <= 0 )
|
||||
{
|
||||
Delete();
|
||||
public void ConsumeCharge(Mobile consumer)
|
||||
{
|
||||
--Charges;
|
||||
|
||||
consumer?.SendLocalizedMessage( 1042531 ); // You have used all of the parts in your trap removal kit.
|
||||
}
|
||||
}
|
||||
if (Charges <= 0)
|
||||
{
|
||||
Delete();
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
consumer?.SendLocalizedMessage(1042531); // You have used all of the parts in your trap removal kit.
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: OSI does not list uses remaining; intentional difference
|
||||
list.Add( 1060584, Charges.ToString() ); // uses remaining: ~1_val~
|
||||
}
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
public FactionTrapRemovalKit( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
// NOTE: OSI does not list uses remaining; intentional difference
|
||||
list.Add(1060584, Charges.ToString()); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
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(1); // version
|
||||
|
||||
writer.WriteEncodedInt( (int) Charges );
|
||||
}
|
||||
writer.WriteEncodedInt(Charges);
|
||||
}
|
||||
|
||||
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:
|
||||
{
|
||||
Charges = reader.ReadEncodedInt();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Charges = 25;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Charges = reader.ReadEncodedInt();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Charges = 25;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue