Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

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

View File

@@ -0,0 +1,77 @@
using System;
namespace Server.Factions
{
public abstract class BaseSystemController : Item
{
private int m_LabelNumber;
public BaseSystemController(int itemID)
: base(itemID)
{
}
public BaseSystemController(Serial serial)
: base(serial)
{
}
public virtual int DefaultLabelNumber
{
get
{
return base.LabelNumber;
}
}
public new virtual string DefaultName
{
get
{
return null;
}
}
public override int LabelNumber
{
get
{
if (this.m_LabelNumber > 0)
return this.m_LabelNumber;
return this.DefaultLabelNumber;
}
}
public virtual void AssignName(TextDefinition name)
{
if (name != null && name.Number > 0)
{
this.m_LabelNumber = name.Number;
this.Name = null;
}
else if (name != null && name.String != null)
{
this.m_LabelNumber = 0;
this.Name = name.String;
}
else
{
this.m_LabelNumber = 0;
this.Name = this.DefaultName;
}
this.InvalidateProperties();
}
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,173 @@
using System;
using Server.Items;
using Server.Mobiles;
using Server.Gumps;
using Server.Engines.VvV;
namespace Server.Factions
{
public class FactionCollectionBox : BaseCollectionItem
{
public Collection FactionCollection { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public Faction Faction
{
get
{
switch (FactionCollection)
{
case Collection.Minax: return Minax.Instance;
case Collection.TrueBritannians: return TrueBritannians.Instance;
case Collection.Shadowlords: return Shadowlords.Instance;
case Collection.CouncilOfMages: return CouncilOfMages.Instance;
}
return null;
}
}
public FactionCollectionBox(Faction faction)
: base(0xE7D)
{
if (faction == Minax.Instance)
FactionCollection = Collection.Minax;
else if (faction == TrueBritannians.Instance)
FactionCollection = Collection.TrueBritannians;
else if (faction == Shadowlords.Instance)
FactionCollection = Collection.Shadowlords;
else
FactionCollection = Collection.CouncilOfMages;
Hue = 0x48D;
StartTier = 10000000;
NextTier = 5000000;
DailyDecay = 100000;
}
public override void OnDoubleClick(Mobile from)
{
if (from.Alive)
{
if (from.NetState == null || !from.NetState.SupportsExpansion(Expansion.ML))
{
from.SendLocalizedMessage(1073651); // You must have Mondain's Legacy before proceeding...
return;
}
else if (!Factions.Settings.Enabled && from.AccessLevel < AccessLevel.GameMaster)
{
from.SendLocalizedMessage(1042753, "Factions"); // ~1_SOMETHING~ has been temporarily disabled.
return;
}
if (from.InRange(Location, 2) && from is PlayerMobile && CanDonate((PlayerMobile)from))
{
from.CloseGump(typeof(CommunityCollectionGump));
from.SendGump(new CommunityCollectionGump((PlayerMobile)from, this, Location));
}
else
from.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
}
public override bool CanDonate(PlayerMobile player)
{
Faction faction = Faction.Find(player);
if (faction == null)
{
return false;
}
return faction == this.Faction;
}
public FactionCollectionBox(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1073436;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public override Collection CollectionID
{
get
{
return FactionCollection;
}
}
public override int MaxTier
{
get
{
return 12;
}
}
private void LoadData()
{
Donations.Add(new CollectionItem(typeof(Silver), 0xEF2, 1017384, 0x0, 1));
Rewards.Add(new FactionCollectionItem(typeof(StrongholdRune), 0x1F14, 1094700, 0, this.Faction, 150, 0));
Rewards.Add(new FactionCollectionItem(typeof(ShrineGem), 0x1EA7, 1094711, 0, this.Faction, 100, 0));
Rewards.Add(new FactionCollectionItem(typeof(SupernovaPotion), 3849, 1094718, 13, this.Faction, 100, 0));
Rewards.Add(new FactionCollectionItem(typeof(GreaterStaminaPotion), 3849, 1094764, 437, this.Faction, 50, 0));
Rewards.Add(new FactionCollectionItem(typeof(EnchantedBandage), 0xE21, 1094712, 0, this.Faction, 100, 0));
Rewards.Add(new FactionCollectionItem(typeof(PowderOfPerseverance), 4102, 1094712, 2419, this.Faction, 300, 0));
Rewards.Add(new FactionCollectionItem(typeof(MorphEarrings), 0x1087, 1094746, 0, this.Faction, 1000, 0));
Rewards.Add(new FactionCollectionItem(typeof(PrimerOnArmsTalisman), 12121, 1094704, 0, this.Faction, 3000, 7));
Rewards.Add(new FactionCollectionItem(typeof(ClaininsSpellbook), 3834, 1094705, 0x84D, this.Faction, 4000, 9));
Rewards.Add(new FactionCollectionItem(typeof(CrimsonCincture), 5435, 1075043, 0x485, this.Faction, 2000, 4));
Rewards.Add(new FactionCollectionItem(typeof(CrystallineRing), 4234, 1075096, 1152, this.Faction, 4000, 9));
Rewards.Add(new FactionCollectionItem(typeof(HumanFeyLeggings), 5054, 1075041, 0, this.Faction, 1000, 1));
Rewards.Add(new FactionCollectionItem(typeof(FoldedSteelGlasses), 12216, 1073380, 1150, this.Faction, 4000, 9));
Rewards.Add(new FactionCollectionItem(typeof(HeartOfTheLion), 5141, 1070817, 1281, this.Faction, 2000, 4));
Rewards.Add(new FactionCollectionItem(typeof(HuntersHeaddress), 5447, 1061595, 1428, this.Faction, 2000, 4));
Rewards.Add(new FactionCollectionItem(typeof(KasaOfTheRajin), 10136, 1070969, 0, this.Faction, 1000, 1));
Rewards.Add(new FactionCollectionItem(typeof(MaceAndShieldGlasses), 12216, 1073381, 477, this.Faction, 5000, 10));
Rewards.Add(new FactionCollectionItem(typeof(VesperOrderShield), 7108, 1073258, 0, this.Faction, 4000, 9));
Rewards.Add(new FactionCollectionItem(typeof(OrnamentOfTheMagician), 4230, 1061105, 1364, this.Faction, 5000, 10));
Rewards.Add(new FactionCollectionItem(typeof(RingOfTheVile), 4234, 1061102, 1271, this.Faction, 2000, 4));
Rewards.Add(new FactionCollectionItem(typeof(RuneBeetleCarapace), 10109, 1070968, 0, this.Faction, 1000, 1));
Rewards.Add(new FactionCollectionItem(typeof(SpiritOfTheTotem), 5445, 1061599, 1109, this.Faction, 3000, 7));
Rewards.Add(new FactionCollectionItem(typeof(Stormgrip), 10130, 1070970, 0, this.Faction, 1000, 1));
Rewards.Add(new FactionCollectionItem(typeof(InquisitorsResolution), 5140, 1060206, 1266, this.Faction, 5000, 10));
Rewards.Add(new FactionCollectionItem(typeof(TomeOfLostKnowledge), 3834, 1070971, 1328, this.Faction, 3000, 7));
Rewards.Add(new FactionCollectionItem(typeof(WizardsCrystalGlasses), 4102, 1094756, 0, this.Faction, 3000, 7));
}
public override void IncreaseTier()
{
base.IncreaseTier();
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
writer.Write((int)FactionCollection);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
FactionCollection = (Collection)reader.ReadInt();
LoadData();
}
}
}

View File

@@ -0,0 +1,199 @@
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using System.Collections.Generic;
using Server.Spells.First;
using Server.Spells.Fourth;
using Server.Spells.Necromancy;
using Server.Spells.Mysticism;
namespace Server.Factions
{
public class EnchantedBandage : Item, IFactionItem
{
public override int LabelNumber { get { return 1094712; } } // Enchanted Bandage
#region Factions
private FactionItem m_FactionState;
public FactionItem FactionItemState
{
get { return m_FactionState; }
set
{
m_FactionState = value;
}
}
#endregion
public EnchantedBandage()
: base(0xE21)
{
Stackable = true;
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
FactionEquipment.AddFactionProperties(this, list);
}
public override void OnDoubleClick(Mobile from)
{
if (from.InRange(GetWorldLocation(), 2))
{
if (FactionEquipment.CanUse(this, from))
{
from.RevealingAction();
from.SendLocalizedMessage(500948); // Who will you use the bandages on?
from.BeginTarget(-1, false, Server.Targeting.TargetFlags.Beneficial, (healer, targeted) =>
{
Mobile patient = targeted as Mobile;
if (patient != null)
{
if (EnchantedApple.GetTotalCurses(patient) == 0)
{
healer.SendLocalizedMessage(500955); // That being is not damaged!
}
else if (!Deleted && healer.CanBeBeneficial(patient, true, true))
{
healer.DoBeneficial(patient);
bool onSelf = (healer == patient);
int dex = healer.Dex;
double seconds;
double resDelay = (patient.Alive ? 0.0 : 5.0);
if (onSelf)
{
seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10));
}
else
{
seconds = Math.Ceiling((double)4 - healer.Dex / 60);
seconds = Math.Max(seconds, 2);
}
if (Context.ContainsKey(healer))
{
Context[healer].Stop();
}
Context[healer] = new InternalTimer(this, patient, healer, seconds);
if (!onSelf)
{
patient.SendLocalizedMessage(1008078, false, healer.Name); // : Attempting to heal you.
}
healer.SendLocalizedMessage(500956); // You begin applying the bandages.
if (healer.NetState != null && healer.NetState.IsEnhancedClient)
{
healer.NetState.Send(new BandageTimerPacket((int)(seconds)));
}
Consume();
}
}
});
}
}
else
{
from.SendLocalizedMessage(500295); // You are too far away to do that.
}
}
public static Dictionary<Mobile, Timer> Context = new Dictionary<Mobile, Timer>();
public class InternalTimer : Timer
{
public EnchantedBandage Bandage { get; set; }
public Mobile Patient { get; set; }
public Mobile Healer { get; set; }
public long Expires { get; set; }
public InternalTimer(EnchantedBandage bandage, Mobile patient, Mobile healer, double seconds)
: base(TimeSpan.FromMilliseconds(250), TimeSpan.FromMilliseconds(250))
{
Bandage = bandage;
Patient = patient;
Healer = healer;
Expires = Core.TickCount + (long)(seconds * 1000);
Start();
}
protected override void OnTick()
{
if (Core.TickCount >= Expires)
{
EndHeal();
Stop();
}
}
private void EndHeal()
{
if (Context.ContainsKey(Healer))
Context.Remove(Healer);
if (Patient != Healer && Patient.InRange(Healer.Location, 2))
{
Healer.PlaySound(0x57);
if (EnchantedApple.GetTotalCurses(Patient) == 0)
Healer.SendLocalizedMessage(500968); // You apply the bandages, but they barely help.
else
Healer.SendLocalizedMessage(500969); // You finish applying the bandages.
EvilOmenSpell.TryEndEffect(Patient);
StrangleSpell.RemoveCurse(Patient);
CorpseSkinSpell.RemoveCurse(Patient);
WeakenSpell.RemoveEffects(Patient);
FeeblemindSpell.RemoveEffects(Patient);
ClumsySpell.RemoveEffects(Patient);
CurseSpell.RemoveEffect(Patient);
MortalStrike.EndWound(Patient);
BloodOathSpell.RemoveCurse(Patient);
MindRotSpell.ClearMindRotScalar(Patient);
SpellPlagueSpell.RemoveFromList(Patient);
SleepSpell.EndSleep(Patient);
BuffInfo.RemoveBuff(Patient, BuffIcon.MassCurse);
}
else
{
Healer.SendLocalizedMessage(500295); // You are too far away to do that.
}
}
}
public EnchantedBandage(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,279 @@
using System;
using Server.Mobiles;
using Server.Items;
namespace Server.Factions
{
public static class FactionEquipment
{
public static bool CanUse(IFactionItem item, Mobile m, int failmessage = 500294)
{
if (item == null)
return true;
var state = PlayerState.Find(m);
if (state != null && state.Faction == item.FactionItemState.Faction)
{
return true;
}
if (failmessage > 0)
{
m.SendLocalizedMessage(failmessage); // You cannot use that.
}
return false;
}
public static bool AddFactionProperties(IFactionItem item, ObjectPropertyList list)
{
if (item.FactionItemState != null)
{
list.Add(1041350); // faction item
if (item.FactionItemState.MinRank > 0)
list.Add(1094805, item.FactionItemState.MinRank.ToString()); // Faction Rank: ~1_VALUE~
return true;
}
return false;
}
public static void CheckProperties(Item item)
{
if (item is PrimerOnArmsTalisman && ((PrimerOnArmsTalisman)item).Attributes.AttackChance != 10)
{
((PrimerOnArmsTalisman)item).Attributes.AttackChance = 10;
}
if (item is ClaininsSpellbook && ((ClaininsSpellbook)item).Attributes.LowerManaCost != 10)
{
((ClaininsSpellbook)item).Attributes.LowerManaCost = 10;
}
if (item is CrimsonCincture && ((CrimsonCincture)item).Attributes.BonusDex != 10)
{
((CrimsonCincture)item).Attributes.BonusDex = 10;
}
if (item is CrystallineRing && ((CrystallineRing)item).Attributes.CastRecovery != 3)
{
((CrystallineRing)item).Attributes.CastRecovery = 3;
}
if (item is FeyLeggings)
{
if (((FeyLeggings)item).PhysicalBonus != 3)
((FeyLeggings)item).PhysicalBonus = 3;
if (((FeyLeggings)item).FireBonus != 3)
((FeyLeggings)item).FireBonus = 3;
if (((FeyLeggings)item).ColdBonus != 3)
((FeyLeggings)item).ColdBonus = 3;
if (((FeyLeggings)item).EnergyBonus != 3)
((FeyLeggings)item).EnergyBonus = 3;
}
if (item is FoldedSteelGlasses && ((FoldedSteelGlasses)item).Attributes.DefendChance != 25)
{
((FoldedSteelGlasses)item).Attributes.DefendChance = 25;
}
if (item is HeartOfTheLion)
{
if (((HeartOfTheLion)item).PhysicalBonus != 5)
((HeartOfTheLion)item).PhysicalBonus = 5;
if (((HeartOfTheLion)item).FireBonus != 5)
((HeartOfTheLion)item).FireBonus = 5;
if (((HeartOfTheLion)item).ColdBonus != 5)
((HeartOfTheLion)item).ColdBonus = 5;
if (((HeartOfTheLion)item).PoisonBonus != 5)
((HeartOfTheLion)item).PoisonBonus = 5;
if (((HeartOfTheLion)item).EnergyBonus != 5)
((HeartOfTheLion)item).EnergyBonus = 5;
}
if (item is HuntersHeaddress)
{
if (((HuntersHeaddress)item).Resistances.Physical != 8)
((HuntersHeaddress)item).Resistances.Physical = 8;
if (((HuntersHeaddress)item).Resistances.Fire != 4)
((HuntersHeaddress)item).Resistances.Fire = 4;
if (((HuntersHeaddress)item).Resistances.Cold != -8)
((HuntersHeaddress)item).Resistances.Cold = -8;
if (((HuntersHeaddress)item).Resistances.Poison != 9)
((HuntersHeaddress)item).Resistances.Poison = 9;
if (((HuntersHeaddress)item).Resistances.Energy != 3)
((HuntersHeaddress)item).Resistances.Energy = 3;
}
if (item is KasaOfTheRajin && ((KasaOfTheRajin)item).Attributes.DefendChance != 10)
{
((KasaOfTheRajin)item).Attributes.DefendChance = 10;
}
if (item is MaceAndShieldGlasses && ((MaceAndShieldGlasses)item).Attributes.WeaponDamage != 10)
{
((MaceAndShieldGlasses)item).Attributes.WeaponDamage = 10;
}
if (item is VesperOrderShield && ((VesperOrderShield)item).Attributes.CastSpeed != 0)
{
((VesperOrderShield)item).Attributes.CastSpeed = 0;
if (item.Name != "Order Shield")
item.Name = "Order Shield";
}
if (item is OrnamentOfTheMagician && ((OrnamentOfTheMagician)item).Attributes.RegenMana != 3)
{
((OrnamentOfTheMagician)item).Attributes.RegenMana = 3;
}
if (item is RingOfTheVile && ((RingOfTheVile)item).Attributes.AttackChance != 25)
{
((RingOfTheVile)item).Attributes.AttackChance = 25;
}
if (item is RuneBeetleCarapace)
{
if (((RuneBeetleCarapace)item).PhysicalBonus != 3)
((RuneBeetleCarapace)item).PhysicalBonus = 3;
if (((RuneBeetleCarapace)item).FireBonus != 3)
((RuneBeetleCarapace)item).FireBonus = 3;
if (((RuneBeetleCarapace)item).ColdBonus != 3)
((RuneBeetleCarapace)item).ColdBonus = 3;
if (((RuneBeetleCarapace)item).PoisonBonus != 3)
((RuneBeetleCarapace)item).PoisonBonus = 3;
if (((RuneBeetleCarapace)item).EnergyBonus != 3)
((RuneBeetleCarapace)item).EnergyBonus = 3;
}
if (item is SpiritOfTheTotem)
{
if (((SpiritOfTheTotem)item).Resistances.Fire != 7)
((SpiritOfTheTotem)item).Resistances.Fire = 7;
if (((SpiritOfTheTotem)item).Resistances.Cold != 2)
((SpiritOfTheTotem)item).Resistances.Cold = 2;
if (((SpiritOfTheTotem)item).Resistances.Poison != 6)
((SpiritOfTheTotem)item).Resistances.Poison = 6;
if (((SpiritOfTheTotem)item).Resistances.Energy != 6)
((SpiritOfTheTotem)item).Resistances.Energy = 6;
}
if (item is Stormgrip && ((Stormgrip)item).Attributes.AttackChance != 10)
{
((Stormgrip)item).Attributes.AttackChance = 10;
}
if (item is InquisitorsResolution)
{
if (((InquisitorsResolution)item).PhysicalBonus != 5)
((InquisitorsResolution)item).PhysicalBonus = 5;
if (((InquisitorsResolution)item).FireBonus != 7)
((InquisitorsResolution)item).FireBonus = 7;
if (((InquisitorsResolution)item).ColdBonus != -2)
((InquisitorsResolution)item).ColdBonus = -2;
if (((InquisitorsResolution)item).PoisonBonus != 7)
((InquisitorsResolution)item).PoisonBonus = 7;
if (((InquisitorsResolution)item).EnergyBonus != -7)
((InquisitorsResolution)item).EnergyBonus = -7;
}
if (item is TomeOfLostKnowledge && ((TomeOfLostKnowledge)item).Attributes.RegenMana != 3)
{
((TomeOfLostKnowledge)item).Attributes.RegenMana = 3;
}
if (item is WizardsCrystalGlasses)
{
if (((WizardsCrystalGlasses)item).PhysicalBonus != 5)
((WizardsCrystalGlasses)item).PhysicalBonus = 5;
if (((WizardsCrystalGlasses)item).FireBonus != 5)
((WizardsCrystalGlasses)item).FireBonus = 5;
if (((WizardsCrystalGlasses)item).ColdBonus != 5)
((WizardsCrystalGlasses)item).ColdBonus = 5;
if (((WizardsCrystalGlasses)item).PoisonBonus != 5)
((WizardsCrystalGlasses)item).PoisonBonus = 5;
if (((WizardsCrystalGlasses)item).EnergyBonus != 5)
((WizardsCrystalGlasses)item).EnergyBonus = 5;
}
}
}
public class FactionCollectionItem : CollectionItem
{
public int MinRank { get; private set; }
public Faction Faction { get; private set; }
public FactionCollectionItem(Type type, int id, int tooltip, int hue, Faction faction, double points, int minRank)
: base(type, id, tooltip, hue, points)
{
Faction = faction;
MinRank = minRank;
}
public override void OnGiveReward(PlayerMobile to, Item item, IComunityCollection collection, int hue)
{
if(this.Faction != null)
{
FactionEquipment.CheckProperties(item);
FactionItem.Imbue(item, Faction, false, -1, MinRank);
if (!(item is Spellbook || item is ShrineGem))
item.LootType = LootType.Regular;
if (item is IWearableDurability)
{
((IWearableDurability)item).MaxHitPoints = 255;
((IWearableDurability)item).HitPoints = 255;
}
if (item is IOwnerRestricted)
{
((IOwnerRestricted)item).Owner = to;
to.SendLocalizedMessage(1094803); // This faction reward is bound to you, and cannot be traded.
}
item.InvalidateProperties();
}
base.OnGiveReward(to, item, collection, hue);
}
public override bool CanSelect(PlayerMobile from)
{
PlayerState state = PlayerState.Find(from);
return from.AccessLevel > AccessLevel.Player || (state != null && state.Rank.Rank >= MinRank);
}
}
}

View File

@@ -0,0 +1,113 @@
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Gumps;
namespace Server.Factions
{
public class PowderOfPerseverance : Item, IFactionItem
{
public override int LabelNumber { get { return 1094756; } } // Powder of Perseverance
#region Factions
private FactionItem m_FactionState;
public FactionItem FactionItemState
{
get { return m_FactionState; }
set
{
m_FactionState = value;
}
}
#endregion
public PowderOfPerseverance()
: base(4102)
{
Hue = 2419;
}
public override void OnDoubleClick(Mobile from)
{
if(IsChildOf(from.Backpack))
{
if (FactionEquipment.CanUse(this, from))
{
from.BeginTarget(-1, false, Server.Targeting.TargetFlags.None, (m, targeted) =>
{
if (targeted is IFactionItem && targeted is IWearableDurability)
{
IWearableDurability durability = targeted as IWearableDurability;
if (durability.HitPoints >= durability.MaxHitPoints)
{
m.SendLocalizedMessage(1094761); // This item is already in perfect condition.
}
else if (durability.MaxHitPoints <= 125)
{
m.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
}
else
{
if (durability.MaxHitPoints == 255)
{
durability.MaxHitPoints = 225;
}
else
{
durability.MaxHitPoints -= 25;
}
durability.HitPoints = durability.MaxHitPoints;
m.SendLocalizedMessage(1049084); // You successfully use the powder on the item.
m.SendLocalizedMessage(1094760); // You have used up your Powder of Perseverance.
m.PlaySound(0x247);
Delete();
}
}
else
{
m.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
}
});
}
}
else
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
list.Add(1060584, "1"); // uses remaining: ~1_val~
FactionEquipment.AddFactionProperties(this, list);
}
public PowderOfPerseverance(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,125 @@
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Gumps;
namespace Server.Factions
{
public class ShrineGem : Item, IFactionItem
{
public static void Initialize()
{
EventSink.PlayerDeath += OnPlayerDeath;
}
public static void OnPlayerDeath(PlayerDeathEventArgs e)
{
if (e.Mobile is PlayerMobile && e.Mobile.Backpack != null)
{
var state = PlayerState.Find(e.Mobile);
if(state != null)
{
ShrineGem gem = null;
foreach (var item in e.Mobile.Backpack.Items)
{
if (item is ShrineGem && ((ShrineGem)item).FactionItemState.Faction == state.Faction)
{
gem = (ShrineGem)item;
break;
}
}
Console.WriteLine("Gem: {0}", gem);
if (gem != null)
{
Timer.DelayCall(TimeSpan.FromSeconds(2.5), () =>
{
BaseGump.SendGump(new ConfirmCallbackGump((PlayerMobile)e.Mobile, 1094715, 1094716, gem, null,
(m, obj) =>
{
ShrineGem g = obj as ShrineGem;
if (g != null && !g.Deleted && g.IsChildOf(m.Backpack))
{
Point3D p = _ShrineLocs[Utility.Random(_ShrineLocs.Length)];
Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
{
m.PlaySound(0x1FC);
m.MoveToWorld(p, m.Map);
m.PlaySound(0x1FC);
g.Delete();
});
}
}));
});
}
}
}
}
private static readonly Point3D[] _ShrineLocs = new Point3D[]
{
new Point3D(1470, 843, 0),
new Point3D(1857, 865, -1),
new Point3D(4220, 563, 36),
new Point3D(1732, 3528, 0),
new Point3D(1300, 644, 8),
new Point3D(3355, 302, 9),
new Point3D(1606, 2490, 5),
new Point3D(2500, 3931, 3),
new Point3D(4264, 3707, 0)
};
public override int LabelNumber { get { return 1094711; } } // Shrine Gem
#region Factions
private FactionItem m_FactionState;
public FactionItem FactionItemState
{
get { return m_FactionState; }
set
{
m_FactionState = value;
Hue = m_FactionState != null ? m_FactionState.Faction.Definition.HuePrimary : 0;
}
}
#endregion
public ShrineGem()
: base(0x1EA7)
{
LootType = LootType.Blessed;
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
FactionEquipment.AddFactionProperties(this, list);
}
public ShrineGem(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,154 @@
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using System.Collections.Generic;
namespace Server.Factions
{
public class StrongholdRune : Item, IFactionItem
{
public override int LabelNumber { get { return 1094700; } } // Faction Stronghold Rune
#region Factions
private FactionItem m_FactionState;
public FactionItem FactionItemState
{
get { return m_FactionState; }
set
{
m_FactionState = value;
Hue = m_FactionState != null ? m_FactionState.Faction.Definition.HuePrimary : 0;
}
}
#endregion
public StrongholdRune()
: base(0x1F14)
{
}
public override void OnDoubleClick(Mobile m)
{
if (IsChildOf(m.Backpack))
{
if (FactionEquipment.CanUse(this, m))
{
if (!IsInCooldown(m))
{
Timer.DelayCall<Mobile>(TimeSpan.FromSeconds(1), Warp, m);
}
else
{
m.SendLocalizedMessage(501789); // You must wait before trying again.
}
}
else
{
m.SendMessage("You are not the proper faction to use this item.");
//TODO: Message
}
}
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
FactionEquipment.AddFactionProperties(this, list);
}
private void Warp(Mobile m)
{
Point3D p = GetStoneLocation();
Map map = Faction.Facet;
int x = p.X;
int y = p.Y;
int z = p.Z;
if (p != Point3D.Zero)
{
for (int i = 0; i < 20; i++)
{
x = p.X + Utility.RandomMinMax(-4, 4);
y = p.Y + Utility.RandomMinMax(-4, 4);
z = map.GetAverageZ(x, y);
Point3D temp = new Point3D(x, y, z);
if (map.CanSpawnMobile(temp))
{
p = temp;
break;
}
}
m.PlaySound(0x1FC);
m.MoveToWorld(p, map);
m.PlaySound(0x1FC);
m.SendLocalizedMessage(1094706); // Your faction stronghold rune has disappeared.
if (m.AccessLevel == AccessLevel.Player)
Delete();
AddToCooldown(m);
}
}
private Point3D GetStoneLocation()
{
if (FactionItemState == null)
{
return Point3D.Zero;
}
return FactionItemState.Faction.Definition.Stronghold.FactionStone;
}
public static List<Mobile> Cooldown = new List<Mobile>();
public static bool IsInCooldown(Mobile m)
{
return Cooldown.Contains(m);
}
public static void AddToCooldown(Mobile m)
{
Cooldown.Add(m);
int minutes = 30;
PlayerState ps = PlayerState.Find(m);
if(ps != null)
minutes = 30 - (ps.Rank.Rank * 2);
Timer.DelayCall<Mobile>(TimeSpan.FromMinutes(minutes), mob =>
{
Cooldown.Remove(mob);
}, m);
}
public StrongholdRune(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,113 @@
using System;
using Server.Mobiles;
using Server.Network;
namespace Server.Factions
{
public class FactionStone : BaseSystemController
{
private Faction m_Faction;
[Constructable]
public FactionStone()
: this(null)
{
}
[Constructable]
public FactionStone(Faction faction)
: base(0xEDC)
{
this.Movable = false;
this.Faction = faction;
}
public FactionStone(Serial serial)
: base(serial)
{
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public Faction Faction
{
get
{
return this.m_Faction;
}
set
{
this.m_Faction = value;
this.AssignName(this.m_Faction == null ? null : this.m_Faction.Definition.FactionStoneName);
}
}
public override string DefaultName
{
get
{
return "faction stone";
}
}
public override void OnDoubleClick(Mobile from)
{
if (this.m_Faction == null)
return;
if (!from.InRange(this.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 == this.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, this.m_Faction));
}
else if (existingFaction != null)
{
// TODO: Validate
from.SendLocalizedMessage(1005053); // This is not your faction stone!
}
else
{
from.SendGump(new JoinStoneGump((PlayerMobile)from, this.m_Faction));
}
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
Faction.WriteReference(writer, this.m_Faction);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
this.Faction = Faction.ReadReference(reader);
break;
}
}
}
}
}

View File

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

View File

@@ -0,0 +1,546 @@
using System;
using System.Collections.Generic;
using Server.Items;
using Server.Mobiles;
using Server.Network;
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 this.m_LastStolen;
}
set
{
this.m_LastStolen = value;
}
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public DateTime GraceStart
{
get
{
return this.m_GraceStart;
}
set
{
this.m_GraceStart = value;
}
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public DateTime CorruptionStart
{
get
{
return this.m_CorruptionStart;
}
set
{
this.m_CorruptionStart = value;
}
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public DateTime PurificationStart
{
get
{
return this.m_PurificationStart;
}
set
{
this.m_PurificationStart = value;
}
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public Town Town
{
get
{
return this.m_Town;
}
set
{
this.m_Town = value;
this.Update();
}
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public Faction Corrupted
{
get
{
return this.m_Corrupted;
}
set
{
this.m_Corrupted = value;
this.Update();
}
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public Faction Corrupting
{
get
{
return this.m_Corrupting;
}
set
{
this.m_Corrupting = value;
this.Update();
}
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public BaseMonolith LastMonolith
{
get
{
return this.m_LastMonolith;
}
set
{
this.m_LastMonolith = value;
}
}
[CommandProperty(AccessLevel.Counselor)]
public bool IsBeingCorrupted
{
get
{
return (this.m_LastMonolith is StrongholdMonolith && this.m_LastMonolith.Faction == this.m_Corrupting && this.m_Corrupting != null);
}
}
[CommandProperty(AccessLevel.Counselor)]
public bool IsCorrupted
{
get
{
return (this.m_Corrupted != null);
}
}
[CommandProperty(AccessLevel.Counselor)]
public bool IsPurifying
{
get
{
return (this.m_PurificationStart != DateTime.MinValue);
}
}
[CommandProperty(AccessLevel.Counselor)]
public bool IsCorrupting
{
get
{
return (this.m_Corrupting != null && this.m_Corrupting != this.m_Corrupted);
}
}
public void Update()
{
this.ItemID = (this.m_Town == null ? 0x1869 : this.m_Town.Definition.SigilID);
if (this.m_Town == null)
this.AssignName(null);
else if (this.IsCorrupted || this.IsPurifying)
this.AssignName(this.m_Town.Definition.CorruptedSigilName);
else
this.AssignName(this.m_Town.Definition.SigilName);
this.InvalidateProperties();
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if (this.IsCorrupted)
TextDefinition.AddTo(list, this.m_Corrupted.Definition.SigilControl);
else
list.Add(1042256); // This sigil is not corrupted.
if (this.IsCorrupting)
list.Add(1042257); // This sigil is in the process of being corrupted.
else if (this.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 (this.IsCorrupted)
{
if (this.m_Corrupted.Definition.SigilControl.Number > 0)
this.LabelTo(from, this.m_Corrupted.Definition.SigilControl.Number);
else if (this.m_Corrupted.Definition.SigilControl.String != null)
this.LabelTo(from, this.m_Corrupted.Definition.SigilControl.String);
}
else
{
this.LabelTo(from, 1042256); // This sigil is not corrupted.
}
if (this.IsCorrupting)
this.LabelTo(from, 1042257); // This sigil is in the process of being corrupted.
else if (this.IsPurifying)
this.LabelTo(from, 1042258); // This sigil has been recently corrupted, and is undergoing purification.
else
this.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(object parent)
{
base.OnAdded(parent);
Mobile mob = this.FindOwner(parent);
if (mob != null)
mob.SolidHueOverride = OwnershipHue;
}
public override void OnRemoved(object parent)
{
base.OnRemoved(parent);
Mobile mob = this.FindOwner(parent);
if (mob != null)
mob.SolidHueOverride = -1;
}
public Sigil(Town town)
: base(0x1869)
{
this.Movable = false;
this.Town = town;
m_Sigils.Add(this);
}
public override void OnDoubleClick(Mobile from)
{
if (this.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, bool vvvOnly = false)
{
if (mob == null || mob.Backpack == null)
return false;
Container pack = mob.Backpack;
if (Server.Engines.VvV.ViceVsVirtueSystem.Enabled && vvvOnly && pack.FindItemByType(typeof(Server.Engines.VvV.VvVSigil)) != null)
return true;
return (pack.FindItemByType(typeof(Sigil)) != null || pack.FindItemByType(typeof(Server.Engines.VvV.VvVSigil)) != null);
}
private void BeginCorrupting(Faction faction)
{
this.m_Corrupting = faction;
this.m_CorruptionStart = DateTime.UtcNow;
}
private void ClearCorrupting()
{
this.m_Corrupting = null;
this.m_CorruptionStart = DateTime.MinValue;
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan TimeUntilCorruption
{
get
{
if (!this.IsBeingCorrupted)
return TimeSpan.Zero;
TimeSpan ts = (this.m_CorruptionStart + CorruptionPeriod) - DateTime.UtcNow;
if (ts < TimeSpan.Zero)
ts = TimeSpan.Zero;
return ts;
}
}
private void Sigil_OnTarget(Mobile from, object obj)
{
if (this.Deleted || !this.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 != this.m_Town)
from.SendLocalizedMessage(1042247); // That is not the correct faction monolith
else
{
m.Sigil = this;
Faction newController = m.Faction;
Faction oldController = this.m_Corrupting;
if (oldController == null)
{
if (this.m_Corrupted != newController)
this.BeginCorrupting(newController);
}
else if (this.m_GraceStart > DateTime.MinValue && (this.m_GraceStart + CorruptionGrace) < DateTime.UtcNow)
{
if (this.m_Corrupted != newController)
this.BeginCorrupting(newController); // grace time over, reset period
else
this.ClearCorrupting();
this.m_GraceStart = DateTime.MinValue;
}
else if (newController == oldController)
{
this.m_GraceStart = DateTime.MinValue; // returned within grace period
}
else if (this.m_GraceStart == DateTime.MinValue)
{
this.m_GraceStart = DateTime.UtcNow;
}
this.m_PurificationStart = DateTime.MinValue;
}
}
#endregion
#region Put in Town
else if (obj is TownMonolith)
{
TownMonolith m = (TownMonolith)obj;
if (m.Town == null || m.Town != this.m_Town)
from.SendLocalizedMessage(1042245); // This is not the correct town sigil monolith
else if (this.m_Corrupted == null || this.m_Corrupted != Faction.Find(from))
from.SendLocalizedMessage(1042244); // Your faction did not corrupt this sigil. Take it to your stronghold.
else
{
m.Sigil = this;
this.m_Corrupting = null;
this.m_PurificationStart = DateTime.UtcNow;
this.m_CorruptionStart = DateTime.MinValue;
this.m_Town.Capture(this.m_Corrupted);
this.m_Corrupted = null;
}
}
#endregion
}
else
{
from.SendLocalizedMessage(1005224); // You can't use the sigil on that
}
this.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, this.m_Town);
Faction.WriteReference(writer, this.m_Corrupted);
Faction.WriteReference(writer, this.m_Corrupting);
writer.Write((Item)this.m_LastMonolith);
writer.Write(this.m_LastStolen);
writer.Write(this.m_GraceStart);
writer.Write(this.m_CorruptionStart);
writer.Write(this.m_PurificationStart);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
this.m_Town = Town.ReadReference(reader);
this.m_Corrupted = Faction.ReadReference(reader);
this.m_Corrupting = Faction.ReadReference(reader);
this.m_LastMonolith = reader.ReadItem() as BaseMonolith;
this.m_LastStolen = reader.ReadDateTime();
this.m_GraceStart = reader.ReadDateTime();
this.m_CorruptionStart = reader.ReadDateTime();
this.m_PurificationStart = reader.ReadDateTime();
this.Update();
Mobile mob = this.RootParent as Mobile;
if (mob != null)
mob.SolidHueOverride = OwnershipHue;
break;
}
}
}
public bool ReturnHome()
{
BaseMonolith monolith = this.m_LastMonolith;
if (monolith == null && this.m_Town != null)
monolith = this.m_Town.Monolith;
if (monolith != null && !monolith.Deleted)
monolith.Sigil = this;
return (monolith != null && !monolith.Deleted);
}
public override void OnParentDeleted(object parent)
{
base.OnParentDeleted(parent);
this.ReturnHome();
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
m_Sigils.Remove(this);
}
public override void Delete()
{
if (this.ReturnHome())
return;
base.Delete();
}
private static readonly List<Sigil> m_Sigils = new List<Sigil>();
public static List<Sigil> Sigils
{
get
{
return m_Sigils;
}
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
namespace Server.Factions
{
public class Silver : Item
{
[Constructable]
public Silver()
: this(1)
{
}
[Constructable]
public Silver(int amountFrom, int amountTo)
: this(Utility.RandomMinMax(amountFrom, amountTo))
{
}
[Constructable]
public Silver(int amount)
: base(0xEF0)
{
this.Stackable = true;
this.Amount = amount;
}
public Silver(Serial serial)
: base(serial)
{
}
public override double DefaultWeight
{
get
{
return 0.02;
}
}
public override int GetDropSound()
{
if (this.Amount <= 1)
return 0x2E4;
else if (this.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,48 @@
using System;
namespace Server.Factions
{
public class StrongholdMonolith : BaseMonolith
{
public StrongholdMonolith()
: this(null, null)
{
}
public StrongholdMonolith(Town town, Faction faction)
: base(town, faction)
{
}
public StrongholdMonolith(Serial serial)
: base(serial)
{
}
public override int DefaultLabelNumber
{
get
{
return 1041042;
}
}// A Faction Sigil Monolith
public override void OnTownChanged()
{
this.AssignName(this.Town == null ? null : this.Town.Definition.StrongholdMonolithName);
}
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,48 @@
using System;
namespace Server.Factions
{
public class TownMonolith : BaseMonolith
{
public TownMonolith()
: this(null)
{
}
public TownMonolith(Town town)
: base(town, null)
{
}
public TownMonolith(Serial serial)
: base(serial)
{
}
public override int DefaultLabelNumber
{
get
{
return 1041403;
}
}// A Faction Town Sigil Monolith
public override void OnTownChanged()
{
this.AssignName(this.Town == null ? null : this.Town.Definition.TownMonolithName);
}
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,94 @@
using System;
using Server.Mobiles;
namespace Server.Factions
{
public class TownStone : BaseSystemController
{
private Town m_Town;
[Constructable]
public TownStone()
: this(null)
{
}
[Constructable]
public TownStone(Town town)
: base(0xEDE)
{
this.Movable = false;
this.Town = town;
}
public TownStone(Serial serial)
: base(serial)
{
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public Town Town
{
get
{
return this.m_Town;
}
set
{
this.m_Town = value;
this.AssignName(this.m_Town == null ? null : this.m_Town.Definition.TownStoneName);
}
}
public override string DefaultName
{
get
{
return "faction town stone";
}
}
public override void OnDoubleClick(Mobile from)
{
if (this.m_Town == null)
return;
Faction faction = Faction.Find(from);
if (faction == null && from.AccessLevel < AccessLevel.GameMaster)
return; // TODO: Message?
if (this.m_Town.Owner == null || (from.AccessLevel < AccessLevel.GameMaster && faction != this.m_Town.Owner))
from.SendLocalizedMessage(1010332); // Your faction does not control this town
else if (!this.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, this.m_Town.Owner, this.m_Town));
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
Town.WriteReference(writer, this.m_Town);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
this.Town = Town.ReadReference(reader);
break;
}
}
}
}
}

View File

@@ -0,0 +1,359 @@
using System;
using Server.Items;
using Server.Network;
namespace Server.Factions
{
public enum AllowedPlacing
{
Everywhere,
AnyFactionTown,
ControlledFactionTown,
FactionStronghold
}
public abstract class BaseFactionTrap : BaseTrap, IRevealableItem
{
private Faction m_Faction;
private Mobile m_Placer;
private DateTime m_TimeOfPlacement;
private Timer m_Concealing;
public bool CheckWhenHidden { get { return true; } }
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)
{
}
[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(Location, Map, 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 == 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 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 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 bool CheckReveal(Mobile m)
{
if (Faction.Find(m) == null)
return false;
return m.CheckTargetSkill(SkillName.DetectHidden, this, 80.0, 100.0);
}
public virtual void OnRevealed(Mobile m)
{
m.SendLocalizedMessage(1042712, true, " " + (Faction == null ? "" : Faction.Definition.FriendlyName)); // You reveal a trap placed by a faction:
Visible = true;
BeginConceal();
}
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 virtual bool CheckPassiveDetect(Mobile m)
{
if (!CheckDecay() && m.InRange(Location, 6))
{
if (Faction.Find(m) != null && ((m.Skills[SkillName.DetectHidden].Value - 80.0) / 20.0) > Utility.RandomDouble())
PrivateOverheadLocalizedMessage(m, 1010154, MessageHue, "", ""); // [Faction Trap]
}
return 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.IsStaff())
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,121 @@
using System;
using Server.Engines.Craft;
using Server.Items;
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 this.m_Faction;
}
set
{
this.m_Faction = value;
if (this.m_Faction != null)
this.Hue = this.m_Faction.Definition.HuePrimary;
}
}
public BaseFactionTrapDeed(int itemID)
: base(itemID)
{
this.Weight = 1.0;
this.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(this.TrapType, new object[] { this.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 != this.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 = this.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);
this.Delete();
}
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
Faction.WriteReference(writer, this.m_Faction);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
this.m_Faction = Faction.ReadReference(reader);
}
#region ICraftable Members
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
{
this.ItemID = 0x14F0;
this.Faction = Faction.Find(from);
return 1;
}
#endregion
}
}

View File

@@ -0,0 +1,134 @@
using System;
namespace Server.Factions
{
public class FactionExplosionTrap : BaseFactionTrap
{
[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 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(this.GetWorldLocation(), this.Map, 0x36BD, 15, 10);
}
public override void DoAttackEffect(Mobile m)
{
m.Damage(Utility.Dice(6, 10, 40), m);
}
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 FactionExplosionTrapDeed()
: base(0x36D2)
{
}
public FactionExplosionTrapDeed(Serial serial)
: base(serial)
{
}
public override Type TrapType
{
get
{
return typeof(FactionExplosionTrap);
}
}
public override int LabelNumber
{
get
{
return 1044603;
}
}// faction explosion trap deed
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,134 @@
using System;
namespace Server.Factions
{
public class FactionGasTrap : BaseFactionTrap
{
[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 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);
}
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 FactionGasTrapDeed()
: base(0x11AB)
{
}
public FactionGasTrapDeed(Serial serial)
: base(serial)
{
}
public override Type TrapType
{
get
{
return typeof(FactionGasTrap);
}
}
public override int LabelNumber
{
get
{
return 1044602;
}
}// faction gas trap deed
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,134 @@
using System;
namespace Server.Factions
{
public class FactionSawTrap : BaseFactionTrap
{
[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 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);
}
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 FactionSawTrapDeed()
: base(0x1107)
{
}
public FactionSawTrapDeed(Serial serial)
: base(serial)
{
}
public override Type TrapType
{
get
{
return typeof(FactionSawTrap);
}
}
public override int LabelNumber
{
get
{
return 1044604;
}
}// faction saw trap deed
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,134 @@
using System;
namespace Server.Factions
{
public class FactionSpikeTrap : BaseFactionTrap
{
[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 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);
}
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 FactionSpikeTrapDeed()
: base(0x11A5)
{
}
public FactionSpikeTrapDeed(Serial serial)
: base(serial)
{
}
public override Type TrapType
{
get
{
return typeof(FactionSpikeTrap);
}
}
public override int LabelNumber
{
get
{
return 1044605;
}
}// faction spike trap deed
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,91 @@
using System;
namespace Server.Factions
{
public class FactionTrapRemovalKit : Item
{
private int m_Charges;
[Constructable]
public FactionTrapRemovalKit()
: base(7867)
{
this.LootType = LootType.Blessed;
this.m_Charges = 25;
}
public FactionTrapRemovalKit(Serial serial)
: base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public int Charges
{
get
{
return this.m_Charges;
}
set
{
this.m_Charges = value;
}
}
public override int LabelNumber
{
get
{
return 1041508;
}
}// a faction trap removal kit
public void ConsumeCharge(Mobile consumer)
{
--this.m_Charges;
if (this.m_Charges <= 0)
{
this.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, this.m_Charges.ToString()); // uses remaining: ~1_val~
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)1); // version
writer.WriteEncodedInt((int)this.m_Charges);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
{
case 1:
{
this.m_Charges = reader.ReadEncodedInt();
break;
}
case 0:
{
this.m_Charges = 25;
break;
}
}
}
}
}