game

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RightButton MouseButton = win.MK_RBUTTON
	LeftButton  MouseButton = win.MK_LBUTTON

	ShiftKey ModifierKey = win.VK_SHIFT
	CtrlKey  ModifierKey = win.VK_CONTROL
)

Variables

This section is empty.

Functions

func KillAllClientHandles

func KillAllClientHandles() error

func StartGame

func StartGame(username string, password string, authmethod string, authToken string, realm string, arguments string, useCustomSettings bool) (uint32, win.HWND, error)

Types

type CrashDetector added in v0.5.0

type CrashDetector struct {
	// contains filtered or unexported fields
}

func NewCrashDetector added in v0.5.0

func NewCrashDetector(sup string, pid int32, hwnd uintptr, logger *slog.Logger, restartFunc func()) *CrashDetector

func (*CrashDetector) Start added in v0.5.0

func (cd *CrashDetector) Start()

func (*CrashDetector) Stop added in v0.5.0

func (cd *CrashDetector) Stop()

type Data

type Data struct {
	data.Data
	CharacterCfg config.CharacterCfg
}

func (Data) CanTeleport

func (d Data) CanTeleport() bool

func (Data) PlayerCastDuration

func (d Data) PlayerCastDuration() time.Duration

type HID

type HID struct {
	// contains filtered or unexported fields
}

func NewHID

func NewHID(gr *MemoryReader, gi *MemoryInjector) *HID

func (*HID) Click

func (hid *HID) Click(btn MouseButton, x, y int)

Click just does a single mouse click at current pointer position

func (*HID) ClickWithModifier

func (hid *HID) ClickWithModifier(btn MouseButton, x, y int, modifier ModifierKey)

func (*HID) GetASCIICode

func (hid *HID) GetASCIICode(key string) byte

func (*HID) KeyDown

func (hid *HID) KeyDown(kb data.KeyBinding)

KeyDown sends a key down event to the game window

func (*HID) KeyUp

func (hid *HID) KeyUp(kb data.KeyBinding)

KeyUp sends a key up event to the game window

func (*HID) MovePointer

func (hid *HID) MovePointer(x, y int)

MovePointer moves the mouse to the requested position, x and y should be the final position based on pixels shown in the screen. Top-left corner is 0,0

func (*HID) PressKey

func (hid *HID) PressKey(key byte)

PressKey receives an ASCII code and sends a key press event to the game window

func (*HID) PressKeyBinding

func (hid *HID) PressKeyBinding(kb data.KeyBinding)

func (*HID) PressKeyWithModifier

func (hid *HID) PressKeyWithModifier(key byte, modifier ModifierKey)

PressKeyWithModifier works the same as PressKey but with a modifier key (shift, ctrl, alt)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewGameManager

func NewGameManager(gr *MemoryReader, hid *HID, sueprvisorName string) *Manager

func (*Manager) CreateOnlineGame

func (gm *Manager) CreateOnlineGame(gameCounter int) (string, error)

func (*Manager) ExitGame

func (gm *Manager) ExitGame() error

func (*Manager) InGame

func (gm *Manager) InGame() bool

func (*Manager) JoinOnlineGame

func (gm *Manager) JoinOnlineGame(gameName, password string) error

func (*Manager) NewGame

func (gm *Manager) NewGame() error

type MemoryInjector

type MemoryInjector struct {
	// contains filtered or unexported fields
}

func InjectorInit

func InjectorInit(logger *slog.Logger, pid uint32) (*MemoryInjector, error)

func (*MemoryInjector) CursorPos

func (i *MemoryInjector) CursorPos(x, y int) error

func (*MemoryInjector) Load

func (i *MemoryInjector) Load() error

func (*MemoryInjector) OverrideGetKeyState

func (i *MemoryInjector) OverrideGetKeyState(key byte) error

func (*MemoryInjector) OverrideSetCursorPos

func (i *MemoryInjector) OverrideSetCursorPos() error

func (*MemoryInjector) RestoreGetCursorPosAddr

func (i *MemoryInjector) RestoreGetCursorPosAddr() error

func (*MemoryInjector) RestoreGetKeyState

func (i *MemoryInjector) RestoreGetKeyState() error

func (*MemoryInjector) RestoreMemory

func (i *MemoryInjector) RestoreMemory() error

func (*MemoryInjector) Unload

func (i *MemoryInjector) Unload() error

type MemoryReader

type MemoryReader struct {
	*memory.GameReader
	CachedMapSeed uint
	HWND          win.HWND
	WindowLeftX   int
	WindowTopY    int
	GameAreaSizeX int
	GameAreaSizeY int
	// contains filtered or unexported fields
}

func NewGameReader

func NewGameReader(cfg *config.CharacterCfg, supervisorName string, pid uint32, window win.HWND, logger *slog.Logger) (*MemoryReader, error)

func (*MemoryReader) GetCachedMapData added in v0.5.0

func (gd *MemoryReader) GetCachedMapData(isNewGame bool) map_client.MapData

func (*MemoryReader) GetData

func (gd *MemoryReader) GetData(isNewGame bool) Data

func (*MemoryReader) Screenshot

func (gd *MemoryReader) Screenshot() image.Image

type ModifierKey

type ModifierKey byte

type MouseButton

type MouseButton uint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL