Skip to content

Commit

Permalink
Merge branch 'main' into hashset_to_vectorset
Browse files Browse the repository at this point in the history
  • Loading branch information
mehah committed Nov 2, 2023
2 parents b0596a1 + 57b4593 commit 94a10e7
Show file tree
Hide file tree
Showing 60 changed files with 858 additions and 696 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/clean-cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Cleanup caches by a branch
on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R "$REPO" -B "$BRANCH" -L 100 | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete "$cacheKey" -R "$REPO" -B "$BRANCH" --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
2 changes: 1 addition & 1 deletion config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ coreDirectory = "data"
-- Set log level
-- It can be trace, debug, info, warning, error, critical, off (default: info).
-- NOTE: Will only display logs with level higher or equal the one set.
logLevel = "debug"
logLevel = "info"

-- Combat settings
-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced"
Expand Down
10 changes: 9 additions & 1 deletion data-otservbr-global/migrations/41.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
function onUpdateDatabase()
return false -- true = There are others migrations file | false = this is the last migration file
logger.info("Updating database to version 42 (fix xpboost types)")

db.query([[
ALTER TABLE `players`
MODIFY `xpboost_stamina` smallint(5) UNSIGNED DEFAULT NULL,
MODIFY `xpboost_value` tinyint(4) UNSIGNED DEFAULT NULL
]])

return true
end
3 changes: 3 additions & 0 deletions data-otservbr-global/migrations/42.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function onUpdateDatabase()
return false -- true = There are others migrations file | false = this is the last migration file
end
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ monster.loot = {
{ name = "bloody tears", chance = 1500 },
{ name = "ghost chestplate", chance = 150 },
{ name = "spooky hood", chance = 150 },
{ name = "pale worm's scalp", chance = 1200 },
{ name = "spectral scrap of cloth", chance = 250 },
{ name = "fabulous legs", chance = 150 },
{ name = "phantasmal axe", chance = 150 },
{ name = "ghost backpack", chance = 150 },
Expand Down
26 changes: 26 additions & 0 deletions data-otservbr-global/npc/lokur.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,32 @@ local function creatureSayCallback(npc, creature, type, message)
return false
end

if MsgContains(message, "ticket") then
if Player(creature):getStorageValue(Storage.WagonTicket) >= os.time() then
npcHandler:say("Your weekly ticket is still valid. Would be a waste of money to purchase a second one", npc, creature)
return true
end

npcHandler:say("Do you want to purchase a weekly ticket for the ore wagons? With it you can travel freely and swiftly through Kazordoon for one week. 250 gold only. Deal?", npc, creature)
npcHandler:setTopic(playerId, 9)
elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) > 0 then
local player = Player(creature)
if npcHandler:getTopic(playerId) == 9 then
if not player:removeMoneyBank(250) then
npcHandler:say("You don't have enough money.", npc, creature)
npcHandler:setTopic(playerId, 0)
return true
end

player:setStorageValue(Storage.WagonTicket, os.time() + 7 * 24 * 60 * 60)
npcHandler:say("Here is your stamp. It can't be transferred to another person and will last one week from now. You'll get notified upon using an ore wagon when it isn't valid anymore.", npc, creature)
end
npcHandler:setTopic(playerId, 0)
elseif MsgContains(message, "no") and npcHandler:getTopic(playerId) > 0 then
npcHandler:say("No then.", npc, creature)
npcHandler:setTopic(playerId, 0)
end

-- Parse bank
npc:parseBank(message, npc, creature, npcHandler)
-- Parse guild bank
Expand Down
25 changes: 25 additions & 0 deletions data-otservbr-global/scripts/actions/mounts/haze_mount.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
local config = {
[32629] = { mountId = 162, message = "You are now versed to ride the haze!" },
}

local hazemount = Action()

function hazemount.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local mount = config[item.itemid]

if not mount then
return true
end

if not player:hasMount(mount.mountId) then
player:addMount(mount.mountId)
player:say(mount.message, TALKTYPE_MONSTER_SAY)
item:remove(1)
else
player:sendTextMessage(19, "You already have this mount")
end
return true
end

