Merge branch 'master' into 320

This commit is contained in:
VladimirMangos 2009-09-10 05:46:08 +04:00
commit 7974e1ebcb
55 changed files with 2899 additions and 2780 deletions

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `character_db_version`; DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` ( CREATE TABLE `character_db_version` (
`required_8433_01_characters_character_account_data` bit(1) default NULL `required_8469_01_characters_character_spell` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
-- --

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL, `version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0', `cache_id` int(10) default '0',
`required_8462_01_mangos_creature_ai_texts` bit(1) default NULL `required_8482_01_mangos_spell_elixir` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
-- --
@ -17021,7 +17021,13 @@ INSERT INTO `spell_elixir` VALUES
(42735,0x3), (42735,0x3),
(45373,0x1), (45373,0x1),
(46837,0xB), (46837,0xB),
(46839,0xB); (46839,0xB),
(53752,0x3),
(53755,0x3),
(53758,0x3),
(53760,0x3),
(54212,0x3),
(62380,0x3);
/*!40000 ALTER TABLE `spell_elixir` ENABLE KEYS */; /*!40000 ALTER TABLE `spell_elixir` ENABLE KEYS */;

View file

@ -0,0 +1,20 @@
ALTER TABLE character_db_version CHANGE COLUMN required_8433_01_characters_character_account_data required_8469_01_characters_character_spell bit;
DELETE FROM character_spell WHERE spell in (
1178, /* Bear Form (Passive) */
3025, /* Cat Form (Passive) */
5419, /* Travel Form (Passive) */
5420, /* Tree of Life _passive_ */
5421, /* Aquatic Form (Passive) */
7376, /* Defensive Stance Passive */
7381, /* Berserker Stance Passive */
9635, /* Dire Bear Form (Passive) */
21156, /* Battle Stance Passive */
21178, /* Bear Form (Passive2) */
24905, /* Moonkin Form (Passive) */
34123, /* Tree of Life _pasive_ */
33948, /* Flight Form (Passive) */
34764, /* Flight Form (Passive) */
40121, /* Swift Flight Form (Passive) */
40122 /* Swift Flight Form (Passive) */
);

View file

@ -0,0 +1,13 @@
ALTER TABLE db_version CHANGE COLUMN required_8462_01_mangos_creature_ai_texts required_8482_01_mangos_spell_elixir bit;
DELETE FROM `spell_elixir` WHERE `entry` IN
(53752,53755,53758,53760,54212,62380);
/* Flasks added in 3.x */
INSERT INTO `spell_elixir` (`entry`, `mask`) VALUES
(53752,0x3),
(53755,0x3),
(53758,0x3),
(53760,0x3),
(54212,0x3),
(62380,0x3);

View file

@ -99,6 +99,8 @@ pkgdata_DATA = \
8444_01_mangos_mangos_string.sql \ 8444_01_mangos_mangos_string.sql \
8451_01_mangos_spell_proc_event.sql \ 8451_01_mangos_spell_proc_event.sql \
8462_01_mangos_creature_ai_texts.sql \ 8462_01_mangos_creature_ai_texts.sql \
8469_01_characters_character_spell.sql \
8482_01_mangos_spell_elixir.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -178,4 +180,6 @@ EXTRA_DIST = \
8444_01_mangos_mangos_string.sql \ 8444_01_mangos_mangos_string.sql \
8451_01_mangos_spell_proc_event.sql \ 8451_01_mangos_spell_proc_event.sql \
8462_01_mangos_creature_ai_texts.sql \ 8462_01_mangos_creature_ai_texts.sql \
8469_01_characters_character_spell.sql \
8482_01_mangos_spell_elixir.sql \
README README

View file

@ -758,7 +758,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
{ {
if (bg->GetTypeID() != BATTLEGROUND_AB) if (bg->GetTypeID() != BATTLEGROUND_AB)
continue; continue;
if(!((BattleGroundAB*)bg)->IsTeamScores500disadvantage(GetPlayer()->GetTeam())) if(!((BattleGroundAB*)bg)->IsTeamScores500Disadvantage(GetPlayer()->GetTeam()))
continue; continue;
break; break;
} }

View file

@ -231,9 +231,22 @@ BattleGround::~BattleGround()
void BattleGround::Update(uint32 diff) void BattleGround::Update(uint32 diff)
{ {
if (!GetPlayersSize() && !GetReviveQueueSize()) if (!GetPlayersSize())
//BG is empty {
// BG is empty
// if there are no players invited, delete BG
// this will delete arena or bg object, where any player entered
// [[ but if you use battleground object again (more battles possible to be played on 1 instance)
// then this condition should be removed and code:
// if (!GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE))
// this->AddToFreeBGObjectsQueue(); // not yet implemented
// should be used instead of current
// ]]
// BattleGround Template instance cannot be updated, because it would be deleted
if (!GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE))
m_SetDeleteThis = true;
return; return;
}
// remove offline players from bg after 5 minutes // remove offline players from bg after 5 minutes
if (!m_OfflineQueue.empty()) if (!m_OfflineQueue.empty())
@ -1028,7 +1041,12 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
DecreaseInvitedCount(team); DecreaseInvitedCount(team);
//we should update battleground queue, but only if bg isn't ending //we should update battleground queue, but only if bg isn't ending
if (isBattleGround() && GetStatus() < STATUS_WAIT_LEAVE) if (isBattleGround() && GetStatus() < STATUS_WAIT_LEAVE)
{
// a player has left the battleground, so there are free slots -> add to queue
AddToBGFreeSlotQueue();
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, GetQueueId()); sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, GetQueueId());
}
// Let others know // Let others know
WorldPacket data; WorldPacket data;
sBattleGroundMgr.BuildPlayerLeftBattleGroundPacket(&data, guid); sBattleGroundMgr.BuildPlayerLeftBattleGroundPacket(&data, guid);
@ -1048,17 +1066,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
sLog.outDetail("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName()); sLog.outDetail("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName());
} }
if (!GetPlayersSize() && !GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE)) //battleground object will be deleted next BattleGround::Update() call
{
// if no players left AND no invitees left, set this bg to delete in next update
// direct deletion could cause crashes
m_SetDeleteThis = true;
// return to prevent addition to freeslotqueue
return;
}
// a player exited the battleground, so there are free slots. add to queue
this->AddToBGFreeSlotQueue();
} }
// this method is called when no players remains in battleground // this method is called when no players remains in battleground
@ -1091,10 +1099,16 @@ void BattleGround::Reset()
void BattleGround::StartBattleGround() void BattleGround::StartBattleGround()
{ {
///this method should spawn spirit guides and so on
SetStartTime(0); SetStartTime(0);
SetLastResurrectTime(0); SetLastResurrectTime(0);
// add BG to free slot queue
AddToBGFreeSlotQueue();
// add bg to update list
// This must be done here, because we need to have already invited some players when first BG::Update() method is executed
// and it doesn't matter if we call StartBattleGround() more times, because m_BattleGrounds is a map and instance id never changes
sBattleGroundMgr.AddBattleGround(GetInstanceID(), GetTypeID(), this);
} }
void BattleGround::AddPlayer(Player *plr) void BattleGround::AddPlayer(Player *plr)
@ -1774,5 +1788,6 @@ WorldSafeLocsEntry const* BattleGround::GetClosestGraveYard( Player* player )
bool BattleGround::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const bool BattleGround::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const
{ {
BattleGroundTeamId team_idx = GetTeamIndexByTeamId(team); BattleGroundTeamId team_idx = GetTeamIndexByTeamId(team);
return m_TeamScores[team_idx] >= minScore && m_TeamScores[team_idx] <= maxScore; uint32 score = (m_TeamScores[team_idx] < 0) ? 0 : uint32(m_TeamScores[team_idx]);
return score >= minScore && score <= maxScore;
} }

View file

@ -143,19 +143,14 @@ void BattleGroundAB::Update(uint32 diff)
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]); UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
if (team == BG_TEAM_HORDE) if (team == BG_TEAM_HORDE)
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]); UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
}
}
// achievements flags // update achievement flags
if (m_TeamScores[BG_TEAM_ALLIANCE] > m_TeamScores[BG_TEAM_HORDE]) // we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
{ // horde will be a bit disadvantaged, but we can assume that points aren't updated for both team in same Update() call
if (m_TeamScores[BG_TEAM_ALLIANCE] - m_TeamScores[BG_TEAM_HORDE] >= 500) uint8 otherTeam = (team + 1) % BG_TEAMS_COUNT;
m_TeamScores500disadvantage[BG_TEAM_HORDE] = true; if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
m_TeamScores500Disadvantage[otherTeam] = true;
} }
else
{
if (m_TeamScores[BG_TEAM_HORDE] - m_TeamScores[BG_TEAM_ALLIANCE] >= 500)
m_TeamScores500disadvantage[BG_TEAM_ALLIANCE] = true;
} }
// Test win condition // Test win condition
@ -588,8 +583,8 @@ void BattleGroundAB::Reset()
bool isBGWeekend = false; //TODO FIXME - call sBattleGroundMgr.IsBGWeekend(m_TypeID); - you must also implement that call! bool isBGWeekend = false; //TODO FIXME - call sBattleGroundMgr.IsBGWeekend(m_TypeID); - you must also implement that call!
m_HonorTics = (isBGWeekend) ? BG_AB_ABBGWeekendHonorTicks : BG_AB_NotABBGWeekendHonorTicks; m_HonorTics = (isBGWeekend) ? BG_AB_ABBGWeekendHonorTicks : BG_AB_NotABBGWeekendHonorTicks;
m_ReputationTics = (isBGWeekend) ? BG_AB_ABBGWeekendReputationTicks : BG_AB_NotABBGWeekendReputationTicks; m_ReputationTics = (isBGWeekend) ? BG_AB_ABBGWeekendReputationTicks : BG_AB_NotABBGWeekendReputationTicks;
m_TeamScores500disadvantage[BG_TEAM_ALLIANCE] = false; m_TeamScores500Disadvantage[BG_TEAM_ALLIANCE] = false;
m_TeamScores500disadvantage[BG_TEAM_HORDE] = false; m_TeamScores500Disadvantage[BG_TEAM_HORDE] = false;
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{ {
@ -681,8 +676,8 @@ bool BattleGroundAB::IsAllNodesConrolledByTeam(uint32 team) const
{ {
uint32 count = 0; uint32 count = 0;
for(int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) for(int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
if (team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED || if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) ||
team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED) (team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED))
++count; ++count;
return count == BG_AB_DYNAMIC_NODES_COUNT; return count == BG_AB_DYNAMIC_NODES_COUNT;

View file

@ -262,7 +262,7 @@ class BattleGroundAB : public BattleGround
/* achievement req. */ /* achievement req. */
bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
bool IsTeamScores500disadvantage(uint32 team) const { return m_TeamScores500disadvantage[GetTeamIndexByTeamId(team)]; } bool IsTeamScores500Disadvantage(uint32 team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; }
private: private:
/* Gameobject spawning/despawning */ /* Gameobject spawning/despawning */
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay); void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay);
@ -293,6 +293,6 @@ class BattleGroundAB : public BattleGround
uint32 m_HonorTics; uint32 m_HonorTics;
uint32 m_ReputationTics; uint32 m_ReputationTics;
// need for achievements // need for achievements
bool m_TeamScores500disadvantage[BG_TEAMS_COUNT]; bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT];
}; };
#endif #endif

View file

@ -1168,13 +1168,16 @@ void BattleGroundMgr::Update(uint32 diff)
if (!m_QueueUpdateScheduler.empty()) if (!m_QueueUpdateScheduler.empty())
{ {
//copy vector and clear the other //copy vector and clear the other
// TODO add lock
// TODO maybe std::list would be better and then unlock after end of cycle
std::vector<uint32> scheduled(m_QueueUpdateScheduler); std::vector<uint32> scheduled(m_QueueUpdateScheduler);
m_QueueUpdateScheduler.clear(); m_QueueUpdateScheduler.clear();
// TODO drop lock
for (uint8 i = 0; i < scheduled.size(); i++) for (uint8 i = 0; i < scheduled.size(); i++)
{ {
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundQueueTypeId(scheduled[i] / 65536); BattleGroundQueueTypeId bgQueueTypeId = BattleGroundQueueTypeId(scheduled[i] >> 16);
BattleGroundTypeId bgTypeId = BattleGroundTypeId((scheduled[i] % 65536) / 256); BattleGroundTypeId bgTypeId = BattleGroundTypeId((scheduled[i] >> 8) & 255);
BGQueueIdBasedOnLevel queue_id = BGQueueIdBasedOnLevel(scheduled[i] % 256); BGQueueIdBasedOnLevel queue_id = BGQueueIdBasedOnLevel(scheduled[i] & 255);
m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, queue_id); m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, queue_id);
} }
} }
@ -1606,12 +1609,6 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
bg->SetArenaType(arenaType); bg->SetArenaType(arenaType);
bg->SetRated(isRated); bg->SetRated(isRated);
// add BG to free slot queue
bg->AddToBGFreeSlotQueue();
// add bg to update list
AddBattleGround(bg->GetInstanceID(), bg->GetTypeID(), bg);
return bg; return bg;
} }
@ -2023,9 +2020,9 @@ void BattleGroundMgr::ToggleArenaTesting()
void BattleGroundMgr::ScheduleQueueUpdate(BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id) void BattleGroundMgr::ScheduleQueueUpdate(BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id)
{ {
//This method must be atomic! //This method must be atomic, TODO add mutex
//we will use only 1 number created of bgTypeId and queue_id //we will use only 1 number created of bgTypeId and queue_id
uint32 schedule_id = (bgQueueTypeId * 65536) + (bgTypeId * 256) + queue_id; uint32 schedule_id = (bgQueueTypeId << 16) | (bgTypeId << 8) | queue_id;
bool found = false; bool found = false;
for (uint8 i = 0; i < m_QueueUpdateScheduler.size(); i++) for (uint8 i = 0; i < m_QueueUpdateScheduler.size(); i++)
{ {

View file

@ -146,8 +146,8 @@ class BGQueueInviteEvent : public BasicEvent
private: private:
uint64 m_PlayerGuid; uint64 m_PlayerGuid;
uint32 m_BgInstanceGUID; uint32 m_BgInstanceGUID;
uint32 m_RemoveTime;
BattleGroundTypeId m_BgTypeId; BattleGroundTypeId m_BgTypeId;
uint32 m_RemoveTime;
}; };
/* /*

View file

@ -1177,7 +1177,7 @@ valid examples:
char c = reader.peek(); char c = reader.peek();
// ignore enchants etc. // ignore enchants etc.
while(c >='0' && c <='9' || c==':') while ((c >= '0' && c <= '9') || c== ':')
{ {
reader.ignore(1); reader.ignore(1);
c = reader.peek(); c = reader.peek();

View file

@ -153,7 +153,7 @@ void Creature::RemoveFromWorld()
void Creature::RemoveCorpse() void Creature::RemoveCorpse()
{ {
if( getDeathState()!=CORPSE && !m_isDeadByDefault || getDeathState()!=ALIVE && m_isDeadByDefault ) if ((getDeathState() != CORPSE && !m_isDeadByDefault) || (getDeathState() != ALIVE && m_isDeadByDefault))
return; return;
m_deathTimer = 0; m_deathTimer = 0;
@ -444,7 +444,7 @@ void Creature::Update(uint32 diff)
RegenerateMana(); RegenerateMana();
m_regenTimer = 2000; m_regenTimer = REGEN_TIME_FULL;
break; break;
} }
case DEAD_FALLING: case DEAD_FALLING:
@ -1459,10 +1459,10 @@ float Creature::GetAttackDistance(Unit const* pl) const
if(aggroRate==0) if(aggroRate==0)
return 0.0f; return 0.0f;
int32 playerlevel = pl->getLevelForTarget(this); uint32 playerlevel = pl->getLevelForTarget(this);
int32 creaturelevel = getLevelForTarget(pl); uint32 creaturelevel = getLevelForTarget(pl);
int32 leveldif = playerlevel - creaturelevel; int32 leveldif = int32(playerlevel) - int32(creaturelevel);
// "The maximum Aggro Radius has a cap of 25 levels under. Example: A level 30 char has the same Aggro Radius of a level 5 char on a level 60 mob." // "The maximum Aggro Radius has a cap of 25 levels under. Example: A level 30 char has the same Aggro Radius of a level 5 char on a level 60 mob."
if ( leveldif < - 25) if ( leveldif < - 25)
@ -1730,7 +1730,7 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const
{ {
if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INVISIBLE) if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INVISIBLE)
return false; return false;
return isAlive() || m_deathTimer > 0 || m_isDeadByDefault && m_deathState==CORPSE; return (isAlive() || m_deathTimer > 0 || (m_isDeadByDefault && m_deathState == CORPSE));
} }
// Dead player see live creatures near own corpse // Dead player see live creatures near own corpse

View file

@ -378,7 +378,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
target = owner; target = owner;
} }
} }
else if (target = m_creature->getVictim()) else if ((target = m_creature->getVictim()))
{ {
if (target->GetTypeId() != TYPEID_PLAYER) if (target->GetTypeId() != TYPEID_PLAYER)
if (Unit* owner = target->GetOwner()) if (Unit* owner = target->GetOwner())

View file

@ -386,6 +386,7 @@ void GameObject::Update(uint32 /*p_time*/)
if (GetGOInfo()->GetAutoCloseTime() && (m_cooldownTime < time(NULL))) if (GetGOInfo()->GetAutoCloseTime() && (m_cooldownTime < time(NULL)))
ResetDoorOrButton(); ResetDoorOrButton();
break; break;
default: break;
} }
break; break;
} }

View file

@ -872,11 +872,11 @@ namespace MaNGOS
return false; return false;
} }
private: private:
bool i_hitHidden;
bool i_targetForPlayer; bool i_targetForPlayer;
WorldObject const* i_obj; WorldObject const* i_obj;
Unit const* i_funit; Unit const* i_funit;
float i_range; float i_range;
bool i_hitHidden;
}; };
// do attack at call of help to friendly crearture // do attack at call of help to friendly crearture
@ -1076,7 +1076,7 @@ namespace MaNGOS
~LocalizedPacketListDo() ~LocalizedPacketListDo()
{ {
for(size_t i = 0; i < i_data_cache.size(); ++i) for(size_t i = 0; i < i_data_cache.size(); ++i)
for(int j = 0; j < i_data_cache[i].size(); ++j) for(size_t j = 0; j < i_data_cache[i].size(); ++j)
delete i_data_cache[i][j]; delete i_data_cache[i][j];
} }
void operator()( Player* p ); void operator()( Player* p );

View file

@ -728,7 +728,7 @@ void Guild::Disband()
objmgr.RemoveGuild(m_Id); objmgr.RemoveGuild(m_Id);
} }
void Guild::Roster(WorldSession *session) void Guild::Roster(WorldSession *session /*= NULL*/)
{ {
// we can only guess size // we can only guess size
WorldPacket data(SMSG_GUILD_ROSTER, (4+MOTD.length()+1+GINFO.length()+1+4+m_Ranks.size()*(4+4+GUILD_BANK_MAX_TABS*(4+4))+members.size()*50)); WorldPacket data(SMSG_GUILD_ROSTER, (4+MOTD.length()+1+GINFO.length()+1+4+m_Ranks.size()*(4+4+GUILD_BANK_MAX_TABS*(4+4))+members.size()*50));
@ -777,7 +777,10 @@ void Guild::Roster(WorldSession *session)
data << itr->second.OFFnote; data << itr->second.OFFnote;
} }
} }
session->SendPacket(&data);; if (session)
session->SendPacket(&data);
else
BroadcastPacket(&data);
sLog.outDebug( "WORLD: Sent (SMSG_GUILD_ROSTER)" ); sLog.outDebug( "WORLD: Sent (SMSG_GUILD_ROSTER)" );
} }
@ -824,7 +827,7 @@ void Guild::UpdateLogoutTime(uint64 guid)
if (itr == members.end() ) if (itr == members.end() )
return; return;
itr->second.Level = time(NULL); itr->second.LogoutTime = time(NULL);
if (m_OnlineMembers > 0) if (m_OnlineMembers > 0)
--m_OnlineMembers; --m_OnlineMembers;
@ -1992,7 +1995,6 @@ void Guild::SendGuildBankTabText(WorldSession *session, uint8 TabId)
session->SendPacket(&data); session->SendPacket(&data);
else else
BroadcastPacket(&data); BroadcastPacket(&data);
} }
void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount ) void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount )

View file

@ -295,19 +295,19 @@ class Guild
uint32 GetId(){ return m_Id; } uint32 GetId(){ return m_Id; }
const uint64& GetLeader(){ return m_LeaderGuid; } const uint64& GetLeader(){ return m_LeaderGuid; }
std::string GetName(){ return m_Name; } std::string const& GetName() const { return m_Name; }
std::string GetMOTD(){ return MOTD; } std::string const& GetMOTD() const { return MOTD; }
std::string GetGINFO(){ return GINFO; } std::string const& GetGINFO() const { return GINFO; }
uint32 GetCreatedYear(){ return m_CreatedYear; } uint32 GetCreatedYear() const { return m_CreatedYear; }
uint32 GetCreatedMonth(){ return m_CreatedMonth; } uint32 GetCreatedMonth() const { return m_CreatedMonth; }
uint32 GetCreatedDay(){ return m_CreatedDay; } uint32 GetCreatedDay() const { return m_CreatedDay; }
uint32 GetEmblemStyle(){ return m_EmblemStyle; } uint32 GetEmblemStyle() const { return m_EmblemStyle; }
uint32 GetEmblemColor(){ return m_EmblemColor; } uint32 GetEmblemColor() const { return m_EmblemColor; }
uint32 GetBorderStyle(){ return m_BorderStyle; } uint32 GetBorderStyle() const { return m_BorderStyle; }
uint32 GetBorderColor(){ return m_BorderColor; } uint32 GetBorderColor() const { return m_BorderColor; }
uint32 GetBackgroundColor(){ return m_BackgroundColor; } uint32 GetBackgroundColor() const { return m_BackgroundColor; }
void SetLeader(uint64 guid); void SetLeader(uint64 guid);
bool AddMember(uint64 plGuid, uint32 plRank); bool AddMember(uint64 plGuid, uint32 plRank);
@ -374,7 +374,7 @@ class Guild
return NULL; return NULL;
} }
void Roster(WorldSession *session); void Roster(WorldSession *session = NULL); // NULL = broadcast
void Query(WorldSession *session); void Query(WorldSession *session);
void UpdateLogoutTime(uint64 guid); void UpdateLogoutTime(uint64 guid);

View file

