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,32 @@
using System;
using Server;
namespace Server.Items
{
public class CopperPuzzleKey : BaseDecayingItem
{
public override int Lifespan { get { return 1800; } }
public override int LabelNumber { get { return 1024110; } } // copper key
[Constructable]
public CopperPuzzleKey() : base(4115)
{
}
public CopperPuzzleKey(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();
}
}
}

View File

@@ -0,0 +1,33 @@
using System;
using Server;
namespace Server.Items
{
public class GoldPuzzleKey : BaseDecayingItem
{
public override int Lifespan { get { return 1800; } }
public override int LabelNumber { get { return 1024111; } } // gold key
[Constructable]
public GoldPuzzleKey() : base(4114)
{
Hue = 1174;
}
public GoldPuzzleKey(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();
}
}
}

View File

@@ -0,0 +1,152 @@
using System;
using Server;
using Server.Mobiles;
using System.Collections.Generic;
using Server.Gumps;
namespace Server.Items
{
public class MagicKey : BaseDecayingItem
{
private int m_Span;
public override int LabelNumber { get { return 1024114; } } // magic key
public override int Lifespan { get { return m_Span; } }
[Constructable]
public MagicKey() : base(4114)
{
m_Span = 0;
Movable = false;
}
public override void OnDoubleClick(Mobile from)
{
if(RootParent != null || !from.InRange(GetWorldLocation(), 3) || Movable || IsLockedDown || IsSecure)
return;
else if (from.Backpack != null && m_Span == 0)
{
Item key = from.Backpack.FindItemByType(typeof(MagicKey));
if(key == null)
{
if(from.HasGump(typeof(MagicKey.MagicKeyConfirmGump)))
from.CloseGump(typeof(MagicKey.MagicKeyConfirmGump));
from.SendGump(new MagicKeyConfirmGump(this));
}
}
}
public override void StartTimer()
{
TimeLeft = 1800;
m_Span = 1800;
Movable = true;
base.StartTimer();
InvalidateProperties();
}
public override void Decay()
{
if (RootParent is Mobile)
{
Mobile m = (Mobile)RootParent;
if (m != null && m.Map != Map.Internal)
{
if (m_PuzzleRoom.Contains(m.Location))
{
int x = Utility.RandomMinMax(1096, 1098);
int y = Utility.RandomMinMax(1175, 1177);
int z = Map.GetAverageZ(x, y);
Point3D loc = m.Location;
Point3D p = new Point3D(x, y, z);
BaseCreature.TeleportPets(m, p, Map.TerMur);
m.MoveToWorld(p, Map.TerMur);
Effects.SendLocationParticles(EffectItem.Create(loc, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
Effects.SendLocationParticles(EffectItem.Create(p, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
}
Container pack = m.Backpack;
if (pack != null)
{
List<Item> list = new List<Item>(pack.Items);
foreach (Item item in list)
{
if (item is CopperPuzzleKey || item is GoldPuzzleKey || item is MazePuzzleItem || item is MastermindPuzzleItem)
item.Delete();
}
}
}
}
base.Decay();
}
private Rectangle2D m_PuzzleRoom = new Rectangle2D(1234, 1234, 10, 10);
private class MagicKeyConfirmGump : Gump
{
private MagicKey m_Key;
public MagicKeyConfirmGump(MagicKey key) : base(50, 50)
{
m_Key = key;
AddPage(0);
AddBackground(0, 0, 297, 115, 9200);
AddImageTiled(5, 10, 285, 25, 2624);
AddHtmlLocalized(10, 15, 275, 25, 1113390, 0x7FFF, false, false); // Puzzle Room Timer
AddImageTiled(5, 40, 285, 40, 2624);
AddHtmlLocalized(10, 40, 275, 40, 1113391, 0x7FFF, false, false); // Click CANCEL to read the instruction book or OK to start the timer now.
AddButton(5, 85, 4017, 4018, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(40, 87, 80, 25, 1011012, 0x7FFF, false, false); //CANCEL
AddButton(215, 85, 4023, 4024, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(250, 87, 80, 25, 1006044, 0x7FFF, false, false); //OK
}
public override void OnResponse(Server.Network.NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
if (info.ButtonID == 1)
{
MagicKey key = new MagicKey();
from.AddToBackpack(key);
key.Movable = true;
key.StartTimer();
from.SendLocalizedMessage(1113389); // As long as you carry this key, you will be granted access to the Puzzle Room.
}
}
}
public MagicKey(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
writer.Write(m_Span);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
m_Span = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,141 @@
using Server;
using System;
using Server.Mobiles;
using System.Collections.Generic;
namespace Server.Items
{
public class MastermindPuzzleItem : PuzzleChest
{
private MagicKey m_Key;
private Timer m_Timer;
private int m_Lifespan;
[CommandProperty(AccessLevel.GameMaster)]
public MagicKey Key { get { return m_Key; } set { m_Key = value; } }
public override int LabelNumber { get { return 1113379; } } // Puzzle Board
[Constructable]
public MastermindPuzzleItem(MagicKey key) : base(0x2AAA)
{
Hue = 914;
m_Key = key;
m_Lifespan = 600;
Movable = true;
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), new TimerCallback(Slice));
m_Timer.Start();
LootType = LootType.Blessed;
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
list.Add(1072517, m_Lifespan.ToString()); // Lifespan: ~1_val~ seconds
}
public override void OnDoubleClick(Mobile from)
{
if (MazePuzzleItem.IsInPuzzleRoom(from))
base.OnDoubleClick(from);
}
/*public override void OnDoubleClick(Mobile from)
{
PuzzleChestSolution solution = GetLastGuess(from);
if (solution != null)
solution = new PuzzleChestSolution(solution);
else
solution = new PuzzleChestSolution(PuzzleChestCylinder.None, PuzzleChestCylinder.None, PuzzleChestCylinder.None, PuzzleChestCylinder.None, PuzzleChestCylinder.None);
from.CloseGump(typeof(PuzzleChest.PuzzleGump));
from.CloseGump(typeof(PuzzleChest.StatusGump));
from.SendGump(new PuzzleChest.PuzzleGump(from, this, solution, 0));
}*/
public virtual void Slice()
{
m_Lifespan -= 10;
InvalidateProperties();
if (m_Lifespan <= 0)
Decay();
}
public virtual void Decay()
{
if (RootParent is Mobile)
{
Mobile parent = (Mobile)RootParent;
if (Name == null)
parent.SendLocalizedMessage(1072515, "#" + LabelNumber); // The ~1_name~ expired...
else
parent.SendLocalizedMessage(1072515, Name); // The ~1_name~ expired...
Effects.SendLocationParticles(EffectItem.Create(parent.Location, parent.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
Effects.PlaySound(parent.Location, parent.Map, 0x201);
parent.CloseGump(typeof(PuzzleChest.PuzzleGump));
parent.CloseGump(typeof(PuzzleChest.StatusGump));
}
else
{
Effects.SendLocationParticles(EffectItem.Create(this.Location, this.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
Effects.PlaySound(this.Location, this.Map, 0x201);
}
if(m_Timer != null)
m_Timer.Stop();
Delete();
}
public override void LockPick( Mobile from )
{
base.LockPick( from );
Timer.DelayCall(TimeSpan.FromSeconds(3), new TimerCallback(Delete));
if(m_Key != null)
m_Key.Decay();
ExperimentalGem gem = new ExperimentalGem();
gem.Owner = from;
from.AddToBackpack(gem);
from.SendLocalizedMessage(1113382); // You've solved the puzzle!! An item has been placed in your bag.
}
protected override void GenerateTreasure()
{
Solution = new PuzzleChestSolution();
}
public MastermindPuzzleItem( Serial serial ) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // ver
writer.Write(m_Key);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
m_Key = reader.ReadItem() as MagicKey;
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), new TimerCallback(Slice));
m_Timer.Start();
}
}
}

View File

@@ -0,0 +1,215 @@
using Server;
using System;
using Server.Mobiles;
using System.Collections.Generic;
using Server.Gumps;
namespace Server.Items
{
public class MazePuzzleItem : BaseDecayingItem, ICircuitTrap
{
private MagicKey m_Key;
public List<int> Path { get; set; }
public List<int> Progress { get; set; }
public CircuitCount Count { get { return CircuitCount.ThirtySix; } }
public int GumpTitle { get { return 1153747; } } // <center>GENERATOR CONTROL PANEL</center>
public int GumpDescription { get { return 1153749; } } // // <center>Close the Grid Circuit</center>
public bool CanDecipher { get { return true; } }
[CommandProperty(AccessLevel.GameMaster)]
public MagicKey Key { get { return m_Key; } set { m_Key = value; } }
public override int LabelNumber { get { return 1113379; } } // Puzzle Board
public override int Lifespan { get { return 600; } }
[Constructable]
public MazePuzzleItem(MagicKey key) : base(0x2AAA)
{
Hue = 914;
m_Key = key;
}
public override void OnDoubleClick(Mobile from)
{
if(!IsChildOf(from.Backpack))
from.SendLocalizedMessage(500325); // I am too far away to do that.
else if(from is PlayerMobile && IsInPuzzleRoom(from))
{
from.CloseGump(typeof(PuzzleChest.PuzzleGump));
from.CloseGump(typeof(PuzzleChest.StatusGump));
BaseGump.SendGump(new CircuitTrapGump((PlayerMobile)from, this));
}
}
private static Rectangle2D m_Bounds = new Rectangle2D(1089, 1162, 16, 12);
public static bool IsInPuzzleRoom(Mobile from)
{
return from.Map == Map.TerMur && m_Bounds.Contains(new Point2D(from.X, from.Y));
}
public override void OnDelete()
{
Mobile m = RootParent as Mobile;
if (m != null)
{
if (m.HasGump(typeof(CircuitTrapGump)))
{
m.CloseGump(typeof(CircuitTrapGump));
}
}
}
public void OnSelfClose(Mobile m)
{
}
public void OnProgress(Mobile m, int pick)
{
m.PlaySound(0x1F5);
}
public void OnFailed(Mobile m)
{
DoDamage(m);
}
public void OnComplete(Mobile m)
{
m.PlaySound(0x3D);
OnPuzzleCompleted(m);
}
private Timer m_DamageTimer;
public void DoDamage(Mobile m)
{
if(m_DamageTimer != null && m_DamageTimer.Running)
m_DamageTimer.Stop();
m_DamageTimer = new InternalTimer(this, m);
m_DamageTimer.Start();
}
public void ApplyShock(Mobile m, int tick)
{
if (m == null || !m.Alive || this.Deleted)
{
if (m_DamageTimer != null)
m_DamageTimer.Stop();
}
else
{
int damage = (int)(75 / Math.Max(1, tick - 1)) + Utility.RandomMinMax(1, 9);
AOS.Damage(m, damage, 0, 0, 0, 0, 100);
m.BoltEffect(0);
m.FixedParticles(0x3818, 1, 11, 0x13A8, 0, 0, EffectLayer.CenterFeet);
m.FixedParticles(0x3818, 1, 11, 0x13A8, 0, 0, EffectLayer.Waist);
m.FixedParticles(0x3818, 1, 11, 0x13A8, 0, 0, EffectLayer.Head);
m.PlaySound(0x1DC);
m.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x21, 1114443); // * Your body convulses from electric shock *
m.NonlocalOverheadMessage(Server.Network.MessageType.Regular, 0x21, 1114443, m.Name); // * ~1_NAME~ spasms from electric shock *
}
}
private class InternalTimer : Timer
{
private MazePuzzleItem m_Item;
private Mobile m_From;
private DateTime m_NextDamage;
private int m_Tick;
public InternalTimer(MazePuzzleItem item, Mobile from) : base(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1))
{
m_Item = item;
m_From = from;
m_NextDamage = DateTime.UtcNow;
m_Tick = 0;
if(item != null)
item.ApplyShock(from, 0);
}
protected override void OnTick()
{
m_Tick++;
if(m_From == null || m_Item == null || !m_From.Alive || m_Item.Deleted)
{
this.Stop();
return;
}
if(DateTime.UtcNow > m_NextDamage)
{
m_Item.ApplyShock(m_From, m_Tick);
int delay;
if(m_Tick < 3)
delay = 2;
else if (m_Tick < 5)
delay = 4;
else
delay = 6;
if(m_Tick >= 10)
this.Stop();
else
m_NextDamage = DateTime.UtcNow + TimeSpan.FromSeconds(delay);
}
}
}
public void OnPuzzleCompleted(Mobile m)
{
if(m != null)
{
Container pack = m.Backpack;
if(pack != null)
{
Item copperKey = pack.FindItemByType(typeof(CopperPuzzleKey));
Item goldKey = pack.FindItemByType(typeof(GoldPuzzleKey));
if(copperKey == null)
pack.DropItem(new CopperPuzzleKey());
else if (goldKey == null)
pack.DropItem(new GoldPuzzleKey());
else
return;
m.SendLocalizedMessage(1113382); // You've solved the puzzle!! An item has been placed in your bag.
}
//TODO: Message/Effects?
}
Timer.DelayCall(TimeSpan.FromSeconds(3), new TimerCallback(Delete));
}
public MazePuzzleItem( Serial serial ) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // ver
writer.Write(m_Key);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
m_Key = reader.ReadItem() as MagicKey;
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
namespace Server.Items
{
public class PuzzleBook : BrownBook
{
public static readonly BookContent Content = new BookContent(
"Instructions", "Sir Wilber",
new BookPageInfo(
"Greetings Traveler!",
"I would like to invite",
"you to a little game.",
"See the magic key? It "),
new BookPageInfo(
"will grant you access to",
"the Puzzle Room. Be advised",
"that once you take the key,",
"you will have no more than",
"30 minutes to enter the room."),
new BookPageInfo(
"and solve the puzzles. If",
"you fail, you will be",
"expelled and all your",
"progress will be lost! ",
"There are 3 puzzle chests.",
"Two of them must be completed",
"first to unlock the third."),
new BookPageInfo(
"If successful, you will get a",
"special item required to enter",
"my other playground should you",
"discover its location within",
"the underworld!!"));
[Constructable]
public PuzzleBook() : base(false)
{
Movable = false;
ItemID = 4030;
}
public PuzzleBook(Serial serial)
: base(serial)
{
}
public override BookContent DefaultContent { get { return Content; } }
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
}

View File

@@ -0,0 +1,113 @@
using Server;
using System;
using Server.Mobiles;
namespace Server.Items
{
public enum PuzzleType
{
WestBox, // Maze #1
EastBox, // Maze #2
NorthBox // Mastermind
}
public class PuzzleBox : Item
{
private PuzzleType m_PuzzleType;
[CommandProperty(AccessLevel.GameMaster)]
public PuzzleType PuzzleType { get { return m_PuzzleType; } set { m_PuzzleType = value; } }
public override int LabelNumber { get { return 1113486; } } // a puzzle box
[Constructable]
public PuzzleBox(PuzzleType type) : base(2472)
{
m_PuzzleType = type;
Movable = false;
}
public override void OnDoubleClick(Mobile from)
{
if(!from.InRange(this.Location, 3))
from.SendLocalizedMessage(3000268); // that is too far away.
else if (from.Backpack != null)
{
Type needed;
Item puzzle = null;
Item key = from.Backpack.FindItemByType(typeof(MagicKey));
Item puzzleItem1 = from.Backpack.FindItemByType(typeof(MazePuzzleItem));
Item puzzleItem2 = from.Backpack.FindItemByType(typeof(MastermindPuzzleItem));
if (key == null)
{
int x = Utility.RandomMinMax(1095, 1099);
int y = Utility.RandomMinMax(1178, 1179);
int z = -1;
Point3D loc = from.Location;
Point3D p = new Point3D(x, y, z);
BaseCreature.TeleportPets(from, p, Map.TerMur);
from.MoveToWorld(p, Map.TerMur);
from.PlaySound(0x1FE);
Effects.SendLocationParticles(EffectItem.Create(loc, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
Effects.SendLocationParticles(EffectItem.Create(p, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
}
if (puzzleItem1 != null || puzzleItem2 != null)
{
from.SendMessage("You already have a puzzle board.");
return;
}
switch(m_PuzzleType)
{
default:
case PuzzleType.WestBox:
case PuzzleType.EastBox: needed = typeof(MagicKey); break;
case PuzzleType.NorthBox: needed = typeof(GoldPuzzleKey); break;
}
Item item = from.Backpack.FindItemByType(needed);
if(item != null && key is MagicKey)
{
if(m_PuzzleType == PuzzleType.NorthBox)
puzzle = new MastermindPuzzleItem((MagicKey)key);
else
puzzle = new MazePuzzleItem((MagicKey)key);
}
if (puzzle != null)
{
if (!from.Backpack.TryDropItem(from, puzzle, true))
puzzle.Delete();
else
from.SendMessage("You recieve a puzzle board.");
}
else
from.SendMessage("You do not have the required key to get that puzzle board.");
}
}
public PuzzleBox( Serial serial ) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // ver
writer.Write((int)m_PuzzleType);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
m_PuzzleType = (PuzzleType)reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,46 @@
using Server;
using System;
using Server.Mobiles;
namespace Server.Items
{
public class PuzzleRoomTeleporter : Teleporter
{
[Constructable]
public PuzzleRoomTeleporter()
{
}
public override bool CanTeleport(Mobile m)
{
if (m.Backpack == null)
return false;
Item item = m.Backpack.FindItemByType(typeof(MagicKey));
if (item == null)
{
m.SendLocalizedMessage(1113393); // You must carry a magic key to enter this room.
return false;
}
return base.CanTeleport(m);
}
public PuzzleRoomTeleporter( Serial serial ) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // ver
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}