Skip to content

Commit

Permalink
Merge branch 'main' into luan/no-more-onkill
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas authored Nov 2, 2023
2 parents 49021a9 + 87904e3 commit 0df66de
Show file tree
Hide file tree
Showing 43 changed files with 752 additions and 603 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
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 @@ -96,6 +96,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/creatures/combat/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ void Combat::addDistanceEffect(std::shared_ptr<Creature> caster, const Position

void Combat::doChainEffect(const Position &origin, const Position &dest, uint8_t effect) {
if (effect > 0) {
std::forward_list<Direction> dirList;
stdext::arraylist<Direction> dirList(128);
FindPathParams fpp;
fpp.minTargetDist = 0;
fpp.maxTargetDist = 1;
Expand Down
6 changes: 3 additions & 3 deletions src/creatures/combat/condition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@ bool ConditionFeared::getFleeDirection(std::shared_ptr<Creature> creature) {
return false;
}

bool ConditionFeared::getFleePath(std::shared_ptr<Creature> creature, const Position &pos, std::forward_list<Direction> &dirList) {
bool ConditionFeared::getFleePath(std::shared_ptr<Creature> creature, const Position &pos, stdext::arraylist<Direction> &dirList) {
const std::vector<uint8_t> walkSize { 15, 9, 3, 1 };
bool found = false;
std::ptrdiff_t found_size = 0;
Expand Down Expand Up @@ -2030,7 +2030,7 @@ bool ConditionFeared::startCondition(std::shared_ptr<Creature> creature) {

bool ConditionFeared::executeCondition(std::shared_ptr<Creature> creature, int32_t interval) {
Position currentPos = creature->getPosition();
std::forward_list<Direction> listDir;
stdext::arraylist<Direction> listDir(128);

g_logger().debug("[ConditionFeared::executeCondition] Executing condition, current position is {}", currentPos.toString());

Expand All @@ -2040,7 +2040,7 @@ bool ConditionFeared::executeCondition(std::shared_ptr<Creature> creature, int32
}

if (getFleePath(creature, currentPos, listDir)) {
g_dispatcher().addEvent(std::bind(&Game::forcePlayerAutoWalk, &g_game(), creature->getID(), listDir), "ConditionFeared::executeCondition");
g_dispatcher().addEvent(std::bind(&Game::forcePlayerAutoWalk, &g_game(), creature->getID(), listDir.data()), "ConditionFeared::executeCondition");
g_logger().debug("[ConditionFeared::executeCondition] Walking Scheduled");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/combat/condition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class ConditionFeared final : public Condition {
private:
bool canWalkTo(std::shared_ptr<Creature> creature, Position pos, Direction moveDirection) const;
bool getFleeDirection(std::shared_ptr<Creature> creature);
bool getFleePath(std::shared_ptr<Creature> creature, const Position &pos, std::forward_list<Direction> &dirList);
bool getFleePath(std::shared_ptr<Creature> creature, const Position &pos, stdext::arraylist<Direction> &dirList);
bool getRandomDirection(std::shared_ptr<Creature> creature, Position pos);
bool isStuck(std::shared_ptr<Creature> creature, Position pos) const;

Expand Down
Loading

0 comments on commit 0df66de

Please sign in to comment.