#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.

This commit is contained in:
WarrentyExpired 2026-08-06 11:06:05 -04:00
parent b51c58f514
commit 3045c83799
3512 changed files with 627673 additions and 0 deletions

View file

@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
namespace Server.Factions
{
public abstract class BaseMonolith : BaseSystemController
{
private Town m_Town;
private Faction m_Faction;
private Sigil m_Sigil;
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public Sigil Sigil
{
get{ return m_Sigil; }
set
{
if ( m_Sigil == value )
return;
m_Sigil = value;
if ( m_Sigil != null && m_Sigil.LastMonolith != null && m_Sigil.LastMonolith != this && m_Sigil.LastMonolith.Sigil == m_Sigil )
m_Sigil.LastMonolith.Sigil = null;
if ( m_Sigil != null )
m_Sigil.LastMonolith = this;
UpdateSigil();
}
}
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public Town Town
{
get{ return m_Town; }
set
{
m_Town = value;
OnTownChanged();
}
}
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public Faction Faction
{
get{ return m_Faction; }
set
{
m_Faction = value;
Hue = ( m_Faction == null ? 0 : m_Faction.Definition.HuePrimary );
}
}
public override void OnLocationChange( Point3D oldLocation )
{
base.OnLocationChange( oldLocation );
UpdateSigil();
}
public override void OnMapChange()
{
base.OnMapChange();
UpdateSigil();
}
public virtual void UpdateSigil()
{
if ( m_Sigil == null || m_Sigil.Deleted )
return;
m_Sigil.MoveToWorld( new Point3D( X, Y, Z + 18 ), Map );
}
public virtual void OnTownChanged()
{
}
public BaseMonolith( Town town, Faction faction ) : base( 0x1183 )
{
Movable = false;
Town = town;
Faction = faction;
m_Monoliths.Add( this );
}
public BaseMonolith( Serial serial ) : base( serial )
{
m_Monoliths.Add( this );
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
m_Monoliths.Remove( this );
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
Town.WriteReference( writer, m_Town );
Faction.WriteReference( writer, m_Faction );
writer.Write( (Item) m_Sigil );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
Town = Town.ReadReference( reader );
Faction = Faction.ReadReference( reader );
m_Sigil = reader.ReadItem() as Sigil;
break;
}
}
}
private static List<BaseMonolith> m_Monoliths = new List<BaseMonolith>();
public static List<BaseMonolith> Monoliths
{
get{ return m_Monoliths; }
set{ m_Monoliths = value; }
}
}
}

View file

@ -0,0 +1,66 @@
using System;
namespace Server.Factions
{
public abstract class BaseSystemController : Item
{
private int m_LabelNumber;
public virtual int DefaultLabelNumber{ get{ return base.LabelNumber; } }
public new virtual string DefaultName{ get{ return null; } }
public override int LabelNumber
{
get
{
if ( m_LabelNumber > 0 )
return m_LabelNumber;
return DefaultLabelNumber;
}
}
public virtual void AssignName( TextDefinition name )
{
if ( name != null && name.Number > 0 )
{
m_LabelNumber = name.Number;
Name = null;
}
else if ( name != null && name.String != null )
{
m_LabelNumber = 0;
Name = name.String;
}
else
{
m_LabelNumber = 0;
Name = DefaultName;
}
InvalidateProperties();
}
public BaseSystemController( int itemID ) : base( itemID )
{
}
public BaseSystemController( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,105 @@
using System;
using Server;
using Server.Mobiles;
using Server.Network;
namespace Server.Factions
{
public class FactionStone : BaseSystemController
{
private Faction m_Faction;
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public Faction Faction
{
get{ return m_Faction; }
set
{
m_Faction = value;
AssignName( m_Faction == null ? null : m_Faction.Definition.FactionStoneName );
}
}
public override string DefaultName { get { return "faction stone"; } }
[Constructable]
public FactionStone() : this( null )
{
}
[Constructable]
public FactionStone( Faction faction ) : base( 0xEDC )
{
Movable = false;
Faction = faction;
}
public override void OnDoubleClick( Mobile from )
{
if ( m_Faction == null )
return;
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 )
{
Faction existingFaction = Faction.Find( from );
if ( existingFaction == m_Faction || from.AccessLevel >= AccessLevel.GameMaster )
{
PlayerState pl = PlayerState.Find( from );
if ( pl != null && pl.IsLeaving )
from.SendLocalizedMessage( 1005051 ); // You cannot use the faction stone until you have finished quitting your current faction
else
from.SendGump( new FactionStoneGump( (PlayerMobile) from, m_Faction ) );
}
else if ( existingFaction != null )
{
// TODO: Validate
from.SendLocalizedMessage( 1005053 ); // This is not your faction stone!
}
else
{
from.SendGump( new JoinStoneGump( (PlayerMobile) from, m_Faction ) );
}
}
}
public FactionStone( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
Faction.WriteReference( writer, m_Faction );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
Faction = Faction.ReadReference( reader );
break;
}
}
}
}
}

View file

@ -0,0 +1,81 @@
using System;
using Server;
using Server.Mobiles;
using Server.Network;
namespace Server.Factions
{
public class JoinStone : BaseSystemController
{
private Faction m_Faction;
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public Faction Faction
{
get{ return m_Faction; }
set
{
m_Faction = value;
Hue = ( m_Faction == null ? 0 : m_Faction.Definition.HueJoin );
AssignName( m_Faction == null ? null : m_Faction.Definition.SignupName );
}
}
public override string DefaultName { get { return "faction signup stone"; } }
[Constructable]
public JoinStone() : this( null )
{
}
[Constructable]
public JoinStone( Faction faction ) : base( 0xEDC )
{
Movable = false;
Faction = faction;
}
public override void OnDoubleClick( Mobile from )
{
if ( m_Faction == null )
return;
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 )
from.SendGump( new JoinStoneGump( (PlayerMobile) from, m_Faction ) );
}
public JoinStone( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
Faction.WriteReference( writer, m_Faction );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
Faction = Faction.ReadReference( reader );
break;
}
}
}
}
}

View file

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Text;
using Server;
using Server.Mobiles;
using Server.Factions;
namespace Server {
public sealed class BloodRose : PowerFactionItem {
public override string DefaultName {
get {
return "blood rose";
}
}
public BloodRose()
: base( Utility.RandomList( 6378, 9035 ) ) {
Hue = 2118;
}
public BloodRose( Serial serial )
: base( serial ) {
}
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 );
}
int amount = Utility.Dice( 3, 3, 3 );
int time = Utility.RandomMinMax( 5, 30 );
from.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist );
from.PlaySound( 0x1EE );
from.AddStatMod( new StatMod( StatType.All, "blood-rose", amount, TimeSpan.FromMinutes( time ) ) );
return true;
} else {
from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.
return false;
}
}
public override void Serialize( GenericWriter writer ) {
base.Serialize( writer );
writer.WriteEncodedInt( ( int ) 0 ); // version
}
public override void Deserialize( GenericReader reader ) {
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
}
}
}

View file

@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Text;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Mobiles;
using Server.Factions;
namespace Server {
public sealed class ClarityPotion : PowerFactionItem {
public override string DefaultName {
get {
return "clarity potion";
}
}
public ClarityPotion()
: base( 3628 ) {
Hue = 1154;
}
public ClarityPotion( Serial serial )
: base( serial ) {
}
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 );
if ( from.Body.IsHuman ) {
from.Animate( 34, 5, 1, true, false, 0 );
}
from.FixedParticles( 0x375A, 10, 15, 5011, EffectLayer.Head );
from.PlaySound( 0x1EB );
StatMod mod = from.GetStatMod( "Concussion" );
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 ) ) );
Timer.DelayCall( TimeSpan.FromMinutes( time ), delegate() {
from.EndAction( typeof( ClarityPotion ) );
} );
return true;
}
return false;
}
public override void Serialize( GenericWriter writer ) {
base.Serialize( writer );
writer.WriteEncodedInt( ( int ) 0 ); // version
}
public override void Deserialize( GenericReader reader ) {
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
}
}
}

View file

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Mobiles;
using Server.Factions;
namespace Server {
public sealed class GemOfEmpowerment : PowerFactionItem {
public override string DefaultName {
get {
return "gem of empowerment";
}
}
public GemOfEmpowerment()
: base( 7955 ) {
Hue = 1154;
}
public GemOfEmpowerment( Serial serial )
: base( serial ) {
}
public override bool Use( Mobile from ) {
if ( Faction.ClearSkillLoss( from ) ) {
from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2219, false, "The gem shatters as you invoke its power." );
from.PlaySound( 909 );
from.FixedEffect( 0x373A, 10, 30 );
from.PlaySound( 0x209 );
return true;
}
return false;
}
public override void Serialize( GenericWriter writer ) {
base.Serialize( writer );
writer.WriteEncodedInt( ( int ) 0 ); // version
}
public override void Deserialize( GenericReader reader ) {
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
}
}
}

View file

@ -0,0 +1,165 @@
using System;
using System.Collections.Generic;
using System.Text;
using Server;
using Server.Mobiles;
using Server.Factions;
using System.IO;
namespace Server {
public abstract class PowerFactionItem : Item {
public abstract bool Use( Mobile mob );
private sealed class DestructionTimer : Timer {
private Mobile _mobile;
private bool _screamed;
public DestructionTimer( Mobile mob )
: base( TimeSpan.FromSeconds( 5 ), TimeSpan.FromSeconds( 0.1 ), 10 ) {
_mobile = mob;
}
protected override void OnTick() {
if ( _mobile.Alive ) {
if ( !_screamed ) {
_screamed = true;
_mobile.PlaySound( _mobile.Female ? 814 : 1088 );
_mobile.PublicOverheadMessage( Server.Network.MessageType.Regular, 2118, false, "Aaaaah!" );
}
_mobile.Damage( Utility.Dice( 2, 6, 0 ) );
}
}
}
private sealed class WeightedItem {
private int _weight;
private Type _type;
public int Weight {
get {
return _weight;
}
}
public Type Type {
get {
return _type;
}
}
public WeightedItem( int weight, Type type ) {
_weight = weight;
_type = type;
}
public Item Construct() {
return Activator.CreateInstance( _type ) as 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 ) )
};
public static void CheckSpawn( Mobile killer, Mobile victim ) {
if ( killer != null && victim != null ) {
PlayerState ps = PlayerState.Find( victim );
if ( ps != null ) {
int chance = ps.Rank.Rank;
if ( chance > Utility.Random( 100 ) ) {
int weight = 0;
foreach ( WeightedItem item in _items ) {
weight += item.Weight;
}
weight = Utility.Random( weight );
foreach ( WeightedItem item in _items ) {
if ( weight < item.Weight ) {
Item obj = item.Construct();
if ( obj != null ) {
killer.AddToBackpack( obj );
killer.SendSound( 1470 );
killer.LocalOverheadMessage(
Server.Network.MessageType.Regular, 2119, false,
"You notice a strange item on the corpse, and decide to pick it up."
);
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 {
}
}
break;
} else {
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 && ((PlayerMobile)from).DuelContext != null ) {
from.SendMessage( "You can't use that." );
} else if ( Faction.Find( from ) == null ) {
from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2119, false, "The object vanishes from your hands as you touch it." );
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), delegate() {
from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2118, false, "You feel a strange tingling sensation throughout your body." );
} );
Timer.DelayCall( TimeSpan.FromSeconds( 4.0 ), delegate() {
from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2118, false, "Your skin begins to burn." );
} );
new DestructionTimer( from ).Start();
Delete();
//from.SendMessage( "You must be in a faction to use this item." );
} else if ( Use( from ) ) {
from.RevealingAction();
Consume();
}
}
public PowerFactionItem( int itemId )
: base( itemId ) {
}
public PowerFactionItem( Serial serial )
: base( serial ) {
}
public override void Serialize( GenericWriter writer ) {
base.Serialize( writer );
writer.WriteEncodedInt( ( int ) 0 ); // version
}
public override void Deserialize( GenericReader reader ) {
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
}
}
}

View file

@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.Text;
using Server;
using Server.Spells;
using Server.Gumps;
using Server.Multis;
using Server.Mobiles;
using Server.Factions;
namespace Server {
public sealed class StormsEye : PowerFactionItem {
public override string DefaultName {
get {
return "storms eye";
}
}
public StormsEye()
: base( 3967 ) {
Hue = 1165;
}
public StormsEye( Serial serial )
: base( serial ) {
}
public override bool Use( Mobile user ) {
if ( this.Movable ) {
user.BeginTarget( 12, true, Server.Targeting.TargetFlags.None, delegate( Mobile from, object obj ) {
if ( this.Movable && !this.Deleted ) {
IPoint3D pt = obj as IPoint3D;
if ( pt != null ) {
SpellHelper.GetSurfaceTop( ref pt );
Point3D origin = new Point3D( pt );
Map facet = from.Map;
if ( facet != null && facet.CanFit( pt.X, pt.Y, pt.Z, 16, false, false, true ) ) {
this.Movable = false;
Effects.SendMovingEffect(
from, new Entity( Serial.Zero, origin, facet ),
this.ItemID & 0x3FFF, 7, 0, false, false, this.Hue - 1, 0
);
Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), delegate() {
this.Delete();
Effects.PlaySound( origin, facet, 530 );
Effects.PlaySound( origin, facet, 263 );
Effects.SendLocationEffect(
origin, facet,
14284, 96, 1, 0, 2
);
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 targets ) {
int damage = ( mob.Hits * 6 ) / 10;
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
);
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 );
Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), delegate() {
mob.PlaySound( 0x1FB );
} );
}
} );
} );
}
}
}
} );
}
return false;
}
public override void Serialize( GenericWriter writer ) {
base.Serialize( writer );
writer.WriteEncodedInt( ( int ) 0 ); // version
}
public override void Deserialize( GenericReader reader ) {
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
}
}
}

