Added States for monsters and corpses (#43)

This commit is contained in:
elb
2024-09-29 07:32:19 -04:00
committed by GitHub
parent 8239f1bbe4
commit 9020cc396e
5 changed files with 35 additions and 7 deletions

View File

@@ -139,6 +139,7 @@ type Corpse struct {
Found bool
IsHovered bool
Position Position
States state.States
}
type Position struct {
@@ -290,3 +291,23 @@ type OpenMenus struct {
func (om OpenMenus) IsMenuOpen() bool {
return om.Inventory || om.NPCInteract || om.NPCShop || om.Stash || om.Waypoint || om.SkillTree || om.Character || om.QuitMenu || om.Cube || om.SkillSelect || om.Anvil
}
func (c Corpse) StateNotInteractable() bool {
CorpseStates := []state.State{
state.CorpseNoselect,
state.CorpseNodraw,
state.Revive,
state.Redeemed,
state.Shatter,
state.Freeze,
}
for _, s := range c.States {
for _, d := range CorpseStates {
if s == d {
return true
}
}
}
return false
}

View File

@@ -3,6 +3,7 @@ package data
import (
"github.com/hectorgimenez/d2go/pkg/data/npc"
"github.com/hectorgimenez/d2go/pkg/data/stat"
"github.com/hectorgimenez/d2go/pkg/data/state"
)
type NPC struct {
@@ -20,6 +21,7 @@ type Monster struct {
Position Position
Stats map[stat.ID]int
Type MonsterType
States state.States
}
type Monsters []Monster