@ -652,7 +652,7 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
guild->SetRankRights(rankId, rights); guild->SetRankRights(rankId, rights);
guild->Query(this); guild->Query(this);
guild->Roster(this); guild->Roster(); // broadcast for tab rights update
} }
void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket)
@ -681,7 +681,7 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket)
guild->CreateRank(rankname, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); guild->CreateRank(rankname, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
guild->Query(this); guild->Query(this);
guild->Roster(this); guild->Roster(); // broadcast for tab rights update
} }
void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/)
@ -703,7 +703,7 @@ void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/)
guild->DelRank(); guild->DelRank();
guild->Query(this); guild->Query(this);
guild->Roster(this); guild->Roster(); // broadcast for tab rights update
} }
void WorldSession::SendGuildCommandResult(uint32 typecmd, const std::string& str,uint32 cmdresult) void WorldSession::SendGuildCommandResult(uint32 typecmd, const std::string& str,uint32 cmdresult)
@ -1016,7 +1016,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
recv_data >> unk2; // always 0 recv_data >> unk2; // always 0
recv_data >> SplitedAmount; recv_data >> SplitedAmount;
if (BankTabSlotDst >= GUILD_BANK_MAX_SLOTS || BankTabDst == BankTab && BankTabSlotDst == BankTabSlot) if (BankTabSlotDst >= GUILD_BANK_MAX_SLOTS || (BankTabDst == BankTab && BankTabSlotDst == BankTabSlot))
{ {
recv_data.rpos(recv_data.wpos()); // prevent additional spam at rejected packet recv_data.rpos(recv_data.wpos()); // prevent additional spam at rejected packet
return; return;
@ -1123,7 +1123,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
GetPlayer()->ModifyMoney(-int(TabCost)); GetPlayer()->ModifyMoney(-int(TabCost));
pGuild->SetBankMoneyPerDay(GetPlayer()->GetRank(), WITHDRAW_MONEY_UNLIMITED); pGuild->SetBankMoneyPerDay(GetPlayer()->GetRank(), WITHDRAW_MONEY_UNLIMITED);
pGuild->SetBankRightsAndSlots(GetPlayer()->GetRank(), TabId, GUILD_BANK_RIGHT_FULL, WITHDRAW_SLOT_UNLIMITED, true); pGuild->SetBankRightsAndSlots(GetPlayer()->GetRank(), TabId, GUILD_BANK_RIGHT_FULL, WITHDRAW_SLOT_UNLIMITED, true);
pGuild->Roster(this); pGuild->Roster(); // broadcast for tab rights update
pGuild->DisplayGuildBankTabsInfo(this); pGuild->DisplayGuildBankTabsInfo(this);
} }

View file

@ -143,7 +143,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/)
// save or plan save after 20 sec (logout delay) if current next save time more this value and _not_ output any messages to prevent cheat planning // save or plan save after 20 sec (logout delay) if current next save time more this value and _not_ output any messages to prevent cheat planning
uint32 save_interval = sWorld.getConfig(CONFIG_INTERVAL_SAVE); uint32 save_interval = sWorld.getConfig(CONFIG_INTERVAL_SAVE);
if(save_interval==0 || save_interval > 20*IN_MILISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILISECONDS) if (save_interval==0 || (save_interval > 20*IN_MILISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILISECONDS))
player->SaveToDB(); player->SaveToDB();
return true; return true;
@ -158,7 +158,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
for(; itr != m.end(); ++itr) for(; itr != m.end(); ++itr)
{ {
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
if ((itr->second->isGameMaster() || itr_sec > SEC_PLAYER && itr_sec <= sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST)) && if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST))) &&
(!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer()))) (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())))
{ {
if(first) if(first)

View file

@ -658,7 +658,7 @@ bool ChatHandler::HandleModifyKnownTitlesCommand(const char* args)
uint64 titles2 = titles; uint64 titles2 = titles;
for(int i = 1; i < sCharTitlesStore.GetNumRows(); ++i) for(uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i)
if(CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i)) if(CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
titles2 &= ~(uint64(1) << tEntry->bit_index); titles2 &= ~(uint64(1) << tEntry->bit_index);
@ -2275,7 +2275,7 @@ bool ChatHandler::HandleGoTaxinodeCommand(const char* args)
return false; return false;
} }
if (node->x == 0.0f && node->y == 0.0f && node->z == 0.0f || if ((node->x == 0.0f && node->y == 0.0f && node->z == 0.0f) ||
!MapManager::IsValidMapCoord(node->map_id,node->x,node->y,node->z)) !MapManager::IsValidMapCoord(node->map_id,node->x,node->y,node->z))
{ {
PSendSysMessage(LANG_INVALID_TARGET_COORD,node->x,node->y,node->map_id); PSendSysMessage(LANG_INVALID_TARGET_COORD,node->x,node->y,node->map_id);
@ -2412,7 +2412,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
float y = (float)atof(py); float y = (float)atof(py);
// prevent accept wrong numeric args // prevent accept wrong numeric args
if (x==0.0f && *px!='0' || y==0.0f && *py!='0') if ((x==0.0f && *px!='0') || (y==0.0f && *py!='0'))
return false; return false;
uint32 areaid = cAreaId ? (uint32)atoi(cAreaId) : _player->GetZoneId(); uint32 areaid = cAreaId ? (uint32)atoi(cAreaId) : _player->GetZoneId();

View file

@ -3180,7 +3180,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
} }
wpCreature->SetVisibility(VISIBILITY_OFF); wpCreature->SetVisibility(VISIBILITY_OFF);
sLog.outDebug("DEBUG: UPDATE creature_movement SET wpguid = '%u"); sLog.outDebug("DEBUG: UPDATE creature_movement SET wpguid = '%u", wpCreature->GetGUIDLow());
// set "wpguid" column to the visual waypoint // set "wpguid" column to the visual waypoint
WorldDatabase.PExecuteLog("UPDATE creature_movement SET wpguid = '%u' WHERE id = '%u' and point = '%u'", wpCreature->GetGUIDLow(), lowguid, point); WorldDatabase.PExecuteLog("UPDATE creature_movement SET wpguid = '%u' WHERE id = '%u' and point = '%u'", wpCreature->GetGUIDLow(), lowguid, point);
@ -3928,8 +3928,6 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id)
bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/) bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/)
{ {
uint32 classmask = m_session->GetPlayer()->getClassMask();
for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i) for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i)
{ {
SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i); SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i);
@ -3970,8 +3968,6 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args)
// converting string that we try to find to lower case // converting string that we try to find to lower case
wstrToLower( wnamepart ); wstrToLower( wnamepart );
uint32 classmask = m_session->GetPlayer()->getClassMask();
std::string name; std::string name;
SkillLineEntry const *targetSkillInfo = NULL; SkillLineEntry const *targetSkillInfo = NULL;

View file

@ -4581,7 +4581,7 @@ bool ChatHandler::HandleServerRestartCommand(const char* args)
int32 time = atoi (time_str); int32 time = atoi (time_str);
///- Prevent interpret wrong arg value as 0 secs shutdown time ///- Prevent interpret wrong arg value as 0 secs shutdown time
if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) if ((time == 0 && (time_str[0]!='0' || time_str[1]!='\0')) || time < 0)
return false; return false;
if (exitcode_str) if (exitcode_str)
@ -4616,7 +4616,7 @@ bool ChatHandler::HandleServerIdleRestartCommand(const char* args)
int32 time = atoi (time_str); int32 time = atoi (time_str);
///- Prevent interpret wrong arg value as 0 secs shutdown time ///- Prevent interpret wrong arg value as 0 secs shutdown time
if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) if ((time == 0 && (time_str[0]!='0' || time_str[1]!='\0')) || time < 0)
return false; return false;
if (exitcode_str) if (exitcode_str)
@ -4651,7 +4651,7 @@ bool ChatHandler::HandleServerIdleShutDownCommand(const char* args)
int32 time = atoi (time_str); int32 time = atoi (time_str);
///- Prevent interpret wrong arg value as 0 secs shutdown time ///- Prevent interpret wrong arg value as 0 secs shutdown time
if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) if ((time == 0 && (time_str[0]!='0' || time_str[1]!='\0')) || time < 0)
return false; return false;
if (exitcode_str) if (exitcode_str)
@ -6182,7 +6182,7 @@ bool ChatHandler::HandleSendItemsCommand(const char* args)
} }
uint32 item_count = itemCountStr ? atoi(itemCountStr) : 1; uint32 item_count = itemCountStr ? atoi(itemCountStr) : 1;
if(item_count < 1 || item_proto->MaxCount > 0 && item_count > uint32(item_proto->MaxCount)) if (item_count < 1 || (item_proto->MaxCount > 0 && item_count > uint32(item_proto->MaxCount)))
{ {
PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, item_count,item_id); PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, item_count,item_id);
SetSentErrorMessage(true); SetSentErrorMessage(true);

View file

@ -45,7 +45,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
GameObject *go = player->GetMap()->GetGameObject(lguid); GameObject *go = player->GetMap()->GetGameObject(lguid);
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) if (!go || ((go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)))
{ {
player->SendLootRelease(lguid); player->SendLootRelease(lguid);
return; return;
@ -280,7 +280,7 @@ void WorldSession::DoLootRelease( uint64 lguid )
GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid); GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid);
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) if (!go || ((go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)))
return; return;
loot = &go->loot; loot = &go->loot;

View file

@ -1789,7 +1789,8 @@ uint16 Map::GetAreaFlag(float x, float y, float z) const
// Makers' Overlook (ground and cave) // Makers' Overlook (ground and cave)
else if (x > 5634.48f && x < 5774.53f && y < 3475.0f && z > 300.0f) else if (x > 5634.48f && x < 5774.53f && y < 3475.0f && z > 300.0f)
{ {
if(y > 3380.26f || y > 3265.0f && z < 360.0f) areaflag = 2187; if (y > 3380.26f || (y > 3265.0f && z < 360.0f))
areaflag = 2187;
} }
break; break;
// The Makers' Perch (underground) // The Makers' Perch (underground)
@ -1868,7 +1869,7 @@ void Map::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 area
bool Map::IsInWater(float x, float y, float pZ) const bool Map::IsInWater(float x, float y, float pZ) const
{ {
// Check surface in x, y point for liquid // Check surface in x, y point for liquid
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) if (const_cast<Map*>(this)->GetGrid(x, y))
{ {
LiquidData liquid_status; LiquidData liquid_status;
if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, &liquid_status)) if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, &liquid_status))
@ -1882,7 +1883,7 @@ bool Map::IsInWater(float x, float y, float pZ) const
bool Map::IsUnderWater(float x, float y, float z) const bool Map::IsUnderWater(float x, float y, float z) const
{ {
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) if (const_cast<Map*>(this)->GetGrid(x, y))
{ {
if (getLiquidStatus(x, y, z, MAP_LIQUID_TYPE_WATER|MAP_LIQUID_TYPE_OCEAN)&LIQUID_MAP_UNDER_WATER) if (getLiquidStatus(x, y, z, MAP_LIQUID_TYPE_WATER|MAP_LIQUID_TYPE_OCEAN)&LIQUID_MAP_UNDER_WATER)
return true; return true;

View file

@ -478,6 +478,8 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
ActiveNonPlayers m_activeNonPlayers; ActiveNonPlayers m_activeNonPlayers;
ActiveNonPlayers::iterator m_activeNonPlayersIter; ActiveNonPlayers::iterator m_activeNonPlayersIter;
private: private:
time_t i_gridExpiry;
//used for fast base_map (e.g. MapInstanced class object) search for //used for fast base_map (e.g. MapInstanced class object) search for
//InstanceMaps and BattleGroundMaps... //InstanceMaps and BattleGroundMaps...
Map* m_parentMap; Map* m_parentMap;
@ -489,8 +491,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
GridMap *GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]; GridMap *GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP*TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells; std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP*TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells;
time_t i_gridExpiry;
std::set<WorldObject *> i_objectsToRemove; std::set<WorldObject *> i_objectsToRemove;
std::multimap<time_t, ScriptAction> m_scriptSchedule; std::multimap<time_t, ScriptAction> m_scriptSchedule;

View file

@ -90,7 +90,7 @@ MotionMaster::UpdateMotion(uint32 diff)
if (m_expList) if (m_expList)
{ {
for (int i = 0; i < m_expList->size(); ++i) for (size_t i = 0; i < m_expList->size(); ++i)
{ {
MovementGenerator* mg = (*m_expList)[i]; MovementGenerator* mg = (*m_expList)[i];
if (!isStatic(mg)) if (!isStatic(mg))

View file

@ -457,7 +457,7 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data)
if(_player->m_mover->GetGUID() == old_mover_guid) if(_player->m_mover->GetGUID() == old_mover_guid)
{ {
sLog.outError("HandleMoveNotActiveMover: incorrect mover guid: mover is " I64FMT " and should be " I64FMT " instead of " I64FMT, _player->m_mover->GetGUID(), _player->GetGUID(), old_mover_guid); sLog.outError("HandleMoveNotActiveMover: incorrect mover guid: mover is " I64FMT " and should be " I64FMT " instead of " UI64FMTD, _player->m_mover->GetGUID(), _player->GetGUID(), old_mover_guid);
recv_data.rpos(recv_data.wpos()); // prevent warnings spam recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return; return;
} }

View file

@ -111,7 +111,7 @@ bool SpellClickInfo::IsFitToRequirements(Player const* player) const
if(questStart) if(questStart)
{ {
// not in expected required quest state // not in expected required quest state
if(!player || (!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)) if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)))
return false; return false;
} }
@ -782,8 +782,8 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
// replace by new structures array // replace by new structures array
const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size()/2+1]; const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size()/2+1];
int i=0; uint32 i=0;
for(int j=0;j<val.size()/2;++j) for(uint32 j = 0; j < val.size()/2; ++j)
{ {
CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]); CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
cAura.spell_id = (uint32)val[2*j+0]; cAura.spell_id = (uint32)val[2*j+0];
@ -1082,7 +1082,7 @@ void ObjectMgr::LoadCreatures()
if(heroicCreatures.find(data.id)!=heroicCreatures.end()) if(heroicCreatures.find(data.id)!=heroicCreatures.end())
{ {
sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as heroic template in `creature_template`, skipped.",guid,data.id ); sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as heroic template (entry: %u) in `creature_template`, skipped.",guid, data.id );
continue; continue;
} }
@ -3482,8 +3482,8 @@ void ObjectMgr::LoadQuests()
bool found = false; bool found = false;
for(int k = 0; k < 3; ++k) for(int k = 0; k < 3; ++k)
{ {
if( spellInfo->Effect[k]==SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k])==qinfo->QuestId || if ((spellInfo->Effect[k] == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k]) == qinfo->QuestId) ||
spellInfo->Effect[k]==SPELL_EFFECT_SEND_EVENT) spellInfo->Effect[k] == SPELL_EFFECT_SEND_EVENT)
{ {
found = true; found = true;
break; break;
@ -7098,7 +7098,7 @@ bool PlayerCondition::Meets(Player const * player) const
case CONDITION_REPUTATION_RANK: case CONDITION_REPUTATION_RANK:
{ {
FactionEntry const* faction = sFactionStore.LookupEntry(value1); FactionEntry const* faction = sFactionStore.LookupEntry(value1);
return faction && player->GetReputationMgr().GetRank(faction) >= value2; return faction && player->GetReputationMgr().GetRank(faction) >= int32(value2);
} }
case CONDITION_TEAM: case CONDITION_TEAM:
return player->GetTeam() == value1; return player->GetTeam() == value1;

View file

@ -785,9 +785,9 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen) void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen)
{ {
if (MaxValue == DISABLED_MIRROR_TIMER) if (int(MaxValue) == DISABLED_MIRROR_TIMER)
{ {
if (CurrentValue!=DISABLED_MIRROR_TIMER) if (int(CurrentValue) != DISABLED_MIRROR_TIMER)
StopMirrorTimer(Type); StopMirrorTimer(Type);
return; return;
} }
@ -1210,7 +1210,7 @@ void Player::Update( uint32 p_time )
} }
} }
if(m_regenTimer > 0) if (m_regenTimer)
{ {
if(p_time >= m_regenTimer) if(p_time >= m_regenTimer)
m_regenTimer = 0; m_regenTimer = 0;
@ -1251,6 +1251,11 @@ void Player::Update( uint32 p_time )
if (isAlive()) if (isAlive())
{ {
// if no longer casting, set regen power as soon as it is up.
if (!IsUnderLastManaUseEffect())
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
if (!m_regenTimer)
RegenerateAll(); RegenerateAll();
} }
@ -1508,7 +1513,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
if(!enchantId) if(!enchantId)
continue; continue;
if(enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId)) if ((enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId)))
break; break;
} }
@ -1912,36 +1917,33 @@ void Player::RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attack
ModifyPower(POWER_RAGE, uint32(addRage*10)); ModifyPower(POWER_RAGE, uint32(addRage*10));
} }
void Player::RegenerateAll() void Player::RegenerateAll(uint32 diff)
{ {
if (m_regenTimer != 0)
return;
uint32 regenDelay = 2000;
// Not in combat or they have regeneration // Not in combat or they have regeneration
if( !isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) || if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) ||
HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed() ) HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed() )
{ {
RegenerateHealth(); RegenerateHealth(diff);
if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN)) if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
{ {
Regenerate(POWER_RAGE); Regenerate(POWER_RAGE, diff);
if(getClass() == CLASS_DEATH_KNIGHT) if(getClass() == CLASS_DEATH_KNIGHT)
Regenerate(POWER_RUNIC_POWER); Regenerate(POWER_RUNIC_POWER, diff);
} }
} }
Regenerate( POWER_ENERGY ); Regenerate(POWER_ENERGY, diff);
Regenerate( POWER_MANA ); Regenerate(POWER_MANA, diff);
if(getClass() == CLASS_DEATH_KNIGHT) if (getClass() == CLASS_DEATH_KNIGHT)
Regenerate( POWER_RUNE ); Regenerate(POWER_RUNE, diff);
m_regenTimer = regenDelay; m_regenTimer = REGEN_TIME_FULL;
} }
void Player::Regenerate(Powers power) // diff contains the time in milliseconds since last regen.
void Player::Regenerate(Powers power, uint32 diff)
{ {
uint32 curValue = GetPower(power); uint32 curValue = GetPower(power);
uint32 maxValue = GetMaxPower(power); uint32 maxValue = GetMaxPower(power);
@ -1980,8 +1982,10 @@ void Player::Regenerate(Powers power)
case POWER_RUNE: case POWER_RUNE:
{ {
for(uint32 i = 0; i < MAX_RUNES; ++i) for(uint32 i = 0; i < MAX_RUNES; ++i)
if(uint8 cd = GetRuneCooldown(i)) // if we have cooldown, reduce it... {
SetRuneCooldown(i, cd - 1); // ... by 2 sec (because update is every 2 sec) if(uint16 cd = GetRuneCooldown(i)) // if we have cooldown, reduce it...
SetRuneCooldown(i, (cd < diff) ? 0 : cd - diff);
}
} break; } break;
case POWER_FOCUS: case POWER_FOCUS:
case POWER_HAPPINESS: case POWER_HAPPINESS:
@ -1999,6 +2003,9 @@ void Player::Regenerate(Powers power)
addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f; addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f;
} }
// addvalue computed on a 2sec basis. => update to diff time
addvalue *= float(diff) / REGEN_TIME_FULL;
if (power != POWER_RAGE && power != POWER_RUNIC_POWER) if (power != POWER_RAGE && power != POWER_RUNIC_POWER)
{ {
curValue += uint32(addvalue); curValue += uint32(addvalue);
@ -2015,7 +2022,7 @@ void Player::Regenerate(Powers power)
SetPower(power, curValue); SetPower(power, curValue);
} }
void Player::RegenerateHealth() void Player::RegenerateHealth(uint32 diff)
{ {
uint32 curValue = GetHealth(); uint32 curValue = GetHealth();
uint32 maxValue = GetMaxHealth(); uint32 maxValue = GetMaxHealth();
@ -2052,6 +2059,8 @@ void Player::RegenerateHealth()
if(addvalue < 0) if(addvalue < 0)
addvalue = 0; addvalue = 0;
addvalue *= (float)diff / REGEN_TIME_FULL;
ModifyHealth(int32(addvalue)); ModifyHealth(int32(addvalue));
} }
@ -2269,9 +2278,8 @@ bool Player::IsGroupVisibleFor(Player* p) const
bool Player::IsInSameGroupWith(Player const* p) const bool Player::IsInSameGroupWith(Player const* p) const
{ {
return p==this || GetGroup() != NULL && return (p==this || (GetGroup() != NULL &&
GetGroup() == p->GetGroup() && GetGroup()->SameSubGroup((Player*)this, (Player*)p)));
GetGroup()->SameSubGroup((Player*)this, (Player*)p);
} }
///- If the player is invited, remove him. If the group if then only 1 person, disband the group. ///- If the player is invited, remove him. If the group if then only 1 person, disband the group.
@ -3073,7 +3081,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL || if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL ||
// lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL // lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL
(pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 ) ((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0))
{ {
switch(GetSkillRangeType(pSkill,_spell_idx->second->racemask!=0)) switch(GetSkillRangeType(pSkill,_spell_idx->second->racemask!=0))
{ {
@ -3127,7 +3135,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
{ {
// note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell // note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
// talent dependent passives activated at form apply have proper stance data // talent dependent passives activated at form apply have proper stance data
bool need_cast = !spellInfo->Stances || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))); bool need_cast = (!spellInfo->Stances || (m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)))));
//Check CasterAuraStates //Check CasterAuraStates
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))); return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));
@ -3169,7 +3177,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
if (itr == m_spells.end()) if (itr == m_spells.end())
return; return;
if(itr->second->state == PLAYERSPELL_REMOVED || disabled && itr->second->disabled) if (itr->second->state == PLAYERSPELL_REMOVED || (disabled && itr->second->disabled))
return; return;
// unlearn non talent higher ranks (recursive) // unlearn non talent higher ranks (recursive)
@ -3279,7 +3287,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
if(_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL && if(_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL &&
pSkill->categoryId != SKILL_CATEGORY_CLASS ||// not unlearn class skills (spellbook/talent pages) pSkill->categoryId != SKILL_CATEGORY_CLASS ||// not unlearn class skills (spellbook/talent pages)
// lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL // lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL
(pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 ) ((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0))
{ {
// not reset skills for professions and racial abilities // not reset skills for professions and racial abilities
if ((pSkill->categoryId==SKILL_CATEGORY_SECONDARY || pSkill->categoryId==SKILL_CATEGORY_PROFESSION) && if ((pSkill->categoryId==SKILL_CATEGORY_SECONDARY || pSkill->categoryId==SKILL_CATEGORY_PROFESSION) &&
@ -4504,7 +4512,7 @@ void Player::RepopAtGraveyard()
AreaTableEntry const *zone = GetAreaEntryByAreaID(GetAreaId()); AreaTableEntry const *zone = GetAreaEntryByAreaID(GetAreaId());
// Such zones are considered unreachable as a ghost and the player must be automatically revived // Such zones are considered unreachable as a ghost and the player must be automatically revived
if(!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY || GetTransport()) if ((!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport())
{ {
ResurrectPlayer(0.5f); ResurrectPlayer(0.5f);
SpawnCorpseBones(); SpawnCorpseBones();
@ -6741,7 +6749,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
// If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage // If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage
if (ssv) if (ssv)
{ {
if (extraDPS = ssv->getDPSMod(proto->ScalingStatValue)) if ((extraDPS = ssv->getDPSMod(proto->ScalingStatValue)))
{ {
float average = extraDPS * proto->Delay / 1000.0f; float average = extraDPS * proto->Delay / 1000.0f;
minDamage = 0.7f * average; minDamage = 0.7f * average;
@ -8464,10 +8472,10 @@ Item* Player::GetItemByPos( uint16 pos ) const
Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const
{ {
if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) ) if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END )) )
return m_items[slot]; return m_items[slot];
else if(bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END else if ((bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)
|| bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END ) || (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END) )
{ {
Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ); Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag );
if ( pBag ) if ( pBag )
@ -11100,7 +11108,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
if(IsEquipmentPos ( src ) || IsBagPos ( src )) if(IsEquipmentPos ( src ) || IsBagPos ( src ))
{ {
// bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later) // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty()); uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || (pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty()));
if(msg != EQUIP_ERR_OK) if(msg != EQUIP_ERR_OK)
{ {
SendEquipError( msg, pSrcItem, pDstItem ); SendEquipError( msg, pSrcItem, pDstItem );
@ -11130,7 +11138,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
if(IsEquipmentPos ( dst ) || IsBagPos ( dst )) if(IsEquipmentPos ( dst ) || IsBagPos ( dst ))
{ {
// bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later) // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty()); uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || (pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty()));
if(msg != EQUIP_ERR_OK) if(msg != EQUIP_ERR_OK)
{ {
SendEquipError( msg, pSrcItem, pDstItem ); SendEquipError( msg, pSrcItem, pDstItem );
@ -11548,7 +11556,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly)
Item* item = *itr; Item* item = *itr;
++itr; // current element can be erased in UpdateDuration ++itr; // current element can be erased in UpdateDuration
if (realtimeonly && item->GetProto()->Duration < 0 || !realtimeonly) if ((realtimeonly && item->GetProto()->Duration < 0) || !realtimeonly)
item->UpdateDuration(this,time); item->UpdateDuration(this,time);
} }
} }
@ -14073,7 +14081,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// check name limitations // check name limitations
if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS || if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS ||
GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name)) (GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name)))
{ {
delete result; delete result;
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid); CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid);
@ -15726,8 +15734,6 @@ void Player::_SaveAuras()
// save previous spellEffectPair to db // save previous spellEffectPair to db
itr2--; itr2--;
SpellEntry const *spellInfo = itr2->second->GetSpellProto();
//skip all auras from spells that are passive //skip all auras from spells that are passive
//do not save single target auras (unless they were cast by the player) //do not save single target auras (unless they were cast by the player)
if (!itr2->second->IsPassive() && (itr2->second->GetCasterGUID() == GetGUID() || !itr2->second->IsSingleTarget())) if (!itr2->second->IsPassive() && (itr2->second->GetCasterGUID() == GetGUID() || !itr2->second->IsSingleTarget()))
@ -17007,7 +17013,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
uint32 mount_display_id = objmgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == NULL); uint32 mount_display_id = objmgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == NULL);
// in spell case allow 0 model // in spell case allow 0 model
if (mount_display_id == 0 && spellid == 0 || sourcepath == 0) if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0)
{ {
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(ERR_TAXIUNSPECIFIEDSERVERERROR); data << uint32(ERR_TAXIUNSPECIFIEDSERVERERROR);
@ -19178,8 +19184,8 @@ void Player::UpdateAreaDependentAuras( uint32 newArea )
uint32 Player::GetCorpseReclaimDelay(bool pvp) const uint32 Player::GetCorpseReclaimDelay(bool pvp) const
{ {
if( pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) || if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) ||
!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ) (!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ))
{ {
return copseReclaimDelay[0]; return copseReclaimDelay[0];
} }
@ -19194,8 +19200,8 @@ void Player::UpdateCorpseReclaimDelay()
{ {
bool pvp = m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH; bool pvp = m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH;
if( pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) || if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) ||
!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ) (!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ))
return; return;
time_t now = time(NULL); time_t now = time(NULL);
@ -19644,7 +19650,7 @@ void Player::ResyncRunes(uint8 count)
for(uint32 i = 0; i < count; ++i) for(uint32 i = 0; i < count; ++i)
{ {
data << uint8(GetCurrentRune(i)); // rune type data << uint8(GetCurrentRune(i)); // rune type
data << uint8(255 - (GetRuneCooldown(i) * 51)); // passed cooldown time (0-255) data << uint8(255 - ((GetRuneCooldown(i) / REGEN_TIME_FULL) * 51)); // passed cooldown time (0-255)
} }
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
} }

View file

@ -269,7 +269,7 @@ struct Areas
}; };
#define MAX_RUNES 6 #define MAX_RUNES 6
#define RUNE_COOLDOWN 5 // 5*2=10 sec #define RUNE_COOLDOWN 10000 // msec
enum RuneType enum RuneType
{ {
@ -284,7 +284,7 @@ struct RuneInfo
{ {
uint8 BaseRune; uint8 BaseRune;
uint8 CurrentRune; uint8 CurrentRune;
uint8 Cooldown; uint16 Cooldown; // msec
}; };
struct Runes struct Runes
@ -1415,9 +1415,9 @@ class MANGOS_DLL_SPEC Player : public Unit
void RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attacker ); void RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attacker );
void SendPetSkillWipeConfirm(); void SendPetSkillWipeConfirm();
void CalcRage( uint32 damage,bool attacker ); void CalcRage( uint32 damage,bool attacker );
void RegenerateAll(); void RegenerateAll(uint32 diff = REGEN_TIME_FULL);
void Regenerate(Powers power); void Regenerate(Powers power, uint32 diff);
void RegenerateHealth(); void RegenerateHealth(uint32 diff);
void setRegenTimer(uint32 time) {m_regenTimer = time;} void setRegenTimer(uint32 time) {m_regenTimer = time;}
void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;} void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;}
@ -2223,10 +2223,10 @@ class MANGOS_DLL_SPEC Player : public Unit
uint8 GetRunesState() const { return m_runes->runeState; } uint8 GetRunesState() const { return m_runes->runeState; }
uint8 GetBaseRune(uint8 index) const { return m_runes->runes[index].BaseRune; } uint8 GetBaseRune(uint8 index) const { return m_runes->runes[index].BaseRune; }
uint8 GetCurrentRune(uint8 index) const { return m_runes->runes[index].CurrentRune; } uint8 GetCurrentRune(uint8 index) const { return m_runes->runes[index].CurrentRune; }
uint8 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; } uint16 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; }
void SetBaseRune(uint8 index, uint8 baseRune) { m_runes->runes[index].BaseRune = baseRune; } void SetBaseRune(uint8 index, uint8 baseRune) { m_runes->runes[index].BaseRune = baseRune; }
void SetCurrentRune(uint8 index, uint8 currentRune) { m_runes->runes[index].CurrentRune = currentRune; } void SetCurrentRune(uint8 index, uint8 currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
void SetRuneCooldown(uint8 index, uint8 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); } void SetRuneCooldown(uint8 index, uint16 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); }
void ConvertRune(uint8 index, uint8 newType); void ConvertRune(uint8 index, uint8 newType);
void ResyncRunes(uint8 count); void ResyncRunes(uint8 count);
void AddRunePower(uint8 index); void AddRunePower(uint8 index);

