Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge: merging prs #2443

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ onlyPremiumAccount = false
-- NOTE: enablePlayerPutItemInAmmoSlot = true, will enable players to put any items on ammo slot, more used in custom shopping system
-- NOTE: startStreakLevel will make a reward streak level for new players who never logged in
-- NOTE: if showLootsInBestiary is true, will cause all loots to be shown in the bestiary even if the player has not reached the required number of kills
-- NOTE: minTownIdToBankTransfer blocks towns less than defined from receiving money transfers
stashMoving = false
depotChest = 4
autoLoot = false
Expand All @@ -257,6 +258,7 @@ storeInboxMaxLimit = 2000
enablePlayerPutItemInAmmoSlot = false
startStreakLevel = 0
showLootsInBestiary = false
minTownIdToBankTransfer = 3

-- Teleport summon
-- Set to true will never remove the summon
Expand Down
1 change: 0 additions & 1 deletion data-canary/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Storage = {
},
},

DelayLargeSeaShell = 30002,
Imbuement = 30004,
}

Expand Down
28 changes: 0 additions & 28 deletions data-canary/scripts/actions/other/large_sea_shell.lua

This file was deleted.

1 change: 0 additions & 1 deletion data-otservbr-global/lib/others/load.lua
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
dofile(DATA_DIRECTORY .. "/lib/others/dawnport.lua")
dofile(DATA_DIRECTORY .. "/lib/others/vip_system.lua")
67 changes: 0 additions & 67 deletions data-otservbr-global/lib/others/vip_system.lua

This file was deleted.

20 changes: 0 additions & 20 deletions data-otservbr-global/scripts/actions/other/sweet_heart.lua

This file was deleted.

1 change: 1 addition & 0 deletions data/libs/systems/load.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ dofile(CORE_DIRECTORY .. "/libs/systems/hazard.lua")
dofile(CORE_DIRECTORY .. "/libs/systems/hireling.lua")
dofile(CORE_DIRECTORY .. "/libs/systems/raids.lua")
dofile(CORE_DIRECTORY .. "/libs/systems/reward_boss.lua")
dofile(CORE_DIRECTORY .. "/libs/systems/vip.lua")
dofile(CORE_DIRECTORY .. "/libs/systems/zones.lua")
62 changes: 62 additions & 0 deletions data/libs/systems/vip.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
-- Bonus mount and outfits
local outfits = {}
local mounts = {}

function Player.onRemoveVip(self)
self:sendTextMessage(MESSAGE_ADMINISTRATOR, "Your VIP days ran out.")

for _, outfit in ipairs(outfits) do
self:removeOutfit(outfit)
end

for _, mount in ipairs(mounts) do
self:removeMount(mount)
end

local playerOutfit = self:getOutfit()
if table.contains(outfits, self:getOutfit().lookType) then
if self:getSex() == PLAYERSEX_FEMALE then
playerOutfit.lookType = 136
else
playerOutfit.lookType = 128
end

playerOutfit.lookAddons = 0
self:setOutfit(playerOutfit)
end

self:kv():scoped("account"):remove("vip-system")
end

function Player.onAddVip(self, days, silent)
if not silent then
self:sendTextMessage(MESSAGE_ADMINISTRATOR, "You have received " .. days .. " VIP days.")
end

for _, outfit in ipairs(outfits) do
self:addOutfitAddon(outfit, 3)
end

for _, mount in ipairs(mounts) do
self:addMount(mount)
end

self:kv():scoped("account"):set("vip-system", true)
end

function CheckPremiumAndPrint(player, msgType)
local msg = ""

Check warning on line 48 in data/libs/systems/vip.lua

View workflow job for this annotation

GitHub Actions / luacheck

[luacheck] reported by reviewdog 🐶 value assigned to variable 'msg' is unused Raw Output: data/libs/systems/vip.lua:48:8: value assigned to variable 'msg' is unused
elsongabriel marked this conversation as resolved.
Show resolved Hide resolved

if player:getVipDays() == 0xFFFF then
msg = "You have infinite amount of VIP days left."
else
local playerVipTime = player:getVipTime()
if playerVipTime < os.time() then
msg = "You do not have VIP on your account."
else
msg = "You have " .. getFormattedTimeRemaining(playerVipTime) .. " of VIP time left."
end
end

