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

feat: augments #2602

Merged
merged 42 commits into from
May 13, 2024
Merged

feat: augments #2602

merged 42 commits into from
May 13, 2024

Conversation

phacUFPE
Copy link
Contributor

@phacUFPE phacUFPE commented May 3, 2024

Description

Implementing Augments system.
Please check the system in the following links:
https://tibia.fandom.com/wiki/Augments
https://www.tibia.com/news/?subtopic=newsarchive&id=7356

What must be done:

  • Add augments to all items that have it;
  • Parse augments from items.xml;
  • Add default value from config lua for augments without value;
  • Store augments into item;
  • Show augments on market;
  • Display augments on item look;
  • Apply augments cooldown on spell usage;
  • Apply augments that increase damage on spell usage;
  • Apply augments life/mana leech on spell usage;
  • Test against players (I ask for the community help to test);
  • Test against monsters (I ask for the community help to test).

Suggestions are welcome.

image

image

image

How to configure an item augment:

Supported augment types are:

  • "critical extra damage",
  • "life leech",
  • "mana leech",
  • "cooldown",
  • "increased damage", (don't need to set value, but can be customized for a specific item)
  • "strong impact", (don't need to set value, but can be customized for a specific item)
  • "powerful impact" (don't need to set value, but can be customized for a specific item)

Example of augment that have default value::

<attribute key="augments" value="1">
	<attribute key="spell name" value="augment type" />
</attribute>

NOTE: The key value of the key "augments" is to enable (1) and disable (0) the augments of the item.

Example of augment that don't have default value, the value must be set:

NOTE: The values represent percentagel, except for cooldown, it should be fill in miliseconds (120 seconds = 120000).

<attribute key="augments" value="1">
   <attribute key="energy wave" value="life leech">
     <attribute key="value" value="5" />
   </attribute>
</attribute>

How to customize an augment that already has a default value?

Just add attribute tag with the key value and the value that you which, example:

<attribute key="augments" value="1">
   <attribute key="energy wave" value="powerful impact">
     <attribute key="value" value="15" />
   </attribute>
</attribute>

changes:
- Added AugmentTypeNames map in tools
- Added AugmentTypes_t to items_definitions
- Added augments properties on items
- Added Augments type using std::map<std::string, std::map<AugmentTypes_t, uint8_t>>
@luanluciano93
Copy link
Contributor

luanluciano93 commented May 3, 2024

https://github.com/opentibiabr/canary/blob/main/src/items/functions/item/item_parse.cpp#L80

ItemParse::parseAugment(tmpStrValue, attributeNode, valueAttribute, itemType);

in parse

const phmap::flat_hash_map<std::string, AugmentsTypes_t> AugmentsTypeMap = {
	{ "powerful impact", AUGMENT_VALUE_POWERFUL_IMPACT },
	{ "strong impact", AUGMENT_VALUE_STRONG_IMPACT },
	{ "increased damage", AUGMENT_VALUE_INCREASED_DAMAGE },
	{ "cooldown", AUGMENT_VALUE_COOLDOWN },
	{ "critical extra damage", AUGMENT_VALUE_CRITICALHITDAMAGE },
	{ "life leech", AUGMENT_VALUE_LIFELEECHAMOUNT },
	{ "mana leech", AUGMENT_VALUE_MANALEECHAMOUNT },
};

src/items/functions/item/item_parse.cpp Outdated Show resolved Hide resolved
src/items/functions/item/item_parse.cpp Outdated Show resolved Hide resolved
changes:
- Added ITEM_PARSE_AUGMENT into item parse mapping
- Update parseAugment item parse (working)
@phacUFPE
Copy link
Contributor Author

phacUFPE commented May 3, 2024

Update!

Item parse working and storing into item.

image

phacUFPE and others added 3 commits May 3, 2024 11:10
@phacUFPE
Copy link
Contributor Author

phacUFPE commented May 3, 2024

Update!

Added item description.

image

changes:
- Added augments to all items that have it
@phacUFPE
Copy link
Contributor Author

phacUFPE commented May 4, 2024

Update!

Added augments to all sanguine and grand sanguine items.

phacUFPE and others added 5 commits May 4, 2024 00:34
changes:
- Added config key to load default values for: increase damage, powerful impact and strong impact
- Added to item parse the load of the augment value for these augments that do not display description
- Added keys to config.lua.dist
changes:
- Added augment description parser on utils tools
- Added augment description in market
@phacUFPE
Copy link
Contributor Author

phacUFPE commented May 4, 2024

Update!

Added augments descriptions on market.

image

changes:
- Added cooldown as miliseconds
changes:
- Added spell cooldown reduction to spells
- Added method to retrieve the augment items by spell name and/or by type
- Added spell method to get the spell cooldown reduction from the augment items
@phacUFPE
Copy link
Contributor Author

phacUFPE commented May 4, 2024

Update!

Cooldown augments working (except for avatar, avatar spells cooldown are calculated in the casting, after this PR I'll be investigating to fix it).

2024-05-04.08-52-14.mp4

@tomasz1337

This comment has been minimized.

@jbracovich

This comment has been minimized.

@phacUFPE

This comment has been minimized.

Copy link
Contributor

@dudantas dudantas left a comment

Choose a reason for hiding this comment

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

I have a few suggestions that could enhance performance and address other issues. Please remember to test these changes before implementing them, as my review is based solely on the code, and I haven’t applied them locally. Additional adjustments might be necessary to prevent compilation errors.

I will conduct the review in a way that locks the PR, because some modifications are optional, while others, like unnecessary copying that directly impacts performance, or dividing by zero without checking the divisor, could potentially cause more serious issues. Feel free to reach out to me for another review when you're ready.

src/creatures/combat/spells.cpp Outdated Show resolved Hide resolved
src/creatures/combat/spells.cpp Show resolved Hide resolved
src/creatures/combat/spells.cpp Outdated Show resolved Hide resolved
src/creatures/combat/spells.cpp Outdated Show resolved Hide resolved
src/creatures/players/player.cpp Outdated Show resolved Hide resolved
src/items/items.hpp Outdated Show resolved Hide resolved
src/items/items.hpp Outdated Show resolved Hide resolved
src/items/items_definitions.hpp Outdated Show resolved Hide resolved
src/server/network/protocol/protocolgame.cpp Outdated Show resolved Hide resolved
src/utils/tools.cpp Outdated Show resolved Hide resolved
phacUFPE and others added 3 commits May 9, 2024 08:52
changes:
- Applying suggestions and comments
changes:
- Applying suggestions and comments
@phacUFPE
Copy link
Contributor Author

phacUFPE commented May 9, 2024

I have a few suggestions that could enhance performance and address other issues. Please remember to test these changes before implementing them, as my review is based solely on the code, and I haven’t applied them locally. Additional adjustments might be necessary to prevent compilation errors.

I will conduct the review in a way that locks the PR, because some modifications are optional, while others, like unnecessary copying that directly impacts performance, or dividing by zero without checking the divisor, could potentially cause more serious issues. Feel free to reach out to me for another review when you're ready.

All fixed and working as expected.

phacUFPE and others added 8 commits May 9, 2024 10:40
- Added doc to config.lua.dist as requested by elsongabriel
- Added const auto &augments to avoid unnecessary copies
changes:
- Improvements
changes:
- Improvements
jprzimba added a commit to jprzimba/crystalserver that referenced this pull request May 10, 2024
phacUFPE added a commit that referenced this pull request May 12, 2024
# Description

This PR fixes the avatar cooldown reduction spells to be done in the
source and remove from scripts, this is being done to work with #2602.

## Behaviour
### **Actual**

The avatar cooldown reduction is via script.

### **Expected**

The avatar cooldown reduction is via source.

## Type of change

  - [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [x] Cast Avatar spell of each vocation with stage 1 in wheel, the
cooldown should be 120 minutes (two hours)
- [x] Cast Avatar spell of each vocation with stage 2 in wheel, the
cooldown should be 90 minutes (one and a half hour)
- [x] Cast Avatar spell of each vocation with stage 3 in wheel, the
cooldown should be 60 minutes (one hour)

**Test Configuration**:

  - Server Version: Latest
  - Client: 13.32
  - Operating System: Windows 11

## Checklist

  - [X] My code follows the style guidelines of this project
  - [X] I have performed a self-review of my own code
  - [X] I checked the PR checks reports
- [X] I have commented my code, particularly in hard-to-understand areas
  - [X] I have made corresponding changes to the documentation
  - [X] My changes generate no new warnings
- [X] I have added tests that prove my fix is effective or that my
feature works

---------

Co-authored-by: GitHub Actions <github-actions[bot]@users.noreply.github.com>
@phacUFPE phacUFPE requested a review from dudantas May 13, 2024 06:00
dudantas and others added 2 commits May 13, 2024 18:00
fix: extract augment name in own variable

fix: remove continue
changes:
- Called method to add spaces before capital letters on item augment description
@phacUFPE phacUFPE merged commit e0e7ab0 into opentibiabr:main May 13, 2024
33 checks passed
@phacUFPE phacUFPE deleted the feat_weapons_augment branch May 13, 2024 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: PRs Done
Development

Successfully merging this pull request may close these issues.

None yet