From ab7d19197ed46867c8739c35d151c668cf378b1e Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Tue, 5 Nov 2019 19:46:52 -0600 Subject: [PATCH] run `goimports` to format all Go source files of the project (#88) Actual command run: find . -type f -name '*.go' | xargs -I '{}' goimports -w '{}' --- Common/LevelPresets.go | 42 ++--- Common/Missiles.go | 334 +++++++++++++++++++------------------- Common/Objects.go | 226 +++++++++++++------------- Common/Weapons.go | 354 ++++++++++++++++++++--------------------- 4 files changed, 477 insertions(+), 479 deletions(-) diff --git a/Common/LevelPresets.go b/Common/LevelPresets.go index 34bd0b78..58eeb3f4 100644 --- a/Common/LevelPresets.go +++ b/Common/LevelPresets.go @@ -8,7 +8,7 @@ import ( ) type LevelPresetRecord struct { - Name string + Name string DefinitionId int LevelId int Populate bool @@ -26,7 +26,7 @@ type LevelPresetRecord struct { FileCount int Files [6]string Dt1Mask uint - Beta bool + Beta bool Expansion bool } @@ -38,22 +38,22 @@ func createLevelPresetRecord(props []string) LevelPresetRecord { return i } result := LevelPresetRecord{ - Name: props[inc()], + Name: props[inc()], DefinitionId: StringToInt(props[inc()]), - LevelId: StringToInt(props[inc()]), - Populate: StringToUint8(props[inc()]) == 1, - Logicals: StringToUint8(props[inc()]) == 1, - Outdoors: StringToUint8(props[inc()]) == 1, - Animate: StringToUint8(props[inc()]) == 1, - KillEdge: StringToUint8(props[inc()]) == 1, - FillBlanks: StringToUint8(props[inc()]) == 1, - SizeX: StringToInt(props[inc()]), - SizeY: StringToInt(props[inc()]), - AutoMap: StringToUint8(props[inc()]) == 1, - Scan: StringToUint8(props[inc()]) == 1, - Pops: StringToInt(props[inc()]), - PopPad: StringToInt(props[inc()]), - FileCount: StringToInt(props[inc()]), + LevelId: StringToInt(props[inc()]), + Populate: StringToUint8(props[inc()]) == 1, + Logicals: StringToUint8(props[inc()]) == 1, + Outdoors: StringToUint8(props[inc()]) == 1, + Animate: StringToUint8(props[inc()]) == 1, + KillEdge: StringToUint8(props[inc()]) == 1, + FillBlanks: StringToUint8(props[inc()]) == 1, + SizeX: StringToInt(props[inc()]), + SizeY: StringToInt(props[inc()]), + AutoMap: StringToUint8(props[inc()]) == 1, + Scan: StringToUint8(props[inc()]) == 1, + Pops: StringToInt(props[inc()]), + PopPad: StringToInt(props[inc()]), + FileCount: StringToInt(props[inc()]), Files: [6]string{ props[inc()], props[inc()], @@ -62,8 +62,8 @@ func createLevelPresetRecord(props []string) LevelPresetRecord { props[inc()], props[inc()], }, - Dt1Mask: StringToUint(props[inc()]), - Beta: StringToUint8(props[inc()]) == 1, + Dt1Mask: StringToUint(props[inc()]), + Beta: StringToUint8(props[inc()]) == 1, Expansion: StringToUint8(props[inc()]) == 1, } return result @@ -79,11 +79,11 @@ func LoadLevelPresets(fileProvider FileProvider) { continue } props := strings.Split(line, "\t") - if(props[1] == "") { + if props[1] == "" { continue // any line without a definition id is skipped (e.g. the "Expansion" line) } rec := createLevelPresetRecord(props) LevelPresets[rec.DefinitionId] = &rec } log.Printf("Loaded %d level presets", len(LevelPresets)) -} \ No newline at end of file +} diff --git a/Common/Missiles.go b/Common/Missiles.go index 8043d353..24db3e1b 100644 --- a/Common/Missiles.go +++ b/Common/Missiles.go @@ -34,16 +34,16 @@ type MissileAnimation struct { AnimationRate int // seems to do nothing AnimationLength int AnimationSpeed int - StartingFrame int // called "RandFrame" + StartingFrame int // called "RandFrame" HasSubLoop bool // runs after first animation ends SubStartingFrame int SubEndingFrame int } type MissileCollision struct { - CollisionType int // controls the kind of collision - // 0 = none, 1 = units only, 3 = normal (units, walls), - // 6 = walls only, 8 = walls, units, and floors + CollisionType int // controls the kind of collision + // 0 = none, 1 = units only, 3 = normal (units, walls), + // 6 = walls only, 8 = walls, units, and floors DestroyedUponCollision bool FriendlyFire bool LastCollide bool // unknown @@ -51,141 +51,141 @@ type MissileCollision struct { ClientCollision bool // unknown ClientSend bool // unclear UseCollisionTimer bool // after hit, use timer before dying - TimerFrames int // how many frames to persist + TimerFrames int // how many frames to persist } type MissileDamage struct { - MinDamage int - MaxDamage int - MinLevelDamage [5]int // additional damage per missile level + MinDamage int + MaxDamage int + MinLevelDamage [5]int // additional damage per missile level // [0]: lvs 2-8, [1]: lvs 9-16, [2]: lvs 17-22, [3]: lvs 23-28, [4]: lv 29+ - MaxLevelDamage [5]int // see above - DamageSynergyPerCalc string // works like synergy in skills.txt, not clear + MaxLevelDamage [5]int // see above + DamageSynergyPerCalc string // works like synergy in skills.txt, not clear } type MissileElementalDamage struct { Damage MissileDamage ElementType string - Duration int // frames, 25 = 1 second + Duration int // frames, 25 = 1 second LevelDuration [3]int // 0,1,2, unknown level intervals, bonus duration per level } type MissileRecord struct { - Name string - Id int + Name string + Id int - ClientMovementFunc int - ClientCollisionFunc int - ServerMovementFunc int - ServerCollisionFunc int - ServerDamageFunc int - ServerMovementCalc MissileCalc - ClientMovementCalc MissileCalc - ServerCollisionCalc MissileCalc - ClientCollisionCalc MissileCalc - ServerDamageCalc MissileCalc + ClientMovementFunc int + ClientCollisionFunc int + ServerMovementFunc int + ServerCollisionFunc int + ServerDamageFunc int + ServerMovementCalc MissileCalc + ClientMovementCalc MissileCalc + ServerCollisionCalc MissileCalc + ClientCollisionCalc MissileCalc + ServerDamageCalc MissileCalc - Velocity int - MaxVelocity int - LevelVelocityBonus int - Accel int - Range int - LevelRangeBonus int + Velocity int + MaxVelocity int + LevelVelocityBonus int + Accel int + Range int + LevelRangeBonus int - Light MissileLight + Light MissileLight - Animation MissileAnimation + Animation MissileAnimation - Collision MissileCollision + Collision MissileCollision - XOffset int - YOffset int - ZOffset int - Size int // diameter + XOffset int + YOffset int + ZOffset int + Size int // diameter - DestroyedByTP bool // if true, destroyed when source player teleports to town - DestroyedByTPFrame int // see above, for client side, (this is a guess) which frame it vanishes on - CanDestroy bool // unknown + DestroyedByTP bool // if true, destroyed when source player teleports to town + DestroyedByTPFrame int // see above, for client side, (this is a guess) which frame it vanishes on + CanDestroy bool // unknown - UseAttackRating bool // if true, uses 'attack rating' to determine if it hits or misses + UseAttackRating bool // if true, uses 'attack rating' to determine if it hits or misses // if false, has a 95% chance to hit. - AlwaysExplode bool // if true, always calls its collision function when it is destroyed, even if it doesn't hit anything + AlwaysExplode bool // if true, always calls its collision function when it is destroyed, even if it doesn't hit anything // note that some collision functions (lightning fury) seem to ignore this and always explode regardless of setting (requires investigation) - ClientExplosion bool // if true, does not really exist + ClientExplosion bool // if true, does not really exist // is only aesthetic / client side - TownSafe bool // if true, doesn't vanish when spawned in town + TownSafe bool // if true, doesn't vanish when spawned in town // if false, vanishes when spawned in town - IgnoreBossModifiers bool // if true, doesn't get bonuses from boss mods - IgnoreMultishot bool // if true, can't gain the mulitshot modifier - HolyFilterType int // specifies what this missile can hit + IgnoreBossModifiers bool // if true, doesn't get bonuses from boss mods + IgnoreMultishot bool // if true, can't gain the mulitshot modifier + HolyFilterType int // specifies what this missile can hit // 0 = all units, 1 = undead only, 2 = demons only, 3 = all units (again?) - CanBeSlowed bool // if true, is affected by skill_handofathena - TriggersHitEvents bool // if true, triggers events that happen "upon getting hit" on targets - TriggersGetHit bool // if true, can cause target to enter hit recovery mode - SoftHit bool // unknown - KnockbackPercent int // chance of knocking the target back, 0-100 + CanBeSlowed bool // if true, is affected by skill_handofathena + TriggersHitEvents bool // if true, triggers events that happen "upon getting hit" on targets + TriggersGetHit bool // if true, can cause target to enter hit recovery mode + SoftHit bool // unknown + KnockbackPercent int // chance of knocking the target back, 0-100 - TransparencyMode int // controls rendering + TransparencyMode int // controls rendering // 0 = normal, 1 = alpha blending (darker = more transparent) // 2 = special (black and white?) - UseQuantity bool // if true, uses quantity + UseQuantity bool // if true, uses quantity // not clear what this means. Also apparently requires a special starting function in skills.txt - AffectedByPierce bool // if true, affected by the pierce modifier and the Pierce skill - SpecialSetup bool // unknown, only true for potions + AffectedByPierce bool // if true, affected by the pierce modifier and the Pierce skill + SpecialSetup bool // unknown, only true for potions - MissileSkill bool // if true, applies elemental damage from items to the splash radius instead of normal damage modifiers - SkillName string // if not empty, the missile will refer to this skill instead of its own data for the following: + MissileSkill bool // if true, applies elemental damage from items to the splash radius instead of normal damage modifiers + SkillName string // if not empty, the missile will refer to this skill instead of its own data for the following: // "ResultFlags, HitFlags, HitShift, HitClass, SrcDamage (SrcDam in skills.txt!), // MinDam, MinLevDam1-5, MaxDam, MaxLevDam1-5, DmgSymPerCalc, EType, EMin, EMinLev1-5, // EMax, EMaxLev1-5, EDmgSymPerCalc, ELen, ELenLev1-3, ELenSymPerCalc" - - ResultFlags int // unknown + + ResultFlags int // unknown // 4 = normal missiles, 5 = explosions, 8 = non-damaging missiles - HitFlags int // unknown + HitFlags int // unknown // 2 = explosions, 5 = freezing arrow - HitShift int // damage is measured in 256s + HitShift int // damage is measured in 256s // the actual damage is [damage] * 2 ^ [hitshift] // e.g. 100 damage, 8 hitshift = 100 * 2 ^ 8 = 100 * 256 = 25600 // (visually, the damage is this result / 256) - ApplyMastery bool // unknown - SourceDamage int // 0-128, 128 is 100% + ApplyMastery bool // unknown + SourceDamage int // 0-128, 128 is 100% // percentage of source units attack properties to apply to the missile? // not only affects damage but also other modifiers like lifesteal and manasteal (need a complete list) // setting this to -1 "gets rid of SrcDmg from skills.txt", not clear what that means HalfDamageForTwoHander bool // if true, damage is halved when a two-handed weapon is used - SourceMissDamage int // 0-128, 128 is 100% + SourceMissDamage int // 0-128, 128 is 100% // unknown, only used for poison clouds. - Damage MissileDamage - ElementalDamage MissileElementalDamage + Damage MissileDamage + ElementalDamage MissileElementalDamage - HitClass int // controls clientside aesthetic effects for collisions + HitClass int // controls clientside aesthetic effects for collisions // particularly sound effects that are played on a hit - NumDirections int // count of dirs in the DCC loaded by CelFile + NumDirections int // count of dirs in the DCC loaded by CelFile // apparently this value is no longer needed in D2 - LocalBlood int // blood effects? + LocalBlood int // blood effects? // 0 = no blood, 1 = blood, 2 = blood and affected by open wounds - DamageReductionRate int // how many frames between applications of the + DamageReductionRate int // how many frames between applications of the // magic_damage_reduced stat, so for instance on a 0 this stat applies every frame // on a 3, only every 4th frame has damage reduced - TravelSound string // name of sound to play during lifetime + TravelSound string // name of sound to play during lifetime // whether or not it loops depends on the specific sound's settings? // if it doesn't loop, it's just a on-spawn sound effect - HitSound string // sound plays upon collision - ProgSound string // plays at "special events", like a mariachi band + HitSound string // sound plays upon collision + ProgSound string // plays at "special events", like a mariachi band - ProgOverlay string // name of an overlay from overlays.txt to use at special events - ExplosionMissile string // name of a missile from missiles.txt that is created upon collision + ProgOverlay string // name of an overlay from overlays.txt to use at special events + ExplosionMissile string // name of a missile from missiles.txt that is created upon collision // or anytime it is destroyed if AlwaysExplode is true - SubMissile [3]string // 0,1,2 name of missiles spawned by movement function - HitSubMissile [4]string // 0,1,2 name of missiles spawned by collision function - ClientSubMissile [3]string // see above, but for client only - ClientHitSubMissile [4]string // see above, but for client only + SubMissile [3]string // 0,1,2 name of missiles spawned by movement function + HitSubMissile [4]string // 0,1,2 name of missiles spawned by collision function + ClientSubMissile [3]string // see above, but for client only + ClientHitSubMissile [4]string // see above, but for client only } func createMissileRecord(line string) MissileRecord { @@ -199,26 +199,26 @@ func createMissileRecord(line string) MissileRecord { // be wrapped in an EmptyToZero transform result := MissileRecord{ Name: r[inc()], - Id: StringToInt(EmptyToZero(r[inc()])), + Id: StringToInt(EmptyToZero(r[inc()])), - ClientMovementFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + ClientMovementFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), ClientCollisionFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - ServerMovementFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + ServerMovementFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), ServerCollisionFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - ServerDamageFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + ServerDamageFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - ServerMovementCalc: loadMissileCalc(&r, inc, 5), - ClientMovementCalc: loadMissileCalc(&r, inc, 5), + ServerMovementCalc: loadMissileCalc(&r, inc, 5), + ClientMovementCalc: loadMissileCalc(&r, inc, 5), ServerCollisionCalc: loadMissileCalc(&r, inc, 3), ClientCollisionCalc: loadMissileCalc(&r, inc, 3), - ServerDamageCalc: loadMissileCalc(&r, inc, 2), - - Velocity: StringToInt(EmptyToZero(r[inc()])), - MaxVelocity: StringToInt(EmptyToZero(r[inc()])), + ServerDamageCalc: loadMissileCalc(&r, inc, 2), + + Velocity: StringToInt(EmptyToZero(r[inc()])), + MaxVelocity: StringToInt(EmptyToZero(r[inc()])), LevelVelocityBonus: StringToInt(EmptyToZero(r[inc()])), - Accel: StringToInt(EmptyToZero(r[inc()])), - Range: StringToInt(EmptyToZero(r[inc()])), - LevelRangeBonus: StringToInt(EmptyToZero(r[inc()])), + Accel: StringToInt(EmptyToZero(r[inc()])), + Range: StringToInt(EmptyToZero(r[inc()])), + LevelRangeBonus: StringToInt(EmptyToZero(r[inc()])), Light: loadMissileLight(&r, inc), @@ -229,61 +229,61 @@ func createMissileRecord(line string) MissileRecord { XOffset: StringToInt(EmptyToZero(r[inc()])), YOffset: StringToInt(EmptyToZero(r[inc()])), ZOffset: StringToInt(EmptyToZero(r[inc()])), - Size: StringToInt(EmptyToZero(r[inc()])), + Size: StringToInt(EmptyToZero(r[inc()])), - DestroyedByTP: StringToInt(EmptyToZero(r[inc()])) == 1, + DestroyedByTP: StringToInt(EmptyToZero(r[inc()])) == 1, DestroyedByTPFrame: StringToInt(EmptyToZero(r[inc()])), - CanDestroy: StringToInt(EmptyToZero(r[inc()])) == 1, + CanDestroy: StringToInt(EmptyToZero(r[inc()])) == 1, UseAttackRating: StringToInt(EmptyToZero(r[inc()])) == 1, - AlwaysExplode: StringToInt(EmptyToZero(r[inc()])) == 1, + AlwaysExplode: StringToInt(EmptyToZero(r[inc()])) == 1, - ClientExplosion: StringToInt(EmptyToZero(r[inc()])) == 1, - TownSafe: StringToInt(EmptyToZero(r[inc()])) == 1, + ClientExplosion: StringToInt(EmptyToZero(r[inc()])) == 1, + TownSafe: StringToInt(EmptyToZero(r[inc()])) == 1, IgnoreBossModifiers: StringToInt(EmptyToZero(r[inc()])) == 1, - IgnoreMultishot: StringToInt(EmptyToZero(r[inc()])) == 1, - HolyFilterType: StringToInt(EmptyToZero(r[inc()])), - CanBeSlowed: StringToInt(EmptyToZero(r[inc()])) == 1, - TriggersHitEvents: StringToInt(EmptyToZero(r[inc()])) == 1, - TriggersGetHit: StringToInt(EmptyToZero(r[inc()])) == 1, - SoftHit: StringToInt(EmptyToZero(r[inc()])) == 1, - KnockbackPercent: StringToInt(EmptyToZero(r[inc()])), + IgnoreMultishot: StringToInt(EmptyToZero(r[inc()])) == 1, + HolyFilterType: StringToInt(EmptyToZero(r[inc()])), + CanBeSlowed: StringToInt(EmptyToZero(r[inc()])) == 1, + TriggersHitEvents: StringToInt(EmptyToZero(r[inc()])) == 1, + TriggersGetHit: StringToInt(EmptyToZero(r[inc()])) == 1, + SoftHit: StringToInt(EmptyToZero(r[inc()])) == 1, + KnockbackPercent: StringToInt(EmptyToZero(r[inc()])), TransparencyMode: StringToInt(EmptyToZero(r[inc()])), - UseQuantity: StringToInt(EmptyToZero(r[inc()])) == 1, + UseQuantity: StringToInt(EmptyToZero(r[inc()])) == 1, AffectedByPierce: StringToInt(EmptyToZero(r[inc()])) == 1, - SpecialSetup: StringToInt(EmptyToZero(r[inc()])) == 1, + SpecialSetup: StringToInt(EmptyToZero(r[inc()])) == 1, MissileSkill: StringToInt(EmptyToZero(r[inc()])) == 1, - SkillName: r[inc()], + SkillName: r[inc()], ResultFlags: StringToInt(EmptyToZero(r[inc()])), - HitFlags: StringToInt(EmptyToZero(r[inc()])), + HitFlags: StringToInt(EmptyToZero(r[inc()])), - HitShift: StringToInt(EmptyToZero(r[inc()])), - ApplyMastery: StringToInt(EmptyToZero(r[inc()])) == 1, - SourceDamage: StringToInt(EmptyToZero(r[inc()])), + HitShift: StringToInt(EmptyToZero(r[inc()])), + ApplyMastery: StringToInt(EmptyToZero(r[inc()])) == 1, + SourceDamage: StringToInt(EmptyToZero(r[inc()])), HalfDamageForTwoHander: StringToInt(EmptyToZero(r[inc()])) == 1, - SourceMissDamage: StringToInt(EmptyToZero(r[inc()])), + SourceMissDamage: StringToInt(EmptyToZero(r[inc()])), - Damage: loadMissileDamage(&r, inc), + Damage: loadMissileDamage(&r, inc), ElementalDamage: loadMissileElementalDamage(&r, inc), - HitClass: StringToInt(EmptyToZero(r[inc()])), - NumDirections: StringToInt(EmptyToZero(r[inc()])), - LocalBlood: StringToInt(EmptyToZero(r[inc()])), + HitClass: StringToInt(EmptyToZero(r[inc()])), + NumDirections: StringToInt(EmptyToZero(r[inc()])), + LocalBlood: StringToInt(EmptyToZero(r[inc()])), DamageReductionRate: StringToInt(EmptyToZero(r[inc()])), - TravelSound: r[inc()], - HitSound: r[inc()], - ProgSound: r[inc()], - ProgOverlay: r[inc()], + TravelSound: r[inc()], + HitSound: r[inc()], + ProgSound: r[inc()], + ProgOverlay: r[inc()], ExplosionMissile: r[inc()], - SubMissile: [3]string{r[inc()], r[inc()], r[inc()]}, - HitSubMissile: [4]string{r[inc()], r[inc()], r[inc()], r[inc()]}, - ClientSubMissile: [3]string{r[inc()], r[inc()], r[inc()]}, + SubMissile: [3]string{r[inc()], r[inc()], r[inc()]}, + HitSubMissile: [4]string{r[inc()], r[inc()], r[inc()], r[inc()]}, + ClientSubMissile: [3]string{r[inc()], r[inc()], r[inc()]}, ClientHitSubMissile: [4]string{r[inc()], r[inc()], r[inc()], r[inc()]}, } return result @@ -307,7 +307,7 @@ func LoadMissiles(fileProvider FileProvider) { func loadMissileCalcParam(r *[]string, inc func() int) MissileCalcParam { result := MissileCalcParam{ Param: StringToInt(EmptyToZero((*r)[inc()])), - Desc: (*r)[inc()], + Desc: (*r)[inc()], } return result } @@ -319,7 +319,7 @@ func loadMissileCalc(r *[]string, inc func() int, params int) MissileCalc { } result.Params = make([]MissileCalcParam, params) for p := 0; p < params; p++ { - result.Params[p] = loadMissileCalcParam(r, inc); + result.Params[p] = loadMissileCalcParam(r, inc) } return result } @@ -327,10 +327,10 @@ func loadMissileCalc(r *[]string, inc func() int, params int) MissileCalc { func loadMissileLight(r *[]string, inc func() int) MissileLight { result := MissileLight{ Diameter: StringToInt(EmptyToZero((*r)[inc()])), - Flicker: StringToInt(EmptyToZero((*r)[inc()])), - Red: StringToUint8(EmptyToZero((*r)[inc()])), - Green: StringToUint8(EmptyToZero((*r)[inc()])), - Blue: StringToUint8(EmptyToZero((*r)[inc()])), + Flicker: StringToInt(EmptyToZero((*r)[inc()])), + Red: StringToUint8(EmptyToZero((*r)[inc()])), + Green: StringToUint8(EmptyToZero((*r)[inc()])), + Blue: StringToUint8(EmptyToZero((*r)[inc()])), } return result } @@ -338,54 +338,54 @@ func loadMissileLight(r *[]string, inc func() int) MissileLight { func loadMissileAnimation(r *[]string, inc func() int) MissileAnimation { result := MissileAnimation{ StepsBeforeVisible: StringToInt(EmptyToZero((*r)[inc()])), - StepsBeforeActive: StringToInt(EmptyToZero((*r)[inc()])), - LoopAnimation: StringToInt(EmptyToZero((*r)[inc()])) == 1, - CelFileName: (*r)[inc()], - AnimationRate: StringToInt(EmptyToZero((*r)[inc()])), - AnimationLength: StringToInt(EmptyToZero((*r)[inc()])), - AnimationSpeed: StringToInt(EmptyToZero((*r)[inc()])), - StartingFrame: StringToInt(EmptyToZero((*r)[inc()])), - HasSubLoop: StringToInt(EmptyToZero((*r)[inc()])) == 1, - SubStartingFrame: StringToInt(EmptyToZero((*r)[inc()])), - SubEndingFrame: StringToInt(EmptyToZero((*r)[inc()])), + StepsBeforeActive: StringToInt(EmptyToZero((*r)[inc()])), + LoopAnimation: StringToInt(EmptyToZero((*r)[inc()])) == 1, + CelFileName: (*r)[inc()], + AnimationRate: StringToInt(EmptyToZero((*r)[inc()])), + AnimationLength: StringToInt(EmptyToZero((*r)[inc()])), + AnimationSpeed: StringToInt(EmptyToZero((*r)[inc()])), + StartingFrame: StringToInt(EmptyToZero((*r)[inc()])), + HasSubLoop: StringToInt(EmptyToZero((*r)[inc()])) == 1, + SubStartingFrame: StringToInt(EmptyToZero((*r)[inc()])), + SubEndingFrame: StringToInt(EmptyToZero((*r)[inc()])), } return result } func loadMissileCollision(r *[]string, inc func() int) MissileCollision { result := MissileCollision{ - CollisionType: StringToInt(EmptyToZero((*r)[inc()])), + CollisionType: StringToInt(EmptyToZero((*r)[inc()])), DestroyedUponCollision: StringToInt(EmptyToZero((*r)[inc()])) == 1, - FriendlyFire: StringToInt(EmptyToZero((*r)[inc()])) == 1, - LastCollide: StringToInt(EmptyToZero((*r)[inc()])) == 1, - Collision: StringToInt(EmptyToZero((*r)[inc()])) == 1, - ClientCollision: StringToInt(EmptyToZero((*r)[inc()])) == 1, - ClientSend: StringToInt(EmptyToZero((*r)[inc()])) == 1, - UseCollisionTimer: StringToInt(EmptyToZero((*r)[inc()])) == 1, - TimerFrames: StringToInt(EmptyToZero((*r)[inc()])), + FriendlyFire: StringToInt(EmptyToZero((*r)[inc()])) == 1, + LastCollide: StringToInt(EmptyToZero((*r)[inc()])) == 1, + Collision: StringToInt(EmptyToZero((*r)[inc()])) == 1, + ClientCollision: StringToInt(EmptyToZero((*r)[inc()])) == 1, + ClientSend: StringToInt(EmptyToZero((*r)[inc()])) == 1, + UseCollisionTimer: StringToInt(EmptyToZero((*r)[inc()])) == 1, + TimerFrames: StringToInt(EmptyToZero((*r)[inc()])), } return result } func loadMissileDamage(r *[]string, inc func() int) MissileDamage { result := MissileDamage{ - MinDamage: StringToInt(EmptyToZero((*r)[inc()])), + MinDamage: StringToInt(EmptyToZero((*r)[inc()])), MinLevelDamage: [5]int{ - StringToInt(EmptyToZero((*r)[inc()])), - StringToInt(EmptyToZero((*r)[inc()])), - StringToInt(EmptyToZero((*r)[inc()])), - StringToInt(EmptyToZero((*r)[inc()])), - StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), }, - MaxDamage: StringToInt(EmptyToZero((*r)[inc()])), + MaxDamage: StringToInt(EmptyToZero((*r)[inc()])), MaxLevelDamage: [5]int{ - StringToInt(EmptyToZero((*r)[inc()])), - StringToInt(EmptyToZero((*r)[inc()])), - StringToInt(EmptyToZero((*r)[inc()])), - StringToInt(EmptyToZero((*r)[inc()])), - StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), }, - DamageSynergyPerCalc: (*r)[inc()], + DamageSynergyPerCalc: (*r)[inc()], } return result } @@ -393,13 +393,13 @@ func loadMissileDamage(r *[]string, inc func() int) MissileDamage { func loadMissileElementalDamage(r *[]string, inc func() int) MissileElementalDamage { result := MissileElementalDamage{ ElementType: (*r)[inc()], - Damage: loadMissileDamage(r, inc), - Duration: StringToInt(EmptyToZero((*r)[inc()])), + Damage: loadMissileDamage(r, inc), + Duration: StringToInt(EmptyToZero((*r)[inc()])), LevelDuration: [3]int{ - StringToInt(EmptyToZero((*r)[inc()])), - StringToInt(EmptyToZero((*r)[inc()])), - StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), + StringToInt(EmptyToZero((*r)[inc()])), }, } return result -} \ No newline at end of file +} diff --git a/Common/Objects.go b/Common/Objects.go index 0d4034fe..7eb1c25d 100644 --- a/Common/Objects.go +++ b/Common/Objects.go @@ -9,14 +9,14 @@ import ( // An ObjectRecord represents the settings for one type of object from objects.txt type ObjectRecord struct { - Name string + Name string Description string - Id int - Token string // refers to what graphics this object uses + Id int + Token string // refers to what graphics this object uses - SpawnMax int // unused? - Selectable [8]bool // is this mode selectable - TrapProbability int // unused + SpawnMax int // unused? + Selectable [8]bool // is this mode selectable + TrapProbability int // unused SizeX int SizeY int @@ -26,32 +26,32 @@ type ObjectRecord struct { NTgtBX int // unknown NTgtBY int // unknown - FrameCount [8]int // how many frames does this mode have, 0 = skip - FrameDelta [8]int // what rate is the animation played at (256 = 100% speed) + FrameCount [8]int // how many frames does this mode have, 0 = skip + FrameDelta [8]int // what rate is the animation played at (256 = 100% speed) CycleAnimation [8]bool // probably whether animation loops - LightDiameter [8]int - BlocksLight [8]bool - HasCollision [8]bool - IsAttackable bool // do we kick it when interacting - StartFrame [8]int + LightDiameter [8]int + BlocksLight [8]bool + HasCollision [8]bool + IsAttackable bool // do we kick it when interacting + StartFrame [8]int - EnvEffect bool // unknown - IsDoor bool + EnvEffect bool // unknown + IsDoor bool BlockVisibility bool // only works with IsDoor - Orientation int // unknown (1=sw, 2=nw, 3=se, 4=ne) - Trans int // controls palette mapping + Orientation int // unknown (1=sw, 2=nw, 3=se, 4=ne) + Trans int // controls palette mapping - OrderFlag [8]int // 0 = object, 1 = floor, 2 = wall - PreOperate bool // unknown + OrderFlag [8]int // 0 = object, 1 = floor, 2 = wall + PreOperate bool // unknown HasAnimationMode [8]bool // 'Mode' in source, true if this mode is used XOffset int // in pixels offset YOffset int - Draw bool // if false, object isn't drawn (shadow is still drawn and player can still select though) + Draw bool // if false, object isn't drawn (shadow is still drawn and player can still select though) - LightRed byte // if lightdiameter is set, rgb of the light + LightRed byte // if lightdiameter is set, rgb of the light LightGreen byte - LightBlue byte + LightBlue byte SelHD bool // whether these DCC components are selectable SelTR bool @@ -61,10 +61,10 @@ type ObjectRecord struct { SelRH bool SelLH bool SelSH bool - SelS [8]bool + SelS [8]bool TotalPieces int // selectable DCC components count - SubClass int // subclass of object: + SubClass int // subclass of object: // 1 = shrine // 2 = obelisk // 4 = portal @@ -79,25 +79,25 @@ type ObjectRecord struct { NameOffset int // pixels to offset the name from the animation pivot - MonsterOk bool // unknown - OperateRange int // distance object can be used from, might be unused - ShrineFunction int // unused - Restore bool // if true, object is stored in memory and will be retained if you leave and re-enter the area - - Parm [8]int // unknown - Act int // what acts this object can appear in (15 = all three) - Lockable bool - Gore bool // unknown, something with corpses - Sync bool // unknown - Flicker bool // light flickers if true - Damage int // amount of damage done by this (used depending on operatefn) - Beta bool // if true, appeared in the beta? - Overlay bool // unknown + MonsterOk bool // unknown + OperateRange int // distance object can be used from, might be unused + ShrineFunction int // unused + Restore bool // if true, object is stored in memory and will be retained if you leave and re-enter the area + + Parm [8]int // unknown + Act int // what acts this object can appear in (15 = all three) + Lockable bool + Gore bool // unknown, something with corpses + Sync bool // unknown + Flicker bool // light flickers if true + Damage int // amount of damage done by this (used depending on operatefn) + Beta bool // if true, appeared in the beta? + Overlay bool // unknown CollisionSubst bool // unknown, controls some kind of special collision checking? - Left int // unknown, clickable bounding box? - Top int - Width int + Left int // unknown, clickable bounding box? + Top int + Width int Height int OperateFn int // what function is called when the player clicks on the object @@ -111,9 +111,9 @@ type ObjectRecord struct { // (see above todo) RestoreVirgins bool // if true, only restores unused objects (see Restore) - BlockMissile bool // if true, missiles collide with this - DrawUnder bool // if true, drawn as a floor tile is - OpenWarp bool // needs clarification, controls whether highlighting shows + BlockMissile bool // if true, missiles collide with this + DrawUnder bool // if true, drawn as a floor tile is + OpenWarp bool // needs clarification, controls whether highlighting shows // 'To ...' or 'trap door' when highlighting, not sure which is T/F AutoMap int // controls how this object appears on the map // 0 = it doesn't, rest of modes need to be analyzed @@ -127,12 +127,12 @@ func createObjectRecord(props []string) ObjectRecord { return i } result := ObjectRecord{ - Name: props[inc()], + Name: props[inc()], Description: props[inc()], - Id: StringToInt(props[inc()]), - Token: props[inc()], - - SpawnMax: StringToInt(props[inc()]), + Id: StringToInt(props[inc()]), + Token: props[inc()], + + SpawnMax: StringToInt(props[inc()]), Selectable: [8]bool{ StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1, @@ -143,16 +143,16 @@ func createObjectRecord(props []string) ObjectRecord { StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1, }, - TrapProbability: StringToInt(props[inc()]), - + TrapProbability: StringToInt(props[inc()]), + SizeX: StringToInt(props[inc()]), SizeY: StringToInt(props[inc()]), - - NTgtFX: StringToInt(props[inc()]), - NTgtFY: StringToInt(props[inc()]), - NTgtBX: StringToInt(props[inc()]), - NTgtBY: StringToInt(props[inc()]), - + + NTgtFX: StringToInt(props[inc()]), + NTgtFY: StringToInt(props[inc()]), + NTgtBX: StringToInt(props[inc()]), + NTgtBY: StringToInt(props[inc()]), + FrameCount: [8]int{ StringToInt(props[inc()]), StringToInt(props[inc()]), @@ -213,7 +213,7 @@ func createObjectRecord(props []string) ObjectRecord { StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1, }, - IsAttackable: StringToUint8(props[inc()]) == 1, + IsAttackable: StringToUint8(props[inc()]) == 1, StartFrame: [8]int{ StringToInt(props[inc()]), StringToInt(props[inc()]), @@ -224,13 +224,13 @@ func createObjectRecord(props []string) ObjectRecord { StringToInt(props[inc()]), StringToInt(props[inc()]), }, - - EnvEffect: StringToUint8(props[inc()]) == 1, - IsDoor: StringToUint8(props[inc()]) == 1, - BlockVisibility: StringToUint8(props[inc()]) == 1, - Orientation: StringToInt(props[inc()]), - Trans: StringToInt(props[inc()]), - + + EnvEffect: StringToUint8(props[inc()]) == 1, + IsDoor: StringToUint8(props[inc()]) == 1, + BlockVisibility: StringToUint8(props[inc()]) == 1, + Orientation: StringToInt(props[inc()]), + Trans: StringToInt(props[inc()]), + OrderFlag: [8]int{ StringToInt(props[inc()]), StringToInt(props[inc()]), @@ -241,7 +241,7 @@ func createObjectRecord(props []string) ObjectRecord { StringToInt(props[inc()]), StringToInt(props[inc()]), }, - PreOperate: StringToUint8(props[inc()]) == 1, + PreOperate: StringToUint8(props[inc()]) == 1, HasAnimationMode: [8]bool{ StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1, @@ -252,16 +252,16 @@ func createObjectRecord(props []string) ObjectRecord { StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1, }, - - XOffset: StringToInt(props[inc()]), + + XOffset: StringToInt(props[inc()]), YOffset: StringToInt(props[inc()]), - Draw: StringToUint8(props[inc()]) == 1, - - LightRed: StringToUint8(props[inc()]), + Draw: StringToUint8(props[inc()]) == 1, + + LightRed: StringToUint8(props[inc()]), LightGreen: StringToUint8(props[inc()]), - LightBlue: StringToUint8(props[inc()]), - - SelHD: StringToUint8(props[inc()]) == 1, + LightBlue: StringToUint8(props[inc()]), + + SelHD: StringToUint8(props[inc()]) == 1, SelTR: StringToUint8(props[inc()]) == 1, SelLG: StringToUint8(props[inc()]) == 1, SelRA: StringToUint8(props[inc()]) == 1, @@ -279,20 +279,20 @@ func createObjectRecord(props []string) ObjectRecord { StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1, }, - - TotalPieces: StringToInt(props[inc()]), - SubClass: StringToInt(props[inc()]), - - XSpace: StringToInt(props[inc()]), + + TotalPieces: StringToInt(props[inc()]), + SubClass: StringToInt(props[inc()]), + + XSpace: StringToInt(props[inc()]), YSpace: StringToInt(props[inc()]), - - NameOffset: StringToInt(props[inc()]), - - MonsterOk: StringToUint8(props[inc()]) == 1, - OperateRange: StringToInt(props[inc()]), - ShrineFunction: StringToInt(props[inc()]), - Restore: StringToUint8(props[inc()]) == 1, - + + NameOffset: StringToInt(props[inc()]), + + MonsterOk: StringToUint8(props[inc()]) == 1, + OperateRange: StringToInt(props[inc()]), + ShrineFunction: StringToInt(props[inc()]), + Restore: StringToUint8(props[inc()]) == 1, + Parm: [8]int{ StringToInt(props[inc()]), StringToInt(props[inc()]), @@ -303,32 +303,32 @@ func createObjectRecord(props []string) ObjectRecord { StringToInt(props[inc()]), StringToInt(props[inc()]), }, - Act: StringToInt(props[inc()]), - Lockable: StringToUint8(props[inc()]) == 1, - Gore: StringToUint8(props[inc()]) == 1, - Sync: StringToUint8(props[inc()]) == 1, - Flicker: StringToUint8(props[inc()]) == 1, - Damage: StringToInt(props[inc()]), - Beta: StringToUint8(props[inc()]) == 1, - Overlay: StringToUint8(props[inc()]) == 1, - CollisionSubst: StringToUint8(props[inc()]) == 1, - - Left: StringToInt(props[inc()]), - Top: StringToInt(props[inc()]), - Width: StringToInt(props[inc()]), + Act: StringToInt(props[inc()]), + Lockable: StringToUint8(props[inc()]) == 1, + Gore: StringToUint8(props[inc()]) == 1, + Sync: StringToUint8(props[inc()]) == 1, + Flicker: StringToUint8(props[inc()]) == 1, + Damage: StringToInt(props[inc()]), + Beta: StringToUint8(props[inc()]) == 1, + Overlay: StringToUint8(props[inc()]) == 1, + CollisionSubst: StringToUint8(props[inc()]) == 1, + + Left: StringToInt(props[inc()]), + Top: StringToInt(props[inc()]), + Width: StringToInt(props[inc()]), Height: StringToInt(props[inc()]), - - OperateFn: StringToInt(props[inc()]), - PopulateFn: StringToInt(props[inc()]), - InitFn: StringToInt(props[inc()]), - ClientFn: StringToInt(props[inc()]), - - RestoreVirgins: StringToUint8(props[inc()]) == 1, - BlockMissile: StringToUint8(props[inc()]) == 1, - DrawUnder: StringToUint8(props[inc()]) == 1, - OpenWarp: StringToUint8(props[inc()]) == 1, - - AutoMap: StringToInt(props[inc()]), + + OperateFn: StringToInt(props[inc()]), + PopulateFn: StringToInt(props[inc()]), + InitFn: StringToInt(props[inc()]), + ClientFn: StringToInt(props[inc()]), + + RestoreVirgins: StringToUint8(props[inc()]) == 1, + BlockMissile: StringToUint8(props[inc()]) == 1, + DrawUnder: StringToUint8(props[inc()]) == 1, + OpenWarp: StringToUint8(props[inc()]) == 1, + + AutoMap: StringToInt(props[inc()]), } return result } @@ -350,4 +350,4 @@ func LoadObjects(fileProvider FileProvider) { Objects[rec.Id] = &rec } log.Printf("Loaded %d objects", len(Objects)) -} \ No newline at end of file +} diff --git a/Common/Weapons.go b/Common/Weapons.go index a9290d68..6d383116 100644 --- a/Common/Weapons.go +++ b/Common/Weapons.go @@ -10,112 +10,112 @@ import ( type WeaponRecord struct { Name string - Type string // base type in ItemTypes.txt - Type2 string - Code string // identifies the item + Type string // base type in ItemTypes.txt + Type2 string + Code string // identifies the item AlternateGfx string // code of the DCC used when equipped - NameString string // seems to be identical to code? - Version int // 0 = classic, 100 = expansion - CompactSave bool // if true, doesn't store any stats upon saving - Rarity int // higher, the rarer - Spawnable bool // if 0, cannot spawn in shops + NameString string // seems to be identical to code? + Version int // 0 = classic, 100 = expansion + CompactSave bool // if true, doesn't store any stats upon saving + Rarity int // higher, the rarer + Spawnable bool // if 0, cannot spawn in shops - MinDamage int - MaxDamage int + MinDamage int + MaxDamage int BarbOneOrTwoHanded bool // if true, barb can wield this in one or two hands - UsesTwoHands bool // if true, it's a 2handed weapon - Min2HandDamage int - Max2HandDamage int - MinMissileDamage int // ranged damage stats - MaxMissileDamage int - MissileSpeed int // unknown, affects movement speed of wielder during ranged attacks? - ExtraRange int // base range = 1, if this is non-zero add this to the range - Speed int // affects movement speed of wielder, >0 = you move slower, <0 = you move faster - StrengthBonus int - DexterityBonus int + UsesTwoHands bool // if true, it's a 2handed weapon + Min2HandDamage int + Max2HandDamage int + MinMissileDamage int // ranged damage stats + MaxMissileDamage int + MissileSpeed int // unknown, affects movement speed of wielder during ranged attacks? + ExtraRange int // base range = 1, if this is non-zero add this to the range + Speed int // affects movement speed of wielder, >0 = you move slower, <0 = you move faster + StrengthBonus int + DexterityBonus int // final mindam = min * str / strbonus + min * dex / dexbonus // same for maxdam - RequiredStrength int + RequiredStrength int RequiredDexterity int - Durability int // base durability 0-255 - NoDurability bool // if true, item has no durability - - Level int // base item level (controls monster drops, for instance a lv20 monster cannot drop a lv30 item) - RequiredLevel int // required level to wield - Cost int // base cost - GambleCost int // for reference only, not used - MagicLevel int // additional magic level (for gambling?) - AutoPrefix int // prefix automatically assigned to this item on spawn, maps to group column of Automagic.txt - OpenBetaGfx string // unknown - NormalCode string - UberCode string - UltraCode string + Durability int // base durability 0-255 + NoDurability bool // if true, item has no durability - WeaponClass string // what kind of attack does this weapon have (i.e. determines attack animations) + Level int // base item level (controls monster drops, for instance a lv20 monster cannot drop a lv30 item) + RequiredLevel int // required level to wield + Cost int // base cost + GambleCost int // for reference only, not used + MagicLevel int // additional magic level (for gambling?) + AutoPrefix int // prefix automatically assigned to this item on spawn, maps to group column of Automagic.txt + OpenBetaGfx string // unknown + NormalCode string + UberCode string + UltraCode string + + WeaponClass string // what kind of attack does this weapon have (i.e. determines attack animations) WeaponClass2Hand string // what kind of attack when wielded with two hands - Component int // corresponds to Composit.txt, player animation layer used by this - HitClass string // determines sounds/graphic effects when attacking - InventoryWidth int - InventoryHeight int - Stackable bool // can be stacked in inventory - MinStack int // min size of stack when item is spawned, used if stackable - MaxStack int // max size of stack when item is spawned - SpawnStack int // unknown, something to do with stack size when spawned (sold maybe?) + Component int // corresponds to Composit.txt, player animation layer used by this + HitClass string // determines sounds/graphic effects when attacking + InventoryWidth int + InventoryHeight int + Stackable bool // can be stacked in inventory + MinStack int // min size of stack when item is spawned, used if stackable + MaxStack int // max size of stack when item is spawned + SpawnStack int // unknown, something to do with stack size when spawned (sold maybe?) - FlippyFile string // DC6 file animation to play when item drops on the ground - InventoryFile string // DC6 file used in your inventory + FlippyFile string // DC6 file animation to play when item drops on the ground + InventoryFile string // DC6 file used in your inventory UniqueInventoryFile string // DC6 file used by the unique version of this item - SetInventoryFile string // DC6 file used by the set version of this item + SetInventoryFile string // DC6 file used by the set version of this item HasInventory bool // if true, item can store gems or runes - GemSockets int // number of gems to store - GemApplyType int // what kind of gem effect is applied + GemSockets int // number of gems to store + GemApplyType int // what kind of gem effect is applied // 0 = weapon, 1= armor or helmet, 2 = shield - SpecialFeature string // Just a comment + SpecialFeature string // Just a comment Useable bool // can be used via right click if true // game knows what to do if used by item code - DropSound string // sfx for dropping - DropSfxFrame int // what frame of drop animation the sfx triggers on - UseSound string // sfx for using + DropSound string // sfx for dropping + DropSfxFrame int // what frame of drop animation the sfx triggers on + UseSound string // sfx for using - Unique bool // if true, only spawns as unique + Unique bool // if true, only spawns as unique Transparent bool // unused - TransTable int // unknown, related to blending mode? - Quivered bool // if true, requires ammo to use - LightRadius int // apparently unused - Belt bool // seems to be unused? supposed to be whether this can go in your quick access belt + TransTable int // unknown, related to blending mode? + Quivered bool // if true, requires ammo to use + LightRadius int // apparently unused + Belt bool // seems to be unused? supposed to be whether this can go in your quick access belt - Quest int // indicates that this item belongs to a given quest? + Quest int // indicates that this item belongs to a given quest? QuestDifficultyCheck bool // if true, item only works in the difficulty it was found in - MissileType int // missile gfx for throwing + MissileType int // missile gfx for throwing DurabilityWarning int // controls what warning icon appears when durability is low - QuantityWarning int // controls at what quantity the low quantity warning appears - GemOffset int // unknown - BitField1 int // 1 = leather item, 3 = metal + QuantityWarning int // controls at what quantity the low quantity warning appears + GemOffset int // unknown + BitField1 int // 1 = leather item, 3 = metal Vendors map[string]*WeaponVendorParams // controls vendor settings - - SourceArt string // unused? - GameArt string // unused? - ColorTransform int // colormap to use for player's gfx - InventoryColorTransform int // colormap to use for inventory's gfx - SkipName bool // if true, don't include the base name in the item description + SourceArt string // unused? + GameArt string // unused? + ColorTransform int // colormap to use for player's gfx + InventoryColorTransform int // colormap to use for inventory's gfx + + SkipName bool // if true, don't include the base name in the item description NightmareUpgrade string // upgraded in higher difficulties - HellUpgrade string + HellUpgrade string - Nameable bool // if true, item can be personalized + Nameable bool // if true, item can be personalized PermStoreItem bool // if true, vendor will always sell this } type WeaponVendorParams struct { - Min int // minimum of this item they can stock - Max int // max they can stock - MagicMin int - MagicMax int + Min int // minimum of this item they can stock + Max int // max they can stock + MagicMin int + MagicMax int MagicLevel uint8 } @@ -129,105 +129,103 @@ func createWeaponRecord(line string) WeaponRecord { result := WeaponRecord{ Name: r[inc()], - Type: r[inc()], - Type2: r[inc()], - Code: r[inc()], - AlternateGfx: r[inc()], - NameString: r[inc()], - Version: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - CompactSave : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - Rarity: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - Spawnable : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - - MinDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - MaxDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - BarbOneOrTwoHanded : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - UsesTwoHands : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - Min2HandDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - Max2HandDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - MinMissileDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - MaxMissileDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - MissileSpeed: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - ExtraRange: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - Speed: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - StrengthBonus: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - DexterityBonus: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - - - RequiredStrength: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + Type: r[inc()], + Type2: r[inc()], + Code: r[inc()], + AlternateGfx: r[inc()], + NameString: r[inc()], + Version: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + CompactSave: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + Rarity: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + Spawnable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + + MinDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + MaxDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + BarbOneOrTwoHanded: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + UsesTwoHands: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + Min2HandDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + Max2HandDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + MinMissileDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + MaxMissileDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + MissileSpeed: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + ExtraRange: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + Speed: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + StrengthBonus: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + DexterityBonus: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + + RequiredStrength: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), RequiredDexterity: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - Durability: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - NoDurability : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - - Level: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - RequiredLevel: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - Cost: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - GambleCost: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - MagicLevel: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - AutoPrefix: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - OpenBetaGfx: r[inc()], - NormalCode: r[inc()], - UberCode: r[inc()], - UltraCode: r[inc()], - - WeaponClass: r[inc()], - WeaponClass2Hand: r[inc()], - Component: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - HitClass: r[inc()], - InventoryWidth: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - InventoryHeight: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - Stackable : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - MinStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - MaxStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - SpawnStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - - FlippyFile: r[inc()], - InventoryFile: r[inc()], - UniqueInventoryFile: r[inc()], - SetInventoryFile: r[inc()], - - HasInventory : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - GemSockets: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - GemApplyType: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - - - SpecialFeature: r[inc()], - - Useable : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - - DropSound: r[inc()], - DropSfxFrame: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - UseSound: r[inc()], - - Unique : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - Transparent : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - TransTable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - Quivered : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - LightRadius: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - Belt : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - - Quest: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - QuestDifficultyCheck : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - - MissileType: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - DurabilityWarning: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - QuantityWarning: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - GemOffset: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - BitField1: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - - Vendors: createWeaponVendorParams(&r, inc), - - SourceArt: r[inc()], - GameArt: r[inc()], - ColorTransform: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - InventoryColorTransform: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), - - SkipName : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - NightmareUpgrade: r[inc()], - HellUpgrade: r[inc()], - - Nameable : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, - PermStoreItem : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + Durability: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + NoDurability: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + + Level: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + RequiredLevel: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + Cost: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + GambleCost: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + MagicLevel: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + AutoPrefix: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + OpenBetaGfx: r[inc()], + NormalCode: r[inc()], + UberCode: r[inc()], + UltraCode: r[inc()], + + WeaponClass: r[inc()], + WeaponClass2Hand: r[inc()], + Component: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + HitClass: r[inc()], + InventoryWidth: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + InventoryHeight: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + Stackable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + MinStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + MaxStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + SpawnStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + + FlippyFile: r[inc()], + InventoryFile: r[inc()], + UniqueInventoryFile: r[inc()], + SetInventoryFile: r[inc()], + + HasInventory: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + GemSockets: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + GemApplyType: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + + SpecialFeature: r[inc()], + + Useable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + + DropSound: r[inc()], + DropSfxFrame: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + UseSound: r[inc()], + + Unique: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + Transparent: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + TransTable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + Quivered: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + LightRadius: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + Belt: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + + Quest: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + QuestDifficultyCheck: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + + MissileType: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + DurabilityWarning: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + QuantityWarning: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + GemOffset: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + BitField1: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + + Vendors: createWeaponVendorParams(&r, inc), + + SourceArt: r[inc()], + GameArt: r[inc()], + ColorTransform: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + InventoryColorTransform: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), + + SkipName: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + NightmareUpgrade: r[inc()], + HellUpgrade: r[inc()], + + Nameable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, + PermStoreItem: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, } return result } @@ -255,13 +253,13 @@ func createWeaponVendorParams(r *[]string, inc func() int) map[string]*WeaponVen for _, name := range vs { wvp := WeaponVendorParams{ - Min: StringToInt(EmptyToZero((*r)[inc()])), - Max: StringToInt(EmptyToZero((*r)[inc()])), - MagicMin: StringToInt(EmptyToZero((*r)[inc()])), - MagicMax: StringToInt(EmptyToZero((*r)[inc()])), + Min: StringToInt(EmptyToZero((*r)[inc()])), + Max: StringToInt(EmptyToZero((*r)[inc()])), + MagicMin: StringToInt(EmptyToZero((*r)[inc()])), + MagicMax: StringToInt(EmptyToZero((*r)[inc()])), MagicLevel: StringToUint8(EmptyToZero((*r)[inc()])), } - result[name] = &wvp; + result[name] = &wvp } return result } @@ -279,4 +277,4 @@ func LoadWeapons(fileProvider FileProvider) { Weapons[rec.Code] = &rec } log.Printf("Loaded %d weapons", len(Weapons)) -} \ No newline at end of file +}