Merge remote branch 'origin/master' into 330

This commit is contained in:
tomrus88 2009-12-20 06:12:32 +03:00
commit ad75d9680c
14 changed files with 122 additions and 34 deletions

View file

@ -319,10 +319,18 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
return false;
Map* map = source->GetMap();
if (!map->Instanceable())
return false;
{
sLog.outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-instance map %u",
ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT, criteria_id, map->GetId());
return false;
}
InstanceData* data = ((InstanceMap*)map)->GetInstanceData();
if (!data)
{
sLog.outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map not have instance script",
ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT, criteria_id, map->GetId());
return false;
}
return data->CheckAchievementCriteriaMeet(criteria_id, source, target, miscvalue1);
}
return false;

View file

@ -19,6 +19,7 @@
#include "InstanceData.h"
#include "Database/DatabaseEnv.h"
#include "Map.h"
#include "Log.h"
void InstanceData::SaveToDB()
{
@ -27,3 +28,10 @@ void InstanceData::SaveToDB()
CharacterDatabase.escape_string(data);
CharacterDatabase.PExecute("UPDATE instance SET data = '%s' WHERE id = '%d'", data.c_str(), instance->GetInstanceId());
}
bool InstanceData::CheckAchievementCriteriaMeet( uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/ )
{
sLog.outError("Achievement system call InstanceData::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
instance->GetId(),criteria_id);
return false;
}

View file

@ -73,9 +73,6 @@ class MANGOS_DLL_SPEC InstanceData
// Achievement criteria additional requirements check
// NOTE: not use this if same can be checked existed requirement types from AchievementCriteriaRequirementType
virtual bool CheckAchievementCriteriaMeet(uint32 /*criteria_id*/, Player const* /*source*/, Unit const* /*target*/ = NULL, uint32 /*miscvalue1*/ = 0)
{
return false;
}
virtual bool CheckAchievementCriteriaMeet(uint32 /*criteria_id*/, Player const* /*source*/, Unit const* /*target*/ = NULL, uint32 /*miscvalue1*/ = 0);
};
#endif

View file

@ -4079,21 +4079,35 @@ SpellCastResult Spell::CheckCast(bool strict)
}
}
// TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result.
// check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc
if(non_caster_target && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
if(non_caster_target)
{
// check correctness positive/negative cast target (pet cast real check and cheating check)
if(IsPositiveSpell(m_spellInfo->Id))
// simple cases
if (IsExplicitPositiveTarget(m_spellInfo->EffectImplicitTargetA[0]))
{
if(m_caster->IsHostileTo(target))
return SPELL_FAILED_BAD_TARGETS;
}
else
else if (IsExplicitNegativeTarget(m_spellInfo->EffectImplicitTargetA[0]))
{
if(m_caster->IsFriendlyTo(target))
return SPELL_FAILED_BAD_TARGETS;
}
// TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result.
// check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc
else if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
{
// check correctness positive/negative cast target (pet cast real check and cheating check)
if(IsPositiveSpell(m_spellInfo->Id))
{
if(m_caster->IsHostileTo(target))
return SPELL_FAILED_BAD_TARGETS;
}
else
{
if(m_caster->IsFriendlyTo(target))
return SPELL_FAILED_BAD_TARGETS;
}
}
}
if(IsPositiveSpell(m_spellInfo->Id))

View file

@ -1381,15 +1381,16 @@ void Aura::HandleAddModifier(bool apply, bool Real)
// Add custom charges for some mod aura
switch (m_spellProto->Id)
{
case 17941: // Shadow Trance
case 22008: // Netherwind Focus
case 31834: // Light's Grace
case 34754: // Clearcasting
case 34936: // Backlash
case 48108: // Hot Streak
case 51124: // Killing Machine
case 54741: // Firestarter
case 57761: // Fireball!
case 17941: // Shadow Trance
case 22008: // Netherwind Focus
case 31834: // Light's Grace
case 34754: // Clearcasting
case 34936: // Backlash
case 44401: // Missile Barrage
case 48108: // Hot Streak
case 51124: // Killing Machine
case 54741: // Firestarter
case 57761: // Fireball!
SetAuraCharges(1);
break;
}
@ -2190,6 +2191,14 @@ void Aura::TriggerSpell()
// original caster must be target (beacon)
target->CastSpell(target, trigger_spell_id, true, NULL, this, target->GetGUID());
return;
// Rapid Recuperation (triggered energize have baspioints == 0)
case 56654:
case 58882:
{
int32 mana = m_target->GetMaxPower(POWER_MANA) * m_modifier.m_amount / 100;
target->CastCustomSpell(target, trigger_spell_id, &mana, NULL, NULL, true, NULL, this);
return;
}
}
}

