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

[AMK][Lua] Cardian orb drop mechanic #4800

Merged
merged 2 commits into from
Jan 3, 2024
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
38 changes: 38 additions & 0 deletions scripts/missions/amk/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,44 @@ xi.amk.helpers.helmTrade = function(player, helmType, broke)
end
end

-- AMK 6 (index 5) - An Errand! The Professor's Price
-- Cardian orb KI logic: All or nothing drop of the orb is handled by
-- a local var that is set once by the first player is called by onMobDeath
-- The rest of the players in alliance get the same outcome as the first
xi.amk.helpers.cardianOrbDrop = function(mob, player, orb)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the conditions for cardians to drop this key item? Can the item drop forever if you've completed AMK? Or do they only drop during this mission and if you want repeat KIs then you have to buy them from squintox?

Either way, your most recent commit removed the mission check all together

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what happens when I try to rush something at work. I'll focus and fix it when I get home.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

I can't, however, find any information about whether or not the key items can drop before flagging mission 6 from shantotto.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy to go get caps on retail

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, this condition seems fine: player:getCurrentMission(xi.mission.log_id.AMK) < xi.mission.id.amk.AN_ERRAND_THE_PROFESSORS_PRICE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a request in FFXI Captures discord. I don't have a retail account personally.

if
player == nil or
player:getCurrentMission(xi.mission.log_id.AMK) < xi.mission.id.amk.AN_ERRAND_THE_PROFESSORS_PRICE
then
return
end

-- Chance of drop increases both based on size of party and level of mob killed
if mob:getLocalVar('Mission[10][5]cardianOrbDrop') == 0 then
local partySize = 0
for _, member in pairs(player:getAlliance()) do
if member:getZoneID() == xi.zone.OUTER_HORUTOTO_RUINS then
partySize = partySize + 1
end
end

-- Chance ranges from 4% to 25.8% (based on max mob lvl of 44)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

local dropChance = (3 * mob:getMainLvl()) + (30 * utils.clamp(partySize, 1, 6)) - 10
local roll = math.random(1000)

if roll < dropChance then
mob:setLocalVar('Mission[10][5]cardianOrbDrop', 1)
else
mob:setLocalVar('Mission[10][5]cardianOrbDrop', 2)
end
end

-- Give orb
if mob:getLocalVar('Mission[10][5]cardianOrbDrop') == 1 then
npcUtil.giveKeyItem(player, orb)
end
end

-- AMK 7 (index 6) - Select/lookup the digging zone
local digZoneIds =
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_BATONS)
xi.regime.checkRegime(player, mob, 667, 2, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Eight_of_Coins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_COINS)
xi.regime.checkRegime(player, mob, 667, 4, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Eight_of_Cups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_CUPS)
xi.regime.checkRegime(player, mob, 667, 1, xi.regime.type.GROUNDS)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_SWORDS)
xi.regime.checkRegime(player, mob, 667, 3, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Five_of_Batons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_BATONS)
xi.regime.checkRegime(player, mob, 664, 2, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Five_of_Coins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_COINS)
xi.regime.checkRegime(player, mob, 664, 4, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Five_of_Cups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_CUPS)
xi.regime.checkRegime(player, mob, 664, 1, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Five_of_Swords.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_SWORDS)
xi.regime.checkRegime(player, mob, 664, 3, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Four_of_Batons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_BATONS)
xi.regime.checkRegime(player, mob, 663, 2, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Four_of_Coins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_COINS)
xi.regime.checkRegime(player, mob, 663, 4, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Four_of_Cups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_CUPS)
xi.regime.checkRegime(player, mob, 663, 1, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Four_of_Swords.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_SWORDS)
xi.regime.checkRegime(player, mob, 663, 3, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Nine_of_Batons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_BATONS)
xi.regime.checkRegime(player, mob, 668, 2, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Nine_of_Coins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_COINS)
xi.regime.checkRegime(player, mob, 668, 4, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Nine_of_Cups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_CUPS)
xi.regime.checkRegime(player, mob, 668, 1, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Nine_of_Swords.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_SWORDS)
xi.regime.checkRegime(player, mob, 668, 3, xi.regime.type.GROUNDS)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_BATONS)
xi.regime.checkRegime(player, mob, 666, 2, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Seven_of_Coins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_COINS)
xi.regime.checkRegime(player, mob, 666, 4, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Seven_of_Cups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_CUPS)
xi.regime.checkRegime(player, mob, 666, 1, xi.regime.type.GROUNDS)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_SWORDS)
xi.regime.checkRegime(player, mob, 666, 3, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Six_of_Batons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_BATONS)
xi.regime.checkRegime(player, mob, 665, 2, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Six_of_Coins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_COINS)
xi.regime.checkRegime(player, mob, 665, 4, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Six_of_Cups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_CUPS)
xi.regime.checkRegime(player, mob, 665, 1, xi.regime.type.GROUNDS)
end

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Six_of_Swords.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_SWORDS)
xi.regime.checkRegime(player, mob, 665, 3, xi.regime.type.GROUNDS)
end

Expand Down
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Ten_of_Batons.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Ten of Batons
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_BATONS)
end

return entity
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Ten_of_Coins.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Ten of Coins
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_COINS)
end

return entity
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Ten_of_Cups.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Ten of Cups
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_CUPS)
end

return entity
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Ten_of_Swords.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Ten of Swords
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_SWORDS)
end

return entity
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Three_of_Batons.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Three of Batons
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_BATONS)
end

return entity
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Three_of_Coins.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Three of Coins
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_COINS)
end

return entity
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Three_of_Cups.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Three of Cups
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_CUPS)
end

return entity
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Three_of_Swords.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Three of Swords
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_SWORDS)
end

return entity
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Two_of_Batons.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Two of Batons
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_BATONS)
end

return entity
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Two_of_Coins.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Two of Coins
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_COINS)
end

return entity
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Two_of_Cups.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Two of Cups
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_CUPS)
end

return entity
11 changes: 11 additions & 0 deletions scripts/zones/Outer_Horutoto_Ruins/mobs/Two_of_Swords.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----------------------------------
-- Area: Outer Horutoto Ruins
-- Mob: Two of Swords
-----------------------------------
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_SWORDS)
end

return entity