Commit 4481584
CUIItemUpgrade implementation (anvil UI) (#417)
* UIItemUpgrade: Item upgrade process completed
* UIItemUpgrade: Animation loop refactored
* CUIItemUpgrade: Refactored behaviour like 1299 Client
* Refactored IsSlotCompatible function
* CUIItemupgrade Header updated
* Merge branch 'master' of https://github.com/Mervandeli/KnightOnline
* resolved conflicts
* Right click behavior added
* minor updates
* IsSlotCompatible updated
* minor review changes applied
* Some reviews solved
* other reviews and ui close problem solved
* ItemCount handled outside render
* Upgrade scroll slot and ItemUpgrade slot seperated
* Removed Unnecessary functions
* UI elements handled on load
* Fixed before commit problem
* Removed deleteiconskill function and defined magic numbers
* Removed deleteiconskill from header
* SetupIconarea used in other functions
* Upgradearea rightclick behavior fixed
* Fixed some reviews
* text ids added text_resource.h and MsgRecv_ItemUpgrade updated
* orher reviews and icon move bug fixed
* Update RestoreInventoryFromBackup logic and rename to UpdateInventory
* last countable item updateinventory problem fixed
* Parent class changed N3UIWndBase to N3UIBase
* Other reviews solved
* Refactored handle functions
* Move Icon poblem fixed
* Removed some functions
* Countable Items problem fixed
* GetWndDistrict updated and Using member reduced
* Countable icons moving like original 1299 client
* ReceiveMessage updated
* Minor update
* Reduced class members
* Used N3_VERIFY_UI_COMPONENT method for Success and Fail UI
* Minor update
* UIItemUpgrade.cpp error fix
* Update UIItemUpgrade.cpp
Remove unintended empty statement in UIItemUpgrade.cpp
* Cleanup pass to knock out low hanging fruit
* Add e_ItemEffect2, fix check
* Tidy up MsgRecv_ObjectEvent()
* Add __IconItemSkill::IsStackable() helper
* Minor cleanup
* IsTrina method removed and Consumable item check added
* SetVisibleWithNoSound updated and SetVisible method added
* SetVisibleWithNoSound updated
* Removed Open method
* CleanArea method removed
* Fix: Reset m_pSelectedItem when associated item is freed to prevent invalid pointer access
* ShowItemCount removed and Countable labels logic moved to render
* UIMsgBoxOkCancel added
* Include untracked files missed in last commit
* Fix missing delete in MsgRecv_ItemUpgrade
* Resolve conflicts
* untrack submodules
* deps/db-modules removed
* Fix errors
* merge master
* merge master
* Fix errors
* Minor update
* Fix slot errors
* Formatter pass
* Add to WarFare/CMakeLists.txt
* Restore forward declaration
* This branch is implemented, disable lint checker for next one
* Address detected clang-tidy issues
* clang-tidy warning fixes
* Fix stack split error
* run clang-format
* Merge branch 'master' into itemupgrade
Conflicts:
src/Client/WarFare/GameDef.h
src/Client/WarFare/IconItemSkill.h
* Update e_ItemUpgradeResult naming in tests as well
* Remove redundant and nonsense definitions
* Rename for consistency
* Use 'requirement' consistently instead of 'material'
* GetWndDistrict(): Be explicit to indicate how this works
As-is there's no indication of what this method actually does; it isn't clear that
the cursor position is fetched for this. From the outside it looks like it serves
a completely different role than it actually does.
So we'll be explicit; that way it's clear that it's fetching the district for the
given cursor position.
* We don't really need a helper for this
At least, not implemented at this level - and then it would need to be more flexible.
... for effectively 2 lines of code.
* Move icon creation helper to __IconItemSkill
* Consistent free logic
delete() is legally allowed to pass nullptr. It's a no-op.
We don't need to constantly be checking for this.
* Rename GetItemFromInv() -> CopyInventoryItems()
This is more explicit in what it does.
Typically many UIs move icons around rather than copy (and are named as such; ItemMoveFromInvToThis).
'Get' is not very specific.
* Fix mem leaks in CopyInventoryItems() + HandleInventoryIconRightClick()
* Use int8_t for consistency
* Separate item being dragged from tooltip item
This ensures it's correct for the right frame and isn't unintentionally influenced between frames,
e.g. when dragging over the top of another icon.
Also fix bugs caused by implicit copies; we should just explicitly clone these as needed, rather than
this though.
* Consistently block item interactions during an upgrade
* Always allocate item for drag, refactor packet handling
Rather than have iffy logic having to constantly try and figure out if it's a copy (to free) or a reference (to absolutely not free, but restore),
we just always allocate a copy regardless.
Additionally, we refactor packet handling to modify the inventory and then just reload the inventory state.
This is simpler than trying to update 2 states (which it wasn't even doing, so they were easily out of state, especially with stack size changes).
Finally, remove MouseProc() - this logic is redundant. It's handled by UIMSG_ICON_DOWN already.
* Remove drag-specific stack hackery, modify on drag instead
(and consequently when restoring)
* Restore MouseProc(), remove UIMSG_ICON_DOWN implementation
At this level, MouseProc() can trigger a little more generously, at least
when we indicate work has been done (UI_MOUSEPROC_DONESOMETHING).
This allows things to act a little smoother as it still behaves when dragged outside the UI.
* Req items should show a stack size of 0 in the inventory when in use
* Don't allow upgrade slot items to be moved
* __IconItemSkill: Add Clone() and block implicit copy behaviour
It's unclear what exactly we want to copy here; we might want the icon, we might not.
Implicit copy behaviour by default would copy the pointer rather than allocate a new instance,
and then it wouldn't be clear which parent it should be assigned to.
To be very clear about what we want, we explicitly add Clone() to fully clone the entire thing.
Anything else can be handled manually, but it should be rare.
* Revert GetUVRect() changes for now
Don't want to touch tools. Too much of a hassle with clang-tidy for now.
Really need to go over tools with clang-tidy so this is not an issue.
* Remove redundant CreateIcon() call
* Refactor to be slightly more sensible/checked
* Sort requirement items in the client
Fix sort order to be consistent with official; this should be descending, not ascending
* These are used now
* These are signed
* Be consistent
* This is no longer used
* Restore official behaviour for single stack req items
Officially this will act as a 'move' and only show up in the requirement list.
Since we're just cloning, to simulate this, we just selectively hide/show the icon as appropriate.
* Only enforce upgrade UI item changes when visible
* Right-clicks should explicitly handle behaviour based on slot
* Ensure items are reset consistently after upgrades
On successful upgrades, on the next assignment, it should reset.
When it burns, we shouldn't bother preserving the slot position as
this item is deleted already, and it just blocks us from adding another.
Also make this consistent across right-clicks and left-clicks.
---------
Co-authored-by: twostars <i.am.twostars@gmail.com>1 parent 48b8440 commit 4481584
File tree
21 files changed
+1626
-77
lines changed- src
- Client/WarFare
- N3Base
- Server/Ebenezer
- tests/Server/Ebenezer
21 files changed
+1626
-77
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
394 | 399 | | |
395 | 400 | | |
396 | 401 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| 143 | + | |
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
| |||
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| 194 | + | |
192 | 195 | | |
193 | 196 | | |
194 | 197 | | |
| |||
242 | 245 | | |
243 | 246 | | |
244 | 247 | | |
| 248 | + | |
245 | 249 | | |
246 | 250 | | |
247 | 251 | | |
| |||
4221 | 4225 | | |
4222 | 4226 | | |
4223 | 4227 | | |
| 4228 | + | |
| 4229 | + | |
| 4230 | + | |
| 4231 | + | |
| 4232 | + | |
| 4233 | + | |
| 4234 | + | |
| 4235 | + | |
4224 | 4236 | | |
4225 | 4237 | | |
4226 | 4238 | | |
| |||
5778 | 5790 | | |
5779 | 5791 | | |
5780 | 5792 | | |
| 5793 | + | |
| 5794 | + | |
| 5795 | + | |
| 5796 | + | |
| 5797 | + | |
| 5798 | + | |
| 5799 | + | |
| 5800 | + | |
| 5801 | + | |
5781 | 5802 | | |
5782 | 5803 | | |
5783 | 5804 | | |
| |||
8001 | 8022 | | |
8002 | 8023 | | |
8003 | 8024 | | |
8004 | | - | |
8005 | 8025 | | |
8006 | | - | |
8007 | 8026 | | |
8008 | 8027 | | |
8009 | | - | |
8010 | 8028 | | |
8011 | 8029 | | |
| 8030 | + | |
8012 | 8031 | | |
8013 | 8032 | | |
8014 | 8033 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
12 | | - | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
35 | 43 | | |
36 | 44 | | |
37 | 45 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
916 | 916 | | |
917 | 917 | | |
918 | 918 | | |
919 | | - | |
920 | | - | |
921 | | - | |
| 919 | + | |
922 | 920 | | |
923 | 921 | | |
924 | 922 | | |
| |||
943 | 941 | | |
944 | 942 | | |
945 | 943 | | |
946 | | - | |
947 | | - | |
948 | | - | |
| 944 | + | |
949 | 945 | | |
950 | 946 | | |
951 | 947 | | |
| |||
970 | 966 | | |
971 | 967 | | |
972 | 968 | | |
973 | | - | |
974 | | - | |
975 | | - | |
| 969 | + | |
976 | 970 | | |
977 | 971 | | |
978 | 972 | | |
| |||
997 | 991 | | |
998 | 992 | | |
999 | 993 | | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
| 994 | + | |
1003 | 995 | | |
1004 | 996 | | |
1005 | 997 | | |
| |||
1024 | 1016 | | |
1025 | 1017 | | |
1026 | 1018 | | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
| 1019 | + | |
1030 | 1020 | | |
1031 | 1021 | | |
1032 | 1022 | | |
| |||
0 commit comments