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,249 @@
using System;
using Server.Mobiles;
namespace Server.Ethics
{
public abstract class Ethic
{
public static readonly bool Enabled = false;
public static readonly Ethic Hero = new Hero.HeroEthic();
public static readonly Ethic Evil = new Evil.EvilEthic();
public static readonly Ethic[] Ethics = new Ethic[]
{
Hero,
Evil
};
protected EthicDefinition m_Definition;
protected PlayerCollection m_Players;
public Ethic()
{
this.m_Players = new PlayerCollection();
}
public EthicDefinition Definition
{
get
{
return this.m_Definition;
}
}
public PlayerCollection Players
{
get
{
return this.m_Players;
}
}
public static Ethic Find(Item item)
{
if ((item.SavedFlags & 0x100) != 0)
{
if (item.Hue == Hero.Definition.PrimaryHue)
return Hero;
item.SavedFlags &= ~0x100;
}
if ((item.SavedFlags & 0x200) != 0)
{
if (item.Hue == Evil.Definition.PrimaryHue)
return Evil;
item.SavedFlags &= ~0x200;
}
return null;
}
public static bool CheckTrade(Mobile from, Mobile to, Mobile newOwner, Item item)
{
Ethic itemEthic = Find(item);
if (itemEthic == null || Find(newOwner) == itemEthic)
return true;
if (itemEthic == Hero)
(from == newOwner ? to : from).SendMessage("Only heros may receive this item.");
else if (itemEthic == Evil)
(from == newOwner ? to : from).SendMessage("Only the evil may receive this item.");
return false;
}
public static bool CheckEquip(Mobile from, Item item)
{
Ethic itemEthic = Find(item);
if (itemEthic == null || Find(from) == itemEthic)
return true;
if (itemEthic == Hero)
from.SendMessage("Only heros may wear this item.");
else if (itemEthic == Evil)
from.SendMessage("Only the evil may wear this item.");
return false;
}
public static bool IsImbued(Item item)
{
return IsImbued(item, false);
}
public static bool IsImbued(Item item, bool recurse)
{
if (Find(item) != null)
return true;
if (recurse)
{
foreach (Item child in item.Items)
{
if (IsImbued(child, true))
return true;
}
}
return false;
}
public static void Initialize()
{
if (Enabled)
EventSink.Speech += new SpeechEventHandler(EventSink_Speech);
}
public static void EventSink_Speech(SpeechEventArgs e)
{
if (e.Blocked || e.Handled)
return;
Player pl = Player.Find(e.Mobile);
if (pl == null)
{
for (int i = 0; i < Ethics.Length; ++i)
{
Ethic ethic = Ethics[i];
if (!ethic.IsEligible(e.Mobile))
continue;
if (!Insensitive.Equals(ethic.Definition.JoinPhrase.String, e.Speech))
continue;
bool isNearAnkh = false;
foreach (Item item in e.Mobile.GetItemsInRange(2))
{
if (item is Items.AnkhNorth || item is Items.AnkhWest)
{
isNearAnkh = true;
break;
}
}
if (!isNearAnkh)
continue;
pl = new Player(ethic, e.Mobile);
pl.Attach();
e.Mobile.FixedEffect(0x373A, 10, 30);
e.Mobile.PlaySound(0x209);
e.Handled = true;
break;
}
}
else
{
Ethic ethic = pl.Ethic;
for (int i = 0; i < ethic.Definition.Powers.Length; ++i)
{
Power power = ethic.Definition.Powers[i];
if (!Insensitive.Equals(power.Definition.Phrase.String, e.Speech))
continue;
if (!power.CheckInvoke(pl))
continue;
power.BeginInvoke(pl);
e.Handled = true;
break;
}
}
}
public static Ethic Find(Mobile mob)
{
return Find(mob, false, false);
}
public static Ethic Find(Mobile mob, bool inherit)
{
return Find(mob, inherit, false);
}
public static Ethic Find(Mobile mob, bool inherit, bool allegiance)
{
Player pl = Player.Find(mob);
if (pl != null)
return pl.Ethic;
if (inherit && mob is BaseCreature)
{
BaseCreature bc = (BaseCreature)mob;
if (bc.Controlled)
return Find(bc.ControlMaster, false);
else if (bc.Summoned)
return Find(bc.SummonMaster, false);
else if (allegiance)
return bc.EthicAllegiance;
}
return null;
}
public abstract bool IsEligible(Mobile mob);
public virtual void Deserialize(GenericReader reader)
{
int version = reader.ReadEncodedInt();
switch ( version )
{
case 0:
{
int playerCount = reader.ReadEncodedInt();
for (int i = 0; i < playerCount; ++i)
{
Player pl = new Player(this, reader);
if (pl.Mobile != null)
Timer.DelayCall(TimeSpan.Zero, new TimerCallback(pl.CheckAttach));
}
break;
}
}
}
public virtual void Serialize(GenericWriter writer)
{
writer.WriteEncodedInt(0); // version
writer.WriteEncodedInt(this.m_Players.Count);
for (int i = 0; i < this.m_Players.Count; ++i)
this.m_Players[i].Serialize(writer);
}
}
}

