Skip to content

Commit

Permalink
Merge branch 'main' into fix-cask-and-kegs
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires authored Jul 9, 2024
2 parents 7dae449 + 98c4a10 commit c845a65
Show file tree
Hide file tree
Showing 135 changed files with 2,029 additions and 1,216 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ QualifierAlignment: Left
ReferenceAlignment: Right
ReflowComments: true
RemoveBracesLLVM: false
SortIncludes: false
SortIncludes: Never
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
Expand All @@ -138,4 +138,4 @@ StatementMacros:
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: true
UseTab: AlignWithSpaces
6 changes: 3 additions & 3 deletions .github/workflows/clang-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ jobs:

- name: Run clang format lint
if: ${{ github.ref != 'refs/heads/main' }}
uses: DoozyX/clang-format-lint-action@v0.16.2
uses: DoozyX/clang-format-lint-action@v0.17
with:
source: "src"
exclude: "src/protobuf"
extensions: "cpp,hpp,h"
clangFormatVersion: 16
clangFormatVersion: 17
inplace: true

- name: Run add and commit
if: ${{ github.ref != 'refs/heads/main' }}
uses: EndBug/add-and-commit@v9
uses: EndBug/add-and-commit@v9.1.4
with:
author_name: GitHub Actions
author_email: github-actions[bot]@users.noreply.github.com
Expand Down
90 changes: 20 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,43 @@
# OpenTibiaBR - Canary

