예제 #1
0
 boss_akilzonAI(Creature *c) : ScriptedAI(c)
 {
     SpellEntry *TempSpell = GET_SPELL(SPELL_ELECTRICAL_DAMAGE);
     SpellEffectEntry const* spellEffect = TempSpell->GetSpellEffect(EFFECT_1);
     //if (spellEffect)
         //spellEffect->EffectBasePoints = 49;//disable bugged lightning until fixed in core
     pInstance = c->GetInstanceScript();
 }
예제 #2
0
 boss_kazrogalAI(Creature *c) : hyjal_trashAI(c)
 {
     pInstance = c->GetInstanceScript();
     pGo = false;
     pos = 0;
     SpellEntry *TempSpell = GET_SPELL(SPELL_MARK);
     SpellEffectEntry const* spellEffect = TempSpell->GetSpellEffect(EFFECT_0);
     if (spellEffect && spellEffect->EffectImplicitTargetA != 1)
     {
         //spellEffect->EffectImplicitTargetA = 1;
         //spellEffect->EffectImplicitTargetB = 0;
     }
 }
예제 #3
0
void ScriptMgr::register_dummy_aura(uint32 entry, exp_handle_dummy_aura callback)
{
	if(_auras.find(entry) != _auras.end())
	{
		LOG_ERROR("ScriptMgr is trying to register a script for Aura ID: %u even if there's already one for that Aura. Remove one of those scripts.", entry);
	}

	SpellEntry* sp = dbcSpell.LookupEntryForced(entry);
	if(sp == NULL)
	{
		LOG_ERROR("ScriptMgr is trying to register a dummy aura handler for Spell ID: %u which is invalid.", entry);
		return;
	}

	if(!sp->AppliesAura(SPELL_AURA_DUMMY) && !sp->AppliesAura(SPELL_AURA_PERIODIC_TRIGGER_DUMMY))
		LOG_ERROR("ScriptMgr has registered a dummy aura handler for Spell ID: %u ( %s ), but spell has no dummy aura!", entry, sp->Name);

	_auras.insert(HandleDummyAuraMap::value_type(entry, callback));
}
예제 #4
0
void ScriptMgr::register_dummy_spell(uint32 entry, exp_handle_dummy_spell callback)
{
	if(_spells.find(entry) != _spells.end())
	{
		LOG_ERROR("ScriptMgr is trying to register a script for Spell ID: %u even if there's already one for that Spell. Remove one of those scripts.", entry);
		return;
	}

	SpellEntry* sp = dbcSpell.LookupEntryForced(entry);
	if(sp == NULL)
	{
		LOG_ERROR("ScriptMgr is trying to register a dummy handler for Spell ID: %u which is invalid.", entry);
		return;
	}

	if(!sp->HasEffect(SPELL_EFFECT_DUMMY) && !sp->HasEffect(SPELL_EFFECT_SCRIPT_EFFECT) && !sp->HasEffect(SPELL_EFFECT_SEND_EVENT))
		LOG_ERROR("ScriptMgr has registered a dummy handler for Spell ID: %u ( %s ), but spell has no dummy/script/send event effect!", entry, sp->Name);

	_spells.insert(HandleDummySpellMap::value_type(entry, callback));
}
예제 #5
0
static void player_use_spell(GameState* gs, PlayerInst* p,
                             SpellEntry& spl_entry, const Pos& target) {
    p->core_stats().mp -= spl_entry.mp_cost;
    p->cooldowns().reset_action_cooldown(spl_entry.cooldown);
    if (spl_entry.uses_projectile()) {
        player_use_projectile_spell(gs, p, spl_entry, spl_entry.projectile,
                                    target);
    } else {
        player_use_luacallback_spell(gs, p, spl_entry, spl_entry.action_func,
                                     target);
    }
}
예제 #6
0
void TotemSummon::SetupSpells()
{
	if(GetOwner() == NULL)
		return;

	SpellEntry* creatorspell = dbcSpell.LookupEntry(GetCreatedBySpell());
	SpellEntry* TotemSpell = dbcSpell.LookupEntry(proto->AISpells[ 0 ]);
	SpellEntry* TotemSpell2 = dbcSpell.LookupEntry(proto->AISpells[ 1 ]);

	if(TotemSpell == NULL)
	{
		printf("Totem %u does not have any spells to cast", creature_info->Id);
		return;
	}

	// Set up AI, depending on our spells.
	bool castingtotem = true;

	if(TotemSpell->HasEffect(SPELL_EFFECT_SUMMON) ||
	        TotemSpell->HasEffect(SPELL_EFFECT_APPLY_GROUP_AREA_AURA) ||
	        TotemSpell->HasEffect(SPELL_EFFECT_APPLY_RAID_AREA_AURA)  ||
	        TotemSpell->HasEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA)  ||
	        (TotemSpell->HasEffect(SPELL_EFFECT_APPLY_AURA) && TotemSpell->AppliesAura(SPELL_AURA_PERIODIC_TRIGGER_SPELL)))
		castingtotem = false;

	if(!castingtotem)
	{
		// We're an area aura. Simply cast the spell.

		m_aiInterface->totemspell = creatorspell;

		Spell* pSpell = sSpellFactoryMgr.NewSpell(this, TotemSpell, true, 0);
		SpellCastTargets targets;

		if(!TotemSpell->HasEffect(SPELL_AURA_PERIODIC_TRIGGER_SPELL))
		{
			targets.m_destX = GetPositionX();
			targets.m_destY = GetPositionY();
			targets.m_destZ = GetPositionZ();
			targets.m_targetMask = TARGET_FLAG_DEST_LOCATION;
		}
		pSpell->prepare(&targets);

	}
	else
	{
		// We're a casting totem. Switch AI on, and tell it to cast this spell.
		EnableAI();
		m_aiInterface->totemspell = TotemSpell;
		m_aiInterface->m_totemspelltimer = 0;
		m_aiInterface->m_totemspelltime  = 3 * MSTIME_SECOND;
	}
	if(TotemSpell2)
		CastSpell(this, TotemSpell2, true);
}
예제 #7
0
void ScriptMgr::register_script_effect(uint32 entry, exp_handle_script_effect callback)
{

	HandleScriptEffectMap::iterator itr = SpellScriptEffects.find(entry);

	if(itr != SpellScriptEffects.end())
	{
		LOG_ERROR("ScriptMgr tried to register more than 1 script effect handlers for Spell %u", entry);
		return;
	}

	SpellEntry* sp = dbcSpell.LookupEntryForced(entry);
	if(sp == NULL)
	{
		LOG_ERROR("ScriptMgr tried to register a script effect handler for Spell %u, which is invalid.", entry);
		return;
	}

	if(!sp->HasEffect(SPELL_EFFECT_SCRIPT_EFFECT) && !sp->HasEffect(SPELL_EFFECT_SEND_EVENT))
		LOG_ERROR("ScriptMgr has registered a script effect handler for Spell ID: %u ( %s ), but spell has no scripted effect!", entry, sp->Name);

	SpellScriptEffects.insert(std::pair< uint32, exp_handle_script_effect >(entry, callback));
}
예제 #8
0
void ScriptMgr::DumpUnimplementedSpells()
{
	std::ofstream of;

	LOG_BASIC("Dumping IDs for spells with unimplemented dummy/script effect(s)");
	uint32 count = 0;

	of.open("unimplemented1.txt");

	for(DBCStorage< SpellEntry >::iterator itr = dbcSpell.begin(); itr != dbcSpell.end(); ++itr)
	{
		SpellEntry* sp = *itr;

		if(!sp->HasEffect(SPELL_EFFECT_DUMMY) && !sp->HasEffect(SPELL_EFFECT_SCRIPT_EFFECT) && !sp->HasEffect(SPELL_EFFECT_SEND_EVENT))
			continue;

		HandleDummySpellMap::iterator sitr = _spells.find(sp->Id);
		if(sitr != _spells.end())
			continue;

		HandleScriptEffectMap::iterator seitr = SpellScriptEffects.find(sp->Id);
		if(seitr != SpellScriptEffects.end())
			continue;

		std::stringstream ss;
		ss << sp->Id;
		ss << std::endl;

		of.write(ss.str().c_str(), ss.str().length());

		count++;
	}

	of.close();

	LOG_BASIC("Dumped %u IDs.", count);

	LOG_BASIC("Dumping IDs for spells with unimplemented dummy aura effect.");

	std::ofstream of2;
	of2.open("unimplemented2.txt");

	count = 0;

	for(DBCStorage< SpellEntry >::iterator itr = dbcSpell.begin(); itr != dbcSpell.end(); ++itr)
	{
		SpellEntry* sp = *itr;

		if(!sp->AppliesAura(SPELL_AURA_DUMMY))
			continue;

		HandleDummyAuraMap::iterator ditr = _auras.find(sp->Id);
		if(ditr != _auras.end())
			continue;

		std::stringstream ss;
		ss << sp->Id;
		ss << std::endl;

		of2.write(ss.str().c_str(), ss.str().length());

		count++;
	}

	of2.close();

	LOG_BASIC("Dumped %u IDs.", count);
}