from phBot import * from threading import Timer import struct import QtBind import urllib.request name = 'ItemStorage' version = 1.0 NewestVersion = 0 gui = QtBind.init(__name__, name) button = QtBind.createButton(gui, 'button_getlist', ' Get List ', 20, 20) button = QtBind.createButton(gui, 'button_claim', ' Claim Selected ', 200, 20) button = QtBind.createButton(gui, 'button_claimall', ' Claim All ', 400, 20) lstItems = QtBind.createList(gui,10,62,580,200) def button_getlist(): global count count = 0 QtBind.clear(gui,lstItems) OpenItemList(1) def button_claim(): SelectedItem = QtBind.text(gui,lstItems) messageID = SelectedItem.split(" ")[0].strip("[]") receiveItem(int(messageID)) def button_claimall(): inject_joymax(0x7558 , b'\x00\x00\x00\x00\x00\x00\x00\x00', False) count = 0 def handle_joymax(opcode,data): global count if opcode == 0xB557: locale = get_locale() if data[0] == 1: PageCount = struct.unpack_from(' CurrentVersion: log('Plugin: There is an update avaliable for [%s]!' % name) lblUpdate = QtBind.createLabel(gui,'There is an Update Avaliable, Press Here to Update',100,283) button1 = QtBind.createButton(gui, 'button_update', ' Update Plugin ', 350, 280) except: pass def button_update(): path = get_config_dir()[:-7] if os.path.exists(path + "Plugins/" + "ItemStorage.py"): try: os.rename(path + "Plugins/" + "ItemStorage.py", path + "Plugins/" + "ItemStorageBACKUP.py") req = urllib.request.Request('https://raw.githubusercontent.com/Bunker141/Phbot-Plugins/master/ItemStorage.py', headers={'User-Agent': 'Mozilla/5.0'}) with urllib.request.urlopen(req) as f: lines = str(f.read().decode("utf-8")) with open(path + "Plugins/" + "ItemStorage.py", "w+") as f: f.write(lines) os.remove(path + "Plugins/" + "ItemStorageBACKUP.py") log('Plugin Successfully Updated, Please Reload the Plugin to Use') except Exception as ex: log('Error Updating [%s] Please Update Manually or Try Again Later' %ex) CheckForUpdate() log('Plugin: [%s] Version %s Loaded' % (name,version))