Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyx14 committed Jan 9, 2025
1 parent 5e9942d commit 5116ecb
Show file tree
Hide file tree
Showing 48 changed files with 1,013 additions and 365 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ jobs:
run: >
sudo apt-get update && sudo apt-get install ccache linux-headers-"$(uname -r)"
- name: Switch to gcc-12 on Ubuntu 22.04
- name: Switch to gcc-13 on Ubuntu 22.04
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt install gcc-12 g++-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
sudo update-alternatives --set gcc /usr/bin/gcc-12
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt install gcc-13 g++-13 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
sudo update-alternatives --set gcc /usr/bin/gcc-13
- name: Switch to gcc-14 on Ubuntu 24.04
if: matrix.os == 'ubuntu-24.04'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -401,5 +401,8 @@ otxserver.old
# VCPKG
vcpkg_installed

# DB Backups
database_backup

# CLION
cmake-build-*
22 changes: 8 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,25 @@ We are trying to create the perfect custom OpenTibia server.
We currently provide build instructions for the following systems:
* [Windows Tutorial for OTX 6](https://github.com/mattyx14/otxserver/wiki/Compiling-on-Windows-(OTX-6-))

## OpenTibia Comunity:
With downloads, support, tutorials, Lua scripts, C++ codes, PHP codes and more ...
* [OTServ Brasil](https://docs.opentibiabr.com/) - [Português/English]
* [Tibiaking](https://tibiaking.com/) - [Português]
* [OTLand](https://otland.net/) - [English]
* [Tibia Face](https://tibiaface.foroactivo.com/) - [Español]

## Old Server Series:
Server created with TFS 0.3.7-(AKA 0.4) with endless improvements that make it ideal for old school servers based on 8.6, clearly it should be used completely with its data defined there.
* [OTX Server 2](https://github.com/mattyx14/otxserver/tree/otxserv2)

## OpenTibia Comunity:
With downloads, support, tutorials, Lua scripts, C++ codes, PHP codes and more ...
* [OTServ Brasil](https://docs.opentibiabr.com/) - [Português/English]
* [Tibiaking](https://tibiaking.com/) - [Português]
* [OTLand](https://otland.net/) - [English]
* [Tibia Face](https://tibiaface.foroactivo.com/) - [Español]

## Contacts OTX Server 2:
- <b>Matty(English & Spanish):</b><br>
Facebook: https://www.facebook.com/Mattyx14/<br>
E-mail: [email protected]<br>
Whatsapp: +5213173832937<br>

Whatsapp: +523211136700<br><br>
- <b>Reason(English & Portuguese):</b><br>
Discord: Reason#2913

- <b>FeeTads(Portuguese):</b><br>
E-mail: [email protected]<br>
Whatsapp: +55 41 9 84036942<br>
Discord: FeeTads#0246

## Special Thanks

- Our contributors ([Canary](https://github.com/opentibiabr/canary/graphs/contributors) | [OTServBR-Global](https://github.com/opentibiabr/otservbr-global/graphs/contributors)).
Expand Down
3 changes: 3 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ maintainModeMessage = ""
-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced"
-- NOTE: removeBeginningWeaponAmmunition: spears, arrows, bolt have endless ammo (allows training for paladins)
-- NOTE: refundManaOnBeginningWeapons: wand of vortex and snakebite refund mana used (allows training for mages)
-- NOTE: loginProtectionTime in MS
worldType = "pvp"
hotkeyAimbotEnabled = true
protectionLevel = 7
Expand All @@ -47,6 +48,7 @@ monthKillsToRedSkull = 10
redSkullDuration = 1
blackSkullDuration = 3
orangeSkullDuration = 7
loginProtectionTime = 10 * 1000

cleanProtectionZones = false

Expand Down Expand Up @@ -401,6 +403,7 @@ mysqlHost = "127.0.0.1"
mysqlUser = "root"
mysqlPass = ""
mysqlDatabase = ""
mysqlDatabaseBackup = true
mysqlPort = 3306
mysqlSock = ""
passwordType = "sha1"
Expand Down
1 change: 1 addition & 0 deletions data-otxserver/lib/functions/load.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dofile(DATA_DIRECTORY .. "/lib/functions/players.lua")
76 changes: 76 additions & 0 deletions data-otxserver/lib/functions/players.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
function Player.getCookiesDelivered(self)
local storage, amount =
{
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.SimonTheBeggar,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Markwin,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Ariella,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Hairycles,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Djinn,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.AvarTar,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.OrcKing,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Lorbas,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Wyda,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Hjaern,
}, 0
for i = 1, #storage do
if self:getStorageValue(storage[i]) == 1 then
amount = amount + 1
end
end
return amount
end

function Player.checkGnomeRank(self)
local points = self:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Rank)
local questProgress = self:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine)
if points >= 30 and points < 120 then
if questProgress <= 25 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 26)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
end
elseif points >= 120 and points < 480 then
if questProgress <= 26 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 27)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
end
elseif points >= 480 and points < 1440 then
if questProgress <= 27 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 28)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
self:addAchievement("Gnomelike")
end
elseif points >= 1440 then
if questProgress <= 29 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 30)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
self:addAchievement("Gnomelike")
self:addAchievement("Honorary Gnome")
end
end
return true
end

function Player.addFamePoint(self)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
local current = math.max(0, points)
self:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points, current + 1)
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received a fame point.")
end

function Player.getFamePoints(self)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
return math.max(0, points)
end

function Player.removeFamePoints(self, amount)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
local current = math.max(0, points)
self:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points, current - amount)
end
3 changes: 3 additions & 0 deletions data-otxserver/lib/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ dofile(DATA_DIRECTORY .. "/lib/quests/quest.lua")

-- Tables library
dofile(DATA_DIRECTORY .. "/lib/tables/load.lua")

-- Functions library
dofile(DATA_DIRECTORY .. "/lib/functions/load.lua")
24 changes: 12 additions & 12 deletions data-otxserver/npc/hireling.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function createHirelingType(HirelingName)
{ itemName = "crossbow", clientId = 3349, buy = 500, sell = 120 },
{ itemName = "crystalline arrow", clientId = 15793, buy = 450 },
{ itemName = "drill bolt", clientId = 16142, buy = 12 },
{ itemName = "diamond arrow", clientId = 35901, buy = 100 },
{ itemName = "diamond arrow", clientId = 35901, buy = 130 },
{ itemName = "earth arrow", clientId = 774, buy = 5 },
{ itemName = "envenomed arrow", clientId = 16143, buy = 12 },
{ itemName = "flaming arrow", clientId = 763, buy = 5 },
Expand Down Expand Up @@ -276,24 +276,24 @@ function createHirelingType(HirelingName)
},
["potions"] = {
{ itemName = "great health potion", clientId = 239, buy = 225 },
{ itemName = "great mana potion", clientId = 238, buy = 144 },
{ itemName = "great spirit potion", clientId = 7642, buy = 228 },
{ itemName = "great mana potion", clientId = 238, buy = 158 },
{ itemName = "great spirit potion", clientId = 7642, buy = 254 },
{ itemName = "health potion", clientId = 266, buy = 50 },
{ itemName = "mana potion", clientId = 268, buy = 56 },
{ itemName = "strong health potion", clientId = 236, buy = 115 },
{ itemName = "strong mana potion", clientId = 237, buy = 93 },
{ itemName = "supreme health potion", clientId = 23375, buy = 625 },
{ itemName = "strong mana potion", clientId = 237, buy = 108 },
{ itemName = "supreme health potion", clientId = 23375, buy = 650 },
{ itemName = "ultimate health potion", clientId = 7643, buy = 379 },
{ itemName = "ultimate mana potion", clientId = 23373, buy = 438 },
{ itemName = "ultimate spirit potion", clientId = 23374, buy = 438 },
{ itemName = "ultimate mana potion", clientId = 23373, buy = 488 },
{ itemName = "ultimate spirit potion", clientId = 23374, buy = 488 },
{ itemName = "empty potion flask", clientId = 283, sell = 5 },
{ itemName = "empty potion flask", clientId = 284, sell = 5 },
{ itemName = "empty potion flask", clientId = 285, sell = 5 },
{ itemName = "vial", clientId = 2874, sell = 5 },
},
["runes"] = {
{ itemName = "animate dead rune", clientId = 3203, buy = 375 },
{ itemName = "avalanche rune", clientId = 3161, buy = 57 },
{ itemName = "avalanche rune", clientId = 3161, buy = 64 },
{ itemName = "blank rune", clientId = 3147, buy = 10 },
{ itemName = "chameleon rune", clientId = 3178, buy = 210 },
{ itemName = "convince creature rune", clientId = 3177, buy = 80 },
Expand All @@ -308,7 +308,7 @@ function createHirelingType(HirelingName)
{ itemName = "fire field rune", clientId = 3188, buy = 28 },
{ itemName = "fire wall rune", clientId = 3190, buy = 61 },
{ itemName = "fireball rune", clientId = 3189, buy = 30 },
{ itemName = "great fireball rune", clientId = 3191, buy = 57 },
{ itemName = "great fireball rune", clientId = 3191, buy = 64 },
{ itemName = "heavy magic missile rune", clientId = 3198, buy = 12 },
{ itemName = "holy missile rune", clientId = 3182, buy = 16 },
{ itemName = "icicle rune", clientId = 3158, buy = 30 },
Expand All @@ -321,9 +321,9 @@ function createHirelingType(HirelingName)
{ itemName = "poison wall rune", clientId = 3176, buy = 52 },
{ itemName = "soulfire rune", clientId = 3195, buy = 46 },
{ itemName = "stalagmite rune", clientId = 3179, buy = 12 },
{ itemName = "stone shower rune", clientId = 3175, buy = 37 },
{ itemName = "sudden death rune", clientId = 3155, buy = 135 },
{ itemName = "thunderstorm rune", clientId = 3202, buy = 47 },
{ itemName = "stone shower rune", clientId = 3175, buy = 41 },
{ itemName = "sudden death rune", clientId = 3155, buy = 162 },
{ itemName = "thunderstorm rune", clientId = 3202, buy = 52 },
{ itemName = "ultimate healing rune", clientId = 3160, buy = 175 },
{ itemName = "wild growth rune", clientId = 3156, buy = 160 },
},
Expand Down
11 changes: 9 additions & 2 deletions data-otxserver/scripts/creaturescripts/customs/freequests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ local function playerFreeQuestStart(playerId, index)
return
end

if player:getStorageValue(questTable[index].storage) ~= questTable[index].storageValue then
player:setStorageValue(questTable[index].storage, questTable[index].storageValue)
local questData = questTable[index]
local currentStorageValue = player:getStorageValue(questData.storage)

if not questData.storage then
logger.warn("[Freequest System]: error storage for '" .. questData.storageName .. "' is nil for the index")
elseif currentStorageValue ~= questData.storageValue then
player:setStorageValue(questData.storage, questData.storageValue)
elseif currentStorageValue == -1 then
logger.warn("[Freequest System]: warning Storage '" .. questData.storageName .. "' currently nil for player ID " .. playerId)
end
end

Expand Down
4 changes: 2 additions & 2 deletions data/XML/events.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<events>
<event name="Example Event 1" startdate="11/03/2020" enddate="12/30/2023" script="example.lua" >
<event name="Example Event 1" startdate="11/03/2024" enddate="12/30/2025" script="example.lua" >
<ingame exprate="100" lootrate="100" bosslootrate="100" spawnrate="100" skillrate="100" />
<description description="Otserver br example 1 description double exp and a half, double loot !chance!, regular spawn and double skill" />
<colors colordark="#235c00" colorlight="#2d7400" />
<details displaypriority="6" isseasonal="0" specialevent="0" />
</event>
<event name="Example Event 2" startdate="2/2/2022" enddate="12/31/2023" script="" >
<event name="Example Event 2" startdate="2/2/2024" enddate="12/31/2025" script="example.lua" >
<ingame exprate="100" lootrate="100" bosslootrate="100" spawnrate="100" skillrate="100" />
<description description="Otserver br example 2 description 50% less exp, triple loot !chance!, 50% faster spawn and regular skill" />
<colors colordark="#735D10" colorlight="#8B6D05" />
Expand Down
4 changes: 2 additions & 2 deletions data/XML/imbuements.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<imbuements>
<base id="1" name="Basic" price="5000" protectionPrice="10000" percent="90" removecost="15000" duration="72000" />
<base id="2" name="Intricate" price="25000" protectionPrice="30000" percent="70" removecost="15000" duration="72000" />
<base id="3" name="Powerful" price="100000" protectionPrice="50000" percent="50" removecost="15000" duration="72000" />
<base id="2" name="Intricate" price="30000" protectionPrice="30000" percent="70" removecost="15000" duration="72000" />
<base id="3" name="Powerful" price="200000" protectionPrice="50000" percent="50" removecost="15000" duration="72000" />

<!-- Category Names -->
<category id="0" name="Elemental Damage" agressive="1" />
Expand Down
52 changes: 0 additions & 52 deletions data/events/scripts/creature.lua
Original file line number Diff line number Diff line change
@@ -1,60 +1,8 @@
local function removeCombatProtection(playerUid)
local player = Player(playerUid)
if not player then
return true
end

local time = 0
if player:isMage() then
time = 10
elseif player:isPaladin() then
time = 20
else
time = 30
end

player:kv():set("combat-protection", 2)
addEvent(function(playerFuncUid)
local playerEvent = Player(playerFuncUid)
if not playerEvent then
return
end

playerEvent:kv():remove("combat-protection")
playerEvent:remove()
end, time * 1000, playerUid)
end

function Creature:onTargetCombat(target)
if not self then
return true
end

if target:isPlayer() then
if self:isMonster() then
local isProtected = target:kv():get("combat-protection") or 0

if target:getIp() == 0 then -- If player is disconnected, monster shall ignore to attack the player
if target:isPzLocked() then
return true
end
if isProtected <= 0 then
addEvent(removeCombatProtection, 30 * 1000, target.uid)
target:kv():set("combat-protection", 1)
elseif isProtected == 1 then
self:searchTarget()
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
end

return true
end

if isProtected >= os.time() then
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
end
end
end

if (target:isMonster() and self:isPlayer() and target:getMaster() == self) or (self:isMonster() and target:isPlayer() and self:getMaster() == target) then
return RETURNVALUE_YOUMAYNOTATTACKTHISCREATURE
end
Expand Down
18 changes: 0 additions & 18 deletions data/libs/functions/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,6 @@ function Player.addManaSpent(...)
return ret
end

function Player.addFamePoint(self)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
local current = math.max(0, points)
self:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points, current + 1)
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received a fame point.")
end

function Player.getFamePoints(self)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
return math.max(0, points)
end

function Player.removeFamePoints(self, amount)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
local current = math.max(0, points)
self:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points, current - amount)
end

function Player.depositMoney(self, amount)
return Bank.deposit(self, amount)
end
Expand Down
Loading

0 comments on commit 5116ecb

Please sign in to comment.