View file

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Text;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Mobiles;
using Server.Factions;
namespace Server {
public sealed class UrnOfAscension : PowerFactionItem {
public override string DefaultName {
get {
return "urn of ascension";
}
}
public UrnOfAscension()
: base( 9246 ) {
}
public UrnOfAscension( Serial serial )
: base( serial ) {
}
public override bool Use( Mobile from ) {
Faction ourFaction = Faction.Find( from );
bool used = false;
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 );
if ( house == null || ( house.IsFriend( from ) || house.IsFriend( mob ) ) ) {
Faction.ClearSkillLoss( mob );
mob.SendGump( new ResurrectGump( mob, from, ResurrectMessage.Generic ) );
used = true;
}
}
}
if ( used ) {
from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2219, false, "The urn shatters as you invoke its power." );
from.PlaySound( 64 );
Effects.PlaySound( from.Location, from.Map, 1481 );
}
return used;
}
public override void Serialize( GenericWriter writer ) {
base.Serialize( writer );
writer.WriteEncodedInt( ( int ) 0 ); // version
}
public override void Deserialize( GenericReader reader ) {
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
}
}
}

View file

@ -0,0 +1,471 @@
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using System.Collections.Generic;
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 BaseMonolith m_LastMonolith;
private Town m_Town;
private Faction m_Corrupted;
private Faction m_Corrupting;
private DateTime m_LastStolen;
private DateTime m_GraceStart;
private DateTime m_CorruptionStart;
private DateTime m_PurificationStart;
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public DateTime LastStolen
{
get{ return m_LastStolen; }
set{ m_LastStolen = value; }
}
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public DateTime GraceStart
{
get{ return m_GraceStart; }
set{ m_GraceStart = value; }
}
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public DateTime CorruptionStart
{
get{ return m_CorruptionStart; }
set{ m_CorruptionStart = value; }
}
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public DateTime PurificationStart
{
get{ return m_PurificationStart; }
set{ m_PurificationStart = value; }
}
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public Town Town
{
get{ return m_Town; }
set{ m_Town = value; Update(); }
}
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public Faction Corrupted
{
get{ return m_Corrupted; }
set{ m_Corrupted = value; Update(); }
}
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public Faction Corrupting
{
get{ return m_Corrupting; }
set{ m_Corrupting = value; Update(); }
}
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public BaseMonolith LastMonolith
{
get{ return m_LastMonolith; }
set{ m_LastMonolith = value; }
}
[CommandProperty( AccessLevel.Counselor )]
public bool IsBeingCorrupted
{
get{ return ( m_LastMonolith is StrongholdMonolith && m_LastMonolith.Faction == m_Corrupting && m_Corrupting != null ); }
}
[CommandProperty( AccessLevel.Counselor )]
public bool IsCorrupted
{
get{ return ( m_Corrupted != null ); }
}
[CommandProperty( AccessLevel.Counselor )]
public bool IsPurifying
{
get{ return ( m_PurificationStart != DateTime.MinValue ); }
}
[CommandProperty( AccessLevel.Counselor )]
public bool IsCorrupting
{
get{ return ( m_Corrupting != null && m_Corrupting != m_Corrupted ); }
}
public void Update()
{
ItemID = ( m_Town == null ? 0x1869 : m_Town.Definition.SigilID );
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 )
return ((Item)parent).RootParent as Mobile;
if ( parent is Mobile )
return (Mobile) parent;
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;
m_Sigils.Add( this );
}
public override void OnDoubleClick( Mobile from )
{
if ( IsChildOf( from.Backpack ) )
{
from.BeginTarget( 1, false, Targeting.TargetFlags.None, new TargetCallback( Sigil_OnTarget ) );
from.SendLocalizedMessage( 1042251 ); // Click on a sigil monolith or player
}
}
public static bool ExistsOn( Mobile mob )
{
Container pack = mob.Backpack;
return ( pack != null && pack.FindItemByType( typeof( Sigil ) ) != null );
}
private void BeginCorrupting( Faction faction )
{
m_Corrupting = faction;
m_CorruptionStart = DateTime.UtcNow;
}
private void ClearCorrupting()
{
m_Corrupting = null;
m_CorruptionStart = DateTime.MinValue;
}
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan TimeUntilCorruption
{
get
{
if ( !IsBeingCorrupted )
return TimeSpan.Zero;
TimeSpan ts = ( m_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 )
{
PlayerMobile targ = (PlayerMobile)obj;
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 ( Sigil.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;
if ( pack != null )
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 )
{
StrongholdMonolith m = (StrongholdMonolith)obj;
if ( m.Faction == null || m.Faction != Faction.Find( from ) )
from.SendLocalizedMessage( 1042246 ); // You can't place that on an enemy monolith
else if ( m.Town == null || m.Town != m_Town )
from.SendLocalizedMessage( 1042247 ); // That is not the correct faction monolith
else
{
m.Sigil = this;
Faction newController = m.Faction;
Faction oldController = m_Corrupting;
if ( oldController == null )
{
if ( m_Corrupted != newController )
BeginCorrupting( newController );
}
else if ( m_GraceStart > DateTime.MinValue && (m_GraceStart + CorruptionGrace) < DateTime.UtcNow )
{
if ( m_Corrupted != newController )
BeginCorrupting( newController ); // grace time over, reset period
else
ClearCorrupting();
m_GraceStart = DateTime.MinValue;
}
else if ( newController == oldController )
{
m_GraceStart = DateTime.MinValue; // returned within grace period
}
else if ( m_GraceStart == DateTime.MinValue )
{
m_GraceStart = DateTime.UtcNow;
}
m_PurificationStart = DateTime.MinValue;
}
}
#endregion
#region Put in Town
else if ( obj is TownMonolith )
{
TownMonolith m = (TownMonolith)obj;
if ( m.Town == null || m.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
{
m.Sigil = this;
m_Corrupting = null;
m_PurificationStart = DateTime.UtcNow;
m_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 )
{
m_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) m_LastMonolith );
writer.Write( m_LastStolen );
writer.Write( m_GraceStart );
writer.Write( m_CorruptionStart );
writer.Write( m_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 );
m_LastMonolith = reader.ReadItem() as BaseMonolith;
m_LastStolen = reader.ReadDateTime();
m_GraceStart = reader.ReadDateTime();
m_CorruptionStart = reader.ReadDateTime();
m_PurificationStart = reader.ReadDateTime();
Update();
Mobile mob = RootParent as Mobile;
if ( mob != null )
mob.SolidHueOverride = OwnershipHue;
break;
}
}
}
public bool ReturnHome()
{
BaseMonolith monolith = m_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();
m_Sigils.Remove( this );
}
public override void Delete()
{
if ( ReturnHome() )
return;
base.Delete();
}
private static List<Sigil> m_Sigils = new List<Sigil>();
public static List<Sigil> Sigils{ get{ return m_Sigils; } }
}
}

