Skip to content

Commit

Permalink
improve: Bed regen config and change dlls.
Browse files Browse the repository at this point in the history
added mana/life gain setting when sleeping in bed.
  • Loading branch information
RCP91 committed Apr 15, 2024
1 parent f98f480 commit 59d4aee
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 5 deletions.
9 changes: 8 additions & 1 deletion .gitignore
@@ -1,3 +1,10 @@

logs/players*
compiler/vc17*
compiler/boost_filesystem-vc143-mt-x64-1_84.dll
compiler/libmariadb.dll
compiler/lua51.dll
compiler/mpir.dll
compiler/pugixml.dll
compiler/theforgottenserver.exe
compiler/theforgottenserver.pdb
compiler/zlib1.dll
Binary file removed boost_filesystem-vc143-mt-x64-1_83.dll
Binary file not shown.
Binary file modified boost_filesystem-vc143-mt-x64-1_84.dll
Binary file not shown.
10 changes: 6 additions & 4 deletions compiler/src/bed.cpp
Expand Up @@ -21,10 +21,12 @@

#include "bed.h"
#include "game.h"
#include "configmanager.h"
#include "iologindata.h"
#include "scheduler.h"

extern Game g_game;
extern ConfigManager g_config;

BedItem::BedItem(uint16_t id) : Item(id)
{
Expand Down Expand Up @@ -223,7 +225,7 @@ void BedItem::regeneratePlayer(Player* player) const
if (condition) {
uint32_t regen;
if (condition->getTicks() != -1) {
regen = std::min<int32_t>((condition->getTicks() / 1000), sleptTime) / 30;
regen = std::min<int32_t>((condition->getTicks() / 1000), sleptTime) / g_config.getNumber(ConfigManager::TICKS_REGEN_BED_GAIN);
const int32_t newRegenTicks = condition->getTicks() - (regen * 30000);
if (newRegenTicks <= 0) {
player->removeCondition(condition);
Expand All @@ -233,9 +235,9 @@ void BedItem::regeneratePlayer(Player* player) const
} else {
regen = sleptTime / 30;
}

player->changeHealth(regen, false);
player->changeMana(regen);
player->changeHealth(regen * g_config.getNumber(ConfigManager::RATE_LIFE_BED), false);
player->changeMana(regen * g_config.getNumber(ConfigManager::RATE_MANA_BED));
}

const int32_t soulRegen = sleptTime / (60 * 15);
Expand Down
3 changes: 3 additions & 0 deletions compiler/src/configmanager.cpp
Expand Up @@ -128,6 +128,9 @@ bool ConfigManager::load()
integer[NEWBIE_LEVEL_THRESHOLD] = getGlobalNumber(L, "newbieLevelThreshold", 5);
integer[MONEY_RATE] = getGlobalNumber(L, "moneyRate", 1);
integer[HOUSE_PRICE] = getGlobalNumber(L, "multiHousePricebyRent", 1);
integer[RATE_LIFE_BED] = getGlobalNumber(L, "RateLifeBed", 1);
integer[RATE_MANA_BED] = getGlobalNumber(L, "RateManaBed", 1);
integer[TICKS_REGEN_BED_GAIN] = getGlobalNumber(L, "TicksRegenBedGain", 30);

loaded = true;
lua_close(L);
Expand Down
3 changes: 3 additions & 0 deletions compiler/src/configmanager.h
Expand Up @@ -117,6 +117,9 @@ class ConfigManager
NEWBIE_LEVEL_THRESHOLD,
MONEY_RATE,
HOUSE_PRICE,
RATE_LIFE_BED,
RATE_MANA_BED,
TICKS_REGEN_BED_GAIN,

LAST_INTEGER_CONFIG /* this must be the last one */
};
Expand Down
5 changes: 5 additions & 0 deletions config.lua
Expand Up @@ -21,6 +21,11 @@ DropSpearFree = true
DropSpearPremium = true
MakeRuneBackpackFree = false
MakeRuneBackpackPremium = true
-- Every 30 seconds gains 1 regeneration, Default 30
TicksRegenBedGain = 5
-- Multiplies regeneration each gain, Default 1
RateLifeBed = 2
RateManaBed = 2

-- Skull System
banLength = 7 * 24 * 60 * 60
Expand Down
Binary file removed libcrypto-3-x64.dll
Binary file not shown.
Binary file modified libmariadb.dll
Binary file not shown.
Binary file removed libmysql.dll
Binary file not shown.
Binary file removed libssl-3-x64.dll
Binary file not shown.
Binary file modified lua51.dll
Binary file not shown.
Binary file modified mpir.dll
Binary file not shown.
Binary file modified pugixml.dll
Binary file not shown.
Binary file modified theforgottenserver.exe
Binary file not shown.
Binary file modified zlib1.dll
Binary file not shown.
Binary file removed zstd.dll
Binary file not shown.

0 comments on commit 59d4aee

Please sign in to comment.