Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,28 @@
using Server;
using System;
using Server.Mobiles;
using Server.Gumps;
namespace Server.Services.TownCryer
{
public class BaseTownCryerGump : BaseGump
{
public TownCrier Cryer { get; private set; }
public BaseTownCryerGump(PlayerMobile pm, TownCrier cryer)
: base(pm, 50, 50)
{
Cryer = cryer;
}
public override void AddGumpLayout()
{
AddPage(0);
AddBackground(0, 0, 854, 700, 0x24AE);
AddImage(156, 35, 0x266C);
AddBackground(40, 130, 770, 470, 0x2486);
}
}
}

View File

@@ -0,0 +1,105 @@
using Server;
using System;
using Server.Mobiles;
using Server.Engines.CityLoyalty;
using Server.Gumps;
namespace Server.Services.TownCryer
{
public class CreateCityEntryGump : BaseTownCryerGump
{
public TownCryerCityEntry Entry { get; set; }
public bool Edit { get; private set; }
public City City { get; private set; }
public CreateCityEntryGump(PlayerMobile pm, TownCrier cryer, City city, TownCryerCityEntry entry = null)
: base(pm, cryer)
{
Entry = entry;
City = city;
if (Entry != null)
{
Edit = true;
}
}
public override void AddGumpLayout()
{
base.AddGumpLayout();
AddHtmlLocalized(57, 155, 100, 20, 1158040, false, false); // City:
AddHtmlLocalized(110, 155, 200, 20, CityLoyaltySystem.GetCityLocalization(City), false, false);
AddHtmlLocalized(57, 185, 50, 20, 1158027, false, false); // Author:
AddLabel(110, 185, 0, Entry != null ? Entry.Author : User.Name);
AddHtmlLocalized(58, 215, 100, 20, 1158026, false, false); // Headline:
AddBackground(58, 235, 740, 20, 0x2486);
AddTextEntry(59, 235, 739, 20, 0, 1, Entry != null ? Entry.Title : "");
AddHtmlLocalized(58, 265, 150, 20, 1158028, false, false); // Body Paragraph 1:
AddBackground(58, 285, 740, 40, 0x2486);
AddTextEntry(59, 285, 739, 40, 0, 2, Entry != null ? Entry.Body : "");
AddBackground(155, 330, 20, 20, 0x2486);
AddHtmlLocalized(58, 330, 150, 20, 1158031, false, false); // Expiry (in days):
AddTextEntry(155, 330, 19, 20, 0, 3, "");
AddImage(85, 425, 0x5EF);
AddButton(40, 615, 0x601, 0x602, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(73, 615, 150, 20, 1077787, false, false); // Submit
}
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID == 1)
{
string headline = info.GetTextEntry(1).Text;
string body = info.GetTextEntry(2).Text;
string exp = info.GetTextEntry(3).Text;
int expires = Utility.ToInt32(exp);
if (Entry == null)
{
Entry = new TownCryerCityEntry(User, City, expires, headline, body);
}
else
{
Entry.Title = headline;
Entry.Body = body;
if (expires >= 1 && expires <= 14)
{
Entry.Expires = DateTime.Now + TimeSpan.FromDays(expires);
}
}
if (expires < 1 || expires > 14)
{
User.SendLocalizedMessage(1158042); // The expiry can be between 1 and 14 days. Please check your entry and try again.
}
else if (string.IsNullOrEmpty(headline) || string.IsNullOrEmpty(body) || headline.Length < 3 || body.Length < 5)
{
User.SendLocalizedMessage(1158032); // The expiry can be between 1 and 30 days. Please check your entry and try again.
}
else
{
if (!Edit)
{
TownCryerSystem.AddEntry(Entry);
}
User.SendLocalizedMessage(1158039); // Your entry has been submitted.
BaseGump.SendGump(new TownCryerGump(User, Cryer, 0, TownCryerGump.GumpCategory.City));
return;
}
Refresh();
}
}
}
}

View File

@@ -0,0 +1,111 @@
using Server;
using System;
using Server.Mobiles;
using Server.Gumps;
namespace Server.Services.TownCryer
{
public class CreateEMEntryGump : BaseTownCryerGump
{
public TownCryerModeratorEntry Entry { get; set; }
public bool Edit { get; private set; }
public CreateEMEntryGump(PlayerMobile pm, TownCrier cryer, TownCryerModeratorEntry entry = null)
: base(pm, cryer)
{
Entry = entry;
if (Entry != null)
{
Edit = true;
}
}
public override void AddGumpLayout()
{
base.AddGumpLayout();
AddHtmlLocalized(58, 150, 100, 20, 1158027, false, false); // Author:
AddLabel(105, 150, 0, String.Format("EM {0}", User.Name));
AddHtmlLocalized(58, 180, 100, 20, 1158026, false, false); // Headline:
AddBackground(58, 200, 740, 20, 0x2486);
AddTextEntry(59, 200, 739, 20, 0, 1, Entry != null ? Entry.Title : "");
AddHtmlLocalized(58, 220, 120, 20, 1158028, false, false); // Body Paragraph 1:
AddBackground(58, 240, 740, 40, 0x2486);
AddTextEntry(59, 240, 739, 40, 0, 2, Entry != null ? Entry.Body1 : "");
AddHtmlLocalized(58, 280, 120, 20, 1158029, false, false); // Body Paragraph 2:
AddBackground(58, 300, 740, 40, 0x2486);
AddTextEntry(59, 300, 739, 40, 0, 3, Entry != null ? Entry.Body2 : "");
AddHtmlLocalized(58, 340, 120, 20, 1158030, false, false); // Body Paragraph 3:
AddBackground(58, 360, 740, 40, 0x2486);
AddTextEntry(59, 360, 739, 40, 0, 4, Entry != null ? Entry.Body3 : "");
AddBackground(155, 405, 20, 20, 0x2486);
AddHtmlLocalized(58, 405, 100, 20, 1158031, false, false); // Expiry (in days):
AddTextEntry(156, 405, 19, 20, 0, 5, "");
AddImage(85, 425, 0x5EF);
AddButton(40, 615, 0x601, 0x602, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(63, 615, 150, 20, 1077787, false, false); // Submit
}
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID == 1)
{
string headline = info.GetTextEntry(1).Text;
string body1 = info.GetTextEntry(2).Text;
string body2 = info.GetTextEntry(3).Text;
string body3 = info.GetTextEntry(4).Text;
string exp = info.GetTextEntry(5).Text;
int expires = Utility.ToInt32(exp);
if (Entry == null)
{
Entry = new TownCryerModeratorEntry(User, expires, headline, body1, body2, body3);
}
else
{
Entry.Title = headline;
Entry.Body1 = body1;
Entry.Body2 = body2;
Entry.Body3 = body3;
if (expires >= 1 && expires <= 30)
{
Entry.Expires = DateTime.Now + TimeSpan.FromDays(expires);
}
}
if(expires < 1 || expires > 30)
{
User.SendLocalizedMessage(1158033); // The expiry can be between 1 and 30 days. Please check your entry and try again.
}
else if (string.IsNullOrEmpty(headline) || string.IsNullOrEmpty(body1) || headline.Length < 5 || body1.Length < 5)
{
User.SendLocalizedMessage(1158032); // You have made an illegal entry. Check your entries and try again.
}
else
{
if (!Edit)
{
TownCryerSystem.AddEntry(Entry);
}
User.SendLocalizedMessage(1158039); // Your entry has been submitted.
BaseGump.SendGump(new TownCryerGump(User, Cryer, 0, TownCryerGump.GumpCategory.EventModerator));
return;
}
Refresh();
}
}
}
}

View File

@@ -0,0 +1,201 @@
using Server;
using System;
using Server.Mobiles;
using Server.Gumps;
namespace Server.Services.TownCryer
{
public class CreateGreetingEntryGump : BaseTownCryerGump
{
public TownCryerGreetingEntry Entry { get; set; }
public bool Edit { get; private set; }
public CreateGreetingEntryGump(PlayerMobile pm, TownCrier cryer, TownCryerGreetingEntry entry = null)
: base(pm, cryer)
{
Entry = entry;
if (Entry != null)
{
Edit = true;
_Headline = Entry.Title != null ? Entry.Title.String : String.Empty;
_Body = Entry.Body1 != null ? Entry.Body1.String : String.Empty;
_Body2 = Entry.Body2 != null ? Entry.Body2 : String.Empty;
_Body3 = Entry.Body3 != null ? Entry.Body3 : String.Empty;
_Link = Entry.Link;
_LinkText = Entry.LinkText;
}
}
public override void AddGumpLayout()
{
base.AddGumpLayout();
AddHtmlLocalized(58, 140, 100, 20, 1158027, false, false); // Author:
AddLabel(105, 140, 0, String.Format("{1} {0}", User.Name, User.AccessLevel.ToString()));
AddHtmlLocalized(58, 160, 100, 20, 1158026, false, false); // Headline:
AddBackground(58, 180, 740, 20, 0x2486);
AddTextEntry(59, 180, 739, 20, 0, 1, Entry != null ? Entry.Title.ToString() : _Headline);
AddHtmlLocalized(58, 200, 120, 20, 1158028, false, false); // Body Paragraph 1:
AddBackground(58, 220, 740, 40, 0x2486);
AddTextEntry(59, 220, 739, 40, 0, 2, _Body);
AddHtmlLocalized(58, 270, 120, 20, 1158029, false, false); // Body Paragraph 2:
AddBackground(58, 290, 740, 40, 0x2486);
AddTextEntry(59, 290, 739, 40, 0, 3, _Body2);
AddHtmlLocalized(58, 340, 120, 20, 1158030, false, false); // Body Paragraph 3:
AddBackground(58, 360, 740, 40, 0x2486);
AddTextEntry(59, 360, 739, 40, 0, 4, _Body3);
AddHtml(58, 410, 250, 20, "Link:", false, false);
AddBackground(58, 430, 740, 40, 0x2486);
AddTextEntry(59, 430, 739, 40, 0, 5, _Link);
AddHtml(58, 480, 250, 20, "Link Text:", false, false);
AddBackground(58, 500, 740, 40, 0x2486);
AddTextEntry(59, 500, 739, 40, 0, 6, _LinkText);
if (!Edit)
{
AddBackground(155, 550, 20, 20, 0x2486);
AddHtmlLocalized(58, 550, 100, 20, 1158031, false, false); // Expiry (in days):
AddTextEntry(156, 550, 19, 20, 0, 7, _Expires);
}
AddButton(40, 615, 0x601, 0x602, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(63, 615, 150, 20, 1077787, false, false); // Submit
}
private void HandleText(RelayInfo info)
{
TextRelay relay = info.GetTextEntry(1);
if (relay != null && !string.IsNullOrEmpty(relay.Text))
{
_Headline = relay.Text.Trim();
}
relay = info.GetTextEntry(2);
if (relay != null && !string.IsNullOrEmpty(relay.Text))
{
_Body = relay.Text.Trim();
}
relay = info.GetTextEntry(3);
if (relay != null && !string.IsNullOrEmpty(relay.Text))
{
_Body2 = relay.Text.Trim();
}
relay = info.GetTextEntry(4);
if (relay != null && !string.IsNullOrEmpty(relay.Text))
{
_Body3 = relay.Text.Trim();
}
relay = info.GetTextEntry(5);
if (relay != null && !string.IsNullOrEmpty(relay.Text))
{
_Link = relay.Text.Trim();
}
relay = info.GetTextEntry(6);
if (relay != null && !string.IsNullOrEmpty(relay.Text))
{
_LinkText = relay.Text.Trim();
}
relay = info.GetTextEntry(7);
if (relay != null && !string.IsNullOrEmpty(relay.Text))
{
_Expires = relay.Text.Trim();
}
}
private string _Headline;
private string _Body;
private string _Body2;
private string _Body3;
private string _Expires;
private string _Link;
private string _LinkText;
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID == 1)
{
HandleText(info);
var headline = _Headline;
var body = _Body;
var body2 = _Body2;
var body3 = _Body3;
var exp = _Expires;
var link = _Link;
var linkText = _LinkText;
int expires = -1;
if (!String.IsNullOrEmpty(exp))
{
expires = Utility.ToInt32(exp);
}
if (Entry == null)
{
Entry = new TownCryerGreetingEntry(headline, body, body2, body3, expires, link, linkText, true);
}
else
{
Entry.Title = headline;
Entry.Body1 = body;
Entry.Body2 = body2;
Entry.Body3 = body3;
Entry.Link = link;
Entry.LinkText = linkText;
if (expires >= 1 && expires <= 30)
{
Entry.Expires = DateTime.Now + TimeSpan.FromDays(expires);
}
}
if(!Edit && (expires < 1 || expires > 30))
{
User.SendLocalizedMessage(1158033); // The expiry can be between 1 and 30 days. Please check your entry and try again.
}
else if (string.IsNullOrEmpty(headline) || string.IsNullOrEmpty(body) || headline.Length < 5 || body.Length < 5)
{
User.SendLocalizedMessage(1158032); // You have made an illegal entry. Check your entries and try again.
}
else
{
if (!Edit)
{
TownCryerSystem.AddEntry(Entry);
User.SendLocalizedMessage(1158039); // Your entry has been submitted.
}
else
{
User.SendMessage("Your edited entry has been submitted.");
}
return;
}
Refresh();
}
}
}
}

View File

@@ -0,0 +1,135 @@
using Server;
using System;
using Server.Mobiles;
using Server.Gumps;
namespace Server.Services.TownCryer
{
public class CreateGuildEntryGump : BaseTownCryerGump
{
public TownCryerGuildEntry Entry { get; set; }
public bool Edit { get; private set; }
public CreateGuildEntryGump(PlayerMobile pm, TownCrier cryer, TownCryerGuildEntry entry = null)
: base(pm, cryer)
{
Entry = entry;
if (Entry != null)
{
Edit = true;
}
}
public override void AddGumpLayout()
{
base.AddGumpLayout();
AddHtmlLocalized(58, 150, 100, 20, 1158027, false, false); // Author:
AddLabel(105, 150, 0, String.Format("{0}", Entry != null ? Entry.Author : User.Name));
AddHtmlLocalized(58, 170, 100, 20, 1158055, false, false); // Guild:
AddLabel(105, 170, 0, Entry != null && Entry.Guild != null ? Entry.Guild.Name : "Unknown");
AddHtmlLocalized(58, 190, 100, 20, 1158026, false, false); // Headline:
AddBackground(58, 210, 740, 20, 0x2486);
AddTextEntry(59, 210, 739, 20, 0, 1, Entry != null ? Entry.Title : "");
AddBackground(138, 240, 20, 20, 0x2486);
AddHtmlLocalized(58, 240, 100, 20, 1158056, false, false); // Event Month:
AddTextEntry(139, 240, 19, 20, 0, 2, Entry != null ? Entry.EventTime.Month.ToString() : "", 2);
AddBackground(323, 240, 20, 20, 0x2486);
AddHtmlLocalized(258, 240, 150, 20, 1158057, false, false); // Event Day:
AddTextEntry(324, 240, 19, 20, 0, 3, Entry != null ? Entry.EventTime.Day.ToString() : "", 2);
AddBackground(529, 240, 20, 20, 0x2486);
AddHtmlLocalized(458, 240, 150, 20, 1158058, false, false); // Event Time:
AddTextEntry(530, 240, 19, 20, 0, 4, Entry != null ? Entry.EventTime.Hour.ToString() : "", 2);
AddHtmlLocalized(58, 260, 150, 20, 1158059, false, false); // Event Timezone:
AddLabel(155, 260, 0, TimeZoneInfo.Local.StandardName);
AddHtmlLocalized(58, 290, 150, 20, 1158060, false, false); // Event Description:
AddBackground(58, 310, 740, 40, 0x2486);
AddTextEntry(59, 310, 739, 40, 0, 5, Entry != null ? Entry.Body : "");
AddHtmlLocalized(58, 370, 150, 20, 1158061, false, false); // Event Meeting Place:
AddBackground(58, 390, 740, 40, 0x2486);
AddTextEntry(59, 390, 739, 40, 0, 6, Entry != null ? Entry.EventLocation : "");
AddImage(85, 425, 0x5EF);
AddButton(40, 615, 0x601, 0x602, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(73, 615, 150, 20, 1077787, false, false); // Submit
}
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID == 1)
{
string headline = info.GetTextEntry(1).Text;
string m = info.GetTextEntry(2).Text;
string d = info.GetTextEntry(3).Text;
string t = info.GetTextEntry(4).Text;
string desc = info.GetTextEntry(5).Text;
string meet = info.GetTextEntry(6).Text;
DateTime dt = DateTime.Now;
bool illegalDate = false;
int year = dt.Year;
if (Utility.ToInt32(m) < DateTime.Now.Month)
{
year++;
}
if (Entry == null)
{
if (!DateTime.TryParse(String.Format("{0}/{1}/{2} {3}:00:00", m, d, year.ToString(), t), out dt)) // bad format
{
illegalDate = true;
dt = DateTime.MinValue;
}
Entry = new TownCryerGuildEntry(User, dt, meet, headline, desc);
}
else
{
Entry.Title = headline;
Entry.Body = desc;
Entry.EventLocation = meet;
if (DateTime.TryParse(String.Format("{0}/{1}/{2} {3}:00:00", m, d, year.ToString(), t), out dt))
{
Entry.EventTime = dt;
}
}
if (string.IsNullOrEmpty(headline) || string.IsNullOrEmpty(desc) || string.IsNullOrEmpty(meet))
{
User.SendLocalizedMessage(1158062); // All fields must be populated. Please check your entries and try again.
}
else if (illegalDate)
{
User.SendLocalizedMessage(1158032); // You have made an illegal entry. Check your entries and try again.
}
else
{
if (!Edit)
{
TownCryerSystem.AddEntry(Entry);
}
User.SendLocalizedMessage(1158039); // Your entry has been submitted.
BaseGump.SendGump(new TownCryerGump(User, Cryer, 0, TownCryerGump.GumpCategory.Guild));
return;
}
Refresh();
}
}
}
}

