Skip to content

Commit

Permalink
Merge branch 'master' into bye-bye-raids
Browse files Browse the repository at this point in the history
  • Loading branch information
ranisalt authored Dec 13, 2023
2 parents 89992a2 + fee42e4 commit 409f0a5
Show file tree
Hide file tree
Showing 65 changed files with 937 additions and 462 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Run vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 501db0f17ef6df184fcdbfbe0f87cde2313b6ab1
vcpkgGitCommitId: a42af01b72c28a8e1d7b48107b33e4f286a55ef6

- name: Build with CMake
uses: lukka/run-cmake@v10
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Run vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 501db0f17ef6df184fcdbfbe0f87cde2313b6ab1
vcpkgGitCommitId: a42af01b72c28a8e1d7b48107b33e4f286a55ef6

- name: Build with CMake
uses: lukka/run-cmake@v10
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ jobs:
test:
runs-on: ubuntu-latest

env:
CC: gcc
CXX: g++

steps:
- uses: actions/checkout@v3

Expand All @@ -29,5 +25,5 @@ jobs:
with:
buildPreset: default
configurePreset: default
configurePresetAdditionalArgs: "['-G Ninja', '-DENABLE_TESTING=ON']"
configurePresetAdditionalArgs: "['-G Ninja', '-DBUILD_TESTING=ON']"
testPreset: default
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ endif ()

find_package(Boost 1.66.0 REQUIRED COMPONENTS system iostreams)

option(ENABLE_TESTING "Build unit tests" OFF)
option(BUILD_TESTING "Build unit tests" OFF)

include_directories(${Boost_INCLUDE_DIRS} ${Crypto++_INCLUDE_DIR} ${LUA_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR} ${PUGIXML_INCLUDE_DIR})

Expand All @@ -78,7 +78,8 @@ add_subdirectory(src)
add_executable(tfs ${tfs_MAIN})
target_link_libraries(tfs tfslib)

if (ENABLE_TESTING)
if (BUILD_TESTING)
message(STATUS "Building unit tests")
enable_testing()
add_subdirectory(src/tests)
endif()
Expand Down
2 changes: 2 additions & 0 deletions data/XML/mounts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,6 @@
<mount id="198" clientid="1526" name="Poppy Ibex" speed="20" premium="no" />
<mount id="199" clientid="1527" name="Mint Ibex" speed="20" premium="no" />
<mount id="200" clientid="1528" name="Cinnamon Ibex" speed="20" premium="no" />
<mount id="201" clientid="1536" name="Giant Beaver" speed="20" premium="yes" />
<mount id="202" clientid="1577" name="Ripptor" speed="20" premium="yes" />
</mounts>
4 changes: 4 additions & 0 deletions data/XML/outfits.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
<outfit type="0" looktype="1461" name="Formal Dress" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1490" name="Ghost Blade" premium="no" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1501" name="Nordic Chieftain" premium="no" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1568" name="Fire-Fighter" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1576" name="Fencer" premium="no" unlocked="no" enabled="yes" />

<!-- Male outfits -->
<outfit type="1" looktype="128" name="Citizen" premium="no" unlocked="yes" enabled="yes" />
Expand Down Expand Up @@ -215,4 +217,6 @@
<outfit type="1" looktype="1460" name="Formal Dress" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1489" name="Ghost Blade" premium="no" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1500" name="Nordic Chieftain" premium="no" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1569" name="Fire-Fighter" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1575" name="Fencer" premium="no" unlocked="no" enabled="yes" />
</outfits>
2 changes: 1 addition & 1 deletion data/actions/scripts/others/enchanting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
end

local storageValue = player:getStorageValue(storage.key)
if storageValue == -1 then
if not storageValue then
return false
end

Expand Down
6 changes: 5 additions & 1 deletion data/actions/scripts/quests/annihilator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local playerPosition = {
{x = 247, y = 661, z = 13},
{x = 247, y = 662, z = 13}
}

