Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Add padding check for logical operators #4537

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/actions/abilities/scavenge.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ abilityObject.onUseAbility = function(player, target, ability, action)
end

else
local bonuses = (player:getMod(xi.mod.SCAVENGE_EFFECT) + player:getMerit(xi.merit.SCAVENGE_EFFECT)) / 100
local arrowsToReturn = math.floor(math.floor(player:getLocalVar('ArrowsUsed') % 10000) * (player:getMainLvl() / 200 + bonuses))
local bonuses = (player:getMod(xi.mod.SCAVENGE_EFFECT) + player:getMerit(xi.merit.SCAVENGE_EFFECT)) / 100
local arrowsToReturn = math.floor(math.floor(player:getLocalVar('ArrowsUsed') % 10000) * (player:getMainLvl() / 200 + bonuses))
local playerID = target:getID()

if arrowsToReturn == 0 then
Expand Down
2 changes: 1 addition & 1 deletion scripts/commands/addlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ commandObj.onTrigger = function(player, light, amount, target)

local selectedLight = tostring(light)

if lightType[selectedLight] == nil or selectedLight == nil then
if lightType[selectedLight] == nil or selectedLight == nil then
error(player, 'Invalid light type.\nValid light types: pearl, azure, ruby, amber, gold, silver, ebon')
return
end
Expand Down
10 changes: 5 additions & 5 deletions scripts/events/egg_hunt_egg-stravaganza.lua
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,8 @@ local getSecondInitial = function(player, option)

for _, member in pairs(party) do
if
member ~= nil and -- Player exists
player:getName() ~= member:getName() and -- Different player
member ~= nil and -- Player exists
player:getName() ~= member:getName() and -- Different player
player:getZoneID() == member:getZoneID() -- Same zone
then
local playerName = member:getName()
Expand Down Expand Up @@ -797,9 +797,9 @@ xi.events.eggHunt.onTrigger = function(player, npc)

for _, member in pairs(party) do
if
member ~= nil and -- Player exists
player:getName() ~= member:getName() and -- Different player
player:getZoneID() == member:getZoneID() -- Same zone
member ~= nil and -- Player exists
player:getName() ~= member:getName() and -- Different player
player:getZoneID() == member:getZoneID() -- Same zone
then
local initial = string.sub(member:getName(), 1, 1)
local letter = string.byte(string.lower(initial)) - 97
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/chocobo_raising.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ xi.chocoboRaising.getPlayerRidingSpeedAndTime = function(player)
local endRank = numberToRank(chocoState.endurance)

local outSpeed = utils.clamp(baseSpeed + (strRank * xi.chocoboRaising.ridingSpeedPerRank), 0, xi.chocoboRaising.ridingSpeedCap)
local outTime = utils.clamp(baseTime + (endRank * xi.chocoboRaising.ridingTimePerRank), 0, xi.chocoboRaising.ridingTimeCap)
local outTime = utils.clamp(baseTime + (endRank * xi.chocoboRaising.ridingTimePerRank), 0, xi.chocoboRaising.ridingTimeCap)

return outSpeed, outTime
end
Expand Down
8 changes: 4 additions & 4 deletions scripts/globals/garrison.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ xi.garrison.getAllyInfo = function(zoneID, zoneData, nationID)
local pos = xi.garrison.zoneData[zoneID].pos

if
allyName == nil or
allyName == nil or
allyGroupId == nil or
allyLooks == nil or
#allyLooks == 0 or
pos == nil
allyLooks == nil or
#allyLooks == 0 or
pos == nil
then
local zone = GetZone(zoneID)
debugLogf('Garrison NPC data missing for %s level %u (%s).', nationName[nationID], zoneData.levelCap, zone:getName())
Expand Down
6 changes: 3 additions & 3 deletions scripts/globals/job_utils/rune_fencer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local function applyRuneEnhancement(effectType, player)
local jobPointBonus = player:getJobPointLevel(xi.jp.RUNE_ENCHANTMENT_EFFECT) -- 1 more elemental resistance per level for a maximum total of 20

-- see https://www.bg-wiki.com/ffxi/Category:Rune
local power = math.floor((49 * runLevel / 99) + 5.5) + meritBonus + jobPointBonus
local power = math.floor((49 * runLevel / 99) + 5.5) + meritBonus + jobPointBonus
player:addStatusEffect(effectType, power, 0, 300)
end

Expand Down Expand Up @@ -457,7 +457,7 @@ end
-- see https://www.bg-wiki.com/ffxi/Battuta
xi.job_utils.rune_fencer.useBattuta = function(player, target, ability, action)
local meritPower = player:getMerit(xi.merit.MERIT_BATTUTA) -- power is 4
local modBonus = (100 + (player:getMod(xi.mod.ENHANCES_BATTUTA) * meritPower / 4)) / 100
local modBonus = (100 + (player:getMod(xi.mod.ENHANCES_BATTUTA) * meritPower / 4)) / 100
local inquartataPower = 36 + meritPower -- base 36% + merit power of 4% each = max of 56%
local spikesPower = 6 + meritPower -- damage is static 26 per rune barring SDT/MDT at 5/5 Battuta merits. 6 + 4*5 = 26.
local runeCount = target:getActiveRuneCount()
Expand Down Expand Up @@ -505,7 +505,7 @@ local function getSwipeLungeDamageMultipliers(player, target, element, bonusMacc
end

local function calculateSwipeLungeDamage(player, target, skillModifier, gearBonus, numHits, multipliers)
local damage = math.floor(skillModifier * (0.50 + 0.25 * numHits + (gearBonus / 100)))
local damage = math.floor(skillModifier * (0.50 + 0.25 * numHits + (gearBonus / 100)))

damage = damage + player:getMod(xi.mod.MAGIC_DAMAGE) -- add mdamage to base damage

Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/mobskills.lua
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ xi.mobskills.mobBreathMove = function(mob, target, percent, base, element, cap)

local globalDamageTaken = target:getMod(xi.mod.DMG) / 10000 -- Mod is base 10000
local breathDamageTaken = target:getMod(xi.mod.DMGBREATH) / 10000 -- Mod is base 10000
local combinedDamageTaken = 1.0 + utils.clamp(breathDamageTaken + globalDamageTaken, -0.5, 0.5) -- The combination of regular "Damage Taken" and "Breath Damage Taken" caps at 50%. There is no BDTII known as of yet.
local combinedDamageTaken = 1.0 + utils.clamp(breathDamageTaken + globalDamageTaken, -0.5, 0.5) -- The combination of regular "Damage Taken" and "Breath Damage Taken" caps at 50%. There is no BDTII known as of yet.

damage = math.floor(damage * combinedDamageTaken)

Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/spells/damage_spell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ xi.spells.damage.calculateNinFutaeBonus = function(caster, skillType)
skillType == xi.skill.NINJUTSU and
caster:hasStatusEffect(xi.effect.FUTAE)
then
ninFutaeBonus = (150 + caster:getJobPointLevel(xi.jp.FUTAE_EFFECT) * 5) / 100
ninFutaeBonus = (150 + caster:getJobPointLevel(xi.jp.FUTAE_EFFECT) * 5) / 100
caster:delStatusEffect(xi.effect.FUTAE)
end

Expand Down
4 changes: 2 additions & 2 deletions scripts/missions/windurst/8_1_Vain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ mission.sections =
onEventUpdate =
{
[903] = function(player, csid, option, npc)
if player:getZPos() > -331 then
if player:getZPos() > -331 then
player:updateEvent(0, 0, 0, 0, 0, 3)
else
player:updateEvent(0, 0, 0, 0, 0, 2)
Expand Down Expand Up @@ -397,7 +397,7 @@ mission.sections =
onEventUpdate =
{
[4] = function(player, csid, option, npc)
if player:getZPos() < 75 then
if player:getZPos() < 75 then
player:updateEvent(0, 0, 0, 0, 0, 1)
else
player:updateEvent(0, 0, 0, 0, 0, 2)
Expand Down
4 changes: 2 additions & 2 deletions scripts/missions/wotg/04_The_Queen_of_the_Dance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ mission.sections =
-- 0: Try to enter without a ticket
{
check = function(player, currentMission, missionStatus, vars)
return currentMission == mission.missionId and missionStatus == 0
and xi.wotg.helpers.meetsMission4Reqs(player)
return currentMission == mission.missionId and missionStatus == 0 and
xi.wotg.helpers.meetsMission4Reqs(player)
end,

[xi.zone.SOUTHERN_SAN_DORIA_S] =
Expand Down
2 changes: 1 addition & 1 deletion scripts/mixins/families/hpemde.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ g_mixins.families.hpemde = function(hpemdeMob)
openMouth(mob)
elseif
mob:getAnimationSub() == 3 and
mob:getHP() < mob:getLocalVar('[hpemde]closeMouthHP')
mob:getHP() < mob:getLocalVar('[hpemde]closeMouthHP')
then
closeMouth(mob)
end
Expand Down
4 changes: 2 additions & 2 deletions scripts/quests/ahtUrhgan/Promotion_Superior_Private.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ quest.sections =
{
{
check = function(player, status, vars)
return status == QUEST_AVAILABLE and player:getCharVar('AssaultPromotion') >= 25
and player:getQuestStatus(xi.quest.log_id.AHT_URHGAN, xi.quest.id.ahtUrhgan.PROMOTION_PRIVATE_FIRST_CLASS) == QUEST_COMPLETED
return status == QUEST_AVAILABLE and player:getCharVar('AssaultPromotion') >= 25 and
player:getQuestStatus(xi.quest.log_id.AHT_URHGAN, xi.quest.id.ahtUrhgan.PROMOTION_PRIVATE_FIRST_CLASS) == QUEST_COMPLETED
end,

[xi.zone.AHT_URHGAN_WHITEGATE] =
Expand Down
6 changes: 3 additions & 3 deletions scripts/quests/crystalWar/Downward_Helix.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
-- Downward Helix
-----------------------------------
-- !addquest 7 33
-- Erlene : !pos 376.936 -39.999 17.914 175
-- Indescript Markings : !pos 322 24 113 98
-- Erlene : !pos 376.936 -39.999 17.914 175
-- Indescript Markings : !pos 322 24 113 98
-----------------------------------

local quest = Quest:new(xi.quest.log_id.CRYSTAL_WAR, xi.quest.id.crystalWar.DOWNWARD_HELIX)
Expand All @@ -18,7 +18,7 @@ quest.sections =
{
check = function(player, status, vars)
return status == QUEST_AVAILABLE and
xi.quest.getVar(player, xi.quest.log_id.CRYSTAL_WAR, xi.quest.id.crystalWar.ON_SABBATICAL, 'Timer') <= VanadielUniqueDay() and
xi.quest.getVar(player, xi.quest.log_id.CRYSTAL_WAR, xi.quest.id.crystalWar.ON_SABBATICAL, 'Timer') <= VanadielUniqueDay() and
player:getMainJob() == xi.job.SCH and
player:getMainLvl() >= xi.settings.main.AF2_QUEST_LEVEL
end,
Expand Down
2 changes: 1 addition & 1 deletion scripts/zones/Bastok-Jeuno_Airship/npcs/Dereck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ entity.onTrigger = function(player, npc)

local message = ID.text.WILL_REACH_BASTOK

if vHour == 0 then
if vHour == 0 then
if vMin >= 13 then
vHour = 3
message = ID.text.WILL_REACH_JEUNO
Expand Down
2 changes: 1 addition & 1 deletion scripts/zones/Bastok-Jeuno_Airship/npcs/Michele.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ entity.onTrigger = function(player, npc)

local message = ID.text.WILL_REACH_BASTOK

if vHour == 0 then
if vHour == 0 then
if vMin >= 13 then
vHour = 3
message = ID.text.WILL_REACH_JEUNO
Expand Down
6 changes: 3 additions & 3 deletions scripts/zones/Bastok_Markets/npcs/Lamepaue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ entity.onTrigger = function(player, npc)
-- Determine if any cutscenes are available for the player.
local gil = player:getGil()
if
bastokMissions == 0xFFFFFFFE and
bastokQuests == 0xFFFFFFFE and
otherQuests == 0xFFFFFFFE and
bastokMissions == 0xFFFFFFFE and
bastokQuests == 0xFFFFFFFE and
otherQuests == 0xFFFFFFFE and
seekersOfAdoulin == 0xFFFFFFFE
then -- Player has no cutscenes available to be viewed.
gil = 0 -- Setting gil to a value less than 10(cost) will trigger the appropriate response from this npc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ entity.onMobRoam = function(mob)

for _, doorID in ipairs(escort.doors) do
local npc = GetNPCByID(doorID)
if doorID ~= openedDoor and mob:checkDistance(npc) <= 8 then
if doorID ~= openedDoor and mob:checkDistance(npc) <= 8 then
npc:setAnimation(xi.animation.OPEN_DOOR)
mob:setLocalVar('opened_door', doorID)
end
Expand Down
2 changes: 1 addition & 1 deletion scripts/zones/LaLoff_Amphitheater/mobs/Ark_Angel_MR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ entity.onMobEngaged = function(mob, target)
end

entity.onMobFight = function(mob, target)
if mob:getLocalVar('Charm') == 0 and mob:getHPP() < 50 then
if mob:getLocalVar('Charm') == 0 and mob:getHPP() < 50 then
mob:useMobAbility(710)
mob:setLocalVar('Charm', 1)
end
Expand Down
2 changes: 1 addition & 1 deletion scripts/zones/Norg/npcs/Magephaud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ entity.onTrigger = function(player, npc)
nFame >= 2
then
player:startEvent(116, xi.item.GOLD_BEASTCOIN) -- Quest start - you have tonberry kills?! I got yo back ^.-
elseif player:getCharVar('EveryonesGrudgeStarted') == 1 then
elseif player:getCharVar('EveryonesGrudgeStarted') == 1 then
player:startEvent(117, xi.item.GOLD_BEASTCOIN)
elseif player:getQuestStatus(xi.quest.log_id.OUTLANDS, xi.quest.id.outlands.EVERYONES_GRUDGE) == QUEST_COMPLETED then
player:startEvent(119) -- After completion cs
Expand Down
4 changes: 2 additions & 2 deletions scripts/zones/Northern_San_dOria/npcs/Durogg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ entity.onTrigger = function(player, npc)
-- Determine if any cutscenes are available for the player.
local gil = player:getGil()
if
addonScenarios == 0xFFFFFFFE and
seekersOfAdoulin == 0xFFFFFFFE
addonScenarios == 0xFFFFFFFE and
seekersOfAdoulin == 0xFFFFFFFE
then -- Player has no cutscenes available to be viewed.
gil = 0 -- Setting gil to a value less than 10(cost) will trigger the appropriate response from this npc.
end
Expand Down
8 changes: 4 additions & 4 deletions scripts/zones/Port_Bastok/npcs/Dalba.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ entity.onTrigger = function(player, npc)
-- Determine if any cutscenes are available for the player.
local gil = player:getGil()
if
bastokMissions == 0xFFFFFFFE and
bastokQuests == 0xFFFFFFFE and
otherQuests == 0xFFFFFFFE and
bastokMissions == 0xFFFFFFFE and
bastokQuests == 0xFFFFFFFE and
otherQuests == 0xFFFFFFFE and
promathiaMissions == 0xFFFFFFFE and
addonScenarios == 0xFFFFFFFE
addonScenarios == 0xFFFFFFFE
then -- Player has no cutscenes available to be viewed.
gil = 0 -- Setting gil to a value less than 10(cost) will trigger the appropriate response from this npc.
end
Expand Down
12 changes: 7 additions & 5 deletions scripts/zones/Rolanberry_Fields/npcs/Saarlan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ entity.onTrigger = function(player, npc)
elseif player:getCharVar('LegionStatus') == 1 then
local maximus = player:hasKeyItem(xi.ki.LEGION_TOME_PAGE_MAXIMUS) and 1 or 0
local minimus = player:hasKeyItem(xi.ki.LEGION_TOME_PAGE_MINIMUS) and 1 or 0

-- TODO: Table these and iterate
local title =
(player:hasTitle(xi.title.SUBJUGATOR_OF_THE_LOFTY) and 1 or 0) +
(player:hasTitle(xi.title.SUBJUGATOR_OF_THE_MIRED) and 2 or 0) +
(player:hasTitle(xi.title.SUBJUGATOR_OF_THE_SOARING) and 4 or 0) +
(player:hasTitle(xi.title.SUBJUGATOR_OF_THE_VEILED) and 8 or 0) +
(player:hasTitle(xi.title.LEGENDARY_LEGIONNAIRE) and 16 or 0)
(player:hasTitle(xi.title.SUBJUGATOR_OF_THE_LOFTY) and 1 or 0) +
(player:hasTitle(xi.title.SUBJUGATOR_OF_THE_MIRED) and 2 or 0) +
(player:hasTitle(xi.title.SUBJUGATOR_OF_THE_SOARING) and 4 or 0) +
(player:hasTitle(xi.title.SUBJUGATOR_OF_THE_VEILED) and 8 or 0) +
(player:hasTitle(xi.title.LEGENDARY_LEGIONNAIRE) and 16 or 0)

player:startEvent(8005, 0, title, maximus, player:getCurrency('legion_point'), minimus)
end
Expand Down
2 changes: 1 addition & 1 deletion scripts/zones/Sea_Serpent_Grotto/npcs/_4w3.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ entity.onTrigger = function(player, npc)
local zPos = player:getZPos()
local mythrilDoorCheck = player:getCharVar('SSG_MythrilDoor')

if xPos >= 40 and zPos >= 15 then
if xPos >= 40 and zPos >= 15 then
if mythrilDoorCheck == 0 then -- Door has never been checked
player:messageSpecial(ID.text.FIRST_CHECK)
player:setCharVar('SSG_MythrilDoor', 1)
Expand Down
10 changes: 5 additions & 5 deletions scripts/zones/Yuhtunga_Jungle/npcs/qm2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ local ID = zones[xi.zone.YUHTUNGA_JUNGLE]
local entity = {}

local function isFightInProgress()
return GetMobByID(ID.mob.NASUS_OFFSET):isAlive()
or GetMobByID(ID.mob.NASUS_OFFSET + 1):isAlive()
or GetMobByID(ID.mob.NASUS_OFFSET + 2):isAlive()
or GetMobByID(ID.mob.NASUS_OFFSET + 3):isAlive()
or GetMobByID(ID.mob.NASUS_OFFSET + 4):isAlive()
return GetMobByID(ID.mob.NASUS_OFFSET):isAlive() or
GetMobByID(ID.mob.NASUS_OFFSET + 1):isAlive() or
GetMobByID(ID.mob.NASUS_OFFSET + 2):isAlive() or
GetMobByID(ID.mob.NASUS_OFFSET + 3):isAlive() or
GetMobByID(ID.mob.NASUS_OFFSET + 4):isAlive()
end

local function spawnNMs(player)
Expand Down
Loading