Skip to content

Commit

Permalink
Merge branch 'base' into healing_the_land_LSB
Browse files Browse the repository at this point in the history
  • Loading branch information
hooksta4 authored Sep 3, 2024
2 parents f99dd28 + 8e17a5d commit 5500fcc
Show file tree
Hide file tree
Showing 9,229 changed files with 11,544 additions and 1,028 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@
"SendToJailOffline",
"GetPlayerIDByName",
"PlayerHasValidSession",

"GetSynergyRecipeByID",
"GetSynergyRecipeByTrade",
],
"Lua.diagnostics.disable": [
"lowercase-global"
Expand Down Expand Up @@ -445,6 +448,11 @@
"ranges": "cpp",
"span": "cpp",
"expected": "cpp",
"string_view": "cpp"
"string_view": "cpp",
"cfenv": "cpp",
"cwctype": "cpp",
"scoped_allocator": "cpp",
"pointers": "cpp",
"*.inc": "cpp"
},
}
20 changes: 20 additions & 0 deletions scripts/enum/animation_strings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,24 @@ xi.animationString =
SPECIAL_10 = 'sp10', -- Zdei vertical barriers off, etc...
SPECIAL_20 = 'sp20', -- Zdei horizontal barriers on, etc...
SPECIAL_30 = 'sp30', -- Zdei horizontal barriers off, etc...

-- Synergy
SYNERGY_COMPLETE = 'ef40',
SYNERGY_FIRE_LEAK = 'ef81',
SYNERGY_ICE_LEAK = 'ef82',
SYNERGY_WIND_LEAK = 'ef83',
SYNERGY_EARTH_LEAK = 'ef84',
SYNERGY_LIGHTNING_LEAK = 'ef85',
SYNERGY_WATER_LEAK = 'ef86',
SYNERGY_LIGHT_LEAK = 'ef87',
SYNERGY_DARK_LEAK = 'ef88',
SYNERGY_FIRE_FEWELL = 'ef91',
SYNERGY_ICE_FEWELL = 'ef92',
SYNERGY_WIND_FEWELL = 'ef93',
SYNERGY_EARTH_FEWELL = 'ef94',
SYNERGY_LIGHTNING_FEWELL = 'ef95',
SYNERGY_WATER_FEWELL = 'ef96',
SYNERGY_LIGHT_FEWELL = 'ef97',
SYNERGY_DARK_FEWELL = 'ef98',
SYNERGY_STEAM = 'efa0',
}
28 changes: 28 additions & 0 deletions scripts/enum/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4195,6 +4195,13 @@ xi.item =
DRACHEN_MAIL = 12649,
EVOKERS_DOUBLET = 12650,
MERCENARYS_GI = 12653,
CUSTOM_TUNIC = 12654,
CUSTOM_VEST = 12655,
MAGNA_JERKIN = 12656,
MAGNA_BODICE = 12657,
WONDER_KAFTAN = 12658,
SAVAGE_SEPARATES = 12659,
ELDERS_SURCOAT = 12660,
GAUNTLETS = 12672,
KOENIG_HANDSCHUHS = 12677,
IRON_MUSKETEERS_GAUNTLETS = 12678,
Expand Down Expand Up @@ -4242,6 +4249,13 @@ xi.item =
GALKAN_BRACERS = 12758,
ELVAAN_GAUNTLETS = 12759,
HUME_F_GLOVES = 12760,
CUSTOM_M_GLOVES = 12761,
CUSTOM_F_GLOVES = 12762,
MAGNA_GAUNTLETS = 12763,
MAGNA_GLOVES = 12764,
WONDER_MITTS = 12765,
SAVAGE_GAUNTLETS = 12766,
ELDERS_BRACERS = 12767,
CUISSES = 12800,
MYTHRIL_CUISSES = 12801,
KOENIG_DIECHLINGS = 12805,
Expand Down Expand Up @@ -4284,6 +4298,13 @@ xi.item =
LINEN_SLACKS = 12866,
WHITE_SLACKS = 12867,
COMBAT_CASTERS_SLACKS = 12870,
CUSTOM_SLACKS = 12871,
CUSTOM_PANTS = 12872,
MAGNA_M_CHAUSSES = 12873,
MAGNA_F_CHAUSSES = 12874,
WONDER_BRACCAE = 12875,
SAVAGE_LOINCLOTH = 12876,
ELDERS_BRAGUETTE = 12877,
LEGIONNAIRES_SUBLIGAR = 12881,
ROYAL_FOOTMANS_TROUSERS = 12882,
HUME_SLACKS = 12883,
Expand Down Expand Up @@ -4342,6 +4363,13 @@ xi.item =
POWER_SANDALS = 13012,
STUMBLING_SANDALS = 13013,
LEAPING_BOOTS = 13014,
CUSTOM_M_BOOTS = 13015,
CUSTOM_F_BOOTS = 13016,
MAGNA_M_LEDELSENS = 13017,
MAGNA_F_LEDELSENS = 13018,
WONDER_CLOMPS = 13019,
SAVAGE_GAITERS = 13020,
ELDERS_SANDALS = 13021,
ROYAL_FOOTMANS_CLOGS = 13045,
FUMA_KYAHAN = 13054,
PEACOCK_CHARM = 13056,
Expand Down
8 changes: 4 additions & 4 deletions scripts/enum/magic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ xi.magic.spellFlag =
-- Spell AOE IDs
-----------------------------------

