Upload from upload_mods.ps1
This commit is contained in:
40
Scripts/Dialog/NPCs/DialogActionExecuteCommandRebirth.cs
Normal file
40
Scripts/Dialog/NPCs/DialogActionExecuteCommandRebirth.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
public class DialogActionExecuteCommandRebirth : DialogActionAddBuff
|
||||
{
|
||||
public override BaseDialogAction.ActionTypes ActionType => BaseDialogAction.ActionTypes.AddBuff;
|
||||
|
||||
public override void PerformAction(EntityPlayer player)
|
||||
{
|
||||
var entityId = -1;
|
||||
if (player.Buffs.HasCustomVar("CurrentNPC"))
|
||||
entityId = (int)player.Buffs.GetCustomVar("CurrentNPC");
|
||||
|
||||
if (entityId == -1)
|
||||
return;
|
||||
|
||||
var myEntity = GameManager.Instance.World.GetEntity(entityId) as EntityAliveV2;
|
||||
if (myEntity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
|
||||
|
||||
switch (ID)
|
||||
{
|
||||
case "OpenInventory":
|
||||
if (myEntity.lootContainer == null)
|
||||
{
|
||||
Log.Out("DialogActionExecuteCommandRebirth-PerformAction NO LOOT CONTAINER SET");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(myEntity.lootContainer.lootListName))
|
||||
myEntity.lootContainer.lootListName = "traderNPC";
|
||||
|
||||
RebirthUtilities.lootContainerOpened(myEntity.lootContainer, uiforPlayer, player.entityId);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
216
Scripts/Dialog/NPCs/DialogActionNPCActionRebirth.cs
Normal file
216
Scripts/Dialog/NPCs/DialogActionNPCActionRebirth.cs
Normal file
@@ -0,0 +1,216 @@
|
||||
//using static RebirthManager;
|
||||
|
||||
public class DialogActionNPCActionRebirth : BaseDialogAction
|
||||
{
|
||||
public override void PerformAction(EntityPlayer player)
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction START, ID: " + ID);
|
||||
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
|
||||
if (!string.IsNullOrEmpty(ID))
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 1");
|
||||
EntityNPCRebirth entityNPC = (EntityNPCRebirth)uiforPlayer.xui.Dialog.Respondent;
|
||||
if (entityNPC != null)
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 2");
|
||||
if (!string.IsNullOrEmpty(ID))
|
||||
{
|
||||
bool checkControl = false;
|
||||
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 3");
|
||||
if (ID.ToLower() == "stay")
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 4");
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient)
|
||||
{
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageSetGuardPositionRebirth>().Setup(entityNPC.entityId, entityNPC.entityId), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityNPC.guardPosition = entityNPC.position;
|
||||
entityNPC.bWillRespawn = true;
|
||||
entityNPC.guardLookPosition = entityNPC.position + entityNPC.GetLookVector();
|
||||
}
|
||||
|
||||
entityNPC.SetRevengeTarget((EntityAlive) null);
|
||||
entityNPC.attackTarget = (EntityAlive) null;
|
||||
|
||||
entityNPC.motion = Vector3.zero;
|
||||
entityNPC.navigator?.clearPath();
|
||||
entityNPC.moveHelper?.Stop();
|
||||
entityNPC.speedForward = 0;
|
||||
entityNPC.speedStrafe = 0;
|
||||
//entityNPC.motion = Vector3.zero;
|
||||
//entityNPC.navigator?.clearPath();
|
||||
//entityNPC.moveHelper?.Stop();
|
||||
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction SET TO STAY");
|
||||
entityNPC.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Stay);
|
||||
entityNPC.Buffs.SetCustomVar("onMission", 0f);
|
||||
checkControl = true;
|
||||
RebirthManager.UpdateHireInfo(entityNPC.entityId, "order", "stay", entityNPC.position.ToString(), entityNPC.rotation.ToString());
|
||||
player.Companions.Remove(entityNPC);
|
||||
}
|
||||
else if (ID.ToLower() == "follow")
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 5");
|
||||
//entityNPC.Buffs.SetCustomVar("$FR_NPC_Respawn", 0f);
|
||||
|
||||
entityNPC.SetRevengeTarget((EntityAlive) null);
|
||||
entityNPC.attackTarget = (EntityAlive) null;
|
||||
|
||||
entityNPC.guardPosition = Vector3.zero;
|
||||
|
||||
entityNPC.motion = Vector3.zero;
|
||||
entityNPC.navigator?.clearPath();
|
||||
entityNPC.moveHelper?.Stop();
|
||||
entityNPC.speedForward = 0;
|
||||
entityNPC.speedStrafe = 0;
|
||||
//entityNPC.motion = Vector3.zero;
|
||||
//entityNPC.navigator?.clearPath();
|
||||
//entityNPC.moveHelper?.Stop();
|
||||
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction SET TO FOLLOW");
|
||||
entityNPC.HideNPC(false);
|
||||
|
||||
entityNPC.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Follow);
|
||||
entityNPC.Buffs.SetCustomVar("onMission", 0f);
|
||||
|
||||
entityNPC.Buffs.RemoveBuff("FuriousRamsayBuffPauseAttack");
|
||||
|
||||
checkControl = true;
|
||||
RebirthManager.UpdateHireInfo(entityNPC.entityId, "order", "follow");
|
||||
entityNPC.LeaderUtils.AddCompanion();
|
||||
}
|
||||
else if (ID.ToLower() == "guard")
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 6");
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction player.position: " + player.position);
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction entityNPC.guardPosition: " + entityNPC.guardPosition);
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient)
|
||||
{
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageSetGuardPositionRebirth>().Setup(entityNPC.entityId, player.entityId), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityNPC.guardPosition = EntityUtilities.CenterPosition(player.position);
|
||||
entityNPC.bWillRespawn = true;
|
||||
entityNPC.guardLookPosition = player.position + player.GetLookVector();
|
||||
}
|
||||
|
||||
entityNPC.SetRevengeTarget((EntityAlive) null);
|
||||
entityNPC.attackTarget = (EntityAlive) null;
|
||||
|
||||
entityNPC.motion = Vector3.zero;
|
||||
entityNPC.navigator?.clearPath();
|
||||
entityNPC.moveHelper?.Stop();
|
||||
entityNPC.speedForward = 0;
|
||||
entityNPC.speedStrafe = 0;
|
||||
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction SET TO STAY (GUARD)");
|
||||
entityNPC.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Stay);
|
||||
entityNPC.Buffs.SetCustomVar("onMission", 0f);
|
||||
checkControl = true;
|
||||
RebirthManager.UpdateHireInfo(entityNPC.entityId, "order", "guard", player.position.ToString(), player.rotation.ToString());
|
||||
player.Companions.Remove(entityNPC);
|
||||
}
|
||||
else if (ID.ToLower() == "pickup")
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 7");
|
||||
var playerInventory = uiforPlayer.xui.PlayerInventory;
|
||||
|
||||
if (playerInventory == null)
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 7a");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityNPCRebirth myEntity = GameManager.Instance.World.GetEntity(entityNPC.entityId) as EntityNPCRebirth;
|
||||
|
||||
if (myEntity != null)
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 7b");
|
||||
if (myEntity.EntityClass.Properties.Values.ContainsKey("SpawnBlock"))
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 7c");
|
||||
string itemName = "FuriousRamsaySpawnCube" + myEntity.EntityClass.Properties.Values["SpawnBlock"] + "_PickedUp";
|
||||
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 7d, itemName: " + itemName);
|
||||
|
||||
ItemValue item = ItemClass.GetItem(itemName);
|
||||
if (item != null)
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 7e");
|
||||
var itemValue = myEntity.GetItemValue(item);
|
||||
|
||||
var itemStack = new ItemStack(itemValue, 1);
|
||||
|
||||
if (!playerInventory.AddItem(itemStack))
|
||||
{
|
||||
if (!player.inventory.AddItem(itemStack))
|
||||
{
|
||||
if (!player.bag.AddItem(itemStack))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction IsServer: " + SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer);
|
||||
|
||||
EntityUtilities.CollectEntityServer(myEntity.entityId, player.entityId);
|
||||
|
||||
RebirthUtilities.DespawnEntity(myEntity);
|
||||
|
||||
//player.Companions.Remove(entityNPC);
|
||||
|
||||
/*GameManager.Instance.DropContentOfLootContainerServer(BlockValue.Air, new Vector3i(myEntity.position), myEntity.entityId);
|
||||
|
||||
RebirthManager.RemoveHire(myEntity.entityId);
|
||||
|
||||
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 7g");
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageDespawnEntityRebirth>().Setup(myEntity.entityId), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("DialogActionNPCActionRebirth-PerformAction 7h");
|
||||
myEntity.bWillRespawn = false;
|
||||
GameManager.Instance.World.RemoveEntity(myEntity.entityId, EnumRemoveEntityReason.Unloaded);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (checkControl)
|
||||
{
|
||||
float flMode = player.Buffs.GetCustomVar("varNPCModMode");
|
||||
float flHalt = player.Buffs.GetCustomVar("varNPCModStopAttacking");
|
||||
|
||||
if (flMode == 0)
|
||||
{
|
||||
entityNPC.Buffs.AddBuff("buffNPCModFullControlMode");
|
||||
}
|
||||
else
|
||||
{
|
||||
entityNPC.Buffs.RemoveBuff("buffNPCModFullControlMode");
|
||||
}
|
||||
|
||||
if (flHalt == 1)
|
||||
{
|
||||
entityNPC.Buffs.AddBuff("buffNPCModStopAttacking");
|
||||
}
|
||||
else
|
||||
{
|
||||
entityNPC.Buffs.RemoveBuff("buffNPCModStopAttacking");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Scripts/Dialog/NPCs/DialogActionNPCCommand.cs
Normal file
63
Scripts/Dialog/NPCs/DialogActionNPCCommand.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
public class DialogActionNPCCommand : DialogActionAddBuff
|
||||
{
|
||||
public override void PerformAction(EntityPlayer player)
|
||||
{
|
||||
//Log.Out("DialogActionNPCCommand-PerformAction START");
|
||||
var entityId = -1;
|
||||
if (player.Buffs.HasCustomVar("CurrentNPC"))
|
||||
{
|
||||
//Log.Out("DialogActionNPCCommand-PerformAction 1");
|
||||
entityId = (int)player.Buffs.GetCustomVar("CurrentNPC");
|
||||
}
|
||||
|
||||
if (entityId == -1)
|
||||
{
|
||||
//Log.Out("DialogActionNPCCommand-PerformAction 2");
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("ENTITY ID: " + entityId);
|
||||
|
||||
var entity = GameManager.Instance.World.GetEntity(entityId) as EntityAliveV2;
|
||||
if (entity)
|
||||
{
|
||||
|
||||
switch (ID)
|
||||
{
|
||||
case "follow":
|
||||
//Log.Out("DialogActionNPCCommand-PerformAction entity: " + entity.EntityClass.entityClassName);
|
||||
|
||||
float flMode = player.Buffs.GetCustomVar("varNPCModMode");
|
||||
float flHalt = player.Buffs.GetCustomVar("varNPCModStopAttacking");
|
||||
|
||||
if (flMode == 0)
|
||||
{
|
||||
//Log.Out("DialogActionNPCCommand-PerformAction 1");
|
||||
entity.Buffs.AddBuff("buffNPCModFullControlMode");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("DialogActionNPCCommand-PerformAction 2");
|
||||
entity.Buffs.RemoveBuff("buffNPCModFullControlMode");
|
||||
}
|
||||
|
||||
if (flHalt == 1)
|
||||
{
|
||||
//Log.Out("DialogActionNPCCommand-PerformAction 3");
|
||||
entity.Buffs.AddBuff("buffNPCModStopAttacking");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("DialogActionNPCCommand-PerformAction 4");
|
||||
entity.Buffs.RemoveBuff("buffNPCModStopAttacking");
|
||||
}
|
||||
|
||||
//Log.Out("DialogActionNPCCommand-PerformAction SET TO FOLLOW");
|
||||
entity.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Follow);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
////Log.Out("DialogActionNPCCommand-PerformAction END");
|
||||
}
|
||||
}
|
||||
37
Scripts/Dialog/NPCs/DialogActionNPCSetCVarRebirth.cs
Normal file
37
Scripts/Dialog/NPCs/DialogActionNPCSetCVarRebirth.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
public class DialogActionNPCSetCVarRebirth : DialogActionAddBuff
|
||||
{
|
||||
public override void PerformAction(EntityPlayer player)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Value))
|
||||
Value = "0";
|
||||
|
||||
float.TryParse(Value, out var flValue);
|
||||
|
||||
var entityId = -1;
|
||||
if (player.Buffs.HasCustomVar("CurrentNPC"))
|
||||
{
|
||||
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 1");
|
||||
entityId = (int)player.Buffs.GetCustomVar("CurrentNPC");
|
||||
}
|
||||
|
||||
if (entityId == -1)
|
||||
{
|
||||
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 2");
|
||||
return;
|
||||
}
|
||||
|
||||
var myEntity = GameManager.Instance.World.GetEntity(entityId) as EntityAliveV2;
|
||||
if (myEntity == null)
|
||||
{
|
||||
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 3");
|
||||
return;
|
||||
}
|
||||
|
||||
if (flValue == 0)
|
||||
myEntity.Buffs.SetCustomVar(ID, 0f);
|
||||
else
|
||||
myEntity.Buffs.SetCustomVar(ID, flValue, true);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
41
Scripts/Dialog/NPCs/DialogActionSetRespawnPointRebirth.cs
Normal file
41
Scripts/Dialog/NPCs/DialogActionSetRespawnPointRebirth.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
public class DialogActionSetRespawnPointRebirth : DialogActionAddBuff
|
||||
{
|
||||
public override void PerformAction(EntityPlayer player)
|
||||
{
|
||||
//Log.Out("DialogActionSetRespawnPointRebirth-PerformAction START");
|
||||
var entityId = -1;
|
||||
if (player.Buffs.HasCustomVar("CurrentNPC"))
|
||||
{
|
||||
//Log.Out("DialogActionSetRespawnPointRebirth-PerformAction 1");
|
||||
entityId = (int)player.Buffs.GetCustomVar("CurrentNPC");
|
||||
}
|
||||
|
||||
if (entityId == -1)
|
||||
{
|
||||
//Log.Out("DialogActionSetRespawnPointRebirth-PerformAction 2");
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("ENTITY ID: " + entityId);
|
||||
|
||||
EntityAliveV2 entity = GameManager.Instance.World.GetEntity(entityId) as EntityAliveV2;
|
||||
if (entity)
|
||||
{
|
||||
//Log.Out("DialogActionSetRespawnPointRebirth-PerformAction Entity: " + entity.EntityName);
|
||||
|
||||
entity.bWillRespawn = true;
|
||||
|
||||
RebirthManager.UpdateHireInfo(entity.entityId, "reSpawnPosition", "", entity.position.ToString(), entity.rotation.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
GameManager.ShowTooltip(GameManager.Instance.World.GetPrimaryPlayer().PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttSetRespawnPoint") + " " + entity.EntityName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
//Log.Out("DialogActionSetRespawnPointRebirth-PerformAction END");
|
||||
}
|
||||
}
|
||||
22
Scripts/Dialog/NPCs/DialogRequirementCanGoHomeRebirth.cs
Normal file
22
Scripts/Dialog/NPCs/DialogRequirementCanGoHomeRebirth.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using static RebirthManager;
|
||||
|
||||
public class DialogRequirementCanGoHomeRebirth : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
foreach (hireInfo hire in RebirthManager.playerHires)
|
||||
{
|
||||
if (hire.hireID == talkingTo.entityId)
|
||||
{
|
||||
if (hire.reSpawnPosition != new Vector3(0, 0, 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
29
Scripts/Dialog/NPCs/DialogRequirementCanGoMineRebirth.cs
Normal file
29
Scripts/Dialog/NPCs/DialogRequirementCanGoMineRebirth.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
public class DialogRequirementIsNotHordeDay : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
|
||||
if (RebirthUtilities.IsHordeDay())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class DialogRequirementIsHordeDay : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
|
||||
if (!RebirthUtilities.IsHordeDay())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
29
Scripts/Dialog/NPCs/DialogRequirementCanRepairRebirth.cs
Normal file
29
Scripts/Dialog/NPCs/DialogRequirementCanRepairRebirth.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
public class DialogRequirementCanRepairRebirth : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
if (player.Buffs.HasBuff("FuriousRamsayHelpRepairBuff"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityNPCRebirth npc = (EntityNPCRebirth)talkingTo;
|
||||
|
||||
if (npc != null)
|
||||
{
|
||||
if (npc.LeaderUtils.Owner)
|
||||
{
|
||||
if (npc.LeaderUtils.Owner.Buffs.HasBuff("FuriousRamsayHelpRepairBuff"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
33
Scripts/Dialog/NPCs/DialogRequirementHasCurrentOrder.cs
Normal file
33
Scripts/Dialog/NPCs/DialogRequirementHasCurrentOrder.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Linq;
|
||||
|
||||
public class DialogRequirementHasCurrentOrder : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
|
||||
EntityAliveV2 myEntity = (EntityAliveV2)talkingTo;
|
||||
|
||||
if (myEntity != null)
|
||||
{
|
||||
// Split the Value string by commas, parse each part to an integer, and create a list
|
||||
var values = Value.Split(',')
|
||||
.Select(v => int.Parse(v.Trim()))
|
||||
.ToList();
|
||||
|
||||
// Get the CurrentOrder from myEntity
|
||||
int currentOrder = (int)myEntity.Buffs.GetCustomVar("CurrentOrder");
|
||||
|
||||
// Check if CurrentOrder is one of the values
|
||||
if (values.Contains(currentOrder))
|
||||
{
|
||||
//Log.Out("DialogRequirementHasCurrentOrder-CheckRequirement true");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("DialogRequirementHasCurrentOrder-CheckRequirement false");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
public class DialogRequirementHasRepairReportRebirth : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
|
||||
EntityNPCRebirth myEntity = (EntityNPCRebirth)talkingTo;
|
||||
|
||||
if (myEntity != null)
|
||||
{
|
||||
//Log.Out("DialogRequirementHasRepairReportRebirth-CheckRequirement strSerialize: " + myEntity.strSerialize);
|
||||
if (myEntity.strSerialize.Trim().Length > 0)
|
||||
{
|
||||
//Log.Out("DialogRequirementHasRepairReportRebirth-CheckRequirement true");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("DialogRequirementHasRepairReportRebirth-CheckRequirement false");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
22
Scripts/Dialog/NPCs/DialogRequirementHiredRebirth.cs
Normal file
22
Scripts/Dialog/NPCs/DialogRequirementHiredRebirth.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
public class DialogRequirementHiredRebirth : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
bool isHired = false;
|
||||
|
||||
if (talkingTo.Buffs.GetCustomVar("$Leader") > 0)
|
||||
{
|
||||
//Log.Out("DialogRequirementHiredRebirth-CheckRequirement NOPE");
|
||||
isHired = true;
|
||||
}
|
||||
|
||||
if (base.Value.EqualsCaseInsensitive("not"))
|
||||
{
|
||||
//Log.Out("DialogRequirementHiredRebirth-CheckRequirement 5, result: " + !isHired);
|
||||
return !isHired;
|
||||
}
|
||||
|
||||
//Log.Out("DialogRequirementHiredRebirth-CheckRequirement 6, result: " + isHired);
|
||||
return isHired;
|
||||
}
|
||||
}
|
||||
9
Scripts/Dialog/NPCs/DialogRequirementIsLeaderRebirth.cs
Normal file
9
Scripts/Dialog/NPCs/DialogRequirementIsLeaderRebirth.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
public class DialogRequirementIsLeaderRebirth : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
return ((int)talkingTo.Buffs.GetCustomVar("$Leader") == player.entityId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
33
Scripts/Dialog/NPCs/DialogRequirementNotHomeRebirth.cs
Normal file
33
Scripts/Dialog/NPCs/DialogRequirementNotHomeRebirth.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using static RebirthManager;
|
||||
|
||||
public class DialogRequirementNotHomeRebirth : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
foreach (hireInfo hire in playerHires)
|
||||
{
|
||||
if (hire.hireID == talkingTo.entityId)
|
||||
{
|
||||
float flPosX = talkingTo.position.x;
|
||||
float flPosY = talkingTo.position.y;
|
||||
float flPosZ = talkingTo.position.z;
|
||||
|
||||
float flX = hire.reSpawnPosition.x;
|
||||
float flY = hire.reSpawnPosition.y;
|
||||
float flZ = hire.reSpawnPosition.z;
|
||||
|
||||
if (flX != flPosX &&
|
||||
flY != flPosY &&
|
||||
flZ != flPosZ)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
98
Scripts/Dialog/NPCs/DialogRequirementRestrictHiresSDX.cs
Normal file
98
Scripts/Dialog/NPCs/DialogRequirementRestrictHiresSDX.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
using static RebirthManager;
|
||||
|
||||
public class DialogRequirementRestrictHiresSDX : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
string restrictiveHire = RebirthVariables.customRestrictHires;
|
||||
|
||||
if (restrictiveHire == "none")
|
||||
{
|
||||
//Log.Out("DialogRequirementIsLeaderRebirth-CheckRequirement 1");
|
||||
result = true;
|
||||
}
|
||||
else if (restrictiveHire == "nofollowers")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
float progressionLevel = 0;
|
||||
|
||||
ProgressionValue progressionValue = player.Progression.GetProgressionValue("perkCharismaticNature");
|
||||
if (progressionValue != null)
|
||||
{
|
||||
progressionLevel = RebirthUtilities.GetCalculatedLevel(player, progressionValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("DialogRequirementRestrictHiresSDX-CheckRequirement progressionValue == null");
|
||||
}
|
||||
|
||||
float charismaticNatureLevel = RebirthUtilities.GetPerkLevel(player, "perkCharismaticNature");
|
||||
|
||||
int numHires = 0;
|
||||
|
||||
foreach (hireInfo hire in playerHires)
|
||||
{
|
||||
if (hire.playerID == player.entityId)
|
||||
{
|
||||
//Log.Out("DialogRequirementRestrictHiresSDX-CheckRequirement hire.hireID: " + hire.hireID);
|
||||
Entity entityNPC = (Entity)GameManager.Instance.World.GetEntity(hire.hireID);
|
||||
if (entityNPC)
|
||||
{
|
||||
if (entityNPC.HasAnyTags(FastTags<TagGroup.Global>.Parse("survivor")) && !entityNPC.HasAnyTags(FastTags<TagGroup.Global>.Parse("trader")))
|
||||
{
|
||||
numHires++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("DialogRequirementRestrictHiresSDX-CheckRequirement progressionLevel: " + progressionLevel);
|
||||
//Log.Out("DialogRequirementRestrictHiresSDX-CheckRequirement charismaticNatureLevel: " + charismaticNatureLevel);
|
||||
//Log.Out("DialogRequirementRestrictHiresSDX-CheckRequirement numHires: " + numHires);
|
||||
|
||||
if (numHires == 0 && charismaticNatureLevel >= 1)
|
||||
{
|
||||
//Log.Out("CAN HIRE 1");
|
||||
result = true;
|
||||
}
|
||||
else if (numHires <= 1 && charismaticNatureLevel >= 2)
|
||||
{
|
||||
//Log.Out("CAN HIRE 2");
|
||||
result = true;
|
||||
}
|
||||
else if (numHires <= 2 && charismaticNatureLevel >= 3)
|
||||
{
|
||||
//Log.Out("CAN HIRE 3");
|
||||
result = true;
|
||||
}
|
||||
else if (numHires <= 3 && charismaticNatureLevel == 4)
|
||||
{
|
||||
//Log.Out("CAN HIRE 4");
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("CAN'T HIRE ANY");
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (base.Value.EqualsCaseInsensitive("not"))
|
||||
{
|
||||
//Log.Out("DialogRequirementRestrictHiresSDX-CheckRequirement !result: " + !result);
|
||||
return !result;
|
||||
}
|
||||
|
||||
//Log.Out("DialogRequirementRestrictHiresSDX-CheckRequirement result: " + result);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user