Updates Packets & Randomizer (#43)

* Fixes a bug with the main loop. Removes unnecessary optimizations for RDRand.

* WIP - Rewriting packets.

* Cleanup and updates README

* Converts more packets

* Fixes header

* Converts Effects packets.

* Forgot the send command

* Adds the start of containers packets.

* Adds message packets with caching

* Extends the send methods

* Starts to add Acquire methods

* Converted the packets

* Cleanup

* Cleanup

* Adds more packets

* Adds more packets

* Fixes clearing arrays from pool. Adds Mobile Incoming

* Converts more packets.

* Moves more packets

* Moves more packets

* Test compression

* Merges

* Migrating to an idiomatic syntax that also supports compression, and proxying.

* Optimize the stack alloc. Changes attributes

* Converted container packets

* Visual Studio doesn't auto save files. I am still getting used to subpar IDEs.

* Adds static packet caching. Will profile later. Converts more packets

* Fixes packets and changes how compression is configured

* WIP - Adds basics for Gumps. Not finished though.

* Fix file

* Fixes formatting

* Changed SpanWriter to be more idiomatic.

* Fixes Span vs RawSpan and missing stackallocs

* Converts over some more gumps

* WIP - Deletes 32bit support.

* Drops RDRand32 support.

* Fixes gump compilation

* Converting gump components

* Removes old huffman compression function

* Revert signature for backwards compatibility

* WIP - Converting more gump components

* Creates ArraySet for the strings. Updates AppendTo to reference that.

* Converts the maining gump components

* Cleans up gump components

* Cleans up directives

* Cleans up ArraySet and moves it. Adds null-coalescing-assignment

* Cleanup, Target Packets, and C# 8 changes.

* Removed OPL Packet

* World packets

* Fixing packet uses

* Cleans up code. Fixes packet uses in various places.

* More cleanup for packets

* Code cleanup

* Converts more packet uses and cleans up more code

* More code cleanup

* Finishes fixing the packets in Item

* Updates secure trade packets

* Updates core and gets it to compile.

* Moved packets to scripts. Fixed account handler use of packets

* Code cleanup

* Updates chat packets

* Code cleanuo

* Adds party packets, but need to implement them.

* Party packets WIP

* Finishes party packets

* Rearrange movement namespaces and classes

* Finishes plant packets

* Code Formatting

* Fixes moving effects

* Code cleanup, eliminates equipinfo

* Adds more packets. Fixes bugs with various packets.

* Finishes mahjon packets

* Fixes mahjong packet

* Code cleanup

* Finishes mahjong packets

* Adds Map packets

* Add multifacet maps and charts

* Cleans up some packets with UTF8

* Optimizes packets

* Cleans up more packets. Moves the MessageHelper

* Removes assistant support. Removes extended protocol. Incorporates MapUO packets as normal packets.

* Updates protocol extensions packet receiver

* Fixes a few bugs. Fixes a few more packets.

* Code cleanup and fixing more packets

* Fixes packet effects

* Cleaned up more code

* Buff Icon cleanup

* Removed unused constructors

* Code Cleanup. Adds BoatHS Packets

* Moves house files. Updates house foundation packets.

* Deployment cleanup

* Fixes:

* Code cleanup

* More code cleanup

* More code cleanup

* Cleaned up BaseHouse

* Enforces styling

* Converts foreach to linq where possible.

* Dont need that

* Goals/Readme updates

* Removes 32bit support at the highest level. Turns on HRT by default.

* Code cleanup. Fixes extended features packet.

* Fixes various bugs

* Code cleanup

* Code cleanup

* Code cleanup. Fixes gump X/Y assignment.

* Code cleanup using |= operator

* More code cleanup

* Cleanup

* Fixes spacing issues. Thanks Visual Studio. You suck.

* Compiler error

* Fixes NPE from RunUO 2.7

* Renames ScriptCompiler to AssemblyHandler. Fixes packets. Updates README

* Fixes more packets. Stupid trailing nulls.

* Fixes various bugs.

* Fixes for gumps

* Fixes more gump stuff. Going to split it out later since it is getting insane

* Recoded the gump writing

* WIP

* *Added output path of scripts project to dev branch
*Activated debugging in code
This commit is contained in:
Kamron Batman 2019-11-11 03:40:16 -08:00 committed by 3HMonkey
parent 7aa8fd3df1
commit 179cb50557
588 changed files with 10843 additions and 16177 deletions

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadMember(m_Mobile, m_Guild))
return;
@ -38,7 +38,7 @@ namespace Server.Gumps
Mobile m = m_List[index];
if (m?.Deleted == false)
state.Mobile.GuildFealty = m;
sender.Mobile.GuildFealty = m;
}
}
}

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -1,5 +1,4 @@
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -21,7 +21,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1013077); // Refuse
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -17,7 +17,7 @@ namespace Server.Gumps
AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadMember(m_Mobile, m_Guild))
return;

