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,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
}
}