Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Merge branch 'mount' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
ibm2431 committed Mar 27, 2020
2 parents 531509c + 625c682 commit f4b1fbe
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 2 deletions.
40 changes: 40 additions & 0 deletions scripts/commands/addallmounts.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---------------------------------------------------------------------------------------------------
-- func: addallmounts
-- desc: Adds all mount key items to player, granting access to their associated mounts
---------------------------------------------------------------------------------------------------

require("scripts/globals/status")
require("scripts/globals/keyitems")

cmdprops =
{
permission = 1,
parameters = "s"
}

function error(player, msg)
player:PrintToPlayer(msg)
player:PrintToPlayer("!addallmounts {player}")
end

function onTrigger(player, 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!", target))
return
end
end

-- add all mount key items
for i = tpz.ki.CHOCOBO_COMPANION, tpz.ki.CHOCOBO_COMPANION + 26 do
targ:addKeyItem(i)
end

player:PrintToPlayer(string.format("%s now has all mounts.", targ:getName()))
end
41 changes: 41 additions & 0 deletions scripts/commands/mount.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require("scripts/globals/status")

cmdprops =
{
permission = 1,
parameters = "sss"
};

function error(player, msg)
player:PrintToPlayer(msg)
player:PrintToPlayer("!mount <mount ID> {player}")
end

function onTrigger(player, mount, target)

-- Default to Chocobo (0)
if (mount == nil) then
mount = 0
end

-- validate mount
mount = tonumber(mount) or tpz.mount[string.upper(mount)]
if (mount == nil or mount < 0 or mount > 27) then
error(player, "Invalid mount ID.")
return
end

-- 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!", target))
return
end
end

targ:addStatusEffectEx(tpz.effect.MOUNTED, tpz.effect.MOUNTED, mount, 0, 0, true)
end
7 changes: 7 additions & 0 deletions scripts/globals/keyitems.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2982,6 +2982,13 @@ tpz.keyItem =
SPECTRAL_CHAIR_COMPANION = 3089,
SPHEROID_COMPANION = 3090,
OMEGA_COMPANION = 3091,
COEURL_COMPANION = 3092,
GOOBBUE_COMPANION = 3093,
RAAZ_COMPANION = 3094,
LEVITUS_COMPANION = 3095,
ADAMANTOISE_COMPANION = 3096,
DHAMEL_COMPANION = 3097,
DOLL_COMPANION = 3098,
SHEET_OF_SHADOW_LORD_TUNES = 3136,
MYSTICAL_CANTEEN = 3137,
YGNASS_INSIGNIA = 3138,
Expand Down
7 changes: 7 additions & 0 deletions scripts/globals/status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2648,6 +2648,13 @@ tpz.mount =
SPECTRAL_CHAIR = 18,
SPHEROID = 19,
OMEGA = 20,
COEURL = 21,
GOOBBUE = 22,
RAAZ = 23,
LEVITUS = 24,
ADAMANTOISE = 25,
DHAMEL = 26,
DOLL = 27,
}

------------------------------------
Expand Down
67 changes: 67 additions & 0 deletions scripts/zones/Upper_Jeuno/npcs/Mapitoto.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
-----------------------------------
-- Area: Upper Jeuno
-- NPC: Mapitoto
-- Type: Full Speed Ahead Mount NPC
-- !pos -54.310 8.200 85.940 244
-----------------------------------
local ID = require("scripts/zones/Upper_Jeuno/IDs")
require("scripts/globals/chocobo")
require("scripts/globals/keyitems")
require("scripts/globals/npc_util")
require("scripts/globals/status")
-----------------------------------

function onTrade(player,npc,trade)
-- The Fenrir (10057) and Omega (10067) items and mounts have their own questlines, so they aren't valid trades here
if trade:getSlotCount() == 1 and not (npcUtil.tradeHasExactly(trade, 10057) or npcUtil.tradeHasExactly(trade, 10067)) then
local item = trade:getItemId(0)
local mount = item - 10050
if item == 15533 then
player:startEvent(10227, 15533, tpz.ki.TRAINERS_WHISTLE, tpz.mount.CHOCOBO)
player:setLocalVar("FullSpeedAheadReward", tpz.ki.CHOCOBO_COMPANION)
elseif mount >= 0 and mount <= 24 then
player:setLocalVar("FullSpeedAheadReward", tpz.ki.TIGER_COMPANION + mount)
player:startEvent(10227, item, tpz.ki.TRAINERS_WHISTLE, tpz.mount.TIGER + mount - 1)
end
end
end

function onTrigger(player,npc)
-- Minigame complete
local fullSpeedAheadStatus = player:getCharVar("[QUEST]FullSpeedAhead")
local hasTrainersWhistle = player:hasKeyItem(tpz.ki.TRAINERS_WHISTLE)

if hasTrainersWhistle then
player:startEvent(10226)
elseif
player:hasKeyItem(tpz.ki.CHOCOBO_LICENSE) and
player:getMainLvl() >= 20 and
player:hasKeyItem(tpz.ki.MAP_OF_THE_JEUNO_AREA)
then
player:startEvent(10223, 0, 0, 4)
elseif fullSpeedAheadStatus == 1 then
player:startEvent(10225, tpz.ki.TRAINERS_WHISTLE)
else
player:startEvent(10222)
end
end

function onEventUpdate(player,csid,option)
end

function onEventFinish(player,csid,option)
if csid == 10223 and option == 1 then
player:setPos(475, 8.8, -159, 128, 105)
elseif csid == 10225 then
-- Complete quest
npcUtil.giveKeyItem(player, tpz.ki.TRAINERS_WHISTLE)
npcUtil.giveKeyItem(player, tpz.ki.RAPTOR_COMPANION)
elseif csid == 10227 then
local rewardKI = player:getLocalVar("FullSpeedAheadReward")
player:setLocalVar("FullSpeedAheadReward", 0)
if rewardKI ~= tpz.ki.CHOCOBO_COMPANION then
player:tradeComplete()
end
npcUtil.giveKeyItem(player, rewardKI)
end
end
4 changes: 2 additions & 2 deletions sql/npc_list.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29709,8 +29709,8 @@ INSERT INTO `npc_list` VALUES (17776891,'Unity_Master','Unity Master',0,0.000,0.
INSERT INTO `npc_list` VALUES (17776892,'???','???',0,0.000,0.000,0.000,0,50,50,0,0,0,2,2051,0x0000340000000000000000000000000000000000,0,NULL,1);
INSERT INTO `npc_list` VALUES (17776893,'csnpc','Volto Oscuro',0,0.000,0.000,0.000,0,50,50,0,0,0,6,27,0x010000018411E620E630E640E650006000700000,32,NULL,1);
INSERT INTO `npc_list` VALUES (17776894,'Iroha','Iroha',0,0.000,0.000,0.000,0,50,50,0,0,0,6,27,0x0000910900000000000000000000000000000000,32,NULL,1);
-- NC: INSERT INTO `npc_list` VALUES (17776895,'NOT_CAPTURED','Mapitoto',0,0.000,0.000,0.000,0,50,50,0,0,0,0,0,0x0000320000000000000000000000000000000000,0,NULL,0);
-- NC: INSERT INTO `npc_list` VALUES (17776896,'NOT_CAPTURED','Raptor',0,0.000,0.000,0.000,0,50,50,0,0,0,0,0,0x0000320000000000000000000000000000000000,0,NULL,0);
INSERT INTO `npc_list` VALUES (17776895,'Mapitoto','Mapitoto',172,-54.310,8.200,85.940,1,50,50,0,0,0,0,27,0x0100040661116121613161416151006000700000,32,'ROV',1);
INSERT INTO `npc_list` VALUES (17776896,'Raptor','Raptor',68,-53.950,8.200,88.960,1,50,50,0,0,0,2,25,0x00003C0100000000000000000000000000000000,32,'ROV',1);

-- ------------------------------------------------------------
-- Lower Jeuno (Zone 245)
Expand Down
7 changes: 7 additions & 0 deletions src/map/entities/baseentity.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ enum MOUNTTYPE
MOUNT_SPECTRAL_CHAIR = 18,
MOUNT_SPHEROID = 19,
MOUNT_OMEGA = 20,
MOUNT_COEURL = 21,
MOUNT_GOOBBUE = 22,
MOUNT_RAAZ = 23,
MOUNT_LEVITUS = 24,
MOUNT_ADAMANTOISE = 25,
MOUNT_DHAMEL = 26,
MOUNT_DOLL = 27,
};

enum ALLEGIANCETYPE
Expand Down

0 comments on commit f4b1fbe

Please sign in to comment.