Commit Graph

14 Commits

Author SHA1 Message Date
Intyre a62e21a572 Renamed CharStatRecord 2020-12-18 18:50:42 +01:00
gravestench af1f0a0eda
removed string table singleton from d2common/d2fileformats/d2tbl/ (#900) 2020-11-03 11:10:11 -08:00
gravestench 6f8b43f8d6
Various lint error fixes and suppressions (#846)
* suppressing the magic number lint errors in mapgen, it will get a heavy refactor soon, hopefully...

* adding string token constants for SkillClass

* adding panic on error to left/right skill select render

* fixed cuddle lint error

* fixed unnecessary conversion, unused func param lint errors in dcc_animation.go

* adding comment for skill class tokens

* fixed typo in comment

* removed unused parameter in dcc/dc6 animations

* supress warning about Object.setMode always being passed direction value of 0

* fixed all invalid golint directives

* fixed a couple gocritic lint errors
2020-10-26 02:04:50 -07:00
gravestench 060abdc3bd
removed globals, added nolint to tests that used globals (#843) 2020-10-25 21:06:00 -07:00
gravestench e274260787
fixed all golint type lint errors (#780) 2020-10-21 23:41:21 -07:00
gravestench fc87b2be7a
Removing d2datadict singletons (#738)
* Remove weapons, armor, misc, itemCommon, itemTyps datadict singletons

- removed loader calls from d2app
- removed the HeroObjects singleton from `d2core/d2inventory`
- added an InventoryItemFactory in d2inventory
- package-level functions that use data records are now methods of the InventoryItemFactory
- renamed ItemGenerator in d2item to ItemFactory
- package-level functions that use records are now methods of ItemFactory
- d2map.MapEntityFactory now has an item factory instance for creating items
- fixed a bug in unique item record loader where it loaded an empty record
- added a PlayerStateFactory for creating a player state (uses the asset manager)
- updated the test inventory/equipment code in d2player to handle errors from the ItemFactory
- character select and character creation screens have a player state and inventory item factory
- updated item tests to use the item factory

* minor edit

* Removed d2datadict.Experience singleton

added a HeroStatsFactory, much like the other factories. The factory  gets an
asset manager reference in order to use data records.

* removed d2datadict.AutoMagic singleton

* removed d2datadict.AutoMap singleton

* removed d2datadict.BodyLocations singleton

* removed d2datadict.Books singleton

* Removed singletons for level records

- removed loader calls in d2app
- changed type references from d2datadict to d2records
- added a `MapGenerator` in d2mapgen which uses thew asset manager and map engine
- package-level map generation functions are now MapGenerator methods
- `d2datadict.GetLevelDetails(id int)` is now a method of the RecordManager

* remove SkillCalc and MissileCalc singletons

* Removed CharStats and ItemStatCost singletons

- added an ItemStatFactory which uses the asset manager to create stats
- package-level functions for stats in d2item are now StatFactory methods
- changed type references from d2datadict to d2records
- `d2player.GetAllPlayerStates` is now a method of the `PlayerStateFactory`

* Removed DkillDesc and Skills singletons from d2datadict

- removed loader calls from d2app
- diablo2stats.Stat instances are given a reference to the factory for doing record lookups

* update the stats test to use mock a asset manager and stat factory

* fixed diablo2stats tests and diablo2item tests

* removed CompCodes singleton from d2datadict

* remove cubemain singleton from d2datadict

* removed DifficultyLevels singleton from d2datadict

* removed ElemTypes singleton from d2datadict

* removed events.go loader from d2datadict (was unused)

* removed Gems singleton from d2datadict

* removed Hireling and Inventory singletons from d2datadict

* removed MagicPrefix and MagicSuffix singletons from d2datadict

* removed ItemRatios singleton from d2datadict

* removed Missiles singleton from d2datadict

* removed MonModes singleton

* Removed all monster and npc singletons from d2datadict

- MapStamp instances now get a reference to their factory for doing record lookups

* removed SoundEntry and SoundEnviron singletons from d2datadict
2020-09-20 17:52:01 -04:00
Gürkan Kaymak f4a71c72e4
lint fixes (#727) 2020-09-12 16:25:09 -04:00
lord 0218cad717
organize d2common pakage (#716)
* move music path enumerations into d2resource

* move text dictionary (.tbl) loader into d2fileformats sub-package d2tbl

* lint fix, add doc file for d2tbl

* moved data_dictionary.go into d2fileformats sub-package d2txt, added doc file

* added sub-packages d2geom for geometry-related things, and d2path for path-related things

* moved calcstring.go to d2calculation

* move bitmuncher, bitstream, stream reader/writer from d2common into sub-package d2datautils

* fix lint errors in d2datadict loaders (caused by moving stuf around in d2common)

* move size.go into d2geom

* move d2common/cache.go into sub-package d2common/d2cache

* renamed d2debugutil to d2util, moved utility functions from d2common into d2util
2020-09-08 15:58:35 -04:00
lord 76ed8ff180
simple inventory item descriptions (#672)
* adding simple inventory item descriptions

* adding method to identify items

* offset description so it doesn't overlap with item in inventory grid
2020-08-03 13:44:00 -04:00
lord bfd3f1046d
D2items WIP (#646)
* wip d2items system and item properties

* added loader for TreasureClassEx.txt

* wip item spawn from treasure class records

* wip items

* add call to init item equivalencies, remove treasure class test from d2app

* made item affix records global var a map of affix codes to the records

* changed how item to item common record equivalency is determined

* changed set items records export to a map of their codes to the records, grouped property params into a struct

* changed property parameter field from calcstring to string

* fixed bug in stat value clone

* adding equipper interface as part of stat context, eventually to be used to resolve set bonus (among other things)

* made the item interface simpler, only needs name and description methods

* adding equipper interface, for anything that will equip or have active items

* handle case where min and max are swapped, removed commented code

* added property/stat resolution for magic, rare, set, and unique items

* adding item generator which can roll for items using treasure class records

* fixed item equivalency func being called in the wrong spot
2020-07-30 10:14:15 -04:00
Gürkan Kaymak 1ce81f1aec
fixed Id renaming in strings (#618) 2020-07-24 07:54:52 -04:00
lord 9e61079e93
Stats refactor (#617)
* add interface for stats, d2 is an implementation

* fix incorrect comment, remove ennecessary int

* simplified description functions, remove duplicates

* moved default stringer functions

* fixed incorrect stat combine method

* change `Create` to `New` in method names

* d2stats + diablo2stats refactored again

- simplified `NewStat` provider function
- added initializer for stat values that sets the stringer functions, value types, and combination types for values when created
- removed redundant description functions
- added stat value combination types `sum` and `static`

`static` stat values which are not altered when stats are combined. this makes sense for stats like proc-on-hit or +skills to class

example:
	Stat A: `10% reanimate as: skeleton mage`
	Stat B: `8% reanimate as: skeleton archer`
	Stat C: `6% reanimate as: skeleton archer`

	A and B can not be combined
	B and C can be combined to `14% reanimate as: skeleton archer`
2020-07-23 22:12:48 -04:00
lord c114ab9eb7
add interfaces for stats, added diablo 2 implementation (#614)
* add interface for stats, d2 is an implementation

* fix incorrect comment, remove ennecessary int

* simplified description functions, remove duplicates

* moved default stringer functions

* fixed incorrect stat combine method

* change `Create` to `New` in method names
2020-07-23 19:03:58 -04:00
dk cf6029eb95
Stat descriptions + tests, Skilldesc.txt loader (#590)
* adding ranged number type, for use in stats

* Loaded Skills.txt

* asset manager only binds terminal commands if terminal != nil

* WIP stats

* cache getter and clear methods were not implemented

* asset manager handles a nil terminal pointer

* adding skilldesc.txt loader (needs work)

* ctc stat descriptions functions working

* moving description functionality out of itemstatcost loader and into stats

* stats seem like a central part of diablo, moving into d2core.

* stats seem like a central part of diablo, moving into d2core.

* delint

* adding statlist, statlist reduction, unit tests

* minor edits to stat.go

* lint error in statlist.go

* Remove dependency on actual data from mpq files

stats unit tests now use mock data

* fixing some lint errors, formatting

Co-authored-by: Maxime Lavigne (malavv) <duguigne@gmail.com>
2020-07-17 18:50:45 -04:00