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,209 @@
internal class XUiC_AddSilencerPopupRebirth : XUiController
{
public XUiV_Label SilencerLabel;
public XUiV_Panel SilencerPanel;
public override void Init()
{
//Log.Out("XUiC_SilencerPopupRebirth-Init START");
base.Init();
SilencerPanel = (XUiV_Panel)GetChildById("SilencerPopup").ViewComponent;
((XUiC_SimpleButton)SilencerPanel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancelSilencer_OnPressed;
((XUiC_SimpleButton)SilencerPanel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirmSilencer_OnPressed;
SilencerLabel = (XUiV_Label)SilencerPanel.Controller.GetChildById("SilencerLabel").ViewComponent;
//Log.Out("XUiC_SilencerPopupRebirth-Init END");
}
public override void OnOpen()
{
//Log.Out("XUiC_SilencerPopupRebirth-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;
if (myEntity != null)
SilencerLabel.Text = string.Format(Localization.Get("ttGiveSilencer"), myEntity.EntityName);
base.OnOpen();
//Log.Out("XUiC_SilencerPopupRebirth-OnOpen END");
}
private void BtnConfirmSilencer_OnPressed(XUiController _sender, int _mouseButton)
{
//Log.Out("XUiC_SilencerPopupRebirth-BtnConfirmSilencer_OnPressed 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_SilencerPopupRebirth-BtnConfirmSilencer_OnPressed 1");
return;
}
var myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
if (myEntity != null)
{
//Log.Out("XUiC_SilencerPopupRebirth-BtnConfirmSilencer_OnPressed 2");
ItemValue item = ItemClass.GetItem("modGunSoundSuppressorSilencer", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
//Log.Out("XUiC_SilencerPopupRebirth-BtnConfirmSilencer_OnPressed 3");
int itemCount = player.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = player.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
//Log.Out("XUiC_SilencerPopupRebirth-BtnConfirmSilencer_OnPressed 4");
if (itemCount2 > 0)
{
//Log.Out("XUiC_SilencerPopupRebirth-BtnConfirmSilencer_OnPressed 5");
player.inventory.DecItem(item, 1, false);
}
else
{
//Log.Out("XUiC_SilencerPopupRebirth-BtnConfirmSilencer_OnPressed 6");
player.bag.DecItem(item, 1, false);
}
ItemActionAttack itemActionRanged = myEntity.inventory.GetHoldingGun();
string weaponName = myEntity.inventory.holdingItem.GetItemName().ToLower().Trim();
if (weaponName == "gunnpcsmg5")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "smg_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "smg_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "silencefiller";
}
else if (weaponName == "gunnpcpipepistol")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "pistol_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "pistol_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcpipeshotgun")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "pump_shotgun_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "pump_shotgun_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcpiperifle")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "hunting_rifle_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "hunting_rifle_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcpipemg")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "m60_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "m60_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "silencefiller";
}
else if (weaponName == "gunnpcm60")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "m60_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "m60_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "silencefiller";
}
else if (weaponName == "gunnpcpistol")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "pistol_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "pistol_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcdpistol")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "pump_shotgun_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "pump_shotgun_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcak47")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "ak47_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "ak47_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "silencefiller";
}
else if (weaponName == "gunnpctrifle")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "ak47_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "ak47_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "silencefiller";
}
else if (weaponName == "gunnpchrifle")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "hunting_rifle_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "hunting_rifle_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcsrifle")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "sniperrifle_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "sniperrifle_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcpshotgun")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "pump_shotgun_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "pump_shotgun_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcashotgun")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "pump_shotgun_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "pump_shotgun_s_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
myEntity.inventory.ForceHoldingItemUpdate();
myEntity.Buffs.AddBuff("FuriousRamsayNPCSilencer");
}
}
}
xui.playerUI.windowManager.Close(windowGroup.ID);
//Log.Out("XUiC_SilencerPopupRebirth-BtnConfirmSilencer_OnPressed END");
}
private void BtnCancelSilencer_OnPressed(XUiController _sender, int _mouseButton)
{
//Log.Out("XUiC_SilencerPopupRebirth-BtnCancelSilencer_OnPressed START");
SilencerPanel.IsVisible = false;
xui.playerUI.windowManager.Close(windowGroup.ID);
//Log.Out("XUiC_SilencerPopupRebirth-BtnCancelSilencer_OnPressed END");
}
public override void OnClose()
{
//Log.Out("XUiC_SilencerPopupRebirth-OnClose START");
if (xui.playerUI.windowManager.HasWindow("dialog") && xui.playerUI.windowManager.IsWindowOpen("dialog"))
xui.playerUI.windowManager.Close("dialog");
base.OnClose();
//Log.Out("XUiC_SilencerPopupRebirth-OnClose END");
}
}

View File

@@ -0,0 +1,93 @@
internal class ChangeSurvivorNameRebirth : XUiController
{
public XUiV_Label Label;
public XUiV_Panel Panel;
public XUiC_TextInput txtInput;
public override void Init()
{
base.Init();
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancel_OnPressed;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirm_OnPressed;
Label = (XUiV_Label)Panel.Controller.GetChildById("Label").ViewComponent;
txtInput = (XUiC_TextInput)this.windowGroup.Controller.GetChildById("txtInput");
}
public override void OnOpen()
{
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)
{
Label.Text = string.Format(Localization.Get("ttChangeName"), myEntity.EntityName);
txtInput.Text = myEntity.EntityName;
}
base.OnOpen();
}
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
{
EntityPlayer player = xui.playerUI.entityPlayer;
if (txtInput.Text.Trim() == "")
{
return;
}
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)
{
//Log.Out("ChangeSurvivorNameRebirth-BtnConfirm_OnPressed BEFORE: " + txtInput.Text.Trim());
string newName = txtInput.Text.Trim() + "REBIRTHREBIRTH";
myEntity.NewName = newName.Trim();
myEntity._strMyName = newName.Trim();
myEntity.SetEntityName(newName.Trim());
if (myEntity.NavObject != null)
{
myEntity.NavObject.name = txtInput.Text.Trim();
}
else
{
myEntity.NavObject = NavObjectManager.Instance.RegisterNavObject(EntityClass.list[myEntity.entityClass].NavObject, myEntity, "", false);
myEntity.NavObject.name = txtInput.Text.Trim();
}
//Log.Out("ChangeSurvivorNameRebirth-BtnConfirm_OnPressed AFTER: " + myEntity.EntityName + " / " + myEntity.NavObject.DisplayName + " / " + myEntity._strMyName);
}
xui.playerUI.windowManager.Close(windowGroup.ID);
}
private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
{
Panel.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();
}
}

View File

@@ -0,0 +1,92 @@
internal class XUiC_DismissEntityRebirth : XUiController
{
public XUiV_Label Label;
public XUiV_Panel Panel;
public int EntityID = -1;
public string EntityName = "";
public override void Init()
{
base.Init();
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancel_OnPressed;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnUnload")).OnPressed += BtnUnload_OnPressed;
Label = (XUiV_Label)Panel.Controller.GetChildById("Label").ViewComponent;
}
public override void OnOpen()
{
EntityPlayer player = xui.playerUI.entityPlayer;
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)
{
Label.Text = string.Format(Localization.Get("ttDismissEntity"), myEntity.EntityName);
}
else
{
Label.Text = string.Format(Localization.Get("ttDismissNPC"), RebirthVariables.NPCName);
}
base.OnOpen();
}
private void BtnUnload_OnPressed(XUiController _sender, int _mouseButton)
{
EntityPlayer player = xui.playerUI.entityPlayer;
var myEntity = player.world.GetEntity(EntityID) as EntityNPCRebirth;
if (myEntity != null)
{
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageDespawnEntityRebirth>().Setup(myEntity.entityId), false);
}
else
{
//Log.Out("XUiC_DismissEntityRebirth-BtnUnload_OnPressed REMOVE HIRE/OWNED ENTITY, hire: " + myEntity.entityId);
if (myEntity.Buffs.GetCustomVar("$Leader") > 0)
{
myEntity.lootDropProb = 0;
GameManager.Instance.DropContentOfLootContainerServer(BlockValue.Air, new Vector3i(myEntity.position), myEntity.entityId);
//RebirthUtilities.DropBackpack(myEntity);
}
RebirthManager.RemoveHire(myEntity.entityId, true);
player.Companions.Remove(myEntity);
myEntity.bWillRespawn = false;
GameManager.Instance.World.RemoveEntity(myEntity.entityId, EnumRemoveEntityReason.Unloaded);
}
GameManager.ShowTooltip(GameManager.Instance.World.GetPrimaryPlayer().PlayerUI.xui.playerUI.entityPlayer, myEntity.EntityName + " " + Localization.Get("ttHireDimissed"));
}
else
{
RebirthManager.RemoveHire(EntityID, true);
}
//Log.Out("XUiC_DismissEntityRebirth-BtnUnload_OnPressed 6");
xui.playerUI.windowManager.Close(windowGroup.ID);
}
private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
{
Panel.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();
}
}

View File

@@ -0,0 +1,120 @@
using static RebirthManager;
internal class XUiC_GoHomeRebirth : XUiController
{
public XUiV_Label Label;
public XUiV_Panel Panel;
public override void Init()
{
base.Init();
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancel_OnPressed;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirm_OnPressed;
Label = (XUiV_Label)Panel.Controller.GetChildById("Label").ViewComponent;
}
public override void OnOpen()
{
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)
{
Label.Text = string.Format(Localization.Get("ttGotToRespawn"), myEntity.EntityName);
}
base.OnOpen();
}
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
{
//Log.Out("XUiC_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 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_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 1");
return;
}
var myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
if (myEntity == null)
{
//Log.Out("XUiC_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 2");
return;
}
foreach (hireInfo hire in RebirthManager.playerHires)
{
if (hire.hireID == myEntity.entityId)
{
if (hire.reSpawnPosition != new Vector3(0, 0, 0))
{
//Log.Out("XUiC_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 2");
myEntity.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Follow);
myEntity.Buffs.AddBuff("buffOrderStay");
myEntity.SetRevengeTarget((EntityAlive) null);
myEntity.motion = Vector3.zero;
myEntity.navigator?.clearPath();
myEntity.moveHelper?.Stop();
myEntity.speedForward = 0;
myEntity.speedStrafe = 0;
//myEntity.navigator?.clearPath();
myEntity.LeaderUtils.IsTeleporting = true;
myEntity.SetPosition(hire.reSpawnPosition, true);
myEntity.rotation.y = hire.reSpawnRotation.y;
myEntity.ClearDamagedTarget();
myEntity.ClearStun();
bool foundHire = false;
foreach (chunkObservers observer in observers)
{
if (observer.entityID == myEntity.entityId)
{
foundHire = true;
break;
}
}
if (!foundHire)
{
//Log.Out("MinEventActionRespawnEntity-Execute ADDED CHUNK OBSERVER for: " + myEntity.entityId);
ChunkManager.ChunkObserver observerRef = GameManager.Instance.AddChunkObserver(hire.reSpawnPosition, false, 3, -1);
observers.Add(new chunkObservers(myEntity.entityId, observerRef));
}
myEntity.LeaderUtils.IsTeleporting = false;
break;
}
}
}
xui.playerUI.windowManager.Close(windowGroup.ID);
}
private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
{
Panel.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();
}
}

View File

@@ -0,0 +1,204 @@
internal class XUiC_GoMineRebirth : XUiController
{
public XUiV_Label Label;
public XUiV_Label Resource;
public XUiV_Label ResourceMultiplier;
public XUiV_Label GatherType;
public XUiV_Panel Panel;
public float flSubLevels = 0.1f;
public bool bDifferentBiome = false;
public string strDuration = "10";
public override void Init()
{
base.Init();
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancel_OnPressed;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirm_OnPressed;
Label = (XUiV_Label)Panel.Controller.GetChildById("Label").ViewComponent;
Resource = (XUiV_Label)Panel.Controller.GetChildById("Resource").ViewComponent;
ResourceMultiplier = (XUiV_Label)Panel.Controller.GetChildById("ResourceMultiplier").ViewComponent;
GatherType = (XUiV_Label)Panel.Controller.GetChildById("GatherType").ViewComponent;
}
public override void OnOpen()
{
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;
string strProperty = RebirthUtilities.GetEntityPropertyValue(entityID, "MiningCost");
float numCost = 0f;
float numMultiplier = 1f;
if (strProperty != "")
{
numCost = int.Parse(strProperty);
}
strProperty = ResourceMultiplier.Text;
if (strProperty != "")
{
numMultiplier = float.Parse(strProperty);
}
numCost = numCost * numMultiplier;
numCost = (int)(numCost * RebirthUtilities.getDiscount(player));
BiomeDefinition biomeStandingOn = player.biomeStandingOn;
string text = "BIOME";
text = RebirthUtilities.GetBiomeName(player);
if (text != "desert" && (Resource.Text == "Sand" || Resource.Text == "Shale"))
{
bDifferentBiome = true;
strDuration = "20";
}
if (myEntity != null)
{
Label.Text = "";
if (text != "desert" && (Resource.Text == "Sand" || Resource.Text == "Shale"))
{
Label.Text = string.Format(Localization.Get("ttMiningPremium"), myEntity.EntityName, Localization.Get("biome_desert"));
numCost = numCost * 1.25f;
}
if (GatherType.Text.ToLower() == "mining")
{
Label.Text = Label.Text + Localization.Get("ttMiningBetter");
Label.Text = string.Format(Localization.Get("ttSendToMine"), myEntity.EntityName, Resource.Text, (int)numCost) +
string.Format(Localization.Get("ttMiningCostDuration"), EntityUtilities.GetHireCurrency(entityID).ItemClass.GetLocalizedItemName(), strDuration) +
Label.Text;
}
else
{
Label.Text = string.Format(Localization.Get("ttSendToGather"), myEntity.EntityName, Resource.Text, (int)numCost) +
string.Format(Localization.Get("ttMiningCostDuration"), EntityUtilities.GetHireCurrency(entityID).ItemClass.GetLocalizedItemName(), strDuration) +
Label.Text;
}
}
base.OnOpen();
}
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
{
//Log.Out("XUiC_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 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_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 1");
return;
}
var myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
if (myEntity == null)
{
//Log.Out("XUiC_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 2");
return;
}
string strProperty = RebirthUtilities.GetEntityPropertyValue(entityID, "MiningCost");
float numCost = 0f;
float numMultiplier = 1f;
if (strProperty != "")
{
numCost = int.Parse(strProperty);
}
strProperty = ResourceMultiplier.Text;
if (strProperty != "")
{
numMultiplier = float.Parse(strProperty);
}
numCost = numCost * numMultiplier;
BiomeDefinition biomeStandingOn = player.biomeStandingOn;
string text = "BIOME";
if (biomeStandingOn != null)
{
text = biomeStandingOn.m_sBiomeName;
}
if (text != "desert" && (Resource.Text == "Sand" || Resource.Text == "Shale"))
{
numCost = numCost * 1.25f;
}
numCost = (int)(numCost * RebirthUtilities.getDiscount(player));
var uiforPlayer = LocalPlayerUI.GetUIForPlayer((EntityPlayerLocal)player);
if (uiforPlayer)
{
if (uiforPlayer.xui.PlayerInventory.GetItemCount(EntityUtilities.GetHireCurrency(myEntity.entityId)) >= (int)numCost)
{
// Create the stack of currency
var stack = new ItemStack(EntityUtilities.GetHireCurrency(myEntity.entityId), (int)numCost);
//DisplayLog(" Removing Item: " + stack);
uiforPlayer.xui.PlayerInventory.RemoveItems(new[] { stack });
if (bDifferentBiome)
{
myEntity.Buffs.AddBuff("FuriousRamsayGoMining" + Resource.Text.Replace(" ", "") + "Premium");
}
else
{
myEntity.Buffs.AddBuff("FuriousRamsayGoMining" + Resource.Text.Replace(" ", ""));
}
int numMiningLevelBefore = (int)myEntity.Buffs.GetCustomVar("$FR_NPC_GoneMiningLevel");
myEntity.Buffs.SetCustomVar("$FR_NPC_GoneMiningLevel", myEntity.Buffs.GetCustomVar("$FR_NPC_GoneMiningLevel") + flSubLevels);
int numMiningLevelAfter = (int)myEntity.Buffs.GetCustomVar("$FR_NPC_GoneMiningLevel");
float flNPCMiningLevel = myEntity.Buffs.GetCustomVar("$FR_NPC_MiningLevel");
if ((numMiningLevelAfter > numMiningLevelBefore) && flNPCMiningLevel < 10)
{
myEntity.Buffs.SetCustomVar("$FR_NPC_MiningLevel", flNPCMiningLevel + 1f);
}
}
else
{
Audio.Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip((EntityPlayerLocal)player, string.Format(Localization.Get("ttCannotAffordMining"), (int)numCost));
ItemValue item = ItemClass.GetItem("casinoCoin", 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 BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
{
Panel.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();
}
}

View File

@@ -0,0 +1,78 @@
internal class XUiC_GoRepairRebirth : XUiController
{
public XUiV_Label Label;
public XUiV_Panel Panel;
public float flSubLevels = 0.1f;
public bool bDifferentBiome = false;
public string strDuration = "25";
public override void Init()
{
base.Init();
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancel_OnPressed;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirm_OnPressed;
Label = (XUiV_Label)Panel.Controller.GetChildById("Label").ViewComponent;
}
public override void OnOpen()
{
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)
{
Label.Text = string.Format(Localization.Get("ttRepairBlocks"), myEntity.EntityName);
}
base.OnOpen();
}
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
{
//Log.Out("XUiC_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 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_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 1");
return;
}
var myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
if (myEntity == null)
{
//Log.Out("XUiC_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 2");
return;
}
myEntity.Buffs.AddBuff("FuriousRamsayHelpRepair");
xui.playerUI.windowManager.Close(windowGroup.ID);
}
private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
{
Panel.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();
}
}

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();
}
}

View File

@@ -0,0 +1,209 @@
using Audio;
internal class XUiC_HireNPCPopupRebirth : XUiController
{
public XUiV_Label hireInformationLabel;
public XUiV_Panel hireInformationPanel;
public EntityNPCRebirth myEntity;
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_HireNPCPopupRebirth-OnOpen START");
EntityPlayer player = xui.playerUI.entityPlayer;
int entityID = RebirthVariables.talkingToNPC; // (int)player.Buffs.GetCustomVar("CurrentNPC");
if (entityID == 0)
return;
//Log.Out("XUiC_HireNPCPopupRebirth-OnOpen entityID: " + entityID);
myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
if (myEntity == null)
{
//Log.Out("XUiC_HireNPCPopupRebirth-OnOpen ENTITY == null");
return;
}
myEntity.Buffs.AddBuff("buffTalkingTo");
int numHirecost = EntityUtilities.GetHireCost(entityID);
int flNPCLevel = (int)myEntity.Buffs.GetCustomVar("$FR_NPC_Level");
numHirecost = numHirecost + (500 * flNPCLevel);
numHirecost = (int)(numHirecost * RebirthUtilities.getDiscount(player));
//Log.Out("numHirecost: " + numHirecost);
//Log.Out("flNPCLevel: " + flNPCLevel);
if (myEntity != null)
{
int minClass = 1;
if (myEntity.EntityClass.Properties.Values.ContainsKey("PlayerLevelRestriction"))
{
minClass = int.Parse(myEntity.EntityClass.Properties.Values["PlayerLevelRestriction"]);
//Log.Out("XUiC_HireNPCPopupRebirth-OnOpen minClass: " + minClass);
}
string restrictiveHire = RebirthVariables.customRestrictHires;
//Log.Out("XUiC_HireNPCPopupRebirth-OnOpen restrictiveHire: " + restrictiveHire);
bool canHire = true;
if (restrictiveHire == "default" || restrictiveHire == "playerLevel")
{
//Log.Out("XUiC_HireNPCPopupRebirth-OnOpen 1");
if (player.Progression.Level < minClass)
{
//Log.Out("XUiC_HireNPCPopupRebirth-OnOpen 2");
canHire = false;
}
}
//Log.Out("XUiC_HireNPCPopupRebirth-OnOpen canHire: " + canHire);
if (canHire)
{
hireInformationLabel.Text = string.Format(Localization.Get("ttHireCost"), myEntity.EntityName, numHirecost) +
EntityUtilities.GetHireCurrency(entityID).ItemClass.GetLocalizedItemName() + "?";
((XUiC_SimpleButton)hireInformationPanel.Controller.GetChildById("btnConfirm")).ViewComponent.Position = new Vector2i(400, 0);
}
else
{
hireInformationLabel.Text = string.Format(Localization.Get("ttMinHireLevel"), minClass, myEntity.EntityName);
((XUiC_SimpleButton)hireInformationPanel.Controller.GetChildById("btnConfirm")).ViewComponent.Position = new Vector2i(-10000, -10000);
}
}
base.OnOpen();
}
private void BtnConfirmHireInformation_OnPressed(XUiController _sender, int _mouseButton)
{
EntityPlayer player = xui.playerUI.entityPlayer;
if (myEntity != null)
{
var uiforPlayer = LocalPlayerUI.GetUIForPlayer((EntityPlayerLocal)player);
if (uiforPlayer)
{
int numHirecost = EntityUtilities.GetHireCost(myEntity.entityId);
int flNPCLevel = (int)myEntity.Buffs.GetCustomVar("$FR_NPC_Level");
numHirecost = numHirecost + (500 * flNPCLevel);
numHirecost = (int)(numHirecost * RebirthUtilities.getDiscount(player));
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 });
EntityUtilities.SetLeaderAndOwner(myEntity.entityId, player.entityId);
myEntity.Buffs.AddBuff("buffOrderFollow");
myEntity.Buffs.AddBuff("FuriousRamsayMaxHealth");
myEntity.belongsPlayerId = player.entityId;
myEntity.LeaderUtils.Owner = player;
RebirthUtilities.SetLeaderAndOwner(myEntity.entityId, player.entityId);
myEntity.Buffs.AddBuff("buffNPCModFullControlMode");
myEntity.AddNavObject("FuriousRamsayHiredNav", "", "");
//Log.Out("XUiC_HireNPCPopupRebirth-BtnConfirmHireInformation_OnPressed SET TO STAY");
myEntity.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Follow);
float flMode = player.Buffs.GetCustomVar("varNPCModMode");
float flHalt = player.Buffs.GetCustomVar("varNPCModStopAttacking");
if (flMode == 0)
{
myEntity.Buffs.AddBuff("buffNPCModFullControlMode");
}
else
{
myEntity.Buffs.RemoveBuff("buffNPCModFullControlMode");
}
if (flHalt == 1)
{
myEntity.Buffs.AddBuff("buffNPCModStopAttacking");
}
else
{
myEntity.Buffs.RemoveBuff("buffNPCModStopAttacking");
}
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageAddCompanion>().Setup(myEntity.entityId, myEntity.belongsPlayerId), false, myEntity.belongsPlayerId, -1, -1, null, 192);
}
else
{
myEntity.LeaderUtils.AddCompanion();
}
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();
}
else
{
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip((EntityPlayerLocal)player, string.Format(Localization.Get("ttMinHireCost"), numHirecost));
ItemValue item = ItemClass.GetItem("casinoCoin", false);
ItemClass itemClass = item.ItemClass;
ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 0);
player.AddUIHarvestingItem(@is, true);
}
}
myEntity.Buffs.RemoveBuff("buffTalkingTo");
}
xui.playerUI.windowManager.Close(windowGroup.ID);
}
private void BtnCancelHireInformation_OnPressed(XUiController _sender, int _mouseButton)
{
myEntity.Buffs.RemoveBuff("buffTalkingTo");
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();
}
}

View File

@@ -0,0 +1,166 @@
using Audio;
internal class XUiC_PickUpNPCPopupRebirth : XUiController
{
public XUiV_Label Label;
public XUiV_Panel Panel;
public override void Init()
{
base.Init();
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancel_OnPressed;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirm_OnPressed;
Label = (XUiV_Label)Panel.Controller.GetChildById("Label").ViewComponent;
}
public override void OnOpen()
{
//Log.Out("XUiC_PickUpNPCPopupRebirth-OnOpen START");
EntityPlayer player = xui.playerUI.entityPlayer;
var entityID = 0;
if (player.Buffs.HasCustomVar("CurrentNPC"))
{
//Log.Out("XUiC_PickUpNPCPopupRebirth-OnOpen 1");
entityID = (int)player.Buffs.GetCustomVar("CurrentNPC");
}
if (entityID == 0)
{
//Log.Out("XUiC_PickUpNPCPopupRebirth-OnOpen 2");
return;
}
//Log.Out("XUiC_PickUpNPCPopupRebirth-OnOpen entityID: " + entityID);
EntityNPCRebirth myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
if (myEntity != null)
{
//Log.Out("XUiC_PickUpNPCPopupRebirth-OnOpen 3");
Label.Text = string.Format(Localization.Get("ttPickUpCost"), myEntity.EntityName);
}
else
{
//Log.Out("XUiC_PickUpNPCPopupRebirth-OnOpen Entity == null");
}
base.OnOpen();
}
private void BtnConfirm_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;
}
EntityNPCRebirth myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
if (myEntity != null)
{
ItemValue item = ItemClass.GetItem("casinoCoin", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
int itemCount = player.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = player.inventory.GetItemCount(item, false, -1, -1);
//Log.Out("XUiC_PickUpNPCPopupRebirth-BtnConfirm_OnPressed itemCount + itemCount2: " + (itemCount + itemCount2));
if (itemCount + itemCount2 >= 250)
{
int Remaining = 250;
bool needMore = false;
int Withdraw = Remaining - itemCount2;
if (Withdraw <= 0)
{
player.inventory.DecItem(item, 250, false);
}
else
{
player.inventory.DecItem(item, itemCount2, false);
needMore = true;
Remaining = Remaining - itemCount2;
player.bag.DecItem(item, Remaining, false);
}
var playerInventory = uiforPlayer.xui.PlayerInventory;
if (playerInventory == null) return;
string ID = myEntity.EntityClass.Properties.Values["SpawnBlockName"];
var itemAdd = ItemClass.GetItem(ID);
if (itemAdd == null)
{
return;
}
var itemStack = new ItemStack(itemAdd, 1);
if (!playerInventory.AddItem(itemStack, true))
player.world.gameManager.ItemDropServer(itemStack, player.GetPosition(), Vector3.zero);
if (myEntity.Buffs.HasBuff("FuriousRamsayNPCSilencer"))
{
ID = "modGunSoundSuppressorSilencer";
itemAdd = ItemClass.GetItem(ID);
itemStack = new ItemStack(itemAdd, 1);
if (!playerInventory.AddItem(itemStack, true))
player.world.gameManager.ItemDropServer(itemStack, player.GetPosition(), Vector3.zero);
}
ItemStack[] array = myEntity.lootContainer.GetItems();
for (int i = 0; i < array.Length; i++)
{
if (!array[i].IsEmpty())
{
if (!playerInventory.AddItem(array[i], true))
{
player.world.gameManager.ItemDropServer(array[i], player.GetPosition(), Vector3.zero);
}
}
}
myEntity.bIsChunkObserver = false;
//Log.Out("XUiC_PickUpNPCPopupRebirth-BtnConfirm_OnPressed REMOVED HIRE, hire: " + myEntity.entityId);
RebirthManager.RemoveHire(myEntity.entityId);
GameManager.Instance.World.RemoveEntity(myEntity.entityId, EnumRemoveEntityReason.Despawned);
}
else
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(uiforPlayer.entityPlayer, Localization.Get("ttMissingCash"));
ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 0);
uiforPlayer.entityPlayer.AddUIHarvestingItem(@is, true);
}
}
}
xui.playerUI.windowManager.Close(windowGroup.ID);
}
private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
{
Panel.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();
}
}

View File

@@ -0,0 +1,193 @@
internal class XUiC_RemoveSilencerPopupRebirth : XUiController
{
public XUiV_Label SilencerLabel;
public XUiV_Panel SilencerPanel;
public override void Init()
{
//Log.Out("XUiC_SilencerPopupRebirth-Init START");
base.Init();
SilencerPanel = (XUiV_Panel)GetChildById("SilencerPopup").ViewComponent;
((XUiC_SimpleButton)SilencerPanel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancelSilencer_OnPressed;
((XUiC_SimpleButton)SilencerPanel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirmSilencer_OnPressed;
SilencerLabel = (XUiV_Label)SilencerPanel.Controller.GetChildById("SilencerLabel").ViewComponent;
//Log.Out("XUiC_SilencerPopupRebirth-Init END");
}
public override void OnOpen()
{
//Log.Out("XUiC_SilencerPopupRebirth-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;
if (myEntity != null)
SilencerLabel.Text = string.Format(Localization.Get("ttRetrieveSilencer"), myEntity.EntityName);
base.OnOpen();
//Log.Out("XUiC_SilencerPopupRebirth-OnOpen END");
}
private void BtnConfirmSilencer_OnPressed(XUiController _sender, int _mouseButton)
{
//Log.Out("XUiC_SilencerPopupRebirth-BtnConfirmSilencer_OnPressed 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;
if (myEntity != null)
{
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
var playerInventory = uiforPlayer.xui.PlayerInventory;
if (playerInventory == null) return;
string ID = "modGunSoundSuppressorSilencer";
var item = ItemClass.GetItem(ID);
if (item == null)
{
//Log.Out("XUiC_RemoveSilencerPopupRebirth: Item Not Found: " + ID);
return;
}
var itemStack = new ItemStack(item, 1);
if (!playerInventory.AddItem(itemStack, true))
player.world.gameManager.ItemDropServer(itemStack, player.GetPosition(), Vector3.zero);
ItemActionAttack itemActionRanged = myEntity.inventory.GetHoldingGun();
string weaponName = myEntity.inventory.holdingItem.GetItemName().ToLower().Trim();
if (weaponName == "gunnpcsmg5")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "smg_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "smg_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "smg_fire_end";
}
else if (weaponName == "gunnpcpipepistol")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "pipe_pistol_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "pipe_pistol_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcpipeshotgun")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "pipe_shotgun_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "pipe_shotgun_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcpiperifle")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "pipe_rifle_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "pipe_rifle_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcpipemg")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "pipe_smg_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "pipe_smg_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcm60")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "m60_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "m60_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "m60_fire_end";
}
else if (weaponName == "gunnpcpistol")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "Pistol_Fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "Pistol_Fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcdpistol")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "desertvulture_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "desertvulture_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcak47")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "ak47_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "ak47_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "ak47_fire_end";
}
else if (weaponName == "gunnpctrifle")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "tacticalar_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "tacticalar_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpchrifle")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "sniperrifle_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "sniperrifle_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcsrifle")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "sharpshooter_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "sharpshooter_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcpshotgun")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "pump_shotgun_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "pump_shotgun_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
else if (weaponName == "gunnpcashotgun")
{
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_start"] = "autoshotgun_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_loop"] = "autoshotgun_fire";
myEntity.inventory.holdingItem.Actions[1].Properties.Values["Sound_end"] = "";
}
myEntity.inventory.ForceHoldingItemUpdate();
myEntity.Buffs.RemoveBuff("FuriousRamsayNPCSilencer");
}
xui.playerUI.windowManager.Close(windowGroup.ID);
//Log.Out("XUiC_SilencerPopupRebirth-BtnConfirmSilencer_OnPressed END");
}
private void BtnCancelSilencer_OnPressed(XUiController _sender, int _mouseButton)
{
//Log.Out("XUiC_SilencerPopupRebirth-BtnCancelSilencer_OnPressed START");
SilencerPanel.IsVisible = false;
xui.playerUI.windowManager.Close(windowGroup.ID);
//Log.Out("XUiC_SilencerPopupRebirth-BtnCancelSilencer_OnPressed END");
}
public override void OnClose()
{
//Log.Out("XUiC_SilencerPopupRebirth-OnClose START");
if (xui.playerUI.windowManager.HasWindow("dialog") && xui.playerUI.windowManager.IsWindowOpen("dialog"))
xui.playerUI.windowManager.Close("dialog");
base.OnClose();
//Log.Out("XUiC_SilencerPopupRebirth-OnClose END");
}
}

View File

@@ -0,0 +1,86 @@
internal class XUiC_RepairReportRebirth : XUiController
{
public XUiV_Label Label;
public XUiV_Panel Panel;
public float flSubLevels = 0.1f;
public bool bDifferentBiome = false;
public override void Init()
{
base.Init();
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirm_OnPressed;
Label = (XUiV_Label)Panel.Controller.GetChildById("Label").ViewComponent;
}
public override void OnOpen()
{
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)
{
string strSerialize = myEntity.strSerialize;
Label.Text = Localization.Get("ttRepairReport");
if (strSerialize != null)
{
if (strSerialize.Length > 0)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive strSerialize.Length: " + strSerialize.Length);
//Log.Out("EntityNPCRebirth-OnUpdateLive strSerializeTmp LOAD: " + strSerialize);
string[] array = strSerialize.Split(new char[]
{
'<'
});
if (array.Length > 0)
{
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split(new char[]
{
'|'
});
for (int i2 = 0; i2 < array2.Length; i2++)
{
if (i2 == 0)
{
Label.Text = Label.Text + " • " + Localization.Get(array2[i2]);
}
else
{
Label.Text = Label.Text + " ([88d188]" + array2[i2] + "[-])";
}
}
Label.Text = Label.Text + "\n";
}
}
}
}
}
base.OnOpen();
}
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
{
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();
}
}

View File

@@ -0,0 +1,122 @@
using System.Net.NetworkInformation;
internal class XUiC_RespawnEntityRebirth : XUiController
{
public XUiV_Label Label;
public XUiV_Panel Panel;
public override void Init()
{
base.Init();
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancel_OnPressed;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirm_OnPressed;
Label = (XUiV_Label)Panel.Controller.GetChildById("Label").ViewComponent;
}
public override void OnOpen()
{
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)
{
int numHirecost = RebirthUtilities.GetHireCost(entityID);
int flNPCLevel = (int)myEntity.Buffs.GetCustomVar("$FR_NPC_Level");
numHirecost = numHirecost + (500 * flNPCLevel);
int numRespawnCost = numHirecost + (250 * (int)flNPCLevel);
numRespawnCost = (int)(numRespawnCost * RebirthUtilities.getDiscount(player));
Label.Text = string.Format(Localization.Get("ttReportForDuty"), myEntity.EntityName);
}
base.OnOpen();
}
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
{
//Log.Out("XUiC_RespawnEntityRebirth-BtnConfirm_OnPressed START");
EntityPlayer player = xui.playerUI.entityPlayer;
bool canRespawn = false;
var entityID = 0;
if (player.Buffs.HasCustomVar("CurrentNPC"))
entityID = (int)player.Buffs.GetCustomVar("CurrentNPC");
if (entityID == 0)
{
//Log.Out("XUiC_RespawnEntityRebirth-BtnConfirm_OnPressed 1");
return;
}
var myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
if (myEntity == null)
{
//Log.Out("XUiC_RespawnEntityRebirth-BtnConfirm_OnPressed 2");
return;
}
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
var playerInventory = uiforPlayer.xui.PlayerInventory;
if (playerInventory == null)
{
//Log.Out("XUiC_RespawnEntityRebirth-BtnConfirm_OnPressed 4");
return;
}
canRespawn = true;
if (canRespawn)
{
EntityNPCRebirth entity = (EntityNPCRebirth)GameManager.Instance.World.GetEntity(entityID);
entity.Buffs.SetCustomVar("$FR_NPC_Respawn", 0f);
entity.factionId = FactionManager.Instance.GetFactionByName("whiteriver").ID;
entity.isHirable = true;
entity.Buffs.RemoveBuff("FuriousRamsayDeathParticle");
entity.Buffs.RemoveBuff("FuriousRamsayRespawned");
//Log.Out("XUiC_RespawnEntityRebirth-BtnConfirm_OnPressed SET TO FOLLOW");
entity.attackTarget = (EntityAlive) null;
entity.SetRevengeTarget((EntityAlive) null);
entity.guardPosition = Vector3.zero;
entity.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Follow);
entity.Buffs.RemoveBuff("FuriousRamsayBuffPauseAttack");
RebirthManager.UpdateHireInfo(entity.entityId, "order", "guard", Vector3.zero.ToString(), Vector3.zero.ToString());
RebirthManager.UpdateHireInfo(entity.entityId, "order", "follow");
bool blEntityClass = entity.EntityClass.entityClassName.Contains("Survivor");
if (entity.NavObject != null)
{
entity.NavObject.IsActive = true;
}
GameManager.ShowTooltip(GameManager.Instance.World.GetPrimaryPlayer().PlayerUI.xui.playerUI.entityPlayer, entity.EntityName + " " + Localization.Get("ttReportingForDuty"));
}
xui.playerUI.windowManager.Close(windowGroup.ID);
}
private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
{
Panel.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();
}
}

View 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");
}
}

View File

@@ -0,0 +1,290 @@
internal class XUiC_ShowStatsPopupRebirth : 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_ShowStatsPopupRebirth-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;
NPCPlayerHireLevel = NPCLevel = (XUiV_Label)Panel.Controller.GetChildById("NPCPlayerHireLevel").ViewComponent;
NPCLevel = (XUiV_Label)Panel.Controller.GetChildById("NPCLevel").ViewComponent;
NPCMiningLevel = (XUiV_Label)Panel.Controller.GetChildById("NPCMiningLevel").ViewComponent;
NPCFaction = (XUiV_Label)Panel.Controller.GetChildById("NPCFaction").ViewComponent;
NPCHireCost = (XUiV_Label)Panel.Controller.GetChildById("NPCHireCost").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;
NPCWeapon = (XUiV_Label)Panel.Controller.GetChildById("NPCWeapon").ViewComponent;
NPCAmmo = (XUiV_Label)Panel.Controller.GetChildById("NPCAmmo").ViewComponent;
NPCMagazineSize = (XUiV_Label)Panel.Controller.GetChildById("NPCMagazineSize").ViewComponent;
NPCShotsPerRound = (XUiV_Label)Panel.Controller.GetChildById("NPCShotsPerRound").ViewComponent;
//Log.Out("XUiC_ShowStatsPopupRebirth-Init END");
}
public override void OnOpen()
{
//Log.Out("XUiC_ShowStatsPopupRebirth-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_ShowStatsPopupRebirth-OnOpen 1");
xui.playerUI.windowManager.Close(windowGroup.ID);
return;
}
var myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
if (myEntity == null)
{
//Log.Out("XUiC_ShowStatsPopupRebirth-OnOpen 2");
xui.playerUI.windowManager.Close(windowGroup.ID);
return;
}
int minClass = 1;
if (myEntity.EntityClass.Properties.Values.ContainsKey("PlayerLevelRestriction"))
{
minClass = int.Parse(myEntity.EntityClass.Properties.Values["PlayerLevelRestriction"]);
}
float flNPCLevel = myEntity.Buffs.GetCustomVar("$FR_NPC_Level");
float flNPCMiningLevel = myEntity.Buffs.GetCustomVar("$FR_NPC_MiningLevel");
//Log.Out("XUiC_ShowStatsPopupRebirth-OnOpen flNPCMiningLevel: " + flNPCMiningLevel);
float flNPCKills = myEntity.Buffs.GetCustomVar("$varNumKills");
float flNPCMagazineSize = myEntity.Buffs.GetCustomVar("$Magsize");
float flNPCBurst = myEntity.Buffs.GetCustomVar("$Burstsize");
string _strRangedWeaponItem = myEntity.inventory.holdingItem.GetItemName();
string _strAmmo = "";
string _strWeaponName = "";
string _strAmmoName = "";
if (myEntity.EntityClass.Properties.Values.ContainsKey("BagItems"))
{
_strWeaponName = Localization.Get(myEntity.EntityClass.Properties.Values["BagItems"]);
}
if (_strRangedWeaponItem == "gunNPCPipePistol")
{
_strAmmo = "ammo9mmBulletBall";
_strAmmoName = "9mm Bullets";
}
if (_strRangedWeaponItem == "gunNPCPipeMG")
{
_strAmmo = "ammo762mmBulletBall";
_strAmmoName = "7.62 Ammo";
}
if (_strRangedWeaponItem == "gunNPCPipeRifle")
{
_strAmmo = "ammo762mmBulletBall";
_strAmmoName = "7.62 Ammo";
}
if (_strRangedWeaponItem == "gunNPCHRifle")
{
_strAmmo = "ammo762mmBulletBall";
_strAmmoName = "7.62 Ammo";
}
if (_strRangedWeaponItem == "gunNPCPipeShotgun")
{
_strAmmo = "ammoShotgunShell";
_strAmmoName = "Shotgun Shells";
}
if (_strRangedWeaponItem == "gunNPCAShotgun")
{
_strAmmo = "ammoShotgunShell";
_strAmmoName = "Shotgun Shells";
}
if (_strRangedWeaponItem == "gunNPCLBow")
{
_strAmmo = "ammoArrowIron";
_strAmmoName = "Iron Arrows";
}
if (_strRangedWeaponItem == "gunNPCXBow")
{
_strAmmo = "ammoCrossbowBoltIron";
_strAmmoName = "Iron Bolts";
}
if (_strRangedWeaponItem == "gunNPCPistol")
{
_strAmmo = "ammo9mmBulletBall";
_strAmmoName = "9mm Bullets";
}
if (_strRangedWeaponItem == "gunNPCDPistol")
{
_strAmmo = "ammo44MagnumBulletBall";
_strAmmoName = ".44 Bullets";
}
if (_strRangedWeaponItem == "gunNPCPShotgun")
{
_strAmmo = "ammoShotgunShell";
_strAmmoName = "Shotgun Shells";
}
if (_strRangedWeaponItem == "gunNPCSMG5")
{
_strAmmo = "ammo9mmBulletBall";
_strAmmoName = "9mm Bullets";
}
if (_strRangedWeaponItem == "gunNPCSRifle")
{
_strAmmo = "ammo762mmBulletBall";
_strAmmoName = "7.62 Ammo";
}
if (_strRangedWeaponItem == "gunNPCTRifle")
{
_strAmmo = "ammo762mmBulletBall";
_strAmmoName = "7.62 Ammo";
}
if (_strRangedWeaponItem == "gunNPCM60")
{
_strAmmo = "ammo762mmBulletBall";
_strAmmoName = "7.62 Ammo";
}
if (_strRangedWeaponItem == "gunNPCAk47")
{
_strAmmo = "ammo762mmBulletBall";
_strAmmoName = "7.62 Ammo";
}
XUiV_Label NPCAmmoLabel = (XUiV_Label)Panel.Controller.GetChildById("NPCAmmoLabel").ViewComponent;
if (NPCAmmoLabel != null)
{
if (_strAmmoName.Trim().Length == 0)
{
NPCAmmoLabel.Position = new Vector2i(-10000, -10000);
XUiV_Label NPCMagazineSizeLabel = (XUiV_Label)Panel.Controller.GetChildById("NPCMagazineSizeLabel").ViewComponent;
if (NPCMagazineSizeLabel != null)
{
NPCMagazineSizeLabel.Position = new Vector2i(-10000, -10000);
}
XUiV_Label NPCShotsPerRoundLabel = (XUiV_Label)Panel.Controller.GetChildById("NPCShotsPerRoundLabel").ViewComponent;
if (NPCShotsPerRoundLabel != null)
{
NPCShotsPerRoundLabel.Position = new Vector2i(-10000, -10000);
}
}
else
{
NPCAmmoLabel.Position = new Vector2i(8, -488);
XUiV_Label NPCMagazineSizeLabel = (XUiV_Label)Panel.Controller.GetChildById("NPCMagazineSizeLabel").ViewComponent;
if (NPCMagazineSizeLabel != null)
{
NPCMagazineSizeLabel.Position = new Vector2i(8, -528);
}
XUiV_Label NPCShotsPerRoundLabel = (XUiV_Label)Panel.Controller.GetChildById("NPCShotsPerRoundLabel").ViewComponent;
if (NPCShotsPerRoundLabel != null)
{
NPCShotsPerRoundLabel.Position = new Vector2i(8, -568);
}
}
}
int numHirecost = 0;
var entityClass = EntityClass.list[myEntity.entityClass];
if (entityClass.Properties.Values.ContainsKey("HireCost"))
{
numHirecost = int.Parse(entityClass.Properties.Values["HireCost"]);
}
numHirecost = numHirecost + (500 * (int)flNPCLevel);
int numRespawnCost = numHirecost + (250 * (int)flNPCLevel);
NPCName.Text = myEntity.EntityName;
NPCPlayerHireLevel.Text = minClass.ToString();
NPCLevel.Text = "" + flNPCLevel;
NPCMiningLevel.Text = "" + flNPCMiningLevel;
NPCFaction.Text = FactionManager.Instance.GetFaction(myEntity.factionId).Name.ToUpper();
float perc = RebirthUtilities.getDiscount(player);
NPCHireCost.Text = "$" + (int)(numHirecost * perc);
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;
NPCWeapon.Text = "" + _strWeaponName;
NPCAmmo.Text = "" + _strAmmoName;
if (_strAmmoName.Trim().Length > 0)
{
NPCMagazineSize.Text = "" + flNPCMagazineSize;
NPCShotsPerRound.Text = "" + flNPCBurst;
}
else
{
NPCMagazineSize.Text = "";
NPCShotsPerRound.Text = "";
}
base.OnOpen();
//Log.Out("XUiC_ShowStatsPopupRebirth-OnOpen END");
}
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
{
//Log.Out("XUiC_ShowStatsPopupRebirth-BtnConfirm_OnPressed START");
EntityPlayer player = xui.playerUI.entityPlayer;
xui.playerUI.windowManager.Close(windowGroup.ID);
//Log.Out("XUiC_ShowStatsPopupRebirth-BtnConfirm_OnPressed END");
}
private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
{
//Log.Out("XUiC_ShowStatsPopupRebirth-BtnCancel_OnPressed START");
EntityPlayer player = xui.playerUI.entityPlayer;
Panel.IsVisible = false;
xui.playerUI.windowManager.Close(windowGroup.ID);
//Log.Out("XUiC_ShowStatsPopupRebirth-BtnCancel_OnPressed END");
}
public override void OnClose()
{
//Log.Out("XUiC_ShowStatsPopupRebirth-OnClose START");
if (xui.playerUI.windowManager.HasWindow("dialog") && xui.playerUI.windowManager.IsWindowOpen("dialog"))
xui.playerUI.windowManager.Close("dialog");
base.OnClose();
//Log.Out("XUiC_ShowStatsPopupRebirth-OnClose END");
}
}