player:sendTextMessage(MESSAGE_ADMINISTRATOR, msg)
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ local sweetheartRing = Action()
function sweetheartRing.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item == player:getSlotItem(CONST_SLOT_RING) then
player:getPosition():sendMagicEffect(CONST_ME_HEARTS)
return true
end
return false

return true
end

sweetheartRing:id(21955)
Expand Down
30 changes: 30 additions & 0 deletions data/scripts/actions/objects/large_seashell.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
local largeSeashell = Action()

function largeSeashell.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:hasExhaustion("delay-large-seashell") then
player:say("You have already opened a shell today.", TALKTYPE_MONSTER_SAY, false, player, item:getPosition())
return true
end

local chance = math.random(100)
local message = "Nothing is inside."

if chance <= 16 then
doTargetCombatHealth(0, player, COMBAT_PHYSICALDAMAGE, -200, -200, CONST_ME_NONE)
message = "Ouch! You squeezed your fingers."
elseif chance > 16 and chance <= 64 then
Game.createItem(math.random(281, 282), 1, player:getPosition())
message = "You found a beautiful pearl."
player:addAchievementProgress("Shell Seeker", 100)
end

player:setExhaustion("delay-large-seashell", 20 * 60 * 60)
player:say(message, TALKTYPE_MONSTER_SAY, false, player, item:getPosition())
item:transform(198)
item:decay()
item:getPosition():sendMagicEffect(CONST_ME_BUBBLES)
return true
end

largeSeashell:id(197)
largeSeashell:register()
6 changes: 3 additions & 3 deletions data/scripts/creaturescripts/player/offline_training.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function offlineTraining.onLogin(player)
player:setOfflineTrainingSkill(SKILL_NONE)

if offlineTime < 600 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must be logged out for more than 10 minutes to start offline training.")
player:sendTextMessage(MESSAGE_OFFLINE_TRAINING, "You must be logged out for more than 10 minutes to start offline training.")
return true
end

Expand Down Expand Up @@ -50,13 +50,13 @@ function offlineTraining.onLogin(player)
end

text = string.format("%s.", text)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, text)
player:sendTextMessage(MESSAGE_OFFLINE_TRAINING, text)

local vocation = player:getVocation()
local promotion = vocation:getPromotion()
local topVocation = not promotion and vocation or promotion

local updateSkills = false

