What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

API documentation

cyberbot

Member
Joined
Mar 15, 2014
Messages
220
Reaction score
2
I haven't used the API for a while, and I am definitely unfamiliar with the new changes in the API. I will appreciate it if you can answer any of the following questions:

1) After setting up a VS project as in https://www.thebuddyforum.com/exile...y-guides/171025-setup-project-exilebuddy.html
do you have any documentation in the Object Browser? All I am seeing is only the classes, functions, namespaces, etc. with no words to describe them. Did I set up the project wrong or is there no documentation?

2) To see the name of the left-hand weapon, it used to be "LokiPoe.InGameState.InventoryPanel.LeftHand.Name". What is it now?

3) To press a keyboard key, it used to be "Loki.Game.LokiPoe.Input.PressKey((System.Windows.Forms.Keys.XXXXXX)". What is it now?

Thanks.
 
Last edited:
1) Sadly, there is no documentation for Exilebuddy API now.
2) To get a left hand weapon name:
Code:
LokiPoe.InGameState.InventoryUi.InventoryControl_PrimaryMainHand.Inventory.Items.FirstOrDefault().Name;
But its better to do with null check:
Code:
var mainWeapon = LokiPoe.InGameState.InventoryUi.InventoryControl_PrimaryMainHand.Inventory.Items.FirstOrDefault();
if (mainWeapon != null)
{
    var name = mainWeapon.Name;
}
3) LokiPoe.Input.SimulateKeyEvent(key, true, false, false). But if you wanna use that for typing in chat, you'd better do LokiPoe.InGameState.ChatPanel.Chat(message);
 
Last edited:
1) Sadly, there is no documentation for Exilebuddy API now.
2) To get a left hand weapon name:
Code:
LokiPoe.InGameState.InventoryUi.InventoryControl_PrimaryMainHand.Inventory.Items.FirstOrDefault().Name;
But its better to do with null check:
Code:
var mainWeapon = LokiPoe.InGameState.InventoryUi.InventoryControl_PrimaryMainHand.Inventory.Items.FirstOrDefault();
if (mainWeapon != null)
{
    var name = mainWeapon.Name;
}
3) LokiPoe.Input.SimulateKeyEvent(key, true, false, false). But if you wanna use that for typing in chat, you'd better do LokiPoe.InGameState.ChatPanel.Chat(message);

While we are at it, ExVault: Is there a way to find out how many instances/fuses of explosive arrow there is on a monster? I've failed to do this.
 
Debuffs are usually auras. You should find some fat monster (Hillock?), shoot explosive arrows at him and dump current auras.

Code:
var hillock = LokiPoe.ObjectManager.Objects.OfType<Monster>().FirstOrDefault(m => m.Rarity == Rarity.Unique && m.Name == "Hillock");
if (hillock != null)
{
     foreach (var aura in hillock.Auras)
     {
         Log.Warn($"Name: {aura.Name}, Internal name: {aura.InternalName}");
     }
}

If thats not the case, maybe explosive arrows charges are stored in Stats then.

Code:
foreach (var stat in hillock.Stats)
{
     Log.Warn($"Stat: {stat.Key}, Value: {stat.Value}");
}

But beware, dumping stats usually results in a wall of text :)
 
Debuffs are usually auras. You should find some fat monster (Hillock?), shoot explosive arrows at him and dump current auras.

Code:
var hillock = LokiPoe.ObjectManager.Objects.OfType<Monster>().FirstOrDefault(m => m.Rarity == Rarity.Unique && m.Name == "Hillock");
if (hillock != null)
{
     foreach (var aura in hillock.Auras)
     {
         Log.Warn($"Name: {aura.Name}, Internal name: {aura.InternalName}");
     }
}

If thats not the case, maybe explosive arrows charges are stored in Stats then.

Code:
foreach (var stat in hillock.Stats)
{
     Log.Warn($"Stat: {stat.Key}, Value: {stat.Value}");
}

But beware, dumping stats usually results in a wall of text :)

Bingo! Stat: MaxFuseArrowOrbsValue: 5

Thanks :) :)

Edit: This might just be a max value, if you have any ideas for where to look for the current value of applied fuses it'd be great! Name of aura is: Name:Hit by Explosive Arrow, Internal name:fuse_arrow_orb

Edit 2: I found this StatTypeGGG.CurrentFuseArrowOrbs but it always returns 0.
 
