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

create itemType through revscriptsys #3010

Open
Zbizu opened this issue May 3, 2020 · 4 comments
Open

create itemType through revscriptsys #3010

Zbizu opened this issue May 3, 2020 · 4 comments
Assignees
Labels
enhancement Increase or improvement in quality, value, or extent feature New feature or functionality
Milestone

Comments

@Zbizu
Copy link
Contributor

Zbizu commented May 3, 2020

Explanation of what you want to do that is currently impossible

create new itemType through lua and set flags/attributes to it (preferable onStartup)

Desired functionality

Increase itemId variable capacity (uint16_t -> 32) in sources.
Create new items on the fly through lua scripts
Set clientId
Set/get all data that would be loaded from xml/otb otherwise

Available workarounds

xml/otb edit, though I don't even know where to find a working otb editor.

Prior art

TFS 0.4 could do it partially through mods (xml file in mods could override main one in existing item ids).

This is how it could look like in 1.x or 2.0:

local it = Game.createItemType(itemId, clientId) -- possible constructor
it:setFlag(flag, value) -- setters for ItemType class
it:setName(name)
it:setWeight(weight)
Game.createItem(itemId, 1, pos)

Problems to deal with

Loading the values the way they're seen as normal items in sources.

Dealing with items that don't get initialized anymore (set client id to avoid debug).

Dealing with container contents of items that aren't containers yet or anymore.

Deciding which house items should be loaded/saved. Making sure that they won't disappear.

(optional, otclient) fixing NPC trade window different items with same clientId bug or changing the way trade works in otclient and adapting the server for it.

@EvilHero90
Copy link
Contributor

This has already been planned and wont make it into 1.4 but it'll probably be a part of 1.5 along with NPC's and a few other things. I'll add this to the 2.0 roadmap tho, so we don't forget about it.

@EvilHero90 EvilHero90 added enhancement Increase or improvement in quality, value, or extent feature New feature or functionality labels May 3, 2020
@EvilHero90 EvilHero90 added this to the 2.0 milestone May 3, 2020
@EvilHero90 EvilHero90 self-assigned this May 3, 2020
@Zbizu
Copy link
Contributor Author

Zbizu commented May 3, 2020

No problem, it can even wait to 2.0.
A solid solution is better than a rushed one
(sorry about closing by accident, missclicked when posting from a phone)

@Zbizu Zbizu closed this as completed May 3, 2020
@Zbizu Zbizu reopened this May 3, 2020
@MillhioreBT MillhioreBT mentioned this issue Mar 2, 2021
3 tasks
@Zbizu
Copy link
Contributor Author

Zbizu commented Jun 29, 2021

Possible problems:

  • change of attributes - would have to update for all online users - including requirements to equip and weight changes. This would also have to update in houses.
  • loading before registration - currently incorrect items get outright discarded. This could be avoided by giving the new items a reserved id range.
  • xml/otb update - the items could overlap with new updates unless their ids were special.
  • market - heavily client sided like npc trade.

Possible alternative:

  • loading the items on startup from xml or lua file with all xml/otb attributes.

@Zbizu
Copy link
Contributor Author

Zbizu commented Jul 24, 2021

If anyone is interested, I wrote a converter that could free us from items.xml.
unknown-4

What do you think about moving itemType registration entirely to lua?

Edit: nvm didn't see the linked pr, but still: what do you think about that?

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

No branches or pull requests

2 participants