hazemount:id(32629)
hazemount:register()
40 changes: 20 additions & 20 deletions data/libs/concoctions_lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ ConcoctionTickType = {
Concoction = {}
Concoction.__index = Concoction
Concoction.Ids = {
KooldownAid = 36723,
StaminaExtension = 36725,
StrikeEnhancement = 36724,
CharmUpgrade = 36726,
WealthDuplex = 36727,
BestiaryBetterment = 36728,
FireResilience = 36729,
IceResilience = 36730,
EarthResilience = 36731,
EnergyResilience = 36732,
HolyResilience = 36733,
DeathResilience = 36734,
PhysicalResilience = 36735,
FireAmplification = 36736,
IceAmplification = 36737,
EarthAmplification = 36738,
EnergyAmplification = 36739,
HolyAmplification = 36740,
DeathAmplification = 36741,
PhysicalAmplification = 36742,
KooldownAid = Concoction_KooldownAid,
StaminaExtension = Concoction_StaminaExtension,
StrikeEnhancement = Concoction_StrikeEnhancement,
CharmUpgrade = Concoction_CharmUpgrade,
WealthDuplex = Concoction_WealthDuplex,
BestiaryBetterment = Concoction_BestiaryBetterment,
FireResilience = Concoction_FireResilience,
IceResilience = Concoction_IceResilience,
EarthResilience = Concoction_EarthResilience,
EnergyResilience = Concoction_EnergyResilience,
HolyResilience = Concoction_HolyResilience,
DeathResilience = Concoction_DeathResilience,
PhysicalResilience = Concoction_PhysicalResilience,
FireAmplification = Concoction_FireAmplification,
IceAmplification = Concoction_IceAmplification,
EarthAmplification = Concoction_EarthAmplification,
EnergyAmplification = Concoction_EnergyAmplification,
HolyAmplification = Concoction_HolyAmplification,
DeathAmplification = Concoction_DeathAmplification,
PhysicalAmplification = Concoction_PhysicalAmplification,
}

function Concoction.find(identifier)
Expand Down
14 changes: 14 additions & 0 deletions data/libs/raids_lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,17 @@ function Raid:getActivePlayerCount()
end
return count
end

--Overrides Encounter:addBroadcast
--Adds a stage that broadcasts raid information globally
--@param message string The message to send
--@return boolean True if the message stage is added successfully, false otherwise
function Raid:addBroadcast(message, type)
type = type or MESSAGE_EVENT_ADVANCE
return self:addStage({
start = function()
self:broadcast(type, message)
Webhook.sendMessage("Incoming raid", message, WEBHOOK_COLOR_RAID)
end,
})
end
35 changes: 0 additions & 35 deletions data/scripts/creatureevents/bestiary_kill.lua

This file was deleted.

33 changes: 0 additions & 33 deletions data/scripts/creatureevents/bosstiary_kill.lua

This file was deleted.

4 changes: 2 additions & 2 deletions schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ CREATE TABLE IF NOT EXISTS `players` (
`skill_manaleech_amount` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`manashield` SMALLINT UNSIGNED NOT NULL DEFAULT '0',
`max_manashield` SMALLINT UNSIGNED NOT NULL DEFAULT '0',
`xpboost_stamina` smallint(5) DEFAULT NULL,
`xpboost_value` tinyint(4) DEFAULT NULL,
`xpboost_stamina` smallint(5) UNSIGNED DEFAULT NULL,
`xpboost_value` tinyint(4) UNSIGNED DEFAULT NULL,
`marriage_status` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`marriage_spouse` int(11) NOT NULL DEFAULT '-1',
`bonus_rerolls` bigint(21) NOT NULL DEFAULT '0',
Expand Down
2 changes: 1 addition & 1 deletion src/account/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace account {
return ERROR_NO;
}

if (!m_descriptor.empty() && accountRepository.loadByEmail(m_descriptor, m_account)) {
if (!m_descriptor.empty() && accountRepository.loadByEmailOrName(getProtocolCompat(), m_descriptor, m_account)) {
m_accLoaded = true;
return ERROR_NO;
}
Expand Down
2 changes: 1 addition & 1 deletion src/account/account_repository.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace account {
virtual ~AccountRepository() = default;

virtual bool loadByID(const uint32_t &id, AccountInfo &acc) = 0;
virtual bool loadByEmail(const std::string &email, AccountInfo &acc) = 0;
virtual bool loadByEmailOrName(bool oldProtocol, const std::string &emailOrName, AccountInfo &acc) = 0;
virtual bool loadBySession(const std::string &email, AccountInfo &acc) = 0;
virtual bool save(const AccountInfo &accInfo) = 0;

Expand Down
7 changes: 4 additions & 3 deletions src/account/account_repository_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ namespace account {
return load(query, acc);
};

bool AccountRepositoryDB::loadByEmail(const std::string &email, AccountInfo &acc) {
auto query = fmt::format("SELECT `id`, `type`, `premdays`, `lastday`, `creation`, `premdays_purchased`, 0 AS `expires` FROM `accounts` WHERE `email` = {}", db.escapeString(email));
bool AccountRepositoryDB::loadByEmailOrName(bool oldProtocol, const std::string &emailOrName, AccountInfo &acc) {
auto identifier = oldProtocol ? "name" : "email";
auto query = fmt::format("SELECT `id`, `type`, `premdays`, `lastday`, `creation`, `premdays_purchased`, 0 AS `expires` FROM `accounts` WHERE `{}` = {}", identifier, db.escapeString(emailOrName));
return load(query, acc);
};

Expand Down Expand Up @@ -163,7 +164,7 @@ namespace account {
acc.premiumLastDay = result->getNumber<time_t>("lastday");
acc.sessionExpires = result->getNumber<time_t>("expires");
acc.premiumDaysPurchased = result->getNumber<uint32_t>("premdays_purchased");
acc.creationTime = result->getNumber<time_t>("creation");
acc.creationTime = result->getNumber<uint32_t>("creation");

setupLoyaltyInfo(acc);

Expand Down
2 changes: 1 addition & 1 deletion src/account/account_repository_db.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace account {
db(db), logger(logger) { }

bool loadByID(const uint32_t &id, AccountInfo &acc) override;
bool loadByEmail(const std::string &email, AccountInfo &acc) override;
bool loadByEmailOrName(bool oldProtocol, const std::string &emailOrName, AccountInfo &acc) override;
bool loadBySession(const std::string &esseionKey, AccountInfo &acc) override;
bool save(const AccountInfo &accInfo) override;

Expand Down
Loading

0 comments on commit 94a10e7

Please sign in to comment.