Jump to content

In-game fishbot / autofishing


Go to solution Solved by KolenMG,

Recommended Posts

Hello! I'm working on a project, mostly as a hobby and for learning purposes.In the last days, I was messing around on internet looking for a way to make the fishing action being automatic, like the user can be AFK while fishing - i.e the "Space" action to start to fish, then the "space" action to catch the fish to be automatic .

I've found a "system" on a forum but, however I'm not sure if it's safe or how it should be implemented since it's just a python file. (Later edit: about implementation, I believe adding the py file in root as well as with some configurations in game.py file" 

I'm leaving the code below: 

# File: f (Python 2.2)

import ui
import grp
import wndMgr
import snd
import chr
import player
import net
import app
import chat
import background
import time
import skill
import locale
import chrmgr
import item
import event

SMALL_BUTTON = {
    'default_image': 'd:/ymir work/ui/public/small_button_01.sub',
    'over_image': 'd:/ymir work/ui/public/small_button_02.sub',
    'down_image': 'd:/ymir work/ui/public/small_button_03.sub' }
MIDDLE_BUTTON = {
    'default_image': 'd:/ymir work/ui/public/middle_button_01.sub',
    'over_image': 'd:/ymir work/ui/public/middle_button_02.sub',
    'down_image': 'd:/ymir work/ui/public/middle_button_03.sub' }
LARGE_BUTTON = {
    'default_image': 'd:/ymir work/ui/public/large_button_01.sub',
    'over_image': 'd:/ymir work/ui/public/large_button_02.sub',
    'down_image': 'd:/ymir work/ui/public/large_button_03.sub' }
CLOSE_BUTTON = {
    'default_image': 'd:/ymir work/ui/public/close_button_01.sub',
    'over_image': 'd:/ymir work/ui/public/close_button_02.sub',
    'down_image': 'd:/ymir work/ui/public/close_button_03.sub' }
MIN_BUTTON = {
    'default_image': 'd:/ymir work/ui/game/windows/btn_minus_up.sub',
    'over_image': 'd:/ymir work/ui/game/windows/btn_minus_over.sub',
    'down_image': 'd:/ymir work/ui/game/windows/btn_minus_down.sub' }
if app.GetLocalePath() == 'locale/pl':
    LOCALE_KILL_FISHES = 'Zabijaj ryby'
    LOCALE_OPEN_CLAMS = 'Otwieraj ma\xb3\xbfe'
    LOCALE_DROP_DYE = 'Wyrzucaj farby'
    LOCALE_DROP_DEAD = 'Wyrz. martwe ryby'
    LOCALE_SELL_FISH = 'Sell martwe'
    LOCALE_TOOLTIP_SELL_FISH = 'Wymagany otwarty sklep'
    LOCALE_TEXT_GM = 'je\x9cli GM szepnie:'
    LOCALE_QUIT_BTN = 'Wyjd\x9f'
    LOCALE_LOGOUT_BTN = 'Wyloguj'
    LOCALE_STOPFISH_BTN = 'przesta\xf1 \xb3owi\xe6'
else:
    LOCALE_KILL_FISHES = 'kill fishes'
    LOCALE_OPEN_CLAMS = 'Open Clams'
    LOCALE_DROP_DYE = 'Drop hair dye'
    LOCALE_DROP_DEAD = 'Drop dead fish'
    LOCALE_SELL_FISH = 'Sell dead'
    LOCALE_TOOLTIP_SELL_FISH = 'Open shop required'
    LOCALE_TEXT_GM = 'When GM whispers:'
    LOCALE_QUIT_BTN = 'Quit'
    LOCALE_LOGOUT_BTN = 'LogOut'
    LOCALE_STOPFISH_BTN = 'stop fishing'
HOOK_INSTALLED = 0
oldOnRecvWhisper = 0
quit_gm_whisper = 0
logout_gm_whisper = 0
MODE = 0
NAME = ''

def NewOnRecvWhisper(self, mode, name, line):
    global MODE, NAME
    oldOnRecvWhisper(self, mode, name, line)
    if name.startswith('[') or mode == chat.WHISPER_TYPE_GM:
        if quit_gm_whisper == 1:
            app.Exit()
        
        if logout_gm_whisper == 1:
            net.SendChatPacket('/logout')
        
    
    MODE = mode
    NAME = name


def InstallHook():
    global oldOnRecvWhisper, HOOK_INSTALLED
    import game
    oldOnRecvWhisper = game.GameWindow.OnRecvWhisper
    game.GameWindow.OnRecvWhisper = NewOnRecvWhisper
    HOOK_INSTALLED = 1


def UninstallHook():
    global HOOK_INSTALLED
    import game
    game.GameWindow.OnRecvWhisper = oldOnRecvWhisper
    HOOK_INSTALLED = 0


class MultihackDialog(ui.ScriptWindow):
    state = 'stop'
    FishingRodTime = 0.0
    fishAgTime = 0.0
    kill_fishes = 0
    open_clams = 0
    drop_dead_fish = 0
    drop_hair_dye = 0
    sell_dead_fish = 0
    stop_gm_whisper = 0
    
    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.LoadGUI()
        self.LoadButtons()
        self.SetCenterPosition()

    
    def __del__(self):
        ui.ScriptWindow.__del__(self)

    
    def LoadGUI(self):
        self.WIDTH = 260
        self.HEIGH = 240
        self.TBoard = ui.BoardWithTitleBar()
        self.TBoard.SetSize(self.WIDTH, self.HEIGH)
        self.TBoard.SetCenterPosition()
        self.TBoard.AddFlag('movable')
        self.TBoard.AddFlag('float')
        self.TBoard.SetTitleName('Fishing Bot v1.2')
        self.TBoard.SetCloseEvent(self.Close)
        self.TBoard.Show()
        if HOOK_INSTALLED == 0:
            InstallHook()
            chat.AppendChat(1, 'Hook Installed')
        else:
            chat.AppendChat(1, 'Hook Already Installed')

    
    def LoadButtons(self):
        ExpandedImageList = []
        boxList = [
            {
                'NAME': 'box1',
                'PARENT': self.TBoard,
                'X': 17,
                'Y': 75,
                'SIZE_X': 92,
                'SIZE_Y': 130,
                'COLOR': grp.GenerateColor(0.0, 0.0, 0.5, 0.29999999999999999) }]
        self.boxDict = { }
        for boxData in boxList:
            box = ui.Box()
            box.SetParent(boxData['PARENT'])
            box.SetPosition(boxData['X'], boxData['Y'])
            box.SetSize(boxData['SIZE_X'], boxData['SIZE_Y'])
            box.SetColor(boxData['COLOR'])
            box.AddFlag('movable')
            box.AddFlag('float')
            box.Show()
            self.boxDict[boxData['NAME']] = box
        
        ButtonList = [
            {
                'NAME': 'aboutBtn',
                'BUTTON_NAME': '',
                'TOOLTIP_TEXT': 'About',
                'PARENT': self.TBoard,
                'X': 232,
                'Y': 213,
                'TEXT_X': 2,
                'TEXT_Y': 0,
                'EVENT': self.about,
                'default_image': 'd:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_01.sub',
                'over_image': 'd:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_02.sub',
                'down_image': 'd:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_03.sub' }]
        ToggleButtonList = [
            {
                'NAME': 'FishingBot',
                'BUTTON_NAME': 'Start',
                'TOOLTIP_TEXT': '',
                'PARENT': self.TBoard,
                'X': 45,
                'Y': 207,
                'TEXT_X': 4,
                'TEXT_Y': 0,
                'EVENT_UP': self.StopFishBot,
                'EVENT_DOWN': self.StartFishBot,
                'default_image': MIDDLE_BUTTON['default_image'],
                'over_image': MIDDLE_BUTTON['over_image'],
                'down_image': MIDDLE_BUTTON['down_image'] },
            {
                'NAME': 'kill_fishes',
                'BUTTON_NAME': LOCALE_KILL_FISHES,
                'TOOLTIP_TEXT': '',
                'PARENT': self.boxDict['box1'],
                'X': 2,
                'Y': 5,
                'TEXT_X': 2,
                'TEXT_Y': 0,
                'EVENT_UP': self.killFishes_off,
                'EVENT_DOWN': self.killFishes_on,
                'default_image': LARGE_BUTTON['default_image'],
                'over_image': LARGE_BUTTON['over_image'],
                'down_image': LARGE_BUTTON['down_image'] },
            {
                'NAME': 'open_clams',
                'BUTTON_NAME': LOCALE_OPEN_CLAMS,
                'TOOLTIP_TEXT': '',
                'PARENT': self.boxDict['box1'],
                'X': 2,
                'Y': 30,
                'TEXT_X': 2,
                'TEXT_Y': 0,
                'EVENT_UP': self.openClam_off,
                'EVENT_DOWN': self.openClam_on,
                'default_image': LARGE_BUTTON['default_image'],
                'over_image': LARGE_BUTTON['over_image'],
                'down_image': LARGE_BUTTON['down_image'] },
            {
                'NAME': 'drop_dead',
                'BUTTON_NAME': LOCALE_DROP_DEAD,
                'TOOLTIP_TEXT': '',
                'PARENT': self.boxDict['box1'],
                'X': 2,
                'Y': 55,
                'TEXT_X': 2,
                'TEXT_Y': 0,
                'EVENT_UP': self.dropDeadFishes_off,
                'EVENT_DOWN': self.dropDeadFishes_on,
                'default_image': LARGE_BUTTON['default_image'],
                'over_image': LARGE_BUTTON['over_image'],
                'down_image': LARGE_BUTTON['down_image'] },
            {
                'NAME': 'drop_hair_dye',
                'BUTTON_NAME': LOCALE_DROP_DYE,
                'TOOLTIP_TEXT': '',
                'PARENT': self.boxDict['box1'],
                'X': 2,
                'Y': 80,
                'TEXT_X': 2,
                'TEXT_Y': 0,
                'EVENT_UP': self.dropHairDye_off,
                'EVENT_DOWN': self.dropHairDye_on,
                'default_image': LARGE_BUTTON['default_image'],
                'over_image': LARGE_BUTTON['over_image'],
                'down_image': LARGE_BUTTON['down_image'] },
            {
                'NAME': 'sell_dead_fish',
                'BUTTON_NAME': LOCALE_SELL_FISH,
                'TOOLTIP_TEXT': LOCALE_TOOLTIP_SELL_FISH,
                'PARENT': self.boxDict['box1'],
                'X': 2,
                'Y': 105,
                'TEXT_X': 2,
                'TEXT_Y': 0,
                'EVENT_UP': self.sellDeadFish_off,
                'EVENT_DOWN': self.sellDeadFish_on,
                'default_image': LARGE_BUTTON['default_image'],
                'over_image': LARGE_BUTTON['over_image'],
                'down_image': LARGE_BUTTON['down_image'] },
            {
                'NAME': 'gm_write_quit',
                'BUTTON_NAME': LOCALE_QUIT_BTN,
                'TOOLTIP_TEXT': '',
                'PARENT': self.TBoard,
                'X': 120,
                'Y': 80,
                'TEXT_X': 0,
                'TEXT_Y': 0,
                'EVENT_UP': lambda arg = 'off': self.quit_gm(arg),
                'EVENT_DOWN': lambda arg = 'on': self.quit_gm(arg),
                'default_image': MIDDLE_BUTTON['default_image'],
                'over_image': MIDDLE_BUTTON['over_image'],
                'down_image': MIDDLE_BUTTON['down_image'] },
            {
                'NAME': 'gm_write_logout',
                'BUTTON_NAME': LOCALE_LOGOUT_BTN,
                'TOOLTIP_TEXT': '',
                'PARENT': self.TBoard,
                'X': 180,
                'Y': 80,
                'TEXT_X': 0,
                'TEXT_Y': 0,
                'EVENT_UP': lambda arg = 'off': self.logout_gm(arg),
                'EVENT_DOWN': lambda arg = 'on': self.logout_gm(arg),
                'default_image': MIDDLE_BUTTON['default_image'],
                'over_image': MIDDLE_BUTTON['over_image'],
                'down_image': MIDDLE_BUTTON['down_image'] },
            {
                'NAME': 'gm_write_stop',
                'BUTTON_NAME': LOCALE_STOPFISH_BTN,
                'TOOLTIP_TEXT': '',
                'PARENT': self.TBoard,
                'X': 180,
                'Y': 102,
                'TEXT_X': 0,
                'TEXT_Y': 0,
                'EVENT_UP': lambda arg = 'off': self.stop_gm(arg),
                'EVENT_DOWN': lambda arg = 'on': self.stop_gm(arg),
                'default_image': MIDDLE_BUTTON['default_image'],
                'over_image': MIDDLE_BUTTON['over_image'],
                'down_image': MIDDLE_BUTTON['down_image'] }]
        TextLineList = [
            {
                'NAME': 'delay_text',
                'BUTTON_NAME': 'Delay:',
                'PARENT': self.TBoard,
                'X': 20,
                'Y': 50 },
            {
                'NAME': 'gm_text',
                'BUTTON_NAME': LOCALE_TEXT_GM,
                'PARENT': self.TBoard,
                'X': 125,
                'Y': 60 }]
        EditLineList = [
            {
                'NAME': 'delay_textbox',
                'EDIT_TEXT': '2.600',
                'PARENT': self.TBoard,
                'X': 55,
                'Y': 50,
                'SIZE_X': 35,
                'SIZE_Y': 15,
                'MAX': 5 }]
        self.imageDict = { }
        for imageData in ExpandedImageList:
            image = ui.ExpandedImageBox()
            image.SetParent(imageData['PARENT'])
            image.SetPosition(imageData['X'], imageData['Y'])
            image.LoadImage(imageData['image'])
            image.Show()
            self.imageDict[imageData['NAME']] = image
        
        self.editlineDict = { }
        self.slotbarDict = { }
        for EditLineData in EditLineList:
            self.SlotBar = ui.SlotBar()
            self.SlotBar.SetParent(self.TBoard)
            self.SlotBar.SetSize(EditLineData['SIZE_X'], EditLineData['SIZE_Y'])
            self.SlotBar.SetPosition(EditLineData['X'], EditLineData['Y'])
            self.SlotBar.Show()
            self.Value = ui.EditLine()
            self.Value.SetParent(self.SlotBar)
            self.Value.SetSize(EditLineData['SIZE_X'], EditLineData['SIZE_Y'])
            self.Value.SetPosition(5, 1)
            self.Value.SetMax(EditLineData['MAX'])
            self.Value.SetText(EditLineData['EDIT_TEXT'])
            self.Value.Show()
            self.editlineDict[EditLineData['NAME']] = self.Value
            self.slotbarDict[EditLineData['NAME']] = self.SlotBar
        
        self.textDict = { }
        for TextLineData in TextLineList:
            textline = ui.TextLine()
            textline.SetParent(TextLineData['PARENT'])
            textline.SetDefaultFontName()
            textline.SetPosition(TextLineData['X'], TextLineData['Y'])
            textline.SetFeather()
            textline.SetText(TextLineData['BUTTON_NAME'])
            textline.SetOutline()
            textline.Show()
            self.textDict[TextLineData['NAME']] = textline
        
        self.buttonDict = { }
        for BtnData in ButtonList:
            button = Button()
            button.SetParent(BtnData['PARENT'])
            button.SetPosition(BtnData['X'], BtnData['Y'])
            button.SetUpVisual(BtnData['default_image'])
            button.SetOverVisual(BtnData['over_image'])
            button.SetDownVisual(BtnData['down_image'])
            button.SetText(BtnData['BUTTON_NAME'])
            button.SetToolTipText(BtnData['TOOLTIP_TEXT'])
            button.SetTextPosition(BtnData['TEXT_X'], BtnData['TEXT_Y'])
            button.Show()
            self.buttonDict[BtnData['NAME']] = button
            button.SetEvent(ui.__mem_func__(BtnData['EVENT']))
        
        self.togglebuttonDict = { }
        for ToggleBtnData in ToggleButtonList:
            tbutton = ToggleButton()
            tbutton.SetParent(ToggleBtnData['PARENT'])
            tbutton.SetPosition(ToggleBtnData['X'], ToggleBtnData['Y'])
            tbutton.SetUpVisual(ToggleBtnData['default_image'])
            tbutton.SetOverVisual(ToggleBtnData['over_image'])
            tbutton.SetDownVisual(ToggleBtnData['down_image'])
            tbutton.SetText(ToggleBtnData['BUTTON_NAME'])
            tbutton.SetToolTipText(ToggleBtnData['TOOLTIP_TEXT'])
            tbutton.SetTextPosition(ToggleBtnData['TEXT_X'], ToggleBtnData['TEXT_Y'])
            tbutton.Show()
            self.togglebuttonDict[ToggleBtnData['NAME']] = tbutton
            tbutton.SetToggleUpEvent(ToggleBtnData['EVENT_UP'])
            tbutton.SetToggleDownEvent(ToggleBtnData['EVENT_DOWN'])
        

    
    def test(self):
        chat.AppendChat(1, self.state)

    
    def about(self):
        import binascii
        import uicommon
        aaw2 = 'UTNKbFlYUmxaQ0JpZVNCTFlVMWxVakV6TXpjdUlIZDNkeTV0WlhScGJqSnRiMlF1ZEdzPQ=='
        aaw = binascii.a2b_base64(aaw2)
        self.popupWindow = uicommon.PopupDialog()
        self.popupWindow.SetText(binascii.a2b_base64(aaw))
        self.popupWindow.SetAcceptEvent(self.about_close)
        self.popupWindow.Open()

    
    def about_close(self):
        self.popupWindow.Hide()

    
    def logout_gm(self, arg):
        global logout_gm_whisper
        if arg == 'on':
            logout_gm_whisper = 1
        elif arg == 'off':
            logout_gm_whisper = 0
        

    
    def quit_gm(self, arg):
        global quit_gm_whisper
        if arg == 'on':
            quit_gm_whisper = 1
        elif arg == 'off':
            quit_gm_whisper = 0
        

    
    def stop_gm(self, arg):
        if arg == 'on':
            self.stop_gm_whisper = 1
        elif arg == 'off':
            self.stop_gm_whisper = 0
        

    
    def StartFishBot(self):
        global MODE, NAME
        self.togglebuttonDict['FishingBot'].SetText('Stop')
        self.time = float(self.editlineDict['delay_textbox'].GetText())
        if self.AddBait():
            MODE = 0
            NAME = ''
            player.SetAttackKeyState(TRUE)
            player.SetAttackKeyState(FALSE)
            self.ProcessTimeStamp = app.GetTime()
            self.state = 'waiting'
        

    
    def StopFishBot(self):
        self.togglebuttonDict['FishingBot'].SetText('Start')
        self.state = 'stop'
        player.SetAttackKeyState(TRUE)
        player.SetAttackKeyState(FALSE)

    
    def killFishes_on(self):
        self.kill_fishes = 1

    
    def killFishes_off(self):
        self.kill_fishes = 0

    
    def killFishes(self):
        for Slot in xrange(player.INVENTORY_PAGE_SIZE * 2):
            if player.GetItemIndex(Slot) in (27803, 27804, 27805, 27806, 27807, 27808, 27809, 27811, 27812, 27813, 27814, 27815, 27816, 27817, 27818, 27819, 27820, 27821, 27822, 27823, 30112):
                net.SendItemUsePacket(Slot)
            
        

    
    def openClam_on(self):
        self.open_clams = 1

    
    def openClam_off(self):
        self.open_clams = 0

    
    def openClams(self):
        for Slot in xrange(player.INVENTORY_PAGE_SIZE * 2):
            if player.GetItemIndex(Slot) == 27987:
                net.SendItemUsePacket(Slot)
            
        

    
    def dropDeadFishes_on(self):
        self.drop_dead_fish = 1

    
    def dropDeadFishes_off(self):
        self.drop_dead_fish = 0

    
    def dropDeadFishes(self):
        for Slot in xrange(player.INVENTORY_PAGE_SIZE * 2):
            if player.GetItemIndex(Slot) in (27833, 27834, 27835, 27836, 27837, 27838, 27839, 27840, 27841, 27842, 27843, 27844, 27845, 27846, 27847, 27848, 27849, 27850, 27851, 27852, 27853, 27802):
                net.SendItemDropPacket(Slot)
            
        

    
    def dropHairDye_on(self):
        self.drop_hair_dye = 1

    
    def dropHairDye_off(self):
        self.drop_hair_dye = 0

    
    def dropHairDye(self):
        for Slot in xrange(player.INVENTORY_PAGE_SIZE * 2):
            if player.GetItemIndex(Slot) >= 70201 and player.GetItemIndex(Slot) <= 70208:
                net.SendItemDropPacket(Slot)
            
        

    
    def sellDeadFish_on(self):
        self.sell_dead_fish = 1

    
    def sellDeadFish_off(self):
        self.sell_dead_fish = 0

    
    def sellDeadFish(self):
        for Slot in xrange(player.INVENTORY_PAGE_SIZE * 2):
            getItemCount = player.GetItemCount(Slot)
            if player.GetItemIndex(Slot) >= 27833 and player.GetItemIndex(Slot) <= 27853 or player.GetItemIndex(Slot) == 27802:
                net.SendShopSellPacket(Slot, getItemCount)
            
        

    
    def UseBait(self):
        for Slot in xrange(player.INVENTORY_PAGE_SIZE * 2):
            if player.GetItemIndex(Slot) in (27800, 27801, 27802):
                net.SendItemUsePacket(Slot)
                break
            
        

    
    def AddBait(self):
        Bait = player.GetItemCountByVnum
        if Bait(27800) == 0 and Bait(27801) == 0 and Bait(27802) == 0:
            self.state = 'stop'
            self.togglebuttonDict['FishingBot'].SetUp()
            self.togglebuttonDict['FishingBot'].SetText('Start')
            return 0
        
        self.UseBait()
        return 1

    
    def BubbleAppear(self):
        if chrmgr.IsPossibleEmoticon(-1) == 1:
            return 0
        else:
            return 1

    
    def OnUpdate(self):
        if self.state == 'start':
            if self.ProcessTimeStamp + 5.0 < app.GetTime():
                if self.AddBait():
                    if self.kill_fishes == 1:
                        self.killFishes()
                    
                    if self.open_clams == 1:
                        self.openClams()
                    
                    if self.drop_dead_fish == 1:
                        self.dropDeadFishes()
                    
                    if self.drop_hair_dye == 1:
                        self.dropHairDye()
                    
                    if self.sell_dead_fish == 1:
                        self.sellDeadFish()
                    
                    player.SetAttackKeyState(TRUE)
                    player.SetAttackKeyState(FALSE)
                    self.ProcessTimeStamp = app.GetTime()
                    self.state = 'waiting'
                
            
        
        if self.state == 'action':
            if self.ProcessTimeStamp + self.time < app.GetTime():
                player.SetAttackKeyState(TRUE)
                player.SetAttackKeyState(FALSE)
                self.ProcessTimeStamp = app.GetTime()
                self.state = 'start'
            
        
        if self.state == 'waiting':
            if not chrmgr.IsPossibleEmoticon(-1):
                self.ProcessTimeStamp = app.GetTime() + float(app.GetRandom(0, int(0.5)))
                self.state = 'action'
            
            if self.ProcessTimeStamp + 40.0 < app.GetTime():
                self.ProcessTimeStamp = app.GetTime()
                self.state = 'start'
            
        
        if self.stop_gm_whisper == 1:
            if NAME.startswith('[') or MODE == chat.WHISPER_TYPE_GM:
                self.state = 'stop'
            
        

    
    def OnKeyDown(self, key):
        
        try:
            self.onPressKeyDict[key]()
        except KeyError:
            pass
        except:
            raise 

        return TRUE

    
    def Close(self):
        self.kill_fishes = 0
        self.open_clams = 0
        self.drop_dead_fish = 0
        self.drop_hair_dye = 0
        self.sell_dead_fish = 0
        self.state = 'stop'
        stop_gm_whisper = 0
        if HOOK_INSTALLED == 1:
            chat.AppendChat(1, 'Hook Uninstalled')
            UninstallHook()
        else:
            chat.AppendChat(1, 'Hook Already Uninstalled')
        self.TBoard.Hide()



class Button(ui.Window):
    
    def __init__(self, layer = 'UI'):
        ui.Window.__init__(self, layer)
        self.eventFunc = None
        self.eventArgs = None
        self.ButtonText = None
        self.ToolTipText = None

    
    def __del__(self):
        ui.Window.__del__(self)
        self.eventFunc = None
        self.eventArgs = None

    
    def RegisterWindow(self, layer):
        self.hWnd = wndMgr.RegisterButton(self, layer)

    
    def SetUpVisual(self, filename):
        wndMgr.SetUpVisual(self.hWnd, filename)

    
    def SetOverVisual(self, filename):
        wndMgr.SetOverVisual(self.hWnd, filename)

    
    def SetDownVisual(self, filename):
        wndMgr.SetDownVisual(self.hWnd, filename)

    
    def SetDisableVisual(self, filename):
        wndMgr.SetDisableVisual(self.hWnd, filename)

    
    def GetUpVisualFileName(self):
        return wndMgr.GetUpVisualFileName(self.hWnd)

    
    def GetOverVisualFileName(self):
        return wndMgr.GetOverVisualFileName(self.hWnd)

    
    def GetDownVisualFileName(self):
        return wndMgr.GetDownVisualFileName(self.hWnd)

    
    def Flash(self):
        wndMgr.Flash(self.hWnd)

    
    def Enable(self):
        wndMgr.Enable(self.hWnd)

    
    def Disable(self):
        wndMgr.Disable(self.hWnd)

    
    def Down(self):
        wndMgr.Down(self.hWnd)

    
    def SetUp(self):
        wndMgr.SetUp(self.hWnd)

    
    def SAFE_SetEvent(self, func, *args):
        self.eventFunc = ui.__mem_func__(func)
        self.eventArgs = args

    
    def SetEvent(self, func, *args):
        self.eventFunc = func
        self.eventArgs = args

    
    def SetTextColor(self, r, b, g):
        if not (self.ButtonText):
            return None
        
        self.ButtonText.SetFontColor(r, g, b)

    
    def SetButtonFontName(self, font):
        if not (self.ButtonText):
            return None
        
        BackUpText = self.ButtonText.GetText()
        self.ButtonText.SetFontName(font)
        self.ButtonText.SetText('')
        self.ButtonText.SetText(str(BackUpText))

    
    def SetText(self, text, height = 4):
        if not (self.ButtonText):
            self.ButtonText = ui.TextLine()
            self.ButtonText.SetParent(self)
            self.ButtonText.SetPosition(self.GetWidth() / 2, self.GetHeight() / 2)
            self.ButtonText.SetVerticalAlignCenter()
            self.ButtonText.SetHorizontalAlignCenter()
            self.ButtonText.Show()
        
        self.ButtonText.SetText(text)

    
    def SetTextPosition(self, x, y):
        self.ButtonText.SetPosition(self.GetWidth() / 2 + int(x), self.GetHeight() / 2 + int(y))

    
    def SetFormToolTipText(self, type, text, x, y):
        if not (self.ToolTipText):
            toolTip = ui.createToolTipWindowDict[type]()
            toolTip.SetParent(self)
            toolTip.SetSize(0, 0)
            toolTip.SetHorizontalAlignCenter()
            toolTip.SetOutline()
            toolTip.Hide()
            toolTip.SetPosition(x + self.GetWidth() / 2, y)
            self.ToolTipText = toolTip
        
        self.ToolTipText.SetText(text)

    
    def SetToolTipWindow(self, toolTip):
        self.ToolTipText = toolTip
        self.ToolTipText.SetParentProxy(self)

    
    def SetToolTipText(self, text, x = 0, y = -19):
        self.SetFormToolTipText('TEXT', text, x, y)

    
    def CallEvent(self):
        snd.PlaySound('sound/ui/click.wav')
        if self.eventFunc:
            apply(self.eventFunc, self.eventArgs)
        

    
    def ShowToolTip(self):
        if self.ToolTipText:
            self.ToolTipText.Show()
        

    
    def HideToolTip(self):
        if self.ToolTipText:
            self.ToolTipText.Hide()
        

    
    def IsDown(self):
        return wndMgr.IsDown(self.hWnd)



class ToggleButton(Button):
    
    def __init__(self):
        Button.__init__(self)
        self.eventUp = None
        self.eventDown = None
        self.ToolTipText = None

    
    def __del__(self):
        Button.__del__(self)
        self.eventUp = None
        self.eventDown = None

    
    def SetToggleUpEvent(self, event):
        self.eventUp = event

    
    def SetToggleDownEvent(self, event):
        self.eventDown = event

    
    def RegisterWindow(self, layer):
        self.hWnd = wndMgr.RegisterToggleButton(self, layer)

    
    def SetTextPosition(self, x, y):
        self.ButtonText.SetPosition(self.GetWidth() / 2 + int(x), self.GetHeight() / 2 + int(y))

    
    def OnToggleUp(self):
        if self.eventUp:
            self.eventUp()
        

    
    def OnToggleDown(self):
        if self.eventDown:
            self.eventDown()
        

    
    def Down(self):
        wndMgr.Down(self.hWnd)

    
    def SetUp(self):
        wndMgr.SetUp(self.hWnd)

    
    def SetFormToolTipText(self, type, text, x, y):
        if not (self.ToolTipText):
            toolTip = ui.createToolTipWindowDict[type]()
            toolTip.SetParent(self)
            toolTip.SetSize(0, 0)
            toolTip.SetHorizontalAlignCenter()
            toolTip.SetOutline()
            toolTip.Hide()
            toolTip.SetPosition(x + self.GetWidth() / 2, y)
            self.ToolTipText = toolTip
        
        self.ToolTipText.SetText(text)

    
    def SetToolTipWindow(self, toolTip):
        self.ToolTipText = toolTip
        self.ToolTipText.SetParentProxy(self)

    
    def SetToolTipText(self, text, x = 0, y = -19):
        self.SetFormToolTipText('TEXT', text, x, y)

    
    def ShowToolTip(self):
        if self.ToolTipText:
            self.ToolTipText.Show()
        

    
    def HideToolTip(self):
        if self.ToolTipText:
            self.ToolTipText.Hide()
        

    
    def Enable(self):
        wndMgr.Enable(self.hWnd)

    
    def Disable(self):
        wndMgr.Disable(self.hWnd)


ItemBoard = MultihackDialog()
ItemBoard.Show()

From what I'm seeing there are some "definitions" in term of user's actions, such as"when GM wishper, use /logout". or "self.logout" or "self.quit" that implies the presents of GM. 

It was this a hack and it was "transformed" into a "system"? 

 

Since it's just a hibby project, yea, should not be a problem for me either ways but I like and I want to do the things right, so yea.. 

I'll leave as well some photos regarding how it should look: 

.png.png

 

If it's something wrong with the post, please let me know and I'll delete it 🙂

  • Eyes 1
Link to comment
Share on other sites

As un updated, I've tried to implement it but I'm encountering some issues and I'm almost rage quitin' After loggin in, the window remain stuck here. 

Spoiler

spacer.png

Still trying to "debug it" if not, I guess, bad luck. 

Here's my syserr: 

Spoiler

0203 19:15:24781 :: Traceback (most recent call last):

0203 19:15:24781 ::   File "networkModule.py", line 245, in SetGamePhase

0203 19:15:24781 ::   File "system.py", line 130, in __pack_import

0203 19:15:24781 ::   File "system.py", line 110, in _process_result

0203 19:15:24781 ::   File "game.py", line 51, in <module>

0203 19:15:24781 ::   File "system.py", line 130, in __pack_import

0203 19:15:24781 ::   File "system.py", line 110, in _process_result

0203 19:15:24781 ::   File "fishbot.py", line 905, in <module>

0203 19:15:24782 ::   File "fishbot.py", line 112, in __init__

0203 19:15:24782 ::   File "fishbot.py", line 133, in LoadGUI

0203 19:15:24782 ::   File "fishbot.py", line 87, in InstallHook

0203 19:15:24782 :: AttributeError
0203 19:15:24782 :: : 
0203 19:15:24782 :: 'module' object has no attribute 'GameWindow'
0203 19:15:24782 :: 

I've only made changes in game.py and added fishbot.py in root. somethings still feels off tho. 

Edited by Metin2 Dev International
Core X - External 2 Internal
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.