EN UO Topic quests virtues - 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
General client requests for quests and virtues. Age of Power server missions are described in a separate section of the Wiki.
| Topic | Commands and explanations |
|---|---|
| QuestRequest | UO.QuestRequest |
| Quest Arrow | UO.GetQuestArrow |
| Virtues Gump | UO.ReqVirtuesGump |
| UseVirtue | UO.UseVirtue |
UO.QuestRequest · UO.GetQuestArrow · UO.ReqVirtuesGump · UO.UseVirtue
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 arrow = UO.GetQuestArrow();
if (Truth(Truth(arrow[0]) == true))
{
UO.Print(Convert.ToString(arrow[1]) + ", " + Convert.ToString(arrow[2]));
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters, result and all scenarios
UO.Print(UO.UseVirtue("Honor"));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetQuestArrow();
dynamic UO.GetQuestArrow(object? point);Reads the position of the server task arrow. Allows the script to know where the arrow received from the server is pointing; She doesn't read the Track command.
-
point- Deprecated optional placeholder. The UO.GetQuestArrow(point) form is retained for compatibility; the argument is not read or modified. Use UO.GetQuestArrow() and its return array.
Array [exists, x, y], exactly three integers. [0] - 1 (true), if there is a server arrow, otherwise 0 (false); [1] - X, [2] - Y. Without arrow [0, 0, 0]. Only the [0] field is a logical attribute; the entire array is not bool. If there are several arrows, the first saved one is read, there is no choice by ID.
- Server and local arrows are stored separately. Track(0) does not remove the server arrow. Without graphics, the marker is saved and appears when the window is opened. Closing the game window does not remove markers; breaking the connection clears them. The server can move or remove its arrow. Coordinates do not prove that the goal is achievable.
- Cell coordinates on the current map, not window pixels. Z and map number are not accepted. Select an existing point on your map; the team does not check terrain, plot a route, or follow a moving target.
- Deprecated optional placeholder. The UO.GetQuestArrow(point) form is retained for compatibility; the argument is not read or modified. Use UO.GetQuestArrow() and its return array.
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.GetQuestArrow();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- First, [0] is checked; then [1]/[2] can be read as X/Y. Don't pass the entire array as serial or bool.
var arrow = UO.GetQuestArrow();
if (Truth(Truth(arrow[0]) == true))
{
UO.Print(Convert.ToString(arrow[1]) + ", " + Convert.ToString(arrow[2]));
}
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:
- Copies the coordinates of the server arrow to the local Track marker. This is not a movement. If the server later moves the arrow, the local one will remain at the same point.
return RunScenario();
object? RunScenario()
{
var arrow = UO.GetQuestArrow();
if (Truth(arrow[0] == 1))
{
UO.Track(1, arrow[1], arrow[2]);
}
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:
- ArrowDistance returns the distance UO.GetDistance(x,y) to the server point or −1 if there is no arrow. At a distance of up to two cells, only the local Track is removed, the server arrow remains.
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 distance = ArrowDistance();
if (Truth(distance >= 0) && Truth(distance <= 2))
{
UO.Track(0);
}
return null;
}
dynamic ArrowDistance()
{
var arrow = UO.GetQuestArrow();
if (Truth(arrow[0] == 0))
{
return -1;
}
return UO.GetDistance(arrow[1], arrow[2]);
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Array.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetQuestArrow:bridge.GetQuestArrow().
Internal implementation code; this is not a standalone script.
case "getquestarrow":
return new InjectionValue(bridge.GetQuestArrow().Select(value => new InjectionValue(value)).ToArray());Parameters: point (Any)
Result: dynamic / Array.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetQuestArrow:bridge.GetQuestArrow().
Internal implementation code; this is not a standalone script.
case "getquestarrow":
return new InjectionValue(bridge.GetQuestArrow().Select(value => new InjectionValue(value)).ToArray());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.QuestRequest();Requests the server task menu.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- QuestRequest passes GameActions.RequestQuestMenu(_world) to the game thread. The team does not read or create tasks.
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
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 command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.QuestRequest");
UO.QuestRequest();Parameters and execution flow:
- Requests the server task menu.
UO.QuestRequest();Parameters and execution flow:
- QuestRequest passes GameActions.RequestQuestMenu(_world) to the game thread. The team does not read or create tasks.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.IsOnline()))
{
UO.QuestRequest();
}
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:
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
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()
{
UO.QuestRequest();
UO.Wait(500);
UO.Print(UO.GetGumpsCount());
return null;
}
}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: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.QuestRequest:bridge.QuestRequest().
Internal implementation code; this is not a standalone script.
case "questrequest": bridge.QuestRequest(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ReqVirtuesGump();Requests a character's virtues window.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- RequestVirtuesGump, if there is a Player, calls ReplyGump with gumpID=0x1CD, button=1 and serial character. Without Player there is no request.
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
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 command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.ReqVirtuesGump");
UO.ReqVirtuesGump();Parameters and execution flow:
- Requests a character's virtues window.
UO.ReqVirtuesGump();Parameters and execution flow:
- RequestVirtuesGump, if there is a Player, calls ReplyGump with gumpID=0x1CD, button=1 and serial character. Without Player there is no request.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Self() != 0))
{
UO.ReqVirtuesGump();
}
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:
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
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()
{
UO.ReqVirtuesGump();
UO.Wait(500);
UO.Print(UO.GetGumpsCount());
return null;
}
}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: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.RequestVirtuesGump:bridge.RequestVirtuesGump().
Internal implementation code; this is not a standalone script.
case "reqvirtuesgump": bridge.RequestVirtuesGump(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.UseVirtue(object? virtueName);Requests the application of virtue.
-
virtueName— The name honor/sacrifice/valor/compassion/honesty/humility/justice/spirituality is case insensitive, with outer spaces removed, or double text ID 1..8.
Numeric flag int: 1 - valid ID 1..8 sent via Send_InvokeVirtueRequest; 0 - unknown name/invalid ID. This is not confirmation of the server effect.
- The names correspond to ID: Honor=1, Sacrifice=2, Valor=3, Compassion=4, Honesty=5, Humility=6, Justice=7, Spirituality=8. Numeric parsing of this function uses int.TryParse, not 0x conversion.
- The team itself does not set a follow-up goal or check virtue points/availability; this is determined by the server.
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.UseVirtue("Honor");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Requests the application of virtue.
UO.Print(UO.UseVirtue("Honor"));Parameters and execution flow:
- The names correspond to ID: Honor=1, Sacrifice=2, Valor=3, Compassion=4, Honesty=5, Humility=6, Justice=7, Spirituality=8. Numeric parsing of this function uses int.TryParse, not 0x conversion.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.UseVirtue("1"));
return null;
}Parameters and execution flow:
- The team itself does not set a follow-up goal or check virtue points/availability; this is determined by the server.
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 accepted = UO.UseVirtue("Honor");
if (Truth(accepted))
{
UO.Print("Virtue request sent");
}
return null;
}
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: virtueName (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.UseVirtue:bridge.UseVirtue(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "usevirtue": return new InjectionValue(bridge.UseVirtue(Text(0)));