Merge commit 'origin/master' into 330

This commit is contained in:
tomrus88 2009-10-14 17:32:52 +04:00
commit b10c3e2287
63 changed files with 942 additions and 1102 deletions

View file

@ -1,19 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 8.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ad", "VC71_ad.vcproj", "{D7552D4F-408F-4F8E-859B-366659150CF4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D7552D4F-408F-4F8E-859B-366659150CF4}.Debug|Win32.ActiveCfg = Debug|Win32
{D7552D4F-408F-4F8E-859B-366659150CF4}.Debug|Win32.Build.0 = Debug|Win32
{D7552D4F-408F-4F8E-859B-366659150CF4}.Release|Win32.ActiveCfg = Release|Win32
{D7552D4F-408F-4F8E-859B-366659150CF4}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -1,324 +0,0 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="ad"
ProjectGUID="{D7552D4F-408F-4F8E-859B-366659150CF4}"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="."
IntermediateDirectory=".\debug\"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName="./ad.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="libmpq"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile="$(IntDir)ad.pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1049"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="zlib.lib"
OutputFile="ad debug.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="./debug/"
IgnoreDefaultLibraryNames="LIBCD.lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="./ad debug.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="."
IntermediateDirectory=".\release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName="./ad.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="libmpq"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
PrecompiledHeaderFile="$(IntDir)ad.pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1049"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="zlib.lib"
OutputFile="./ad.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="./release/"
IgnoreDefaultLibraryNames="LIBC.lib"
ProgramDatabaseFile="./ad.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\loadlib\loadlib.cpp"
>
</File>
<File
RelativePath=".\loadlib\adt.cpp"
>
</File>
<File
RelativePath=".\loadlib\wdt.cpp"
>
</File>
<File
RelativePath=".\libmpq\common.cpp"
>
</File>
<File
RelativePath=".\dbcfile.cpp"
>
</File>
<File
RelativePath=".\libmpq\explode.cpp"
>
</File>
<File
RelativePath=".\libmpq\extract.cpp"
>
</File>
<File
RelativePath=".\libmpq\huffman.cpp"
>
</File>
<File
RelativePath=".\libmpq\mpq.cpp"
>
</File>
<File
RelativePath=".\mpq_libmpq.cpp"
>
</File>
<File
RelativePath=".\libmpq\parser.cpp"
>
</File>
<File
RelativePath="system.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath=".\libmpq\wave.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\libmpq\common.h"
>
</File>
<File
RelativePath=".\dbcfile.h"
>
</File>
<File
RelativePath=".\libmpq\explode.h"
>
</File>
<File
RelativePath=".\libmpq\huffman.h"
>
</File>
<File
RelativePath=".\libmpq\mpq.h"
>
</File>
<File
RelativePath=".\mpq_libmpq.h"
>
</File>
<File
RelativePath=".\libmpq\wave.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="ad"
ProjectGUID="{D7552D4F-408F-4F8E-859B-366659150CF4}"
RootNamespace="ad"
@ -310,6 +310,10 @@
RelativePath=".\mpq_libmpq.h"
>
</File>
<File
RelativePath=".\loadlib\wdt.h"
>
</File>
<Filter
Name="libmpq"
>
@ -325,6 +329,10 @@
RelativePath=".\libmpq\huffman.h"
>
</File>
<File
RelativePath=".\loadlib\loadlib.h"
>
</File>
<File
RelativePath=".\libmpq\mpq.h"
>
@ -333,6 +341,10 @@
RelativePath=".\libmpq\wave.h"
>
</File>
<File
RelativePath=".\libmpq\wdt.h"
>
</File>
<File
RelativePath=".\libmpq\zconf.h"
>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="ad"
ProjectGUID="{D7552D4F-408F-4F8E-859B-366659150CF4}"
RootNamespace="ad"
@ -215,18 +215,10 @@
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\loadlib\loadlib.cpp"
>
</File>
<File
RelativePath=".\loadlib\adt.cpp"
>
</File>
<File
RelativePath=".\loadlib\wdt.cpp"
>
</File>
<File
RelativePath=".\libmpq\common.cpp"
>
@ -247,6 +239,10 @@
RelativePath=".\libmpq\huffman.cpp"
>
</File>
<File
RelativePath=".\loadlib\loadlib.cpp"
>
</File>
<File
RelativePath=".\libmpq\mpq.cpp"
>
@ -287,11 +283,19 @@
RelativePath=".\libmpq\wave.cpp"
>
</File>
<File
RelativePath=".\loadlib\wdt.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\loadlib\adt.h"
>
</File>
<File
RelativePath=".\libmpq\common.h"
>
@ -308,6 +312,10 @@
RelativePath=".\libmpq\huffman.h"
>
</File>
<File
RelativePath=".\loadlib\loadlib.h"
>
</File>
<File
RelativePath=".\libmpq\mpq.h"
>
@ -320,6 +328,10 @@
RelativePath=".\libmpq\wave.h"
>
</File>
<File
RelativePath=".\loadlib\wdt.h"
>
</File>
</Filter>
</Files>
<Globals>

Binary file not shown.

View file

@ -3,26 +3,28 @@
#ifdef WIN32
typedef __int64 int64;
typedef long int32;
typedef short int16;
typedef char int8;
typedef __int32 int32;
typedef __int16 int16;
typedef __int8 int8;
typedef unsigned __int64 uint64;
typedef unsigned long uint32;
typedef unsigned short uint16;
typedef unsigned char uint8;
typedef unsigned __int32 uint32;
typedef unsigned __int16 uint16;
typedef unsigned __int8 uint8;
#else
#include <stdint.h>
#ifndef uint64_t
#ifdef __linux__
#include <linux/types.h>
#endif
#endif
typedef int64_t int64;
typedef long int32;
typedef short int16;
typedef char int8;
typedef int32_t int32;
typedef int16_t int16;
typedef int8_t int8;
typedef uint64_t uint64;
typedef unsigned long uint32;
typedef unsigned short uint16;
typedef unsigned char uint8;
typedef uint32_t uint32;
typedef uint16_t uint16;
typedef uint8_t uint8;
#endif
#define FILE_FORMAT_VERSION 18

View file

@ -4660,7 +4660,7 @@ if test "$ace_user_enable_reentrant_funcs" = yes; then
fi
],
[
dnl Nothing to do!
echo "Nothing to do";
])
],
[AC_DEFINE([ACE_LACKS_PWD_REENTRANT_FUNCTIONS])])

View file

