1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2025-02-02 22:57:04 -05:00

d2core/d2records: rename some Ids to IDs

This commit is contained in:
gucio321 2021-06-13 17:59:50 +02:00
parent 9c87bd775e
commit 6fb564a170
11 changed files with 7944 additions and 7948 deletions

View File

@ -136,7 +136,7 @@ func (mr *Stamp) Entities(tileOffsetX, tileOffsetY int) []d2interface.MapEntity
continue continue
} }
objectRecord := mr.factory.asset.Records.Object.Details[lookup.ObjectsTxtId] objectRecord := mr.factory.asset.Records.Object.Details[lookup.ObjectsTxtID]
if objectRecord != nil { if objectRecord != nil {
// nolint:gomnd // constant // nolint:gomnd // constant

View File

@ -16,7 +16,7 @@ func missilesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
for d.Next() { for d.Next() {
record := &MissileRecord{ record := &MissileRecord{
Name: d.String("Missile"), Name: d.String("Missile"),
Id: d.Number("Id"), ID: d.Number("Id"),
ClientMovementFunc: d.Number("pCltDoFunc"), ClientMovementFunc: d.Number("pCltDoFunc"),
ClientCollisionFunc: d.Number("pCltHitFunc"), ClientCollisionFunc: d.Number("pCltHitFunc"),
@ -296,7 +296,7 @@ func missilesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
}, },
} }
records[record.Id] = record records[record.ID] = record
r.missilesByName[sanitizeMissilesKey(record.Name)] = record r.missilesByName[sanitizeMissilesKey(record.Name)] = record
} }

View File

@ -102,7 +102,7 @@ type MissileRecord struct {
ServerMovementFunc int ServerMovementFunc int
ClientMovementFunc int ClientMovementFunc int
ClientCollisionFunc int ClientCollisionFunc int
Id int ID int
ServerCollisionFunc int ServerCollisionFunc int
ServerDamageFunc int ServerDamageFunc int
Velocity int Velocity int

View File

@ -15,7 +15,7 @@ func monsterStatsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
ID: d.Number("hcIdx"), ID: d.Number("hcIdx"),
BaseKey: d.String("BaseId"), BaseKey: d.String("BaseId"),
NextKey: d.String("NextInClass"), NextKey: d.String("NextInClass"),
PaletteId: d.Number("TransLvl"), PaletteID: d.Number("TransLvl"),
NameString: d.String("NameStr"), NameString: d.String("NameStr"),
ExtraDataKey: d.String("MonStatsEx"), ExtraDataKey: d.String("MonStatsEx"),
PropertiesKey: d.String("MonProp"), PropertiesKey: d.String("MonProp"),
@ -30,8 +30,8 @@ func monsterStatsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
SpawnOffsetX: d.Number("spawnx"), SpawnOffsetX: d.Number("spawnx"),
SpawnOffsetY: d.Number("spawny"), SpawnOffsetY: d.Number("spawny"),
SpawnAnimationKey: d.String("spawnmode"), SpawnAnimationKey: d.String("spawnmode"),
MinionId1: d.String("minion1"), MinionID1: d.String("minion1"),
MinionId2: d.String("minion2"), MinionID2: d.String("minion2"),
IsLeader: d.Number("SetBoss") > 0, IsLeader: d.Number("SetBoss") > 0,
TransferLeadership: d.Number("BossXfer") > 0, TransferLeadership: d.Number("BossXfer") > 0,
MinionPartyMin: d.Number("PartyMin"), MinionPartyMin: d.Number("PartyMin"),
@ -108,14 +108,14 @@ func monsterStatsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
IgnorePets: d.Number("petIgnore") > 0, IgnorePets: d.Number("petIgnore") > 0,
DealsDamageOnDeath: d.Number("deathDmg") > 0, DealsDamageOnDeath: d.Number("deathDmg") > 0,
GenericSpawn: d.Number("genericSpawn") > 0, GenericSpawn: d.Number("genericSpawn") > 0,
SkillId1: d.String("Skill1"), SkillID1: d.String("Skill1"),
SkillId2: d.String("Skill2"), SkillID2: d.String("Skill2"),
SkillId3: d.String("Skill3"), SkillID3: d.String("Skill3"),
SkillId4: d.String("Skill4"), SkillID4: d.String("Skill4"),
SkillId5: d.String("Skill5"), SkillID5: d.String("Skill5"),
SkillId6: d.String("Skill6"), SkillID6: d.String("Skill6"),
SkillId7: d.String("Skill7"), SkillID7: d.String("Skill7"),
SkillId8: d.String("Skill8"), SkillID8: d.String("Skill8"),
SkillAnimation1: d.String("Sk1mode"), SkillAnimation1: d.String("Sk1mode"),
SkillAnimation2: d.String("Sk2mode"), SkillAnimation2: d.String("Sk2mode"),
SkillAnimation3: d.String("Sk3mode"), SkillAnimation3: d.String("Sk3mode"),
@ -157,7 +157,7 @@ func monsterStatsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
ResistancePoisonNightmare: d.Number("ResPo(N)"), ResistancePoisonNightmare: d.Number("ResPo(N)"),
ResistancePoisonHell: d.Number("ResPo(H)"), ResistancePoisonHell: d.Number("ResPo(H)"),
HealthRegenPerFrame: d.Number("DamageRegen"), HealthRegenPerFrame: d.Number("DamageRegen"),
DamageSkillId: d.String("SkillDamage"), DamageSkillID: d.String("SkillDamage"),
IgnoreMonLevelTxt: d.Number("noRatio") > 0, IgnoreMonLevelTxt: d.Number("noRatio") > 0,
CanBlockWithoutShield: d.Number("NoShldBlock") > 0, CanBlockWithoutShield: d.Number("NoShldBlock") > 0,
ChanceToBlockNormal: d.Number("ToBlock"), ChanceToBlockNormal: d.Number("ToBlock"),
@ -257,8 +257,8 @@ func monsterStatsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
TreasureClassQuestNormal: d.String("TreasureClass4"), TreasureClassQuestNormal: d.String("TreasureClass4"),
TreasureClassQuestNightmare: d.String("TreasureClass4(N)"), TreasureClassQuestNightmare: d.String("TreasureClass4(N)"),
TreasureClassQuestHell: d.String("TreasureClass4(H)"), TreasureClassQuestHell: d.String("TreasureClass4(H)"),
TreasureClassQuestTriggerId: d.String("TCQuestId"), TreasureClassQuestTriggerID: d.String("TCQuestId"),
TreasureClassQuestCompleteId: d.String("TCQuestCP"), TreasureClassQuestCompleteID: d.String("TCQuestCP"),
SpecialEndDeath: d.Number("SplEndDeath"), SpecialEndDeath: d.Number("SplEndDeath"),
SpecialGetModeChart: d.Number("SplGetModeChart") > 0, SpecialGetModeChart: d.Number("SplGetModeChart") > 0,
SpecialEndGeneric: d.Number("SplEndGeneric") > 0, SpecialEndGeneric: d.Number("SplEndGeneric") > 0,

View File

@ -11,7 +11,7 @@ type (
// MonStatRecord represents a single row from `data/global/excel/monstats.txt` in the MPQ files. // MonStatRecord represents a single row from `data/global/excel/monstats.txt` in the MPQ files.
// These records are used for creating monsters. // These records are used for creating monsters.
MonStatRecord struct { MonStatRecord struct {
TreasureClassQuestCompleteId string TreasureClassQuestCompleteID string
Key string Key string
BaseKey string BaseKey string
NextKey string NextKey string
@ -24,8 +24,8 @@ type (
AnimationDirectoryToken string AnimationDirectoryToken string
SpawnKey string SpawnKey string
SpawnAnimationKey string SpawnAnimationKey string
MinionId1 string MinionID1 string
MinionId2 string MinionID2 string
SoundKeyNormal string SoundKeyNormal string
SoundKeySpecial string SoundKeySpecial string
MissileA1 string MissileA1 string
@ -36,14 +36,14 @@ type (
MissileS4 string MissileS4 string
MissileC string MissileC string
MissileSQ string MissileSQ string
SkillId1 string SkillID1 string
SkillId2 string SkillID2 string
SkillId3 string SkillID3 string
SkillId4 string SkillID4 string
SkillId5 string SkillID5 string
SkillId6 string SkillID6 string
SkillId7 string SkillID7 string
SkillId8 string SkillID8 string
SkillAnimation1 string SkillAnimation1 string
SkillAnimation2 string SkillAnimation2 string
SkillAnimation3 string SkillAnimation3 string
@ -52,7 +52,7 @@ type (
SkillAnimation6 string SkillAnimation6 string
SkillAnimation7 string SkillAnimation7 string
SkillAnimation8 string SkillAnimation8 string
DamageSkillId string DamageSkillID string
ElementAttackMode1 string ElementAttackMode1 string
ElementAttackMode2 string ElementAttackMode2 string
ElementAttackMode3 string ElementAttackMode3 string
@ -71,9 +71,9 @@ type (
TreasureClassQuestNormal string TreasureClassQuestNormal string
TreasureClassQuestNightmare string TreasureClassQuestNightmare string
TreasureClassQuestHell string TreasureClassQuestHell string
TreasureClassQuestTriggerId string TreasureClassQuestTriggerID string
ResistanceMagicNightmare int ResistanceMagicNightmare int
PaletteId int PaletteID int
SpawnOffsetX int SpawnOffsetX int
SpawnOffsetY int SpawnOffsetY int
MinionPartyMin int MinionPartyMin int

View File

@ -37,9 +37,9 @@ type ObjectLookupRecord struct {
S3 string S3 string
Act int Act int
Direction int Direction int
MonstatsTxtId int MonstatsTxtID int
ObjectsTxtId int ObjectsTxtID int
Id int ID int
Type d2enum.ObjectType Type d2enum.ObjectType
Index int Index int
} }

File diff suppressed because it is too large Load Diff

View File

@ -20,22 +20,22 @@ func TestIndexObjects(t *testing.T) {
} }
testObjects := []ObjectLookupRecord{ testObjects := []ObjectLookupRecord{
{Act: 1, Type: d2enum.ObjectTypeCharacter, Id: 0, Description: "Act1CharId0"}, {Act: 1, Type: d2enum.ObjectTypeCharacter, ID: 0, Description: "Act1CharID0"},
{Act: 1, Type: d2enum.ObjectTypeCharacter, Id: 1, Description: "Act1CharId1"}, {Act: 1, Type: d2enum.ObjectTypeCharacter, ID: 1, Description: "Act1CharID1"},
{Act: 1, Type: d2enum.ObjectTypeCharacter, Id: 2, Description: "Act1CharId2"}, {Act: 1, Type: d2enum.ObjectTypeCharacter, ID: 2, Description: "Act1CharID2"},
{Act: 1, Type: d2enum.ObjectTypeCharacter, Id: 3, Description: "Act1CharId3"}, {Act: 1, Type: d2enum.ObjectTypeCharacter, ID: 3, Description: "Act1CharID3"},
{Act: 1, Type: d2enum.ObjectTypeItem, Id: 0, Description: "Act1ItemId0"}, {Act: 1, Type: d2enum.ObjectTypeItem, ID: 0, Description: "Act1ItemID0"},
{Act: 1, Type: d2enum.ObjectTypeItem, Id: 1, Description: "Act1ItemId1"}, {Act: 1, Type: d2enum.ObjectTypeItem, ID: 1, Description: "Act1ItemID1"},
{Act: 1, Type: d2enum.ObjectTypeItem, Id: 2, Description: "Act1ItemId2"}, {Act: 1, Type: d2enum.ObjectTypeItem, ID: 2, Description: "Act1ItemID2"},
{Act: 1, Type: d2enum.ObjectTypeItem, Id: 3, Description: "Act1ItemId3"}, {Act: 1, Type: d2enum.ObjectTypeItem, ID: 3, Description: "Act1ItemID3"},
{Act: 2, Type: d2enum.ObjectTypeCharacter, Id: 0, Description: "Act2CharId0"}, {Act: 2, Type: d2enum.ObjectTypeCharacter, ID: 0, Description: "Act2CharID0"},
{Act: 2, Type: d2enum.ObjectTypeCharacter, Id: 1, Description: "Act2CharId1"}, {Act: 2, Type: d2enum.ObjectTypeCharacter, ID: 1, Description: "Act2CharID1"},
{Act: 2, Type: d2enum.ObjectTypeCharacter, Id: 2, Description: "Act2CharId2"}, {Act: 2, Type: d2enum.ObjectTypeCharacter, ID: 2, Description: "Act2CharID2"},
{Act: 2, Type: d2enum.ObjectTypeCharacter, Id: 3, Description: "Act2CharId3"}, {Act: 2, Type: d2enum.ObjectTypeCharacter, ID: 3, Description: "Act2CharID3"},
{Act: 2, Type: d2enum.ObjectTypeItem, Id: 0, Description: "Act2ItemId0"}, {Act: 2, Type: d2enum.ObjectTypeItem, ID: 0, Description: "Act2ItemID0"},
{Act: 2, Type: d2enum.ObjectTypeItem, Id: 1, Description: "Act2ItemId1"}, {Act: 2, Type: d2enum.ObjectTypeItem, ID: 1, Description: "Act2ItemID1"},
{Act: 2, Type: d2enum.ObjectTypeItem, Id: 2, Description: "Act2ItemId2"}, {Act: 2, Type: d2enum.ObjectTypeItem, ID: 2, Description: "Act2ItemID2"},
{Act: 2, Type: d2enum.ObjectTypeItem, Id: 3, Description: "Act2ItemId3"}, {Act: 2, Type: d2enum.ObjectTypeItem, ID: 3, Description: "Act2ItemID3"},
} }
r.initObjectRecords(testObjects) r.initObjectRecords(testObjects)

View File

@ -398,7 +398,7 @@ func (r *RecordManager) initObjectRecords(lookups []ObjectLookupRecord) {
records[record.Act][record.Type] = make([]*ObjectLookupRecord, 1000) records[record.Act][record.Type] = make([]*ObjectLookupRecord, 1000)
} }
records[record.Act][record.Type][record.Id] = record records[record.Act][record.Type][record.ID] = record
} }
r.Object.Lookup = records r.Object.Lookup = records

View File

@ -19,7 +19,6 @@ import (
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2screen" "github.com/OpenDiablo2/OpenDiablo2/d2core/d2screen"
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2ui" "github.com/OpenDiablo2/OpenDiablo2/d2core/d2ui"
"github.com/OpenDiablo2/OpenDiablo2/d2networking/d2client/d2clientconnectiontype" "github.com/OpenDiablo2/OpenDiablo2/d2networking/d2client/d2clientconnectiontype"
"github.com/OpenDiablo2/OpenDiablo2/d2script"
) )
type mainMenuScreenMode int type mainMenuScreenMode int
@ -169,7 +168,6 @@ type MainMenu struct {
diabloLogoRight *d2ui.Sprite diabloLogoRight *d2ui.Sprite
diabloLogoLeft *d2ui.Sprite diabloLogoLeft *d2ui.Sprite
background *d2ui.Sprite background *d2ui.Sprite
scriptEngine *d2script.ScriptEngine
trademarkBackground *d2ui.Sprite trademarkBackground *d2ui.Sprite
*d2util.Logger *d2util.Logger
buildInfo BuildInfo buildInfo BuildInfo

View File

@ -266,7 +266,6 @@ func (g *GameClient) handleMovePlayerPacket(packet d2netpacket.NetPacket) error
player.SetIsInTown(tile.RegionType == d2enum.RegionAct1Town) player.SetIsInTown(tile.RegionType == d2enum.RegionAct1Town)
err := player.SetAnimationMode(player.GetAnimationMode()) err := player.SetAnimationMode(player.GetAnimationMode())
if err != nil { if err != nil {
fmtStr := "GameClient: error setting animation mode for player %s: %s" fmtStr := "GameClient: error setting animation mode for player %s: %s"
g.Errorf(fmtStr, player.ID(), err) g.Errorf(fmtStr, player.ID(), err)
@ -394,9 +393,8 @@ func (g *GameClient) createMissileEntity(
missileEntity, err := g.MapEngine.NewMissile( missileEntity, err := g.MapEngine.NewMissile(
int(player.Position.X()), int(player.Position.X()),
int(player.Position.Y()), int(player.Position.Y()),
g.asset.Records.Missiles[missileRecord.Id], g.asset.Records.Missiles[missileRecord.ID],
) )
if err != nil { if err != nil {
return nil, err return nil, err
} }