View file

@ -100,7 +100,7 @@ uint32 PoolGroup<T>::RollOne(void)
template<class T> template<class T>
void PoolGroup<T>::DespawnObject(uint32 guid) void PoolGroup<T>::DespawnObject(uint32 guid)
{ {
for (int i=0; i<EqualChanced.size(); ++i) for (size_t i=0; i < EqualChanced.size(); ++i)
{ {
if (EqualChanced[i].spawned) if (EqualChanced[i].spawned)
{ {
@ -189,7 +189,7 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache)
else if (limit < EqualChanced.size() && Spawned < limit) else if (limit < EqualChanced.size() && Spawned < limit)
{ {
std::vector<uint32> IndexList; std::vector<uint32> IndexList;
for (int i=0; i<EqualChanced.size(); ++i) for (size_t i = 0; i < EqualChanced.size(); ++i)
if (!EqualChanced[i].spawned) if (!EqualChanced[i].spawned)
IndexList.push_back(i); IndexList.push_back(i);
@ -215,7 +215,7 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache)
} }
else // Not enough objects in pool, so spawn all else // Not enough objects in pool, so spawn all
{ {
for (int i=0; i<EqualChanced.size(); ++i) for (size_t i = 0; i < EqualChanced.size(); ++i)
EqualChanced[i].spawned = Spawn1Object(EqualChanced[i].guid); EqualChanced[i].spawned = Spawn1Object(EqualChanced[i].guid);
} }
} }

View file

@ -43,7 +43,7 @@ class PoolGroup
public: public:
PoolGroup(); PoolGroup();
~PoolGroup() {}; ~PoolGroup() {};
bool isEmpty() { return ExplicitlyChanced.size()==0 && EqualChanced.size()==0; } bool isEmpty() { return ExplicitlyChanced.empty() && EqualChanced.empty(); }
void AddEntry(PoolObject& poolitem, uint32 maxentries); void AddEntry(PoolObject& poolitem, uint32 maxentries);
bool CheckPool(void); bool CheckPool(void);
uint32 RollOne(void); uint32 RollOne(void);

View file

@ -199,7 +199,7 @@ void SocialMgr::GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &fri
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all // MODERATOR, GAME MASTER, ADMINISTRATOR can see all
if (pFriend && pFriend->GetName() && if (pFriend && pFriend->GetName() &&
(security > SEC_PLAYER || (security > SEC_PLAYER ||
(pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList)) && ((pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList))) &&
pFriend->IsVisibleGloballyFor(player)) pFriend->IsVisibleGloballyFor(player))
{ {
friendInfo.Status = FRIEND_STATUS_ONLINE; friendInfo.Status = FRIEND_STATUS_ONLINE;
@ -285,7 +285,7 @@ void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet)
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all // MODERATOR, GAME MASTER, ADMINISTRATOR can see all
if (pFriend && pFriend->IsInWorld() && if (pFriend && pFriend->IsInWorld() &&
(pFriend->GetSession()->GetSecurity() > SEC_PLAYER || (pFriend->GetSession()->GetSecurity() > SEC_PLAYER ||
(pFriend->GetTeam() == team || allowTwoSideWhoList) && security <= gmLevelInWhoList) && ((pFriend->GetTeam() == team || allowTwoSideWhoList) && security <= gmLevelInWhoList)) &&
player->IsVisibleGloballyFor(pFriend)) player->IsVisibleGloballyFor(pFriend))
{ {
pFriend->GetSession()->SendPacket(packet); pFriend->GetSession()->SendPacket(packet);

View file

@ -519,6 +519,38 @@ void Spell::FillTargetMap()
switch(m_spellInfo->EffectImplicitTargetB[i]) switch(m_spellInfo->EffectImplicitTargetB[i])
{ {
case 0: case 0:
SetTargetMap(i, TARGET_EFFECT_SELECT, tmpUnitMap);
break;
default:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
break;
}
break;
case TARGET_EFFECT_SELECT:
switch(m_spellInfo->EffectImplicitTargetB[i])
{
case 0:
case TARGET_EFFECT_SELECT:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
break;
case TARGET_INNKEEPER_COORDINATES:
case TARGET_TABLE_X_Y_Z_COORDINATES:
case TARGET_CASTER_COORDINATES:
case TARGET_SCRIPT_COORDINATES:
case TARGET_CURRENT_ENEMY_COORDINATES:
case TARGET_DUELVSPLAYER_COORDINATES:
case TARGET_DYNAMIC_OBJECT_COORDINATES:
case TARGET_POINT_AT_NORTH:
case TARGET_POINT_AT_SOUTH:
case TARGET_POINT_AT_EAST:
case TARGET_POINT_AT_WEST:
case TARGET_POINT_AT_NE:
case TARGET_POINT_AT_NW:
case TARGET_POINT_AT_SE:
case TARGET_POINT_AT_SW:
// need some target for proccesing
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
break; break;
default: default:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
@ -529,6 +561,7 @@ void Spell::FillTargetMap()
switch(m_spellInfo->EffectImplicitTargetB[i]) switch(m_spellInfo->EffectImplicitTargetB[i])
{ {
case 0: case 0:
case TARGET_EFFECT_SELECT:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
break; break;
case TARGET_AREAEFFECT_INSTANT: // use B case that not dependent from from A in fact case TARGET_AREAEFFECT_INSTANT: // use B case that not dependent from from A in fact
@ -546,10 +579,13 @@ void Spell::FillTargetMap()
} }
break; break;
case TARGET_CASTER_COORDINATES: case TARGET_CASTER_COORDINATES:
switch(m_spellInfo->EffectImplicitTargetB[i])
{
case TARGET_ALL_ENEMY_IN_AREA:
// Note: this hack with search required until GO casting not implemented // Note: this hack with search required until GO casting not implemented
// environment damage spells already have around enemies targeting but this not help in case not existed GO casting support // environment damage spells already have around enemies targeting but this not help in case not existed GO casting support
// currently each enemy selected explicitly and self cast damage // currently each enemy selected explicitly and self cast damage
if(m_spellInfo->EffectImplicitTargetB[i] == TARGET_ALL_ENEMY_IN_AREA && m_spellInfo->Effect[i] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) if (m_spellInfo->Effect[i] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE)
{ {
if(m_targets.getUnitTarget()) if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget()); tmpUnitMap.push_back(m_targets.getUnitTarget());
@ -560,6 +596,14 @@ void Spell::FillTargetMap()
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
} }
break; break;
default:
{
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
}
break;
}
break;
case TARGET_TABLE_X_Y_Z_COORDINATES: case TARGET_TABLE_X_Y_Z_COORDINATES:
switch(m_spellInfo->EffectImplicitTargetB[i]) switch(m_spellInfo->EffectImplicitTargetB[i])
{ {
@ -567,10 +611,7 @@ void Spell::FillTargetMap()
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
// need some target for proccesing // need some target for proccesing
if(m_targets.getUnitTarget()) SetTargetMap(i, TARGET_EFFECT_SELECT, tmpUnitMap);
tmpUnitMap.push_back(m_targets.getUnitTarget());
else
tmpUnitMap.push_back(m_caster);
break; break;
case TARGET_AREAEFFECT_INSTANT: // All 17/7 pairs used for dest teleportation, A processed in effect code case TARGET_AREAEFFECT_INSTANT: // All 17/7 pairs used for dest teleportation, A processed in effect code
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
@ -585,6 +626,7 @@ void Spell::FillTargetMap()
switch(m_spellInfo->EffectImplicitTargetB[i]) switch(m_spellInfo->EffectImplicitTargetB[i])
{ {
case 0: case 0:
case TARGET_EFFECT_SELECT:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
break; break;
case TARGET_SCRIPT_COORDINATES: // B case filled in CheckCast but we need fill unit list base at A case case TARGET_SCRIPT_COORDINATES: // B case filled in CheckCast but we need fill unit list base at A case
@ -598,165 +640,6 @@ void Spell::FillTargetMap()
break; break;
} }
if( (m_spellInfo->EffectImplicitTargetA[i] == 0 || m_spellInfo->EffectImplicitTargetA[i] == TARGET_EFFECT_SELECT) &&
(m_spellInfo->EffectImplicitTargetB[i] == 0 || m_spellInfo->EffectImplicitTargetB[i] == TARGET_EFFECT_SELECT) )
{
// add here custom effects that need default target.
// FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!!
switch(m_spellInfo->Effect[i])
{
case SPELL_EFFECT_DUMMY:
{
switch(m_spellInfo->Id)
{
case 20577: // Cannibalize
{
WorldObject* result = FindCorpseUsing<MaNGOS::CannibalizeObjectCheck> ();
if(result)
{
switch(result->GetTypeId())
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
tmpUnitMap.push_back((Unit*)result);
break;
case TYPEID_CORPSE:
m_targets.setCorpseTarget((Corpse*)result);
if(Player* owner = ObjectAccessor::FindPlayer(((Corpse*)result)->GetOwnerGUID()))
tmpUnitMap.push_back(owner);
break;
}
}
else
{
// clear cooldown at fail
if(m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id, true);
SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES);
finish(false);
}
break;
}
default:
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
}
case SPELL_EFFECT_RESURRECT:
case SPELL_EFFECT_PARRY:
case SPELL_EFFECT_BLOCK:
case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_TRIGGER_SPELL:
case SPELL_EFFECT_TRIGGER_MISSILE:
case SPELL_EFFECT_LEARN_SPELL:
case SPELL_EFFECT_SKILL_STEP:
case SPELL_EFFECT_PROFICIENCY:
case SPELL_EFFECT_SUMMON_OBJECT_WILD:
case SPELL_EFFECT_SELF_RESURRECT:
case SPELL_EFFECT_REPUTATION:
case SPELL_EFFECT_SEND_TAXI:
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
// Triggered spells have additional spell targets - cast them even if no explicit unit target is given (required for spell 50516 for example)
else if(m_spellInfo->Effect[i] == SPELL_EFFECT_TRIGGER_SPELL)
tmpUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
if(m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
{
Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection());
if(target)
tmpUnitMap.push_back(target);
}
break;
case SPELL_EFFECT_RESURRECT_NEW:
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
if(m_targets.getCorpseTargetGUID())
{
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID());
if(corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
if(owner)
tmpUnitMap.push_back(owner);
}
}
break;
case SPELL_EFFECT_SUMMON:
if(m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED || m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2)
{
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
}
else
tmpUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_CHANGE_ITEM:
case SPELL_EFFECT_TRANS_DOOR:
case SPELL_EFFECT_ADD_FARSIGHT:
case SPELL_EFFECT_APPLY_GLYPH:
case SPELL_EFFECT_STUCK:
case SPELL_EFFECT_FEED_PET:
case SPELL_EFFECT_DESTROY_ALL_TOTEMS:
case SPELL_EFFECT_SKILL:
tmpUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_LEARN_PET_SPELL:
if(Pet* pet = m_caster->GetPet())
tmpUnitMap.push_back(pet);
break;
case SPELL_EFFECT_ENCHANT_ITEM:
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
case SPELL_EFFECT_DISENCHANT:
case SPELL_EFFECT_PROSPECTING:
case SPELL_EFFECT_MILLING:
if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i);
break;
case SPELL_EFFECT_APPLY_AURA:
switch(m_spellInfo->EffectApplyAuraName[i])
{
case SPELL_AURA_ADD_FLAT_MODIFIER: // some spell mods auras have 0 target modes instead expected TARGET_SELF(1) (and present for other ranks for same spell for example)
case SPELL_AURA_ADD_PCT_MODIFIER:
tmpUnitMap.push_back(m_caster);
break;
default: // apply to target in other case
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
// AreaAura
if(m_spellInfo->Attributes == 0x9050000 || m_spellInfo->Attributes == 0x10000)
SetTargetMap(i,TARGET_AREAEFFECT_PARTY, tmpUnitMap);
break;
case SPELL_EFFECT_SKIN_PLAYER_CORPSE:
if(m_targets.getUnitTarget())
{
tmpUnitMap.push_back(m_targets.getUnitTarget());
}
else if (m_targets.getCorpseTargetGUID())
{
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID());
if(corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
if(owner)
tmpUnitMap.push_back(owner);
}
}
break;
default:
break;
}
}
if(m_caster->GetTypeId() == TYPEID_PLAYER) if(m_caster->GetTypeId() == TYPEID_PLAYER)
{ {
Player *me = (Player*)m_caster; Player *me = (Player*)m_caster;
@ -1405,11 +1288,11 @@ struct TargetDistanceOrder : public std::binary_function<const Unit, const Unit,
} }
}; };
void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
{ {
float radius; float radius;
if (m_spellInfo->EffectRadiusIndex[i]) if (m_spellInfo->EffectRadiusIndex[effIndex])
radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
else else
radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex));
@ -1417,7 +1300,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
if(Player* modOwner = m_originalCaster->GetSpellModOwner()) if(Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this); modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this);
uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i]; uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[effIndex];
if(m_originalCaster) if(m_originalCaster)
if(Player* modOwner = m_originalCaster->GetSpellModOwner()) if(Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, EffectChainTarget, this); modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, EffectChainTarget, this);
@ -1445,7 +1328,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
unMaxTargets+=(*m)->GetModifier()->m_amount; unMaxTargets+=(*m)->GetModifier()->m_amount;
} }
switch(cur) switch(targetMode)
{ {
case TARGET_TOTEM_EARTH: case TARGET_TOTEM_EARTH:
case TARGET_TOTEM_WATER: case TARGET_TOTEM_WATER:
@ -1688,7 +1571,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
{ {
SpellTargets targetB = SPELL_TARGETS_AOE_DAMAGE; SpellTargets targetB = SPELL_TARGETS_AOE_DAMAGE;
// Select friendly targets for positive effect // Select friendly targets for positive effect
if (IsPositiveEffect(m_spellInfo->Id, i)) if (IsPositiveEffect(m_spellInfo->Id, effIndex))
targetB = SPELL_TARGETS_FRIENDLY; targetB = SPELL_TARGETS_FRIENDLY;
FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(),radius, PUSH_DEST_CENTER, targetB); FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(),radius, PUSH_DEST_CENTER, targetB);
@ -1700,7 +1583,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
case TARGET_ALL_ENEMY_IN_AREA_INSTANT: case TARGET_ALL_ENEMY_IN_AREA_INSTANT:
{ {
// targets the ground, not the units in the area // targets the ground, not the units in the area
switch(m_spellInfo->Effect[i]) switch(m_spellInfo->Effect[effIndex])
{ {
case SPELL_EFFECT_PERSISTENT_AREA_AURA: case SPELL_EFFECT_PERSISTENT_AREA_AURA:
break; break;
@ -1842,7 +1725,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
} }
case TARGET_GAMEOBJECT: case TARGET_GAMEOBJECT:
if(m_targets.getGOTarget()) if(m_targets.getGOTarget())
AddGOTarget(m_targets.getGOTarget(), i); AddGOTarget(m_targets.getGOTarget(), effIndex);
break; break;
case TARGET_IN_FRONT_OF_CASTER: case TARGET_IN_FRONT_OF_CASTER:
{ {
@ -1875,9 +1758,9 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
} }
case TARGET_GAMEOBJECT_ITEM: case TARGET_GAMEOBJECT_ITEM:
if(m_targets.getGOTargetGUID()) if(m_targets.getGOTargetGUID())
AddGOTarget(m_targets.getGOTarget(), i); AddGOTarget(m_targets.getGOTarget(), effIndex);
else if(m_targets.getItemTarget()) else if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i); AddItemTarget(m_targets.getItemTarget(), effIndex);
break; break;
case TARGET_MASTER: case TARGET_MASTER:
if(Unit* owner = m_caster->GetCharmerOrOwner()) if(Unit* owner = m_caster->GetCharmerOrOwner())
@ -1885,11 +1768,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
break; break;
case TARGET_ALL_ENEMY_IN_AREA_CHANNELED: case TARGET_ALL_ENEMY_IN_AREA_CHANNELED:
// targets the ground, not the units in the area // targets the ground, not the units in the area
if (m_spellInfo->Effect[i]!=SPELL_EFFECT_PERSISTENT_AREA_AURA) if (m_spellInfo->Effect[effIndex]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)
FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE); FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE);
break; break;
case TARGET_MINION: case TARGET_MINION:
if(m_spellInfo->Effect[i] != SPELL_EFFECT_DUEL) if(m_spellInfo->Effect[effIndex] != SPELL_EFFECT_DUEL)
TagUnitMap.push_back(m_caster); TagUnitMap.push_back(m_caster);
break; break;
case TARGET_SINGLE_ENEMY: case TARGET_SINGLE_ENEMY:
@ -1972,7 +1855,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
if(m_targets.getUnitTarget()) if(m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget()); TagUnitMap.push_back(m_targets.getUnitTarget());
if(m_targets.getItemTarget()) if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i); AddItemTarget(m_targets.getItemTarget(), effIndex);
break; break;
} }
case TARGET_SELF_FISHING: case TARGET_SELF_FISHING:
@ -2046,7 +1929,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
{ {
TagUnitMap.push_back(currentTarget); TagUnitMap.push_back(currentTarget);
m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ()); m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ());
if(m_spellInfo->EffectImplicitTargetB[i]==TARGET_ALL_ENEMY_IN_AREA_INSTANT) if(m_spellInfo->EffectImplicitTargetB[effIndex]==TARGET_ALL_ENEMY_IN_AREA_INSTANT)
FillAreaTargets(TagUnitMap, currentTarget->GetPositionX(), currentTarget->GetPositionY(), radius, PUSH_TARGET_CENTER, SPELL_TARGETS_AOE_DAMAGE); FillAreaTargets(TagUnitMap, currentTarget->GetPositionX(), currentTarget->GetPositionY(), radius, PUSH_TARGET_CENTER, SPELL_TARGETS_AOE_DAMAGE);
} }
break; break;
@ -2135,7 +2018,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
Unit* currentTarget = m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster; Unit* currentTarget = m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster;
float angle = currentTarget != m_caster ? currentTarget->GetAngle(m_caster) : m_caster->GetOrientation(); float angle = currentTarget != m_caster ? currentTarget->GetAngle(m_caster) : m_caster->GetOrientation();
switch(cur) switch(targetMode)
{ {
case TARGET_POINT_AT_NORTH: break; case TARGET_POINT_AT_NORTH: break;
case TARGET_POINT_AT_SOUTH: angle += M_PI; break; case TARGET_POINT_AT_SOUTH: angle += M_PI; break;
@ -2170,6 +2053,159 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
TagUnitMap.push_back(m_caster); TagUnitMap.push_back(m_caster);
break; break;
} }
case TARGET_EFFECT_SELECT:
{
// add here custom effects that need default target.
// FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!!
switch(m_spellInfo->Effect[effIndex])
{
case SPELL_EFFECT_DUMMY:
{
switch(m_spellInfo->Id)
{
case 20577: // Cannibalize
{
WorldObject* result = FindCorpseUsing<MaNGOS::CannibalizeObjectCheck> ();
if(result)
{
switch(result->GetTypeId())
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
TagUnitMap.push_back((Unit*)result);
break;
case TYPEID_CORPSE:
m_targets.setCorpseTarget((Corpse*)result);
if (Player* owner = ObjectAccessor::FindPlayer(((Corpse*)result)->GetOwnerGUID()))
TagUnitMap.push_back(owner);
break;
}
}
else
{
// clear cooldown at fail
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id, true);
SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES);
finish(false);
}
break;
}
default:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
}
case SPELL_EFFECT_RESURRECT:
case SPELL_EFFECT_PARRY:
case SPELL_EFFECT_BLOCK:
case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_TRIGGER_SPELL:
case SPELL_EFFECT_TRIGGER_MISSILE:
case SPELL_EFFECT_LEARN_SPELL:
case SPELL_EFFECT_SKILL_STEP:
case SPELL_EFFECT_PROFICIENCY:
case SPELL_EFFECT_SUMMON_OBJECT_WILD:
case SPELL_EFFECT_SELF_RESURRECT:
case SPELL_EFFECT_REPUTATION:
case SPELL_EFFECT_SEND_TAXI:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
// Triggered spells have additional spell targets - cast them even if no explicit unit target is given (required for spell 50516 for example)
else if (m_spellInfo->Effect[effIndex] == SPELL_EFFECT_TRIGGER_SPELL)
TagUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
if (m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
{
Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection());
if(target)
TagUnitMap.push_back(target);
}
break;
case SPELL_EFFECT_RESURRECT_NEW:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
if (m_targets.getCorpseTargetGUID())
{
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID());
if(corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
if(owner)
TagUnitMap.push_back(owner);
}
}
break;
case SPELL_EFFECT_SUMMON:
if (m_spellInfo->EffectMiscValueB[effIndex] == SUMMON_TYPE_POSESSED ||
m_spellInfo->EffectMiscValueB[effIndex] == SUMMON_TYPE_POSESSED2)
{
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
}
else
TagUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_CHANGE_ITEM:
case SPELL_EFFECT_TRANS_DOOR:
case SPELL_EFFECT_ADD_FARSIGHT:
case SPELL_EFFECT_APPLY_GLYPH:
case SPELL_EFFECT_STUCK:
case SPELL_EFFECT_FEED_PET:
case SPELL_EFFECT_DESTROY_ALL_TOTEMS:
case SPELL_EFFECT_SKILL:
TagUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_LEARN_PET_SPELL:
if (Pet* pet = m_caster->GetPet())
TagUnitMap.push_back(pet);
break;
case SPELL_EFFECT_ENCHANT_ITEM:
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
case SPELL_EFFECT_DISENCHANT:
case SPELL_EFFECT_PROSPECTING:
case SPELL_EFFECT_MILLING:
if (m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), effIndex);
break;
case SPELL_EFFECT_APPLY_AURA:
switch(m_spellInfo->EffectApplyAuraName[effIndex])
{
case SPELL_AURA_ADD_FLAT_MODIFIER: // some spell mods auras have 0 target modes instead expected TARGET_SELF(1) (and present for other ranks for same spell for example)
case SPELL_AURA_ADD_PCT_MODIFIER:
TagUnitMap.push_back(m_caster);
break;
default: // apply to target in other case
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
// AreaAura
if(m_spellInfo->Attributes == 0x9050000 || m_spellInfo->Attributes == 0x10000)
SetTargetMap(effIndex,TARGET_AREAEFFECT_PARTY, TagUnitMap);
break;
case SPELL_EFFECT_SKIN_PLAYER_CORPSE:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
else if (m_targets.getCorpseTargetGUID())
{
if (Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID()))
if (Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID()))
TagUnitMap.push_back(owner);
}
break;
default:
break;
}
break;
}
default: default:
break; break;
} }
@ -3498,7 +3534,7 @@ void Spell::TakePower()
// Set the five second timer // Set the five second timer
if (powerType == POWER_MANA && m_powerCost > 0) if (powerType == POWER_MANA && m_powerCost > 0)
m_caster->SetLastManaUse(getMSTime()); m_caster->SetLastManaUse();
} }
SpellCastResult Spell::CheckRuneCost(uint32 runeCostID) SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
@ -4846,6 +4882,7 @@ SpellCastResult Spell::CheckCasterAuras() const
else if ( m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) else if ( m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
return SPELL_FAILED_SILENCED; return SPELL_FAILED_SILENCED;
break; break;
default: break;
} }
} }
} }
@ -5018,6 +5055,15 @@ SpellCastResult Spell::CheckPower()
if(m_CastItem) if(m_CastItem)
return SPELL_CAST_OK; return SPELL_CAST_OK;
// Do precise power regen on spell cast
if (m_powerCost > 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
{
Player* playerCaster = (Player*)m_caster;
uint32 diff = REGEN_TIME_FULL - m_caster->GetRegenTimer();
if (diff >= REGEN_TIME_PRECISE)
playerCaster->RegenerateAll(diff);
}
// health as power used - need check health amount // health as power used - need check health amount
if(m_spellInfo->powerType == POWER_HEALTH) if(m_spellInfo->powerType == POWER_HEALTH)
{ {

View file

@ -319,6 +319,7 @@ class Spell
void EffectEnergisePct(uint32 i); void EffectEnergisePct(uint32 i);
void EffectTriggerSpellWithValue(uint32 i); void EffectTriggerSpellWithValue(uint32 i);
void EffectTriggerRitualOfSummoning(uint32 i); void EffectTriggerRitualOfSummoning(uint32 i);
void EffectKillCreditPersonal(uint32 i);
void EffectKillCredit(uint32 i); void EffectKillCredit(uint32 i);
void EffectQuestFail(uint32 i); void EffectQuestFail(uint32 i);
void EffectActivateRune(uint32 i); void EffectActivateRune(uint32 i);
@ -370,7 +371,7 @@ class Spell
typedef std::list<Unit*> UnitList; typedef std::list<Unit*> UnitList;
void FillTargetMap(); void FillTargetMap();
void SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap); void SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap);
void FillAreaTargets( UnitList& TagUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets ); void FillAreaTargets( UnitList& TagUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets );
void FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster ); void FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster );

View file

@ -1337,8 +1337,6 @@ void Aura::HandleAddModifier(bool apply, bool Real)
m_spellmod = mod; m_spellmod = mod;
} }
uint64 spellFamilyMask = m_spellmod->mask;
((Player*)m_target)->AddSpellMod(m_spellmod, apply); ((Player*)m_target)->AddSpellMod(m_spellmod, apply);
// reapply talents to own passive persistent auras // reapply talents to own passive persistent auras

View file

@ -147,7 +147,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectUnused, // 87 SPELL_EFFECT_WMO_DAMAGE &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, // 89 SPELL_EFFECT_WMO_CHANGE
&Spell::EffectUnused, // 90 SPELL_EFFECT_KILL_CREDIT &Spell::EffectKillCreditPersonal, // 90 SPELL_EFFECT_KILL_CREDIT Kill credit but only for single person
&Spell::EffectUnused, // 91 SPELL_EFFECT_THREAT_ALL one spell: zzOLDBrainwash &Spell::EffectUnused, // 91 SPELL_EFFECT_THREAT_ALL one spell: zzOLDBrainwash
&Spell::EffectEnchantHeldItem, // 92 SPELL_EFFECT_ENCHANT_HELD_ITEM &Spell::EffectEnchantHeldItem, // 92 SPELL_EFFECT_ENCHANT_HELD_ITEM
&Spell::EffectUnused, // 93 SPELL_EFFECT_SUMMON_PHANTASM &Spell::EffectUnused, // 93 SPELL_EFFECT_SUMMON_PHANTASM
@ -6777,6 +6777,14 @@ void Spell::EffectStealBeneficialBuff(uint32 i)
} }
} }
void Spell::EffectKillCreditPersonal(uint32 i)
{
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
((Player*)unitTarget)->KilledMonsterCredit(m_spellInfo->EffectMiscValue[i], 0);
}
void Spell::EffectKillCredit(uint32 i) void Spell::EffectKillCredit(uint32 i)
{ {
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)

View file

@ -2989,7 +2989,8 @@ void SpellMgr::CheckUsedSpells(char const* table)
{ {
if(spellEntry->SpellFamilyFlags != 0 || spellEntry->SpellFamilyFlags2 != 0) if(spellEntry->SpellFamilyFlags != 0 || spellEntry->SpellFamilyFlags2 != 0)
{ {
sLog.outError("Spell %u '%s' not fit to (" I64FMT "," I32FMT ") but used in %s.",spell,name.c_str(),familyMaskA,familyMaskB,code.c_str()); sLog.outError("Spell %u '%s' not fit to (" I64FMT "," I32FMT ") but used in %s.",
spell, name.c_str(), familyMaskA, familyMaskB, code.c_str());
continue; continue;
} }

View file

@ -167,16 +167,16 @@ inline bool IsElementalShield(SpellEntry const *spellInfo)
inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo) inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo)
{ {
return spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM return ((spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM
&& spellInfo->Effect[1] == SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effect[1] == SPELL_EFFECT_SCRIPT_EFFECT)
|| spellInfo->Id == 64323; // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data) || spellInfo->Id == 64323); // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data)
} }
inline bool IsLootCraftingSpell(SpellEntry const *spellInfo) inline bool IsLootCraftingSpell(SpellEntry const *spellInfo)
{ {
return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_RANDOM_ITEM || return (spellInfo->Effect[0]==SPELL_EFFECT_CREATE_RANDOM_ITEM ||
// different random cards from Inscription (121==Virtuoso Inking Set category) // different random cards from Inscription (121==Virtuoso Inking Set category)
spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] == 121; (spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] == 121));
} }
int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2); int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2);

