Commit Graph

300 Commits

Author SHA1 Message Date
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
Tim Sarbin ce36dec7f8
Fix background music crash issue. (#880)
* Added useful config error panic. Added window title to panic window.

* Fixed background music crash.
2020-10-28 22:34:47 -04:00
Tim Sarbin a9d832b539
Added useful config error panic. Added window title to panic window. (#879) 2020-10-28 21:42:03 -04:00
Tim Sarbin 1a6c6b8e9f
Add panic screen (#878)
* Add panic screen

* Fixed lint error. Updated all module references
2020-10-28 21:02:12 -04:00
Thomas Christlieb 2d4c79484f
Animation mode for player should be checked (and possible changed) every tick. It needs to be changed when the player stops or starts running while follwing a path (single click, don't hold the mouse at target). Fixes #837 (#875) 2020-10-28 15:11:41 -04:00
gravestench 6e31cfb52a
migrate to ebiten v2.0 API (#860)
* migrate to ebiten v2.0 API

* fixed lint errors
2020-10-28 14:17:42 -04:00
juander-ux 79c147866e
Tooltip refactor (#872)
* d2ui: Add tooltip class

we reimplemented tooltips in several places
(inventory/skill_select_panel). Let's make it its own ui element.

* d2player: Refactor skill_select_panel to use the tooltip class

* d2player: Refactor inventory to use the tooltip class

* Make linter happy

* Make golangci-lint 1.27.0 happy as well

* tooltip: Remove const and rather disable linter
2020-10-28 13:54:55 -04:00
gravestench 4a62101b96
adding the rest of the data dictionary loaders (#869) 2020-10-28 13:52:15 -04:00
gravestench 33368e5aa3
Lint cleanup funlen (#854)
* d2ui/button.go: refactored button state prerender to fix funlen lint error

* d2player/help/help.go: break up Load method to reduce complexity

* d2game/d2player/game_controls.go: refactored renderHUD method, fixed funlen lint error

* d2player/skilltree.go: fixed funlen lint error

* map_engine_test.go: fixed funlen lint error
2020-10-26 15:55:13 -07:00
Gürkan Kaymak ec9c0c3d95
fixes #767, implemented deepCopy for the dcc_animation and dc6_animation (#852) 2020-10-26 09:13:08 -04:00
gravestench 0bd774aaa6
fixed some of the remaining funlen lint errors (#850)
* d2records/: suppressing function legnth lint errors for record loaders

* d2gamescreen/character_select.go: broke up OnLoad method to reduce complexity

* d2ui/button.go: suppressing funlen lint error, can't reduce function size
2020-10-26 04:39:10 -07:00
gravestench 1046fb6137
bugifx (#849) 2020-10-26 04:35:23 -07:00
gravestench dd0c148784
fixed all `gocognit` lint errors (#848)
* reduced ItemFactory.NewItem complexity

* d2compression/wav.go: suppressing gocognit lint error, suppressing gocyclo lint error

* d2maprenderer/renderer.go: reducing complexity of rnderPass2 and renderPass3
2020-10-26 03:53:42 -07: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 622186e350
fixed 'dupl' lint errors (#845)
* removed dupl lint errors in d2compression/huffman.go

* remove duplicate code for set/unique item properties

This is a more involved edit. I've added a `PropertyDescriptor`
which is a common struct that should have existed already. The
`PropertyDescriptor` is used to generate property instances, and is common
to item affixes, set items, sets, unique items, and runewords.

This was all to remove duplicate code in d2item/

* removed duplicate code for rare item affixes
2020-10-26 00:38:18 -07:00
gravestench 815cfa09cb
fix all gosec lint errors (#844) 2020-10-25 23:38:15 -07:00
gravestench 060abdc3bd
removed globals, added nolint to tests that used globals (#843) 2020-10-25 21:06:00 -07:00
gravestench 359bcd6ef8
fixed all goimports lint errors (#842) 2020-10-25 20:55:46 -07:00
gravestench 13d5e1c4de
removed all 'lll' (line length) lint errors (#841) 2020-10-25 18:11:04 -07:00
gravestench 37235282e0
removed all 'deadcode' lint errors (#840) 2020-10-25 18:01:57 -07:00
gravestench 49c1985dcc
removed all 'structcheck' and 'unused' lint errors (#839) 2020-10-25 17:49:41 -07:00
gravestench 42a48fe03a
removed all 'whitespace' lint errors (#838) 2020-10-25 17:33:04 -07:00
gravestench 02acba231b
removed all 'wsl' lint errors (#836) 2020-10-25 17:28:40 -07:00
gravestench 1ce2af19bf
removed all 'gocritic' lint errors (#835) 2020-10-25 17:03:23 -07:00
gravestench 6b5c2a1fc5
removed all 'govet' type lint errors (#834) 2020-10-25 16:50:13 -07:00
gravestench a1380bc264
removed all `golint` lint errors (#833)
* removed all 'golint' type lint errors
2020-10-25 16:23:55 -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
Julien Ganichot 8e957c17fe
fix(run/walk): changes invalid surface for toggled state (#816) 2020-10-25 15:12:55 -04:00
gravestench 589850a728
Removing TODO comments, making issues for them (#807)
* removed the rest of the magic number errors from d2game

* hotfix for bug i added in map engine test

* removed TODO's from d2mapengine/engine.go, added link to github issue

* removed TODO's and made issues and other minor lint work

* lint cleanup, mostly removing TODO's and putting links to their issues on github
2020-10-25 10:21:14 -04:00
gravestench 18c9e85cbc
`d2game/d2player/` lint error cleanup (#788)
* d2game/d2player/inventory.go: magic number lint cleanup

* d2game/d2player/mini_panel.go: magic number lint cleanup

* d2game/d2player/skill_select_panel.go: lint cleanup

* d2game/d2player/skilltree.go: removed all lint errors

* removed the rest of the magic number errors from d2game

* hotfix for bug i added in map engine test

* all magic numbers removed (excluding  mapgen)
2020-10-25 00:42:31 -07:00
presiyan-ivanov c4b128ac2e
Handle casting summon skills and skills that have multiple missile references. Add background to skill select's skill hover tooltip. (#786)
Co-authored-by: Presiyan Ivanov <presiyan-ivanov@users.noreply.github.com>
2020-10-24 10:08:45 -04:00
gravestench 16a82442bb
removed a bunch of magic number lint errors (#785)
* removed magic numbers from d2ui/button.go

* removed a bunch of magic number lint errors
2020-10-23 09:00:51 -04:00
gravestench 2704a23289
removed magic numbers from d2ui/frame.go (#784) 2020-10-22 14:27:18 -07: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 209cc19c89
removed a lot of magic number lint errors (#781) 2020-10-22 10:02:32 -04:00
gravestench e274260787
fixed all golint type lint errors (#780) 2020-10-21 23:41:21 -07: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
Albin 8b2cc76c30
Added ObjectMode, StorePage and Colors.txt resource loaders (#771)
* add ObjMode.txt loader

* add colors.txt loader

* added storepage loader

* Update storepage_loader.go

removed printline

Co-authored-by: kottz <edward.kallstedt@gmail.com>
2020-10-21 11:05: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
kottz b5e052fc81
Add gamble.txt loader (#764) 2020-10-10 18:45:28 -04:00
Josh Jordan b1cdb47302
Help and Escape Menu click through and close behavior (#761)
* Disallow clicking through the help menu to control the game

* Move Navigator and EscapeMenu up in package tree to be accessible by GameControls. Disallow GameControls input when EscapeMenu is open

* Make ESC key behavior more consistent with D2
2020-10-07 21:20:05 -04:00
Thomas Christlieb d78175b7b4
Player starts walking, and allow for CTRL-Key to toggle running while holding key (#762) 2020-10-07 16:12:56 -04:00
nicholas-eden 24556f62fc
Add belt loader (#757)
Add loader and record type for belts #634
2020-09-26 02:13:01 -04:00
Brendan Porter ca45be0948
Adds error handling everywhere (#743)
* adds error handling, returns early from funcs where it makes sense

* fixes build errors

* merge ballresin PR with upstream

* adds error handling, returns early from funcs where it makes sense

* fixes build errors

* merge ballresin PR with upstream

Co-authored-by: dknuth <dknuth0101@gmail.com>
2020-09-23 13:30:54 -04:00
gravestench a5f9067248
replace satori/go.uuid with google/uuid (#747) 2020-09-23 13:30:15 -04:00
gravestench be354f139b
Removing the rest of the d2data singletons (#742)
* removing objects records from d2datadict

* removing Overlay singleton from d2datadict

* remove PetTypes singleton from d2datadict

* remove PlayerClass singleton from d2datadict

* removed PlrModes singleton from d2datadict

* removed Properties singleton from d2datadict

* removed ItemQuality singleton from d2datadict

* removed RarePrefix and RareSuffix singletons from d2datadict

* removed States singleton from d2datadict

* removed Runewords singleton from d2datadict

* removed Sets and SetItems singletons from d2datadict

* remoed Shrines singleton from d2datadict

* removed UniqueItems singleton from d2datadict

* removed SuperUniques singleton from d2datadict

* removed TreasureClass singleton from d2datadict

* removed UniqueAppellation singleton from d2datadict

* removed d2datadict

* removed data dict init from d2app, this has moved to asset manager init
2020-09-20 20:30:27 -04:00