View File

@@ -0,0 +1,41 @@
using Server;
using System;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Gumps;
namespace Server.Services.TownCryer
{
public class TownCryerCityGump : BaseTownCryerGump
{
public TownCryerCityEntry Entry { get; private set; }
public TownCryerCityGump(PlayerMobile pm, TownCrier cryer, TownCryerCityEntry entry)
: base(pm, cryer)
{
Entry = entry;
}
public override void AddGumpLayout()
{
base.AddGumpLayout();
AddHtml(57, 155, 724, 20, Entry.Title, false, false);
AddHtmlLocalized(57, 180, 724, 20, 1154760, Entry.Author, 0, false, false); // By: ~1_NAME~
AddHtml(57, 215, 724, 205, Entry.Body, false, false);
AddImage(85, 425, 0x5EF);
}
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID == 0)
{
var gump = new TownCryerGump(User, Cryer);
gump.Category = TownCryerGump.GumpCategory.City;
BaseGump.SendGump(gump);
}
}
}
}

View File

@@ -0,0 +1,63 @@
using Server;
using System;
using System.Linq;
using Server.Mobiles;
using Server.Gumps;
using Server.Engines.Quests;
namespace Server.Services.TownCryer
{
public class TownCrierQuestCompleteGump : BaseGump
{
public object Title { get; set; }
public object Body { get; set; }
public int GumpID { get; set; }
public TownCrierQuestCompleteGump(PlayerMobile pm, object title, object body, int id)
: base(pm, 10, 100)
{
Title = title;
Body = body;
GumpID = id;
}
public TownCrierQuestCompleteGump(PlayerMobile pm, BaseQuest quest)
: base(pm, 10, 100)
{
Title = quest.Title;
Body = quest.Complete;
var entry = TownCryerSystem.NewsEntries.FirstOrDefault(e => e.QuestType == quest.GetType());
if (entry != null)
{
GumpID = entry.GumpImage;
}
}
public override void AddGumpLayout()
{
AddBackground(0, 0, 454, 540, 9380);
AddImage(62, 42, GumpID);
if (Title is int)
{
AddHtmlLocalized(0, 392, 454, 20, CenterLoc, String.Format("#{0}", (int)Title), 0, false, false);
}
else if (Title is string)
{
AddHtml(0, 392, 454, 20, Center((string)Title), false, false);
}
if (Body is int)
{
AddHtmlLocalized(27, 417, 390, 73, (int)Body, C32216(0x080808), false, true);
}
else if (Body is string)
{
AddHtml(27, 417, 390, 73, (string)Body, false, true);
}
}
}
}

View File

@@ -0,0 +1,43 @@
using Server;
using System;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Gumps;
namespace Server.Services.TownCryer
{
public class TownCryerEventModeratorGump : BaseTownCryerGump
{
public TownCryerModeratorEntry Entry { get; private set; }
public TownCryerEventModeratorGump(PlayerMobile pm, TownCrier cryer, TownCryerModeratorEntry entry)
: base(pm, cryer)
{
Entry = entry;
}
public override void AddGumpLayout()
{
base.AddGumpLayout();
AddHtml(58, 150, 724, 20, Entry.Title, false, false);
AddHtmlLocalized(58, 180, 724, 20, 1154760, Entry.ModeratorName, 0, false, false); // By: ~1_NAME~
AddHtml(58, 215, 724, 205, Entry.Body1, false, false);
AddHtml(58, 280, 724, 205, Entry.Body2, false, false);
AddHtml(58, 345, 724, 205, Entry.Body3, false, false);
AddImage(85, 425, 0x5EF);
}
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID == 0)
{
var gump = new TownCryerGump(User, Cryer);
gump.Category = TownCryerGump.GumpCategory.EventModerator;
BaseGump.SendGump(gump);
}
}
}
}

View File

