Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class CompassDirectionGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
|
||||
public CompassDirectionGump(Mobile from) : base(120, 50)
|
||||
{
|
||||
m_From = from;
|
||||
List<Point3D> pointList = Server.Regions.MazeOfDeathRegion.Path;
|
||||
|
||||
Point3D cur = m_From.Location;
|
||||
Point3D northLoc = new Point3D(cur.X, cur.Y - 1, cur.Z);
|
||||
Point3D eastLoc = new Point3D(cur.X + 1, cur.Y, cur.Z);
|
||||
Point3D southLoc = new Point3D(cur.X, cur.Y + 1, cur.Z);
|
||||
Point3D westLoc = new Point3D(cur.X - 1, cur.Y, cur.Z);
|
||||
|
||||
//this.Closable = false;
|
||||
|
||||
//Empty radar
|
||||
AddImage(0, 0, 9007);
|
||||
|
||||
//Arrows
|
||||
if(pointList.Contains(northLoc))
|
||||
AddImage(100, 50, 4501);
|
||||
|
||||
if(pointList.Contains(eastLoc))
|
||||
AddImage(100, 100, 4503);
|
||||
|
||||
if(pointList.Contains(southLoc))
|
||||
AddImage(50, 100, 4505);
|
||||
|
||||
if(pointList.Contains(westLoc))
|
||||
AddImage(50, 50, 4507);
|
||||
}
|
||||
}
|
||||
}
|
||||
86
Scripts/Services/Underworld/Maze of Death/GoldenCompass.cs
Normal file
86
Scripts/Services/Underworld/Maze of Death/GoldenCompass.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GoldenCompass : BaseDecayingItem
|
||||
{
|
||||
private int m_Span;
|
||||
|
||||
public override int Lifespan { get { return m_Span; } }
|
||||
public override int LabelNumber { get { return 1113578; } } // a golden compass
|
||||
|
||||
[Constructable]
|
||||
public GoldenCompass() : base(459)
|
||||
{
|
||||
Weight = 1;
|
||||
Hue = 0x501;
|
||||
m_Span = 0;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack) && from.Region != null && from.Region.IsPartOf<MazeOfDeathRegion>())
|
||||
{
|
||||
from.CloseGump(typeof(CompassDirectionGump));
|
||||
from.SendGump(new CompassDirectionGump(from));
|
||||
}
|
||||
else if (RootParent == null && from.InRange(GetWorldLocation(), 3) && !Movable && !IsLockedDown && !IsSecure)
|
||||
{
|
||||
if (from.Backpack != null && m_Span == 0 && from.Backpack.FindItemByType(typeof(GoldenCompass)) == null)
|
||||
{
|
||||
GoldenCompass c = new GoldenCompass();
|
||||
c.StartTimer();
|
||||
from.Backpack.DropItem(c);
|
||||
from.SendLocalizedMessage(1113584); // Please return what you borrow!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void StartTimer()
|
||||
{
|
||||
TimeLeft = 1800;
|
||||
m_Span = 1800;
|
||||
Movable = true;
|
||||
base.StartTimer();
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
Mobile m = this.RootParent as Mobile;
|
||||
|
||||
if (m != null)
|
||||
m.CloseGump(typeof(Server.Gumps.CompassDirectionGump));
|
||||
}
|
||||
|
||||
public GoldenCompass(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 v = reader.ReadInt();
|
||||
m_Span = reader.ReadInt();
|
||||
|
||||
if(m_Span > 0)
|
||||
{
|
||||
StartTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
372
Scripts/Services/Underworld/Maze of Death/Region.cs
Normal file
372
Scripts/Services/Underworld/Maze of Death/Region.cs
Normal file
@@ -0,0 +1,372 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Gumps;
|
||||
using System.Collections.Generic;
|
||||
using Server.Targeting;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Regions
|
||||
{
|
||||
public class MazeOfDeathRegion : Region
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
new MazeOfDeathRegion();
|
||||
|
||||
m_Path = new List<Point3D>();
|
||||
|
||||
m_Path.Add(new Point3D(1062, 1060, -42));
|
||||
m_Path.Add(new Point3D(1062, 1059, -42));
|
||||
m_Path.Add(new Point3D(1062, 1058, -42));
|
||||
m_Path.Add(new Point3D(1061, 1058, -42));
|
||||
m_Path.Add(new Point3D(1060, 1058, -42));
|
||||
m_Path.Add(new Point3D(1060, 1057, -42));
|
||||
m_Path.Add(new Point3D(1059, 1057, -42));
|
||||
m_Path.Add(new Point3D(1059, 1056, -42));
|
||||
m_Path.Add(new Point3D(1059, 1055, -42));
|
||||
m_Path.Add(new Point3D(1060, 1055, -42));
|
||||
m_Path.Add(new Point3D(1060, 1054, -42));
|
||||
m_Path.Add(new Point3D(1060, 1053, -42));
|
||||
m_Path.Add(new Point3D(1059, 1053, -42));
|
||||
m_Path.Add(new Point3D(1059, 1052, -42));
|
||||
m_Path.Add(new Point3D(1059, 1051, -42));
|
||||
m_Path.Add(new Point3D(1059, 1050, -42));
|
||||
m_Path.Add(new Point3D(1058, 1050, -42));
|
||||
m_Path.Add(new Point3D(1058, 1049, -42));
|
||||
m_Path.Add(new Point3D(1057, 1049, -42));
|
||||
m_Path.Add(new Point3D(1057, 1048, -42));
|
||||
m_Path.Add(new Point3D(1057, 1047, -42));
|
||||
m_Path.Add(new Point3D(1057, 1046, -42));
|
||||
m_Path.Add(new Point3D(1058, 1047, -42));
|
||||
m_Path.Add(new Point3D(1059, 1047, -42));
|
||||
m_Path.Add(new Point3D(1059, 1046, -42));
|
||||
m_Path.Add(new Point3D(1059, 1045, -42));
|
||||
m_Path.Add(new Point3D(1059, 1044, -42));
|
||||
m_Path.Add(new Point3D(1060, 1044, -42));
|
||||
m_Path.Add(new Point3D(1061, 1044, -42));
|
||||
m_Path.Add(new Point3D(1061, 1043, -42));
|
||||
m_Path.Add(new Point3D(1060, 1042, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1059, 1042, -42));
|
||||
m_Path.Add(new Point3D(1058, 1042, -42));
|
||||
m_Path.Add(new Point3D(1057, 1042, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1061, 1042, -42));
|
||||
m_Path.Add(new Point3D(1061, 1041, -42));
|
||||
m_Path.Add(new Point3D(1061, 1042, -42));
|
||||
m_Path.Add(new Point3D(1062, 1042, -42));
|
||||
m_Path.Add(new Point3D(1062, 1041, -42));
|
||||
m_Path.Add(new Point3D(1062, 1040, -42));
|
||||
m_Path.Add(new Point3D(1063, 1040, -42));
|
||||
m_Path.Add(new Point3D(1063, 1041, -42));
|
||||
m_Path.Add(new Point3D(1063, 1040, -42));
|
||||
m_Path.Add(new Point3D(1063, 1039, -42));
|
||||
m_Path.Add(new Point3D(1062, 1039, -42));
|
||||
m_Path.Add(new Point3D(1062, 1038, -42));
|
||||
m_Path.Add(new Point3D(1061, 1038, -42));
|
||||
m_Path.Add(new Point3D(1061, 1037, -42));
|
||||
m_Path.Add(new Point3D(1060, 1037, -42));
|
||||
m_Path.Add(new Point3D(1059, 1037, -42));
|
||||
m_Path.Add(new Point3D(1058, 1037, -42));
|
||||
m_Path.Add(new Point3D(1057, 1037, -42));
|
||||
m_Path.Add(new Point3D(1057, 1036, -42));
|
||||
m_Path.Add(new Point3D(1057, 1035, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1058, 1035, -42));
|
||||
m_Path.Add(new Point3D(1059, 1035, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1057, 1034, -42));
|
||||
m_Path.Add(new Point3D(1057, 1033, -42));
|
||||
m_Path.Add(new Point3D(1057, 1032, -42));
|
||||
m_Path.Add(new Point3D(1058, 1032, -42));
|
||||
m_Path.Add(new Point3D(1059, 1032, -42));
|
||||
m_Path.Add(new Point3D(1060, 1032, -42));
|
||||
m_Path.Add(new Point3D(1060, 1031, -42));
|
||||
m_Path.Add(new Point3D(1060, 1030, -42));
|
||||
m_Path.Add(new Point3D(1060, 1029, -42));
|
||||
m_Path.Add(new Point3D(1061, 1029, -42));
|
||||
m_Path.Add(new Point3D(1061, 1028, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1061, 1027, -42));
|
||||
m_Path.Add(new Point3D(1062, 1027, -42));
|
||||
m_Path.Add(new Point3D(1063, 1027, -42));
|
||||
m_Path.Add(new Point3D(1064, 1027, -42));
|
||||
m_Path.Add(new Point3D(1061, 1026, -42));
|
||||
m_Path.Add(new Point3D(1062, 1026, -42));
|
||||
m_Path.Add(new Point3D(1063, 1026, -42));
|
||||
m_Path.Add(new Point3D(1064, 1026, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1061, 1026, -42));
|
||||
m_Path.Add(new Point3D(1061, 1025, -42));
|
||||
m_Path.Add(new Point3D(1061, 1024, -42));
|
||||
m_Path.Add(new Point3D(1061, 1023, -42));
|
||||
m_Path.Add(new Point3D(1061, 1022, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1060, 1026, -42));
|
||||
m_Path.Add(new Point3D(1059, 1026, -42));
|
||||
m_Path.Add(new Point3D(1058, 1026, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1058, 1025, -42));
|
||||
m_Path.Add(new Point3D(1058, 1024, -42));
|
||||
m_Path.Add(new Point3D(1058, 1023, -42));
|
||||
m_Path.Add(new Point3D(1058, 1022, -42));
|
||||
m_Path.Add(new Point3D(1058, 1021, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1057, 1021, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1057, 1020, -42));
|
||||
m_Path.Add(new Point3D(1057, 1019, -42));
|
||||
m_Path.Add(new Point3D(1057, 1018, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1058, 1018, -42));
|
||||
m_Path.Add(new Point3D(1059, 1018, -42));
|
||||
m_Path.Add(new Point3D(1060, 1018, -42));
|
||||
m_Path.Add(new Point3D(1061, 1018, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1061, 1017, -42));
|
||||
m_Path.Add(new Point3D(1061, 1016, -42));
|
||||
m_Path.Add(new Point3D(1061, 1015, -42));
|
||||
m_Path.Add(new Point3D(1061, 1014, -42));
|
||||
m_Path.Add(new Point3D(1061, 1013, -42));
|
||||
m_Path.Add(new Point3D(1061, 1012, -42));
|
||||
m_Path.Add(new Point3D(1061, 1011, -42));
|
||||
m_Path.Add(new Point3D(1061, 1010, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1060, 1010, -42));
|
||||
m_Path.Add(new Point3D(1059, 1010, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1059, 1009, -42));
|
||||
m_Path.Add(new Point3D(1059, 1008, -42));
|
||||
m_Path.Add(new Point3D(1059, 1007, -42));
|
||||
m_Path.Add(new Point3D(1059, 1006, -42));
|
||||
m_Path.Add(new Point3D(1059, 1005, -42));
|
||||
m_Path.Add(new Point3D(1059, 1004, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1058, 1004, -42));
|
||||
m_Path.Add(new Point3D(1057, 1004, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1057, 1003, -42));
|
||||
m_Path.Add(new Point3D(1057, 1002, -42));
|
||||
m_Path.Add(new Point3D(1057, 1001, -42));
|
||||
m_Path.Add(new Point3D(1057, 1000, -42));
|
||||
m_Path.Add(new Point3D(1057, 999, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1058, 999, -42));
|
||||
m_Path.Add(new Point3D(1059, 999, -42));
|
||||
m_Path.Add(new Point3D(1060, 999, -42));
|
||||
m_Path.Add(new Point3D(1061, 999, -42));
|
||||
m_Path.Add(new Point3D(1062, 999, -42));
|
||||
m_Path.Add(new Point3D(1063, 999, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1063, 998, -42));
|
||||
m_Path.Add(new Point3D(1063, 997, -42));
|
||||
m_Path.Add(new Point3D(1063, 996, -42));
|
||||
m_Path.Add(new Point3D(1063, 995, -42));
|
||||
m_Path.Add(new Point3D(1063, 994, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1062, 994, -42));
|
||||
m_Path.Add(new Point3D(1061, 994, -42));
|
||||
|
||||
m_Path.Add(new Point3D(1061, 993, -42));
|
||||
m_Path.Add(new Point3D(1061, 992, -42));
|
||||
m_Path.Add(new Point3D(1061, 991, -42));
|
||||
m_Path.Add(new Point3D(1061, 990, -42));
|
||||
|
||||
//Add some randoms
|
||||
int toAdd = 33;
|
||||
|
||||
while (toAdd > 0)
|
||||
{
|
||||
int x = Utility.RandomMinMax(m_TrapBounds.X, m_TrapBounds.X + m_TrapBounds.Width);
|
||||
int y = Utility.RandomMinMax(m_TrapBounds.Y, m_TrapBounds.Y + m_TrapBounds.Height);
|
||||
int z = -42;
|
||||
|
||||
Point3D p = new Point3D(x, y, z);
|
||||
|
||||
if (!m_Path.Contains(p))
|
||||
{
|
||||
m_Path.Add(p);
|
||||
toAdd--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Rectangle2D[] m_Bounds = new Rectangle2D[]
|
||||
{
|
||||
new Rectangle2D(1057, 1028, 16, 40),
|
||||
new Rectangle2D(1057, 990, 16, 38)
|
||||
};
|
||||
|
||||
private static Rectangle2D m_TrapBounds = new Rectangle2D(1057, 990, 7, 71);
|
||||
|
||||
private static List<Point3D> m_Path;
|
||||
public static List<Point3D> Path { get { return m_Path; } }
|
||||
|
||||
private static Rectangle2D m_Entrance = new Rectangle2D(1057, 1062, 7, 5);
|
||||
|
||||
public MazeOfDeathRegion() : base("Maze of Death", Map.TerMur, Region.DefaultPriority, m_Bounds)
|
||||
{
|
||||
Register();
|
||||
}
|
||||
|
||||
public override bool OnBeginSpellCast(Mobile m, ISpell s)
|
||||
{
|
||||
if (m.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
|
||||
if (s is Spells.Sixth.MarkSpell || s is Spells.Seventh.GateTravelSpell || s is Spells.Third.TeleportSpell)
|
||||
{
|
||||
m.SendLocalizedMessage(501802); // that spell doesn't seem to work.
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnBeginSpellCast(m, s);
|
||||
}
|
||||
|
||||
public override bool OnTarget( Mobile m, Target t, object o )
|
||||
{
|
||||
if(m.AccessLevel == AccessLevel.Player && t is Server.Spells.Third.TeleportSpell.InternalTarget)
|
||||
{
|
||||
m.SendLocalizedMessage(501802); // that spell doesn't seem to work.
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnTarget(m, t, o);
|
||||
}
|
||||
|
||||
public override void OnEnter( Mobile m )
|
||||
{
|
||||
if(m.Backpack == null)
|
||||
return;
|
||||
|
||||
if (m.NetState != null)
|
||||
{
|
||||
m.Paralyze(TimeSpan.FromSeconds(2));
|
||||
m.PrivateOverheadMessage(Server.Network.MessageType.Regular, 33, 1113580, m.NetState); // You are filled with a sense of dread and impending doom!
|
||||
m.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, 1113581, m.NetState); // I might need something to help me navigate through this.
|
||||
|
||||
if (m.Backpack.FindItemByType(typeof(GoldenCompass)) != null)
|
||||
{
|
||||
m.CloseGump(typeof(CompassDirectionGump));
|
||||
m.SendGump(new CompassDirectionGump(m));
|
||||
}
|
||||
}
|
||||
|
||||
base.OnEnter(m);
|
||||
}
|
||||
|
||||
public override void OnExit( Mobile m )
|
||||
{
|
||||
m.CloseGump(typeof(CompassDirectionGump));
|
||||
base.OnExit(m);
|
||||
}
|
||||
|
||||
public override void OnLocationChanged( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
base.OnLocationChanged(m, oldLocation);
|
||||
|
||||
if (oldLocation.X > 1063 && m.Location.X <= 1063)
|
||||
{
|
||||
if (m.Backpack != null && m.Backpack.FindItemByType(typeof(GoldenCompass)) != null)
|
||||
m.SendLocalizedMessage(1113582); // I better proceed with caution.
|
||||
else
|
||||
m.SendLocalizedMessage(1113581); // I might need something to help me navigate through this.
|
||||
}
|
||||
else if (oldLocation.Y == 991 && m.Location.Y == 990)
|
||||
{
|
||||
if(m.HasGump(typeof(CompassDirectionGump)))
|
||||
m.SendLocalizedMessage(1113585); // The compass' arrows flicker. You must be near the right location.
|
||||
}
|
||||
|
||||
if(m != null && m.Backpack != null)
|
||||
{
|
||||
Item item = m.Backpack.FindItemByType(typeof(GoldenCompass));
|
||||
|
||||
if (m.Alive && !m_Path.Contains(m.Location) && m_TrapBounds.Contains(m.Location))
|
||||
SpringTrap(m);
|
||||
|
||||
else if (m.Alive && m.HasGump(typeof(CompassDirectionGump)))
|
||||
{
|
||||
//May need to check old gump to get x,y so new gump opens in same spot!
|
||||
m.CloseGump(typeof(CompassDirectionGump));
|
||||
m.SendGump(new CompassDirectionGump(m));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDeath( Mobile m )
|
||||
{
|
||||
base.OnDeath(m);
|
||||
|
||||
if(m.Player && m_TrapBounds.Contains(m.Location))
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(3), new TimerStateCallback(Kick_Callback), m);
|
||||
}
|
||||
|
||||
public void SpringTrap(Mobile from)
|
||||
{
|
||||
if (from == null || !from.Alive)
|
||||
return;
|
||||
|
||||
int cliloc;
|
||||
int damage = Utility.RandomMinMax(75, 150);
|
||||
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
Effects.SendLocationEffect( from, from.Map, 0x3709, 30 );
|
||||
from.PlaySound( 0x54 );
|
||||
cliloc = 1010524; // Searing heat scorches thy skin.
|
||||
AOS.Damage(from, damage, 0, 100, 0, 0, 0);
|
||||
break;
|
||||
case 1:
|
||||
from.PlaySound(0x223);
|
||||
cliloc = 1010525; // Pain lances through thee from a sharp metal blade.
|
||||
AOS.Damage(from, damage, 100, 0, 0, 0, 0);
|
||||
break;
|
||||
case 2:
|
||||
from.BoltEffect(0);
|
||||
cliloc = 1010526; // Lightning arcs through thy body.
|
||||
AOS.Damage(from, damage, 0, 0, 0, 0, 100);
|
||||
break;
|
||||
case 3:
|
||||
Effects.SendLocationEffect( from, from.Map, 0x113A, 20, 10 );
|
||||
from.PlaySound( 0x231 );
|
||||
from.ApplyPoison(from, Poison.Deadly);
|
||||
cliloc = 1010523; // A toxic vapor envelops thee.
|
||||
AOS.Damage(from, damage, 0, 0, 0, 100, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
from.LocalOverheadMessage(Server.Network.MessageType.Regular, 0xEE, cliloc);
|
||||
}
|
||||
|
||||
public void Kick_Callback(object o)
|
||||
{
|
||||
Mobile m = (Mobile)o;
|
||||
|
||||
if(m != null)
|
||||
KickToEntrance(m);
|
||||
}
|
||||
|
||||
public void KickToEntrance(Mobile from)
|
||||
{
|
||||
if(from == null || from.Map == null)
|
||||
return;
|
||||
|
||||
int x = Utility.RandomMinMax(m_Entrance.X, m_Entrance.X + m_Entrance.Width);
|
||||
int y = Utility.RandomMinMax(m_Entrance.Y, m_Entrance.Y + m_Entrance.Height);
|
||||
int z = from.Map.GetAverageZ(x, y);
|
||||
|
||||
Point3D p = new Point3D(x, y, z);
|
||||
|
||||
from.MoveToWorld(p, Map.TerMur);
|
||||
|
||||
if(from.Player && !from.Alive && from.Corpse != null)
|
||||
from.Corpse.MoveToWorld(p, Map.TerMur);
|
||||
|
||||
from.SendMessage("You have been teleported to the beginning of the maze.");
|
||||
}
|
||||
}
|
||||
}
|
||||
201
Scripts/Services/Underworld/Maze of Death/Rewards.cs
Normal file
201
Scripts/Services/Underworld/Maze of Death/Rewards.cs
Normal file
@@ -0,0 +1,201 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(5353, 5354)]
|
||||
public class MouldingBoard : Item
|
||||
{
|
||||
[Constructable]
|
||||
public MouldingBoard () : base(5353)
|
||||
{
|
||||
}
|
||||
|
||||
public MouldingBoard ( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class DoughBowl : Item
|
||||
{
|
||||
[Constructable]
|
||||
public DoughBowl () : base(4323)
|
||||
{
|
||||
}
|
||||
|
||||
public DoughBowl ( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class HornedTotemPole : Item
|
||||
{
|
||||
[Constructable]
|
||||
public HornedTotemPole () : base(12289)
|
||||
{
|
||||
}
|
||||
|
||||
public HornedTotemPole ( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeSquarePillow : Item
|
||||
{
|
||||
[Constructable]
|
||||
public LargeSquarePillow () : base(5691)
|
||||
{
|
||||
}
|
||||
|
||||
public LargeSquarePillow ( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeDiamondPillow : Item
|
||||
{
|
||||
[Constructable]
|
||||
public LargeDiamondPillow () : base(5690)
|
||||
{
|
||||
}
|
||||
|
||||
public LargeDiamondPillow ( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class DustyPillow : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1113638; } } // dusty pillow
|
||||
|
||||
[Constructable]
|
||||
public DustyPillow () : base(Utility.RandomList(5690, 5691))
|
||||
{
|
||||
}
|
||||
|
||||
public DustyPillow ( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class StatuePedestal : Item
|
||||
{
|
||||
[Constructable]
|
||||
public StatuePedestal () : base(13042)
|
||||
{
|
||||
Weight = 5;
|
||||
}
|
||||
|
||||
public StatuePedestal ( 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();
|
||||
}
|
||||
}
|
||||
|
||||
/*public class FlouredBreadBoard : Item
|
||||
{
|
||||
[Constructable]
|
||||
public FlouredBreadBoard () : base(1234)
|
||||
{
|
||||
}
|
||||
|
||||
public FlouredBreadBoard ( 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();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class RolledMapOfTheUnderworld : Item
|
||||
{
|
||||
[Constructable]
|
||||
public RolledMapOfTheUnderworld() : base(5357)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.InRange(GetWorldLocation(), 3))
|
||||
{
|
||||
from.CloseGump(typeof(InternalGump));
|
||||
from.SendGump(new InternalGump());
|
||||
}
|
||||
}
|
||||
|
||||
public RolledMapOfTheUnderworld(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 v = reader.ReadInt();
|
||||
}
|
||||
|
||||
private class InternalGump : Gump
|
||||
{
|
||||
public InternalGump()
|
||||
: base(75, 75)
|
||||
{
|
||||
AddImage(0, 0, 0x7739);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
902
Scripts/Services/Underworld/Maze of Death/UnderworldPuzzle.cs
Normal file
902
Scripts/Services/Underworld/Maze of Death/UnderworldPuzzle.cs
Normal file
@@ -0,0 +1,902 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class UnderworldPuzzleItem : BaseDecayingItem
|
||||
{
|
||||
public static readonly int MaxAttempts = 8;
|
||||
|
||||
private UnderworldPuzzleSolution m_Solution;
|
||||
private UnderworldPuzzleSolution m_CurrentSolution;
|
||||
private int m_Attempts;
|
||||
|
||||
public UnderworldPuzzleSolution Solution { get { return m_Solution; } }
|
||||
public UnderworldPuzzleSolution CurrentSolution { get { return m_CurrentSolution; } set { m_CurrentSolution = value; } }
|
||||
|
||||
public override int LabelNumber { get { return 1113379; } } // Puzzle Board
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Attempts
|
||||
{
|
||||
get { return m_Attempts; }
|
||||
set
|
||||
{
|
||||
m_Attempts = value;
|
||||
|
||||
/*if (m_Solution != null && m_Attempts >= m_Solution.MaxAttempts)
|
||||
{
|
||||
m_Solution = new UnderworldPuzzleSolution();
|
||||
m_CurrentSolution = new UnderworldPuzzleSolution(m_Solution.Index);
|
||||
m_Attempts = 0;
|
||||
|
||||
Mobile m = (Mobile)RootParent;
|
||||
if (m != null)
|
||||
m.SendMessage("You failed to complete the puzzle board.");
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public override int Lifespan { get { return 1800; } }
|
||||
|
||||
[Constructable]
|
||||
public UnderworldPuzzleItem()
|
||||
: base(0x2AAA)
|
||||
{
|
||||
Hue = 914;
|
||||
m_Attempts = 0;
|
||||
|
||||
m_Solution = new UnderworldPuzzleSolution();
|
||||
m_CurrentSolution = new UnderworldPuzzleSolution(m_Solution.Index);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
else
|
||||
{
|
||||
from.CloseGump(typeof(UnderworldPuzzleGump));
|
||||
from.SendGump(new UnderworldPuzzleGump(from, this));
|
||||
}
|
||||
}
|
||||
|
||||
public bool SubmitSolution(Mobile m, UnderworldPuzzleSolution solution)
|
||||
{
|
||||
if (solution.Matches(m_Solution))
|
||||
{
|
||||
Item item = Loot.Construct(m_Rewards[Utility.Random(m_Rewards.Length)]);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
if (item is VoidEssence || item is SilverSerpentVenom || item is ToxicVenomSac)
|
||||
item.Amount = 30;
|
||||
|
||||
if (item is LuckyCoin)
|
||||
item.Amount = Utility.RandomMinMax(2, 6);
|
||||
|
||||
if (m.Backpack == null || !m.Backpack.TryDropItem(m, item, false))
|
||||
m.BankBox.DropItem(item);
|
||||
}
|
||||
|
||||
m.PlaySound(0x3D);
|
||||
m.SendLocalizedMessage(1113579); // Correct Code Entered. Crystal Lock Disengaged.
|
||||
|
||||
Delete();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Type[] m_Rewards = new Type[]
|
||||
{
|
||||
typeof(VoidEssence), typeof(SilverSerpentVenom), typeof(ScouringToxin),
|
||||
typeof(ToxicVenomSac), typeof(MouldingBoard), typeof(DoughBowl),
|
||||
typeof(HornedTotemPole), typeof(LargeSquarePillow), typeof(LargeDiamondPillow),
|
||||
typeof(DustyPillow), typeof(StatuePedestal), /*typeof(FlouredBreadBoard),*/
|
||||
typeof(LuckyCoin),
|
||||
};
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
Mobile m = this.RootParent as Mobile;
|
||||
|
||||
if (m != null)
|
||||
m.CloseGump(typeof(UnderworldPuzzleGump));
|
||||
}
|
||||
|
||||
public UnderworldPuzzleItem(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 v = reader.ReadInt();
|
||||
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public enum PuzzlePiece
|
||||
{
|
||||
None,
|
||||
RedSingle,
|
||||
RedDouble,
|
||||
RedTriple,
|
||||
RedBar,
|
||||
BlueSingle,
|
||||
BlueDouble,
|
||||
BlueTriple,
|
||||
BlueBar,
|
||||
GreenSingle,
|
||||
GreenDouble,
|
||||
GreenTriple,
|
||||
GreenBar
|
||||
}
|
||||
|
||||
public enum PuzzleColor
|
||||
{
|
||||
Red,
|
||||
Blue,
|
||||
Green
|
||||
}
|
||||
|
||||
public class UnderworldPuzzleSolution
|
||||
{
|
||||
public const int Length = 4;
|
||||
|
||||
private PuzzlePiece[] m_Rows = new PuzzlePiece[Length];
|
||||
public PuzzlePiece[] Rows { get { return m_Rows; } }
|
||||
|
||||
private int m_Index;
|
||||
private int m_MaxAttempts;
|
||||
|
||||
public int Index { get { return m_Index; } }
|
||||
public int MaxAttempts { get { return m_MaxAttempts; } }
|
||||
|
||||
public PuzzlePiece First { get { return m_Rows[0]; } set { m_Rows[0] = value; } }
|
||||
public PuzzlePiece Second { get { return m_Rows[1]; } set { m_Rows[1] = value; } }
|
||||
public PuzzlePiece Third { get { return m_Rows[2]; } set { m_Rows[2] = value; } }
|
||||
public PuzzlePiece Fourth { get { return m_Rows[3]; } set { m_Rows[3] = value; } }
|
||||
|
||||
public UnderworldPuzzleSolution()
|
||||
{
|
||||
PickRandom();
|
||||
}
|
||||
|
||||
public UnderworldPuzzleSolution(int index)
|
||||
{
|
||||
LoadStartSolution(index);
|
||||
}
|
||||
|
||||
public UnderworldPuzzleSolution(PuzzlePiece first, PuzzlePiece second, PuzzlePiece third, PuzzlePiece fourth)
|
||||
{
|
||||
First = first;
|
||||
Second = second;
|
||||
Third = third;
|
||||
Fourth = fourth;
|
||||
}
|
||||
|
||||
public bool Matches(UnderworldPuzzleSolution check)
|
||||
{
|
||||
return GetMatches(check) >= 4;
|
||||
}
|
||||
|
||||
public int GetMatches(UnderworldPuzzleSolution check)
|
||||
{
|
||||
int matches = 0;
|
||||
|
||||
for (int i = 0; i < m_Rows.Length; i++)
|
||||
{
|
||||
if (m_Rows[i] == check.Rows[i])
|
||||
matches++;
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
||||
public void PickRandom()
|
||||
{
|
||||
m_Index = Utility.Random(16);
|
||||
switch (m_Index)
|
||||
{
|
||||
case 0: //Good To Go
|
||||
First = PuzzlePiece.RedSingle;
|
||||
Second = PuzzlePiece.BlueSingle;
|
||||
Third = PuzzlePiece.RedSingle;
|
||||
Fourth = PuzzlePiece.GreenSingle;
|
||||
m_MaxAttempts = 6;
|
||||
break;
|
||||
case 1: //Good To Go
|
||||
First = PuzzlePiece.GreenDouble;
|
||||
Second = PuzzlePiece.RedBar;
|
||||
Third = PuzzlePiece.None;
|
||||
Fourth = PuzzlePiece.BlueTriple;
|
||||
m_MaxAttempts = 6;
|
||||
break;
|
||||
case 2: //Good To Go
|
||||
First = PuzzlePiece.None;
|
||||
Second = PuzzlePiece.None;
|
||||
Third = PuzzlePiece.RedBar;
|
||||
Fourth = PuzzlePiece.RedTriple;
|
||||
m_MaxAttempts = 4;
|
||||
break;
|
||||
case 3: //Good To Go
|
||||
First = PuzzlePiece.BlueDouble;
|
||||
Second = PuzzlePiece.None;
|
||||
Third = PuzzlePiece.GreenDouble;
|
||||
Fourth = PuzzlePiece.GreenDouble;
|
||||
m_MaxAttempts = 7;
|
||||
break;
|
||||
case 4: //Good To Go
|
||||
First = PuzzlePiece.BlueSingle;
|
||||
Second = PuzzlePiece.GreenSingle;
|
||||
Third = PuzzlePiece.GreenDouble;
|
||||
Fourth = PuzzlePiece.RedBar;
|
||||
m_MaxAttempts = 7;
|
||||
break;
|
||||
case 5: //Good To Go
|
||||
First = PuzzlePiece.GreenDouble;
|
||||
Second = PuzzlePiece.BlueBar;
|
||||
Third = PuzzlePiece.RedSingle;
|
||||
Fourth = PuzzlePiece.BlueSingle;
|
||||
m_MaxAttempts = 8;
|
||||
break;
|
||||
case 6: //Good To Go
|
||||
First = PuzzlePiece.GreenSingle;
|
||||
Second = PuzzlePiece.RedSingle;
|
||||
Third = PuzzlePiece.BlueDouble;
|
||||
Fourth = PuzzlePiece.GreenBar;
|
||||
m_MaxAttempts = 5;
|
||||
break;
|
||||
case 7: //Good To Go
|
||||
First = PuzzlePiece.BlueDouble;
|
||||
Second = PuzzlePiece.None;
|
||||
Third = PuzzlePiece.BlueTriple;
|
||||
Fourth = PuzzlePiece.None;
|
||||
m_MaxAttempts = 4;
|
||||
break;
|
||||
case 8: //Good To Go
|
||||
First = PuzzlePiece.GreenSingle;
|
||||
Second = PuzzlePiece.GreenBar;
|
||||
Third = PuzzlePiece.RedDouble;
|
||||
Fourth = PuzzlePiece.RedSingle;
|
||||
m_MaxAttempts = 7;
|
||||
break;
|
||||
case 9: //Good to Go
|
||||
First = PuzzlePiece.BlueSingle;
|
||||
Second = PuzzlePiece.GreenDouble;
|
||||
Third = PuzzlePiece.None;
|
||||
Fourth = PuzzlePiece.GreenTriple;
|
||||
m_MaxAttempts = 6;
|
||||
break;
|
||||
case 10: //Good To Go
|
||||
First = PuzzlePiece.BlueSingle;
|
||||
Second = PuzzlePiece.RedSingle;
|
||||
Third = PuzzlePiece.RedTriple;
|
||||
Fourth = PuzzlePiece.None;
|
||||
m_MaxAttempts = 6;
|
||||
break;
|
||||
case 11: //Good To Go
|
||||
First = PuzzlePiece.GreenSingle;
|
||||
Second = PuzzlePiece.None;
|
||||
Third = PuzzlePiece.GreenTriple;
|
||||
Fourth = PuzzlePiece.GreenDouble;
|
||||
m_MaxAttempts = 5;
|
||||
break;
|
||||
case 12: //Good to Go
|
||||
First = PuzzlePiece.RedTriple;
|
||||
Second = PuzzlePiece.None;
|
||||
Third = PuzzlePiece.None;
|
||||
Fourth = PuzzlePiece.RedTriple;
|
||||
m_MaxAttempts = 6;
|
||||
break;
|
||||
case 13: //Good To Go
|
||||
First = PuzzlePiece.None;
|
||||
Second = PuzzlePiece.BlueTriple;
|
||||
Third = PuzzlePiece.GreenSingle;
|
||||
Fourth = PuzzlePiece.BlueDouble;
|
||||
m_MaxAttempts = 7;
|
||||
break;
|
||||
case 14: //Good To Go
|
||||
First = PuzzlePiece.BlueTriple;
|
||||
Second = PuzzlePiece.None;
|
||||
Third = PuzzlePiece.BlueTriple;
|
||||
Fourth = PuzzlePiece.None;
|
||||
m_MaxAttempts = 6;
|
||||
break;
|
||||
case 15: //Good to Go
|
||||
First = PuzzlePiece.RedSingle;
|
||||
Second = PuzzlePiece.BlueDouble;
|
||||
Third = PuzzlePiece.RedDouble;
|
||||
Fourth = PuzzlePiece.GreenSingle;
|
||||
m_MaxAttempts = 6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadStartSolution(int index)
|
||||
{
|
||||
m_Index = index;
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
First = PuzzlePiece.RedSingle;
|
||||
Second = PuzzlePiece.RedSingle;
|
||||
Third = PuzzlePiece.RedSingle;
|
||||
Fourth = PuzzlePiece.RedSingle;
|
||||
break;
|
||||
case 1:
|
||||
First = PuzzlePiece.BlueBar;
|
||||
Second = PuzzlePiece.RedDouble;
|
||||
Third = PuzzlePiece.RedBar;
|
||||
Fourth = PuzzlePiece.BlueSingle;
|
||||
break;
|
||||
case 2:
|
||||
First = PuzzlePiece.GreenBar;
|
||||
Second = PuzzlePiece.BlueDouble;
|
||||
Third = PuzzlePiece.RedTriple;
|
||||
Fourth = PuzzlePiece.RedBar;
|
||||
break;
|
||||
case 3:
|
||||
First = PuzzlePiece.RedSingle;
|
||||
Second = PuzzlePiece.GreenDouble;
|
||||
Third = PuzzlePiece.BlueTriple;
|
||||
Fourth = PuzzlePiece.RedBar;
|
||||
break;
|
||||
case 4:
|
||||
First = PuzzlePiece.GreenSingle;
|
||||
Second = PuzzlePiece.RedBar;
|
||||
Third = PuzzlePiece.RedDouble;
|
||||
Fourth = PuzzlePiece.GreenSingle;
|
||||
break;
|
||||
case 5:
|
||||
First = PuzzlePiece.RedBar;
|
||||
Second = PuzzlePiece.GreenBar;
|
||||
Third = PuzzlePiece.RedBar;
|
||||
Fourth = PuzzlePiece.BlueBar;
|
||||
break;
|
||||
case 6:
|
||||
First = PuzzlePiece.RedBar;
|
||||
Second = PuzzlePiece.GreenDouble;
|
||||
Third = PuzzlePiece.GreenDouble;
|
||||
Fourth = PuzzlePiece.RedBar;
|
||||
break;
|
||||
case 7:
|
||||
First = PuzzlePiece.GreenBar;
|
||||
Second = PuzzlePiece.BlueSingle;
|
||||
Third = PuzzlePiece.BlueTriple;
|
||||
Fourth = PuzzlePiece.RedSingle;
|
||||
break;
|
||||
case 8:
|
||||
First = PuzzlePiece.GreenBar;
|
||||
Second = PuzzlePiece.None;
|
||||
Third = PuzzlePiece.GreenTriple;
|
||||
Fourth = PuzzlePiece.GreenSingle;
|
||||
break;
|
||||
case 9:
|
||||
First = PuzzlePiece.RedBar;
|
||||
Second = PuzzlePiece.RedBar;
|
||||
Third = PuzzlePiece.RedBar;
|
||||
Fourth = PuzzlePiece.RedBar;
|
||||
break;
|
||||
case 10:
|
||||
First = PuzzlePiece.RedSingle;
|
||||
Second = PuzzlePiece.None;
|
||||
Third = PuzzlePiece.BlueDouble;
|
||||
Fourth = PuzzlePiece.RedBar;
|
||||
break;
|
||||
case 11:
|
||||
First = PuzzlePiece.RedDouble;
|
||||
Second = PuzzlePiece.GreenDouble;
|
||||
Third = PuzzlePiece.RedDouble;
|
||||
Fourth = PuzzlePiece.BlueDouble;
|
||||
break;
|
||||
case 12:
|
||||
First = PuzzlePiece.GreenTriple;
|
||||
Second = PuzzlePiece.BlueBar;
|
||||
Third = PuzzlePiece.GreenTriple;
|
||||
Fourth = PuzzlePiece.RedBar;
|
||||
break;
|
||||
case 13:
|
||||
First = PuzzlePiece.RedSingle;
|
||||
Second = PuzzlePiece.GreenBar;
|
||||
Third = PuzzlePiece.GreenBar;
|
||||
Fourth = PuzzlePiece.RedSingle;
|
||||
break;
|
||||
case 14:
|
||||
First = PuzzlePiece.GreenTriple;
|
||||
Second = PuzzlePiece.GreenBar;
|
||||
Third = PuzzlePiece.BlueBar;
|
||||
Fourth = PuzzlePiece.GreenSingle;
|
||||
break;
|
||||
case 15:
|
||||
First = PuzzlePiece.BlueTriple;
|
||||
Second = PuzzlePiece.GreenDouble;
|
||||
Third = PuzzlePiece.BlueSingle;
|
||||
Fourth = PuzzlePiece.RedDouble;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class UnderworldPuzzleGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private UnderworldPuzzleItem m_Item;
|
||||
private UnderworldPuzzleSolution m_Solution;
|
||||
private UnderworldPuzzleSolution m_CurrentSolution;
|
||||
private int m_Row;
|
||||
|
||||
public UnderworldPuzzleGump(Mobile from, UnderworldPuzzleItem item)
|
||||
: this(from, item, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public UnderworldPuzzleGump(Mobile from, UnderworldPuzzleItem item, int row)
|
||||
: base(45, 45)
|
||||
{
|
||||
if (row > 3) row = 3;
|
||||
if (row < 0) row = 0;
|
||||
|
||||
m_From = from;
|
||||
m_Item = item;
|
||||
m_Row = row;
|
||||
|
||||
m_Solution = item.Solution;
|
||||
m_CurrentSolution = item.CurrentSolution;
|
||||
|
||||
AddBackground(50, 50, 500, 200, 9250);
|
||||
|
||||
AddImageTiled(85, 210, 17, 150, 9255);
|
||||
AddImageTiled(110, 63, 17, 150, 9255);
|
||||
|
||||
AddImageTiled(140, 90, 250, 17, 9251);
|
||||
AddImageTiled(60, 125, 350, 17, 9251);
|
||||
AddImageTiled(140, 160, 250, 17, 9251);
|
||||
AddImageTiled(60, 195, 350, 17, 9251);
|
||||
|
||||
AddBackground(70, 70, 90, 155, 9250);
|
||||
AddBackground(200, 70, 140, 155, 9250);
|
||||
AddBackground(390, 70, 140, 155, 9250);
|
||||
|
||||
AddBackground(50, 280, 200, 120, 9250);
|
||||
|
||||
AddImage(0, 0, 10400);
|
||||
AddImage(0, 170, 10401);
|
||||
AddImage(0, 350, 10402);
|
||||
|
||||
AddButton(105, 87, row == 0 ? 208 : 209, row == 0 ? 209 : 208, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(105, 122, row == 1 ? 208 : 209, row == 0 ? 209 : 208, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(105, 157, row == 2 ? 208 : 209, row == 0 ? 209 : 208, 3, GumpButtonType.Reply, 0);
|
||||
AddButton(105, 192, row == 3 ? 208 : 209, row == 0 ? 209 : 208, 4, GumpButtonType.Reply, 0);
|
||||
|
||||
AddPiece(0, true, m_Solution.First);
|
||||
AddPiece(1, true, m_Solution.Second);
|
||||
AddPiece(2, true, m_Solution.Third);
|
||||
AddPiece(3, true, m_Solution.Fourth);
|
||||
|
||||
AddPiece(0, false, m_CurrentSolution.First);
|
||||
AddPiece(1, false, m_CurrentSolution.Second);
|
||||
AddPiece(2, false, m_CurrentSolution.Third);
|
||||
AddPiece(3, false, m_CurrentSolution.Fourth);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (i == row && m_CurrentSolution.Rows[i] != PuzzlePiece.None && m_Item.Attempts < m_Solution.MaxAttempts)
|
||||
{
|
||||
AddButton(85, 87 + (i * 35), 2650, 2650, 5, GumpButtonType.Reply, 0); //Up
|
||||
AddButton(125, 87 + (i * 35), 2648, 2648, 6, GumpButtonType.Reply, 0); //Down
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage(85, 87 + (i * 35), 2709);
|
||||
AddImage(125, 87 + (i * 35), 2709);
|
||||
}
|
||||
}
|
||||
|
||||
AddButton(85, 87 + (row * 35), 2650, 2650, 5, GumpButtonType.Reply, 0); //Up
|
||||
AddButton(125, 87 + (row * 35), 2648, 2648, 6, GumpButtonType.Reply, 0); //Down
|
||||
|
||||
AddHtmlLocalized(65, 295, 130, 16, 1150180, false, false); // Command Functions:
|
||||
AddLabel(200, 295, 0, String.Format("{0}/{1}", m_Item.Attempts, m_Solution.MaxAttempts));
|
||||
|
||||
if(from.Skills[SkillName.Lockpicking].Base >= 100.0)
|
||||
{
|
||||
int locked = m_Solution.GetMatches(m_CurrentSolution);
|
||||
AddHtmlLocalized(65, 310, 120, 16, 1150179, false, false); // Crystals Locked :
|
||||
AddLabel(190, 310, 0, locked.ToString());
|
||||
}
|
||||
|
||||
AddButton(80, 335, 2124, 2123, 7, GumpButtonType.Reply, 0); // Okay
|
||||
AddButton(160, 335, 2073, 2072, 8, GumpButtonType.Reply, 0); // Cancel
|
||||
AddButton(120, 360, 2011, 2010, 0, GumpButtonType.Reply, 0); // Logout
|
||||
}
|
||||
|
||||
private void AddPiece(int row, bool right, PuzzlePiece piece)
|
||||
{
|
||||
int id = GetPuzzlePieceID(piece);
|
||||
int x = right ? 405 : 215;
|
||||
int y = 82 + (35 * row );
|
||||
|
||||
switch(piece)
|
||||
{
|
||||
case PuzzlePiece.None:
|
||||
break;
|
||||
case PuzzlePiece.RedSingle:
|
||||
case PuzzlePiece.BlueSingle:
|
||||
case PuzzlePiece.GreenSingle:
|
||||
AddImage(x + 40, y, id);
|
||||
break;
|
||||
case PuzzlePiece.RedDouble:
|
||||
case PuzzlePiece.BlueDouble:
|
||||
case PuzzlePiece.GreenDouble:
|
||||
AddImage(x, y, id);
|
||||
AddImage(x + 80, y, id);
|
||||
break;
|
||||
case PuzzlePiece.RedTriple:
|
||||
case PuzzlePiece.BlueTriple:
|
||||
case PuzzlePiece.GreenTriple:
|
||||
AddImage(x, y, id);
|
||||
AddImage(x + 40, y, id);
|
||||
AddImage(x + 80, y, id);
|
||||
break;
|
||||
case PuzzlePiece.RedBar:
|
||||
case PuzzlePiece.BlueBar:
|
||||
case PuzzlePiece.GreenBar:
|
||||
AddImage(x, y, id);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Item.Deleted || info.ButtonID == 0 || !m_From.CheckAlive())
|
||||
return;
|
||||
|
||||
if (m_From.AccessLevel == AccessLevel.Player && !m_Item.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500446); // That is too far away.
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: break;
|
||||
default:
|
||||
{
|
||||
m_Row = info.ButtonID - 1;
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
int nextRow = m_Row - 1;
|
||||
if (nextRow < 0) nextRow = 3;
|
||||
|
||||
PuzzlePiece movingPiece = m_CurrentSolution.Rows[m_Row];
|
||||
PuzzlePiece movingToPiece = m_CurrentSolution.Rows[nextRow];
|
||||
|
||||
//Can't move empty spaces
|
||||
if (movingPiece == PuzzlePiece.None || m_Item.Attempts >= m_Solution.MaxAttempts)
|
||||
break;
|
||||
|
||||
SplitPiecesUp(ref movingPiece, ref movingToPiece);
|
||||
|
||||
if (movingPiece != m_CurrentSolution.Rows[m_Row] || movingToPiece != m_CurrentSolution.Rows[nextRow])
|
||||
{
|
||||
m_CurrentSolution.Rows[m_Row] = movingPiece;
|
||||
m_CurrentSolution.Rows[nextRow] = movingToPiece;
|
||||
|
||||
m_Item.CurrentSolution = m_CurrentSolution;
|
||||
m_Item.Attempts++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
int nextRow = m_Row + 1;
|
||||
if (nextRow > 3) nextRow = 0;
|
||||
|
||||
PuzzlePiece movingPiece = m_CurrentSolution.Rows[m_Row];
|
||||
PuzzlePiece movingToPiece = m_CurrentSolution.Rows[nextRow];
|
||||
|
||||
//Can't Move Empty Spaces
|
||||
if (movingPiece == PuzzlePiece.None || m_Item.Attempts >= m_Solution.MaxAttempts)
|
||||
break;
|
||||
|
||||
SplitPiecesDown(ref movingPiece, ref movingToPiece);
|
||||
|
||||
if (movingPiece != m_CurrentSolution.Rows[m_Row] || movingToPiece != m_CurrentSolution.Rows[nextRow])
|
||||
{
|
||||
m_CurrentSolution.Rows[m_Row] = movingPiece;
|
||||
m_CurrentSolution.Rows[nextRow] = movingToPiece;
|
||||
|
||||
m_Item.Attempts++;
|
||||
|
||||
m_Item.CurrentSolution = m_CurrentSolution;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
if (m_Item.SubmitSolution(m_From, m_CurrentSolution))
|
||||
return;
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
int index = m_Item.Solution.Index;
|
||||
m_Item.CurrentSolution = new UnderworldPuzzleSolution(index);
|
||||
m_Item.Attempts = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_From.SendGump(new UnderworldPuzzleGump(m_From, m_Item, m_Row));
|
||||
}
|
||||
|
||||
private int GetTotalPieces(PuzzlePiece piece)
|
||||
{
|
||||
switch(piece)
|
||||
{
|
||||
default:
|
||||
return 0;
|
||||
case PuzzlePiece.RedSingle: case PuzzlePiece.BlueSingle: case PuzzlePiece.GreenSingle: return 1;
|
||||
case PuzzlePiece.RedDouble: case PuzzlePiece.BlueDouble: case PuzzlePiece.GreenDouble: return 2;
|
||||
case PuzzlePiece.RedTriple: case PuzzlePiece.BlueTriple: case PuzzlePiece.GreenTriple: return 3;
|
||||
case PuzzlePiece.RedBar: case PuzzlePiece.BlueBar: case PuzzlePiece.GreenBar: return 4;
|
||||
}
|
||||
}
|
||||
|
||||
private void SplitPiecesUp(ref PuzzlePiece movingPiece, ref PuzzlePiece movingToPiece)
|
||||
{
|
||||
int movingAmount = GetTotalPieces(movingPiece);
|
||||
int moveToAmount = GetTotalPieces(movingToPiece);
|
||||
|
||||
if (movingToPiece == PuzzlePiece.None)
|
||||
{
|
||||
if ((movingAmount == 2 || movingAmount == 4))
|
||||
{
|
||||
switch (movingPiece)
|
||||
{
|
||||
case PuzzlePiece.RedDouble:
|
||||
movingToPiece = PuzzlePiece.BlueSingle;
|
||||
movingPiece = PuzzlePiece.GreenSingle;
|
||||
break;
|
||||
case PuzzlePiece.BlueDouble:
|
||||
movingToPiece = PuzzlePiece.GreenSingle;
|
||||
movingPiece = PuzzlePiece.RedSingle;
|
||||
break;
|
||||
case PuzzlePiece.GreenDouble:
|
||||
movingToPiece = PuzzlePiece.RedSingle;
|
||||
movingPiece = PuzzlePiece.BlueSingle;
|
||||
break;
|
||||
case PuzzlePiece.RedBar:
|
||||
movingToPiece = PuzzlePiece.BlueDouble;
|
||||
movingPiece = PuzzlePiece.GreenDouble;
|
||||
break;
|
||||
case PuzzlePiece.BlueBar:
|
||||
movingToPiece = PuzzlePiece.GreenDouble;
|
||||
movingPiece = PuzzlePiece.RedDouble;
|
||||
break;
|
||||
case PuzzlePiece.GreenBar:
|
||||
movingToPiece = PuzzlePiece.RedDouble;
|
||||
movingPiece = PuzzlePiece.BlueDouble;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(movingAmount + moveToAmount > 4)
|
||||
{
|
||||
PuzzlePiece movingTemp = movingPiece;
|
||||
PuzzlePiece movingToTemp = movingToPiece;
|
||||
|
||||
movingPiece = movingToTemp;
|
||||
movingToPiece = movingTemp;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
movingToPiece = CombinePieces(movingPiece, movingToPiece);
|
||||
movingPiece = PuzzlePiece.None;
|
||||
}
|
||||
|
||||
private void SplitPiecesDown(ref PuzzlePiece movingPiece, ref PuzzlePiece movingToPiece)
|
||||
{
|
||||
int movingAmount = GetTotalPieces(movingPiece);
|
||||
int moveToAmount = GetTotalPieces(movingToPiece);
|
||||
|
||||
if (movingToPiece == PuzzlePiece.None)
|
||||
{
|
||||
if ((movingAmount == 2 || movingAmount == 4))
|
||||
{
|
||||
switch (movingPiece)
|
||||
{
|
||||
case PuzzlePiece.RedDouble:
|
||||
movingToPiece = PuzzlePiece.BlueSingle;
|
||||
movingPiece = PuzzlePiece.GreenSingle;
|
||||
break;
|
||||
case PuzzlePiece.BlueDouble:
|
||||
movingToPiece = PuzzlePiece.GreenSingle;
|
||||
movingPiece = PuzzlePiece.RedSingle;
|
||||
break;
|
||||
case PuzzlePiece.GreenDouble:
|
||||
movingToPiece = PuzzlePiece.RedSingle;
|
||||
movingPiece = PuzzlePiece.BlueSingle;
|
||||
break;
|
||||
case PuzzlePiece.RedBar:
|
||||
movingToPiece = PuzzlePiece.BlueDouble;
|
||||
movingPiece = PuzzlePiece.GreenDouble;
|
||||
break;
|
||||
case PuzzlePiece.BlueBar:
|
||||
movingToPiece = PuzzlePiece.GreenDouble;
|
||||
movingPiece = PuzzlePiece.RedDouble;
|
||||
break;
|
||||
case PuzzlePiece.GreenBar:
|
||||
movingToPiece = PuzzlePiece.RedDouble;
|
||||
movingPiece = PuzzlePiece.BlueDouble;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int t = 0;
|
||||
//PuzzlePiece greater = movingPiece;
|
||||
|
||||
if (moveToAmount > movingAmount)
|
||||
{
|
||||
//greater = movingToPiece;
|
||||
t = (int)movingToPiece - movingAmount;
|
||||
}
|
||||
else if (movingAmount > moveToAmount)
|
||||
{
|
||||
//greater = movingPiece;
|
||||
//t = (int)movingToPiece + (movingAmount - moveToAmount);
|
||||
//t -= 1;
|
||||
if (movingAmount == 4 && moveToAmount == 3)
|
||||
t = (int)movingToPiece - 2;
|
||||
else if (movingAmount == 4 && moveToAmount == 2)
|
||||
t = (int)movingToPiece;
|
||||
else if (movingAmount == 4 && moveToAmount == 1)
|
||||
t = (int)movingToPiece + 2;
|
||||
|
||||
else if (movingAmount == 2 && moveToAmount == 1)
|
||||
t = (int)movingToPiece;
|
||||
else if (movingAmount == 3 && moveToAmount == 2)
|
||||
t = (int)movingToPiece - 1;
|
||||
else if (movingAmount == 3 && moveToAmount == 1)
|
||||
t = (int)movingToPiece + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
movingPiece = PuzzlePiece.None;
|
||||
movingToPiece = PuzzlePiece.None;
|
||||
return;
|
||||
}
|
||||
|
||||
movingToPiece = (PuzzlePiece)t;
|
||||
movingPiece = PuzzlePiece.None;
|
||||
}
|
||||
|
||||
private PuzzlePiece CombinePieces(PuzzlePiece moving, PuzzlePiece movingInto)
|
||||
{
|
||||
int movingAmount = GetTotalPieces(moving);
|
||||
int moveToAmount = GetTotalPieces(movingInto);
|
||||
int combined = movingAmount + moveToAmount;
|
||||
|
||||
if (movingAmount != moveToAmount)
|
||||
{
|
||||
int t = (int)movingInto + movingAmount; //combined + (int)moving;
|
||||
return (PuzzlePiece)t;
|
||||
}
|
||||
|
||||
combined--;
|
||||
|
||||
PuzzleColor movingCol = GetColor(moving);
|
||||
PuzzleColor movingIntoCol = GetColor(movingInto);
|
||||
|
||||
switch (movingCol)
|
||||
{
|
||||
case PuzzleColor.Red:
|
||||
switch (movingIntoCol)
|
||||
{
|
||||
case PuzzleColor.Red:
|
||||
return PuzzlePiece.RedSingle + combined;
|
||||
case PuzzleColor.Blue:
|
||||
return PuzzlePiece.GreenSingle + combined;
|
||||
case PuzzleColor.Green:
|
||||
return PuzzlePiece.BlueSingle + combined;
|
||||
}
|
||||
break;
|
||||
case PuzzleColor.Blue:
|
||||
switch (movingIntoCol)
|
||||
{
|
||||
case PuzzleColor.Red:
|
||||
return PuzzlePiece.GreenSingle + combined;
|
||||
case PuzzleColor.Blue:
|
||||
return PuzzlePiece.BlueSingle + combined;
|
||||
case PuzzleColor.Green:
|
||||
return PuzzlePiece.RedSingle + combined;
|
||||
}
|
||||
break;
|
||||
case PuzzleColor.Green:
|
||||
switch (movingIntoCol)
|
||||
{
|
||||
case PuzzleColor.Red:
|
||||
return PuzzlePiece.BlueSingle + combined;
|
||||
case PuzzleColor.Blue:
|
||||
return PuzzlePiece.RedSingle + combined;
|
||||
case PuzzleColor.Green:
|
||||
return PuzzlePiece.GreenSingle + combined;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return moving;
|
||||
}
|
||||
|
||||
private PuzzleColor GetColor(PuzzlePiece piece)
|
||||
{
|
||||
switch (piece)
|
||||
{
|
||||
default:
|
||||
case PuzzlePiece.RedSingle:
|
||||
case PuzzlePiece.RedDouble:
|
||||
case PuzzlePiece.RedTriple:
|
||||
case PuzzlePiece.RedBar:
|
||||
return PuzzleColor.Red;
|
||||
case PuzzlePiece.BlueSingle:
|
||||
case PuzzlePiece.BlueDouble:
|
||||
case PuzzlePiece.BlueTriple:
|
||||
case PuzzlePiece.BlueBar:
|
||||
return PuzzleColor.Blue;
|
||||
case PuzzlePiece.GreenSingle:
|
||||
case PuzzlePiece.GreenDouble:
|
||||
case PuzzlePiece.GreenTriple:
|
||||
case PuzzlePiece.GreenBar:
|
||||
return PuzzleColor.Green;
|
||||
}
|
||||
}
|
||||
|
||||
private int GetPuzzlePieceID(PuzzlePiece piece)
|
||||
{
|
||||
switch (piece)
|
||||
{
|
||||
default:
|
||||
case PuzzlePiece.None: return 0x0;
|
||||
case PuzzlePiece.RedSingle:
|
||||
case PuzzlePiece.RedDouble:
|
||||
case PuzzlePiece.RedTriple: return 0x2A62;
|
||||
case PuzzlePiece.BlueSingle:
|
||||
case PuzzlePiece.BlueDouble:
|
||||
case PuzzlePiece.BlueTriple: return 0x2A3A;
|
||||
case PuzzlePiece.GreenSingle:
|
||||
case PuzzlePiece.GreenDouble:
|
||||
case PuzzlePiece.GreenTriple: return 0x2A4E;
|
||||
case PuzzlePiece.RedBar: return 0x2A58;
|
||||
case PuzzlePiece.BlueBar: return 0x2A30;
|
||||
case PuzzlePiece.GreenBar: return 0x2A44;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using Server;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class UnderworldPuzzleBox : MetalChest
|
||||
{
|
||||
private static Dictionary<Mobile, DateTime> m_Table = new Dictionary<Mobile, DateTime>();
|
||||
|
||||
[Constructable]
|
||||
public UnderworldPuzzleBox()
|
||||
{
|
||||
Movable = false;
|
||||
ItemID = 3712;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.InRange(this.Location, 3))
|
||||
{
|
||||
if (from.AccessLevel == AccessLevel.Player && IsInCooldown(from))
|
||||
from.SendLocalizedMessage(1113413); // You have recently participated in this challenge. You must wait 24 hours to try again.
|
||||
else if (from.Backpack != null)
|
||||
{
|
||||
Item item = from.Backpack.FindItemByType(typeof(UnderworldPuzzleItem));
|
||||
|
||||
if (item != null)
|
||||
from.SendMessage("You already have a puzzle board.");
|
||||
else
|
||||
{
|
||||
from.AddToBackpack(new UnderworldPuzzleItem());
|
||||
from.SendMessage("You recieve a puzzle piece.");
|
||||
|
||||
if (from.AccessLevel == AccessLevel.Player)
|
||||
m_Table[from] = DateTime.UtcNow + TimeSpan.FromHours(24);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsInCooldown(Mobile from)
|
||||
{
|
||||
if(m_Table.ContainsKey(from))
|
||||
{
|
||||
if(m_Table[from] < DateTime.UtcNow)
|
||||
m_Table.Remove(from);
|
||||
}
|
||||
|
||||
return m_Table.ContainsKey(from);
|
||||
}
|
||||
|
||||
public UnderworldPuzzleBox(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 v = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user