View file

@ -41,7 +41,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 360, 150, 30, 1011012); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (Guild.NewGuildSystem && !BaseGuildGump.IsLeader(m_Mobile, m_Guild) ||
!Guild.NewGuildSystem && GuildGump.BadLeader(m_Mobile, m_Guild))

View file

@ -41,7 +41,7 @@ namespace Server.Gumps
AddHtml(55, 220, 300, 20, website);
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadMember(m_Mobile, m_Guild))
return;

View file

@ -1,5 +1,4 @@
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -23,7 +23,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -1,6 +1,5 @@
using System.Collections.Generic;
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -1,5 +1,4 @@
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -20,7 +20,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -17,7 +17,7 @@ namespace Server.Gumps
AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadMember(m_Mobile, m_Guild))
return;

View file

@ -1,5 +1,4 @@
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -63,7 +63,7 @@ namespace Server.Gumps
AddHtmlLocalized(55, 400, 400, 35, 1011104); // Return to the previous menu.
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -86,7 +86,7 @@ namespace Server.Gumps
}
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadMember(m_Mobile, m_Guild))
return;

View file

@ -1,5 +1,4 @@
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{

View file

@ -82,7 +82,7 @@ namespace Server.Gumps
AddHtmlLocalized(335, 360, 100, 30, 1011441); // EXIT
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState sender, RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
return;

View file

@ -1,3 +1,4 @@
using System.Linq;
using Server.Gumps;
using Server.Misc;
using Server.Mobiles;
@ -40,9 +41,7 @@ namespace Server.Guilds
public override void OnResponse(NetState sender, RelayInfo info)
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (!IsMember(pm, guild))
if (!(sender.Mobile is PlayerMobile pm &&IsMember(pm, guild)))
return;
switch (info.ButtonID)
@ -85,30 +84,12 @@ namespace Server.Guilds
s = s.ToLower();
for (int i = 0; i < s.Length; ++i)
{
char c = s[i];
if ((c < 'a' || c > 'z') && (c < '0' || c > '9'))
{
bool except = false;
for (int j = 0; !except && j < exceptions.Length; j++)
if (c == exceptions[j])
except = true;
if (!except)
return false;
}
}
if (s.Any(c => (c < 'a' || c > 'z') && (c < '0' || c > '9') && exceptions.All(exception => exception != c)))
return false;
string[] disallowed = ProfanityProtection.Disallowed;
for (int i = 0; i < disallowed.Length; i++)
if (s.IndexOf(disallowed[i]) != -1)
return false;
return true;
return disallowed.All(t => s.IndexOf(t) == -1);
}
public void AddHtmlText(int x, int y, int width, int height, TextDefinition text, bool back, bool scroll)

View file

