Example #1
0
def on_release(key):
    if format(key) == '<97>':
        print("martin chaos test: " + format(key)+" "+PoeInputMacro.getForegroundWindowName())
        #PoeChaosRecipe.getTabContents()
        if checkIsPoeInForeground():
            #PoeInputMacro.getItemStatusStash(0,0,True)
            PoeStashSort.sortStashTab(-1, itemDB)
            #PoeStashSort.sortStashTab(5, itemDB)
        else:
            print("action: "+format(key)+" aborted, window not in focus")
    if format(key) == '<98>':
        print("martin test: " + format(key)+" "+PoeInputMacro.getForegroundWindowName())
        try:
            if checkIsPoeInForeground():
                PoeChaosRecipe.getChaosRecipe(itemDB)
                #PoeTradeMacros.listTradeItemsThem(itemDB)
            else:
                print("action: " + format(key) + " aborted, window not in focus")
        except Exception as e:
            print("out of chaos recipe: "+str(e))
    if format(key) == '<99>':
        print("martin test: " + format(key)+" "+PoeInputMacro.getForegroundWindowName())
        if checkIsPoeInForeground():
            PoeDepositAll.despositAllInv()
        else:
            print("action: "+format(key)+" aborted, window not in focus")
Example #2
0
def getChaosRecipe(itemDB):
    tabResults = getTabContents()
    withdrawItems = []
    printChaosAmounts(tabResults)
    withdrawItems.append(findChaosItem(tabResults, 'isHelmet', withdrawItems))
    withdrawItems.append(findChaosItem(tabResults, 'isGloves', withdrawItems))
    withdrawItems.append(findChaosItem(tabResults, 'isBoots', withdrawItems))
    withdrawItems.append(findChaosItem(tabResults, 'isRing', withdrawItems))
    withdrawItems.append(findChaosItem(tabResults, 'isRing', withdrawItems))
    withdrawItems.append(findChaosItem(tabResults, 'isAmulet', withdrawItems))
    withdrawItems.append(findChaosItem(tabResults, 'isBelt', withdrawItems))
    withdrawItems.append(
        findChaosItem(tabResults, 'isChaosWeapon', withdrawItems))
    withdrawItems.append(
        findChaosItem(tabResults, 'isChaosWeapon', withdrawItems))
    withdrawItems.append(
        findChaosItem(tabResults, 'isBodyArmour', withdrawItems))

    removeItems(tabResults, withdrawItems)

    if PoeChaosRecipe.tabSetup is None:
        PoeChaosRecipe.tabSetup = PoeStash.getTabs()

    for tab in PoeChaosRecipe.tabs:
        if tabHasItems(tab, withdrawItems):
            PoeInputMacro.changeTab(tab)
            for item in withdrawItems:
                if item.tabId == tab:
                    print("withdraw: " + str(item.x) + " " + str(item.y) +
                          " " + item.typeLine)
                    PoeInputMacro.clickStashItem(
                        item.x, item.y, PoeChaosRecipe.tabSetup.isQuad(tab))
Example #3
0
def clickTheseItemsInInv(targetTab, items):
    PoeInputMacro.changeTab(targetTab)
    i = 0
    while i < len(items):
        x = math.floor((i / 5))
        y = i % 5
        PoeInputMacro.clickInvItem(x, y)
        i += 1
Example #4
0
def getItemsFromStash(trade):
    PoeInputMacro.openStash()
    tabId = findStashTabId(trade.tab)
    isQuadTab = ClientState.tabSetup.isQuad(tabId)
    PoeInputMacro.changeTab(tabId)
    PoeInputMacro.clickStashItem(trade.leftIdx, trade.downIdx, isQuadTab)
    PoeInputMacro.closeStash()
Example #5
0
def despositAllInv():
    x = 0
    y = 0
    screenshot = PoeInputMacro.screenInv()
    while x < 12:
        while y < 5:
            #check is an item in slot
            if PoeInputMacro.checkInvSlot(x, y, screenshot):
                #whitelisted spot at the end of inv for scrolls
                if not (x == 11 and y == 3) and not (x == 11 and y == 4):
                    #print("pixel "+str(x)+" "+str(y)+ " "+str(PoeInputMacro.checkInvSlot(x, y, screenshot)))
                    PoeInputMacro.clickInvItem(x, y)
                    screenshot = PoeInputMacro.screenInv()
            y += 1
        y = 0
        x += 1
Example #6
0
def listTradeItemsThem(itemDB):
    x = 0
    y = 0
    screenshot = PoeInputMacro.screenTradeThem()
    itemSlots = [[]]
    while x < 12:
        while y < 5:
            #check is an item in slot
            if PoeInputMacro.checkTradeSlotThem(x, y, screenshot) and not itemSlots[x][y]:
                #whitelisted spot at the end of inv for scrolls
                #print("pixel "+str(x)+" "+str(y)+ " "+str(PoeInputMacro.checkInvSlot(x, y, screenshot)))
                item = PoeInputMacro.getItemStatusTradeThem(x,y)
                print(item)
                detailedItemInfo = itemDB.parseItemClipboard(item)
                addItemToLocalList(detailedItemInfo,x,y, itemSlots)
            y += 1
        y = 0
        x += 1
Example #7
0
def addRequestedItem(trade):
    x = 0
    y = 0
    screenshot = PoeInputMacro.screenInv()
    while x < 12:
        while y < 5:
            # check is an item in slot
            if PoeInputMacro.checkInvSlot(x, y, screenshot):
                # whitelisted spot at the end of inv for scrolls
                if not (x == 11 and y == 3) and not (x == 11 and y == 4):
                    itemInfo = PoeInputMacro.getItemStatusInv(x, y)
                    detailedItemInfo = ClientState.itemDB.parseItemClipboard(itemInfo)
                    print("addRequestedItem ")
                    if detailedItemInfo.itemIdentifiedInfo in trade.itemName:
                        PoeInputMacro.clickInvItem(x, y)
                    print("addRequestedItem "+ detailedItemInfo.itemIdentifiedInfo+" "+trade.itemName)
            y += 1
        y = 0
        x += 1
Example #8
0
def spawnTradeThread():
    waitTimer = 30
    print("spawnTradeThread")
    while waitTimer > 0:
        time.sleep(1)
        if PoeInputMacro.countItemsOnMyTradeScreen() <= 10 and ClientState.state == 0:
            print("spawnTradeThread opened trade screen ")
            ClientState.state = 1
            #trade screen opened
            addRequestedItems()
            waitTimer = 30
        if ClientState.state == 1:
            print("spawnTradeThread opened trade screen ")
            screenshot = checkThereItems()
            #PoeInputMacro.hitTradeAccept()
        waitTimer -= 1
Example #9
0
def sortTab(targetTab, originTab, items, itemDB, tabSetup, func):
    if targetTab == -1:
        return
    filteredItems = []
    for item in items:
        if getattr(item, func)(itemDB):
            print(item.typeLine + " : " + func + " : " +
                  str(getattr(item, func)(itemDB)))
            PoeInputMacro.clickStashItem(item.x, item.y,
                                         tabSetup.isQuad(originTab))
            filteredItems.append(item)
    if len(filteredItems) > 0:
        #clickTheseItemsInInv(targetTab, filteredItems)
        PoeInputMacro.changeTab(targetTab)
        PoeDepositAll.despositAllInv()
        PoeInputMacro.changeTab(originTab)
Example #10
0
def checkIsPoeInForeground():
    foregroundText = PoeInputMacro.getForegroundWindowName()
    if PoePlayerConfig.PlayerConfig.path_of_exile_executable_title == foregroundText:
        return True
    return False
Example #11
0
import PoEWebserver
import PoePlayerConfig
import time
import threading
import math
import json

with open('data/config/player_settings.json') as json_data_file:
    config = json.load(json_data_file)

PoePlayerConfig.setupConfig(config)

with open("data/config/"+PoePlayerConfig.PlayerConfig.resolution+".json") as json_data_file:
    config = json.load(json_data_file)

PoeInputMacro.setupMacro(config)



itemDB = PoeItemDB.PoeItemDB()
itemDB.initDB()

#PoeLogListener.regexWhisper("2019/12/28 19:41:02 12140169 ac9 [INFO Client 3304] @From WishItsMylast: Hi, I would like to buy your Tabula Rasa Simple Robe listed for 11 chaos in Metamorph (stash tab \"~price 5 chaos\"; position: left 23, top 2)")
#PoeLogListener.regexWhisper("2020/01/03 17:56:59 364642828 ac9 [INFO Client 3128] @To 요하네스벅포: ty")
#PoeLogListener.regexWhisper("2020/01/03 17:56:11 364594421 ac9 [INFO Client 3128] @To 요하네스벅포: 안녕하세요, 변형(보관함 탭 \"판매\", 위치: 왼쪽 11, 상단 3)에 1 fuse(으)로 올려놓은 창살 지도(Cage Map)(T3)을(를) 구매하고 싶습니다")

t = threading.Thread(target=PoeLogListener.listenToFile, args=(itemDB,))
t.start()

t = threading.Thread(target=PoEWebserver.startWebServer)
t.start()
Example #12
0
def tradePlayer(playerName):
    tradeStr = "/tradewith " + playerName
    ClientState.currentTradePartner = playerName
    PoeInputMacro.typeOutChat(tradeStr)
    spawnTradeThread()
Example #13
0
def invitePlayer(playerName):
    inviteStr = "/invite "+playerName
    PoeInputMacro.typeOutChat(inviteStr)
Example #14
0
def sortStashTab(tabId, itemDB):
    tabSetup = PoeStash.getTabs()
    if tabId == -1:
        tabId = getDefaultQuad(tabSetup)

    items = PoeStash.getStash(tabId)
    PoeInputMacro.changeTab(tabId)

    isQuadTab = tabSetup.isQuad(tabId)
    if getTabId(tabSetup, tabSetup.mapTab,
                PoePlayerConfig.PlayerConfig.sorting_override_maps) >= 0:
        sortTab(
            getTabId(tabSetup, tabSetup.mapTab,
                     PoePlayerConfig.PlayerConfig.sorting_override_maps),
            tabId, items, itemDB, tabSetup, 'isMap')

    if getTabId(tabSetup, tabSetup.currencyTab,
                PoePlayerConfig.PlayerConfig.sorting_override_currency) >= 0:
        sortTab(
            getTabId(tabSetup, tabSetup.currencyTab,
                     PoePlayerConfig.PlayerConfig.sorting_override_currency),
            tabId, items, itemDB, tabSetup, 'isCurrency')

    if getTabId(tabSetup, tabSetup.essenceTab,
                PoePlayerConfig.PlayerConfig.sorting_override_essence) >= 0:
        sortTab(
            getTabId(tabSetup, tabSetup.essenceTab,
                     PoePlayerConfig.PlayerConfig.sorting_override_essence),
            tabId, items, itemDB, tabSetup, 'isEssence')

    if getTabId(tabSetup, tabSetup.fragmentTab,
                PoePlayerConfig.PlayerConfig.sorting_override_fragments) >= 0:
        sortTab(
            getTabId(tabSetup, tabSetup.fragmentTab,
                     PoePlayerConfig.PlayerConfig.sorting_override_fragments),
            tabId, items, itemDB, tabSetup, 'isFragment')

    if getTabId(tabSetup, -1,
                PoePlayerConfig.PlayerConfig.sorting_override_div) >= 0:
        sortTab(
            getTabId(tabSetup, -1,
                     PoePlayerConfig.PlayerConfig.sorting_override_div), tabId,
            items, itemDB, tabSetup, 'isDivination')

    if getTabId(tabSetup, -1,
                PoePlayerConfig.PlayerConfig.sorting_override_delve) >= 0:
        sortTab(
            getTabId(tabSetup, -1,
                     PoePlayerConfig.PlayerConfig.sorting_override_delve),
            tabId, items, itemDB, tabSetup, 'isDelveItem')

    if getTabId(tabSetup, -1, PoePlayerConfig.PlayerConfig.sorting_flask) >= 0:
        sortTab(
            getTabId(tabSetup, -1, PoePlayerConfig.PlayerConfig.sorting_flask),
            tabId, items, itemDB, tabSetup, 'isFlask')

    if getTabId(tabSetup, -1, PoePlayerConfig.PlayerConfig.sorting_jewel) >= 0:
        sortTab(
            getTabId(tabSetup, -1, PoePlayerConfig.PlayerConfig.sorting_jewel),
            tabId, items, itemDB, tabSetup, 'isJewel')

    if getTabId(tabSetup, -1,
                PoePlayerConfig.PlayerConfig.sorting_prophecy) >= 0:
        sortTab(
            getTabId(tabSetup, -1,
                     PoePlayerConfig.PlayerConfig.sorting_prophecy), tabId,
            items, itemDB, tabSetup, 'isProphecy')

    if getTabId(tabSetup, -1,
                PoePlayerConfig.PlayerConfig.sorting_incubator) >= 0:
        sortTab(
            getTabId(tabSetup, -1,
                     PoePlayerConfig.PlayerConfig.sorting_incubator), tabId,
            items, itemDB, tabSetup, 'isIncubator')

    if getTabId(tabSetup, -1, PoePlayerConfig.PlayerConfig.sorting_oil) >= 0:
        sortTab(
            getTabId(tabSetup, -1, PoePlayerConfig.PlayerConfig.sorting_oil),
            tabId, items, itemDB, tabSetup, 'isOil')

    if getTabId(tabSetup, -1,
                PoePlayerConfig.PlayerConfig.sorting_catalyst) >= 0:
        sortTab(
            getTabId(tabSetup, -1,
                     PoePlayerConfig.PlayerConfig.sorting_catalyst), tabId,
            items, itemDB, tabSetup, 'isCatalyst')

    if getTabId(tabSetup, -1,
                PoePlayerConfig.PlayerConfig.sorting_metamorph) >= 0:
        sortTab(
            getTabId(tabSetup, -1,
                     PoePlayerConfig.PlayerConfig.sorting_metamorph), tabId,
            items, itemDB, tabSetup, 'isMetamorph')

    if getTabId(tabSetup, -1, PoePlayerConfig.PlayerConfig.sorting_gem) >= 0:
        sortTab(
            getTabId(tabSetup, -1, PoePlayerConfig.PlayerConfig.sorting_gem),
            tabId, items, itemDB, tabSetup, 'isGem')