Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
129
Projects/Scripts/Engines/Factions/Items/BaseMonolith.cs
Normal file
129
Projects/Scripts/Engines/Factions/Items/BaseMonolith.cs
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public abstract class BaseMonolith : BaseSystemController
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private Sigil m_Sigil;
|
||||
private Town m_Town;
|
||||
|
||||
public BaseMonolith(Town town = null, Faction faction = null) : base(0x1183)
|
||||
{
|
||||
Movable = false;
|
||||
Town = town;
|
||||
Faction = faction;
|
||||
Monoliths.Add(this);
|
||||
}
|
||||
|
||||
public BaseMonolith(Serial serial) : base(serial)
|
||||
{
|
||||
Monoliths.Add(this);
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Sigil Sigil
|
||||
{
|
||||
get => m_Sigil;
|
||||
set
|
||||
{
|
||||
if (m_Sigil == value)
|
||||
return;
|
||||
|
||||
m_Sigil = value;
|
||||
|
||||
if (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 => m_Town;
|
||||
set
|
||||
{
|
||||
m_Town = value;
|
||||
OnTownChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
Hue = m_Faction?.Definition.HuePrimary ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<BaseMonolith> Monoliths{ get; set; } = new List<BaseMonolith>();
|
||||
|
||||
public override void OnLocationChange(Point3D oldLocation)
|
||||
{
|
||||
base.OnLocationChange(oldLocation);
|
||||
UpdateSigil();
|
||||
}
|
||||
|
||||
public override void OnMapChange()
|
||||
{
|
||||
base.OnMapChange();
|
||||
UpdateSigil();
|
||||
}
|
||||
|
||||
public virtual void UpdateSigil()
|
||||
{
|
||||
if (m_Sigil?.Deleted != false)
|
||||
return;
|
||||
|
||||
m_Sigil.MoveToWorld(new Point3D(X, Y, Z + 18), Map);
|
||||
}
|
||||
|
||||
public virtual void OnTownChanged()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
Monoliths.Remove(this);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
Town.WriteReference(writer, m_Town);
|
||||
Faction.WriteReference(writer, m_Faction);
|
||||
|
||||
writer.Write(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
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 => base.LabelNumber;
|
||||
public new virtual string DefaultName => 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?.String != null)
|
||||
{
|
||||
m_LabelNumber = 0;
|
||||
Name = name.String;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LabelNumber = 0;
|
||||
Name = DefaultName;
|
||||
}
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
99
Projects/Scripts/Engines/Factions/Items/FactionStone.cs
Normal file
99
Projects/Scripts/Engines/Factions/Items/FactionStone.cs
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class FactionStone : BaseSystemController
|
||||
{
|
||||
private Faction m_Faction;
|
||||
|
||||
[Constructible]
|
||||
public FactionStone(Faction faction = null) : base(0xEDC)
|
||||
{
|
||||
Movable = false;
|
||||
Faction = faction;
|
||||
}
|
||||
|
||||
public FactionStone(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
|
||||
AssignName(m_Faction?.Definition.FactionStoneName);
|
||||
}
|
||||
}
|
||||
|
||||
public override string DefaultName => "faction stone";
|
||||
|
||||
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 mobile)
|
||||
{
|
||||
Faction existingFaction = Faction.Find(mobile);
|
||||
|
||||
if (existingFaction == m_Faction || mobile.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(mobile);
|
||||
|
||||
if (pl != null && pl.IsLeaving)
|
||||
mobile.SendLocalizedMessage(
|
||||
1005051); // You cannot use the faction stone until you have finished quitting your current faction
|
||||
else
|
||||
mobile.SendGump(new FactionStoneGump(mobile, m_Faction));
|
||||
}
|
||||
else if (existingFaction != null)
|
||||
{
|
||||
// TODO: Validate
|
||||
mobile.SendLocalizedMessage(1005053); // This is not your faction stone!
|
||||
}
|
||||
else
|
||||
{
|
||||
mobile.SendGump(new JoinStoneGump(mobile, m_Faction));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
74
Projects/Scripts/Engines/Factions/Items/JoinStone.cs
Normal file
74
Projects/Scripts/Engines/Factions/Items/JoinStone.cs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class JoinStone : BaseSystemController
|
||||
{
|
||||
private Faction m_Faction;
|
||||
|
||||
[Constructible]
|
||||
public JoinStone(Faction faction = null) : base(0xEDC)
|
||||
{
|
||||
Movable = false;
|
||||
Faction = faction;
|
||||
}
|
||||
|
||||
public JoinStone(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
|
||||
Hue = m_Faction?.Definition.HueJoin ?? 0;
|
||||
AssignName(m_Faction?.Definition.SignupName);
|
||||
}
|
||||
}
|
||||
|
||||
public override string DefaultName => "faction signup stone";
|
||||
|
||||
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 mobile)
|
||||
mobile.SendGump(new JoinStoneGump(mobile, m_Faction));
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public sealed class BloodRose : PowerFactionItem
|
||||
{
|
||||
public BloodRose()
|
||||
: base(Utility.RandomList(6378, 9035))
|
||||
{
|
||||
Hue = 2118;
|
||||
}
|
||||
|
||||
public BloodRose(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override string DefaultName => "blood rose";
|
||||
|
||||
public override bool Use(Mobile from)
|
||||
{
|
||||
if (from.GetStatMod("blood-rose") == null)
|
||||
{
|
||||
from.PlaySound(Utility.Random(0x3A, 3));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public sealed class ClarityPotion : PowerFactionItem
|
||||
{
|
||||
public ClarityPotion()
|
||||
: base(3628)
|
||||
{
|
||||
Hue = 1154;
|
||||
}
|
||||
|
||||
public ClarityPotion(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override string DefaultName => "clarity potion";
|
||||
|
||||
public override bool Use(Mobile from)
|
||||
{
|
||||
if (from.BeginAction<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<ClarityPotion>(); });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
using Server.Factions;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public sealed class GemOfEmpowerment : PowerFactionItem
|
||||
{
|
||||
public GemOfEmpowerment()
|
||||
: base(7955)
|
||||
{
|
||||
Hue = 1154;
|
||||
}
|
||||
|
||||
public GemOfEmpowerment(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override string DefaultName => "gem of empowerment";
|
||||
|
||||
public override bool Use(Mobile from)
|
||||
{
|
||||
if (Faction.ClearSkillLoss(from))
|
||||
{
|
||||
from.LocalOverheadMessage(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(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Server.Factions;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public abstract class PowerFactionItem : Item
|
||||
{
|
||||
private static WeightedItem[] _items =
|
||||
{
|
||||
new WeightedItem(30, typeof(GemOfEmpowerment)),
|
||||
new WeightedItem(25, typeof(BloodRose)),
|
||||
new WeightedItem(20, typeof(ClarityPotion)),
|
||||
new WeightedItem(15, typeof(UrnOfAscension)),
|
||||
new WeightedItem(10, typeof(StormsEye))
|
||||
};
|
||||
|
||||
public PowerFactionItem(int itemId)
|
||||
: base(itemId)
|
||||
{
|
||||
}
|
||||
|
||||
public PowerFactionItem(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract bool Use(Mobile mob);
|
||||
|
||||
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(
|
||||
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
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
weight -= item.Weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
|
||||
}
|
||||
else if (from is PlayerMobile mobile && mobile.DuelContext != null)
|
||||
{
|
||||
mobile.SendMessage("You can't use that.");
|
||||
}
|
||||
else if (Faction.Find(from) == null)
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 2119, false,
|
||||
"The object vanishes from your hands as you touch it.");
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0),
|
||||
delegate
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 2118, false,
|
||||
"You feel a strange tingling sensation throughout your body.");
|
||||
});
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(4.0),
|
||||
delegate { from.LocalOverheadMessage(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 override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
|
||||
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(MessageType.Regular, 2118, false, "Aaaaah!");
|
||||
}
|
||||
|
||||
_mobile.Damage(Utility.Dice(2, 6, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class WeightedItem
|
||||
{
|
||||
public WeightedItem(int weight, Type type)
|
||||
{
|
||||
Weight = weight;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public int Weight{ get; }
|
||||
|
||||
public Type Type{ get; }
|
||||
|
||||
public Item Construct()
|
||||
{
|
||||
return Activator.CreateInstance(Type) as Item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Factions;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public sealed class StormsEye : PowerFactionItem
|
||||
{
|
||||
public StormsEye()
|
||||
: base(3967)
|
||||
{
|
||||
Hue = 1165;
|
||||
}
|
||||
|
||||
public StormsEye(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override string DefaultName => "storms eye";
|
||||
|
||||
public override bool Use(Mobile user)
|
||||
{
|
||||
if (Movable)
|
||||
user.BeginTarget(12, true, TargetFlags.None, delegate(Mobile from, object obj)
|
||||
{
|
||||
if (Movable && !Deleted)
|
||||
if (obj is IPoint3D pt)
|
||||
{
|
||||
SpellHelper.GetSurfaceTop(ref pt);
|
||||
|
||||
Point3D origin = new Point3D(pt);
|
||||
Map facet = from.Map;
|
||||
|
||||
if (facet?.CanFit(pt.X, pt.Y, pt.Z, 16, false, false) != true)
|
||||
return;
|
||||
|
||||
Movable = false;
|
||||
|
||||
Effects.SendMovingEffect(
|
||||
from, new Entity(Serial.Zero, origin, facet),
|
||||
ItemID & 0x3FFF, 7, 0, false, false, Hue - 1
|
||||
);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.5), delegate
|
||||
{
|
||||
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 = facet.GetMobilesInRange(origin, 12).Where(mob =>
|
||||
from.CanBeHarmful(mob, false) && mob.InLOS(new Point3D(origin, origin.Z + 1)) &&
|
||||
Faction.Find(mob) != null).ToList();
|
||||
|
||||
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, 0,
|
||||
100);
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(0.70), mob, from, damage / 3.0, 0, 0, 0, 0,
|
||||
100);
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(1.00), mob, from, damage / 3.0, 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(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public sealed class UrnOfAscension : PowerFactionItem
|
||||
{
|
||||
public UrnOfAscension()
|
||||
: base(9246)
|
||||
{
|
||||
}
|
||||
|
||||
public UrnOfAscension(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override string DefaultName => "urn of ascension";
|
||||
|
||||
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));
|
||||
used = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (used)
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 2219, false, "The urn shatters as you invoke its power.");
|
||||
from.PlaySound(64);
|
||||
|
||||
Effects.PlaySound(from.Location, from.Map, 1481);
|
||||
}
|
||||
|
||||
return used;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
456
Projects/Scripts/Engines/Factions/Items/Sigil.cs
Normal file
456
Projects/Scripts/Engines/Factions/Items/Sigil.cs
Normal file
|
|
@ -0,0 +1,456 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class Sigil : BaseSystemController
|
||||
{
|
||||
public const int OwnershipHue = 0xB;
|
||||
|
||||
// ?? time corrupting faction has to return the sigil before corruption time resets ?
|
||||
public static readonly TimeSpan CorruptionGrace = TimeSpan.FromMinutes(Core.SE ? 30.0 : 15.0);
|
||||
|
||||
// Sigil must be held at a stronghold for this amount of time in order to become corrupted
|
||||
public static readonly TimeSpan CorruptionPeriod = Core.SE ? TimeSpan.FromHours(10.0) : TimeSpan.FromHours(24.0);
|
||||
|
||||
// After a sigil has been corrupted it must be returned to the town within this period of time
|
||||
public static readonly TimeSpan ReturnPeriod = TimeSpan.FromHours(1.0);
|
||||
|
||||
// Once it's been returned the corrupting faction owns the town for this period of time
|
||||
public static readonly TimeSpan PurificationPeriod = TimeSpan.FromDays(3.0);
|
||||
private Faction m_Corrupted;
|
||||
private Faction m_Corrupting;
|
||||
|
||||
private Town m_Town;
|
||||
|
||||
public Sigil(Town town) : base(0x1869)
|
||||
{
|
||||
Movable = false;
|
||||
Town = town;
|
||||
|
||||
Sigils.Add(this);
|
||||
}
|
||||
|
||||
public Sigil(Serial serial) : base(serial)
|
||||
{
|
||||
Sigils.Add(this);
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public DateTime LastStolen{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public DateTime GraceStart{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public DateTime CorruptionStart{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public DateTime PurificationStart{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Town Town
|
||||
{
|
||||
get => m_Town;
|
||||
set
|
||||
{
|
||||
m_Town = value;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Faction Corrupted
|
||||
{
|
||||
get => m_Corrupted;
|
||||
set
|
||||
{
|
||||
m_Corrupted = value;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Faction Corrupting
|
||||
{
|
||||
get => m_Corrupting;
|
||||
set
|
||||
{
|
||||
m_Corrupting = value;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public BaseMonolith LastMonolith{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public bool IsBeingCorrupted => LastMonolith is StrongholdMonolith && LastMonolith.Faction == m_Corrupting &&
|
||||
m_Corrupting != null;
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public bool IsCorrupted => m_Corrupted != null;
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public bool IsPurifying => PurificationStart != DateTime.MinValue;
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public bool IsCorrupting => m_Corrupting != null && m_Corrupting != m_Corrupted;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeSpan TimeUntilCorruption
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsBeingCorrupted)
|
||||
return TimeSpan.Zero;
|
||||
|
||||
TimeSpan ts = CorruptionStart + CorruptionPeriod - DateTime.UtcNow;
|
||||
|
||||
if (ts < TimeSpan.Zero)
|
||||
ts = TimeSpan.Zero;
|
||||
|
||||
return ts;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Sigil> Sigils{ get; } = new List<Sigil>();
|
||||
|
||||
public void Update()
|
||||
{
|
||||
ItemID = m_Town?.Definition.SigilID ?? 0x1869;
|
||||
|
||||
if (m_Town == null)
|
||||
AssignName(null);
|
||||
else if (IsCorrupted || IsPurifying)
|
||||
AssignName(m_Town.Definition.CorruptedSigilName);
|
||||
else
|
||||
AssignName(m_Town.Definition.SigilName);
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (IsCorrupted)
|
||||
TextDefinition.AddTo(list, m_Corrupted.Definition.SigilControl);
|
||||
else
|
||||
list.Add(1042256); // This sigil is not corrupted.
|
||||
|
||||
if (IsCorrupting)
|
||||
list.Add(1042257); // This sigil is in the process of being corrupted.
|
||||
else if (IsPurifying)
|
||||
list.Add(1042258); // This sigil has recently been corrupted, and is undergoing purification.
|
||||
else
|
||||
list.Add(1042259); // This sigil is not in the process of being corrupted.
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
if (IsCorrupted)
|
||||
{
|
||||
if (m_Corrupted.Definition.SigilControl.Number > 0)
|
||||
LabelTo(from, m_Corrupted.Definition.SigilControl.Number);
|
||||
else if (m_Corrupted.Definition.SigilControl.String != null)
|
||||
LabelTo(from, m_Corrupted.Definition.SigilControl.String);
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, 1042256); // This sigil is not corrupted.
|
||||
}
|
||||
|
||||
if (IsCorrupting)
|
||||
LabelTo(from, 1042257); // This sigil is in the process of being corrupted.
|
||||
else if (IsPurifying)
|
||||
LabelTo(from, 1042258); // This sigil has been recently corrupted, and is undergoing purification.
|
||||
else
|
||||
LabelTo(from, 1042259); // This sigil is not in the process of being corrupted.
|
||||
}
|
||||
|
||||
public override bool CheckLift(Mobile from, Item item, ref LRReason reject)
|
||||
{
|
||||
from.SendLocalizedMessage(1005225); // You must use the stealing skill to pick up the sigil
|
||||
return false;
|
||||
}
|
||||
|
||||
private Mobile FindOwner(IEntity parent)
|
||||
{
|
||||
if (parent is Item item)
|
||||
return item.RootParent as Mobile;
|
||||
|
||||
if (parent is Mobile mobile)
|
||||
return mobile;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
base.OnAdded(parent);
|
||||
|
||||
Mobile mob = FindOwner(parent);
|
||||
|
||||
if (mob != null)
|
||||
mob.SolidHueOverride = OwnershipHue;
|
||||
}
|
||||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
base.OnRemoved(parent);
|
||||
|
||||
Mobile mob = FindOwner(parent);
|
||||
|
||||
if (mob != null)
|
||||
mob.SolidHueOverride = -1;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack))
|
||||
{
|
||||
from.BeginTarget(1, false, TargetFlags.None, Sigil_OnTarget);
|
||||
from.SendLocalizedMessage(1042251); // Click on a sigil monolith or player
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ExistsOn(Mobile mob)
|
||||
{
|
||||
return mob.Backpack?.FindItemByType<Sigil>() != null;
|
||||
}
|
||||
|
||||
private void BeginCorrupting(Faction faction)
|
||||
{
|
||||
m_Corrupting = faction;
|
||||
CorruptionStart = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
private void ClearCorrupting()
|
||||
{
|
||||
m_Corrupting = null;
|
||||
CorruptionStart = DateTime.MinValue;
|
||||
}
|
||||
|
||||
private void Sigil_OnTarget(Mobile from, object obj)
|
||||
{
|
||||
if (Deleted || !IsChildOf(from.Backpack))
|
||||
return;
|
||||
|
||||
#region Give To Mobile
|
||||
|
||||
if (obj is Mobile)
|
||||
{
|
||||
if (obj is PlayerMobile targ)
|
||||
{
|
||||
Faction toFaction = Faction.Find(targ);
|
||||
Faction fromFaction = Faction.Find(from);
|
||||
|
||||
if (toFaction == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1005223); // You cannot give the sigil to someone not in a faction
|
||||
}
|
||||
else if (fromFaction != toFaction)
|
||||
{
|
||||
from.SendLocalizedMessage(1005222); // You cannot give the sigil to someone not in your faction
|
||||
}
|
||||
else if (ExistsOn(targ))
|
||||
{
|
||||
from.SendLocalizedMessage(1005220); // You cannot give this sigil to someone who already has a sigil
|
||||
}
|
||||
else if (!targ.Alive)
|
||||
{
|
||||
from.SendLocalizedMessage(1042248); // You cannot give a sigil to a dead person.
|
||||
}
|
||||
else if (from.NetState != null && targ.NetState != null)
|
||||
{
|
||||
Container pack = targ.Backpack;
|
||||
|
||||
pack?.DropItem(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1005221); //You cannot give the sigil to them
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
else if (obj is BaseMonolith)
|
||||
{
|
||||
#region Put in Stronghold
|
||||
|
||||
if (obj is StrongholdMonolith sm)
|
||||
{
|
||||
if (sm.Faction == null || sm.Faction != Faction.Find(from))
|
||||
{
|
||||
from.SendLocalizedMessage(1042246); // You can't place that on an enemy monolith
|
||||
}
|
||||
else if (sm.Town == null || sm.Town != m_Town)
|
||||
{
|
||||
from.SendLocalizedMessage(1042247); // That is not the correct faction monolith
|
||||
}
|
||||
else
|
||||
{
|
||||
sm.Sigil = this;
|
||||
|
||||
Faction newController = sm.Faction;
|
||||
Faction oldController = m_Corrupting;
|
||||
|
||||
if (oldController == null)
|
||||
{
|
||||
if (m_Corrupted != newController)
|
||||
BeginCorrupting(newController);
|
||||
}
|
||||
else if (GraceStart > DateTime.MinValue && GraceStart + CorruptionGrace < DateTime.UtcNow)
|
||||
{
|
||||
if (m_Corrupted != newController)
|
||||
BeginCorrupting(newController); // grace time over, reset period
|
||||
else
|
||||
ClearCorrupting();
|
||||
|
||||
GraceStart = DateTime.MinValue;
|
||||
}
|
||||
else if (newController == oldController)
|
||||
{
|
||||
GraceStart = DateTime.MinValue; // returned within grace period
|
||||
}
|
||||
else if (GraceStart == DateTime.MinValue)
|
||||
{
|
||||
GraceStart = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
PurificationStart = DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Put in Town
|
||||
|
||||
else if (obj is TownMonolith tm)
|
||||
{
|
||||
if (tm.Town == null || tm.Town != m_Town)
|
||||
{
|
||||
from.SendLocalizedMessage(1042245); // This is not the correct town sigil monolith
|
||||
}
|
||||
else if (m_Corrupted == null || m_Corrupted != Faction.Find(from))
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1042244); // Your faction did not corrupt this sigil. Take it to your stronghold.
|
||||
}
|
||||
else
|
||||
{
|
||||
tm.Sigil = this;
|
||||
|
||||
m_Corrupting = null;
|
||||
PurificationStart = DateTime.UtcNow;
|
||||
CorruptionStart = DateTime.MinValue;
|
||||
|
||||
m_Town.Capture(m_Corrupted);
|
||||
m_Corrupted = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1005224); // You can't use the sigil on that
|
||||
}
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
Town.WriteReference(writer, m_Town);
|
||||
Faction.WriteReference(writer, m_Corrupted);
|
||||
Faction.WriteReference(writer, m_Corrupting);
|
||||
|
||||
writer.Write(LastMonolith);
|
||||
|
||||
writer.Write(LastStolen);
|
||||
writer.Write(GraceStart);
|
||||
writer.Write(CorruptionStart);
|
||||
writer.Write(PurificationStart);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Town = Town.ReadReference(reader);
|
||||
m_Corrupted = Faction.ReadReference(reader);
|
||||
m_Corrupting = Faction.ReadReference(reader);
|
||||
|
||||
LastMonolith = reader.ReadItem() as BaseMonolith;
|
||||
|
||||
LastStolen = reader.ReadDateTime();
|
||||
GraceStart = reader.ReadDateTime();
|
||||
CorruptionStart = reader.ReadDateTime();
|
||||
PurificationStart = reader.ReadDateTime();
|
||||
|
||||
Update();
|
||||
|
||||
if (RootParent is Mobile mob)
|
||||
mob.SolidHueOverride = OwnershipHue;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReturnHome()
|
||||
{
|
||||
BaseMonolith monolith = LastMonolith;
|
||||
|
||||
if (monolith == null && m_Town != null)
|
||||
monolith = m_Town.Monolith;
|
||||
|
||||
if (monolith?.Deleted == false)
|
||||
monolith.Sigil = this;
|
||||
|
||||
return monolith?.Deleted == false;
|
||||
}
|
||||
|
||||
public override void OnParentDeleted(IEntity parent)
|
||||
{
|
||||
base.OnParentDeleted(parent);
|
||||
|
||||
ReturnHome();
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
Sigils.Remove(this);
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
if (ReturnHome())
|
||||
return;
|
||||
|
||||
base.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
51
Projects/Scripts/Engines/Factions/Items/Silver.cs
Normal file
51
Projects/Scripts/Engines/Factions/Items/Silver.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
namespace Server.Factions
|
||||
{
|
||||
public class Silver : Item
|
||||
{
|
||||
[Constructible]
|
||||
public Silver() : this(1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Silver(int amountFrom, int amountTo) : this(Utility.RandomMinMax(amountFrom, amountTo))
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Silver(int amount) : base(0xEF0)
|
||||
{
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
public Silver(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override double DefaultWeight => 0.02;
|
||||
|
||||
public override int GetDropSound()
|
||||
{
|
||||
if (Amount <= 1)
|
||||
return 0x2E4;
|
||||
if (Amount <= 5)
|
||||
return 0x2E5;
|
||||
return 0x2E6;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
namespace Server.Factions
|
||||
{
|
||||
public class StrongholdMonolith : BaseMonolith
|
||||
{
|
||||
public StrongholdMonolith(Town town = null, Faction faction = null) : base(town, faction)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public StrongholdMonolith(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int DefaultLabelNumber => 1041042; // A Faction Sigil Monolith
|
||||
|
||||
public override void OnTownChanged()
|
||||
{
|
||||
AssignName(Town?.Definition.StrongholdMonolithName);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
34
Projects/Scripts/Engines/Factions/Items/TownMonolith.cs
Normal file
34
Projects/Scripts/Engines/Factions/Items/TownMonolith.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
namespace Server.Factions
|
||||
{
|
||||
public class TownMonolith : BaseMonolith
|
||||
{
|
||||
public TownMonolith(Town town = null) : base(town)
|
||||
{
|
||||
}
|
||||
|
||||
public TownMonolith(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int DefaultLabelNumber => 1041403; // A Faction Town Sigil Monolith
|
||||
|
||||
public override void OnTownChanged()
|
||||
{
|
||||
AssignName(Town?.Definition.TownMonolithName);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
79
Projects/Scripts/Engines/Factions/Items/TownStone.cs
Normal file
79
Projects/Scripts/Engines/Factions/Items/TownStone.cs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class TownStone : BaseSystemController
|
||||
{
|
||||
private Town m_Town;
|
||||
|
||||
[Constructible]
|
||||
public TownStone(Town town = null) : base(0xEDE)
|
||||
{
|
||||
Movable = false;
|
||||
Town = town;
|
||||
}
|
||||
|
||||
public TownStone(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
|
||||
public Town Town
|
||||
{
|
||||
get => m_Town;
|
||||
set
|
||||
{
|
||||
m_Town = value;
|
||||
|
||||
AssignName(m_Town?.Definition.TownStoneName);
|
||||
}
|
||||
}
|
||||
|
||||
public override string DefaultName => "faction town stone";
|
||||
|
||||
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 mobile)
|
||||
mobile.SendGump(new TownStoneGump(mobile, m_Town.Owner, m_Town));
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
264
Projects/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs
Normal file
264
Projects/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs
Normal file
|
|
@ -0,0 +1,264 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public enum AllowedPlacing
|
||||
{
|
||||
Everywhere,
|
||||
|
||||
AnyFactionTown,
|
||||
ControlledFactionTown,
|
||||
FactionStronghold
|
||||
}
|
||||
|
||||
public abstract class BaseFactionTrap : BaseTrap
|
||||
{
|
||||
private Timer m_Concealing;
|
||||
|
||||
public BaseFactionTrap(Faction f, Mobile m, int itemID) : base(itemID)
|
||||
{
|
||||
Visible = false;
|
||||
|
||||
Faction = f;
|
||||
TimeOfPlacement = DateTime.UtcNow;
|
||||
Placer = m;
|
||||
}
|
||||
|
||||
public BaseFactionTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Faction Faction{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Placer{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime TimeOfPlacement{ get; set; }
|
||||
|
||||
public virtual int EffectSound => 0;
|
||||
|
||||
public virtual int SilverFromDisarm => 100;
|
||||
|
||||
public virtual int MessageHue => 0;
|
||||
|
||||
public virtual int AttackMessage => 0;
|
||||
public virtual int DisarmMessage => 0;
|
||||
|
||||
public virtual AllowedPlacing AllowedPlacing => AllowedPlacing.Everywhere;
|
||||
|
||||
public virtual TimeSpan ConcealPeriod => 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 && Placer != null && Faction != null)
|
||||
{
|
||||
PlayerState victimState = PlayerState.Find(from);
|
||||
|
||||
if (victimState?.CanGiveSilverTo(Placer) == true && victimState.KillPoints > 0)
|
||||
{
|
||||
int silverGiven = Faction.AwardSilver(Placer, silverToAward);
|
||||
|
||||
if (silverGiven > 0)
|
||||
{
|
||||
// TODO: Get real message
|
||||
if (from.Alive)
|
||||
Placer.SendMessage("You have earned {0} silver pieces because {1} fell for your trap.",
|
||||
silverGiven, from.Name);
|
||||
else
|
||||
Placer.SendLocalizedMessage(1042736,
|
||||
$"{silverGiven} silver\t{from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
|
||||
}
|
||||
|
||||
victimState.OnGivenSilverTo(Placer);
|
||||
}
|
||||
}
|
||||
|
||||
from.LocalOverheadMessage(MessageType.Regular, MessageHue, AttackMessage);
|
||||
}
|
||||
|
||||
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 trap && trap.Faction == Faction)
|
||||
return 1075263; // There is already a trap belonging to your faction at this location.;
|
||||
|
||||
switch (AllowedPlacing)
|
||||
{
|
||||
case AllowedPlacing.FactionStronghold:
|
||||
{
|
||||
StrongholdRegion region = Region.Find(p, m).GetRegion<StrongholdRegion>();
|
||||
|
||||
if (region != null && region.Faction == 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 == 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.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)
|
||||
{
|
||||
NetState ns = to?.NetState;
|
||||
|
||||
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 (TimeOfPlacement + decayPeriod < DateTime.UtcNow)
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.Zero, Delete);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void BeginConceal()
|
||||
{
|
||||
m_Concealing?.Stop();
|
||||
|
||||
m_Concealing = Timer.DelayCall(ConcealPeriod, Conceal);
|
||||
}
|
||||
|
||||
public virtual void Conceal()
|
||||
{
|
||||
m_Concealing?.Stop();
|
||||
|
||||
m_Concealing = null;
|
||||
|
||||
if (!Deleted)
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
Faction.WriteReference(writer, Faction);
|
||||
writer.Write(Placer);
|
||||
writer.Write(TimeOfPlacement);
|
||||
|
||||
if (Visible)
|
||||
BeginConceal();
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Faction = Faction.ReadReference(reader);
|
||||
Placer = reader.ReadMobile();
|
||||
TimeOfPlacement = reader.ReadDateTime();
|
||||
|
||||
if (Visible)
|
||||
BeginConceal();
|
||||
|
||||
CheckDecay();
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
if (Faction?.Traps.Contains(this) == true)
|
||||
Faction.Traps.Remove(this);
|
||||
|
||||
base.OnDelete();
|
||||
}
|
||||
|
||||
public virtual bool IsEnemy(Mobile mob)
|
||||
{
|
||||
if (mob.Hidden && mob.AccessLevel > AccessLevel.Player)
|
||||
return false;
|
||||
|
||||
if (!mob.Alive || mob.IsDeadBondedPet)
|
||||
return false;
|
||||
|
||||
Faction faction = Faction.Find(mob, true);
|
||||
|
||||
if (faction == null && mob is BaseFactionGuard guard)
|
||||
faction = guard.Faction;
|
||||
|
||||
if (faction == null)
|
||||
return false;
|
||||
|
||||
return faction != Faction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
using System;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public abstract class BaseFactionTrapDeed : Item, ICraftable
|
||||
{
|
||||
private Faction m_Faction;
|
||||
|
||||
public BaseFactionTrapDeed(int itemID= 0x14F0) : base(itemID)
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public BaseFactionTrapDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract Type TrapType{ get; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set
|
||||
{
|
||||
m_Faction = value;
|
||||
|
||||
if (m_Faction != null)
|
||||
Hue = m_Faction.Definition.HuePrimary;
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
public virtual BaseFactionTrap Construct(Mobile from)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Activator.CreateInstance(TrapType, 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(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class FactionExplosionTrap : BaseFactionTrap
|
||||
{
|
||||
public FactionExplosionTrap(Faction f = null, Mobile m = null) : base(f, m, 0x11C1)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionExplosionTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1044599; // faction explosion trap
|
||||
|
||||
public override int AttackMessage => 1010543; // You are enveloped in an explosion of fire!
|
||||
public override int DisarmMessage => 1010539; // You carefully remove the pressure trigger and disable the trap.
|
||||
public override int EffectSound => 0x307;
|
||||
public override int MessageHue => 0x78;
|
||||
|
||||
public override AllowedPlacing AllowedPlacing => 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);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class FactionExplosionTrapDeed : BaseFactionTrapDeed
|
||||
{
|
||||
public FactionExplosionTrapDeed() : base(0x36D2)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionExplosionTrapDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Type TrapType => typeof(FactionExplosionTrap);
|
||||
public override int LabelNumber => 1044603; // faction explosion trap deed
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class FactionGasTrap : BaseFactionTrap
|
||||
{
|
||||
public FactionGasTrap(Faction f = null, Mobile m = null) : base(f, m, 0x113C)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionGasTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1044598; // faction gas trap
|
||||
|
||||
public override int AttackMessage => 1010542; // A noxious green cloud of poison gas envelops you!
|
||||
public override int DisarmMessage => 502376; // The poison leaks harmlessly away due to your deft touch.
|
||||
public override int EffectSound => 0x230;
|
||||
public override int MessageHue => 0x44;
|
||||
|
||||
public override AllowedPlacing AllowedPlacing => AllowedPlacing.FactionStronghold;
|
||||
|
||||
public override void DoVisibleEffect()
|
||||
{
|
||||
Effects.SendLocationEffect(Location, 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(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 => typeof(FactionGasTrap);
|
||||
public override int LabelNumber => 1044602; // faction gas trap deed
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class FactionSawTrap : BaseFactionTrap
|
||||
{
|
||||
public FactionSawTrap(Faction f = null, Mobile m = null) : base(f, m, 0x11AC)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041047; // faction saw trap
|
||||
|
||||
public override int AttackMessage => 1010544; // The blade cuts deep into your skin!
|
||||
public override int DisarmMessage => 1010540; // You carefully dismantle the saw mechanism and disable the trap.
|
||||
public override int EffectSound => 0x218;
|
||||
public override int MessageHue => 0x5A;
|
||||
|
||||
public override AllowedPlacing AllowedPlacing => AllowedPlacing.ControlledFactionTown;
|
||||
|
||||
public override void DoVisibleEffect()
|
||||
{
|
||||
Effects.SendLocationEffect(Location, 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(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 => typeof(FactionSawTrap);
|
||||
public override int LabelNumber => 1044604; // faction saw trap deed
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class FactionSpikeTrap : BaseFactionTrap
|
||||
{
|
||||
public FactionSpikeTrap(Faction f = null, Mobile m = null) : base(f, m, 0x11A0)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionSpikeTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1044601; // faction spike trap
|
||||
|
||||
public override int AttackMessage => 1010545; // Large spikes in the ground spring up piercing your skin!
|
||||
|
||||
public override int DisarmMessage =>
|
||||
1010541; // You carefully dismantle the trigger on the spikes and disable the trap.
|
||||
|
||||
public override int EffectSound => 0x22E;
|
||||
public override int MessageHue => 0x5A;
|
||||
|
||||
public override AllowedPlacing AllowedPlacing => AllowedPlacing.ControlledFactionTown;
|
||||
|
||||
public override void DoVisibleEffect()
|
||||
{
|
||||
Effects.SendLocationEffect(Location, 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(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 => typeof(FactionSpikeTrap);
|
||||
public override int LabelNumber => 1044605; // faction spike trap deed
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
namespace Server.Factions
|
||||
{
|
||||
public class FactionTrapRemovalKit : Item
|
||||
{
|
||||
[Constructible]
|
||||
public FactionTrapRemovalKit() : base(7867)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Charges = 25;
|
||||
}
|
||||
|
||||
public FactionTrapRemovalKit(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Charges{ get; set; }
|
||||
|
||||
public override int LabelNumber => 1041508; // a faction trap removal kit
|
||||
|
||||
public void ConsumeCharge(Mobile consumer)
|
||||
{
|
||||
--Charges;
|
||||
|
||||
if (Charges <= 0)
|
||||
{
|
||||
Delete();
|
||||
|
||||
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, Charges.ToString()); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.WriteEncodedInt(Charges);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Charges = reader.ReadEncodedInt();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Charges = 25;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue