Commit Graph

28 Commits

Author SHA1 Message Date
Will Roberts d1c1e8bd26 No forward slashes in filepath.Join to satisfy golangci-lint 2021-03-23 23:30:00 -04:00
Will Roberts b18a70cef9 Updates more instances of path->filepath 2021-03-23 23:18:19 -04:00
Intyre a62e21a572 Renamed CharStatRecord 2020-12-18 18:50:42 +01:00
M. Sz 7e346bd039 add-buttons init 2020-12-16 16:49:50 +01:00
M. Sz 9c019afd94 hero save file 2020-12-16 16:49:50 +01:00
Thomas Christlieb 320583b5d4 save act and difficulty. Fixes #866 2020-11-25 11:51:20 +01:00
gucio321 7919b742bd
gold (#943)
* Init for gold button and label

* gold button and label in inventory menu

* gold value saved/loaded from player save file

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2020-11-22 14:53:33 -08:00
gucio321 9ffbf1320c
D2core logger (#934)
* logger for d2audio & d2map

* logger for d2ui e.t.c

* d2inventory now passes on error messages

* no more importing log in d2core

* implemented #925

* added logger to part of d2networking & fixed "need to be changed" comments

* fixed lints

* fixed errors

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2020-11-21 02:33:22 -08:00
Thomas Christlieb 0b76e1a561 save player: level, health, mana, experience
Fixes #865
2020-11-19 20:12:31 +01:00
Stephen Horan 4dd69e7709
Health/Mana/Exp load values from save file #815 (#886)
* Return errors for #790

* Fixing lint issues

* Returning nil instead of empty struct pointer

* Removed new hero stat calls as new player requires stats to be passed in. These were using defaults regardless of the save file.

* Removed override on the default to health/mana/experience. These should now result is proper values.

* Removed new hero stat calls as new player requires stats to be passed in. These were using defaults regardless of the save file.

* Removed override on the default to health/mana/experience. These should now result is proper values.
2020-10-31 23:59:24 -04:00
Thomas Christlieb 40cc421f51
Saving and loading game data, Fixes #868 #799 (#883)
* saving of player should be done on the server. That's also where the loading happens.

* refactor nearly everything, but this time it looks not that bad...

* MAke Linter happy

* Typo... uuups
2020-10-31 14:30:08 -04: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 815cfa09cb
fix all gosec lint errors (#844) 2020-10-25 23:38:15 -07:00
gravestench 02acba231b
removed all 'wsl' lint errors (#836) 2020-10-25 17:28:40 -07:00
gravestench 025ee94e50
Removed all TODO's in project (#831)
* removed the rest of the magic number errors from d2game

* hotfix for bug i added in map engine test

* removed all TODO's in project, made issues on github for each one
2020-10-25 18:36:12 -04:00
presiyan-ivanov 7661b81576
Initial left & right skill select panel implementation. HeroSkill serialization cleanup. (#783)
- Clicking the active left/right skill now opens a skill select panel.
Only the available skills for the hero, which are valid for the panel type are shown.
Clicking on a skill from the skill select panel makes it the new active skill for the hero.

- Hovering a skill in the skill select panel shows the skill name +
skill description.

- New command which learns all skills for a specific
class(not persisted to a save file yet) - e.g. `learnskills ama` will learn
skills for the Amazon class.

- Initialize HeroSkill.shallowHeroSkill struct in the hero state factory, so we can use it
when we serialize the HeroSkill to packets/game save files.

- The parsed Skill.ListRow is now a number instead  of string.

Co-authored-by: Presiyan Ivanov <presiyan-ivanov@users.noreply.github.com>
2020-10-22 16:53:18 -04:00
juander-ux e5dae4e5d8
Inital skilltree panel implementation (#782)
* d2ui/UIFrame: Refactor into its own class

it's not useful to have the handling of frames for the
inventory/herostate/skilltree/quest panels individually in each of
those.

* d2ui/button: Fix crash when a buttonlayout was not allowing FrameChange

When AllowFrameChange is false we do not create pressedSurface. So if we
press the button the game will crash.

* d2ui/button: Allow label-only buttons

At least for the skillmenu we need buttons were the graphic size does
not match the buttonsize. So let's render the graphic in there and make
the button label only.

* d2hero/hero_state_factory: Give all heroes their class specific skills

* d2player/gamecontrols: Fix wrong inventory/stats layouts for exp chars

For Druid/Assassin the inventory frame was rendered for a 640x480
resolution. This brings it in line with all other characters.

* d2player: Add inital Skilltree panel

* d2player/game_controls: Enable skilltree

Note here, that the inventory panel and skilltree panel can overlap.

* d2player/skilltree: Add skillicon rendering

Note here, that I couldn't figure out how to render them dark if no
skillpoints are invested.

Signed-off-by: juander <juander@rumtueddeln.de>
2020-10-22 12:54:45 -04:00
gravestench 783993470e
Lint error cleanup1 (#779)
* fixed lint error in d2app/app.go

* go fmt entire project

* adding doc.go for d2records

* fixed lint issues in d2core/d2map

* fixed lint error in d2interface/palette.go

* fixed lint error in  d2core/d2hero/hero_state_factory.go

* adding dov.go to d2common/d2geom

* fixing lint errors in d2common/d2loader

* adding doc.go to d2common/d2cache

* adding doc files for d2datautils, d2util, d2path

* adding package doc strings for mapgen, in-geam help screen, and tcp client connection

* removed all cuddling lint errors

* changed stamina equality check to '<=' instead of '<'
2020-10-22 01:12:06 -04:00
Thomas Christlieb 30b6f0cb4e
first stamina drain implementation (#778)
Bugs: 1. In D2 when Stamina is drained it does not regenerate until you completely stop
2. Stamina Bar does not get red when near the end
2020-10-21 23:25:53 -04:00
gravestench 7fb57a273b
hotfix for #768 (#769) 2020-10-10 23:31:12 -04:00
presiyan-ivanov 88326b5278
Initial cast overlay implementation. Fix HeroSkill deserialization & map entities processing crashing for remote client. (#766)
* Casting a skill now plays the corresponding overlay(if any).

* Prevent a crash caused by nil pointer in HeroSkill deserialization, happening when
unmarshalling HeroSkill from packets as a remote client.

* Add PlayerAnimationModeNone to handle some of the Skills(e.g.
Paladin auras) having "" as animation mode.

* Joining a game as remote client now waits for map generation to finish
before rendering map or processing map entities. This is temporary hack to prevent the game from
crashing due to concurrent map read & write exception.

* Send CastSkill packet to other clients.

Co-authored-by: Presiyan Ivanov <presiyan-ivanov@users.noreply.github.com>
2020-10-10 18:47:51 -04: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
presiyan-ivanov a4e9797431
Initial player Left skill and Right skill handling (#741)
* Initial player Left skill and Right skill handling

* Handle empty skill names in charStats.BaseSkils + add Attack skill for all classes.

Co-authored-by: Presiyan Ivanov <presiyan-ivanov@users.noreply.github.com>
2020-09-20 11:55:44 -04:00
dk de116e8367
moving package comments into doc.go files (#534) 2020-07-03 18:33:46 -04:00
Maxime Lavigne (malavv) d15221c21c
d2hero is *nearly* lint free #487. (#506)
Only lint left are meaningful TODOs.

I also defaulted the level and exp parameters as if we were to handle non-default state, we would need much more information. It might be worth creating another function at that point.
2020-06-30 17:03:20 -04:00
presiyan-ivanov c64e9be78b
Character stats (#458)
* Save/load hero stats and display them in stats panel.

* Load default hero state for characters created before saving stats was introduced

Co-authored-by: Presiyan Ivanov <presiyan-ivanov@users.noreply.github.com>
2020-06-25 14:56:49 -04:00
Alex Yatskov 8a547ebf0e
Moving files around to make more sense (#279)
* Prevent input fighting between terminal and other input listeners.

* Moving files around, removing exports

* Add missing line
2020-02-01 18:55:56 -05:00
Tim Sarbin 2461142fbd
Minor changes to project layout (#276)
* Minor changes to reduce interdependencies on modules.
2020-01-31 23:18:11 -05:00