コード例 #1
0
def clear():
    print("clearing quickbar...")
    show()
    cm.sleep(0.2)
    cm.clickPointPNG('imgs/resetquickbar.png', 5, 5)
    cm.sleep(0.5)
    cm.clickPointPNG('imgs/yesno.png', 5, 5)
    itemlist.clear()
コード例 #2
0
def openItem(typeid):
    show()
    for idx, item in enumerate(itemlist):
        if api.getNameFromID(typeid) == item:
            print("found typeid: " + str(typeid) + " in quickbar at index: " +
                  str(idx))
            print("all items in quickbar:")
            print(itemlist)
            cm.clickPointPNG('imgs/regionalmarkettopleft.png',
                             35,
                             81 + idx * 20,
                             cache=True)
            return
    print("couldn't find item in quickbar: " + api.getNameFromID(typeid))
コード例 #3
0
def guiinit():
    #close undock window
    cm.clickPointPNG('imgs/undock.png', 173, 3)
    if pyautogui.locateOnScreen('imgs/myordersselling.png',
                                confidence=0.9) is None:
        cm.clickPointPNG('imgs/marketordersbutton.png', 10, 10, cache=True)
    #make regional market search results big so ocr can read better
    thing = pyautogui.locateOnScreen('imgs/search.png', confidence=0.9)
    pyautogui.moveTo(thing.left + 75, thing.top + 27)
    cm.sleep(1)
    pyautogui.dragRel(300, 0, 1, button='left')
    cm.sleep(1)
    variables.bidaplh = cm.getAPandLH(True)
    variables.sellaplh = cm.getAPandLH(False)
コード例 #4
0
ファイル: orderstuff.py プロジェクト: Sceptix/evetradebot
def buyorder(typeid, price, quantity):
    quickbar.openItem(typeid)
    cm.sleep(3)
    thing = pyautogui.locateOnScreen('imgs/placebuyorder.png')
    buyorderpos = cm.Point(thing.left + thing.width / 2,
                           thing.top + thing.height / 2)
    cm.clickPoint(buyorderpos)
    cm.sleep(2)
    thing = pyautogui.locateOnScreen('imgs/buyorderadvanced.png')
    if thing is not None:
        advanced = cm.Point(thing.left + thing.width / 2,
                            thing.top + thing.height / 2)
        cm.clickPoint(advanced)
        cm.sleep(1)
    thing = pyautogui.locateOnScreen('imgs/buyorderoriginpoint.png')
    bidpricefield = cm.Point(thing.left + 143, thing.top + 33)
    quantityfield = cm.Point(thing.left + 143, thing.top + 169)
    duration = cm.Point(thing.left + 143, thing.top + 190)
    threemonths = cm.Point(thing.left + 143, thing.top + 332)
    buything = pyautogui.locateOnScreen('imgs/buyandcancel.png')
    buybutton = cm.Point(buything.left + 25, buything.top + 7)
    cm.clickPoint(bidpricefield, 2)
    cm.sleep(0.3)
    cm.safetypewrite(price)
    cm.clickPoint(quantityfield, 2)
    cm.sleep(0.3)
    cm.safetypewrite(quantity)
    cm.clickPoint(duration)
    for _ in range(10):
        pyautogui.press('down')
    cm.clickPoint(duration)
    cm.clickPoint(buybutton, 1)
    cm.sleep(0.6)
    thing = pyautogui.locateOnScreen('imgs/confirmorder.png')
    confirmyes = cm.Point(thing.left + 149, thing.top + 197)
    cm.clickPoint(confirmyes)
    thing = pyautogui.locateOnScreen("imgs/warning.png", confidence=0.9)
    if thing is not None:
        cm.clickPointPNG("imgs/yesno.png", 20, 10)
コード例 #5
0
ファイル: orderstuff.py プロジェクト: Sceptix/evetradebot
def refreshOrderList():
    cm.clickPointPNG('imgs/marketordersbutton.png', 10, 10, cache=True)
    cm.sleep(0.2)
    cm.clickPointPNG('imgs/marketordersbutton.png', 10, 10, cache=True)
    cm.sleep(0.2)
    while pyautogui.locateOnScreen('imgs/myordersselling.png',
                                   confidence=0.9) is None:
        print("didnt properly reopen order list")
        cm.clickPointPNG('imgs/marketordersbutton.png', 10, 10, cache=True)
        cm.sleep(1)
コード例 #6
0
def show():
    cm.clickPointPNG('imgs/regionalmarkettopleft.png', 76, 58, cache=True)
    cm.sleep(0.5)
