/// <summary> /// Find out how nStandardFaction feels about oCreature. /// - nStandardFaction: STANDARD_FACTION_* /// - oCreature /// Returns -1 on an error. /// Returns 0-100 based on the standing of oCreature within the faction nStandardFaction. /// 0-10 : Hostile. /// 11-89 : Neutral. /// 90-100 : Friendly. /// </summary> public static int GetStandardFactionReputation(StandardFaction nStandardFaction, uint oCreature = Core.NWScript.NWScript.OBJECT_INVALID) { Internal.NativeFunctions.StackPushObject(oCreature); Internal.NativeFunctions.StackPushInteger((int)nStandardFaction); Internal.NativeFunctions.CallBuiltIn(524); return(Internal.NativeFunctions.StackPopInteger()); }
/// <summary> /// Set how nStandardFaction feels about oCreature. /// - nStandardFaction: STANDARD_FACTION_* /// - nNewReputation: 0-100 (inclusive) /// - oCreature /// </summary> public static void SetStandardFactionReputation(StandardFaction nStandardFaction, int nNewReputation, uint oCreature = Core.NWScript.NWScript.OBJECT_INVALID) { Internal.NativeFunctions.StackPushObject(oCreature); Internal.NativeFunctions.StackPushInteger(nNewReputation); Internal.NativeFunctions.StackPushInteger((int)nStandardFaction); Internal.NativeFunctions.CallBuiltIn(523); }
/// <summary> /// Resolves a <see cref="NwFaction"/> from a <see cref="StandardFaction"/>. /// </summary> /// <param name="factionType">The faction type to resolve.</param> /// <returns>The associated <see cref="NwFaction"/> instance. Null if the faction type is invalid.</returns> public static NwFaction?FromStandardFaction(StandardFaction factionType) { return(FromFactionId((int)factionType)); }
/// <summary> /// Sets how this standard faction feels about the specified creature.<br/> /// -> 0-10 means this faction is hostile to the target.<br/> /// -> 11-89 means this faction is neutral to the target.<br/> /// -> 90-100 means this faction is friendly to the target. /// </summary> /// <param name="faction">The source faction.</param> /// <param name="target">The target object.</param> /// <param name="newReputation">A value between 0-100 (inclusive).</param> public static void SetReputation(this StandardFaction faction, NwGameObject target, int newReputation) => NWScript.SetStandardFactionReputation((int)faction, newReputation, target);
/// <summary> /// Gets an integer between 0 and 100 (inclusive) that represents how this faction feels about the specified target.<br/> /// -> 0-10 means this faction is hostile to the target<br/> /// -> 11-89 means this faction is neutral to the target<br/> /// -> 90-100 means this faction is friendly to the target. /// </summary> /// <param name="faction">The source faction.</param> /// <param name="target">The target object.</param> /// <returns>0-100 (inclusive) based on the standing of the target within this standard faction.</returns> public static int GetReputation(this StandardFaction faction, NwGameObject target) => NWScript.GetStandardFactionReputation((int)faction, target);
/// <summary> /// Make oCreatureToChange join one of the standard factions. /// ** This will only work on an NPC ** /// - nStandardFaction: STANDARD_FACTION_* /// </summary> public static void ChangeToStandardFaction(uint oCreatureToChange, StandardFaction nStandardFaction) { Internal.NativeFunctions.StackPushInteger((int)nStandardFaction); Internal.NativeFunctions.StackPushObject(oCreatureToChange); Internal.NativeFunctions.CallBuiltIn(412); }