if table.contains({ SKILL_CLUB, SKILL_SWORD, SKILL_AXE, SKILL_DISTANCE }, offlineTrainingSkill) then
local modifier = topVocation:getBaseAttackSpeed() / 1000
updateSkills = player:addOfflineTrainingTries(offlineTrainingSkill, (trainingTime / modifier) / (offlineTrainingSkill == SKILL_DISTANCE and 4 or 2))
Expand Down
3 changes: 2 additions & 1 deletion src/config/config_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ enum ConfigKey_t : uint16_t {
CLASSIC_ATTACK_SPEED,
CLEAN_PROTECTION_ZONES,
COMBAT_CHAIN_DELAY,
COMBAT_CHAIN_TARGETS,
COMBAT_CHAIN_SKILL_FORMULA_AXE,
COMBAT_CHAIN_SKILL_FORMULA_CLUB,
COMBAT_CHAIN_SKILL_FORMULA_SWORD,
COMBAT_CHAIN_TARGETS,
COMPRESSION_LEVEL,
CONVERT_UNSAFE_SCRIPTS,
CORE_DIRECTORY,
Expand Down Expand Up @@ -155,6 +155,7 @@ enum ConfigKey_t : uint16_t {
METRICS_PROMETHEUS_ADDRESS,
MIN_DELAY_BETWEEN_CONDITIONS,
MIN_ELEMENTAL_RESISTANCE,
MIN_TOWN_ID_TO_BANK_TRANSFER,
MOMENTUM_CHANCE_FORMULA_A,
MOMENTUM_CHANCE_FORMULA_B,
MOMENTUM_CHANCE_FORMULA_C,
Expand Down
7 changes: 4 additions & 3 deletions src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ bool ConfigManager::load() {
loadBoolConfig(L, XP_DISPLAY_MODE, "experienceDisplayRates", true);

loadFloatConfig(L, BESTIARY_RATE_CHARM_SHOP_PRICE, "bestiaryRateCharmShopPrice", 1.0);
loadFloatConfig(L, COMBAT_CHAIN_SKILL_FORMULA_AXE, "combatChainSkillFormulaAxe", 0.9);
loadFloatConfig(L, COMBAT_CHAIN_SKILL_FORMULA_CLUB, "combatChainSkillFormulaClub", 0.7);
loadFloatConfig(L, COMBAT_CHAIN_SKILL_FORMULA_SWORD, "combatChainSkillFormulaSword", 1.1);
loadFloatConfig(L, FORGE_AMOUNT_MULTIPLIER, "forgeAmountMultiplier", 3.0);
loadFloatConfig(L, HAZARD_EXP_BONUS_MULTIPLIER, "hazardExpBonusMultiplier", 2.0);
loadFloatConfig(L, LOYALTY_BONUS_PERCENTAGE_MULTIPLIER, "loyaltyBonusPercentageMultiplier", 1.0);
Expand Down Expand Up @@ -218,9 +221,6 @@ bool ConfigManager::load() {
loadIntConfig(L, CHECK_EXPIRED_MARKET_OFFERS_EACH_MINUTES, "checkExpiredMarketOffersEachMinutes", 60);
loadIntConfig(L, COMBAT_CHAIN_DELAY, "combatChainDelay", 50);
loadIntConfig(L, COMBAT_CHAIN_TARGETS, "combatChainTargets", 5);
loadFloatConfig(L, COMBAT_CHAIN_SKILL_FORMULA_AXE, "combatChainSkillFormulaAxe", 0.9);
loadFloatConfig(L, COMBAT_CHAIN_SKILL_FORMULA_CLUB, "combatChainSkillFormulaClub", 0.7);
loadFloatConfig(L, COMBAT_CHAIN_SKILL_FORMULA_SWORD, "combatChainSkillFormulaSword", 1.1);
loadIntConfig(L, COMPRESSION_LEVEL, "packetCompressionLevel", 6);
loadIntConfig(L, CRITICALCHANCE, "criticalChance", 10);
loadIntConfig(L, DAY_KILLS_TO_RED, "dayKillsToRedSkull", 3);
Expand Down Expand Up @@ -287,6 +287,7 @@ bool ConfigManager::load() {
loadIntConfig(L, METRICS_OSTREAM_INTERVAL, "metricsOstreamInterval", 1000);
loadIntConfig(L, MIN_DELAY_BETWEEN_CONDITIONS, "minDelayBetweenConditions", 0);
loadIntConfig(L, MIN_ELEMENTAL_RESISTANCE, "minElementalResistance", -200);
loadIntConfig(L, MIN_TOWN_ID_TO_BANK_TRANSFER, "minTownIdToBankTransfer", 3);
loadIntConfig(L, MONTH_KILLS_TO_RED, "monthKillsToRedSkull", 10);
loadIntConfig(L, MULTIPLIER_ATTACKONFIST, "multiplierSpeedOnFist", 5);
loadIntConfig(L, ORANGE_SKULL_DURATION, "orangeSkullDuration", 7);
Expand Down
6 changes: 3 additions & 3 deletions src/game/bank/bank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ const std::set<std::string> deniedNames = {
"paladinsample"
};

const uint32_t minTownId = 3;

bool Bank::transferTo(const std::shared_ptr<Bank> destination, uint64_t amount) {
if (!destination) {
g_logger().error("Bank::transferTo: destination is nullptr");
return false;
}

auto bankable = getBankable();
if (!bankable) {
g_logger().error("Bank::transferTo: bankable is nullptr");
return false;
}

auto destinationBankable = destination->getBankable();
if (!destinationBankable) {
g_logger().error("Bank::transferTo: destinationBankable is nullptr");
Expand All @@ -106,7 +106,7 @@ bool Bank::transferTo(const std::shared_ptr<Bank> destination, uint64_t amount)
g_logger().warn("Bank::transferTo: denied name: {}", name);
return false;
}
if (destinationPlayer->getTown()->getID() < minTownId) {
if (destinationPlayer->getTown()->getID() < g_configManager().getNumber(MIN_TOWN_ID_TO_BANK_TRANSFER, __FUNCTION__)) {
g_logger().warn("Bank::transferTo: denied town: {}", destinationPlayer->getTown()->getID());
return false;
}
Expand Down
Loading