Last edited:
3) LokiPoe.Input.SimulateKeyEvent(key, true, false, false). But if you wanna use that for typing in chat, you'd better do LokiPoe.InGameState.ChatPanel.Chat(message);

Thanks for the above.

I am trying to switch my weapon in a fight:

Code:
Loki.Game.LokiPoe.Input.SimulateKeyEvent(Loki.Game.LokiPoe.Input.Binding.weapon_swap,true, false,false);							
await Coroutines.LatencyWait();
But the bot keeps on fighting without switching the weapon. I suspect the thread(s) are not waiting for this to happen. What should I do? I tried using multiple "await Coroutines.LatencyWait();" or "await Coroutine.Sleep(1000);" with no success while fighting. (It will change only after the fight has ended).
 
XML docs not being visible in VS was not intended, and is a bug. I've fixed it for the next beta/release, as it seems the current setup has been long broken due to changes made with the build server over the years.

The Help/documentation.chm file is still accurate though, and contains a faster to work with (although less convenient compared to VS) means of viewing API docs. The Help folder also contains some extra docs and stuff.

Lastly, the Guides section contains a few stickies about the major API changes that took place earlier this year with Ascendancy. Even though you've gotten help for a few of those old changes, check those threads for more detailed info about what all happened.

Oh, and OldGrindBot and QuestBot both now come with full source, so you have access to almost all of the non-API stuff. A few things in Loki.Bot are still private, but they aren't things people should be changing.

But the bot keeps on fighting without switching the weapon. I suspect the thread(s) are not waiting for this to happen. What should I do? I tried using multiple "await Coroutines.LatencyWait();" or "await Coroutine.Sleep(1000);" with no success while fighting. (It will change only after the fight has ended).

Try waiting for all actions to finish first (you must clear key states as well), then enter your weapon swap logic loop (small loop with delay and multiple tries, because this is PoE after all), then continue your normal combat logic. You can use LokiPoe.InstanceInfo.WeaponSet to know you actually swapped or not.

You can verify the client won't actually swap weapons until a certain point after animations are done, so that's most likely what is happening in your case.
 
XML docs not being visible in VS was not intended, and is a bug. I've fixed it for the next beta/release, as it seems the current setup has been long broken due to changes made with the build server over the years.

The Help/documentation.chm file is still accurate though, and contains a faster to work with (although less convenient compared to VS) means of viewing API docs. The Help folder also contains some extra docs and stuff.

Lastly, the Guides section contains a few stickies about the major API changes that took place earlier this year with Ascendancy. Even though you've gotten help for a few of those old changes, check those threads for more detailed info about what all happened.

Oh, and OldGrindBot and QuestBot both now come with full source, so you have access to almost all of the non-API stuff. A few things in Loki.Bot are still private, but they aren't things people should be changing.



Try waiting for all actions to finish first (you must clear key states as well), then enter your weapon swap logic loop (small loop with delay and multiple tries, because this is PoE after all), then continue your normal combat logic. You can use LokiPoe.InstanceInfo.WeaponSet to know you actually swapped or not.

You can verify the client won't actually swap weapons until a certain point after animations are done, so that's most likely what is happening in your case.

The documentation is very very helpful. The key to my problem, as you suggested, is "await Coroutines.FinishCurrentAction();" Thanks.
 
Another question. In the past, when I wanted to end a run, I would call "await Coroutines.CreateAndTakePortalToTown();". How to end a run now? Thanks.
 
Another question. In the past, when I wanted to end a run, I would call "await Coroutines.CreateAndTakePortalToTown();". How to end a run now? Thanks.

Best way would be to set NeedsTownRun in oldgrindbot, not sure they're accessible tho
 
Best way would be to set NeedsTownRun in oldgrindbot, not sure they're accessible tho

I tried that. Even though it returns to town, it will go back to the crime scene through the portal and try to continue the run that I wanted finished.
 
I tried that. Even though it returns to town, it will go back to the crime scene through the portal and try to continue the run that I wanted finished.

NeedsTownRun is a flag, if you want it to create a new instance I don't remember what's the value you have to assign, I assume 1 or 2, not sure
 
Found it...
Code:
if (await CoroutinesV3.CreatePortalToTown())
{
	if (await CoroutinesV3.TakeClosestPortal())
	        return true;
}
return false;
 
Last edited:
Found it...
Code:
if (await CoroutinesV3.CreatePortalToTown())
{
	if (await CoroutinesV3.TakeClosestPortal())
	        return true;
}
return false;

Yes but this won't force a new instance in OGB, just so you know
 
Back
Top