fix: Removes razor negotiations since they arent maintained (#1090)
This commit is contained in:
parent
4f28e1e3c4
commit
8d3aaaeb2a
7 changed files with 14 additions and 188 deletions
|
|
@ -1,107 +0,0 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: AssistantConfiguration.cs *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Server.Json;
|
||||
|
||||
namespace Server.Assistants;
|
||||
|
||||
public static class AssistantConfiguration
|
||||
{
|
||||
private const string _path = "Configuration/assistants.json";
|
||||
|
||||
public static bool Enabled { get; private set; }
|
||||
|
||||
public static AssistantSettings Settings { get; private set; }
|
||||
|
||||
private const string _defaultWarningMessage = "The server was unable to negotiate features with your assistant. "
|
||||
+ "You must download and run an updated version of <A HREF=\"https://uosteam.com\">UOSteam</A>"
|
||||
+ " or <A HREF=\"https://github.com/markdwags/Razor/releases/latest\">Razor</A>."
|
||||
+ "<BR><BR>Make sure you've checked the option <B>Negotiate features with server</B>, "
|
||||
+ "once you have this box checked you may log in and play normally."
|
||||
+ "<BR><BR>You will be disconnected shortly.";
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
Enabled = ServerConfiguration.GetOrUpdateSetting("assistants.enableRazorNegotiation", false);
|
||||
|
||||
var path = Path.Join(Core.BaseDirectory, _path);
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
Settings = JsonConfig.Deserialize<AssistantSettings>(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings = new AssistantSettings
|
||||
{
|
||||
WarnOnFailure = true,
|
||||
KickOnFailure = true,
|
||||
DisallowedFeatures = AssistantFeatures.None,
|
||||
DisconnectDelay = TimeSpan.FromSeconds(15.0),
|
||||
WarningMessage = _defaultWarningMessage
|
||||
};
|
||||
|
||||
Save(path);
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void DisallowFeature(AssistantFeatures feature) => SetDisallowed(feature, true);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void AllowFeature(AssistantFeatures feature) => SetDisallowed(feature, false);
|
||||
|
||||
public static void SetDisallowed(AssistantFeatures feature, bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
Settings.DisallowedFeatures |= feature;
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.DisallowedFeatures &= ~feature;
|
||||
}
|
||||
|
||||
Save();
|
||||
}
|
||||
|
||||
private static void Save(string path = null)
|
||||
{
|
||||
path ??= Path.Join(Core.BaseDirectory, _path);
|
||||
JsonConfig.Serialize(path, Settings);
|
||||
}
|
||||
}
|
||||
|
||||
public record AssistantSettings
|
||||
{
|
||||
[JsonPropertyName("warnOnFailure")]
|
||||
public bool WarnOnFailure { get; set; }
|
||||
|
||||
[JsonPropertyName("kickOnFailure")]
|
||||
public bool KickOnFailure { get; set; }
|
||||
|
||||
[JsonPropertyName("features")]
|
||||
public AssistantFeatures DisallowedFeatures { get; set; }
|
||||
|
||||
[JsonPropertyName("disconnectDelay")]
|
||||
public TimeSpan DisconnectDelay { get; set; }
|
||||
|
||||
[JsonPropertyName("warningMessage")]
|
||||
public string WarningMessage { get; set; }
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: AssistantEvents.cs *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Server.Accounting;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server;
|
||||
|
||||
public class AssistantAuthEventArgs
|
||||
{
|
||||
public NetState State { get; }
|
||||
public IAccount Account { get; }
|
||||
public bool AuthOk { get; }
|
||||
|
||||
public AssistantAuthEventArgs(NetState state, IAccount acct, bool authOK)
|
||||
{
|
||||
State = state;
|
||||
Account = acct;
|
||||
AuthOk = authOK;
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class EventSink
|
||||
{
|
||||
public static event Action<AssistantAuthEventArgs> AssistantAuth;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void InvokeAssistantAuth(AssistantAuthEventArgs e) => AssistantAuth?.Invoke(e);
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: AssistantFeatures.cs *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Server.Assistants;
|
||||
|
||||
[Flags]
|
||||
public enum AssistantFeatures : ulong
|
||||
{
|
||||
None = 0,
|
||||
|
||||
FilterWeather = 1ul << 0, // Weather Filter
|
||||
FilterLight = 1ul << 1, // Light Filter
|
||||
SmartTarget = 1ul << 2, // Smart Last Target
|
||||
RangedTarget = 1ul << 3, // Range Check Last Target
|
||||
AutoOpenDoors = 1ul << 4, // Automatically Open Doors
|
||||
DequipOnCast = 1ul << 5, // Unequip Weapon on spell cast
|
||||
AutoPotionEquip = 1ul << 6, // Un/Re-equip weapon on potion use
|
||||
PoisonedChecks = 1ul << 7, // Block heal If poisoned/Macro If Poisoned condition/Heal or Cure self
|
||||
LoopedMacros = 1ul << 8, // Disallow Looping macros, For loops, and macros that call other macros
|
||||
UseOnceAgent = 1ul << 9, // The use once agent
|
||||
RestockAgent = 1ul << 10, // The restock agent
|
||||
SellAgent = 1ul << 11, // The sell agent
|
||||
BuyAgent = 1ul << 12, // The buy agent
|
||||
PotionHotkeys = 1ul << 13, // All potion hotkeys
|
||||
RandomTargets = 1ul << 14, // All random target hotkeys (not target next, last target, target self)
|
||||
ClosestTargets = 1ul << 15, // All closest target hotkeys
|
||||
OverheadHealth = 1ul << 16, // Health and Mana/Stam messages shown over player's heads
|
||||
|
||||
// AssistUO Only
|
||||
AutolootAgent = 1ul << 17, // The autoloot agent
|
||||
|
||||
BoneCutterAgent = 1ul << 18, // The bone cutter agent
|
||||
JScriptMacros = 1ul << 19, // Javascript macro engine
|
||||
AutoRemount = 1ul << 20, // Auto remount after dismount
|
||||
AutoBandage = 1 << 21, // Auto bandage friends, self, last and mount option
|
||||
EnemyTargetShare = 1 << 22, // Enemy target share on guild, party or alliance chat
|
||||
FilterSeason = 1 << 23, // Season Filter
|
||||
SpellTargetShare = 1 << 24, // Spell target share on guild, party or alliance chat
|
||||
|
||||
All = ~None // Every feature possible
|
||||
}
|
||||
|
|
@ -16,7 +16,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server.Assistants;
|
||||
using CV = Server.ClientVersion;
|
||||
|
||||
namespace Server.Network;
|
||||
|
|
@ -70,32 +69,9 @@ public static class IncomingAccountPackets
|
|||
var flags = reader.ReadInt32();
|
||||
reader.Seek(8, SeekOrigin.Current);
|
||||
int prof = reader.ReadByte();
|
||||
reader.Seek(15, SeekOrigin.Current);
|
||||
|
||||
int genderRace;
|
||||
if (AssistantConfiguration.Enabled && AssistantConfiguration.Settings.DisallowedFeatures != AssistantFeatures.None)
|
||||
{
|
||||
var razorFeatures = (AssistantFeatures)reader.ReadUInt64();
|
||||
var key = reader.ReadUInt64();
|
||||
|
||||
var authOk = razorFeatures == AssistantConfiguration.Settings.DisallowedFeatures &&
|
||||
// Highly recommend a shard changes these here, in razor and redistribute the assistant.
|
||||
(key & 0xFFFFFFFFFFFFFF00ul) == 0x0911832B04178300ul;
|
||||
|
||||
EventSink.InvokeAssistantAuth(new AssistantAuthEventArgs(state, state.Account, authOk));
|
||||
|
||||
if (!state.Running)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
genderRace = (int)(key & 0xFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Seek(15, SeekOrigin.Current);
|
||||
genderRace = reader.ReadByte();
|
||||
}
|
||||
|
||||
var genderRace = reader.ReadByte();
|
||||
|
||||
var stats = new StatNameValue[]
|
||||
{
|
||||
|
|
@ -246,41 +222,9 @@ public static class IncomingAccountPackets
|
|||
|
||||
public static void PlayCharacter(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
reader.Seek(4, SeekOrigin.Current); // 0xEDEDEDED
|
||||
|
||||
reader.Seek(30, SeekOrigin.Current); // var name = reader.ReadAscii(30);
|
||||
|
||||
reader.Seek(2, SeekOrigin.Current);
|
||||
|
||||
reader.Seek(36, SeekOrigin.Current); // 4 = 0xEDEDEDED, 30 = Name, 2 = unknown
|
||||
var flags = reader.ReadInt32();
|
||||
|
||||
if (AssistantConfiguration.Enabled && AssistantConfiguration.Settings.DisallowedFeatures != AssistantFeatures.None)
|
||||
{
|
||||
var razorFeatures = (AssistantFeatures)reader.ReadUInt64();
|
||||
var key1 = reader.ReadUInt64();
|
||||
var key2 = reader.ReadUInt64();
|
||||
|
||||
var authOk = razorFeatures == AssistantConfiguration.Settings.DisallowedFeatures &&
|
||||
// Highly recommend a shard changes these here, in razor and redistribute the assistant.
|
||||
key1 == 0x0911832B04178305ul && key2 == 0x2485071787061988ul;
|
||||
|
||||
EventSink.InvokeAssistantAuth(new AssistantAuthEventArgs(state, state.Account, authOk));
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Seek(22, SeekOrigin.Current);
|
||||
|
||||
if (reader.ReadUInt16() == 0xDEAD)
|
||||
{
|
||||
EventSink.InvokeAssistantAuth(new AssistantAuthEventArgs(state, state.Account, false));
|
||||
}
|
||||
}
|
||||
|
||||
if (!state.Running)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
reader.Seek(24, SeekOrigin.Current);
|
||||
var charSlot = reader.ReadInt32();
|
||||
reader.Seek(4, SeekOrigin.Current); // var clientIP = reader.ReadInt32();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@ using System;
|
|||
using System.IO;
|
||||
using System.Buffers;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Cryptography;
|
||||
using Server.Accounting;
|
||||
using Server.Assistants;
|
||||
|
||||
namespace Server.Network;
|
||||
|
||||
|
|
@ -286,8 +284,6 @@ public static class OutgoingAccountPackets
|
|||
ns.Send(writer.Span);
|
||||
}
|
||||
|
||||
private static MD5 _md5Provider;
|
||||
|
||||
/**
|
||||
* Packet: 0xA9
|
||||
* Length: 1410 or more bytes
|
||||
|
|
@ -334,11 +330,6 @@ public static class OutgoingAccountPackets
|
|||
writer.Write((ushort)length);
|
||||
writer.Write((byte)count); // TODO: It is probably more proper to use count.
|
||||
|
||||
var enforceRazor = AssistantConfiguration.Enabled &&
|
||||
AssistantConfiguration.Settings.DisallowedFeatures != AssistantFeatures.None;
|
||||
|
||||
Span<byte> hashBuffer = enforceRazor ? stackalloc byte[16] : null;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var m = acct[i];
|
||||
|
|
@ -351,35 +342,6 @@ public static class OutgoingAccountPackets
|
|||
{
|
||||
var name = (m.RawName?.Trim()).DefaultIfNullOrEmpty("-no name-");
|
||||
writer.WriteAscii(name, 30);
|
||||
}
|
||||
|
||||
if (enforceRazor)
|
||||
{
|
||||
writer.Write((byte)0);
|
||||
var pos = writer.Position;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
writer.Write((ulong)AssistantConfiguration.Settings.DisallowedFeatures);
|
||||
}
|
||||
|
||||
if (count > 1 && i == 2 || count == 1 && i == 0)
|
||||
{
|
||||
_md5Provider ??= MD5.Create();
|
||||
if (_md5Provider.TryComputeHash(writer.Span, hashBuffer, out var bytesWritten) && bytesWritten == 16)
|
||||
{
|
||||
writer.Write(hashBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
var remaining = 28 - pos;
|
||||
Utility.RandomBytes(writer.RawBuffer.Slice(writer.Position, remaining));
|
||||
writer.Seek(remaining, SeekOrigin.Current);
|
||||
|
||||
writer.Write((byte)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Clear(30); // password
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,4 +46,7 @@
|
|||
<ItemGroup>
|
||||
<AdditionalFiles Include="Migrations/*.v*.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Assistants" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue