API:GetBraggingRights
From RoR Wiki
UI Lua API · Social functions
Version: WAR 1.4.8
Returns the player's bragging rights (Tome of Knowledge entries shown to other players) and bragging-rights card slots.
brags, cards = GetBraggingRights()
Arguments
None.
Returns
- brags
table– Array of 10 brag tables, one per slot.- cards
table– Array of 6 tables, one per card slot. Each has one field,id(number), the value set with SetBraggingRightsCard.
Each brag table has these fields:
| Key | Type | Meaning |
|---|---|---|
id |
number |
Tome entry id in the slot. 0 for an empty slot. |
name |
wstring |
Name of the tome entry. |
cardId |
number |
Id of the card that belongs to the entry, or 0. The stock UI passes it to TomeGetCardData.
|
rewards |
table |
Only present when the entry has reward data. Array of up to two reward tables with rewardType (number) and rewardId (number). The first one always has rewardType 0.
|
Details
- Both tables always have all their entries (10 and 6), including empty slots.
- The data is the client's local copy. SetBraggingRight and SetBraggingRightsCard change it at once and fire
SystemData.Events.SOCIAL_BRAGGING_RIGHTS_UPDATED.
Errors
None.
Example
From default/ea_characterwindow/source/characterwindowbrags.lua:
CharacterWindow.braggingRights = GetBraggingRights()
for index, brag in ipairs( CharacterWindow.braggingRights )
do
...
LabelSetText( windowName.."Text", brag.name )
-- set the reward data
if( not brag.rewards )
then
WindowSetShowing( windowName.."Reward1", false )
WindowSetShowing( windowName.."Reward2", false )
else
TomeWindow.SetTomeReward( windowName.."Reward1", brag.rewards[1] )
TomeWindow.SetTomeReward( windowName.."Reward2", brag.rewards[2] )
...
Reading both results, from default/ea_tomeofknowledge/source/tomewindow.lua:
TomeWindow.braggingRights, TomeWindow.braggingRightsCards = GetBraggingRights() WindowRegisterEventHandler( "TomeWindow", SystemData.Events.SOCIAL_BRAGGING_RIGHTS_UPDATED, "TomeWindow.OnBraggingRightsUpdated")