View file

@ -0,0 +1,58 @@
using System;
using Server;
namespace Server.Factions
{
public class Silver : Item
{
public override double DefaultWeight
{
get { return 0.02; }
}
[Constructable]
public Silver() : this( 1 )
{
}
[Constructable]
public Silver( int amountFrom, int amountTo ) : this( Utility.RandomMinMax( amountFrom, amountTo ) )
{
}
[Constructable]
public Silver( int amount ) : base( 0xEF0 )
{
Stackable = true;
Amount = amount;
}
public Silver( Serial serial ) : base( serial )
{
}
public override int GetDropSound()
{
if ( Amount <= 1 )
return 0x2E4;
else if ( Amount <= 5 )
return 0x2E5;
else
return 0x2E6;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,40 @@
using System;
namespace Server.Factions
{
public class StrongholdMonolith : BaseMonolith
{
public override int DefaultLabelNumber{ get{ return 1041042; } } // A Faction Sigil Monolith
public override void OnTownChanged()
{
AssignName( Town == null ? null : Town.Definition.StrongholdMonolithName );
}
public StrongholdMonolith() : this( null, null )
{
}
public StrongholdMonolith( Town town, Faction faction ) : base( town, faction )
{
}
public StrongholdMonolith( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,40 @@
using System;
namespace Server.Factions
{
public class TownMonolith : BaseMonolith
{
public override int DefaultLabelNumber{ get{ return 1041403; } } // A Faction Town Sigil Monolith
public override void OnTownChanged()
{
AssignName( Town == null ? null : Town.Definition.TownMonolithName );
}
public TownMonolith() : this( null )
{
}
public TownMonolith( Town town ) : base( town, null )
{
}
public TownMonolith( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,87 @@
using System;
using Server;
using Server.Mobiles;
using Server.Network;
namespace Server.Factions
{
public class TownStone : BaseSystemController
{
private Town m_Town;
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
public Town Town
{
get{ return m_Town; }
set
{
m_Town = value;
AssignName( m_Town == null ? null : m_Town.Definition.TownStoneName );
}
}
public override string DefaultName { get { return "faction town stone"; } }
[Constructable]
public TownStone() : this( null )
{
}
[Constructable]
public TownStone( Town town ) : base( 0xEDE )
{
Movable = false;
Town = town;
}
public override void OnDoubleClick( Mobile from )
{
if ( m_Town == null )
return;
Faction faction = Faction.Find( from );
if ( faction == null && from.AccessLevel < AccessLevel.GameMaster )
return; // TODO: Message?
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 )
from.SendGump( new TownStoneGump( (PlayerMobile)from, m_Town.Owner, m_Town ) );
}
public TownStone( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
Town.WriteReference( writer, m_Town );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
Town = Town.ReadReference( reader );
break;
}
}
}
}
}

View file

@ -0,0 +1,294 @@
using System;
using Server;
using Server.Items;
using Server.Network;
using Server.Regions;
namespace Server.Factions
{
public enum AllowedPlacing
{
Everywhere,
AnyFactionTown,
ControlledFactionTown,
FactionStronghold
}
public abstract class BaseFactionTrap : BaseTrap
{
private Faction m_Faction;
private Mobile m_Placer;
private DateTime m_TimeOfPlacement;
private Timer m_Concealing;
[CommandProperty( AccessLevel.GameMaster )]
public Faction Faction
{
get{ return m_Faction; }
set{ m_Faction = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Placer
{
get{ return m_Placer; }
set{ m_Placer = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public DateTime TimeOfPlacement
{
get{ return m_TimeOfPlacement; }
set{ m_TimeOfPlacement = value; }
}
public virtual int EffectSound{ get{ return 0; } }
public virtual int SilverFromDisarm{ get{ return 100; } }
public virtual int MessageHue{ get{ return 0; } }
public virtual int AttackMessage{ get{ return 0; } }
public virtual int DisarmMessage{ get{ return 0; } }
public virtual AllowedPlacing AllowedPlacing{ get{ return AllowedPlacing.Everywhere; } }
public virtual TimeSpan ConcealPeriod
{
get{ return TimeSpan.FromMinutes( 1.0 ); }
}
public virtual TimeSpan DecayPeriod
{
get
{
if ( Core.AOS )
return TimeSpan.FromDays( 1.0 );
return TimeSpan.MaxValue; // no decay
}
}
public override void OnTrigger( Mobile from )
{
if ( !IsEnemy( from ) )
return;
Conceal();
DoVisibleEffect();
Effects.PlaySound( this.Location, this.Map, this.EffectSound );
DoAttackEffect( from );
int silverToAward = ( from.Alive ? 20 : 40 );
if ( silverToAward > 0 && m_Placer != null && m_Faction != null )
{
PlayerState victimState = PlayerState.Find( from );
if ( victimState != null && victimState.CanGiveSilverTo( m_Placer ) && victimState.KillPoints > 0 )
{
int silverGiven = m_Faction.AwardSilver( m_Placer, silverToAward );
if ( silverGiven > 0 )
{
// TODO: Get real message
if ( from.Alive )
m_Placer.SendMessage( "You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name );
else
m_Placer.SendLocalizedMessage( 1042736, String.Format( "{0} silver\t{1}", silverGiven, from.Name ) ); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
}
victimState.OnGivenSilverTo( m_Placer );
}
}
from.LocalOverheadMessage( MessageType.Regular, MessageHue, AttackMessage );
}
public abstract void DoVisibleEffect();
public abstract void DoAttackEffect( Mobile m );
public virtual int IsValidLocation()
{
return IsValidLocation( GetWorldLocation(), Map );
}
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 && ((BaseFactionTrap)item).Faction == this.Faction )
return 1075263; // There is already a trap belonging to your faction at this location.;
}
}
switch( AllowedPlacing )
{
case AllowedPlacing.FactionStronghold:
{
StrongholdRegion region = (StrongholdRegion) Region.Find( p, m ).GetRegion( typeof( StrongholdRegion ) );
if ( region != null && region.Faction == m_Faction )
return 0;
return 1010355; // This trap can only be placed in your stronghold
}
case AllowedPlacing.AnyFactionTown:
{
Town town = Town.FromRegion( Region.Find( p, m ) );
if ( town != null )
return 0;
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 == m_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 void PrivateOverheadLocalizedMessage( Mobile to, int number, int hue, string name, string args )
{
if ( to == null )
return;
NetState ns = to.NetState;
if ( ns != null )
ns.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, hue, 3, number, name, args ) );
}
public BaseFactionTrap( Faction f, Mobile m, int itemID ) : base( itemID )
{
Visible = false;
m_Faction = f;
m_TimeOfPlacement = DateTime.UtcNow;
m_Placer = m;
}
public BaseFactionTrap( Serial serial ) : base( serial )
{
}
public virtual bool CheckDecay()
{
TimeSpan decayPeriod = DecayPeriod;
if ( decayPeriod == TimeSpan.MaxValue )
return false;
if ( (m_TimeOfPlacement + decayPeriod) < DateTime.UtcNow )
{
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Delete ) );
return true;
}
return false;
}
public virtual void BeginConceal()
{
if ( m_Concealing != null )
m_Concealing.Stop();
m_Concealing = Timer.DelayCall( ConcealPeriod, new TimerCallback( Conceal ) );
}
public virtual void Conceal()
{
if ( m_Concealing != null )
m_Concealing.Stop();
m_Concealing = null;
if ( !Deleted )
Visible = false;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
Faction.WriteReference( writer, m_Faction );
writer.Write( (Mobile) m_Placer );
writer.Write( (DateTime) m_TimeOfPlacement );
if ( Visible )
BeginConceal();
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_Faction = Faction.ReadReference( reader );
m_Placer = reader.ReadMobile();
m_TimeOfPlacement = reader.ReadDateTime();
if ( Visible )
BeginConceal();
CheckDecay();
}
public override void OnDelete()
{
if ( m_Faction != null && m_Faction.Traps.Contains( this ) )
m_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 )
faction = ((BaseFactionGuard)mob).Faction;
if ( faction == null )
return false;
return ( faction != m_Faction );
}
}
}

View file

@ -0,0 +1,112 @@
using System;
using Server.Mobiles;
using Server.Targeting;
using Server.Items;
using Server;
using Server.Engines.Craft;
namespace Server.Factions
{
public abstract class BaseFactionTrapDeed : Item, ICraftable
{
public abstract Type TrapType{ get; }
private Faction m_Faction;
[CommandProperty( AccessLevel.GameMaster )]
public Faction Faction
{
get{ return m_Faction; }
set
{
m_Faction = value;
if ( m_Faction != null )
Hue = m_Faction.Definition.HuePrimary;
}
}
public BaseFactionTrapDeed( int itemID ) : base( itemID )
{
Weight = 1.0;
LootType = LootType.Blessed;
}
public BaseFactionTrapDeed( bool createdFromDeed ) : this( 0x14F0 )
{
}
public BaseFactionTrapDeed( Serial serial ) : base( serial )
{
}
public virtual BaseFactionTrap Construct( Mobile from )
{
try{ return Activator.CreateInstance( TrapType, new object[]{ m_Faction, from } ) as BaseFactionTrap; }
catch{ return null; }
}
public override void OnDoubleClick( Mobile from )
{
Faction 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 );
if ( trap == null )
return;
int message = trap.IsValidLocation( from.Location, from.Map );
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 Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
Faction.WriteReference( writer, m_Faction );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_Faction = Faction.ReadReference( reader );
}
#region ICraftable Members
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 );
return 1;
}
#endregion
}
}

View file

@ -0,0 +1,85 @@
using System;
using Server;
namespace Server.Factions
{
public class FactionExplosionTrap : BaseFactionTrap
{
public override int LabelNumber{ get{ return 1044599; } } // faction explosion trap
public override int AttackMessage{ get{ return 1010543; } } // You are enveloped in an explosion of fire!
public override int DisarmMessage{ get{ return 1010539; } } // You carefully remove the pressure trigger and disable the trap.
public override int EffectSound{ get{ return 0x307; } }
public override int MessageHue{ get{ return 0x78; } }
public override AllowedPlacing AllowedPlacing{ get{ return AllowedPlacing.AnyFactionTown; } }
public override void DoVisibleEffect()
{
Effects.SendLocationEffect( GetWorldLocation(), Map, 0x36BD, 15, 10 );
}
public override void DoAttackEffect( Mobile m )
{
m.Damage( Utility.Dice( 6, 10, 40 ), m );
}
[Constructable]
public FactionExplosionTrap() : this( null )
{
}
public FactionExplosionTrap( Faction f ) : this( f, null )
{
}
public FactionExplosionTrap( Faction f, Mobile m ) : base( f, m, 0x11C1 )
{
}
public FactionExplosionTrap( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class FactionExplosionTrapDeed : BaseFactionTrapDeed
{
public override Type TrapType{ get{ return typeof( FactionExplosionTrap ); } }
public override int LabelNumber{ get{ return 1044603; } } // faction explosion trap deed
public FactionExplosionTrapDeed() : base( 0x36D2 )
{
}
public FactionExplosionTrapDeed( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,85 @@
using System;
using Server;
namespace Server.Factions
{
public class FactionGasTrap : BaseFactionTrap
{
public override int LabelNumber{ get{ return 1044598; } } // faction gas trap
public override int AttackMessage{ get{ return 1010542; } } // A noxious green cloud of poison gas envelops you!
public override int DisarmMessage{ get{ return 502376; } } // The poison leaks harmlessly away due to your deft touch.
public override int EffectSound{ get{ return 0x230; } }
public override int MessageHue{ get{ return 0x44; } }
public override AllowedPlacing AllowedPlacing{ get{ return AllowedPlacing.FactionStronghold; } }
public override void DoVisibleEffect()
{
Effects.SendLocationEffect( this.Location, this.Map, 0x3709, 28, 10, 0x1D3, 5 );
}
public override void DoAttackEffect( Mobile m )
{
m.ApplyPoison( m, Poison.Lethal );
}
[Constructable]
public FactionGasTrap() : this( null )
{
}
public FactionGasTrap( Faction f ) : this( f, null )
{
}
public FactionGasTrap( Faction f, Mobile m ) : base( f, m, 0x113C )
{
}
public FactionGasTrap( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class FactionGasTrapDeed : BaseFactionTrapDeed
{
public override Type TrapType{ get{ return typeof( FactionGasTrap ); } }
public override int LabelNumber{ get{ return 1044602; } } // faction gas trap deed
public FactionGasTrapDeed() : base( 0x11AB )
{
}
public FactionGasTrapDeed( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,85 @@
using System;
using Server;
namespace Server.Factions
{
public class FactionSawTrap : BaseFactionTrap
{
public override int LabelNumber{ get{ return 1041047; } } // faction saw trap
public override int AttackMessage{ get{ return 1010544; } } // The blade cuts deep into your skin!
public override int DisarmMessage{ get{ return 1010540; } } // You carefully dismantle the saw mechanism and disable the trap.
public override int EffectSound{ get{ return 0x218; } }
public override int MessageHue{ get{ return 0x5A; } }
public override AllowedPlacing AllowedPlacing{ get{ return AllowedPlacing.ControlledFactionTown; } }
public override void DoVisibleEffect()
{
Effects.SendLocationEffect( this.Location, this.Map, 0x11AD, 25, 10 );
}
public override void DoAttackEffect( Mobile m )
{
m.Damage( Utility.Dice( 6, 10, 40 ), m );
}
[Constructable]
public FactionSawTrap() : this( null )
{
}
public FactionSawTrap( Serial serial ) : base( serial )
{
}
public FactionSawTrap( Faction f ) : this( f, null )
{
}
public FactionSawTrap( Faction f, Mobile m ) : base( f, m, 0x11AC )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class FactionSawTrapDeed : BaseFactionTrapDeed
{
public override Type TrapType{ get{ return typeof( FactionSawTrap ); } }
public override int LabelNumber{ get{ return 1044604; } } // faction saw trap deed
public FactionSawTrapDeed() : base( 0x1107 )
{
}
public FactionSawTrapDeed( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,85 @@
using System;
using Server;
namespace Server.Factions
{
public class FactionSpikeTrap : BaseFactionTrap
{
public override int LabelNumber{ get{ return 1044601; } } // faction spike trap
public override int AttackMessage{ get{ return 1010545; } } // Large spikes in the ground spring up piercing your skin!
public override int DisarmMessage{ get{ return 1010541; } } // You carefully dismantle the trigger on the spikes and disable the trap.
public override int EffectSound{ get{ return 0x22E; } }
public override int MessageHue{ get{ return 0x5A; } }
public override AllowedPlacing AllowedPlacing{ get{ return AllowedPlacing.ControlledFactionTown; } }
public override void DoVisibleEffect()
{
Effects.SendLocationEffect( this.Location, this.Map, 0x11A4, 12, 6 );
}
public override void DoAttackEffect( Mobile m )
{
m.Damage( Utility.Dice( 6, 10, 40 ), m );
}
[Constructable]
public FactionSpikeTrap() : this( null )
{
}
public FactionSpikeTrap( Faction f ) : this( f, null )
{
}
public FactionSpikeTrap( Faction f, Mobile m ) : base( f, m, 0x11A0 )
{
}
public FactionSpikeTrap( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class FactionSpikeTrapDeed : BaseFactionTrapDeed
{
public override Type TrapType{ get{ return typeof( FactionSpikeTrap ); } }
public override int LabelNumber{ get{ return 1044605; } } // faction spike trap deed
public FactionSpikeTrapDeed() : base( 0x11A5 )
{
}
public FactionSpikeTrapDeed( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,82 @@
using System;
using Server;
using Server.Items;
namespace Server.Factions
{
public class FactionTrapRemovalKit : Item
{
private int m_Charges;
[CommandProperty( AccessLevel.GameMaster )]
public int Charges
{
get{ return m_Charges; }
set{ m_Charges = value; }
}
public override int LabelNumber{ get{ return 1041508; } } // a faction trap removal kit
[Constructable]
public FactionTrapRemovalKit() : base( 7867 )
{
LootType = LootType.Blessed;
m_Charges = 25;
}
public void ConsumeCharge( Mobile consumer )
{
--m_Charges;
if ( m_Charges <= 0 )
{
Delete();
if ( consumer != null )
consumer.SendLocalizedMessage( 1042531 ); // You have used all of the parts in your trap removal kit.
}
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
// NOTE: OSI does not list uses remaining; intentional difference
list.Add( 1060584, m_Charges.ToString() ); // uses remaining: ~1_val~
}
public FactionTrapRemovalKit( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 1 ); // version
writer.WriteEncodedInt( (int) m_Charges );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 1:
{
m_Charges = reader.ReadEncodedInt();
break;
}
case 0:
{
m_Charges = 25;
break;
}
}
}
}
}