[![Discord Channel](https://img.shields.io/discord/528117503952551936.svg?style=flat-square&logo=discord)](https://discord.gg/gvTj5sh9Mp)
[![GitHub issues](https://img.shields.io/github/issues/opentibiabr/canary)](https://github.com/opentibiabr/canary/issues)
[![GitHub pull request](https://img.shields.io/github/issues-pr/opentibiabr/canary)](https://github.com/opentibiabr/canary/pulls)
[![Contributors](https://img.shields.io/github/contributors/opentibiabr/canary.svg?style=flat-square)](https://github.com/opentibiabr/canary/graphs/contributors)
[![GitHub](https://img.shields.io/github/license/opentibiabr/canary)](https://github.com/opentibiabr/canary/blob/master/LICENSE)

![GitHub repo size](https://img.shields.io/github/repo-size/opentibiabr/canary)

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=opentibiabr_canary&metric=alert_status)](https://sonarcloud.io/dashboard?id=opentibiabr_canary)

## Builds

[![Build - Ubuntu](https://github.com/opentibiabr/canary/actions/workflows/build-ubuntu.yml/badge.svg)](https://github.com/opentibiabr/canary/actions/workflows/build-ubuntu.yml)
[![Build - Windows - CMake](https://github.com/opentibiabr/canary/actions/workflows/build-windows-cmake.yml/badge.svg)](https://github.com/opentibiabr/canary/actions/workflows/build-windows-cmake.yml)
[![Build - Windows - Solution](https://github.com/opentibiabr/canary/actions/workflows/build-windows-solution.yml/badge.svg)](https://github.com/opentibiabr/canary/actions/workflows/build-windows-solution.yml)
[![Build - Docker](https://github.com/opentibiabr/canary/actions/workflows/build-docker.yml/badge.svg)](https://github.com/opentibiabr/canary/actions/workflows/build-docker.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=opentibiabr_canary&metric=alert_status)](https://sonarcloud.io/dashboard?id=opentibiabr_canary)
![GitHub repo size](https://img.shields.io/github/repo-size/opentibiabr/canary)
[![GitHub](https://img.shields.io/github/license/opentibiabr/canary)](https://github.com/opentibiabr/canary/blob/main/LICENSE)

## Docker

`docker pull opentibiabr/canary:latest`<br><br>
[![Automation](https://img.shields.io/docker/cloud/automated/opentibiabr/canary)](https://hub.docker.com/r/opentibiabr/canary)
[![Image Size](https://img.shields.io/docker/image-size/opentibiabr/canary)](https://hub.docker.com/r/opentibiabr/canary/tags?page=1&ordering=last_updated)
![Pulls](https://img.shields.io/docker/pulls/opentibiabr/canary)
[![Build](https://img.shields.io/docker/cloud/build/opentibiabr/canary)](https://hub.docker.com/r/opentibiabr/canary/builds)

## Project

OpenTibiaBR - Canary is a free and open-source MMORPG server emulator written in C++.

It is a fork of the [OTServBR-Global](https://github.com/opentibiabr/otservbr-global) project. You can see the
repository history in the [releases](https://github.com/opentibiabr/otservbr-global/releases/).

This project was created with the intention of being a base as clean as possible, to work as an MMORPG engine and not
necessarily linked to Tibia Global, although it will also work. The OpenTibiaBR - Global was adapted to work with the
source of the Canary, so that it will be the first repository to use this engine.

To connect to the server and to take a stable experience, you can
use [mehah's otclient](https://github.com/mehah/otclient)
OpenTibiaBR - Canary is a free and open-source MMORPG server emulator written in C++. It is a fork of the [OTServBR-Global](https://github.com/opentibiabr/otservbr-global) project. To connect to the server and to take a stable experience, you can use [mehah's otclient](https://github.com/mehah/otclient)
or [tibia client](https://github.com/dudantas/tibia-client/releases/latest) and if you want to edit something, check
our [customized tools](https://docs.opentibiabr.com/opentibiabr/downloads/tools).

If you want edit the map, use the [own remere's map editor](https://github.com/opentibiabr/remeres-map-editor/).
our [customized tools](https://docs.opentibiabr.com/opentibiabr/downloads/tools). If you want to edit the map, use our own [remere's map editor](https://github.com/opentibiabr/remeres-map-editor/).

You are subject to our code of conduct, read
at [this link](https://github.com/opentibiabr/canary/blob/master/CODE_OF_CONDUCT.md).

### Getting **Started**
## Getting Started

* [Gitbook](https://docs.opentibiabr.com/opentibiabr/projects/canary).
* [Wiki](https://github.com/opentibiabr/canary/wiki).

### Issues
## Support

If you need help, please visit our [discord](https://discord.gg/gvTj5sh9Mp). Our issue tracker is not a support forum, and using it as one will result in your issue being closed.

We use the [issue tracker on GitHub](https://github.com/opentibiabr/canary/issues). Keep in mind that everyone who is
watching the repository gets notified by e-mail when there is an activity, so be thoughtful and avoid writing comments
that aren't meant for an issue (e.g. "+1"). If you'd like for an issue to be fixed faster, you should either fix it
yourself and submit a pull request, or place a bounty on the issue.
## Contributing

### Pull requests
Here are some ways you can contribute:

Before [creating a pull request](https://github.com/opentibiabr/canary/pulls) please keep in mind:
* [Issue Tracker](https://github.com/opentibiabr/canary/issues/new/choose).
* [Pull Request](https://github.com/opentibiabr/canary/pulls).

* Do not send Pull Request changing the map, as we can't review the changes it's better to use
our [Discord](https://discord.gg/gvTj5sh9Mp) to talk about or send the map changes to the responsible for updating it.
* Focus on fixing only one thing, mixing too much things on the same Pull Request make it harder to review, harder to
test and if we need to revert the change it will remove other things together.
* Follow the project indentation, if your editor support you can use the [editorconfig](https://editorconfig.org/) to
automatic configure the indentation.
* There are people that doesn't play the game on the official server, so explain your changes to help understand what
are you changing and why.
* Avoid opening a Pull Request to just update one line of an xml file.
You are subject to our code of conduct, read at [this link](https://github.com/opentibiabr/canary/blob/main/CODE_OF_CONDUCT.md).

### Special Thanks
## Special Thanks

* our partners
* our crew (majesty, gpedro, eduardo dantas, foot)
* [our contributors](https://github.com/opentibiabr/canary/graphs/contributors)
* [fear lucien](https://github.com/FearLucien)
* [cjaker](https://github.com/Eternal-Scripts)
* [slavidodo](https://github.com/slavidodo)
* [mignari and our awesome tools](https://github.com/ottools)
* [mattyx14/otxserver](https://github.com/mattyx14/otxserver) and contributors
* [otland/forgottenserver](https://github.com/otland/forgottenserver) and contributors
* [saiyansking/optimized_forgottenserver](https://github.com/SaiyansKing/optimized_forgottenserver) and contributors
* if we forget someone, we apologize by forgot you. but you know, **forgot**tenserver.
- Our contributors ([Canary](https://github.com/opentibiabr/canary/graphs/contributors) | [OTServBR-Global](https://github.com/opentibiabr/otservbr-global/graphs/contributors)).

### **Sponsors**
## Sponsors

See our [donate page](https://docs.opentibiabr.com/home/donate)
See our [donate page](https://docs.opentibiabr.com/home/donate).

## Project supported by JetBrains

Expand All @@ -98,6 +48,6 @@ other open-source initiatives.
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg" alt="JetBrains" width="150" />
</a>

### Partners
## Partners

[![Supported by OTServ Brasil](https://raw.githubusercontent.com/otbr/otserv-brasil/main/otbr.png)](https://forums.otserv.com.br)
7 changes: 7 additions & 0 deletions data-canary/scripts/creaturescripts/player_death.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ function playerDeath.onDeath(player, corpse, killer, mostDamageKiller, unjustifi
mostDamageName = "field item"
end

player:takeScreenshot(byPlayer and SCREENSHOT_TYPE_DEATHPVP or SCREENSHOT_TYPE_DEATHPVE)

if mostDamageKiller and mostDamageKiller:isPlayer() and killer ~= mostDamageKiller then
mostDamageKiller:takeScreenshot(SCREENSHOT_TYPE_PLAYERKILL)
end

local playerGuid = player:getGuid()
db.query(
"INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`) VALUES ("
Expand Down Expand Up @@ -83,6 +89,7 @@ function playerDeath.onDeath(player, corpse, killer, mostDamageKiller, unjustifi
end

if byPlayer == 1 then
killer:takeScreenshot(SCREENSHOT_TYPE_PLAYERKILL)
local targetGuild = player:getGuild()
targetGuild = targetGuild and targetGuild:getId() or 0
if targetGuild ~= 0 then
Expand Down
9 changes: 9 additions & 0 deletions data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3079,6 +3079,15 @@ GlobalStorage = {
DarashiaWest = 60193,
},
},
TheDreamCourts = {
-- Reserved storage from 60194 - 60196
FacelessBane = {
-- Global
StepsOn = 60194,
Deaths = 60195,
ResetSteps = 60196,
},
},
FuryGates = 65000,
Yakchal = 65001,
PitsOfInfernoLevers = 65002,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ monster.events = {
"GraveDangerBossDeath",
}

monster.health = 75000
monster.maxHealth = 75000
monster.health = 300000
monster.maxHealth = 300000
monster.race = "venom"
monster.corpse = 31599
monster.speed = 125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local mType = Game.createMonsterType("Faceless Bane")
local monster = {}

monster.description = "Faceless Bane"
monster.experience = 30000
monster.experience = 20000
monster.outfit = {
lookType = 1119,
lookHead = 0,
Expand All @@ -22,7 +22,11 @@ monster.manaCost = 0

monster.changeTarget = {
interval = 4000,
chance = 10,
chance = 20,
}

monster.reflects = {
{ type = COMBAT_DEATHDAMAGE, percent = 90 },
}

monster.bosstiary = {
Expand Down Expand Up @@ -131,11 +135,7 @@ monster.elements = {
{ type = COMBAT_DROWNDAMAGE, percent = 0 },
{ type = COMBAT_ICEDAMAGE, percent = 0 },
{ type = COMBAT_HOLYDAMAGE, percent = 0 },
{ type = COMBAT_DEATHDAMAGE, percent = 99 },
}

monster.heals = {
{ type = COMBAT_DEATHDAMAGE, percent = 100 },
{ type = COMBAT_DEATHDAMAGE, percent = 50 },
}

monster.immunities = {
Expand All @@ -149,6 +149,11 @@ mType.onThink = function(monster, interval) end

mType.onAppear = function(monster, creature)
if monster:getType():isRewardBoss() then
-- reset global storage state to default / ensure sqm's reset for the next team
Game.setStorageValue(GlobalStorage.TheDreamCourts.FacelessBane.Deaths, -1)
Game.setStorageValue(GlobalStorage.TheDreamCourts.FacelessBane.StepsOn, -1)
Game.setStorageValue(GlobalStorage.TheDreamCourts.FacelessBane.ResetSteps, 1)
monster:registerEvent("facelessBaneImmunity")
monster:setReward(true)
end
end
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/npc/emael.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ local function creatureSayCallback(npc, creature, type, message)
npcHandler:say("Ah, I see you killed a lot of dangerous creatures. Here's your podium of vigour!", npc, creature)
local inbox = player:getStoreInbox()
local inboxItems = inbox:getItems()
if inbox and #inboxItems <= inbox:getMaxCapacity() then
if inbox and #inboxItems < inbox:getMaxCapacity() then
local decoKit = inbox:addItem(ITEM_DECORATION_KIT, 1)
if decoKit then
decoKit:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Unwrap it in your own house to create a <" .. ItemType(38707):getName() .. ">.")
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/npc/emperor_kruzak.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ local function creatureSayCallback(npc, creature, type, message)
if player:getMoney() + player:getBankBalance() >= 500000000 then
local inbox = player:getStoreInbox()
local inboxItems = inbox:getItems()
if inbox and #inboxItems <= inbox:getMaxCapacity() then
if inbox and #inboxItems < inbox:getMaxCapacity() then
local decoKit = inbox:addItem(ITEM_DECORATION_KIT, 1)
local decoItemName = ItemType(31510):getName()
decoKit:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "You bought this item in the Store.\nUnwrap it in your own house to create a " .. decoItemName .. ".")
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/npc/hireling.lua
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ function createHirelingType(HirelingName)
local inboxItems = inbox:getItems()
if player:getFreeCapacity() < itType:getWeight(1) then
npcHandler:say("Sorry, but you don't have enough capacity.", npc, creature)
elseif not inbox or #inboxItems > inbox:getMaxCapacity() then
elseif not inbox or #inboxItems >= inbox:getMaxCapacity() then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
npcHandler:say("Sorry, you don't have enough room on your inbox", npc, creature)
elseif not player:removeMoneyBank(15000) then
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/npc/king_tibianus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ local function creatureSayCallback(npc, creature, type, message)
if player:getMoney() + player:getBankBalance() >= 500000000 then
local inbox = player:getStoreInbox()
local inboxItems = inbox:getItems()
if inbox and #inboxItems <= inbox:getMaxCapacity() then
if inbox and #inboxItems < inbox:getMaxCapacity() then
local decoKit = inbox:addItem(ITEM_DECORATION_KIT, 1)
local decoItemName = ItemType(31510):getName()
decoKit:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Unwrap it in your own house to create a " .. decoItemName .. ".")
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/npc/queen_eloise.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ local function creatureSayCallback(npc, creature, type, message)
if player:getMoney() + player:getBankBalance() >= 500000000 then
local inbox = player:getStoreInbox()
local inboxItems = inbox:getItems()
if inbox and #inboxItems <= inbox:getMaxCapacity() then
if inbox and #inboxItems < inbox:getMaxCapacity() then
local decoKit = inbox:addItem(ITEM_DECORATION_KIT, 1)
local decoItemName = ItemType(31510):getName()
decoKit:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "You bought this item in the Store.\nUnwrap it in your own house to create a " .. decoItemName .. ".")
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/npc/walter_jaeger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ local function processItemInboxPurchase(player, name, id)

local inbox = player:getStoreInbox()
local inboxItems = inbox:getItems()
if inbox and #inboxItems <= inbox:getMaxCapacity() then
if inbox and #inboxItems < inbox:getMaxCapacity() then
local decoKit = inbox:addItem(ITEM_DECORATION_KIT, 1)
if decoKit then
decoKit:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "You bought this item with the Walter Jaeger.\nUnwrap it in your own house to create a <" .. name .. ">.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function rapierQuest.onUse(player, item, fromPosition, target, toPosition, isHot
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a rapier.")
player:addItem(rewardId, 1)
player:questKV("rapier"):set("completed", true)
player:takeScreenshot(SCREENSHOT_TYPE_TREASUREFOUND)
return true
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
local bossName = "Faceless Bane"

local function healBoss(creature)
if creature then
creature:addHealth(creature:getMaxHealth())
creature:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
end
end

local function createSummons(creature)
if creature then
local pos = creature:getPosition()
Game.createMonster("Gazer Spectre", pos, true, false, creature)
Game.createMonster("Ripper Spectre", pos, true, false, creature)
Game.createMonster("Burster Spectre", pos, true, false, creature)
end
end

local function resetBoss(creature, deaths)
if creature then
healBoss(creature)
createSummons(creature)
Game.setStorageValue(GlobalStorage.TheDreamCourts.FacelessBane.Deaths, deaths + 1)
Game.setStorageValue(GlobalStorage.TheDreamCourts.FacelessBane.StepsOn, 0)
Game.setStorageValue(GlobalStorage.TheDreamCourts.FacelessBane.ResetSteps, 1)
end
end

local facelessBaneImmunity = CreatureEvent("facelessBaneImmunity")

function facelessBaneImmunity.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType)
if creature and creature:isMonster() and creature:getName() == bossName then
local creatureHealthPercent = (creature:getHealth() * 100) / creature:getMaxHealth()
local facelessBaneDeathsStorage = Game.getStorageValue(GlobalStorage.TheDreamCourts.FacelessBane.Deaths)

if creatureHealthPercent <= 20 and facelessBaneDeathsStorage < 1 then
resetBoss(creature, facelessBaneDeathsStorage)
return true
elseif Game.getStorageValue(GlobalStorage.TheDreamCourts.FacelessBane.StepsOn) < 1 then
healBoss(creature)
return true
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end

facelessBaneImmunity:register()
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ function playerDeath.onDeath(player, corpse, killer, mostDamageKiller, unjustifi
mostDamageName = "field item"
end

player:takeScreenshot(byPlayer and SCREENSHOT_TYPE_DEATHPVP or SCREENSHOT_TYPE_DEATHPVE)

if mostDamageKiller and mostDamageKiller:isPlayer() then
mostDamageKiller:takeScreenshot(SCREENSHOT_TYPE_PLAYERKILL)
end

local playerGuid = player:getGuid()
db.query(
"INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`) VALUES ("
Expand Down Expand Up @@ -83,6 +89,7 @@ function playerDeath.onDeath(player, corpse, killer, mostDamageKiller, unjustifi
end

if byPlayer == 1 then
killer:takeScreenshot(SCREENSHOT_TYPE_PLAYERKILL)
local targetGuild = player:getGuild()
local targetGuildId = targetGuild and targetGuild:getId() or 0
if targetGuildId ~= 0 then
Expand Down
Loading

0 comments on commit c845a65

Please sign in to comment.