Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyx14 committed Aug 28, 2023
1 parent c9f4fe7 commit 0ac8210
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ saveIntervalTime = 15

-- Imbuement
toggleImbuementShrineStorage = false
toggleImbuementNonAggressiveFightOnly = false

-- Free quests
-- Add quest access to player when logging in
Expand Down
6 changes: 6 additions & 0 deletions data/items/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58873,21 +58873,27 @@
<attribute key="rotateTo" value="42334"/>
</item>
<item id="42336" name="opulent wood floor planks">
<attribute key="type" value="carpet"/>
<attribute key="wrapableto" value="23398"/>
</item>
<item id="42337" name="opulent wood floor">
<attribute key="type" value="carpet"/>
<attribute key="wrapableto" value="23398"/>
</item>
<item id="42338" name="loose opulent floor intarsia">
<attribute key="type" value="carpet"/>
<attribute key="wrapableto" value="23398"/>
</item>
<item id="42339" name="opulent floor intarsia">
<attribute key="type" value="carpet"/>
<attribute key="wrapableto" value="23398"/>
</item>
<item id="42340" name="rolled-up opulent carpet">
<attribute key="type" value="carpet"/>
<attribute key="wrapableto" value="23398"/>
</item>
<item id="42341" name="opulent carpet">
<attribute key="type" value="carpet"/>
<attribute key="wrapableto" value="23398"/>
</item>
<item id="42342" name="pile of riches">
Expand Down
2 changes: 1 addition & 1 deletion data/libs/hazard_lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Hazard:getHazardPlayerAndPoints(damageMap)
for key, _ in pairs(damageMap) do
local player = Player(key)
if player then
local playerHazardPoints = self:getPlayerCurrentLevel()
local playerHazardPoints = self:getPlayerCurrentLevel(player)

if playerHazardPoints < hazardPoints or hazardPoints == -1 then
hazardPlayer = player
Expand Down
1 change: 1 addition & 0 deletions src/config/config_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ enum booleanConfig_t {
TASK_HUNTING_FREE_THIRD_SLOT,
STASH_MOVING,
TOGGLE_IMBUEMENT_SHRINE_STORAGE,
TOGGLE_IMBUEMENT_NON_AGGRESSIVE_FIGHT_ONLY,
AUTOLOOT,
AUTOBANK,
RATE_USE_STAGES,
Expand Down
1 change: 1 addition & 0 deletions src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ bool ConfigManager::load() {
boolean[ONLY_PREMIUM_ACCOUNT] = getGlobalBoolean(L, "onlyPremiumAccount", false);
boolean[RATE_USE_STAGES] = getGlobalBoolean(L, "rateUseStages", false);
boolean[TOGGLE_IMBUEMENT_SHRINE_STORAGE] = getGlobalBoolean(L, "toggleImbuementShrineStorage", true);
boolean[TOGGLE_IMBUEMENT_NON_AGGRESSIVE_FIGHT_ONLY] = getGlobalBoolean(L, "toggleImbuementNonAggressiveFightOnly", false);

boolean[TOGGLE_DOWNLOAD_MAP] = getGlobalBoolean(L, "toggleDownloadMap", false);
boolean[USE_ANY_DATAPACK_FOLDER] = getGlobalBoolean(L, "useAnyDatapackFolder", false);
Expand Down
1 change: 0 additions & 1 deletion src/creatures/players/imbuements/imbuements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ bool Imbuements::loadFromXml(bool /* reloading */) {
pugi::cast<uint32_t>(baseNode.attribute("removecost").value()),
pugi::cast<uint32_t>(baseNode.attribute("duration").value()),
pugi::cast<uint16_t>(baseNode.attribute("percent").value())

);

// Category/Group
Expand Down
13 changes: 11 additions & 2 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ void Player::updateInventoryImbuement() {
bool isInProtectionZone = playerTile && playerTile->hasFlag(TILESTATE_PROTECTIONZONE);
// Check if the player is in fight mode
bool isInFightMode = hasCondition(CONDITION_INFIGHT);
bool nonAggressiveFightOnly = g_configManager().getBoolean(TOGGLE_IMBUEMENT_NON_AGGRESSIVE_FIGHT_ONLY);

// Iterate through all items in the player's inventory
for (auto item : getAllInventoryItems()) {
Expand All @@ -605,7 +606,7 @@ void Player::updateInventoryImbuement() {
auto parent = item->getParent();
bool isInBackpack = parent && parent->getContainer();
// If the imbuement is aggressive and the player is not in fight mode or is in a protection zone, or the item is in a container, ignore it.
if (categoryImbuement && categoryImbuement->agressive && (isInProtectionZone || !isInFightMode || isInBackpack)) {
if (categoryImbuement && (categoryImbuement->agressive || nonAggressiveFightOnly) && (isInProtectionZone || !isInFightMode || isInBackpack)) {
continue;
}
// If the item is not in the backpack slot and it's not a agressive imbuement, ignore it.
Expand All @@ -622,9 +623,15 @@ void Player::updateInventoryImbuement() {

g_logger().debug("Decaying imbuement {} from item {} of player {}", imbuement->getName(), item->getName(), getName());
// Calculate the new duration of the imbuement, making sure it doesn't go below 0
uint64_t duration = std::max<uint64_t>(0, imbuementInfo.duration - EVENT_IMBUEMENT_INTERVAL / 1000);
uint32_t duration = std::max<uint32_t>(0, imbuementInfo.duration - EVENT_IMBUEMENT_INTERVAL / 1000);
// Update the imbuement's duration in the item
item->decayImbuementTime(slotid, imbuement->getID(), duration);

if (duration == 0) {
removeItemImbuementStats(imbuement);
updateImbuementTrackerStats();
continue;
}
}
}
}
Expand Down Expand Up @@ -2906,6 +2913,8 @@ void Player::addInFightTicks(bool pzlock /*= false*/) {
sendIcons();
}

updateImbuementTrackerStats();

Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_INFIGHT, g_configManager().getNumber(PZ_LOCKED), 0);
addCondition(condition);
}
Expand Down
1 change: 1 addition & 0 deletions src/lua/functions/core/game/config_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ void ConfigFunctions::init(lua_State* L) {
registerEnumIn(L, "configKeys", SAVE_INTERVAL_TIME);
registerEnumIn(L, "configKeys", RATE_USE_STAGES);
registerEnumIn(L, "configKeys", TOGGLE_IMBUEMENT_SHRINE_STORAGE);
registerEnumIn(L, "configKeys", TOGGLE_IMBUEMENT_NON_AGGRESSIVE_FIGHT_ONLY);
registerEnumIn(L, "configKeys", GLOBAL_SERVER_SAVE_TIME);
registerEnumIn(L, "configKeys", DATA_DIRECTORY);
registerEnumIn(L, "configKeys", CORE_DIRECTORY);
Expand Down
1 change: 1 addition & 0 deletions src/security/argon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ bool Argon2::verifyPassword(const std::string &password, const std::string &phas
std::vector<uint8_t> computed_hash(hash.size());
if (argon2id_hash_raw(t_cost, m_cost, parallelism, password.c_str(), password.length(), salt.data(), salt.size(), computed_hash.data(), computed_hash.size()) != ARGON2_OK) {
g_logger().warn("Error hashing password");
return false;
}

// Compare
Expand Down
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "otxserver",
"version-string": "1.0.0",
"version-string": "6.2.0",
"dependencies": [
"argon2",
"asio",
Expand Down

0 comments on commit 0ac8210

Please sign in to comment.