Documentation ¶
Overview ¶
Package d2player contains the information necessary for managing players
Index ¶
- type EquipmentSlot
- type EscapeMenu
- func (m *EscapeMenu) Advance(elapsed float64) error
- func (m *EscapeMenu) IsOpen() bool
- func (m *EscapeMenu) OnEscKey()
- func (m *EscapeMenu) OnKeyDown(event d2interface.KeyEvent) bool
- func (m *EscapeMenu) OnLoad()
- func (m *EscapeMenu) OnMouseButtonDown(event d2interface.MouseEvent) bool
- func (m *EscapeMenu) OnMouseButtonUp(event d2interface.MouseEvent) bool
- func (m *EscapeMenu) OnMouseMove(event d2interface.MouseMoveEvent) bool
- func (m *EscapeMenu) Render(target d2interface.Surface) error
- func (m *EscapeMenu) SetOnCloseCb(cb func())
- type GameControls
- func (g *GameControls) Advance(elapsed float64) error
- func (g *GameControls) HideZoneChangeTextAfter(delay float64)
- func (g *GameControls) HpStatsIsVisible() bool
- func (g *GameControls) Load()
- func (g *GameControls) ManaStatsIsVisible() bool
- func (g *GameControls) OnKeyDown(event d2interface.KeyEvent) bool
- func (g *GameControls) OnKeyRepeat(event d2interface.KeyEvent) bool
- func (g *GameControls) OnKeyUp(event d2interface.KeyEvent) bool
- func (g *GameControls) OnMouseButtonDown(event d2interface.MouseEvent) bool
- func (g *GameControls) OnMouseButtonRepeat(event d2interface.MouseEvent) bool
- func (g *GameControls) OnMouseButtonUp(event d2interface.MouseEvent) bool
- func (g *GameControls) OnMouseMove(event d2interface.MouseMoveEvent) bool
- func (g *GameControls) Render(target d2interface.Surface) error
- func (g *GameControls) SetZoneChangeText(text string)
- func (g *GameControls) ShowZoneChangeText()
- func (g *GameControls) ToggleHpStats()
- func (g *GameControls) ToggleManaStats()
- func (g *GameControls) UnbindTerminalCommands(term d2interface.Terminal) error
- type HUD
- type HelpOverlay
- type HeroStatsPanel
- type Inventory
- type InventoryItem
- type ItemGrid
- func (g *ItemGrid) Add(items ...InventoryItem) (int, error)
- func (g *ItemGrid) ChangeEquippedSlot(slot d2enum.EquippedSlot, item InventoryItem)
- func (g *ItemGrid) GetSlot(x, y int) InventoryItem
- func (g *ItemGrid) Load(items ...InventoryItem)
- func (g *ItemGrid) Remove(item InventoryItem)
- func (g *ItemGrid) Render(target d2interface.Surface)
- func (g *ItemGrid) ScreenToSlot(screenX, screenY int) (slotX, slotY int)
- func (g *ItemGrid) Set(x, y int, item InventoryItem) error
- func (g *ItemGrid) SlotToScreen(slotX, slotY int) (screenX, screenY int)
- type KeyBinding
- type KeyBindingMenu
- type KeyBindingType
- type KeyMap
- func (km *KeyMap) GetBindingByKey(key d2enum.Key) (*KeyBinding, d2enum.GameEvent, KeyBindingType)
- func (km *KeyMap) GetKeysForGameEvent(gameEvent d2enum.GameEvent) *KeyBinding
- func (km *KeyMap) KeyToString(k d2enum.Key) string
- func (km *KeyMap) ResetToDefault()
- func (km *KeyMap) SetPrimaryBinding(gameEvent d2enum.GameEvent, key d2enum.Key) (*KeyBinding, KeyBindingType)
- func (km *KeyMap) SetSecondaryBinding(gameEvent d2enum.GameEvent, key d2enum.Key) (*KeyBinding, KeyBindingType)
- type MoveGoldPanel
- type Panel
- type PanelText
- type PartyPanel
- func (s *PartyPanel) AddPlayer(player *d2mapentity.Player, relations d2enum.PlayersRelationships)
- func (s *PartyPanel) Advance(_ float64)
- func (s *PartyPanel) Close()
- func (s *PartyPanel) DeletePlayer(player *d2mapentity.Player) bool
- func (s *PartyPanel) IsInPanel(player *d2mapentity.Player) bool
- func (s *PartyPanel) IsMe(player *d2mapentity.Player) bool
- func (s *PartyPanel) IsOpen() bool
- func (s *PartyPanel) Load()
- func (s *PartyPanel) OnMouseMove(event d2interface.MouseMoveEvent) bool
- func (s *PartyPanel) Open()
- func (s *PartyPanel) SetOnCloseCb(cb func())
- func (s *PartyPanel) Sort()
- func (s *PartyPanel) Toggle()
- func (s *PartyPanel) UpdatePanel()
- func (s *PartyPanel) UpdatePlayersList(list map[string]*d2mapentity.Player)
- type QuestLog
- type SkillListRow
- type SkillPanel
- func (s *SkillPanel) Close()
- func (s *SkillPanel) GetListRowByPos(x, y int) *SkillListRow
- func (s *SkillPanel) HandleClick(x, y int) bool
- func (s *SkillPanel) HandleMouseMove(x, y int) bool
- func (s *SkillPanel) IsInRect(x, y int) bool
- func (s *SkillPanel) IsOpen() bool
- func (s *SkillPanel) Open()
- func (s *SkillPanel) RegenerateImageCache()
- func (s *SkillPanel) Render(target d2interface.Surface) error
- func (s *SkillPanel) Toggle()
- type SkillResource
- type SkillSelectMenu
- func (sm *SkillSelectMenu) ClosePanels()
- func (sm *SkillSelectMenu) HandleClick(x, y int) bool
- func (sm *SkillSelectMenu) HandleMouseMove(x, y int)
- func (sm *SkillSelectMenu) IsInRect(x, y int) bool
- func (sm *SkillSelectMenu) IsOpen() bool
- func (sm *SkillSelectMenu) OpenLeftPanel()
- func (sm *SkillSelectMenu) OpenRightPanel()
- func (sm *SkillSelectMenu) RegenerateImageCache()
- func (sm *SkillSelectMenu) Render(target d2interface.Surface)
- func (sm *SkillSelectMenu) ToggleLeftPanel()
- func (sm *SkillSelectMenu) ToggleRightPanel()
- type StatsPanelLabels
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EquipmentSlot ¶
type EquipmentSlot struct {
// contains filtered or unexported fields
}
EquipmentSlot represents an equipment slot for a player
type EscapeMenu ¶
EscapeMenu represents the in-game menu that shows up when the esc key is pressed
func NewEscapeMenu ¶
func NewEscapeMenu(navigator d2interface.Navigator, renderer d2interface.Renderer, audioProvider d2interface.AudioProvider, uiManager *d2ui.UIManager, guiManager *d2gui.GuiManager, assetManager *d2asset.AssetManager, l d2util.LogLevel, keyMap *KeyMap, ) *EscapeMenu
NewEscapeMenu creates a new escape menu
func (*EscapeMenu) Advance ¶
func (m *EscapeMenu) Advance(elapsed float64) error
Advance computes the state of the elements of the menu overtime
func (*EscapeMenu) IsOpen ¶
func (m *EscapeMenu) IsOpen() bool
IsOpen returns whether the escape menu is open (visible) or not
func (*EscapeMenu) OnEscKey ¶
func (m *EscapeMenu) OnEscKey()
OnEscKey is called when the escape key is pressed
func (*EscapeMenu) OnKeyDown ¶
func (m *EscapeMenu) OnKeyDown(event d2interface.KeyEvent) bool
OnKeyDown defines the actions of the Escape Menu when a key is pressed
func (*EscapeMenu) OnLoad ¶
func (m *EscapeMenu) OnLoad()
OnLoad loads the necessary files for the escape menu
func (*EscapeMenu) OnMouseButtonDown ¶
func (m *EscapeMenu) OnMouseButtonDown(event d2interface.MouseEvent) bool
OnMouseButtonDown triggers whnever a mous button is pressed
func (*EscapeMenu) OnMouseButtonUp ¶
func (m *EscapeMenu) OnMouseButtonUp(event d2interface.MouseEvent) bool
OnMouseButtonUp triggers whenever a mouse button is released
func (*EscapeMenu) OnMouseMove ¶
func (m *EscapeMenu) OnMouseMove(event d2interface.MouseMoveEvent) bool
OnMouseMove triggers whenever the mouse moves within the renderer
func (*EscapeMenu) Render ¶
func (m *EscapeMenu) Render(target d2interface.Surface) error
Render will render the escape menu on the target surface
func (*EscapeMenu) SetOnCloseCb ¶
func (m *EscapeMenu) SetOnCloseCb(cb func())
SetOnCloseCb sets the callback that is run when close() is called
type GameControls ¶
type GameControls struct { PartyPanel *PartyPanel HelpOverlay *HelpOverlay FreeCam bool *d2util.Logger // contains filtered or unexported fields }
GameControls represents the game's controls on the screen
func NewGameControls ¶
func NewGameControls( asset *d2asset.AssetManager, renderer d2interface.Renderer, hero *d2mapentity.Player, mapEngine *d2mapengine.MapEngine, escapeMenu *EscapeMenu, mapRenderer *d2maprenderer.MapRenderer, inputListener inputCallbackListener, term d2interface.Terminal, ui *d2ui.UIManager, keyMap *KeyMap, audioProvider d2interface.AudioProvider, l d2util.LogLevel, isSinglePlayer bool, players map[string]*d2mapentity.Player, ) (*GameControls, error)
NewGameControls creates a GameControls instance and returns a pointer to it nolint:funlen // doesn't make sense to split this up
func (*GameControls) Advance ¶
func (g *GameControls) Advance(elapsed float64) error
Advance advances the state of the GameControls
func (*GameControls) HideZoneChangeTextAfter ¶
func (g *GameControls) HideZoneChangeTextAfter(delay float64)
HideZoneChangeTextAfter hides the zoneChangeText after the given amount of seconds
func (*GameControls) HpStatsIsVisible ¶
func (g *GameControls) HpStatsIsVisible() bool
HpStatsIsVisible returns true if the hp and mana stats are visible to the player
func (*GameControls) Load ¶
func (g *GameControls) Load()
Load the resources required for the GameControls
func (*GameControls) ManaStatsIsVisible ¶
func (g *GameControls) ManaStatsIsVisible() bool
ManaStatsIsVisible returns true if the hp and mana stats are visible to the player
func (*GameControls) OnKeyDown ¶
func (g *GameControls) OnKeyDown(event d2interface.KeyEvent) bool
OnKeyDown handles key presses
func (*GameControls) OnKeyRepeat ¶
func (g *GameControls) OnKeyRepeat(event d2interface.KeyEvent) bool
OnKeyRepeat is called to handle repeated key presses
func (*GameControls) OnKeyUp ¶
func (g *GameControls) OnKeyUp(event d2interface.KeyEvent) bool
OnKeyUp handles key release
func (*GameControls) OnMouseButtonDown ¶
func (g *GameControls) OnMouseButtonDown(event d2interface.MouseEvent) bool
OnMouseButtonDown handles mouse button presses
func (*GameControls) OnMouseButtonRepeat ¶
func (g *GameControls) OnMouseButtonRepeat(event d2interface.MouseEvent) bool
OnMouseButtonRepeat handles repeated mouse clicks
func (*GameControls) OnMouseButtonUp ¶
func (g *GameControls) OnMouseButtonUp(event d2interface.MouseEvent) bool
OnMouseButtonUp handles mouse button presses
func (*GameControls) OnMouseMove ¶
func (g *GameControls) OnMouseMove(event d2interface.MouseMoveEvent) bool
OnMouseMove handles mouse movement events
func (*GameControls) Render ¶
func (g *GameControls) Render(target d2interface.Surface) error
Render draws the GameControls onto the target
func (*GameControls) SetZoneChangeText ¶
func (g *GameControls) SetZoneChangeText(text string)
SetZoneChangeText sets the zoneChangeText
func (*GameControls) ShowZoneChangeText ¶
func (g *GameControls) ShowZoneChangeText()
ShowZoneChangeText shows the zoneChangeText
func (*GameControls) ToggleHpStats ¶
func (g *GameControls) ToggleHpStats()
ToggleHpStats toggles the visibility of the hp and mana stats placed above their respective globe and load only if they do not match
func (*GameControls) ToggleManaStats ¶
func (g *GameControls) ToggleManaStats()
ToggleManaStats toggles the visibility of the hp and mana stats placed above their respective globe
func (*GameControls) UnbindTerminalCommands ¶
func (g *GameControls) UnbindTerminalCommands(term d2interface.Terminal) error
UnbindTerminalCommands unbinds commands from the terminal
type HUD ¶
HUD represents the always visible user interface of the game
func NewHUD ¶
func NewHUD( asset *d2asset.AssetManager, ui *d2ui.UIManager, hero *d2mapentity.Player, miniPanel *miniPanel, actionableRegions []actionableRegion, mapEngine *d2mapengine.MapEngine, l d2util.LogLevel, gameControls *GameControls, mapRenderer *d2maprenderer.MapRenderer, ) *HUD
NewHUD creates a HUD object
func (*HUD) Advance ¶
Advance updates syncs data on widgets that might have changed. I.e. the current stamina value in the stamina tooltip
func (*HUD) OnMouseMove ¶
func (h *HUD) OnMouseMove(event d2interface.MouseMoveEvent) bool
OnMouseMove handles mouse move events
type HelpOverlay ¶
HelpOverlay represents the in-game overlay that toggles visibility when the h key is pressed
func NewHelpOverlay ¶
func NewHelpOverlay( asset *d2asset.AssetManager, ui *d2ui.UIManager, l d2util.LogLevel, keyMap *KeyMap, ) *HelpOverlay
NewHelpOverlay creates a new HelpOverlay instance
func (*HelpOverlay) IsInRect ¶
func (h *HelpOverlay) IsInRect(px, py int) bool
IsInRect checks if the given point is within the overlay layout rectangle
func (*HelpOverlay) IsOpen ¶
func (h *HelpOverlay) IsOpen() bool
IsOpen returns whether or not the overlay is visible/open
func (*HelpOverlay) Render ¶
func (h *HelpOverlay) Render(target d2interface.Surface)
Render the overlay to the given surface
func (*HelpOverlay) SetOnCloseCb ¶
func (h *HelpOverlay) SetOnCloseCb(cb func())
SetOnCloseCb sets the callback run when Close() is called
func (*HelpOverlay) Toggle ¶
func (h *HelpOverlay) Toggle()
Toggle the visibility state of the overlay
type HeroStatsPanel ¶
HeroStatsPanel represents the hero status panel
func NewHeroStatsPanel ¶
func NewHeroStatsPanel(asset *d2asset.AssetManager, ui *d2ui.UIManager, heroName string, heroClass d2enum.Hero, l d2util.LogLevel, heroState *d2hero.HeroStatsState) *HeroStatsPanel
NewHeroStatsPanel creates a new hero status panel
func (*HeroStatsPanel) Advance ¶
func (s *HeroStatsPanel) Advance(elapsed float64)
Advance updates labels on the panel
func (*HeroStatsPanel) IsOpen ¶
func (s *HeroStatsPanel) IsOpen() bool
IsOpen returns true if the hero status panel is open
func (*HeroStatsPanel) Load ¶
func (s *HeroStatsPanel) Load()
Load the data for the hero status panel
func (*HeroStatsPanel) SetOnCloseCb ¶
func (s *HeroStatsPanel) SetOnCloseCb(cb func())
SetOnCloseCb the callback run on closing the HeroStatsPanel
func (*HeroStatsPanel) Toggle ¶
func (s *HeroStatsPanel) Toggle()
Toggle toggles the visibility of the hero status panel
type Inventory ¶
Inventory represents the inventory
func NewInventory ¶
func NewInventory(asset *d2asset.AssetManager, ui *d2ui.UIManager, l d2util.LogLevel, gold int, record *d2records.InventoryRecord) (*Inventory, error)
NewInventory creates an inventory instance and returns a pointer to it
func (*Inventory) Render ¶
func (g *Inventory) Render(target d2interface.Surface)
Render draws the inventory onto the given surface
func (*Inventory) SetOnCloseCb ¶
func (g *Inventory) SetOnCloseCb(cb func())
SetOnCloseCb the callback run on closing the inventory
type InventoryItem ¶
type InventoryItem interface { InventoryGridSize() (width int, height int) GetItemCode() string InventoryGridSlot() (x, y int) SetInventoryGridSlot(x, y int) GetItemDescription() []string }
InventoryItem is an interface for an items that can be placed in the inventory grid
type ItemGrid ¶
ItemGrid is a reusable grid for use with player and merchant inventory. Handles layout and rendering item icons based on code.
func NewItemGrid ¶
func NewItemGrid(asset *d2asset.AssetManager, ui *d2ui.UIManager, l d2util.LogLevel, record *d2records.InventoryRecord) *ItemGrid
NewItemGrid creates a new ItemGrid instance
func (*ItemGrid) Add ¶
func (g *ItemGrid) Add(items ...InventoryItem) (int, error)
Add places a given set of items into the first available slots. Returns a count of the number of items which could be inserted.
func (*ItemGrid) ChangeEquippedSlot ¶
func (g *ItemGrid) ChangeEquippedSlot(slot d2enum.EquippedSlot, item InventoryItem)
ChangeEquippedSlot sets the item for an equipment slot
func (*ItemGrid) GetSlot ¶
func (g *ItemGrid) GetSlot(x, y int) InventoryItem
GetSlot returns the inventory item at a given slot (can return nil)
func (*ItemGrid) Load ¶
func (g *ItemGrid) Load(items ...InventoryItem)
Load reads the inventory sprites for items into local cache for rendering.
func (*ItemGrid) Remove ¶
func (g *ItemGrid) Remove(item InventoryItem)
Remove does an in place filter to remove the element from the slice of items.
func (*ItemGrid) Render ¶
func (g *ItemGrid) Render(target d2interface.Surface)
Render the item grid to the given surface
func (*ItemGrid) ScreenToSlot ¶
ScreenToSlot translates screen coordinates to slot coordinates
func (*ItemGrid) Set ¶
func (g *ItemGrid) Set(x, y int, item InventoryItem) error
Set an inventory item at the given grid coordinate
func (*ItemGrid) SlotToScreen ¶
SlotToScreen translates slot coordinates to screen coordinates
type KeyBinding ¶
KeyBinding holds the primary and secondary keys assigned to a GameEvent
func (KeyBinding) IsEmpty ¶
func (b KeyBinding) IsEmpty() bool
IsEmpty checks if no keys are associated to the binding
type KeyBindingMenu ¶
KeyBindingMenu represents the menu to view/edit the key bindings
func NewKeyBindingMenu ¶
func NewKeyBindingMenu( asset *d2asset.AssetManager, renderer d2interface.Renderer, ui *d2ui.UIManager, guiManager *d2gui.GuiManager, keyMap *KeyMap, l d2util.LogLevel, escapeMenu *EscapeMenu, ) *KeyBindingMenu
NewKeyBindingMenu generates a new instance of the "Configure Keys" menu found in the options
func (*KeyBindingMenu) Advance ¶
func (menu *KeyBindingMenu) Advance(elapsed float64) error
Advance computes the state of the elements of the menu overtime
func (*KeyBindingMenu) Close ¶
func (menu *KeyBindingMenu) Close() error
Close will disable the render of the menu and clear the current selection
func (*KeyBindingMenu) Load ¶
func (menu *KeyBindingMenu) Load() error
Load will setup the layouts of the menu
func (*KeyBindingMenu) OnKeyDown ¶
func (menu *KeyBindingMenu) OnKeyDown(event d2interface.KeyEvent) error
OnKeyDown will assign the new key to the selected binding if any
func (*KeyBindingMenu) Render ¶
func (menu *KeyBindingMenu) Render(target d2interface.Surface) error
Render draws the different element of the menu on the target surface
type KeyBindingType ¶
type KeyBindingType int
KeyBindingType defines whether it's a primary or secondary binding
const ( KeyBindingTypeNone KeyBindingType = iota KeyBindingTypePrimary KeyBindingTypeSecondary )
Values defining the type of key binding
type KeyMap ¶
type KeyMap struct {
// contains filtered or unexported fields
}
KeyMap represents the key mappings of the game. Each game event can be associated to 2 different keys. A key of -1 means none
func GetDefaultKeyMap ¶
func GetDefaultKeyMap(asset *d2asset.AssetManager) *KeyMap
GetDefaultKeyMap generates a KeyMap instance with the default values
func NewKeyMap ¶
func NewKeyMap(asset *d2asset.AssetManager) *KeyMap
NewKeyMap returns a new instance of a KeyMap
func (*KeyMap) GetBindingByKey ¶
func (km *KeyMap) GetBindingByKey(key d2enum.Key) (*KeyBinding, d2enum.GameEvent, KeyBindingType)
GetBindingByKey returns the bindings for a givent game event
func (*KeyMap) GetKeysForGameEvent ¶
func (km *KeyMap) GetKeysForGameEvent(gameEvent d2enum.GameEvent) *KeyBinding
GetKeysForGameEvent returns the bindings for a givent game event
func (*KeyMap) KeyToString ¶
KeyToString returns a string representing the key
func (*KeyMap) ResetToDefault ¶
func (km *KeyMap) ResetToDefault()
ResetToDefault will reset the KeyMap to the default values
func (*KeyMap) SetPrimaryBinding ¶
func (km *KeyMap) SetPrimaryBinding(gameEvent d2enum.GameEvent, key d2enum.Key) (*KeyBinding, KeyBindingType)
SetPrimaryBinding binds the first key for gameEvent
func (*KeyMap) SetSecondaryBinding ¶
func (km *KeyMap) SetSecondaryBinding(gameEvent d2enum.GameEvent, key d2enum.Key) (*KeyBinding, KeyBindingType)
SetSecondaryBinding binds the second key for gameEvent
type MoveGoldPanel ¶
MoveGoldPanel represents the move gold panel
func NewMoveGoldPanel ¶
func NewMoveGoldPanel(asset *d2asset.AssetManager, ui *d2ui.UIManager, gold int, l d2util.LogLevel, ) *MoveGoldPanel
NewMoveGoldPanel creates a new move gold panel
func (*MoveGoldPanel) IsOpen ¶
func (s *MoveGoldPanel) IsOpen() bool
IsOpen returns true if the move gold panel is opened
func (*MoveGoldPanel) SetOnCloseCb ¶
func (s *MoveGoldPanel) SetOnCloseCb(cb func())
SetOnCloseCb the callback run on closing the HeroStatsPanel
func (*MoveGoldPanel) Toggle ¶
func (s *MoveGoldPanel) Toggle()
Toggle toggles the visibility of the move gold panel
type Panel ¶
type Panel interface { IsOpen() bool Open() Close() }
Panel represents the panel at the bottom of the game screen
type PartyPanel ¶
PartyPanel represents the party panel
func NewPartyPanel ¶
func NewPartyPanel(asset *d2asset.AssetManager, ui *d2ui.UIManager, heroName string, l d2util.LogLevel, me *d2mapentity.Player, heroState *d2hero.HeroStatsState, players map[string]*d2mapentity.Player) *PartyPanel
NewPartyPanel creates a new party panel
func (*PartyPanel) AddPlayer ¶
func (s *PartyPanel) AddPlayer(player *d2mapentity.Player, relations d2enum.PlayersRelationships)
AddPlayer adds a new player to the party panel
func (*PartyPanel) DeletePlayer ¶
func (s *PartyPanel) DeletePlayer(player *d2mapentity.Player) bool
DeletePlayer deletes player from PartyIndexes
func (*PartyPanel) IsInPanel ¶
func (s *PartyPanel) IsInPanel(player *d2mapentity.Player) bool
IsInPanel returns true if player given already exists in panel
func (*PartyPanel) IsMe ¶
func (s *PartyPanel) IsMe(player *d2mapentity.Player) bool
IsMe returns true if player given is "me"
func (*PartyPanel) IsOpen ¶
func (s *PartyPanel) IsOpen() bool
IsOpen returns true if the hero status panel is open
func (*PartyPanel) OnMouseMove ¶
func (s *PartyPanel) OnMouseMove(event d2interface.MouseMoveEvent) bool
OnMouseMove handles mouse movement events
func (*PartyPanel) SetOnCloseCb ¶
func (s *PartyPanel) SetOnCloseCb(cb func())
SetOnCloseCb the callback run on closing the PartyPanel
func (*PartyPanel) Toggle ¶
func (s *PartyPanel) Toggle()
Toggle toggles the visibility of the hero status panel
func (*PartyPanel) UpdatePanel ¶
func (s *PartyPanel) UpdatePanel()
UpdatePanel updates panel indexes with players list
func (*PartyPanel) UpdatePlayersList ¶
func (s *PartyPanel) UpdatePlayersList(list map[string]*d2mapentity.Player)
UpdatePlayersList updates internal players list
type QuestLog ¶
QuestLog represents the quest log
func NewQuestLog ¶
func NewQuestLog(asset *d2asset.AssetManager, ui *d2ui.UIManager, l d2util.LogLevel, audioProvider d2interface.AudioProvider, act int) *QuestLog
NewQuestLog creates a new quest log
func (*QuestLog) SetOnCloseCb ¶
func (s *QuestLog) SetOnCloseCb(cb func())
SetOnCloseCb the callback run on closing the HeroStatsPanel
type SkillListRow ¶
type SkillListRow struct { Rectangle d2geom.Rectangle Skills []*d2hero.HeroSkill // contains filtered or unexported fields }
SkillListRow represents a row of skills that is shown when the skill select menu is rendered.
func (*SkillListRow) AddSkill ¶
func (s *SkillListRow) AddSkill(skill *d2hero.HeroSkill)
AddSkill appends to the skills of the row.
func (*SkillListRow) GetRectangle ¶
func (s *SkillListRow) GetRectangle() d2geom.Rectangle
GetRectangle returns the rectangle of the list.
func (*SkillListRow) GetWidth ¶
func (s *SkillListRow) GetWidth() int
GetWidth returns the width based on the size of the skills.
func (*SkillListRow) IsInRect ¶
func (s *SkillListRow) IsInRect(x, y int) bool
IsInRect returns true when the list has any skills and coordinates are in the rectangle of the list.
type SkillPanel ¶
type SkillPanel struct { ListRows []*SkillListRow *d2util.Logger // contains filtered or unexported fields }
SkillPanel represents a skill select menu popup that is displayed when the player left clicks on his active left/right skill.
func NewHeroSkillsPanel ¶
func NewHeroSkillsPanel(asset *d2asset.AssetManager, ui *d2ui.UIManager, hero *d2mapentity.Player, l d2util.LogLevel, isLeftPanel bool) *SkillPanel
NewHeroSkillsPanel creates a new hero status panel
func (*SkillPanel) GetListRowByPos ¶
func (s *SkillPanel) GetListRowByPos(x, y int) *SkillListRow
GetListRowByPos returns the skill list row for a given X and Y, based on the width and height of the skills list.
func (*SkillPanel) HandleClick ¶
func (s *SkillPanel) HandleClick(x, y int) bool
HandleClick will change the hero's active(left or right) skill and return true. Returns false if the given X, Y is out of panel boundaries.
func (*SkillPanel) HandleMouseMove ¶
func (s *SkillPanel) HandleMouseMove(x, y int) bool
HandleMouseMove will process a mouse move event, if inside the panel.
func (*SkillPanel) IsInRect ¶
func (s *SkillPanel) IsInRect(x, y int) bool
IsInRect returns whether the X Y coordinates are in some of the list rows of the panel.
func (*SkillPanel) IsOpen ¶
func (s *SkillPanel) IsOpen() bool
IsOpen returns true if the hero skills panel is open
func (*SkillPanel) RegenerateImageCache ¶
func (s *SkillPanel) RegenerateImageCache()
RegenerateImageCache will force re-generating the cached menu image on next Render. Somewhat expensive operation, should not be called often. Currently called every time the panel is opened or when the player learns a new skill.
func (*SkillPanel) Render ¶
func (s *SkillPanel) Render(target d2interface.Surface) error
Render gets called on every tick
func (*SkillPanel) Toggle ¶
func (s *SkillPanel) Toggle()
Toggle toggles the visibility of the hero status panel
type SkillResource ¶
type SkillResource struct { SkillResourcePath string // path to a skills DC6 file(see getSkillResourceByClass) IconNumber int // the index of the frame in the DC6 file SkillIcon *d2ui.Sprite }
SkillResource represents a Skill with its corresponding icon sprite, path to DC6 file and icon number. SkillResourcePath points to a DC6 resource which contains the icons of multiple skills as frames. The IconNumber is the frame at which we can find our skill sprite in the DC6 file.
type SkillSelectMenu ¶
type SkillSelectMenu struct { LeftPanel *SkillPanel RightPanel *SkillPanel }
SkillSelectMenu is a wrapper for the left + right menu that pop up when a player clicks the left/right skill select.
func NewSkillSelectMenu ¶
func NewSkillSelectMenu(asset *d2asset.AssetManager, ui *d2ui.UIManager, l d2util.LogLevel, hero *d2mapentity.Player) *SkillSelectMenu
NewSkillSelectMenu creates a skill select menu.
func (*SkillSelectMenu) ClosePanels ¶
func (sm *SkillSelectMenu) ClosePanels()
ClosePanels will close both panels
func (*SkillSelectMenu) HandleClick ¶
func (sm *SkillSelectMenu) HandleClick(x, y int) bool
HandleClick will propagate the click to the panels.
func (*SkillSelectMenu) HandleMouseMove ¶
func (sm *SkillSelectMenu) HandleMouseMove(x, y int)
HandleMouseMove will propagate the mouse move event to the panels.
func (*SkillSelectMenu) IsInRect ¶
func (sm *SkillSelectMenu) IsInRect(x, y int) bool
IsInRect returns whether the coordinates are in one of the panels(left or right)
func (*SkillSelectMenu) IsOpen ¶
func (sm *SkillSelectMenu) IsOpen() bool
IsOpen returns whether one of the panels(left or right) is open
func (*SkillSelectMenu) OpenLeftPanel ¶
func (sm *SkillSelectMenu) OpenLeftPanel()
OpenLeftPanel will close the right panel and open the left panel.
func (*SkillSelectMenu) OpenRightPanel ¶
func (sm *SkillSelectMenu) OpenRightPanel()
OpenRightPanel will close the left panel and open the right panel.
func (*SkillSelectMenu) RegenerateImageCache ¶
func (sm *SkillSelectMenu) RegenerateImageCache()
RegenerateImageCache will force both panels to re-create the image shown at skill popup menus. Somewhat expensive operation, should not be called often.
func (*SkillSelectMenu) Render ¶
func (sm *SkillSelectMenu) Render(target d2interface.Surface)
Render gets called on every frame
func (*SkillSelectMenu) ToggleLeftPanel ¶
func (sm *SkillSelectMenu) ToggleLeftPanel()
ToggleLeftPanel will close or open the left panel, depending on the current state
func (*SkillSelectMenu) ToggleRightPanel ¶
func (sm *SkillSelectMenu) ToggleRightPanel()
ToggleRightPanel will close or open the right panel, depending on the current state
type StatsPanelLabels ¶
type StatsPanelLabels struct { Level *d2ui.Label Experience *d2ui.Label NextLevelExp *d2ui.Label Strength *d2ui.Label Dexterity *d2ui.Label Vitality *d2ui.Label Energy *d2ui.Label Health *d2ui.Label MaxHealth *d2ui.Label Mana *d2ui.Label MaxMana *d2ui.Label MaxStamina *d2ui.Label Stamina *d2ui.Label }
StatsPanelLabels represents the labels in the status panel
Source Files ¶
- binding_layout.go
- doc.go
- equipment_slot.go
- escape_menu.go
- game_controls.go
- globeWidget.go
- help_overlay.go
- hero_stats_panel.go
- hud.go
- input_callback_listener.go
- inventory.go
- inventory_grid.go
- key_binding_menu.go
- key_map.go
- mini_panel.go
- move_gold_panel.go
- party_panel.go
- quest_log.go
- skill_row.go
- skill_select_menu.go
- skill_select_panel.go
- skillicon.go
- skilltree.go