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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,645 @@
using System;
using System.Collections;
using Server;
using Server.HuePickers;
using Server.Gumps;
using Knives.Utils;
namespace Knives.Chat3
{
public class FriendsGump : GumpPlus
{
public static void SendTo(Mobile m)
{
SendTo(m, false);
}
public static void SendTo(Mobile m, bool min)
{
General.ClearGump(m, typeof(FriendsGump));
new FriendsGump(m, min);
}
#region Class Definitions
private int c_Page, c_Height, c_Width;
private Mobile c_Profile;
private bool c_Minimized, c_Options, c_Search;
private string c_TxtSearch, c_CharSearch;
public Data GetData { get { return Data.GetData(Owner); } }
#endregion
#region Constructors
public FriendsGump(Mobile m, bool min) : base(m, 250, 50)
{
c_Minimized = min;
if (c_Minimized)
Override = false;
c_Page = 0;
c_TxtSearch = "";
c_CharSearch = "";
NewGump();
}
#endregion
#region Methods
protected override void BuildGump()
{
Owner.CloseGump(typeof(FriendsGump));
c_Height = 80 + (GetData.FriendsPP * 20);
c_Width = 160;
if (c_Minimized)
AddImage(0, 0, 0x9C5);
else
AddBackground(0, 0, c_Width, c_Height, 0x1400);
AddButton(0, 0, 0x13A8, 0x13A8, "Minimize", new TimerCallback(Minimize));
if ( c_Minimized )
AddLabel(1, -3, 0x47E, "^");
else
AddLabel(2, -9, 0x47E, "_");
if (c_Minimized)
DisplayMin();
else
DisplayList();
}
private void DisplayMin()
{
AddHtml(60, 1, 80, 21, HTML.White + General.Local(19 + (int)GetData.Status), false, false, false);
AddButton(42, 5, 0x2716, 0x2716, "Status", new TimerCallback(Status));
if (GetData.NewMsg())
AddButton(20, 2, 0x1523, 0x1523, "Check Message", new TimerCallback(CheckMsg));
}
private ArrayList BuildList()
{
ArrayList list = new ArrayList();
if (c_TxtSearch == "" && c_CharSearch == "")
{
list = new ArrayList( GetData.Friends );
foreach( Message msg in GetData.Messages )
if (!msg.Read && !list.Contains(msg.From))
list.Add(msg.From);
list.Sort(new InternalSort(GetData));
return list;
}
foreach( Mobile m in GetData.Friends )
if( m.Name.ToLower().IndexOf(c_TxtSearch.ToLower()) != -1 || m.Name.ToLower().IndexOf(c_CharSearch.ToLower()) == 0 )
list.Add(m);
list.Sort(new InternalSort(GetData));
return list;
}
private void DisplayList()
{
if (c_Profile != null && !GetData.Friends.Contains(c_Profile))
c_Profile = null;
if (c_Profile != null)
Chat3.Profile.Insert(c_Profile, this, c_Width+20, 0);
if (c_Search)
SearchTab();
if (c_Options)
OptionsTab();
ArrayList list = BuildList();
int perpage = GetData.FriendsPP;
int y = 10;
if ( perpage*c_Page > list.Count || c_Page < 0 )
c_Page = 0;
AddImage(8, y - 1, 0x9C5);
AddHtml(10, y, c_Width - 20, 21, HTML.White + "<CENTER>" + General.Local(32), false, false, false);
y += 20;
if (perpage*(c_Page+1) < list.Count)
AddButton(c_Width / 2 - 10, c_Height - 25, 0x25E8, 0x25E9, "Page Up", new TimerCallback(PageUp));
if (c_Page != 0)
AddButton(c_Width/2-10, 30, 0x25E4, 0x25E5, "Page Down", new TimerCallback(PageDown));
AddButton(10, 32, 0x983, 0x983, "PerPage Down", new TimerCallback(PerPageDown));
AddButton(20, 32, 0x985, 0x985, "PerPage Up", new TimerCallback(PerPageUp));
AddButton(6, c_Height - 30, 0x768, 0x768, "Options", new TimerCallback(Options));
AddButton(22, c_Height - 30, 0x768, 0x768, "Search", new TimerCallback(Search));
AddLabel(11, c_Height - 30, c_Options ? 0x34 : 0x47E, "O");
AddLabel(27, c_Height - 30, c_Search ? 0x34 : 0x47E, "S");
AddHtml(c_Width-53, c_Height-29, 80, 21, HTML.White + General.Local(19+(int)GetData.Status), false, false);
AddButton(c_Width-70, c_Height-26, 0x2716, 0x2716, "Status", new TimerCallback(Status));
try
{
for (int i = perpage * c_Page; i < list.Count && i < perpage * (c_Page + 1); ++i)
{
AddHtml(45, y += 20, 90, 21, HTML.White + ((Mobile)list[i]).Name + (Data.GetData((Mobile)list[i]).Status != OnlineStatus.Online ? " (" + General.Local(19 + (int)Data.GetData((Mobile)list[i]).Status) + ")" : ""), false, false, false);
AddButton(30, y + 3, list[i] == c_Profile ? 0x939 : 0x2716, list[i] == c_Profile ? 0x939 : 0x2716, "Profile", new TimerStateCallback(Profile), (Mobile)list[i]);
if (GetData.NewMsgFrom((Mobile)list[i]))
AddButton(10, y, 0x1523, 0x1523, "Check Message From", new TimerStateCallback(CheckMsgFrom), (Mobile)list[i]);
}
}
catch
{
AddHtml(45, y += 20, 80, 21, HTML.White + "!!!", false, false);
}
}
private void SearchTab()
{
AddBackground(c_Width + 20, 10, 130, 40, 0x1400);
AddImageTiled(c_Width + 30, 20, 90, 21, 0xBBC);
AddTextField(c_Width + 30, 20, 90, 21, 0x480, 1, c_TxtSearch);
AddButton(c_Width + 127, 24, 0x2716, 0x2716, "Text Search", new TimerCallback(TxtSearch));
char[] chars = new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
int x = c_Width + 17;
int y = 51;
foreach (char c in chars)
{
AddButton(x += 20, y, 0x2344, 0x2344, "Char Search", new TimerStateCallback(CharSearch), c.ToString());
AddHtml(x + 6, y, 20, 20, (c_CharSearch == c.ToString() ? HTML.Green : HTML.White) + c, false, false, false);
if (x >= c_Width + 115)
{
x = c_Width + 17;
y += 20;
}
}
}
private void OptionsTab()
{
int x = c_Width+20;
AddHtml(x, 10, 300, 21, HTML.White + "<CENTER>" + General.Local(18), false, false);
int y = 10;
if (GetData.GlobalAccess && GetData.Global)
{
AddHtml(x + 120, y+=25, 120, 21, HTML.Red + General.Local(26), false, false, false);
AddButton(x + 70, y, GetData.GlobalM ? 0x2343 : 0x2342, GetData.GlobalM ? 0x2343 : 0x2342, "Global Messages", new TimerCallback(GlobalMsg));
AddImage(x + 90, y, 0x2342, GetData.GlobalMC);
AddButton(x + 94, y + 4, 0x2716, 0x2716, "GlobalMsgColor", new TimerCallback(GlobalMsgColor));
}
AddHtml(x + 60, y += 25, 220, 21, HTML.White + General.Local(24), false, false);
AddButton(x + 30, y, GetData.FriendsOnly ? 0x2343 : 0x2342, GetData.FriendsOnly ? 0x2343 : 0x2342, "Friends Only", new TimerCallback(FriendsOnly));
AddHtml(x + 60, y += 20, 220, 21, HTML.White + General.Local(25), false, false);
AddButton(x + 30, y, GetData.ByRequest ? 0x2343 : 0x2342, GetData.ByRequest ? 0x2343 : 0x2342, "Friend Request", new TimerCallback(FriendRequest));
AddHtml(x + 60, y+=20, 220, 21, HTML.White + General.Local(30), false, false);
AddButton(x + 30, y, GetData.FriendAlert ? 0x2343 : 0x2342, GetData.FriendAlert ? 0x2343 : 0x2342, "Friend Alert", new TimerCallback(FriendAlert));
AddHtml(x + 60, y += 20, 220, 21, HTML.White + General.Local(196), false, false);
AddButton(x + 30, y, GetData.ReadReceipt ? 0x2343 : 0x2342, GetData.ReadReceipt ? 0x2343 : 0x2342, "Read Receipt", new TimerCallback(ReadReceipt));
AddHtml(x + 30, y += 25, 170, 21, HTML.White + General.Local(29), false, false);
AddImageTiled(x + 175, y, 70, 21, 0xBBA);
AddTextField(x + 175, y, 70, 21, 0x480, 2, GetData.FriendsSpeech);
AddButton(x + 255, y + 3, 0x2716, 0x2716, "Submit Speech", new TimerCallback(SubmitSpeech));
AddHtml(x + 60, y += 23, 220, 21, HTML.White + General.Local(27), false, false);
AddButton(x + 30, y, GetData.MsgSound ? 0x2343 : 0x2342, GetData.MsgSound ? 0x2343 : 0x2342, "Message Sound", new TimerCallback(MessageSound));
if (GetData.MsgSound)
{
AddHtml(x, y+=25, 300, 21, HTML.White + "<CENTER>" + General.Local(28), false, false);
AddImageTiled(x+125, y+=25, 50, 21, 0xBBA);
AddTextField(x+125, y, 50, 21, 0x480, 1, GetData.DefaultSound.ToString());
AddButton(x + 185, y+3, 0x15E1, 0x15E5, "Play Sound", new TimerCallback(PlaySound));
AddButton(x + 110, y, 0x983, 0x983, "Sound Up", new TimerCallback(SoundUp));
AddButton(x + 110, y+10, 0x985, 0x985, "Sound Down", new TimerCallback(SoundDown));
}
Entries.Insert(0, new GumpBackground(x, 0, 300, y+40, 0x1400));
}
private string GetColor(Mobile m)
{
if (Owner == m)
return HTML.Yellow;
if (Data.GetData(m).Banned)
return HTML.Red;
if (GetData.Ignores.Contains(m))
return HTML.AshRed;
if (GetData.Global && GetData.GIgnores.Contains(m))
return HTML.AshRed;
if (!GetData.Global && GetData.GListens.Contains(m))
return HTML.Blue;
if (m.NetState == null)
return HTML.DarkGray;
if (Data.GetData(m).Status == OnlineStatus.Away || Data.GetData(m).Status == OnlineStatus.Busy)
return HTML.Gray;
if (m.AccessLevel > AccessLevel.Player)
return HTML.LightPurple;
if (m.Guild != null && (m.Guild == Owner.Guild))
return HTML.Green;
return HTML.White;
}
protected override void OnClose()
{
if (c_Profile != null || c_Search || c_Options)
{
c_Profile = null;
c_Options = false;
c_Search = false;
NewGump();
return;
}
}
#endregion
#region Responses
private void Minimize()
{
c_Minimized = !c_Minimized;
if (c_Minimized)
Override = false;
else
Override = true;
NewGump();
}
private void PageUp()
{
c_Page++;
NewGump();
}
private void PageDown()
{
c_Page--;
NewGump();
}
private void PerPageUp()
{
GetData.FriendsPP++;
NewGump();
}
private void PerPageDown()
{
GetData.FriendsPP--;
NewGump();
}
private void Search()
{
c_Search = !c_Search;
c_Profile = null;
c_Options = false;
NewGump();
}
private void Options()
{
c_Options = !c_Options;
c_Profile = null;
c_Search = false;
NewGump();
}
private void CheckMsgFrom(object o)
{
if (!(o is Mobile))
return;
GetData.CheckMsgFrom((Mobile)o);
General.RefreshGump(Owner, typeof(MailGump));
NewGump();
}
private void CheckMsg()
{
GetData.CheckMsg();
General.RefreshGump(Owner, typeof(MailGump));
NewGump();
}
private void Profile(object o)
{
if (!(o is Mobile))
return;
if (c_Profile == o)
c_Profile = null;
else
c_Profile = (Mobile)o;
c_Options = false;
c_Search = false;
NewGump();
}
private void TxtSearch()
{
c_TxtSearch = GetTextField(1);
c_CharSearch = "";
NewGump();
}
private void CharSearch(object o)
{
if (!(o is string))
return;
if (c_CharSearch == o.ToString())
c_CharSearch = "";
else
c_CharSearch = o.ToString();
c_TxtSearch = "";
NewGump();
}
private void Status()
{
new StatusGump(Owner, this);
}
private void FriendsOnly()
{
GetData.FriendsOnly = !GetData.FriendsOnly;
NewGump();
}
private void FriendRequest()
{
GetData.ByRequest = !GetData.ByRequest;
NewGump();
}
private void FriendAlert()
{
GetData.FriendAlert = !GetData.FriendAlert;
NewGump();
}
private void ReadReceipt()
{
GetData.ReadReceipt = !GetData.ReadReceipt;
NewGump();
}
private void GlobalMsg()
{
GetData.GlobalM = !GetData.GlobalM;
NewGump();
}
private void GlobalMsgColor()
{
Owner.SendHuePicker(new InternalPicker(this));
}
private void MessageSound()
{
GetData.MsgSound = !GetData.MsgSound;
NewGump();
}
private void PlaySound()
{
GetData.DefaultSound = Utility.ToInt32(GetTextField(1));
Owner.SendSound(GetData.DefaultSound);
NewGump();
}
private void SoundUp()
{
GetData.DefaultSound = GetData.DefaultSound+1;
NewGump();
}
private void SoundDown()
{
GetData.DefaultSound = GetData.DefaultSound-1;
NewGump();
}
private void SubmitSpeech()
{
GetData.FriendsSpeech = GetTextField(2);
if (GetData.FriendsSpeech != "")
Owner.SendMessage(GetData.SystemC, General.Local(70) + " \"" + GetData.FriendsSpeech + "\"");
else
Owner.SendMessage(GetData.SystemC, General.Local(71));
NewGump();
}
#endregion
#region Internal Classes
private class InternalSort : IComparer
{
private Data c_Data;
public InternalSort( Data data )
{
c_Data = data;
}
public int Compare(object x, object y)
{
if (x == null && y == null)
return 0;
if (x == null || !(x is Mobile))
return -1;
if (y == null || !(y is Mobile))
return 1;
Mobile a = (Mobile)x;
Mobile b = (Mobile)y;
if (c_Data.NewMsgFrom(a) && !c_Data.NewMsgFrom(b))
return 1;
if (c_Data.NewMsgFrom(b) && !c_Data.NewMsgFrom(a))
return -1;
if (a.NetState != null && b.NetState == null)
return 1;
if (a.NetState == null && b.NetState != null)
return -1;
return Insensitive.Compare(a.Name, b.Name);
}
}
private class StatusGump : GumpPlus
{
private GumpPlus c_Gump;
public StatusGump(Mobile m, GumpPlus g) : base(m, 100, 100)
{
m.CloseGump(typeof(StatusGump));
c_Gump = g;
NewGump();
}
protected override void BuildGump()
{
AddBackground(0, 0, 100, 100, 0x1400);
int y = 20;
AddHtml(40, y, 80, 21, HTML.White + General.Local(19), false, false, false);
AddButton(20, y + 2, 0x2716, 0x2716, "Online", new TimerStateCallback(Status), OnlineStatus.Online);
AddHtml(40, y += 20, 80, 21, HTML.White + General.Local(20), false, false, false);
AddButton(20, y + 2, 0x2716, 0x2716, "Away", new TimerStateCallback(Status), OnlineStatus.Away);
AddHtml(40, y += 20, 80, 21, HTML.White + General.Local(21), false, false, false);
AddButton(20, y + 2, 0x2716, 0x2716, "Busy", new TimerStateCallback(Status), OnlineStatus.Busy);
AddHtml(40, y += 20, 80, 21, HTML.White + General.Local(22), false, false, false);
AddButton(20, y + 2, 0x2716, 0x2716, "Hidden", new TimerStateCallback(Status), OnlineStatus.Hidden);
}
private void Status(object o)
{
if (!(o is OnlineStatus))
return;
Data.GetData(Owner).Status = (OnlineStatus)o;
if ((OnlineStatus)o == OnlineStatus.Away || (OnlineStatus)o == OnlineStatus.Busy)
new AwayGump(Owner, c_Gump);
else
c_Gump.NewGump();
}
protected override void OnClose()
{
c_Gump.NewGump();
}
}
private class AwayGump : GumpPlus
{
private GumpPlus c_Gump;
public AwayGump(Mobile m, GumpPlus g) : base(m, 100, 100)
{
m.CloseGump(typeof(AwayGump));
c_Gump = g;
NewGump();
}
protected override void BuildGump()
{
AddBackground(0, 0, 200, 200, 0x1400);
AddHtml(0, 10, 200, 21, HTML.White + "<CENTER>" + General.Local(12), false, false);
AddImageTiled(10, 30, 180, 120, 0xBBC);
AddTextField(10, 30, 180, 120, 0x480, 0, Data.GetData(Owner).AwayMsg);
AddButton(60, 160, 0xFB1, 0xFB3, "Clear", new TimerCallback(ClearMsg));
AddButton(120, 160, 0xFB7, 0xFB9, "Submit", new TimerCallback(Submit));
}
private void ClearMsg()
{
Data.GetData(Owner).AwayMsg = "";
NewGump();
}
private void Submit()
{
Data.GetData(Owner).AwayMsg = GetTextField(0);
c_Gump.NewGump();
}
protected override void OnClose()
{
c_Gump.NewGump();
}
}
private class InternalPicker : HuePicker
{
private GumpPlus c_Gump;
public InternalPicker(GumpPlus g) : base(0x1018)
{
c_Gump = g;
}
public override void OnResponse(int hue)
{
Data.GetData(c_Gump.Owner).GlobalMC = hue;
c_Gump.NewGump();
}
}
#endregion
}
}

View File

@@ -0,0 +1,507 @@
using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.HuePickers;
using Knives.Utils;
namespace Knives.Chat3
{
public class MailGump : GumpPlus
{
public static void SendTo(Mobile m)
{
SendTo(m, m);
}
public static void SendTo(Mobile from, Mobile to)
{
General.ClearGump(from, typeof(MailGump));
new MailGump(from, to);
}
#region Class Definitions
private Mobile c_Target;
private int c_Width, c_Height, c_Page;
private bool c_Options, c_Search, c_Minimized;
private string c_CharSearch, c_TxtSearch;
public Data GetData { get { return Data.GetData(Owner); } }
#endregion
#region Constructors
public MailGump(Mobile from, Mobile to) : base(from, 400, 50)
{
c_Target = to;
c_TxtSearch = "";
c_CharSearch = "";
NewGump();
}
#endregion
#region Methods
protected override void BuildGump()
{
Owner.CloseGump(typeof(MailGump));
c_Width = 300;
c_Height = 60 + (40 * GetData.MailPP);
if (c_Minimized)
{
if (GetData.NewMsg())
AddImage(0, 0, 0xFC4);
else
AddImage(0, 0, 0xFC5);
}
else
AddBackground(0, 0, c_Width, c_Height, 0x1400);
AddButton(0, 0, 0x13A8, 0x13A8, "Minimize", new TimerCallback(Minimize));
if (c_Minimized)
AddLabel(1, -3, 0x47E, "^");
else
AddLabel(2, -9, 0x47E, "_");
if (c_Minimized)
DisplayMin();
else
DisplayList();
}
private void DisplayMin()
{
}
private ArrayList BuildList()
{
ArrayList list = Data.GetData(c_Target).Messages;
if (c_CharSearch != "")
foreach (Message m in new ArrayList(list))
if (m.From.Name.ToLower().IndexOf(c_CharSearch.ToLower()) != 0)
list.Remove(m);
if (c_TxtSearch != "")
foreach (Message m in new ArrayList(list))
if (m.From.Name.ToLower().IndexOf(c_CharSearch.ToLower()) == -1)
list.Remove(m);
list.Sort(new InternalSort());
return list;
}
private void DisplayList()
{
if (c_Options)
OptionsTab();
if (c_Search)
SearchTab();
int y = 10;
AddImage(78, y - 1, 0x9C5);
AddHtml(0, y, c_Width, 21, HTML.White + "<CENTER>" + General.Local(56) + (c_Target == Owner ? "" : "(" + c_Target.Name + ")"), false, false, false);
AddButton(10, 32, 0x983, 0x983, "PerPage Down", new TimerCallback(PerPageDown));
AddButton(20, 32, 0x985, 0x985, "PerPage Up", new TimerCallback(PerPageUp));
ArrayList list = BuildList();
AddHtml(c_Width - 50, y, 60, 21, HTML.White + list.Count + "/" + Data.MaxMsgs, false, false);
int perpage = GetData.MailPP;
if (perpage * c_Page > list.Count || c_Page < 0)
c_Page = 0;
if (perpage * (c_Page + 1) < list.Count)
AddButton(c_Width / 2 - 10, c_Height - 25, 0x25E8, 0x25E9, "Page Up", new TimerCallback(PageUp));
if (c_Page != 0)
AddButton(c_Width / 2 - 10, 30, 0x25E4, 0x25E5, "Page Down", new TimerCallback(PageDown));
AddButton(6, c_Height - 30, 0x768, 0x768, "Options", new TimerCallback(Options));
AddButton(22, c_Height - 30, 0x768, 0x768, "Search", new TimerCallback(Search));
AddLabel(11, c_Height - 30, c_Options ? 0x34 : 0x47E, "O");
AddLabel(27, c_Height - 30, c_Search ? 0x34 : 0x47E, "S");
if (Owner.AccessLevel >= AccessLevel.GameMaster)
{
AddHtml(c_Width - 73, c_Height - 29, 80, 21, HTML.White + General.Local(95), false, false);
AddButton(c_Width - 90, c_Height - 26, 0x2716, 0x2716, "Broadcast", new TimerCallback(Broadcast));
}
y += 20;
Message msg;
try
{
for (int i = perpage * c_Page; i < list.Count && i < perpage * (c_Page + 1); ++i)
{
msg = (Message)list[i];
AddHtml(45, y += 20, 180, 21, ColorFor(msg) + (msg.Read ? "" : "<B>") + msg.Subject, false, false, false);
AddHtml(45, y += 16, 150, 21, HTML.White + General.Local(60) + " " + msg.From.Name, false, false);
AddButton(20, y - 10, 0x2716, 0x2716, "Open", new TimerStateCallback(Open), (Message)list[i]);
AddButton(c_Width - 40, y - 10, 0x5686, 0x5687, "Delete", new TimerStateCallback(Delete), (Message)list[i]);
}
}
catch
{
AddHtml(45, y += 20, 90, 21, HTML.White + "!!!", false, false);
}
}
private string ColorFor(Message msg)
{
switch (msg.Type)
{
case MsgType.Normal: return HTML.White;
case MsgType.Invite: return HTML.Yellow;
case MsgType.System: return HTML.Red;
default: return HTML.White;
}
}
private void SearchTab()
{
AddBackground(c_Width + 20, 10, 130, 40, 0x1400);
AddImageTiled(c_Width + 30, 20, 90, 21, 0xBBC);
AddTextField(c_Width + 30, 20, 90, 21, 0x480, 1, c_TxtSearch);
AddButton(c_Width + 127, 24, 0x2716, 0x2716, "Text Search", new TimerCallback(TxtSearch));
char[] chars = new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
int x = c_Width + 17;
int y = 51;
foreach (char c in chars)
{
AddButton(x += 20, y, 0x2344, 0x2344, "Char Search", new TimerStateCallback(CharSearch), c.ToString());
AddHtml(x + 6, y, 20, 20, (c_CharSearch == c.ToString() ? HTML.Green : HTML.White) + c, false, false, false);
if (x >= c_Width + 115)
{
x = c_Width + 17;
y += 20;
}
}
}
private void OptionsTab()
{
int x = c_Width + 20;
AddHtml(x, 10, 300, 21, HTML.White + "<CENTER>" + General.Local(57), false, false);
int y = 10;
if (GetData.GlobalAccess && GetData.Global)
{
AddHtml(x + 120, y += 25, 120, 21, HTML.Red + General.Local(26), false, false, false);
AddButton(x + 70, y, GetData.GlobalM ? 0x2343 : 0x2342, GetData.GlobalM ? 0x2343 : 0x2342, "Global Messages", new TimerCallback(GlobalMsg));
AddImage(x + 90, y, 0x2342, GetData.GlobalMC);
AddButton(x + 94, y + 4, 0x2716, 0x2716, "GlobalMsgColor", new TimerCallback(GlobalMsgColor));
}
AddHtml(x + 60, y += 25, 220, 21, HTML.White + General.Local(58), false, false);
AddButton(x + 30, y, GetData.SevenDays ? 0x2343 : 0x2342, GetData.SevenDays ? 0x2343 : 0x2342, "Seven Days", new TimerCallback(SevenDays));
AddHtml(x + 60, y += 20, 220, 21, HTML.White + General.Local(24), false, false);
AddButton(x + 30, y, GetData.FriendsOnly ? 0x2343 : 0x2342, GetData.FriendsOnly ? 0x2343 : 0x2342, "Friends Only", new TimerCallback(FriendsOnly));
AddHtml(x + 60, y += 20, 220, 21, HTML.White + General.Local(25), false, false);
AddButton(x + 30, y, GetData.ByRequest ? 0x2343 : 0x2342, GetData.ByRequest ? 0x2343 : 0x2342, "Friend Request", new TimerCallback(FriendRequest));
AddHtml(x + 60, y += 20, 220, 21, HTML.White + General.Local(196), false, false);
AddButton(x + 30, y, GetData.ReadReceipt ? 0x2343 : 0x2342, GetData.ReadReceipt ? 0x2343 : 0x2342, "Read Receipt", new TimerCallback(ReadReceipt));
AddHtml(x + 30, y += 25, 170, 21, HTML.White + General.Local(59), false, false);
AddImageTiled(x + 175, y, 70, 21, 0xBBA);
AddTextField(x + 175, y, 70, 21, 0x480, 2, GetData.MailSpeech);
AddButton(x + 255, y + 3, 0x2716, 0x2716, "Submit Speech", new TimerCallback(SubmitSpeech));
AddHtml(x + 60, y += 23, 220, 21, HTML.White + General.Local(27), false, false);
AddButton(x + 30, y, GetData.MsgSound ? 0x2343 : 0x2342, GetData.MsgSound ? 0x2343 : 0x2342, "Message Sound", new TimerCallback(MessageSound));
if (GetData.MsgSound)
{
AddHtml(x, y += 25, 300, 21, HTML.White + "<CENTER>" + General.Local(28), false, false);
AddImageTiled(x + 125, y += 25, 50, 21, 0xBBA);
AddTextField(x + 125, y, 50, 21, 0x480, 1, GetData.DefaultSound.ToString());
AddButton(x + 185, y + 3, 0x15E1, 0x15E5, "Play Sound", new TimerCallback(PlaySound));
AddButton(x + 110, y, 0x983, 0x983, "Sound Up", new TimerCallback(SoundUp));
AddButton(x + 110, y + 10, 0x985, 0x985, "Sound Down", new TimerCallback(SoundDown));
}
Entries.Insert(0, new GumpBackground(x, 0, 300, y + 40, 0x1400));
}
protected override void OnClose()
{
if (c_Options || c_Search)
{
c_Options = false;
c_Search = false;
NewGump();
return;
}
}
#endregion
#region Responses
private void Minimize()
{
c_Minimized = !c_Minimized;
if (c_Minimized)
Override = false;
else
Override = true;
NewGump();
}
private void PageUp()
{
c_Page++;
NewGump();
}
private void PageDown()
{
c_Page--;
NewGump();
}
private void PerPageUp()
{
GetData.MailPP++;
NewGump();
}
private void PerPageDown()
{
GetData.MailPP--;
NewGump();
}
private void Open(object o)
{
if (!(o is Message))
return;
MessageGump.SendTo(Owner, (Message)o);
General.RefreshGump(Owner, typeof(FriendsGump));
NewGump();
}
private void Delete(object o)
{
if (!(o is Message))
return;
GetData.DeleteMessage((Message)o);
NewGump();
}
private void Search()
{
c_Search = !c_Search;
c_Options = false;
NewGump();
}
private void Options()
{
c_Options = !c_Options;
c_Search = false;
NewGump();
}
private void TxtSearch()
{
c_TxtSearch = GetTextField(1);
c_CharSearch = "";
NewGump();
}
private void CharSearch(object o)
{
if (!(o is string))
return;
if (c_CharSearch == o.ToString())
c_CharSearch = "";
else
c_CharSearch = o.ToString();
c_TxtSearch = "";
NewGump();
}
private void SevenDays()
{
GetData.SevenDays = !GetData.SevenDays;
NewGump();
}
private void FriendsOnly()
{
GetData.FriendsOnly = !GetData.FriendsOnly;
NewGump();
}
private void FriendRequest()
{
GetData.ByRequest = !GetData.ByRequest;
NewGump();
}
private void ReadReceipt()
{
GetData.ReadReceipt = !GetData.ReadReceipt;
NewGump();
}
private void GlobalMsg()
{
GetData.GlobalM = !GetData.GlobalM;
NewGump();
}
private void GlobalMsgColor()
{
Owner.SendHuePicker(new InternalPicker(this));
}
private void MessageSound()
{
GetData.MsgSound = !GetData.MsgSound;
NewGump();
}
private void PlaySound()
{
GetData.DefaultSound = Utility.ToInt32(GetTextField(1));
Owner.SendSound(GetData.DefaultSound);
NewGump();
}
private void SoundUp()
{
GetData.DefaultSound = GetData.DefaultSound + 1;
NewGump();
}
private void SoundDown()
{
GetData.DefaultSound = GetData.DefaultSound - 1;
NewGump();
}
private void SubmitSpeech()
{
GetData.MailSpeech = GetTextField(2);
if (GetData.MailSpeech != "")
Owner.SendMessage(GetData.SystemC, General.Local(70) + " \"" + GetData.MailSpeech + "\"");
else
Owner.SendMessage(GetData.SystemC, General.Local(71));
NewGump();
}
private void Broadcast()
{
NewGump();
SendMessageGump.SendTo(Owner, null);
}
#endregion
#region Internal Classes
private class InternalSort : IComparer
{
public InternalSort()
{
}
public int Compare(object x, object y)
{
if (x == null && y == null)
return 0;
if (x == null || !(x is Message))
return -1;
if (y == null || !(y is Message))
return 1;
Message a = (Message)x;
Message b = (Message)y;
if (a.Received > b.Received)
return -1;
if (a.Received < b.Received)
return 1;
return Insensitive.Compare(a.From.Name, b.From.Name);
}
}
private class InternalPicker : HuePicker
{
private GumpPlus c_Gump;
public InternalPicker(GumpPlus g) : base(0x1018)
{
c_Gump = g;
}
public override void OnResponse(int hue)
{
Data.GetData(c_Gump.Owner).GlobalMC = hue;
c_Gump.NewGump();
}
}
#endregion
}
}

View File

@@ -0,0 +1,136 @@
using System;
using System.Collections;
using Server;
using Knives.Utils;
namespace Knives.Chat3
{
public class MessageGump : GumpPlus
{
public static void SendTo(Mobile m, Message msg)
{
new MessageGump(m, msg);
}
#region Class Definitions
private Message c_Message;
public Data GetData { get { return Data.GetData(Owner); } }
#endregion
#region Constructors
public MessageGump(Mobile m, Message msg) : base(m, 200, 400)
{
c_Message = msg;
if (GetData.Messages.Contains(msg))
{
if (!msg.Read && Data.GetData(msg.From).ReadReceipt && msg.From.AccessLevel >= m.AccessLevel)
msg.From.SendMessage(Data.GetData(msg.From).SystemC, m.Name + " " + General.Local(197) + " " + msg.Subject);
msg.Read = true;
}
NewGump();
}
#endregion
#region Methods
protected override void BuildGump()
{
AddBackground(0, 0, 300, 200, 0x1400);
int y = 10;
AddHtml(10, y, 280, 21, HTML.White + c_Message.Subject, false, false);
AddHtml(15, y += 18, 150, 21, HTML.White + General.Local(60) + " " + c_Message.From.Name, false, false);
AddHtml(10, y += 20, 280, 200 - y - 40, HTML.White + c_Message.Msg, true, true);
if (GetData.Messages.Contains(c_Message))
{
if (c_Message.Type == MsgType.Normal)
{
if (Message.CanMessage(Owner, c_Message.From))
AddButton(200, 170, 0xFA5, 0xFA6, "Reply", new TimerCallback(Reply));
AddButton(140, 170, 0xFB1, 0xFB2, "Delete", new TimerCallback(Delete));
AddButton(80, 170, 0xFA2, 0xFA3, "Ignore", new TimerCallback(Ignore));
}
else if (c_Message.Type == MsgType.Invite)
{
AddButton(200, 170, 0xFA8, 0xFA9, "Accept", new TimerCallback(Accept));
AddButton(140, 170, 0xFB1, 0xFB2, "Deny", new TimerCallback(Deny));
AddButton(80, 170, 0xFA2, 0xFA3, "Ignore", new TimerCallback(Ignore));
}
}
}
#endregion
#region Responses
private void Reply()
{
if (Message.CanMessage(Owner, c_Message.From))
SendMessageGump.SendTo(Owner, c_Message.From, c_Message);
}
private void Delete()
{
GetData.DeleteMessage(c_Message);
General.RefreshGump(Owner, typeof(MailGump));
General.RefreshGump(Owner, typeof(FriendsGump));
}
private void Ignore()
{
GetData.Ignores.Add(c_Message.From);
Owner.SendMessage(GetData.SystemC, General.Local(68) + " " + c_Message.From.Name);
Deny();
}
private void Accept()
{
c_Message.From.SendMessage(Data.GetData(c_Message.From).SystemC, Owner.Name + " " + General.Local(87));
GetData.AddFriend(c_Message.From);
Data.GetData(c_Message.From).AddFriend(Owner);
GetData.Messages.Remove(c_Message);
if (Owner.HasGump(typeof(FriendsGump)))
General.RefreshGump(Owner, typeof(FriendsGump));
else
FriendsGump.SendTo(Owner, true);
General.RefreshGump(Owner, typeof(MailGump));
}
private void Deny()
{
c_Message.From.SendMessage(Data.GetData(c_Message.From).SystemC, Owner.Name + " " + General.Local(88));
Owner.SendMessage(GetData.SystemC, General.Local(89) + " " + c_Message.From.Name);
GetData.Messages.Remove(c_Message);
if (Owner.HasGump(typeof(FriendsGump)))
General.RefreshGump(Owner, typeof(FriendsGump));
else
FriendsGump.SendTo(Owner, true);
General.RefreshGump(Owner, typeof(MailGump));
}
#endregion
}
}

View File

@@ -0,0 +1,204 @@
using System;
using System.Collections;
using Server;
using Knives.Utils;
namespace Knives.Chat3
{
public class SendMessageGump : GumpPlus
{
public static void SendTo(Mobile from, Mobile to)
{
SendTo(from, to, "", null);
}
public static void SendTo(Mobile from, Mobile to, string txt)
{
SendTo(from, to, txt, null);
}
public static void SendTo(Mobile from, Mobile to, Message reply)
{
SendTo(from, to, "", reply);
}
public static void SendTo(Mobile from, Mobile to, string txt, Message reply)
{
General.ClearGump(from, typeof(SendMessageGump));
new SendMessageGump(from, to, txt, reply);
}
#region Class Definitions
private Mobile c_From, c_To;
private Message c_Reply;
private string c_Text, c_Subject;
public Data GetData { get { return Data.GetData(Owner); } }
#endregion
#region Constructors
public SendMessageGump(Mobile from, Mobile to, string txt, Message reply) : base(from, 200, 200)
{
c_From = from;
c_To = to;
c_Text = txt;
c_Subject = "";
c_Reply = reply;
if (c_Reply != null)
{
if (c_Reply.Subject.IndexOf("RE:") != 0)
c_Subject = "RE: " + c_Reply.Subject;
else
c_Subject = c_Reply.Subject;
}
NewGump();
}
#endregion
#region Methods
protected override void BuildGump()
{
Owner.CloseGump(typeof(SendMessageGump));
AddBackground(0, 0, 400, 400, 0x1400);
if (c_To == null)
AddHtml(0, 8, 400, 21, HTML.White + "<CENTER>" + General.Local(94), false, false);
else
AddHtml(0, 8, 400, 21, HTML.White + "<CENTER>" + General.Local(62) + " " + c_To.Name, false, false);
AddImageTiled(20, 30, 350, 21, 0xBBC);
AddTextField(20, 30, 350, 21, 0x480, 0, c_Subject);
if (GetData.Recording == this)
{
AddHtml(20, 30, 350, 25, HTML.White + c_Subject, true, false);
AddHtml(10, 57, 380, 310, HTML.White + c_Text, true, true);
AddHtml(0, 370, 400, 21, HTML.White + "<CENTER>" + General.Local(63), false, false);
}
else
{
AddImageTiled(20, 30, 350, 21, 0xBBC);
AddTextField(20, 30, 350, 21, 0x480, 0, c_Subject);
AddImageTiled(10, 57, 380, 310, 0xBBC);
AddTextField(10, 57, 380, 310, 0x480, 1, c_Text);
AddButton(10, 370, 0x2333, 0x2333, "Record", new TimerCallback(Record));
}
AddButton(360, 370, 0xFBD, 0xFBE, "Send", new TimerCallback(Send));
}
#endregion
#region Responses
public void AddText(string txt)
{
c_Text += txt;
NewGump();
}
private void Save()
{
c_Subject = GetTextField(0);
c_Text = GetTextField(1);
}
private void Record()
{
Save();
if (c_Subject.Trim() == "")
{
Owner.SendMessage(GetData.SystemC, General.Local(194));
NewGump();
return;
}
if (GetData.Recording != null)
GetData.Recording = null;
Save();
GetData.Recording = this;
Owner.SendMessage(GetData.SystemC, General.Local(65));
NewGump();
}
private void Send()
{
if( GetData.Recording == null )
Save();
if (c_Subject.Trim() == "" || c_Text.Trim() == "")
{
Owner.SendMessage(GetData.SystemC, General.Local(66));
NewGump();
return;
}
if (!TrackSpam.LogSpam(Owner, "Message", TimeSpan.FromSeconds(Data.MsgSpam)))
{
Owner.SendMessage(GetData.SystemC, General.Local(97));
NewGump();
return;
}
if (GetData.Recording == this)
GetData.Recording = null;
if (Data.FilterMsg)
{
c_Text = Filter.FilterText(Owner, c_Text, false);
c_Subject = Filter.FilterText(Owner, c_Subject, false);
}
if (c_To == null)
{
foreach (Data data in Data.Datas.Values)
{
data.AddMessage(new Message(Owner, c_Subject, c_Text, MsgType.System));
if (data.Mobile.HasGump(typeof(FriendsGump)))
General.RefreshGump(data.Mobile, typeof(FriendsGump));
else
FriendsGump.SendTo(data.Mobile, true);
General.RefreshGump(data.Mobile, typeof(MailGump));
}
}
else
{
Data.GetData(c_To).AddMessage(new Message(Owner, c_Subject, c_Text, MsgType.Normal));
Owner.SendMessage(GetData.SystemC, General.Local(67) + " " + c_To.Name);
if (Data.GetData(c_To).Status != OnlineStatus.Online)
Owner.SendMessage(GetData.SystemC, c_To.Name + ": " + Data.GetData(c_To).AwayMsg);
if (c_To.HasGump(typeof(FriendsGump)))
General.RefreshGump(c_To, typeof(FriendsGump));
else
FriendsGump.SendTo(c_To, true);
General.RefreshGump(c_To, typeof(MailGump));
}
foreach( Data data in Data.Datas.Values)
if (data.Mobile.AccessLevel >= c_From.AccessLevel && ((data.GlobalM && !data.GIgnores.Contains(c_From)) || data.GListens.Contains(c_From)))
data.Mobile.SendMessage(data.GlobalMC, String.Format("(Global) <Mail> {0} to {1}: {2}", Owner.Name, (c_To == null ? "All" : c_To.Name), c_Text ));
}
#endregion
}
}

View File

@@ -0,0 +1,645 @@
using System;
using System.Collections;
using Server;
using Server.Gumps;
using Knives.Utils;
namespace Knives.Chat3
{
public enum SetupPage { Publics, Misc, FilterSpam, IRC }
public class SetupGump : GumpPlus
{
public static void SendTo(Mobile m)
{
General.ClearGump(m, typeof(SetupGump));
new SetupGump(m);
}
#region Class Definitions
private SetupPage c_Page;
private int c_Width, c_Height;
private Channel c_Channel;
public Data GetData { get { return Data.GetData(Owner); } }
protected Channel Channel { get { return c_Channel; } set { c_Channel = value; } }
#endregion
#region Constructors
public SetupGump(Mobile m) : base(m, 200, 200)
{
c_Width = c_Height = 300;
NewGump();
}
#endregion
#region Methods
protected override void BuildGump()
{
Owner.CloseGump(typeof(SetupGump));
AddBackground(0, 0, c_Width, c_Height, 0x1400);
AddButton(c_Width / 5 - 5, c_Height - 40, c_Page == SetupPage.Publics ? 0x767 : 0x768, c_Page == SetupPage.Publics ? 0x767 : 0x768, "Messages", new TimerStateCallback(Page), SetupPage.Publics);
AddButton(c_Width / 5 * 2 - 5, c_Height - 40, c_Page == SetupPage.Misc ? 0x767 : 0x768, c_Page == SetupPage.Misc ? 0x767 : 0x768, "Messages", new TimerStateCallback(Page), SetupPage.Misc);
AddButton(c_Width / 5 * 3 - 5, c_Height - 40, c_Page == SetupPage.FilterSpam ? 0x767 : 0x768, c_Page == SetupPage.FilterSpam ? 0x767 : 0x768, "Filter and Spam", new TimerStateCallback(Page), SetupPage.FilterSpam);
AddButton(c_Width/5*4-5, c_Height - 40, c_Page == SetupPage.IRC ? 0x767 : 0x768, c_Page == SetupPage.IRC ? 0x767 : 0x768, "IRC", new TimerStateCallback(Page), SetupPage.IRC);
AddImage(13, 6, 0x476);
switch (c_Page)
{
case SetupPage.Publics: PublicsTab(); break;
case SetupPage.Misc: MiscTab(); break;
case SetupPage.FilterSpam: FilterSpamTab(); break;
case SetupPage.IRC: IRCTab(); break;
}
AddButton(c_Width - 20, c_Height - 20, 0xFC1, 0xFC1, "About", new TimerCallback(About));
}
private void PublicsTab()
{
int y = 10;
AddHtml(0, y, c_Width, 21, HTML.White + "<CENTER>" + General.Local(177), false, false);
AddImage(77, (y += 25) - 1, 0x9C5);
AddHtml(100, y, 100, 21, "<CENTER>" + HTML.White + (c_Channel == null ? "" : c_Channel.Name), false, false);
AddButton(85, y+3, 0x2716, 0x2716, "Channel Select", new TimerCallback(ChannelSelect));
if( c_Channel != null )
AddButton(200, y+1, 0x5686, 0x5687, "Delete Channel", new TimerCallback(DeleteChannel));
if (c_Channel == null)
{
AddHtml(0, y+=25, c_Width, 21, HTML.White + "<CENTER>" + General.Local(179), false, false);
return;
}
AddHtml(77, y+=25, 100, 21, HTML.White + General.Local(180), false, false);
AddImageTiled(162, y, 70, 21, 0xBBA);
AddTextField(162, y, 70, 21, 0x480, 10, "" + c_Channel.Name);
AddButton(142, y + 3, 0x2716, 0x2716, "Submit Channel", new TimerCallback(SubmitChannel));
AddHtml(40, y += 25, 80, 21, HTML.White + General.Local(181) + ":", false, false);
AddHtml(120, y, 80, 21, HTML.White + General.Local(182), false, false);
AddHtml(200, y, 80, 21, HTML.White + General.Local(183), false, false);
AddButton(100, y + 3, c_Channel.Style == ChatStyle.Global ? 0x939 : 0x2716, c_Channel.Style == ChatStyle.Global ? 0x939 : 0x2716, "Global", new TimerCallback(Global));
AddButton(180, y + 3, c_Channel.Style == ChatStyle.Regional ? 0x939 : 0x2716, c_Channel.Style == ChatStyle.Regional ? 0x939 : 0x2716, "Regional", new TimerCallback(Regional));
AddHtml(110, y += 25, 120, 21, HTML.White + General.Local(184), false, false);
AddButton(80, y, c_Channel.ToIrc ? 0x2343 : 0x2342, c_Channel.ToIrc ? 0x2343 : 0x2342, "Send to IRC", new TimerCallback(SendToIrc));
AddHtml(110, y += 25, 120, 21, HTML.White + General.Local(188), false, false);
AddButton(80, y, c_Channel.NewChars ? 0x2343 : 0x2342, c_Channel.NewChars ? 0x2343 : 0x2342, "Auto join new characters", new TimerCallback(AutoNewChars));
AddHtml(27, y += 25, 150, 21, HTML.White + General.Local(185), false, false);
AddImageTiled(182, y, 70, 21, 0xBBA);
AddTextField(182, y, 70, 21, 0x480, 11, "");
AddButton(162, y + 4, 0x2716, 0x2716, "Add/Remove Command", new TimerCallback(AddCommand));
string txt = General.Local(42) + ": ";
foreach (string str in c_Channel.Commands)
txt += str + " ";
AddHtml(20, y += 25, 260, 60, HTML.White + txt, false, false);
}
private void MiscTab()
{
int y = 10;
AddHtml(0, y, c_Width, 21, HTML.White + "<CENTER>" + General.Local(101), false, false);
AddHtml(70, y += 25, 250, 21, HTML.White + General.Local(152), false, false);
AddButton(40, y, Data.ShowStaff ? 0x2343 : 0x2342, Data.ShowStaff ? 0x2343 : 0x2342, "Show Staff", new TimerCallback(ShowStaff));
AddHtml(37, y += 25, 150, 21, HTML.White + General.Local(153), false, false);
AddImageTiled(172, y, 70, 21, 0xBBA);
AddTextField(172, y, 70, 21, 0x480, 9, "" + Data.MaxMsgs);
AddButton(152, y + 4, 0x2716, 0x2716, "MaxMsgs", new TimerCallback(MaxMsgs));
AddHtml(70, y += 25, 250, 21, HTML.White + General.Local(169), false, false);
AddButton(45, y+3, 0x2716, 0x2716, "Reload Local", new TimerCallback(ReloadLocal));
}
private void FilterSpamTab()
{
int y = 10;
AddHtml(0, y, c_Width, 21, HTML.White + "<CENTER>" + General.Local(99), false, false);
AddHtml(70, y += 25, 250, 21, HTML.White + General.Local(142), false, false);
AddButton(40, y, Data.FilterSpeech ? 0x2343 : 0x2342, Data.FilterSpeech ? 0x2343 : 0x2342, "Filter Speech", new TimerCallback(FilterSpeech));
AddHtml(70, y += 25, 250, 21, HTML.White + General.Local(143), false, false);
AddButton(40, y, Data.FilterMsg ? 0x2343 : 0x2342, Data.FilterMsg ? 0x2343 : 0x2342, "Filter Messages", new TimerCallback(FilterMsg));
AddHtml(17, y += 25, 100, 21, HTML.White + General.Local(144), false, false);
AddHtml(142, y, 100, 21, HTML.White + "s", false, false);
AddImageTiled(107, y, 30, 21, 0xBBA);
AddTextField(107, y, 30, 21, 0x480, 4, "" + Data.ChatSpam);
AddHtml(162, y, 100, 21, HTML.White + General.Local(145), false, false);
AddHtml(277, y, 100, 21, HTML.White + "s", false, false);
AddImageTiled(242, y, 30, 21, 0xBBA);
AddTextField(242, y, 30, 21, 0x480, 5, "" + Data.MsgSpam);
AddHtml(17, y += 25, 100, 21, HTML.White + General.Local(146), false, false);
AddHtml(142, y, 100, 21, HTML.White + "h", false, false);
AddImageTiled(107, y, 30, 21, 0xBBA);
AddTextField(107, y, 30, 21, 0x480, 6, "" + Data.RequestSpam);
AddHtml(162, y, 100, 21, HTML.White + General.Local(147), false, false);
AddHtml(277, y, 100, 21, HTML.White + "m", false, false);
AddImageTiled(242, y, 30, 21, 0xBBA);
AddTextField(242, y, 30, 21, 0x480, 7, "" + Data.FilterBanLength);
AddButton(148, y - 9, 0x2716, 0x2716, "SubmitFilterSpam", new TimerCallback(SubmitFilterSpam));
AddHtml(90, y += 25, 150, 21, HTML.White + General.Local(154) + ": " + General.Local(155 + (int)Data.FilterPenalty), false, false);
AddButton(70, y + 4, 0x2716, 0x2716, "Filter Penalty", new TimerCallback(FilterPenalty));
AddHtml(37, y+=25, 150, 21, HTML.White + General.Local(148), false, false);
AddImageTiled(172, y, 70, 21, 0xBBA);
AddTextField(172, y, 70, 21, 0x480, 8, "");
AddButton(152, y + 4, 0x2716, 0x2716, "Add/Remove Filter", new TimerCallback(AddFilter));
string txt = General.Local(151) + " ";
foreach (string filter in Data.Filters)
txt += filter + " ";
AddHtml(20, y += 25, 260, 60, HTML.White + txt, false, false);
}
private void IRCTab()
{
int y = 10;
AddHtml(0, y, c_Width, 21, HTML.White + "<CENTER>" + General.Local(100), false, false);
AddHtml(120, y += 25, 100, 21, HTML.White + General.Local(98), false, false);
AddButton(90, y, Data.IrcEnabled ? 0x2343 : 0x2342, Data.IrcEnabled ? 0x2343 : 0x2342, "IRC Enabled", new TimerCallback(IrcEnabled));
if (!Data.IrcEnabled)
return;
AddHtml(60, y += 25, 100, 21, HTML.White + General.Local(115), false, false);
AddButton(30, y, Data.IrcAutoConnect ? 0x2343 : 0x2342, Data.IrcAutoConnect ? 0x2343 : 0x2342, "IRC Auto Connect", new TimerCallback(IrcAutoConnect));
AddHtml(180, y, 100, 21, HTML.White + General.Local(116), false, false);
AddButton(150, y, Data.IrcAutoReconnect ? 0x2343 : 0x2342, Data.IrcAutoReconnect ? 0x2343 : 0x2342, "IRC Auto Reconnect", new TimerCallback(IrcAutoReconnect));
AddHtml(60, y += 25, 100, 21, HTML.White + General.Local(117), false, false);
AddImageTiled(130, y, 100, 21, 0xBBA);
AddTextField(130, y, 100, 21, 0x480, 0, Data.IrcNick);
AddButton(235, y + 4, 0x2716, 0x2716, "Submit", new TimerCallback(Submit));
AddHtml(60, y += 25, 100, 21, HTML.White + General.Local(118), false, false);
AddImageTiled(130, y, 100, 21, 0xBBA);
AddTextField(130, y, 100, 21, 0x480, 1, Data.IrcServer);
AddButton(235, y + 4, 0x2716, 0x2716, "Submit", new TimerCallback(Submit));
AddHtml(60, y += 25, 100, 21, HTML.White + General.Local(119), false, false);
AddImageTiled(130, y, 100, 21, 0xBBA);
AddTextField(130, y, 100, 21, 0x480, 2, Data.IrcRoom);
AddButton(235, y + 4, 0x2716, 0x2716, "Submit", new TimerCallback(Submit));
AddHtml(60, y += 25, 100, 21, HTML.White + General.Local(120), false, false);
AddImageTiled(130, y, 70, 21, 0xBBA);
AddTextField(130, y, 70, 21, 0x480, 3, "" + Data.IrcPort);
AddButton(235, y + 4, 0x2716, 0x2716, "Submit", new TimerCallback(Submit));
AddHtml(60, y += 25, 150, 21, HTML.White + General.Local(138) + ": " + General.Local(121 + (int)Data.IrcStaffColor), false, false);
AddButton(40, y + 4, 0x2716, 0x2716, "Irc Staff Color", new TimerCallback(IrcStaffColor));
int num = 139;
if (IrcConnection.Connection.Connected)
num = 141;
if (IrcConnection.Connection.Connecting)
num = 140;
AddHtml(110, y += 40, 150, 21, HTML.White + General.Local(num), false, false);
AddButton(90, y + 4, 0x2716, 0x2716, "Connect or Cancel or Close", new TimerCallback(ConnectCancelClose));
}
#endregion
#region Responses
private void Page(object o)
{
if (!(o is SetupPage))
return;
c_Page = (SetupPage)o;
NewGump();
}
private void ChannelSelect()
{
new ChannelSelectGump(this);
}
private void DeleteChannel()
{
if (c_Channel != null)
{
foreach (string str in c_Channel.Commands)
Channel.RemoveCommand(str);
Channel.Channels.Remove(c_Channel);
}
c_Channel = null;
NewGump();
return;
}
private void AutoNewChars()
{
if (c_Channel != null)
{
c_Channel.NewChars = !c_Channel.NewChars;
if (c_Channel.NewChars)
foreach (Data data in Data.Datas.Values)
data.Channels.Add(c_Channel.Name);
return;
}
NewGump();
}
private void SubmitChannel()
{
if( GetTextField(10) != "" )
c_Channel.Name = GetTextField(10);
NewGump();
}
private void AddCommand()
{
if (GetTextField(11) == "")
{
NewGump();
return;
}
if (c_Channel.Commands.Contains(GetTextField(11).ToLower()))
{
c_Channel.Commands.Remove(GetTextField(11).ToLower());
Channel.RemoveCommand(GetTextField(11).ToLower());
}
else
{
c_Channel.Commands.Add(GetTextField(11).ToLower());
Channel.AddCommand(GetTextField(11).ToLower());
}
NewGump();
}
private void Global()
{
c_Channel.Style = ChatStyle.Global;
NewGump();
}
private void Regional()
{
c_Channel.Style = ChatStyle.Regional;
NewGump();
}
private void SendToIrc()
{
SubmitChannel();
c_Channel.ToIrc = !c_Channel.ToIrc;
NewGump();
}
private void ShowStaff()
{
Data.ShowStaff = !Data.ShowStaff;
NewGump();
}
private void MaxMsgs()
{
Data.MaxMsgs = Utility.ToInt32(GetTextField(9));
NewGump();
}
private void ReloadLocal()
{
General.LoadLocalFile();
Owner.SendMessage(GetData.SystemC, General.Local(168));
NewGump();
}
private void FilterSpeech()
{
Data.FilterSpeech = !Data.FilterSpeech;
NewGump();
}
private void FilterMsg()
{
Data.FilterMsg = !Data.FilterMsg;
NewGump();
}
private void SubmitFilterSpam()
{
Data.ChatSpam = Utility.ToInt32(GetTextField(4));
Data.MsgSpam = Utility.ToInt32(GetTextField(5));
Data.RequestSpam = Utility.ToInt32(GetTextField(6));
Data.FilterBanLength = Utility.ToInt32(GetTextField(7));
NewGump();
}
private void AddFilter()
{
if (GetTextField(8).Trim() == "")
{
NewGump();
return;
}
if (Data.Filters.Contains(GetTextField(8).ToLower()))
{
Data.Filters.Remove(GetTextField(8).ToLower());
Owner.SendMessage(GetData.SystemC, General.Local(149) + " " + GetTextField(8).ToLower());
}
else
{
Data.Filters.Add(GetTextField(8).ToLower());
Owner.SendMessage(GetData.SystemC, General.Local(150) + " " + GetTextField(8).ToLower());
}
NewGump();
}
private void FilterPenalty()
{
new FilterPenaltyGump(Owner, this);
}
private void IrcEnabled()
{
Data.IrcEnabled = !Data.IrcEnabled;
NewGump();
}
private void IrcAutoConnect()
{
Data.IrcAutoConnect = !Data.IrcAutoConnect;
NewGump();
}
private void IrcAutoReconnect()
{
Data.IrcAutoReconnect = !Data.IrcAutoReconnect;
NewGump();
}
private void Submit()
{
Data.IrcNick = GetTextField(0);
Data.IrcServer = GetTextField(1);
Data.IrcRoom = GetTextField(2);
Data.IrcPort = Utility.ToInt32(GetTextField(3));
NewGump();
}
private void IrcStaffColor()
{
new IrcStaffColorGump(Owner, this);
}
private void ConnectCancelClose()
{
Data.IrcNick = GetTextField(0);
Data.IrcServer = GetTextField(1);
Data.IrcRoom = GetTextField(2);
Data.IrcPort = Utility.ToInt32(GetTextField(3));
if (IrcConnection.Connection.Connected)
IrcConnection.Connection.Disconnect(false);
else if (IrcConnection.Connection.Connecting)
IrcConnection.Connection.CancelConnect();
else if (!IrcConnection.Connection.Connected)
IrcConnection.Connection.Connect(Owner);
NewGump();
}
private void About()
{
NewGump();
new AboutGump(Owner);
}
#endregion
#region Internal Classes
private class ChannelSelectGump : GumpPlus
{
private SetupGump c_Gump;
public ChannelSelectGump(SetupGump g) : base(g.Owner, 100, 100)
{
c_Gump = g;
NewGump();
}
protected override void BuildGump()
{
int y = 10;
AddHtml(0, y, 150, 21, HTML.White + "<CENTER>" + General.Local(38), false, false);
foreach (Channel c in Channel.Channels)
{
if (c.Mod)
{
AddHtml(50, y += 20, 100, 21, HTML.White + c.NameFor(Owner), false, false);
AddButton(30, y + 3, 0x2716, 0x2716, "Select Channel", new TimerStateCallback(SelectChannel), c);
}
}
AddHtml(50, y += 30, 100, 21, HTML.White + General.Local(178), false, false);
AddButton(30, y + 3, 0x2716, 0x2716, "New Channel", new TimerCallback(NewChannel));
Entries.Insert(0, new GumpBackground(0, 0, 150, y + 40, 0x1400));
}
private void NewChannel()
{
Channel c = new Channel("New");
c.Mod = true;
c_Gump.Channel = c;
c_Gump.NewGump();
}
private void SelectChannel(object o)
{
if (!(o is Channel))
return;
c_Gump.Channel = (Channel)o;
c_Gump.NewGump();
}
protected override void OnClose()
{
c_Gump.NewGump();
}
}
private class IrcStaffColorGump : GumpPlus
{
private GumpPlus c_Gump;
public IrcStaffColorGump(Mobile m, GumpPlus g) : base(m, 100, 100)
{
c_Gump = g;
NewGump();
}
protected override void BuildGump()
{
int y = 10;
AddHtml(0, y, 150, 21, HTML.White + "<CENTER>" + General.Local(137), false, false);
y += 5;
for (int i = 0; i < 16; ++i)
{
AddHtml(60, y += 20, 90, 21, HTML.White + General.Local(121 + i), false, false);
AddButton(40, y + 4, 0x2716, 0x2716, "Select", new TimerStateCallback(Select), i);
}
Entries.Insert(0, new GumpBackground(0, 0, 150, y + 40, 0x1400));
}
protected override void OnClose()
{
c_Gump.NewGump();
}
private void Select(object o)
{
if (!(o is int))
return;
Data.IrcStaffColor = (IrcColor)(int)o;
c_Gump.NewGump();
}
}
private class FilterPenaltyGump : GumpPlus
{
private GumpPlus c_Gump;
public FilterPenaltyGump(Mobile m, GumpPlus g) : base(m, 100, 100)
{
c_Gump = g;
NewGump();
}
protected override void BuildGump()
{
int y = 10;
AddHtml(0, y, 150, 21, HTML.White + "<CENTER>" + General.Local(154), false, false);
y += 5;
for (int i = 0; i < 3; ++i)
{
AddHtml(60, y += 20, 90, 21, HTML.White + General.Local(155 + i), false, false);
AddButton(40, y + 4, 0x2716, 0x2716, "Select", new TimerStateCallback(Select), i);
}
Entries.Insert(0, new GumpBackground(0, 0, 150, y + 40, 0x1400));
}
protected override void OnClose()
{
c_Gump.NewGump();
}
private void Select(object o)
{
if (!(o is int))
return;
Data.FilterPenalty = (FilterPenalty)(int)o;
c_Gump.NewGump();
}
}
private class AboutGump : GumpPlus
{
public AboutGump(Mobile m) : base(m, 100, 100)
{
NewGump();
}
protected override void BuildGump()
{
AddBackground(0, 0, 200, 100, 0x1400);
string txt = HTML.White + "<CENTER>Knives' Chat<br>" + General.Version + "<br>Release Date: " + General.ReleaseDate.Month + "/" + General.ReleaseDate.Day + "/" + General.ReleaseDate.Year + "<br>Contact: kmwill23@hotmail.com";
AddHtml(0, 10, 200, 81, txt , false, false);
}
}
#endregion
}
}