PDA

View Full Version : Help with python courier runner for Eve



asdfasdf100500
06-23-2011, 05:02 PM
Hello

I'm trying to write a python based courier runner bot.

So far I've managed to start a convo with an agent and respond to them.

I'm stuck trying to get the mission objectives, anyone know how to get them? Trough the moniker or maybe "agents"-services GetMissionBriefingInformation(['self', 'wnd'], None, None, None) ? Unfortunately I don't know what the parameters are supposed to be.

Any help is much appreciated. Here's what I have so far:


from log import LogError
try:
import eve
import types
import service
import svc
import util
import base
import blue
import datetime, time

class TestingTesting:
def __init__(self):
self.theService = sm.services["agents"]

self.logToFile("start")
testAgentID = 3016177

#starts a convo with an agent
self.theService.InteractWith(testAgentID)

#reference to the convo window
window = self.theService.windows[testAgentID]

#this as well as "window" contains the available answer options to the convo
kakka = self.theService._Agents__GetConversation(window,No ne)

#don't know what to do with this, maybe the mission details can be found here
moniker = getattr(window.sr, "agentMoniker", {})

#this is the right pane (type uicls.Container) of the convo window, don't know how to extract contents
paneRight = getattr(window.sr, "rightPaneBottom", {})

self.logToFile(dir(paneRight))

self.logToFile("test")
self.logToFile(dir(self.theService))

self.logToFile("end")

#always returns None
#self.logToFile(asdf.GetMissionJournalInfo(testAge ntID))



def logToFile(self,message):
f = open('C:\\temp\\moi.txt', 'a')
f.writelines("{0} - {1}\n".format(datetime.datetime.now(),message))
f.close();
#LogError(message)

def initTimer(self):
global TimerInstance
try:
TimerInstance = TestingTesting()
except:
pass

sm.services["cmd"].OpenJukebox = types.MethodType(initTimer, sm.services["cmd"], service.Service)
except Exception, e:
f = open('C:\\temp\\moi.txt', 'a')
f.writelines("{0} - {1}\n".format(datetime.datetime.now(),e))
f.close();

DannyDeranged
06-23-2011, 05:37 PM
Any chance you could print out the contents of moniker and paneRight for us? If they're objects, try using dir() or some such method.

asdfasdf100500
06-23-2011, 05:43 PM
I think moniker is the right object. When I do dir() to it, it doesn't show anything promising, but I know from the old EVE source that it has a method moniker.GetMissionJournalInfo(testAgentID) which in my case always returns None. If that method didn't exist, python would throw an exception right?

Any idea how I could retrieve all of its methods? I think it's just listing the methods of its base type.

Another good candidate is theService.ShowMissionObjectives(...) but with a parameter AgentID it is constantly returning None.

dir(moniker):

2011-06-23 20:39:50.924000 - ['Bind', 'FromURLString', 'GetNodeID', 'GetSelfLocal', 'IsRunning', 'MonikeredCall', 'QuickResolve', 'Resolve', 'SetSessionCheck', 'ToURLString', 'Unbind', 'Unresolve', '_Moniker__ClearBoundObject', '_Moniker__PerformSessionCheck', '_Moniker__ResolveImpl', '_Moniker__bindParams', '_Moniker__nodeID', '_Moniker__quicky', '_Moniker__serviceName', '_Moniker__sessionCheck', '__del__', '__doc__', '__getattr__', '__getstate__', '__guid__', '__init__', '__module__', '__passbyvalue__', '__persistvar__', '__remobsuppmeth__', '__semaphoreB__', '__semaphoreR__', '__setstate__', '__str__', 'boundObject']

dir(paneRight):

2011-06-23 20:41:15.576000 - ['AppendBackgroundObject', 'AppendChild', 'ApplyAttributes', 'AttachAnimationCurveSet', 'AutoFitToContent', 'BeginDrag', 'ClearAttachTo', 'Close', 'ConsumeBudget', 'Disable', 'DoDrag', 'Enable', 'Find', 'FindChild', 'FindEventHandler', 'FindParentByName', 'FlagAlignmentDirty', 'FlagChildrenDirty', 'FlagNextObjectsDirty', 'Flush', 'GetAbsolute', 'GetAbsoluteBottom', 'GetAbsoluteLeft', 'GetAbsolutePosition', 'GetAbsoluteRight', 'GetAbsoluteSize', 'GetAbsoluteTop', 'GetAlign', 'GetAlignmentBudget', 'GetChild', 'GetHint', 'GetMyAttachments', 'GetOpacity', 'GetPadding', 'GetParent', 'GetPosition', 'GetRenderObject', 'GetSize', 'GetState', 'HasEventHandler', 'Hide', 'InitRenderObject', 'InsertBackgroundObject', 'InsertChild', 'IsBeingDragged', 'IsDraggable', 'IsHidden', 'OnClick', 'OnDragCanceled_', 'OnDragMove', 'OnEndDrag_', 'OnMouseDown', 'OnMouseEnter', 'OnMouseExit', 'OnMouseHover', 'OnMouseMove', 'OnMouseUp', 'PostApplyAttributes', 'PrepareDrag_', 'PrepareProperties', 'ProcessEvent', 'RemoveBackgroundObject', 'RemoveChild', 'SendMessage', 'SetAlign', 'SetAttachTo', 'SetDisplayRect', 'SetFocus', 'SetHint', 'SetOpacity', 'SetOrder', 'SetPadding', 'SetParent', 'SetPosition', 'SetSize', 'SetState', 'Show', 'StopAnimations', 'Toggle', 'Traverse', 'UpdateAbsoluteAlignment', 'UpdateAlignment', 'UpdateAlignmentAsRoot', 'UpdateAttachedPosition', 'UpdateAttachments', 'UpdateBottomLeftAlignment', 'UpdateBottomRightAlignment', 'UpdateCenterAlignment', 'UpdateCenterBottomAlignment', 'UpdateCenterLeftAlignment', 'UpdateCenterRightAlignment', 'UpdateCenterTopAlignment', 'UpdateFromRoot', 'UpdateNoAlignment', 'UpdateToAllAlignment', 'UpdateToBottomAlignment', 'UpdateToBottomProportionalAlignment', 'UpdateToLeftAlignment', 'UpdateToLeftProportionalAlignment', 'UpdateToRightAlignment', 'UpdateToRightProportionalAlignment', 'UpdateToTopAlignment', 'UpdateToTopProportionalAlignment', 'UpdateTopLeftAlignment', 'UpdateTopRightAlignment', 'VerifyDrop', '_AddAttachment', '_FindChildByName', '_Initialize', '

moniker.boundObject:

2011-06-23 20:45:04.245000 - <RemoteObject:N=712781:4970>

dir(moniker.boundObject):

2011-06-23 20:45:04.245000 - ['Objectcast', 'PerformSessionCheck', 'RegisterObjectChangeHandler', 'SetSessionCheck', 'UnRegisterObjectChangeHandler', 'UpdatePublicAttributes', '__del__', '__doc__', '__getattr__', '__init__', '__machoObjectUUID__', '__module__', '__nonzero__', '__publicattributes__', '__repr__', '__str__', 'blocking', 'clisid', 'deleted', 'destination', 'gpcs', 'objectChangeHandlers', 'objectID', 'persistantObjectID', 'session', 'sessionCheck']

DannyDeranged
06-23-2011, 06:30 PM
GetMissionJournalInfo(charID, contentID) - according to a brief grep of the released source. Might be able to call it with just charID. (See below.)


showMissionObjectives is defined as:

def ShowMissionObjectives(self, agentID, charID = None, contentID = None):
if (agentID not in self.windows):
self.InteractWith(agentID)
return
if self.reentrancyGuard2:
return
self.reentrancyGuard2 = 1
try:
agentDialogueWindow = self.windows[agentID]
ret = self.GetAgentMoniker(agentID).GetMissionObjectiveI nfo(charID, contentID)
if not agentDialogueWindow.destroyed:
if ret:
ret = self.InsertSecurityWarning(ret)
html = ret.html
agentDialogueWindow.SetDoublePaneView()
agentDialogueWindow.LoadHTML(html, where='objectiveBrowser')
else:
agentDialogueWindow.SetSinglePaneView()

finally:
self.reentrancyGuard2 = 0
ret obviously has the objectives, and ret is set by GetMissionObjectiveInfo. Basically, showMissionObjectives is an HTML-output wrapper for that function.

asdfasdf100500
06-23-2011, 06:44 PM
I must have an old source because I cant find that method. Do you mind sharing where you got that newer source?

However self.theService.GetAgentMoniker(testAgentID).GetMi ssionObjectiveInfo(agentID, eve.eve.session.charid) returns None. I guess it needs the contentID, but my old source offers no clue as to where to get it.

DannyDeranged
06-24-2011, 05:01 AM
To be perfectly honest, I googled "incursion source eve". If you PM me, I'll get you a link to my copy (assuming you trust me not to link you to a lolvirus or something).

You're still calling it wrong. eve.eve.session.charid should be your first parameter, not agentID. As for contentID, it default to None so I'd assume it can be called like that. My only other thought would be to call it with a random integer and see what happens.

asdfasdf100500
06-24-2011, 09:24 AM
Okay mission objectives works now! Thank you very much for your help!

For future reference, I found the updated source code here: https://gitorious.org/eve-online

I copied the ShowMissionObjectives from the new source to my own class and removed all the html bits. Calling it with self.ShowMissionObjectives(testAgentID) works.

Now onto things like transferring cargo between the station and the ship hangar. I think it's done trough svc_invtools.py method MoveItems, but if someone knows the exact code I would of course appreciate it.

DannyDeranged
06-24-2011, 05:39 PM
MoveItems is definitely the right place to go. Although, for stacking you might want to use ItemHangar.Add() and ShipHangar.Add().

asdfasdf100500
06-24-2011, 05:43 PM
Hey yeah those worked. I found an old source of eryan and copied it from there. Also copied warping etc. Now it does courier missions pretty solid \o/

DannyDeranged
06-29-2011, 12:00 PM
Just in case anyone stumbles across this thinking they might try running Eryan, do NOT do so.

It's fine to take functions out of it, but Eryan was the source of a rather large number of permabans when it was still being developed. Something in it obviously tipped CCP off - be it poor error handling, calling some function too many times, or whatever it may have been.

asdfasdf100500
06-29-2011, 12:04 PM
Just in case anyone stumbles across this thinking they might try running Eryan, do NOT do so.

It's fine to take functions out of it, but Eryan was the source of a rather large number of permabans when it was still being developed. Something in it obviously tipped CCP off - be it poor error handling, calling some function too many times, or whatever it may have been.

yup atleast the methods that transfer items between containers throw exceptions. haven't been banned yet \o/