aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authormegamage <none@none>2009-01-22 22:44:27 -0600
committermegamage <none@none>2009-01-22 22:44:27 -0600
commitab4b9160f2d1d534832372422fd1e2bc514b808a (patch)
treeee5ec121b585b419ff8ec38193ec008d930e75da /src/game
parent4230318f962f5faeddf188d61a367a635a8bb81a (diff)
*Update to Mangos 7151.
--HG-- branch : trunk
Diffstat (limited to 'src/game')
-rw-r--r--src/game/AchievementMgr.cpp32
-rw-r--r--src/game/BattleGroundAB.cpp4
-rw-r--r--src/game/CalendarHandler.cpp4
-rw-r--r--src/game/CharacterHandler.cpp2
-rw-r--r--src/game/Creature.h2
-rw-r--r--src/game/GameEvent.cpp113
-rw-r--r--src/game/GameObject.h2
-rw-r--r--src/game/Guild.cpp4
-rw-r--r--src/game/InstanceSaveMgr.cpp8
-rw-r--r--src/game/Map.cpp14
-rw-r--r--src/game/Map.h4
-rw-r--r--src/game/Object.cpp2
-rw-r--r--src/game/ObjectMgr.cpp141
-rw-r--r--src/game/Pet.cpp7
-rw-r--r--src/game/Player.cpp76
-rw-r--r--src/game/Player.h5
-rw-r--r--src/game/ScriptCalls.cpp3
-rw-r--r--src/game/SharedDefines.h3
-rw-r--r--src/game/Spell.cpp11
-rw-r--r--src/game/Spell.h1
-rw-r--r--src/game/SpellAuraDefines.h8
-rw-r--r--src/game/SpellAuras.cpp74
-rw-r--r--src/game/SpellAuras.h8
-rw-r--r--src/game/SpellEffects.cpp46
-rw-r--r--src/game/SpellMgr.cpp12
-rw-r--r--src/game/Unit.cpp73
-rw-r--r--src/game/Unit.h2
-rw-r--r--src/game/WaypointManager.cpp2
-rw-r--r--src/game/World.cpp47
-rw-r--r--src/game/WorldSession.cpp2
30 files changed, 506 insertions, 206 deletions
diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index 598bca0087f..f920bf17b40 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -907,14 +907,30 @@ AchievementCriteriaEntryList const& AchievementGlobalMgr::GetAchievementCriteria
void AchievementGlobalMgr::LoadAchievementCriteriaList()
{
+ if(sAchievementCriteriaStore.GetNumRows()==0)
+ {
+ barGoLink bar(1);
+ bar.step();
+
+ sLog.outString("");
+ sLog.outErrorDb(">> Loaded 0 achievement criteria.");
+ return;
+ }
+
+ barGoLink bar( sAchievementCriteriaStore.GetNumRows() );
for (uint32 entryId = 0; entryId<sAchievementCriteriaStore.GetNumRows(); entryId++)
{
+ bar.step();
+
AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId);
if(!criteria)
continue;
m_AchievementCriteriasByType[criteria->requiredType].push_back(criteria);
}
+
+ sLog.outString();
+ sLog.outErrorDb(">> Loaded 0 achievement criteria.",m_AchievementCriteriasByType->size());
}
@@ -923,15 +939,27 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
QueryResult *result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement");
if(!result)
+ {
+ barGoLink bar(1);
+ bar.step();
+
+ sLog.outString("");
+ sLog.outString(">> Loaded 0 realm completed achievements . DB table `character_achievement` is empty.");
return;
+ }
+ barGoLink bar(result->GetRowCount());
do
{
+ bar.step();
Field *fields = result->Fetch();
m_allCompletedAchievements.insert(fields[0].GetUInt32());
} while(result->NextRow());
delete result;
+
+ sLog.outString("");
+ sLog.outString(">> Loaded %u realm completed achievements.",m_allCompletedAchievements.size());
}
void AchievementGlobalMgr::LoadRewards()
@@ -948,7 +976,7 @@ void AchievementGlobalMgr::LoadRewards()
bar.step();
sLog.outString("");
- sLog.outString(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
+ sLog.outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
return;
}
@@ -956,9 +984,9 @@ void AchievementGlobalMgr::LoadRewards()
do
{
- Field *fields = result->Fetch();
bar.step();
+ Field *fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
if (!sAchievementStore.LookupEntry(entry))
{
diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp
index 6388cacd698..0023c935db2 100644
--- a/src/game/BattleGroundAB.cpp
+++ b/src/game/BattleGroundAB.cpp
@@ -425,9 +425,9 @@ void BattleGroundAB::_NodeDeOccupied(uint8 node)
{
WorldSafeLocsEntry const *ClosestGrave = NULL;
Player *plr;
- for (std::vector<uint64>::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
+ for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
{
- plr = objmgr.GetPlayer(*ghost_list.begin());
+ plr = objmgr.GetPlayer(*itr);
if( !plr )
continue;
if( !ClosestGrave )
diff --git a/src/game/CalendarHandler.cpp b/src/game/CalendarHandler.cpp
index 9c69e3a91f6..fd2858646c2 100644
--- a/src/game/CalendarHandler.cpp
+++ b/src/game/CalendarHandler.cpp
@@ -1,5 +1,5 @@
-/*
- * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
+/*
+ * Copyright (C) 2005-2009 MaNGOS <http://www.mangosproject.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp
index d30136993f3..498836ad5ee 100644
--- a/src/game/CharacterHandler.cpp
+++ b/src/game/CharacterHandler.cpp
@@ -84,7 +84,7 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'",GUID_LOPART(m_guid));
// in other case still be dummy query
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT guildid,rank FROM guild_member WHERE guid = '%u'", GUID_LOPART(m_guid));
- res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, personal_rating FROM arena_team_member WHERE guid='%u'", GUID_LOPART(m_guid));
+ res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, personal_rating FROM arena_team_member WHERE guid='%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS,"SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = '%u'", GUID_LOPART(m_guid));
diff --git a/src/game/Creature.h b/src/game/Creature.h
index c27acf77415..8e4db98258e 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -174,7 +174,7 @@ struct CreatureInfo
uint32 rangeattacktime;
uint32 unit_flags; // enum UnitFlags mask values
uint32 dynamicflags;
- uint32 family; // enum CreatureFamily values for type==CREATURE_TYPE_BEAST, or 0 in another cases
+ uint32 family; // enum CreatureFamily values (optional)
uint32 trainer_type;
uint32 trainer_spell;
uint32 classNum;
diff --git a/src/game/GameEvent.cpp b/src/game/GameEvent.cpp
index 9ceed9024c4..f08ba179797 100644
--- a/src/game/GameEvent.cpp
+++ b/src/game/GameEvent.cpp
@@ -190,50 +190,52 @@ void GameEvent::LoadFromDB()
if( !result )
{
mGameEvent.clear();
- sLog.outString(">> Table game_event is empty:");
+ sLog.outString(">> Table game_event is empty!");
sLog.outString();
return;
}
uint32 count = 0;
- barGoLink bar( result->GetRowCount() );
- do
{
- ++count;
- Field *fields = result->Fetch();
+ barGoLink bar( result->GetRowCount() );
+ do
+ {
+ ++count;
+ Field *fields = result->Fetch();
- bar.step();
+ bar.step();
- uint16 event_id = fields[0].GetUInt16();
- if(event_id==0)
- {
- sLog.outErrorDb("`game_event` game event id (%i) is reserved and can't be used.",event_id);
- continue;
- }
+ uint16 event_id = fields[0].GetUInt16();
+ if(event_id==0)
+ {
+ sLog.outErrorDb("`game_event` game event id (%i) is reserved and can't be used.",event_id);
+ continue;
+ }
- GameEventData& pGameEvent = mGameEvent[event_id];
- uint64 starttime = fields[1].GetUInt64();
- pGameEvent.start = time_t(starttime);
- uint64 endtime = fields[2].GetUInt64();
- pGameEvent.end = time_t(endtime);
- pGameEvent.occurence = fields[3].GetUInt32();
- pGameEvent.length = fields[4].GetUInt32();
- pGameEvent.description = fields[5].GetCppString();
- pGameEvent.state = (GameEventState)(fields[6].GetUInt8());
- pGameEvent.nextstart = 0;
-
- if(pGameEvent.length==0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check
- {
- sLog.outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.",event_id);
- continue;
- }
+ GameEventData& pGameEvent = mGameEvent[event_id];
+ uint64 starttime = fields[1].GetUInt64();
+ pGameEvent.start = time_t(starttime);
+ uint64 endtime = fields[2].GetUInt64();
+ pGameEvent.end = time_t(endtime);
+ pGameEvent.occurence = fields[3].GetUInt32();
+ pGameEvent.length = fields[4].GetUInt32();
+ pGameEvent.description = fields[5].GetCppString();
+ pGameEvent.state = (GameEventState)(fields[6].GetUInt8());
+ pGameEvent.nextstart = 0;
+
+ if(pGameEvent.length==0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check
+ {
+ sLog.outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.",event_id);
+ continue;
+ }
- } while( result->NextRow() );
+ } while( result->NextRow() );
+ delete result;
- sLog.outString();
- sLog.outString( ">> Loaded %u game events", count );
- delete result;
+ sLog.outString();
+ sLog.outString( ">> Loaded %u game events", count );
+ }
// load game event saves
// 0 1 2
@@ -346,8 +348,8 @@ void GameEvent::LoadFromDB()
count = 0;
if( !result )
{
- barGoLink bar2(1);
- bar2.step();
+ barGoLink bar(1);
+ bar.step();
sLog.outString();
sLog.outString(">> Loaded %u creatures in game events", count );
@@ -355,12 +357,12 @@ void GameEvent::LoadFromDB()
else
{
- barGoLink bar2( result->GetRowCount() );
+ barGoLink bar( result->GetRowCount() );
do
{
Field *fields = result->Fetch();
- bar2.step();
+ bar.step();
uint32 guid = fields[0].GetUInt32();
int16 event_id = fields[1].GetInt16();
@@ -378,9 +380,10 @@ void GameEvent::LoadFromDB()
crelist.push_back(guid);
} while( result->NextRow() );
+ delete result;
+
sLog.outString();
sLog.outString( ">> Loaded %u creatures in game events", count );
- delete result;
}
mGameEventGameobjectGuids.resize(mGameEvent.size()*2-1);
@@ -391,8 +394,8 @@ void GameEvent::LoadFromDB()
count = 0;
if( !result )
{
- barGoLink bar3(1);
- bar3.step();
+ barGoLink bar(1);
+ bar.step();
sLog.outString();
sLog.outString(">> Loaded %u gameobjects in game events", count );
@@ -400,12 +403,12 @@ void GameEvent::LoadFromDB()
else
{
- barGoLink bar3( result->GetRowCount() );
+ barGoLink bar( result->GetRowCount() );
do
{
Field *fields = result->Fetch();
- bar3.step();
+ bar.step();
uint32 guid = fields[0].GetUInt32();
int16 event_id = fields[1].GetInt16();
@@ -423,10 +426,10 @@ void GameEvent::LoadFromDB()
golist.push_back(guid);
} while( result->NextRow() );
+ delete result;
+
sLog.outString();
sLog.outString( ">> Loaded %u gameobjects in game events", count );
-
- delete result;
}
mGameEventModelEquip.resize(mGameEvent.size());
@@ -439,8 +442,8 @@ void GameEvent::LoadFromDB()
count = 0;
if( !result )
{
- barGoLink bar3(1);
- bar3.step();
+ barGoLink bar(1);
+ bar.step();
sLog.outString();
sLog.outString(">> Loaded %u model/equipment changes in game events", count );
@@ -448,12 +451,12 @@ void GameEvent::LoadFromDB()
else
{
- barGoLink bar3( result->GetRowCount() );
+ barGoLink bar( result->GetRowCount() );
do
{
Field *fields = result->Fetch();
- bar3.step();
+ bar.step();
uint32 guid = fields[0].GetUInt32();
uint16 event_id = fields[1].GetUInt16();
@@ -483,10 +486,10 @@ void GameEvent::LoadFromDB()
equiplist.push_back(std::pair<uint32, ModelEquip>(guid, newModelEquipSet));
} while( result->NextRow() );
+ delete result;
+
sLog.outString();
sLog.outString( ">> Loaded %u model/equipment changes in game events", count );
-
- delete result;
}
mGameEventCreatureQuests.resize(mGameEvent.size());
@@ -496,8 +499,8 @@ void GameEvent::LoadFromDB()
count = 0;
if( !result )
{
- barGoLink bar3(1);
- bar3.step();
+ barGoLink bar(1);
+ bar.step();
sLog.outString();
sLog.outString(">> Loaded %u quests additions in game events", count );
@@ -505,12 +508,12 @@ void GameEvent::LoadFromDB()
else
{
- barGoLink bar3( result->GetRowCount() );
+ barGoLink bar( result->GetRowCount() );
do
{
Field *fields = result->Fetch();
- bar3.step();
+ bar.step();
uint32 id = fields[0].GetUInt32();
uint32 quest = fields[1].GetUInt32();
uint16 event_id = fields[2].GetUInt16();
@@ -569,10 +572,10 @@ void GameEvent::LoadFromDB()
questlist.push_back(QuestRelation(id, quest));
} while( result->NextRow() );
+ delete result;
+
sLog.outString();
sLog.outString( ">> Loaded %u quests additions in game events", count );
-
- delete result;
}
// Load quest to (event,condition) mapping
diff --git a/src/game/GameObject.h b/src/game/GameObject.h
index 8638ba602bb..eccfae7bd70 100644
--- a/src/game/GameObject.h
+++ b/src/game/GameObject.h
@@ -351,7 +351,7 @@ struct GameObjectInfo
uint32 state2Name; //3
} destructibleBuilding;
//34 GAMEOBJECT_TYPE_TRAPDOOR
- struct
+ struct
{
uint32 whenToPause; // 0
uint32 startOpen; // 1
diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp
index a34d4bee524..9dbba57ac12 100644
--- a/src/game/Guild.cpp
+++ b/src/game/Guild.cpp
@@ -1604,7 +1604,7 @@ void Guild::DisplayGuildBankLogs(WorldSession *session, uint8 TabId)
{
data << uint8((*itr)->LogEntry);
data << uint64(MAKE_NEW_GUID((*itr)->PlayerGuid,0,HIGHGUID_PLAYER));
- if ((*itr)->LogEntry == GUILD_BANK_LOG_DEPOSIT_MONEY ||
+ if ((*itr)->LogEntry == GUILD_BANK_LOG_DEPOSIT_MONEY ||
(*itr)->LogEntry == GUILD_BANK_LOG_WITHDRAW_MONEY ||
(*itr)->LogEntry == GUILD_BANK_LOG_REPAIR_MONEY ||
(*itr)->LogEntry == GUILD_BANK_LOG_UNK1 ||
@@ -1634,7 +1634,7 @@ void Guild::DisplayGuildBankLogs(WorldSession *session, uint8 TabId)
{
data << uint8((*itr)->LogEntry);
data << uint64(MAKE_NEW_GUID((*itr)->PlayerGuid,0,HIGHGUID_PLAYER));
- if ((*itr)->LogEntry == GUILD_BANK_LOG_DEPOSIT_MONEY ||
+ if ((*itr)->LogEntry == GUILD_BANK_LOG_DEPOSIT_MONEY ||
(*itr)->LogEntry == GUILD_BANK_LOG_WITHDRAW_MONEY ||
(*itr)->LogEntry == GUILD_BANK_LOG_REPAIR_MONEY ||
(*itr)->LogEntry == GUILD_BANK_LOG_UNK1 ||
diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp
index cb95dac6978..52e513b7c97 100644
--- a/src/game/InstanceSaveMgr.cpp
+++ b/src/game/InstanceSaveMgr.cpp
@@ -361,8 +361,8 @@ void InstanceSaveManager::PackInstances()
bar.step();
}
- sLog.outString();
sLog.outString( ">> Instance numbers remapped, next instance id is %u", InstanceNumber );
+ sLog.outString();
}
void InstanceSaveManager::LoadResetTimes()
@@ -454,7 +454,7 @@ void InstanceSaveManager::LoadResetTimes()
// add the global reset times to the priority queue
for(uint32 i = 0; i < sInstanceTemplate.MaxEntry; i++)
{
- InstanceTemplate* temp = (InstanceTemplate*)objmgr.GetInstanceTemplate(i);
+ InstanceTemplate const* temp = objmgr.GetInstanceTemplate(i);
if(!temp) continue;
// only raid/heroic maps have a global reset time
const MapEntry* entry = sMapStore.LookupEntry(temp->map);
@@ -583,7 +583,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe
{
// global reset for all instances of the given map
// note: this isn't fast but it's meant to be executed very rarely
- Map *map = (MapInstanced*)MapManager::Instance().GetBaseMap(mapid);
+ Map const *map = MapManager::Instance().GetBaseMap(mapid);
if(!map->Instanceable())
return;
uint64 now = (uint64)time(NULL);
@@ -591,7 +591,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe
if(!warn)
{
// this is called one minute before the reset time
- InstanceTemplate* temp = (InstanceTemplate*)objmgr.GetInstanceTemplate(mapid);
+ InstanceTemplate const* temp = objmgr.GetInstanceTemplate(mapid);
if(!temp || !temp->reset_delay)
{
sLog.outError("InstanceSaveManager::ResetOrWarnAll: no instance template or reset delay for map %d", mapid);
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index 0919db4ebe1..d64a1736fe1 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -1767,10 +1767,10 @@ bool InstanceMap::CanEnter(Player *player)
}
// cannot enter if the instance is full (player cap), GMs don't count
- InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId());
- if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= iTemplate->maxPlayers)
+ uint32 maxPlayers = GetMaxPlayers();
+ if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= maxPlayers)
{
- sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), iTemplate->maxPlayers, player->GetName());
+ sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName());
player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS);
return false;
}
@@ -2080,6 +2080,14 @@ void InstanceMap::SetResetSchedule(bool on)
}
}
+uint32 InstanceMap::GetMaxPlayers() const
+{
+ InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId());
+ if(!iTemplate)
+ return 0;
+ return IsHeroic() ? iTemplate->maxPlayersHeroic : iTemplate->maxPlayers;
+}
+
/* ******* Battleground Instance Maps ******* */
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId)
diff --git a/src/game/Map.h b/src/game/Map.h
index bcdb4d9782c..0c4fbd0ece4 100644
--- a/src/game/Map.h
+++ b/src/game/Map.h
@@ -100,7 +100,8 @@ struct InstanceTemplate
uint32 levelMin;
uint32 levelMax;
uint32 maxPlayers;
- uint32 reset_delay;
+ uint32 maxPlayersHeroic;
+ uint32 reset_delay; // FIX ME: now exist normal/heroic raids with possible different time of reset.
float startLocX;
float startLocY;
float startLocZ;
@@ -384,6 +385,7 @@ class TRINITY_DLL_SPEC InstanceMap : public Map
bool CanEnter(Player* player);
void SendResetWarnings(uint32 timeLeft) const;
void SetResetSchedule(bool on);
+ uint32 GetMaxPlayers() const;
private:
bool m_resetAfterUnload;
bool m_unloadWhenEmpty;
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 50ed59d2486..24e97183ec8 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -258,7 +258,7 @@ void Object::DestroyForPlayer(Player *target) const
void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2) const
{
uint16 unk_flags = ((GetTypeId() == TYPEID_PLAYER) ? ((Player*)this)->m_movementInfo.unk1 : 0);
-
+
if(GetTypeId() == TYPEID_UNIT)
if(((Creature*)this)->isVehicle())
unk_flags |= 0x20; // always allow pitch
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index ba74bd3b762..ccd78c4be20 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -843,6 +843,19 @@ void ObjectMgr::LoadCreatureTemplates()
if((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE)
sLog.outErrorDb("Creature (Entry: %u) has wrong trainer type %u",cInfo->Entry,cInfo->trainer_type);
+ if(cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type))
+ {
+ sLog.outErrorDb("Creature (Entry: %u) has invalid creature type (%u) in `type`",cInfo->Entry,cInfo->type);
+ const_cast<CreatureInfo*>(cInfo)->type = CREATURE_TYPE_HUMANOID;
+ }
+
+ // must exist or used hidden but used in data horse case
+ if(cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM )
+ {
+ sLog.outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `family`",cInfo->Entry,cInfo->family);
+ const_cast<CreatureInfo*>(cInfo)->family = 0;
+ }
+
if(cInfo->InhabitType <= 0 || cInfo->InhabitType > INHABIT_ANYWHERE)
{
sLog.outErrorDb("Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly",cInfo->Entry,cInfo->InhabitType);
@@ -1542,18 +1555,36 @@ void ObjectMgr::LoadAuctions()
{
QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auctionhouse");
if( !result )
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString("");
+ sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return;
+ }
Field *fields = result->Fetch();
uint32 AuctionCount=fields[0].GetUInt32();
delete result;
if(!AuctionCount)
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString("");
+ sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return;
+ }
result = CharacterDatabase.Query( "SELECT id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit,location FROM auctionhouse" );
if( !result )
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString("");
+ sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return;
+ }
barGoLink bar( AuctionCount );
@@ -1594,7 +1625,6 @@ void ObjectMgr::LoadAuctions()
sLog.outString();
sLog.outString( ">> Loaded %u auctions", AuctionCount );
- sLog.outString();
}
void ObjectMgr::LoadItemLocales()
@@ -2028,7 +2058,13 @@ void ObjectMgr::LoadAuctionItems()
QueryResult *result = CharacterDatabase.Query( "SELECT data,itemguid,item_template FROM auctionhouse JOIN item_instance ON itemguid = guid" );
if( !result )
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString("");
+ sLog.outString(">> Loaded 0 auction items");
return;
+ }
barGoLink bar( result->GetRowCount() );
@@ -2063,7 +2099,6 @@ void ObjectMgr::LoadAuctionItems()
++count;
}
while( result->NextRow() );
-
delete result;
sLog.outString();
@@ -4448,14 +4483,20 @@ void ObjectMgr::LoadInstanceTemplate()
else if(!entry->HasResetTime())
continue;
+ //FIXME: now exist heroic instance, normal/heroic raid instances
+ // entry->resetTimeHeroic store reset time for both heroic mode instance (raid and non-raid)
+ // entry->resetTimeRaid store reset time for normal raid only
+ // for current state entry->resetTimeRaid == entry->resetTimeHeroic in case raid instances with heroic mode.
+ // but at some point wee need implement reset time dependen from raid insatance mode
if(temp->reset_delay == 0)
{
// use defaults from the DBC
- if(entry->SupportsHeroicMode())
+ if(entry->resetTimeHeroic) // for both raid and non raids, read above
{
temp->reset_delay = entry->resetTimeHeroic / DAY;
}
else if (entry->resetTimeRaid && entry->map_type == MAP_RAID)
+ // for normal raid only
{
temp->reset_delay = entry->resetTimeRaid / DAY;
}
@@ -4633,14 +4674,27 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
// 0 1 2 3 4 5 6 7 8 9
QueryResult* result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,itemTextId,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" I64FMTD "'", (uint64)basetime);
if ( !result )
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString("");
+ sLog.outString(">> Only expired mails (need to be return or delete) or DB table `mail` is empty.");
return; // any mails need to be returned or deleted
- Field *fields;
+ }
+
//std::ostringstream delitems, delmails; //will be here for optimization
//bool deletemail = false, deleteitem = false;
//delitems << "DELETE FROM item_instance WHERE guid IN ( ";
//delmails << "DELETE FROM mail WHERE id IN ( "
+
+ barGoLink bar( result->GetRowCount() );
+ uint32 count = 0;
+ Field *fields;
+
do
{
+ bar.step();
+
fields = result->Fetch();
Mail *m = new Mail;
m->messageID = fields[0].GetUInt32();
@@ -4706,8 +4760,12 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
//delmails << m->messageID << ", ";
CharacterDatabase.PExecute("DELETE FROM mail WHERE id = '%u'", m->messageID);
delete m;
+ ++count;
} while (result->NextRow());
delete result;
+
+ sLog.outString();
+ sLog.outString( ">> Loaded %u mails", count );
}
void ObjectMgr::LoadQuestAreaTriggers()
@@ -4873,24 +4931,31 @@ uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, u
for(uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
{
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
- if(node && node->map_id == mapid && node->MountCreatureID[team == ALLIANCE ? 1 : 0])
+ if(!node || node->map_id != mapid || !node->MountCreatureID[team == ALLIANCE ? 1 : 0])
+ continue;
+
+ uint8 field = (uint8)((i - 1) / 32);
+ uint32 submask = 1<<((i-1)%32);
+
+ // skip not taxi network nodes
+ if((sTaxiNodesMask[field] & submask)==0)
+ continue;
+
+ float dist2 = (node->x - x)*(node->x - x)+(node->y - y)*(node->y - y)+(node->z - z)*(node->z - z);
+ if(found)
{
- float dist2 = (node->x - x)*(node->x - x)+(node->y - y)*(node->y - y)+(node->z - z)*(node->z - z);
- if(found)
- {
- if(dist2 < dist)
- {
- dist = dist2;
- id = i;
- }
- }
- else
+ if(dist2 < dist)
{
- found = true;
dist = dist2;
id = i;
}
}
+ else
+ {
+ found = true;
+ dist = dist2;
+ id = i;
+ }
}
return id;
@@ -6626,11 +6691,22 @@ void ObjectMgr::LoadGameObjectForQuests()
{
mGameObjectForQuestSet.clear(); // need for reload case
+ if( !sGOStorage.MaxEntry )
+ {
+ barGoLink bar( 1 );
+ bar.step();
+ sLog.outString();
+ sLog.outString( ">> Loaded 0 GameObjects for quests" );
+ return;
+ }
+
+ barGoLink bar( sGOStorage.MaxEntry - 1 );
uint32 count = 0;
// collect GO entries for GO that must activated
for(uint32 go_entry = 1; go_entry < sGOStorage.MaxEntry; ++go_entry)
{
+ bar.step();
GameObjectInfo const* goInfo = sGOStorage.LookupEntry<GameObjectInfo>(go_entry);
if(!goInfo)
continue;
@@ -6665,7 +6741,7 @@ void ObjectMgr::LoadGameObjectForQuests()
}
sLog.outString();
- sLog.outString( ">> Loaded %u GameObject for quests", count );
+ sLog.outString( ">> Loaded %u GameObjects for quests", count );
}
bool ObjectMgr::LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value)
@@ -7211,11 +7287,10 @@ void ObjectMgr::LoadGameTele()
++count;
}
while (result->NextRow());
-
delete result;
sLog.outString();
- sLog.outString( ">> Loaded %u game tele's", count );
+ sLog.outString( ">> Loaded %u GameTeleports", count );
}
GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
@@ -7387,7 +7462,7 @@ void ObjectMgr::LoadTrainerSpell()
delete result;
sLog.outString();
- sLog.outString( ">> Loaded Trainers %d", count );
+ sLog.outString( ">> Loaded %d Trainers", count );
}
void ObjectMgr::LoadVendors()
@@ -7665,16 +7740,30 @@ void ObjectMgr::LoadScriptNames()
"SELECT DISTINCT(ScriptName) FROM areatrigger_scripts WHERE ScriptName <> '' "
"UNION "
"SELECT DISTINCT(script) FROM instance_template WHERE script <> ''");
- if(result)
+
+ if( !result )
{
- do
- {
- m_scriptNames.push_back((*result)[0].GetString());
- } while (result->NextRow());
- delete result;
+ barGoLink bar( 1 );
+ bar.step();
+ sLog.outString();
+ sLog.outErrorDb(">> Loaded empty set of Script Names!");
+ return;
}
+ barGoLink bar( result->GetRowCount() );
+ uint32 count = 0;
+
+ do
+ {
+ bar.step();
+ m_scriptNames.push_back((*result)[0].GetString());
+ ++count;
+ } while (result->NextRow());
+ delete result;
+
std::sort(m_scriptNames.begin(), m_scriptNames.end());
+ sLog.outString();
+ sLog.outString( ">> Loaded %d Script Names", count );
}
uint32 ObjectMgr::GetScriptId(const char *name)
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index e5fd0d037e4..6a39aeb6d3b 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -777,11 +777,10 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(creature->getLevel())/4);
SetUInt32Value(UNIT_NPC_FLAGS, 0);
- CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(creature->GetCreatureInfo()->family);
- if( char* familyname = cFamily->Name[sWorld.GetDefaultDbcLocale()] )
- SetName(familyname);
+ if(CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family))
+ SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]);
else
- SetName(creature->GetName());
+ SetName(creature->GetNameForLocaleIdx(objmgr.GetDBCLocaleIndex()));
if(cinfo->type == CREATURE_TYPE_BEAST)
{
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 3a8ebeede4d..ccf3eefcb6f 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -301,6 +301,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this)
m_comboPoints = 0;
m_usedTalentCount = 0;
+ m_questRewardTalentCount = 0;
m_regenTimer = 0;
m_weaponChangeTimer = 0;
@@ -430,7 +431,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this)
for (int i = 0; i < MAX_COMBAT_RATING; i++)
m_baseRatingValue[i] = 0;
-
+
m_baseSpellDamage = 0;
m_baseSpellHealing = 0;
m_baseFeralAP = 0;
@@ -2351,7 +2352,8 @@ void Player::InitTalentForLevel()
}
else
{
- uint32 talentPointsForLevel = uint32((level-9)*sWorld.getRate(RATE_TALENT));
+ uint32 talentPointsForLevel = CalculateTalentsPoints();
+
// if used more that have then reset
if(m_usedTalentCount > talentPointsForLevel)
{
@@ -3273,8 +3275,7 @@ bool Player::resetTalents(bool no_cost)
CharacterDatabase.PExecute("UPDATE characters set at_login = at_login & ~ %u WHERE guid ='%u'", uint32(AT_LOGIN_RESET_TALENTS), GetGUIDLow());
}
- uint32 level = getLevel();
- uint32 talentPointsForLevel = level < 10 ? 0 : uint32((level-9)*sWorld.getRate(RATE_TALENT));
+ uint32 talentPointsForLevel = CalculateTalentsPoints();
if (m_usedTalentCount == 0)
{
@@ -4654,7 +4655,7 @@ float Player::OCTRegenMPPerSpirit()
void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply)
{
m_baseRatingValue[cr]+=(apply ? value : -value);
-
+
int32 amount = uint32(m_baseRatingValue[cr]);
// Apply bonus from SPELL_AURA_MOD_RATING_FROM_STAT
// stat used stored in miscValueB for this aura
@@ -10267,7 +10268,7 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
if(!CanDualWield())
return EQUIP_ERR_CANT_DUAL_WIELD;
}
- else if (type == INVTYPE_2HWEAPON)
+ else if (type == INVTYPE_2HWEAPON)
{
if(!CanDualWield() || !CanTitanGrip())
return EQUIP_ERR_CANT_DUAL_WIELD;
@@ -13011,6 +13012,12 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
SetTitle(titleEntry);
}
+ if(pQuest->GetBonusTalents())
+ {
+ m_questRewardTalentCount+=pQuest->GetBonusTalents();
+ InitTalentForLevel();
+ }
+
// Send reward mail
if(pQuest->GetRewMailTemplateId())
{
@@ -14732,16 +14739,15 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
_LoadSpells(holder->GetResult(PLAYER_LOGIN_QUERY_LOADSPELLS));
- // after spell load
- InitTalentForLevel();
- learnSkillRewardedSpells();
- learnDefaultSpells();
-
-
// after spell load, learn rewarded spell if need also
_LoadQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS));
_LoadDailyQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS));
+ // after spell and quest load
+ InitTalentForLevel();
+ learnSkillRewardedSpells();
+ learnDefaultSpells();
+
_LoadTutorials(holder->GetResult(PLAYER_LOGIN_QUERY_LOADTUTORIALS));
// must be before inventory (some items required reputation check)
@@ -15404,6 +15410,9 @@ void Player::_LoadQuestStatus(QueryResult *result)
if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId()))
SetTitle(titleEntry);
}
+
+ if(pQuest->GetBonusTalents())
+ m_questRewardTalentCount+=pQuest->GetBonusTalents();
}
sLog.outDebug("Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.m_status, quest_id, GetGUIDLow());
@@ -15680,29 +15689,29 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave *save, bool permanent, b
void Player::SendRaidInfo()
{
+ uint32 counter = 0;
+
WorldPacket data(SMSG_RAID_INSTANCE_INFO, 4);
- uint32 counter = 0, i;
- for(i = 0; i < TOTAL_DIFFICULTIES; i++)
- for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
- if(itr->second.perm) counter++;
+ size_t p_counter = data.wpos();
+ data << uint32(counter); // placeholder
- data << counter;
- for(i = 0; i < TOTAL_DIFFICULTIES; i++)
+ for(int i = 0; i < TOTAL_DIFFICULTIES; ++i)
{
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
{
if(itr->second.perm)
{
InstanceSave *save = itr->second.save;
- data << (save->GetMapId());
- data << (uint32)(save->GetResetTime() - time(NULL));
- data << save->GetInstanceId();
- data << uint32(counter);
- counter--;
+ data << uint32(save->GetMapId());
+ data << uint32(save->GetResetTime() - time(NULL));
+ data << uint32(save->GetInstanceId());
+ data << uint32(save->GetDifficulty());
+ ++counter;
}
}
}
+ data.put<uint32>(p_counter,counter);
GetSession()->SendPacket(&data);
}
@@ -19251,7 +19260,7 @@ bool Player::isHonorOrXPTarget(Unit* pVictim)
if(pVictim->GetTypeId() == TYPEID_UNIT)
{
- if (((Creature*)pVictim)->isTotem() ||
+ if (((Creature*)pVictim)->isTotem() ||
((Creature*)pVictim)->isPet() ||
((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)
return false;
@@ -20060,7 +20069,7 @@ void Player::UpdateCharmedAI()
void Player::ConvertRune(uint8 index, uint8 newType)
{
SetCurrentRune(index, newType);
-
+
WorldPacket data(SMSG_CONVERT_RUNE, 2);
data << uint8(index);
data << uint8(newType);
@@ -20125,3 +20134,20 @@ void Player::AutoStoreLootItem(uint8 bag, uint8 slot, uint32 loot_id, LootStore
StoreNewItem (dest,lootItem->itemid,true,lootItem->randomPropertyId);
}
+
+uint32 Player::CalculateTalentsPoints() const
+{
+ uint32 base_talent = getLevel() < 10 ? 0 : uint32((getLevel()-9)*sWorld.getRate(RATE_TALENT));
+
+ if(getClass() != CLASS_DEATH_KNIGHT)
+ return base_talent;
+
+ uint32 talentPointsForLevel =
+ (getLevel() < 56 ? 0 : uint32((getLevel()-55)*sWorld.getRate(RATE_TALENT)))
+ + m_questRewardTalentCount;
+
+ if(talentPointsForLevel > base_talent)
+ talentPointsForLevel = base_talent;
+
+ return talentPointsForLevel;
+}
diff --git a/src/game/Player.h b/src/game/Player.h
index d4ef1151b4e..1ea97f0b82a 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -443,7 +443,7 @@ enum PlayerFlags
PLAYER_FLAGS_UNK18 = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
PLAYER_FLAGS_UNK20 = 0x00080000,
- PLAYER_FLAGS_UNK21 = 0x00100000,
+ PLAYER_FLAGS_UNK21 = 0x00100000,
PLAYER_FLAGS_UNK22 = 0x00200000,
PLAYER_FLAGS_UNK23 = 0x00400000,
PLAYER_FLAGS_UNK24 = 0x00800000, // disabled all abilitys on tab except autoattack
@@ -1494,6 +1494,8 @@ class TRINITY_DLL_SPEC Player : public Unit
uint32 resetTalentsCost() const;
void InitTalentForLevel();
+ uint32 CalculateTalentsPoints() const;
+
void InitGlyphsForLevel();
void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); }
uint32 GetGlyphSlot(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot); }
@@ -2421,6 +2423,7 @@ class TRINITY_DLL_SPEC Player : public Unit
uint32 m_resetTalentsCost;
time_t m_resetTalentsTime;
uint32 m_usedTalentCount;
+ uint32 m_questRewardTalentCount;
// Social
PlayerSocial *m_social;
diff --git a/src/game/ScriptCalls.cpp b/src/game/ScriptCalls.cpp
index 8c763809f63..693f27b1fb0 100644
--- a/src/game/ScriptCalls.cpp
+++ b/src/game/ScriptCalls.cpp
@@ -86,7 +86,8 @@ bool LoadScriptingModule(char const* libName)
return false;
}
- printf("Scripts Library %s was successfully loaded.\n",name.c_str());
+ sLog.outString();
+ sLog.outString( ">>> Scripts Library %s was successfully loaded.\n", name.c_str() );
//heh we are still there :P we have a valid library
//we reload script
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index adfc6af32ef..66db2a8a3e8 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -1588,6 +1588,7 @@ enum TrainerType // this is important
#define MAX_TRAINER_TYPE 4
+// CreatureType.dbc
enum CreatureType
{
CREATURE_TYPE_BEAST = 1,
@@ -1607,6 +1608,7 @@ enum CreatureType
uint32 const CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD = (1 << (CREATURE_TYPE_HUMANOID-1)) | (1 << (CREATURE_TYPE_UNDEAD-1));
+// CreatureFamily.dbc
enum CreatureFamily
{
CREATURE_FAMILY_WOLF = 1,
@@ -1618,6 +1620,7 @@ enum CreatureFamily
CREATURE_FAMILY_CARRION_BIRD = 7,
CREATURE_FAMILY_CRAB = 8,
CREATURE_FAMILY_GORILLA = 9,
+ CREATURE_FAMILY_HORSE_CUSTOM = 10, // not exist in DBC but used for horse like beasts in DB
CREATURE_FAMILY_RAPTOR = 11,
CREATURE_FAMILY_TALLSTRIDER = 12,
CREATURE_FAMILY_FELHUNTER = 15,
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 1530e0728fc..c80a3316f50 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -651,11 +651,12 @@ void Spell::prepareDataForTriggerSystem()
case SPELLFAMILY_ROGUE: // For poisons need do it
if (m_spellInfo->SpellFamilyFlags & 0x000000101001E000LL) m_canTrigger = true;
break;
- case SPELLFAMILY_HUNTER: // Hunter Rapid Killing/Explosive Trap Effect/Immolation Trap Effect/Frost Trap Aura/Snake Trap Effect
- if (m_spellInfo->SpellFamilyFlags & 0x0100200000000014LL) m_canTrigger = true;
+ case SPELLFAMILY_HUNTER: // Hunter Rapid Killing/Explosive Trap Effect/Immolation Trap Effect/Frost Trap Aura/Snake Trap Effect/Explosive Shot
+ if (m_spellInfo->SpellFamilyFlags & 0x0100200000000214LL ||
+ m_spellInfo->SpellFamilyFlags2 & 0x200) m_canTrigger = true;
break;
- case SPELLFAMILY_PALADIN: // For Holy Shock triggers need do it
- if (m_spellInfo->SpellFamilyFlags & 0x0001000000200000LL) m_canTrigger = true;
+ case SPELLFAMILY_PALADIN: // For Judgements (all) / Holy Shock triggers need do it
+ if (m_spellInfo->SpellFamilyFlags & 0x0001000900B80400LL) m_canTrigger = true;
break;
}
}
@@ -4204,7 +4205,7 @@ uint8 Spell::CanCast(bool strict)
break;
}
- // This is generic summon effect
+ // This is generic summon effect
case SPELL_EFFECT_SUMMON:
{
switch(m_spellInfo->EffectMiscValueB[i])
diff --git a/src/game/Spell.h b/src/game/Spell.h
index afe9776374d..d06862ad1fa 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -319,6 +319,7 @@ class Spell
void EffectCharge(uint32 i);
void EffectProspecting(uint32 i);
void EffectMilling(uint32 i);
+ void EffectRenamePet(uint32 i);
void EffectSendTaxi(uint32 i);
void EffectSummonCritter(uint32 i);
void EffectKnockBack(uint32 i);
diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h
index 80d280eb22a..eb802d1c934 100644
--- a/src/game/SpellAuraDefines.h
+++ b/src/game/SpellAuraDefines.h
@@ -239,7 +239,7 @@ enum AuraType
SPELL_AURA_HASTE_MELEE = 192,
SPELL_AURA_MELEE_SLOW = 193,
SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL = 194,
- SPELL_AURA_MOD_DEPRICATED_2 = 195, // not used now, old SPELL_AURA_MOD_SPELL_HEALING_OF_INTELLECT
+ SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL = 195,
SPELL_AURA_MOD_COOLDOWN = 196, // only 24818 Noxious Breath
SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE = 197,
SPELL_AURA_MOD_ALL_WEAPON_SKILLS = 198,
@@ -271,7 +271,7 @@ enum AuraType
SPELL_AURA_224 = 224,
SPELL_AURA_PRAYER_OF_MENDING = 225,
SPELL_AURA_PERIODIC_DUMMY = 226,
- SPELL_AURA_227 = 227,
+ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE = 227,
SPELL_AURA_DETECT_STEALTH = 228,
SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE = 229,
SPELL_AURA_230 = 230,
@@ -311,10 +311,10 @@ enum AuraType
SPELL_AURA_264 = 264,
SPELL_AURA_265 = 265,
SPELL_AURA_266 = 266,
- SPELL_AURA_267 = 267,
+ SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL = 267,
SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT = 268,
SPELL_AURA_269 = 269,
- SPELL_AURA_270 = 270,
+ SPELL_AURA_MOD_IGNORE_TARGET_RESIST = 270, // Possibly need swap vs 195 aura used only in 1 spell Chaos Bolt Passive
SPELL_AURA_MOD_DAMAGE_FROM_CASTER = 271,
SPELL_AURA_272 = 272,
SPELL_AURA_273 = 273,
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 471dbdfec16..6f6224795d1 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -249,7 +249,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleModMeleeRangedSpeedPct, //192 SPELL_AURA_HASTE_MELEE
&Aura::HandleModCombatSpeedPct, //193 SPELL_AURA_MELEE_SLOW (in fact combat (any type attack) speed pct)
&Aura::HandleUnused, //194 SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL
- &Aura::HandleUnused, //195 SPELL_AURA_MOD_DEPRICATED_2 not used now (old SPELL_AURA_MOD_SPELL_HEALING_OF_INTELLECT)
+ &Aura::HandleNoImmediateEffect, //195 SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL implement in Unit::CalculateSpellDamage
&Aura::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN
&Aura::HandleNoImmediateEffect, //197 SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE implemented in Unit::SpellCriticalBonus Unit::GetUnitCriticalChance
&Aura::HandleUnused, //198 SPELL_AURA_MOD_ALL_WEAPON_SKILLS
@@ -281,7 +281,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleUnused, //224 unused
&Aura::HandleNoImmediateEffect, //225 SPELL_AURA_PRAYER_OF_MENDING
&Aura::HandleAuraPeriodicDummy, //226 SPELL_AURA_PERIODIC_DUMMY
- &Aura::HandleNULL, //227 periodic trigger spell
+ &Aura::HandlePeriodicTriggerSpellWithValue, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
&Aura::HandleNoImmediateEffect, //228 stealth detection
&Aura::HandleNULL, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
&Aura::HandleAuraModIncreaseMaxHealth, //230 Commanding Shout
@@ -309,7 +309,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNULL, //252 haste all?
&Aura::HandleNULL, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE
&Aura::HandleNULL, //254 SPELL_AURA_MOD_DISARM_SHIELD disarm Shield
- &Aura::HandleNULL, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT
+ &Aura::HandleNoImmediateEffect, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus
&Aura::HandleNoReagentUseAura, //256 SPELL_AURA_NO_REAGENT_USE Use SpellClassMask for spell select
&Aura::HandleNULL, //257 SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS Use SpellClassMask for spell select
&Aura::HandleNULL, //258 SPELL_AURA_MOD_SPELL_VISUAL
@@ -321,10 +321,10 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNULL, //264 unused
&Aura::HandleNULL, //265 unused
&Aura::HandleNULL, //266 unused
- &Aura::HandleNULL, //267 some immunity?
+ &Aura::HandleNoImmediateEffect, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmunedToSpellEffect
&Aura::HandleAuraModAttackPowerOfStatPercent, //268 SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT
&Aura::HandleNULL, //269 ignore DR effects?
- &Aura::HandleNULL, //270
+ &Aura::HandleNULL, //270 SPELL_AURA_MOD_IGNORE_TARGET_RESIST
&Aura::HandleNoImmediateEffect, //271 SPELL_AURA_MOD_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonus
&Aura::HandleNULL, //272 reduce spell cast time?
&Aura::HandleNULL, //273
@@ -344,7 +344,7 @@ Aura::Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, U
m_spellmod(NULL), m_caster_guid(0), m_castItemGuid(castItem?castItem->GetGUID():0), m_target(target),
m_timeCla(1000), m_periodicTimer(0), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE),
m_effIndex(eff), m_auraSlot(MAX_AURAS), m_auraFlags(AFLAG_NONE), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),
-m_positive(false), m_permanent(false), m_isPeriodic(false), m_isTrigger(false), m_isAreaAura(false), m_isPersistent(false),
+m_positive(false), m_permanent(false), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false),
m_updated(false), m_isRemovedOnShapeLost(true), m_in_use(false)
{
assert(target);
@@ -613,12 +613,7 @@ void Aura::Update(uint32 diff)
m_periodicTimer += m_modifier.periodictime;
if(!m_target->hasUnitState(UNIT_STAT_ISOLATED))
- {
- if(m_isTrigger)
- TriggerSpell();
- else
- PeriodicTick();
- }
+ PeriodicTick();
}
}
}
@@ -861,7 +856,7 @@ void Aura::_AddAura()
// Conflagrate aura state on Immolate
if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellProto->SpellFamilyFlags & 4)
m_target->ModifyAuraState(AURA_STATE_IMMOLATE, true);
-
+
// Faerie Fire (druid versions)
if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellFamilyFlags & 0x0000000000000400LL)
m_target->ModifyAuraState(AURA_STATE_FAERIE_FIRE, true);
@@ -984,7 +979,7 @@ void Aura::_RemoveAura()
for(Unit::AuraMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
{
SpellEntry const *auraSpellInfo = (*i).second->GetSpellProto();
- if(auraSpellInfo->SpellFamilyName == m_spellProto->SpellFamilyName &&
+ if(auraSpellInfo->SpellFamilyName == m_spellProto->SpellFamilyName &&
auraSpellInfo->SpellFamilyFlags == m_spellProto->SpellFamilyFlags )
{
found = true;
@@ -1204,6 +1199,7 @@ void Aura::HandleAddTargetTrigger(bool apply, bool Real)
m_spellmod = NULL;
}
}
+
void Aura::TriggerSpell()
{
Unit* caster = GetCaster();
@@ -1215,8 +1211,6 @@ void Aura::TriggerSpell()
// generic casting code with custom spells and target/caster customs
uint32 trigger_spell_id = GetSpellProto()->EffectTriggerSpell[m_effIndex];
- uint64 originalCasterGUID = GetCasterGUID();
-
SpellEntry const *triggeredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id);
SpellEntry const *auraSpellInfo = GetSpellProto();
uint32 auraId = auraSpellInfo->Id;
@@ -1894,17 +1888,17 @@ void Aura::TriggerSpell()
return;
caster = target;
- originalCasterGUID = 0;
break;
}
// Mana Tide
case 16191:
{
- caster->CastCustomSpell(target, trigger_spell_id, &m_modifier.m_amount, NULL, NULL, true, NULL, this, originalCasterGUID);
+ caster->CastCustomSpell(target, trigger_spell_id, &m_modifier.m_amount, NULL, NULL, true, NULL, this);
return;
}
}
}
+<<<<<<< HEAD:src/game/SpellAuras.cpp
if(!GetSpellMaxRange(sSpellRangeStore.LookupEntry(triggeredSpellInfo->rangeIndex)))
target = m_target; //for druid dispel poison
m_target->CastSpell(target, triggeredSpellInfo, true, 0, this, originalCasterGUID);
@@ -1917,6 +1911,25 @@ Unit* Aura::GetTriggerTarget() const
((Player*)m_target)->GetSelection() :*/
m_target->GetUInt64Value(UNIT_FIELD_TARGET));
return target ? target : m_target;
+=======
+ // All ok cast by default case
+ caster->CastSpell(target, triggeredSpellInfo, true, 0, this);
+}
+
+void Aura::TriggerSpellWithValue()
+{
+ Unit* caster = GetCaster();
+ Unit* target = GetTriggerTarget();
+
+ if(!caster || !target)
+ return;
+
+ // generic casting code with custom spells and target/caster customs
+ uint32 trigger_spell_id = GetSpellProto()->EffectTriggerSpell[m_effIndex];
+ int32 basepoints0 = this->GetModifier()->m_amount;
+
+ caster->CastCustomSpell(target, trigger_spell_id, &basepoints0, 0, 0, true, 0, this);
+>>>>>>> upstream/master:src/game/SpellAuras.cpp
}
/*********************************************************/
@@ -2052,14 +2065,14 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
if (caster && m_removeMode == AURA_REMOVE_BY_DEATH)
{
// Stop caster Arcane Missle chanelling on death
- if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE &&
+ if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE &&
m_spellProto->SpellFamilyFlags&0x0000000000000800LL)
{
caster->InterruptSpell(CURRENT_CHANNELED_SPELL);
return;
}
// Stop caster Penance chanelling on death
- if (m_spellProto->SpellFamilyName == SPELLFAMILY_PRIEST &&
+ if (m_spellProto->SpellFamilyName == SPELLFAMILY_PRIEST &&
m_spellProto->SpellFamilyFlags2 & 0x00000080)
{
caster->InterruptSpell(CURRENT_CHANNELED_SPELL);
@@ -3944,7 +3957,14 @@ void Aura::HandlePeriodicTriggerSpell(bool apply, bool Real)
m_periodicTimer += m_modifier.periodictime;
m_isPeriodic = apply;
- m_isTrigger = apply;
+}
+
+void Aura::HandlePeriodicTriggerSpellWithValue(bool apply, bool Real)
+{
+ if (m_periodicTimer <= 0)
+ m_periodicTimer += m_modifier.periodictime;
+
+ m_isPeriodic = apply;
}
void Aura::HandlePeriodicEnergize(bool apply, bool Real)
@@ -6087,6 +6107,16 @@ void Aura::PeriodicTick()
PeriodicDummyTick();
break;
}
+ case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
+ {
+ TriggerSpell();
+ break;
+ }
+ case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
+ {
+ TriggerSpellWithValue();
+ break;
+ }
default:
break;
}
@@ -6197,7 +6227,7 @@ void Aura::PeriodicDummyTick()
// case 33208: break;
// // Gossip NPC Periodic - Despawn
// case 33209: break;
-
+
// TODO: now its not periodic dummy - need move out from here
// Aspect of the Viper
case 34074:
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 67bf2c439c0..9d680ff8db1 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -112,6 +112,7 @@ class TRINITY_DLL_SPEC Aura
void HandleAuraModRegenInterrupt(bool Apply, bool Real);
void HandleHaste(bool Apply, bool Real);
void HandlePeriodicTriggerSpell(bool Apply, bool Real);
+ void HandlePeriodicTriggerSpellWithValue(bool apply, bool Real);
void HandlePeriodicEnergize(bool Apply, bool Real);
void HandleAuraModResistanceExclusive(bool Apply, bool Real);
void HandleAuraModPetTalentsPoints(bool Apply, bool Real);
@@ -260,7 +261,7 @@ class TRINITY_DLL_SPEC Aura
uint8 GetAuraLevel() const { return m_auraLevel; }
void SetAuraLevel(uint8 level) { m_auraLevel = level; }
uint8 GetAuraCharges() const { return m_procCharges; }
- void SetAuraCharges(uint8 charges)
+ void SetAuraCharges(uint8 charges)
{
if (m_procCharges == charges)
return;
@@ -268,7 +269,7 @@ class TRINITY_DLL_SPEC Aura
SendAuraUpdate(false);
}
bool DropAuraCharge() // return true if last charge dropped
- {
+ {
if (m_procCharges == 0)
return false;
m_procCharges--;
@@ -292,7 +293,6 @@ class TRINITY_DLL_SPEC Aura
bool IsPermanent() const { return m_permanent; }
bool IsAreaAura() const { return m_isAreaAura; }
bool IsPeriodic() const { return m_isPeriodic; }
- bool IsTrigger() const { return m_isTrigger; }
bool IsPassive() const { return m_isPassive; }
bool IsPersistent() const { return m_isPersistent; }
bool IsDeathPersistent() const { return m_isDeathPersist; }
@@ -319,6 +319,7 @@ class TRINITY_DLL_SPEC Aura
DiminishingGroup getDiminishGroup() const { return m_AuraDRGroup; }
void TriggerSpell();
+ void TriggerSpellWithValue();
void PeriodicTick();
void PeriodicDummyTick();
@@ -355,7 +356,6 @@ class TRINITY_DLL_SPEC Aura
bool m_positive:1;
bool m_permanent:1;
bool m_isPeriodic:1;
- bool m_isTrigger:1;
bool m_isAreaAura:1;
bool m_isPassive:1;
bool m_isPersistent:1;
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 27a51ee8b34..e7c67f4f41e 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -152,7 +152,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectSummonPlayer, // 85 SPELL_EFFECT_SUMMON_PLAYER
&Spell::EffectActivateObject, // 86 SPELL_EFFECT_ACTIVATE_OBJECT
&Spell::EffectUnused, // 87 SPELL_EFFECT_WMO_DAMAGE
- &Spell::EffectUnused, // 88 SPELL_EFFECT_WMO_REPAIR
+ &Spell::EffectUnused, // 88 SPELL_EFFECT_WMO_REPAIR
&Spell::EffectUnused, // 89 SPELL_EFFECT_WMO_CHANGE
&Spell::EffectUnused, // 90 SPELL_EFFECT_KILL_CREDIT
&Spell::EffectUnused, // 91 SPELL_EFFECT_THREAT_ALL one spell: zzOLDBrainwash
@@ -221,9 +221,9 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectNULL, //154 unused
&Spell::EffectTitanGrip, //155 SPELL_EFFECT_TITAN_GRIP Allows you to equip two-handed axes, maces and swords in one hand, but you attack $49152s1% slower than normal.
&Spell::EffectNULL, //156 Add Socket
- &Spell::EffectCreateItem, //157 SPELL_EFFECT_CREATE_ITEM_2 create/learn item/spell for profession
- &Spell::EffectMilling, //158 milling
- &Spell::EffectNULL //159 allow rename pet once again
+ &Spell::EffectCreateItem, //157 SPELL_EFFECT_CREATE_ITEM_2 create/learn item/spell for profession
+ &Spell::EffectMilling, //158 SPELL_EFFECT_MILLING milling
+ &Spell::EffectRenamePet //159 SPELL_EFFECT_ALLOW_RENAME_PET allow rename pet once again
};
void Spell::EffectNULL(uint32 /*i*/)
@@ -532,7 +532,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
// Lookup for Deadly poison (only attacker applied)
Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
- if( (*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_ROGUE &&
+ if( (*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_ROGUE &&
(*itr)->GetSpellProto()->SpellFamilyFlags & 0x10000 &&
(*itr)->GetCasterGUID()==m_caster->GetGUID() )
{
@@ -1016,7 +1016,7 @@ void Spell::EffectDummy(uint32 i)
{
Aura * dummy = m_caster->GetDummyAura(28734);
if (dummy)
- {
+ {
int32 bp = damage * dummy->GetStackAmount();
m_caster->CastCustomSpell(m_caster, 28733, &bp, NULL, NULL, true);
m_caster->RemoveAurasDueToSpell(28734);
@@ -1354,7 +1354,7 @@ void Spell::EffectDummy(uint32 i)
if (Aura *aura = m_caster->GetDummyAura(58367))
rage+=aura->GetModifier()->m_amount;
- int32 basePoints0 = damage+int32(rage * m_spellInfo->DmgMultiplier[i] +
+ int32 basePoints0 = damage+int32(rage * m_spellInfo->DmgMultiplier[i] +
m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f);
m_caster->CastCustomSpell(unitTarget, 20647, &basePoints0, NULL, NULL, true, 0);
m_caster->SetPower(POWER_RAGE,0);
@@ -1819,7 +1819,7 @@ void Spell::EffectDummy(uint32 i)
Unit::AuraList const& auraDummy = m_caster->GetAurasByType(SPELL_AURA_DUMMY);
for(Unit::AuraList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr)
{
- if( (*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_SHAMAN &&
+ if( (*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_SHAMAN &&
(*itr)->GetSpellProto()->SpellFamilyFlags & 0x0000000000200000LL &&
(*itr)->GetCastItemGUID() == item->GetGUID())
{
@@ -4370,9 +4370,16 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
Unit::AuraList const& list = unitTarget->GetAurasByType(SPELL_AURA_MOD_RESISTANCE);
for(Unit::AuraList::const_iterator itr=list.begin();itr!=list.end();++itr)
{
+<<<<<<< HEAD:src/game/SpellEffects.cpp
SpellEntry const *proto = (*itr)->GetSpellProto();
if(proto->SpellFamilyName == SPELLFAMILY_WARRIOR
&& proto->SpellFamilyFlags == SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR)
+=======
+ SpellEntry const *spellInfo = (*itr).second->GetSpellProto();
+ if( spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR &&
+ spellInfo->SpellFamilyFlags & 0x0000000000004000LL &&
+ (*itr).second->GetCasterGUID() == m_caster->GetGUID())
+>>>>>>> upstream/master:src/game/SpellEffects.cpp
{
(*itr)->RefreshAura();
stack = (*itr)->GetStackAmount();
@@ -5017,7 +5024,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 60893: // Northrend Alchemy Research
case 61177: // Northrend Inscription Research
case 61288: // Minor Inscription Research
- case 61756: // Northrend Inscription Research (FAST QA VERSION)
+ case 61756: // Northrend Inscription Research (FAST QA VERSION)
{
if(!IsExplicitDiscoverySpell(m_spellInfo))
{
@@ -6152,6 +6159,12 @@ void Spell::EffectSendTaxi(uint32 i)
case 34905: //Stealth Flight
mountid = 6851;
break;
+ case 45883: //Amber Ledge to Beryl Point
+ mountid = 23524;
+ break;
+ case 46064: //Amber Ledge to Coldarra
+ mountid = 6371;
+ break;
case 53335: //Stormwind Harbor Flight - Peaceful
mountid = 6852;
break;
@@ -6652,7 +6665,7 @@ void Spell::EffectQuestFail(uint32 i)
((Player*)unitTarget)->FailQuest(m_spellInfo->EffectMiscValue[i]);
}
-void Spell::EffectActivateRune(uint32 i)
+void Spell::EffectActivateRune(uint32 eff_idx)
{
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
@@ -6664,14 +6677,14 @@ void Spell::EffectActivateRune(uint32 i)
for(uint32 j = 0; j < MAX_RUNES; ++j)
{
- if(plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == m_spellInfo->EffectMiscValue[i])
+ if(plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == m_spellInfo->EffectMiscValue[eff_idx])
{
plr->SetRuneCooldown(j, 0);
}
}
}
-void Spell::EffectTitanGrip(uint32 i)
+void Spell::EffectTitanGrip(uint32 /*eff_idx*/)
{
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER)
((Player*)unitTarget)->SetCanTitanGrip(true);
@@ -6682,3 +6695,12 @@ void Spell::EffectRedirectThreat(uint32 /*i*/)
if(unitTarget)
m_caster->SetReducedThreatPercent((uint32)damage, unitTarget->GetGUID());
}
+
+void Spell::EffectRenamePet(uint32 /*eff_idx*/)
+{
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT ||
+ !((Creature*)unitTarget)->isPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET)
+ return;
+
+ unitTarget->SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_ALLOWED);
+}
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 7ad3eceed94..9092b494013 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -364,7 +364,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
// only hunter aspects have this (but not all aspects in hunter family)
if( spellInfo->SpellFamilyFlags & 0x0044000000380000LL || spellInfo->SpellFamilyFlags2 & 0x00003010)
return SPELL_ASPECT;
-
+
if( spellInfo->SpellFamilyFlags2 & 0x00000002 )
return SPELL_TRACKER;
@@ -943,7 +943,7 @@ void SpellMgr::LoadSpellAffects()
case 0: ptr = &spellInfo->EffectSpellClassMaskA[0]; break;
case 1: ptr = &spellInfo->EffectSpellClassMaskB[0]; break;
case 2: ptr = &spellInfo->EffectSpellClassMaskC[0]; break;
- default:
+ default:
continue;
}
if(ptr[0] == affect.SpellClassMask[0] || ptr[1] == affect.SpellClassMask[1] || ptr[2] == affect.SpellClassMask[2])
@@ -983,7 +983,7 @@ void SpellMgr::LoadSpellAffects()
case 0: ptr = &spellInfo->EffectSpellClassMaskA[0]; break;
case 1: ptr = &spellInfo->EffectSpellClassMaskB[0]; break;
case 2: ptr = &spellInfo->EffectSpellClassMaskC[0]; break;
- default:
+ default:
continue;
}
if(ptr[0] || ptr[1] || ptr[2])
@@ -1687,8 +1687,10 @@ void SpellMgr::LoadSpellLearnSkills()
// search auto-learned skills and add its to map also for use in unlearn spells/talents
uint32 dbc_count = 0;
+ barGoLink bar( sSpellStore.GetNumRows() );
for(uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell)
{
+ bar.step();
SpellEntry const* entry = sSpellStore.LookupEntry(spell);
if(!entry)
@@ -2565,10 +2567,12 @@ void SpellMgr::LoadSkillLineAbilityMap()
{
mSkillLineAbilityMap.clear();
+ barGoLink bar( sSkillLineAbilityStore.GetNumRows() );
uint32 count = 0;
for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); i++)
{
+ bar.step();
SkillLineAbilityEntry const *SkillInfo = sSkillLineAbilityStore.LookupEntry(i);
if(!SkillInfo)
continue;
@@ -2578,7 +2582,7 @@ void SpellMgr::LoadSkillLineAbilityMap()
}
sLog.outString();
- sLog.outString(">> Loaded %u SkillLineAbility MultiMap", count);
+ sLog.outString(">> Loaded %u SkillLineAbility MultiMap Data", count);
}
DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto, bool triggered)
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index ddfd53657c6..79ec28dcb0c 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -1259,8 +1259,21 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
// Calculate absorb resist
if(damage > 0)
{
- CalcAbsorbResist(pVictim, damageSchoolMask, SPELL_DIRECT_DAMAGE, damage, &damageInfo->absorb, &damageInfo->resist);
- damage-= damageInfo->absorb + damageInfo->resist;
+ // lookup absorb/resist ignore auras on caster for spell
+ bool ignore = false;
+ Unit::AuraList const& ignoreAbsorb = GetAurasByType(SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL);
+ for(Unit::AuraList::const_iterator i = ignoreAbsorb.begin(); i != ignoreAbsorb.end(); ++i)
+ if ((*i)->isAffectedOnSpell(spellInfo))
+ {
+ ignore = true;
+ break;
+ }
+
+ if (!ignore)
+ {
+ CalcAbsorbResist(pVictim, damageSchoolMask, SPELL_DIRECT_DAMAGE, damage, &damageInfo->absorb, &damageInfo->resist);
+ damage-= damageInfo->absorb + damageInfo->resist;
+ }
}
else
damage = 0;
@@ -1947,7 +1960,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
// Remove all expired absorb auras
if (existExpired)
{
- for(AuraList::const_iterator i = vSchoolAbsorb.begin(), next; i != vSchoolAbsorb.end();)
+ for(AuraList::const_iterator i = vSchoolAbsorb.begin(); i != vSchoolAbsorb.end();)
{
if ((*i)->GetModifier()->m_amount<=0)
{
@@ -2514,7 +2527,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
// Can`t dodge from behind in PvP (but its possible in PvE)
if (GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
canDodge = false;
- // Can`t parry
+ // Can`t parry
canParry = false;
}
// Check creatures flags_extra for disable parry
@@ -4895,7 +4908,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
for(AuraMap::iterator iter = Auras.begin(); iter != Auras.end();)
{
SpellEntry const *spell = iter->second->GetSpellProto();
- if( spell->Mechanic == MECHANIC_STUN ||
+ if( spell->Mechanic == MECHANIC_STUN ||
spell->EffectMechanic[iter->second->GetEffIndex()] == MECHANIC_STUN)
{
pVictim->RemoveAurasDueToSpell(spell->Id);
@@ -5460,7 +5473,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
// Rapid Recuperation
if ( dummySpell->SpellIconID == 3560 )
{
- // mane regen from Rapid Killing
+ // This effect only from Rapid Killing (mana regen)
+ if (!(procSpell->SpellFamilyFlags & 0x0100000000000000LL))
+ return false;
triggered_spell_id = 56654;
target = this;
break;
@@ -5486,6 +5501,22 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
target = this;
break;
}
+ // Righteous Vengeance
+ if (dummySpell->SpellIconID == 3025)
+ {
+ // 4 damage tick
+ basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/400;
+ triggered_spell_id = 61840;
+ break;
+ }
+ // Sheath of Light
+ if (dummySpell->SpellIconID == 3030)
+ {
+ // 4 healing tick
+ basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/400;
+ triggered_spell_id = 54203;
+ break;
+ }
switch(dummySpell->Id)
{
// Judgement of Light
@@ -5990,7 +6021,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
// Mark of Blood
if (dummySpell->Id == 49005)
{
- // TODO: need more info (cooldowns/PPM)
+ // TODO: need more info (cooldowns/PPM)
triggered_spell_id = 50424;
break;
}
@@ -6647,6 +6678,15 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
return false;
break;
}
+ // Rapid Recuperation
+ case 53228:
+ case 53232:
+ {
+ // This effect only from Rapid Fire (ability cast)
+ if (!(procSpell->SpellFamilyFlags & 0x0000000000000020LL))
+ return false;
+ break;
+ }
}
// Costum basepoints/target for exist spell
@@ -7686,6 +7726,16 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
if( (*i)->GetCasterGUID() == GetGUID() && (*i)->isAffectedOnSpell(spellProto))
TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ // Mod damage from spell mechanic
+ uint32 mechanicMask = GetAllSpellMechanicMask(spellProto);
+ if (mechanicMask)
+ {
+ AuraList const& mDamageDoneMechanic = pVictim->GetAurasByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
+ for(AuraList::const_iterator i = mDamageDoneMechanic.begin();i != mDamageDoneMechanic.end(); ++i)
+ if(mechanicMask & uint32(1<<((*i)->GetModifier()->m_miscvalue)))
+ TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ }
+
// Distribute Damage over multiple effects, reduce by AoE
CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime );
@@ -8056,7 +8106,7 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
}
// Glyph of Shadowburn
if (spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK &&
- spellProto->SpellFamilyFlags & 0x0000000000000080LL &&
+ spellProto->SpellFamilyFlags & 0x0000000000000080LL &&
pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
{
AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
@@ -8456,6 +8506,13 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) con
for(SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr)
if(itr->type == aura)
return true;
+ // Check for immune to application of harmful magical effects
+ AuraList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL);
+ for(AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
+ if (spellInfo->Dispel == DISPEL_MAGIC && // Magic debuff
+ ((*iter)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellInfo)) && // Check school
+ !IsPositiveEffect(spellInfo->Id, index)) // Harmful
+ return true;
}
return false;
diff --git a/src/game/Unit.h b/src/game/Unit.h
index f48d17fd409..b2ff5287309 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -662,7 +662,7 @@ struct UnitActionBarEntry
union
{
- struct
+ struct
{
uint16 SpellOrAction;
uint16 Type;
diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp
index fc0ca9e8007..bf999dbbc03 100644
--- a/src/game/WaypointManager.cpp
+++ b/src/game/WaypointManager.cpp
@@ -29,7 +29,7 @@ WaypointStore WaypointMgr;
void WaypointStore::Free()
{
- waypoint_map.clear();
+ waypoint_map.clear();
}
void WaypointStore::Load()
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 1607206cf40..fde4126db18 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1110,7 +1110,7 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading Script Names...");
objmgr.LoadScriptNames();
- sLog.outString( "Loading InstanceTemplate" );
+ sLog.outString( "Loading InstanceTemplate..." );
objmgr.LoadInstanceTemplate();
sLog.outString( "Loading SkillLineAbilityMultiMap Data..." );
@@ -1123,6 +1123,7 @@ void World::SetInitialWorldSettings()
sLog.outString( "Packing instances..." );
sInstanceSaveManager.PackInstances();
+ sLog.outString();
sLog.outString( "Loading Localization strings..." );
objmgr.LoadCreatureLocales();
objmgr.LoadGameObjectLocales();
@@ -1132,6 +1133,8 @@ void World::SetInitialWorldSettings()
objmgr.LoadPageTextLocales();
objmgr.LoadNpcOptionLocales();
objmgr.SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
+ sLog.outString( ">>> Localization strings loaded" );
+ sLog.outString();
sLog.outString( "Loading Page Texts..." );
objmgr.LoadPageTexts();
@@ -1197,7 +1200,10 @@ void World::SetInitialWorldSettings()
objmgr.LoadCreatures();
sLog.outString( "Loading Creature Addon Data..." );
+ sLog.outString();
objmgr.LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
+ sLog.outString( ">>> Creature Addon Data loaded" );
+ sLog.outString();
sLog.outString( "Loading Creature Respawn Data..." ); // must be after PackInstances()
objmgr.LoadCreatureRespawnTimes();
@@ -1209,7 +1215,10 @@ void World::SetInitialWorldSettings()
objmgr.LoadGameobjectRespawnTimes();
sLog.outString( "Loading Game Event Data...");
+ sLog.outString();
gameeventmgr.LoadFromDB();
+ sLog.outString( ">>> Game Event Data loaded" );
+ sLog.outString();
sLog.outString( "Loading Weather Data..." );
objmgr.LoadWeatherZoneChances();
@@ -1218,7 +1227,10 @@ void World::SetInitialWorldSettings()
objmgr.LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
sLog.outString( "Loading Quests Relations..." );
+ sLog.outString();
objmgr.LoadQuestRelations(); // must be after quest load
+ sLog.outString( ">>> Quests Relations loaded" );
+ sLog.outString();
sLog.outString( "Loading AreaTrigger definitions..." );
objmgr.LoadAreaTriggerTeleports(); // must be after item template load
@@ -1253,8 +1265,11 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading linked spells..." );
spellmgr.LoadSpellLinked();
- sLog.outString( "Loading player Create Info & Level Stats..." );
+ sLog.outString( "Loading Player Create Info & Level Stats..." );
+ sLog.outString();
objmgr.LoadPlayerInfo();
+ sLog.outString( ">>> Player Create Info & Level Stats loaded" );
+ sLog.outString();
sLog.outString( "Loading Exploration BaseXP Data..." );
objmgr.LoadExplorationBaseXP();
@@ -1275,7 +1290,10 @@ void World::SetInitialWorldSettings()
objmgr.LoadSpellDisabledEntrys();
sLog.outString( "Loading Loot Tables..." );
+ sLog.outString();
LoadLootTables();
+ sLog.outString( ">>> Loot Tables loaded" );
+ sLog.outString();
sLog.outString( "Loading Skill Discovery Table..." );
LoadSkillDiscoveryTable();
@@ -1286,22 +1304,22 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading Skill Fishing base level requirements..." );
objmgr.LoadFishingBaseSkillLevel();
- sLog.outString( "Loading AchievementCriteriaList..." );
+ sLog.outString( "Loading Achievements..." );
+ sLog.outString();
achievementmgr.LoadAchievementCriteriaList();
-
- sLog.outString( "Loading achievement rewards..." );
achievementmgr.LoadRewards();
-
- sLog.outString( "Loading achievement reward locale strings..." );
achievementmgr.LoadRewardLocales();
-
- sLog.outString( "Loading completed achievements..." );
achievementmgr.LoadCompletedAchievements();
+ sLog.outString( ">>> Achievements loaded" );
+ sLog.outString();
///- Load dynamic data tables from the database
sLog.outString( "Loading Auctions..." );
+ sLog.outString();
objmgr.LoadAuctionItems();
objmgr.LoadAuctions();
+ sLog.outString( ">>> Auctions loaded" );
+ sLog.outString();
sLog.outString( "Loading Guilds..." );
objmgr.LoadGuilds();
@@ -1315,7 +1333,7 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading ReservedNames..." );
objmgr.LoadReservedPlayersNames();
- sLog.outString( "Loading GameObject for quests..." );
+ sLog.outString( "Loading GameObjects for quests..." );
objmgr.LoadGameObjectForQuests();
sLog.outString( "Loading BattleMasters..." );
@@ -1330,13 +1348,14 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading Npc Options..." );
objmgr.LoadNpcOptions();
- sLog.outString( "Loading vendors..." );
+ sLog.outString( "Loading Vendors..." );
objmgr.LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
- sLog.outString( "Loading trainers..." );
+ sLog.outString( "Loading Trainers..." );
objmgr.LoadTrainerSpell(); // must be after load CreatureTemplate
sLog.outString( "Loading Waypoints..." );
+ sLog.outString();
WaypointMgr.Load();
sLog.outString( "Loading Creature Formations..." );
@@ -1351,12 +1370,15 @@ void World::SetInitialWorldSettings()
///- Load and initialize scripts
sLog.outString( "Loading Scripts..." );
+ sLog.outString();
objmgr.LoadQuestStartScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
objmgr.LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
objmgr.LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
objmgr.LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data)
objmgr.LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
objmgr.LoadWaypointScripts();
+ sLog.outString( ">>> Scripts loaded" );
+ sLog.outString();
sLog.outString( "Loading Scripts text locales..." ); // must be after Load*Scripts calls
objmgr.LoadDbScriptStrings();
@@ -1475,6 +1497,7 @@ void World::DetectDBCLang()
m_defaultDbcLocale = LocaleConstant(default_locale);
sLog.outString("Using %s DBC Locale as default. All available DBC locales: %s",localeNames[m_defaultDbcLocale],availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
+ sLog.outString();
}
void World::RecordTimeDiff(const char *text, ...)
diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp
index 78bc11f62e0..5bb52fe5de6 100644
--- a/src/game/WorldSession.cpp
+++ b/src/game/WorldSession.cpp
@@ -544,7 +544,7 @@ void WorldSession::LoadAccountData()
if(!result)
return;
- do
+ do
{
Field *fields = result->Fetch();