local newPosition = {
{x = 189, y = 650, z = 13},
{x = 189, y = 651, z = 13},
Expand All @@ -16,10 +17,11 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local players = {}
for _, position in ipairs(playerPosition) do
local topPlayer = Tile(position):getTopCreature()
if not topPlayer or not topPlayer:isPlayer() or topPlayer:getLevel() < 100 or topPlayer:getStorageValue(PlayerStorageKeys.annihilatorReward) ~= -1 then
if not topPlayer or not topPlayer:isPlayer() or topPlayer:getLevel() < 100 or topPlayer:getStorageValue(PlayerStorageKeys.annihilatorReward) then
player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end

players[#players + 1] = topPlayer
end

Expand All @@ -28,9 +30,11 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
targetPlayer:teleportTo(newPosition[i], false)
targetPlayer:getPosition():sendMagicEffect(CONST_ME_ENERGYAREA)
end

item:transform(1946)
elseif item.itemid == 1946 then
player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
end

return true
end
4 changes: 2 additions & 2 deletions data/actions/scripts/quests/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local itemWeight = itemType:getWeight()
local playerCap = player:getFreeCapacity()
if table.contains(annihilatorReward, item.uid) then
if player:getStorageValue(PlayerStorageKeys.annihilatorReward) == -1 then
if not player:getStorageValue(PlayerStorageKeys.annihilatorReward) then
if playerCap >= itemWeight then
if item.uid == 1990 then
player:addItem(1990, 1):addItem(2326, 1)
Expand All @@ -29,7 +29,7 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.")
end
elseif player:getStorageValue(item.uid) == -1 then
elseif not player:getStorageValue(item.uid) then
if playerCap >= itemWeight then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
player:addItem(item.uid, 1)
Expand Down
4 changes: 2 additions & 2 deletions data/creaturescripts/scripts/login.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function onLogin(player)
local promotion = vocation:getPromotion()
if player:isPremium() then
local value = player:getStorageValue(PlayerStorageKeys.promotion)
if value == 1 then
if value and value == 1 then
player:setVocation(promotion)
end
elseif not promotion then
Expand All @@ -26,7 +26,7 @@ function onLogin(player)
player:updateClientExpDisplay()

-- achievements points for highscores
if player:getStorageValue(PlayerStorageKeys.achievementsTotal) == -1 then
if not player:getStorageValue(PlayerStorageKeys.achievementsTotal) then
player:setStorageValue(PlayerStorageKeys.achievementsTotal, player:getAchievementPoints())
end

Expand Down
1 change: 1 addition & 0 deletions data/events/events.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<event class="Creature" method="onAreaCombat" enabled="0" />
<event class="Creature" method="onTargetCombat" enabled="0" />
<event class="Creature" method="onHear" enabled="0" />
<event class="Creature" method="onChangeZone" enabled="0" />
<event class="Creature" method="onUpdateStorage" enabled="1" />

<!-- Party methods -->
Expand Down
7 changes: 7 additions & 0 deletions data/events/scripts/creature.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ function Creature:onHear(speaker, words, type)
end
end

function Creature:onChangeZone(fromZone, toZone)
local onChangeZone = EventCallback.onChangeZone
if onChangeZone then
onChangeZone(self, fromZone, toZone)
end
end

function Creature:onUpdateStorage(key, value, oldValue, isSpawn)
local onUpdateStorage = EventCallback.onUpdateStorage
if onUpdateStorage then
Expand Down
Binary file modified data/items/items.otb
Binary file not shown.
8 changes: 7 additions & 1 deletion data/items/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4420,7 +4420,7 @@
<attribute key="type" value="mailbox" />
</item>
<item id="2594" article="a" name="depot chest">
<attribute key="containerSize" value="18" />
<attribute key="containerSize" value="20" />
</item>
<item id="2595" article="a" name="parcel">
<attribute key="type" value="container" />
Expand Down Expand Up @@ -42934,4 +42934,10 @@
<item id="42854" article="a" name="box full of ballons" />
<item id="42855" article="a" name="Pan Amphora" />
<item id="42858" article="a" name="big reward box" />
<item id="44714" name="depot box XIX">
<attribute key="containerSize" value="32" />
</item>
<item id="44715" name="depot box XX">
<attribute key="containerSize" value="32" />
</item>
</items>
19 changes: 18 additions & 1 deletion data/lib/compat/compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ do
self:type("record")
self:onRecord(value)
return
elseif key == "onSave" then
self:type("save")
self:onSave(value)
return
end
rawset(self, key, value)
end
Expand Down Expand Up @@ -1055,7 +1059,7 @@ function hasProperty(uid, prop)
return item:hasProperty(prop)
end

function doSetItemText(uid, text)
function doSetItemText(uid, text, writer, date)
local item = Item(uid)
if not item then
return false
Expand All @@ -1066,6 +1070,19 @@ function doSetItemText(uid, text)
else
item:removeAttribute(ITEM_ATTRIBUTE_TEXT)
end

if writer then
item:setAttribute(ITEM_ATTRIBUTE_WRITER, tostring(writer))
else
item:removeAttribute(ITEM_ATTRIBUTE_WRITER)
end

if date then
item:setAttribute(ITEM_ATTRIBUTE_DATE, tonumber(date))
else
item:removeAttribute(ITEM_ATTRIBUTE_DATE)
end

return true
end
function doSetItemSpecialDescription(uid, desc)
Expand Down
19 changes: 19 additions & 0 deletions data/lib/core/achievements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,25 @@ achievements = {
[494] = {clientId = 528, name = "Shell we take a Ride", grade = 1, points = 3, description = "Equipped with the shell of a tortoise and claws of a lobster this insect like companion will help you through every hardship."},
[495] = {clientId = 530, name = "Some Like It Hot", grade = 1, points = 2, description = "You have braved the searing heat in the tunnels deep below Kazordoon and vanquished the Brainstealer. The voices inside your head are finally silenced."},
[496] = {clientId = 427, name = "Woodcarver", grade = 1, points = 3, secret = true, description = "You defeated Megasylvan Yselda in the wake of the sleeping carnisylvan menace deep under Bounac."},

-- non-secret that were missed earlier
[497] = {clientId = 419, name = "Reason to Celebrate", grade = 1, points = 1, description = "You met the legendary First Dragon and survived. That's a reason to celebrate for sure."},
[498] = {clientId = 443, name = "Cobbled and Patched", grade = 2, points = 6, description = "Exploring the depths can be a dangerous task. Surprisingly, some crude wood planks, rusty nails and a tinged pot can offer a sufficient protection against the creatures lurking in the deep."},
[499] = {clientId = 495, name = "Inquisition's Arm", grade = 1, points = 2, description = "Your special garb, solely awarded to a dedicated hand of the Inquisition, is now complete."},

-- 12.80
[500] = {clientId = 532, name = "Sharp Dressed", grade = 1, points = 1, description = "Just everyone will be crazy about you if you are wearing this formal dress. They will come running, promise!"},
[501] = {clientId = 533, name = "Engine Driver", grade = 1, points = 1, description = "The glooth-driven locomotive will bring you to any party in the blink of an eye."},

-- 12.90
[502] = {clientId = 534, name = "Friendly Fire", grade = 1, points = 1, description = "You mastered the fire and tamed a supervulcano!"},
[503] = {clientId = 535, name = "Wedding Planner", grade = 1, points = 3, description = "Alas! What could be more beautiful and satisfying than bringing two loving hearts together? So romantic!"},
[504] = {clientId = 536, name = "Beaver Away", grade = 1, points = 1, description = "You really were as busy as a beaver in order to help the nagas. Enjoy some eager company!"},
[505] = {clientId = 537, name = "Snake Pit", grade = 1, points = 1, description = "Mysterious nagas, a vibrant jungle and a sinking island - you really know every corner of Marapur now."},
[506] = {clientId = 538, name = "Royalty of Hazard", grade = 1, points = 1, description = "For some it can't be hazardous enough."},
[507] = {clientId = 539, name = "Measuring the World", grade = 1, points = 3, description = "Step by step you discovered many of the secrets hidden in the world, thus gaining the right to wear the Discoverer outfit and hat. Made-to-measure for a brave traveller of the wilds."},
[508] = {clientId = 540, name = "Ripp-Ripp Hooray!", grade = 1, points = 3, description = "Don't get carried away by your success. Get carried away by your ripptor."},
[509] = {clientId = 531, name = "First Achievement", grade = 1, points = 1, secret = true, description = "Congratulations to your very first achievement! ... Well, not really. But imagine, it is. Because at this point during your journey into the past, achievements have been introduced."},
}

ACHIEVEMENT_FIRST = 1
Expand Down
11 changes: 11 additions & 0 deletions data/lib/core/constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,14 @@ SCREENSHOT_TYPE_SKILLUP = 12

SCREENSHOT_TYPE_FIRST = SCREENSHOT_TYPE_ACHIEVEMENT
SCREENSHOT_TYPE_LAST = SCREENSHOT_TYPE_SKILLUP

CYCLOPEDIA_SKILL_MAGIC = 1
CYCLOPEDIA_SKILL_SHIELDING = 6
CYCLOPEDIA_SKILL_DISTANCE = 7
CYCLOPEDIA_SKILL_SWORD = 8
CYCLOPEDIA_SKILL_CLUB = 9
CYCLOPEDIA_SKILL_AXE = 10
CYCLOPEDIA_SKILL_FIST = 11
CYCLOPEDIA_SKILL_FISHING = 13

CYCLOPEDIA_SKILL_AMOUNT = 8
45 changes: 45 additions & 0 deletions data/lib/core/game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,48 @@ function Game.getUnpromotedVocations()
end
return vocations
end

do
local worldLightLevel = 0
local worldLightColor = 0

function Game.getWorldLight()
return worldLightLevel, worldLightColor
end

function Game.setWorldLight(color, level)
if not configManager.getBoolean(configKeys.DEFAULT_WORLD_LIGHT) then
return
end

local previousColor = worldLightColor
local previousLevel = worldLightLevel
worldLightColor = color
worldLightLevel = level

if worldLightColor ~= previousColor or worldLightLevel ~= previousLevel then
for _, player in ipairs(Game.getPlayers()) do
player:sendWorldLight(worldLightColor, worldLightLevel)
end
end
end
end

do
local worldTime = 0

function Game.getWorldTime()
return worldTime
end

function Game.setWorldTime(time)
worldTime = time

-- quarter-hourly update to client clock near the minimap
if worldTime % 15 == 0 then
for _, player in ipairs(Game.getPlayers()) do
player:sendWorldTime(worldTime)
end
end
end
end
22 changes: 21 additions & 1 deletion data/lib/core/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ function Player.sendQuestLog(self)
for _, quest in pairs(quests) do
msg:addU16(quest.id)
msg:addString(quest.name)
msg:addByte(quest:isCompleted(self))
msg:addByte(quest:isCompleted(self) and 0x01 or 0x00)
end

msg:sendToPlayer(self)
Expand Down Expand Up @@ -698,3 +698,23 @@ end
function Player.getAccountStorageValue(self, key)
return Game.getAccountStorageValue(self:getAccountId(), key)
end

function Player.sendWorldLight(self, color, level)
local msg = NetworkMessage()
msg:addByte(0x82)
msg:addByte(self:getGroup():getAccess() and 0xFF or level)
msg:addByte(color)
msg:sendToPlayer(self)
msg:delete()
return true
end

function Player.sendWorldTime(self, time)
local msg = NetworkMessage()
msg:addByte(0xEF)
msg:addByte(time / 60) -- hour
msg:addByte(time % 60) -- min
msg:sendToPlayer(self)
msg:delete()
return true
end
2 changes: 1 addition & 1 deletion data/npc/scripts/runes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function creatureSayCallback(cid, type, msg)

if msgcontains(msg, 'first rod') or msgcontains(msg, 'first wand') then
if items[vocationId] then
if player:getStorageValue(PlayerStorageKeys.firstRod) == -1 then
if not player:getStorageValue(PlayerStorageKeys.firstRod) then
selfSay('So you ask me for a {' .. ItemType(items[vocationId]):getName() .. '} to begin your adventure?', cid)
npcHandler.topic[cid] = 1
else
Expand Down
8 changes: 8 additions & 0 deletions data/scripts/actions/others/taming.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,14 @@ local config = {
{sound = "GRRRRRRRRR", text = "The noble lion majestically rejects your amulet."}
},
success = {sound = "Grrr", text = "The noble lion will now accompany you as a friend and ally."}
},
[44579] = { -- colourful water lily
name = "giant beaver",
id = 201,
type = TYPE_MONSTER,
achievement = "Beaver Away",
chance = 100,
success = {sound = "Grrr!", text = "You tamed the giant beaver."}
}
}

Expand Down
Loading

0 comments on commit 409f0a5

Please sign in to comment.