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,840 @@
using System;
using Server;
using Server.Items;
using System.Collections.Generic;
using Server.Engines.Quests;
using System.Linq;
namespace Server.Mobiles
{
[CorpseName("a tyrannosaurus rex corpse")]
public class TRex : BaseCreature
{
private DateTime _NextFreeze;
[Constructable]
public TRex()
: base(AIType.AI_Melee, FightMode.Weakest, 10, 1, .08, .17)
{
Name = "Tyrannosaurus Rex";
Body = 1400;
BaseSoundID = 362;
SetStr(500, 700);
SetDex(500, 700);
SetInt(100, 180);
SetHits(15000);
SetDamage(33, 55);
SetDamageType(ResistanceType.Physical, 100);
SetResistance(ResistanceType.Physical, 80, 90);
SetResistance(ResistanceType.Fire, 60, 80);
SetResistance(ResistanceType.Cold, 60, 70);
SetResistance(ResistanceType.Poison, 80, 100);
SetResistance(ResistanceType.Energy, 60, 70);
SetSkill(SkillName.Anatomy, 100.0);
SetSkill(SkillName.MagicResist, 140.0, 150.0);
SetSkill(SkillName.Tactics, 110.0, 130.0);
SetSkill(SkillName.Wrestling, 130.0, 150.0);
SetSkill(SkillName.Poisoning, 60.0, 70.0);
SetSkill(SkillName.Parry, 100);
Fame = 24000;
Karma = -24000;
_NextFreeze = DateTime.UtcNow;
CanSwim = true;
SetWeaponAbility(WeaponAbility.ArmorIgnore);
SetSpecialAbility(SpecialAbility.TailSwipe);
}
public override bool AutoDispel { get { return true; } }
public override Poison PoisonImmune { get { return Poison.Lethal; } }
public override bool UseSmartAI { get { return true; } }
public override bool ReacquireOnMovement { get { return true; } }
public override bool AttacksFocus { get { return true; } }
public override bool CanFlee { get { return false; } }
public override int TreasureMapLevel { get { return 7; } }
// Missing Tail Swipe Ability
public override void OnThink()
{
base.OnThink();
if (Combatant == null)
return;
if (_NextFreeze < DateTime.UtcNow)
DoFreeze();
}
public void DoFreeze()
{
DoEffects(Direction.North);
DoEffects(Direction.West);
DoEffects(Direction.South);
DoEffects(Direction.East);
_NextFreeze = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 60));
}
private bool DoEffects(Direction d)
{
int x = X;
int y = Y;
int z = Z;
int range = 10;
int offset = 8;
switch (d)
{
case Direction.North:
x = X + Utility.RandomMinMax(-offset, offset);
y = Y - range;
break;
case Direction.West:
x = X - range;
y = Y + Utility.RandomMinMax(-offset, offset);
break;
case Direction.South:
x = X + Utility.RandomMinMax(-offset, offset);
y = Y + range;
break;
case Direction.East:
x = X + range;
y = Y + Utility.RandomMinMax(-offset, offset);
break;
}
for (int i = 0; i < range; i++)
{
switch (d)
{
case Direction.North: y += i; break;
case Direction.West: x += i; break;
case Direction.South: y -= i; break;
case Direction.East: x -= i; break;
}
z = Map.GetAverageZ(x, y);
Point3D p = new Point3D(x, y, z);
if (Server.Spells.SpellHelper.AdjustField(ref p, Map, 12, false))/*Map.CanFit(x, y, z, 16, false, false, true))/*Map.CanSpawnMobile(x, y, z)*/
{
MovementPath path = new MovementPath(this, p);
if (path.Success)
{
DropCrack(path);
return true;
}
}
}
return false;
}
private void DropCrack(MovementPath path)
{
int time = 10;
int x = X;
int y = Y;
for (int i = 0; i < path.Directions.Length; ++i)
{
Movement.Movement.Offset(path.Directions[i], ref x, ref y);
IPoint3D p = new Point3D(x, y, Map.GetAverageZ(x, y)) as IPoint3D;
Timer.DelayCall(TimeSpan.FromMilliseconds(time), new TimerStateCallback(ManaDrainEffects_Callback), new object[] { p, Map });
time += 200;
}
}
private void ManaDrainEffects_Callback(object o)
{
object[] objs = o as object[];
IPoint3D p = objs[0] as IPoint3D;
Map map = objs[1] as Map;
var item = new FreezeItem(Utility.RandomList(6913, 6915, 6917, 6919), this);
Spells.SpellHelper.GetSurfaceTop(ref p);
item.MoveToWorld(new Point3D(p), Map);
}
private class FreezeItem : Item
{
public Item Static { get; private set; }
public BaseCreature Owner { get; private set; }
public FreezeItem(int id, BaseCreature owner)
: base(id)
{
Owner = owner;
Movable = false;
Hue = 1152;
Timer.DelayCall(TimeSpan.FromSeconds(5), ChangeHue);
}
private void ChangeHue()
{
Hue = 1153;
Static.Hue = 1153;
Timer.DelayCall(TimeSpan.FromSeconds(0.5), Delete);
}
public override void Delete()
{
if (Static != null)
Static.Delete();
Static = null;
base.Delete();
}
public override void OnLocationChange(Point3D oldLocation)
{
Static = new Static(ItemID + 1);
Static.MoveToWorld(Location, Map);
IPooledEnumerable eable = Map.GetMobilesInRange(Location, 0);
foreach (Mobile m in eable)
{
OnMoveOver(m);
}
eable.Free();
}
public override bool OnMoveOver(Mobile m)
{
if ((m is PlayerMobile || (m is BaseCreature && ((BaseCreature)m).GetMaster() is PlayerMobile)) && m.CanBeHarmful(Owner, false))
{
m.Freeze(TimeSpan.FromSeconds(Utility.RandomMinMax(5, 10)));
if (Owner.CanBeHarmful(m))
{
m.AggressiveAction(Owner);
Owner.InitialFocus = m;
Owner.Combatant = m;
}
}
return true;
}
public FreezeItem(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Delete();
}
}
public override void GenerateLoot()
{
AddLoot(LootPack.SuperBoss, 2);
}
public TRex(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
[CorpseName("the corpse of a great ape")]
public class GreatApe : BaseCreature
{
private DateTime _NextSpecial;
private DateTime _NextBarrelThrow;
private int _LastTeleport;
private Point3D[] _TeleList =
{
new Point3D(874, 1439, 0),
new Point3D(847, 1425, 0),
new Point3D(847, 1389, 0),
new Point3D(866, 1366, 0),
new Point3D(887, 1390, 0),
new Point3D(889, 1407, 0),
new Point3D(882, 1426, 0),
new Point3D(858, 1412, 21),
new Point3D(868, 1412, 20),
new Point3D(869, 1409, 20),
new Point3D(869, 1404, 20),
new Point3D(858, 1412, 21),
new Point3D(868, 1412, 20),
new Point3D(869, 1409, 20),
new Point3D(869, 1404, 20),
};
private Point3D[] _PlayerTeleList =
{
new Point3D(875, 1380, -20),
new Point3D(855, 1442, -20)
};
private int[] _BarrelIDs =
{
3703, 4014, 5453, 7861,
17650
};
[CommandProperty(AccessLevel.GameMaster)]
public bool Teleports { get; set; }
[Constructable]
public GreatApe(bool teleports = false)
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, .08, .17)
{
Teleports = teleports;
Name = "a great ape";
Body = 1308;
BaseSoundID = 0x9E;
SetStr(986, 1185);
SetDex(177, 255);
SetInt(151, 250);
SetHits(12500);
SetDamage(20, 33);
SetDamageType(ResistanceType.Physical, 100);
SetResistance(ResistanceType.Physical, 65, 80);
SetResistance(ResistanceType.Fire, 60, 80);
SetResistance(ResistanceType.Cold, 50, 60);
SetResistance(ResistanceType.Poison, 100);
SetResistance(ResistanceType.Energy, 40, 50);
SetSkill(SkillName.Anatomy, 25.1, 50.0);
SetSkill(SkillName.MagicResist, 150.0);
SetSkill(SkillName.Tactics, 100);
SetSkill(SkillName.Wrestling, 100);
Fame = 35000;
Karma = -35000;
_NextSpecial = DateTime.UtcNow;
_NextBarrelThrow = DateTime.UtcNow;
}
public override void GenerateLoot()
{
AddLoot(LootPack.SuperBoss, 2);
}
public override bool AutoDispel { get { return true; } }
public override Poison PoisonImmune { get { return Poison.Lethal; } }
public override bool UseSmartAI { get { return true; } }
public override int TreasureMapLevel { get { return 7; } }
public GreatApe(Serial serial)
: base(serial)
{
}
public override void OnThink()
{
base.OnThink();
if (Combatant == null)
return;
if (_NextSpecial < DateTime.UtcNow)
{
_NextSpecial = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 60));
switch(Utility.Random(Teleports ? 3 : 2))
{
case 0:
IPooledEnumerable eable = Map.GetMobilesInRange(Location, 10);
foreach (Mobile m in eable)
{
if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile && .75 > Utility.RandomDouble())
DoDismount(m);
}
eable.Free();
break;
case 1:
IPooledEnumerable eable2 = Map.GetMobilesInRange(Location, 10);
List<Mobile> mobiles = new List<Mobile>();
foreach (Mobile m in eable2)
{
if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile)
mobiles.Add(m);
}
eable2.Free();
if (mobiles.Count > 0)
{
Mobile m = mobiles[Utility.Random(mobiles.Count)];
Point3D old2 = m.Location;
Point3D p2 = _PlayerTeleList[Utility.Random(_PlayerTeleList.Length)];
m.MoveToWorld(p2, Map);
m.ProcessDelta();
Effects.SendLocationParticles(EffectItem.Create(old2, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
Effects.SendLocationParticles(EffectItem.Create(p2, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
}
ColUtility.Free(mobiles);
break;
case 2:
int ran = -1;
while (ran < 0 || ran > _TeleList.Length || ran == _LastTeleport)
{
ran = Utility.Random(_TeleList.Length);
}
_LastTeleport = ran;
Point3D p = _TeleList[ran];
Point3D old = Location;
MoveToWorld(p, Map);
ProcessDelta();
Effects.SendLocationParticles(EffectItem.Create(old, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
Effects.SendLocationParticles(EffectItem.Create(p, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
break;
}
}
else if (_NextBarrelThrow < DateTime.UtcNow && .25 > Utility.RandomDouble())
{
_NextBarrelThrow = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(5, 10));
int barrel = CheckBarrel();
if (barrel >= 0)
{
IPooledEnumerable eable = Map.GetMobilesInRange(Location, 10);
List<Mobile> mobiles = new List<Mobile>();
foreach (Mobile m in eable)
{
if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile)
mobiles.Add(m);
}
eable.Free();
if (mobiles.Count > 0)
{
Mobile m = mobiles[Utility.Random(mobiles.Count)];
DoHarmful(m);
MovingParticles(m, barrel, 10, 0, false, true, 0, 0, 9502, 6014, 0x11D, EffectLayer.Waist, 0);
Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
{
m.PlaySound(0x11D);
AOS.Damage(m, this, Utility.RandomMinMax(70, 120), 100, 0, 0, 0, 0);
});
}
ColUtility.Free(mobiles);
}
}
}
public void DoDismount(Mobile m)
{
MovingParticles(m, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
PlaySound(0x15E);
double range = m.GetDistanceToSqrt(this);
Timer.DelayCall(TimeSpan.FromMilliseconds(250 * range), () =>
{
IMount mount = m.Mount;
if (mount != null)
{
if (m is PlayerMobile)
((PlayerMobile)m).SetMountBlock(BlockMountType.Dazed, TimeSpan.FromSeconds(10), true);
else
mount.Rider = null;
}
else if (m.Flying)
{
((PlayerMobile)m).SetMountBlock(BlockMountType.Dazed, TimeSpan.FromSeconds(10), true);
}
PlaySound(0x220);
AOS.Damage(m, this, Utility.RandomMinMax(15, 25), 100, 0, 0, 0, 0);
m.SendLocalizedMessage(1156495); // *The shaking ground damages and disorients you!*
});
}
public int CheckBarrel()
{
IPooledEnumerable eable = Map.GetItemsInRange(Location, 2);
List<Item> items = new List<Item>();
foreach (Item item in eable)
{
if (!item.Movable && _BarrelIDs.Any(id => id == item.ItemID))
items.Add(item);
}
eable.Free();
int itemid;
if (items.Count > 0)
itemid = items[Utility.Random(items.Count)].ItemID;
else
itemid = -1;
ColUtility.Free(items);
return itemid;
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
writer.Write(Teleports);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Teleports = reader.ReadBool();
_NextSpecial = DateTime.UtcNow;
_NextBarrelThrow = DateTime.UtcNow;
}
}
[CorpseName("the corpse of a tiger cub")]
public class TigerCub : BaseCreature
{
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Protector { get; set; }
[Constructable]
public TigerCub()
: base(AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
{
Name = "a tiger cub";
Body = 1309;
BaseSoundID = 0x69;
SetStr(100);
SetDex(100);
SetInt(20);
SetHits(50, 60);
SetMana(0);
SetDamage(10, 12);
SetDamageType(ResistanceType.Physical, 100);
SetResistance(ResistanceType.Physical, 5, 10);
SetSkill(SkillName.MagicResist, 5.0);
SetSkill(SkillName.Tactics, 40.0);
SetSkill(SkillName.Wrestling, 50.0);
Fame = 0;
Karma = 500;
ControlSlots = 1;
MinTameSkill = 0;
}
public override void OnThink()
{
base.OnThink();
if (Protector != null && Protector is PlayerMobile && InRange(Home, 2))
{
PrideOfTheAmbushQuest quest = QuestHelper.GetQuest((PlayerMobile)Protector, typeof(PrideOfTheAmbushQuest)) as PrideOfTheAmbushQuest;
if (quest != null && !quest.Completed)
quest.Update(this);
Protector.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x35, 1156501, Protector.NetState); // *You watch as the Tiger Cub safely returns to the Kurak Tribe*
Timer.DelayCall(TimeSpan.FromSeconds(.25), Delete);
Protector = null;
}
}
public override int Damage(int amount, Mobile from, bool informMount, bool checkfizzle)
{
if (from == Protector)
{
PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x35, 1156500, from.NetState); // *The cub looks at you playfully. Your attack fails as you are overwhelmed by its cuteness*
return 0;
}
return base.Damage(amount, from, informMount, checkfizzle);
}
public override int Meat { get { return 1; } }
public override FoodType FavoriteFood { get { return FoodType.Meat | FoodType.Fish; } }
public override PackInstinct PackInstinct { get { return PackInstinct.Feline; } }
public TigerCub(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)1);
writer.Write(Protector);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Protector = reader.ReadMobile();
if(version == 0)
{
ControlSlots = 1;
MinTameSkill = 0;
}
}
}
public class Trapper : Brigand
{
[Constructable]
public Trapper()
{
Title = "the trapper";
SetHits(2500);
SetStr(125, 150);
SetDex(200);
SetInt(61, 75);
SetDamage(20, 32);
SetSkill(SkillName.Fencing, 100);
SetSkill(SkillName.Macing, 100);
SetSkill(SkillName.MagicResist, 120);
SetSkill(SkillName.Swords, 100);
SetSkill(SkillName.Tactics, 100);
SetSkill(SkillName.Wrestling, 100);
Fame = 12000;
Karma = -12000;
Timer.DelayCall(TimeSpan.FromMinutes(10), Delete);
}
public override void GenerateLoot()
{
AddLoot(LootPack.Rich, 3);
}
public Trapper(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Delete();
}
}
public class Poacher : Trapper
{
[CommandProperty(AccessLevel.GameMaster)]
public NestWithEgg Nest { get; set; }
[Constructable]
public Poacher(NestWithEgg nest)
{
Title = "the poacher";
Nest = nest;
}
public override void GenerateLoot()
{
AddLoot(LootPack.Rich, 3);
}
public Poacher(Serial serial)
: base(serial)
{
}
public override void OnDeath(Container c)
{
base.OnDeath(c);
if (Nest != null && !Nest.Deleted)
Nest.OnPoacherKilled(this);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
[CorpseName("a lava elemental corpse")]
public class VolcanoElemental : BaseCreature
{
[Constructable]
public VolcanoElemental()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "a volcano elemental";
Body = 15;
Hue = 2726;
SetStr(446, 510);
SetDex(173, 191);
SetInt(369, 397);
SetHits(800, 1200);
SetDamage(18, 24);
SetDamageType(ResistanceType.Physical, 10);
SetDamageType(ResistanceType.Fire, 90);
SetResistance(ResistanceType.Physical, 60, 70);
SetResistance(ResistanceType.Fire, 20, 30);
SetResistance(ResistanceType.Cold, 20, 30);
SetResistance(ResistanceType.Poison, 100);
SetResistance(ResistanceType.Energy, 40, 50);
SetSkill(SkillName.Anatomy, 0.0, 12.8);
SetSkill(SkillName.EvalInt, 84.8, 92.6);
SetSkill(SkillName.Magery, 90.1, 92.7);
SetSkill(SkillName.Meditation, 97.8, 102.8);
SetSkill(SkillName.MagicResist, 101.9, 106.2);
SetSkill(SkillName.Tactics, 80.3, 94.0);
SetSkill(SkillName.Wrestling, 71.7, 85.4);
Fame = 12500;
Karma = -12500;
SetSpecialAbility(SpecialAbility.DragonBreath);
}
public override void GenerateLoot()
{
AddLoot(LootPack.FilthyRich, 3);
AddLoot(LootPack.Gems, 2);
AddLoot(LootPack.MedScrolls);
}
public VolcanoElemental(Serial serial)
: base(serial)
{
}
public override int GetIdleSound()
{
return 1549;
}
public override int GetAngerSound()
{
return 1546;
}
public override int GetHurtSound()
{
return 1548;
}
public override int GetDeathSound()
{
return 1547;
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,257 @@
using System;
using Server;
using System.Collections.Generic;
using Server.Mobiles;
using System.Linq;
using Server.Engines.Quests;
namespace Server.Items
{
public class NestWithEgg : BaseAddon
{
public TimeSpan ResetPeriod { get { return TimeSpan.FromSeconds(Utility.RandomMinMax(120, 360)); } }
public List<BaseCreature> Poachers { get; set; }
public List<Mobile> FocusList { get; set; }
public BaseCreature Hatchling { get; set; }
public Mobile Focus { get; set; }
public bool IsHatching { get; set; }
public DateTime CooldownEnds { get; set; }
public Timer DeadlineTimer { get; set; }
public AddonComponent Egg
{
get
{
return Components.FirstOrDefault(c => c.ItemID == 16831);
}
}
public bool IsInCooldown { get { return CooldownEnds != DateTime.MinValue && DateTime.UtcNow < CooldownEnds; } }
[Constructable]
public NestWithEgg()
{
AddonComponent comp = new LocalizedAddonComponent(3518, 1026869);
comp.Hue = 449;
AddComponent(comp, 0, 0, 0);
comp = new LocalizedAddonComponent(3270, 1026869);
comp.Hue = 551;
AddComponent(comp, 0, 0, 2);
comp = new LocalizedAddonComponent(3374, 1026869);
comp.Hue = 551;
AddComponent(comp, 0, 0, 2);
comp = new LocalizedAddonComponent(16831, 1112469);
AddComponent(comp, 1, 1, 15);
FocusList = new List<Mobile>();
}
public override bool HandlesOnMovement { get { return !IsInCooldown; } }
public override void OnMovement(Mobile m, Point3D oldLocation)
{
if(m is PlayerMobile && m.Location != oldLocation && m.InRange(this.Location, 3) && (!FocusList.Contains(m) || 0.015 > Utility.RandomDouble()))
{
EmptyNestQuest quest = QuestHelper.GetQuest((PlayerMobile)m, typeof(EmptyNestQuest)) as EmptyNestQuest;
if(quest != null && !quest.Completed)
{
if(Focus == null)
{
Focus = m;
m.RevealingAction();
SpawnPoachers(m);
DeadlineTimer = Timer.DelayCall(TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5), () =>
{
DeadlineTimer.Stop();
if(Poachers != null && Poachers.Count > 0)
Delete();
else
{
Focus = null;
Hatchling = null;
CooldownEnds = DateTime.MinValue;
}
});
DeadlineTimer.Start();
}
else if(IsInCooldown)
{
CooldownEnds = DateTime.UtcNow + TimeSpan.FromMinutes(2);
}
}
}
}
public void SpawnPoachers(Mobile m)
{
Map map = m.Map;
if(map == null || map == Map.Internal)
return;
if(Poachers == null)
Poachers = new List<BaseCreature>();
for(int i = 0; i < 3; i++)
{
Poacher p = new Poacher(this);
Point3D pnt = m.Location;
for(int j = 0; j < 10; j++)
{
int x = Utility.RandomMinMax(m.X - 2, m.X + 2);
int y = Utility.RandomMinMax(m.Y - 2, m.Y + 2);
int z = map.GetAverageZ(x, y);
if(map.CanSpawnMobile(x, y, z))
{
pnt = new Point3D(x, y, z);
break;
}
}
p.MoveToWorld(pnt, map);
Poachers.Add(p);
}
Poachers.ForEach(poacher => poacher.Combatant = m);
}
public void OnPoacherKilled(BaseCreature bc)
{
if(Poachers != null && Poachers.Contains(bc))
{
Poachers.Remove(bc);
if(Poachers.Count == 0)
{
if(!IsHatching)
{
IsHatching = true;
ColUtility.Free(Poachers);
Timer.DelayCall(TimeSpan.FromSeconds(Utility.RandomMinMax(15, 30)), () =>
{
Hatchling = new DragonTurtleHatchling();
Hatchling.MoveToWorld(this.Location, this.Map);
Hatchling.Tamable = false;
SpawnPoachers(Hatchling);
if(Egg != null)
Egg.Visible = false;
});
}
else
{
if(Hatchling.Alive)
{
CooldownEnds = DateTime.UtcNow + ResetPeriod;
Timer.DelayCall(TimeSpan.FromSeconds(1), OnComplete, new object[] { Hatchling, Focus } );
if(!FocusList.Contains(Focus))
FocusList.Add(Focus);
}
else
Delete();
if(DeadlineTimer != null)
{
DeadlineTimer.Stop();
DeadlineTimer = null;
}
Hatchling = null;
Focus = null;
ColUtility.Free(Poachers);
Poachers = null;
}
}
}
}
private void OnComplete(object o)
{
object[] objs = o as object[];
BaseCreature hatchling = objs[0] as BaseCreature;
Mobile focus = objs[1] as Mobile;
if(hatchling != null)
{
focus.PublicOverheadMessage(Server.Network.MessageType.Regular, 0x35, 1156496); // *The Hatchling safely burrows into the sand*
Timer.DelayCall(TimeSpan.FromSeconds(1), hatchling.Delete);
}
if(focus != null && focus is PlayerMobile)
{
EmptyNestQuest quest = QuestHelper.GetQuest((PlayerMobile)focus, typeof(EmptyNestQuest)) as EmptyNestQuest;
if(quest != null)
{
quest.Update(hatchling);
// Quest Complete and crap can be handled in update
}
}
Timer.DelayCall(TimeSpan.FromMinutes(1), () =>
{
if(Egg != null && !Egg.Visible)
Egg.Visible = true;
});
IsHatching = false;
}
public override void Delete()
{
base.Delete();
if (DeadlineTimer != null)
{
DeadlineTimer.Stop();
DeadlineTimer = null;
}
if (Poachers != null)
ColUtility.Free(Poachers);
}
public NestWithEgg(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
writer.Write(Hatchling);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Hatchling = reader.ReadMobile() as BaseCreature;
if(Hatchling != null)
Hatchling.Delete();
if(Egg != null && !Egg.Visible)
Egg.Visible = true;
FocusList = new List<Mobile>();
}
}
}

View File

@@ -0,0 +1,759 @@
using Server;
using System;
using Server.Engines.Quests;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Items
{
public class KingBlackthornOrders : BaseQuestItem
{
public override Type[] Quests
{
get
{
return new Type[]
{
typeof( TimeIsOfTheEssenceQuest )
};
}
}
public override int LabelNumber { get { return 1156516; } } // Orders from King Blackthorn to Sir Geoffrey
public override int Lifespan { get { return 360; } }
[Constructable]
public KingBlackthornOrders()
: base(8792)
{
}
public KingBlackthornOrders(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
/*public class LavaStone : Item
{
public override int LabelNumber { get { return 1151166; } } // lava rock
[Constructable]
public LavaStone()
: base(39638)
{
}
public LavaStone(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}*/
public class MosaicOfHeluzz : Item
{
public override int LabelNumber { get { return 1156467; } } // Mosaic of Heluzz
[Constructable]
public MosaicOfHeluzz() : base(39638)
{
Hue = 2952;
}
public MosaicOfHeluzz(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
public class TotemOfFabozz : Item
{
public override int LabelNumber { get { return 1156468; } } // Totem Of Faboz
[Constructable]
public TotemOfFabozz() : base(40092)
{
Hue = 2576;
}
public TotemOfFabozz(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
public class FiresOfKukuzz : Item
{
public override int LabelNumber { get { return 1156469; } } // Fires of Kukuzz
[Constructable]
public FiresOfKukuzz() : base(40014)
{
}
public FiresOfKukuzz(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
public class SkullOfMotazz : Item
{
public override int LabelNumber { get { return 1156470; } } // The Skull of Motazz
[Constructable]
public SkullOfMotazz() : base(40051)
{
Hue = 2500;
}
public SkullOfMotazz(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
public class SkullOfAphazz : Item
{
public override int LabelNumber { get { return 1156471; } } // The Skull of Aphazz
[Constructable]
public SkullOfAphazz() : base(8707)
{
}
public SkullOfAphazz(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
public enum RugHue
{
Regular,
White,
Black
}
public class TigerRugAddon : BaseAddon
{
public override BaseAddonDeed Deed { get { return new TigerRugAddonDeed(this.RugType); } }
public RugHue RugType { get; set; }
[Constructable]
public TigerRugAddon() : this(RugHue.Regular, true)
{
}
[Constructable]
public TigerRugAddon(RugHue type, bool south)
{
RugType = type;
int hue = 0;
int cliloc;
switch(type)
{
default:
case RugHue.Regular:
cliloc = 1156481;
break;
case RugHue.White:
hue = 2500;
cliloc = 1156483;
break;
case RugHue.Black:
hue = 1175;
cliloc = 1156482;
break;
}
if(south)
{
AddComponent(new LocalizedAddonComponent(40057, cliloc), 0, 0, 0);
AddComponent(new LocalizedAddonComponent(40058, cliloc), -1, 0, 0);
AddComponent(new LocalizedAddonComponent(40059, cliloc), 0, -1, 0);
AddComponent(new LocalizedAddonComponent(40060, cliloc), -1, -1, 0);
AddComponent(new LocalizedAddonComponent(40061, cliloc), 0, -2, 0);
AddComponent(new LocalizedAddonComponent(40062, cliloc), -1, -2, 0);
}
else
{
AddComponent(new LocalizedAddonComponent(40051, cliloc), 0, 0, 0);
AddComponent(new LocalizedAddonComponent(40052, cliloc), 0, -1, 0);
AddComponent(new LocalizedAddonComponent(40053, cliloc), -1, 0, 0);
AddComponent(new LocalizedAddonComponent(40054, cliloc), -1, -1, 0);
AddComponent(new LocalizedAddonComponent(40055, cliloc), -2, 0, 0);
AddComponent(new LocalizedAddonComponent(40056, cliloc), -2, -1, 0);
}
Timer.DelayCall(() => Hue = hue);
}
public TigerRugAddon(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write((int)RugType);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
RugType = (RugHue)reader.ReadInt();
}
}
public class TigerRugAddonDeed : BaseAddonDeed
{
public override int LabelNumber
{
get
{
switch(this.RugType)
{
case RugHue.Regular: return 1156481;
case RugHue.White: return 1156483;
case RugHue.Black: return 1156482;
}
return 1156481;
}
}
public override BaseAddon Addon { get { return new TigerRugAddon(this.RugType, SouthFacing); } }
public RugHue RugType { get; set; }
public bool SouthFacing { get; set; }
[Constructable]
public TigerRugAddonDeed() : this(RugHue.Regular)
{
}
[Constructable]
public TigerRugAddonDeed(RugHue type)
{
RugType = type;
}
public override void OnDoubleClick(Mobile from)
{
if(IsChildOf(from.Backpack))
{
from.SendGump(new SouthEastGump(s =>
{
SouthFacing = s;
base.OnDoubleClick(from);
}));
}
}
public TigerRugAddonDeed(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write((int)RugType);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
RugType = (RugHue)reader.ReadInt();
}
}
public enum BananaHoardSize
{
Small,
Medium,
Large
}
public class BananaHoardAddon : BaseAddon
{
public override BaseAddonDeed Deed { get { return new BananaHoardAddonDeed(); } }
public BananaHoardSize BananaHoardSize { get; set; }
[Constructable]
public BananaHoardAddon()
{
}
public BananaHoardAddon(BananaHoardSize bananaHoardSize)
{
BananaHoardSize = bananaHoardSize;
switch(bananaHoardSize)
{
case BananaHoardSize.Small:
AddComponent(new LocalizedAddonComponent(40047, 1156484), 0, 0, 0);
AddComponent(new LocalizedAddonComponent(40046, 1156484), -1, 0, 0);
AddComponent(new LocalizedAddonComponent(40049, 1156484), 0, -1, 0);
AddComponent(new LocalizedAddonComponent(40050, 1156484), -1, -1, 0);
break;
case BananaHoardSize.Medium:
AddComponent(new LocalizedAddonComponent(40043, 1156485), 0, 0, 0);
AddComponent(new LocalizedAddonComponent(40044, 1156485), 0, -1, 0);
AddComponent(new LocalizedAddonComponent(40048, 1156485), -1, 0, 0);
AddComponent(new LocalizedAddonComponent(40045, 1156485), -1, -1, 0);
break;
case BananaHoardSize.Large:
AddComponent(new LocalizedAddonComponent(40042, 1156486), 0, 0, 0);
AddComponent(new LocalizedAddonComponent(40040, 1156486), -1, 0, 0);
AddComponent(new LocalizedAddonComponent(40041, 1156486), 0, -1, 0);
break;
}
}
public BananaHoardAddon(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write((int)this.BananaHoardSize);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
this.BananaHoardSize = (BananaHoardSize)reader.ReadInt();
}
}
public class BananaHoardAddonDeed : BaseAddonDeed
{
public override BaseAddon Addon { get { return new BananaHoardAddon(BananaHoardSize); } }
public override int LabelNumber { get { return 1156556; } } // Great Ape's Banana Hoard
public BananaHoardSize BananaHoardSize { get; set; }
[Constructable]
public BananaHoardAddonDeed()
{
}
public override void OnDoubleClick(Mobile from)
{
if(IsChildOf(from.Backpack))
{
from.SendGump(new InternalGump(from as PlayerMobile, s =>
{
this.BananaHoardSize = s;
base.OnDoubleClick(from);
}));
}
}
private class InternalGump : Gump
{
public Action<BananaHoardSize> Callback { get; set; }
public PlayerMobile User { get; set; }
public InternalGump(PlayerMobile p, Action<BananaHoardSize> callback) : base(50, 50)
{
Callback = callback;
User = p;
AddGumpLayout();
}
public void AddGumpLayout()
{
AddBackground(0, 0, 200, 200, 5054);
AddBackground(10, 10, 180, 180, 3000);
AddHtml(55, 50, 150, 16, "Small", false, false);
AddHtml(55, 80, 150, 16, "Medium", false, false);
AddHtml(55, 110, 150, 16, "Large", false, false);
for(int i = 0; i < 3; i++)
{
AddButton(20, 50 + (i * 30), 4005, 4007, i + 1, GumpButtonType.Reply, 0);
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID > 0 && Callback != null)
{
Callback((BananaHoardSize)info.ButtonID - 1);
}
}
}
public BananaHoardAddonDeed(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
public class DinosaurHunterRewardTitleDeed : BaseRewardTitleDeed
{
public override TextDefinition Title { get { return new TextDefinition("Dinosaur Hunter"); } }
[Constructable]
public DinosaurHunterRewardTitleDeed()
{
}
public DinosaurHunterRewardTitleDeed(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
public class LavaRockDisplay : Item
{
public override int LabelNumber { get { return 1124033; } } // lava rock display
[Constructable]
public LavaRockDisplay() : base(40009)
{
Weight = 5.0;
}
public LavaRockDisplay(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
public class DragonTurtleFountainAddon : BaseAddon
{
public override BaseAddonDeed Deed { get { return new DragonTurtleFountainAddonDeed(); } }
[Constructable]
public DragonTurtleFountainAddon(bool south)
{
if (south)
{
AddComponent(new AddonComponent(40087), 0, 0, 0);
AddComponent(new AddonComponent(40089), 0, -1, 0);
AddComponent(new AddonComponent(40088), 1, -1, 0);
AddComponent(new AddonComponent(40090), 1, -2, 0);
}
else
{
AddComponent(new AddonComponent(40092), 0, 0, 0);
AddComponent(new AddonComponent(40093), -1, 0, 0);
AddComponent(new AddonComponent(40094), -1, 1, 0);
AddComponent(new AddonComponent(40096), -2, 1, 0);
}
}
public DragonTurtleFountainAddon(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
public class DragonTurtleFountainAddonDeed : BaseAddonDeed
{
public override BaseAddon Addon { get { return new DragonTurtleFountainAddon(SouthFacing); } }
public override int LabelNumber { get { return 1156488; } } // Dragon Turtle Fountain
public bool SouthFacing { get; set; }
[Constructable]
public DragonTurtleFountainAddonDeed()
{
}
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
from.SendGump(new SouthEastGump(s =>
{
SouthFacing = s;
base.OnDoubleClick(from);
}));
}
}
public DragonTurtleFountainAddonDeed(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
public class PetTigerCubStatuette : MonsterStatuette
{
public bool HasUsed { get; set; }
[Constructable]
public PetTigerCubStatuette() : base(MonsterStatuetteType.TigerCub)
{
IsRewardItem = false;
}
public override void OnDoubleClick(Mobile from)
{
if (HasUsed)
{
base.OnDoubleClick(from);
}
else if (IsLockedDown && from.Followers != from.FollowersMax)
{
BaseCreature cub = new TigerCub();
Point3D p = from.Location;
int x = p.X;
int y = p.Y;
Server.Movement.Movement.Offset(from.Direction, ref x, ref y);
int z = from.Map.GetAverageZ(x, y);
if (from.Map.CanSpawnMobile(x, y, z))
p = new Point3D(x, y, z);
cub.MoveToWorld(p, from.Map);
cub.SetControlMaster(from);
cub.IsBonded = true;
HasUsed = true;
}
}
public PetTigerCubStatuette(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(1);
writer.Write(HasUsed);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
switch(v)
{
case 1:
HasUsed = reader.ReadBool();
break;
case 0:
break;
}
}
}
public class UniqueTreasureBag : Pouch
{
public override int LabelNumber { get { return 1156581; } } // A bag with a unique treasure
[Constructable]
public UniqueTreasureBag()
{
switch (Utility.Random(6))
{
case 0: DropItem(new LavaRockDisplay()); break;
case 1:
double random = Utility.RandomDouble();
if (random <= .02)
DropItem(new TigerRugAddonDeed(RugHue.White));
else if (random < .15)
DropItem(new TigerRugAddonDeed(RugHue.Black));
else
DropItem(new TigerRugAddonDeed(RugHue.Regular));
break;
case 2: DropItem(new BananaHoardAddonDeed()); break;
case 3: DropItem(new DragonTurtleFountainAddonDeed()); break;
case 4: DropItem(new DinosaurHunterRewardTitleDeed()); break;
case 5: DropItem(new PetTigerCubStatuette()); break;
}
}
public UniqueTreasureBag(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,251 @@
using System;
using Server;
using System.Collections.Generic;
using Server.Mobiles;
using System.Linq;
using Server.Network;
using Server.Commands;
namespace Server.Items
{
public class MyrmidexHill : Item
{
private Type[] _SpawnList =
{
typeof(MyrmidexLarvae), typeof(MyrmidexDrone), typeof(MyrmidexWarrior)
};
[CommandProperty(AccessLevel.GameMaster)]
public DateTime NextSpawn { get; set; }
public EodonTribeRegion Zone { get; set; }
public List<BaseCreature> Spawn { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Focus { get; set; }
public int SpawnCount { get { return Utility.RandomMinMax(6, 9); } }
public int HasSpawned { get; set; }
public MyrmidexHill(EodonTribeRegion zone, Mobile focus)
: base(8754)
{
Movable = false;
Focus = focus;
Zone = zone;
Spawn = new List<BaseCreature>();
}
public override bool HandlesOnMovement { get { return NextSpawn < DateTime.UtcNow; } }
public override void OnMovement(Mobile m, Point3D oldLocation)
{
if (m.InRange(this.Location, 7) && m.AccessLevel == AccessLevel.Player &&
(m is PlayerMobile || (m is BaseCreature && ((BaseCreature)m).GetMaster() is PlayerMobile)))
{
Focus = m;
DoSpawn();
}
}
public void DoSpawn()
{
Map map = this.Map;
if (Spawn == null)
return;
ColUtility.ForEach(Spawn.Where(bc => bc == null || !bc.Alive || bc.Deleted), bc => Spawn.Remove(bc));
if (map != null && map != Map.Internal && !this.Deleted && Spawn.Count == 0 && HasSpawned < 3)
{
HasSpawned++;
NextSpawn = DateTime.UtcNow + TimeSpan.FromMinutes(Utility.RandomMinMax(2, 5));
int time = 333;
for (int i = 0; i < SpawnCount - Spawn.Count; i++)
{
Timer.DelayCall(TimeSpan.FromMilliseconds(time), () =>
{
Point3D p = this.Location;
for (int j = 0; j < 25; j++)
{
int x = Utility.RandomMinMax(this.X - 3, this.X + 3);
int y = Utility.RandomMinMax(this.Y - 3, this.Y + 3);
int z = map.GetAverageZ(x, y);
if (map.CanSpawnMobile(x, y, z) && this.InLOS(new Point3D(x, y, z)))
{
p = new Point3D(x, y, z);
break;
}
}
BaseCreature bc = Activator.CreateInstance(_SpawnList[Utility.Random(_SpawnList.Length)]) as BaseCreature;
if (bc != null)
{
Spawn.Add(bc);
bc.MoveToWorld(p, map);
Timer.DelayCall<BaseCreature>(creature => creature.Combatant = Focus, bc);
}
});
time += 333;
}
}
}
public void CheckSpawn()
{
if (Spawn == null)
Delete();
else
{
int count = 0;
ColUtility.ForEach(Spawn.Where(bc => bc != null && bc.Alive), bc => count++);
if (count == 0)
Delete();
}
}
public override void Delete()
{
base.Delete();
if (Spawn != null)
{
ColUtility.Free(Spawn);
Spawn = null;
}
}
public MyrmidexHill(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(1);
writer.Write(HasSpawned);
writer.Write(Spawn == null ? 0 : Spawn.Count);
if (Spawn != null)
{
Spawn.ForEach(bc => writer.Write(bc));
}
Timer.DelayCall(TimeSpan.FromSeconds(30), CheckSpawn);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 1:
HasSpawned = reader.ReadInt();
goto case 0;
case 0:
int count = reader.ReadInt();
if (count > 0)
{
Spawn = new List<BaseCreature>();
for (int i = 0; i < count; i++)
{
BaseCreature bc = reader.ReadMobile() as BaseCreature;
if (bc != null)
Spawn.Add(bc);
}
}
break;
}
if (Spawn == null || Spawn.Count == 0)
Delete();
else
{
Timer.DelayCall(TimeSpan.FromSeconds(10), () =>
{
EodonTribeRegion r = Region.Find(this.Location, this.Map) as EodonTribeRegion;
if (r != null)
Zone = r;
});
}
}
}
public class EodonTribeRegion : Region
{
public static void Initialize()
{
_Zones[0] = new EodonTribeRegion(EodonTribe.Jukari, new Rectangle2D[] { new Rectangle2D(640, 2046, 115, 115) }, 6);
_Zones[1] = new EodonTribeRegion(EodonTribe.Kurak, new Rectangle2D[] { new Rectangle2D(291, 1817, 125, 90) }, 6);
_Zones[2] = new EodonTribeRegion(EodonTribe.Barrab, new Rectangle2D[] { new Rectangle2D(134, 1767, 33, 20), new Rectangle2D(142, 1786, 57, 80), new Rectangle2D(145, 1750, 20, 20) }, 5);
_Zones[3] = new EodonTribeRegion(EodonTribe.Barako, new Rectangle2D[] { new Rectangle2D(620, 1677, 95, 100) }, 5);
_Zones[4] = new EodonTribeRegion(EodonTribe.Urali, new Rectangle2D[] { new Rectangle2D(320, 1551, 160, 72) }, 5);
_Zones[5] = new EodonTribeRegion(EodonTribe.Sakkhra, new Rectangle2D[] { new Rectangle2D(482, 1375, 200, 200) }, 8);
}
public static EodonTribeRegion[] _Zones = new EodonTribeRegion[6];
public int MaxSpawns { get; private set; }
public EodonTribe Tribe { get; set; }
public int Spawns { get { return this.GetItemCount(i => i is MyrmidexHill); } }
public EodonTribeRegion(EodonTribe tribe, Rectangle2D[] rec, int maxSpawns)
: base(tribe.ToString() + " tribe", Map.TerMur, Region.DefaultPriority, rec)
{
Tribe = tribe;
Register();
MaxSpawns = maxSpawns;
}
public override void OnLocationChanged(Mobile m, Point3D oldLocation)
{
if (Tribe != EodonTribe.Barrab && Spawns < MaxSpawns)
{
double chance = Utility.RandomDouble();
if (0.005 > chance && (m is PlayerMobile || (m is BaseCreature && ((BaseCreature)m).GetMaster() is PlayerMobile)) && m.AccessLevel == AccessLevel.Player)
{
MyrmidexHill hill = new MyrmidexHill(this, m);
Point3D p = m.Location;
for (int i = 0; i < 10; i++)
{
int x = Utility.RandomMinMax(p.X - 5, p.X + 5);
int y = Utility.RandomMinMax(p.Y - 5, p.Y + 5);
int z = this.Map.GetAverageZ(x, y);
if (this.Map.CanFit(x, y, z, 16, false, false, true))
{
p = new Point3D(x, y, z);
break;
}
}
hill.MoveToWorld(p, this.Map);
hill.DoSpawn();
}
}
}
}
}

View File

@@ -0,0 +1,415 @@
using System;
using Server;
using Server.Items;
using Server.Engines.Quests;
namespace Server.Mobiles
{
public class Hawkwind2 : MondainQuester
{
public override Type[] Quests { get { return new Type[] { typeof(TimeIsOfTheEssenceQuest) }; } }
[Constructable]
public Hawkwind2()
: base("Hawkwind", "the Time Lord")
{
}
public Hawkwind2(Serial serial)
: base(serial)
{
}
public override void OnTalk(PlayerMobile player)
{
if (QuestHelper.HasQuest(player, typeof(UnitingTheTribesQuest)))
{
OnOfferFailed();
return;
}
base.OnTalk(player);
}
public override void Advertise()
{
Say(1156465); // The situation is dire, King Blackthorn. I fear only a courageous adventurer can aid us...
}
public override void InitBody()
{
InitStats(100, 100, 25);
Female = false;
Race = Race.Human;
Hue = 0x83EB;
}
public override void InitOutfit()
{
Robe robe = new Robe();
robe.ItemID = 0x7816;
AddItem(robe);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class SirGeoffery : MondainQuester
{
public override Type[] Quests { get { return new Type[] { typeof(UnitingTheTribesQuest) }; } }
public override bool ChangeRace { get { return false; } }
[Constructable]
public SirGeoffery()
: base("Sir Geoffrey", "the Guardsman")
{
}
public override void InitBody()
{
InitStats(125, 150, 25);
Female = false;
Body = 0x190;
FacialHairItemID = 8267;
HairItemID = Race.RandomHair(false);
HairHue = Race.RandomHairHue();
Hue = Utility.RandomSkinHue();
}
public override void InitOutfit()
{
SetWearable(new PlateArms());
SetWearable(new PlateChest());
SetWearable(new Doublet(), 1702);
SetWearable(new BodySash(), 437);
SetWearable(new ChainLegs());
SetWearable(new PlateGorget());
SetWearable(new Helmet());
SetWearable(new Halberd());
SetWearable(new ShortPants(), 2305);
SetWearable(new Shoes(), 2305);
}
public SirGeoffery(Serial serial)
: base(serial)
{
}
public override void OnTalk(PlayerMobile player)
{
TimeIsOfTheEssenceQuest q = QuestHelper.GetQuest(player, typeof(TimeIsOfTheEssenceQuest)) as TimeIsOfTheEssenceQuest;
if (QuestHelper.HasQuest(player, typeof(TimeIsOfTheEssenceQuest)) || QuestHelper.HasQuest(player, typeof(UnitingTheTribesQuest)))
{
base.OnTalk(player);
}
else
{
Advertise();
}
}
public override void Advertise()
{
Say(1156466); // Get these supplies unloaded! Set up a perimeter! I don't want to see a Myrmidex within 10 feet of this camp! Where's that bloody assistance the King promised!?
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class SakkhraHighChieftess : MondainQuester
{
public override Type[] Quests { get { return new Type[] { typeof(TheGreatHuntQuest) }; } }
[Constructable]
public SakkhraHighChieftess()
: base(BaseEodonTribesman.GetRandomName(), "the sakkhra high chieftess")
{
}
public SakkhraHighChieftess(Serial serial)
: base(serial)
{
}
public override void InitBody()
{
InitStats(100, 100, 25);
Female = true;
Body = 0x191;
HairItemID = 0x203C;
Hue = 34894;
}
public override void InitOutfit()
{
SetWearable(new StuddedChest(), 2118);
SetWearable(new LeatherArms(), 2106);
SetWearable(new LeatherGloves(), 2106);
SetWearable(new SkullCap(), 2118);
SetWearable(new RingmailLegs(), 2106);
SetWearable(new ThighBoots(), 2106);
SetWearable(new Yumi(), 2118);
}
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();
if (Title != "the sakkhra high chieftess")
Title = "the sakkhra high chieftess";
}
}
public class UraliHighChieftess : MondainQuester
{
public override Type[] Quests { get { return new Type[] { typeof(EmptyNestQuest) }; } }
[Constructable]
public UraliHighChieftess()
: base(BaseEodonTribesman.GetRandomName(), "the urali high chieftess")
{
}
public UraliHighChieftess(Serial serial)
: base(serial)
{
}
public override void InitBody()
{
InitStats(100, 100, 25);
Female = true;
Body = 0x25E;
Race = Race.Elf;
HairItemID = 0x2FD0;
Hue = 35356;
}
public override void InitOutfit()
{
SetWearable(new ChainLegs(), 2576);
SetWearable(new DragonChest(), 2576);
SetWearable(new DragonArms(), 2576);
SetWearable(new MetalShield(), 2576);
SetWearable(new Circlet(), 2576);
SetWearable(new JinBaori(), 2592);
SetWearable(new Waraji(), 2576);
}
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();
if (Title != "the urali high chieftess")
Title = "the urali high chieftess";
}
}
public class JukariHighChief : MondainQuester
{
public override Type[] Quests { get { return new Type[] { typeof(TheGreatVolcanoQuest) }; } }
[Constructable]
public JukariHighChief()
: base(BaseEodonTribesman.GetRandomName(), "the jukari high chief")
{
}
public JukariHighChief(Serial serial)
: base(serial)
{
}
public override void InitBody()
{
InitStats(100, 100, 25);
Female = false;
Body = 0x190;
HairItemID = 0;
Hue = 34723;
}
public override void InitOutfit()
{
SetWearable(new LeatherLegs(), 1175);
SetWearable(new Shirt(), 1175);
SetWearable(new Torch());
SetWearable(new Bokuto(), 1175);
}
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();
if (Title != "the jukari high chief")
Title = "the jukari high chief";
}
}
public class KurakHighChief : MondainQuester
{
public override Type[] Quests { get { return new Type[] { typeof(PrideOfTheAmbushQuest) }; } }
[Constructable]
public KurakHighChief()
: base(BaseEodonTribesman.GetRandomName(), "the kurak high chief")
{
}
public KurakHighChief(Serial serial)
: base(serial)
{
}
public override void InitBody()
{
InitStats(100, 100, 25);
Female = false;
Body = 0x190;
HairItemID = 0x203B;
Hue = 33960;
}
public override void InitOutfit()
{
SetWearable(new LeatherDo(), 1175);
SetWearable(new FancyShirt(), 1175);
SetWearable(new TattsukeHakama());
SetWearable(new Sandals(), 1175);
SetWearable(new Tekagi(), 1175);
}
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();
if (Title != "the kurak high chief")
Title = "the kurak high chief";
}
}
public class BarakoHighChief : MondainQuester
{
public override Type[] Quests { get { return new Type[] { typeof(TheGreatApeQuest) }; } }
[Constructable]
public BarakoHighChief()
: base(BaseEodonTribesman.GetRandomName(), "the barako high chief")
{
}
public BarakoHighChief(Serial serial)
: base(serial)
{
}
public override void InitBody()
{
InitStats(100, 100, 25);
Female = false;
Body = 0x190;
HairItemID = 0x203C;
Hue = 35187;
}
public override void InitOutfit()
{
SetWearable(new BoneChest(), 2407);
SetWearable(new LeatherNinjaPants(), 2407);
SetWearable(new StuddedHiroSode(), 2407);
SetWearable(new BoneGloves(), 2407);
SetWearable(new StuddedGorget(), 2407);
SetWearable(new Boots(), 2407);
SetWearable(new Scepter(), 2407);
}
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();
if (Title != "the barako high chief")
Title = "the barako high chief";
}
}
}

View File

@@ -0,0 +1,671 @@
using Server;
using System;
using System.Linq;
using System.Collections.Generic;
using Server.Items;
using Server.Mobiles;
using Server.Engines.Harvest;
using Server.Network;
using Server.Gumps;
namespace Server.Engines.Quests
{
public class TimeIsOfTheEssenceQuest : BaseQuest
{
public override QuestChain ChainID{ get{ return QuestChain.ValleyOfOne; } }
public override Type NextQuest{ get{ return typeof( UnitingTheTribesQuest ); } }
public override object Title{ get{ return 1156512; } } /*The Valley of One*/
public override object Description{ get{ return 1156458; } } /*Hawkwind: I'm afraid I have foreseen a most unfortunate timeline of events...
<br><br>Blackthorn: Tell me, what is it that troubles you?<br><br>Hawkwind: I
brought the Britannians to Shadowguard to aid in the battle against Minax, in
doing so I fear I may have placed the native peoples in grave peril. The
Britannians are a curious and brave people, I fear that curiosity has put the
Valley of Eodon at risk. Britannians seek to take advantage of the natural
resources in Eodon.<br><br>Blackthorn: Such is the nature of all humans. Surely
you knew of this risk?<br><br>Hawkwind: Indeed, for every action there is an
equal and opposite reaction. Cause and effect are linked at the most fundamental
levels.<br><br>Blackthorn: And so what is the effect of the Britannian's
adventurism?<br><br>Hawkwind: Scores of Dragon Turtles lay dead, tiger carcasses
litter the jungle floor. Native tribes people have been murdered at the hands of
what they only know as foreign invaders.<br><br>Blackthorn: *Blackthorn looks down
solemnly* One must ask whether the ends justify the means...<br><br>Hawkwind: We
could not allow Minax to take hold in Eodon. As any other threat, I am certain the
Britannians will answer the call.<br><br>Blackthorn: Tis the very nature of my Kingdom
and its peoples to rise in a time of need.<br><br>Hawkwind: With so much death the
Myrmidex have grown increasingly bold. The abundance of carrion has lured them from
their dark pits to feed and bolster their numbers. The Barrab Tribe has seen this as
an omen and increased the fervor of their zealotism. If the Myrmidex are not held in
check, I fear the entire Valley will be overrun.<br><br>Blackthorn: Is there no way to
stop the invasion?<br><br>Hawkwind: There is always another path on the Time Line.
We must unite the Tribes of Eodon against the Barrab. Only then can they stop the
Myrmidex invasion.<br><br>Blackthorn: *King Blackthorn smiles at you* Well then!
Take these orders to Sir Geoffrey at his camp near the Barrab Tribe in the Valley of
Eodon. Godspeed!*/
public override object Refuse{ get{ return 1156460; } } /* Tis unfortunate, in this time of great need we must look to our inner courage... */
public override object Uncomplete{ get{ return 1156461; } } /*There is little time to delay. Deliver the orders to Sir Geoffrey at his camp near
the Barrab Tribe in the Valley of Eodon.*/
public override object Complete{ get{ return 1156462; } } /* Ahh, King Blackthorn sent you did he? */
public TimeIsOfTheEssenceQuest() : base()
{
AddObjective( new DeliverObjective( typeof(KingBlackthornOrders), "Orders from King Blackthorn to Sir Geoffrey", 1, typeof(SirGeoffery), "Sir Geoffery", 360 ) );
AddReward( new BaseReward( 1156459 ) ); // A step closer to quelling the Myrmidex threat...
}
public override bool RenderObjective(MondainQuestGump g, bool offer)
{
if (offer)
g.AddHtmlLocalized(130, 45, 270, 16, 1049010, 0xFFFFFF, false, false); // Quest Offer
else
g.AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false); // Quest Log
g.AddButton(130, 430, 0x2EEF, 0x2EF1, (int)Buttons.PreviousPage, GumpButtonType.Reply, 0);
g.AddButton(275, 430, 0x2EE9, 0x2EEB, (int)Buttons.NextPage, GumpButtonType.Reply, 0);
g.AddHtmlObject(160, 70, 330, 16, Title, BaseQuestGump.DarkGreen, false, false);
g.AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710, false, false); // Objective:
g.AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710, false, false); // All of the following
g.AddHtmlLocalized(98, 1, 40, 16, 1072207, 0x15F90, false, false); // Deliver
g.AddHtmlLocalized(143, 172, 300, 16, 1156516, 0xFFFF, false, false); // Orders from King Blackthorn to Sir Geoffrey
return true;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class UnitingTheTribesQuest : BaseQuest
{
public override QuestChain ChainID{ get{ return QuestChain.ValleyOfOne; } }
public override object Title{ get{ return 1156463; } } /* Uniting the Tribes */
public override object Description{ get{ return 1156464; } } /* *Sir Geoffrey looks up at you* What's this? Ah! Here to join the effort then?
We've been trying for weeks to push through to the Barrab and get them to give
us the secrets to entering the Myrmidex pits, but alas we have had little luck.
King Blackthorn seems to think our only hope is to pressure the Barrab via the
other Eodonian tribes. We tried to approach them initially but were met with
aggression. It wasn't until Professor Rafkin arrived that we were able to peacefully
communicate with them. In order for them to join our cause you'll need to gain their
trust. The Sakkhra worship these overgrown Lizardmen, "Di-no-saur" is the word they
use, bunch of rubbish if you ask me, but you should find their High Chief in the
Sakkhra walled village to the North beyond the rivers. The Urali worship the
Dragon Turtle, shucks, to be honest I thought such a creature was myth until one
came crashing up on a beach during one of our early expeditions. You can find the
Urali just north of the beach lined streams that are home to the Dragon Turtles. The
Jukari worship the great Volcano. Nasty bunch too, took out a company of my men with
pickaxes to the skull. In any case, they can be found at the base of the Volcano to
the Southeast. The Kurak are lightning fast and worship the jungle cats they call
"Ti-gers" Cute little things until one rips you apart and drags you back to its den
*chuckles a bit* Their tribe is in the lowlands to the Southwest. The Barako live
high up in the trees and worship the gorillas that populate that region. Professor
Rafkin says something about a mythical giant ape, bunch of baloney if you ask me.
Their tribe sits in the forest canopy to the East. Bring me back proof that the
tribes have agreed to join our cause and you'll be rewarded handsomely. Or this jungle
will tear you apart, whichever happens first. Good luck!*/
public override object Refuse{ get{ return 1156472; } } /* Well then stop wasting my bloody time! Haven't you see we've got a war to win?! */
public override object Uncomplete{ get{ return 1156518; } } /* These tribes aren't going to unite themselves, best get on with it and visit the Sakkhra,
Urali, Jukari, Kurak, and Barako tribes! We've got a war to win! */
public override object Complete{ get{ return 1156519; } } /*Well done! I don't know how you managed to pull it off but this is the break we've
been waiting for! With the support of the other tribes we can begin to plan an offensive
to quell the Myrmidex threat! It will likely take some time before our troops and the
Tribes are ready. I will send word when the time to attack comes!*/
public UnitingTheTribesQuest() : base()
{
AddObjective(new ObtainObjective(typeof(MosaicOfHeluzz), "Trust of the Sakkhra Tribe", 1));
AddObjective(new ObtainObjective(typeof(TotemOfFabozz), "Trust of the Urali Tribe", 1));
AddObjective(new ObtainObjective(typeof(FiresOfKukuzz), "Trust of the Jukari Tribe", 1));
AddObjective(new ObtainObjective(typeof(SkullOfMotazz), "Trust of the Kurak Tribe", 1));
AddObjective(new ObtainObjective(typeof(SkullOfAphazz), "Trust of the Barako Tribe", 1));
AddReward(new BaseReward(typeof(UniqueTreasureBag), 1, 1156581)); // A bag with a unique treasure
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class TheGreatHuntQuest : BaseQuest
{
public override object Title{ get{ return 1156521; } } /* The Great Hunt */
public override object Description{ get{ return 1156522; } } /* *The Sakkhra High Chieftess looks at you apprehensively,
as the greeting Professor Rafkin's book taught you rolls from your tongue The
High Chief smiles and warms to you* Rafkin say you can help Sakkhra. Sakkhra
do not trust you. You want Sakkhra trust, then you fight biggest of all dinosaur,
T Rex! You survive the T Rex hunt, then Sakkhra trust you. *The Chief motions you
west to the nearby dinosaur plains* */
public override object Refuse{ get{ return 1156550; } } /* *The Chieftess looks at you...* */
public override object Uncomplete{ get{ return 1156531; } } /* You not kill giant dino yet? Sakkhra will not help until you kill big dino! */
public override object Complete{ get{ return 1156557; } } /* Ahh-Ooo! Ahh-Ooo! Britainnian kill big dino! Show courage and strength! Sakkrah trust you now! */
public TheGreatHuntQuest() : base()
{
AddObjective(new SlayObjective(typeof(TRex), "Slay the Tyrannosaurus Rex", 1));
AddReward( new BaseReward( typeof(MosaicOfHeluzz), 1, 1156551 ) ); // Trust of the Sakkhra Tribe
}
public override bool RenderObjective(MondainQuestGump g, bool offer)
{
if (offer)
g.AddHtmlLocalized(130, 45, 270, 16, 1049010, 0xFFFFFF, false, false); // Quest Offer
else
g.AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false); // Quest Log
g.AddButton(130, 430, 0x2EEF, 0x2EF1, (int)Buttons.PreviousPage, GumpButtonType.Reply, 0);
g.AddButton(275, 430, 0x2EE9, 0x2EEB, (int)Buttons.NextPage, GumpButtonType.Reply, 0);
g.AddHtmlObject(160, 70, 330, 16, Title, BaseQuestGump.DarkGreen, false, false);
g.AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710, false, false); // Objective:
g.AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710, false, false); // All of the following
g.AddHtmlLocalized(98, 172, 300, 16, 1156533, 0xFFFF, false, false); // Slay the Tyrannosaurus Rex
return true;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class EmptyNestQuest : BaseQuest
{
public override object Title{ get{ return 1156523; } } /* Empty Nest */
public override object Description{ get{ return 1156524; } } /* *The Urali High Chieftess looks at you apprehensively, as the greeting Professor
Rafkin's book taught you rolls from your tongue The Chieftess smiles and warms to you*
Rafkin say you can help Urali. Urali do not trust you. You want Urali trust, then you
stop them taking Dragon Turtle Egg. You stop Dragon Turtle Egg theft, then Urali trust you.
*The Chieftess motions you south towards the nearby nesting beach* */
public override object Refuse{ get{ return 1156550; } } /* *The Chieftess looks at you...* */
public override object Uncomplete{ get{ return 1156536; } } /* You not save Dragon Turtle Hatchlings yet? Urali will not help until you save Dragon Turtle Hatchlings! */
public override object Complete{ get{ return 1156537; } } /* Ahhh-OOO! Ahhh-OOO! Dragon Turtle dig-dig and swim-swim! You good to Urali! Urali trust you! */
public EmptyNestQuest() : base()
{
AddObjective( new InternalObjective());
AddReward( new BaseReward( typeof(TotemOfFabozz), 1, 1156552 ) ); // Trust of the Urali Tribe
}
public override bool RenderObjective(MondainQuestGump g, bool offer)
{
if (offer)
g.AddHtmlLocalized(130, 45, 270, 16, 1049010, 0xFFFFFF, false, false); // Quest Offer
else
g.AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false); // Quest Log
g.AddButton(130, 430, 0x2EEF, 0x2EF1, (int)Buttons.PreviousPage, GumpButtonType.Reply, 0);
g.AddButton(275, 430, 0x2EE9, 0x2EEB, (int)Buttons.NextPage, GumpButtonType.Reply, 0);
g.AddHtmlObject(160, 70, 330, 16, Title, BaseQuestGump.DarkGreen, false, false);
g.AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710, false, false); // Objective:
g.AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710, false, false); // All of the following
g.AddHtmlLocalized(98, 172, 300, 16, 1156534, 0xFFFF, false, false); // Rescue 5 Dragon Turtle Hatchlings from poachers
return true;
}
public void Update(object o)
{
foreach (BaseObjective obj in Objectives)
{
obj.Update(o);
if (!Completed)
{
Owner.PlaySound(UpdateSound);
Owner.SendLocalizedMessage(1156535, String.Format("{0}\t{1}", obj.CurProgress.ToString(), obj.MaxProgress.ToString())); // You have rescued ~1_count~ of ~2_max~ Dragon Turtle Hatchlings.
}
else
{
OnCompleted();
}
}
}
public override void OnCompleted()
{
Owner.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete.
Owner.PlaySound(CompleteSound);
}
public class InternalObjective : BaseObjective
{
public InternalObjective() : base(5)
{
}
public override bool Update(object o)
{
CurProgress++;
return true;
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class TheGreatVolcanoQuest : BaseQuest
{
public override object Title{ get{ return 1156525; } } /* The Great Volcano */
public override object Description{ get{ return 1156526; } } /* *The Jukari High Chief looks at you apprehensively, as the greeting Professor
Rafkin's book taught you rolls from your tongue The Chief smiles and warms to you*
Rafkin say you can help Jukari. Jukari do not trust you. You want Jukari trust, then
you mine Jukari Lavastone from Volcano. Volcano no eat you, then Jukari trust you.
*The chief motions you east toward the Volcano* */
public override object Refuse{ get{ return 1156532; } } /* *The Chief looks at you...* */
public override object Uncomplete{ get{ return 1156540; } } /* You afraid of Great Volcano? Ha Ha! Britannian afraid! */
public override object Complete{ get{ return 1156541; } } /* OOO! You bring Jukari lava rock, mean Volcano no like your taste HA HA! Jukari help you! */
public TheGreatVolcanoQuest() : base()
{
//AddObjective( new ObtainObjective( typeof(LavaStone), "Recover 5 lava rocks from the Caldera of the Great Volcano", 5 ) );
AddObjective(new InternalObjective());
AddReward( new BaseReward( typeof(FiresOfKukuzz), 1, 1156553 ) ); // Trust of the Jukari Tribe
}
public static Rectangle2D VolcanoMineBounds = new Rectangle2D(879, 1568, 95, 95);
public static bool OnHarvest(Mobile m, Item tool)
{
if (!(m is PlayerMobile) || m.Map != Map.TerMur)
return false;
PlayerMobile pm = m as PlayerMobile;
if ((pm.ToggleMiningStone || pm.ToggleStoneOnly) && VolcanoMineBounds.Contains(m.Location))
{
object locked = tool;
if (!m.BeginAction(locked))
return false;
m.Animate(AnimationType.Attack, 3);
Timer.DelayCall(Mining.System.OreAndStone.EffectSoundDelay, () =>
{
m.PlaySound(Utility.RandomList(Mining.System.OreAndStone.EffectSounds));
});
Timer.DelayCall(Mining.System.OreAndStone.EffectDelay, () =>
{
TheGreatVolcanoQuest quest = QuestHelper.GetQuest(pm, typeof(TheGreatVolcanoQuest)) as TheGreatVolcanoQuest;
if (quest != null && !quest.Completed && 0.05 > Utility.RandomDouble())
{
if (m.CheckSkill(SkillName.Mining, 90, 100))
{
double chance = Utility.RandomDouble();
if (0.08 > chance)
{
BaseCreature spawn = new VolcanoElemental();
Point3D p = m.Location;
for (int i = 0; i < 10; i++)
{
int x = Utility.RandomMinMax(p.X - 1, p.X + 1);
int y = Utility.RandomMinMax(p.Y - 1, p.Y + 1);
int z = Map.TerMur.GetAverageZ(x, y);
if (Map.TerMur.CanSpawnMobile(x, y, z))
{
p = new Point3D(x, y, z);
break;
}
}
spawn.OnBeforeSpawn(p, Map.TerMur);
spawn.MoveToWorld(p, Map.TerMur);
spawn.OnAfterSpawn();
spawn.Combatant = m;
m.SendLocalizedMessage(1156508); // Uh oh...that doesn't look like a lava rock!
}
else if (0.55 > chance)
{
m.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1156507, m.NetState); // *You uncover a lava rock and carefully store it for later!*
quest.Update(m);
}
else
m.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, 1156509); // You loosen some dirt but fail to find anything.
}
else
m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1156509); // You loosen some dirt but fail to find anything.
}
else
m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1156509); // You loosen some dirt but fail to find anything.
if (tool is IUsesRemaining)
{
((IUsesRemaining)tool).UsesRemaining--;
if (((IUsesRemaining)tool).UsesRemaining <= 0)
{
m.SendLocalizedMessage(1044038); // You have worn out your tool!
tool.Delete();
}
}
m.EndAction(locked);
});
return true;
}
return false;
}
public bool Update(object o)
{
foreach (BaseObjective obj in Objectives)
{
obj.Update(o);
if (!Completed)
{
Owner.PlaySound(UpdateSound);
Owner.SendLocalizedMessage(1156539, String.Format("{0}\t{1}", obj.CurProgress.ToString(), obj.MaxProgress.ToString())); // You have recovered ~1_count~ of ~2_max~ Lava Rocks.
}
else
{
OnCompleted();
}
}
return true;
}
private class InternalObjective : BaseObjective
{
public override object ObjectiveDescription
{
get { return 1156538; } // Recover 5 lava rocks from the Caldera of the Great Volcano
}
public InternalObjective()
: base(5)
{
}
public override bool Update(object o)
{
CurProgress++;
return true;
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class PrideOfTheAmbushQuest : BaseQuest
{
public override object Title{ get{ return 1156527; } } /* The Pride of the Ambush */
public override object Description{ get{ return 1156528; } } /* *The Kurak High Chief looks at you apprehensively, as the greeting Professor
Rafkin's book taught you rolls from your tongue The Chieftess smiles and warms
to you* Rafkin say you can help Kurak. Kurak do not trust you. You want Kurak
trust, then you free cubs from trappers. You free cubs from trappers, then
Kurak trust you. *The chieftess motions you south to the lowlands* */
public override object Refuse{ get{ return 1156532; } } /* *The Chief looks at you...* */
public override object Uncomplete{ get{ return 1156545; } } /* You save tiger cubs! They little and helpless! Kurak will not help until you save tiger cubs! */
public override object Complete{ get{ return 1156546; } } /* You save tiger cubs! Kurak thank you and help you! */
public PrideOfTheAmbushQuest() : base()
{
AddObjective( new InternalObjective( ) );
AddReward( new BaseReward( typeof(SkullOfMotazz), 1, 1156554 ) ); // Trust of the Kurak Tribe
}
public override bool RenderObjective(MondainQuestGump g, bool offer)
{
if (offer)
g.AddHtmlLocalized(130, 45, 270, 16, 1049010, 0xFFFFFF, false, false); // Quest Offer
else
g.AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false); // Quest Log
g.AddButton(130, 430, 0x2EEF, 0x2EF1, (int)Buttons.PreviousPage, GumpButtonType.Reply, 0);
g.AddButton(275, 430, 0x2EE9, 0x2EEB, (int)Buttons.NextPage, GumpButtonType.Reply, 0);
g.AddHtmlObject(160, 70, 330, 16, Title, BaseQuestGump.DarkGreen, false, false);
g.AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710, false, false); // Objective:
g.AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710, false, false); // All of the following
g.AddHtmlLocalized(98, 172, 300, 16, 1156544, 0xFFFF, false, false); // Rescue 5 tiger cubs from the trapper enclosures.
return true;
}
public bool Update(object o)
{
foreach (BaseObjective obj in Objectives)
{
obj.Update(o);
if (!Completed)
{
Owner.PlaySound(UpdateSound);
Owner.SendLocalizedMessage(1156543, String.Format("{0}\t{1}", obj.CurProgress.ToString(), obj.MaxProgress.ToString())); // You have rescued ~1_count~ of ~2_max~ tiger cubs.
}
else
{
OnCompleted();
}
}
return true;
}
public override void OnCompleted()
{
Owner.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete.
Owner.PlaySound(CompleteSound);
}
public class InternalObjective : BaseObjective
{
public InternalObjective()
: base(5)
{
}
public override bool Update(object o)
{
CurProgress++;
return true;
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class TheGreatApeQuest : BaseQuest
{
public override object Title{ get{ return 1156529; } } /* The Great Ape */
public override object Description{ get{ return 1156530; } } /* *The Barako High Chief looks at you apprehensively, as the greeting
Professor Rafkin's book taught you rolls from your tongue The Chief smiles
and warms to you* Rafkin say you can help Barako. Barako do not trust you.
You want Barako trust, then you battle Great Ape. You go to banana cave and
ape no eat you, then Barako trust you. *The Chief motions you northeast toward
the nearby banana cave* */
public override object Refuse{ get{ return 1156532; } } /* *The Chief looks at you...* */
public override object Uncomplete{ get{ return 1156548; } } /* *Thumps chest!* You battle Great Ape or Barako will not trust you! */
public override object Complete{ get{ return 1156549; } } /* *Thumps chest* You battle Great Ape and win! You strong and Barako respect and trust you! */
public TheGreatApeQuest() : base()
{
AddObjective( new SlayObjective( typeof(GreatApe), "Defeat the Great Ape", 1 ) ); // Defeat the Great Ape
AddReward( new BaseReward( typeof(SkullOfAphazz), 1, 1156555 ) ); // Trust of the Barako Tribe
}
public override bool RenderObjective(MondainQuestGump g, bool offer)
{
if (offer)
g.AddHtmlLocalized(130, 45, 270, 16, 1049010, 0xFFFFFF, false, false); // Quest Offer
else
g.AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false); // Quest Log
g.AddButton(130, 430, 0x2EEF, 0x2EF1, (int)Buttons.PreviousPage, GumpButtonType.Reply, 0);
g.AddButton(275, 430, 0x2EE9, 0x2EEB, (int)Buttons.NextPage, GumpButtonType.Reply, 0);
g.AddHtmlObject(160, 70, 330, 16, Title, BaseQuestGump.DarkGreen, false, false);
g.AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710, false, false); // Objective:
g.AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710, false, false); // All of the following
g.AddHtmlLocalized(98, 172, 300, 16, 1156547, 0xFFFF, false, false); // Defeat the Great Ape
return true;
}
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,457 @@
using System;
using Server;
using System.Collections.Generic;
using Server.Mobiles;
using System.Linq;
using Server.Gumps;
using Server.Engines.Quests;
using Server.Network;
namespace Server.Items
{
public class CubEnclosure : BaseAddon
{
public EnclosureDoor Door { get; set; }
public TigerCub Cub { get; set; }
public static readonly Point3D DoorOffset = new Point3D(2, 2, 0);
public static readonly Point3D HomeLocation = new Point3D(354, 1894, 2);
[Constructable]
public CubEnclosure()
{
AddComponent(new AddonComponent(2103), 0, 0, 0);
AddComponent(new AddonComponent(2103), 0, 1, 0);
AddComponent(new AddonComponent(2103), 0, 2, 0);
AddComponent(new AddonComponent(2102), 1, 2, 0);
AddComponent(new AddonComponent(2101), 3, 2, 0);
AddComponent(new AddonComponent(2103), 3, 1, 0);
AddComponent(new AddonComponent(2103), 3, 0, 0);
AddComponent(new AddonComponent(2102), 2, -1, 0);
AddComponent(new AddonComponent(2102), 1, -1, 0);
AddComponent(new AddonComponent(2102), 3, -1, 0);
Door = new EnclosureDoor(this);
Cub = new TigerCub();
Cub.Blessed = true;
Cub.RangeHome = 5;
Cub.Location = new Point3D(this.Location.X + 1, this.Location.Y + 1, this.Location.Z);
}
public override void OnLocationChange(Point3D oldLocation)
{
base.OnLocationChange(oldLocation);
if(Door != null)
Door.MoveToWorld(new Point3D(X + DoorOffset.X, Y + DoorOffset.Y, Z + DoorOffset.Z), this.Map);
if(Cub != null)
{
Cub.MoveToWorld(new Point3D(X + 1, Y + 1, Z), this.Map);
Cub.Home = Cub.Location;
}
}
public override void OnMapChange()
{
base.OnMapChange();
if(Door != null)
Door.Map = this.Map;
if(Cub != null)
Cub.Map = this.Map;
}
public bool Contains(Point3D p)
{
foreach (AddonComponent c in Components)
{
if (c.Location == p)
return true;
}
return Door != null && Door.Location == p;
}
public void OnPuzzleCompleted(PlayerMobile pm)
{
if(Door != null)
{
pm.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x35, 1156501, pm.NetState); // *You watch as the Tiger Cub safely returns to the Kurak Tribe*
Timer.DelayCall(TimeSpan.FromSeconds(.25), Delete);
//1156499;*The enclosure unlocks!* Is this used?
if(Cub != null)
{
Cub.Blessed = false;
Cub.Protector = pm;
Cub.Home = HomeLocation;
Cub.RangeHome = 1;
}
}
}
public void OnBadDirection(PlayerMobile pm)
{
if(Utility.RandomBool())
{
if(Door != null)
pm.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x35, 1156493, pm.NetState); //*A poisonous dart embeds itself into your neck!*
Effects.PlaySound(pm.Location, pm.Map, 0x22E);
pm.Damage(Utility.RandomMinMax(20, 40));
pm.ApplyPoison(pm, Poison.Deadly);
}
else
{
if(Door != null)
pm.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x35, 1156494, pm.NetState); //*You are ambushed by attacking trappers!*
SpawnTrappers(pm);
}
}
public void SpawnTrappers(Mobile m)
{
if(m == null || !m.Alive)
return;
for(int i = 0; i < 3; i++)
{
Point3D p = m.Location;
for(int j = 0; j < 25; j++)
{
int x = p.X + Utility.RandomMinMax(p.X - 2, p.X + 2);
int y = p.Y + Utility.RandomMinMax(p.Y - 2, p.Y + 2);
int z = m.Map.GetAverageZ(x, y);
if(m.Map.CanSpawnMobile(x, y, z) && !this.Contains(new Point3D(x, y, z)))
{
p = new Point3D(x, y, z);
break;
}
}
BaseCreature bc = new Trapper();
bc.MoveToWorld(p, m.Map);
Timer.DelayCall(TimeSpan.FromSeconds(.25), (mob) => ((Mobile)mob).Combatant = m, bc);
}
}
public override void Delete()
{
base.Delete();
if (Door != null)
Door.Delete();
if (Cub != null && Cub.Protector == null)
Cub.Delete();
}
public CubEnclosure(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write(Door);
writer.Write(Cub);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
Door = reader.ReadItem() as EnclosureDoor;
Cub = reader.ReadMobile() as TigerCub;
if (Door != null)
Door.Enclosure = this;
}
}
public class EnclosureDoor : Item
{
[CommandProperty(AccessLevel.GameMaster)]
public CubEnclosure Enclosure { get; set; }
public List<int> Path { get; set; }
public EnclosureDoor(CubEnclosure enclosure) : base(2086)
{
Enclosure = enclosure;
Path = GetRandomPath();
Movable = false;
}
public override void OnDoubleClick(Mobile from)
{
if(from is PlayerMobile && from.InRange(GetWorldLocation(), 2) && from.InLOS(this))
{
PrideOfTheAmbushQuest quest = QuestHelper.GetQuest((PlayerMobile)from, typeof(PrideOfTheAmbushQuest)) as PrideOfTheAmbushQuest;
if(quest != null)
{
from.SendGump(new LockingMechanismGump((PlayerMobile)from, this));
}
}
}
private int[] m_Possibles = new int[]
{
0, 1, 2, 3,
4, 5, 6, 7,
8, 9, 10, 11,
12, 13, 14, 15
};
private int[][] _Paths = new int[][]
{
new int[] { 0, 1, 2, 3, 7, 11, 15 },
new int[] { 0, 4, 8, 12, 13, 9, 5, 1, 2, 6, 10, 14, 15 },
new int[] { 0, 4, 5, 1, 2, 3, 7, 6, 10, 14, 15 },
new int[] { 0, 4, 8, 12, 13, 14, 10, 6, 2, 3, 7, 11, 15 }, //
new int[] { 0, 4, 5, 9, 13, 14, 10, 11, 15 },
new int[] { 0, 4, 5, 1, 2, 6, 10, 9, 13, 14, 15 },
new int[] { 0, 1, 5, 4, 8, 12, 13, 14, 10, 11, 15 },
new int[] { 0, 1, 2, 6, 5, 4, 8, 12, 13, 9, 10, 11, 15 },
new int[] { 0, 1, 5, 6, 7, 11, 10, 9, 13, 14, 15 },
new int[] { 0, 1, 5, 6, 7, 11, 15 },
new int[] { 0, 1, 5, 6, 10, 9, 13, 14, 15 },
new int[] { 0, 1, 2, 3, 7, 6, 5, 4, 8, 9, 1, 11, 12, 13, 14, 15 },
new int[] { 0, 4, 8, 12, 13, 14, 15 },
new int[] { 0, 4, 5, 9, 8, 12, 13, 14, 10, 6, 2, 3, 7, 11, 15 }
};
public List<int> GetRandomPath()
{
return new List<int>(_Paths[Utility.Random(_Paths.Length)]);
}
public class LockingMechanismGump : Gump
{
public EnclosureDoor Door { get; set; }
public bool ShowNext { get; set; }
public PlayerMobile User { get; set; }
public List<int> Path { get { return Door != null && !Door.Deleted ? Door.Path : null; } }
public List<int> Progress { get; set; }
public LockingMechanismGump(PlayerMobile pm, EnclosureDoor door)
: base(25, 25)
{
Door = door;
User = pm;
Progress = new List<int>();
Progress.Add(0);
AddGumpLayout();
}
public void Refresh()
{
Entries.Clear();
Entries.TrimExcess();
AddGumpLayout();
User.CloseGump(this.GetType());
User.SendGump(this, false);
}
public void AddGumpLayout()
{
AddBackground(50, 50, 550, 440, 2600);
AddBackground(100, 75, 450, 90, 2600);
AddBackground(90, 175, 270, 270, 2600);
AddBackground(100, 185, 250, 250, 5120);
AddBackground(370, 175, 178, 200, 5120);
AddImage(145, 95, 10451);
AddImage(435, 95, 10451);
AddImage(0, 50, 10400);
AddImage(0, 200, 10401);
AddImage(0, 360, 10402);
AddImage(565, 50, 10410);
AddImage(565, 200, 10411);
AddImage(565, 360, 10412);
AddImage(370, 175, 10452);
AddImage(370, 360, 10452);
AddImageTiled(125, 207, 130, 3, 5031);
AddImageTiled(125, 247, 130, 3, 5031);
AddImageTiled(125, 287, 130, 3, 5031);
AddImageTiled(125, 327, 130, 3, 5031);
AddImageTiled(123, 205, 3, 130, 5031);
AddImageTiled(163, 205, 3, 130, 5031);
AddImageTiled(203, 205, 3, 130, 5031);
AddImageTiled(243, 205, 3, 130, 5031);
AddImage(420, 250, 1417);
AddImage(440, 270, 2642);
AddHtmlLocalized(220, 90, 210, 16, 1156490, false, false); // <center>Enclosure Locking Mechanism</center>
AddHtmlLocalized(220, 112, 210, 16, 1153748, false, false); // <center>Use the Directional Controls to</center>
AddHtmlLocalized(220, 131, 210, 16, 1156491, false, false); // <center>Unlock the Enclosure</center>
int x = 110;
int y = 195;
int xOffset = 0;
int yOffset = 0;
for (int i = 0; i < 16; i++)
{
int itemID = Progress.Contains(i) ? 2152 : 9720;
if (i < 4)
{
xOffset = x + (40 * i);
yOffset = y;
}
else if (i < 8)
{
xOffset = x + (40 * (i - 4));
yOffset = y + 40;
}
else if (i < 12)
{
xOffset = x + (40 * (i - 8));
yOffset = y + 80;
}
else if (i < 16)
{
xOffset = x + (40 * (i - 12));
yOffset = y + 120;
}
AddImage(xOffset, yOffset, itemID);
if (i == Progress[Progress.Count - 1])
AddImage(xOffset + 8, yOffset + 8, 5032);
if (ShowNext && Progress.Count <= Path.Count && i == Path[Progress.Count])
AddImage(xOffset + 8, yOffset + 8, 2361);
}
ShowNext = false;
if (User.Skills[SkillName.Lockpicking].Base >= 100)
{
AddHtmlLocalized(410, 415, 150, 32, 1156492, false, false); // Attempt to pick the enclosure lock
AddButton(370, 415, 4005, 4005, 5, GumpButtonType.Reply, 0);
}
AddButton(453, 245, 10700, 10701, 1, GumpButtonType.Reply, 0); // up
AddButton(478, 281, 10710, 10711, 2, GumpButtonType.Reply, 0); // right
AddButton(453, 305, 10720, 10721, 3, GumpButtonType.Reply, 0); // down
AddButton(413, 281, 10730, 10731, 4, GumpButtonType.Reply, 0); // left
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID > 0 && info.ButtonID <= 5)
HandleButton(info.ButtonID);
}
public void HandleButton(int id)
{
if (Door == null || Door.Deleted)
return;
if (id > 0 && id < 5)
{
int current = Progress[Progress.Count - 1];
int next = 15;
int pick;
if (Progress.Count >= 0 && Progress.Count < Path.Count)
next = Path[Progress.Count];
switch (id)
{
default:
case 1: pick = current - 4; break;
case 2: pick = current + 1; break;
case 3: pick = current + 4; break;
case 4: pick = current - 1; break;
}
if (Progress.Contains(pick) || pick < 0 || pick > 15) //Off board or already chosen spot
{
User.PlaySound(0x5B6);
Refresh();
}
else if ((current == 10 || current == 11 || current == 14) && pick == 15)
{
User.PlaySound(0x3D);
if (Door.Enclosure != null)
Door.Enclosure.OnPuzzleCompleted(User);
}
else if (pick == next) //Found next
{
Progress.Add(pick);
User.PlaySound(0x1F5);
Refresh();
}
else // Wrong Mutha Fucka!
{
if (Door.Enclosure != null)
Door.Enclosure.OnBadDirection(User);
ClearProgress();
}
}
else if (id == 5)
{
ShowNext = true;
Refresh();
}
}
public void ClearProgress()
{
Progress.Clear();
Progress.Add(0);
}
}
public EnclosureDoor(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
Path = GetRandomPath();
}
}
}

View File

@@ -0,0 +1,226 @@
using System;
using Server;
using System.Collections.Generic;
using Server.Mobiles;
using System.Linq;
using Server.Network;
using Server.Regions;
using Server.Spells;
namespace Server.Items
{
public class Volcano
{
public static readonly Rectangle2D LavaStart = new Rectangle2D(927, 1615, 2, 2);
public static readonly int LastLavaStage = 70;
public static readonly Rectangle2D[] SafeZone = new Rectangle2D[]
{
new Rectangle2D(959, 1704, 15, 14),
new Rectangle2D(915, 1696, 15, 15),
new Rectangle2D(1056, 1584, 17, 19),
new Rectangle2D(884, 1695, 13, 15),
new Rectangle2D(1009, 1663, 13, 13),
new Rectangle2D(994, 1526, 15, 15),
new Rectangle2D(1012, 1541, 15, 14),
new Rectangle2D(1032, 1520, 19, 18),
new Rectangle2D(1011, 1601, 9, 9),
new Rectangle2D(897, 1554, 15, 15),
new Rectangle2D(834, 1546, 23, 20),
new Rectangle2D(837, 1675, 11, 14),
new Rectangle2D(838, 1636, 15, 12),
new Rectangle2D(856, 1697, 19, 18),
new Rectangle2D(879, 1668, 15, 19),
new Rectangle2D(991, 1590, 15, 15)
};
public static bool InSafeZone(IPoint3D point)
{
foreach (Rectangle2D rec in SafeZone)
{
if (rec.Contains(point))
return true;
}
return false;
}
public static TimeSpan FlameRespawn { get { return TimeSpan.FromSeconds(Utility.RandomMinMax(1, 3)); } }
public static TimeSpan LavaRespawn { get { return TimeSpan.FromSeconds(Utility.RandomMinMax(20, 30)); } }
public static TimeSpan LavaAdvance { get { return TimeSpan.FromSeconds(2); } }
public static Volcano Instance { get; set; }
private Timer _LavaTimer;
private DateTime _NextLava;
private long _NextLavaAdvance;
private int _LavaStage;
private Rectangle2D _CurrentLava;
private Rectangle2D _SafeZone;
private Region _Region;
public static void Initialize()
{
Instance = new Volcano();
}
public Volcano()
{
_Region = new VolcanoRegion(this);
Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), OnTick);
}
public void OnTick()
{
if (_Region == null)
return;
int count = _Region.GetPlayerCount();
if (count == 0 && _LavaTimer == null && _NextLava < DateTime.UtcNow)
{
_NextLava = DateTime.UtcNow + LavaRespawn;
return;
}
if (count > 0 && _LavaTimer == null && _NextLava < DateTime.UtcNow)
{
List<Mobile> players = _Region.GetPlayers();
players.ForEach(m =>
{
if (m.AccessLevel == AccessLevel.Player)
m.PrivateOverheadMessage(MessageType.Regular, 0x21, 1156506, m.NetState); // *The Volcano is becoming unstable!*
});
ColUtility.Free(players);
_CurrentLava = LavaStart;
_NextLavaAdvance = Core.TickCount + 450;
_LavaTimer = Timer.DelayCall(TimeSpan.FromMilliseconds(250), TimeSpan.FromMilliseconds(250), () =>
{
if (Core.TickCount - _NextLavaAdvance >= 0)
{
_CurrentLava = new Rectangle2D(_CurrentLava.X - 2, _CurrentLava.Y - 2, _CurrentLava.Width + 4, _CurrentLava.Height + 4);
_SafeZone = new Rectangle2D(_CurrentLava.X + 2, _CurrentLava.Y + 2, _CurrentLava.Width - 4, _CurrentLava.Height - 4);
_NextLavaAdvance = Core.TickCount + 450;
AddLava();
}
});
_LavaTimer.Start();
}
}
public bool CheckCoordinate(int x, int y)
{
if (x <= _CurrentLava.X + 2 || x >= (_CurrentLava.X + _CurrentLava.Width) - 2 || y <= _CurrentLava.Y + 2 || y >= (_CurrentLava.Y + _CurrentLava.Height) - 2)
{
return true;
}
return false;
}
public void AddLava()
{
_LavaStage++;
for (int x = _CurrentLava.X; x <= _CurrentLava.X + _CurrentLava.Width; x++)
{
for (int y = _CurrentLava.Y; y <= _CurrentLava.Y + _CurrentLava.Height; y++)
{
if (CheckCoordinate(x, y))
{
Point3D p = new Point3D(x, y, 0);
IPooledEnumerable mobiles = Map.TerMur.GetMobilesInRange(p, 20);
foreach (Mobile m in mobiles)
{
if (m.AccessLevel == AccessLevel.Player && m is PlayerMobile)
m.PlaySound(520);
}
mobiles.Free();
if (Map.TerMur.CanFit(x, y, 0, 16, false, false, true) && !InSafeZone(p))
{
Effects.SendLocationEffect(p, Map.TerMur, 4847, (int)LavaAdvance.TotalSeconds * 10);
IPooledEnumerable eable = Map.TerMur.GetMobilesInRange(p, 0);
foreach (Mobile m in eable)
{
if (m.Alive && m.AccessLevel == AccessLevel.Player && (m is PlayerMobile || (m is BaseCreature && ((BaseCreature)m).GetMaster() is PlayerMobile)))
DoLavaDamageDelayed(m);
}
eable.Free();
}
}
}
}
if (_LavaStage >= LastLavaStage)
{
if (_LavaTimer != null)
{
_LavaTimer.Stop();
_LavaTimer = null;
}
_NextLava = DateTime.UtcNow + LavaRespawn;
_LavaStage = 0;
}
}
public void CheckMovement(Mobile m)
{
if (!m.Alive || m.AccessLevel > AccessLevel.Player || (m is BaseCreature && ((BaseCreature)m).GetMaster() == null))
return;
if (_LavaTimer != null && m.AccessLevel == AccessLevel.Player && m.Alive && _CurrentLava.Contains(m) && !_SafeZone.Contains(m) && !InSafeZone(m))
{
DoLavaDamageDelayed(m);
}
}
public void DoLavaDamage(Mobile m)
{
m.PrivateOverheadMessage(MessageType.Regular, 0x22, 1156497, m.NetState); // *The flowing lava scorches you!*
AOS.Damage(m, null, Utility.RandomMinMax(200, 300), 0, 100, 0, 0, 0);
}
public void DoLavaDamageDelayed(Mobile m)
{
Timer.DelayCall(TimeSpan.FromSeconds(.25), new TimerStateCallback<Mobile>(DoLavaDamage), m);
}
}
public class VolcanoRegion : BaseRegion
{
public Volcano Volcano { get; private set; }
public VolcanoRegion(Volcano volcano)
: base("Eodon_Volcano", Map.TerMur, Region.DefaultPriority, new Rectangle2D[] { new Rectangle2D(832, 1502, 255, 217)})
{
Volcano = volcano;
Register();
}
public override bool CheckTravel(Mobile m, Point3D newLocation, TravelCheckType travelType)
{
return travelType >= (TravelCheckType)4; // teleport only
}
public override void OnLocationChanged(Mobile m, Point3D oldLocation)
{
if(Volcano != null)
Volcano.CheckMovement(m);
base.OnLocationChanged(m, oldLocation);
}
}
}