Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue