1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-18 02:16:23 -05:00

fixed Id renaming in strings (#618)

This commit is contained in:
Gürkan Kaymak 2020-07-24 14:54:52 +03:00 committed by GitHub
parent 9e61079e93
commit 1ce81f1aec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 24 additions and 24 deletions

View File

@ -96,7 +96,7 @@ func LoadHireling(file []byte) {
hireling := &HirelingRecord{
Hireling: d.String("Hireling"),
SubType: d.String("SubType"),
ID: d.Number("ID"),
ID: d.Number("Id"),
Class: d.Number("Class"),
Act: d.Number("Act"),
Difficulty: d.Number("Difficulty"),
@ -109,7 +109,7 @@ func LoadHireling(file []byte) {
HP: d.Number("HP"),
HPPerLvl: d.Number("HP/Lvl"),
Defense: d.Number("Defense"),
DefPerLvl: d.Number("ID"),
DefPerLvl: d.Number("Id"),
Str: d.Number("Str"),
StrPerLvl: d.Number("Str/Lvl"),
Dex: d.Number("Dex"),

View File

@ -36,7 +36,7 @@ func LoadLevelWarps(file []byte) {
for d.Next() {
record := &LevelWarpRecord{
Name: d.String("Name"),
ID: d.Number("ID"),
ID: d.Number("Id"),
SelectX: d.Number("SelectX"),
SelectY: d.Number("SelectY"),
SelectDX: d.Number("SelectDX"),

View File

@ -95,7 +95,7 @@ type LevelDetailsRecord struct {
// ID
// Level ID (used in columns like VIS0-7)
Id int //nolint:golint,stylecheck // ID is the right key
ID int
// Palette is the Act Palette . Reference only
Palette int // Pal
@ -138,7 +138,7 @@ type LevelDetailsRecord struct {
// location.
DependantLevelID int // Depend
// The type of the Level (ID from lvltypes.txt)
// The type of the Level (Id from lvltypes.txt)
LevelType int // LevelType
// Controls if teleport is allowed in that level.
@ -367,10 +367,10 @@ type LevelDetailsRecord struct {
//nolint:gochecknoglobals // Currently global by design, only written once
var LevelDetails map[int]*LevelDetailsRecord
// GetLevelDetails gets a LevelDetailsRecord by the record ID
// GetLevelDetails gets a LevelDetailsRecord by the record Id
func GetLevelDetails(id int) *LevelDetailsRecord {
for i := 0; i < len(LevelDetails); i++ {
if LevelDetails[i].Id == id {
if LevelDetails[i].ID == id {
return LevelDetails[i]
}
}
@ -387,7 +387,7 @@ func LoadLevelDetails(file []byte) {
for d.Next() {
record := &LevelDetailsRecord{
Name: d.String("Name "),
Id: d.Number("ID"),
ID: d.Number("Id"),
Palette: d.Number("Pal"),
Act: d.Number("Act"),
QuestFlag: d.Number("QuestFlag"),
@ -532,7 +532,7 @@ func LoadLevelDetails(file []byte) {
ObjectGroupSpawnChance6: d.Number("ObjPrb6"),
ObjectGroupSpawnChance7: d.Number("ObjPrb7"),
}
LevelDetails[record.Id] = record
LevelDetails[record.ID] = record
}
if d.Err != nil {

View File

@ -17,9 +17,9 @@ type (
// Key contains the pointer that will be used in other txt files
// such as levels.txt and superuniques.txt.
Key string // called `ID` in monstats.txt
Key string // called `Id` in monstats.txt
// ID is the actual internal ID of the unit (this is what the ID pointer
// Id is the actual internal ID of the unit (this is what the ID pointer
// actually points at) remember that no two units can have the same ID,
// this will result in lots of unpredictable behavior and crashes so please
// dont do it. This 'HarcCodedInDeX' is used for several things, such as
@ -28,7 +28,7 @@ type (
// column also links other hardcoded effects to the units, such as the
// transparency on necro summons and the name-color change on unique boss
// units (thanks to Kingpin for the info)
Id int //nolint:golint,stylecheck // called `hcIdx` in monstats.txt
ID int // called `hcIdx` in monstats.txt
// BaseKey is an ID pointer of the “base” unit for this specific
// monster type (ex. There are five types of “Fallen”; all of them have
@ -80,10 +80,10 @@ type (
// which animation mode will the spawned monster be spawned in.
SpawnAnimationKey string // called `spawnmode` in monstats.txt
// MinionId1 is an ID of a minion that spawns when this monster is created
// MinionId1 is an Id of a minion that spawns when this monster is created
MinionId1 string //nolint:golint,stylecheck // called `minion1` in monstats.txt
// MinionId2 is an ID of a minion that spawns when this monster is created
// MinionId2 is an Id of a minion that spawns when this monster is created
MinionId2 string //nolint:golint,stylecheck // called `minion2` in monstats.txt
// SoundKeyNormal, SoundKeySpecial
@ -690,8 +690,8 @@ func LoadMonStats(file []byte) { // nolint:funlen // Makes no sense to split
d := d2common.LoadDataDictionary(file)
for d.Next() {
record := &MonStatsRecord{
Key: d.String("ID"),
Id: d.Number("hcIdx"),
Key: d.String("Id"),
ID: d.Number("hcIdx"),
BaseKey: d.String("BaseId"),
NextKey: d.String("NextInClass"),
PaletteId: d.Number("TransLvl"),

View File

@ -177,7 +177,7 @@ func LoadMonStats2(file []byte) {
d := d2common.LoadDataDictionary(file)
for d.Next() {
record := &MonStats2Record{
Key: d.String("ID"),
Key: d.String("Id"),
Height: d.Number("Height"),
OverlayHeight: d.Number("OverlayHeight"),
PixelHeight: d.Number("pixHeight"),

View File

@ -281,7 +281,7 @@ func LoadSkills(file []byte) {
for d.Next() {
record := &SkillRecord{
Skill: d.String("skill"),
ID: d.Number("ID"),
ID: d.Number("Id"),
Charclass: d.String("charclass"),
Skilldesc: d.String("skilldesc"),
Srvstfunc: d.Number("srvstfunc"),

View File

@ -7,7 +7,7 @@ import (
// Object is a game world object
type Object struct {
Type int
Id int //nolint:golint ID is the right key
ID int
X int
Y int
Flags int

View File

@ -115,7 +115,7 @@ func (ds1 *DS1) loadObjects(br *d2common.StreamReader) {
for objIdx := 0; objIdx < int(numberOfObjects); objIdx++ {
newObject := d2data.Object{}
newObject.Type = int(br.GetInt32())
newObject.Id = int(br.GetInt32())
newObject.ID = int(br.GetInt32())
newObject.X = int(br.GetInt32())
newObject.Y = int(br.GetInt32())
newObject.Flags = int(br.GetInt32())

View File

@ -127,7 +127,7 @@ func (mr *Stamp) Entities(tileOffsetX, tileOffsetY int) []d2interface.MapEntity
for _, object := range mr.ds1.Objects {
if object.Type == int(d2enum.ObjectTypeCharacter) {
monstat := d2datadict.MonStats[d2datadict.MonPresets[mr.ds1.Act][object.Id]]
monstat := d2datadict.MonStats[d2datadict.MonPresets[mr.ds1.Act][object.ID]]
// If monstat is nil here it is a place_ type object, idk how to handle those yet.
// (See monpreset and monplace txts for reference)
if monstat != nil {
@ -145,7 +145,7 @@ func (mr *Stamp) Entities(tileOffsetX, tileOffsetY int) []d2interface.MapEntity
if object.Type == int(d2enum.ObjectTypeItem) {
// For objects the DS1 ID to objectID is hardcoded in the game
// use the lookup table
lookup := d2datadict.LookupObject(int(mr.ds1.Act), object.Type, object.Id)
lookup := d2datadict.LookupObject(int(mr.ds1.Act), object.Type, object.ID)
if lookup == nil {
continue

View File

@ -250,7 +250,7 @@ func TestStat_InitMockData(t *testing.T) {
}
var monStats = map[string]*d2datadict.MonStatsRecord{
"Specter": {NameString: "Specter", Id: 40},
"Specter": {NameString: "Specter", ID: 40},
}
d2datadict.ItemStatCosts = itemStatCosts

View File

@ -74,7 +74,7 @@ func stringerSkillName(sv d2stats.StatValue) string {
func stringerMonsterName(sv d2stats.StatValue) string {
for key := range d2datadict.MonStats {
if d2datadict.MonStats[key].Id == sv.Int() {
if d2datadict.MonStats[key].ID == sv.Int() {
return d2datadict.MonStats[key].NameString
}
}