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,19 @@
public class DialogActionAddBuffRebirth : BaseDialogAction
{
public override void PerformAction(EntityPlayer player)
{
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
if (!string.IsNullOrEmpty(Value) && Value.ToLower() == "self")
{
var entityNPC = uiforPlayer.xui.Dialog.Respondent;
if (entityNPC != null)
{
Debug.Log($"Adding {ID}...");
// calls buffOrderDismiss, removes the cvar. Doesn't work
entityNPC.Buffs.AddBuff(base.ID);
}
return;
}
player.Buffs.AddBuff(ID);
}
}

View File

@@ -0,0 +1,7 @@
public class DialogActionCallGameEventRebirth : BaseDialogAction
{
public override void PerformAction(EntityPlayer player)
{
GameEventManager.Current.HandleAction(this.ID, player as EntityPlayer, player, false, "", "", false, true, "", null);
}
}

View File

@@ -0,0 +1,45 @@
public class DialogActionDespawnEntityRebirth : DialogActionAddBuff
{
public override BaseDialogAction.ActionTypes ActionType => BaseDialogAction.ActionTypes.AddBuff;
public override void PerformAction(EntityPlayer player)
{
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 EntityNPCRebirth;
if (myEntity == null)
{
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 3");
return;
}
RebirthUtilities.DespawnEntity(myEntity);
/*player.Companions.Remove(myEntity);
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 5");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageDespawnEntityRebirth>().Setup(myEntity.entityId), false);
}
else
{
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 6");
////Log.Out("DialogActionDespawnEntityRebirth-PerformAction REMOVE HIRE/OWNED ENTITY, hire: " + myEntity.entityId);
RebirthManager.RemoveHire(myEntity.entityId, true);
myEntity.bWillRespawn = false;
GameManager.Instance.World.RemoveEntity(myEntity.entityId, EnumRemoveEntityReason.Unloaded);
}*/
}
}

View File

@@ -0,0 +1,40 @@
public class DialogActionGiveQuestRebirth : DialogActionAddBuff
{
public override void PerformAction(EntityPlayer player)
{
//Log.Out("GiveQuestRebirth-PerformAction START");
Quest newQuest = QuestClass.CreateQuest(ID);
if (newQuest == null)
return;
if (newQuest != null)
{
//Log.Out("GiveQuestRebirth-PerformAction 1");
QuestClass questClass = newQuest.QuestClass;
if (questClass != null)
{
//Log.Out("GiveQuestRebirth-PerformAction 2");
for (int i = 0; i < player.QuestJournal.quests.Count; i++)
{
//Log.Out("QUEST ID: " + player.QuestJournal.quests[i].ID);
//Log.Out("QUEST STATE: " + player.QuestJournal.quests[i].CurrentState);
if (player.QuestJournal.quests[i].CurrentState == Quest.QuestState.InProgress)
{
if (player.QuestJournal.quests[i].ID.ToLower() == ID.ToLower())
{
GameManager.ShowTooltip((EntityPlayerLocal)player, Localization.Get("questunavailable"));
//Log.Out("YOU ALREADY HAVE THIS QUEST");
return;
}
}
}
//Log.Out("GiveQuestRebirth-PerformAction 3");
player.QuestJournal.AddQuest(newQuest);
return;
}
}
//Log.Out("GiveQuestRebirth-PerformAction END");
}
}

View File

@@ -0,0 +1,57 @@

public class DialogActionOpenDialogRebirth : DialogActionAddBuff
{
public override void PerformAction(EntityPlayer player)
{
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
//Log.Out("DialogActionOpenDialogRebirth-PerformAction START");
//Log.Out("DialogActionOpenDialogRebirth-PerformAction ID: " + ID);
if (ID.ToLower().Contains("quest_"))
{
//Log.Out("DialogActionOpenDialogRebirth-PerformAction 1");
Quest newQuest = QuestClass.CreateQuest(ID);
if (newQuest == null)
{
//Log.Out("DialogActionOpenDialogRebirth-PerformAction 2");
return;
}
if (newQuest != null)
{
//Log.Out("DialogActionOpenDialogRebirth-PerformAction 3");
QuestClass questClass = newQuest.QuestClass;
if (questClass != null)
{
//Log.Out("DialogActionOpenDialogRebirth-PerformAction 4");
for (int i = 0; i < player.QuestJournal.quests.Count; i++)
{
////Log.Out("QUEST ID: " + player.QuestJournal.quests[i].ID);
////Log.Out("QUEST STATE: " + player.QuestJournal.quests[i].CurrentState);
if (player.QuestJournal.quests[i].CurrentState == Quest.QuestState.InProgress)
{
if (player.QuestJournal.quests[i].ID.ToLower() == ID.ToLower())
{
GameManager.ShowTooltip((EntityPlayerLocal)player, Localization.Get("ttAlreadyHaveActiveQuest"));
//Log.Out("YOU ALREADY HAVE THIS QUEST");
return;
}
}
}
//Log.Out("DialogActionOpenDialogRebirth-PerformAction 5");
}
}
uiforPlayer.windowManager.Open("OfferQuestRebirth", true, false, true);
}
else
{
uiforPlayer.windowManager.Open(ID, true, false, true);
}
}
}

View File

@@ -0,0 +1,40 @@
public class DialogActionRemoveWaypointRebirth : BaseDialogAction
{
public override void PerformAction(EntityPlayer player)
{
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
if (!string.IsNullOrEmpty(Value) && Value.ToLower() == "self")
{
var entityNPC = uiforPlayer.xui.Dialog.Respondent;
if (entityNPC != null)
{
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
Vector3i blockPosition = World.worldToBlockPos(entityNPC.position);
foreach (Waypoint waypoint in primaryPlayer.Waypoints.Collection.list)
{
if ((waypoint.pos.x <= blockPosition.x + 2)
&& (waypoint.pos.x >= blockPosition.x - 2)
&& (waypoint.pos.y <= blockPosition.y + 2)
&& (waypoint.pos.y >= blockPosition.y - 2)
&& (waypoint.pos.z <= blockPosition.z + 2)
&& (waypoint.pos.z >= blockPosition.z - 2)
&& waypoint.name.Text.ToLower().Trim() == Localization.Get(entityNPC.EntityClass.entityClassName).ToLower().Trim()
)
{
primaryPlayer.Waypoints.Collection.Remove(waypoint);
NavObjectManager.Instance.UnRegisterNavObject(waypoint.navObject);
XUiV_Window window = uiforPlayer.xui.GetWindow("mapTracking");
if (window != null)
{
((XUiC_MapWaypointList)window.Controller.GetChildById("waypointList")).UpdateWaypointsList(null);
}
break;
}
}
}
return;
}
}
}

View File

@@ -0,0 +1,17 @@
public class DialogActionSetCVarRebirth : DialogActionAddBuff
{
public override void PerformAction(EntityPlayer player)
{
if (string.IsNullOrEmpty(Value))
Value = "0";
float.TryParse(Value, out var flValue);
if (flValue == 0)
player.Buffs.SetCustomVar(ID, 0f);
else
player.Buffs.SetCustomVar(ID, flValue, true);
return;
}
}

View File

@@ -0,0 +1,12 @@
public class DialogRequirementCanPickUp : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
if (talkingTo.EntityClass.Properties.Values.ContainsKey("SpawnBlock"))
{
return true;
}
return false;
}
}

View File

@@ -0,0 +1,42 @@
using System.Linq;
public class DialogRequirementHasBuffRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
var matches = -1;
// If there's more than one buff listed, loop around, recording how many we match.
string[] array = Value.Split(new char[]
{
','
});
if (Value.Contains(","))
{
matches = array.Count(t => player.Buffs.HasBuff(t));
if (matches > 0)
return true;
return false;
}
else
{
// Reverse condition on the buff.
if (Value.StartsWith("!"))
{
var tempBuff = Value.Replace("!", "");
if (!player.Buffs.HasBuff(tempBuff))
return true;
}
// If no operator, just check if we have it
if (player.Buffs.HasBuff(Value))
return true;
}
return false;
}
}

View File

@@ -0,0 +1,12 @@
public class DialogRequirementHasPlayerBackpackRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
if (player.GetDroppedBackpackPositions().Count == 0)
{
return false;
}
return true;
}
}

View File

