Files
d2go/pkg/data/objects.go
elb 2eeee0cf1f Npc/Monsters Mode and Portals destination + optimization (#49)
* Added States for monsters and corpses

Now can properly identify if a corpse is interactable with a skill ( barbarian, necromancer)
Also getting states about monsters  : Exemple  Soul Killer with Conviction aura:   State  28 // conviction

Also can tell if monster has a state after you used a skill on it  Exemple:   State 56  Terror ( After using Barbarian skill Howl to fear )

Another Exemple  using Grief on Mephistos he now have  states :    2 poison
    52  Preventheal

will be very useful for further development.

* Added modes to player

Now accessible in koolo using : s.data.PlayerUnit.Mode

Those are Modes for player:
const Death: 0;
        const StandingOutsideTown: 1;
        const Walking: 2;
        const Running: 3;
        const GettingHit: 4;
        const StandingInTown: 5;
        const WalkingInTown: 6;
        const Attacking1: 7;
        const Attacking2: 8;
        const Blocking: 9;
        const CastingSkill: 10;
        const ThrowingItem: 11;
        const Kicking: 12;
        const UsingSkill1: 13;
        const UsingSkill2: 14;
        const UsingSkill3: 15;
        const UsingSkill4: 16;
        const Dead: 17;
        const SkillActionSequence: 18;
        const KnockedBack: 19;

* update Added alias(const) for player modes

can be used like this s.data.PlayerUnit.Mode == mode.StandingInTown

* added modes to object

0 = Object idle
1 = Object operating
2 = Object opened
3 = Object special 1    ?? to be determined what it does exactly
4 = Object special 2    ?? to be determined what it does exactly
5 = Object special 3    ?? to be determined what it does exactly
6 = Object special 4    ?? to be determined what it does exactly
7 = Object special 5    ?? to be determined what it does exactly

* update object mode strings

* Update object_mode.go

* Update object_mode.go

* update object modes again. accurate now

* Added IsSealBoss()  for Chaos Run

* Npc/Monster Modes and Portals destination
also IsEscapingType()  Monster cannot be attacked when airborne or hide in water (NpcMode 8)

* Npc/Monster Modes and Portals destination
also IsEscapingType()  Monster cannot be attacked when airborne or hide in water (NpcMode 8)

* Optimized monsters.go and object.go
also catapults have been added to ignore list

* Tz Frigid Higland ingores added
2024-12-01 22:54:57 +09:00

154 lines
3.7 KiB
Go

package data
import (
"github.com/hectorgimenez/d2go/pkg/data/mode"
"github.com/hectorgimenez/d2go/pkg/data/object"
)
type Object struct {
ID UnitID
object.Name
IsHovered bool
Selectable bool
InteractType object.InteractType
Shrine object.ShrineData
Position Position
Owner string
Mode mode.ObjectMode
PortalData object.PortalData
}
type Objects []Object
func (o Objects) FindOne(name object.Name) (Object, bool) {
for _, obj := range o {
if obj.Name == name {
return obj, true
}
}
return Object{}, false
}
func (o Objects) FindByID(id UnitID) (Object, bool) {
for _, obj := range o {
if obj.ID == id {
return obj, true
}
}
return Object{}, false
}
func (o Object) IsShrine() bool {
switch o.Shrine.ShrineType {
case object.RefillShrine,
object.HealthShrine,
object.ManaShrine,
object.HPXChangeShrine,
object.ManaXChangeShrine,
object.ArmorShrine,
object.CombatShrine,
object.ResistFireShrine,
object.ResistColdShrine,
object.ResistLightningShrine,
object.ResistPoisonShrine,
object.SkillShrine,
object.ManaRegenShrine,
object.StaminaShrine,
object.ExperienceShrine,
object.UnknownShrine,
object.PortalShrine,
object.GemShrine,
object.FireShrine,
object.MonsterShrine,
object.ExplosiveShrine,
object.PoisonShrine:
return true
}
return false
}
func (o Object) IsWaypoint() bool {
switch o.Name {
case object.WaypointPortal,
object.Act1WildernessWaypoint,
object.Act2Waypoint,
object.Act3TownWaypoint,
object.PandamoniumFortressWaypoint,
object.Act2CellerWaypoint,
object.Act2SewerWaypoint,
object.Act3TravincalWaypoint,
object.ValleyWaypoint,
object.WorldstoneWaypoint,
object.ExpansionWildernessWaypoint,
object.IceCaveWaypoint,
object.TempleWaypoint,
object.InnerHellWaypoint,
object.WaypointH,
object.ExpansionWaypoint:
return true
}
return false
}
func (o Object) IsPortal() bool {
return o.Name == object.TownPortal
}
func (o Object) IsRedPortal() bool {
return o.Name == object.PermanentTownPortal
}
func (o Object) IsChest() bool {
switch o.Name {
case 1, 3, 5, 6, 50, 51, 53, 54, 55, 56, 57, 58, 79, 87, 88, 89, 104, 105, 106, 107, 125, 126, 127, 128, 139, 140, 141,
144, 146, 147, 148, 154, 155, 158, 159, 169, 171, 174, 175, 176, 177, 178, 181, 182, 183, 185, 186, 187, 188, 198,
203, 204, 205, 223, 224, 225, 240, 241, 242, 243, 244, 247, 248, 266, 268, 270, 271, 272, 274, 284, 314, 315, 316,
317, 326, 329, 330, 331, 332, 333, 334, 335, 336, 354, 355, 356, 360, 371, 372, 380, 381, 383, 384, 387, 388, 389,
390, 391, 397, 405, 406, 407, 413, 416, 420, 424, 425, 430, 431, 432, 433, 454, 455, 463, 466, 485, 486, 487, 501,
502, 504, 505, 518, 524, 525, 526, 529, 530, 531, 532, 533, 534, 535, 540, 541, 544, 545, 556, 580, 581:
return true
}
return false
}
func (o Object) IsDoor() bool {
switch o.Name {
case object.DoorCathedralLeft,
object.DoorCathedralRight,
object.DoorCathedralDouble,
object.DoorCourtyardLeft,
object.DoorCourtyardRight,
object.DoorGateLeft,
object.DoorGateRight,
object.DoorMonasteryDoubleRight,
object.DoorWoodenLeft,
object.DoorWoodenLeft2,
object.DoorWoodenRight,
object.IronGrateDoorLeft,
object.IronGrateDoorRight,
object.SlimeDoor1,
object.SlimeDoor2,
object.TombDoorLeft,
object.TombDoorLeft2,
object.TombDoorRight,
object.TombDoorRight2,
object.WoodenDoorLeft,
object.WoodenDoorRight,
object.WoodenGrateDoorLeft,
object.WoodenGrateDoorRight,
object.AndarielDoor,
object.PenBreakableDoor,
object.ArreatSummitDoorToWorldstone,
object.SecretDoor1,
object.ExpansionTownGate:
return true
}
return false
}
func (o Object) IsSuperChest() bool {
switch o.Name {
case 104, 105, 106, 107, 181, 183, 580, 397, 387, 389, 390, 391, 455:
return true
}
return false
}