@@ -0,0 +1,188 @@
using Server;
using System;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Engines.Quests;
using Server.Gumps;
namespace Server.Services.TownCryer
{
public class TownCryerGreetingsGump : BaseTownCryerGump
{
public int Page { get; private set; }
public int Pages { get { return TownCryerSystem.GreetingsEntries.Count; } }
public TownCryerGreetingEntry Entry { get; private set; }
public TownCryerGreetingsGump(PlayerMobile pm, TownCrier cryer, int page = 0)
: base(pm, cryer)
{
Page = page;
}
public override void AddGumpLayout()
{
base.AddGumpLayout();
var list = new List<TownCryerGreetingEntry>(TownCryerSystem.GreetingsEntries);
list.Sort();
Entry = list[0];
if (Page >= 0 && Page < list.Count)
{
Entry = list[Page];
}
int y = 150;
if (Entry.Title != null)
{
if (Entry.Title.Number > 0)
{
AddHtmlLocalized(78, y, 700, 400, Entry.Title.Number, false, false);
}
else
{
AddHtml(78, y, 700, 400, Entry.Title.ToString(), false, false);
}
y += 40;
}
// For now, we're only supporting a cliloc (hard coded greetings per EA) or string (Custom) entries. Not both.
// Html tags will needed to be added when creating the entry, this will not auto format it for you.
if (Entry.Body1.Number > 0)
{
AddHtmlLocalized(78, y, 700, 400, Entry.Body1.Number, false, false);
}
else if (!String.IsNullOrEmpty(Entry.Body1.String))
{
var str = Entry.Body1.String;
if (!String.IsNullOrEmpty(Entry.Body2))
{
if (!str.EndsWith("<br>"))
{
str += " ";
}
str += Entry.Body2;
}
if (!String.IsNullOrEmpty(Entry.Body3))
{
if (!str.EndsWith("<br>"))
{
str += " ";
}
str += Entry.Body3;
}
AddHtml(78, y, 700, 400, str, false, false);
}
if (Entry.Expires != DateTime.MinValue)
{
AddHtmlLocalized(50, 550, 200, 20, 1060658, String.Format("{0}\t{1}", "Created", Entry.Created.ToShortDateString()), 0, false, false);
AddHtmlLocalized(50, 570, 200, 20, 1060659, String.Format("{0}\t{1}", "Expires", Entry.Expires.ToShortDateString()), 0, false, false);
}
AddButton(350, 570, 0x605, 0x606, 1, GumpButtonType.Reply, 0);
AddButton(380, 570, 0x609, 0x60A, 2, GumpButtonType.Reply, 0);
AddButton(430, 570, 0x607, 0x608, 3, GumpButtonType.Reply, 0);
AddButton(455, 570, 0x603, 0x604, 4, GumpButtonType.Reply, 0);
AddHtml(395, 570, 35, 20, Center(String.Format("{0}/{1}", (Page + 1).ToString(), Pages.ToString())), false, false);
AddButton(525, 625, 0x5FF, 0x600, 5, GumpButtonType.Reply, 0);
AddHtmlLocalized(550, 625, 300, 20, 1158386, false, false); // Close and do not show this version again
if (Entry.Link != null)
{
if (!string.IsNullOrEmpty(Entry.LinkText))
{
AddHtml(50, 490, 745, 40, String.Format("<a href=\"{0}\">{1}</a>", Entry.Link, Entry.LinkText), false, false);
}
else
{
AddHtml(50, 490, 745, 40, String.Format("<a href=\"{0}\">{1}</a>", Entry.Link, Entry.Link), false, false);
}
}
/*if (TownCryerSystem.HasCustomEntries())
{
AddButton(40, 615, 0x603, 0x604, 6, GumpButtonType.Reply, 0);
AddHtmlLocalized(68, 615, 300, 20, 1060660, String.Format("{0}\t{1}", "Sort By", Sort.ToString()), 0, false, false);
}*/
if (User.AccessLevel >= AccessLevel.Administrator)
{
if (Entry.CanEdit)
{
AddButton(40, 601, 0x603, 0x604, 7, GumpButtonType.Reply, 0);
AddHtml(68, 601, 300, 20, "Edit Greeting", false, false);
}
AddButton(40, 623, 0x603, 0x604, 8, GumpButtonType.Reply, 0);
AddHtml(68, 623, 300, 20, "New Greeting", false, false);
AddButton(40, 645, 0x603, 0x604, 9, GumpButtonType.Reply, 0);
AddHtml(68, 645, 300, 20, "Entry Props", false, false);
}
ColUtility.Free(list);
}
public override void OnResponse(RelayInfo info)
{
int button = info.ButtonID;
switch (button)
{
case 0: break;
case 1: // <<
Page = 0;
Refresh();
break;
case 2: // <
Page = Math.Max(0, Page - 1);
Refresh();
break;
case 3: // >
Page = Math.Min(Pages - 1, Page + 1);
Refresh();
break;
case 4: // >>
Page = Pages - 1;
Refresh();
break;
case 5: // No Show
TownCryerSystem.AddExempt(User);
break;
case 7:
if (Entry != null)
{
BaseGump.SendGump(new CreateGreetingEntryGump(User, Cryer, Entry));
}
else
{
Refresh();
}
break;
case 8:
BaseGump.SendGump(new CreateGreetingEntryGump(User, Cryer));
break;
case 9:
Refresh();
if (Entry != null)
{
User.SendGump(new PropertiesGump(User, Entry));
}
break;
}
}
}
}

View File

@@ -0,0 +1,57 @@
using Server;
using System;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Guilds;
using Server.Gumps;
namespace Server.Services.TownCryer
{
public class TownCryerGuildGump : BaseTownCryerGump
{
public TownCryerGuildEntry Entry { get; private set; }
public TownCryerGuildGump(PlayerMobile pm, TownCrier cryer, TownCryerGuildEntry entry)
: base(pm, cryer)
{
Entry = entry;
}
public override void AddGumpLayout()
{
base.AddGumpLayout();
AddHtml(57, 155, 724, 20, Entry.Title, false, false);
AddHtmlLocalized(57, 180, 724, 20, 1158066, String.Format("{0}, {1}", Entry.Author, Entry.Guild.Name), 0, false, false); // Posted By: ~1_NAME~
AddHtmlLocalized(57, 215, 50, 20, 1158067, false, false); // When:
AddHtmlLocalized(57, 235, 50, 20, 1158068, false, false); // Where:
int time = Entry.EventTime.Hour;
AddLabel(102, 215, 0, String.Format("{0}-{1}-{2} {3}{4} {5}",
Entry.EventTime.Month,
Entry.EventTime.Day,
Entry.EventTime.Year,
time == 0 ? 12 : time > 12 ? time - 12 : time,
Entry.EventTime.Hour >= 12 ? "pm" : "am",
TimeZoneInfo.Local.StandardName));
AddLabel(102, 235, 0, Entry.EventLocation);
AddHtml(57, 270, 724, 205, Entry.Body, false, false);
AddImage(85, 425, 0x5EF);
}
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID == 0)
{
var gump = new TownCryerGump(User, Cryer);
gump.Category = TownCryerGump.GumpCategory.Guild;
BaseGump.SendGump(gump);
}
}
}
}

View File

@@ -0,0 +1,477 @@
using Server;
using System;
using System.Linq;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Engines.CityLoyalty;
using Server.Gumps;
using Server.Guilds;
using Server.Engines.Quests;
namespace Server.Services.TownCryer
{
public class TownCryerGump : BaseTownCryerGump
{
public enum GumpCategory
{
News = 1,
EventModerator,
City,
Guild
}
private City _City;
public GumpCategory Category { get; set; }
public int Page { get; set; }
public int Pages { get; set; }
public City City
{
get { return _City; }
set
{
var city = _City;
if (city != value)
{
_City = value;
SetDefaultCity();
}
}
}
public static Dictionary<PlayerMobile, City> LastCity { get; private set; }
public TownCryerGump(PlayerMobile pm, TownCrier tc, int page = 0, GumpCategory Cartegory = GumpCategory.News)
: base(pm, tc)
{
Page = page;
Category = GumpCategory.News;
SetDefaultCity();
}
public override void AddGumpLayout()
{
base.AddGumpLayout();
switch (Category)
{
case GumpCategory.News:
BuildNewsPage();
break;
case GumpCategory.EventModerator:
BuildEMPage();
break;
case GumpCategory.City:
BuildCityPage();
break;
case GumpCategory.Guild:
BuildGuildPage();
break;
}
AddButton(275, 598, Category == GumpCategory.News ? 0x5F6 : 0x5F5, 0x5F6, 1, GumpButtonType.Reply, 0);
AddButton(355, 598, Category == GumpCategory.EventModerator ? 0x5F4 : 0x5F3, 0x5F4, 2, GumpButtonType.Reply, 0);
AddButton(435, 598, Category == GumpCategory.City ? 0x5F8 : 0x5F7, 0x5F8, 3, GumpButtonType.Reply, 0);
AddButton(515, 598, Category == GumpCategory.Guild ? 0x5F2 : 0x5F1, 0x5F2, 4, GumpButtonType.Reply, 0);
}
private void BuildNewsPage()
{
int perPage = 20;
int y = 170;
int start = Page * perPage;
Pages = (int)Math.Ceiling((double)TownCryerSystem.NewsEntries.Count / (double)perPage);
for (int i = start; i < TownCryerSystem.NewsEntries.Count && i < perPage; i++)
{
var entry = TownCryerSystem.NewsEntries[i];
AddButton(50, y, 0x5FB, 0x5FC, 100 + i, GumpButtonType.Reply, 0);
bool doneQuest = entry.QuestType != null && QuestHelper.CheckDoneOnce(User, entry.QuestType, Cryer, false);
if (entry.Title.Number > 0)
{
AddHtmlLocalized(87, y, 700, 20, entry.Title.Number, doneQuest ? C32216(0x696969) : 0, false, false);
}
else
{
AddLabelCropped(87, y, 700, 20, doneQuest ? 0x3B2 : 0, entry.Title);
}
y += 23;
}
if (TownCryerSystem.NewsEntries.Count > perPage)
{
AddButton(350, 570, 0x605, 0x606, 5, GumpButtonType.Reply, 0);
AddButton(380, 570, 0x609, 0x60A, 6, GumpButtonType.Reply, 0);
AddButton(430, 570, 0x607, 0x608, 7, GumpButtonType.Reply, 0);
AddButton(455, 570, 0x603, 0x604, 8, GumpButtonType.Reply, 0);
AddHtml(395, 570, 35, 20, Center(String.Format("{0}/{1}", (Page + 1).ToString(), (Pages + 1).ToString())), false, false);
}
}
private void BuildEMPage()
{
int perPage = 15;
AddPage(1);
int y = 170;
for (int i = 0; i < TownCryerSystem.ModeratorEntries.Count && i < perPage; i++)
{
var entry = TownCryerSystem.ModeratorEntries[i];
AddButton(50, y, 0x5FB, 0x5FC, 200 + i, GumpButtonType.Reply, 0);
AddLabelCropped(87, y, 631, 20, 0, entry.Title);
if (User.AccessLevel > AccessLevel.Player) // Couselors+ can moderate events
{
AddButton(735, y, 0x5FD, 0x5FE, 2000 + i, GumpButtonType.Reply, 0);
AddButton(760, y, 0x5FF, 0x600, 2500 + i, GumpButtonType.Reply, 0);
}
y += 23;
}
AddButton(320, 525, 0x627, 0x628, 9, GumpButtonType.Reply, 0);
}
private void BuildCityPage()
{
AddButton(233, 150, City == City.Britain ? 0x5E5 : 0x5E4, City == City.Britain ? 0x5E5 : 0x5E4, 10, GumpButtonType.Reply, 0);
AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Britain));
AddButton(280, 150, City == City.Jhelom ? 0x5E7 : 0x5E6, City == City.Jhelom ? 0x5E7 : 0x5E6, 11, GumpButtonType.Reply, 0);
AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Jhelom));
AddButton(327, 150, City == City.Minoc ? 0x5E5 : 0x5E4, City == City.Minoc ? 0x5E5 : 0x5E4, 12, GumpButtonType.Reply, 0);
AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Minoc));
AddButton(374, 150, City == City.Moonglow ? 0x5E3 : 0x5E2, City == City.Moonglow ? 0x5E3 : 0x5E2, 13, GumpButtonType.Reply, 0);
AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Moonglow));
AddButton(418, 150, City == City.NewMagincia ? 0x5DD : 0x5DC, City == City.NewMagincia ? 0x5DD : 0x5DC, 14, GumpButtonType.Reply, 0);
AddTooltip(CityLoyaltySystem.GetCityLocalization(City.NewMagincia));
AddButton(463, 150, City == City.SkaraBrae ? 0x5DF : 0x5DE, City == City.SkaraBrae ? 0x5DF : 0x5DE, 15, GumpButtonType.Reply, 0);
AddTooltip(CityLoyaltySystem.GetCityLocalization(City.SkaraBrae));
AddButton(509, 150, City == City.Trinsic ? 0x5E1 : 0x5E0, City == City.Trinsic ? 0x5E1 : 0x5E0, 16, GumpButtonType.Reply, 0);
AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Trinsic));
AddButton(555, 150, City == City.Vesper ? 0x5ED : 0x5ED, City == City.Vesper ? 0x5ED : 0x5EC, 17, GumpButtonType.Reply, 0);
AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Vesper));
AddButton(601, 150, City == City.Yew ? 0x5E9 : 0x5E8, City == City.Yew ? 0x5E9 : 0x5E8, 18, GumpButtonType.Reply, 0);
AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Yew));
AddHtmlLocalized(0, 260, 854, 20, CenterLoc, String.Format("#{0}", TownCryerSystem.GetCityLoc(this.City)), 0, false, false); // The Latest News from the City of ~1_CITY~
int y = 300;
for (int i = 0; i < TownCryerSystem.CityEntries.Count && i < TownCryerSystem.MaxPerCityGoverrnorEntries; i++)
{
var entry = TownCryerSystem.CityEntries[i];
if (entry.City != this.City)
continue;
AddButton(50, y, 0x5FB, 0x5FC, 300 + i, GumpButtonType.Reply, 0);
AddLabelCropped(87, y, 700, 20, 0, entry.Title);
var city = CityLoyaltySystem.GetCitizenship(User, false);
if ((city != null && city.Governor == User) || User.AccessLevel >= AccessLevel.GameMaster) // Only Governors
{
AddButton(735, y, 0x5FD, 0x5FE, 3000 + i, GumpButtonType.Reply, 0);
AddButton(760, y, 0x5FF, 0x600, 3500 + i, GumpButtonType.Reply, 0);
}
y += 23;
}
AddImage(230, 460, 0x5F0);
}
private void BuildGuildPage()
{
var list = TownCryerSystem.GuildEntries.OrderBy(e => e.EventTime).ToList();
int perPage = 20;
int y = 170;
int start = Page * perPage;
var guild = User.Guild as Guild;
Pages = (int)Math.Ceiling((double)list.Count / (double)perPage);
for (int i = start; i < list.Count && i < perPage; i++)
{
var entry = TownCryerSystem.GuildEntries[i];
AddButton(50, y, 0x5FB, 0x5FC, 400 + TownCryerSystem.GuildEntries.IndexOf(entry), GumpButtonType.Reply, 0);
AddLabelCropped(87, y, 700, 20, 0, entry.FullTitle);
if ((guild == entry.Guild && User.GuildRank != null && User.GuildRank.Rank >= 3) || User.AccessLevel >= AccessLevel.GameMaster) // Only warlords+
{
int index = TownCryerSystem.GuildEntries.IndexOf(entry);
AddButton(735, y, 0x5FD, 0x5FE, 4000 + index, GumpButtonType.Reply, 0);
AddButton(760, y, 0x5FF, 0x600, 4500 + index, GumpButtonType.Reply, 0);
}
y += 23;
}
AddButton(350, 570, 0x605, 0x606, 5, GumpButtonType.Reply, 0);
AddButton(380, 570, 0x609, 0x60A, 6, GumpButtonType.Reply, 0);
AddButton(430, 570, 0x607, 0x608, 7, GumpButtonType.Reply, 0);
AddButton(455, 570, 0x603, 0x604, 8, GumpButtonType.Reply, 0);
AddHtml(395, 570, 35, 20, Center(String.Format("{0}/{1}", (Page + 1).ToString(), (Pages + 1).ToString())), false, false);
}
private void SetDefaultCity()
{
if (LastCity == null || !LastCity.ContainsKey(User))
{
LastCity = new Dictionary<PlayerMobile, City>();
var system = CityLoyaltySystem.GetCitizenship(User, false);
if (system != null)
{
LastCity[User] = system.City;
}
}
else
{
LastCity[User] = _City;
}
}
public override void OnResponse(RelayInfo info)
{
int id = info.ButtonID;
switch (id)
{
case 0: break;
case 1:
case 2:
case 3:
case 4:
{
Category = (GumpCategory)id;
Refresh();
break;
}
case 5: // <<
{
Page = 0;
Refresh();
break;
}
case 6: // <
{
Page = Math.Max(0, Page - 1);
Refresh();
break;
}
case 7: // >
{
Page = Math.Min(Pages, Page + 1);
Refresh();
break;
}
case 8: // >>
{
Page = Pages;
Refresh();
break;
}
case 9: // Learn More - EM Page
{
User.LaunchBrowser(TownCryerSystem.EMEventsPage);
Refresh();
break;
}
case 10:
{
City = City.Britain;
Refresh();
break;
}
case 11:
{
City = City.Jhelom;
Refresh();
break;
}
case 12:
{
City = City.Minoc;
Refresh();
break;
}
case 13:
{
City = City.Moonglow;
Refresh();
break;
}
case 14:
{
City = City.NewMagincia;
Refresh();
break;
}
case 15:
{
City = City.SkaraBrae;
Refresh();
break;
}
case 16:
{
City = City.Trinsic;
Refresh();
break;
}
case 17:
{
City = City.Vesper;
Refresh();
break;
}
case 18:
{
City = City.Yew;
Refresh();
break;
}
default:
{
if (id < 200)
{
id -= 100;
if (id >= 0 && id < TownCryerSystem.NewsEntries.Count)
{
BaseGump.SendGump(new TownCryerNewsGump(User, Cryer, TownCryerSystem.NewsEntries[id]));
}
}
else if (id < 300)
{
id -= 200;
if (id >= 0 && id < TownCryerSystem.ModeratorEntries.Count)
{
BaseGump.SendGump(new TownCryerEventModeratorGump(User, Cryer, TownCryerSystem.ModeratorEntries[id]));
}
}
else if (id < 400)
{
id -= 300;
if (id >= 0 && id < TownCryerSystem.CityEntries.Count)
{
BaseGump.SendGump(new TownCryerCityGump(User, Cryer, TownCryerSystem.CityEntries[id]));
}
}
else if (id < 600)
{
id -= 400;
if (id >= 0 && id < TownCryerSystem.GuildEntries.Count)
{
BaseGump.SendGump(new TownCryerGuildGump(User, Cryer, TownCryerSystem.GuildEntries[id]));
}
}
else if (id < 3000)
{
if (id < 2500)
{
id -= 2000;
if (id >= 0 && id < TownCryerSystem.ModeratorEntries.Count)
{
BaseGump.SendGump(new CreateEMEntryGump(User, Cryer, TownCryerSystem.ModeratorEntries[id]));
}
}
else
{
id -= 2500;
if (id >= 0 && id < TownCryerSystem.ModeratorEntries.Count)
{
TownCryerSystem.ModeratorEntries.RemoveAt(id);
}
Refresh();
}
}
else if (id < 4000)
{
var city = CityLoyaltySystem.GetCitizenship(User, false);
if ((city != null && city.Governor == User) || User.AccessLevel >= AccessLevel.GameMaster) // Only Governors
{
if (id < 3500)
{
id -= 3000;
if (id >= 0 && id < TownCryerSystem.CityEntries.Count)
{
BaseGump.SendGump(new CreateCityEntryGump(User, Cryer, City, TownCryerSystem.CityEntries[id]));
}
}
else
{
id -= 3500;
if (id >= 0 && id < TownCryerSystem.CityEntries.Count)
{
TownCryerSystem.CityEntries.RemoveAt(id);
}
}
}
Refresh();
}
else if (id < 5000)
{
if (id < 4500)
{
id -= 4000;
if (id >= 0 && id < TownCryerSystem.GuildEntries.Count)
{
BaseGump.SendGump(new CreateGuildEntryGump(User, Cryer, TownCryerSystem.GuildEntries[id]));
}
}
else
{
id -= 4500;
if (id >= 0 && id < TownCryerSystem.GuildEntries.Count)
{
TownCryerSystem.GuildEntries.RemoveAt(id);
}
Refresh();
}
}
}
break;
}
}
}
}

