1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-09 09:20:44 +00:00
Commit Graph

166 Commits

Author SHA1 Message Date
Julien Ganichot
8365400ff5
Feat(KeyMapping): Adds a configurable keymap to GameControls, resolves #793 (#893)
* Feat(KeyMapping): Adds a configurable keymap to GameControls + Updates help overlay to use it

Co-authored-by: gravestench <dknuth0101@gmail.com>
2020-11-01 19:43:23 -08: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
Stephen Horan
fb8e25ebdb
Code Cleanup for #790 (#870)
* Return errors for #790

* Fixing lint issues

* Returning nil instead of empty struct pointer
2020-10-30 20:19:06 -04:00
juander-ux
4506380dbb
d2player/game_controls: Fix health/mana globe text locking (#882)
when you click on a either of the globes the values should appear
above them.
2020-10-29 09:59:07 -04:00
juander-ux
b1058d6085
Add labels for skill levels (#881)
* d2player/skilltree: Add label for skillpoints

this also darkens the skillicon if no skillpoint was invested yet.

* d2player/gamecontrols: learnskills <class> should only learn class
specific skills

the character would learn skills of enemies as well, like DiabWall. I
wasn't expecting the command to do that.
2020-10-29 09:50:15 -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
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
Zaprit
7d5cd10850
Added an OnKeyUp method to the main menu to emulate retail behavior (#853)
any keyboard event will navigate from trademark screen to the main menu
2020-10-26 12:50:38 -07:00
gravestench
7f19f7e970
another bugfix (#851) 2020-10-26 05:00:30 -07: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
aa9f6be411
Lint cleanup gocyclo (#847)
* d2player/inventory.go: fixed gocyclo error, broke up render method to smaller methods

* d2client/game_client.go: suppressing gocyclo error for OnPacketReceived, doesnt make sense to split

* d2remoteclient/remote_client_connection.go: suppressing gocyclo error for decodeToPacket, doesnt make sense to split

* d2dcc/dcc_direction.go: suppressing gocyclo error in generateFrames
2020-10-26 02:24:04 -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
49c1985dcc
removed all 'structcheck' and 'unused' lint errors (#839) 2020-10-25 17:49:41 -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
Thomas Christlieb
2b469d302b
fix miniPanelGameMenu wrong rendering (#810) 2020-10-25 13:37:07 -04:00
Thomas Christlieb
bb9789d700
Red stamina bar (#809)
* Fixed a typo. Make stamina bar red wehan below 25%

* make linter happy
2020-10-25 13:15:28 -04:00
juander-ux
bbc716f682
Add close buttons to all panels (#808)
* d2player/panels: Add close button to hero/inventory/skilltree panel

we require a OnClose callback here, as we need to update the perspective
of the view which is handled by gamecontrols.updateLayout().

* d2player/skilltree: Fix using the same tab label for all tabs

* d2player/game_controls: Fix wrong position of left/right menu

the character would not detect that a click was in a menu and start
walking.
2020-10-25 10:54:39 -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
gravestench
fb8923185f
d2game/d2player refactor + lint cleanup (#787)
* minor refactor of hero_stats_panel to clean up lint errors

* minor edit to skill_select_panel.go

* major refactor of d2game/d2player/game_controls.go, removed most lint errors.
2020-10-24 22:52:26 -04: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
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
Thomas Christlieb
53e3619781
Game menu button (#777)
* mini panel starts closed. Mini Panel game menu button opens game menu

* explicit close instead of toggle
2020-10-21 13:58:51 -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
Benjamin Maisonnas
7be3b7b98d
fix(escape_menu): fix pentagrams starting position, default menu entry, and rotation direction #460 (#765) 2020-10-10 18:46:13 -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
leahiel
815c0d17ba
help panel: semi-trans background, font reset, string table (#758) 2020-09-26 11:14:34 -04:00
leahiel
6f9e4bdc87
unbinds the character select screen after use (#756) 2020-09-25 23:14:32 -04:00
leahiel
9dcf7cefca
double click char select to load char (#755)
* double click char select to load char

* removed vestigial code

* fixed out of index error
2020-09-25 21:53:56 -04:00
leahiel
4bbc2e3470
Updated panel strings to pull from string table v2 (#752)
* Updated panel strings to pull from string table v2

* updated a string method
2020-09-24 16:28:14 -07:00
leahiel
481b3a0134
updated life/mana globes and text placement to not use magic numbers (#750) 2020-09-23 23:00:15 -04:00
leahiel
a4c8aef8aa
added tooltips to minipanel buttons, stamina and xp bars (#749) 2020-09-23 22:59:36 -04:00
leahiel
7ccc944fec
Changed nameLabel font to Font 16. (#748) 2020-09-23 22:58:56 -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
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
Brendan Porter
f4d78549c5
Helpv3 (#739)
* finishing up help overlay

* fixes help overlay close button,
adds hack to prevent buysellbtn from rendering all 24 unrelated frames on top of eachother
2020-09-20 02:54:24 -04:00
Gürkan Kaymak
ef0fbc0581
removed gui manager singleton in d2gui (#735) 2020-09-18 16:10:52 -04:00