public static bool CheckFaction(int EntityID, EntityAlive entity) { bool result = false; EntityAlive myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive; if (myEntity == null) { return(result); } // same faction if (myEntity.factionId == entity.factionId) { return(true); } FactionManager.Relationship myRelationship = FactionManager.Instance.GetRelationshipTier(myEntity, entity); DisplayLog(" CheckFactionForEnemy: " + myRelationship.ToString()); if (myRelationship == FactionManager.Relationship.Hate) { DisplayLog(" I hate this entity: " + entity.ToString()); return(false); } else { DisplayLog(" My relationship with this " + entity.ToString() + " is: " + myRelationship.ToString()); result = true; } return(false); }
public bool CheckFactionForEnemy(EntityAlive Entity) { FactionManager.Relationship myRelationship = FactionManager.Instance.GetRelationshipTier(this.theEntity, Entity); DisplayLog(" CheckFactionForEnemy: " + myRelationship.ToString()); if (myRelationship == FactionManager.Relationship.Hate) { DisplayLog(" I hate this entity: " + Entity.ToString()); return(true); } else { DisplayLog(" My relationship with this " + Entity.ToString() + " is: " + myRelationship.ToString()); } return(false); }
// <requirement type="Faction, Mods" requirementtype="Hide" value="neutral" /> public override bool CheckRequirement(EntityPlayer player) { int entityID = 0; if (player.Buffs.HasCustomVar("CurrentNPC")) { entityID = (int)player.Buffs.GetCustomVar("CurrentNPC"); } EntityAlive myEntity = player.world.GetEntity(entityID) as EntityAlive; if (myEntity != null) { FactionManager.Relationship myRelationship = FactionManager.Instance.GetRelationshipTier(myEntity, player); if (myRelationship.ToString().ToLower() == ID.ToLower()) { return(true); } } return(false); }
public static bool Postfix(bool __result, EAISetNearestEntityAsTarget __instance) { // Check if we have any target in mind. EntityAlive targetEntity = __instance.targetEntity; if (targetEntity == null) { DisplayLog("No Target Entity", __instance.theEntity); return(__result); } DisplayLog("Postfix for CanExecute()", __instance.theEntity); // If we have a target, check if they are our leader, so we can forgive them. if (__result) { DisplayLog("Checking for Leader", __instance.theEntity); // If the Revenge Target is your leader, then forgive them? Entity myLeader = EntityUtilities.GetLeaderOrOwner(__instance.theEntity.entityId); if (myLeader) { DisplayLog("Leader Found " + myLeader.entityId + ", checking ID", __instance.theEntity); if (targetEntity.entityId == myLeader.entityId) { __result = false; } } } // If we are still intent on attacking this target, check its faction, and see if we can forgive them. // If they don't really like them, it doesn't mean they want to kill them. if (__result) { DisplayLog("Checking Relationship with " + targetEntity.entityId, __instance.theEntity); FactionManager.Relationship myRelationship = FactionManager.Instance.GetRelationshipTier(__instance.theEntity, targetEntity); if (myRelationship != FactionManager.Relationship.Hate) { __result = false; } DisplayLog("\tMRelationship with " + targetEntity.entityId + " is " + myRelationship.ToString(), __instance.theEntity); } DisplayLog("CanExecute(): " + __result, __instance.theEntity); return(__result); }