Initial commit

This commit is contained in:
Ubuntu
2026-06-19 00:00:16 -04:00
commit 73701ff86e
7100 changed files with 1952988 additions and 0 deletions
+130
View File
@@ -0,0 +1,130 @@
#region References
using System;
using Server.Factions;
using Server.Gumps;
using Server.Misc;
using Server.Mobiles;
using Server.Multis;
using Server.Network;
using Server.Regions;
using Server.Spells;
#endregion
namespace Server.Items
{
public class AdminGate : Moongate
{
private bool m_StaffOnly = true;
private AdminGate m_LinkedGate;
private InternalTimer m_Timer;
public override bool ShowFeluccaWarning { get { return false; } }
public override bool TeleportPets { get { return true; } }
[CommandProperty(AccessLevel.GameMaster)]
public bool StaffOnly
{
get { return m_StaffOnly; }
set { m_StaffOnly = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public AdminGate LinkedGate
{
get { return m_LinkedGate; }
set { m_LinkedGate = value; }
}
[Constructable]
public AdminGate()
: base(Point3D.Zero, null)
{
Name = "Golden Moongate";
Dispellable = false;
Hue = 2503;
if(m_Timer == null)
m_Timer = new InternalTimer(this);
m_Timer.Start();
}
[Constructable]
public AdminGate(Point3D target, Map targetMap)
: base(target, targetMap)
{
Name = "Golden Moongate";
Dispellable = false;
Movable = false;
Light = LightType.Circle300;
Hue = 2503;
Target = target;
TargetMap = targetMap;
if(m_Timer == null)
m_Timer = new InternalTimer(this);
m_Timer.Start();
}
public AdminGate(Serial serial)
: base(serial)
{ }
public override void OnDoubleClick(Mobile from)
{
if (StaffOnly && !from.IsStaff())
from.SendMessage("You cannot access this gate.");
else
base.OnDoubleClick(from);
}
public override void UseGate(Mobile m)
{
if (StaffOnly && !m.IsStaff())
m.SendMessage("You cannot access this gate.");
else
base.UseGate(m);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(1); // version
writer.Write(m_StaffOnly);
writer.Write(m_LinkedGate);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
m_StaffOnly = reader.ReadBool();
m_LinkedGate = reader.ReadItem() as AdminGate;
m_Timer = new InternalTimer(this);
}
private class InternalTimer : Timer
{
private readonly Item m_Item;
public InternalTimer(Item item)
: base(TimeSpan.FromSeconds(30.0))
{
Priority = TimerPriority.OneSecond;
m_Item = item;
}
protected override void OnTick()
{
m_Item.Delete();
}
}
}
}
+215
View File
@@ -0,0 +1,215 @@
using System;
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Engines.Craft;
using Server.Gumps;
using Server.Mobiles;
using Server.Multis;
using Server.Network;
using Server.Prompts;
namespace Server.Items
{
public class AdminRunebook : Item, ISecurable
{
private List <AdminRunebookEntry> m_Entries;
private string m_Description;
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string Description
{
get
{
return m_Description;
}
set
{
m_Description = value;
InvalidateProperties();
}
}
public virtual int MaxEntries { get { return 9; } }
[Constructable]
public AdminRunebook()
: base(0x9C16) //0x22C5 OG runebook itemID, 0x2259 BOD book ID
{
Name = "admin runebook";
Weight = 0.0;
Hue = 2503;
m_Entries = new List<AdminRunebookEntry>();
}
public List<AdminRunebookEntry> Entries { get { return m_Entries; } }
public void AddEntry(PlayerMobile pm)
{
if(m_Entries == null)
{
m_Entries = new List<AdminRunebookEntry>();
pm.SendMessage("New list added.");
}
else
{
AdminRunebookEntry entry = new AdminRunebookEntry(pm.Location, pm.Map, "a new location");
m_Entries.Add(entry);
pm.SendMessage(entry.Description + " added to list");
pm.SendMessage(m_Entries.Count + " entries total");
}
}
public override void OnDoubleClick(Mobile from)
{
if(from is PlayerMobile)
{
PlayerMobile pm = (PlayerMobile)from;
if (!pm.IsStaff())
pm.SendMessage("You do not have the power to access this book.");
else
{
BaseGump.SendGump(new AdminRunebookGump(this, pm));
pm.SendMessage("You open the admin runebook.");
}
}
}
public AdminRunebook(Serial serial)
: base(serial)
{
}
public void GetDescriptionPrompt(PlayerMobile admin)
{
admin.Prompt = new DescriptionPrompt(this);
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
SetSecureLevelEntry.AddTo(from, this, list);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_Entries.Count);
for (int i = 0; i < m_Entries.Count; ++i)
m_Entries[i].Serialize(writer);
writer.Write(m_Description);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
int count = reader.ReadInt();
m_Entries = new List<AdminRunebookEntry>(count);
for (int i = 0; i < count; ++i)
m_Entries.Add(new AdminRunebookEntry(reader));
m_Description = reader.ReadString();
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if (m_Description != null && m_Description.Length > 0)
list.Add(m_Description);
}
private class DescriptionPrompt : Prompt
{
//public override int MessageCliloc { get { return 501804; } }
private readonly AdminRunebook m_Book;
public DescriptionPrompt(AdminRunebook book)
{
m_Book = book;
}
public override void OnResponse(Mobile from, string text)
{
if (m_Book != null)
{
m_Book.Description = text;
from.SendMessage("You add a description to your book");
}
}
}
}
public class AdminRunebookEntry
{
private Map m_TargetMap;
private string m_Description;
private bool m_Selected = false;
public bool Selected
{
get { return m_Selected; }
set { m_Selected = value; }
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
public Point3D Target { get; set; }
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
public Map TargetMap
{
get { return m_TargetMap; }
set
{
if (m_TargetMap != value)
{
m_TargetMap = value;
//InvalidateProperties();
}
}
}
public string Description
{
get { return m_Description; }
set { m_Description = value; }
}
public BaseGalleon Galleon { get; }
public AdminRunebookEntry(Point3D loc, Map map, string desc)
{
Target = loc;
m_TargetMap = map;
m_Description = desc;
}
public AdminRunebookEntry(GenericReader reader)
{
int version = reader.ReadByte();
//int version = reader.ReadInt();
Target = reader.ReadPoint3D();
m_TargetMap = reader.ReadMap();
m_Description = reader.ReadString();
}
public void Serialize(GenericWriter writer)
{
writer.Write((byte)3);
writer.Write(Target);
writer.Write(m_TargetMap);
writer.Write(m_Description);
}
}
}
+381
View File
@@ -0,0 +1,381 @@
using System;
using Server.Items;
using Server.Network;
using Server.Mobiles;
using Server.Targets;
using Server.Targeting;
using System.Globalization;
using System.Collections.Generic;
namespace Server.Gumps
{
public class AdminRunebookGump : BaseGump
{
private AdminRunebook m_Book;
private List<AdminRunebookEntry> m_Entries;
private PlayerMobile m_Admin;
private int MaxEntries = 24;
private int PageOneEntries;
private int PageTwoEntries;
private bool StaffOnly = false;
private bool OptionsMenu = false;
private int Page;
public AdminRunebookGump(AdminRunebook book, PlayerMobile admin)
: base(admin, 100, 100)
{
m_Book = book;
m_Entries = book.Entries;
m_Admin = admin;
Page = 1;
}
public AdminRunebookGump(AdminRunebook book, PlayerMobile admin, int page)
: base(admin, 100, 100)
{
m_Book = book;
m_Entries = book.Entries;
m_Admin = admin;
Page = page;
}
public override void AddGumpLayout()
{
AddPage(0);
AddImage(0, 0, 0x9BF3);
AddHtml(60, 10, 190, 16, FormatOptions("Admin Runebook", "#504107"), false, false);
AddHtml(80, 300, 400, 16, FormatOptions("Add Location", "#F0F8FF"), false, false);
AddButton(50, 300, 0x16CE, 0x16CD, 1, GumpButtonType.Reply, 0);
AddHtml(80, 330, 400, 16, FormatOptions("Options", "#F0F8FF"), false, false);
AddButton(50, 330, 0x16CE, 0x16CD, 2, GumpButtonType.Reply, 0);
/* Options menu */
if (OptionsMenu == true)
{
AddHtml(275, 10, 400, 16, FormatOptions("Options", "#504107"), false, false);
AddButton(250, 105, 0x868, 0x869, 6, GumpButtonType.Reply, 0);
AddHtml(285, 110, 400, 16, FormatOptions("Subtitle Book", "#F0F8FF"), false, false);
AddButton(250, 155, 0x868, 0x869, 5, GumpButtonType.Reply, 0);
AddHtml(285, 160, 400, 16, FormatOptions("Clear Entries", "#F0F8FF"), false, false);
AddButton(250, 205, 0x868, 0x869, 4, GumpButtonType.Reply, 0);
AddHtml(285, 210, 400, 16, FormatOptions("Copy Entries", "#F0F8FF"), false, false);
}
AddPage(1);
if (Page == 1)
{
AddButton(374, 4, 0x89E, 0x89E, 1002, GumpButtonType.Reply, 0);
if (m_Entries.Count < 12)
PageOneEntries = m_Entries.Count;
else
PageOneEntries = 12;
int y = 30;
if(m_Entries != null )
{
for(int i = 0; i < PageOneEntries; i++)
{
if (m_Entries[i] == null)
{
m_Entries.RemoveAt(i);
i--;
}
else
{
AddButton(40, y+2, 0x4B9, 0x4BA, i + 100, GumpButtonType.Reply, 0);
AddHtml(65, y, 400, 16, FormatOptions(m_Entries[i].Description, m_Entries[i].Selected ? "#504107" : "#F0F8FF"), false, false);
if (m_Entries[i].Selected)
{
AddImageTiled(270, 10, 100, 21, 0xBBC);
AddTextEntry(275, 10, 140, 21, 0, 1, m_Entries[i].Description);
AddButton(260, 52, 0x4B9, 0x4BA, i + 500, GumpButtonType.Reply, 0); //Remove Entry
AddHtml(280, 50, 400, 16, FormatOptions("Remove Entry", "#504107"), false, false);
AddButton(250, 85, 0x868, 0x869, i + 600, GumpButtonType.Reply, 0);
AddHtml(285, 90, 400, 16, FormatOptions("Create Rune", "#504107"), false, false);
AddButton(250, 135, 0x868, 0x869, i + 400, GumpButtonType.Reply, 0);
AddHtml(285, 140, 400, 16, FormatOptions("Send Player", "#504107"), false, false);
AddHtml(255, 255, 400, 16, FormatOptions("Travel", "#504107"), false, false);
AddHtml(315, 255, 400, 16, FormatOptions( "Admin Gate", "#504107"), false, false);
AddHtml(264, 185, 400, 16, FormatOptions("Gate Access: ", "#504107"), false, false);
AddButton(250, 205, StaffOnly ? 0x86A : 0x868, StaffOnly ? 0x867 : 0x869, 3, GumpButtonType.Reply, 0); //Staff Only
AddHtml(285, 210, 400, 16, FormatOptions("Staff Only", "#504107"), false, false);
AddButton(245, 11, 0x4B9, 0x4BA, i + 150, GumpButtonType.Reply, 0); //Rename
AddButton(250, 290, 0x1B77, 0x1B77, i + 200, GumpButtonType.Reply, 0); // Travel
AddButton(315, 290, 0x1B8B, 0x1B8B, i + 250, GumpButtonType.Reply, 0); // Admin Gate
}
y += 20;
}
}
if( m_Entries.Count == 0)
AddHtml(60, 30, 400, 16, FormatOptions("No entries", "#F0F8FF"), false, false);
}
else
AddHtml(60, 30, 400, 16, FormatOptions("No entries", "#F0F8FF"), false, false);
}
if ( Page == 2)
{
AddButton(22, 4, 0x89D, 0x89D, 1001, GumpButtonType.Reply, 0);
if (m_Entries.Count < 12)
PageTwoEntries = 0;
else if (m_Entries.Count > 9 && m_Entries.Count < 24)
PageTwoEntries = m_Entries.Count;
else
PageTwoEntries = 24;
int y = 30;
if(m_Entries != null )
{
for(int i = 12; i < PageTwoEntries; i++)
{
if (m_Entries[i] == null)
{
m_Entries.RemoveAt(i);
i--;
}
else
{
AddButton(40, y+2, 0x4B9, 0x4BA, i + 100, GumpButtonType.Reply, 0);
AddHtml(65, y, 400, 16, FormatOptions(m_Entries[i].Description, m_Entries[i].Selected ? "#504107" : "#F0F8FF"), false, false);
if (m_Entries[i].Selected)
{
AddImageTiled(270, 10, 100, 21, 0xBBC);
AddTextEntry(275, 10, 140, 21, 0, 1, m_Entries[i].Description);
AddButton(260, 52, 0x4B9, 0x4BA, i + 500, GumpButtonType.Reply, 0); //Remove Entry
AddHtml(280, 50, 400, 16, FormatOptions("Remove Entry", "#504107"), false, false);
AddButton(250, 85, 0x868, 0x869, i + 600, GumpButtonType.Reply, 0);
AddHtml(285, 90, 400, 16, FormatOptions("Create Rune", "#504107"), false, false);
AddButton(250, 135, 0x868, 0x869, i + 400, GumpButtonType.Reply, 0);
AddHtml(285, 140, 400, 16, FormatOptions("Send Player", "#504107"), false, false);
AddHtml(255, 255, 400, 16, FormatOptions("Travel", "#504107"), false, false);
AddHtml(315, 255, 400, 16, FormatOptions( "Admin Gate", "#504107"), false, false);
AddHtml(264, 185, 400, 16, FormatOptions("Gate Access: ", "#504107"), false, false);
AddButton(250, 205, StaffOnly ? 0x86A : 0x868, StaffOnly ? 0x867 : 0x869, 3, GumpButtonType.Reply, 0); //Staff Only
AddHtml(285, 210, 400, 16, FormatOptions("Staff Only", "#504107"), false, false);
AddButton(245, 11, 0x4B9, 0x4BA, i + 150, GumpButtonType.Reply, 0); //Rename
AddButton(250, 290, 0x1B77, 0x1B77, i + 200, GumpButtonType.Reply, 0); // Travel
AddButton(315, 290, 0x1B8B, 0x1B8B, i + 250, GumpButtonType.Reply, 0); // Admin Gate
}
y += 20;
}
}
if( m_Entries.Count == 0)
AddHtml(60, 30, 400, 16, FormatOptions("No entries", "#F0F8FF"), false, false);
}
else
AddHtml(60, 30, 400, 16, FormatOptions("No entries", "#F0F8FF"), false, false);
}
}
public string Rename(RelayInfo info, Mobile from)
{
TextRelay tn = info.GetTextEntry(1); //Text Name
string name = tn.Text;
return name;
}
public string FormatOptions(string val, string color)
{
if( color == null)
return String.Format("<div align=left>{0}</div>", val);
else
return String.Format("<BASEFONT COLOR={1}><dic align=left>{0}</div>", val, color);
}
public override void OnResponse(RelayInfo info)
{
if(info.ButtonID == 0)
return;
if(info.ButtonID == 1)
{
if( m_Entries.Count < MaxEntries)
m_Book.AddEntry(m_Admin);
else
{
m_Admin.SendMessage("Your entry list is full.");
Refresh();
}
}
if(info.ButtonID == 2)
{
if (m_Entries != null)
{
for(int n = 0; n < m_Entries.Count; n++)
m_Entries[n].Selected = false;
}
OptionsMenu = true;
Refresh();
}
if (info.ButtonID == 3)
{
if(!StaffOnly)
StaffOnly = true;
else
StaffOnly = false;
Refresh();
}
if(info.ButtonID == 4)
{
m_Admin.Target = new CopyEntriesTarget(m_Book);
}
if(info.ButtonID == 5)
{
if(m_Entries != null)
m_Entries.Clear();
}
if(info.ButtonID == 6)
{
m_Book.GetDescriptionPrompt(m_Admin);
}
if (info.ButtonID >= 400 && info.ButtonID < 425) // send player
{
m_Admin.Target = new AdminRunebookPlayerTarget(m_Entries[info.ButtonID - 400].Target, m_Entries[info.ButtonID - 400].TargetMap);
Refresh();
}
if (info.ButtonID >= 100 && info.ButtonID < 125) // select entry
{
OptionsMenu = false;
for(int e = 0; e < m_Entries.Count; e++)
m_Entries[e].Selected = false;
m_Entries[info.ButtonID - 100].Selected = true;
if (info.ButtonID > 112)
Page = 2;
Refresh();
}
if (info.ButtonID >= 150 && info.ButtonID < 175)
{
string newName = Rename(info, m_Admin);
m_Entries[info.ButtonID - 150].Description = newName;
Refresh();
}
if (info.ButtonID >= 200 && info.ButtonID < 225) // admin gate
{
m_Admin.MoveToWorld(m_Entries[info.ButtonID - 200].Target, m_Entries[info.ButtonID - 200].TargetMap);
}
if (info.ButtonID >= 250 && info.ButtonID < 275)
{
AdminGate gateOne = new AdminGate(m_Entries[info.ButtonID - 250].Target, m_Entries[info.ButtonID - 250].TargetMap);
gateOne.MoveToWorld(m_Admin.Location, m_Admin.Map);
AdminGate gateTwo = new AdminGate(m_Admin.Location, m_Admin.Map);
gateTwo.MoveToWorld(m_Entries[info.ButtonID - 250].Target, m_Entries[info.ButtonID - 250].TargetMap);
if(!StaffOnly)
{
gateOne.StaffOnly = false;
gateTwo.StaffOnly = false;
}
else
{
gateOne.StaffOnly = true;
gateTwo.StaffOnly = true;
}
gateOne.LinkedGate = gateTwo;
gateTwo.LinkedGate = gateOne;
}
if (info.ButtonID >= 500 && info.ButtonID < 525)
{
m_Entries.RemoveAt(info.ButtonID - 500);
}
if (info.ButtonID >= 600 && info.ButtonID < 625)
{
RecallRune rune = new RecallRune();
rune.Marked = true;
rune.TargetMap = m_Entries[info.ButtonID - 600].TargetMap;
rune.Target = m_Entries[info.ButtonID - 600].Target;
rune.Description = m_Entries[info.ButtonID - 600].Description;
m_Admin.Backpack.DropItem(rune);
}
if (info.ButtonID == 1001)
{
BaseGump.SendGump(new AdminRunebookGump(m_Book, m_Admin, 1));
}
if (info.ButtonID == 1002)
{
BaseGump.SendGump(new AdminRunebookGump(m_Book, m_Admin, 2));
}
}
private class CopyEntriesTarget : Target
{
private AdminRunebook m_Original;
public CopyEntriesTarget(AdminRunebook book)
: base( -1, true, TargetFlags.None)
{
m_Original = book;
}
protected override void OnTarget(Mobile from, object o)
{
if (from is PlayerMobile && o is AdminRunebook)
{
PlayerMobile pm = from as PlayerMobile;
AdminRunebook book = o as AdminRunebook;
book.Entries.Clear();
for( int i = 0; i < m_Original.Entries.Count; i++)
{
book.AddEntry(pm);
book.Entries[i] = m_Original.Entries[i];
}
}
}
}
}
}
+30
View File
@@ -0,0 +1,30 @@
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Targets
{
public class AdminRunebookPlayerTarget : Target
{
Point3D TargetLocation;
Map TargetMap;
public AdminRunebookPlayerTarget(Point3D loc, Map map)
: base( 12, false, TargetFlags.None)
{
TargetLocation = loc;
TargetMap = map;
}
protected override void OnTarget(Mobile from, object targeted)
{
if (targeted is PlayerMobile && TargetLocation != Point3D.Zero && TargetMap != null)
{
PlayerMobile pm = (PlayerMobile)targeted;
pm.MoveToWorld(TargetLocation, TargetMap);
pm.SendMessage("You have been sent to a new location though divine intervention!");
}
}
}
}
+265
View File
@@ -0,0 +1,265 @@
using System;
using Server.Engines.Craft;
using Server.Mobiles;
namespace Server.Items
{
public class AdminToken : Item
{
private Timer m_Timer;
private DateTime m_EndTime;
public DateTime EndTime
{
get { return m_EndTime; }
set { m_EndTime = value; }
}
public Timer Timer
{
get { return m_Timer; }
set { m_Timer = value; }
}
public enum Level
{
Player = 0,
VIP = 1,
Counselor = 2,
Decorator = 3,
Spawner = 4,
GameMaster = 5,
Seer = 6,
Administrator = 7,
Developer = 8,
CoOwner = 9,
Owner = 10,
None = 11
}
private Level m_Level = Level.None;
public Level StaffLevel
{
get { return m_Level; }
set { m_Level = value; InvalidateProperties(); }
}
[Constructable]
public AdminToken()
: base(0x23C) //0xF8B)
{
Name = "admin token";
Weight = 1.0;
LootType = LootType.Blessed;
}
public AdminToken(Serial serial)
: base(serial)
{
}
public override void OnDoubleClick(Mobile m)
{
if (m_Level == Level.None && m.AccessLevel != AccessLevel.Player)
{
switch(m.AccessLevel)
{
case AccessLevel.Owner:
m_Level = Level.Owner;
break;
case AccessLevel.CoOwner:
m_Level = Level.CoOwner;
break;
case AccessLevel.Developer:
m_Level = Level.Developer;
break;
case AccessLevel.Administrator:
m_Level = Level.Administrator;
break;
case AccessLevel.Seer:
m_Level = Level.Seer;
break;
case AccessLevel.GameMaster:
m_Level = Level.GameMaster;
break;
case AccessLevel.Spawner:
m_Level = Level.Spawner;
break;
case AccessLevel.Counselor:
m_Level = Level.Counselor;
break;
case AccessLevel.VIP:
m_Level = Level.VIP;
break;
}
}
if (m.AccessLevel != AccessLevel.Player && m_Level != Level.None)
{
AdminToken token = FindToken(m);
int IntLevel = (int)token.StaffLevel;
Server.AccessLevel tokenLevel = (AccessLevel)Enum.ToObject(typeof(AccessLevel), IntLevel);
m.AccessLevel = AccessLevel.Player;
m_EndTime = DateTime.UtcNow + TimeSpan.FromMinutes(5);
if (m is PlayerMobile)
{
PlayerMobile pm = m as PlayerMobile;
DoTimer(pm);
}
m.SendMessage( "You are now in Player Mode.");
}
else if (m.AccessLevel == AccessLevel.Player && m_Level != Level.None)
{
AdminToken token = FindToken(m);
int IntLevel = (int)token.StaffLevel;
Server.AccessLevel tokenLevel = (AccessLevel)Enum.ToObject(typeof(AccessLevel), IntLevel);
m.AccessLevel = tokenLevel;
m.SendMessage( "You are now in Admin Mode.");
if (m_Timer != null)
{
m_Timer.Stop();
m_Timer = null;
}
}
}
public void SetLevel(Level level)
{
m_Level = level;
}
private static AdminToken FindToken(Mobile from)
{
if ((from == null) || from.Backpack == null)
return null;
if (from.Holding is AdminToken)
{
return (AdminToken)from.Holding;
}
return from.Backpack.FindItemByType<AdminToken>();
}
public void DoTimer(PlayerMobile pm)
{
if(pm.AccessLevel == AccessLevel.Player)
{
if (m_Timer != null)
{
m_Timer.Stop();
m_Timer = null;
}
m_Timer = new InternalTimer(this, pm, TimeSpan.FromSeconds(1), m_EndTime);
m_Timer.Start();
}
}
public override void OnDelete()
{
base.OnDelete();
if(m_Timer != null)
m_Timer.Stop();
}
public override void AddNameProperties(ObjectPropertyList list)
{
base.AddNameProperties(list);
list.Add( "Acess Level: " + m_Level.ToString());
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
private class InternalTimer : Timer
{
private readonly AdminToken Token;
private readonly PlayerMobile Owner;
private DateTime EndTime;
private readonly TimeSpan Delay;
public InternalTimer(AdminToken token, PlayerMobile owner, TimeSpan delay, DateTime end)
: base(delay)
{
Token = token;
Owner = owner;
Delay = delay;
EndTime = end;
}
protected override void OnTick()
{
if (Token == null && !Token.Deleted)
{
Stop();
}
if (Owner.Hits < (Owner.HitsMax/3) && !Owner.Blessed)
{
Owner.Blessed = true;
EndTime = DateTime.UtcNow + TimeSpan.FromSeconds(5);
Owner.SendMessage("You have been blessed.");
if (Token.Timer != null)
{
Token.Timer.Stop();
Token.Timer = null;
}
Token.Timer = new InternalTimer(Token, Owner, Delay, EndTime);
Token.Timer.Start();
}
if (DateTime.UtcNow > EndTime)
{
if (Owner.Blessed)
{
if (!Owner.Alive)
Owner.Resurrect();
Owner.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist);
Owner.PlaySound(0x1F2);
Owner.Hits = Owner.HitsMax;
Owner.Blessed = false;
}
int IntLevel = (int)Token.StaffLevel;
Server.AccessLevel tokenLevel = (AccessLevel)Enum.ToObject(typeof(AccessLevel), IntLevel);
Owner.AccessLevel = tokenLevel;
}
else
{
if (Token.Timer != null)
{
Token.Timer.Stop();
Token.Timer = null;
}
Token.Timer = new InternalTimer(Token, Owner, Delay, EndTime);
Token.Timer.Start();
}
}
}
}
}
+299
View File
@@ -0,0 +1,299 @@
using System;
using Server;
using Server.Gumps;
using Server.Items;
using Server.SkillHandlers;
using System.Collections.Generic;
using System.Linq;
using Server.Misc;
using Server.Commands;
using Server.Mobiles;
using Server.Targeting;
using Server.Targets;
namespace Server.Gumps
{
public class CommandGump : BaseGump
{
public static void Initialize()
{
CommandSystem.Register("CommandGump",AccessLevel.Administrator, new CommandEventHandler(CommandGump_OnCommand));
}
[Usage("CommandGump")]
[Description("Displays a gump of various admin commands")]
public static void CommandGump_OnCommand(CommandEventArgs e)
{
if(e.Mobile is PlayerMobile)
{
PlayerMobile pm = (PlayerMobile)e.Mobile;
pm.SendGump(new CommandGump(pm));
//pm.SendMessage("Is the Gump sending?");
}
}
private bool Vertical = false;
private PlayerMobile Admin;
public CommandGump(PlayerMobile pm)
: base(pm, 50, 50)
{
Admin = pm;
AddGumpLayout();
}
public override void AddGumpLayout()
{
int TotalCommands = 7;
int width;
int height;
if (!Vertical)
{
width = 650;
height = 50;
}
else
{
width = 100;
height = 400;
}
AddBackground(0, 0, width, height, 0x6DB);
string[] commands = { "teleport", "hide", "bless", "kill", "remove", "props"};
if (!Vertical)
{
for( int j = 0; j < commands.Length; j++)
{
int x = width / TotalCommands;
AddHtml( 35 + (j * x), 15, 250, 20, FormatGump( commands[j].ToString(), "#F0F8FF"), false, false);
}
for( int i = 0; i < (TotalCommands - 1); i++)
{
int space = width / TotalCommands;
AddButton(10 + (i * space), 15, 0x4B9, 0x4BA, i + 1, GumpButtonType.Reply, 0);
}
AddButton(width - 25, 15, 0x15E2, 0x15E6, 10, GumpButtonType.Reply, 0);
}
else
{
for( int j = 0; j < commands.Length; j++)
{
int y = height / TotalCommands;
AddHtml(35, 5 + (y * j), 250, 20, FormatGump( commands[j].ToString(), "#F0F8FF"), false, false);
}
for( int i = 0; i < (TotalCommands -1); i++)
{
int space = height / TotalCommands;
AddButton(10, 10 + (i * space), 0x4B9, 0x4BA, i + 1, GumpButtonType.Reply, 0);
}
AddButton(5, height - 25, 0x15E0, 0x15E4, 10, GumpButtonType.Reply, 0);
}
}
public string FormatGump(string str, string color)
{
if( color == null)
return String.Format("<div align=left>{0}</div>", str);
else
return String.Format("<BASEFONT COLOR={1}><dic align=left>{0}</div>", str, color);
}
public override void OnResponse(RelayInfo info)
{
int button = info.ButtonID;
if (button == 1)
{
//Admin.Target = new MoveTarget(Admin);
Admin.Target = new TeleTarget(Admin);
Refresh();
}
if (button == 2)
{
if (!Admin.Hidden)
Admin.Hidden = true;
else
Admin.Hidden = false;
Refresh();
}
if (button == 3)
{
if (!Admin.Blessed)
{
Admin.Blessed = true;
Admin.SendMessage("You are invulnerable.");
}
else
{
Admin.Blessed = false;
Admin.SendMessage("You are vulnerable.");
}
Refresh();
}
if (button == 4)
{
Admin.Target = new KillTarget();
Refresh();
}
if (button == 5)
{
Admin.Target = new RemoveTarget();
Refresh();
}
if (button == 6)
{
Admin.Target = new PropsTarget();
Refresh();
}
if (button == 10)
{
if (!Vertical)
Vertical = true;
else
Vertical = false;
Refresh();
}
}
private class TeleTarget : Target
{
private readonly object m_Object;
public TeleTarget(object o)
: base (-1, true, TargetFlags.None)
{
this.m_Object = o;
}
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if( p != null)
{
if (p is Item)
((Item)p).GetWorldTop();
if (this.m_Object is Mobile)
{
Mobile m = (Mobile)this.m_Object;
if (!m.Deleted)
{
m.MoveToWorld(new Point3D(p), from.Map);
from.Target = new TeleTarget(from);
var fromLoc = from.Location;
var toLoc = new Point3D(p);
from.Location = toLoc;
from.ProcessDelta();
if (!from.Hidden)
{
Effects.SendLocationParticles( EffectItem.Create(fromLoc, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
Effects.SendLocationParticles(EffectItem.Create(toLoc, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
from.PlaySound(0x1FE);
}
}
else
from.SendMessage("Invalid Mobile.");
}
}
}
}
private class KillTarget : Target
{
public KillTarget()
: base( -1, true, TargetFlags.None)
{
}
protected override void OnTarget(Mobile from, object o)
{
if ( from != null && o != null)
{
if (o is Mobile)
{
Mobile m = o as Mobile;
if (!m.Blessed)
{
m.Kill();
from.SendMessage( m.Name + " has been killed.");
}
else
from.SendMessage( m.Name + " is invulnerable.");
}
else
from.SendMessage( "That is an invalid target.");
}
}
}
private class PropsTarget : Target
{
public PropsTarget()
: base ( -1, true, TargetFlags.None)
{
}
protected override void OnTarget(Mobile from, object o)
{
if (from != null && o != null)
{
from.SendGump( new PropertiesGump(from, o));
}
}
}
private class RemoveTarget : Target
{
public RemoveTarget()
: base( -1, true, TargetFlags.None)
{
}
protected override void OnTarget(Mobile from, object o)
{
if ( from != null && o != null)
{
if (o is Mobile)
{
Mobile m = o as Mobile;
m.Delete();
from.SendMessage( "The Mobile has been deleted.");
}
else if (o is Item)
{
Item i = o as Item;
i.Delete();
from.SendMessage( "The item has been deleted.");
}
else
from.SendMessage( "That is an invalid target.");
}
}
}
}
}
+93
View File
@@ -0,0 +1,93 @@
using System;
using Server;
using Server.Commands;
using Server.Mobiles;
namespace Server.Gumps
{
public class SOSGump : BaseGump
{
public static void Initialize()
{
CommandSystem.Register("SOSGump",AccessLevel.Administrator, new CommandEventHandler(SOSGump_OnCommand));
}
[Usage("SOSGump")]
[Description("Can full heal, cure, and bless yourself")]
public static void SOSGump_OnCommand(CommandEventArgs e)
{
if(e.Mobile is PlayerMobile)
{
PlayerMobile pm = (PlayerMobile)e.Mobile;
pm.SendGump(new SOSGump(pm));
//pm.SendMessage("Is the Gump sending?");
}
}
PlayerMobile User;
public SOSGump(PlayerMobile pm)
: base(pm, 50, 50)
{
User = pm;
AddGumpLayout();
}
public override void AddGumpLayout()
{
AddBackground(0, 0, 100, 100, 0x1400);
AddButton(10, 15, 0x16CE, 0x16CD, 1, GumpButtonType.Reply, 0);
AddHtml(35, 15, 250, 20, FormatGump( "Full Heal", "#F0F8FF"), false, false);
AddButton(10, 35, 0x16CE, 0x16CD, 2, GumpButtonType.Reply, 0);
AddHtml(35, 35, 250, 20, FormatGump( "Cure", "#F0F8FF"), false, false);
AddButton(10, 55, 0x16CE, 0x16CD, 3, GumpButtonType.Reply, 0);
AddHtml(35, 55, 250, 20, FormatGump( "Bless", "#F0F8FF"), false, false);
}
public string FormatGump(string str, string color)
{
if( color == null)
return String.Format("<div align=left>{0}</div>", str);
else
return String.Format("<BASEFONT COLOR={1}><dic align=left>{0}</div>", str, color);
}
public override void OnResponse(RelayInfo info)
{
int button = info.ButtonID;
if (button == 1)
{
if (User.Hits < User.HitsMax)
{
User.Hits = User.HitsMax;
User.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
User.PlaySound(0x202);
}
Refresh();
}
if (button == 2)
{
if (User.Poison != null)
User.Poison = null;
User.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
User.PlaySound(0x1E0);
Refresh();
}
if (button == 3)
{
if (!User.Blessed)
User.Blessed = true;
else
User.Blessed = false;
Refresh();
}
}
}
}
+88
View File
@@ -0,0 +1,88 @@
using System;
namespace Server.Items
{
public class ViewEffectItem : Item
{
private int m_ItemID = 0;
private int m_Duration = 30;
private int m_Speed = 10;
private int m_Hue = 0;
private int m_RenderMode = 0;
private int m_Height = 0;
private Point3D p;
[CommandProperty(AccessLevel.GameMaster)]
public int itemID
{
get { return m_ItemID; }
set { m_ItemID = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public int Duration
{
get { return m_Duration; }
set { m_Duration = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public int Speed
{
get { return m_Speed; }
set { m_Speed = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public int effectHue
{
get { return m_Hue; }
set { m_Hue = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public int RenderMode
{
get { return m_RenderMode; }
set { m_RenderMode = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public int Height
{
get { return m_Height; }
set { m_Height = value; }
}
[Constructable]
public ViewEffectItem()
: base(0x1BC3)
{
Movable = false;
Weight = 1.0;
Visible = false;
}
public ViewEffectItem (Serial serial)
: base(serial)
{
}
public override void OnDoubleClick(Mobile from)
{
p = Location;
p.Z += m_Height;
Effects.SendLocationEffect(EffectItem.Create(p, Map, EffectItem.DefaultDuration), Map, m_ItemID, m_Duration, m_Speed, m_Hue, m_RenderMode);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}