Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ArsenalItemRankHintUIInfo.c
Go to the documentation of this file.
1[BaseContainerProps(configRoot: true)]
2class SCR_ArsenalItemRankHintUIInfo : SCR_InventoryItemHintUIInfo
3{
4 [Attribute("#AR-Item_Hint_Arsenal_InsufficientRank")]
6
7 [Attribute("{A4D40440E48CC7CC}UI/Textures/Editor/ContextMenu/ContextAction_BanPlayer.edds")]
9
10 protected SCR_ECharacterRank m_eRequiredRank;
11
12 //------------------------------------------------------------------------------------------------
13 override bool CanBeShown(InventoryItemComponent item, SCR_InventorySlotUI focusedSlot)
14 {
15 if (!super.CanBeShown(item, focusedSlot))
16 return false;
17
19 if (!localPlayerEntity)
20 return false;
21
22 if (m_eRequiredRank <= SCR_CharacterRankComponent.GetCharacterRank(localPlayerEntity))
23 {
24 FactionAffiliationComponent playerFactionAffiliation = FactionAffiliationComponent.Cast(localPlayerEntity.FindComponent(FactionAffiliationComponent));
25 if (!playerFactionAffiliation)
26 return false;
27
28 SCR_Faction playerFaction = SCR_Faction.Cast(playerFactionAffiliation.GetAffiliatedFaction());
29 if (!playerFaction)
30 return false;
31
32 //~ Hide the hint if the faction has no rank equal to the required rank and the item is availible to be taken
33 if (playerFaction.GetRanks().GetRankName(m_eRequiredRank).IsEmpty())
34 return false;
35 }
36
37 return true;
38 }
39
40 //------------------------------------------------------------------------------------------------
41 void SetRequiredRank(SCR_ECharacterRank rank)
42 {
43 m_eRequiredRank = rank;
44 }
45
46 //------------------------------------------------------------------------------------------------
48 {
49 SCR_Faction playerFaction = SCR_Faction.Cast(SCR_FactionManager.SGetLocalPlayerFaction());
50 if (!playerFaction)
51 {
52 Print("'SCR_ArsenalItemRankHintUIInfo' is unable to find the player's faction.", LogLevel.WARNING);
54 }
55
56 SCR_RankInfo rank = playerFaction.GetRanks().GetRankByID(m_eRequiredRank, true);
57 if (!rank)
59
60 return WidgetManager.Translate(GetName(), rank.GetRankName());
61 }
62
63 //------------------------------------------------------------------------------------------------
64 override bool SetIconTo(ImageWidget imageWidget)
65 {
66 if (!imageWidget)
67 return false;
68
70 if (rankIconImageSet.IsEmpty())
71 return false;
72
73 SCR_Faction playerFaction = SCR_Faction.Cast(SCR_FactionManager.SGetLocalPlayerFaction());
74 if (!playerFaction)
75 return false;
76
77 SCR_RankInfo rank = playerFaction.GetRanks().GetRankByID(m_eRequiredRank, true);
78 if (!rank)
79 {
80 imageWidget.LoadImageTexture(0, m_sRankLessFactionIconFallback);
81 return true;
82 }
83
84 imageWidget.LoadImageFromSet(0, rankIconImageSet, rank.GetRankInsignia());
85 return true;
86 }
87}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
void SCR_CharacterRankComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void SCR_FactionManager(IEntitySource src, IEntity parent)
proto external Managed FindComponent(typename typeName)
override string GetItemHintName(InventoryItemComponent item)
override bool CanBeShown(InventoryItemComponent item, SCR_InventorySlotUI focusedSlot)
override bool SetIconTo(ImageWidget imageWidget)
void SetRequiredRank(SCR_ECharacterRank rank)
SCR_RankContainer GetRanks()
static IEntity GetLocalControlledEntity()
SCR_RankInfo GetRankByID(SCR_ECharacterRank rankIdentifier)
string GetRankName(SCR_ECharacterRank rankID)
string GetRankName()
string GetRankInsignia()
static ResourceName GetRankIconImageSet()
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute