Skip to content

Commit

Permalink
Merge pull request #3679 from Xaver-DaRed/escha/npcs
Browse files Browse the repository at this point in the history
[Escha] Add Ethereal droplet npcs and logic
  • Loading branch information
claywar authored Mar 18, 2023
2 parents 913f34a + 933d0ce commit a945600
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 39 deletions.
1 change: 1 addition & 0 deletions scripts/globals/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,7 @@ xi.items =
CYLLENIAN_ABJURATION_HANDS = 9127,
CYLLENIAN_ABJURATION_LEGS = 9128,
CYLLENIAN_ABJURATION_FEET = 9129,
ETHEREAL_DROPLET = 9202,
DIAL_KEY_AB = 9217,
DIAL_KEY_FO = 9218,
DIAL_KEY_ANV = 9274,
Expand Down
67 changes: 36 additions & 31 deletions scripts/globals/teleports/eschan_portals.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
-------------------------------------------
-- Escha/Reisenjima Portals Global
-------------------------------------------
require("scripts/globals/teleports")
require("scripts/globals/items")
require("scripts/globals/keyitems")
require("scripts/globals/npc_util")
require("scripts/globals/status")
require("scripts/globals/teleports")
require("scripts/globals/utils")
-------------------------------------------
xi = xi or {}
Expand All @@ -13,18 +14,18 @@ xi.escha.portals = xi.escha.portals or {}

local costReduction = -- Based on Luck+ Vorseal power
{-- Power, reduction (percentage based, will always be (100 minus reduction))
[ 0] = 0,
[ 1] = 5,
[ 2] = 10,
[ 3] = 15,
[ 4] = 20,
[ 5] = 25,
[ 6] = 30,
[ 7] = 35,
[ 8] = 40,
[ 9] = 45,
[10] = 50,
[11] = 55,
[ 0] = 100,
[ 1] = 95,
[ 2] = 90,
[ 3] = 85,
[ 4] = 80,
[ 5] = 75,
[ 6] = 70,
[ 7] = 65,
[ 8] = 60,
[ 9] = 55,
[10] = 50,
[11] = 45,
}

local portalOffsets =
Expand All @@ -37,17 +38,18 @@ local portalOffsets =

-------------------------------------------------------------------------------------------------------------
-- Notes:
-- Portal base cost is 100 in every escha zone.
-- Portal base cost is 50 in every escha zone.
-- Vorseal Luck+ (Portal Cost per unpgrade) -5%, -10%, -15%, -20%, -25%, -30%, -35%, -40%, -45%, -50%, -55%
-- Vorseal status effect = 602
-------------------------------------------------------------------------------------------------------------
local function getPortalCost(player)
local cost = 100
local cost = 50
local luckVorsealPower = 0

--TODO: get Vorseal Luck+ power amount.
-- TODO: get Vorseal Luck+ power amount.
-- Note: Rounded down. Base 50 with luck+ 3 (-15%) results in 42. (17/march/2023)

cost = cost - costReduction[luckVorsealPower]
cost = math.floor(cost * costReduction[luckVorsealPower] / 100)

return cost
end
Expand All @@ -58,20 +60,19 @@ xi.escha.portals.eschanPortalOnTrigger = function(player, npc, portalGlobalNumbe
local lockValue = 0 -- Param 5.
local zonePortalsUnlocked = 0

-- Reisenjima portal #10. Unlocked with Key Item.
if
zoneId == xi.zone.REISENJIMA and
player:hasKeyItem(xi.ki.SCINTILLATING_RHAPSODY)
then
lockValue = 4
zonePortalsUnlocked = 1
end
-- Reisenjima only.
if zoneId == xi.zone.REISENJIMA then
-- Scintillating Rhapsody. Unlocks Portal #8 and #10.
if player:hasKeyItem(xi.ki.SCINTILLATING_RHAPSODY) then
lockValue = lockValue + 4
zonePortalsUnlocked = zonePortalsUnlocked + 1
end

-- Ethereal droplet.
-- TODO: Confirm Ethereal droplet logic. Adds +2 to lockValue when in possesion of one.
-- if player:hasItem(9202, 0) then
-- lockValue = lockValue + 2
-- end
-- Ethereal droplet. Warps you to Portal #1.
if player:hasItem(xi.items.ETHEREAL_DROPLET, xi.inv.TEMPITEMS) then
lockValue = lockValue + 2
end
end

-- Player has not activated this Portal.
if
Expand Down Expand Up @@ -113,8 +114,12 @@ end
xi.escha.portals.eschanPortalEventFinish = function(player, csid, option, npc)
local portalCost = getPortalCost(player)

if
if option == 3 then-- Ethereal droplet usage.
player:delItem(xi.items.ETHEREAL_DROPLET, 1, xi.inv.TEMPITEMS)
player:messageSpecial(ID.text.YOU_HAVE_USED, xi.items.ETHEREAL_DROPLET)
elseif
option ~= 0 and
option ~= 4 and -- Scintillating Rhapsody usage.
option ~= 1073741824
then
player:delCurrency("escha_silt", portalCost)
Expand Down
2 changes: 2 additions & 0 deletions scripts/zones/Reisenjima/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ zones[xi.zone.REISENJIMA] =
GIL_OBTAINED = 6391, -- Obtained <number> gil.
KEYITEM_OBTAINED = 6393, -- Obtained key item: <keyitem>.
ITEMS_OBTAINED = 6399, -- You obtain <number> <item>!
NOTHING_OUT_OF_ORDINARY = 6404, -- There is nothing out of the ordinary here.
CARRIED_OVER_POINTS = 7001, -- You have carried over <number> login point[/s].
LOGIN_CAMPAIGN_UNDERWAY = 7002, -- The [/January/February/March/April/May/June/July/August/September/October/November/December] <number> Login Campaign is currently underway!
LOGIN_NUMBER = 7003, -- In celebration of your most recent login (login no. <number>), we have provided you with <number> points! You currently have a total of <number> points.
MEMBERS_LEVELS_ARE_RESTRICTED = 7023, -- Your party is unable to participate because certain members' levels are restricted.
YOU_HAVE_USED = 7609, -- You have used <item>.
},
mob =
{
Expand Down
31 changes: 31 additions & 0 deletions scripts/zones/Reisenjima/npcs/qm_ethereal_droplet.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-----------------------------------
-- Area: Reisenjima (291)
-- NPC: ???
-- Notes: Grants "Ethereal droplet" temporary item.
-----------------------------------
local ID = require("scripts/zones/Reisenjima/IDs")
require("scripts/globals/items")
require("scripts/globals/status")
-----------------------------------

local entity = {}

entity.onTrade = function(player, npc, trade)
end

entity.onTrigger = function(player, npc)
if player:hasItem(xi.items.ETHEREAL_DROPLET, xi.inv.TEMPITEMS) then
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)
else
player:addTempItem(xi.items.ETHEREAL_DROPLET, 1)
player:messageSpecial(ID.text.ITEM_OBTAINED, xi.items.ETHEREAL_DROPLET)
end
end

entity.onEventUpdate = function(player, csid, option)
end

entity.onEventFinish = function(player, csid, option, npc)
end

return entity
13 changes: 5 additions & 8 deletions sql/npc_list.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36113,16 +36113,13 @@ INSERT INTO `npc_list` VALUES (17969983,'Ethereal_Ingress_#6','Ethereal Ingress
INSERT INTO `npc_list` VALUES (17969984,'Ethereal_Ingress_#7','Ethereal Ingress #7',0,640.599,-374.000,-911.200,8,50,50,0,0,0,0,27,0x0000BC0900000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969985,'Ethereal_Ingress_#8','Ethereal Ingress #8',0,-368.720,-113.300,211.450,8,50,50,0,0,0,0,27,0x0000BC0900000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969986,'Ethereal_Ingress_#9','Ethereal Ingress #9',0,-580.000,-417.400,-1065.000,8,50,50,0,0,0,0,27,0x0000BC0900000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969987,'Ethereal Ingress #10','Ethereal Ingress #10',0,-389.220,-439.710,-835.130,0,50,50,0,0,0,0,27,0x0000BC0900000000000000000000000000000000,0,NULL,0);
INSERT INTO `npc_list` VALUES (17969987,'Ethereal_Ingress_#10','Ethereal Ingress #10',0,-389.220,-439.710,-835.130,0,50,50,0,0,0,0,27,0x0000BC0900000000000000000000000000000000,0,NULL,0);
INSERT INTO `npc_list` VALUES (17969988,'qm','???',0,0.000,0.000,0.000,0,50,50,0,0,0,0,27,0x0000340000000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969989,'qm','???',0,0.000,0.000,0.000,0,50,50,0,0,0,0,27,0x0000340000000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969990,'qm','???',0,0.000,0.000,0.000,0,50,50,0,0,0,0,27,0x0000340000000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969991,'qm','???',0,0.000,0.000,0.000,0,50,50,0,0,0,0,27,0x0000340000000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969992,'qm','???',0,0.000,0.000,0.000,0,50,50,0,0,0,0,27,0x0000340000000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969989,'qm_ethereal_droplet','???',0,648.680,-374.780,-912.430,0,50,50,0,0,0,0,3,0x0000340000000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969990,'qm_ethereal_droplet','???',0,-377.500,-113.300,211.500,0,50,50,0,0,0,0,3,0x0000340000000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969991,'qm_ethereal_droplet','???',0,-592.260,-417.400,-1061.440,0,50,50,0,0,0,0,3,0x0000340000000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969992,'qm_ethereal_droplet','???',0,-388.930,-439.920,-843.130,0,50,50,0,0,0,0,3,0x0000340000000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969993,'qm','???',0,220.000,-66.400,181.000,8,50,50,0,0,0,0,27,0x0000340000000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969994,'qm','???',0,648.679,-374.779,-912.430,8,50,50,0,0,0,0,27,0x0000340000000000000000000000000000000000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17969995,'qm','???',0,-377.500,-113.300,211.500,1,50,50,0,0,112,0,3,0x0000340000000000000000000000000000000000,2,'ROV',1);
INSERT INTO `npc_list` VALUES (17969996,'qm','???',0,-592.260,-417.399,-1061.439,1,50,50,0,0,112,0,3,0x0000340000000000000000000000000000000000,2,'ROV',1);
INSERT INTO `npc_list` VALUES (17969997,'Emblazoned_Reliquary','Emblazoned Reliquary',0,0.000,0.000,0.000,8,50,50,0,4,4,0,3,0x0000C50300000000000000000000000000000000,0,'ROV',1);
INSERT INTO `npc_list` VALUES (17969998,'Emblazoned_Reliquary','Emblazoned Reliquary',0,0.000,0.000,0.000,8,50,50,0,4,4,0,3,0x0000C50300000000000000000000000000000000,0,'ROV',1);
INSERT INTO `npc_list` VALUES (17969999,'Emblazoned_Reliquary','Emblazoned Reliquary',0,0.000,0.000,0.000,8,50,50,0,4,4,0,3,0x0000C50300000000000000000000000000000000,0,'ROV',1);
Expand Down

0 comments on commit a945600

Please sign in to comment.