@@ -0,0 +1,89 @@
public class DialogRequirementHasPlayerLevelRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
// If value is not specified, accepted it.
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement START");
if (string.IsNullOrEmpty(Value))
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 1");
return false;
}
float numPlayerLevel = player.Buffs.GetCustomVar(ID);
string tempValue = Value;
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement: Value: " + Value);
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement: tempValue: " + tempValue);
if (tempValue.Contains(">="))
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 2a");
tempValue = tempValue.Replace(">=", "");
float.TryParse(tempValue, out var flValue);
if (numPlayerLevel >= flValue)
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 2b");
return true;
}
}
else if (tempValue.Contains("LTE"))
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 3a");
tempValue = tempValue.Replace("LTE", "");
float.TryParse(tempValue, out var flValue);
if (numPlayerLevel <= flValue)
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 3b");
return true;
}
}
else if (tempValue.Contains(">"))
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 4a");
tempValue = tempValue.Replace(">", "");
float.TryParse(tempValue, out var flValue);
if (numPlayerLevel > flValue)
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 4b");
return true;
}
}
else if (tempValue.Contains("LT"))
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 5a");
tempValue = tempValue.Replace("LT", "");
float.TryParse(tempValue, out var flValue);
if (numPlayerLevel < flValue)
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 5b");
return true;
}
}
else if (tempValue.Contains("!="))
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 6a");
tempValue = tempValue.Replace("!=", "");
float.TryParse(tempValue, out var flValue);
if (numPlayerLevel != flValue)
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 6b");
return true;
}
}
else
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 7a");
float.TryParse(tempValue, out var flValue);
if (numPlayerLevel == flValue)
{
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement 7b");
return true;
}
}
//Log.Out("DialogRequirementHasPlayerLevelRebirth-CheckRequirement END");
return false;
}
}

View File

@@ -0,0 +1,89 @@
public class DialogRequirementHasProgressLevelRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
// If value is not specified, accepted it.
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement START");
if (string.IsNullOrEmpty(Value))
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 1");
return false;
}
float numProgressionLevel = player.Progression.GetProgressionValue(ID).Level;
string tempValue = Value;
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement: Value: " + Value);
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement: tempValue: " + tempValue);
if (tempValue.Contains(">="))
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 2a");
tempValue = tempValue.Replace(">=", "");
float.TryParse(tempValue, out var flValue);
if (numProgressionLevel >= flValue)
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 2b");
return true;
}
}
else if (tempValue.Contains("LTE"))
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 3a");
tempValue = tempValue.Replace("LTE", "");
float.TryParse(tempValue, out var flValue);
if (numProgressionLevel <= flValue)
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 3b");
return true;
}
}
else if (tempValue.Contains(">"))
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 4a");
tempValue = tempValue.Replace(">", "");
float.TryParse(tempValue, out var flValue);
if (numProgressionLevel > flValue)
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 4b");
return true;
}
}
else if (tempValue.Contains("LT"))
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 5a");
tempValue = tempValue.Replace("LT", "");
float.TryParse(tempValue, out var flValue);
if (numProgressionLevel < flValue)
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 5b");
return true;
}
}
else if (tempValue.Contains("!="))
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 6a");
tempValue = tempValue.Replace("!=", "");
float.TryParse(tempValue, out var flValue);
if (numProgressionLevel != flValue)
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 6b");
return true;
}
}
else
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 7a");
float.TryParse(tempValue, out var flValue);
if (numProgressionLevel == flValue)
{
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement 7b");
return true;
}
}
//Log.Out("DialogRequirementHasProgressLevelRebirth-CheckRequirement END");
return false;
}
}

View File

@@ -0,0 +1,130 @@
public class DialogRequirementIsBetweenTimesRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
ulong worldTime = GameManager.Instance.World.worldTime;
ValueTuple<int, int, int> valueTuple = GameUtils.WorldTimeToElements(worldTime);
int hour = valueTuple.Item2;
int minutes = valueTuple.Item3;
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, hour: " + hour);
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, minutes: " + minutes);
string[] array = this.Value.Split(new char[]
{
','
});
int numHour1 = 0;
int numMinutes1 = 0;
int numHour2 = 0;
int numMinutes2 = 0;
bool bOutside = false;
for (int i = 0; i < array.Length; i++)
{
if (i == 0)
{
numHour1 = Int16.Parse(array[0]);
}
if (i == 1)
{
numMinutes1 = Int16.Parse(array[1]);
}
if (i == 2)
{
numHour2 = Int16.Parse(array[2]);
}
if (i == 3)
{
numMinutes2 = Int16.Parse(array[3]);
}
}
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, numHour1: " + numHour1);
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, numMinutes1: " + numMinutes1);
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, numHour2: " + numHour2);
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, numMinutes2: " + numMinutes2);
if (numHour1 > numHour2)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, numHour2 > numHour1");
bOutside = true;
}
else
{
if ((numHour1 == numHour2))
{
if (numMinutes1 > numMinutes2)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, numMinutes1 > numMinutes2");
bOutside = true;
}
}
}
bool flag = false;
if (!bOutside)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, NOT bOutside");
if (numHour1 < hour && hour < numHour2)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, hour > numHour1 && hour < numHour2");
flag = true;
}
else if (hour == numHour1 && hour == numHour2)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, hour == numHour1 && hour == numHour2");
if (minutes >= numMinutes1 && minutes <= numMinutes2)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, minutes >= numMinutes1 && minutes <= numMinutes2");
flag = true;
}
}
else if (hour == numHour1 && minutes >= numMinutes1)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, hour == numHour1 && minutes >= numMinutes1");
flag = true;
}
else if (hour == numHour2 && minutes <= numMinutes2)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, hour == numHour2 && minutes <= numMinutes2");
flag = true;
}
}
else
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, bOutside");
if (hour > numHour1 || hour < numHour2)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, hour < numHour1 || hour > numHour2");
flag = true;
}
else if (hour == numHour1 && hour == numHour2)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, hour == numHour1 && hour == numHour2");
if (minutes <= numMinutes2 || minutes >= numMinutes1)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, minutes <= numMinutes2 || minutes >= numMinutes1");
flag = true;
}
}
else if (hour == numHour1 && minutes >= numMinutes1)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, hour == numHour1 && minutes >= numMinutes1");
flag = true;
}
else if (hour == numHour2 && minutes <= numMinutes2)
{
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, hour == numHour2 && minutes <= numMinutes2");
flag = true;
}
}
//Log.Out("DialogRequirementIsBetweenTimesRebirth-CheckRequirement, flag: " + flag);
return flag;
}
}

View File

@@ -0,0 +1,33 @@
public class DialogRequirementIsOptionValid : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
string[] array = Value.Split(new char[]
{
','
});
return RebirthUtilities.IsOptionAvailable(array[0], array[1], array[2]);
}
}
public class DialogRequirementNotIsOptionValid : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
string[] array = Value.Split(new char[]
{
','
});
//Log.Out("DialogRequirementNotIsOptionValid-CheckRequirement array[0]: " + array[0]);
//Log.Out("DialogRequirementNotIsOptionValid-CheckRequirement array[1]: " + array[1]);
//Log.Out("DialogRequirementNotIsOptionValid-CheckRequirement array[2]: " + array[2]);
bool result = !RebirthUtilities.IsOptionAvailable(array[0], array[1], array[2]);
//Log.Out("DialogRequirementNotIsOptionValid-CheckRequirement result: " + result);
return result;
}
}

View File

@@ -0,0 +1,31 @@
public class DialogRequirementIsntBloodMoonRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
if (!SkyManager.IsBloodMoonVisible())
{
return true;
}
ulong worldTime = GameManager.Instance.World.worldTime;
ValueTuple<int, int, int> valueTuple = GameUtils.WorldTimeToElements(worldTime);
int num = valueTuple.Item2;
int num2 = valueTuple.Item3;
int numDaylength = GamePrefs.GetInt(EnumGamePrefs.DayLightLength);
int numOpenTime = 22 - numDaylength;
if ((num == 21 && num2 >= 55) || (num >= 22) || num < numOpenTime)
{
return false;
}
else
{
return true;
}
}
}

View File

@@ -0,0 +1,62 @@
/*
* Match at least one of these buffs, by default.
* <requirement type="NPCHasBuffSDX, RebirthUtils" requirementtype="Hide" value="buffCursed,buffGodMode,buffImagination" />
* Do not have these buffs
* <requirement type="NPCHasBuffSDX, RebirthUtils" requirementtype="Hide" value="!buffCursed" " />
*/
using System.Linq;
public class DialogRequirementNPCHasBuffSDX : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
//Log.Out("DialogRequirementNPCHasBuffSDX-CheckRequirement START");
//Log.Out("DialogRequirementNPCHasBuffSDX-CheckRequirement, Value: " + Value);
var matches = -1;
// If there's more than one buff listed, loop around, recording how many we match.
string[] array = Value.Split(new char[]
{
','
});
if (Value.Contains(","))
{
//Log.Out("DialogRequirementNPCHasBuffSDX-CheckRequirement 1");
matches = array.Count(t => talkingTo.Buffs.HasBuff(t));
if (matches > 0)
return true;
return false;
}
else
{
//Log.Out("DialogRequirementNPCHasBuffSDX-CheckRequirement 2");
// Reverse condition on the buff.
if (Value.StartsWith("!"))
{
//Log.Out("DialogRequirementNPCHasBuffSDX-CheckRequirement 3");
var tempBuff = Value.Replace("!", "");
if (!talkingTo.Buffs.HasBuff(tempBuff))
return true;
}
// If no operator, just check if we have it
if (talkingTo.Buffs.HasBuff(Value))
{
//Log.Out("DialogRequirementNPCHasBuffSDX-CheckRequirement 4");
return true;
}
}
//Log.Out("DialogRequirementNPCHasBuffSDX-CheckRequirement END");
return false;
}
}

