EN UO Topic buffs effects - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Effects and status check panel. A negative status check does not mean that all possible effects are absent.
| Topic | Commands and explanations |
|---|---|
| Buff Bar | UO.GetBuffBarInfo |
| Poison | UO.Poisoned |
| Paralyze | UO.Paralyzed |
| Frozen | UO.Frozen |
| Flying | UO.Flying |
| Resistance | UO.GetResist · UO.GetPhysicalResist · UO.GetFireResist · UO.GetColdResist · UO.GetPoisonResist · UO.GetEnergyResist |
Each command card has several independent scenarios: direct code, functions and classes. Below are selected short scenarios; restrictions and full analysis are in the cards.
Parameters, result and all scenarios
var buffs = UO.GetBuffBarInfo();
for (int i = (int)(0); i <= ArrayLength(buffs)-1; i += (int)(1))
{
UO.Print(buffs[i]);
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;Parameters, result and all scenarios
var state = UO.Paralyzed();
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;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetBuffBarInfo();Returns a snapshot of the current character's buff icons.
There are no parameters.
Array of strings of format type|graphic|remainingMilliseconds|text. remainingMilliseconds=-1 for Timer=uint.MaxValue; else max(0,Timer-Time.Ticks). No character/icons - empty array.
- The data is taken from Player.BuffIcons.Values, without a request to the server. The value remainingMilliseconds refers to the client timer and may be out of date; -1 denotes an indefinite timer, not an error. Text can contain | characters, so it is not expected to have exactly four simple words.
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.GetBuffBarInfo();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Each line contains type, graphic, timer remainder, and text.
var buffs = UO.GetBuffBarInfo();
for (int i = (int)(0); i <= ArrayLength(buffs)-1; i += (int)(1))
{
UO.Print(buffs[i]);
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;Parameters and execution flow:
- The size reflects the current client icons.
return RunScenario();
object? RunScenario()
{
var buffs = UO.GetBuffBarInfo();
UO.Print(Convert.ToString(ArrayLength(buffs)));
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;Parameters and execution flow:
- The new call rereads the current set; the old array remains a snapshot.
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.GetBuffBarInfo();
await Delay(1000);
var after = UO.GetBuffBarInfo();
UO.Print(Convert.ToString(ArrayLength(before)) + " " + Convert.ToString(ArrayLength(after)));
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
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.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.StringArray:StringArray(bridge.GetBuffBarInfo()). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetBuffBarInfo:bridge.GetBuffBarInfo().
Internal implementation code; this is not a standalone script.
case "getbuffbarinfo": return StringArray(bridge.GetBuffBarInfo());