Beispiel #1
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            user.SetLocalObject("PERK_REFUND_OBJECT", item.Object);
            user.ClearAllActions();

            _dialog.StartConversation(user, user, "PerkRefund");
        }
Beispiel #2
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            user.SetLocalObject("XP_TOME_OBJECT", item.Object);
            user.ClearAllActions();

            _dialog.StartConversation(user, user, "XPTome");
        }
Beispiel #3
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            user.SetLocalObject("ITEM_BEING_RENAMED", item);
            string conversation = item.GetLocalString("CONVERSATION");

            DialogService.StartConversation((NWPlayer)user, user, conversation);
        }
Beispiel #4
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            NWArea area            = user.Area;
            bool   farmingDisabled = area.GetLocalInt("FARMING_DISABLED") == 1;

            if (farmingDisabled)
            {
                user.SendMessage("You cannot dig a hole in this area.");
                return;
            }

            user.SetLocalObject("SHOVEL_ITEM", item.Object);
            user.SetLocalLocation("SHOVEL_TARGET_LOCATION", targetLocation);
            user.SetLocalObject("SHOVEL_TARGET_OBJECT", target.Object);
            user.ClearAllActions();
            _dialog.StartConversation(user, user, "Shovel");
        }
Beispiel #5
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            if (item.Tag == "PazaakCard" && target.Tag == "PazaakCollection")
            {
                user.ClearAllActions(); // In case they are in the manage collection dialog, avoid conflicts.
                PazaakService.AddCardToCollection(item, target);
                return;
            }

            if (item.Tag == "PazaakCollection" && target.Tag == "PazaakTable")
            {
                user.SetLocalObject("ACTIVE_COLLECTION", item);
                DialogService.StartConversation(user, target, "PazaakTable");
                return;
            }

            if (item.Tag == "PazaakCollection" && (!target.IsValid || target == user))
            {
                user.SetLocalObject("ACTIVE_COLLECTION", item);
                DialogService.StartConversation(user, user, "PazaakCollection");
                return;
            }
        }
        private static void ActivateAbility(
            NWCreature activator,
            NWObject target,
            Data.Entity.Perk entity,
            IPerkHandler perkHandler,
            int pcPerkLevel,
            PerkExecutionType executionType,
            int spellTier)
        {
            string uuid = Guid.NewGuid().ToString();
            float  baseActivationTime = perkHandler.CastingTime(activator, (float)entity.BaseCastingTime, spellTier);
            float  activationTime     = baseActivationTime;
            var    vfxID       = VisualEffect.Invalid;
            var    animationID = Animation.Invalid;

            if (baseActivationTime > 0f && activationTime < 1.0f)
            {
                activationTime = 1.0f;
            }

            // Force ability armor penalties
            float armorPenalty = 0.0f;

            if (executionType == PerkExecutionType.ForceAbility ||
                executionType == PerkExecutionType.ConcentrationAbility)
            {
                string penaltyMessage = string.Empty;
                foreach (var item in activator.EquippedItems)
                {
                    if (item.CustomItemType == CustomItemType.HeavyArmor)
                    {
                        armorPenalty   = 2;
                        penaltyMessage = "Heavy armor slows your force cooldown by 100%.";
                        break;
                    }
                    else if (item.CustomItemType == CustomItemType.LightArmor)
                    {
                        armorPenalty   = 1.25f;
                        penaltyMessage = "Light armor slows your force cooldown by 25%.";
                    }
                }

                // If there's an armor penalty, send a message to the player.
                if (armorPenalty > 0.0f)
                {
                    activator.SendMessage(penaltyMessage);
                }
            }

            // If player is in stealth mode, force them out of stealth mode.
            if (_.GetActionMode(activator.Object, ActionMode.Stealth))
            {
                _.SetActionMode(activator.Object, ActionMode.Stealth, false);
            }

            // Make the player face their target.
            _.ClearAllActions();
            BiowarePosition.TurnToFaceObject(target, activator);

            // Force and Concentration Abilities will display a visual effect during the casting process.
            if (executionType == PerkExecutionType.ForceAbility ||
                executionType == PerkExecutionType.ConcentrationAbility)
            {
                vfxID       = VisualEffect.Vfx_Dur_Iounstone_Yellow;
                animationID = Animation.LoopingConjure1;
            }

            if (executionType == PerkExecutionType.ConcentrationAbility)
            {
                activator.SetLocalObject("CONCENTRATION_TARGET", target);
            }

            // If a VFX ID has been specified, play that effect instead of the default one.
            if (vfxID != VisualEffect.Invalid)
            {
                var vfx = _.EffectVisualEffect(vfxID);
                vfx = _.TagEffect(vfx, "ACTIVATION_VFX");
                _.ApplyEffectToObject(DurationType.Temporary, vfx, activator.Object, activationTime + 0.2f);
            }

            // If an animation has been specified, make the player play that animation now.
            // bypassing if perk is throw saber due to couldn't get the animation to work via db table edit
            if (animationID != Animation.Invalid && entity.ID != (int)PerkType.ThrowSaber)
            {
                activator.AssignCommand(() => _.ActionPlayAnimation(animationID, 1.0f, activationTime - 0.1f));
            }

            // Mark player as busy. Busy players can't take other actions (crafting, harvesting, etc.)
            activator.IsBusy = true;

            // Non-players can't be interrupted via movement.
            if (!activator.IsPlayer)
            {
                // Begin the check for spell interruption. If the activator moves, the spell will be canceled.
                CheckForSpellInterruption(activator, uuid, activator.Position);
            }

            activator.SetLocalInt(uuid, (int)SpellStatusType.Started);

            // If there's a casting delay, display a timing bar on-screen.
            if (activationTime > 0)
            {
                NWNXPlayer.StartGuiTimingBar(activator, (int)activationTime, string.Empty);
            }

            // Run the FinishAbilityUse event at the end of the activation time.
            int perkID = entity.ID;

            var @event = new OnFinishAbilityUse(activator, uuid, perkID, target, pcPerkLevel, spellTier, armorPenalty);

            activator.DelayEvent(activationTime + 0.2f, @event);
        }