From 1b9fb0a6f6a0eb25972318475b4a0823e211a2e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo?= Date: Sun, 19 Jan 2025 09:01:33 -0300 Subject: [PATCH] * New attributies to outfits * Bump version I'm going to finish this efature --- data/XML/outfits.xml | 22 ++++++++++- markdowns/CHANGELOG.md | 19 ++++++++++ src/core.hpp | 2 +- src/creatures/appearance/outfit/outfit.cpp | 43 +++++++++++++++++++++- src/creatures/appearance/outfit/outfit.hpp | 8 +++- 5 files changed, 90 insertions(+), 4 deletions(-) diff --git a/data/XML/outfits.xml b/data/XML/outfits.xml index 60330101..19a5dd50 100644 --- a/data/XML/outfits.xml +++ b/data/XML/outfits.xml @@ -1,5 +1,25 @@ + @@ -124,7 +144,7 @@ - + diff --git a/markdowns/CHANGELOG.md b/markdowns/CHANGELOG.md index 5c9f257f..d40fefc9 100644 --- a/markdowns/CHANGELOG.md +++ b/markdowns/CHANGELOG.md @@ -1,6 +1,25 @@ # Changelog for Crystal Server +## Version 4.1.3 + +### Features + +- Add new attributies to outfits. ([Tryller](https://github.com/jprzimba)) + +## Added files + +- notting + +## Modified files + +- data/XML/outfits.xml + +### Bug Fixes + +- notting + + ## Version 4.1.2 ### Features diff --git a/src/core.hpp b/src/core.hpp index e324895a..eff9c42b 100644 --- a/src/core.hpp +++ b/src/core.hpp @@ -18,7 +18,7 @@ #pragma once static constexpr auto SOFTWARE_NAME = "Crystal Server"; -static constexpr auto SOFTWARE_VERSION = "4.1.2"; +static constexpr auto SOFTWARE_VERSION = "4.1.3"; static constexpr auto SOFTWARE_DEVELOPERS = "Crystal Server Contributors"; static constexpr auto AUTHENTICATOR_DIGITS = 6U; diff --git a/src/creatures/appearance/outfit/outfit.cpp b/src/creatures/appearance/outfit/outfit.cpp index 0b151cc2..df714688 100644 --- a/src/creatures/appearance/outfit/outfit.cpp +++ b/src/creatures/appearance/outfit/outfit.cpp @@ -90,6 +90,26 @@ bool Outfits::loadFromXml() { outfit->speed = outfitNode.attribute("speed").as_int(); outfit->attackSpeed = outfitNode.attribute("attackSpeed").as_int() || outfitNode.attribute("attackspeed").as_int(); + if (auto healthGainAttr = outfitNode.attribute("healthGain")) { + outfit->healthGain = healthGainAttr.as_int(); + outfit->regeneration = true; + } + + if (auto healthTicksAttr = outfitNode.attribute("healthTicks")) { + outfit->healthTicks = healthTicksAttr.as_int(); + outfit->regeneration = true; + } + + if (auto manaGainAttr = outfitNode.attribute("manaGain")) { + outfit->manaGain = manaGainAttr.as_int(); + outfit->regeneration = true; + } + + if (auto manaTicksAttr = outfitNode.attribute("manaTicks")) { + outfit->manaTicks = manaTicksAttr.as_int(); + outfit->regeneration = true; + } + if (auto skillsNode = outfitNode.child("skills")) { for (auto skillNode : skillsNode.children()) { std::string skillName = skillNode.name(); @@ -234,6 +254,23 @@ bool Outfits::addAttributes(uint32_t playerId, uint32_t outfitId, uint16_t sex, g_game().changeSpeed(player, outfit->speed); } + if (outfit->regeneration) { + const auto &condition = Condition::createCondition(CONDITIONID_OUTFIT, CONDITION_REGENERATION, -1, 0); + if(outfit->healthGain) + condition->setParam(CONDITION_PARAM_HEALTHGAIN, outfit->healthGain); + + if(outfit->healthTicks) + condition->setParam(CONDITION_PARAM_HEALTHTICKS, outfit->healthTicks); + + if(outfit->manaGain) + condition->setParam(CONDITION_PARAM_MANAGAIN, outfit->manaGain); + + if(outfit->manaTicks) + condition->setParam(CONDITION_PARAM_MANATICKS, outfit->manaTicks); + + player->addCondition(condition); + } + // Apply skills for (uint32_t i = SKILL_FIRST; i <= SKILL_LAST; ++i) { if (outfit->skills[i]) { @@ -270,7 +307,7 @@ bool Outfits::removeAttributes(uint32_t playerId, uint32_t outfitId, uint16_t se const auto &outfit = *it; - // Remoe conditions + // Remove conditions if (outfit->manaShield) { player->removeCondition(CONDITION_MANASHIELD, CONDITIONID_OUTFIT); } @@ -283,6 +320,10 @@ bool Outfits::removeAttributes(uint32_t playerId, uint32_t outfitId, uint16_t se g_game().changeSpeed(player, -outfit->speed); } + if (outfit->regeneration) { + player->removeCondition(CONDITION_REGENERATION, CONDITIONID_OUTFIT); + } + // Remove skills for (uint32_t i = SKILL_FIRST; i <= SKILL_LAST; ++i) { if (outfit->skills[i]) { diff --git a/src/creatures/appearance/outfit/outfit.hpp b/src/creatures/appearance/outfit/outfit.hpp index 67401cbc..045e3135 100644 --- a/src/creatures/appearance/outfit/outfit.hpp +++ b/src/creatures/appearance/outfit/outfit.hpp @@ -32,7 +32,7 @@ struct OutfitEntry { struct Outfit { Outfit(std::string initName, std::string initFrom, bool initPremium, bool initUnlocked, uint16_t initLookType) : name(std::move(initName)), from(std::move(initFrom)), premium(initPremium), unlocked(initUnlocked), lookType(initLookType), - manaShield(false), invisible(false), speed(0), attackSpeed(0) { + manaShield(false), invisible(false), regeneration(false), healthGain(0), healthTicks(0), manaGain(0), manaTicks(0), speed(0), attackSpeed(0) { std::memset(skills, 0, sizeof(skills)); std::memset(stats, 0, sizeof(stats)); } @@ -44,11 +44,17 @@ struct Outfit { bool unlocked; bool manaShield; bool invisible; + bool regeneration; uint16_t lookType; int32_t speed; int32_t attackSpeed; + int32_t healthGain; + int32_t healthTicks; + int32_t manaGain; + int32_t manaTicks; + int32_t skills[SKILL_LAST + 1]; int32_t stats[STAT_LAST + 1]; };