コード例 #7
0
ファイル: main.py プロジェクト: Sceptix/evetradebot
 while True:
     try:
         if not process.is_alive():
             sys.exit()
         cl = pyautogui.locateOnScreen("imgs/connectionlost.png", confidence=0.9)
         if(cl is not None):
             process.terminate()
             print("we lost connection, initiating restart procedure")
             point = cm.Point(cl.left + 169, cl.top + 194)
             cm.clickPoint(point, 5)
             #wait 20 minutes for internet to come back or eve to restart
             time.sleep(1200)
             lg = pyautogui.locateOnScreen("imgs/launchgroup.png")
             pn = pyautogui.locateOnScreen("imgs/playnow.png")
             while (lg is None and pn is None):
                 cm.clickPointPNG("imgs/evetaskbar.png", 5, 5)
                 lg = pyautogui.locateOnScreen("imgs/launchgroup.png")
                 pn = pyautogui.locateOnScreen("imgs/playnow.png")
                 time.sleep(5)
             print("starting eve client")
             cm.clickPointPNG("imgs/launchgroup.png", 10, 10)
             cm.clickPointPNG("imgs/playnow.png", 10, 10)
             #wait for game to start
             time.sleep(60)
             print("clicking character")
             #5 clicks because the window may not be focused
             cm.clickxy(470 + 110, 420, 5)
             time.sleep(60)
             print("starting bot")
             process = multiprocessing.Process(target=mainwrapper.doTradeBot, args=(tradedaystart,))
             process.start()
コード例 #8
0
ファイル: orderstuff.py プロジェクト: Sceptix/evetradebot
def getTopOrders(typeid):
    quickbar.openItem(typeid)
    cm.sleep(0.2)

    marketlogsfolder = os.path.expanduser(
        '~\\Documents\\EVE\\logs\\Marketlogs')
    deleteMarketLogs()

    cm.clickPointPNG("imgs/exporttofile.png", 5, 5, cache=True)

    loopidx = 0
    while True:
        if (len(os.listdir(marketlogsfolder)) > 0):
            print("found file in marketlogs...")
            break
        if loopidx % 5 == 0:
            print("didn't open item")
            quickbar.openItem(typeid)
            cm.clickPointPNG("imgs/exporttofile.png", 5, 5, cache=True)
        else:
            cm.sleep(0.5)
        loopidx += 1

    if os.listdir(marketlogsfolder)[-1].startswith('My Orders'):
        print("wrong file exported")
        return getTopOrders(typeid)

    logfile = marketlogsfolder + "\\" + os.listdir(marketlogsfolder)[-1]
    buyorders, sellorders = [], []
    exitflag = False
    try:
        with open(logfile) as export:
            reader = csv.DictReader(export)
            for l in reader:
                #if we didnt wait long enough for item to load
                if (int(l['typeID']) != typeid):
                    exitflag = True
                    break
                if (int(l['jumps']) != 0):
                    continue
                o = cm.Order(typeid, int(l['orderID']),
                             str(l['bid']) == "True", float(l['price']),
                             int(float(l['volEntered'])),
                             int(float(l['volRemaining'])),
                             DateUtilParser(l['issueDate']).timestamp())
                if (o.bid):
                    buyorders.append(o)
                else:
                    sellorders.append(o)
        os.remove(logfile)
    except:
        print("exception while reading item export")
        cm.sleep(5)
        return getTopOrders(typeid)

    if (exitflag):
        print("wrong item was exported")
        quickbar.addItemToQuickbar(typeid)
        return getTopOrders(typeid)
    #highest first
    buyorders.sort(key=lambda x: x.price, reverse=True)
    #lowest first
    sellorders.sort(key=lambda x: x.price, reverse=False)
    return (buyorders[0:6], sellorders[0:6])
コード例 #9
0
ファイル: orderstuff.py プロジェクト: Sceptix/evetradebot
def sellitemininventory(typeid, price):
    item = api.getNameFromID(typeid)
    cm.clickPointPNG('imgs/inventorytopright.png', 0, 25, 2, cache=True)
    cm.sleep(0.2)
    cm.safetypewrite(item)

    stackitems(item)

    cm.sleep(0.5)

    thing = pyautogui.locateOnScreen('imgs/inventoryitemhangar.png')
    inventorylist = cm.Area(thing.left + 25, thing.top + 70, 500, 250)

    cm.sleep(1)

    box = inventorylist.toAbsTuple()
    ocr = cm.grabandocr(box)

    #todo implement ocr with highestsim check
    for s in ocr.splitlines():
        if (s.split()[-1][:5] in item.lower()):
            offsetpos = inventorylist
            mousex = offsetpos.x + int(s.split()[6]) / 4 + 5
            mousey = offsetpos.y + int(s.split()[7]) / 4 + 5
            cm.clickxy(mousex, mousey, clicks=1, right=True)
            cm.sleep(0.2)

            box = (mousex + 15, mousey + 2, mousex + 15 + 135,
                   mousey + 3 + 200)
            ocr = cm.grabandocr(box)

            for s in ocr.splitlines():
                if (s.split()[-1] == "sell"):
                    mousex = mousex + 18 + int(s.split()[6]) / 4 + 5
                    mousey = mousey + 3 + int(s.split()[7]) / 4 + 5
                    cm.clickxy(mousex, mousey)
                    cm.sleep(5)
                    #todo replace this with clickpointpng
                    thing = pyautogui.locateOnScreen('imgs/sellitems.png')
                    pricefield = cm.Point(thing.left + thing.width / 2,
                                          thing.top + 80)
                    thing = pyautogui.locateOnScreen(
                        'imgs/sellitemsellcancel.png')
                    sellbutton = cm.Point(thing.left + 25, thing.top + 12)
                    thing = pyautogui.locateOnScreen(
                        'imgs/sellitemduration.png')
                    duration = cm.Point(thing.left - 50, thing.top + 28)

                    #set duration to 3 months
                    cm.clickPoint(duration)
                    for _ in range(10):
                        pyautogui.press('down')
                    cm.clickPoint(duration)

                    #set price
                    pyautogui.moveTo(pricefield.x, pricefield.y)
                    cm.sleep(0.3)
                    pyautogui.doubleClick(pricefield.x, pricefield.y)
                    cm.safetypewrite(price)

                    cm.clickPoint(sellbutton)
                    cm.sleep(0.5)
                    thing = pyautogui.locateOnScreen(
                        'imgs/sellitemconfirm.png')
                    confirmbutton = cm.Point(thing.left + 145, thing.top + 193)
                    cm.clickPoint(confirmbutton)
                    thing = pyautogui.locateOnScreen("imgs/warning.png",
                                                     confidence=0.9)
                    if thing is not None:
                        cm.clickPointPNG("imgs/yesno.png", 20, 10)

                    return 1
    return 0
コード例 #10
0
ファイル: orderstuff.py プロジェクト: Sceptix/evetradebot
def changeOrder(order, newprice):
    refreshOrderList()
    position, itemsinlist = getOrderPosition(order)
    itemname = api.getNameFromID(order.typeid)
    print("changing order of item: " + itemname + " in position: " +
          str(position))
    if order.bid:
        actingPoint, listheight = variables.bidaplh
    else:
        actingPoint, listheight = variables.sellaplh
    pyautogui.moveTo(actingPoint.x, actingPoint.y)
    cm.sleep(0.2)

    #this scrolls so the order is visible, and adjusts the position
    itemsfitinlist = math.ceil(listheight / 20)
    if (position >= itemsfitinlist):
        pagescrollcount = math.floor(position / itemsfitinlist)
        position -= (itemsinlist % itemsfitinlist)
        pyautogui.scroll(int(-130 * itemsfitinlist * pagescrollcount))
    pyautogui.move(0, 20 * position)
    pyautogui.click(button='right', clicks=1)
    cm.sleep(0.5)
    pyautogui.move(35, 10)
    cm.sleep(0.5)
    pyautogui.click()
    thing = pyautogui.locateOnScreen("imgs/modifyorder.png", confidence=0.9)
    for a in range(100):
        if thing is None:
            thing = pyautogui.locateOnScreen("imgs/modifyorder.png",
                                             confidence=0.9)
            cm.sleep(0.2)
        else:
            break
    if thing is None:
        refreshAllOrders()
        return changeOrder(order, newprice)
    box = cm.Area(thing.left + 100, thing.top + 21, 300, 19)
    ocr = cm.grabandocr(box).splitlines()
    ocrname = ""
    for line in ocr:
        if (len(line.split()) > 11):
            ocrname += line.split()[-1] + " "
    print("checking if we clicked the right order...")
    print("itemname: " + itemname.lower() + ", ocrname: " + ocrname)
    if cm.similar(ocrname.lower(), itemname.lower()) < 0.5:
        print("failed similar check")
        cm.clickxy(thing.left + 265, thing.top + 192)
        cm.sleep(0.5)
        refreshAllOrders()
        return changeOrder(order, newprice)
    cm.sleep(0.2)
    pyautogui.keyDown('ctrl')
    pyautogui.keyDown('c')
    cm.sleep(0.2)
    pyautogui.keyUp('c')
    pyautogui.keyUp('ctrl')
    realprice = pyperclip.paste()
    cm.safetypewrite(newprice)
    cm.sleep(0.2)
    pyautogui.typewrite(['enter'])
    cm.sleep(0.5)
    thing = pyautogui.locateOnScreen("imgs/warning.png", confidence=0.9)
    if thing is not None:
        cm.clickPointPNG("imgs/yesno.png", 20, 10)
    #reset scroll
    pyautogui.moveTo(actingPoint.x + 10, actingPoint.y + 10)
    pyautogui.scroll(100000)
    order.price = float(newprice)
    order.issuedate = cm.getEVETimestamp()