Skip to content

Commit

Permalink
Merge pull request #6201 from LandSandBoat/lls/npcutil
Browse files Browse the repository at this point in the history
[lls] Annotate npcUtil global, correct issues identified
  • Loading branch information
claywar authored Sep 1, 2024
2 parents d5c52ff + 2655f99 commit c57f162
Show file tree
Hide file tree
Showing 34 changed files with 795 additions and 440 deletions.
4 changes: 2 additions & 2 deletions modules/custom/lua/custom_HNM_system.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ hnmSystem:addOverride('xi.zones.Dragons_Aery.npcs.qm0.onTrade', function(player,
if
not GetMobByID(dragonsAeryID.mob.FAFNIR):isSpawned() and
not GetMobByID(dragonsAeryID.mob.NIDHOGG):isSpawned() and
npcUtil.tradeHasExactly(trade, xi.item.SWEET_TEA) and
npcUtil.tradeHasExactly(trade, xi.item.CUP_OF_SWEET_TEA) and
npcUtil.popFromQM(player, npc, dragonsAeryID.mob.NIDHOGG)
then
player:confirmTrade()
Expand Down Expand Up @@ -117,7 +117,7 @@ hnmSystem:addOverride('xi.zones.Valley_of_Sorrows.npcs.qm1.onTrade', function(pl
if
not GetMobByID(valleySorrowsID.mob.ADAMANTOISE):isSpawned() and
not GetMobByID(valleySorrowsID.mob.ASPIDOCHELONE):isSpawned() and
npcUtil.tradeHasExactly(trade, xi.item.RED_PONDWEED) and
npcUtil.tradeHasExactly(trade, xi.item.CLUMP_OF_RED_PONDWEED) and
npcUtil.popFromQM(player, npc, valleySorrowsID.mob.ASPIDOCHELONE)
then
player:confirmTrade()
Expand Down
256 changes: 253 additions & 3 deletions scripts/enum/item.lua

Large diffs are not rendered by default.

72 changes: 37 additions & 35 deletions scripts/events/login_campaign_data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@

-- TODO: Fill in with _commented out entries_ for all the things seen in each category
-- https://www.bg-wiki.com/ffxi/Repeat_Login_Campaign/Past_Login_Campaign_Rewards
---@class prizes : { [integer] : { ['price']: integer, ['items']: { [integer]: xi.item } } }
local prizes =
{
[1] =
{
['price'] = 10,
['items'] =
{
1126, -- Beastmen's Seal
1127, -- Kindred's Seal
2955, -- Kindred's Crest
2956, -- High Kindred's Crest
2957, -- Sacred Kindred's Crest
xi.item.BEASTMENS_SEAL,
xi.item.KINDREDS_SEAL,
xi.item.KINDREDS_CREST,
xi.item.HIGH_KINDREDS_CREST,
xi.item.SACRED_KINDREDS_CREST,
-- 1857, -- Cordial Invite
-- 2306, -- Martial Ball Invite
-- 5364, -- Training Grounds Key
Expand All @@ -39,20 +40,20 @@ local prizes =
['price'] = 100,
['items'] =
{
8734, -- Mog Kupon I-S1
8966, -- Eudaemon Blade
8967, -- Eudaemon Cape
8968, -- Eudaemon Ring
8969, -- Eudaemon Sash
8970, -- Eudaemon Shield
17006, -- Drill Calamary
17007, -- Dwarf Pugil
6413, -- Astral Cube
xi.item.MOG_KUPON_I_S1, -- Mog Kupon I-S1
xi.item.EUDAEMON_BLADE, -- Eudaemon Blade
xi.item.EUDAEMON_CAPE, -- Eudaemon Cape
xi.item.EUDAEMON_RING, -- Eudaemon Ring
xi.item.EUDAEMON_SASH, -- Eudaemon Sash
xi.item.EUDAEMON_SHIELD, -- Eudaemon Shield
xi.item.DRILL_CALAMARY, -- Drill Calamary
xi.item.DWARF_PUGIL, -- Dwarf Pugil
xi.item.ASTRAL_CUBE, -- Astral Cube
-- 9891, -- Zinnia Orb
-- 10112, -- Cipher: Zeid
-- 10113, -- Cipher: Lion
10118, -- Cipher: Naja
10120, -- Cipher: Lehko
xi.item.CIPHER_OF_NAJAS_ALTER_EGO, -- Cipher: Naja
xi.item.CIPHER_OF_LEHKOS_ALTER_EGO, -- Cipher: Lehko
-- 10124, -- Cipher: Luzaf
-- 10125, -- Cipher: Najelith
-- 10129, -- Cipher: Domina
Expand Down Expand Up @@ -80,8 +81,8 @@ local prizes =
-- 10178, -- Cipher: Ullegore
-- 10179, -- Cipher: Teodor
-- 10183, -- Cipher: Darrcuiln
20713, -- Excalipoor
6008, -- Copse Candy
xi.item.EXCALIPOOR, -- Excalipoor
xi.item.PIECE_OF_COPSE_CANDY, -- Copse Candy
},
},

Expand All @@ -91,12 +92,12 @@ local prizes =
['items'] =
{
-- 10187, -- Cipher: Shantotto II
10069, -- ♪Goobbue
10051, -- ♪Crab
10058, -- ♪Beetle
xi.item.MOUNT_GOOBBUE, -- ♪Goobbue
xi.item.MOUNT_CRAB, -- ♪Crab
xi.item.MOUNT_BEETLE, -- ♪Beetle
-- TODO: The other mounts
10384, -- Cumulus Masque
20666, -- Blizzard Brand
xi.item.CUMULUS_MASQUE, -- Cumulus Masque
xi.item.BLIZZARD_BRAND, -- Blizzard Brand
-- 25658, -- Wyrm. Masque +1
-- 25757, -- Wyrmking Suit +1
-- 5854, -- Frayed Pouch (B)
Expand All @@ -120,7 +121,7 @@ local prizes =
['items'] =
{
-- TODO: Special month-to-month things
10073, -- ♪Dhalmel
xi.item.MOUNT_DHALMEL, -- ♪Dhalmel
},

},
Expand All @@ -130,15 +131,15 @@ local prizes =
['price'] = 750,
['items'] =
{
3885, -- Melodious Plans
3886, -- Timbre Case Kit
3887, -- Musichinery Kit
xi.item.COPY_OF_MELODIOUS_PLANS, -- Melodious Plans
xi.item.TIMBRE_CASE_KIT, -- Timbre Case Kit
xi.item.MUSICHINERY_KIT, -- Musichinery Kit
-- 9079, -- Kitchen Brick
-- 9080, -- Kitchen Stove
-- 9081, -- Kitchen Plate
3339, -- Honey Wine
3341, -- Beastly Shank
3343, -- Blue Pondweed
xi.item.JUG_OF_HONEY_WINE, -- Honey Wine
xi.item.BEASTLY_SHANK, -- Beastly Shank
xi.item.CLUMP_OF_BLUE_PONDWEED, -- Blue Pondweed
-- 1873, -- Brigand's Chart
-- 1874, -- Pirate's Chart
-- 6381, -- Fisherman's Feast
Expand All @@ -156,8 +157,8 @@ local prizes =
['items'] =
{
-- 6499, -- Patio Design Plans
26165, -- Facility Ring
26164, -- Caliber Ring
xi.item.FACILITY_RING, -- Facility Ring
xi.item.CALIBER_RING, -- Caliber Ring
-- 6486, -- Frayed Sack (Pel)
-- 6487, -- Frayed Sack (Fer)
-- 6488, -- Frayed Sack (Tau)
Expand All @@ -169,9 +170,9 @@ local prizes =
['price'] = 1500,
['items'] =
{
3340, -- Sweet Tea
3342, -- Savory Shank
3344, -- Red Pondweed
xi.item.CUP_OF_SWEET_TEA, -- Sweet Tea
xi.item.SAVORY_SHANK, -- Savory Shank
xi.item.CLUMP_OF_RED_PONDWEED, -- Red Pondweed
-- 8720, -- Maliya. Coral Orb
-- 8722, -- Hepatizon Ingot
-- 8724, -- Beryllium Ingot
Expand All @@ -180,4 +181,5 @@ local prizes =
},
},
}

return prizes
6 changes: 5 additions & 1 deletion scripts/globals/abyssea.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ xi.abyssea.abyssiteType =
DEMILUNE = 20,
}

---@enum xi.abyssea.itemType
xi.abyssea.itemType =
{
ITEM = 1,
Expand Down Expand Up @@ -777,7 +778,10 @@ xi.abyssea.giveNMDrops = function(mob, player, ID)
local playerClaimed = GetPlayerByID(mob:getLocalVar('[ClaimedBy]'))

for _, keyItemId in pairs(normalDrops) do
if xi.abyssea.canGiveNMKI(mob, 20) then
if
playerClaimed and
xi.abyssea.canGiveNMKI(mob, 20)
then
npcUtil.giveKeyItem(playerClaimed, keyItemId, ID.text.PLAYER_KEYITEM_OBTAINED)
end
end
Expand Down
105 changes: 58 additions & 47 deletions scripts/globals/besieged.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,70 +49,81 @@ end
-----------------------------------
-- function getISPItem(i) returns the item ID and cost of the imperial standing
-- points item indexed by i (the same value as that used by the vendor event.)
-- TODO: Format table, use xi.items enum, and descriptive parameter name
-- TODO: Separate packed data into something more logical
-----------------------------------
local function getISPItem(i)
---@class imperialStandingItems : { [integer]: { id: xi.item, price: integer } }
local imperialStandingItems =
{
-- Common Items
[1] = { id = 4182, price = 7 }, -- scroll of Instant Reraise
[4097] = { id = 4181, price = 10 }, -- scroll of Instant Warp
[8193] = { id = 2230, price = 100 }, -- lambent fire cell
[12289] = { id = 2231, price = 100 }, -- lambent water cell
[16385] = { id = 2232, price = 100 }, -- lambent earth cell
[20481] = { id = 2233, price = 100 }, -- lambent wind cell
[24577] = { id = 19021, price = 20000 }, -- katana strap
[28673] = { id = 19022, price = 20000 }, -- axe grip
[32769] = { id = 19023, price = 20000 }, -- staff strap
[36865] = { id = 3307, price = 5000 }, -- heat capacitor
[40961] = { id = 3308, price = 5000 }, -- power cooler
[45057] = { id = 3309, price = 5000 }, -- barrage turbine
[53249] = { id = 3311, price = 5000 }, -- galvanizer
[57345] = { id = 6409, price = 50000 },
[69633] = { id = xi.item.CIPHER_OF_MIHLIS_ALTER_EGO, price = 5000 }, -- mihli
[ 1] = { id = xi.item.SCROLL_OF_INSTANT_RERAISE, price = 7 },
[ 4097] = { id = xi.item.SCROLL_OF_INSTANT_WARP, price = 10 },
[ 8193] = { id = xi.item.LAMBENT_FIRE_CELL, price = 100 },
[12289] = { id = xi.item.LAMBENT_WATER_CELL, price = 100 },
[16385] = { id = xi.item.LAMBENT_EARTH_CELL, price = 100 },
[20481] = { id = xi.item.LAMBENT_WIND_CELL, price = 100 },
[24577] = { id = xi.item.KATANA_STRAP, price = 20000 },
[28673] = { id = xi.item.AXE_GRIP, price = 20000 },
[32769] = { id = xi.item.STAFF_STRAP, price = 20000 },
[36865] = { id = xi.item.HEAT_CAPACITOR, price = 5000 },
[40961] = { id = xi.item.POWER_COOLER, price = 5000 },
[45057] = { id = xi.item.BARRAGE_TURBINE, price = 5000 },
[53249] = { id = xi.item.GALVANIZER, price = 5000 },
[57345] = { id = xi.item.EPHRAMADIAN_THRONE, price = 50000 },
[69633] = { id = xi.item.CIPHER_OF_MIHLIS_ALTER_EGO, price = 5000 },

-- Private Second Class
-- Map Key Items (handled separately)
-- Private First Class
[33] = { id = 18689, price = 2000 }, -- volunteer's dart
[289] = { id = 18690, price = 2000 }, -- mercenary's dart
[545] = { id = 18691, price = 2000 }, -- Imperial dart
[ 33] = { id = xi.item.VOLUNTEERS_DART, price = 2000 },
[289] = { id = xi.item.MERCENARYS_DART, price = 2000 },
[545] = { id = xi.item.IMPERIAL_DART, price = 2000 },

-- Superior Private
[49] = { id = 18692, price = 4000 }, -- Mamoolbane
[305] = { id = 18693, price = 4000 }, -- Lamiabane
[561] = { id = 18694, price = 4000 }, -- Trollbane
[817] = { id = 15810, price = 4000 }, -- Luzaf's ring
[ 49] = { id = xi.item.MAMOOLBANE, price = 4000 },
[305] = { id = xi.item.LAMIABANE, price = 4000 },
[561] = { id = xi.item.TROLLBANE, price = 4000 },
[817] = { id = xi.item.LUZAFS_RING, price = 4000 },

-- Lance Corporal
[65] = { id = 15698, price = 8000 }, -- sneaking boots
[321] = { id = 15560, price = 8000 }, -- trooper's ring
[577] = { id = 16168, price = 8000 }, -- sentinel shield
[ 65] = { id = xi.item.SNEAKING_BOOTS, price = 8000 },
[321] = { id = xi.item.TROOPERS_RING, price = 8000 },
[577] = { id = xi.item.SENTINEL_SHIELD, price = 8000 },

-- Corporal
[81] = { id = 18703, price = 16000 }, -- shark gun
[337] = { id = 18742, price = 16000 }, -- puppet claws
[593] = { id = 17723, price = 16000 }, -- singh kilij
[ 81] = { id = xi.item.SHARK_GUN, price = 16000 },
[337] = { id = xi.item.PUPPET_CLAWS, price = 16000 },
[593] = { id = xi.item.SINGH_KILIJ, price = 16000 },

-- Sergeant
[97] = { id = 15622, price = 24000 }, -- mercenary's trousers
[353] = { id = 15790, price = 24000 }, -- multiple ring
[609] = { id = 15981, price = 24000 }, -- haten earring
[ 97] = { id = xi.item.MERCENARYS_TROUSERS, price = 24000 },
[353] = { id = xi.item.MULTIPLE_RING, price = 24000 },
[609] = { id = xi.item.HATEN_EARRING, price = 24000 },

-- Sergeant Major
[113] = { id = 15623, price = 32000 }, -- volunteer's brais
[369] = { id = 15982, price = 32000 }, -- priest's earring
[625] = { id = 15983, price = 32000 }, -- chaotic earring
[113] = { id = xi.item.VOLUNTEERS_BRAIS, price = 32000 },
[369] = { id = xi.item.PRIESTS_EARRING, price = 32000 },
[625] = { id = xi.item.CHAOTIC_EARRING, price = 32000 },

-- Chief Sergeant
[129] = { id = 17741, price = 40000 }, -- perdu hanger
[385] = { id = 18943, price = 40000 }, -- perdu sickle
[641] = { id = 18850, price = 40000 }, -- perdu wand
[897] = { id = 18717, price = 40000 }, -- perdu bow
[129] = { id = xi.item.PERDU_HANGER, price = 40000 },
[385] = { id = xi.item.PERDU_SICKLE, price = 40000 },
[641] = { id = xi.item.PERDU_WAND, price = 40000 },
[897] = { id = xi.item.PERDU_BOW, price = 40000 },

-- Second Lieutenant
[145] = { id = 16602, price = 48000 }, -- perdu sword
[401] = { id = 18425, price = 48000 }, -- perdu blade
[657] = { id = 18491, price = 48000 }, -- perdu voulge
[913] = { id = 18588, price = 48000 }, -- perdu staff
[1169] = { id = 18718, price = 48000 }, -- perdu crossbow
[ 145] = { id = xi.item.PERDU_SWORD, price = 48000 },
[ 401] = { id = xi.item.PERDU_BLADE, price = 48000 },
[ 657] = { id = xi.item.PERDU_VOULGE, price = 48000 },
[ 913] = { id = xi.item.PERDU_STAFF, price = 48000 },
[1169] = { id = xi.item.PERDU_CROSSBOW, price = 48000 },

-- First Lieutenant
[161] = { id = 16271, price = 56000 }, -- lieutenant's gorget
[417] = { id = 15912, price = 56000 }, -- lieutenant's sash
[673] = { id = 16230, price = 56000 } -- lieutenant's cape
[161] = { id = xi.item.LIEUTENANTS_GORGET, price = 56000 },
[417] = { id = xi.item.LIEUTENANTS_SASH, price = 56000 },
[673] = { id = xi.item.LIEUTENANTS_CAPE, price = 56000 },
}

local item = imperialStandingItems[i]
if item then
return item.id, item.price
Expand Down
Loading

0 comments on commit c57f162

Please sign in to comment.