View file

@ -309,6 +309,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged )
} }
break; break;
} }
default: break;
} }
switch(m_form) switch(m_form)
@ -909,7 +910,7 @@ void Pet::UpdateResistances(uint32 school)
Unit *owner = GetOwner(); Unit *owner = GetOwner();
// hunter and warlock pets gain 40% of owner's resistance // hunter and warlock pets gain 40% of owner's resistance
if(owner && (getPetType() == HUNTER_PET || getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)) if(owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)))
value += float(owner->GetResistance(SpellSchools(school))) * 0.4f; value += float(owner->GetResistance(SpellSchools(school))) * 0.4f;
SetResistance(SpellSchools(school), int32(value)); SetResistance(SpellSchools(school), int32(value));
@ -926,7 +927,7 @@ void Pet::UpdateArmor()
Unit *owner = GetOwner(); Unit *owner = GetOwner();
// hunter and warlock pets gain 35% of owner's armor value // hunter and warlock pets gain 35% of owner's armor value
if(owner && (getPetType() == HUNTER_PET || getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)) if(owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)))
bonus_armor = 0.35f * float(owner->GetArmor()); bonus_armor = 0.35f * float(owner->GetArmor());
value = GetModifierValue(unitMod, BASE_VALUE); value = GetModifierValue(unitMod, BASE_VALUE);

