Skip to content

Commit c8e8190

Browse files
committed
* Add a new configurable feature in config.lua: chainSystemVipOnly."
1 parent 6f45409 commit c8e8190

File tree

6 files changed

+15
-2
lines changed

6 files changed

+15
-2
lines changed

config.lua.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ maxDamageReflection = 200
450450
-- Chain system
451451
-- NOTE: combatChainDelay: set to minimum 50 miliseconds
452452
toggleChainSystem = false
453+
chainSystemVipOnly = true
453454
combatChainDelay = 50
454455
combatChainTargets = 5
455456
combatChainSkillFormulaAxe = 0.9

data/scripts/talkactions/player/chain_system.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ function feature.onSay(player, words, param)
1010
return true
1111
end
1212

13+
if configManager.getBoolean(configKeys.VIP_SYSTEM_ENABLED) and configManager.getBoolean(configKeys.CHAIN_SYSTEM_VIP_ONLY) and not player:isVip() then
14+
player:sendCancelMessage("You need to be VIP to use this command!")
15+
return true
16+
end
17+
1318
if not table.contains(validValues, param) then
1419
local validValuesStr = table.concat(validValues, "/")
1520
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Invalid param specified. Usage: !chain [" .. validValuesStr .. "]")

markdowns/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- New protocol 14.05 assets. ([Tryller](https://github.com/jprzimba))
1010
- Fix gotoHouse talkaction. ([Tryller](https://github.com/jprzimba))
1111
- Optimized the `onPlayerSellAllLoot` code to prevent prolonged freezes. ([Tryller](https://github.com/jprzimba))
12+
- Add a new configurable feature in `config.lua`: `chainSystemVipOnly`. ([Tryller](https://github.com/jprzimba))
1213

1314
## Added files
1415

src/config/config_enums.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,4 +345,5 @@ enum ConfigKey_t : uint16_t {
345345
FAIRFIGHT_TIMERANGE,
346346
BLACK_SKULL_DEATH_HEALTH,
347347
BLACK_SKULL_DEATH_MANA,
348+
CHAIN_SYSTEM_VIP_ONLY,
348349
};

src/config/configmanager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ bool ConfigManager::load() {
168168
loadBoolConfig(L, HALF_LOSS_EXP, "halfLossExp", true);
169169
loadBoolConfig(L, HALF_LOSS_SKILL, "halfLossSkill", true);
170170
loadBoolConfig(L, HALF_LOSS_MAGIC, "halfLossMagicLevel", true);
171+
loadBoolConfig(L, CHAIN_SYSTEM_VIP_ONLY, "chainSystemVipOnly", false);
171172

172173
loadFloatConfig(L, BESTIARY_RATE_CHARM_SHOP_PRICE, "bestiaryRateCharmShopPrice", 1.0);
173174
loadFloatConfig(L, COMBAT_CHAIN_SKILL_FORMULA_AXE, "combatChainSkillFormulaAxe", 0.9);

src/creatures/players/player.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4934,6 +4934,7 @@ bool Player::checkAutoLoot(bool isBoss) const {
49344934
if (!g_configManager().getBoolean(AUTOLOOT)) {
49354935
return false;
49364936
}
4937+
49374938
if (g_configManager().getBoolean(VIP_SYSTEM_ENABLED) && g_configManager().getBoolean(VIP_AUTOLOOT_VIP_ONLY) && !isVip()) {
49384939
return false;
49394940
}
@@ -4949,8 +4950,11 @@ bool Player::checkAutoLoot(bool isBoss) const {
49494950
}
49504951

49514952
bool Player::checkChainSystem() const {
4952-
const bool toggleChain = g_configManager().getBoolean(TOGGLE_CHAIN_SYSTEM);
4953-
if (!toggleChain) {
4953+
if (!g_configManager().getBoolean(TOGGLE_CHAIN_SYSTEM)) {
4954+
return false;
4955+
}
4956+
4957+
if (g_configManager().getBoolean(VIP_SYSTEM_ENABLED) && g_configManager().getBoolean(CHAIN_SYSTEM_VIP_ONLY) && !isVip()) {
49544958
return false;
49554959
}
49564960

0 commit comments

Comments
 (0)