@ -27,7 +27,7 @@ do
ACE_CHECK_DEFINE($ace_def,
[AC_DEFINE_UNQUOTED(AS_TR_CPP([ACE_HAS_$ace_def])) $2],
[$3],
[$4])dnl
[$4])
done
])
@ -43,6 +43,6 @@ do
ACE_CHECK_DEFINE($ace_def,
[$2],
[AC_DEFINE_UNQUOTED(AS_TR_CPP([ACE_LACKS_$ace_def])) $3],
[$4])dnl
[$4])
done
])

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_8608_02_mangos_battleground_events` bit(1) default NULL
`required_8618_01_mangos_spell_proc_event` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--
@ -255,7 +255,7 @@ INSERT INTO battleground_events (map, event1, event2, description) VALUES
(572, 253, 0, 'buffs'),
(572, 254, 0, 'doors'),
(562, 253, 0, 'buffs'),
(562, 254, 0, 'doors');
(562, 254, 0, 'doors'),
-- alterac valley
(30, 254, 0, 'Doors'),
@ -18252,6 +18252,7 @@ INSERT INTO `spell_proc_event` VALUES
(56355, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0),
(56364, 0x00000000, 3, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(56372, 0x00000000, 3, 0x00000000, 0x00000080, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0),
(56375, 0x00000000, 3, 0x01000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0),
(56451, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3),
(56611, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
(56612, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),

View file

@ -0,0 +1,6 @@
ALTER TABLE db_version CHANGE COLUMN required_8608_02_mangos_battleground_events required_8618_01_mangos_spell_proc_event bit;
DELETE FROM `spell_proc_event` WHERE `entry` = 56375;
INSERT INTO `spell_proc_event` VALUES
(56375, 0x00, 3, 0x01000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0);

View file

@ -134,6 +134,7 @@ pkgdata_DATA = \
8607_02_mangos_command.sql \
8608_01_mangos_mangos_string.sql \
8608_02_mangos_battleground_events.sql \
8618_01_mangos_spell_proc_event.sql \
README
## Additional files to include when running 'make dist'
@ -248,4 +249,5 @@ EXTRA_DIST = \
8607_02_mangos_command.sql \
8608_01_mangos_mangos_string.sql \
8608_02_mangos_battleground_events.sql \
8618_01_mangos_spell_proc_event.sql \
README

View file

@ -298,7 +298,7 @@ bool EffectDummyItem(Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTa
void ScriptedAI::UpdateAI(const uint32)
{
//Check if we have a current target
if( m_creature->isAlive() && m_creature->SelectHostilTarget() && m_creature->getVictim())
if( m_creature->isAlive() && m_creature->SelectHostileTarget() && m_creature->getVictim())
{
//If we are within range melee the target
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))

View file

@ -46,7 +46,7 @@ AggressorAI::MoveInLineOfSight(Unit *u)
if( !m_creature->canFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE )
return;
if( !m_creature->hasUnitState(UNIT_STAT_STUNNED) && u->isTargetableForAttack() &&
if( !m_creature->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED) && u->isTargetableForAttack() &&
( m_creature->IsHostileTo( u ) /*|| u->getVictim() && m_creature->IsFriendlyTo( u->getVictim() )*/ ) &&
u->isInAccessablePlaceFor(m_creature) )
{
@ -71,7 +71,7 @@ void AggressorAI::EnterEvadeMode()
{
if( !m_creature->isAlive() )
{
DEBUG_LOG("Creature stopped attacking cuz his dead [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, he is dead [guid=%u]", m_creature->GetGUIDLow());
i_victimGuid = 0;
m_creature->CombatStop(true);
m_creature->DeleteThreatList();
@ -82,23 +82,23 @@ void AggressorAI::EnterEvadeMode()
if( !victim )
{
DEBUG_LOG("Creature stopped attacking because victim is non exist [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, no victim [guid=%u]", m_creature->GetGUIDLow());
}
else if( !victim->isAlive() )
{
DEBUG_LOG("Creature stopped attacking cuz his victim is dead [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, victim is dead [guid=%u]", m_creature->GetGUIDLow());
}
else if( victim->HasStealthAura() )
{
DEBUG_LOG("Creature stopped attacking cuz his victim is stealth [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, victim is in stealth [guid=%u]", m_creature->GetGUIDLow());
}
else if( victim->isInFlight() )
{
DEBUG_LOG("Creature stopped attacking cuz his victim is fly away [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, victim is in flight [guid=%u]", m_creature->GetGUIDLow());
}
else
{
DEBUG_LOG("Creature stopped attacking due to target out run him [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, victim out run him [guid=%u]", m_creature->GetGUIDLow());
//i_state = STATE_LOOK_AT_VICTIM;
//i_tracker.Reset(TIME_INTERVAL_LOOK);
}
@ -122,7 +122,7 @@ void
AggressorAI::UpdateAI(const uint32 /*diff*/)
{
// update i_victimGuid if m_creature->getVictim() !=0 and changed
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim())
if(!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
i_victimGuid = m_creature->getVictim()->GetGUID();

View file

@ -749,7 +749,7 @@ void BattleGround::EndBattleGround(uint32 winner)
{
//needed cause else in av some creatures will kill the players at the end
plr->CombatStop();
plr->getHostilRefManager().deleteReferences();
plr->getHostileRefManager().deleteReferences();
}
//this line is obsolete - team is set ALWAYS

View file

@ -60,14 +60,14 @@ void BattleGroundAV::HandleKillUnit(Creature *creature, Player *killer)
CastSpellOnTeam(BG_AV_BOSS_KILL_QUEST_SPELL, HORDE); // this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(BG_AV_FACTION_H, m_RepBoss, HORDE);
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_BOSS), HORDE);
SendYellToAll(LANG_BG_AV_H_GENERAL_DEAD, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0));
SendYellToAll(LANG_BG_AV_A_GENERAL_DEAD, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0));
EndBattleGround(HORDE);
break;
case BG_AV_BOSS_H:
CastSpellOnTeam(BG_AV_BOSS_KILL_QUEST_SPELL, ALLIANCE); // this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(BG_AV_FACTION_A, m_RepBoss, ALLIANCE);
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_BOSS), ALLIANCE);
SendYellToAll(LANG_BG_AV_A_GENERAL_DEAD, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0));
SendYellToAll(LANG_BG_AV_H_GENERAL_DEAD, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0));
EndBattleGround(ALLIANCE);
break;
case BG_AV_CAPTAIN_A:

View file

@ -102,7 +102,7 @@ ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
if(!&unit)
return true;
if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED | UNIT_STAT_DIED))
return true;
if( i_nextMoveTime.Passed() )

View file

@ -1782,6 +1782,18 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const
return false;
}
void Creature::SendAIReaction(AiReaction reactionType)
{
WorldPacket data(SMSG_AI_REACTION, 12);
data << uint64(GetGUID());
data << uint32(reactionType);
((WorldObject*)this)->SendMessageToSet(&data, true);
sLog.outDebug("WORLD: Sent SMSG_AI_REACTION, type %u.", reactionType);
}
void Creature::CallAssistance()
{
if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed())

View file

@ -619,6 +619,8 @@ class MANGOS_DLL_SPEC Creature : public Unit
float GetAttackDistance(Unit const* pl) const;
void SendAIReaction(AiReaction reactionType);
void DoFleeToGetAssistance();
void CallForHelp(float fRadius);
void CallAssistance();

View file

@ -524,8 +524,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
case ACTION_T_THREAT_ALL_PCT:
{
std::list<HostilReference*>& threatList = m_creature->getThreatManager().getThreatList();
for (std::list<HostilReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
if(Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
m_creature->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent);
break;
@ -635,8 +635,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
case ACTION_T_CAST_EVENT_ALL:
{
std::list<HostilReference*>& threatList = m_creature->getThreatManager().getThreatList();
for (std::list<HostilReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
if (Temp->GetTypeId() == TYPEID_PLAYER)
((Player*)Temp)->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetGUID(), action.cast_event_all.spellId);
@ -994,7 +994,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
if (m_creature->isCivilian() || m_creature->IsNeutralToAll())
return;
if (!m_creature->hasUnitState(UNIT_STAT_STUNNED) && who->isTargetableForAttack() &&
if (!m_creature->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED) && who->isTargetableForAttack() &&
m_creature->IsHostileTo(who) && who->isInAccessablePlaceFor(m_creature))
{
if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
@ -1034,7 +1034,7 @@ void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell)
void CreatureEventAI::UpdateAI(const uint32 diff)
{
//Check if we are in combat (also updates calls threat update code)
bool Combat = m_creature->SelectHostilTarget() && m_creature->getVictim();
bool Combat = m_creature->SelectHostileTarget() && m_creature->getVictim();
//Must return if creature isn't alive. Normally select hostil target and get victim prevent this
if (!m_creature->isAlive())
@ -1115,9 +1115,9 @@ bool CreatureEventAI::IsVisible(Unit *pl) const
inline Unit* CreatureEventAI::SelectUnit(AttackingTarget target, uint32 position)
{
//ThreatList m_threatlist;
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostilReference*>::iterator i = m_threatlist.begin();
std::list<HostilReference*>::reverse_iterator r = m_threatlist.rbegin();
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>::iterator i = m_threatlist.begin();
std::list<HostileReference*>::reverse_iterator r = m_threatlist.rbegin();
if (position >= m_threatlist.size() || !m_threatlist.size())
return NULL;
@ -1341,7 +1341,8 @@ bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Trigge
return false;
//Silenced so we can't cast
if (!Triggered && m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
if (!Triggered && (m_creature->hasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_DIED)
|| m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)))
return false;
//Check for power

View file

@ -33,7 +33,7 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
if( !&owner )
return;
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED) )
return;
if(!_setMoveData(owner))
@ -353,7 +353,7 @@ FleeingMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
{
if( !&owner || !owner.isAlive() )
return false;
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED) )
return true;
Traveller<T> traveller(owner);
@ -409,7 +409,7 @@ bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 & time_dif
if( !owner.isAlive() )
return false;
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED) )
return true;
i_totalFleeTime.Update(time_diff);

View file

@ -719,7 +719,7 @@ namespace MaNGOS
bool operator()(Unit* u)
{
if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
(u->isFeared() || u->isCharmed() || u->isFrozen() || u->hasUnitState(UNIT_STAT_STUNNED) || u->hasUnitState(UNIT_STAT_CONFUSED)))
(u->isFeared() || u->isCharmed() || u->isFrozen() || u->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_CONFUSED | UNIT_STAT_DIED)))
{
return true;
}

View file

@ -75,23 +75,23 @@ void GuardAI::EnterEvadeMode()
if (!victim)
{
DEBUG_LOG("Creature stopped attacking because victim is non exist [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, no victim [guid=%u]", m_creature->GetGUIDLow());
}
else if (!victim->isAlive())
{
DEBUG_LOG("Creature stopped attacking because victim is dead [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, victim is dead [guid=%u]", m_creature->GetGUIDLow());
}
else if (victim->HasStealthAura())
{
DEBUG_LOG("Creature stopped attacking because victim is using stealth [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, victim is in stealth [guid=%u]", m_creature->GetGUIDLow());
}
else if (victim->isInFlight())
{
DEBUG_LOG("Creature stopped attacking because victim is flying away [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, victim is in flight [guid=%u]", m_creature->GetGUIDLow());
}
else
{
DEBUG_LOG("Creature stopped attacking because victim outran him [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, victim out run him [guid=%u]", m_creature->GetGUIDLow());
}
m_creature->RemoveAllAuras();
@ -108,7 +108,7 @@ void GuardAI::EnterEvadeMode()
void GuardAI::UpdateAI(const uint32 /*diff*/)
{
// update i_victimGuid if i_creature.getVictim() !=0 and changed
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
i_victimGuid = m_creature->getVictim()->GetGUID();

View file

@ -42,7 +42,7 @@ HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner)
if( !&owner )
return;
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) )
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED | UNIT_STAT_DIED) )
return;
float x, y, z;

View file

@ -22,7 +22,7 @@
#include "DBCStructure.h"
#include "SpellMgr.h"
HostilRefManager::~HostilRefManager()
HostileRefManager::~HostileRefManager()
{
deleteReferences();
}
@ -32,9 +32,9 @@ HostilRefManager::~HostilRefManager()
// The pVictim is hated than by them as well
// use for buffs and healing threat functionality
void HostilRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
void HostileRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
HostilReference* ref;
HostileReference* ref;
uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat
ref = getFirst();
@ -51,9 +51,9 @@ void HostilRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry con
//=================================================
void HostilRefManager::addThreatPercent(int32 pValue)
void HostileRefManager::addThreatPercent(int32 pValue)
{
HostilReference* ref;
HostileReference* ref;
ref = getFirst();
while(ref != NULL)
@ -66,9 +66,9 @@ void HostilRefManager::addThreatPercent(int32 pValue)
//=================================================
// The online / offline status is given to the method. The calculation has to be done before
void HostilRefManager::setOnlineOfflineState(bool pIsOnline)
void HostileRefManager::setOnlineOfflineState(bool pIsOnline)
{
HostilReference* ref;
HostileReference* ref;
ref = getFirst();
while(ref != NULL)
@ -81,9 +81,9 @@ void HostilRefManager::setOnlineOfflineState(bool pIsOnline)
//=================================================
// The online / offline status is calculated and set
void HostilRefManager::updateThreatTables()
void HostileRefManager::updateThreatTables()
{
HostilReference* ref = getFirst();
HostileReference* ref = getFirst();
while(ref)
{
ref->updateOnlineStatus();
@ -95,12 +95,12 @@ void HostilRefManager::updateThreatTables()
// The references are not needed anymore
// tell the source to remove them from the list and free the mem
void HostilRefManager::deleteReferences()
void HostileRefManager::deleteReferences()
{
HostilReference* ref = getFirst();
HostileReference* ref = getFirst();
while(ref)
{
HostilReference* nextRef = ref->next();
HostileReference* nextRef = ref->next();
ref->removeReference();
delete ref;
ref = nextRef;
@ -110,12 +110,12 @@ void HostilRefManager::deleteReferences()
//=================================================
// delete one reference, defined by Unit
void HostilRefManager::deleteReference(Unit *pCreature)
void HostileRefManager::deleteReference(Unit *pCreature)
{
HostilReference* ref = getFirst();
HostileReference* ref = getFirst();
while(ref)
{
HostilReference* nextRef = ref->next();
HostileReference* nextRef = ref->next();
if(ref->getSource()->getOwner() == pCreature)
{
ref->removeReference();
@ -129,12 +129,12 @@ void HostilRefManager::deleteReference(Unit *pCreature)
//=================================================
// set state for one reference, defined by Unit
void HostilRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline)
void HostileRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline)
{
HostilReference* ref = getFirst();
HostileReference* ref = getFirst();
while(ref)
{
HostilReference* nextRef = ref->next();
HostileReference* nextRef = ref->next();
if(ref->getSource()->getOwner() == pCreature)
{
ref->setOnlineOfflineState(pIsOnline);

View file

@ -24,18 +24,18 @@
class Unit;
class ThreatManager;
class HostilReference;
class HostileReference;
struct SpellEntry;
//=================================================
class HostilRefManager : public RefManager<Unit, ThreatManager>
class HostileRefManager : public RefManager<Unit, ThreatManager>
{
private:
Unit *iOwner;
public:
explicit HostilRefManager(Unit *pOwner) { iOwner = pOwner; }
~HostilRefManager();
explicit HostileRefManager(Unit *pOwner) { iOwner = pOwner; }
~HostileRefManager();
Unit* getOwner() { return iOwner; }
@ -50,7 +50,7 @@ class HostilRefManager : public RefManager<Unit, ThreatManager>
// tell the source to remove them from the list and free the mem
void deleteReferences();
HostilReference* getFirst() { return ((HostilReference* ) RefManager<Unit, ThreatManager>::getFirst()); }
HostileReference* getFirst() { return ((HostileReference* ) RefManager<Unit, ThreatManager>::getFirst()); }
void updateThreatTables();

View file

@ -565,12 +565,12 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
pItem->SetCount( pItem->GetCount() - count );
_player->ItemRemovedQuestCheck( pItem->GetEntry(), count );
if( _player->IsInWorld() )
pItem->SendUpdateToPlayer( _player );
pItem->SendCreateUpdateToPlayer( _player );
pItem->SetState(ITEM_CHANGED, _player);
_player->AddItemToBuyBackSlot( pNewItem );
if( _player->IsInWorld() )
pNewItem->SendUpdateToPlayer( _player );
pNewItem->SendCreateUpdateToPlayer( _player );
}
else
{

View file

@ -3904,7 +3904,7 @@ bool ChatHandler::HandleCombatStopCommand(const char* args)
return false;
target->CombatStop();
target->getHostilRefManager().deleteReferences();
target->getHostileRefManager().deleteReferences();
return true;
}

View file

@ -5728,13 +5728,7 @@ bool ChatHandler::HandleCastBackCommand(const char* args)
bool triggered = (trig_str != NULL);
// update orientation at server
caster->SetOrientation(caster->GetAngle(m_session->GetPlayer()));
// and client
WorldPacket data;
caster->BuildHeartBeatMsg(&data);
caster->SendMessageToSet(&data,true);
caster->SetFacingToObject(m_session->GetPlayer());
caster->CastSpell(m_session->GetPlayer(),spell,triggered);
@ -5819,13 +5813,7 @@ bool ChatHandler::HandleCastTargetCommand(const char* args)
bool triggered = (trig_str != NULL);
// update orientation at server
caster->SetOrientation(caster->GetAngle(m_session->GetPlayer()));
// and client
WorldPacket data;
caster->BuildHeartBeatMsg(&data);
caster->SendMessageToSet(&data,true);
caster->SetFacingToObject(m_session->GetPlayer());
caster->CastSpell(caster->getVictim(),spell,triggered);

View file

@ -285,7 +285,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
virtual void InitVisibilityDistance();
void PlayerRelocation(Player *, float x, float y, float z, float angl);
void CreatureRelocation(Creature *creature, float x, float y, float, float);
void CreatureRelocation(Creature *creature, float x, float y, float z, float orientation);
template<class LOCK_TYPE, class T, class CONTAINER> void Visit(const CellLock<LOCK_TYPE> &cell, TypeContainerVisitor<T, CONTAINER> &visitor);

View file

@ -76,7 +76,7 @@ MotionMaster::~MotionMaster()
void
MotionMaster::UpdateMotion(uint32 diff)
{
if( i_owner->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
if( i_owner->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED) )
return;
assert( !empty() );
m_cleanFlag |= MMCF_UPDATE;

View file

@ -198,22 +198,12 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c
data->AddUpdateBlock(buf);
}
void Object::BuildUpdate(UpdateDataMapType &update_players)
void Object::SendCreateUpdateToPlayer(Player* player)
{
ObjectAccessor::_buildUpdateObject(this,update_players);
ClearUpdateMask(true);
}
void Object::SendUpdateToPlayer(Player* player)
{
// send update to another players
SendUpdateObjectToAllExcept(player);
// send create update to player
UpdateData upd;
WorldPacket packet;
upd.Clear();
BuildCreateUpdateBlockForPlayer(&upd, player);
upd.BuildPacket(&packet);
player->GetSession()->SendPacket(&packet);
@ -762,20 +752,6 @@ void Object::ClearUpdateMask(bool remove)
}
}
// Send current value fields changes to all viewers
void Object::SendUpdateObjectToAllExcept(Player* exceptPlayer)
{
// changes will be send in create packet
if(!IsInWorld())
return;
// nothing do
if(!m_objectUpdated)
return;
ObjectAccessor::UpdateObject(this,exceptPlayer);
}
bool Object::LoadValues(const char* data)
{
if(!m_uint32Values) _InitValues();
@ -1658,7 +1634,7 @@ namespace MaNGOS
float x,y,z;
if( !c->isAlive() || c->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) ||
if( !c->isAlive() || c->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED | UNIT_STAT_DIED) ||
!c->GetMotionMaster()->GetDestination(x,y,z) )
{
x = c->GetPositionX();

View file

@ -146,12 +146,11 @@ class MANGOS_DLL_SPEC Object
bool isType(uint16 mask) const { return (mask & m_objectType); }
virtual void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const;
void SendUpdateToPlayer(Player* player);
void SendCreateUpdateToPlayer(Player* player);
void BuildValuesUpdateBlockForPlayer( UpdateData *data, Player *target ) const;
void BuildOutOfRangeUpdateBlock( UpdateData *data ) const;
void BuildMovementUpdateBlock( UpdateData * data, uint32 flags = 0 ) const;
void BuildUpdate(UpdateDataMapType &);
virtual void DestroyForPlayer( Player *target, bool anim = false ) const;
@ -289,7 +288,6 @@ class MANGOS_DLL_SPEC Object
}
void ClearUpdateMask(bool remove);
void SendUpdateObjectToAllExcept(Player* exceptPlayer);
bool LoadValues(const char* data);

View file

@ -182,51 +182,17 @@ ObjectAccessor::SaveAllPlayers()
itr->second->SaveToDB();
}
void
ObjectAccessor::UpdateObject(Object* obj, Player* exceptPlayer)
{
UpdateDataMapType update_players;
obj->BuildUpdate(update_players);
WorldPacket packet;
for(UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
{
if(iter->first == exceptPlayer)
continue;
iter->second.BuildPacket(&packet);
iter->first->GetSession()->SendPacket(&packet);
packet.clear();
}
}
void
ObjectAccessor::_buildUpdateObject(Object *obj, UpdateDataMapType &update_players)
{
bool build_for_all = true;
Player *pl = NULL;
if(obj->isType(TYPEMASK_ITEM))
{
Item *item = static_cast<Item *>(obj);
pl = item->GetOwner();
build_for_all = false;
}
if( pl != NULL )
if (Player* pl = item->GetOwner())
_buildPacket(pl, obj, update_players);
// Capt: okey for all those fools who think its a real fix
// THIS IS A TEMP FIX
if( build_for_all )
{
WorldObject * temp = dynamic_cast<WorldObject*>(obj);
//assert(dynamic_cast<WorldObject*>(obj)!=NULL);
if (temp)
_buildChangeObjectForPlayer(temp, update_players);
else
sLog.outDebug("ObjectAccessor: Ln 405 Temp bug fix");
}
else
_buildChangeObjectForPlayer(static_cast<WorldObject*>(obj), update_players);
}
void

View file

@ -199,7 +199,6 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
void AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* map);
Corpse* ConvertCorpseForPlayer(uint64 player_guid, bool insignia = false);
static void UpdateObject(Object* obj, Player* exceptPlayer);
static void _buildUpdateObject(Object* obj, UpdateDataMapType &);
private:

View file

@ -2879,8 +2879,8 @@ void ObjectMgr::LoadGuilds()
// 0 1 2 3 4 5 6
QueryResult *result = CharacterDatabase.Query("SELECT guild.guildid,guild.name,leaderguid,EmblemStyle,EmblemColor,BorderStyle,BorderColor,"
// 7 8 9 10 11 12
"BackgroundColor,info,motd,createdate,BankMoney,COUNT(guild_bank_tab.guildid) "
"FROM guild LEFT JOIN guild_bank_tab ON guild.guildid = guild_bank_tab.guildid GROUP BY guild.guildid ORDER BY guildid ASC");
"BackgroundColor,info,motd,createdate,BankMoney,(SELECT COUNT(guild_bank_tab.guildid) FROM guild_bank_tab WHERE guild_bank_tab.guildid = guild.guildid) "
"FROM guild ORDER BY guildid ASC");
if( !result )
{

View file

@ -101,12 +101,12 @@ void PetAI::_stopAttack()
inCombat = false;
if( !m_creature->isAlive() )
{
DEBUG_LOG("Creature stoped attacking cuz his dead [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("PetAI (guid = %u) stopped attack, he is dead.", m_creature->GetGUIDLow());
m_creature->StopMoving();
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
m_creature->CombatStop();
m_creature->getHostilRefManager().deleteReferences();
m_creature->getHostileRefManager().deleteReferences();
return;
}
@ -147,7 +147,7 @@ void PetAI::UpdateAI(const uint32 diff)
{
if (_needToStop())
{
DEBUG_LOG("Pet AI stoped attacking [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("PetAI (guid = %u) is stopping attack.", m_creature->GetGUIDLow());
_stopAttack();
return;
}
@ -287,10 +287,10 @@ void PetAI::UpdateAI(const uint32 diff)
{
m_creature->SetInFront(target);
if (target->GetTypeId() == TYPEID_PLAYER)
m_creature->SendUpdateToPlayer((Player*)target);
m_creature->SendCreateUpdateToPlayer((Player*)target);
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
m_creature->SendUpdateToPlayer( (Player*)owner );
m_creature->SendCreateUpdateToPlayer( (Player*)owner );
}
m_creature->AddCreatureSpellCooldown(spell->m_spellInfo->Id);

View file

@ -197,17 +197,17 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
{
pet->SetInFront(unit_target);
if (unit_target->GetTypeId() == TYPEID_PLAYER)
pet->SendUpdateToPlayer( (Player*)unit_target );
pet->SendCreateUpdateToPlayer( (Player*)unit_target );
}
else if(Unit *unit_target2 = spell->m_targets.getUnitTarget())
{
pet->SetInFront(unit_target2);
if (unit_target2->GetTypeId() == TYPEID_PLAYER)
pet->SendUpdateToPlayer( (Player*)unit_target2 );
pet->SendCreateUpdateToPlayer( (Player*)unit_target2 );
}
if (Unit* powner = pet->GetCharmerOrOwner())
if(powner->GetTypeId() == TYPEID_PLAYER)
pet->SendUpdateToPlayer((Player*)powner);
pet->SendCreateUpdateToPlayer((Player*)powner);
result = SPELL_CAST_OK;
}

View file

@ -859,12 +859,15 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
switch (timer)
{
case FATIGUE_TIMER:
return MINUTE*IN_MILISECONDS;
if (GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_TIMERBAR_FATIGUE_GMLEVEL))
return DISABLED_MIRROR_TIMER;
return sWorld.getConfig(CONFIG_TIMERBAR_FATIGUE_MAX)*IN_MILISECONDS;
case BREATH_TIMER:
{
if (!isAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) || GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_DISABLE_BREATHING))
if (!isAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) ||
GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_TIMERBAR_BREATH_GMLEVEL))
return DISABLED_MIRROR_TIMER;
int32 UnderWaterTime = 3*MINUTE*IN_MILISECONDS;
int32 UnderWaterTime = sWorld.getConfig(CONFIG_TIMERBAR_BREATH_MAX)*IN_MILISECONDS;
AuraList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING);
for(AuraList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
UnderWaterTime = uint32(UnderWaterTime * (100.0f + (*i)->GetModifier()->m_amount) / 100.0f);
@ -872,9 +875,9 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
}
case FIRE_TIMER:
{
if (!isAlive())
if (!isAlive() || GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_TIMERBAR_FIRE_GMLEVEL))
return DISABLED_MIRROR_TIMER;
return 1*IN_MILISECONDS;
return sWorld.getConfig(CONFIG_TIMERBAR_FIRE_MAX)*IN_MILISECONDS;
}
default:
return 0;
@ -2182,7 +2185,7 @@ void Player::SetInWater(bool apply)
// remove auras that need water/land
RemoveAurasWithInterruptFlags(apply ? AURA_INTERRUPT_FLAG_NOT_ABOVEWATER : AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
getHostilRefManager().updateThreatTables();
getHostileRefManager().updateThreatTables();
}
void Player::SetGameMaster(bool on)
@ -2196,7 +2199,7 @@ void Player::SetGameMaster(bool on)
if (Pet* pet = GetPet())
{
pet->setFaction(35);
pet->getHostilRefManager().setOnlineOfflineState(false);
pet->getHostileRefManager().setOnlineOfflineState(false);
}
for (int8 i = 0; i < MAX_TOTEM; ++i)
@ -2207,7 +2210,7 @@ void Player::SetGameMaster(bool on)
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
ResetContestedPvP();
getHostilRefManager().setOnlineOfflineState(false);
getHostileRefManager().setOnlineOfflineState(false);
CombatStopWithPets();
SetPhaseMask(PHASEMASK_ANYWHERE,false); // see and visible in all phases
@ -2225,7 +2228,7 @@ void Player::SetGameMaster(bool on)
if (Pet* pet = GetPet())
{
pet->setFaction(getFaction());
pet->getHostilRefManager().setOnlineOfflineState(true);
pet->getHostileRefManager().setOnlineOfflineState(true);
}
for (int8 i = 0; i < MAX_TOTEM; ++i)
@ -2240,7 +2243,7 @@ void Player::SetGameMaster(bool on)
// restore FFA PvP area state, remove not allowed for GM mounts
UpdateArea(m_areaUpdateId);
getHostilRefManager().setOnlineOfflineState(true);
getHostileRefManager().setOnlineOfflineState(true);
}
UpdateVisibilityForPlayer();
@ -10407,7 +10410,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
if (IsInWorld() && update)
{
pItem->AddToWorld();
pItem->SendUpdateToPlayer( this );
pItem->SendCreateUpdateToPlayer( this );
}
pItem->SetState(ITEM_CHANGED, this);
@ -10418,7 +10421,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
if( IsInWorld() && update )
{
pItem->AddToWorld();
pItem->SendUpdateToPlayer( this );
pItem->SendCreateUpdateToPlayer( this );
}
pItem->SetState(ITEM_CHANGED, this);
pBag->SetState(ITEM_CHANGED, this);
@ -10438,7 +10441,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
pItem2->SetCount( pItem2->GetCount() + count );
if (IsInWorld() && update)
pItem2->SendUpdateToPlayer( this );
pItem2->SendCreateUpdateToPlayer( this );
if (!clone)
{
@ -10528,7 +10531,7 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
if( IsInWorld() && update )
{
pItem->AddToWorld();
pItem->SendUpdateToPlayer( this );
pItem->SendCreateUpdateToPlayer( this );
}
ApplyEquipCooldown(pItem);
@ -10548,7 +10551,7 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
{
pItem2->SetCount( pItem2->GetCount() + pItem->GetCount() );
if( IsInWorld() && update )
pItem2->SendUpdateToPlayer( this );
pItem2->SendCreateUpdateToPlayer( this );
// delete item (it not in any slot currently)
//pItem->DeleteFromDB();
@ -10589,7 +10592,7 @@ void Player::QuickEquipItem( uint16 pos, Item *pItem)
if( IsInWorld() )
{
pItem->AddToWorld();
pItem->SendUpdateToPlayer( this );
pItem->SendCreateUpdateToPlayer( this );
}
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
@ -10711,7 +10714,7 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update )
// pItem->SetUInt64Value( ITEM_FIELD_OWNER, 0 ); not clear owner at remove (it will be set at store). This used in mail and auction code
pItem->SetSlot( NULL_SLOT );
if( IsInWorld() && update )
pItem->SendUpdateToPlayer( this );
pItem->SendCreateUpdateToPlayer( this );
}
}
@ -10859,7 +10862,7 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq
ItemRemovedQuestCheck( pItem->GetEntry(), count - remcount );
pItem->SetCount( pItem->GetCount() - count + remcount );
if (IsInWorld() & update)
pItem->SendUpdateToPlayer( this );
pItem->SendCreateUpdateToPlayer( this );
pItem->SetState(ITEM_CHANGED, this);
return;
}
@ -10887,7 +10890,7 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq
ItemRemovedQuestCheck( pItem->GetEntry(), count - remcount );
pItem->SetCount( pItem->GetCount() - count + remcount );
if (IsInWorld() & update)
pItem->SendUpdateToPlayer( this );
pItem->SendCreateUpdateToPlayer( this );
pItem->SetState(ITEM_CHANGED, this);
return;
}
@ -10920,7 +10923,7 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq
ItemRemovedQuestCheck( pItem->GetEntry(), count - remcount );
pItem->SetCount( pItem->GetCount() - count + remcount );
if (IsInWorld() && update)
pItem->SendUpdateToPlayer( this );
pItem->SendCreateUpdateToPlayer( this );
pItem->SetState(ITEM_CHANGED, this);
return;
}
@ -10953,7 +10956,7 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq
ItemRemovedQuestCheck( pItem->GetEntry(), count - remcount );
pItem->SetCount( pItem->GetCount() - count + remcount );
if (IsInWorld() & update)
pItem->SendUpdateToPlayer( this );
pItem->SendCreateUpdateToPlayer( this );
pItem->SetState(ITEM_CHANGED, this);
return;
}
@ -11038,7 +11041,7 @@ void Player::DestroyItemCount( Item* pItem, uint32 &count, bool update )
pItem->SetCount( pItem->GetCount() - count );
count = 0;
if( IsInWorld() & update )
pItem->SendUpdateToPlayer( this );
pItem->SendCreateUpdateToPlayer( this );
pItem->SetState(ITEM_CHANGED, this);
}
}
@ -11103,7 +11106,7 @@ void Player::SplitItem( uint16 src, uint16 dst, uint32 count )
}
if( IsInWorld() )
pSrcItem->SendUpdateToPlayer( this );
pSrcItem->SendCreateUpdateToPlayer( this );
pSrcItem->SetState(ITEM_CHANGED, this);
StoreItem( dest, pNewItem, true);
}
@ -11123,7 +11126,7 @@ void Player::SplitItem( uint16 src, uint16 dst, uint32 count )
}
if( IsInWorld() )
pSrcItem->SendUpdateToPlayer( this );
pSrcItem->SendCreateUpdateToPlayer( this );
pSrcItem->SetState(ITEM_CHANGED, this);
BankItem( dest, pNewItem, true);
}
@ -11143,7 +11146,7 @@ void Player::SplitItem( uint16 src, uint16 dst, uint32 count )
}
if( IsInWorld() )
pSrcItem->SendUpdateToPlayer( this );
pSrcItem->SendCreateUpdateToPlayer( this );
pSrcItem->SetState(ITEM_CHANGED, this);
EquipItem( dest, pNewItem, true);
AutoUnequipOffhandIfNeed();
@ -11314,8 +11317,8 @@ void Player::SwapItem( uint16 src, uint16 dst )
pDstItem->SetState(ITEM_CHANGED, this);
if( IsInWorld() )
{
pSrcItem->SendUpdateToPlayer( this );
pDstItem->SendUpdateToPlayer( this );
pSrcItem->SendCreateUpdateToPlayer( this );
pDstItem->SendCreateUpdateToPlayer( this );
}
}
return;
@ -16936,7 +16939,7 @@ void Player::HandleStealthedUnitsDetection()
{
if(!hasAtClient)
{
(*i)->SendUpdateToPlayer(this);
(*i)->SendCreateUpdateToPlayer(this);
m_clientGUIDs.insert((*i)->GetGUID());
#ifdef MANGOS_DEBUG
@ -18109,7 +18112,7 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe
{
if(target->isVisibleForInState(this, viewPoint, false))
{
target->SendUpdateToPlayer(this);
target->SendCreateUpdateToPlayer(this);
if(target->GetTypeId()!=TYPEID_GAMEOBJECT||!((GameObject*)target)->IsTransport())
m_clientGUIDs.insert(target->GetGUID());
@ -18163,7 +18166,6 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateD
if(target->isVisibleForInState(this,viewPoint,false))
{
visibleNow.insert(target);
target->BuildUpdate(data_updates);
target->BuildCreateUpdateBlockForPlayer(&data, this);
UpdateVisibilityOf_helper(m_clientGUIDs,target);

View file

@ -42,7 +42,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
if(!&unit)
return false;
if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED))
return true;
Traveller<T> traveller(unit);

View file

@ -129,7 +129,7 @@ template<>
bool
RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff)
{
if(creature.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
if(creature.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED | UNIT_STAT_DIED))
{
i_nextMoveTime.Update(i_nextMoveTime.GetExpiry()); // Expire the timer
creature.clearUnitState(UNIT_STAT_ROAMING);

View file

@ -68,7 +68,7 @@ void
ReactorAI::UpdateAI(const uint32 /*time_diff*/)
{
// update i_victimGuid if i_creature.getVictim() !=0 and changed
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim())
if(!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
i_victimGuid = m_creature->getVictim()->GetGUID();
@ -88,7 +88,7 @@ ReactorAI::EnterEvadeMode()
{
if( !m_creature->isAlive() )
{
DEBUG_LOG("Creature stoped attacking cuz his dead [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, he is dead [guid=%u]", m_creature->GetGUIDLow());
m_creature->GetMotionMaster()->MovementExpired();
m_creature->GetMotionMaster()->MoveIdle();
i_victimGuid = 0;
@ -101,19 +101,19 @@ ReactorAI::EnterEvadeMode()
if( !victim )
{
DEBUG_LOG("Creature stopped attacking because victim is non exist [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, no victim [guid=%u]", m_creature->GetGUIDLow());
}
else if( victim->HasStealthAura() )
{
DEBUG_LOG("Creature stopped attacking cuz his victim is stealth [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, victim is in stealth [guid=%u]", m_creature->GetGUIDLow());
}
else if( victim->isInFlight() )
{
DEBUG_LOG("Creature stopped attacking cuz his victim is fly away [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, victim is in flight [guid=%u]", m_creature->GetGUIDLow());
}
else
{
DEBUG_LOG("Creature stopped attacking due to target %s [guid=%u]", victim->isAlive() ? "out run him" : "is dead", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking, victim %s [guid=%u]", victim->isAlive() ? "out run him" : "is dead", m_creature->GetGUIDLow());
}
m_creature->RemoveAllAuras();

View file

@ -1004,6 +1004,15 @@ enum SpellImmunity
#define MAX_SPELL_IMMUNITY 6
enum WeaponAttackType
{
BASE_ATTACK = 0,
OFF_ATTACK = 1,
RANGED_ATTACK = 2
};
#define MAX_ATTACK 3
enum Targets
{
TARGET_SELF = 1,
@ -2368,8 +2377,8 @@ enum PetDiet
enum AiReaction
{
AI_REACTION_UNK1 = 1,
AI_REACTION_AGGRO = 2,
AI_REACTION_UNK3 = 3,
AI_REACTION_AGGRO = 2, // trigger aggro sound to play, if defined in dbc
AI_REACTION_UNK3 = 3, // seen happen at polymorph, possible when AI not in control of self?
AI_REACTION_UNK4 = 4
};

View file

@ -351,25 +351,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_applyMultiplierMask = 0;
// Get data for type of attack
switch (m_spellInfo->DmgClass)
{
case SPELL_DAMAGE_CLASS_MELEE:
if (m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_REQ_OFFHAND)
m_attackType = OFF_ATTACK;
else
m_attackType = BASE_ATTACK;
break;
case SPELL_DAMAGE_CLASS_RANGED:
m_attackType = RANGED_ATTACK;
break;
default:
// Wands
if (m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG)
m_attackType = RANGED_ATTACK;
else
m_attackType = BASE_ATTACK;
break;
}
m_attackType = GetWeaponAttackType(m_spellInfo);
m_spellSchoolMask = GetSpellSchoolMask(info); // Can be override for some spell (wand shoot for example)
@ -499,11 +481,11 @@ void Spell::FillTargetMap()
continue;
// targets for TARGET_SCRIPT_COORDINATES (A) and TARGET_SCRIPT
// and TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT (A) if no RequiresSpellFocus set
// for TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT (A) all is checked in Spell::CheckCast and in Spell::CheckItem
// filled in Spell::CheckCast call
if(m_spellInfo->EffectImplicitTargetA[i] == TARGET_SCRIPT_COORDINATES ||
m_spellInfo->EffectImplicitTargetA[i] == TARGET_SCRIPT ||
(m_spellInfo->EffectImplicitTargetA[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT && !m_spellInfo->RequiresSpellFocus) ||
m_spellInfo->EffectImplicitTargetA[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT ||
(m_spellInfo->EffectImplicitTargetB[i] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[i] != TARGET_SELF))
continue;
@ -988,7 +970,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo);
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo, crit);
unitTarget->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo);
unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo);
}
// Do damage and triggers
else if (m_damage)
@ -997,7 +979,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask);
// Add bonuses and fill damageInfo struct
caster->CalculateSpellDamage(&damageInfo, m_damage, m_spellInfo);
caster->CalculateSpellDamage(&damageInfo, m_damage, m_spellInfo, m_attackType);
caster->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
// Send log damage message to client
@ -1134,7 +1116,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if (unit->isInCombat() && !(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_INITIAL_AGGRO))
{
realCaster->SetInCombatState(unit->GetCombatTimer() > 0);
unit->getHostilRefManager().threatAssist(realCaster, 0.0f);
unit->getHostileRefManager().threatAssist(realCaster, 0.0f);
}
}
}
@ -1329,31 +1311,6 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
switch(targetMode)
{
case TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT:
{
if(m_spellInfo->RequiresSpellFocus)
{
CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
GameObject* goTarget = NULL;
MaNGOS::GameObjectFocusCheck go_check(m_caster, m_spellInfo->RequiresSpellFocus);
MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck> checker(m_caster, goTarget, go_check);
TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck>, GridTypeMapContainer > object_checker(checker);
CellLock<GridReadGuard> cell_lock(cell, p);
Map& map = *m_caster->GetMap();
cell_lock->Visit(cell_lock, object_checker, map, *m_caster, map.GetVisibilityDistance());
if(goTarget)
AddGOTarget(goTarget, effIndex);
}
else if(m_targets.getGOTarget())
AddGOTarget(m_targets.getGOTarget(), effIndex);
break;
}
case TARGET_RANDOM_NEARBY_LOC:
radius *= sqrt(rand_norm()); // Get a random point in circle. Use sqrt(rand) to correct distribution when converting polar to Cartesian coordinates.
// no 'break' expected since we use code in case TARGET_RANDOM_CIRCUMFERENCE_POINT!!!
@ -4164,10 +4121,11 @@ SpellCastResult Spell::CheckCast(bool strict)
for(uint8 j = 0; j < 3; ++j)
{
if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT ||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[j] != TARGET_SELF ||
(m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[j] != TARGET_SELF) ||
m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES ||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES ||
m_spellInfo->EffectImplicitTargetA[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT )
// Check possible in DB targets only for spells with no implicit spell focus
(m_spellInfo->EffectImplicitTargetA[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT && !m_spellInfo->RequiresSpellFocus))
{
SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(m_spellInfo->Id);

View file

@ -3566,51 +3566,7 @@ void Aura::HandleFeignDeath(bool apply, bool Real)
if(!Real)
return;
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
if( apply )
{
/*
WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
data<<m_target->GetGUID();
data<<uint8(0);
m_target->SendMessageToSet(&data,true);
*/
// blizz like 2.0.x
m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29);
// blizz like 2.0.x
m_target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
// blizz like 2.0.x
m_target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
m_target->addUnitState(UNIT_STAT_DIED);
m_target->CombatStop();
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
// prevent interrupt message
if (m_caster_guid==m_target->GetGUID())
m_target->FinishSpell(CURRENT_GENERIC_SPELL,false);
m_target->InterruptNonMeleeSpells(true);
m_target->getHostilRefManager().deleteReferences();
}
else
{
/*
WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
data<<m_target->GetGUID();
data<<uint8(1);
m_target->SendMessageToSet(&data,true);
*/
// blizz like 2.0.x
m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29);
// blizz like 2.0.x
m_target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
// blizz like 2.0.x
m_target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
m_target->clearUnitState(UNIT_STAT_DIED);
}
m_target->SetFeignDeath(apply, GetCasterGUID(), GetId());
}
void Aura::HandleAuraModDisarm(bool apply, bool Real)
@ -4082,7 +4038,7 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real)
float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount);
m_target->getHostilRefManager().threatAssist(caster, threatMod);
m_target->getHostileRefManager().threatAssist(caster, threatMod);
}
void Aura::HandleModTaunt(bool apply, bool Real)
@ -6325,6 +6281,16 @@ void Aura::PeriodicTick()
{
pdamage = amount;
// SpellDamageBonus for magic spells
if(GetSpellProto()->DmgClass == SPELL_DAMAGE_CLASS_NONE || GetSpellProto()->DmgClass == SPELL_DAMAGE_CLASS_MAGIC)
pdamage = pCaster->SpellDamageBonus(m_target, GetSpellProto(), pdamage, DOT, GetStackAmount());
// MeleeDamagebonus for weapon based spells
else
{
WeaponAttackType attackType = GetWeaponAttackType(GetSpellProto());
pdamage = pCaster->MeleeDamageBonus(m_target, pdamage, attackType, GetSpellProto(), DOT, GetStackAmount());
}
// Calculate armor mitigation if it is a physical spell
// But not for bleed mechanic spells
if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL &&
@ -6335,8 +6301,6 @@ void Aura::PeriodicTick()
pdamage = pdamageReductedArmor;
}
pdamage = pCaster->SpellDamageBonus(m_target, GetSpellProto(), pdamage, DOT, GetStackAmount());
// Curse of Agony damage-per-tick calculation
if (GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000400)) && GetSpellProto()->SpellIconID==544)
{
@ -6444,7 +6408,7 @@ void Aura::PeriodicTick()
uint32 heal = pCaster->SpellHealingBonus(pCaster, GetSpellProto(), uint32(new_damage * multiplier), DOT, GetStackAmount());
int32 gain = pCaster->DealHeal(pCaster, heal, GetSpellProto());
pCaster->getHostilRefManager().threatAssist(pCaster, gain * 0.5f, GetSpellProto());
pCaster->getHostileRefManager().threatAssist(pCaster, gain * 0.5f, GetSpellProto());
break;
}
case SPELL_AURA_PERIODIC_HEAL:
@ -6496,7 +6460,7 @@ void Aura::PeriodicTick()
if( BattleGround *bg = ((Player*)pCaster)->GetBattleGround() )
bg->UpdatePlayerScore(((Player*)pCaster), SCORE_HEALING_DONE, gain);
m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
SpellEntry const* spellProto = GetSpellProto();
@ -6626,7 +6590,7 @@ void Aura::PeriodicTick()
int32 gain = m_target->ModifyPower(power,pdamage);
if(Unit* pCaster = GetCaster())
m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
break;
}
case SPELL_AURA_OBS_MOD_MANA:
@ -6648,7 +6612,7 @@ void Aura::PeriodicTick()
int32 gain = m_target->ModifyPower(POWER_MANA, pdamage);
if(Unit* pCaster = GetCaster())
m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
break;
}
case SPELL_AURA_POWER_BURN_MANA:
@ -6701,7 +6665,7 @@ void Aura::PeriodicTick()
{
int32 gain = m_target->ModifyHealth(m_modifier.m_amount);
if (Unit *caster = GetCaster())
m_target->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
m_target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
break;
}
case SPELL_AURA_MOD_POWER_REGEN:

View file

@ -2584,7 +2584,7 @@ void Spell::EffectHealPct( uint32 /*i*/ )
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this);
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo);
unitTarget->getHostilRefManager().threatAssist(m_caster, float(gain) * 0.5f, m_spellInfo);
unitTarget->getHostileRefManager().threatAssist(m_caster, float(gain) * 0.5f, m_spellInfo);
}
}
@ -2858,6 +2858,7 @@ void Spell::EffectEnergize(uint32 i)
case 31930: // Judgements of the Wise
case 63375: // Improved Stormstrike
damage = damage * unitTarget->GetCreateMana() / 100;
break;
default:
break;
}
@ -4608,11 +4609,7 @@ void Spell::EffectWeaponDmg(uint32 i)
bonus = int32(bonus*totalDamagePercentMod);
// prevent negative damage
uint32 eff_damage = uint32(bonus > 0 ? bonus : 0);
// Add melee damage bonuses (also check for negative)
m_caster->MeleeDamageBonus(unitTarget, &eff_damage, m_attackType, m_spellInfo);
m_damage+= eff_damage;
m_damage+= uint32(bonus > 0 ? bonus : 0);
// Hemorrhage
if (m_spellInfo->SpellFamilyName==SPELLFAMILY_ROGUE && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x2000000)))
@ -5516,7 +5513,7 @@ void Spell::EffectSanctuary(uint32 /*i*/)
//unitTarget->CombatStop();
unitTarget->CombatStop();
unitTarget->getHostilRefManager().deleteReferences(); // stop all fighting
unitTarget->getHostileRefManager().deleteReferences(); // stop all fighting
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
if(m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (m_spellInfo->SpellFamilyFlags & SPELLFAMILYFLAG_ROGUE_VANISH))
{

View file

@ -90,6 +90,60 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
return (castTime > 0) ? uint32(castTime) : 0;
}
uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo)
{
int32 DotDuration = GetSpellDuration(spellInfo);
if(DotDuration == 0)
return 1;
// 200% limit
if(DotDuration > 30000)
DotDuration = 30000;
int j = 0;
for( ; j < 3; j++)
{
if( spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA && (
spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE ||
spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_HEAL ||
spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) )
{
break;
}
}
if(spellInfo->EffectAmplitude[j] != 0)
return DotDuration / spellInfo->EffectAmplitude[j];
return 6;
}
WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo)
{
if(!spellInfo)
return BASE_ATTACK;
switch (spellInfo->DmgClass)
{
case SPELL_DAMAGE_CLASS_MELEE:
if (spellInfo->AttributesEx3 & SPELL_ATTR_EX3_REQ_OFFHAND)
return OFF_ATTACK;
else
return BASE_ATTACK;
break;
case SPELL_DAMAGE_CLASS_RANGED:
return RANGED_ATTACK;
break;
default:
// Wands
if (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG)
return RANGED_ATTACK;
else
return BASE_ATTACK;
break;
}
}
bool IsPassiveSpell(uint32 spellId)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
@ -2145,11 +2199,37 @@ void SpellMgr::LoadSpellScriptTarget()
continue;
}
// More checks on TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT
bool ok = true;
for (int i = 0; i < 3; ++i)
{
if (spellProto->EffectImplicitTargetA[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT ||
spellProto->EffectImplicitTargetB[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT)
{
if (spellProto->RequiresSpellFocus)
{
sLog.outErrorDb("Table `spell_script_target`: spellId %u for TargetEnty %u of type TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT is wrong because spell has implicit ReqSpellFocus %u.", spellId, targetEntry, spellProto->RequiresSpellFocus);
ok = false;
break;
}
if (type != SPELL_TARGET_TYPE_GAMEOBJECT)
{
sLog.outErrorDb("Table `spell_script_target`: spellId %u has target type TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT but target in table is creature (must be gameobject).", spellId);
ok = false;
break;
}
}
}
if (!ok)
continue;
// Checks by target type
switch (type)
{
case SPELL_TARGET_TYPE_GAMEOBJECT:
{
if( targetEntry==0 )
if (!targetEntry)
break;
if (!sGOStorage.LookupEntry<GameObjectInfo>(targetEntry))
@ -2160,26 +2240,25 @@ void SpellMgr::LoadSpellScriptTarget()
break;
}
default:
{
if( targetEntry==0 )
if (!targetEntry)
{
sLog.outErrorDb("Table `spell_script_target`: target entry == 0 for not GO target type (%u).",type);
continue;
}
if(!sCreatureStorage.LookupEntry<CreatureInfo>(targetEntry))
if (const CreatureInfo* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(targetEntry))
{
sLog.outErrorDb("Table `spell_script_target`: creature template entry %u does not exist.",targetEntry);
continue;
}
const CreatureInfo* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(targetEntry);
if (spellId == 30427 && !cInfo->SkinLootId)
{
sLog.outErrorDb("Table `spell_script_target` has creature %u as a target of spellid 30427, but this creature has no skinlootid. Gas extraction will not work!", cInfo->Entry);
continue;
}
break;
}
else
{
sLog.outErrorDb("Table `spell_script_target`: creature template entry %u does not exist.",targetEntry);
continue;
}
break;
}
mSpellScriptTarget.insert(SpellScriptTarget::value_type(spellId,SpellTargetEntry(SpellTargetType(type),targetEntry)));

View file

@ -125,6 +125,8 @@ inline float GetSpellMaxRange(SpellRangeEntry const *range, bool friendly = fals
inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo) { return spellInfo->RecoveryTime > spellInfo->CategoryRecoveryTime ? spellInfo->RecoveryTime : spellInfo->CategoryRecoveryTime; }
int32 GetSpellDuration(SpellEntry const *spellInfo);
int32 GetSpellMaxDuration(SpellEntry const *spellInfo);
uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo);
WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo);
inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
{
@ -200,7 +202,7 @@ inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto)
inline bool IsDeathOnlySpell(SpellEntry const *spellInfo)
{
return spellInfo->AttributesEx & SPELL_ATTR_EX3_CAST_ON_DEAD
return spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CAST_ON_DEAD
|| spellInfo->Id == 2584
|| spellInfo->Id == 22011;
}

View file

@ -46,7 +46,7 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
if (!i_target.isValid() || !i_target->IsInWorld())
return;
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED | UNIT_STAT_DIED))
return;
// prevent redundant micro-movement for pets, other followers.
@ -132,7 +132,7 @@ TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
if (!owner.isAlive())
return true;
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_DISTRACTED))
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_DISTRACTED | UNIT_STAT_DIED))
return true;
// prevent movement while casting spells with cast time or channel time

View file

@ -41,10 +41,10 @@ float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float pT
}
//============================================================
//================= HostilReference ==========================
//================= HostileReference ==========================
//============================================================
HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat)
HostileReference::HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat)
{
iThreat = pThreat;
iTempThreatModifyer = 0.0f;
@ -56,14 +56,14 @@ HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, flo
//============================================================
// Tell our refTo (target) object that we have a link
void HostilReference::targetObjectBuildLink()
void HostileReference::targetObjectBuildLink()
{
getTarget()->addHatedBy(this);
}
//============================================================
// Tell our refTo (taget) object, that the link is cut
void HostilReference::targetObjectDestroyLink()
void HostileReference::targetObjectDestroyLink()
{
getTarget()->removeHatedBy(this);
}
@ -71,7 +71,7 @@ void HostilReference::targetObjectDestroyLink()
//============================================================
// Tell our refFrom (source) object, that the link is cut (Target destroyed)
void HostilReference::sourceObjectDestroyLink()
void HostileReference::sourceObjectDestroyLink()
{
setOnlineOfflineState(false);
}
@ -79,7 +79,7 @@ void HostilReference::sourceObjectDestroyLink()
//============================================================
// Inform the source, that the status of the reference changed
void HostilReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent)
void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent)
{
if(getSource())
getSource()->processThreatEvent(&pThreatRefStatusChangeEvent);
@ -87,7 +87,7 @@ void HostilReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefSt
//============================================================
void HostilReference::addThreat(float pMod)
void HostileReference::addThreat(float pMod)
{
iThreat += pMod;
// the threat is changed. Source and target unit have to be availabe
@ -111,7 +111,7 @@ void HostilReference::addThreat(float pMod)
//============================================================
// check, if source can reach target and set the status
void HostilReference::updateOnlineStatus()
void HostileReference::updateOnlineStatus()
{
bool online = false;
bool accessible = false;
@ -148,7 +148,7 @@ void HostilReference::updateOnlineStatus()
//============================================================
// set the status and fire the event on status change
void HostilReference::setOnlineOfflineState(bool pIsOnline)
void HostileReference::setOnlineOfflineState(bool pIsOnline)
{
if(iOnline != pIsOnline)
{
@ -163,7 +163,7 @@ void HostilReference::setOnlineOfflineState(bool pIsOnline)
//============================================================
void HostilReference::setAccessibleState(bool pIsAccessible)
void HostileReference::setAccessibleState(bool pIsAccessible)
{
if(iAccessible != pIsAccessible)
{
@ -178,7 +178,7 @@ void HostilReference::setAccessibleState(bool pIsAccessible)
// prepare the reference for deleting
// this is called be the target
void HostilReference::removeReference()
void HostileReference::removeReference()
{
invalidate();
@ -188,7 +188,7 @@ void HostilReference::removeReference()
//============================================================
Unit* HostilReference::getSourceUnit()
Unit* HostileReference::getSourceUnit()
{
return (getSource()->getOwner());
}
@ -199,7 +199,7 @@ Unit* HostilReference::getSourceUnit()
void ThreatContainer::clearReferences()
{
for(std::list<HostilReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
for(std::list<HostileReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
{
(*i)->unlink();
delete (*i);
@ -208,12 +208,12 @@ void ThreatContainer::clearReferences()
}
//============================================================
// Return the HostilReference of NULL, if not found
HostilReference* ThreatContainer::getReferenceByTarget(Unit* pVictim)
// Return the HostileReference of NULL, if not found
HostileReference* ThreatContainer::getReferenceByTarget(Unit* pVictim)
{
HostilReference* result = NULL;
HostileReference* result = NULL;
uint64 guid = pVictim->GetGUID();
for(std::list<HostilReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
for(std::list<HostileReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
{
if((*i)->getUnitGuid() == guid)
{
@ -228,9 +228,9 @@ HostilReference* ThreatContainer::getReferenceByTarget(Unit* pVictim)
//============================================================
// Add the threat, if we find the reference
HostilReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat)
HostileReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat)
{
HostilReference* ref = getReferenceByTarget(pVictim);
HostileReference* ref = getReferenceByTarget(pVictim);
if(ref)
ref->addThreat(pThreat);
return ref;
@ -240,13 +240,13 @@ HostilReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat)
void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 pPercent)
{
if(HostilReference* ref = getReferenceByTarget(pVictim))
if(HostileReference* ref = getReferenceByTarget(pVictim))
ref->addThreatPercent(pPercent);
}
//============================================================
bool HostilReferenceSortPredicate(const HostilReference* lhs, const HostilReference* rhs)
bool HostileReferenceSortPredicate(const HostileReference* lhs, const HostileReference* rhs)
{
// std::list::sort ordering predicate must be: (Pred(x,y)&&Pred(y,x))==false
return lhs->getThreat() > rhs->getThreat(); // reverse sorting
@ -259,7 +259,7 @@ void ThreatContainer::update()
{
if(iDirty && iThreatList.size() >1)
{
iThreatList.sort(HostilReferenceSortPredicate);
iThreatList.sort(HostileReferenceSortPredicate);
}
iDirty = false;
}
@ -268,16 +268,16 @@ void ThreatContainer::update()
// return the next best victim
// could be the current victim
HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilReference* pCurrentVictim)
HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostileReference* pCurrentVictim)
{
HostilReference* currentRef = NULL;
HostileReference* currentRef = NULL;
bool found = false;
bool noPriorityTargetFound = false;
std::list<HostilReference*>::const_iterator lastRef = iThreatList.end();
std::list<HostileReference*>::const_iterator lastRef = iThreatList.end();
lastRef--;
for(std::list<HostilReference*>::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;)
for(std::list<HostileReference*>::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;)
{
currentRef = (*iter);
@ -380,7 +380,7 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask scho
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, schoolMask, pThreatSpell);
HostilReference* ref = iThreatContainer.addThreat(pVictim, threat);
HostileReference* ref = iThreatContainer.addThreat(pVictim, threat);
// Ref is not in the online refs, search the offline refs next
if(!ref)
ref = iThreatOfflineContainer.addThreat(pVictim, threat);
@ -388,11 +388,11 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask scho
if(!ref) // there was no ref => create a new one
{
// threat has to be 0 here
HostilReference* hostilReference = new HostilReference(pVictim, this, 0);
iThreatContainer.addReference(hostilReference);
hostilReference->addThreat(threat); // now we add the real threat
HostileReference* hostileReference = new HostileReference(pVictim, this, 0);
iThreatContainer.addReference(hostileReference);
hostileReference->addThreat(threat); // now we add the real threat
if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster())
hostilReference->setOnlineOfflineState(false); // GM is always offline
hostileReference->setOnlineOfflineState(false); // GM is always offline
}
}
@ -405,10 +405,10 @@ void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 pPercent)
//============================================================
Unit* ThreatManager::getHostilTarget()
Unit* ThreatManager::getHostileTarget()
{
iThreatContainer.update();
HostilReference* nextVictim = iThreatContainer.selectNextVictim((Creature*) getOwner(), getCurrentVictim());
HostileReference* nextVictim = iThreatContainer.selectNextVictim((Creature*) getOwner(), getCurrentVictim());
setCurrentVictim(nextVictim);
return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : NULL;
}
@ -418,7 +418,7 @@ Unit* ThreatManager::getHostilTarget()
float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList)
{
float threat = 0.0f;
HostilReference* ref = iThreatContainer.getReferenceByTarget(pVictim);
HostileReference* ref = iThreatContainer.getReferenceByTarget(pVictim);
if(!ref && pAlsoSearchOfflineList)
ref = iThreatOfflineContainer.getReferenceByTarget(pVictim);
if(ref)
@ -430,7 +430,7 @@ float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList)
void ThreatManager::tauntApply(Unit* pTaunter)
{
HostilReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
if(getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat()))
{
if(ref->getTempThreatModifyer() == 0.0f)
@ -443,16 +443,16 @@ void ThreatManager::tauntApply(Unit* pTaunter)
void ThreatManager::tauntFadeOut(Unit *pTaunter)
{
HostilReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
if(ref)
ref->resetTempThreat();
}
//============================================================
void ThreatManager::setCurrentVictim(HostilReference* pHostilReference)
void ThreatManager::setCurrentVictim(HostileReference* pHostileReference)
{
iCurrentVictim = pHostilReference;
iCurrentVictim = pHostileReference;
}
//============================================================
@ -463,44 +463,44 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
{
threatRefStatusChangeEvent->setThreatManager(this); // now we can set the threat manager
HostilReference* hostilReference = threatRefStatusChangeEvent->getReference();
HostileReference* hostileReference = threatRefStatusChangeEvent->getReference();
switch(threatRefStatusChangeEvent->getType())
{
case UEV_THREAT_REF_THREAT_CHANGE:
if((getCurrentVictim() == hostilReference && threatRefStatusChangeEvent->getFValue()<0.0f) ||
(getCurrentVictim() != hostilReference && threatRefStatusChangeEvent->getFValue()>0.0f))
if((getCurrentVictim() == hostileReference && threatRefStatusChangeEvent->getFValue()<0.0f) ||
(getCurrentVictim() != hostileReference && threatRefStatusChangeEvent->getFValue()>0.0f))
setDirty(true); // the order in the threat list might have changed
break;
case UEV_THREAT_REF_ONLINE_STATUS:
if(!hostilReference->isOnline())
if(!hostileReference->isOnline())
{
if (hostilReference == getCurrentVictim())
if (hostileReference == getCurrentVictim())
{
setCurrentVictim(NULL);
setDirty(true);
}
iThreatContainer.remove(hostilReference);
iThreatOfflineContainer.addReference(hostilReference);
iThreatContainer.remove(hostileReference);
iThreatOfflineContainer.addReference(hostileReference);
}
else
{
if(getCurrentVictim() && hostilReference->getThreat() > (1.1f * getCurrentVictim()->getThreat()))
if(getCurrentVictim() && hostileReference->getThreat() > (1.1f * getCurrentVictim()->getThreat()))
setDirty(true);
iThreatContainer.addReference(hostilReference);
iThreatOfflineContainer.remove(hostilReference);
iThreatContainer.addReference(hostileReference);
iThreatOfflineContainer.remove(hostileReference);
}
break;
case UEV_THREAT_REF_REMOVE_FROM_LIST:
if (hostilReference == getCurrentVictim())
if (hostileReference == getCurrentVictim())
{
setCurrentVictim(NULL);
setDirty(true);
}
if(hostilReference->isOnline())
iThreatContainer.remove(hostilReference);
if(hostileReference->isOnline())
iThreatContainer.remove(hostileReference);
else
iThreatOfflineContainer.remove(hostilReference);
iThreatOfflineContainer.remove(hostileReference);
break;
}
}

View file

@ -43,10 +43,10 @@ class ThreatCalcHelper
};
//==============================================================
class MANGOS_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager>
class MANGOS_DLL_SPEC HostileReference : public Reference<Unit, ThreatManager>
{
public:
HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat);
HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat);
//=================================================
void addThreat(float pMod);
@ -86,7 +86,7 @@ class MANGOS_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager>
void setAccessibleState(bool pIsAccessible);
//=================================================
bool operator ==(const HostilReference& pHostilReference) const { return pHostilReference.getUnitGuid() == getUnitGuid(); }
bool operator ==(const HostileReference& pHostileReference) const { return pHostileReference.getUnitGuid() == getUnitGuid(); }
//=================================================
@ -99,7 +99,7 @@ class MANGOS_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager>
//=================================================
HostilReference* next() { return ((HostilReference* ) Reference<Unit, ThreatManager>::next()); }
HostileReference* next() { return ((HostileReference* ) Reference<Unit, ThreatManager>::next()); }
//=================================================
@ -130,13 +130,13 @@ class ThreatManager;
class MANGOS_DLL_SPEC ThreatContainer
{
private:
std::list<HostilReference*> iThreatList;
std::list<HostileReference*> iThreatList;
bool iDirty;
protected:
friend class ThreatManager;
void remove(HostilReference* pRef) { iThreatList.remove(pRef); }
void addReference(HostilReference* pHostilReference) { iThreatList.push_back(pHostilReference); }
void remove(HostileReference* pRef) { iThreatList.remove(pRef); }
void addReference(HostileReference* pHostileReference) { iThreatList.push_back(pHostileReference); }
void clearReferences();
// Sort the list if necessary
void update();
@ -144,11 +144,11 @@ class MANGOS_DLL_SPEC ThreatContainer
ThreatContainer() { iDirty = false; }
~ThreatContainer() { clearReferences(); }
HostilReference* addThreat(Unit* pVictim, float pThreat);
HostileReference* addThreat(Unit* pVictim, float pThreat);
void modifyThreatPercent(Unit *pVictim, int32 percent);
HostilReference* selectNextVictim(Creature* pAttacker, HostilReference* pCurrentVictim);
HostileReference* selectNextVictim(Creature* pAttacker, HostileReference* pCurrentVictim);
void setDirty(bool pDirty) { iDirty = pDirty; }
@ -156,11 +156,11 @@ class MANGOS_DLL_SPEC ThreatContainer
bool empty() { return(iThreatList.empty()); }
HostilReference* getMostHated() { return iThreatList.empty() ? NULL : iThreatList.front(); }
HostileReference* getMostHated() { return iThreatList.empty() ? NULL : iThreatList.front(); }
HostilReference* getReferenceByTarget(Unit* pVictim);
HostileReference* getReferenceByTarget(Unit* pVictim);
std::list<HostilReference*>& getThreatList() { return iThreatList; }
std::list<HostileReference*>& getThreatList() { return iThreatList; }
};
//=================================================
@ -168,7 +168,7 @@ class MANGOS_DLL_SPEC ThreatContainer
class MANGOS_DLL_SPEC ThreatManager
{
public:
friend class HostilReference;
friend class HostileReference;
explicit ThreatManager(Unit *pOwner);
@ -185,27 +185,27 @@ class MANGOS_DLL_SPEC ThreatManager
void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent);
HostilReference* getCurrentVictim() { return iCurrentVictim; }
HostileReference* getCurrentVictim() { return iCurrentVictim; }
Unit* getOwner() { return iOwner; }
Unit* getHostilTarget();
Unit* getHostileTarget();
void tauntApply(Unit* pTaunter);
void tauntFadeOut(Unit *pTaunter);
void setCurrentVictim(HostilReference* pHostilReference);
void setCurrentVictim(HostileReference* pHostileReference);
void setDirty(bool pDirty) { iThreatContainer.setDirty(pDirty); }
// methods to access the lists from the outside to do sume dirty manipulation (scriping and such)
// I hope they are used as little as possible.
std::list<HostilReference*>& getThreatList() { return iThreatContainer.getThreatList(); }
std::list<HostilReference*>& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); }
std::list<HostileReference*>& getThreatList() { return iThreatContainer.getThreatList(); }
std::list<HostileReference*>& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); }
ThreatContainer& getOnlineContainer() { return iThreatContainer; }
ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; }
private:
HostilReference* iCurrentVictim;
HostileReference* iCurrentVictim;
Unit* iOwner;
ThreatContainer iThreatContainer;
ThreatContainer iThreatOfflineContainer;

File diff suppressed because it is too large Load diff

View file

@ -428,15 +428,6 @@ enum UnitMoveType
extern float baseMoveSpeed[MAX_MOVE_TYPE];
enum WeaponAttackType
{
BASE_ATTACK = 0,
OFF_ATTACK = 1,
RANGED_ATTACK = 2
};
#define MAX_ATTACK 3
enum CombatRating
{
CR_WEAPON_SKILL = 0,
@ -507,7 +498,7 @@ enum UnitFlags
UNIT_FLAG_SILENCED = 0x00002000, // silenced, 2.1.1
UNIT_FLAG_UNK_14 = 0x00004000, // 2.0.8
UNIT_FLAG_UNK_15 = 0x00008000,
UNIT_FLAG_UNK_16 = 0x00010000,
UNIT_FLAG_UNK_16 = 0x00010000, // removes attackable icon
UNIT_FLAG_PACIFIED = 0x00020000, // 3.0.3 ok
UNIT_FLAG_STUNNED = 0x00040000, // 3.0.3 ok
UNIT_FLAG_IN_COMBAT = 0x00080000,
@ -522,7 +513,7 @@ enum UnitFlags
UNIT_FLAG_UNK_28 = 0x10000000,
UNIT_FLAG_UNK_29 = 0x20000000, // used in Feing Death spell
UNIT_FLAG_SHEATHE = 0x40000000,
UNIT_FLAG_UNK_31 = 0x80000000
UNIT_FLAG_UNK_31 = 0x80000000 // set skinnable icon and also changes color of portrait
};
// Value masks for UNIT_FIELD_FLAGS_2
@ -936,7 +927,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
bool CanFreeMove() const
{
return !hasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_IN_FLIGHT |
UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED ) && GetOwnerGUID()==0;
UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED | UNIT_STAT_DIED ) && GetOwnerGUID()==0;
}
uint32 getLevel() const { return GetUInt32Value(UNIT_FIELD_LEVEL); }
@ -1322,6 +1313,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void SetBaseWeaponDamage(WeaponAttackType attType ,WeaponDamageRange damageRange, float value) { m_weaponDamage[attType][damageRange] = value; }
void SetInFront(Unit const* target);
void SetFacingToObject(WorldObject* pObject);
// Visibility system
UnitVisibility GetVisibility() const { return m_Visibility; }
@ -1346,13 +1338,13 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void AddThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
void DeleteThreatList();
bool SelectHostilTarget();
bool SelectHostileTarget();
void TauntApply(Unit* pVictim);
void TauntFadeOut(Unit *taunter);
ThreatManager& getThreatManager() { return m_ThreatManager; }
void addHatedBy(HostilReference* pHostilReference) { m_HostilRefManager.insertFirst(pHostilReference); };
void removeHatedBy(HostilReference* /*pHostilReference*/ ) { /* nothing to do yet */ }
HostilRefManager& getHostilRefManager() { return m_HostilRefManager; }
void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); };
void removeHatedBy(HostileReference* /*pHostileReference*/ ) { /* nothing to do yet */ }
HostileRefManager& getHostileRefManager() { return m_HostileRefManager; }
uint32 GetVisibleAura(uint8 slot)
{
@ -1447,7 +1439,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void SetContestedPvP(Player *attackedPlayer = NULL);
void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellEntry const *spellProto = NULL);
uint32 MeleeDamageBonus(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellEntry const *spellProto = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, uint32 stack =1);
uint32 GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime );
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
@ -1487,8 +1479,9 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
bool IsStopped() const { return !(hasUnitState(UNIT_STAT_MOVING)); }
void StopMoving();
void SetFeared(bool apply, uint64 casterGUID = 0, uint32 spellID = 0, uint32 time = 0);
void SetConfused(bool apply, uint64 casterGUID = 0, uint32 spellID = 0);
void SetFeared(bool apply, uint64 const& casterGUID = 0, uint32 spellID = 0, uint32 time = 0);
void SetConfused(bool apply, uint64 const& casterGUID = 0, uint32 spellID = 0);
void SetFeignDeath(bool apply, uint64 const& casterGUID = 0, uint32 spellID = 0);
void AddComboPointHolder(uint32 lowguid) { m_ComboPointHolders.insert(lowguid); }
void RemoveComboPointHolder(uint32 lowguid) { m_ComboPointHolders.erase(lowguid); }
@ -1587,7 +1580,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
// Manage all Units threatening us
ThreatManager m_ThreatManager;
// Manage all Units that are threatened by us
HostilRefManager m_HostilRefManager;
HostileRefManager m_HostileRefManager;
FollowerRefManager m_FollowingRefManager;

View file

@ -23,7 +23,7 @@
class ThreatContainer;
class ThreatManager;
class HostilReference;
class HostileReference;
//==============================================================
//==============================================================
@ -85,7 +85,7 @@ class MANGOS_DLL_SPEC UnitBaseEvent
class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent
{
private:
HostilReference* iHostilReference;
HostileReference* iHostileReference;
union
{
float iFValue;
@ -94,13 +94,13 @@ class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent
};
ThreatManager* iThreatManager;
public:
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType) { iHostilReference = NULL; }
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType) { iHostileReference = NULL; }
ThreatRefStatusChangeEvent(uint32 pType, HostilReference* pHostilReference) : UnitBaseEvent(pType) { iHostilReference = pHostilReference; }
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; }
ThreatRefStatusChangeEvent(uint32 pType, HostilReference* pHostilReference, float pValue) : UnitBaseEvent(pType) { iHostilReference = pHostilReference; iFValue = pValue; }
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iFValue = pValue; }
ThreatRefStatusChangeEvent(uint32 pType, HostilReference* pHostilReference, bool pValue) : UnitBaseEvent(pType) { iHostilReference = pHostilReference; iBValue = pValue; }
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iBValue = pValue; }
int32 getIValue() const { return iIValue; }
@ -110,7 +110,7 @@ class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent
void setBValue(bool pValue) { iBValue = pValue; }
HostilReference* getReference() const { return iHostilReference; }
HostileReference* getReference() const { return iHostileReference; }
void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; }
@ -125,7 +125,7 @@ class MANGOS_DLL_SPEC ThreatManagerEvent : public ThreatRefStatusChangeEvent
ThreatContainer* iThreatContainer;
public:
ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType) {}
ThreatManagerEvent(uint32 pType, HostilReference* pHostilReference) : ThreatRefStatusChangeEvent(pType, pHostilReference) {}
ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference) {}
void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; }

View file

@ -83,7 +83,7 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint3
// Waypoint movement can be switched on/off
// This is quite handy for escort quests and other stuff
if(creature.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
if(creature.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED | UNIT_STAT_DIED))
return true;
// prevent a crash at empty waypoint path.
@ -233,7 +233,7 @@ uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
void FlightPathMovementGenerator::Initialize(Player &player)
{
player.getHostilRefManager().setOnlineOfflineState(false);
player.getHostileRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT);
player.SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
LoadPath(player);
@ -258,7 +258,7 @@ void FlightPathMovementGenerator::Finalize(Player & player)
if(player.m_taxi.empty())
{
player.getHostilRefManager().setOnlineOfflineState(true);
player.getHostileRefManager().setOnlineOfflineState(true);
if(player.pvpInfo.inHostileArea)
player.CastSpell(&player, 2479, true);

View file

@ -893,8 +893,6 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_SAVE_RESPAWN_TIME_IMMEDIATLY] = sConfig.GetBoolDefault("SaveRespawnTimeImmediately",true);
m_configs[CONFIG_WEATHER] = sConfig.GetBoolDefault("ActivateWeather",true);
m_configs[CONFIG_DISABLE_BREATHING] = sConfig.GetIntDefault("DisableWaterBreath", SEC_CONSOLE);
m_configs[CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL] = sConfig.GetBoolDefault("AlwaysMaxSkillForLevel", false);
if(reload)
@ -996,6 +994,13 @@ void World::LoadConfigSettings(bool reload)
if (m_configs[CONFIG_GUILD_BANK_EVENT_LOG_COUNT] < GUILD_BANK_MAX_LOGS)
m_configs[CONFIG_GUILD_BANK_EVENT_LOG_COUNT] = GUILD_BANK_MAX_LOGS;
m_configs[CONFIG_TIMERBAR_FATIGUE_GMLEVEL] = sConfig.GetIntDefault("TimerBar.Fatigue.GMLevel", SEC_CONSOLE);
m_configs[CONFIG_TIMERBAR_FATIGUE_MAX] = sConfig.GetIntDefault("TimerBar.Fatigue.Max", 60);
m_configs[CONFIG_TIMERBAR_BREATH_GMLEVEL] = sConfig.GetIntDefault("TimerBar.Breath.GMLevel", SEC_CONSOLE);
m_configs[CONFIG_TIMERBAR_BREATH_MAX] = sConfig.GetIntDefault("TimerBar.Breath.Max", 180);
m_configs[CONFIG_TIMERBAR_FIRE_GMLEVEL] = sConfig.GetIntDefault("TimerBar.Fire.GMLevel", SEC_CONSOLE);
m_configs[CONFIG_TIMERBAR_FIRE_MAX] = sConfig.GetIntDefault("TimerBar.Fire.Max", 1);
m_VisibleUnitGreyDistance = sConfig.GetFloatDefault("Visibility.Distance.Grey.Unit", 1);
if(m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE)
{

View file

@ -193,7 +193,6 @@ enum WorldConfigs
CONFIG_DEATH_BONES_BG_OR_ARENA,
CONFIG_THREAT_RADIUS,
CONFIG_INSTANT_LOGOUT,
CONFIG_DISABLE_BREATHING,
CONFIG_ALL_TAXI_PATHS,
CONFIG_DECLINED_NAMES_USED,
CONFIG_LISTEN_RANGE_SAY,
@ -217,6 +216,12 @@ enum WorldConfigs
CONFIG_CLIENTCACHE_VERSION,
CONFIG_GUILD_EVENT_LOG_COUNT,
CONFIG_GUILD_BANK_EVENT_LOG_COUNT,
CONFIG_TIMERBAR_FATIGUE_GMLEVEL,
CONFIG_TIMERBAR_FATIGUE_MAX,
CONFIG_TIMERBAR_BREATH_GMLEVEL,
CONFIG_TIMERBAR_BREATH_MAX,
CONFIG_TIMERBAR_FIRE_GMLEVEL,
CONFIG_TIMERBAR_FIRE_MAX,
CONFIG_VALUE_COUNT
};

View file

@ -297,14 +297,14 @@ void WorldSession::LogoutPlayer(bool Save)
//FIXME: logout must be delayed in case lost connection with client in time of combat
if (_player->GetDeathTimer())
{
_player->getHostilRefManager().deleteReferences();
_player->getHostileRefManager().deleteReferences();
_player->BuildPlayerRepop();
_player->RepopAtGraveyard();
}
else if (!_player->getAttackers().empty())
{
_player->CombatStop();
_player->getHostilRefManager().setOnlineOfflineState(false);
_player->getHostileRefManager().setOnlineOfflineState(false);
_player->RemoveAllAurasOnDeath();
// build set of player who attack _player or who have pet attacking of _player

View file

@ -482,10 +482,6 @@ LogColors = ""
# Enable or disable instant logout for security level (0..4) or high (NOT in combat/while dueling/while falling)
# Default: 1 (Mods/GMs/Admins)
#
# DisableWaterBreath
# Disable/enable waterbreathing for security level (0..4) or high
# Default: 4 (None)
#
# AllFlightPaths
# Players will start with all flight paths (Note: ALL flight paths, not only player's team)
# Default: 0 (false)
@ -549,6 +545,33 @@ LogColors = ""
# Useful when you don't want old log events to be overwritten by new, but increasing can slow down performance
# Default: 25
#
# TimerBar.Fatigue.GMLevel
# Disable/enable fatigue for security level (0..4) or high
# Default: 4 (None)
#
# TimerBar.Fatigue.Max
# Fatigue max timer value (in secs)
# Default: 60 (1 minute)
# 0 (instant death)
#
# TimerBar.Breath.GMLevel
# Disable/enable waterbreathing for security level (0..4) or high
# Default: 4 (None)
#
# TimerBar.Breath.Max
# Waterbreathing max timer value (in secs)
# Default: 180
# 0 (instant underwater breathing damage start)
#
# TimerBar.Fire.GMLevel
# Disable/enable lava fire damage for security level (0..4) or high
# Default: 4 (None)
#
# TimerBar.Fire.Max
# Lava damage delay max timer value (in secs)
# Default: 1
# 0 (instant in lava damage start)
#
# MaxPrimaryTradeSkill
# Max count that player can learn the primary trade skill.
# Default: 2
@ -638,6 +661,12 @@ Quests.LowLevelHideDiff = 4
Quests.HighLevelHideDiff = 7
Guild.EventLogRecordsCount = 100
Guild.BankEventLogRecordsCount = 25
TimerBar.Fatigue.GMLevel = 4
TimerBar.Fatigue.Max = 60
TimerBar.Breath.GMLevel = 4
TimerBar.Breath.Max = 180
TimerBar.Fire.GMLevel = 4
TimerBar.Fire.Max = 1
MaxPrimaryTradeSkill = 2
MinPetitionSigns = 9
MaxGroupXPDistance = 74

View file

@ -46,7 +46,7 @@ void HmacHash::Finalize()
{
uint32 length = 0;
HMAC_Final(&m_ctx, (uint8*)m_digest, &length);
ASSERT(length == SHA_DIGEST_LENGTH)
ASSERT(length == SHA_DIGEST_LENGTH);
}
uint8 *HmacHash::ComputeHash(BigNumber *bn)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8617"
#define REVISION_NR "8643"
#endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_8596_01_characters_bugreport"
#define REVISION_DB_MANGOS "required_8608_02_mangos_battleground_events"
#define REVISION_DB_MANGOS "required_8618_01_mangos_spell_proc_event"
#define REVISION_DB_REALMD "required_8332_01_realmd_realmcharacters"
#endif // __REVISION_SQL_H__