Skip to content

Commit

Permalink
Merge branch 'base' into base
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuchemey authored Nov 18, 2024
2 parents 12beb17 + b0508a3 commit 4cd3fb3
Show file tree
Hide file tree
Showing 204 changed files with 8,969 additions and 2,614 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,12 @@ xi_search.dSYM
# Keys and Certs
**/*.key
**/*.cert

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
3 changes: 2 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"name": "Win32",
"includePath": [
"${workspaceFolder}/ext/**",
"${workspaceFolder}/src/**"
"${workspaceFolder}/src/**",
"${workspaceFolder}/build/generated/**"
],
"defines": [],
"cStandard":"c23",
Expand Down
27 changes: 27 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
link_libraries(${CMAKE_THREAD_LIBS_INIT})

# Find Python (defines ${Python_EXECUTABLE})
find_package(Python REQUIRED)
message(STATUS "Python_EXECUTABLE: ${Python_EXECUTABLE}")
message(STATUS "Python_VERSION: ${Python_VERSION}")
if(NOT ${Python_VERSION_MAJOR} EQUAL 3)
message(FATAL_ERROR "Python 3 is required")
endif()

# Find MariaDB
find_package(MariaDB REQUIRED)
find_package(MariaDBCPP REQUIRED)
Expand Down Expand Up @@ -108,4 +116,23 @@ message(STATUS "Configuring src/common/version.cpp")
configure_file(${CMAKE_SOURCE_DIR}/src/common/version.cpp.in
${CMAKE_SOURCE_DIR}/src/common/version.cpp)

# Generate IPC stubs
set_property(
DIRECTORY
APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/tools/generate_ipc_stubs.py
)
message(STATUS "Generating IPC stubs")
message(STATUS "Calling: ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/generate_ipc_stubs.py ${CMAKE_BINARY_DIR}")
execute_process(
COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/generate_ipc_stubs.py ${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE IPC_EXIT_CODE
)
if (NOT IPC_EXIT_CODE EQUAL 0)
message(FATAL_ERROR "Failed to generate IPC stubs")
endif()

include_directories(${CMAKE_BINARY_DIR}/generated) # Globally include the build/generated directory

add_subdirectory(src)
2 changes: 1 addition & 1 deletion documentation/battlefield_ids.txt
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ local battlefields =
{
{ 0, 32, 0 }, -- Save the Children (San d'Oria 1-3)
{ 1, 33, 0 }, -- The Holy Crest (Quest)
{ 2, 34, 1551 }, -- Wings of Fury (BS20) -- TODO: mobskills Slipstream and Turbulence
{ 2, 34, 1551 }, -- Wings of Fury (BS20)
{ 3, 35, 1552 }, -- Petrifying Pair (BS30)
{ 4, 36, 1552 }, -- Toadal Recall (BS30) -- TODO: shroom-in-cap mechanic
-- { 5, 37, 0 }, -- Mirror, Mirror (Quest)
Expand Down
7 changes: 7 additions & 0 deletions ext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ if(bcrypt_ADDED) # bcrypt's cmake isn't suitable for us
)
endif()

CPMAddPackage(
NAME alpaca
GITHUB_REPOSITORY p-ranav/alpaca
GIT_TAG 83a592f0c3807500f1aaf3b07fd48105a01e2780
) # defines: alpaca

set(EXTERNAL_LIBS
fmt::fmt
spdlog
Expand All @@ -257,6 +263,7 @@ set(EXTERNAL_LIBS
pcg-cpp
asio
bcrypt
alpaca
)

if(WIN32)
Expand Down
16 changes: 16 additions & 0 deletions modules/era/lua/era_effect_composure.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-----------------------------------
-- Era Composure effect
-- Pre 8 Feb 2019
-- https://forum-square--enix-com.translate.goog/ffxi/threads/55024?_x_tr_sl=ja&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=sc
-----------------------------------
require('modules/module_utils')
-----------------------------------
local m = Module:new('era_effect_composure')

m:addOverride('xi.effects.composure.onEffectGain', function(target, effect)
local power = math.floor(target:getMainLvl() / 5)

effect:addMod(xi.mod.ACC, power)
end)

return m
2 changes: 1 addition & 1 deletion modules/era/lua/missable_mom_the_adventurer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ m:addOverride('xi.server.onServerStart', function()
xi.module.modifyInteractionEntry('scripts/quests/bastok/Mom_the_Adventurer', function(quest)
quest.sections[1].check = function(player, status, vars)
return status ~= xi.questStatus.QUEST_ACCEPTED and
player:getFameLevel(xi.quest.fame_area.BASTOK) < 2 and
player:getFameLevel(xi.fameArea.BASTOK) < 2 and
vars.Prog == 0
end
end)
Expand Down
18 changes: 9 additions & 9 deletions scripts/actions/mobskills/astral_flow_pet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ end
-- [mobskillId] = { petFamily1, petFamily2, ... }
local petAstralFlowAbility =
{
[839] = { 36, 381 }, -- Fenrir (Howling Moon)
[913] = { 38, 383 }, -- Ifrit (Inferno)
[914] = { 45, 388 }, -- Titan (Earthen Fury)
[915] = { 40, 384 }, -- Leviathan (Tidal Wave)
[916] = { 37, 382 }, -- Garuda (Aerial Blast)
[917] = { 44, 387 }, -- Shiva (Diamond Dust)
[918] = { 43, 386 }, -- Ramuh (Judgment Bolt)
[919] = { 34, 379 }, -- Carbuncle (Searing Light)
[xi.mobSkill.HOWLING_MOON_2] = { 36, 381 }, -- Fenrir (Howling Moon)
[xi.mobSkill.INFERNO_1] = { 38, 383 }, -- Ifrit (Inferno)
[xi.mobSkill.EARTHEN_FURY_1] = { 45, 388 }, -- Titan (Earthen Fury)
[xi.mobSkill.TIDAL_WAVE_1] = { 40, 384 }, -- Leviathan (Tidal Wave)
[xi.mobSkill.AERIAL_BLAST_1] = { 37, 382 }, -- Garuda (Aerial Blast)
[xi.mobSkill.DIAMOND_DUST_1] = { 44, 387 }, -- Shiva (Diamond Dust)
[xi.mobSkill.JUDGMENT_BOLT_1] = { 43, 386 }, -- Ramuh (Judgment Bolt)
[xi.mobSkill.SEARING_LIGHT_1] = { 34, 379 }, -- Carbuncle (Searing Light)
}

mobskillObject.onMobWeaponSkill = function(target, mob, skill)
Expand All @@ -58,7 +58,7 @@ mobskillObject.onMobWeaponSkill = function(target, mob, skill)

-- Find proper pet skill
local petFamily = pet:getFamily()
local skillId = 919 -- Default to Searing Light if not found below
local skillId = xi.mobSkill.SEARING_LIGHT_1 -- Default to Searing Light if not found below

for mobSkillId, petFamilyList in pairs(petAstralFlowAbility) do
if utils.contains(petFamily, petFamilyList) then
Expand Down
3 changes: 2 additions & 1 deletion scripts/actions/mobskills/hundred_fists.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ mobskillObject.onMobSkillCheck = function(target, mob, skill)
end

mobskillObject.onMobWeaponSkill = function(target, mob, skill)
xi.mobskills.mobBuffMove(mob, xi.effect.HUNDRED_FISTS, 1, 0, 30)
-- note that captures show that mobskill hundred fists is still 45 seconds on retail
xi.mobskills.mobBuffMove(mob, xi.effect.HUNDRED_FISTS, 1, 0, 45)

skill:setMsg(xi.msg.basic.USES)

Expand Down
18 changes: 18 additions & 0 deletions scripts/actions/mobskills/slipstream.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-----------------------------------
-- Slipstream
-- Reduces accuracy of targets in area of effect
-----------------------------------
---@type TMobSkill
local mobskillObject = {}

mobskillObject.onMobSkillCheck = function(target, mob, skill)
return 0
end

mobskillObject.onMobWeaponSkill = function(target, mob, skill)
skill:setMsg(xi.mobskills.mobStatusEffectMove(mob, target, xi.effect.ACCURACY_DOWN, 25, 0, math.random(120, 180)))

return xi.effect.ACCURACY_DOWN
end

return mobskillObject
23 changes: 23 additions & 0 deletions scripts/actions/mobskills/turbulence.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-----------------------------------
-- Turbulence
-- Deals wind based damage in an area of effect
-----------------------------------
---@type TMobSkill
local mobskillObject = {}

mobskillObject.onMobSkillCheck = function(target, mob, skill)
return 0
end

mobskillObject.onMobWeaponSkill = function(target, mob, skill)
local damage = mob:getWeaponDmg() * 3

damage = xi.mobskills.mobMagicalMove(mob, target, skill, damage, xi.element.WIND, 1, xi.mobskills.magicalTpBonus.NO_EFFECT)
damage = xi.mobskills.mobFinalAdjustments(damage, mob, skill, target, xi.attackType.MAGICAL, xi.damageType.WIND, xi.mobskills.shadowBehavior.WIPE_SHADOWS)

target:takeDamage(damage, mob, xi.attackType.MAGICAL, xi.damageType.WIND)

return damage
end

return mobskillObject
5 changes: 1 addition & 4 deletions scripts/actions/spells/black/death.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ spellObject.onSpellCast = function(caster, target, spell)
not target:isNM() and
not target:hasStatusEffect(xi.effect.MAGIC_SHIELD)
then
local magicAcc = xi.combat.magicHitRate.calculateActorMagicAccuracy(caster, target, xi.magic.spellGroup.BLACK, xi.skill.DARK_MAGIC, xi.element.DARK, 0, 0)
local magicEva = xi.combat.magicHitRate.calculateTargetMagicEvasion(caster, target, xi.element.DARK, true, 0, 0)
local magicHitRate = utils.clamp(xi.combat.magicHitRate.calculateMagicHitRate(magicAcc, magicEva), 5, 30) -- Sources suggest a 30% max rate for players.
local resistRate = xi.combat.magicHitRate.calculateResistRate(caster, target, xi.skill.DARK_MAGIC, xi.element.DARK, magicHitRate, 0)
local resistRate = xi.combat.magicHitRate.calculateResistRate(caster, target, xi.magic.spellGroup.BLACK, xi.skill.DARK_MAGIC, xi.element.DARK, 0, 0, 0)

if resistRate == 1 then
instaDeath = true
Expand Down
2 changes: 1 addition & 1 deletion scripts/actions/spells/trust/mildaurion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spellObject.onMobSpawn = function(mob)
})

mob:addListener('WEAPONSKILL_USE', 'MILDAURION_WEAPONSKILL_USE', function(mobArg, target, wsid, tp, action)
if wsid == xi.mobSkill.LIGHT_BLADE then
if wsid == xi.mobSkill.LIGHT_BLADE_3 then
-- For Vana'diel!
xi.trust.message(mobArg, xi.trust.messageOffset.SPECIAL_MOVE_1)
end
Expand Down
1 change: 0 additions & 1 deletion scripts/battlefields/Ghelsba_Outpost/wings_of_fury.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ local content = Battlefield:new({
},
})

-- TODO: MobSkills Slipstream and Turbulence need to be implemented/applied.
content:addEssentialMobs({ 'Colo-colo', 'Furies' })

content.loot =
Expand Down
2 changes: 1 addition & 1 deletion scripts/battlefields/Temenos/central_temenos_2nd_floor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ content.groups =
'Mystic_Avatar_Carbuncle',
},
mobMods = { [xi.mobMod.DETECTION] = xi.detects.HEARING },
inParty = true,
isParty = true,
},

{
Expand Down
73 changes: 73 additions & 0 deletions scripts/commands/getfame.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
-----------------------------------
-- func: getfame
-- desc: Gets fame level of a target player
-----------------------------------
local commandObj = {}

commandObj.cmdprops =
{
permission = 3,
parameters = 'si'
}

local function error(player, msg)
if msg == nil then
msg = '!getfame [player] <fame_zone 0-15>'
end

player:printToPlayer(msg)
end

commandObj.onTrigger = function(player, target, famezone)
-- validate target
local targ = nil

if target == nil then
if player:getCursorTarget() == nil then
targ = player
else
if player:getCursorTarget():isPC() then
targ = player:getCursorTarget()
else
error(player, 'You must target a player or specify a name.')
return
end
end
else
targ = GetPlayerByName(target)
if targ == nil then
error(player, string.format('Player named "%s" not found or not a valid player!', target))
return
end
end

local fameZoneNames = {}
for name, value in pairs(xi.fameArea) do
fameZoneNames[value] = name
end

-- Validate famezone
if famezone == nil then
player:printToPlayer(string.format('Fame Report for player: %s', targ:getName()), xi.msg.channel.SYSTEM_3)
for i = 0, 15 do
player:printToPlayer(string.format('Area %s (%s): %s (Level: %s)', i, fameZoneNames[i], player:getFame(i), player:getFameLevel(i)), xi.msg.channel.SYSTEM_3)
end

return
elseif famezone < 0 or famezone > 15 then
error(player, 'Fame zone must be a value from 0 to 15, or omit for complete list.')
return
end

local fameBaseValues = { 0, 50, 125, 225, 325, 425, 488, 550, 613 }
local fame = player:getFame(famezone)
local level = player:getFameLevel(famezone)

if level < 9 then
player:printToPlayer(string.format('%s\'s reputation in fame area %i (%s) is %i (Level %i). Next level at %i (%i points to go).', targ:getName(), famezone, fameZoneNames[famezone], fame, level, fameBaseValues[level + 1], fameBaseValues[level + 1]-fame), xi.msg.channel.SYSTEM_3)
else
player:printToPlayer(string.format('%s\'s reputation in fame area %i (%s) is %i (Level %i).', targ:getName(), famezone, fameZoneNames[famezone], fame, level), xi.msg.channel.SYSTEM_3)
end
end

return commandObj
69 changes: 69 additions & 0 deletions scripts/commands/setfamelevel.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
-----------------------------------
-- func: setfamelevel
-- desc: Sets fame level on a target player
-----------------------------------
local commandObj = {}

commandObj.cmdprops =
{
permission = 3,
parameters = 'iis'
}

local function error(player, msg)
if msg == nil then
msg = '!setfamelevel <fame_zone 0-15> <level 1-9> <player> (Omit level and target to show zone numbers)'
end

player:printToPlayer(msg)
end

commandObj.onTrigger = function(player, famezone, level, target)
-- validate target
local targ

if target == nil then
targ = player
else
targ = GetPlayerByName(target)
if targ == nil then
error(player, string.format('Player named "%s" not found or not a valid player!', target))
return
end
end

local fameZoneNames = {}
for name, value in pairs(xi.fameArea) do
fameZoneNames[value] = name
end

if famezone == nil then
error(player)
return
elseif famezone < 0 or famezone > 15 then
error(player, 'You must provide a fame zone from 0 to 15.')
return
end

-- validate level
if level == nil then
player:printToPlayer(string.format('Fame Zone %s: %s - No other parameters requested.', famezone, fameZoneNames[famezone]))
return
elseif level < 0 or level > 9 then
error(player, 'You must provide a fame level from 1 to 9.')
return
end

local fameBaseValues = { 0, 50, 125, 225, 325, 425, 488, 550, 613 }
local fameMultiplier = xi.settings.map.FAME_MULTIPLIER

if level > 6 and (famezone >= 6 and famezone <= 14) then -- Abyssea fame caps at level 6
level = 6
error(player, 'Abyssea fame capped at level 6. Setting to level 6.')
end

targ:setFame(famezone, fameBaseValues[level] / fameMultiplier)
player:printToPlayer(string.format('Set %s\'s fame for fame area %i (%s) to %i (Level %i).', targ:getName(), famezone, fameZoneNames[famezone], fameBaseValues[level], level))
end

return commandObj
Loading

0 comments on commit 4cd3fb3

Please sign in to comment.