Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:RequestItemSet

From RoR Wiki

UI Lua API · Item functions
Version: WAR 1.4.8

Publishes the client's cached data for an item set to GameData.UpdatedItemSet and raises ITEM_SET_DATA_ARRIVED.

RequestItemSet(itemSetId)

Arguments

itemSetId
number – ID of the item set. Must not be 0.

Returns

Nothing useful. See Details.

Details

  • If the client has data for this set, it is written to GameData.UpdatedItemSet and SystemData.Events.ITEM_SET_DATA_ARRIVED is raised. The fields written are:
Key Type Meaning
id number Item set ID.
name wstring Name of the set.
castingLevel number The set's casting level value.
itemNames[1] … itemNames[21] wstring Names of the set's pieces. Unused entries are empty.
bonuses[1] … bonuses[10] table One table per bonus rank, with the fields below.
bonuses[n].piecesRequired number Number of pieces needed for this bonus. 0 for an unused rank.
bonuses[n].rankType number Bonus rank type.
bonuses[n].statType number Stat the bonus applies to.
bonuses[n].statValue number Size of the bonus.
bonuses[n].isPercentage boolean true if statValue is a percentage.
  • If the client has no data for the set, nothing happens. The function does not send a request to the server.
  • Nothing happens if the player object does not exist yet.
  • When the player object exists, the function reports one return value without pushing one, so Lua receives the value on top of the stack, which is the last argument passed. Do not rely on this.
  • Exactly one argument must be passed.

Errors

  • Error in function call 'RequestItemSet': ItemSetId must be valid. (argument missing or not a number, in addition to the generic Invalid Parameters message)
  • Error in function call 'RequestItemSet': IteSetId cannot be 0. (sic)

Example

From default/easystem_utils/source/datautils.lua. DataUtils.UpdateItemSets handles ITEM_SET_DATA_ARRIVED and copies GameData.UpdatedItemSet into its own table:

function DataUtils.GetItemSetData (itemSetId)
    if (itemSetId ~= nil) then
        if (ItemSetData[itemSetId] ~= nil) then
            return ItemSetData[itemSetId];
        end

        -- Otherwise, we need to request this from the client...
        RequestItemSet (itemSetId);
    end

    return nil;
end

See also