Upload from upload_mods.ps1
This commit is contained in:
117
Scripts/XUIC/NPCs/XUiC_ShowStatsCompanionPopupRebirth.cs
Normal file
117
Scripts/XUIC/NPCs/XUiC_ShowStatsCompanionPopupRebirth.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
internal class XUiC_ShowStatsCompanionPopupRebirth : XUiController
|
||||
{
|
||||
public XUiV_Label NPCName;
|
||||
public XUiV_Label NPCPlayerHireLevel;
|
||||
public XUiV_Label NPCLevel;
|
||||
public XUiV_Label NPCMiningLevel;
|
||||
public XUiV_Label NPCFaction;
|
||||
public XUiV_Label NPCHireCost;
|
||||
public XUiV_Label NPCRespawnCost;
|
||||
public XUiV_Label NPCHealth;
|
||||
public XUiV_Label NPCInventoryCapacity;
|
||||
public XUiV_Label NPCArmor;
|
||||
public XUiV_Label NPCKills;
|
||||
public XUiV_Label NPCWeapon;
|
||||
public XUiV_Label NPCAmmo;
|
||||
public XUiV_Label NPCMagazineSize;
|
||||
public XUiV_Label NPCShotsPerRound;
|
||||
public XUiV_Panel Panel;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-Init START");
|
||||
|
||||
base.Init();
|
||||
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
|
||||
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancel_OnPressed;
|
||||
NPCName = (XUiV_Label)Panel.Controller.GetChildById("NPCName").ViewComponent;
|
||||
NPCLevel = (XUiV_Label)Panel.Controller.GetChildById("NPCLevel").ViewComponent;
|
||||
NPCRespawnCost = (XUiV_Label)Panel.Controller.GetChildById("NPCRespawnCost").ViewComponent;
|
||||
NPCHealth = (XUiV_Label)Panel.Controller.GetChildById("NPCHealth").ViewComponent;
|
||||
NPCInventoryCapacity = (XUiV_Label)Panel.Controller.GetChildById("NPCInventoryCapacity").ViewComponent;
|
||||
NPCArmor = (XUiV_Label)Panel.Controller.GetChildById("NPCArmor").ViewComponent;
|
||||
NPCKills = (XUiV_Label)Panel.Controller.GetChildById("NPCKills").ViewComponent;
|
||||
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-Init END");
|
||||
}
|
||||
|
||||
public override void OnOpen()
|
||||
{
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-OnOpen START");
|
||||
|
||||
EntityPlayer player = xui.playerUI.entityPlayer;
|
||||
|
||||
var entityID = 0;
|
||||
if (player.Buffs.HasCustomVar("CurrentNPC"))
|
||||
entityID = (int)player.Buffs.GetCustomVar("CurrentNPC");
|
||||
|
||||
if (entityID == 0)
|
||||
{
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-OnOpen 1");
|
||||
xui.playerUI.windowManager.Close(windowGroup.ID);
|
||||
return;
|
||||
}
|
||||
|
||||
var myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
|
||||
if (myEntity == null)
|
||||
{
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-OnOpen 2");
|
||||
xui.playerUI.windowManager.Close(windowGroup.ID);
|
||||
return;
|
||||
}
|
||||
|
||||
float flNPCLevel = myEntity.Buffs.GetCustomVar("$FR_NPC_Level");
|
||||
float flNPCKills = myEntity.Buffs.GetCustomVar("$varNumKills");
|
||||
|
||||
var entityClass = EntityClass.list[myEntity.entityClass];
|
||||
|
||||
NPCName.Text = myEntity.EntityName;
|
||||
|
||||
NPCLevel.Text = "" + flNPCLevel;
|
||||
|
||||
float perc = RebirthUtilities.getDiscount(player);
|
||||
|
||||
NPCRespawnCost.Text = Localization.Get("ttFree"); // "$" + (int)(numRespawnCost * perc);
|
||||
NPCHealth.Text = myEntity.GetMaxHealth() + " life";
|
||||
NPCInventoryCapacity.Text = myEntity.lootContainer.GetContainerSize().x * myEntity.lootContainer.GetContainerSize().y + " Slots";
|
||||
NPCArmor.Text = "" + (int)EffectManager.GetValue(PassiveEffects.PhysicalDamageResist, null, 0f, myEntity, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
|
||||
NPCKills.Text = "" + flNPCKills;
|
||||
|
||||
base.OnOpen();
|
||||
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-OnOpen END");
|
||||
}
|
||||
|
||||
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
|
||||
{
|
||||
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-BtnConfirm_OnPressed START");
|
||||
|
||||
EntityPlayer player = xui.playerUI.entityPlayer;
|
||||
xui.playerUI.windowManager.Close(windowGroup.ID);
|
||||
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-BtnConfirm_OnPressed END");
|
||||
}
|
||||
|
||||
private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
|
||||
{
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-BtnCancel_OnPressed START");
|
||||
|
||||
EntityPlayer player = xui.playerUI.entityPlayer;
|
||||
Panel.IsVisible = false;
|
||||
xui.playerUI.windowManager.Close(windowGroup.ID);
|
||||
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-BtnCancel_OnPressed END");
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-OnClose START");
|
||||
|
||||
if (xui.playerUI.windowManager.HasWindow("dialog") && xui.playerUI.windowManager.IsWindowOpen("dialog"))
|
||||
xui.playerUI.windowManager.Close("dialog");
|
||||
base.OnClose();
|
||||
|
||||
//Log.Out("XUiC_ShowStatsCompanionPopupRebirth-OnClose END");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user