Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:44:53 +09:30
commit f1fbbe67bb
1722 changed files with 165268 additions and 0 deletions

View File

@@ -0,0 +1,142 @@
using Audio;
internal class XUiC_HireAnimalPopupRebirth : XUiController
{
public XUiV_Label hireInformationLabel;
public XUiV_Panel hireInformationPanel;
public override void Init()
{
base.Init();
hireInformationPanel = (XUiV_Panel)GetChildById("HireInformationPopup").ViewComponent;
((XUiC_SimpleButton)hireInformationPanel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancelHireInformation_OnPressed;
((XUiC_SimpleButton)hireInformationPanel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirmHireInformation_OnPressed;
hireInformationLabel = (XUiV_Label)hireInformationPanel.Controller.GetChildById("HireInformationLabel").ViewComponent;
}
public override void OnOpen()
{
//Log.Out("XUiC_HireAnimalPopupRebirth-OnOpen START");
EntityPlayer player = xui.playerUI.entityPlayer;
var entityID = 0;
if (player.Buffs.HasCustomVar("CurrentNPC"))
entityID = (int)player.Buffs.GetCustomVar("CurrentNPC");
if (entityID == 0)
return;
var myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
int numHirecost = EntityUtilities.GetHireCost(entityID);
//Log.Out("numHirecost: " + numHirecost);
if (myEntity != null)
hireInformationLabel.Text = string.Format(Localization.Get("ttTakeCare"), myEntity.EntityName, numHirecost) +
EntityUtilities.GetHireCurrency(entityID).ItemClass.GetLocalizedItemName() + "?";
base.OnOpen();
}
private void BtnConfirmHireInformation_OnPressed(XUiController _sender, int _mouseButton)
{
EntityPlayer player = xui.playerUI.entityPlayer;
var entityID = 0;
if (player.Buffs.HasCustomVar("CurrentNPC"))
entityID = (int)player.Buffs.GetCustomVar("CurrentNPC");
if (entityID == 0)
return;
var myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
if (myEntity != null)
{
var uiforPlayer = LocalPlayerUI.GetUIForPlayer((EntityPlayerLocal)player);
if (uiforPlayer)
{
int numHirecost = EntityUtilities.GetHireCost(entityID);
if (uiforPlayer.xui.PlayerInventory.GetItemCount(EntityUtilities.GetHireCurrency(myEntity.entityId)) >= numHirecost)
{
// Create the stack of currency
var stack = new ItemStack(EntityUtilities.GetHireCurrency(myEntity.entityId), numHirecost);
//DisplayLog(" Removing Item: " + stack);
uiforPlayer.xui.PlayerInventory.RemoveItems(new[] { stack });
// Add the stack of currency to the NPC, and set its orders.
EntityUtilities.SetLeaderAndOwner(myEntity.entityId, player.entityId);
myEntity.Buffs.AddBuff("buffOrderFollow");
RebirthManager.AddHire(player.entityId,
myEntity.entityId,
myEntity.EntityName,
myEntity.EntityClass.entityClassName,
myEntity.position,
myEntity.rotation,
new Vector3(0, 0, 0),
new Vector3(0, 0, 0),
0,
0,
0,
true
);
// If we're going to hire them, they need to wake up.
if (myEntity.IsSleeping)
myEntity.ConditionalTriggerSleeperWakeUp();
float flMode = player.Buffs.GetCustomVar("varNPCModMode");
float flHalt = player.Buffs.GetCustomVar("varNPCModStopAttacking");
if (flMode == 0)
{
myEntity.Buffs.AddBuff("buffNPCModFullControlMode");
myEntity.Buffs.RemoveBuff("buffNPCModThreatControlMode");
}
else
{
myEntity.Buffs.AddBuff("buffNPCModThreatControlMode");
myEntity.Buffs.RemoveBuff("buffNPCModFullControlMode");
}
if (flHalt == 1)
{
myEntity.Buffs.AddBuff("buffNPCModStopAttacking");
}
else
{
myEntity.Buffs.RemoveBuff("buffNPCModStopAttacking");
}
}
else
{
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip((EntityPlayerLocal)player, string.Format(Localization.Get("ttMinTakeCareCost"), numHirecost));
ItemValue item = ItemClass.GetItem("foodRawMeat", false);
ItemClass itemClass = item.ItemClass;
ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 0);
player.AddUIHarvestingItem(@is, true);
}
}
}
xui.playerUI.windowManager.Close(windowGroup.ID);
}
private void BtnCancelHireInformation_OnPressed(XUiController _sender, int _mouseButton)
{
hireInformationPanel.IsVisible = false;
xui.playerUI.windowManager.Close(windowGroup.ID);
}
public override void OnClose()
{
if (xui.playerUI.windowManager.HasWindow("dialog") && xui.playerUI.windowManager.IsWindowOpen("dialog"))
xui.playerUI.windowManager.Close("dialog");
base.OnClose();
}
}