View File

@@ -0,0 +1,50 @@
public class DialogRequirementNPCHasCVarRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
////Log.Out("DialogRequirementNPCHasCVarRebirth-CheckRequirement START");
//Log.Out("DialogRequirementNPCHasCVarRebirth-CheckRequirement ID: " + ID);
//Log.Out("DialogRequirementNPCHasCVarRebirth-CheckRequirement Value: " + Value);
//Log.Out("DialogRequirementNPCHasCVarRebirth-CheckRequirement talkingTo.EntityClass.entityClassName: " + talkingTo.EntityClass.entityClassName);
if (string.IsNullOrEmpty(Value))
{
//Log.Out("DialogRequirementNPCHasCVarRebirth-CheckRequirement 1");
if (talkingTo.Buffs.HasCustomVar(ID))
{
//Log.Out("DialogRequirementNPCHasCVarRebirth-CheckRequirement 2");
return true;
}
}
float.TryParse(Value, out float flValue);
if (talkingTo.Buffs.HasCustomVar(ID))
{
//Log.Out("DialogRequirementNPCHasCVarRebirth-CheckRequirement 3");
float numCVar = talkingTo.Buffs.GetCustomVar(ID);
//Log.Out("DialogRequirementNPCHasCVarRebirth-CheckRequirement numCVar: " + numCVar);
if (numCVar == flValue)
{
//Log.Out("DialogRequirementNPCHasCVarRebirth-CheckRequirement 4");
return true;
}
}
else
{
if (flValue == 0f)
{
//Log.Out("DialogRequirementNPCHasCVarRebirth-CheckRequirement 5");
return true;
}
}
//Log.Out("DialogRequirementNPCHasCVarRebirth-CheckRequirement END");
return false;
}
}

View File

@@ -0,0 +1,50 @@
/*
* Match at least one of these buffs, by default.
* <requirement type="NPCNotHasBuffSDX, RebirthUtils" requirementtype="Hide" value="buffCursed,buffGodMode,buffImagination" />
* Do not have these buffs
* <requirement type="NPCNotHasBuffSDX, RebirthUtils" requirementtype="Hide" value="!buffCursed" " />
*/
using System.Linq;
public class DialogRequirementNPCNotHasBuffSDX : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
var matches = -1;
// If there's more than one buff listed, loop around, recording how many we match.
string[] array = Value.Split(new char[]
{
','
});
if (Value.Contains(","))
{
matches = array.Count(t => talkingTo.Buffs.HasBuff(t));
if (matches > 0)
return false;
return true;
}
else
{
// Reverse condition on the buff.
if (Value.StartsWith("!"))
{
var tempBuff = Value.Replace("!", "");
if (!talkingTo.Buffs.HasBuff(tempBuff))
return false;
}
// If no operator, just check if we have it
if (talkingTo.Buffs.HasBuff(Value))
return false;
}
return false;
}
}

View File

@@ -0,0 +1,43 @@
public class DialogRequirementNPCNotHasCVarRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
//Log.Out("DialogRequirementNPCNotHasCVarRebirth-CheckRequirement START");
//Log.Out("DialogRequirementNPCNotHasCVarRebirth-CheckRequirement Value: " + Value);
//Log.Out("DialogRequirementNPCNotHasCVarRebirth-CheckRequirement ID: " + ID);
if (string.IsNullOrEmpty(Value))
{
//Log.Out("DialogRequirementNPCNotHasCVarRebirth-CheckRequirement 1");
if (talkingTo.Buffs.HasCustomVar(ID))
{
//Log.Out("DialogRequirementNPCNotHasCVarRebirth-CheckRequirement 2");
return false;
}
}
float.TryParse(Value, out var flValue);
////Log.Out("DialogRequirementNPCNotHasCVarRebirth-CheckRequirement flValue: " + flValue);
if (talkingTo.Buffs.HasCustomVar(ID))
{
//Log.Out("DialogRequirementNPCNotHasCVarRebirth-CheckRequirement 3");
float numCVar = talkingTo.Buffs.GetCustomVar(ID);
//Log.Out("DialogRequirementNPCNotHasCVarRebirth-CheckRequirement numCVar: " + numCVar);
if (numCVar == flValue)
{
//Log.Out("DialogRequirementNPCNotHasCVarRebirth-CheckRequirement 4");
return false;
}
}
//Log.Out("DialogRequirementNPCNotHasCVarRebirth-CheckRequirement END");
return true;
}
}

View File

@@ -0,0 +1,34 @@
using System.Linq;
public class DialogRequirementNotHasBuffRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
var matches = -1;
// If there's more than one buff listed, loop around, recording how many we match.
string[] array = Value.Split(new char[]
{
','
});
if (Value.Contains(","))
{
matches = array.Count(t => player.Buffs.HasBuff(t));
if (matches > 0)
return false;
return true;
}
else
{
// If no operator, just check if we have it
if (!player.Buffs.HasBuff(Value))
{
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,30 @@
public class DialogRequirementPlayerHasCVarRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
if (string.IsNullOrEmpty(Value))
{
if (player.Buffs.HasCustomVar(ID))
{
return true;
}
}
float.TryParse(Value, out var flValue);
if (player.Buffs.HasCustomVar(ID))
{
float numCVar = player.Buffs.GetCustomVar(ID);
if (numCVar == flValue)
{
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,28 @@
public class DialogRequirementPlayerHasItemRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
var count = 0;
if (string.IsNullOrEmpty(Value))
Value = "1";
float.TryParse(Value, out var flValue);
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
var playerInventory = uiforPlayer.xui.PlayerInventory;
var item = ItemClass.GetItem(ID);
if (item != null)
{
count = playerInventory.Backpack.GetItemCount(item, -1, -1, false);
count += playerInventory.Toolbelt.GetItemCount(item, false, -1, -1);
if (flValue <= count)
return true;
}
return false;
}
}

View File

@@ -0,0 +1,32 @@
public class DialogRequirementPlayerNotHasQuestRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
Quest newQuest = QuestClass.CreateQuest(ID);
if (newQuest == null)
return true;
if (newQuest != null)
{
QuestClass questClass = newQuest.QuestClass;
if (questClass != null)
{
for (int i = 0; i < player.QuestJournal.quests.Count; i++)
{
if (player.QuestJournal.quests[i].CurrentState == Quest.QuestState.InProgress)
{
if (player.QuestJournal.quests[i].ID.ToLower() == ID.ToLower())
{
return false;
}
}
}
return true;
}
}
return true;
}
}

View File

@@ -0,0 +1,42 @@
public class DialogRequirementPlayerNotHasCVarRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
//Log.Out("DialogRequirementPlayerNotHasCVarRebirth-CheckRequirement START, ID: " + ID);
float numCVar = player.Buffs.GetCustomVar(ID);
if (string.IsNullOrEmpty(Value))
{
//Log.Out("DialogRequirementPlayerNotHasCVarRebirth-CheckRequirement 1");
if (numCVar > 0)
{
//Log.Out("DialogRequirementPlayerNotHasCVarRebirth-CheckRequirement 2");
return false;
}
else
{
//Log.Out("DialogRequirementPlayerNotHasCVarRebirth-CheckRequirement 3");
return true;
}
}
float.TryParse(Value, out var flValue);
if (numCVar == flValue)
{
//Log.Out("DialogRequirementPlayerNotHasCVarRebirth-CheckRequirement 4");
return false;
}
else
{
//Log.Out("DialogRequirementPlayerNotHasCVarRebirth-CheckRequirement 5");
return true;
}
//Log.Out("DialogRequirementPlayerNotHasCVarRebirth-CheckRequirement 6");
return true;
}
}

View File

@@ -0,0 +1,95 @@
public class DialogRequirementQuestStatusRebirth : BaseDialogRequirement
{
public override BaseDialogRequirement.RequirementTypes RequirementType
{
get
{
return BaseDialogRequirement.RequirementTypes.QuestStatus;
}
}
public override string GetRequiredDescription(EntityPlayer player)
{
return "";
}
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
int maxJobs = RebirthVariables.customMaxJobs;
if (maxJobs == 0)
{
return false;
}
DialogRequirementQuestStatusRebirth.QuestStatuses questStatuses = EnumUtils.Parse<DialogRequirementQuestStatusRebirth.QuestStatuses>(base.Value, false);
string id = base.ID;
int numQuests = 0;
int questTier = player.QuestJournal.GetCurrentFactionTier(talkingTo.NPCInfo.QuestFaction);
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement questTier: " + questTier);
for (int i = 0; i < player.QuestJournal.quests.Count; i++)
{
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement quests[i].ID: " + player.QuestJournal.quests[i].ID);
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement quests[i].QuestClass.Name: " + player.QuestJournal.quests[i].QuestClass.Name);
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement quests[i].QuestClass.QuestType: " + player.QuestJournal.quests[i].QuestClass.QuestType);
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement quests[i].QuestClass.Difficulty: " + player.QuestJournal.quests[i].QuestClass.Difficulty);
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement quests[i].QuestClass.DifficultyTier: " + player.QuestJournal.quests[i].QuestClass.DifficultyTier);
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement quests[i].Active: " + player.QuestJournal.quests[i].Active);
bool isFromVanillaTrader = RebirthUtilities.IsVanillaTrader(player.QuestJournal.quests[i].QuestGiverID);
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement QuestGiverID: " + player.QuestJournal.quests[i].QuestGiverID);
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement isFromVanillaTrader: " + isFromVanillaTrader);
bool isOpen = isFromVanillaTrader && player.QuestJournal.quests[i].SharedOwnerID == -1 && (player.QuestJournal.quests[i].CurrentState == Quest.QuestState.NotStarted ||
player.QuestJournal.quests[i].CurrentState == Quest.QuestState.InProgress ||
player.QuestJournal.quests[i].CurrentState == Quest.QuestState.ReadyForTurnIn)
;
if (isOpen)
{
numQuests++;
}
}
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement numQuests: " + numQuests);
int numMaxQuests = 7 - (questTier + numQuests);
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement numMaxQuests: " + numMaxQuests);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient)
{
if (questTier == 1 || questTier == 2)
{
numMaxQuests = 3 - numQuests;
}
else if (questTier == 3 || questTier == 4)
{
numMaxQuests = 2 - numQuests;
}
else
{
numMaxQuests = 1 - numQuests;
}
}
//Log.Out("DialogRequirementQuestStatusRebirth-CheckRequirement numMaxQuests: " + numMaxQuests);
return (numMaxQuests > 0);
}
private enum QuestStatuses
{
NotStarted,
InProgress,
TurnInReady,
Completed,
CanReceive,
CannotReceive
}
}

View File

@@ -0,0 +1,104 @@
public class DialogRequirementShowBristonSpecialMissionsRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
int numEntries = 0;
int level = player.Progression.GetLevel();
//Log.Out("ShowBristonSpecialMissionsRebirth-CheckRequirement level: " + level);
// SILENCER
float numSilencerSchematicUnlocked = -1;
if (player.Buffs.HasCustomVar("$FuriousRamsaySilencerSchematicUnlocked"))
{
//Log.Out("ShowBristonSpecialMissionsRebirth-CheckRequirement 1a");
numSilencerSchematicUnlocked = player.Buffs.GetCustomVar("$FuriousRamsaySilencerSchematicUnlocked");
}
else
{
//Log.Out("ShowBristonSpecialMissionsRebirth-CheckRequirement 1b");
numSilencerSchematicUnlocked = 0;
}
if (numSilencerSchematicUnlocked == 0 && !HasActiveQuest(player, "quest_FuriousRamsayEventNanos") && level >= 30)
{
//Log.Out("ShowBristonSpecialMissionsRebirth-CheckRequirement 1c");
numEntries++;
}
//ZOMBIE PUTTY
float numBrownPasteSchematicUnlocked = -1;
if (player.Buffs.HasCustomVar("$FuriousRamsayBrownPasteSchematicUnlocked"))
{
//Log.Out("ShowBristonSpecialMissionsRebirth-CheckRequirement 2a");
numBrownPasteSchematicUnlocked = player.Buffs.GetCustomVar("$FuriousRamsayBrownPasteSchematicUnlocked");
}
else
{
//Log.Out("ShowBristonSpecialMissionsRebirth-CheckRequirement 2b");
numBrownPasteSchematicUnlocked = 0;
}
if (numBrownPasteSchematicUnlocked == 0 && !HasActiveQuest(player, "quest_FuriousRamsayMissionBrownPaste") && level >= 20)
{
//Log.Out("ShowBristonSpecialMissionsRebirth-CheckRequirement 2c");
numEntries++;
}
// AMMO MACHINE
float numAmmoMachineSchematicUnlocked = -1;
if (player.Buffs.HasCustomVar("$FuriousRamsaySilencerSchematicUnlocked"))
{
//Log.Out("ShowBristonSpecialMissionsRebirth-CheckRequirement 3a");
numAmmoMachineSchematicUnlocked = player.Buffs.GetCustomVar("$FuriousRamsayAmmoMachineSchematicUnlocked");
}
else
{
//Log.Out("ShowBristonSpecialMissionsRebirth-CheckRequirement 3b");
numAmmoMachineSchematicUnlocked = 0;
}
if (numAmmoMachineSchematicUnlocked == 0 && !HasActiveQuest(player, "quest_FuriousRamsayMissionAmmoMachine") && level >= 50)
{
//Log.Out("ShowBristonSpecialMissionsRebirth-CheckRequirement 3c");
numEntries++;
}
//Log.Out("ShowBristonSpecialMissionsRebirth-CheckRequirement numEntries: " + numEntries);
if (numEntries > 0)
{
return true;
}
return false;
}
public bool HasActiveQuest(EntityPlayer player, string QuestID)
{
Quest newQuest = QuestClass.CreateQuest(QuestID);
if (newQuest == null)
{
return false;
}
if (newQuest != null)
{
QuestClass questClass = newQuest.QuestClass;
if (questClass != null)
{
for (int i = 0; i < player.QuestJournal.quests.Count; i++)
{
if (player.QuestJournal.quests[i].CurrentState == Quest.QuestState.InProgress)
{
if (player.QuestJournal.quests[i].ID.ToLower() == QuestID.ToLower())
{
GameManager.ShowTooltip((EntityPlayerLocal)player, Localization.Get("ttAlreadyHaveActiveQuest"));
return true;
}
}
}
}
}
return false;
}
}