View file

@ -365,16 +365,12 @@ void Spell::EffectSchoolDMG(uint32 effect_idx)
}
break;
}
case SPELLFAMILY_MAGE:
{
// Arcane Blast
if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x20000000))
{
m_caster->CastSpell(m_caster, 36032, true);
}
// remove Arcane Blast buffs at any non-Arcane Blast arcane damage spell.
// NOTE: it removed at hit instead cast because currently spell done-damage calculated at hit instead cast
if ((m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_ARCANE) && !(m_spellInfo->SpellFamilyFlags & UI64LIT(0x20000000)))
m_caster->RemoveAurasDueToSpell(36032); // Arcane Blast buff
break;
}
case SPELLFAMILY_WARRIOR:
{
// Bloodthirst
@ -475,7 +471,8 @@ void Spell::EffectSchoolDMG(uint32 effect_idx)
// found Immolate or Shadowflame
if (aura)
{
int32 damagetick = aura->GetModifier()->m_amount;
// DoT not have applied spell bonuses in m_amount
int32 damagetick = m_caster->SpellDamageBonus(unitTarget, aura->GetSpellProto(), aura->GetModifier()->m_amount, DOT);
damage += damagetick * 4;
// Glyph of Conflagrate

View file

@ -426,6 +426,40 @@ bool IsPositiveTarget(uint32 targetA, uint32 targetB)
return true;
}
bool IsExplicitPositiveTarget(uint32 targetA)
{
// positive targets
switch(targetA)
{
case TARGET_SELF:
case TARGET_SINGLE_FRIEND:
case TARGET_SINGLE_PARTY:
case TARGET_CHAIN_HEAL:
case TARGET_SINGLE_FRIEND_2:
case TARGET_AREAEFFECT_PARTY_AND_CLASS:
case TARGET_SELF2:
return true;
default:
break;
}
return false;
}
bool IsExplicitNegativeTarget(uint32 targetA)
{
// non-positive targets
switch(targetA)
{
case TARGET_CHAIN_DAMAGE:
case TARGET_CURRENT_ENEMY_COORDINATES:
case TARGET_SINGLE_ENEMY:
return true;
default:
break;
}
return false;
}
bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
{
SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId);

View file

@ -220,6 +220,9 @@ bool IsPositiveSpell(uint32 spellId);
bool IsPositiveEffect(uint32 spellId, uint32 effIndex);
bool IsPositiveTarget(uint32 targetA, uint32 targetB);
bool IsExplicitPositiveTarget(uint32 targetA);
bool IsExplicitNegativeTarget(uint32 targetA);
bool IsSingleTargetSpell(SpellEntry const *spellInfo);
bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellInfo2);

View file

@ -5965,8 +5965,18 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
// This effect only from Rapid Killing (mana regen)
if (!(procSpell->SpellFamilyFlags & UI64LIT(0x0100000000000000)))
return false;
triggered_spell_id = 56654;
target = this;
switch(dummySpell->Id)
{
case 53228: // Rank 1
triggered_spell_id = 56654;
break;
case 53232: // Rank 2
triggered_spell_id = 58882;
break;
}
break;
}
break;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9026"
#define REVISION_NR "9035"
#endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_8874_01_characters_character_skills"
#define REVISION_DB_MANGOS "required_9025_01_mangos_spell_proc_event"
#define REVISION_DB_MANGOS "required_9034_01_mangos_spell_proc_event"
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
#endif // __REVISION_SQL_H__