Repository navigation
EN UO Topic character Part 2
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetEquipment(object? id);Reads the list of equipment on non-zero object layers.
-
id— Serial/ID of a specific object: int, decimal/hex string or set alias self, backpack, lasttarget, lastobject or name AddObject. This is not graphic/type. The lines my/backpack select the backpack. Only explicit 0, "0" or "ground" select land. An unknown alias, a missing backpack, a negative ID, or an inappropriate value type results in an empty array.
Array — serial of each item whose Container is equal to ID and Layer is not equal to Invalid. For ground/0 an empty Array is returned. Without entries, an empty Array is returned. The list contains ID, not type and not layers.
- Data already downloaded by the client is read. The command does not open the container, move items, or download objects from the entire server.
- Array - array with indices starting from 0. Store it in var, check ArrayLength before accessing. Elements may disappear from the world after taking a snapshot: check Exists(serial) before taking action.
- There is no recursive traversal of nested bags, sorting by distance, Ignore filter, or FindDistance/FindVertical. The regular FindType snapshot remains unchanged.
- GetEquipment(self) includes the knapsack and other known non-zero layers; The mere fact of a layer does not mean a weapon or armor being worn. GetContent(self) can include equipment because its parent is a character.
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.GetEquipment("self");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- ID="self" - the current character, his direct items with a non-zero Layer are selected.
- Length - number of records/ID. This is not the amount of Amount in stacks. The empty list gives 0.
var items = UO.GetEquipment("self");
UO.Print(Convert.ToString(ArrayLength(items)));
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;Parameters and execution flow:
- ID="self" - the current character, his direct items with a non-zero Layer are selected.
- items[i] — numeric serial. Hex is used for output only. The loop does not access the last index.
return RunScenario();
object? RunScenario()
{
var items = UO.GetEquipment("self");
var i = 0;
while (Truth(i < ArrayLength(items)))
{
UO.Print("0x" + Hex(items[i]));
i = i + 1;
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
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:
- ID="self" - the current character, his direct items with a non-zero Layer are selected.
- Two different things are checked: the record in the snapshot and the existence of the object now. Order without explicit sorting does not mean closeness.
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()
{
var items = UO.GetEquipment("self");
if (Truth(ArrayLength(items) > 0))
{
var first = items[0];
if (Truth(UO.Exists(first)))
{
UO.Print(UO.GetName(first));
}
}
else
{
UO.Print("Empty list");
}
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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: id (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
InjectionScript.Runtime.NumberConversions.TryStr2Int:NumberConversions.TryStr2Int(text, out int literal). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(text). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetEquipment:bridge.GetEquipment(container). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetContent:bridge.GetContent(container). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Backpack:bridge.Backpack.
Internal implementation code; this is not a standalone script.
case "getcontent":
case "getequipment":
{
InjectionValue selection = arguments[0];
bool ground = false, explicitZero;
int container;
if (selection.Kind == InjectionValueKind.String)
{
string text = Text(0).Trim();
ground = text.Equals("ground", StringComparison.OrdinalIgnoreCase);
explicitZero = NumberConversions.TryStr2Int(text, out int literal) && literal == 0;
container = ground ? 0 : text.Equals("my", StringComparison.OrdinalIgnoreCase)
? bridge.Backpack : GetObject(text);
}
else
{
if (selection.Kind != InjectionValueKind.Integer && selection.Kind != InjectionValueKind.Decimal)
return new InjectionValue(Array.Empty<InjectionValue>());
container = Arg(0);
explicitZero = selection.Kind == InjectionValueKind.Integer ? selection.Integer == 0 : selection.Decimal == 0d;
}
// Only an explicit ground/zero selector may query world items.
if (container < 0 || container == 0 && !ground && !explicitZero)
return new InjectionValue(Array.Empty<InjectionValue>());
bool equipment = name.Equals("GetEquipment", StringComparison.OrdinalIgnoreCase);
int[] items = equipment
? container == 0 ? Array.Empty<int>() : bridge.GetEquipment(container)
: bridge.GetContent(container);
return new InjectionValue(items.Select(serial => new InjectionValue(serial)).ToArray());
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetFireResist();Reads the current character's resistance field: fire.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.FireResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.
var result = UO.GetFireResist();
UO.Print("GetFireResist: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.GetFireResist();
UO.Print("FireResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetFireResist();
await Delay(500);
var after = UO.GetFireResist();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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()
{
if (Truth(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetFireResist();
return value >= minimum;
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetFireResist]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.FireResistance:bridge.FireResistance.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.FireResistanceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetFlying();
int UO.GetFlying(object? value);Checks if the character is currently flying. This is usually needed for Gargoyle: for example, before starting a route or before requesting to enable a flight. Answers the question “is my character flying now?” without argument. The command only reads the state: it does not enable flight, land or move the character.
-
value- Optional character serial: number, hex string, self, lasttarget or name saved via UO.AddObject. Without argument, your character is used. This is the ID of a specific mobile, not the graphic/type and not the Z coordinate. An unknown name, missing/deleted mobile or item gives 0.
Numeric flag int: 1 (condition met), 0 (condition not met). This is a numeric flag: in C# check result != 0 or result == 0. Direct comparison of int with true/false and if (result) is not allowed. 1 - mobile has IsFlying, 0 has no flag or mobile is missing. Altitude Z by itself does not mean flight.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- The main gaming application is the flight of Gargoyle. However, the getter does not check the race: in this client it reads the 0x04 bit of mobile with protocol version 7.0.0.0 and newer. On the old protocol it returns 0. Standing on a roof, high Z, wing animations, or the Gargoyle race itself are not proof of flight enabled.
- There is a separate UO.ToggleFly() for changing state: it sends a switch request rather than a "turn on" command. If you are already flying, a repeat call requests landing. The server may fail; after prompting, read Flying again with limited waiting. false is also possible without character/data available, so check Connected before playing the action.
- Reads the local model: does not open target, does not request status, does not change the flag, and does not send the packet. A destroyed object is considered missing even before the entry is deleted from the dictionary.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
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.
var result = UO.GetFlying();
UO.Print("GetFlying: " + Convert.ToString(result));Parameters and execution flow:
- Empty parentheses indicate self. true is equal to 1, false is equal to 0; if UO.Flying() { ... } is acceptable. This example doesn't switch anything.
var active = UO.GetFlying();
if (Truth(Truth(active) == true))
{
UO.Print("Flying mode active");
}
else
{
UO.Print("Ground mode or character data unavailable");
}
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:
- ReadState(obj) accepts serial/alias and returns state. The full definition is below; the absence of an object is handled before reading. Someone else's character is also checked against the data already received by the client.
return RunScenario();
object? RunScenario()
{
var target = Asc(UO.GetSerial("lasttarget"), 0);
if (Truth(target != 0) && Truth(UO.Exists(target)))
{
if (Truth(ReadState(target)))
{
UO.AddObject("flying_mobile", target);
}
}
return null;
}
dynamic ReadState(dynamic obj)
{
if (!(Truth(UO.Exists(obj))))
{
return false;
}
return UO.GetFlying(obj);
}
int Asc(object? value, int fallback = 0)
{
string text = Convert.ToString(value) ?? "";
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
return int.TryParse(text, out int number) ? number : fallback;
}
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:
- The example is for your Gargoyle on a flight-supporting server. EnsureFlight(timeoutMs) returns 1/true if flight is observed, otherwise 0/false. 2000 — waiting limit in milliseconds; checks every 50 ms. If you are already flying, ToggleFly is not called. At most one request is sent, then the response status is checked. Script pause/scheduler delay can increase real time.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
if (Truth(await EnsureFlight(2000)))
{
UO.Print("Flight confirmed; ready for the next stage");
}
else
{
UO.Print("Flight not confirmed; route was not started");
}
return null;
}
async Task<dynamic> EnsureFlight(dynamic timeoutMs)
{
if (!(Truth(UO.Connected())) || Truth(UO.Dead()))
{
return false;
}
if (Truth(UO.GetFlying()))
{
return true;
}
UO.ToggleFly();
var waited = 0;
while (Truth(waited < timeoutMs))
{
if (!(Truth(UO.Connected())))
{
return false;
}
if (Truth(UO.GetFlying()))
{
return true;
}
await Delay(50);
waited += 50;
}
return UO.GetFlying();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetFlying]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Flying:bridge.Flying(serial). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.Flying(serial)Internal implementation code; this is not a standalone script.
() => getter(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetFlying]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Flying:bridge.Flying(serial). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(value).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.Flying(serial)Internal implementation code; this is not a standalone script.
value => getter(GetObject(value))API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetFrozen();
int UO.GetFrozen(object? value);Checks the character's paralysis flag known to the client.
-
value- Optional serial/ID mobile: number, hex string, self, lasttarget or other standard object name or AddObject name. This is not a graphic/type. Without an argument, self is used. Unknown name resolves to 0; target doesn't open.
Numeric flag int: 1 (condition met) - loaded mobile has flag IsParalyzed; 0 (condition not met) - no flag, mobile unknown, deleted, or the object is an item. This is not a time of paralysis and does not guarantee the ability to move with a result of 0.
- Use Paralyzed to check the paralysis flag. The variants Is/Get, GetParalisa, Frozen and GetLocked read the same flag.
- The command only reads local data. It does not apply or remove paralysis, does not wait for it to end, and does not send an update request to the server.
- The result of this command is of type int: use if (value != 0) or if (value == 0). Direct comparisons with true/false and if (value) in C# are not allowed. The value preserves the meaning of the flag, not the quantity or ID.
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.
var result = UO.GetFrozen();
UO.Print("GetFrozen: " + Convert.ToString(result));Parameters and execution flow:
- Empty parentheses select self. state stores one snapshot of the flag; true — numeric constant 1.
- A false result does not rule out a wall, lack of stamina, or other reason for stopping.
var state = UO.GetFrozen();
if (Truth(Truth(state) == true))
{
UO.Print("Paralysis flag is set");
}
else
{
UO.Print("Paralysis flag is absent or unavailable");
}
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:
- target stores the hex string serial of the last target. IsNpc checks that this is a loaded mobile, including players.
- The command with the argument reads target. She doesn't select a new character or change lasttarget.
return RunScenario();
object? RunScenario()
{
var target = UO.GetSerial("lasttarget");
if (Truth(UO.IsNPC(target)))
{
var state = UO.GetFrozen(target);
UO.Print("Selected mobile paralysis 1/0: " + Convert.ToString(state));
}
else
{
UO.Print("No loaded mobile selected");
}
return null;
}
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:
- No more than 10 pauses for 100 ms. Each call without an argument reads self again.
- After the loop, the presence of self is checked separately. This is an observation for about a second plus the execution of commands, and not a guaranteed removal of paralysis.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var attempts = 0;
while (Truth(Truth(UO.GetFrozen()) == true) && Truth(attempts < 10))
{
await Delay(100);
attempts = attempts + 1;
}
if (Truth(UO.IsNPC("self")))
{
if (Truth(Truth(UO.GetFrozen()) == false))
{
UO.Print("Paralysis flag is clear");
}
else
{
UO.Print("Still paralyzed");
}
}
else
{
UO.Print("Self is unavailable");
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetFrozen]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.GetLocked(serial)Internal implementation code; this is not a standalone script.
() => getter(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetFrozen]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(value).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.GetLocked(serial)Internal implementation code; this is not a standalone script.
value => getter(GetObject(value))API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetGold();Reads the amount of gold from the current character's status.
There are no parameters.
int/double — non-negative sum 0..4294967295. Up to 2147483647 inclusive, an int is returned, above - a double (Double), exactly representing any 32-bit unsigned integer. 0 also means no current undeleted Player or amount received. It's not bool, ID, number of stacks, or knapsack/bank traversal.
- There are no parameters. Reads the Player.Gold cache from CharacterStatus (0x11). The server determines what gold is included in its counter; the team does not go through the bags or ask for bank balances. No/destroyed Player - 0; a ghost present can maintain a status amount.
- ReadGoldValue reads bridge.Gold once. The old C# bridge retains the Int32 signature and transmits UInt32 bits. unchecked conversion restores the unsigned sum; a small amount turns into int, a large amount into double. The most significant bit no longer turns the balance negative. The conversion is local, there are no packages.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
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.GetGold();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- amount stores one result; Convert.ToString formats it for journal. Gold is not sought, carried, or spent.
var amount = UO.GetGold();
UO.Print("Status gold: " + Convert.ToString(amount));Parameters and execution flow:
- price=3000000000.0 is an example of price, not the limit. CanAfford(price) rejects a negative price or no Player, reads the amount once and returns bool: true or false if amount >= price. The amount itself is not bool. The function is fully defined below.
return RunScenario();
object? RunScenario()
{
var price = 3000000000.0;
if (Truth(Truth(CanAfford(price)) == true))
{
UO.Print("Local balance is sufficient");
}
else
{
UO.Print("Local check failed");
}
return null;
}
dynamic CanAfford(dynamic price)
{
if (Truth(price < 0) || Truth(UO.Self() == 0))
{
return false;
}
var amount = UO.GetGold();
return amount >= price;
}
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:
- before/after separates UO.Wait(500) milliseconds. difference=after-before can be negative when the balance decreases; This is not a fixed unsigned counter overflow. Interim updates and character changes may be missed.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var before = UO.GetGold();
await Delay(500);
var after = UO.GetGold();
var difference = after - before;
UO.Print("Balance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}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:
-
InjectionScript.Runtime.InjectionApiUO.ReadGoldValue. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Gold:bridge.Gold.
Internal implementation code; this is not a standalone script.
private InjectionValue ReadGoldValue()
{
// The existing bridge carries all 32 unsigned status-counter bits in
// an Int32. Keep small results Integer; Double exactly represents
// every UInt32 and avoids returning a negative large gold amount.
uint amount = unchecked((uint)bridge.Gold);
return amount <= int.MaxValue ? new InjectionValue((int)amount)
: new InjectionValue((double)amount);
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetHP();
int UO.GetHP(object? id);Reads the current health from the local model.
-
id— Optional object in the forms shown: serial number/hex string, self, lasttarget, or registered name AddObject. This is not type. Without an argument, self is read. Unknown text in some forms causes a conversion error; check the name before calling.
int is the value of the Hits field, not a percentage or a bool. 0 can be a real value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
int hp = UO.GetHP();
UO.Print($"HP = {hp}");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.
var result = UO.GetHP();
UO.Print("GetHP: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.GetHP();
UO.Print("GetHP: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.GetHP();
var maximum = UO.GetMaxHP();
if (Truth(maximum > 0) && Truth(value * 100 / maximum < 50))
{
UO.Print("Health below half of the known maximum");
}
return null;
}
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:
- lasttarget - previously selected object; Exists checks for existence. obj is the only parameter of ReadValue. The function returns the command number unchanged and is given in its entirety.
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()
{
if (Truth(UO.Exists("lasttarget")))
{
var value = ReadValue("lasttarget");
UO.Print("Selected value: " + Convert.ToString(value));
}
return null;
}
dynamic ReadValue(dynamic obj)
{
return UO.GetHP(obj);
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetHP. -
InjectionScript.Runtime.InjectionApiUO.GetHP:GetHP("self").
Internal implementation code; this is not a standalone script.
public int GetHP() => GetHP("self");Parameters: id (Any/Integer/String)
Result: int / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetHP:bridge.GetHP(Arg(0, bridge.Self)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0, bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "gethp": return new InjectionValue(bridge.GetHP(Arg(0, bridge.Self)));Parameters: id (Any/Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetHP. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetHP:bridge.GetHP(id).
Internal implementation code; this is not a standalone script.
public int GetHP(int id) => bridge.GetHP(id);Parameters: id (Any/Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetHP. -
InjectionScript.Runtime.InjectionApiUO.GetHP:GetHP(GetObject(id)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id).
Internal implementation code; this is not a standalone script.
public int GetHP(string id) => GetHP(GetObject(id));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetHidden();
int UO.GetHidden(object? value);Tests the character's stealth.
-
value— Optional object in the forms shown: serial number/hex string, self, lasttarget, or registered name AddObject. This is not type. Without an argument, self is read. Unknown text in some forms causes a conversion error; check the name before calling.
Numeric flag int: 1 (condition met), 0 (condition not met). This is a numeric flag: in C# check result != 0 or result == 0. Direct comparison of int with true/false and if (result) is not allowed. 1 - mobile has IsHidden, 0 has no flag or mobile is missing. This is a server flag, not visibility behind a wall.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- Reads the local model: does not open target, does not request status, does not change the flag, and does not send the packet. A destroyed object is considered missing even before the entry is deleted from the dictionary.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
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.
var result = UO.GetHidden();
UO.Print("GetHidden: " + Convert.ToString(result));Parameters and execution flow:
- Empty parentheses read self. active saves the result once; true and false define two branches. Print only displays an example message.
var active = UO.GetHidden();
if (Truth(Truth(active) == true))
{
UO.Print("State is active");
}
else
{
UO.Print("State is inactive or unavailable");
}
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:
- lasttarget - previously selected object. Exists checks for its presence. obj is the only parameter ReadState; the function returns the result of the command without modification. Its definition is included in the copied code.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Exists("lasttarget")))
{
var observed = ReadState("lasttarget");
UO.Print("State 1/0: " + Convert.ToString(observed));
}
return null;
}
dynamic ReadState(dynamic obj)
{
return UO.GetHidden(obj);
}
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:
- Two calls without arguments read self, UO.Wait(500) sets 500 milliseconds. Two images are compared; intermediate transitions may be skipped. There is no endless waiting.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var before = UO.GetHidden();
await Delay(500);
var after = UO.GetHidden();
if (Truth(before != after))
{
UO.Print("State changed: " + Convert.ToString(before) + " -> " + Convert.ToString(after));
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetHidden]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Hidden:bridge.Hidden(serial). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.Hidden(serial)Internal implementation code; this is not a standalone script.
() => getter(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetHidden]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Hidden:bridge.Hidden(serial). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(value).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.Hidden(serial)Internal implementation code; this is not a standalone script.
value => getter(GetObject(value))API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetInt();
int UO.GetInt(object? objID);Reads the character's current Intelligence (INT).
-
objID— ObjID only in the form shown with one argument: serial character number, decimal/0x hex string, "self", "lasttarget" or name AddObject. Selects an object, not a graphic/type. Without an argument, the current character is read.
int — current stat points, 0..65535 in the client model; not percentage, ID, skill, lock mode or bool. 0 also means missing/deleted character or inaccessible object. Compare with the numerical requirement, not == true. This is not a stat cap or a guaranteed base value without modifiers.
- Supported are () for self and (ObjID) for an explicit object. There are no other optional arguments.
- Reads Player.Intelligence if Player exists and has not been destroyed; otherwise 0. A dead character present is not a removed object. The stat is not calculated from HP, mana, or stamina.
- GetStr/GetInt/GetDex accept ObjID. Data PlayerMobile is only available for self; for another serial - 0, even for loaded mobile. Someone else's characteristics are not substituted or guessed.
- Invoke reads on the game thread with the ability to cancel the wait by script. Does not query status, does not open target, does not send a packet, does not change the characteristic and does not add delay.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
UO.Int(),UO.Intelligence(),UO.GetInt(),UO.GetIntelligence(). - ExecuteClientApiCompatibility.Arg first resolves the object name, then converts the number. An unknown non-numeric string causes a conversion error, not a target. double is converted to int, Array/void is converted to 0. To select a character, use the correct serial, not such transformations.
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.
var result = UO.GetInt();
UO.Print("GetInt: " + Convert.ToString(result));Parameters and execution flow:
- value stores the numeric result; Convert.ToString just formats it for the journal. There are no arguments or character actions.
var value = UO.GetInt();
UO.Print("Intelligence: " + Convert.ToString(value));Parameters and execution flow:
- before and after separate 1000 ms; UO.Wait added to the example. change=after-before can be positive, zero or negative. By itself, it does not distinguish between all intermediate updates and exit from the world.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetInt();
await Delay(1000);
var after = UO.GetInt();
var change = after - before;
UO.Print("Change: " + Convert.ToString(change));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=80 is an example of a requirement, not a client limit. AttributeAtLeast(minimum) rejects the missing character, reads the characteristic once and returns bool: true or false if >= minimum. The logical meaning is given by the comparison, not the characteristic itself.
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()
{
if (Truth(Truth(AttributeAtLeast(80)) == true))
{
UO.Print("Requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic AttributeAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetInt();
return value >= minimum;
}
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:
- id is the result of UO.Self(), not type. AddObject stores ID as statSubject without target cursor because the second argument is specified. Both calls select the same character, but the readings are not atomic.
var id = UO.Self();
if (Truth(id != 0))
{
UO.AddObject("statSubject", id);
var direct = UO.GetInt(id);
var byName = UO.GetInt("statSubject");
UO.Print("Direct: " + Convert.ToString(direct) + "; alias: " + Convert.ToString(byName));
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetInt]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Intelligence:bridge.Intelligence.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.IntelligenceAPI creation: These functions register the API. They do not run again for every command call.
Parameters: objID (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetIntelligence:bridge.GetIntelligence(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Intelligence:bridge.Intelligence.
Internal implementation code; this is not a standalone script.
case "getint": return new InjectionValue(arguments.Length > 0 ? bridge.GetIntelligence(Arg(0)) : bridge.Intelligence);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetIntelligence();Reads the character's current Intelligence (INT).
There are no parameters.
int — current stat points, 0..65535 in the client model; not percentage, ID, skill, lock mode or bool. 0 also means missing/deleted character or inaccessible object. Compare with the numerical requirement, not == true. This is not a stat cap or a guaranteed base value without modifiers.
- The command takes no arguments. Use the exact signatures above.
- Reads Player.Intelligence if Player exists and has not been destroyed; otherwise 0. A dead character present is not a removed object. The stat is not calculated from HP, mana, or stamina.
- GetStr/GetInt/GetDex accept ObjID. Data PlayerMobile is only available for self; for another serial - 0, even for loaded mobile. Someone else's characteristics are not substituted or guessed.
- Invoke reads on the game thread with the ability to cancel the wait by script. Does not query status, does not open target, does not send a packet, does not change the characteristic and does not add delay.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
UO.Int(),UO.Intelligence(),UO.GetInt(),UO.GetIntelligence().
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.
var result = UO.GetIntelligence();
UO.Print("GetIntelligence: " + Convert.ToString(result));Parameters and execution flow:
- value stores the numeric result; Convert.ToString just formats it for the journal. There are no arguments or character actions.
var value = UO.GetIntelligence();
UO.Print("Intelligence: " + Convert.ToString(value));Parameters and execution flow:
- before and after separate 1000 ms; UO.Wait added to the example. change=after-before can be positive, zero or negative. By itself, it does not distinguish between all intermediate updates and exit from the world.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetIntelligence();
await Delay(1000);
var after = UO.GetIntelligence();
var change = after - before;
UO.Print("Change: " + Convert.ToString(change));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=80 is an example of a requirement, not a client limit. AttributeAtLeast(minimum) rejects the missing character, reads the characteristic once and returns bool: true or false if >= minimum. The logical meaning is given by the comparison, not the characteristic itself.
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()
{
if (Truth(Truth(AttributeAtLeast(80)) == true))
{
UO.Print("Requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic AttributeAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetIntelligence();
return value >= minimum;
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetIntelligence]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Intelligence:bridge.Intelligence.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.IntelligenceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetLife();Reads the current health from the local model.
There are no parameters.
int is the value of the Hits field, not a percentage or a bool. 0 can be a real value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
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.
var result = UO.GetLife();
UO.Print("GetLife: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.GetLife();
UO.Print("GetLife: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.GetLife();
var maximum = UO.GetMaxHP();
if (Truth(maximum > 0) && Truth(value * 100 / maximum < 50))
{
UO.Print("Health below half of the known maximum");
}
return null;
}
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:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.GetLife();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetLife]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetHP:bridge.GetHP(bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.GetHP(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetLuck();Reads your character's status counter: luck points.
There are no parameters.
int — luck points, 0..65535 in the client model. 0 can be a real value, no data, or a missing/destroyed Player. This is quantity, not bool, ID or type: 1 means one unit, not success. The command does not iterate over objects and does not return an array.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.Luck if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Luck reads server luck points stored as UInt16 from status type >= 4. This is not a percentage, a random number, or a guarantee of the quality of the loot. When reading, the client does not calculate the drop rate and does not add equipment bonuses.
- CharacterStatus checks the required body before updating. Weight is in its own extended status, slots are with type 3, Luck - with type 4, server slots WeightMax - with type 5. A compact/old package without an optional counter leaves its previous cache. The new Player starts from scratch; the call does not prove receipt of a fresh status.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
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.
var result = UO.GetLuck();
UO.Print("GetLuck: " + Convert.ToString(result));Parameters and execution flow:
- value stores one no-argument call to its own character; Convert.ToString formats the number for the log without changing its meaning.
var value = UO.GetLuck();
UO.Print("Luck: " + Convert.ToString(value));Parameters and execution flow:
- UO.Wait(500) separates before and after by 500 milliseconds. difference can be positive, zero or negative; Interim updates and character changes may be skipped. Pause is an example.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetLuck();
await Delay(500);
var after = UO.GetLuck();
var difference = after - before;
UO.Print("Counter change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- LuckAtLeast(minimum) receives a numeric requirement; 1000 is an example, not a limit or percentage. Rejects the absence of a Player, reads luck once and returns bool: true or false by value >= minimum. Luck itself is not bool. Cached points are compared and loot drops are not predicted.
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()
{
if (Truth(Truth(LuckAtLeast(1000)) == true))
{
UO.Print("Local check passed");
}
else
{
UO.Print("Local check failed or data unavailable");
}
return null;
}
dynamic LuckAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetLuck();
return value >= minimum;
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetLuck]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Luck:bridge.Luck.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.LuckAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetMana();
dynamic UO.GetMana(object? objID);Reads the current mana from the local model.
-
objID— Optional object in the forms shown: serial number/hex string, self, lasttarget, or registered name AddObject. This is not type. Without an argument, self is read. Unknown text in some forms causes a conversion error; check the name before calling.
int is the value of the Mana field, not a percentage or a bool. 0 can be a real value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
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.
var result = UO.GetMana();
UO.Print("GetMana: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.GetMana();
UO.Print("GetMana: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.GetMana();
if (Truth(value >= 10))
{
UO.Print("At least ten mana points are known");
}
return null;
}
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:
- lasttarget - previously selected object; Exists checks for existence. obj is the only parameter of ReadValue. The function returns the command number unchanged and is given in its entirety.
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()
{
if (Truth(UO.Exists("lasttarget")))
{
var value = ReadValue("lasttarget");
UO.Print("Selected value: " + Convert.ToString(value));
}
return null;
}
dynamic ReadValue(dynamic obj)
{
return UO.GetMana(obj);
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetMana]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Mana:bridge.Mana.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.ManaAPI creation: These functions register the API. They do not run again for every command call.
Parameters: objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetMana:bridge.GetMana(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Mana:bridge.Mana.
Internal implementation code; this is not a standalone script.
case "getmana": return new InjectionValue(arguments.Length > 0 ? bridge.GetMana(Arg(0)) : bridge.Mana);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetMaxHP();
int UO.GetMaxHP(object? id);Reads maximum health from the local model.
-
id— Optional object in the forms shown: serial number/hex string, self, lasttarget, or registered name AddObject. This is not type. Without an argument, self is read. Unknown text in some forms causes a conversion error; check the name before calling.
int is the value of the HitsMax field, not a percentage or a bool. 0 can be a true value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
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.
var result = UO.GetMaxHP();
UO.Print("GetMaxHP: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.GetMaxHP();
UO.Print("GetMaxHP: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.GetMaxHP();
if (Truth(value > 0))
{
UO.Print("Known HP percent: " + Convert.ToString(UO.GetHP() * 100 / value));
}
else
{
UO.Print("HP maximum unavailable");
}
return null;
}
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:
- lasttarget - previously selected object; Exists checks for existence. obj is the only parameter of ReadValue. The function returns the command number unchanged and is given in its entirety.
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()
{
if (Truth(UO.Exists("lasttarget")))
{
var value = ReadValue("lasttarget");
UO.Print("Selected value: " + Convert.ToString(value));
}
return null;
}
dynamic ReadValue(dynamic obj)
{
return UO.GetMaxHP(obj);
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetMaxHP. -
InjectionScript.Runtime.InjectionApiUO.GetMaxHP:GetMaxHP("self").
Internal implementation code; this is not a standalone script.
public int GetMaxHP() => GetMaxHP("self");Parameters: id (Any/Integer/String)
Result: int / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetMaxHP:bridge.GetMaxHP(Arg(0, bridge.Self)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0, bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "getmaxhp": return new InjectionValue(bridge.GetMaxHP(Arg(0, bridge.Self)));Parameters: id (Any/Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetMaxHP. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetMaxHP:bridge.GetMaxHP(id).
Internal implementation code; this is not a standalone script.
public int GetMaxHP(int id) => bridge.GetMaxHP(id);Parameters: id (Any/Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetMaxHP. -
InjectionScript.Runtime.InjectionApiUO.GetMaxHP:GetMaxHP(GetObject(id)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id).
Internal implementation code; this is not a standalone script.
public int GetMaxHP(string id) => GetMaxHP(GetObject(id));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetMaxLife();Reads maximum health from the local model.
There are no parameters.
int is the value of the HitsMax field, not a percentage or a bool. 0 can be a true value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
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.
var result = UO.GetMaxLife();
UO.Print("GetMaxLife: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.GetMaxLife();
UO.Print("GetMaxLife: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.GetMaxLife();
if (Truth(value > 0))
{
UO.Print("Known HP percent: " + Convert.ToString(UO.GetHP() * 100 / value));
}
else
{
UO.Print("HP maximum unavailable");
}
return null;
}
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:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.GetMaxLife();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetMaxLife]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetMaxHP:bridge.GetMaxHP(bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.GetMaxHP(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetMaxMana();
dynamic UO.GetMaxMana(object? objID);Reads maximum mana from the local model.
-
objID— Optional object in the forms shown: serial number/hex string, self, lasttarget, or registered name AddObject. This is not type. Without an argument, self is read. Unknown text in some forms causes a conversion error; check the name before calling.
int is the value of the ManaMax field, not a percentage or a bool. 0 can be a true value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
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.
var result = UO.GetMaxMana();
UO.Print("GetMaxMana: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.GetMaxMana();
UO.Print("GetMaxMana: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.GetMaxMana();
if (Truth(value > 0))
{
UO.Print("Mana percent: " + Convert.ToString(UO.Mana() * 100 / value));
}
return null;
}
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:
- lasttarget - previously selected object; Exists checks for existence. obj is the only parameter of ReadValue. The function returns the command number unchanged and is given in its entirety.
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()
{
if (Truth(UO.Exists("lasttarget")))
{
var value = ReadValue("lasttarget");
UO.Print("Selected value: " + Convert.ToString(value));
}
return null;
}
dynamic ReadValue(dynamic obj)
{
return UO.GetMaxMana(obj);
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetMaxMana]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.MaxMana:bridge.MaxMana.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.MaxManaAPI creation: These functions register the API. They do not run again for every command call.
Parameters: objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetMaxMana:bridge.GetMaxMana(Arg(0, bridge.Self)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0, bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "getmaxmana": return new InjectionValue(bridge.GetMaxMana(Arg(0, bridge.Self)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetMaxStam();
dynamic UO.GetMaxStam(object? objID);Reads the maximum endurance from the local model.
-
objID— Optional object in the forms shown: serial number/hex string, self, lasttarget, or registered name AddObject. This is not type. Without an argument, self is read. Unknown text in some forms causes a conversion error; check the name before calling.
int is the value of the StaminaMax field, not a percentage or a bool. 0 can be a true value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
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.
var result = UO.GetMaxStam();
UO.Print("GetMaxStam: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.GetMaxStam();
UO.Print("GetMaxStam: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.GetMaxStam();
if (Truth(value > 0))
{
UO.Print("Stamina percent: " + Convert.ToString(UO.Stamina() * 100 / value));
}
return null;
}
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:
- lasttarget - previously selected object; Exists checks for existence. obj is the only parameter of ReadValue. The function returns the command number unchanged and is given in its entirety.
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()
{
if (Truth(UO.Exists("lasttarget")))
{
var value = ReadValue("lasttarget");
UO.Print("Selected value: " + Convert.ToString(value));
}
return null;
}
dynamic ReadValue(dynamic obj)
{
return UO.GetMaxStam(obj);
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetMaxStam]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.MaxStamina:bridge.MaxStamina.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.MaxStaminaAPI creation: These functions register the API. They do not run again for every command call.
Parameters: objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetMaxStamina:bridge.GetMaxStamina(Arg(0, bridge.Self)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0, bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "getmaxstam": return new InjectionValue(bridge.GetMaxStamina(Arg(0, bridge.Self)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetMaxStamina();Reads the maximum endurance from the local model.
There are no parameters.
int is the value of the StaminaMax field, not a percentage or a bool. 0 can be a true value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
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.
var result = UO.GetMaxStamina();
UO.Print("GetMaxStamina: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.GetMaxStamina();
UO.Print("GetMaxStamina: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.GetMaxStamina();
if (Truth(value > 0))
{
UO.Print("Stamina percent: " + Convert.ToString(UO.Stamina() * 100 / value));
}
return null;
}
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:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.GetMaxStamina();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetMaxStamina]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.MaxStamina:bridge.MaxStamina.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.MaxStaminaAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetMaxWeight();Reads your character's status counter: maximum weight in stones.
There are no parameters.
int — maximum weight in stones, 0..65535 in the client model. 0 can be a real value, no data, or a missing/destroyed Player. This is quantity, not bool, ID or type: 1 means one unit, not success. The command does not iterate over objects and does not return an array.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.WeightMax if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- MaxWeight reads WeightMax cache. The native status type >= 5 sets the server limit to UInt16, even if it is equal to 0. The old extended status calculates it once upon reception: protocol UO >= 5.0.0a - 7 * floor(Strength / 2) + 40; the older one is Strength * 4 + 25. The result is saved as UInt16; extreme values are wrapped modulo 65536. Strength=101 gives 390 or 429 respectively. When changing Strength separately, the getter itself does not recalculate the limit.
- CharacterStatus checks the required body before updating. Weight is in its own extended status, slots are with type 3, Luck - with type 4, server slots WeightMax - with type 5. A compact/old package without an optional counter leaves its previous cache. The new Player starts from scratch; the call does not prove receipt of a fresh status.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
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.
var result = UO.GetMaxWeight();
UO.Print("GetMaxWeight: " + Convert.ToString(result));Parameters and execution flow:
- value stores one no-argument call to its own character; Convert.ToString formats the number for the log without changing its meaning.
var value = UO.GetMaxWeight();
UO.Print("WeightMax: " + Convert.ToString(value));Parameters and execution flow:
- UO.Wait(500) separates before and after by 500 milliseconds. difference can be positive, zero or negative; Interim updates and character changes may be skipped. Pause is an example.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetMaxWeight();
await Delay(500);
var after = UO.GetMaxWeight();
var difference = after - before;
UO.Print("Counter change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- CanCarry(extra) gets extra weight in stones; 10 is an example, not the number of stacks. Rejects negative extra, no Player, or maximum <= 0, reads the current weight and limit, then returns bool: true or false by extra <= maximum - current. Subtraction avoids current + extra overflow. When overloaded, the result is false even for extra=0. This is a local assessment, not a server resolution; reads are not atomic, and the zero weight may be unknown.
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()
{
if (Truth(Truth(CanCarry(10)) == true))
{
UO.Print("Local check passed");
}
else
{
UO.Print("Local check failed or data unavailable");
}
return null;
}
dynamic CanCarry(dynamic extra)
{
if (Truth(extra < 0) || Truth(UO.Self() == 0))
{
return false;
}
var current = UO.Weight();
var maximum = UO.GetMaxWeight();
if (Truth(maximum <= 0))
{
return false;
}
return extra <= maximum - current;
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetMaxWeight]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.MaxWeight:bridge.MaxWeight.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.MaxWeightAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetParalisa();
int UO.GetParalisa(object? value);Checks the character's paralysis flag known to the client.
-
value- Optional serial/ID mobile: number, hex string, self, lasttarget or other standard object name or AddObject name. This is not a graphic/type. Without an argument, self is used. Unknown name resolves to 0; target doesn't open.
Numeric flag int: 1 (condition met) - loaded mobile has flag IsParalyzed; 0 (condition not met) - no flag, mobile unknown, deleted, or the object is an item. This is not a time of paralysis and does not guarantee the ability to move with a result of 0.
- Use Paralyzed to check the paralysis flag. The variants Is/Get, GetParalisa, Frozen and GetLocked read the same flag.
- The command only reads local data. It does not apply or remove paralysis, does not wait for it to end, and does not send an update request to the server.
- The result of this command is of type int: use if (value != 0) or if (value == 0). Direct comparisons with true/false and if (value) in C# are not allowed. The value preserves the meaning of the flag, not the quantity or ID.
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.
var result = UO.GetParalisa();
UO.Print("GetParalisa: " + Convert.ToString(result));Parameters and execution flow:
- Empty parentheses select self. state stores one snapshot of the flag; true — numeric constant 1.
- A false result does not rule out a wall, lack of stamina, or other reason for stopping.
var state = UO.GetParalisa();
if (Truth(Truth(state) == true))
{
UO.Print("Paralysis flag is set");
}
else
{
UO.Print("Paralysis flag is absent or unavailable");
}
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:
- target stores the hex string serial of the last target. IsNpc checks that this is a loaded mobile, including players.
- The command with the argument reads target. She doesn't select a new character or change lasttarget.
return RunScenario();
object? RunScenario()
{
var target = UO.GetSerial("lasttarget");
if (Truth(UO.IsNPC(target)))
{
var state = UO.GetParalisa(target);
UO.Print("Selected mobile paralysis 1/0: " + Convert.ToString(state));
}
else
{
UO.Print("No loaded mobile selected");
}
return null;
}
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:
- No more than 10 pauses for 100 ms. Each call without an argument reads self again.
- After the loop, the presence of self is checked separately. This is an observation for about a second plus the execution of commands, and not a guaranteed removal of paralysis.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var attempts = 0;
while (Truth(Truth(UO.GetParalisa()) == true) && Truth(attempts < 10))
{
await Delay(100);
attempts = attempts + 1;
}
if (Truth(UO.IsNPC("self")))
{
if (Truth(Truth(UO.GetParalisa()) == false))
{
UO.Print("Paralysis flag is clear");
}
else
{
UO.Print("Still paralyzed");
}
}
else
{
UO.Print("Self is unavailable");
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetParalisa]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.GetLocked(serial)Internal implementation code; this is not a standalone script.
() => getter(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetParalisa]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(value).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.GetLocked(serial)Internal implementation code; this is not a standalone script.
value => getter(GetObject(value))API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetParalysed();
int UO.GetParalysed(object? value);Checks the character's paralysis flag known to the client.
-
value- Optional serial/ID mobile: number, hex string, self, lasttarget or other standard object name or AddObject name. This is not a graphic/type. Without an argument, self is used. Unknown name resolves to 0; target doesn't open.
Numeric flag int: 1 (condition met) - loaded mobile has flag IsParalyzed; 0 (condition not met) - no flag, mobile unknown, deleted, or the object is an item. This is not a time of paralysis and does not guarantee the ability to move with a result of 0.
- Use Paralyzed to check the paralysis flag. The variants Is/Get, GetParalisa, Frozen and GetLocked read the same flag.
- The command only reads local data. It does not apply or remove paralysis, does not wait for it to end, and does not send an update request to the server.
- The result of this command is of type int: use if (value != 0) or if (value == 0). Direct comparisons with true/false and if (value) in C# are not allowed. The value preserves the meaning of the flag, not the quantity or ID.
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.
var result = UO.GetParalysed();
UO.Print("GetParalysed: " + Convert.ToString(result));Parameters and execution flow:
- Empty parentheses select self. state stores one snapshot of the flag; true — numeric constant 1.
- A false result does not rule out a wall, lack of stamina, or other reason for stopping.
var state = UO.GetParalysed();
if (Truth(Truth(state) == true))
{
UO.Print("Paralysis flag is set");
}
else
{
UO.Print("Paralysis flag is absent or unavailable");
}
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:
- target stores the hex string serial of the last target. IsNpc checks that this is a loaded mobile, including players.
- The command with the argument reads target. She doesn't select a new character or change lasttarget.
return RunScenario();
object? RunScenario()
{
var target = UO.GetSerial("lasttarget");
if (Truth(UO.IsNPC(target)))
{
var state = UO.GetParalysed(target);
UO.Print("Selected mobile paralysis 1/0: " + Convert.ToString(state));
}
else
{
UO.Print("No loaded mobile selected");
}
return null;
}
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:
- No more than 10 pauses for 100 ms. Each call without an argument reads self again.
- After the loop, the presence of self is checked separately. This is an observation for about a second plus the execution of commands, and not a guaranteed removal of paralysis.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var attempts = 0;
while (Truth(Truth(UO.GetParalysed()) == true) && Truth(attempts < 10))
{
await Delay(100);
attempts = attempts + 1;
}
if (Truth(UO.IsNPC("self")))
{
if (Truth(Truth(UO.GetParalysed()) == false))
{
UO.Print("Paralysis flag is clear");
}
else
{
UO.Print("Still paralyzed");
}
}
else
{
UO.Print("Self is unavailable");
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetParalysed]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.GetLocked(serial)Internal implementation code; this is not a standalone script.
() => getter(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetParalysed]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(value).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.GetLocked(serial)Internal implementation code; this is not a standalone script.
value => getter(GetObject(value))API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetParalyzed();
int UO.GetParalyzed(object? value);Checks the character's paralysis flag known to the client.
-
value- Optional serial/ID mobile: number, hex string, self, lasttarget or other standard object name or AddObject name. This is not a graphic/type. Without an argument, self is used. Unknown name resolves to 0; target doesn't open.
Numeric flag int: 1 (condition met) - loaded mobile has flag IsParalyzed; 0 (condition not met) - no flag, mobile unknown, deleted, or the object is an item. This is not a time of paralysis and does not guarantee the ability to move with a result of 0.
- Use Paralyzed to check the paralysis flag. The variants Is/Get, GetParalisa, Frozen and GetLocked read the same flag.
- The command only reads local data. It does not apply or remove paralysis, does not wait for it to end, and does not send an update request to the server.
- The result of this command is of type int: use if (value != 0) or if (value == 0). Direct comparisons with true/false and if (value) in C# are not allowed. The value preserves the meaning of the flag, not the quantity or ID.
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.
var result = UO.GetParalyzed();
UO.Print("GetParalyzed: " + Convert.ToString(result));Parameters and execution flow:
- Empty parentheses select self. state stores one snapshot of the flag; true — numeric constant 1.
- A false result does not rule out a wall, lack of stamina, or other reason for stopping.
var state = UO.GetParalyzed();
if (Truth(Truth(state) == true))
{
UO.Print("Paralysis flag is set");
}
else
{
UO.Print("Paralysis flag is absent or unavailable");
}
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:
- target stores the hex string serial of the last target. IsNpc checks that this is a loaded mobile, including players.
- The command with the argument reads target. She doesn't select a new character or change lasttarget.
return RunScenario();
object? RunScenario()
{
var target = UO.GetSerial("lasttarget");
if (Truth(UO.IsNPC(target)))
{
var state = UO.GetParalyzed(target);
UO.Print("Selected mobile paralysis 1/0: " + Convert.ToString(state));
}
else
{
UO.Print("No loaded mobile selected");
}
return null;
}
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:
- No more than 10 pauses for 100 ms. Each call without an argument reads self again.
- After the loop, the presence of self is checked separately. This is an observation for about a second plus the execution of commands, and not a guaranteed removal of paralysis.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var attempts = 0;
while (Truth(Truth(UO.GetParalyzed()) == true) && Truth(attempts < 10))
{
await Delay(100);
attempts = attempts + 1;
}
if (Truth(UO.IsNPC("self")))
{
if (Truth(Truth(UO.GetParalyzed()) == false))
{
UO.Print("Paralysis flag is clear");
}
else
{
UO.Print("Still paralyzed");
}
}
else
{
UO.Print("Self is unavailable");
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetParalyzed]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.GetLocked(serial)Internal implementation code; this is not a standalone script.
() => getter(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetParalyzed]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(value).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.GetLocked(serial)Internal implementation code; this is not a standalone script.
value => getter(GetObject(value))API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetPhysicalResist();Reads the current character's resistance field: physical armor/resistance.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.PhysicalResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- PhysicalResistance - server armor/status field: the classic server can transmit armor rating, and rules with resistances can transmit physical resistance. API does not convert from one to the other and does not calculate the percentage of damage reduction. Armor and physical aliases read the same field.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.
var result = UO.GetPhysicalResist();
UO.Print("GetPhysicalResist: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.GetPhysicalResist();
UO.Print("PhysicalResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetPhysicalResist();
await Delay(500);
var after = UO.GetPhysicalResist();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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()
{
if (Truth(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetPhysicalResist();
return value >= minimum;
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetPhysicalResist]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Armor:bridge.Armor.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.ArmorAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetPlayerStatusText(object? objID);Generates a short text of the object's name and health.
-
objID— Serial/ID of a specific object: int, decimal/hex string or set alias self, backpack, lasttarget, lastobject or name AddObject. This is not a graphic/type.
string in the format "name HP/MaxHP". For example "Raven 75/100". For an unknown object, usually "0/0" with a leading space. This is text, not a structure, bool or open status gump.
- GetName/GetHP/GetMaxHP are read without asking for an update. Do not parse text by space to get ID or HP: the name may contain spaces, use separate getter commands for numbers.
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.GetPlayerStatusText("self");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- ObjID=self - current character.
- Print shows the finished text in the journal.
UO.Print(UO.GetPlayerStatusText("self"));Parameters and execution flow:
- ObjID=serial of the last target.
- Exists prevents output of an unknown object like 0/0.
return RunScenario();
object? RunScenario()
{
var target = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(target)))
{
UO.Print(UO.GetPlayerStatusText(target));
}
return null;
}
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:
- 500 - milliseconds between readings.
- The text of the name/HP is compared, not all characteristics of the character.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var before = UO.GetPlayerStatusText("self");
await Delay(500);
var after = UO.GetPlayerStatusText("self");
if (Truth(before != after))
{
UO.Print(after);
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
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: objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetName:bridge.GetName(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetHP:bridge.GetHP(Arg(0)). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetMaxHP:bridge.GetMaxHP(Arg(0)).
Internal implementation code; this is not a standalone script.
case "getplayerstatustext": return new InjectionValue(bridge.GetName(Arg(0)) + " " + bridge.GetHP(Arg(0)) + "/" + bridge.GetMaxHP(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetPoisonResist();Reads the current character's resistance field: poison.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.PoisonResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.
var result = UO.GetPoisonResist();
UO.Print("GetPoisonResist: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.GetPoisonResist();
UO.Print("PoisonResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetPoisonResist();
await Delay(500);
var after = UO.GetPoisonResist();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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()
{
if (Truth(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetPoisonResist();
return value >= minimum;
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetPoisonResist]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.PoisonResistance:bridge.PoisonResistance.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.PoisonResistanceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetPoisoned();
int UO.GetPoisoned(object? value);Checks the character's poisoning.
-
value— Optional object in the forms shown: serial number/hex string, self, lasttarget, or registered name AddObject. This is not type. Without an argument, self is read. Unknown text in some forms causes a conversion error; check the name before calling.
Numeric flag int: 1 (condition met), 0 (condition not met). This is a numeric flag: in C# check result != 0 or result == 0. Direct comparison of int with true/false and if (result) is not allowed. 1 - mobile has IsPoisoned, 0 has no flag or mobile is missing. The degree of poison and the remaining time are not returned.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- Reads the local model: does not open target, does not request status, does not change the flag, and does not send the packet. A destroyed object is considered missing even before the entry is deleted from the dictionary.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- For Poisoned/Flying, the protocol version is taken into account: up to 7.0.0.0 bit 0x04 means poison; starting with 7.0.0.0 it means flight and the poison is stored separately. Flight is not calculated from Z.
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.
var result = UO.GetPoisoned();
UO.Print("GetPoisoned: " + Convert.ToString(result));Parameters and execution flow:
- Empty parentheses read self. active saves the result once; true and false define two branches. Print only displays an example message.
var active = UO.GetPoisoned();
if (Truth(Truth(active) == true))
{
UO.Print("State is active");
}
else
{
UO.Print("State is inactive or unavailable");
}
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:
- lasttarget - previously selected object. Exists checks for its presence. obj is the only parameter ReadState; the function returns the result of the command without modification. Its definition is included in the copied code.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Exists("lasttarget")))
{
var observed = ReadState("lasttarget");
UO.Print("State 1/0: " + Convert.ToString(observed));
}
return null;
}
dynamic ReadState(dynamic obj)
{
return UO.GetPoisoned(obj);
}
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:
- Two calls without arguments read self, UO.Wait(500) sets 500 milliseconds. Two images are compared; intermediate transitions may be skipped. There is no endless waiting.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var before = UO.GetPoisoned();
await Delay(500);
var after = UO.GetPoisoned();
if (Truth(before != after))
{
UO.Print("State changed: " + Convert.ToString(before) + " -> " + Convert.ToString(after));
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetPoisoned]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Poisoned:bridge.Poisoned(serial). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.Poisoned(serial)Internal implementation code; this is not a standalone script.
() => getter(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetPoisoned]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Poisoned:bridge.Poisoned(serial). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(value).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.Poisoned(serial)Internal implementation code; this is not a standalone script.
value => getter(GetObject(value))API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetRace();Reads the character's race from the client model.
There are no parameters.
int — 1=human, 2=elf, 3=gargoyle according to the client model. 0 means no character loaded. This is not body/graphic and not serial.
- Already received local data is read. The request does not open status and does not force the server to send an update. After death, map transition, or object deletion, the values may change between two calls.
- C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.
var result = UO.GetRace();
UO.Print("GetRace: " + Convert.ToString(result));Parameters and execution flow:
- A call without arguments refers to self. The character's race is stored in value.
- Convert.ToString converts the number to be output and does not change the meaning of the result.
var value = UO.GetRace();
UO.Print("GetRace: " + Convert.ToString(value));Parameters and execution flow:
- The value is read once without any arguments. The character's race is used in the calculation or condition shown.
- Numerical thresholds are examples of script conditions and not new client limits. The field stores the server units and restrictions described above.
return RunScenario();
object? RunScenario()
{
var value = UO.GetRace();
if (Truth(value == 3))
{
UO.Print("Player race is gargoyle");
}
return null;
}
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:
- Both calls without an argument read their current value. UO.Wait(1000) gives a pause in milliseconds between shots.
- Change compared: character race. An example does not change anything in the world and does not wait endlessly. Events within this second may be missed.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
var before = UO.GetRace();
await Delay(1000);
var after = UO.GetRace();
if (Truth(before != after))
{
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetRace]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Race:bridge.Race.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.RaceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetResist(object? resistance);Reads one of your character's resistances using a numeric or string selector.
-
resistance— resistance is required. Numbers: 0=physical, 1=fire, 2=cold, 3=poison, 4=energy. Lines: physical/phys/armor, fire, cold, poison, energy. Case and trailing spaces are ignored. There is no serial, type, hue, target cursor or second argument.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- GetResistance first distinguishes the value type: the strings "1" and "0" are unknown names, give 0 and are not numeric selectors. A non-string double discards the fraction to zero: 1.9 -> fire, -0.9 -> physical. true=1 selects fire, false=0 selects physical; Array/null is also converted to 0. Use an explicit integer or a valid name. The names AddObject are not allowed.
- GetResistance selects exactly one bridge field. Unknown numbers/names give int 0 without reading the field. The command does not remove five values atomically and does not change the resistance.
- PhysicalResistance - server armor/status field: the classic server can transmit armor rating, and rules with resistances can transmit physical resistance. API does not convert from one to the other and does not calculate the percentage of damage reduction. Armor and physical aliases read the same field.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Invoke reads on the game thread with the ability to cancel the wait by script. Does not query status, does not open target, does not send a packet, does not change the characteristic and does not add delay.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
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.
var result = UO.GetResist("fire");
UO.Print("GetResist: " + Convert.ToString(result));Parameters and execution flow:
- resistance=" FiRe " selects fire after removing trailing spaces and is case insensitive. value remains a signed number; the sight does not appear.
var value = UO.GetResist(" FiRe ");
UO.Print("Fire resistance: " + Convert.ToString(value));Parameters and execution flow:
- 2 selects cold; "poison" - poison. These are selectors, not serial. Comparing two snapshots returns bool; Poison Resistance does not tell whether a character is poisoned.
return RunScenario();
object? RunScenario()
{
var cold = UO.GetResist(2);
var poison = UO.GetResist("poison");
if (Truth(cold < poison))
{
UO.Print("Cold resistance is lower");
}
else
{
UO.Print("Cold resistance is equal or higher");
}
return null;
}
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:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
- selector is passed from the function to GetResist without changes; the example uses "fire". The function checks for the presence of Player, but does not validate the arbitrary selector and does not confirm the freshness of the status. Use the selector from the list above.
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()
{
if (Truth(Truth(ResistanceAtLeast("fire", 50)) == true))
{
UO.Print("Local fire resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic selector, dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetResist(selector);
return value >= minimum;
}
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: resistance (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetResistance. -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(resistance). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Armor:bridge.Armor. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.FireResistance:bridge.FireResistance. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ColdResistance:bridge.ColdResistance. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.PoisonResistance:bridge.PoisonResistance. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.EnergyResistance:bridge.EnergyResistance.
Internal implementation code; this is not a standalone script.
private int GetResistance(InjectionValue resistance)
{
if (resistance.Kind != InjectionValueKind.String)
{
switch (NumberConversions.ToInt(resistance))
{
case 0: return bridge.Armor;
case 1: return bridge.FireResistance;
case 2: return bridge.ColdResistance;
case 3: return bridge.PoisonResistance;
case 4: return bridge.EnergyResistance;
default: return 0;
}
}
switch ((resistance.String ?? string.Empty).Trim().ToLowerInvariant())
{
case "physical":
case "phys":
case "armor": return bridge.Armor;
case "fire": return bridge.FireResistance;
case "cold": return bridge.ColdResistance;
case "poison": return bridge.PoisonResistance;
case "energy": return bridge.EnergyResistance;
default: return 0;
}
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetResistCold();Reads the current character's resistance field: cold.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.ColdResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.
var result = UO.GetResistCold();
UO.Print("GetResistCold: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.GetResistCold();
UO.Print("ColdResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetResistCold();
await Delay(500);
var after = UO.GetResistCold();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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()
{
if (Truth(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetResistCold();
return value >= minimum;
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetResistCold]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ColdResistance:bridge.ColdResistance.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.ColdResistanceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetResistEnergy();Reads the current character's resistance field: energy.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.EnergyResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.
var result = UO.GetResistEnergy();
UO.Print("GetResistEnergy: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.GetResistEnergy();
UO.Print("EnergyResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetResistEnergy();
await Delay(500);
var after = UO.GetResistEnergy();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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()
{
if (Truth(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetResistEnergy();
return value >= minimum;
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetResistEnergy]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.EnergyResistance:bridge.EnergyResistance.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.EnergyResistanceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetResistFire();Reads the current character's resistance field: fire.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.FireResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.
var result = UO.GetResistFire();
UO.Print("GetResistFire: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.GetResistFire();
UO.Print("FireResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetResistFire();
await Delay(500);
var after = UO.GetResistFire();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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()
{
if (Truth(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetResistFire();
return value >= minimum;
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetResistFire]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.FireResistance:bridge.FireResistance.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.FireResistanceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetResistPhysical();Reads the current character's resistance field: physical armor/resistance.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.PhysicalResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- PhysicalResistance - server armor/status field: the classic server can transmit armor rating, and rules with resistances can transmit physical resistance. API does not convert from one to the other and does not calculate the percentage of damage reduction. Armor and physical aliases read the same field.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.
var result = UO.GetResistPhysical();
UO.Print("GetResistPhysical: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.GetResistPhysical();
UO.Print("PhysicalResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetResistPhysical();
await Delay(500);
var after = UO.GetResistPhysical();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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()
{
if (Truth(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetResistPhysical();
return value >= minimum;
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetResistPhysical]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Armor:bridge.Armor.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.ArmorAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetResistPoison();Reads the current character's resistance field: poison.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.PoisonResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.
var result = UO.GetResistPoison();
UO.Print("GetResistPoison: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.GetResistPoison();
UO.Print("PoisonResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetResistPoison();
await Delay(500);
var after = UO.GetResistPoison();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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()
{
if (Truth(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.GetResistPoison();
return value >= minimum;
}
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetResistPoison]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.PoisonResistance:bridge.PoisonResistance.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.PoisonResistanceAPI creation: These functions register the API. They do not run again for every command call.
ClassicUO — Bad Newbie & C# Scripts IDE