---@enum xi.aoe
---@enum xi.magic.aoe
xi.magic.aoe =
{
NONE = 0,
Expand All @@ -34,7 +34,7 @@ xi.magic.aoe =
-- Spell Groups
-----------------------------------

---@enum xi.spellGroup
---@enum xi.magic.spellGroup
xi.magic.spellGroup =
{
NONE = 0,
Expand All @@ -52,7 +52,7 @@ xi.magic.spellGroup =
-- Spell Families
-----------------------------------

---@enum xi.spellFamily
---@enum xi.magic.spellFamily
xi.magic.spellFamily =
{
NONE = 0,
Expand Down Expand Up @@ -218,7 +218,7 @@ xi.magic.spellFamily =
-- Spell IDs
-----------------------------------

---@enum xi.spell
---@enum xi.magic.spell
xi.magic.spell =
{
CURE = 1,
Expand Down
9 changes: 8 additions & 1 deletion scripts/globals/homepoint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ xi.homepoint.onEventUpdate = function(player, csid, option, npc)

if xi.settings.main.HOMEPOINT_TELEPORT == 1 then
if choice >= selection.SET_LAYOUT and choice <= selection.REP_FAVORITE then

local index = bit.rshift(bit.lshift(option, 8), 24) -- Ret HP #

if choice == selection.ADD_FAVORITE then
Expand Down Expand Up @@ -230,6 +229,14 @@ xi.homepoint.onEventUpdate = function(player, csid, option, npc)
end

player:setTeleportMenu(xi.teleport.type.HOMEPOINT, favs)
elseif choice == selection.TELEPORT then
local hpIndex = bit.rshift(option, 16)
local origin = player:getLocalVar('originIndex')

if not player:hasTeleport(xi.teleport.type.HOMEPOINT, hpIndex, math.floor(origin / 32)) then
print(string.format("Player %s tried to teleport to an HP without it's destination being unlocked", player:getName()))
player:release()
end
end

for x = 1, 3 do -- Condense arrays for event params
Expand Down
17 changes: 17 additions & 0 deletions scripts/globals/interaction/actions/action.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
-----------------------------------
----- Action base class
-----------------------------------
---@class TInteractionAction
Action = {}

---@enum Action.Priority
Action.Priority =
{
Ignore = 1,
Expand All @@ -13,6 +15,7 @@ Action.Priority =
Progress = 1000,
}

---@enum Action.Type
Action.Type =
{
LambdaAction = 0,
Expand All @@ -26,6 +29,8 @@ Action.Type =
NoAction = 8,
}

---@param type Action.Type
---@return TInteractionAction
function Action:new(type)
local obj = {}
setmetatable(obj, self)
Expand All @@ -34,51 +39,63 @@ function Action:new(type)
return obj
end

---@param player CBaseEntity
---@param targetEntity CBaseEntity
---@return integer
function Action:perform(player, targetEntity)
-- Functionality is implemented in the specific sub-classes
return self.returnValue
end

---@param priorityArg Action.Priority|integer
---@return TInteractionAction
function Action:setPriority(priorityArg)
self.priority = priorityArg
return self
end

---@return TInteractionAction
function Action:progress()
-- Set highest priority for action
return self:setPriority(Action.Priority.Progress)
end

---@return TInteractionAction
function Action:replaceDefault()
-- Always prefer this over falling back to default in lua file
return self:setPriority(Action.Priority.ReplaceDefault)
end

-- Perform the action as a Progress priority, and then default back to event
---@return TInteractionAction
function Action:importantEvent()
self.priority = Action.Priority.Progress
self.secondaryPriority = Action.Priority.Event
return self
end

-- After the first time the action is performed, it will have a lower priority
---@return TInteractionAction
function Action:importantOnce()
self.priority = Action.Priority.Event
self.secondaryPriority = Action.Priority.Default
return self
end

-- Only do this action once per zone, unless there's nothing else to do
---@return TInteractionAction
function Action:oncePerZone()
self.secondaryPriority = Action.Priority.Ignore
return self
end

---@return TInteractionAction
function Action:openDoor()
self.returnValue = -1
return self
end

---@return TInteractionAction
function Action:open()
return self:openDoor()
end
8 changes: 8 additions & 0 deletions scripts/globals/interaction/actions/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
-----------------------------------
require('scripts/globals/interaction/actions/action')

---@class TInteractionEvent : TInteractionAction
---@field id integer
---@field options integer[]|table[]
Event = Action:new(Action.Type.Event)

---@param eventId integer
---@param ... integer|table
function Event:new(eventId, ...)
local obj = {}
setmetatable(obj, self)
Expand All @@ -16,6 +21,8 @@ function Event:new(eventId, ...)
return obj
end

---@param player CBaseEntity
---@param targetEntity CBaseEntity
function Event:perform(player, targetEntity)
if self.isCutscene and player.startCutscene then
player:startCutscene(self.id, unpack(self.options))
Expand All @@ -26,6 +33,7 @@ function Event:perform(player, targetEntity)
return self.returnValue
end

---@return TInteractionEvent
function Event:cutscene()
self.isCutscene = true
return self
Expand Down
6 changes: 6 additions & 0 deletions scripts/globals/interaction/actions/keyitem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
-----------------------------------
require('scripts/globals/interaction/actions/action')

---@class TInteractionKeyItem : TInteractionAction
---@field id integer
KeyItemAction = Action:new(Action.Type.KeyItem)

---@param keyItemId xi.keyItem
---@return TInteractionKeyItem
function KeyItemAction:new(keyItemId)
local obj = {}
setmetatable(obj, self)
Expand All @@ -14,6 +18,8 @@ function KeyItemAction:new(keyItemId)
return obj
end

---@param player CBaseEntity
---@param targetEntity CBaseEntity
function KeyItemAction:perform(player, targetEntity)
return npcUtil.giveKeyItem(player, self.id)
end
5 changes: 5 additions & 0 deletions scripts/globals/interaction/actions/lambdaaction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
-----------------------------------
require('scripts/globals/interaction/actions/action')

---@class TInteractionLambdaAction : TInteractionAction
---@field actionFunc function
---@field priority Action.Priority|integer
LambdaAction = Action:new(Action.Type.LambdaAction)

---@param actionFunc function
---@param prio Action.Priority|integer
function LambdaAction:new(actionFunc, prio)
local obj = {}
setmetatable(obj, self)
Expand Down
13 changes: 13 additions & 0 deletions scripts/globals/interaction/actions/message.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,26 @@
-----------------------------------
require('scripts/globals/interaction/actions/action')

---@class TInteractionMessage: TInteractionAction
---@field messageType Message.type
---@field id integer
---@field npcId integer?
---@field options integer[]
---@field face integer?
Message = Action:new(Action.Type.Message)

---@enum Message.type
Message.Type =
{
Text = 1,
Special = 2,
Name = 3,
}

---@param messageId integer
---@param messageType Message.type?
---@param ... integer?
---@return TInteractionMessage
function Message:new(messageId, messageType, ...)
local obj = {}
setmetatable(obj, self)
Expand All @@ -23,6 +34,8 @@ function Message:new(messageId, messageType, ...)
return obj
end

---@param player CBaseEntity
---@param targetEntity CBaseEntity
function Message:perform(player, targetEntity)
if self.messageType == Message.Type.Special then
player:messageSpecial(self.id, unpack(self.options))
Expand Down
1 change: 1 addition & 0 deletions scripts/globals/interaction/actions/noaction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-----------------------------------
require('scripts/globals/interaction/actions/action')

---@class TInteractionNoAction : TInteractionAction
NoAction = Action:new(Action.Type.NoAction)

function NoAction:new(prio)
Expand Down
7 changes: 7 additions & 0 deletions scripts/globals/interaction/actions/sequence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
require('scripts/globals/interaction/actions/action')
require('scripts/globals/interaction/actions/message')

---@class TInteractionSequence : TInteractionAction
---@field __nextAction any
Sequence = Action:new(Action.Type.Sequence)

-- Parse out a sequence from a table of actions.
Expand All @@ -28,6 +30,7 @@ function Sequence:new(unparsedSequence)
local id = nil
for _, entry in ipairs(unparsedSequence) do
if entry.text then
---@type TInteractionMessage
local newLast = Message:new(entry.text)
last.__nextAction = newLast
last = newLast
Expand All @@ -47,11 +50,15 @@ function Sequence:new(unparsedSequence)
-- Waits can be part of the other action
if entry.wait then
local newLast = { type = Action.Type.Wait, milliseconds = entry.wait }
-- TODO: Find a more elegant way to handle the inject field warnings
---@diagnostic disable-next-line inject-field
last.__nextAction = newLast
last = newLast
end
end

-- TODO: Find a more elegant way to handle the inject field warnings
---@diagnostic disable-next-line inject-field
last.__nextAction = { type = Action.Type.Release }

obj.id = id
Expand Down
Loading

0 comments on commit 5500fcc

Please sign in to comment.