#W# Added: Made a custom moongate and gump.
This commit is contained in:
parent
282fd94fd2
commit
d8db393d1a
3 changed files with 194 additions and 0 deletions
62
Projects/UOContent/Items/CustomMoonGate.cs
Normal file
62
Projects/UOContent/Items/CustomMoonGate.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class CustomMoongate : Item
|
||||
{
|
||||
[Constructible]
|
||||
public CustomMoongate() : base(0xF6C)
|
||||
{
|
||||
Movable = false;
|
||||
Light = LightType.Circle300;
|
||||
Name = "a moongate";
|
||||
}
|
||||
|
||||
// Required for ModernUO Serialization
|
||||
public CustomMoongate(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
// Triggers when a player walks onto the gate
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (m.Player && m.Alive)
|
||||
{
|
||||
SendGateGump(m);
|
||||
}
|
||||
return true; // Return true to allow the player to step onto the tile
|
||||
}
|
||||
|
||||
// Triggers when a player double-clicks the gate
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.Player || !from.Alive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
SendGateGump(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
}
|
||||
}
|
||||
|
||||
private void SendGateGump(Mobile m)
|
||||
{
|
||||
if (m is PlayerMobile pm)
|
||||
{
|
||||
// Close any existing moongate gumps before opening a new one
|
||||
pm.CloseGump<CustomMoongateGump>();
|
||||
pm.SendGump(new CustomMoongateGump());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue