1114 lines
37 KiB
C#
1114 lines
37 KiB
C#
using System;
|
|
using System.Collections;
|
|
using Server;
|
|
using Server.HuePickers;
|
|
using Server.Gumps;
|
|
using Knives.Utils;
|
|
|
|
namespace Knives.Chat3
|
|
{
|
|
public enum DisplayType { Channel, All, Ignores, GIgnores, GListens, Bans }
|
|
|
|
public class ChannelGump : GumpPlus
|
|
{
|
|
public static void SendTo(Mobile m)
|
|
{
|
|
General.ClearGump(m, typeof(ChannelGump));
|
|
|
|
new ChannelGump(m);
|
|
}
|
|
|
|
#region Class Definitions
|
|
|
|
private Mobile c_Profile;
|
|
private DisplayType c_Type;
|
|
private int c_Height, c_Width, c_Page;
|
|
private bool c_Minimized, c_Search, c_Options;
|
|
private string c_TxtSearch, c_CharSearch;
|
|
|
|
public DisplayType Type { get { return c_Type; } set { c_Type = value; } }
|
|
public Data GetData { get { return Data.GetData(Owner); } }
|
|
|
|
#endregion
|
|
|
|
#region Constructors
|
|
|
|
public ChannelGump(Mobile m) : base( m, 50, 50 )
|
|
{
|
|
c_TxtSearch = "";
|
|
c_CharSearch = "";
|
|
|
|
NewGump();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
protected override void BuildGump()
|
|
{
|
|
Owner.CloseGump(typeof(ChannelGump));
|
|
|
|
if (GetData.CurrentChannel != null && !GetData.CurrentChannel.CanChat(Owner, false))
|
|
GetData.CurrentChannel = null;
|
|
|
|
c_Height = 100 + (GetData.ChannelPP * 20);
|
|
c_Width = 160;
|
|
|
|
if (GetData.QuickBar)
|
|
c_Width += 80;
|
|
|
|
if (c_Minimized)
|
|
{
|
|
AddImage(0, 0, 0x2907);
|
|
AddImage(15, 0, 0x2908);
|
|
AddImage(20, 0, 0x2909);
|
|
AddItem(9, 11, 0x1ECF);
|
|
}
|
|
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 = new ArrayList();
|
|
|
|
if (c_Type == DisplayType.Channel && GetData.CurrentChannel == null)
|
|
return list;
|
|
|
|
if (c_Type == DisplayType.Channel)
|
|
list = GetData.CurrentChannel.BuildList(Owner);
|
|
else if (c_Type == DisplayType.All)
|
|
{
|
|
list = new ArrayList();
|
|
foreach (Mobile m in Data.Datas.Keys)
|
|
{
|
|
if (!Data.ShowStaff && m.AccessLevel > AccessLevel.Player)
|
|
continue;
|
|
|
|
list.Add(m);
|
|
}
|
|
}
|
|
else if (c_Type == DisplayType.Ignores)
|
|
{
|
|
list = new ArrayList(GetData.Ignores);
|
|
list.AddRange(GetData.IrcIgnores);
|
|
}
|
|
else if (c_Type == DisplayType.GIgnores)
|
|
list = new ArrayList(GetData.GIgnores);
|
|
else if (c_Type == DisplayType.GListens)
|
|
list = new ArrayList(GetData.GListens);
|
|
else if (c_Type == DisplayType.Bans)
|
|
foreach (Data data in Data.Datas.Values)
|
|
if (data.Banned)
|
|
list.Add(data.Mobile);
|
|
|
|
list.Sort(new InternalSort());
|
|
|
|
if (GetData.CurrentChannel != null && GetData.CurrentChannel.Style == ChatStyle.Regional)
|
|
foreach (object o in new ArrayList(list))
|
|
{
|
|
if (!(o is Mobile))
|
|
continue;
|
|
|
|
if (((Mobile)o).NetState != null && ((Mobile)o).Region != Owner.Region)
|
|
list.Remove(o);
|
|
}
|
|
|
|
string str = "";
|
|
if (c_TxtSearch != "")
|
|
foreach (object o in new ArrayList(list))
|
|
{
|
|
if (o is Mobile)
|
|
str = ((Mobile)o).Name;
|
|
else
|
|
str = o.ToString();
|
|
|
|
if (str.ToLower().IndexOf(c_TxtSearch.ToLower()) == -1)
|
|
list.Remove(o);
|
|
}
|
|
|
|
if (c_CharSearch != "")
|
|
foreach (object o in new ArrayList(list))
|
|
{
|
|
if (o is Mobile)
|
|
str = ((Mobile)o).Name;
|
|
else
|
|
str = o.ToString();
|
|
|
|
if (str.ToLower().IndexOf(c_CharSearch.ToLower()) != 0)
|
|
list.Remove(o);
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
private void DisplayList()
|
|
{
|
|
if (c_Options)
|
|
OptionsTab();
|
|
if (c_Search)
|
|
SearchTab();
|
|
|
|
int y = 10;
|
|
|
|
AddImage(c_Width/2-75, y - 1, 0x9C5);
|
|
|
|
if (c_Type == DisplayType.Channel)
|
|
AddButton(c_Width/2-75+5, y + 4, 0x2716, 0x2716, "Channels", new TimerCallback(Channels));
|
|
|
|
AddButton(7, c_Height - 30, 0x768, 0x768, "Options", new TimerCallback(Options));
|
|
AddButton(23, c_Height - 30, 0x768, 0x768, "Search", new TimerCallback(Search));
|
|
AddButton(39, c_Height - 30, 0x768, 0x768, "Friends", new TimerCallback(Friends));
|
|
AddButton(55, c_Height - 30, 0x768, 0x768, "Mail", new TimerCallback(Mail));
|
|
AddLabel(12, c_Height - 30, c_Options ? 0x34 : 0x47E, "O");
|
|
AddLabel(28, c_Height - 30, c_Search ? 0x34 : 0x47E, "S");
|
|
AddLabel(45, c_Height - 30, 0x47E, "F");
|
|
AddLabel(59, c_Height - 30, 0x47E, "M");
|
|
|
|
if (Owner.AccessLevel >= AccessLevel.Administrator)
|
|
{
|
|
AddButton(71, c_Height - 30, 0x768, 0x768, "Setup", new TimerCallback(Setup));
|
|
AddLabel(76, c_Height - 30, 0x26, "A");
|
|
}
|
|
|
|
if (c_Type == DisplayType.All)
|
|
AddHtml(c_Width - 53, c_Height - 29, 80, 21, HTML.White + General.Local(46), false, false);
|
|
else
|
|
AddHtml(c_Width - 53, c_Height - 29, 80, 21, HTML.White + General.Local(50 + (c_Type > DisplayType.All ? (int)c_Type - 1 : (int)c_Type)), false, false);
|
|
|
|
AddButton(c_Width - 70, c_Height - 26, 0x2716, 0x2716, "Display Type", new TimerCallback(DispType));
|
|
|
|
if (c_Type == DisplayType.Channel && (GetData.CurrentChannel == null || !GetData.CurrentChannel.CanChat(Owner, false)))
|
|
{
|
|
AddHtml(10, c_Height / 2 - 20, c_Width - 20, 41, HTML.White + "<CENTER>" + General.Local(31), false, false);
|
|
return;
|
|
}
|
|
if (GetData.Status == OnlineStatus.Hidden && Owner.AccessLevel == AccessLevel.Player)
|
|
{
|
|
AddHtml(10, c_Height / 2 - 20, c_Width - 20, 41, HTML.White + "<CENTER>" + General.Local(23), false, false);
|
|
return;
|
|
}
|
|
|
|
if (c_Profile != null)
|
|
Chat3.Profile.Insert(c_Profile, this, c_Width + 20, 0);
|
|
|
|
ArrayList list = BuildList();
|
|
|
|
int perpage = GetData.ChannelPP;
|
|
|
|
if (c_Type == DisplayType.Channel)
|
|
{
|
|
if( GetData.CurrentChannel != null)
|
|
AddHtml(30, y, c_Width-60, 21, HTML.White + "<CENTER>" + GetData.CurrentChannel.NameFor(Owner), false, false, false);
|
|
}
|
|
else
|
|
{
|
|
if (c_Type == DisplayType.All)
|
|
AddHtml(30, y, c_Width-60, 21, HTML.White + "<CENTER>" + General.Local(46), false, false, false);
|
|
else
|
|
AddHtml(30, y, c_Width-60, 21, HTML.White + "<CENTER>" + General.Local(50 + (c_Type > DisplayType.All ? (int)c_Type - 1 : (int)c_Type)), false, false, false);
|
|
}
|
|
|
|
y += 20;
|
|
|
|
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 - 45, 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));
|
|
|
|
string str = "";
|
|
int bar = c_Width - 18;
|
|
|
|
try
|
|
{
|
|
for (int i = perpage * c_Page; i < list.Count && i < perpage * (c_Page + 1); ++i)
|
|
{
|
|
if (list[i] is Mobile)
|
|
{
|
|
AddHtml(35, y += 20, 150, 21, GetColor((Mobile)list[i]) + ((Mobile)list[i]).Name + (Data.GetData((Mobile)list[i]).Status != OnlineStatus.Online && Data.GetData((Mobile)list[i]).Status != OnlineStatus.Hidden ? " (" + General.Local(19 + (int)Data.GetData((Mobile)list[i]).Status) + ")" : ""), false, false, false);
|
|
|
|
if (Owner == list[i])
|
|
continue;
|
|
|
|
bar = c_Width - 18;
|
|
|
|
if (GetData.QuickBar)
|
|
{
|
|
if (Owner.AccessLevel > ((Mobile)list[i]).AccessLevel)
|
|
{
|
|
if (GetData.GlobalAccess)
|
|
{
|
|
if (GetData.Global)
|
|
{
|
|
AddButton(bar -= 12, y + 3, 0x13A8, 0x13A8, "Mini Ignore", new TimerStateCallback(GIgnore), list[i]);
|
|
AddLabel(bar + 4, y, GetData.GIgnores.Contains(list[i]) ? 0x44 : 0x26, "I");
|
|
}
|
|
else
|
|
{
|
|
AddButton(bar -= 12, y + 3, 0x13A8, 0x13A8, "Mini Listen", new TimerStateCallback(GListen), list[i]);
|
|
AddLabel(bar + 4, y, GetData.GListens.Contains(list[i]) ? 0x44 : 0x26, "L");
|
|
}
|
|
}
|
|
|
|
if (((Mobile)list[i]).NetState != null)
|
|
{
|
|
AddButton(bar -= 12, y + 3, 0x13A8, 0x13A8, "Mini Goto", new TimerStateCallback(Goto), list[i]);
|
|
AddLabel(bar + 3, y - 2, 0x47E, "g");
|
|
|
|
AddButton(bar -= 12, y + 3, 0x13A8, 0x13A8, "Mini Client", new TimerStateCallback(Client), list[i]);
|
|
AddLabel(bar + 3, y - 2, 0x47E, "c");
|
|
}
|
|
|
|
AddButton(bar -= 12, y + 3, 0x13A8, 0x13A8, "Mini Ban", new TimerStateCallback(Ban), list[i]);
|
|
AddLabel(bar + 4, y, Data.GetData((Mobile)list[i]).Banned ? 0x44 : 0x26, "b");
|
|
}
|
|
|
|
if (Chat3.Message.CanMessage(Owner, (Mobile)list[i]))
|
|
{
|
|
AddButton(bar -= 12, y + 3, 0x13A8, 0x13A8, "Mini Message", new TimerStateCallback(Message), list[i]);
|
|
AddLabel(bar + 3, y - 2, 0x47E, "m");
|
|
}
|
|
|
|
AddButton(bar -= 12, y + 3, 0x13A8, 0x13A8, "Mini Ignore", new TimerStateCallback(Ignore), list[i]);
|
|
AddLabel(bar + 5, y - 1, GetData.Ignores.Contains(list[i]) ? 0x44 : 0x26, "i");
|
|
|
|
AddButton(bar -= 12, y + 3, 0x13A8, 0x13A8, "Mini Friend", new TimerStateCallback(Friend), list[i]);
|
|
AddLabel(bar + 3, y, GetData.Friends.Contains(list[i]) ? 0x44 : 0x26, "f");
|
|
}
|
|
|
|
AddButton(20, y + 3, list[i] == c_Profile ? 0x939 : 0x2716, list[i] == c_Profile ? 0x939 : 0x2716, "Profile", new TimerStateCallback(Profile), (Mobile)list[i]);
|
|
}
|
|
else if (list[i] is string)
|
|
{
|
|
str = list[i].ToString();
|
|
|
|
if (str.IndexOf("@") == 0)
|
|
str = str.Substring(1, str.Length - 1);
|
|
|
|
AddHtml(35, y += 20, 90, 21, HTML.White + list[i].ToString(), false, false);
|
|
|
|
AddButton(c_Width - 40, y, GetData.IrcIgnores.Contains(str) ? 0x5687 : 0x5686, GetData.IrcIgnores.Contains(str) ? 0x5687 : 0x5686, "Ignore IRC", new TimerStateCallback(IgnoreIrc), list[i]);
|
|
}
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
AddHtml(35, y += 20, 90, 21, HTML.White + "!!!", false, false);
|
|
}
|
|
}
|
|
|
|
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 || Data.GetData(m).Status == OnlineStatus.Hidden)
|
|
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;
|
|
}
|
|
|
|
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;
|
|
int y = 10;
|
|
|
|
AddHtml(x, 10, 300, 21, HTML.White + "<CENTER>" + General.Local(39), false, false);
|
|
|
|
AddHtml(x + 30, y += 20, 170, 21, HTML.White + General.Local(41), false, false);
|
|
AddImageTiled(x + 180, y, 70, 21, 0xBBA);
|
|
AddTextField(x + 180, y, 70, 21, 0x480, 0, GetData.ChannelsSpeech);
|
|
AddButton(x + 260, y + 3, 0x2716, 0x2716, "Submit Speech", new TimerCallback(SubmitSpeech));
|
|
|
|
AddHtml(x + 60, y+=25, 220, 21, HTML.White + General.Local(195), false, false, false);
|
|
AddButton(x + 30, y, GetData.QuickBar ? 0x2343 : 0x2342, GetData.QuickBar ? 0x2343 : 0x2342, "Quickbar", new TimerCallback(QuickBar));
|
|
|
|
AddHtml(x + 180, y, 120, 21, HTML.White + General.Local(47), false, false);
|
|
AddImage(x + 150, y, 0x2342, GetData.SystemC);
|
|
AddButton(x + 154, y + 4, 0x2716, 0x2716, "System Color", new TimerCallback(SystemColor));
|
|
|
|
y += 25;
|
|
|
|
if (Owner.AccessLevel != AccessLevel.Player)
|
|
{
|
|
AddHtml(x + 60, y, 120, 21, HTML.Red + General.Local(48), false, false, false);
|
|
AddImage(x + 30, y, 0x2342, GetData.StaffC);
|
|
AddButton(x + 34, y + 4, 0x2716, 0x2716, "Staff Color", new TimerCallback(StaffColor));
|
|
}
|
|
|
|
if (GetData.GlobalAccess)
|
|
{
|
|
AddHtml(x + 180, y, 220, 21, HTML.Red + General.Local(43), false, false, false);
|
|
AddButton(x + 150, y, GetData.Global ? 0x2343 : 0x2342, GetData.Global ? 0x2343 : 0x2342, "Global", new TimerCallback(Global));
|
|
|
|
if (GetData.Global)
|
|
{
|
|
AddHtml(x + 80, y += 25, 120, 21, HTML.Red + General.Local(44), false, false, false);
|
|
AddButton(x + 30, y, GetData.GlobalC ? 0x2343 : 0x2342, GetData.GlobalC ? 0x2343 : 0x2342, "Global Chat", new TimerCallback(GlobalChat));
|
|
AddImage(x + 50, y, 0x2342, GetData.GlobalCC);
|
|
AddButton(x + 54, y + 4, 0x2716, 0x2716, "Global Chat Color", new TimerCallback(GlobalChatColor));
|
|
|
|
AddHtml(x + 200, y, 120, 21, HTML.Red + General.Local(45), false, false, false);
|
|
AddButton(x + 150, y, GetData.GlobalW ? 0x2343 : 0x2342, GetData.GlobalW ? 0x2343 : 0x2342, "Global World", new TimerCallback(GlobalWorld));
|
|
AddImage(x + 170, y, 0x2342, GetData.GlobalWC);
|
|
AddButton(x + 174, y + 4, 0x2716, 0x2716, "Global World Color", new TimerCallback(GlobalWorldColor));
|
|
|
|
y += 25;
|
|
|
|
if (Channel.GetByName("Guild") != null)
|
|
{
|
|
AddHtml(x + 80, y, 120, 21, HTML.Red + General.Local(192), false, false, false);
|
|
AddButton(x + 30, y, GetData.GlobalG ? 0x2343 : 0x2342, GetData.GlobalG ? 0x2343 : 0x2342, "Global Guild", new TimerCallback(GlobalGuild));
|
|
AddImage(x + 50, y, 0x2342, GetData.GlobalGC);
|
|
AddButton(x + 54, y + 4, 0x2716, 0x2716, "Global Guild Color", new TimerCallback(GlobalGuildColor));
|
|
}
|
|
|
|
if (Channel.GetByName("Faction") != null)
|
|
{
|
|
AddHtml(x + 200, y, 120, 21, HTML.Red + General.Local(193), false, false, false);
|
|
AddButton(x + 150, y, GetData.GlobalF ? 0x2343 : 0x2342, GetData.GlobalF ? 0x2343 : 0x2342, "Global Faction", new TimerCallback(GlobalFaction));
|
|
AddImage(x + 170, y, 0x2342, GetData.GlobalFC);
|
|
AddButton(x + 174, y + 4, 0x2716, 0x2716, "Global Faction Color", new TimerCallback(GlobalFactionColor));
|
|
}
|
|
}
|
|
}
|
|
|
|
Entries.Insert(0, new GumpBackground(x, 0, 300, y + 40, 0x1400));
|
|
|
|
if( GetData.CurrentChannel != null )
|
|
GetData.CurrentChannel.GumpOptions(this, x, y + 40);
|
|
}
|
|
|
|
protected override void OnClose()
|
|
{
|
|
if (c_Profile != null)
|
|
{
|
|
c_Profile = null;
|
|
NewGump();
|
|
return;
|
|
}
|
|
|
|
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.ChannelPP++;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void PerPageDown()
|
|
{
|
|
GetData.ChannelPP--;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void Search()
|
|
{
|
|
c_Search = !c_Search;
|
|
|
|
c_Options = false;
|
|
c_Profile = null;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void Options()
|
|
{
|
|
c_Options = !c_Options;
|
|
|
|
c_Search = false;
|
|
c_Profile = null;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void Channels()
|
|
{
|
|
new ChannelSelectGump(this);
|
|
}
|
|
|
|
private void Friends()
|
|
{
|
|
NewGump();
|
|
|
|
FriendsGump.SendTo(Owner);
|
|
}
|
|
|
|
private void Mail()
|
|
{
|
|
NewGump();
|
|
|
|
MailGump.SendTo(Owner);
|
|
}
|
|
|
|
private void Setup()
|
|
{
|
|
NewGump();
|
|
|
|
SetupGump.SendTo(Owner);
|
|
}
|
|
|
|
private void Profile(object o)
|
|
{
|
|
if (!(o is Mobile))
|
|
return;
|
|
|
|
if (c_Profile == o)
|
|
c_Profile = null;
|
|
else
|
|
c_Profile = (Mobile)o;
|
|
|
|
c_Search = false;
|
|
c_Options = 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 SubmitSpeech()
|
|
{
|
|
GetData.ChannelsSpeech = GetTextField(0);
|
|
|
|
if (GetData.ChannelsSpeech != "")
|
|
Owner.SendMessage(GetData.SystemC, General.Local(70) + " \"" + GetData.ChannelsSpeech + "\"");
|
|
else
|
|
Owner.SendMessage(GetData.SystemC, General.Local(71));
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void QuickBar()
|
|
{
|
|
GetData.QuickBar = !GetData.QuickBar;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void Global()
|
|
{
|
|
GetData.Global = !GetData.Global;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void GlobalChat()
|
|
{
|
|
GetData.GlobalC = !GetData.GlobalC;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void GlobalWorld()
|
|
{
|
|
GetData.GlobalW = !GetData.GlobalW;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void GlobalGuild()
|
|
{
|
|
GetData.GlobalG = !GetData.GlobalG;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void GlobalFaction()
|
|
{
|
|
GetData.GlobalF = !GetData.GlobalF;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void GlobalChatColor()
|
|
{
|
|
Owner.SendHuePicker(new InternalPicker(this, 0));
|
|
}
|
|
|
|
private void GlobalWorldColor()
|
|
{
|
|
Owner.SendHuePicker(new InternalPicker(this, 1));
|
|
}
|
|
|
|
private void GlobalGuildColor()
|
|
{
|
|
Owner.SendHuePicker(new InternalPicker(this, 4));
|
|
}
|
|
|
|
private void GlobalFactionColor()
|
|
{
|
|
Owner.SendHuePicker(new InternalPicker(this, 5));
|
|
}
|
|
|
|
private void SystemColor()
|
|
{
|
|
Owner.SendHuePicker(new InternalPicker(this, 2));
|
|
}
|
|
|
|
private void StaffColor()
|
|
{
|
|
Owner.SendHuePicker(new InternalPicker(this, 3));
|
|
}
|
|
|
|
private void DispType()
|
|
{
|
|
new DisplayTypeGump(this);
|
|
}
|
|
|
|
private void IgnoreIrc(object o)
|
|
{
|
|
if (!(o is string))
|
|
return;
|
|
|
|
string str = o.ToString();
|
|
|
|
if (str.IndexOf("@") == 0)
|
|
str = str.Substring(1, str.Length - 1);
|
|
|
|
if (!GetData.IrcIgnores.Contains(str))
|
|
GetData.AddIrcIgnore(str);
|
|
else
|
|
GetData.RemoveIrcIgnore(str);
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void Friend(object o)
|
|
{
|
|
if (!(o is Mobile))
|
|
return;
|
|
|
|
Mobile m = (Mobile)o;
|
|
|
|
if (Data.GetData(m).ByRequest && !GetData.Friends.Contains(m))
|
|
{
|
|
if (!TrackSpam.LogSpam(Owner, "Request " + m.Name, TimeSpan.FromHours(24)))
|
|
{
|
|
TimeSpan ts = TrackSpam.NextAllowedIn(Owner, "Request " + m.Name, TimeSpan.FromHours(Data.RequestSpam));
|
|
string txt = (ts.Days != 0 ? ts.Days + " " + General.Local(170) + " " : "") + (ts.Hours != 0 ? ts.Hours + " " + General.Local(171) + " " : "") + (ts.Minutes != 0 ? ts.Minutes + " " + General.Local(172) + " " : "");
|
|
|
|
Owner.SendMessage(GetData.SystemC, General.Local(96) + " " + txt);
|
|
NewGump();
|
|
return;
|
|
}
|
|
|
|
Data.GetData(m).AddMessage(new Message(Owner, General.Local(84), General.Local(85), MsgType.Invite));
|
|
|
|
Owner.SendMessage(GetData.SystemC, General.Local(86) + " " + m.Name);
|
|
|
|
if (m.HasGump(typeof(FriendsGump)))
|
|
General.RefreshGump(m, typeof(FriendsGump));
|
|
else
|
|
FriendsGump.SendTo(m, true);
|
|
|
|
General.RefreshGump(m, typeof(MailGump));
|
|
|
|
NewGump();
|
|
|
|
return;
|
|
}
|
|
|
|
if (GetData.Friends.Contains(m))
|
|
GetData.RemoveFriend(m);
|
|
else
|
|
GetData.AddFriend(m);
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void Ignore(object o)
|
|
{
|
|
if (!(o is Mobile))
|
|
return;
|
|
|
|
Mobile m = (Mobile)o;
|
|
|
|
if (GetData.Ignores.Contains(m))
|
|
GetData.RemoveIgnore(m);
|
|
else
|
|
GetData.AddIgnore(m);
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void Message(object o)
|
|
{
|
|
if (!(o is Mobile))
|
|
return;
|
|
|
|
Mobile m = (Mobile)o;
|
|
|
|
NewGump();
|
|
|
|
if (Chat3.Message.CanMessage(Owner, m))
|
|
SendMessageGump.SendTo(Owner, m);
|
|
}
|
|
|
|
private void Ban(object o)
|
|
{
|
|
if (!(o is Mobile))
|
|
return;
|
|
|
|
Mobile m = (Mobile)o;
|
|
|
|
if (Data.GetData(m).Banned)
|
|
{
|
|
Data.GetData(m).RemoveBan();
|
|
Owner.SendMessage(GetData.SystemC, General.Local(78) + " " + m.Name);
|
|
NewGump();
|
|
}
|
|
else
|
|
new BanGump(m, this);
|
|
}
|
|
|
|
private void GIgnore(object o)
|
|
{
|
|
if (!(o is Mobile))
|
|
return;
|
|
|
|
Mobile m = (Mobile)o;
|
|
|
|
if (GetData.GIgnores.Contains(m))
|
|
GetData.RemoveGIgnore(m);
|
|
else
|
|
GetData.AddGIgnore(m);
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void GListen(object o)
|
|
{
|
|
if (!(o is Mobile))
|
|
return;
|
|
|
|
Mobile m = (Mobile)o;
|
|
|
|
if (GetData.GListens.Contains(m))
|
|
GetData.RemoveGListen(m);
|
|
else
|
|
GetData.AddGListen(m);
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void Client(object o)
|
|
{
|
|
if (!(o is Mobile))
|
|
return;
|
|
|
|
Mobile m = (Mobile)o;
|
|
|
|
NewGump();
|
|
|
|
if (m.NetState == null)
|
|
Owner.SendMessage(GetData.SystemC, m.Name + " " + General.Local(83));
|
|
else
|
|
Owner.SendGump(new ClientGump(Owner, m.NetState));
|
|
}
|
|
|
|
private void Goto(object o)
|
|
{
|
|
if (!(o is Mobile))
|
|
return;
|
|
|
|
Mobile m = (Mobile)o;
|
|
|
|
if (m.NetState == null)
|
|
Owner.SendMessage(GetData.SystemC, m.Name + " " + General.Local(83));
|
|
else
|
|
{
|
|
Owner.Location = m.Location;
|
|
Owner.Map = m.Map;
|
|
}
|
|
|
|
NewGump();
|
|
}
|
|
|
|
#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 Mobile) && !(x is string)))
|
|
return -1;
|
|
if (y == null || (!(y is Mobile) && !(x is string)))
|
|
return 1;
|
|
|
|
if (x is Mobile && !(y is Mobile))
|
|
return -1;
|
|
if (y is Mobile && !(x is Mobile))
|
|
return 1;
|
|
|
|
if (x is Mobile && y is Mobile)
|
|
{
|
|
Mobile a = (Mobile)x;
|
|
Mobile b = (Mobile)y;
|
|
|
|
if (a.AccessLevel > b.AccessLevel)
|
|
return -1;
|
|
if (a.AccessLevel < b.AccessLevel)
|
|
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);
|
|
}
|
|
else
|
|
{
|
|
string a = x.ToString();
|
|
string b = y.ToString();
|
|
|
|
return Insensitive.Compare(a, b);
|
|
}
|
|
}
|
|
}
|
|
|
|
private class BanGump : GumpPlus
|
|
{
|
|
private GumpPlus c_Gump;
|
|
private Mobile c_Target;
|
|
|
|
public BanGump(Mobile m, GumpPlus g)
|
|
: base(g.Owner, 100, 100)
|
|
{
|
|
c_Gump = g;
|
|
c_Target = m;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
protected override void BuildGump()
|
|
{
|
|
int y = 10;
|
|
|
|
AddHtml(0, y, 150, 21, HTML.White + "<CENTER>" + General.Local(160), false, false);
|
|
|
|
AddHtml(40, y += 20, 100, 21, HTML.White + General.Local(161), false, false);
|
|
AddButton(25, y + 3, 0x2716, 0x2716, "30 minutes", new TimerStateCallback(BanTime), TimeSpan.FromMinutes(30));
|
|
AddHtml(40, y += 20, 100, 21, HTML.White + General.Local(162), false, false);
|
|
AddButton(25, y + 3, 0x2716, 0x2716, "1 hour", new TimerStateCallback(BanTime), TimeSpan.FromHours(1));
|
|
AddHtml(40, y += 20, 100, 21, HTML.White + General.Local(163), false, false);
|
|
AddButton(25, y + 3, 0x2716, 0x2716, "12 hours", new TimerStateCallback(BanTime), TimeSpan.FromHours(12));
|
|
AddHtml(40, y += 20, 100, 21, HTML.White + General.Local(164), false, false);
|
|
AddButton(25, y + 3, 0x2716, 0x2716, "1 day", new TimerStateCallback(BanTime), TimeSpan.FromDays(1));
|
|
AddHtml(40, y += 20, 100, 21, HTML.White + General.Local(165), false, false);
|
|
AddButton(25, y + 3, 0x2716, 0x2716, "1 week", new TimerStateCallback(BanTime), TimeSpan.FromDays(7));
|
|
AddHtml(40, y += 20, 100, 21, HTML.White + General.Local(166), false, false);
|
|
AddButton(25, y + 3, 0x2716, 0x2716, "1 month", new TimerStateCallback(BanTime), TimeSpan.FromDays(30));
|
|
AddHtml(40, y += 20, 100, 21, HTML.White + General.Local(167), false, false);
|
|
AddButton(25, y + 3, 0x2716, 0x2716, "1 year", new TimerStateCallback(BanTime), TimeSpan.FromDays(365));
|
|
|
|
Entries.Insert(0, new GumpBackground(0, 0, 150, y + 40, 0x1400));
|
|
}
|
|
|
|
private void BanTime(object o)
|
|
{
|
|
if (!(o is TimeSpan))
|
|
return;
|
|
|
|
Data.GetData(c_Target).Ban((TimeSpan)o);
|
|
Owner.SendMessage(Data.GetData(Owner).SystemC, General.Local(77) + " " + c_Target.Name);
|
|
|
|
c_Gump.NewGump();
|
|
}
|
|
|
|
protected override void OnClose()
|
|
{
|
|
c_Gump.NewGump();
|
|
}
|
|
}
|
|
|
|
private class ChannelSelectGump : GumpPlus
|
|
{
|
|
private GumpPlus c_Gump;
|
|
|
|
public ChannelSelectGump(GumpPlus 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.CanChat(Owner, false))
|
|
{
|
|
AddHtml(60, y += 20, 100, 21, HTML.White + c.NameFor(Owner), false, false);
|
|
AddButton(20, y, Data.GetData(Owner).Channels.Contains(c.Name) ? 0x2343 : 0x2342, Data.GetData(Owner).Channels.Contains(c.Name) ? 0x2343 : 0x2342, "Join Channel", new TimerStateCallback(JoinChannel), c);
|
|
|
|
if (Data.GetData(Owner).Channels.Contains(c.Name))
|
|
AddButton(45, y + 3, 0x2716, 0x2716, "View Channel", new TimerStateCallback(ViewChannel), c);
|
|
}
|
|
}
|
|
|
|
Entries.Insert(0, new GumpBackground(0, 0, 165, y + 40, 0x1400));
|
|
}
|
|
|
|
private void JoinChannel(object o)
|
|
{
|
|
if (!(o is Channel))
|
|
return;
|
|
|
|
Channel c = (Channel)o;
|
|
|
|
if (Data.GetData(Owner).Channels.Contains(c.Name))
|
|
{
|
|
Owner.SendMessage(Data.GetData(Owner).SystemC, General.Local(189) + " " + c.NameFor(Owner));
|
|
Data.GetData(Owner).Channels.Remove(c.Name);
|
|
}
|
|
else
|
|
{
|
|
Owner.SendMessage(Data.GetData(Owner).SystemC, General.Local(190) + " " + c.NameFor(Owner));
|
|
Data.GetData(Owner).Channels.Add(c.Name);
|
|
}
|
|
|
|
if (Data.GetData(Owner).CurrentChannel == c)
|
|
Data.GetData(Owner).CurrentChannel = null;
|
|
|
|
NewGump();
|
|
}
|
|
|
|
private void ViewChannel(object o)
|
|
{
|
|
if (!(o is Channel))
|
|
return;
|
|
|
|
Data.GetData(Owner).CurrentChannel = (Channel)o;
|
|
|
|
c_Gump.NewGump();
|
|
}
|
|
|
|
protected override void OnClose()
|
|
{
|
|
c_Gump.NewGump();
|
|
}
|
|
}
|
|
|
|
private class DisplayTypeGump : GumpPlus
|
|
{
|
|
private ChannelGump c_Gump;
|
|
|
|
public DisplayTypeGump(ChannelGump 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(55), false, false);
|
|
|
|
AddHtml(60, y += 20, 100, 21, HTML.White + General.Local(50), false, false);
|
|
AddButton(45, y + 3, 0x2716, 0x2716, "Channel", new TimerStateCallback(Display), DisplayType.Channel);
|
|
AddHtml(60, y += 20, 100, 21, HTML.White + General.Local(46), false, false);
|
|
AddButton(45, y + 3, 0x2716, 0x2716, "View All", new TimerStateCallback(Display), DisplayType.All);
|
|
AddHtml(60, y += 20, 100, 21, HTML.White + General.Local(51), false, false);
|
|
AddButton(45, y + 3, 0x2716, 0x2716, "Ignores", new TimerStateCallback(Display), DisplayType.Ignores);
|
|
|
|
if (Data.GetData(Owner).GlobalAccess)
|
|
{
|
|
AddHtml(60, y += 20, 100, 21, HTML.White + General.Local(52), false, false);
|
|
AddButton(45, y + 3, 0x2716, 0x2716, "GIgnores", new TimerStateCallback(Display), DisplayType.GIgnores);
|
|
AddHtml(60, y += 20, 100, 21, HTML.White + General.Local(53), false, false);
|
|
AddButton(45, y + 3, 0x2716, 0x2716, "GListens", new TimerStateCallback(Display), DisplayType.GListens);
|
|
}
|
|
|
|
if (Owner.AccessLevel >= AccessLevel.GameMaster)
|
|
{
|
|
AddHtml(60, y += 20, 100, 21, HTML.White + General.Local(54), false, false);
|
|
AddButton(45, y + 3, 0x2716, 0x2716, "Bans", new TimerStateCallback(Display), DisplayType.Bans);
|
|
}
|
|
|
|
Entries.Insert(0, new GumpBackground(0, 0, 150, y + 40, 0x1400));
|
|
}
|
|
|
|
private void Display(object o)
|
|
{
|
|
if (!(o is DisplayType))
|
|
return;
|
|
|
|
c_Gump.Type = (DisplayType)o;
|
|
|
|
c_Gump.NewGump();
|
|
}
|
|
|
|
protected override void OnClose()
|
|
{
|
|
c_Gump.NewGump();
|
|
}
|
|
}
|
|
|
|
private class InternalPicker : HuePicker
|
|
{
|
|
private GumpPlus c_Gump;
|
|
private int c_Num;
|
|
|
|
public InternalPicker(GumpPlus g, int num) : base(0x1018)
|
|
{
|
|
c_Gump = g;
|
|
c_Num = num;
|
|
}
|
|
|
|
public override void OnResponse(int hue)
|
|
{
|
|
switch (c_Num)
|
|
{
|
|
case 0: Data.GetData(c_Gump.Owner).GlobalCC = hue; break;
|
|
case 1: Data.GetData(c_Gump.Owner).GlobalWC = hue; break;
|
|
case 2: Data.GetData(c_Gump.Owner).SystemC = hue; break;
|
|
case 3: Data.GetData(c_Gump.Owner).StaffC = hue; break;
|
|
case 4: Data.GetData(c_Gump.Owner).GlobalGC = hue; break;
|
|
case 5: Data.GetData(c_Gump.Owner).GlobalFC = hue; break;
|
|
}
|
|
|
|
c_Gump.NewGump();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
} |