View File

@@ -0,0 +1,73 @@
public class DialogRequirementShowFarmerSpecialMissionsRebirth : BaseDialogRequirement
{
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
int numEntries = 0;
int level = player.Progression.GetLevel();
//Log.Out("ShowFarmerSpecialMissionsRebirth-CheckRequirement level: " + level);
//CHICKEN COOP
float numChickenCoopSchematicUnlocked = -1;
if (player.Buffs.HasCustomVar("$FuriousRamsayChickenCoopSchematicUnlocked"))
{
//Log.Out("ShowFarmerSpecialMissionsRebirth-CheckRequirement 2a");
numChickenCoopSchematicUnlocked = player.Buffs.GetCustomVar("$FuriousRamsayChickenCoopSchematicUnlocked");
}
else
{
//Log.Out("ShowFarmerSpecialMissionsRebirth-CheckRequirement 2b");
numChickenCoopSchematicUnlocked = 0;
}
float flAchievementFarmerTraderLevel = RebirthUtilities.GetPerkLevel(player, "FuriousRamsayAchievementFarmerTrader");
if (numChickenCoopSchematicUnlocked == 0 &&
!HasActiveQuest(player, "quest_FuriousRamsayMissionChickenCoop") &&
flAchievementFarmerTraderLevel == 1)
{
//Log.Out("ShowFarmerSpecialMissionsRebirth-CheckRequirement 2c");
numEntries++;
}
if (numEntries > 0)
{
return true;
}
//Log.Out("ShowFarmerSpecialMissionsRebirth-CheckRequirement numEntries: " + numEntries);
return false;
}
public bool HasActiveQuest(EntityPlayer player, string QuestID)
{
Quest newQuest = QuestClass.CreateQuest(QuestID);
if (newQuest == null)
{
return false;
}
if (newQuest != null)
{
QuestClass questClass = newQuest.QuestClass;
if (questClass != null)
{
for (int i = 0; i < player.QuestJournal.quests.Count; i++)
{
if (player.QuestJournal.quests[i].CurrentState == Quest.QuestState.InProgress)
{
if (player.QuestJournal.quests[i].ID.ToLower() == QuestID.ToLower())
{
GameManager.ShowTooltip((EntityPlayerLocal)player, Localization.Get("ttAlreadyHaveActiveQuest"));
return true;
}
}
}
}
}
return false;
}
}

View File

@@ -0,0 +1,33 @@
using UnityEngine.Scripting;
[Preserve]
public class DialogRequirementSkillRebirth : BaseDialogRequirement
{
public override BaseDialogRequirement.RequirementTypes RequirementType
{
get
{
return BaseDialogRequirement.RequirementTypes.Skill;
}
}
public override string GetRequiredDescription(EntityPlayer player)
{
ProgressionValue progressionValue = player.Progression.GetProgressionValue(base.ID);
return string.Format("({0} {1})", Localization.Get(progressionValue.ProgressionClass.NameKey), Convert.ToInt32(base.Value));
}
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
{
//Log.Out("DialogRequirementSkillRebirth-CheckRequirement base.ID: " + base.ID);
//Log.Out("DialogRequirementSkillRebirth-CheckRequirement base.Value: " + base.Value);
bool result = false;
result = player.Progression.GetProgressionValue(base.ID).calculatedLevel == Convert.ToInt32(base.Value);
//Log.Out("DialogRequirementSkillRebirth-CheckRequirement result: " + result);
return result;
}
}

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

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

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

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

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

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

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

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

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

View File

@@ -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;
}
}

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

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

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

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