Skip to content

Commit

Permalink
* Add new configurable featuree in config.lua: bedsOnlyPremium.
Browse files Browse the repository at this point in the history
  • Loading branch information
jprzimba committed Dec 19, 2024
1 parent 314bb37 commit 25bc3cb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ housePurchasedShowPrice = false
houseLoseAfterInactivity = 30 -- days; 0 = never
onlyInvitedCanMoveHouseItems = true
togglehouseTransferOnRestart = true
bedsOnlyPremium = true

-- Item Usage
timeBetweenActions = 200
Expand Down
2 changes: 1 addition & 1 deletion markdowns/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- New protocol 14.05 assets. ([Tryller](https://github.com/jprzimba))
- Fix gotoHouse talkaction. ([Tryller](https://github.com/jprzimba))
- Optimized the `onPlayerSellAllLoot` code to prevent prolonged freezes. ([Tryller](https://github.com/jprzimba))
- Add new configurable featurees in `config.lua`: `chainSystemVipOnly`, `fieldOwnershipDuration`. ([Tryller](https://github.com/jprzimba))
- Add new configurable featurees in `config.lua`: `chainSystemVipOnly`, `fieldOwnershipDuration`, `bedsOnlyPremium`. ([Tryller](https://github.com/jprzimba))

## Added files

Expand Down
1 change: 1 addition & 0 deletions src/config/config_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,5 @@ enum ConfigKey_t : uint16_t {
BLACK_SKULL_DEATH_MANA,
CHAIN_SYSTEM_VIP_ONLY,
FIELD_OWNERSHIP,
BEDS_ONLY_PREMIUM,
};
1 change: 1 addition & 0 deletions src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ bool ConfigManager::load() {
loadFloatConfig(L, COMBAT_CHAIN_SKILL_FORMULA_DISTANCE, "combatChainSkillFormulaDistance", 0.9);
loadFloatConfig(L, COMBAT_CHAIN_SKILL_FORMULA_MISSILE, "combatChainSkillFormulaMissile", 0.9);
loadFloatConfig(L, COMBAT_CHAIN_SKILL_FORMULA_WANDS_AND_RODS, "combatChainSkillFormulaWandsAndRods", 1.0);
loadFloatConfig(L, BEDS_ONLY_PREMIUM, "bedsOnlyPremium", true);

loadIntConfig(L, ACTIONS_DELAY_INTERVAL, "timeBetweenActions", 200);
loadIntConfig(L, ADVENTURERSBLESSING_LEVEL, "adventurersBlessingLevel", 21);
Expand Down
7 changes: 6 additions & 1 deletion src/items/bed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ std::shared_ptr<BedItem> BedItem::getNextBedItem() {
}

bool BedItem::canUse(const std::shared_ptr<Player> &player) {
if ((player == nullptr) || (house == nullptr) || !player->isPremium()) {
if ((player == nullptr) || (house == nullptr)) {
return false;
}

if (g_configManager().getBoolean(BEDS_ONLY_PREMIUM) && !player->isPremium()) {
player->sendCancelMessage(RETURNVALUE_YOUNEEDPREMIUMACCOUNT);
return false;
}

Expand Down

0 comments on commit 25bc3cb

Please sign in to comment.