Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
using Server;
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
||||
public class ExperimentalBook : BrownBook
|
||||
{
|
||||
public override int LabelNumber { get { return 1113479; } } //
|
||||
|
||||
[Constructable]
|
||||
public ExperimentalBook() : base(false)
|
||||
{
|
||||
ItemID = 4030;
|
||||
}
|
||||
|
||||
public static readonly BookContent Content = new BookContent(
|
||||
"Read Me!", "Sir Wilber",
|
||||
new BookPageInfo(
|
||||
"Hello again!",
|
||||
"This is Part II of my",
|
||||
"experiment. Beyond these",
|
||||
"doors is a challenge for",
|
||||
"those carrying an ",
|
||||
"Experimental Gem."),
|
||||
new BookPageInfo(
|
||||
"INSTRUCTIONS:",
|
||||
"Activate the Gem to start",
|
||||
"the self-destruct timer.",
|
||||
"You have 30 minutes to",
|
||||
"reach the final room."),
|
||||
new BookPageInfo(
|
||||
"Each room has colored",
|
||||
"areas matching various states:",
|
||||
"White = Cold",
|
||||
"Pink = Warm",
|
||||
"Blue = Freezing",
|
||||
"Red = Blazing"),
|
||||
new BookPageInfo(
|
||||
"Green = Poison",
|
||||
"Orange = Cure",
|
||||
"Dark Green= Lethal",
|
||||
"Brown=Greater Cure",
|
||||
"Your gem's state will cycle",
|
||||
"randomly through these"),
|
||||
new BookPageInfo(
|
||||
"colors. Each time the gem",
|
||||
"shifts, you must enter the",
|
||||
"colored region that will",
|
||||
"bring your gem back to neutral",
|
||||
"state (grey). "),
|
||||
new BookPageInfo(
|
||||
"Failing when the gem reaches",
|
||||
"the extreme of any state get you",
|
||||
"expelled from the room and you",
|
||||
"will have to start over. The",
|
||||
"self-destruct"),
|
||||
new BookPageInfo(
|
||||
"timer will not reset. Once you",
|
||||
"reach the final room, place your",
|
||||
"gem in the box to receive",
|
||||
"your reward."));
|
||||
|
||||
public override BookContent DefaultContent { get { return Content; } }
|
||||
|
||||
public ExperimentalBook(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
721
Scripts/Services/Underworld/ExperimentalRoom/ExperimentalGem.cs
Normal file
721
Scripts/Services/Underworld/ExperimentalRoom/ExperimentalGem.cs
Normal file
@@ -0,0 +1,721 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum Room
|
||||
{
|
||||
RoomZero = 0,
|
||||
RoomOne = 1,
|
||||
RoomTwo = 2,
|
||||
RoomThree = 3,
|
||||
RoomFour = 4
|
||||
}
|
||||
|
||||
public class ExperimentalGem : BaseDecayingItem
|
||||
{
|
||||
private static readonly int Neutral = 0x356;
|
||||
private static readonly int Red = 0x26;
|
||||
private static readonly int White = 0x481;
|
||||
private static readonly int Blue = 0x4;
|
||||
private static readonly int Pink = 0x4B2;
|
||||
private static readonly int Orange = 0x30;
|
||||
private static readonly int LightGreen = 0x3D;
|
||||
private static readonly int DarkGreen = 0x557;
|
||||
private static readonly int Brown = 0x747;
|
||||
|
||||
private static readonly TimeSpan HueToHueDelay = TimeSpan.FromSeconds(4);
|
||||
private static readonly TimeSpan HueToLocDelay = TimeSpan.FromSeconds(4);
|
||||
private static readonly TimeSpan RoomToRoomDelay = TimeSpan.FromSeconds(20);
|
||||
|
||||
private static readonly Rectangle2D m_Entrance = new Rectangle2D(980, 1117, 17, 3);
|
||||
|
||||
private bool m_Active;
|
||||
private bool m_IsExtremeHue;
|
||||
private bool m_Complete;
|
||||
private Room m_CurrentRoom;
|
||||
private double m_Completed;
|
||||
private double m_ToComplete;
|
||||
private int m_LastIndex;
|
||||
private int m_CurrentHue;
|
||||
private int m_Span;
|
||||
private Timer m_Timer;
|
||||
private DateTime m_Expire;
|
||||
private Mobile m_Owner;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Active { get { return m_Active; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsExtremeHue { get { return m_IsExtremeHue; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Complete { get { return m_Complete; } set { m_Complete = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Room CurrentRoom { get { return m_CurrentRoom; } set { m_CurrentRoom = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public double Completed { get { return m_Completed; } set { m_Completed = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public double ToComplete { get { return m_ToComplete; } set { m_ToComplete = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int CurrentHue { get { return m_CurrentHue; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int LastIndex { get { return m_LastIndex; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Owner { get { return m_Owner; } set { m_Owner = value; } }
|
||||
|
||||
public override int Lifespan { get { return m_Span; } }
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Active)
|
||||
return 1113409; // An Experimental Gem [Activated]
|
||||
return 1113380; //An Experimental Gem
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ExperimentalGem() : base(6463)
|
||||
{
|
||||
m_LastIndex = -1;
|
||||
m_IsExtremeHue = false;
|
||||
m_CurrentHue = Neutral;
|
||||
m_CurrentRoom = Room.RoomZero;
|
||||
m_Active = false;
|
||||
m_Expire = DateTime.MaxValue;
|
||||
m_Span = 0;
|
||||
m_Completed = 0;
|
||||
m_ToComplete = 0;
|
||||
|
||||
Hue = Neutral;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
from.SendLocalizedMessage(1054107); // This item must be in your backpack.
|
||||
else if (ExperimentalRoomController.IsInCooldown(from))
|
||||
from.SendLocalizedMessage(1113413); // You have recently participated in this challenge. You must wait 24 hours to try again.
|
||||
else if (!m_Active && m_Entrance.Contains(from.Location) && from.Map == Map.TerMur)
|
||||
{
|
||||
if (from.HasGump(typeof(ExperimentalGem.InternalGump)))
|
||||
from.CloseGump(typeof(ExperimentalGem.InternalGump));
|
||||
|
||||
from.SendGump(new InternalGump(this));
|
||||
}
|
||||
else if (m_Active)
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1113408); // The gem is already active. You must clear the rooms before it is destroyed!
|
||||
}
|
||||
|
||||
public override void Decay()
|
||||
{
|
||||
}
|
||||
|
||||
public void Activate(Mobile from)
|
||||
{
|
||||
m_Active = true;
|
||||
|
||||
StartTimer();
|
||||
|
||||
m_CurrentRoom = Room.RoomOne;
|
||||
m_ToComplete = Utility.RandomMinMax(5, 8);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(5), new TimerCallback(BeginRoom_Callback));
|
||||
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1113405); // Your gem is now active. You may enter the Experimental Room.
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void BeginRoom_Callback()
|
||||
{
|
||||
m_Timer = new InternalTimer(this);
|
||||
m_LastIndex = -1;
|
||||
SelectNewHue();
|
||||
}
|
||||
|
||||
public override void StartTimer()
|
||||
{
|
||||
if (m_Span == 0)
|
||||
{
|
||||
TimeLeft = 1800;
|
||||
m_Span = 1800;
|
||||
base.StartTimer();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectNewHue()
|
||||
{
|
||||
int index = -1;
|
||||
int[] list = GetRoomHues();
|
||||
|
||||
do
|
||||
{
|
||||
index = Utility.Random(list.Length);
|
||||
}
|
||||
while(index == m_LastIndex);
|
||||
|
||||
m_Expire = DateTime.UtcNow + HueToLocDelay;
|
||||
m_Holding = false;
|
||||
m_LastIndex = index;
|
||||
|
||||
if (IsExtreme(list[index]))
|
||||
m_IsExtremeHue = true;
|
||||
|
||||
Hue = list[index];
|
||||
m_CurrentHue = Hue;
|
||||
}
|
||||
|
||||
private bool m_Holding;
|
||||
|
||||
public void OnTick()
|
||||
{
|
||||
if (m_Holding || m_Expire > DateTime.UtcNow)
|
||||
return;
|
||||
|
||||
Mobile m = (Mobile)RootParent;
|
||||
int floorHue = GetFloorHue(m);
|
||||
int nextHue = GetRevertedHue(m, m_CurrentHue, floorHue);
|
||||
|
||||
if (m != null && nextHue >= 0) //Standing in the right spot
|
||||
{
|
||||
if (m_IsExtremeHue && nextHue != Neutral) // from extreme back to regular
|
||||
{
|
||||
m_Completed += 0.5;
|
||||
|
||||
Hue = nextHue;
|
||||
m_CurrentHue = Hue;
|
||||
m_IsExtremeHue = false;
|
||||
m_LastIndex = GetIndexFor(nextHue);
|
||||
m_Expire = DateTime.UtcNow + HueToLocDelay;
|
||||
m.PlaySound(0x51);
|
||||
|
||||
m_Completed += 0.5;
|
||||
}
|
||||
else // Neutralized, new color
|
||||
{
|
||||
m_Completed++;
|
||||
|
||||
m_IsExtremeHue = false;
|
||||
m_Holding = true;
|
||||
Hue = Neutral;
|
||||
m_CurrentHue = Neutral;
|
||||
|
||||
if (m_Completed < m_ToComplete)
|
||||
{
|
||||
Timer.DelayCall(HueToHueDelay, new TimerCallback(SelectNewHue));
|
||||
m.PlaySound(0x51);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Completed >= m_ToComplete) // next room or complete!
|
||||
{
|
||||
if (m_CurrentRoom == Room.RoomThree) // puzzle completed
|
||||
{
|
||||
m_Holding = true;
|
||||
Hue = Neutral;
|
||||
m_CurrentHue = Neutral;
|
||||
CompletePuzzle(m);
|
||||
|
||||
m.PlaySound(0x1FF);
|
||||
m.LocalOverheadMessage(MessageType.Regular, 0x21, 1113403); // Congratulations!! The last room has been unlocked!! Hurry through to claim your reward!
|
||||
}
|
||||
else // on to the next room!
|
||||
{
|
||||
m_CurrentRoom++;
|
||||
|
||||
m_Holding = true;
|
||||
Hue = Neutral;
|
||||
m_CurrentHue = Neutral;
|
||||
|
||||
m_Completed = 0;
|
||||
|
||||
switch (m_CurrentRoom)
|
||||
{
|
||||
default:
|
||||
case Room.RoomOne:
|
||||
m_ToComplete = Utility.RandomMinMax(5, 8);
|
||||
break;
|
||||
case Room.RoomTwo:
|
||||
m_ToComplete = Utility.RandomMinMax(10, 15);
|
||||
break;
|
||||
case Room.RoomThree:
|
||||
m_ToComplete = Utility.RandomMinMax(15, 25);
|
||||
break;
|
||||
}
|
||||
|
||||
m_LastIndex = -1;
|
||||
Timer.DelayCall(RoomToRoomDelay, new TimerCallback(SelectNewHue));
|
||||
|
||||
m.PlaySound(0x1FF);
|
||||
m.LocalOverheadMessage(MessageType.Regular, 0x21, 1113402); // The next room has been unlocked! Hurry through the door before your gem's state changes again!
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_IsExtremeHue) //Already extreme, failed
|
||||
{
|
||||
if (m != null && m.AccessLevel == AccessLevel.Player)
|
||||
OnPuzzleFailed(m);
|
||||
else
|
||||
{
|
||||
if (m != null)
|
||||
m.SendMessage("As a GM, you get another chance!");
|
||||
|
||||
m_Expire = DateTime.UtcNow + HueToLocDelay;
|
||||
}
|
||||
|
||||
if (m != null)
|
||||
m.LocalOverheadMessage(MessageType.Regular, 0x21, 1113400); // You fail to neutralize the gem in time and are expelled from the room!!
|
||||
}
|
||||
else if (Hue != -1) //set to extreme hue
|
||||
{
|
||||
int hue = GetExtreme(m_CurrentHue);
|
||||
|
||||
Hue = hue;
|
||||
m_CurrentHue = hue;
|
||||
m_IsExtremeHue = true;
|
||||
m_LastIndex = GetIndexFor(hue);
|
||||
|
||||
if (m != null)
|
||||
m.LocalOverheadMessage(MessageType.Regular, 0x21, 1113401); // The state of your gem worsens!!
|
||||
|
||||
m_Expire = DateTime.UtcNow + HueToLocDelay;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string GetFloorString(int hue)
|
||||
{
|
||||
switch (hue)
|
||||
{
|
||||
case 0x481: //White
|
||||
return "white";
|
||||
case 0x4B2: //Pink
|
||||
return "pink";
|
||||
case 0x30: //Orange
|
||||
return "orange";
|
||||
case 0x3D: //LightGreen
|
||||
return "light green";
|
||||
case 0x26: //Red
|
||||
return "red";
|
||||
case 0x4: //Blue
|
||||
return "blue";
|
||||
case 0x557: //Dark Green
|
||||
return "dark green";
|
||||
case 0x747: //Brown
|
||||
return "brown";
|
||||
}
|
||||
|
||||
return "NOT STANDING ON A COLOR";
|
||||
}
|
||||
|
||||
private void CompletePuzzle(Mobile m)
|
||||
{
|
||||
if(m_Timer != null)
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Timer = null;
|
||||
}
|
||||
|
||||
m_Complete = true;
|
||||
Hue = Neutral;
|
||||
m_CurrentHue = Hue;
|
||||
|
||||
m_CurrentRoom = Room.RoomFour;
|
||||
}
|
||||
|
||||
private void OnPuzzleFailed(Mobile m)
|
||||
{
|
||||
if (m != null)
|
||||
{
|
||||
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 = m.Map.GetAverageZ(x, y);
|
||||
|
||||
Point3D from = m.Location;
|
||||
Point3D p = new Point3D(x, y, z);
|
||||
|
||||
m.PlaySound(0x1FE);
|
||||
Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
|
||||
Effects.SendLocationParticles(EffectItem.Create(p, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
|
||||
|
||||
BaseCreature.TeleportPets(m, p, Map.TerMur);
|
||||
m.MoveToWorld(p, Map.TerMur);
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
if(m_Timer != null)
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Timer = null;
|
||||
}
|
||||
|
||||
m_Complete = false;
|
||||
m_Completed = 0;
|
||||
m_ToComplete = 0;
|
||||
m_IsExtremeHue = false;
|
||||
m_Active = false;
|
||||
m_CurrentRoom = Room.RoomOne;
|
||||
m_LastIndex = -1;
|
||||
m_Expire = DateTime.MaxValue;
|
||||
m_CurrentHue = Neutral;
|
||||
Hue = Neutral;
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
if(m_Timer != null)
|
||||
m_Timer.Stop();
|
||||
|
||||
if(m_Owner != null)
|
||||
ExperimentalRoomController.AddToTable(m_Owner);
|
||||
|
||||
base.Delete();
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private ExperimentalGem m_Gem;
|
||||
|
||||
public InternalTimer(ExperimentalGem gem) : base(TimeSpan.FromSeconds(.5), TimeSpan.FromSeconds(.5))
|
||||
{
|
||||
m_Gem = gem;
|
||||
Start();
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if(m_Gem != null)
|
||||
m_Gem.OnTick();
|
||||
else
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
|
||||
private int[] GetRoomHues()
|
||||
{
|
||||
switch(m_CurrentRoom)
|
||||
{
|
||||
default:
|
||||
case Room.RoomOne:
|
||||
return m_RoomHues[0];
|
||||
case Room.RoomTwo:
|
||||
return m_RoomHues[1];
|
||||
case Room.RoomThree:
|
||||
return m_RoomHues[2];
|
||||
}
|
||||
}
|
||||
|
||||
private Rectangle2D GetRoomRec()
|
||||
{
|
||||
switch(m_CurrentRoom)
|
||||
{
|
||||
default:
|
||||
case Room.RoomOne:
|
||||
return m_RoomRecs[0];
|
||||
case Room.RoomTwo:
|
||||
return m_RoomRecs[1];
|
||||
case Room.RoomThree:
|
||||
return m_RoomRecs[2];
|
||||
}
|
||||
}
|
||||
|
||||
public int GetIndexFor(int hue)
|
||||
{
|
||||
int[] hues = GetRoomHues();
|
||||
|
||||
for (int i = 0; i < hues.Length; i++)
|
||||
{
|
||||
if (hue == hues[i])
|
||||
return i;
|
||||
}
|
||||
|
||||
return White; //Oops, something happened, this should never happened.
|
||||
}
|
||||
|
||||
public static int GetExtreme(int hue)
|
||||
{
|
||||
switch (hue)
|
||||
{
|
||||
case 0x4B2: return Red; // Pink to Red
|
||||
case 0x481: return Blue; // White to Blue
|
||||
case 0x30: return Brown; // Orange to Brown
|
||||
case 0x3D: return DarkGreen;// LightGreen to DarkGreen
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int GetRegular(int hue)
|
||||
{
|
||||
switch (hue)
|
||||
{
|
||||
case 0x26: return Pink; // Red to Pink
|
||||
case 0x4: return White; // Blue to White
|
||||
case 0x747: return Orange; // Brown to Orange
|
||||
case 0x557: return LightGreen; // DarkGreen to LightGreen
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Extreme Normal SlowOpposite FastOpposite
|
||||
*
|
||||
* Red Pink White Blue
|
||||
* Blue White Pink Red
|
||||
* Brown Orange LightGreen DarkGreen
|
||||
* DarkGreen LightGreen Orange Brown
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Checks locations the player is standing, in relation to the gem hue.
|
||||
/// </summary>
|
||||
/// <param name="oldHue">current gem hue</param>
|
||||
/// <param name="floorHue">where they are standing</param>
|
||||
/// <returns>-1 if they are in the wrong spot, the new gem hue if in the correct spot</returns>
|
||||
public int GetRevertedHue(Mobile from, int oldHue, int floorHue)
|
||||
{
|
||||
if (from == null)
|
||||
return -1;
|
||||
|
||||
if (!GetRoomRec().Contains(from.Location))
|
||||
return -1;
|
||||
|
||||
switch (oldHue)
|
||||
{
|
||||
case 0x481: //White
|
||||
if (floorHue == Pink || floorHue == Red)
|
||||
return Neutral;
|
||||
break;
|
||||
case 0x4B2: //Pink
|
||||
if (floorHue == White || floorHue == Blue)
|
||||
return Neutral;
|
||||
break;
|
||||
case 0x30: //Orange
|
||||
if (floorHue == LightGreen || floorHue == DarkGreen)
|
||||
return Neutral;
|
||||
break;
|
||||
case 0x3D: //LightGreen
|
||||
if (floorHue == Orange || floorHue == Brown)
|
||||
return Neutral;
|
||||
break;
|
||||
case 0x26: //Red
|
||||
if (floorHue == White)
|
||||
return Pink;
|
||||
if (floorHue == Blue)
|
||||
return Neutral;
|
||||
break;
|
||||
case 0x4: //Blue
|
||||
if (floorHue == Pink)
|
||||
return White;
|
||||
if (floorHue == Red)
|
||||
return Neutral;
|
||||
break;
|
||||
case 0x557: //Dark Green
|
||||
if (floorHue == Orange)
|
||||
return Orange;
|
||||
if (floorHue == Brown)
|
||||
return Neutral;
|
||||
break;
|
||||
case 0x747: //Brown
|
||||
if (floorHue == LightGreen)
|
||||
return Orange;
|
||||
if (floorHue == DarkGreen)
|
||||
return Neutral;
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int GetFloorHue(Mobile from)
|
||||
{
|
||||
if (from == null || from.Map != Map.TerMur)
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < m_FloorRecs.Length; i++)
|
||||
{
|
||||
if (m_FloorRecs[i].Contains(from.Location))
|
||||
return m_FloorHues[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public bool IsExtreme(int hue)
|
||||
{
|
||||
foreach (int i in ExtremeHues)
|
||||
{
|
||||
if (i == hue)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int[] RegularHues = new int[]
|
||||
{
|
||||
White,
|
||||
Pink,
|
||||
LightGreen,
|
||||
Orange,
|
||||
};
|
||||
|
||||
private int[] ExtremeHues = new int[]
|
||||
{
|
||||
Red,
|
||||
Blue,
|
||||
Brown,
|
||||
DarkGreen
|
||||
};
|
||||
|
||||
private static int[][] m_RoomHues = new int[][]
|
||||
{
|
||||
//Room One
|
||||
new int[] { White, Pink, Red, Blue },
|
||||
|
||||
//Room Two
|
||||
new int[] { Pink, Blue, Red, Orange, LightGreen, White },
|
||||
|
||||
//Room Three
|
||||
new int[] { Blue, Pink, DarkGreen, Orange, Brown, LightGreen, Red, White },
|
||||
};
|
||||
|
||||
private static Rectangle2D[] m_FloorRecs = new Rectangle2D[]
|
||||
{
|
||||
//Room One
|
||||
new Rectangle2D(977, 1104, 5, 5), // White, opposite of pink
|
||||
new Rectangle2D(987, 1104, 5, 5), // Pink, opposite of white
|
||||
new Rectangle2D(977, 1109, 5, 5), // Blue, opposite of red
|
||||
new Rectangle2D(987, 1109, 5, 5), // Red, opposite of Blue
|
||||
|
||||
//Room Two
|
||||
new Rectangle2D(977, 1092, 6, 3), // White, opposite of pink
|
||||
new Rectangle2D(986, 1092, 6, 3), //Red, opposite of Blue
|
||||
new Rectangle2D(977, 1095, 6, 3), //Blue, opposite of red
|
||||
new Rectangle2D(986, 1095, 6, 3), //LightGreen, oppostie of Orange
|
||||
new Rectangle2D(977, 1098, 6, 3), //Orange, opposite of LightGreen
|
||||
new Rectangle2D(986, 1098, 6, 3), //Pink, opposite of white
|
||||
|
||||
//Room Three
|
||||
new Rectangle2D(977, 1074, 3, 5), //Red, opposite of Blue
|
||||
new Rectangle2D(980, 1074, 3, 5), //White, oppostie of Pink
|
||||
new Rectangle2D(986, 1074, 3, 5), //Brown, oppostie of DarkGreen
|
||||
new Rectangle2D(989, 1074, 3, 5), //LightGreen, opposite of Orange
|
||||
new Rectangle2D(977, 1079, 3, 5), //DarkGreen, opposite of Brown
|
||||
new Rectangle2D(980, 1079, 3, 5), //Orange, opposite of LightGreen
|
||||
new Rectangle2D(986, 1079, 3, 5), //Blue, opposite of red
|
||||
new Rectangle2D(989, 1079, 3, 5), //Pink, opposite of White
|
||||
};
|
||||
|
||||
private static int[] m_FloorHues = new int[]
|
||||
{
|
||||
//Room One
|
||||
White,
|
||||
Pink,
|
||||
Red,
|
||||
Blue,
|
||||
|
||||
//Room Two
|
||||
White,
|
||||
Red,
|
||||
Blue,
|
||||
LightGreen,
|
||||
Orange,
|
||||
Pink,
|
||||
|
||||
//Room Three
|
||||
Red,
|
||||
White,
|
||||
Brown,
|
||||
LightGreen,
|
||||
DarkGreen,
|
||||
Orange,
|
||||
Blue,
|
||||
Pink
|
||||
};
|
||||
|
||||
private static Rectangle2D[] m_RoomRecs = new Rectangle2D[]
|
||||
{
|
||||
new Rectangle2D(977, 1104, 15, 10), //RoomOne
|
||||
new Rectangle2D(977, 1092, 15, 9), //RoomTwo
|
||||
new Rectangle2D(977, 1074, 15, 10), //RoomThree
|
||||
};
|
||||
|
||||
public ExperimentalGem(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1);
|
||||
writer.Write(m_Owner);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
switch (v)
|
||||
{
|
||||
case 1:
|
||||
m_Owner = reader.ReadMobile();
|
||||
goto case 0;
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
private class InternalGump : Gump
|
||||
{
|
||||
private ExperimentalGem m_Gem;
|
||||
|
||||
public InternalGump(ExperimentalGem gem) : base(50, 50)
|
||||
{
|
||||
m_Gem = gem;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 297, 115, 9200);
|
||||
|
||||
AddImageTiled(5, 10, 285, 25, 2624);
|
||||
AddHtmlLocalized(10, 15, 275, 25, 1113407, 0x7FFF, false, false); // Experimental Room Access
|
||||
|
||||
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)
|
||||
{
|
||||
if (info.ButtonID == 1)
|
||||
m_Gem.Activate(state.Mobile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items {
|
||||
|
||||
public class ExperimentalRoomChest : MetalBox
|
||||
{
|
||||
private Dictionary<Item, Mobile> m_Instancing;
|
||||
|
||||
public override bool DisplayWeight { get { return false; } }
|
||||
public override bool DisplaysContent{ get{ return false; } }
|
||||
public override bool Decays { get { return true; } }
|
||||
public override TimeSpan DecayTime { get { return TimeSpan.FromMinutes(10.0); } }
|
||||
|
||||
[Constructable]
|
||||
public ExperimentalRoomChest()
|
||||
{
|
||||
Movable = false;
|
||||
m_Instancing = new Dictionary<Item, Mobile>();
|
||||
LiftOverride = true;
|
||||
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if(pack != null)
|
||||
{
|
||||
Item item = pack.FindItemByType(typeof(ExperimentalGem));
|
||||
|
||||
if(item != null && item is ExperimentalGem && ((ExperimentalGem)item).Complete)
|
||||
{
|
||||
item.Delete();
|
||||
|
||||
Item toDrop = GetRandomDrop();
|
||||
|
||||
if(toDrop != null)
|
||||
AddItemFor(toDrop, from);
|
||||
}
|
||||
}
|
||||
|
||||
base.OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override bool TryDropItem(Mobile from, Item dropped, bool message)
|
||||
{
|
||||
if(dropped is ExperimentalGem && ((ExperimentalGem)dropped).Complete && from.InRange(this.Location, 2))
|
||||
{
|
||||
dropped.Delete();
|
||||
|
||||
Item toDrop = GetRandomDrop();
|
||||
|
||||
if(toDrop != null)
|
||||
AddItemFor(toDrop, from);
|
||||
|
||||
base.OnDoubleClick(from);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void AddItemFor(Item item, Mobile mob)
|
||||
{
|
||||
if (item == null || mob == null)
|
||||
return;
|
||||
|
||||
DropItem(item);
|
||||
item.SetLastMoved();
|
||||
|
||||
if (m_Instancing == null)
|
||||
m_Instancing = new Dictionary<Item, Mobile>();
|
||||
|
||||
m_Instancing[item] = mob;
|
||||
}
|
||||
|
||||
public override bool IsChildVisibleTo( Mobile m, Item child )
|
||||
{
|
||||
if (m.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
|
||||
if (m_Instancing != null)
|
||||
{
|
||||
if (!m_Instancing.ContainsKey(child))
|
||||
return true;
|
||||
|
||||
if (m_Instancing[child] == m)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool OnDecay()
|
||||
{
|
||||
List<Item> items = new List<Item>( this.Items );
|
||||
|
||||
foreach(Item i in items)
|
||||
{
|
||||
if (i.Decays && i.LastMoved.Add(DecayTime) < DateTime.UtcNow)
|
||||
{
|
||||
i.Delete();
|
||||
|
||||
if(m_Instancing.ContainsKey(i))
|
||||
m_Instancing.Remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void RemoveItem(Item item)
|
||||
{
|
||||
if (m_Instancing != null && m_Instancing.ContainsKey(item))
|
||||
m_Instancing.Remove(item);
|
||||
|
||||
base.RemoveItem(item);
|
||||
}
|
||||
|
||||
public Item GetRandomDrop()
|
||||
{
|
||||
Item item = null;
|
||||
|
||||
switch(Utility.Random(17))
|
||||
{
|
||||
case 0: case 1: case 2: case 3: case 4: case 5: case 6:
|
||||
item = new Stalagmite();
|
||||
break;
|
||||
case 7: case 8: case 9: case 10:
|
||||
item = new Flowstone();
|
||||
break;
|
||||
case 11:
|
||||
item = new CanvaslessEasel();
|
||||
break;
|
||||
case 12:
|
||||
item = new HangingChainmailLegs();
|
||||
break;
|
||||
case 13:
|
||||
item = new HangingRingmailTunic();
|
||||
break;
|
||||
case 14:
|
||||
item = new PluckedChicken();
|
||||
break;
|
||||
case 15:
|
||||
item = new ColorfulTapestry();
|
||||
break;
|
||||
case 16:
|
||||
item = new TwoStoryBanner();
|
||||
break;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public ExperimentalRoomChest( 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();
|
||||
|
||||
m_Instancing = new Dictionary<Item, Mobile>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ExperimentalRoomController : Item
|
||||
{
|
||||
private static ExperimentalRoomController m_Instance;
|
||||
public static ExperimentalRoomController Instance { get { return m_Instance; } }
|
||||
|
||||
private static Dictionary<Mobile, DateTime> m_Table;
|
||||
|
||||
public ExperimentalRoomController() : base(7107)
|
||||
{
|
||||
m_Table = new Dictionary<Mobile, DateTime>();
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_Instance = this;
|
||||
}
|
||||
|
||||
public static void AddToTable(Mobile from)
|
||||
{
|
||||
if (from == null)
|
||||
return;
|
||||
|
||||
m_Table[from] = DateTime.UtcNow + TimeSpan.FromHours(24);
|
||||
}
|
||||
|
||||
public static bool IsInCooldown(Mobile from)
|
||||
{
|
||||
Defrag();
|
||||
|
||||
return m_Table.ContainsKey(from);
|
||||
}
|
||||
|
||||
public static void Defrag()
|
||||
{
|
||||
List<Mobile> list = new List<Mobile>();
|
||||
|
||||
foreach (KeyValuePair<Mobile, DateTime> kvp in m_Table)
|
||||
{
|
||||
if (kvp.Value <= DateTime.UtcNow)
|
||||
list.Add(kvp.Key);
|
||||
}
|
||||
|
||||
foreach (Mobile m in list)
|
||||
m_Table.Remove(m);
|
||||
}
|
||||
|
||||
public static bool HasItem(Mobile from, Type type)
|
||||
{
|
||||
if (from == null || from.Backpack == null)
|
||||
return false;
|
||||
|
||||
Item item = from.Backpack.FindItemByType(type);
|
||||
|
||||
return item != null;
|
||||
}
|
||||
|
||||
public ExperimentalRoomController(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
Defrag();
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Table = new Dictionary<Mobile, DateTime>();
|
||||
|
||||
m_Instance = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items {
|
||||
|
||||
public class ExperimentalRoomDoor : MetalDoor2 {
|
||||
|
||||
public override string DefaultName { get { return "a door"; } }
|
||||
|
||||
private Room m_Room;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Room Room {
|
||||
get { return m_Room; }
|
||||
set { m_Room = value; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ExperimentalRoomDoor( Room room, DoorFacing facing ) : base(facing) {
|
||||
m_Room = room;
|
||||
}
|
||||
|
||||
public ExperimentalRoomDoor( Serial serial ) : base(serial) {
|
||||
|
||||
}
|
||||
|
||||
public override void Use(Mobile from)
|
||||
{
|
||||
if (from.AccessLevel > AccessLevel.Player)
|
||||
{
|
||||
from.SendMessage("You open the door with your godly powers.");
|
||||
base.Use(from);
|
||||
return;
|
||||
}
|
||||
|
||||
Container pack = from.Backpack;
|
||||
bool hasGem = false;
|
||||
|
||||
if (pack != null)
|
||||
{
|
||||
Item[] items = pack.FindItemsByType(typeof(ExperimentalGem));
|
||||
|
||||
if (items != null && items.Length > 0)
|
||||
{
|
||||
hasGem = true;
|
||||
|
||||
foreach (Item item in items)
|
||||
{
|
||||
ExperimentalGem gem = (ExperimentalGem)item;
|
||||
|
||||
if (gem.Active && (gem.CurrentRoom > m_Room || m_Room == Room.RoomZero))
|
||||
{
|
||||
base.Use(from);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1113410); // You must have an active Experimental Gem to enter that room.
|
||||
}
|
||||
|
||||
if(hasGem)
|
||||
from.SendLocalizedMessage(1113411); // You have not yet earned access to that room!
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer) {
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // ver
|
||||
writer.Write((int)m_Room);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader) {
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
m_Room = (Room)reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Server.Items {
|
||||
|
||||
public class ExperimentalRoomBlocker : Item
|
||||
{
|
||||
private Room m_Room;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Room Room {
|
||||
get { return m_Room; }
|
||||
set { m_Room = value; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ExperimentalRoomBlocker( Room room ) : base(7107)
|
||||
{
|
||||
m_Room = room;
|
||||
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public ExperimentalRoomBlocker( Serial serial ) : base(serial) {
|
||||
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile from)
|
||||
{
|
||||
if(from.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if(pack != null)
|
||||
{
|
||||
Item[] items = pack.FindItemsByType(typeof(ExperimentalGem));
|
||||
|
||||
if(items != null)
|
||||
{
|
||||
foreach(Item item in items)
|
||||
{
|
||||
ExperimentalGem gem = (ExperimentalGem)item;
|
||||
|
||||
if(gem.Active && (gem.CurrentRoom > m_Room || m_Room == Room.RoomZero))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Message?
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer) {
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // ver
|
||||
writer.Write((int)m_Room);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader) {
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
m_Room = (Room)reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
using Server;
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(12287, 12288)]
|
||||
public class TwoStoryBanner : Item
|
||||
{
|
||||
[Constructable]
|
||||
public TwoStoryBanner() : base(12287)
|
||||
{
|
||||
}
|
||||
|
||||
public TwoStoryBanner( 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 Stalagmite : Item
|
||||
{
|
||||
[Constructable]
|
||||
public Stalagmite() : base(Utility.RandomList(2272, 2273, 2276, 2277, 2279, 2281, 2282))
|
||||
{
|
||||
}
|
||||
|
||||
public Stalagmite( 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 Flowstone : Item
|
||||
{
|
||||
[Constructable]
|
||||
public Flowstone() : base(Utility.RandomList(2274, 2275, 2278, 2280))
|
||||
{
|
||||
}
|
||||
|
||||
public Flowstone( 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 HangingChainmailLegs : Item
|
||||
{
|
||||
[Constructable]
|
||||
public HangingChainmailLegs() : base(5052)
|
||||
{
|
||||
}
|
||||
|
||||
public HangingChainmailLegs( 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 HangingRingmailTunic : Item
|
||||
{
|
||||
[Constructable]
|
||||
public HangingRingmailTunic() : base(5095)
|
||||
{
|
||||
}
|
||||
|
||||
public HangingRingmailTunic( 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 PluckedChicken : Item
|
||||
{
|
||||
[Constructable]
|
||||
public PluckedChicken() : base(7819)
|
||||
{
|
||||
}
|
||||
|
||||
public PluckedChicken( 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 ColorfulTapestry : Item
|
||||
{
|
||||
[Constructable]
|
||||
public ColorfulTapestry() : base(17092)
|
||||
{
|
||||
}
|
||||
|
||||
public ColorfulTapestry( 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 CanvaslessEasel : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 123467; } }
|
||||
|
||||
[Constructable]
|
||||
public CanvaslessEasel() : base(Utility.RandomBool() ? 3943 : 3945)
|
||||
{
|
||||
}
|
||||
|
||||
public CanvaslessEasel( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
82
Scripts/Services/Underworld/ExperimentalRoom/Region.cs
Normal file
82
Scripts/Services/Underworld/ExperimentalRoom/Region.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using System.Xml;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Regions
|
||||
{
|
||||
public class ExperimentalRoomRegion : DungeonRegion
|
||||
{
|
||||
public ExperimentalRoomRegion(XmlElement xml, Map map, Region parent)
|
||||
: base(xml, map, parent)
|
||||
{
|
||||
}
|
||||
|
||||
private static Rectangle2D m_Entrance = new Rectangle2D(994, 1114, 4, 4);
|
||||
|
||||
public override void OnLocationChanged(Mobile m, Point3D oldLocation)
|
||||
{
|
||||
if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned))
|
||||
{
|
||||
foreach (Rectangle2D rec in m_RoomRecs)
|
||||
{
|
||||
if (rec.Contains(m.Location))
|
||||
{
|
||||
KickToEntrance(m);
|
||||
Mobile master = ((BaseCreature)m).GetMaster();
|
||||
|
||||
if (master != null && master.NetState != null)
|
||||
master.SendLocalizedMessage(1113472); // Your pet has been kicked out of the room. This is not a stable!
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m is PlayerMobile && m.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
if (m.Backpack == null)
|
||||
KickToEntrance(m);
|
||||
else
|
||||
{
|
||||
Item item = m.Backpack.FindItemByType(typeof(ExperimentalGem));
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
foreach (Rectangle2D rec in m_RoomRecs)
|
||||
{
|
||||
if (rec.Contains(m.Location))
|
||||
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 loc = from.Location;
|
||||
Point3D p = new Point3D(x, y, z);
|
||||
|
||||
if(from is PlayerMobile)
|
||||
BaseCreature.TeleportPets(from, p, Map.TerMur);
|
||||
|
||||
from.MoveToWorld(p, Map.TerMur);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
private static Rectangle2D[] m_RoomRecs = new Rectangle2D[]
|
||||
{
|
||||
new Rectangle2D(977, 1104, 15, 10), //RoomOne
|
||||
new Rectangle2D(977, 1092, 15, 9), //RoomTwo
|
||||
new Rectangle2D(977, 1074, 15, 10), //RoomThree
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user