GWA2

From GameRevision Wiki

Jump to: navigation, search

Contents

Introduction

The Guild Wars AutoIt API, or GWA², is an API designed to write bots for Guild Wars using the AutoIt scripting language. It automatically injects itself into Guild Wars and modifies memory, giving it capabilities rivaling GWCA. Because it is written completely in AutoIt, coding bots for GWA² is generally simpler than GWCA, however this comes at the price of speed. By using AutoIt to handle memory injection and modification, GWA² combines the power of GWCA and the GWMI's ease of use.

GWA² Basics

To use GWA², it must be included and initialized before any other functions can be used. This is generally done at the top of a script using:

#include "GWA².au3" ;Path to GWA².au3
Initialize(WinGetProcess("Guild Wars")) ;See Initialize()

GWA² follows the same Agent ID system the GWCA established. -2 represents your character, and -1 represents your current target.

GWA² utilizes DllStructs to store information read from the client as pseudo-objects. This information can be easily accessed by using AutoIt's DllStructGetData() function. This code can be written quickly and more easily by utilizing the GWA² Switcher.

For example, you might use the following to find your target's current X coordinate:

$Agent = GetAgentByID(-1)
$X = DllStructGetData($Agent, 'X')
MsgBox(0, "Coordinate", "My current target's X coordinate is: " & $X)

GWA² also features callback functionality to automatically use functions on skill activation and other in-game events. For more information, read about the Event System.

Functions

Memory
Function Description
MemoryOpen() Internal use only.
MemoryClose() Internal use only.
WriteBinary() Internal use only.
MemoryWrite() Internal use only.
MemoryRead() Internal use only.
MemoryReadPtr() Internal use only.
SwapEndian() Internal use only.
Initialisation
Function Description
Initialize() Injects GWA² into the game client.
GetValue() Internal use only.
SetValue() Internal use only.
Scan() Internal use only.
AddPattern() Internal use only.
GetScannedAddress() Internal use only.
ScanForCharname() Internal use only.
Commands
Item
Function Description
StartSalvage() Starts a salvaging session of an item.
SalvageMaterials() Salvage the materials out of an item.
SalvageMod() Salvages a mod out of an item.
IdentifyItem() Identifies an item.
IdentifyBag() Identifies all items in a bag.
EquipItem() Equips an item.
UseItem() Uses an item.
PickUpItem() Picks up an item.
DropItem() Drops an item.
MoveItem() Moves an item.
AcceptAllItems() Accepts unclaimed items after a mission.
SellItem() Sells an item.
BuyItem() Buys an item.
BuyIDKit() Buys an ID kit.
BuySuperiorIDKit() Buys a superior ID kit.
TraderRequest() Request a quote to buy an item from a trader. Returns true if successful.
TraderBuy() Buy the requested item.
TraderRequestSell() Request a quote to sell an item to the trader.
TraderSell() ID of the item item being sold.
DropGold() Drop gold on the ground.
DepositGold() Deposit gold into storage.
WithdrawGold() Withdraw gold from storage.
ChangeGold() Internal use for moving gold.
H&H
Function Description
AddHero() Adds a hero to the party.
KickHero() Kicks a hero from the party.
AddNpc() Add a henchman to the party.
KickNpc() Kick a henchman from the party.
CancelHero() Clear the position flag from a hero.
CancelAll() Clear the position flag from all heroes.
CommandHero() Place a hero's position flag.
CommandAll() Place the full-party position flag.
LockHeroTarget() Lock a hero onto a target.
SetHeroAggression() Change a hero's aggression level.
DisableHeroSkillSlot() Disable a skill on a hero's skill bar.
EnableHeroSkillSlot() Enable a skill on a hero's skill bar.
ChangeHeroSkillSlotState() Internal use for enabling or disabling hero skills
UseHeroSkill() Order a hero to use a skill.
Movement
Function Description
Move() Move to a location.
MoveTo() Move to a location and wait until you reach it.
GoPlayer() Run to or follow a player.
GoNPC() Talk to an NPC
GoToNPC() Talks to NPC and waits until you reach them.
GoSignpost() Run to a signpost.
GoToSignpost() Go to signpost and waits until you reach it.
Attack() Attack an agent.
TurnLeft() Turn character to the left.
TurnRight() Turn character to the right.
MoveBackward() Move backwards.
MoveForward() Run forwards.
StrafeLeft() Strafe to the left.
StrafeRight() Strafe to the right.
ToggleAutoRun() Auto-run.
ReverseDirection() Turn around.
Travel
Function Description
TravelTo() Map travel to an outpost.
ZoneMap() Internal use for map travel.
MoveMap() Internal use for map travel.
ReturnToOutpost() Returns to outpost after resigning/failure.
EnterChallenge() Enter a challenge mission/pvp.
EnterChallengeForeign() Enter a foreign challenge mission/pvp.
TravelGH() Travel to your guild hall.
LeaveGH() Leave your guild hall.
Quest
Function Description
AcceptQuest() Accept a quest from an NPC.
QuestReward() Accept the reward for a quest.
AbandonQuest() Abandon a quest.
Windows
Function Description
CloseAllPanels() Close all in-game windows.
ToggleHeroWindow() Toggle hero window.
ToggleInventory() Toggle inventory window.
ToggleAllBags() Toggle all bags window.
ToggleWorldMap() Toggle world map.
ToggleOptions() Toggle options window.
ToggleQuestWindow() Toggle quest window.
ToggleSkillWindow() Toggle skills window.
ToggleMissionMap() Toggle mission map.
ToggleFriendList() Toggle friends list window.
ToggleGuildWindow() Toggle guild window.
TogglePartyWindow() Toggle party window.
ToggleScoreChart() Toggle score chart.
ToggleLayoutWindow() Toggle layout window.
ToggleMinionList() Toggle minions window.
ToggleHeroPanel() Toggle a hero panel.
ToggleHeroPetPanel() Toggle hero's pet panel.
TogglePetPanel() Toggle pet panel.
ToggleHelpWindow() Toggle help window.
Targeting
Function Description
ChangeTarget() Target an agent.
CallAttack() Call and attack target.
CallTarget() Call target.
ClearTarget() Clear current target.
TargetNearestEnemy() Target the nearest enemy.
TargetNextEnemy() Target the next enemy.
TargetPartyMember() Target the next party member.
TargetPreviousEnemy() Target the previous enemy.
TargetCalledTarget() Target the called target.
TargetSelf() Target yourself.
TargetNearestAlly() Target the nearest ally.
TargetNearestItem() Target the nearest item.
TargetNextItem() Target the next item.
TargetPreviousItem() Target the previous item.
TargetNextPartyMember() Target the next party member.
TargetPreviousPartyMember() Target the previous party member.
Display
Function Description
EnableRendering() Enable graphics rendering.
DisableRendering() Disable graphics rendering.
DisplayAll() Display all names.
DisplayAllies() Display the names of allies.
DisplayEnemies() Display the names of enemies.
Chat
Function Description
WriteChat() Write a message in chat (can only be seen by botter).
SendWhisper() Send a whisper to another player.
SendChat() Send a message to chat.
Misc
Function Description
ChangeWeaponSet() Change weapon sets.
UseSkill() Use a skill.
CancelAction() Cancel current action.
ActionInteract() Same as hitting spacebar.
ActionFollow() Follow a player.
DropBundle() Drop environment object.
ClearPartyCommands() Clear all hero flags.
SuppressAction() Suppress action.
OpenChest() Open a chest.
DropBuff() Stop maintaining enchantment on target.
MakeScreenshot() Take a screenshot.
InvitePlayer() Invite a player to the party.
LeaveGroup() Leave your party.
SwitchMode() Switches to/from Hard Mode.
Resign() Resign.
DonateFaction() Donate Kurzick or Luxon faction.
Dialog() Open a dialog.
SkipCinematic() Skip a cinematic.
SetSkillbarSkill() Change a skill on the skillbar.
IncreaseAttribute() Increase attribute by 1
DecreaseAttribute() Decrease attribute by 1
ClearAttributes() Set all attributes to 0
ChangeSecondProfession() Change your secondary profession.
InitMapLoad() Sets value of GetMapIsLoaded() to 0.
EnsureEnglish() Changes game language to english.
ToggleLanguage() Change game language.
ChangeMaxZoom() Changes the maximum distance you can zoom out.
Enqueue() Internal use only.
FloatToInt() Converts float to integer.
Queries
Titles
Function Description
GetHeroTitle() Returns Hero title progress.
GetGladiatorTitle() Returns Gladiator title progress.
GetKurzickTitle() Returns Kurzick title progress.
GetLuxonTitle() Returns Luxon title progress.
GetDrunkardTitle() Returns drunkard title progress.
GetSurvivorTitle() Returns survivor title progress.
GetMaxTitles() Returns max titles
GetLuckyTitle() Returns lucky title progress.
GetUnluckyTitle() Returns unlucky title progress.
GetSunspearTitle() Returns Sunspear title progress.
GetLightbringerTitle() Returns Lightbringer title progress.
GetCommanderTitle() Returns Commander title progress.
GetGamerTitle() Returns Gamer title progress.
GetLegendaryGuardianTitle() Returns Legendary Guardian title progress.
GetSweetTitle() Returns sweets title progress.
GetAsuraTitle() Returns Asura title progress.
GetDeldrimorTitle() Returns Deldrimor title progress.
GetVanguardTitle() Returns Vanguard title progress.
GetNornTitle() Returns Norn title progress.
GetNorthMasteryTitle() Returns mastery of the north title progress.
GetPartyTitle() Returns party title progress.
GetZaishenTitle() Returns Zaishen title progress.
GetTreasureTitle() Returns treasure hunter title progress.
GetWisdomTitle() Returns wisdom title progress.
Faction
Function Description
GetKurzickFaction() Returns current Kurzick faction.
GetMaxKurzickFaction() Returns max Kurzick faction.
GetLuxonFaction() Returns current Luxon faction.
GetMaxLuxonFaction() Returns max Luxon faction.
GetBalthazarFaction() Returns current Balthazar faction.
GetMaxBalthazarFaction() Returns max Balthazar faction.
GetImperialFaction() Returns current Imperial faction.
GetMaxImperialFaction() Returns max Imperial faction.
Item
Function Description
GetRarity() Returns rarity (name color) of an item.
GetIsIDed() Tests if an item is identified.
GetItemReq() Returns a weapon or shield's minimum required attribute.
GetItemAttribute() Returns a weapon or shield's required attribute.
GetModByIdentifier() Returns an array of a the requested mod.
GetModStruct() Returns modstruct of an item.
GetAssignedToMe() Tests if an item is assigned to you.
GetCanPickUp() Tests if you can pick up an item.
GetBag() Returns struct of an inventory bag.
GetItemBySlot() Returns item by slot.
GetItemByItemID() Returns item struct.
GetItemByAgentID() Returns item by agent ID.
GetItemByModelID() Returns item by model ID.
GetGoldStorage() Returns amount of gold in storage.
GetGoldCharacter() Returns amount of gold being carried.
FindSalvageKit() Returns item ID of salvage kit in inventory.
FindIDKit() Returns item ID of ID kit in inventory.
GetTraderCostID() Returns the item ID of the quoted item.
GetTraderCostValue() Returns the cost of the requested item.
GetMerchantItemsBase() Internal use for BuyItem()
GetMerchantItemsSize() Internal use for BuyItem()
H&H
Function Description
GetHeroCount() Returns number of heroes you control.
GetHeroID() Returns agent ID of a hero.
GetHeroNumberByAgentID() Returns hero number by agent ID.
GetHeroNumberByHeroID() Returns hero number by hero ID.
GetIsHeroSkillSlotDisabled() Tests if a hero's skill slot is disabled.
Agent
Function Description
GetAgentByID() Returns an agent struct.
GetAgentPtr() Internal use for GetAgentByID()
GetAgentExists() Test if an agent exists.
GetTarget() Returns the target of an agent.
GetAgentByPlayerName() Returns agent by player name.
GetAgentByName() Returns agent by name.
GetNearestAgentToAgent() Returns the nearest agent to an agent.
GetNearestEnemyToAgent() Returns the nearest enemy to an agent.
GetNearestAgentToCoords() Returns the nearest agent to a set of coordinates.
GetNearestSignpostToAgent() Returns the nearest signpost to an agent.
GetNearestSignpostToCoords() Returns the nearest signpost to a set of coordinates.
GetNearestNPCToAgent() Returns the nearest NPC to an agent.
GetNearestNPCToCoords() Returns the nearest NPC to a set of coordinates.
GetNearestItemToAgent() Returns the nearest item to an agent.
GetParty() Returns array of party members
AgentInfo
Function Description
GetIsLiving() Tests if an agent is living.
GetIsStatic() Tests if an agent is a signpost/chest/etc.
GetIsMovable() Tests if an agent is an item.
GetEnergy() Returns energy of an agent. (Only self/heroes)
GetHealth() Returns health of an agent. (Must have caused numerical change in health)
GetIsMoving() Tests if an agent is moving.
GetIsKnocked() Tests if an agent is knocked down.
GetIsAttacking() Tests if an agent is attacking.
GetIsCasting() Tests if an agent is casting.
GetIsBleeding() Tests if an agent is bleeding.
GetHasCondition() Tests if an agent has a condition.
GetIsDead() Tests if an agent is dead.
GetHasDeepWound() Tests if an agent has a deep wound.
GetIsPoisoned() Tests if an agent is poisoned.
GetIsEnchanted() Tests if an agent is enchanted.
GetHasDegenHex() Tests if an agent has a degen hex.
GetHasHex() Tests if an agent is hexed.
GetHasWeaponSpell() Tests if an agent has a weapon spell.
GetIsBoss() Tests if an agent is a boss.
GetPlayerName() Returns a player's name.
GetAgentName() Returns the name of an agent.
Buff
Function Description
GetBuffCount() Returns current number of buffs being maintained.
GetIsTargetBuffed() Tests if you are currently maintaining buff on target.
GetBuffByIndex() Returns buff struct.
Misc
Function Description
GetSkillbar() Returns skillbar struct.
GetSkillbarSkillID() Returns the skill ID of an equipped skill.
GetSkillbarSkillAdrenaline() Returns the adrenaline charge of an equipped skill.
GetSkillbarSkillRecharge() Returns the recharge time remaining of an equipped skill in milliseconds.
GetSkillByID() Returns skill struct.
GetMorale() Returns current morale.
GetEffect() Returns effect struct or array of effects.
GetEffectTimeRemaining() Returns time remaining before an effect expires, in milliseconds.
GetSkillTimer() Returns the timestamp used for effects and skills (milliseconds).
GetAttributeByID() Returns level of an attribute.
GetExperience() Returns amount of experience.
GetAreaVanquished() Tests if an area has been vanquished.
GetFoesKilled() Returns number of foes that have been killed so far.
GetFoesToKill() Returns number of enemies left to kill for vanquish.
GetMaxAgents() Returns number of agents currently loaded.
GetMyID() Returns your agent ID.
GetCurrentTarget() Returns current target.
GetCurrentTargetID() Returns current target ID.
GetPing() Returns current ping.
GetMapID() Returns current map ID.
GetMapLoading() Returns current load-state.
GetMapIsLoaded() Returns if map has been loaded. Reset with InitMapLoad().
GetDistrict() Returns current district
GetRegion() Internal use for travel functions.
GetLanguage() Internal use for travel functions.
WaitMapLoading() Wait for map to load. Returns true if successful.
GetQuestByID() Returns quest struct.
GetCharname() Returns your characters name.
GetLoggedIn() Returns if you're logged in.
GetDisplayLanguage() Returns language currently being used.
Other Functions
Misc
Function Description
RndSleep() Sleep a random amount of time.
TolSleep() Sleep a period of time, plus or minus a tolerance
GetWindowHandle() Returns window handle of Guild Wars.
ComputeDistance() Returns the distance between two coordinate pairs.
GetDistance() Returns the distance between two agents.
ConvertID() Internal use for handing -1 and -2 agent IDs.
SendPacket() Internal use only.
PerformAction() Internal use only.
Callback
Function Description
SetEvent() Controls Event System.
Event() Internal use for Event System.
Modification
Function Description
ModifyMemory() Internal use only.
WriteDetour() Internal use only.
CreateData() Internal use only.
CreateMain() Internal use only.
CreateTargetLog() Internal use only.
CreateSkillLog() Internal use only.
CreateSkillCancelLog() Internal use only.
CreateSkillCompleteLog() Internal use only.
CreateChatLog() Internal use only.
CreateTraderHook() Internal use only.
CreateLoadFinished() Internal use only.
CreateStringLog() Internal use only.
CreateStringFilter1() Internal use only.
CreateStringFilter2() Internal use only.
CreateRenderingMod() Internal use only.
CreateCommands() Internal use only.
Assembler
Function Description
_() Internal use only.
CompleteASMCode() Internal use only.
GetLabelInfo() Internal use only.

See Also

GWA² Troubleshooting

Personal tools