View File

@@ -0,0 +1,88 @@
using Server;
using System;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Engines.Quests;
using Server.Gumps;
namespace Server.Services.TownCryer
{
public class TownCryerNewsGump : BaseTownCryerGump
{
public TownCryerNewsEntry Entry { get; private set; }
public TownCryerNewsGump(PlayerMobile pm, TownCrier cryer, TownCryerNewsEntry entry)
: base(pm, cryer)
{
Entry = entry;
}
public override void AddGumpLayout()
{
base.AddGumpLayout();
//AddPage(1);
//AddImageTiled(58, 213, 397, 271, 0x24B2);
if (Entry.Body.Number > 0)
{
AddHtmlLocalized(58, 213, 397, 271, Entry.Body.Number, C32216(0x080808), false, true);
}
else
{
AddHtml(58, 213, 397, 271, Color("#080808", Entry.Body.String), false, true);
}
AddHtmlLocalized(0, 150, 854, 20, CenterLoc, Entry.Title.ToString(), 0, false, false);
AddHtmlLocalized(0, 180, 854, 20, CenterLoc, "#1158084", 0, false, false); // The Town Cryer News Network
AddImage(468, 213, Entry.GumpImage);
AddImage(50, 532, 0x60C);
if (!String.IsNullOrEmpty(Entry.InfoUrl))
{
AddButton(147, 600, 0x627, 0x628, 1, GumpButtonType.Reply, 0);
}
if (Entry.QuestType != null)
{
AddButton(545, 600, 0x629, 0x62A, 2, GumpButtonType.Reply, 0);
}
}
public override void OnResponse(RelayInfo info)
{
switch (info.ButtonID)
{
case 0:
var gump = new TownCryerGump(User, Cryer);
gump.Category = TownCryerGump.GumpCategory.News;
BaseGump.SendGump(gump);
break;
case 1:
User.LaunchBrowser(Entry.InfoUrl);
Refresh();
break;
case 2:
if (QuestHelper.HasQuest(User, Entry.QuestType))
{
Cryer.SayTo(User, 1080107, 1150); // I'm sorry, I have nothing for you at this time.
}
else
{
BaseQuest quest = QuestHelper.Construct(Entry.QuestType) as BaseQuest;
if (quest != null && (!QuestHelper.CheckDoneOnce(User, quest, Cryer, true) || User.AccessLevel > AccessLevel.Player))
{
quest.Owner = User;
quest.Quester = Cryer;
User.CloseGump(typeof(MondainQuestGump));
User.SendGump(new MondainQuestGump(quest));
}
}
break;
}
}
}
}