Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable stack size per ItemType #4854

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ArturKnopik
Copy link
Contributor

@ArturKnopik ArturKnopik commented Nov 24, 2024

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

Configurable stack size per ItemType.
Configuration is done in items.xml file by using attribue "stacksize"
Example:

<item id="2316" article="an" name="animate dead rune">
	<attribute key="type" value="rune" />
	<attribute key="runeSpellName" value="adana mort" />
	<attribute key="weight" value="210" />
	<attribute key="charges" value="1" />
	<attribute key="stacksize" value="2" /> <!--  <<< HERE-->
</item>

note: npc now can sell multiple bp's with stackable items.

Issues addressed:
N/A

How to test:
Set 'stacksize' in any stackable item

  • Collect items from monsters
  • Move items in BP
  • Move items to Arrow/Weapon slot
  • Buy items from NPC

@ArturKnopik ArturKnopik marked this pull request as ready for review November 24, 2024 15:31
@ghost ghost requested review from ranisalt and MillhioreBT and removed request for ranisalt November 24, 2024 16:36
@@ -13685,6 +13686,18 @@ int LuaScriptInterface::luaItemTypeGetWorth(lua_State* L)
return 1;
}

int LuaScriptInterface::luaItemTypeGetStackSize(lua_State* L)
{
// itemType:getStackSize()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion

itemType:stackSize(value) // set
itemType:stackSize() // get

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's used only in shop system
setting stack size should be done only on startup, your change reguest will affect ItemType that is and should be static

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right, I hadn't seen that 😲

Copy link
Member

@nekiro nekiro Dec 5, 2024

Choose a reason for hiding this comment

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

not a fan of this "revscriptsys" way of getters and setters, make it obvious getAnything, setAnything
anything() is confusing and may result in undefined behaviour if you by any chance pass value or actually pass no value, which could happen, because lua is a dynamic language

@ArturKnopik ArturKnopik added enhancement Increase or improvement in quality, value, or extent feature New feature or functionality labels Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Increase or improvement in quality, value, or extent feature New feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants