99 lines
3.3 KiB
C#
99 lines
3.3 KiB
C#
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;
|
|
}
|
|
}
|
|
|
|
|