@ -108,9 +108,7 @@ namespace Server.Guilds
if (PendingWar)
{
if (war.WarRequester)
{
number = 1063027; // <div align=center>You have challenged this guild to war!</div>
}
else
{
number = 1062969; // <div align=center>This guild has challenged you to war!</div>
@ -211,9 +209,7 @@ namespace Server.Guilds
if (war?.WarRequester == false && activeWar == null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
@ -276,9 +272,7 @@ namespace Server.Guilds
if (war?.WarRequester == false && activeWar == null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
@ -287,9 +281,7 @@ namespace Server.Guilds
alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
pm.SendGump(new WarDeclarationGump(pm, guild, otherGuild));
}
}
break;
@ -299,9 +291,7 @@ namespace Server.Guilds
if (war != null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
@ -324,9 +314,7 @@ namespace Server.Guilds
case 8: //Surrender
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
@ -384,9 +372,7 @@ namespace Server.Guilds
if (war == null && activeWar == null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
@ -402,9 +388,7 @@ namespace Server.Guilds
otherAlliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
pm.SendGump(new WarDeclarationGump(pm, guild, m_Other));
}
}
break;
@ -419,14 +403,10 @@ namespace Server.Guilds
if (alliance == null)
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1070747); // You don't have permission to create an alliance.
}
else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
{
pm.SendLocalizedMessage(
1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
}
else if (otherAlliance != null)
{
if (otherAlliance.IsPendingMember(m_Other))
@ -436,13 +416,9 @@ namespace Server.Guilds
pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance.
}
else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war.
}
else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war.
}
else
{
pm.SendLocalizedMessage(1063439); // Enter a name for the new alliance:
@ -457,14 +433,10 @@ namespace Server.Guilds
else
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if (otherAlliance != null)
{
if (otherAlliance.IsPendingMember(m_Other))
@ -474,23 +446,15 @@ namespace Server.Guilds
pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance.
}
else if (alliance.IsPendingMember(guild))
{
pm.SendLocalizedMessage(1063416,
guild.Name); // ~1_val~ is currently considering another alliance proposal.
}
else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war.
}
else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war.
}
else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
{
pm.SendLocalizedMessage(
1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
}
else
{
pm.SendLocalizedMessage(1070750,
@ -517,9 +481,7 @@ namespace Server.Guilds
case 11: //Leave Alliance
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance?.IsMember(guild) == true)
{
guild.Alliance = null; //Calls alliance.Removeguild
@ -535,14 +497,10 @@ namespace Server.Guilds
case 12: //Remove Guild from alliance
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if (alliance?.IsMember(guild) == true && alliance.IsMember(m_Other))
{
m_Other.Alliance = null;
@ -557,14 +515,10 @@ namespace Server.Guilds
case 13: //Promote to Alliance leader
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && alliance.Leader != guild)
{
pm.SendLocalizedMessage(1063239,
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if (alliance?.IsMember(guild) == true && alliance.IsMember(m_Other))
{
pm.SendLocalizedMessage(1063434,
@ -578,9 +532,7 @@ namespace Server.Guilds
case 14: //Withdraw Request
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && alliance.Leader == guild && alliance.IsPendingMember(m_Other))
{
m_Other.Alliance = null;
@ -592,9 +544,7 @@ namespace Server.Guilds
case 15: //Deny Alliance Request
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && otherAlliance != null && alliance.Leader == m_Other &&
otherAlliance.IsPendingMember(guild))
{
@ -609,9 +559,7 @@ namespace Server.Guilds
case 16: //Accept Alliance Request
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (otherAlliance != null && otherAlliance.Leader == m_Other &&
otherAlliance.IsPendingMember(guild))
{
@ -640,20 +588,15 @@ namespace Server.Guilds
if (!IsMember(from, guild) || alliance != null)
return;
RankDefinition playerRank = pm.GuildRank;
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1070747); // You don't have permission to create an alliance.
}
else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
{
//Notes about this: OSI only cares/checks when proposing, you can change your faction all you want later.
pm.SendLocalizedMessage(
1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
}
else if (otherAlliance != null)
{
if (otherAlliance.IsPendingMember(m_Other))
@ -663,30 +606,20 @@ namespace Server.Guilds
pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance.
}
else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war.
}
else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war.
}
else
{
string name = Utility.FixHtml(text.Trim());
if (!CheckProfanity(name))
{
pm.SendLocalizedMessage(1070886); // That alliance name is not allowed.
}
else if (name.Length > Guild.NameLimit)
{
pm.SendLocalizedMessage(1070887,
Guild.NameLimit.ToString()); // An alliance name cannot exceed ~1_val~ characters in length.
}
else if (AllianceInfo.Alliances.ContainsKey(name.ToLower()))
{
pm.SendLocalizedMessage(1063428); // That alliance name is not available.
}
else
{
pm.SendLocalizedMessage(1070750,