Skip to content

Commit

Permalink
* New attributies to outfits
Browse files Browse the repository at this point in the history
* Bump version
I'm going to finish this efature
  • Loading branch information
jprzimba committed Jan 19, 2025
1 parent 0ff6dad commit 1b9fb0a
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 4 deletions.
22 changes: 21 additions & 1 deletion data/XML/outfits.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<outfits>
<!-- Example of new attributies
<outfit type="1" looktype="128" name="Citizen" premium="no" unlocked="yes" enabled="yes" healthGain="5" healthTicks="5" manaGain="5" manaTicks="5" manaShield="no" speed="220" attackSpeed="500">
<skills>
<fist value="1" />
<club value="2" />
<axe value="3" />
<sword value="4" />
<distance value="5" />
<shielding value="6" />
<fishing value="7" />
</skills>
<stats>
<maxHealth value="5" />
<maxMana value="5" />
<soul value="100" />
<cap value="100" />
<magicLevel value="1" />
</stats>
</outfit>
-->
<!-- Female -->
<outfit type="0" looktype="136" name="Citizen" premium="no" unlocked="yes" enabled="yes" />
<outfit type="0" looktype="137" name="Hunter" premium="no" unlocked="yes" enabled="yes" />
Expand Down Expand Up @@ -124,7 +144,7 @@
<outfit type="0" looktype="1777" name="Beekeeper" premium="no" unlocked="no" enabled="yes" from="store" />

<!-- Male -->
<outfit type="1" looktype="128" name="Citizen" premium="no" unlocked="yes" enabled="yes" manaShield="yes" speed="220" attackSpeed="500">
<outfit type="1" looktype="128" name="Citizen" premium="no" unlocked="yes" enabled="yes" healthGain="5" healthTicks="5" manaGain="5" manaTicks="5" manaShield="no" speed="220" attackSpeed="500">
<skills>
<fist value="1" />
<club value="2" />
Expand Down
19 changes: 19 additions & 0 deletions markdowns/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
43 changes: 42 additions & 1 deletion src/creatures/appearance/outfit/outfit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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]) {
Expand Down Expand Up @@ -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);
}
Expand All @@ -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]) {
Expand Down
8 changes: 7 additions & 1 deletion src/creatures/appearance/outfit/outfit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct OutfitEntry {
struct Outfit {
Outfit(std::string initName, std::string initFrom, bool initPremium, bool initUnlocked, uint16_t initLookType) :

Check warning on line 33 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 33 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 33 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 33 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 33 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 33 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

when initialized here [-Wreorder]
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));
}
Expand All @@ -44,11 +44,17 @@ struct Outfit {
bool unlocked;
bool manaShield;

Check warning on line 45 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘bool Outfit::manaShield’ [-Wreorder]

Check warning on line 45 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘bool Outfit::manaShield’ [-Wreorder]

Check warning on line 45 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘bool Outfit::manaShield’ [-Wreorder]

Check warning on line 45 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘bool Outfit::manaShield’ [-Wreorder]
bool invisible;
bool regeneration;

uint16_t lookType;

Check warning on line 49 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘Outfit::lookType’ will be initialized after [-Wreorder]

Check warning on line 49 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘Outfit::lookType’ will be initialized after [-Wreorder]

Check warning on line 49 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘Outfit::lookType’ will be initialized after [-Wreorder]

Check warning on line 49 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘Outfit::lookType’ will be initialized after [-Wreorder]

int32_t speed;

Check warning on line 51 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘int32_t Outfit::speed’ [-Wreorder]

Check warning on line 51 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘int32_t Outfit::speed’ [-Wreorder]
int32_t attackSpeed;
int32_t healthGain;
int32_t healthTicks;
int32_t manaGain;
int32_t manaTicks;

Check warning on line 56 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘Outfit::manaTicks’ will be initialized after [-Wreorder]

Check warning on line 56 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘Outfit::manaTicks’ will be initialized after [-Wreorder]

Check warning on line 56 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘Outfit::manaTicks’ will be initialized after [-Wreorder]

Check warning on line 56 in src/creatures/appearance/outfit/outfit.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘Outfit::manaTicks’ will be initialized after [-Wreorder]

int32_t skills[SKILL_LAST + 1];
int32_t stats[STAT_LAST + 1];
};
Expand Down

0 comments on commit 1b9fb0a

Please sign in to comment.