public static bool Check(int index, int type) { using (new Profiler(nameof(KeyItemCheck))) { NWPlayer player = _.GetPCSpeaker(); NWObject talkingTo = _.OBJECT_SELF; int count = 1; List <int> requiredKeyItemIDs = new List <int>(); int keyItemID = talkingTo.GetLocalInt($"KEY_ITEM_{index}_REQ_{count}"); while (keyItemID > 0) { requiredKeyItemIDs.Add(keyItemID); count++; keyItemID = talkingTo.GetLocalInt($"KEY_ITEM_{index}_REQ_{count}"); } // Type 1 = ALL // Anything else = ANY return(type == 1 ? KeyItemService.PlayerHasAllKeyItems(player, requiredKeyItemIDs.ToArray()) : KeyItemService.PlayerHasAnyKeyItem(player, requiredKeyItemIDs.ToArray())); } }
public static bool Check(params object[] args) { using (new Profiler(nameof(QuestCollectItem))) { using (new Profiler(nameof(QuestCanAccept))) { int index = (int)args[0]; NWPlayer player = _.GetPCSpeaker(); NWObject talkTo = Object.OBJECT_SELF; int questID = talkTo.GetLocalInt("QUEST_ID_" + index); if (questID <= 0) { questID = talkTo.GetLocalInt("QST_ID_" + index); } if (DataService.GetAll <Data.Entity.Quest>().All(x => x.ID != questID)) { _.SpeakString("ERROR: Quest #" + index + " is improperly configured. Please notify an admin"); return(false); } QuestService.RequestItemsFromPC(player, talkTo, questID); return(true); } } }
public static bool Check(params object[] args) { using (new Profiler(nameof(QuestIsDone))) { int index = (int)args[0]; NWPlayer player = _.GetPCSpeaker(); NWObject talkingTo = NWGameObject.OBJECT_SELF; int questID = talkingTo.GetLocalInt("QUEST_ID_" + index); if (questID <= 0) { questID = talkingTo.GetLocalInt("QST_ID_" + index); } if (!DataService.Quest.ExistsByID(questID)) { _.SpeakString("ERROR: Quest #" + index + " is improperly configured. Please notify an admin"); return(false); } var status = DataService.PCQuestStatus.GetByPlayerAndQuestIDOrDefault(player.GlobalID, questID); if (status == null) { return(false); } var currentQuestState = DataService.QuestState.GetByID(status.CurrentQuestStateID); var states = DataService.QuestState.GetAllByQuestID(currentQuestState.QuestID); return(currentQuestState.ID == states.OrderBy(o => o.Sequence).Last().ID&& status.CompletionDate != null); } }
public static bool Check(params object[] args) { using (new Profiler(nameof(QuestCanAccept))) { int index = (int)args[0]; NWPlayer player = _.GetPCSpeaker(); NWObject talkTo = _.OBJECT_SELF; int questID = talkTo.GetLocalInt("QUEST_ID_" + index); if (questID <= 0) { questID = talkTo.GetLocalInt("QST_ID_" + index); } if (!QuestService.QuestExistsByID(questID)) { _.SpeakString("ERROR: Quest #" + index + " is improperly configured. Please notify an admin"); return(false); } var quest = QuestService.GetQuestByID(questID); quest.Advance(player, talkTo); } return(true); }
public static bool Check(params object[] args) { using (new Profiler(nameof(QuestIsDone))) { int index = (int)args[0]; NWPlayer player = _.GetPCSpeaker(); NWObject talkingTo = Object.OBJECT_SELF; int questID = talkingTo.GetLocalInt("QUEST_ID_" + index); if (questID <= 0) { questID = talkingTo.GetLocalInt("QST_ID_" + index); } if (DataService.GetAll <Data.Entity.Quest>().All(x => x.ID != questID)) { _.SpeakString("ERROR: Quest #" + index + " is improperly configured. Please notify an admin"); return(false); } var status = DataService.SingleOrDefault <PCQuestStatus>(x => x.PlayerID == player.GlobalID && x.QuestID == questID); if (status == null) { return(false); } var currentQuestState = DataService.Get <QuestState>(status.CurrentQuestStateID); var quest = DataService.Get <Data.Entity.Quest>(currentQuestState.QuestID); var states = DataService.Where <QuestState>(x => x.QuestID == quest.ID); return(currentQuestState.ID == states.OrderBy(o => o.Sequence).Last().ID&& status.CompletionDate != null); } }
public string IsValidTarget(NWCreature user, NWItem item, NWObject target, Location targetLocation) { if (!target.IsValid) { return("Please select a target to harvest."); } int qualityID = target.GetLocalInt("RESOURCE_QUALITY"); if (qualityID <= 0) { return("You cannot harvest that object."); } NWPlayer player = (user.Object); ResourceQuality quality = (ResourceQuality)qualityID; int tier = target.GetLocalInt("RESOURCE_TIER"); int rank = SkillService.GetPCSkillRank(player, SkillType.Harvesting); int difficulty = (tier - 1) * 10 + ResourceService.GetDifficultyAdjustment(quality); int delta = difficulty - rank; if (delta >= 5) { return("Your Harvesting skill rank is too low to harvest this resource."); } return(null); }
public bool Run(params object[] args) { int index = (int)args[0]; int state = (int)args[1]; NWPlayer player = _.GetPCSpeaker(); NWObject talkTo = Object.OBJECT_SELF; int questID = talkTo.GetLocalInt("QUEST_ID_" + index); if (questID <= 0) { questID = talkTo.GetLocalInt("QST_ID_" + index); } if (_data.GetAll <Quest>().All(x => x.ID != questID)) { _.SpeakString("ERROR: Quest #" + index + " State #" + state + " is improperly configured. Please notify an admin"); return(false); } var status = _data.SingleOrDefault <PCQuestStatus>(x => x.PlayerID == player.GlobalID && x.QuestID == questID); if (status == null) { return(false); } var questState = _data.Get <QuestState>(status.CurrentQuestStateID); bool has = questState.Sequence == state && status.CompletionDate == null; return(has); }
public static bool Check(params object[] args) { using (new Profiler(nameof(QuestCheckState))) { int index = (int)args[0]; int state = (int)args[1]; NWPlayer player = _.GetPCSpeaker(); NWObject talkTo = _.OBJECT_SELF; int questID = talkTo.GetLocalInt("QUEST_ID_" + index); if (questID <= 0) { questID = talkTo.GetLocalInt("QST_ID_" + index); } if (!QuestService.QuestExistsByID(questID)) { _.SpeakString("ERROR: Quest #" + index + " State #" + state + " is improperly configured. Please notify an admin"); return(false); } var status = DataService.PCQuestStatus.GetByPlayerAndQuestIDOrDefault(player.GlobalID, questID); if (status == null) { return(false); } bool has = status.QuestState == state && status.CompletionDate == null; return(has); } }
public override void Initialize() { NWObject door = NWGameObject.OBJECT_SELF; NWPlayer player = GetPC(); List <int> keyItemIDs = new List <int>(); int count = 1; int keyItemID = door.GetLocalInt("REQUIRED_KEY_ITEM_ID_" + count); while (keyItemID > 0) { keyItemIDs.Add(keyItemID); count++; keyItemID = door.GetLocalInt("REQUIRED_KEY_ITEM_ID_" + count); } bool hasKeyItems = KeyItemService.PlayerHasAllKeyItems(player, keyItemIDs.ToArray()); string doorDialogue = door.GetLocalString("DOOR_DIALOGUE"); if (!string.IsNullOrWhiteSpace(doorDialogue)) { SetPageHeader("MainPage", doorDialogue); } if (hasKeyItems) { SetResponseText("MainPage", 1, "Open Door"); } else { SetResponseVisible("MainPage", 1, false); } }
public bool Run(params object[] args) { int index = (int)args[0]; int type = (int)args[1]; NWPlayer player = _.GetPCSpeaker(); NWObject talkingTo = Object.OBJECT_SELF; int count = 1; List <int> requiredKeyItemIDs = new List <int>(); int keyItemID = talkingTo.GetLocalInt($"KEY_ITEM_{index}_REQ_{count}"); while (keyItemID > 0) { requiredKeyItemIDs.Add(keyItemID); count++; keyItemID = talkingTo.GetLocalInt($"KEY_ITEM_{index}_REQ_{count}"); } // Type 1 = ALL // Anything else = ANY return(type == 1 ? _keyItem.PlayerHasAllKeyItems(player, requiredKeyItemIDs.ToArray()) : _keyItem.PlayerHasAnyKeyItem(player, requiredKeyItemIDs.ToArray())); }
public bool Run(params object[] args) { int index = (int)args[0]; int customRuleIndex = (int)args[1]; NWPlayer player = _.GetPCSpeaker(); NWObject talkTo = Object.OBJECT_SELF; int questID = talkTo.GetLocalInt("QUEST_ID_" + index); if (questID <= 0) { questID = talkTo.GetLocalInt("QST_ID_" + index); } if (_data.GetAll <Quest>().All(x => x.ID != questID)) { _.SpeakString("ERROR: Quest #" + index + " is improperly configured. Please notify an admin"); return(false); } string rule = string.Empty; string ruleArgs = string.Empty; if (customRuleIndex > 0) { string ruleName = "QUEST_ID_" + index + "_RULE_" + customRuleIndex; rule = talkTo.GetLocalString(ruleName); ruleArgs = talkTo.GetLocalString("QUEST_ID_" + index + "_RULE_ARGS_" + customRuleIndex); if (string.IsNullOrWhiteSpace(rule)) { _.SpeakString("ERROR: Quest #" + index + ", rule #" + customRuleIndex + " is improperly configured. Please notify an admin."); return(false); } } _quest.CompleteQuest(player, talkTo, questID, null); if (!string.IsNullOrWhiteSpace(rule)) { Quest quest = _data.Single <Quest>(x => x.ID == questID); App.ResolveByInterface <IQuestRule>("QuestRule." + rule, ruleAction => { string[] argsArray = null; if (string.IsNullOrWhiteSpace(ruleArgs)) { ruleArgs = quest.OnCompleteArgs; } if (!string.IsNullOrWhiteSpace(ruleArgs)) { argsArray = ruleArgs.Split(','); } ruleAction.Run(player, talkTo, questID, argsArray); }); } return(true); }
public static bool Check(int index, int customRuleIndex) { using (new Profiler(nameof(QuestComplete) + ".Index" + index + ".Rule" + customRuleIndex)) { NWPlayer player = _.GetPCSpeaker(); NWObject talkTo = NWGameObject.OBJECT_SELF; int questID = talkTo.GetLocalInt("QUEST_ID_" + index); if (questID <= 0) { questID = talkTo.GetLocalInt("QST_ID_" + index); } if (!DataService.Quest.ExistsByID(questID)) { _.SpeakString("ERROR: Quest #" + index + " is improperly configured. Please notify an admin"); return(false); } string rule = string.Empty; string ruleArgs = string.Empty; if (customRuleIndex > 0) { string ruleName = "QUEST_ID_" + index + "_RULE_" + customRuleIndex; rule = talkTo.GetLocalString(ruleName); ruleArgs = talkTo.GetLocalString("QUEST_ID_" + index + "_RULE_ARGS_" + customRuleIndex); if (string.IsNullOrWhiteSpace(rule)) { _.SpeakString("ERROR: Quest #" + index + ", rule #" + customRuleIndex + " is improperly configured. Please notify an admin."); return(false); } } QuestService.CompleteQuest(player, talkTo, questID, null); if (!string.IsNullOrWhiteSpace(rule)) { Data.Entity.Quest quest = DataService.Quest.GetByID(questID); var ruleAction = QuestService.GetQuestRule(rule); string[] argsArray = null; if (string.IsNullOrWhiteSpace(ruleArgs)) { ruleArgs = quest.OnCompleteArgs; } if (!string.IsNullOrWhiteSpace(ruleArgs)) { argsArray = ruleArgs.Split(','); } ruleAction.Run(player, talkTo, questID, argsArray); } return(true); } }
private static void HandleTriggerAndPlaceableQuestLogic(NWPlayer oPC, NWObject oObject) { if (!oPC.IsPlayer) { return; } string questMessage = oObject.GetLocalString("QUEST_MESSAGE"); int questID = oObject.GetLocalInt("QUEST_ID"); int questSequence = oObject.GetLocalInt("QUEST_SEQUENCE"); string visibilityObjectID = oObject.GetLocalString("VISIBILITY_OBJECT_ID"); if (questID <= 0) { oPC.SendMessage("QUEST_ID variable not set on object. Please inform admin this quest is bugged. (QuestID: " + questID + ")"); return; } if (questSequence <= 0) { oPC.SendMessage("QUEST_SEQUENCE variable not set on object. Please inform admin this quest is bugged. (QuestID: " + questID + ")"); return; } PCQuestStatus pcQuestStatus = DataService.SingleOrDefault <PCQuestStatus>(x => x.PlayerID == oPC.GlobalID && x.QuestID == questID); if (pcQuestStatus == null) { return; } QuestState questState = DataService.Get <QuestState>(pcQuestStatus.CurrentQuestStateID); if (questState.Sequence != questSequence || (questState.QuestTypeID != (int)QuestType.UseObject && questState.QuestTypeID != (int)QuestType.ExploreArea)) { return; } if (!string.IsNullOrWhiteSpace(questMessage)) { _.DelayCommand(1.0f, () => { oPC.SendMessage(questMessage); }); } AdvanceQuestState(oPC, oObject, questID); if (!string.IsNullOrWhiteSpace(visibilityObjectID)) { ObjectVisibilityService.AdjustVisibility(oPC, oObject, false); } }
/// <summary> /// Progresses a player to the next state if they meet all requirements to do so. /// </summary> /// <param name="player">The player object</param> /// <param name="trigger">The trigger or placeable being used/entered.</param> private static void HandleTriggerAndPlaceableQuestLogic(NWPlayer player, NWObject trigger) { if (!player.IsPlayer) { return; } string questMessage = trigger.GetLocalString("QUEST_MESSAGE"); int questID = trigger.GetLocalInt("QUEST_ID"); int questState = trigger.GetLocalInt("QUEST_STATE"); string visibilityObjectID = trigger.GetLocalString("VISIBILITY_OBJECT_ID"); if (questID <= 0) { player.SendMessage("QUEST_ID variable not set on object. Please inform admin this quest is bugged. (QuestID: " + questID + ")"); return; } if (questState <= 0) { player.SendMessage("QUEST_STATE variable not set on object. Please inform admin this quest is bugged. (QuestID: " + questID + ")"); return; } PCQuestStatus pcQuestStatus = DataService.PCQuestStatus.GetByPlayerAndQuestIDOrDefault(player.GlobalID, questID); if (pcQuestStatus == null) { return; } if (pcQuestStatus.QuestState != questState) { return; } if (!string.IsNullOrWhiteSpace(questMessage)) { DelayCommand(1.0f, () => { player.SendMessage(questMessage); }); } var quest = GetQuestByID(questID); quest.Advance(player, trigger); if (!string.IsNullOrWhiteSpace(visibilityObjectID)) { ObjectVisibilityService.AdjustVisibility(player, trigger, false); } }
private void HandleTriggerAndPlaceableQuestLogic(NWPlayer oPC, NWObject oObject) { if (!oPC.IsPlayer) { return; } string questMessage = oObject.GetLocalString("QUEST_MESSAGE"); int questID = oObject.GetLocalInt("QUEST_ID"); int questSequence = oObject.GetLocalInt("QUEST_SEQUENCE"); if (questID <= 0) { oPC.SendMessage("QUEST_ID variable not set on object. Please inform admin this quest is bugged."); return; } if (questSequence <= 0) { oPC.SendMessage("QUEST_SEQUENCE variable not set on object. Please inform admin this quest is bugged. (QuestID: " + questID + ")"); return; } PCQuestStatus pcQuestStatus = _db.PCQuestStatus.Single(x => x.PlayerID == oPC.GlobalID && x.QuestID == questID); if (pcQuestStatus == null) { return; } QuestState questState = pcQuestStatus.CurrentQuestState; if (questState.Sequence == questSequence || (questState.QuestTypeID != (int)QuestType.UseObject && questState.QuestTypeID != (int)QuestType.ExploreArea)) { return; } if (!string.IsNullOrWhiteSpace(questMessage)) { oPC.DelayCommand(() => { oPC.SendMessage(questMessage); }, 1.0f); } AdvanceQuestState(oPC, questID); }
public void OnConcentrationTick(NWCreature creature, NWObject target, int spellTier, int tick) { int amount; switch (spellTier) { case 1: amount = 5; break; case 2: amount = 6; break; case 3: amount = 7; break; case 4: amount = 8; break; case 5: amount = 10; break; default: throw new ArgumentOutOfRangeException(nameof(spellTier)); } var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Dark); // +/- percent change based on resistance float delta = 0.01f * result.Delta; amount = amount + (int)(amount * delta); if (target.GetLocalInt("FORCE_DRAIN_IMMUNITY") == 1) { amount = 0; } creature.AssignCommand(() => { _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(amount, DamageType.Negative), target); }); // Only apply a heal if caster is not at max HP. Otherwise they'll get unnecessary spam. if (creature.CurrentHP < creature.MaxHP) { _.ApplyEffectToObject(DurationType.Instant, _.EffectHeal(amount), creature); } if (creature.IsPlayer) { SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter); } _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Com_Hit_Negative), target); }
public void CopyVariables(NWObject oSource, NWObject oCopy) { int variableCount = _nwnxObject.GetLocalVariableCount(oSource); for (int variableIndex = 0; variableIndex < variableCount - 1; variableIndex++) { LocalVariable stCurVar = _nwnxObject.GetLocalVariable(oSource, variableIndex); switch (stCurVar.Type) { case LocalVariableType.Int: oCopy.SetLocalInt(stCurVar.Key, oSource.GetLocalInt(stCurVar.Key)); break; case LocalVariableType.Float: oCopy.SetLocalFloat(stCurVar.Key, oSource.GetLocalFloat(stCurVar.Key)); break; case LocalVariableType.String: oCopy.SetLocalString(stCurVar.Key, oSource.GetLocalString(stCurVar.Key)); break; case LocalVariableType.Object: oCopy.SetLocalObject(stCurVar.Key, oSource.GetLocalObject(stCurVar.Key)); break; case LocalVariableType.Location: oCopy.SetLocalLocation(stCurVar.Key, oSource.GetLocalLocation(stCurVar.Key)); break; } } }
private void HandleRecoveryBlast() { DamageData data = _nwnxDamage.GetDamageEventData(); NWObject damager = data.Damager; bool isActive = damager.GetLocalInt("RECOVERY_BLAST_ACTIVE") == TRUE; damager.DeleteLocalInt("RECOVERY_BLAST_ACTIVE"); NWItem weapon = _.GetLastWeaponUsed(damager.Object); if (!isActive || weapon.CustomItemType != CustomItemType.BlasterRifle) { return; } data.Bludgeoning = 0; data.Pierce = 0; data.Slash = 0; data.Magical = 0; data.Acid = 0; data.Cold = 0; data.Divine = 0; data.Electrical = 0; data.Fire = 0; data.Negative = 0; data.Positive = 0; data.Sonic = 0; data.Base = 0; _nwnxDamage.SetDamageEventData(data); }
private void HandleTranquilizerEffect() { DamageData data = _nwnxDamage.GetDamageEventData(); if (data.Total <= 0) { return; } NWObject self = Object.OBJECT_SELF; // Ignore the first damage because it occurred during the application of the effect. if (self.GetLocalInt("TRANQUILIZER_EFFECT_FIRST_RUN") > 0) { self.DeleteLocalInt("TRANQUILIZER_EFFECT_FIRST_RUN"); return; } for (Effect effect = _.GetFirstEffect(self.Object); _.GetIsEffectValid(effect) == TRUE; effect = _.GetNextEffect(self.Object)) { if (_.GetEffectTag(effect) == "TRANQUILIZER_EFFECT") { _.RemoveEffect(self, effect); } } }
public static int GetWindStrength(NWObject oArea) { //-------------------------------------------------------------------------- // Areas will have one of the CLIMATE_* values stored in each weather var. //-------------------------------------------------------------------------- NWObject oMod = _.GetModule(); int nWind = oMod.GetLocalInt(VAR_WEATHER_WIND); if (oArea.IsValid) { nWind += oArea.GetLocalInt(VAR_WEATHER_WIND); nWind += _GetClimate(oArea).Wind_Modifier; //---------------------------------------------------------------------- // Automatic cover bonus for artificial areas such as cities (lots of // buildings). //---------------------------------------------------------------------- if (_.GetIsAreaNatural(oArea) == 0) { nWind -= 1; } } if (nWind > 10) { nWind = 10; } if (nWind < 1) { nWind = 1; } return(nWind); }
public static int GetHeatIndex(NWObject oArea) { //-------------------------------------------------------------------------- // Areas may have one of the CLIMATE_* values stored in each weather var. //-------------------------------------------------------------------------- NWObject oMod = _.GetModule(); int nHeat = oMod.GetLocalInt(VAR_WEATHER_HEAT); if (oArea.IsValid) { nHeat += oArea.GetLocalInt(VAR_WEATHER_HEAT); nHeat += _GetClimate(oArea).Heat_Modifier; } nHeat = (_.GetIsNight() == 1) ? nHeat - 2 : nHeat + 2; if (nHeat > 10) { nHeat = 10; } if (nHeat < 1) { nHeat = 1; } return(nHeat); }
public static int GetHumidity(NWObject oArea) { //-------------------------------------------------------------------------- // Areas may have one of the CLIMATE_* values stored in each weather var. //-------------------------------------------------------------------------- NWObject oMod = _.GetModule(); int nHumidity = oMod.GetLocalInt(VAR_WEATHER_HUMIDITY); if (oArea.IsValid) { nHumidity += oArea.GetLocalInt(VAR_WEATHER_HUMIDITY); nHumidity += _GetClimate(oArea).Humidity_Modifier; } if (nHumidity > 10) { nHumidity = 10; } if (nHumidity < 1) { nHumidity = 1; } return(nHumidity); }
private static void OnStoreOpened() { NWObject store = Object.OBJECT_SELF; int playersAccessing = store.GetLocalInt("STORE_SERVICE_PLAYERS_ACCESSING") + 1; store.SetLocalInt("STORE_SERVICE_PLAYERS_ACCESSING", playersAccessing); }
private void HandleRecoveryBlast() { DamageData data = _nwnxDamage.GetDamageEventData(); NWObject damager = data.Damager; bool isActive = damager.GetLocalInt("RECOVERY_BLAST_ACTIVE") == TRUE; if (!isActive) { return; } data.Bludgeoning = 0; data.Pierce = 0; data.Slash = 0; data.Magical = 0; data.Acid = 0; data.Cold = 0; data.Divine = 0; data.Electrical = 0; data.Fire = 0; data.Negative = 0; data.Positive = 0; data.Sonic = 0; data.Base = 0; _nwnxDamage.SetDamageEventData(data); }
private void ApplyEffect(NWCreature creature, NWObject target, int spellTier) { Effect effectMindShield; // Handle effects for differing spellTier values switch (spellTier) { case 1: effectMindShield = _.EffectImmunity(ImmunityType.Dazed); creature.AssignCommand(() => { _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f); }); break; case 2: effectMindShield = _.EffectImmunity(ImmunityType.Dazed); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Confused)); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Dominate)); // Force Pursuade is DOMINATION effect creature.AssignCommand(() => { _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f); }); break; case 3: effectMindShield = _.EffectImmunity(ImmunityType.Dazed); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Confused)); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Dominate)); // Force Pursuade is DOMINATION effect if (target.GetLocalInt("FORCE_DRAIN_IMMUNITY") == 1) { creature.SetLocalInt("FORCE_DRAIN_IMMUNITY", 0); } creature.DelayAssignCommand(() => { creature.DeleteLocalInt("FORCE_DRAIN_IMMUNITY"); }, 6.1f); creature.AssignCommand(() => { _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f); }); break; default: throw new ArgumentOutOfRangeException(nameof(spellTier)); } // Play VFX _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Dur_Mind_Affecting_Positive), target); if (creature.IsPlayer) { SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceControl, null); } }
public bool Run(params object[] args) { int index = (int)args[0]; string method = (string)args[1]; NWPlayer player = _.GetPCSpeaker(); NWObject talkTo = Object.OBJECT_SELF; int count = 1; string varName = "SKILL_" + index + "_REQ_"; int skillID = talkTo.GetLocalInt(varName + count); bool displayNode = true; while (skillID > 0) { int requiredLevel = talkTo.GetLocalInt(varName + "LEVEL_" + count); bool meetsRequirement = _skill.GetPCSkillRank(player, skillID) >= requiredLevel; // OR = Any one of the listed skills can be met and the node will appear. if (method == "OR") { if (meetsRequirement) { return(true); } else { displayNode = false; } } // AND = ALL listed skills must be met in order for the node to appear. else { if (!meetsRequirement) { return(false); } } count++; skillID = talkTo.GetLocalInt(varName + count); } return(displayNode); }
private bool CanHarvest() { NWObject target = (GetPC().GetLocalObject("SHOVEL_TARGET_OBJECT")); return(target.IsValid && target.GetLocalInt("GROWING_PLANT_ID") > 0 && _.GetDistanceBetween(GetPC().Object, target.Object) <= 2.0f); }
public string OnModuleExamine(string existingDescription, NWPlayer examiner, NWObject examinedObject) { if (!examiner.IsPlayer && !examiner.IsDM) { return(existingDescription); } if (examinedObject.ObjectType != OBJECT_TYPE_ITEM) { return(existingDescription); } int perkID = examinedObject.GetLocalInt("ACTIVATION_PERK_ID"); if (perkID <= 0) { return(existingDescription); } Data.Entities.Perk perk = _db.Perks.Single(x => x.PerkID == perkID); string description = existingDescription; description += _color.Orange("Name: ") + perk.Name + "\n" + _color.Orange("Description: ") + perk.Description + "\n"; switch ((PerkExecutionType)perk.PerkExecutionType.PerkExecutionTypeID) { case PerkExecutionType.CombatAbility: description += _color.Orange("Type: ") + "Combat Ability\n"; break; case PerkExecutionType.Spell: description += _color.Orange("Type: ") + "Spell\n"; break; case PerkExecutionType.ShieldOnHit: description += _color.Orange("Type: ") + "Reactive\n"; break; case PerkExecutionType.QueuedWeaponSkill: description += _color.Orange("Type: ") + "Queued Attack\n"; break; } if (perk.BaseManaCost > 0) { description += _color.Orange("Base Mana Cost: ") + perk.BaseManaCost + "\n"; } if (perk.CooldownCategory.BaseCooldownTime > 0.0f) { description += _color.Orange("Cooldown: ") + perk.CooldownCategory.BaseCooldownTime + "s\n"; } if (perk.BaseCastingTime > 0.0f) { description += _color.Orange("Base Casting Time: ") + perk.BaseCastingTime + "s\n"; } return(description); }
public static bool Check(int index, string method) { using (new Profiler(nameof(HasSkillRank))) { NWPlayer player = _.GetPCSpeaker(); NWObject talkTo = _.OBJECT_SELF; int count = 1; string varName = "SKILL_" + index + "_REQ_"; int skillID = talkTo.GetLocalInt(varName + count); bool displayNode = true; while (skillID > 0) { int requiredLevel = talkTo.GetLocalInt(varName + "LEVEL_" + count); bool meetsRequirement = SkillService.GetPCSkillRank(player, skillID) >= requiredLevel; // OR = Any one of the listed skills can be met and the node will appear. if (method == "OR") { if (meetsRequirement) { return(true); } else { displayNode = false; } } // AND = ALL listed skills must be met in order for the node to appear. else { if (!meetsRequirement) { return(false); } } count++; skillID = talkTo.GetLocalInt(varName + count); } return(displayNode); } }
private void LoadDestinations() { NWObject terminal = GetDialogTarget(); int currentLocation = terminal.GetLocalInt("CURRENT_LOCATION"); ClearPageResponses("MainPage"); AddResponseToPage("MainPage", "Viscara", currentLocation != (int)Planet.Viscara); AddResponseToPage("MainPage", "Mon Cala", currentLocation != (int)Planet.MonCala); }