View File

@@ -0,0 +1,73 @@
using System;
namespace Server.Ethics
{
[TypeAlias("Server.Factions.EthicsPersistance")]
public class EthicsPersistence : Item
{
private static EthicsPersistence m_Instance;
[Constructable]
public EthicsPersistence()
: base(1)
{
this.Movable = false;
if (m_Instance == null || m_Instance.Deleted)
m_Instance = this;
else
base.Delete();
}
public EthicsPersistence(Serial serial)
: base(serial)
{
m_Instance = this;
}
public static EthicsPersistence Instance
{
get
{
return m_Instance;
}
}
public override string DefaultName
{
get
{
return "Ethics Persistence - Internal";
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
for (int i = 0; i < Ethics.Ethic.Ethics.Length; ++i)
Ethics.Ethic.Ethics[i].Serialize(writer);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
for (int i = 0; i < Ethics.Ethic.Ethics.Length; ++i)
Ethics.Ethic.Ethics[i].Deserialize(reader);
break;
}
}
}
public override void Delete()
{
}
}
}

View File

@@ -0,0 +1,211 @@
using System;
using Server.Mobiles;
namespace Server.Ethics
{
public class PlayerCollection : System.Collections.ObjectModel.Collection<Player>
{
}
[PropertyObject]
public class Player
{
private readonly Ethic m_Ethic;
private readonly Mobile m_Mobile;
private int m_Power;
private int m_History;
private Mobile m_Steed;
private Mobile m_Familiar;
private DateTime m_Shield;
public Player(Ethic ethic, Mobile mobile)
{
this.m_Ethic = ethic;
this.m_Mobile = mobile;
this.m_Power = 5;
this.m_History = 5;
}
public Player(Ethic ethic, GenericReader reader)
{
this.m_Ethic = ethic;
int version = reader.ReadEncodedInt();
switch ( version )
{
case 0:
{
this.m_Mobile = reader.ReadMobile();
this.m_Power = reader.ReadEncodedInt();
this.m_History = reader.ReadEncodedInt();
this.m_Steed = reader.ReadMobile();
this.m_Familiar = reader.ReadMobile();
this.m_Shield = reader.ReadDeltaTime();
break;
}
}
}
public Ethic Ethic
{
get
{
return this.m_Ethic;
}
}
public Mobile Mobile
{
get
{
return this.m_Mobile;
}
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public int Power
{
get
{
return this.m_Power;
}
set
{
this.m_Power = value;
}
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public int History
{
get
{
return this.m_History;
}
set
{
this.m_History = value;
}
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public Mobile Steed
{
get
{
return this.m_Steed;
}
set
{
this.m_Steed = value;
}
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public Mobile Familiar
{
get
{
return this.m_Familiar;
}
set
{
this.m_Familiar = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool IsShielded
{
get
{
if (this.m_Shield == DateTime.MinValue)
return false;
if (DateTime.UtcNow < (this.m_Shield + TimeSpan.FromHours(1.0)))
return true;
this.FinishShield();
return false;
}
}
public static Player Find(Mobile mob)
{
return Find(mob, false);
}
public static Player Find(Mobile mob, bool inherit)
{
PlayerMobile pm = mob as PlayerMobile;
if (pm == null)
{
if (inherit && mob is BaseCreature)
{
BaseCreature bc = mob as BaseCreature;
if (bc != null && bc.Controlled)
pm = bc.ControlMaster as PlayerMobile;
else if (bc != null && bc.Summoned)
pm = bc.SummonMaster as PlayerMobile;
}
if (pm == null)
return null;
}
Player pl = pm.EthicPlayer;
if (pl != null && !pl.Ethic.IsEligible(pl.Mobile))
pm.EthicPlayer = pl = null;
return pl;
}
public void BeginShield()
{
this.m_Shield = DateTime.UtcNow;
}
public void FinishShield()
{
this.m_Shield = DateTime.MinValue;
}
public void CheckAttach()
{
if (this.m_Ethic.IsEligible(this.m_Mobile))
this.Attach();
}
public void Attach()
{
if (this.m_Mobile is PlayerMobile)
(this.m_Mobile as PlayerMobile).EthicPlayer = this;
this.m_Ethic.Players.Add(this);
}
public void Detach()
{
if (this.m_Mobile is PlayerMobile)
(this.m_Mobile as PlayerMobile).EthicPlayer = null;
this.m_Ethic.Players.Remove(this);
}
public void Serialize(GenericWriter writer)
{
writer.WriteEncodedInt(0); // version
writer.Write(this.m_Mobile);
writer.WriteEncodedInt(this.m_Power);
writer.WriteEncodedInt(this.m_History);
writer.Write(this.m_Steed);
writer.Write(this.m_Familiar);
writer.WriteDeltaTime(this.m_Shield);
}
}
}

View File

@@ -0,0 +1,36 @@
using System;
namespace Server.Ethics
{
public abstract class Power
{
protected PowerDefinition m_Definition;
public PowerDefinition Definition
{
get
{
return this.m_Definition;
}
}
public virtual bool CheckInvoke(Player from)
{
if (!from.Mobile.CheckAlive())
return false;
if (from.Power < this.m_Definition.Power)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You lack the power to invoke this ability.");
return false;
}
return true;
}
public abstract void BeginInvoke(Player from);
public virtual void FinishInvoke(Player from)
{
from.Power -= this.m_Definition.Power;
}
}
}

View File

@@ -0,0 +1,60 @@
using System;
namespace Server.Ethics
{
public class EthicDefinition
{
private readonly int m_PrimaryHue;
private readonly TextDefinition m_Title;
private readonly TextDefinition m_Adjunct;
private readonly TextDefinition m_JoinPhrase;
private readonly Power[] m_Powers;
public EthicDefinition(int primaryHue, TextDefinition title, TextDefinition adjunct, TextDefinition joinPhrase, Power[] powers)
{
this.m_PrimaryHue = primaryHue;
this.m_Title = title;
this.m_Adjunct = adjunct;
this.m_JoinPhrase = joinPhrase;
this.m_Powers = powers;
}
public int PrimaryHue
{
get
{
return this.m_PrimaryHue;
}
}
public TextDefinition Title
{
get
{
return this.m_Title;
}
}
public TextDefinition Adjunct
{
get
{
return this.m_Adjunct;
}
}
public TextDefinition JoinPhrase
{
get
{
return this.m_JoinPhrase;
}
}
public Power[] Powers
{
get
{
return this.m_Powers;
}
}
}
}

View File

@@ -0,0 +1,49 @@
using System;
namespace Server.Ethics
{
public class PowerDefinition
{
private readonly int m_Power;
private readonly TextDefinition m_Name;
private readonly TextDefinition m_Phrase;
private readonly TextDefinition m_Description;
public PowerDefinition(int power, TextDefinition name, TextDefinition phrase, TextDefinition description)
{
this.m_Power = power;
this.m_Name = name;
this.m_Phrase = phrase;
this.m_Description = description;
}
public int Power
{
get
{
return this.m_Power;
}
}
public TextDefinition Name
{
get
{
return this.m_Name;
}
}
public TextDefinition Phrase
{
get
{
return this.m_Phrase;
}
}
public TextDefinition Description
{
get
{
return this.m_Description;
}
}
}
}

View File

@@ -0,0 +1,34 @@
using System;
using Server.Factions;
namespace Server.Ethics.Evil
{
public sealed class EvilEthic : Ethic
{
public EvilEthic()
{
this.m_Definition = new EthicDefinition(
0x455,
"Evil", "(Evil)",
"I am evil incarnate",
new Power[]
{
new UnholySense(),
new UnholyItem(),
new SummonFamiliar(),
new VileBlade(),
new BlightPower(),
new UnholyShield(),
new UnholySteed(),
new UnholyWord()
});
}
public override bool IsEligible(Mobile mob)
{
Faction fac = Faction.Find(mob);
return (fac is Minax || fac is Shadowlords);
}
}
}

View File

@@ -0,0 +1,118 @@
using System;
using Server.Ethics;
namespace Server.Mobiles
{
[CorpseName("an evil corpse")]
public class UnholyFamiliar : BaseCreature
{
[Constructable]
public UnholyFamiliar()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
this.Name = "a dark wolf";
this.Body = 99;
this.BaseSoundID = 0xE5;
this.SetStr(96, 120);
this.SetDex(81, 105);
this.SetInt(36, 60);
this.SetHits(58, 72);
this.SetMana(0);
this.SetDamage(11, 17);
this.SetDamageType(ResistanceType.Physical, 100);
this.SetResistance(ResistanceType.Physical, 20, 25);
this.SetResistance(ResistanceType.Fire, 10, 20);
this.SetResistance(ResistanceType.Cold, 5, 10);
this.SetResistance(ResistanceType.Poison, 5, 10);
this.SetResistance(ResistanceType.Energy, 10, 15);
this.SetSkill(SkillName.MagicResist, 57.6, 75.0);
this.SetSkill(SkillName.Tactics, 50.1, 70.0);
this.SetSkill(SkillName.Wrestling, 60.1, 80.0);
this.Fame = 2500;
this.Karma = 2500;
this.VirtualArmor = 22;
this.Tamable = false;
this.ControlSlots = 1;
}
public UnholyFamiliar(Serial serial)
: base(serial)
{
}
public override bool IsDispellable
{
get
{
return false;
}
}
public override bool IsBondable
{
get
{
return false;
}
}
public override int Meat
{
get
{
return 1;
}
}
public override int Hides
{
get
{
return 7;
}
}
public override FoodType FavoriteFood
{
get
{
return FoodType.Meat;
}
}
public override PackInstinct PackInstinct
{
get
{
return PackInstinct.Canine;
}
}
public override string ApplyNameSuffix(string suffix)
{
if (suffix.Length == 0)
suffix = Ethic.Evil.Definition.Adjunct.String;
else
suffix = String.Concat(suffix, " ", Ethic.Evil.Definition.Adjunct.String);
return base.ApplyNameSuffix(suffix);
}
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,104 @@
using System;
using Server.Ethics;
namespace Server.Mobiles
{
[CorpseName("an unholy corpse")]
public class UnholySteed : BaseMount
{
[Constructable]
public UnholySteed()
: base("a dark steed", 0x74, 0x3EA7, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
{
SetStr(496, 525);
SetDex(86, 105);
SetInt(86, 125);
SetHits(298, 315);
SetDamage(16, 22);
SetDamageType(ResistanceType.Physical, 40);
SetDamageType(ResistanceType.Fire, 40);
SetDamageType(ResistanceType.Energy, 20);
SetResistance(ResistanceType.Physical, 55, 65);
SetResistance(ResistanceType.Fire, 30, 40);
SetResistance(ResistanceType.Cold, 30, 40);
SetResistance(ResistanceType.Poison, 30, 40);
SetResistance(ResistanceType.Energy, 20, 30);
SetSkill(SkillName.MagicResist, 25.1, 30.0);
SetSkill(SkillName.Tactics, 97.6, 100.0);
SetSkill(SkillName.Wrestling, 80.5, 92.5);
Fame = 14000;
Karma = -14000;
VirtualArmor = 60;
Tamable = false;
ControlSlots = 1;
SetSpecialAbility(SpecialAbility.DragonBreath);
}
public UnholySteed(Serial serial)
: base(serial)
{
}
public override bool IsDispellable
{
get
{
return false;
}
}
public override bool IsBondable
{
get
{
return false;
}
}
public override FoodType FavoriteFood
{
get
{
return FoodType.FruitsAndVegies | FoodType.GrainsAndHay;
}
}
public override string ApplyNameSuffix(string suffix)
{
if (suffix.Length == 0)
suffix = Ethic.Evil.Definition.Adjunct.String;
else
suffix = String.Concat(suffix, " ", Ethic.Evil.Definition.Adjunct.String);
return base.ApplyNameSuffix(suffix);
}
public override void OnDoubleClick(Mobile from)
{
if (Ethic.Find(from) != Ethic.Evil)
from.SendMessage("You may not ride this steed.");
else
base.OnDoubleClick(from);
}
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,80 @@
using System;
using Server.Spells;
namespace Server.Ethics.Evil
{
public sealed class BlightPower : Power
{
public BlightPower()
{
this.m_Definition = new PowerDefinition(
15,
"Blight",
"Velgo Ontawl",
"");
}
public override void BeginInvoke(Player from)
{
from.Mobile.BeginTarget(12, true, Targeting.TargetFlags.None, new TargetStateCallback(Power_OnTarget), from);
from.Mobile.SendMessage("Where do you wish to blight?");
}
private void Power_OnTarget(Mobile fromMobile, object obj, object state)
{
Player from = state as Player;
IPoint3D p = obj as IPoint3D;
if (p == null)
return;
if (!this.CheckInvoke(from))
return;
bool powerFunctioned = false;
SpellHelper.GetSurfaceTop(ref p);
IPooledEnumerable eable = from.Mobile.GetMobilesInRange(6);
foreach (Mobile mob in eable)
{
if (mob == from.Mobile || !SpellHelper.ValidIndirectTarget(from.Mobile, mob))
continue;
if (mob.GetStatMod("Holy Curse") != null)
continue;
if (!from.Mobile.CanBeHarmful(mob, false))
continue;
from.Mobile.DoHarmful(mob, true);
mob.AddStatMod(new StatMod(StatType.All, "Holy Curse", -10, TimeSpan.FromMinutes(30.0)));
mob.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
mob.PlaySound(0x1FB);
powerFunctioned = true;
}
eable.Free();
if (powerFunctioned)
{
SpellHelper.Turn(from.Mobile, p);
Effects.PlaySound(p, from.Mobile.Map, 0x1FB);
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You curse the area.");
this.FinishInvoke(from);
}
else
{
from.Mobile.FixedEffect(0x3735, 6, 30);
from.Mobile.PlaySound(0x5C);
}
}
}
}

View File

@@ -0,0 +1,44 @@
using System;
using Server.Mobiles;
namespace Server.Ethics.Evil
{
public sealed class SummonFamiliar : Power
{
public SummonFamiliar()
{
this.m_Definition = new PowerDefinition(
5,
"Summon Familiar",
"Trubechs Vingir",
"");
}
public override void BeginInvoke(Player from)
{
if (from.Familiar != null && from.Familiar.Deleted)
from.Familiar = null;
if (from.Familiar != null)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You already have an unholy familiar.");
return;
}
if ((from.Mobile.Followers + 1) > from.Mobile.FollowersMax)
{
from.Mobile.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
return;
}
UnholyFamiliar familiar = new UnholyFamiliar();
if (Mobiles.BaseCreature.Summon(familiar, from.Mobile, from.Mobile.Location, 0x217, TimeSpan.FromHours(1.0)))
{
from.Familiar = familiar;
this.FinishInvoke(from);
}
}
}
}

View File

@@ -0,0 +1,68 @@
using System;
using Server.Items;
namespace Server.Ethics.Evil
{
public sealed class UnholyItem : Power
{
public UnholyItem()
{
this.m_Definition = new PowerDefinition(
5,
"Unholy Item",
"Vidda K'balc",
"");
}
public override void BeginInvoke(Player from)
{
from.Mobile.BeginTarget(12, false, Targeting.TargetFlags.None, new TargetStateCallback(Power_OnTarget), from);
from.Mobile.SendMessage("Which item do you wish to imbue?");
}
private void Power_OnTarget(Mobile fromMobile, object obj, object state)
{
Player from = state as Player;
Item item = obj as Item;
if (item == null)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You may not imbue that.");
return;
}
if (item.Parent != from.Mobile)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You may only imbue items you are wearing.");
return;
}
if ((item.SavedFlags & 0x300) != 0)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "That has already beem imbued.");
return;
}
bool canImbue = (item is Spellbook || item is BaseClothing || item is BaseArmor || item is BaseWeapon) && (item.Name == null);
if (canImbue)
{
if (!this.CheckInvoke(from))
return;
item.Hue = Ethic.Evil.Definition.PrimaryHue;
item.SavedFlags |= 0x200;
from.Mobile.FixedEffect(0x375A, 10, 20);
from.Mobile.PlaySound(0x209);
this.FinishInvoke(from);
}
else
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You may not imbue that.");
}
}
}
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Text;
namespace Server.Ethics.Evil
{
public sealed class UnholySense : Power
{
public UnholySense()
{
this.m_Definition = new PowerDefinition(
0,
"Unholy Sense",
"Drewrok Velgo",
"");
}
public override void BeginInvoke(Player from)
{
Ethic opposition = Ethic.Hero;
int enemyCount = 0;
int maxRange = 18 + from.Power;
Player primary = null;
foreach (Player pl in opposition.Players)
{
Mobile mob = pl.Mobile;
if (mob == null || mob.Map != from.Mobile.Map || !mob.Alive)
continue;
if (!mob.InRange(from.Mobile, Math.Max(18, maxRange - pl.Power)))
continue;
if (primary == null || pl.Power > primary.Power)
primary = pl;
++enemyCount;
}
StringBuilder sb = new StringBuilder();
sb.Append("You sense ");
sb.Append(enemyCount == 0 ? "no" : enemyCount.ToString());
sb.Append(enemyCount == 1 ? " enemy" : " enemies");
if (primary != null)
{
sb.Append(", and a strong presense");
switch ( from.Mobile.GetDirectionTo(primary.Mobile) )
{
case Direction.West:
sb.Append(" to the west.");
break;
case Direction.East:
sb.Append(" to the east.");
break;
case Direction.North:
sb.Append(" to the north.");
break;
case Direction.South:
sb.Append(" to the south.");
break;
case Direction.Up:
sb.Append(" to the north-west.");
break;
case Direction.Down:
sb.Append(" to the south-east.");
break;
case Direction.Left:
sb.Append(" to the south-west.");
break;
case Direction.Right:
sb.Append(" to the north-east.");
break;
}
}
else
{
sb.Append('.');
}
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x59, false, sb.ToString());
this.FinishInvoke(from);
}
}
}

View File

@@ -0,0 +1,31 @@
using System;
namespace Server.Ethics.Evil
{
public sealed class UnholyShield : Power
{
public UnholyShield()
{
this.m_Definition = new PowerDefinition(
20,
"Unholy Shield",
"Velgo K'blac",
"");
}
public override void BeginInvoke(Player from)
{
if (from.IsShielded)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You are already under the protection of an unholy shield.");
return;
}
from.BeginShield();
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You are now under the protection of an unholy shield.");
this.FinishInvoke(from);
}
}
}

View File

@@ -0,0 +1,43 @@
using System;
namespace Server.Ethics.Evil
{
public sealed class UnholySteed : Power
{
public UnholySteed()
{
this.m_Definition = new PowerDefinition(
30,
"Unholy Steed",
"Trubechs Yeliab",
"");
}
public override void BeginInvoke(Player from)
{
if (from.Steed != null && from.Steed.Deleted)
from.Steed = null;
if (from.Steed != null)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You already have an unholy steed.");
return;
}
if ((from.Mobile.Followers + 1) > from.Mobile.FollowersMax)
{
from.Mobile.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
return;
}
Mobiles.UnholySteed steed = new Mobiles.UnholySteed();
if (Mobiles.BaseCreature.Summon(steed, from.Mobile, from.Mobile.Location, 0x217, TimeSpan.FromHours(1.0)))
{
from.Steed = steed;
this.FinishInvoke(from);
}
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
namespace Server.Ethics.Evil
{
public sealed class UnholyWord : Power
{
public UnholyWord()
{
this.m_Definition = new PowerDefinition(
100,
"Unholy Word",
"Velgo Oostrac",
"");
}
public override void BeginInvoke(Player from)
{
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
namespace Server.Ethics.Evil
{
public sealed class VileBlade : Power
{
public VileBlade()
{
this.m_Definition = new PowerDefinition(
10,
"Vile Blade",
"Velgo Reyam",
"");
}
public override void BeginInvoke(Player from)
{
}
}
}

View File

@@ -0,0 +1,37 @@
using System;
using Server.Factions;
namespace Server.Ethics.Hero
{
public sealed class HeroEthic : Ethic
{
public HeroEthic()
{
this.m_Definition = new EthicDefinition(
0x482,
"Hero", "(Hero)",
"I will defend the virtues",
new Power[]
{
new HolySense(),
new HolyItem(),
new SummonFamiliar(),
new HolyBlade(),
new Bless(),
new HolyShield(),
new HolySteed(),
new HolyWord()
});
}
public override bool IsEligible(Mobile mob)
{
if (mob.Murderer)
return false;
Faction fac = Faction.Find(mob);
return (fac is TrueBritannians || fac is CouncilOfMages);
}
}
}

View File

@@ -0,0 +1,118 @@
using System;
using Server.Ethics;
namespace Server.Mobiles
{
[CorpseName("a holy corpse")]
public class HolyFamiliar : BaseCreature
{
[Constructable]
public HolyFamiliar()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
this.Name = "a silver wolf";
this.Body = 100;
this.BaseSoundID = 0xE5;
this.SetStr(96, 120);
this.SetDex(81, 105);
this.SetInt(36, 60);
this.SetHits(58, 72);
this.SetMana(0);
this.SetDamage(11, 17);
this.SetDamageType(ResistanceType.Physical, 100);
this.SetResistance(ResistanceType.Physical, 20, 25);
this.SetResistance(ResistanceType.Fire, 10, 20);
this.SetResistance(ResistanceType.Cold, 5, 10);
this.SetResistance(ResistanceType.Poison, 5, 10);
this.SetResistance(ResistanceType.Energy, 10, 15);
this.SetSkill(SkillName.MagicResist, 57.6, 75.0);
this.SetSkill(SkillName.Tactics, 50.1, 70.0);
this.SetSkill(SkillName.Wrestling, 60.1, 80.0);
this.Fame = 2500;
this.Karma = 2500;
this.VirtualArmor = 22;
this.Tamable = false;
this.ControlSlots = 1;
}
public HolyFamiliar(Serial serial)
: base(serial)
{
}
public override bool IsDispellable
{
get
{
return false;
}
}
public override bool IsBondable
{
get
{
return false;
}
}
public override int Meat
{
get
{
return 1;
}
}
public override int Hides
{
get
{
return 7;
}
}
public override FoodType FavoriteFood
{
get
{
return FoodType.Meat;
}
}
public override PackInstinct PackInstinct
{
get
{
return PackInstinct.Canine;
}
}
public override string ApplyNameSuffix(string suffix)
{
if (suffix.Length == 0)
suffix = Ethic.Hero.Definition.Adjunct.String;
else
suffix = String.Concat(suffix, " ", Ethic.Hero.Definition.Adjunct.String);
return base.ApplyNameSuffix(suffix);
}
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,104 @@
using System;
using Server.Ethics;
namespace Server.Mobiles
{
[CorpseName("a holy corpse")]
public class HolySteed : BaseMount
{
[Constructable]
public HolySteed()
: base("a silver steed", 0x75, 0x3EA8, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
{
SetStr(496, 525);
SetDex(86, 105);
SetInt(86, 125);
SetHits(298, 315);
SetDamage(16, 22);
SetDamageType(ResistanceType.Physical, 40);
SetDamageType(ResistanceType.Fire, 40);
SetDamageType(ResistanceType.Energy, 20);
SetResistance(ResistanceType.Physical, 55, 65);
SetResistance(ResistanceType.Fire, 30, 40);
SetResistance(ResistanceType.Cold, 30, 40);
SetResistance(ResistanceType.Poison, 30, 40);
SetResistance(ResistanceType.Energy, 20, 30);
SetSkill(SkillName.MagicResist, 25.1, 30.0);
SetSkill(SkillName.Tactics, 97.6, 100.0);
SetSkill(SkillName.Wrestling, 80.5, 92.5);
Fame = 14000;
Karma = 14000;
VirtualArmor = 60;
Tamable = false;
ControlSlots = 1;
SetSpecialAbility(SpecialAbility.DragonBreath);
}
public HolySteed(Serial serial)
: base(serial)
{
}
public override bool IsDispellable
{
get
{
return false;
}
}
public override bool IsBondable
{
get
{
return false;
}
}
public override FoodType FavoriteFood
{
get
{
return FoodType.FruitsAndVegies | FoodType.GrainsAndHay;
}
}
public override string ApplyNameSuffix(string suffix)
{
if (suffix.Length == 0)
suffix = Ethic.Hero.Definition.Adjunct.String;
else
suffix = String.Concat(suffix, " ", Ethic.Hero.Definition.Adjunct.String);
return base.ApplyNameSuffix(suffix);
}
public override void OnDoubleClick(Mobile from)
{
if (Ethic.Find(from) != Ethic.Hero)
from.SendMessage("You may not ride this steed.");
else
base.OnDoubleClick(from);
}
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,79 @@
using System;
using Server.Spells;
namespace Server.Ethics.Hero
{
public sealed class Bless : Power
{
public Bless()
{
this.m_Definition = new PowerDefinition(
15,
"Bless",
"Erstok Ontawl",
"");
}
public override void BeginInvoke(Player from)
{
from.Mobile.BeginTarget(12, true, Targeting.TargetFlags.None, new TargetStateCallback(Power_OnTarget), from);
from.Mobile.SendMessage("Where do you wish to bless?");
}
private void Power_OnTarget(Mobile fromMobile, object obj, object state)
{
Player from = state as Player;
IPoint3D p = obj as IPoint3D;
if (p == null)
return;
if (!this.CheckInvoke(from))
return;
bool powerFunctioned = false;
SpellHelper.GetSurfaceTop(ref p);
IPooledEnumerable eable = from.Mobile.GetMobilesInRange(6);
foreach (Mobile mob in eable)
{
if (mob != from.Mobile && SpellHelper.ValidIndirectTarget(from.Mobile, mob))
continue;
if (mob.GetStatMod("Holy Bless") != null)
continue;
if (!from.Mobile.CanBeBeneficial(mob, false))
continue;
from.Mobile.DoBeneficial(mob);
mob.AddStatMod(new StatMod(StatType.All, "Holy Bless", 10, TimeSpan.FromMinutes(30.0)));
mob.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
mob.PlaySound(0x1EA);
powerFunctioned = true;
}
eable.Free();
if (powerFunctioned)
{
SpellHelper.Turn(from.Mobile, p);
Effects.PlaySound(p, from.Mobile.Map, 0x299);
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You consecrate the area.");
this.FinishInvoke(from);
}
else
{
from.Mobile.FixedEffect(0x3735, 6, 30);
from.Mobile.PlaySound(0x5C);
}
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
namespace Server.Ethics.Hero
{
public sealed class HolyBlade : Power
{
public HolyBlade()
{
this.m_Definition = new PowerDefinition(
10,
"Holy Blade",
"Erstok Reyam",
"");
}
public override void BeginInvoke(Player from)
{
}
}
}

View File

@@ -0,0 +1,68 @@
using System;
using Server.Items;
namespace Server.Ethics.Hero
{
public sealed class HolyItem : Power
{
public HolyItem()
{
this.m_Definition = new PowerDefinition(
5,
"Holy Item",
"Vidda K'balc",
"");
}
public override void BeginInvoke(Player from)
{
from.Mobile.BeginTarget(12, false, Targeting.TargetFlags.None, new TargetStateCallback(Power_OnTarget), from);
from.Mobile.SendMessage("Which item do you wish to imbue?");
}
private void Power_OnTarget(Mobile fromMobile, object obj, object state)
{
Player from = state as Player;
Item item = obj as Item;
if (item == null)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You may not imbue that.");
return;
}
if (item.Parent != from.Mobile)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You may only imbue items you are wearing.");
return;
}
if ((item.SavedFlags & 0x300) != 0)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "That has already beem imbued.");
return;
}
bool canImbue = (item is Spellbook || item is BaseClothing || item is BaseArmor || item is BaseWeapon) && (item.Name == null);
if (canImbue)
{
if (!this.CheckInvoke(from))
return;
item.Hue = Ethic.Hero.Definition.PrimaryHue;
item.SavedFlags |= 0x100;
from.Mobile.FixedEffect(0x375A, 10, 20);
from.Mobile.PlaySound(0x209);
this.FinishInvoke(from);
}
else
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You may not imbue that.");
}
}
}
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Text;
namespace Server.Ethics.Hero
{
public sealed class HolySense : Power
{
public HolySense()
{
this.m_Definition = new PowerDefinition(
0,
"Holy Sense",
"Drewrok Erstok",
"");
}
public override void BeginInvoke(Player from)
{
Ethic opposition = Ethic.Evil;
int enemyCount = 0;
int maxRange = 18 + from.Power;
Player primary = null;
foreach (Player pl in opposition.Players)
{
Mobile mob = pl.Mobile;
if (mob == null || mob.Map != from.Mobile.Map || !mob.Alive)
continue;
if (!mob.InRange(from.Mobile, Math.Max(18, maxRange - pl.Power)))
continue;
if (primary == null || pl.Power > primary.Power)
primary = pl;
++enemyCount;
}
StringBuilder sb = new StringBuilder();
sb.Append("You sense ");
sb.Append(enemyCount == 0 ? "no" : enemyCount.ToString());
sb.Append(enemyCount == 1 ? " enemy" : " enemies");
if (primary != null)
{
sb.Append(", and a strong presense");
switch ( from.Mobile.GetDirectionTo(primary.Mobile) )
{
case Direction.West:
sb.Append(" to the west.");
break;
case Direction.East:
sb.Append(" to the east.");
break;
case Direction.North:
sb.Append(" to the north.");
break;
case Direction.South:
sb.Append(" to the south.");
break;
case Direction.Up:
sb.Append(" to the north-west.");
break;
case Direction.Down:
sb.Append(" to the south-east.");
break;
case Direction.Left:
sb.Append(" to the south-west.");
break;
case Direction.Right:
sb.Append(" to the north-east.");
break;
}
}
else
{
sb.Append('.');
}
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x59, false, sb.ToString());
this.FinishInvoke(from);
}
}
}

View File

@@ -0,0 +1,31 @@
using System;
namespace Server.Ethics.Hero
{
public sealed class HolyShield : Power
{
public HolyShield()
{
this.m_Definition = new PowerDefinition(
20,
"Holy Shield",
"Erstok K'blac",
"");
}
public override void BeginInvoke(Player from)
{
if (from.IsShielded)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You are already under the protection of a holy shield.");
return;
}
from.BeginShield();
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You are now under the protection of a holy shield.");
this.FinishInvoke(from);
}
}
}

View File

@@ -0,0 +1,43 @@
using System;
namespace Server.Ethics.Hero
{
public sealed class HolySteed : Power
{
public HolySteed()
{
this.m_Definition = new PowerDefinition(
30,
"Holy Steed",
"Trubechs Yeliab",
"");
}
public override void BeginInvoke(Player from)
{
if (from.Steed != null && from.Steed.Deleted)
from.Steed = null;
if (from.Steed != null)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You already have a holy steed.");
return;
}
if ((from.Mobile.Followers + 1) > from.Mobile.FollowersMax)
{
from.Mobile.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
return;
}
Mobiles.HolySteed steed = new Mobiles.HolySteed();
if (Mobiles.BaseCreature.Summon(steed, from.Mobile, from.Mobile.Location, 0x217, TimeSpan.FromHours(1.0)))
{
from.Steed = steed;
this.FinishInvoke(from);
}
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
namespace Server.Ethics.Hero
{
public sealed class HolyWord : Power
{
public HolyWord()
{
this.m_Definition = new PowerDefinition(
100,
"Holy Word",
"Erstok Oostrac",
"");
}
public override void BeginInvoke(Player from)
{
}
}
}

View File

@@ -0,0 +1,44 @@
using System;
using Server.Mobiles;
namespace Server.Ethics.Hero
{
public sealed class SummonFamiliar : Power
{
public SummonFamiliar()
{
this.m_Definition = new PowerDefinition(
5,
"Summon Familiar",
"Trubechs Vingir",
"");
}
public override void BeginInvoke(Player from)
{
if (from.Familiar != null && from.Familiar.Deleted)
from.Familiar = null;
if (from.Familiar != null)
{
from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, false, "You already have a holy familiar.");
return;
}
if ((from.Mobile.Followers + 1) > from.Mobile.FollowersMax)
{
from.Mobile.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
return;
}
HolyFamiliar familiar = new HolyFamiliar();
if (Mobiles.BaseCreature.Summon(familiar, from.Mobile, from.Mobile.Location, 0x217, TimeSpan.FromHours(1.0)))
{
from.Familiar = familiar;
this.FinishInvoke(from);
}
}
}
}