示例#1
0
        private static void HandleQueueWeaponSkill(NWCreature activator, Data.Entity.Perk entity, IPerkHandler ability, Feat spellFeatID)
        {
            var    perkFeat           = DataService.PerkFeat.GetByFeatID((int)spellFeatID);
            int?   cooldownCategoryID = ability.CooldownCategoryID(activator, entity.CooldownCategoryID, perkFeat.PerkLevelUnlocked);
            var    cooldownCategory   = DataService.CooldownCategory.GetByID(Convert.ToInt32(cooldownCategoryID));
            string queueUUID          = Guid.NewGuid().ToString();

            activator.SetLocalInt("ACTIVE_WEAPON_SKILL", entity.ID);
            activator.SetLocalString("ACTIVE_WEAPON_SKILL_UUID", queueUUID);
            activator.SetLocalInt("ACTIVE_WEAPON_SKILL_FEAT_ID", (int)spellFeatID);
            activator.SendMessage("Weapon skill '" + entity.Name + "' queued for next attack.");
            SendAOEMessage(activator, activator.Name + " readies weapon skill '" + entity.Name + "'.");

            ApplyCooldown(activator, cooldownCategory, ability, perkFeat.PerkLevelUnlocked, 0.0f);

            // Player must attack within 30 seconds after queueing or else it wears off.
            _.DelayCommand(30f, () =>
            {
                if (activator.GetLocalString("ACTIVE_WEAPON_SKILL_UUID") == queueUUID)
                {
                    activator.DeleteLocalInt("ACTIVE_WEAPON_SKILL");
                    activator.DeleteLocalString("ACTIVE_WEAPON_SKILL_UUID");
                    activator.DeleteLocalInt("ACTIVE_WEAPON_SKILL_FEAT_ID");
                    activator.SendMessage("Your weapon skill '" + entity.Name + "' is no longer queued.");
                    SendAOEMessage(activator, activator.Name + " no longer has weapon skill '" + entity.Name + "' readied.");
                }
            });
        }
示例#2
0
 /// <summary>
 /// Sets event scripts base on local variables and deletes the local variables when done.
 /// </summary>
 /// <param name="creature">The creatures whose events we're enabling</param>
 private static void EnableCreatureEvents(NWCreature creature)
 {
     // NOTE: Don't disable the spawn-in event because it's necessary for AI to work.
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_HEARTBEAT, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_HEARTBEAT"));
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_NOTICE, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_NOTICE"));
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_SPELLCASTAT, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_SPELLCASTAT"));
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_MELEE_ATTACKED, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_MELEE_ATTACKED"));
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_DAMAGED, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_DAMAGED"));
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_DISTURBED, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_DISTURBED"));
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_END_COMBATROUND, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_END_COMBATROUND"));
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_DIALOGUE, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_DIALOGUE"));
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_RESTED, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_RESTED"));
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_DEATH, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_DEATH"));
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_USER_DEFINED_EVENT, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_USER_DEFINED_EVENT"));
     SetEventScript(creature, EVENT_SCRIPT_CREATURE_ON_BLOCKED_BY_DOOR, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_BLOCKED_BY_DOOR"));
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_HEARTBEAT");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_NOTICE");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_SPELLCASTAT");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_MELEE_ATTACK");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_DAMAGED");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_DISTURBED");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_END_COMBATROUND");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_DIALOGUE");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_RESTED");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_DEATH");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_USER_DEFINED_EVENT");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_BLOCKED_BY_DOOR");
 }
示例#3
0
 /// <summary>
 /// Sets event scripts base on local variables and deletes the local variables when done.
 /// </summary>
 /// <param name="creature">The creatures whose events we're enabling</param>
 private static void EnableCreatureEvents(NWCreature creature)
 {
     // NOTE: Don't disable the spawn-in event because it's necessary for AI to work.
     SetEventScript(creature, EventScript.Creature_OnHeartbeat, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_HEARTBEAT"));
     SetEventScript(creature, EventScript.Creature_OnNotice, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_NOTICE"));
     SetEventScript(creature, EventScript.Creature_OnSpellCastAt, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_SPELLCASTAT"));
     SetEventScript(creature, EventScript.Creature_OnMeleeAttacked, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_MELEE_ATTACKED"));
     SetEventScript(creature, EventScript.Creature_OnDamaged, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_DAMAGED"));
     SetEventScript(creature, EventScript.Creature_OnDisturbed, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_DISTURBED"));
     SetEventScript(creature, EventScript.Creature_OnEndCombatRound, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_END_COMBATROUND"));
     SetEventScript(creature, EventScript.Creature_OnDialogue, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_DIALOGUE"));
     SetEventScript(creature, EventScript.Creature_OnRested, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_RESTED"));
     SetEventScript(creature, EventScript.Creature_OnDeath, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_DEATH"));
     SetEventScript(creature, EventScript.Creature_OnUserDefined, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_USER_DEFINED_EVENT"));
     SetEventScript(creature, EventScript.Creature_OnBlockedByDoor, creature.GetLocalString("SPAWN_CREATURE_EVENT_ON_BLOCKED_BY_DOOR"));
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_HEARTBEAT");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_NOTICE");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_SPELLCASTAT");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_MELEE_ATTACK");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_DAMAGED");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_DISTURBED");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_END_COMBATROUND");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_DIALOGUE");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_RESTED");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_DEATH");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_USER_DEFINED_EVENT");
     creature.DeleteLocalString("SPAWN_CREATURE_EVENT_ON_BLOCKED_BY_DOOR");
 }