View file

@ -592,7 +592,7 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket)
// check cheating, can't fail with correct client operations // check cheating, can't fail with correct client operations
Item* item = _player->GetItemByPos(bag,slot); Item* item = _player->GetItemByPos(bag,slot);
if(!item || tradeSlot!=TRADE_SLOT_NONTRADED && !item->CanBeTraded()) if (!item || (tradeSlot != TRADE_SLOT_NONTRADED && !item->CanBeTraded()))
{ {
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
return; return;

View file

@ -140,7 +140,7 @@ Unit::Unit()
m_baseSpellCritChance = 5; m_baseSpellCritChance = 5;
m_CombatTimer = 0; m_CombatTimer = 0;
m_lastManaUse = 0; m_lastManaUseTimer = 0;
//m_victimThreat = 0.0f; //m_victimThreat = 0.0f;
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
@ -192,6 +192,14 @@ void Unit::Update( uint32 p_time )
m_Events.Update( p_time ); m_Events.Update( p_time );
_UpdateSpells( p_time ); _UpdateSpells( p_time );
if (m_lastManaUseTimer)
{
if (p_time >= m_lastManaUseTimer)
m_lastManaUseTimer = 0;
else
m_lastManaUseTimer -= p_time;
}
// really delete auras "deleted" while processing its ApplyModify code // really delete auras "deleted" while processing its ApplyModify code
for(AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.begin(); ++itr) for(AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.begin(); ++itr)
delete *itr; delete *itr;
@ -6500,7 +6508,6 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
{ {
if ((*i)->GetModifier()->m_miscvalue == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellProto()->SpellIconID == 113) if ((*i)->GetModifier()->m_miscvalue == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellProto()->SpellIconID == 113)
{ {
int32 value2 = CalculateSpellDamage((*i)->GetSpellProto(),2,(*i)->GetSpellProto()->EffectBasePoints[2],this);
// Drain Soul // Drain Soul
CastCustomSpell(this, 18371, &basepoints[0], NULL, NULL, true, castItem, triggeredByAura); CastCustomSpell(this, 18371, &basepoints[0], NULL, NULL, true, castItem, triggeredByAura);
break; break;
@ -11804,11 +11811,6 @@ Aura* Unit::GetDummyAura( uint32 spell_id ) const
return NULL; return NULL;
} }
bool Unit::IsUnderLastManaUseEffect() const
{
return getMSTimeDiff(m_lastManaUse,getMSTime()) < 5000;
}
void Unit::SetContestedPvP(Player *attackedPlayer) void Unit::SetContestedPvP(Player *attackedPlayer)
{ {
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself(); Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();

View file

@ -692,9 +692,9 @@ struct SpellPeriodicAuraLogInfo
Aura *aura; Aura *aura;
uint32 damage; uint32 damage;
uint32 overDamage; // overkill/overheal
uint32 absorb; uint32 absorb;
uint32 resist; uint32 resist;
uint32 overDamage; // overkill/overheal
float multiplier; float multiplier;
bool critical; bool critical;
}; };
@ -856,6 +856,10 @@ typedef std::set<uint64> GuardianPetList;
#define ATTACK_DISPLAY_DELAY 200 #define ATTACK_DISPLAY_DELAY 200
#define MAX_PLAYER_STEALTH_DETECT_RANGE 45.0f // max distance for detection targets by player #define MAX_PLAYER_STEALTH_DETECT_RANGE 45.0f // max distance for detection targets by player
// Regeneration defines
#define REGEN_TIME_FULL 2000 // For this time difference is computed regen value
#define REGEN_TIME_PRECISE 500 // Used in Spell::CheckPower for precise regeneration in spell cast time
struct SpellProcEventEntry; // used only privately struct SpellProcEventEntry; // used only privately
class MANGOS_DLL_SPEC Unit : public WorldObject class MANGOS_DLL_SPEC Unit : public WorldObject
@ -1423,8 +1427,16 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
uint32 SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); uint32 SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; } void SetLastManaUse()
bool IsUnderLastManaUseEffect() const; {
if (GetTypeId() == TYPEID_PLAYER && !IsUnderLastManaUseEffect())
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
m_lastManaUseTimer = 5000;
}
bool IsUnderLastManaUseEffect() const { return m_lastManaUseTimer; }
uint32 GetRegenTimer() const { return m_regenTimer; }
void SetContestedPvP(Player *attackedPlayer = NULL); void SetContestedPvP(Player *attackedPlayer = NULL);
@ -1546,6 +1558,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
uint32 m_reactiveTimer[MAX_REACTIVE]; uint32 m_reactiveTimer[MAX_REACTIVE];
uint32 m_regenTimer; uint32 m_regenTimer;
uint32 m_lastManaUseTimer;
private: private:
bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent ); bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent );
@ -1558,7 +1571,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
uint32 m_state; // Even derived shouldn't modify uint32 m_state; // Even derived shouldn't modify
uint32 m_CombatTimer; uint32 m_CombatTimer;
uint32 m_lastManaUse; // msecs
Spell* m_currentSpells[CURRENT_MAX_SPELL]; Spell* m_currentSpells[CURRENT_MAX_SPELL];

View file

@ -312,7 +312,7 @@ void WaypointManager::CheckTextsExistance(std::set<int32>& ids)
WaypointPathMap::const_iterator pmItr = m_pathMap.begin(); WaypointPathMap::const_iterator pmItr = m_pathMap.begin();
for ( ; pmItr != m_pathMap.end(); ++pmItr) for ( ; pmItr != m_pathMap.end(); ++pmItr)
{ {
for (int i = 0; i < pmItr->second.size(); ++i) for (size_t i = 0; i < pmItr->second.size(); ++i)
{ {
WaypointBehavior* be = pmItr->second[i].behavior; WaypointBehavior* be = pmItr->second[i].behavior;
if (!be) if (!be)

View file

@ -310,7 +310,7 @@ void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
return; return;
uint32 map0 = i_mapIds[0]; uint32 map0 = i_mapIds[0];
for(int i = 1; i < i_mapIds.size(); ++i) for (size_t i = 1; i < i_mapIds.size(); ++i)
{ {
if(i_mapIds[i]!=map0) if(i_mapIds[i]!=map0)
{ {

View file

@ -28,8 +28,6 @@
INSTANTIATE_SINGLETON_2(WorldLog, CLASS_LOCK); INSTANTIATE_SINGLETON_2(WorldLog, CLASS_LOCK);
INSTANTIATE_CLASS_MUTEX(WorldLog, ACE_Thread_Mutex); INSTANTIATE_CLASS_MUTEX(WorldLog, ACE_Thread_Mutex);
#define WORLD_LOG_FILE_STRING "world.log"
/// Open the log file (if specified so in the configuration file) /// Open the log file (if specified so in the configuration file)
void WorldLog::Initialize() void WorldLog::Initialize()
{ {

View file

@ -597,14 +597,14 @@ void WorldSession::LoadAccountData(QueryResult* result, uint32 mask)
if (type >= NUM_ACCOUNT_DATA_TYPES) if (type >= NUM_ACCOUNT_DATA_TYPES)
{ {
sLog.outError("Table `%s` have invalid account data type (%u), ignore.", sLog.outError("Table `%s` have invalid account data type (%u), ignore.",
mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data"); mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
continue; continue;
} }
if ((mask & (1 << type))==0) if ((mask & (1 << type))==0)
{ {
sLog.outError("Table `%s` have non appropriate for table account data type (%u), ignore.", sLog.outError("Table `%s` have non appropriate for table account data type (%u), ignore.",
mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data"); mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
continue; continue;
} }

View file

@ -293,10 +293,6 @@ int Master::Run()
uint32 socketSelecttime = sWorld.getConfig(CONFIG_SOCKET_SELECTTIME); uint32 socketSelecttime = sWorld.getConfig(CONFIG_SOCKET_SELECTTIME);
// maximum counter for next ping
uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / socketSelecttime));
uint32 loopCounter = 0;
///- Start up freeze catcher thread ///- Start up freeze catcher thread
if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0)) if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0))
{ {

View file

@ -217,7 +217,7 @@ bool Database::CheckRequiredField( char const* table_name, char const* required_
} }
} }
delete result; delete result2;
if(!reqName.empty()) if(!reqName.empty())
sLog.outErrorDb("Table `%s` have field `%s` but expected `%s`! Not all sql updates applied?",table_name,reqName.c_str(),required_name); sLog.outErrorDb("Table `%s` have field `%s` but expected `%s`! Not all sql updates applied?",table_name,reqName.c_str(),required_name);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8467" #define REVISION_NR "8482"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_8433_01_characters_character_account_data" #define REVISION_DB_CHARACTERS "required_8469_01_characters_character_spell"
#define REVISION_DB_MANGOS "required_8462_01_mangos_creature_ai_texts" #define REVISION_DB_MANGOS "required_8482_01_mangos_spell_elixir"
#define REVISION_DB_REALMD "required_8332_01_realmd_realmcharacters" #define REVISION_DB_REALMD "required_8332_01_realmd_realmcharacters"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__