Open CryoGenesisX opened 8 years ago
I'll have to see if we have those specific scripts wrapped, and if not, see what would be required to wrap them if possible.
This was a plugin supported by another user. It does work but it crashes the bot. Myabe this can be useful as a different approach to fix this problem. I know once upon a time BuddyWing did harvest corspes
using System;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Diagnostics;
using Buddy.Common;
using Buddy.CommonBot;
using Buddy.Common.Plugins;
using Buddy.Swtor;
using Buddy.Swtor.Objects;
namespace Buddywing.Plugins
{
class ProximityInteract : IPlugin
{
#region Implementation of IEquatable<IPlugin>
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <returns>
/// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
/// </returns>
/// <param name="other">An object to compare with this object.</param>
public bool Equals(IPlugin other)
{
return other.Name == Name;
}
#endregion
#region Implementation of IPlugin
public DateTime LastInteractCheck;
public ulong LastInteract;
public string Author { get { return "Bender69"; } }
public Version Version { get { return new Version(0, 1); } }
public string Name { get { return "Proximity Interact"; } }
public string Description { get { return "Use Companion on salvaging nodes or similar"; } }
public Window DisplayWindow { get { return null; } }
/// <summary> Executes the pulse action. This is called every "tick" of the bot. </summary>
public void OnPulse()
{
if (DateTime.Now.Subtract(LastInteractCheck).TotalSeconds > 0.5f)
{
if (!BuddyTor.Me.IsCasting && !BuddyTor.Me.IsMoving)
{
List<TorNpc> Objects = ObjectManager.GetObjects<TorNpc>().Where(o => o.Distance < 1.0f).ToList();
foreach (TorNpc t in Objects)
{
if (t.IsDead && !t.IsLootable && LastInteract != t.Guid)
{
LastInteract = t.Guid;
Logging.Write("[ProximityInteract] " + t.Name + " id:" + t.Guid);
t.Interact();
t.Interact();
}
}
}
LastInteractCheck = DateTime.Now;
}
}
/// <summary> Executes the initialize action. This is called at initial bot startup. (When the bot itself is started, not when Start() is called) </summary>
public void OnInitialize()
{
}
public void OnStart()
{
LastInteractCheck = DateTime.Now;
}
public void OnStop()
{
}
/// <summary> Executes the shutdown action. This is called when the bot is shutting down. (Not when Stop() is called) </summary>
public void OnShutdown()
{
}
/// <summary> Executes the enabled action. This is called when the user has enabled this specific plugin via the GUI. </summary>
public void OnEnabled()
{
}
/// <summary> Executes the disabled action. This is called whent he user has disabled this specific plugin via the GUI. </summary>
public void OnDisabled()
{
}
#endregion
}
}
@armyruss79 That's one approach we could take, but it'd be cleaner to detect if we can actually harvest corpses around us rather than interacting with everything that's near us. What's the crash that occurs with this plugin specifically by the way, it doesn't seem to be doing anything out of the ordinary?
Its constantly scanning around for bodies to harvest and I think its having issues with the memory process's. I can not bot for more than hour running this plugin without the bot just stopping. I turn the plugin off and runs all night
2016-03-04 08:58:43,961 [Main Bot Thread] INFO Log - Killing Massassi Brute with 100% health at 25.68 meters
2016-03-04 08:58:44,259 [Main Bot Thread] INFO Log - [BenderCombat] >> Casting << Blazing Bolts
2016-03-04 08:58:47,180 [Main Bot Thread] INFO Log - [Poi.Clear] Reason: Targeted unit is dead, clearing Poi and carrying on!
2016-03-04 08:58:47,330 [Main Bot Thread] INFO Log - Moving to Massassi Brute at 27.48711 meters.
2016-03-04 08:58:50,418 [Main Bot Thread] ERROR Log - System.Exception: Function GetHealth does not exist.
at ?????????????????????????????????????????.????????????????????????????????????????.?????????????????????????????????????????[](Boolean , String , Object[])
at Buddy.Swtor.Objects.TorObject.CallScript[T](Boolean hasReturnValue, String function, Object[] args)
at Buddy.Swtor.Objects.TorCharacter.get_Health()
at Buddy.Swtor.Objects.TorCharacter.get_IsDead()
at Buddy.Swtor.Objects.TorNpc.get_IsLootable()
at Buddy.CommonBot.DefaultLootTargetingProvider.?????????????????????????????????????????.?????????????????????????????????????????(TorNpc )
at System.Linq.Enumerable.<>cDisplayClassf`1.2.MoveNext() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)
at Buddy.CommonBot.DefaultLootTargetingProvider.GetObjectsByWeight()
at Buddy.CommonBot.Targeting.Pulse()
at Buddy.CommonBot.Logic.BrainBehavior.?????????????????????????????????????????()
2016-03-04 08:58:52,397 [Main Bot Thread] ERROR Log - System.Exception: Function GetHealth does not exist.
at ?????????????????????????????????????????.????????????????????????????????????????.?????????????????????????????????????????[](Boolean , String , Object[])
at Buddy.Swtor.Objects.TorObject.CallScript[T](Boolean hasReturnValue, String function, Object[] args)
at Buddy.Swtor.Objects.TorCharacter.get_Health()
at Buddy.Swtor.Objects.TorCharacter.get_IsDead()
at Buddy.Swtor.Objects.TorNpc.get_IsLootable()
at Buddy.CommonBot.DefaultLootTargetingProvider.?????????????????????????????????????????.?????????????????????????????????????????(TorNpc )
at System.Linq.Enumerable.<>cDisplayClassf`1.2.MoveNext() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)
at Buddy.CommonBot.DefaultLootTargetingProvider.GetObjectsByWeight()
at Buddy.CommonBot.Targeting.Pulse()
at Buddy.CommonBot.Logic.BrainBehavior.?????????????????????????????????????????()
2016-03-04 08:58:54,328 [Main Bot Thread] WARN Log - Blacklisting 216642589B for 00:01:00
2016-03-04 08:58:54,329 [Main Bot Thread] INFO Log - [Poi.Clear] Reason: Done Looting.
2016-03-04 08:58:54,622 [Main Bot Thread] INFO Log - Killing Massassi Brute with 100% health at 35.47 meters
2016-03-04 08:58:57,445 [Main Bot Thread] INFO Log - [BenderCombat] >> Casting << Tracer Missile
2016-03-04 08:58:58,234 [Main Bot Thread] ERROR Log - Engine class is null, TorObject may no longer be valid!
2016-03-04 08:58:58,263 [Main Bot Thread] ERROR Log - Engine class is null, TorObject may no longer be valid!
2016-03-04 08:58:58,263 [Main Bot Thread] ERROR Log - System.Exception: DbOffset is Zero.
at ?????????????????????????????????????????.?????????????????????????????????????????.?????????????????????????????????????????[](UInt64 , HeroType)
at Buddy.Swtor.Objects.TorObject.GetField[T](DomFieldIds field, HeroType forcedType)
at Buddy.Swtor.Objects.TorCharacter.get_Health()
at Buddy.Swtor.Objects.TorCharacter.get_IsDead()
at Buddy.Swtor.Objects.TorNpc.get_IsLootable()
at Buddy.CommonBot.DefaultLootTargetingProvider.?????????????????????????????????????????.?????????????????????????????????????????(TorNpc )
at System.Linq.Enumerable.<>cDisplayClassf`1.2.MoveNext() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)
at Buddy.CommonBot.DefaultLootTargetingProvider.GetObjectsByWeight()
at Buddy.CommonBot.Targeting.Pulse()
at Buddy.CommonBot.Logic.BrainBehavior.?????????????????????????????????????????()
2016-03-04 08:58:59,290 [Main Bot Thread] INFO Log - [BenderCombat] >> Casting << Blazing Bolts
2016-03-04 08:59:00,028 [Main Bot Thread] INFO Log - [Poi.Clear] Reason: I'm in combat, but POI isn't. Clearing POI and picking up a new target.
2016-03-04 08:59:00,111 [Main Bot Thread] INFO Log - Killing Massassi Brute with 100% health at 36.51 meters
Once the target is dead could we get the bot to just click on the bodies regardless if it's harvest-able or not? If its harvest-able and the bot clicks on the body the companion will harvest it and off we go to the next. Instead of scanning and searching for harvest-able ID's its just a click and that's it
bot ran for 2hrs or less and I got a 36meg error log with that plugin running. trying to post the entire log to the buddywing forums since it is took large for github
This is the last moments before the bot timed out and the character went to lobby. I see something about the lockbox plugin. Are these two plugins competing for something?
2016-03-04 05:10:25,857 [Main Bot Thread] ERROR Log - System.Exception: Only part of a ReadProcessMemory or WriteProcessMemory request was completed, at addr: 00000001, Size: 33
at GreyMagic.ExternalProcessMemory.ReadByteBuffer(IntPtr addr, Void* buffer, Int32 count)
at GreyMagic.MemoryBase.ReadBytes(IntPtr addr, Int32 count)
at ?????????????????????????????????????????.?????????????????????????????????????????.get_Struct()
at ?????????????????????????????????????????.?????????????????????????????????????????.?????????????????????????????????????????()
at ?????????????????????????????????????????.?????????????????????????????????????????.get_NodeView()
at Buddy.Swtor.Objects.TorObject.get_DataBaseOffset()
at ?????????????????????????????????????????.?????????????????????????????????????????.get_DbOffset()
at ?????????????????????????????????????????.?????????????????????????????????????????.?????????????????????????????????????????[](UInt64 , HeroType)
at Buddy.Swtor.Objects.TorObject.GetField[T](DomFieldIds field, HeroType forcedType)
at Buddy.Swtor.Objects.TorCharacter.get_Health()
at Buddy.Swtor.Objects.TorCharacter.get_IsDead()
at Buddy.CommonBot.Logic.BrainBehavior.?????????????????????????????????????????.?????????????????????????????????????????(Object )
at Buddy.BehaviorTree.Decorator.CanRun(Object context)
at Buddy.BehaviorTree.Decorator.3:[}^fnG^.HVtHxC;6F1o!.MoveNext() at (IEnumerator ) at Buddy.BehaviorTree.Composite.Tick(Object context) at Buddy.BehaviorTree.PrioritySelector.V\*h(CLQ'\,=ifY@~\]{xP\\a\[QQ!.MoveNext() at (IEnumerator ) at Buddy.BehaviorTree.Composite.Tick(Object context) at Buddy.BehaviorTree.Decorator.3\*:\[}^fnG^\.HVtHxC\*;6
F1o!.MoveNext()
at (IEnumerator )
at Buddy.BehaviorTree.Composite.Tick(Object context)
at Buddy.BehaviorTree.PrioritySelector.Vh(CLQ'\,=ifY@~]{xP\a[QQ!.MoveNext()
at (IEnumerator )
at Buddy.BehaviorTree.Composite.Tick(Object context)
at Buddy.CommonBot.BotMain.?????????????????????????????????????????()
2016-03-04 05:10:25,955 [Main Bot Thread] ERROR Log - System.Exception: Only part of a ReadProcessMemory or WriteProcessMemory request was completed, at addr: 00000001, Size: 33
at GreyMagic.ExternalProcessMemory.ReadByteBuffer(IntPtr addr, Void* buffer, Int32 count)
at GreyMagic.MemoryBase.ReadBytes(IntPtr addr, Int32 count)
at ?????????????????????????????????????????.?????????????????????????????????????????.get_Struct()
at ?????????????????????????????????????????.?????????????????????????????????????????.?????????????????????????????????????????()
at ?????????????????????????????????????????.?????????????????????????????????????????.get_NodeView()
at Buddy.Swtor.Objects.TorObject.get_DataBaseOffset()
at ?????????????????????????????????????????.?????????????????????????????????????????.get_DbOffset()
at ?????????????????????????????????????????.?????????????????????????????????????????.?????????????????????????????????????????[](UInt64 , HeroType)
at Buddy.Swtor.Objects.TorObject.GetField[T](DomFieldIds field, HeroType forcedType)
at Buddy.Swtor.Objects.TorCharacter.get_Health()
at Buddy.Swtor.Objects.TorCharacter.get_IsDead()
at Buddy.CommonBot.Logic.BrainBehavior.?????????????????????????????????????????.?????????????????????????????????????????(Object )
at Buddy.BehaviorTree.Decorator.CanRun(Object context)
at Buddy.BehaviorTree.Decorator.3:[}^fnG^.HVtHxC;6F1o!.MoveNext() at (IEnumerator ) at Buddy.BehaviorTree.Composite.Tick(Object context) at Buddy.BehaviorTree.PrioritySelector.V\*h(CLQ'\,=ifY@~\]{xP\\a\[QQ!.MoveNext() at (IEnumerator ) at Buddy.BehaviorTree.Composite.Tick(Object context) at Buddy.BehaviorTree.Decorator.3\*:\[}^fnG^\.HVtHxC\*;6
F1o!.MoveNext()
at (IEnumerator )
at Buddy.BehaviorTree.Composite.Tick(Object context)
at Buddy.BehaviorTree.PrioritySelector.Vh(CLQ'\,=ifY@~]{xP\a[QQ!.MoveNext()
at (IEnumerator )
at Buddy.BehaviorTree.Composite.Tick(Object context)
at Buddy.CommonBot.BotMain.?????????????????????????????????????????()
2016-03-04 05:10:27,427 [Main Bot Thread] ERROR Log - Exception while pulsing plugin Use Lockboxes:
System.NullReferenceException: Object reference not set to an instance of an object.
at Buddy.Swtor.Objects.Containers.TorContainer1.?????????????????????????????????????????.?????????????????????????????????????????(????????????????????????????????????????? ) at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext()
at Buddywing.Plugins.OpenLockboxesPlugin.OnPulse() in d:\Star Wars-The Old Republic\Killer\Plugins\OpenLockboxes\OpenLockboxesPlugin.cs:line 52
at Buddy.Common.Plugins.PluginManager.PulsePlugin(IPlugin plugin)
2016-03-04 05:10:27,428 [Main Bot Thread] ERROR Log - Engine class is null, TorObject may no longer be valid!
2016-03-04 05:10:27,428 [Main Bot Thread] ERROR Log - System.Exception: DbOffset is Zero.
at ?????????????????????????????????????????.?????????????????????????????????????????.?????????????????????????????????????????[](UInt64 , HeroType)
at Buddy.Swtor.Objects.TorObject.GetField[T](DomFieldIds field, HeroType forcedType)
at Buddy.Swtor.Objects.TorCharacter.get_Level()
at Buddy.CommonBot.Profile.GrindArea.RequirementsMet()
at Buddy.CommonBot.ProfileManager.?????????????????????????????????????????.?????????????????????????????????????????(GrindArea )
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func
2 predicate)
at Buddy.CommonBot.ProfileManager.UpdateGrindArea()
at Buddy.CommonBot.Logic.BuddyBot.Pulse()
at Buddy.CommonBot.BotMain.?????????????????????????????????????????()
Joes had this, I was trying to reverse engineer into a plugin. I'll upload the WIP I had while trying to make it a plugin. This will have everything needed to detect properly. It started first with checking if you had the skills, then checked to see if corpse was strong or higher and a few other checks. Was quite the elaborate system. Please note this code doesn't completely work right now and to implement as a plugin would need to pause default combat.
If you see what you need here just let me know and I'll stop developing on my side as internal to the bot would be the best solution.
@Wired203 Fantastic work! I'm not sure I'm comfortable with implementing a range-based interact into the core of the bot though, at least not as the default behaviour. If we can find a way to make this work exclusively for harvesting, then I'd be all for it.
If we were to ship it as proximity interaction, a plugin would be the favourable choice to ship this functionality.
It's not Proximity Interaction anymore, I just used his plugin as a loose base. This is the code from Joes which I didn't get quite working however it has all the checks he was using along with his movement code.
The pertinent part for you is the checks, if needed I could clean the code down to just the checks themselves. His code basically identified if you had the skills early in the code, then identified if the dead mob was strong or greater, then identified if he could harvest and did a moveto interact with that item just like regular harvesting.
@Wired203 It uses a lot of seemingly weird checks, such as the object count in the cache, as well as some weird casts such as (Int32)0
. It'll need some cleaning up, but if it gets into shape we can probably supply this functionality as a plugin with BW.
Which parts exactly are currently problematic?
Not sure I haven't vested much time into it, put most of my free time into finding out why healing wasn't working. I know it was entering the scantargets however I don't think it returned from there. I need to finish cleaning out the unneeded code and add some logging so I can get it down to the nitty gritty. Joes had it and it was super complex to pull out.
Let me look through this better, honestly when I was building it as a plugin I would have needed the movement code etc. If your going to build it into the engine then I just really need a plugin that properly checks and returns the status. Let me see if I can whittle a plugin down to the checks that's working which should be all you need to implement it.
Let me know what you come up with, and of course if you need any help with this, just send me a PM or add me on IM.
I'm moving this feature to the future until we have the implementation down.
I appreciate it, have some work to finish up with Default Combat and then I'll re-engage this.
Ok here's what your looking for, Pure had apparently ripped it. I was able to change a few lines and call it after rest and it's working. Only thing and I couldn't figure it out, it will attempt to harvest with companion then player character 1 second later. Has all the proper checks as well. Scavenge.zip
I do have this working perfectly in the new default combat build I have done with the exception for both the companion and player interact and I don't know how to stop that. I know Cyro would prefer this go into buddywing itself but it's your call.
Either way once I have a little more testing with my new default combat build and we push it we will have the functionality. Man where was this when I was trying to get as many tier 8 resources to convert to 9 lol.
Currently the bot ignores to check if a killed NPC can be harvested. Please add logic for checking if it can be harvested, if yes then harvest. Also killed NPCs by other players can be harvested, but i think, when there is a check in place if a NPC can be harvested it would also try it on NPCs killed by other players.