Skip to content

Commit

Permalink
Merge branch 'opentibiabr:main' into mkZERA-Canary
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusvcj authored Nov 1, 2023
2 parents 359ebdc + 06683a6 commit 4b12d7c
Show file tree
Hide file tree
Showing 21 changed files with 316 additions and 180 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 @@ -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
22 changes: 8 additions & 14 deletions src/creatures/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,14 +625,6 @@ void Creature::onCreatureMove(std::shared_ptr<Creature> creature, std::shared_pt
void Creature::onDeath() {
bool lastHitUnjustified = false;
bool mostDamageUnjustified = false;
std::shared_ptr<Creature> lastHitCreature = g_game().getCreatureByID(lastHitCreatureId);
std::shared_ptr<Creature> lastHitCreatureMaster;
if (lastHitCreature) {
lastHitUnjustified = lastHitCreature->onKilledCreature(static_self_cast<Creature>(), true);
lastHitCreatureMaster = lastHitCreature->getMaster();
} else {
lastHitCreatureMaster = nullptr;
}

std::shared_ptr<Creature> mostDamageCreature = nullptr;

Expand Down Expand Up @@ -674,13 +666,15 @@ void Creature::onDeath() {
it.first->onGainExperience(it.second, getCreature());
}

std::shared_ptr<Creature> mostDamageCreatureMaster = nullptr;
if (mostDamageCreature) {
if (mostDamageCreature != lastHitCreature && mostDamageCreature != lastHitCreatureMaster) {
auto mostDamageCreatureMaster = mostDamageCreature->getMaster();
if (lastHitCreature != mostDamageCreatureMaster && (lastHitCreatureMaster == nullptr || mostDamageCreatureMaster != lastHitCreatureMaster)) {
mostDamageUnjustified = mostDamageCreature->onKilledCreature(static_self_cast<Creature>(), false);
}
}
mostDamageCreatureMaster = mostDamageCreature->getMaster();
mostDamageUnjustified = mostDamageCreature->onKilledCreature(getCreature(), false);
}

std::shared_ptr<Creature> lastHitCreature = g_game().getCreatureByID(lastHitCreatureId);
if (lastHitCreature && lastHitCreature != mostDamageCreature && lastHitCreature != mostDamageCreatureMaster) {
lastHitUnjustified = lastHitCreature->onKilledCreature(getCreature(), true);
}

bool droppedCorpse = dropCorpse(lastHitCreature, mostDamageCreature, lastHitUnjustified, mostDamageUnjustified);
Expand Down
10 changes: 7 additions & 3 deletions src/creatures/monsters/monsters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,19 @@ class MonsterType {
}

float getHealthMultiplier() const {
return info.bosstiaryClass.empty() ? g_configManager().getFloat(RATE_MONSTER_HEALTH) : g_configManager().getFloat(RATE_BOSS_HEALTH);
return isBoss() ? g_configManager().getFloat(RATE_BOSS_HEALTH) : g_configManager().getFloat(RATE_MONSTER_HEALTH);
}

float getAttackMultiplier() const {
return info.bosstiaryClass.empty() ? g_configManager().getFloat(RATE_MONSTER_ATTACK) : g_configManager().getFloat(RATE_BOSS_ATTACK);
return isBoss() ? g_configManager().getFloat(RATE_BOSS_ATTACK) : g_configManager().getFloat(RATE_MONSTER_ATTACK);
}

float getDefenseMultiplier() const {
return info.bosstiaryClass.empty() ? g_configManager().getFloat(RATE_MONSTER_DEFENSE) : g_configManager().getFloat(RATE_BOSS_DEFENSE);
return isBoss() ? g_configManager().getFloat(RATE_BOSS_DEFENSE) : g_configManager().getFloat(RATE_MONSTER_DEFENSE);
}

bool isBoss() const {
return !info.bosstiaryClass.empty();
}

void loadLoot(const std::shared_ptr<MonsterType> monsterType, LootBlock lootblock);
Expand Down
8 changes: 8 additions & 0 deletions src/creatures/players/grouping/party.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ class Party : public SharedObject {
std::shared_ptr<Player> getLeader() const {
return m_leader.lock();
}
std::vector<std::shared_ptr<Player>> getPlayers() const {
std::vector<std::shared_ptr<Player>> players;
for (auto &member : memberList) {
players.push_back(member);
}
players.push_back(getLeader());
return players;
}
std::vector<std::shared_ptr<Player>> getMembers() {
return memberList;
}
Expand Down
Loading

0 comments on commit 4b12d7c

Please sign in to comment.