Repository navigation
EN UO Topic proxy
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Compatible names API for proxies. The mere presence of a name in the registry does not prove support for the transport: the actual restrictions are indicated in each card.
| Topic | Commands and explanations |
|---|---|
| UseProxy | UO.UseProxy |
| ProxyIP | UO.ProxyIP |
| ProxyPort | UO.ProxyPort |
| Authentication | UO.UseProxy |
UO.UseProxy · UO.ProxyIP · UO.ProxyPort
Each command card has several independent scenarios: direct code, functions and classes. Below are selected short scenarios; restrictions and full analysis are in the cards.
Parameters, result and all scenarios
return UO.ProxyIP();Parameters, result and all scenarios
return UO.ProxyPort();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.ProxyIP();Reads the current profile's proxy address to verify the selected route before connecting.
There are no parameters.
string: The specified IP or DNS is the proxy name. An empty string for a direct join. DNS-name is not converted to IP here; This is not the game server address.
- There are no parameters. Reads the settings of the owner of this session, including without a connection. Does not enable or disable the proxy, does not access it, does not reconnect or reveal the password. A regular Full without a managed proxy returns direct connection values. To apply connection changes, change the profile and restart its session. The profile is used for both login and gaming connection.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
object? result = UO.ProxyIP();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Main returns the current setting. For proxy.example.invalid:1080 the address is "proxy.example.invalid", port 1080, UseProxy == 1. For direct connection, respectively, "", 0, 0. The example domain is a stub, not a working proxy.
return UO.ProxyIP();Parameters and execution flow:
- The array contains two resolved addresses with an exact match. The loop compares the configured name only if UseProxy == 1 and returns 1 if there is a match, otherwise 0. Replace the names with your own. This is a configuration check, not the authenticity of the remote proxy.
return RunScenario();
object? RunScenario()
{
dynamic[] allowed = new dynamic[checked((int)(1) + 1)];
allowed[0] = "proxy.example.invalid";
allowed[1] = "127.0.0.1";
if (Truth(UO.UseProxy()))
{
var index = 0;
while (Truth(index < ArrayLength(allowed)))
{
if (Truth(UO.ProxyIP() == allowed[index]))
{
return 1;
}
index = index + 1;
}
}
return 0;
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- RequireRoute receives address="proxy.example.invalid", port=1080. Checks all three settings up to UO.Connect. A mismatch gives 0 without connection. The match asks to connect and gives 1; This is a request, not a confirmation of entry into the game. Replace both plugs; UO.Connected check separately.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
return RequireRoute("proxy.example.invalid", 1080);
return null;
}
dynamic RequireRoute(dynamic address, dynamic port)
{
if (!(Truth(UO.UseProxy())))
{
return 0;
}
if (Truth(UO.ProxyIP() != address) || Truth(UO.ProxyPort() != port))
{
return 0;
}
UO.Connect();
return 1;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
Internal implementation code; this is not a standalone script.
case "proxyip": return new InjectionValue((bridge as IProxyMetadataBridge)?.ProxyAddress ?? string.Empty);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.ProxyPort();Reads the proxy port of the current profile to check the address/port pair.
There are no parameters.
int: configured proxy port in 1..65535; 0 for direct connection. This is not a game server port.
- There are no parameters. Reads the settings of the owner of this session, including without a connection. Does not enable or disable the proxy, does not access it, does not reconnect or reveal the password. A regular Full without a managed proxy returns direct connection values. To apply connection changes, change the profile and restart its session. The profile is used for both login and gaming connection.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
object? result = UO.ProxyPort();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Main returns the current setting. For proxy.example.invalid:1080 the address is "proxy.example.invalid", port 1080, UseProxy == 1. For direct connection, respectively, "", 0, 0. The example domain is a stub, not a working proxy.
return UO.ProxyPort();Parameters and execution flow:
- RouteLabel builds the signature of the configured route: address:port or “direct” for a direct connection. Login and password are not readable.
return RunScenario();
object? RunScenario()
{
return RouteLabel();
return null;
}
dynamic RouteLabel()
{
if (Truth(UO.UseProxy()))
{
return UO.ProxyIP() + ":" + Convert.ToString(UO.ProxyPort());
}
return "direct";
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- RequireRoute receives address="proxy.example.invalid", port=1080. Checks all three settings up to UO.Connect. A mismatch gives 0 without connection. The match asks to connect and gives 1; This is a request, not a confirmation of entry into the game. Replace both plugs; UO.Connected check separately.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
return RequireRoute("proxy.example.invalid", 1080);
return null;
}
dynamic RequireRoute(dynamic address, dynamic port)
{
if (!(Truth(UO.UseProxy())))
{
return 0;
}
if (Truth(UO.ProxyIP() != address) || Truth(UO.ProxyPort() != port))
{
return 0;
}
UO.Connect();
return 1;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
Internal implementation code; this is not a standalone script.
case "proxyport": return new InjectionValue((bridge as IProxyMetadataBridge)?.ProxyPort ?? 0);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.UseProxy();Checks whether this session is configured to connect through a proxy.
There are no parameters.
int 1 (true) if proxy is configured, otherwise 0 (false). In C# check if (result != 0) or if (result == 1); result is of type int, so if (result) and comparison with true are not allowed. The unit does not confirm proxy availability or successful authorization.
- There are no parameters. Reads the settings of the owner of this session, including without a connection. Does not enable or disable the proxy, does not access it, does not reconnect or reveal the password. A regular Full without a managed proxy returns direct connection values. To apply connection changes, change the profile and restart its session. The profile is used for both login and gaming connection.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
object? result = UO.UseProxy();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Main returns the current setting. For proxy.example.invalid:1080 the address is "proxy.example.invalid", port 1080, UseProxy == 1. For direct connection, respectively, "", 0, 0. The example domain is a stub, not a working proxy.
return UO.UseProxy();Parameters and execution flow:
- RouteLabel builds the signature of the configured route: address:port or “direct” for a direct connection. Login and password are not readable.
return RunScenario();
object? RunScenario()
{
return RouteLabel();
return null;
}
dynamic RouteLabel()
{
if (Truth(UO.UseProxy()))
{
return UO.ProxyIP() + ":" + Convert.ToString(UO.ProxyPort());
}
return "direct";
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- RequireRoute receives address="proxy.example.invalid", port=1080. Checks all three settings up to UO.Connect. A mismatch gives 0 without connection. The match asks to connect and gives 1; This is a request, not a confirmation of entry into the game. Replace both plugs; UO.Connected check separately.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
return RequireRoute("proxy.example.invalid", 1080);
return null;
}
dynamic RequireRoute(dynamic address, dynamic port)
{
if (!(Truth(UO.UseProxy())))
{
return 0;
}
if (Truth(UO.ProxyIP() != address) || Truth(UO.ProxyPort() != port))
{
return 0;
}
UO.Connect();
return 1;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
Internal implementation code; this is not a standalone script.
case "useproxy": return new InjectionValue((bridge as IProxyMetadataBridge)?.UsesProxy == true ? 1 : 0);ClassicUO — Bad Newbie & C# Scripts IDE