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

Implement the enchantment table #32

Closed
madmaxoft opened this issue Aug 2, 2013 · 8 comments
Closed

Implement the enchantment table #32

madmaxoft opened this issue Aug 2, 2013 · 8 comments
Milestone

Comments

@madmaxoft
Copy link
Member

We have most of the parts working (UI, enchantments, etc.), so it'd be a good time to actually implement the enchanting on the enchantment table.

@madmaxoft
Copy link
Member Author

Note that Player XP (#143) and Experience orbs (#141) should be implemented first

@NiLSPACE
Copy link
Member

This video says that the text in an enchantment table does not effect the result enchantments. That should make this issue a bit easier.

@madmaxoft
Copy link
Member Author

I remember seeing that information in the official wiki already, quite a long time ago; also, there's nothing in the protocol to actually transmit the texts, only the XP levels are sent: http://wiki.vg/Protocol#Window_Property

@tigerw
Copy link
Member

tigerw commented Jan 18, 2014

The text is generated by the client using letters from the Standard Galactic Alphabet (true). The server doesn't need to worry about it.

@madmaxoft
Copy link
Member Author

I'm copying this text here from the forum, slightly updated and re-worded, 'cause I think it might come in handy.

When a player places an item in the enchantment slot, the server initializes a list of enchantments applicable to that specific item type by defaults. Then it asks plugins (by using a hook) to modify the list if they wish to do so.
When the player chooses the enchantment cost, find the (default) enchantments that the server would give the item out of that list, then fire a plugin hook saying user is about to enchant something at a specified cost, letting the plugins to modify the final enchantments.

HOOK_GET_APPLICABLE_ENCHANTMENTS: Called when the player places an item in the enchantment table's slot
Receives arguments:

  • the player
  • the item
  • array-table of cEnchantments, each containing a single allowed enchantment (represented as std::vector in the C++ code); the server initializes this to the default list of enchantments applicable for that item

Return values:

  • continue hook execution (bool) - when true, no more hooks in the chain are called (if not given, false if assumed)
  • array-table of cEnchantments, each containing a single allowed enchantment (if not given, the default list given in the parameter is assumed)
    After the hook returns, the server stores the list of applicable enchantments in the cPlayer object, so that it can retrieve it later, and displays the XP costs, if applicable.

HOOK_ENCHANTING_ITEM: Called when the player chooses the XP cost in the enchantment table's UI
Receives arguments:

  • the player
  • the item
  • the XP cost that the player has chosen
  • single cEnchantments class containing all the enchantments that the item will receive, initialized by the server from the list of applicable enchantments; plugins may directly modify this object

Return values:

  • continue hook execution (bool) - when true, no more hooks in the chain are called (if not given, false if assumed)

@daniel0916
Copy link
Contributor

I'm currently working on the enchanting table. I also created a thread in the forum.

@bennasar99
Copy link
Contributor

This needs to be closed,

@bearbin bearbin closed this as completed Apr 21, 2014
@madmaxoft
Copy link
Member Author

There's still the issue of hooks for plugins... It'd be a shame for my awesome description to go to waste :P

Daniel promised to refactor the enchanting code a bit more, so it'd be great to wait for him to finish it before doing anything plugin-wise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants