Skip to content

QuickLoot Part 1#4337

Open
MillhioreBT wants to merge 3 commits intootland:masterfrom
Unreal-TFS:loot_categories
Open

QuickLoot Part 1#4337
MillhioreBT wants to merge 3 commits intootland:masterfrom
Unreal-TFS:loot_categories

Conversation

@MillhioreBT
Copy link
Copy Markdown
Contributor

@MillhioreBT MillhioreBT commented Feb 28, 2023

Pull Request Prelude

  • I have followed [proper The Forgotten Server code styling][code].
  • I have read and understood the [contribution guidelines][cont] before making this PR.
  • I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.

Changes Proposed

These changes add the bases to work in another PR the QuickLoot system
Add:

  • A category value for each item
  • A flag to the containers to identify what type they are for the system in question
  • 3540 categories extracted from Tibia RL archives updated 02/28 to items.otb
  • Mechanism to reset abandoned loot containers when a player moves them into their inventory
  • A reserved storage key for fallback, so you don't have to modify the database for this ugly boolean

Notes

This PR if merged will be the precursor to working QuickLoot, however I haven't made the decision yet whether to do it from sources or wait for the new onParsePacket method #4043, no matter what, I wanted to do this system in two parts.

Tests

As the QuickLoot system is not yet ready in this PR, you can do some tests to test these changes with a simple script
script.lua

local talkAction = TalkAction("!test")

function talkAction.onSay(player, words, param, type)
	local backpack = player:getSlotItem(CONST_SLOT_BACKPACK)
	player:setLootContainer(16, backpack) -- set backpack as loot container (16 = ammo category)
	return false
end

talkAction:register()

In the example i put 16, but you can choose the category you want.
the container will update, however if you want to see the changes in the QuickLoot window you must logout and login, as I said the system is not ready, but the bases are already there and are working.

image
image

For remove category:
player:setLootContainer(16, nil)

Help

If you have any suggestions on how to improve the code let me know <3

Extra Info

Number of items to which categories were added:

from appearances.dat

ARMORS: 129
AMULETS: 71
BOOTS: 45
CONTAINERS: 107
DECORATION: 462
FOOD: 164
HELMETS_HATS: 105
LEGS: 45
OTHERS: 518
POTIONS: 40
RINGS: 35
RUNES: 34
SHIELDS: 94
TOOLS: 80
VALUABLES: 351
AMMUNITION: 22
AXES: 121
CLUBS: 139
DISTANCE_WEAPONS: 74
SWORDS: 130
WANDS_RODS: 60
PREMIUM_SCROLLS: 1
TIBIA_COINS: 1
CREATURE_PRODUCTS: 707
QUIVER: 5

Issues addressed: Nothing!

@ghost ghost added the feature New feature or functionality label Feb 28, 2023
@ghost ghost requested review from nekiro and ranisalt February 28, 2023 16:00
@omarcopires
Copy link
Copy Markdown
Contributor

Just out of curiosity, what was added to items.otb?

@Zbizu
Copy link
Copy Markdown
Contributor

Zbizu commented Feb 28, 2023

Just out of curiosity, what was added to items.otb?

item flag corpse (1 << 29) - for items with "loot" in context menu
item property lootType (44) - for items that can be found in monsters

Copy link
Copy Markdown
Contributor

@Zbizu Zbizu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MillhioreBT
Copy link
Copy Markdown
Contributor Author

Just out of curiosity, what was added to items.otb?

The same number of items is maintained, but the difference is that now categories were added for those items that had a category defined in appearances.dat.
There in the description leave a list of the amount of item that each category has.

items.otb now has a new attribute called category and its key is 48 as declared HERE
This value only occupies 1 byte of information.

@omarcopires
Copy link
Copy Markdown
Contributor

Just out of curiosity, what was added to items.otb?

The same number of items is maintained, but the difference is that now categories were added for those items that had a category defined in appearances.dat. There in the description leave a list of the amount of item that each category has.

items.otb now has a new attribute called category and its key is 48 as declared HERE This value only occupies 1 byte of information.

Perfect explanation.
But which editor did you use to change it, is it open access?

@MillhioreBT
Copy link
Copy Markdown
Contributor Author

MillhioreBT commented Feb 28, 2023

Just out of curiosity, what was added to items.otb?

The same number of items is maintained, but the difference is that now categories were added for those items that had a category defined in appearances.dat. There in the description leave a list of the amount of item that each category has.
items.otb now has a new attribute called category and its key is 48 as declared HERE This value only occupies 1 byte of information.

Perfect explanation. But which editor did you use to change it, is it open access?

I use a small program to compile the items.otb
However, the information of the categories was obtained with another program written in python
when I have time I will add support to read appearances.dat and staticdata.dat to that same LuaOTB program

@ghost ghost requested review from a team March 2, 2023 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants