Fixed compile errors and some typos

--HG--
branch : trunk
This commit is contained in:
n0n4m3
2009-12-17 14:06:20 +01:00
parent 89656d5749
commit eccf162be2
18 changed files with 316 additions and 154 deletions
@@ -454,7 +454,7 @@ struct TRINITY_DLL_DECL npc_marzon_silent_bladeAI : public ScriptedAI
{
CAST_AI(npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiTimer = 2000;
CAST_AI(npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiPhase = 5;
m_creature->ChangeOrient(0.0f, pSummoner);
//m_creature->ChangeOrient(0.0f, pSummoner);
}
}
}
@@ -514,8 +514,6 @@ struct TRINITY_DLL_DECL npc_tyrion_spybotAI : public npc_escortAI
switch(uiPointId)
{
case 1:
if (pTyrion = m_creature->FindNearestCreature(NPC_TYRION, 10.0f, true))
m_creature->ChangeOrient(0.0f, pTyrion);
SetEscortPaused(true);
uiTimer = 2000;
uiPhase = 1;
@@ -528,8 +526,6 @@ struct TRINITY_DLL_DECL npc_tyrion_spybotAI : public npc_escortAI
break;
case 17:
SetEscortPaused(true);
if (pLescovar = m_creature->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR, 20.0f, true))
pLescovar->ChangeOrient(0.0f, m_creature);
DoScriptText(SAY_SPYBOT_3, m_creature);
uiTimer = 3000;
uiPhase = 8;
+4 -6
View File
@@ -82,7 +82,7 @@ void BattleGroundBE::AddPlayer(Player *plr)
m_PlayerScores[plr->GetGUID()] = sc;
UpdateArenaUnitWorldState();
UpdateArenaWorldState();
}
void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
@@ -90,7 +90,7 @@ void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
UpdateArenaUnitWorldState();
UpdateArenaWorldState();
CheckArenaWinConditions();
}
@@ -107,7 +107,7 @@ void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
BattleGround::HandleKillPlayer(player,killer);
UpdateArenaUnitWorldState();
UpdateArenaWorldState();
CheckArenaWinConditions();
}
@@ -146,8 +146,7 @@ void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattleGroundBE::FillInitialWorldStates(WorldPacket &data)
{
data << uint32(0x9f3) << uint32(1); // 9
UpdateArenaUnitWorldState();
UpdateArenaWorldState();
}
void BattleGroundBE::Reset()
@@ -200,4 +199,3 @@ spell 32725 - Green Team
35774 Gold Team
35775 Green Team
*/
-1
View File
@@ -76,4 +76,3 @@ class BattleGroundBE : public BattleGround
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
};
#endif
+5 -7
View File
@@ -79,7 +79,7 @@ void BattleGroundNA::AddPlayer(Player *plr)
m_PlayerScores[plr->GetGUID()] = sc;
UpdateArenaUnitWorldState();
UpdateArenaWorldState();
}
void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
@@ -87,7 +87,7 @@ void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
UpdateArenaUnitWorldState();
UpdateArenaWorldState();
CheckArenaWinConditions();
}
@@ -104,7 +104,7 @@ void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
BattleGround::HandleKillPlayer(player,killer);
UpdateArenaUnitWorldState();
UpdateArenaWorldState();
CheckArenaWinConditions();
}
@@ -138,9 +138,8 @@ void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattleGroundNA::FillInitialWorldStates(WorldPacket &data)
{
data << uint32(0xa11) << uint32(1);
UpdateArenaUnitWorldState();
data << uint32(0xa11) << uint32(1); // 9
UpdateArenaWorldState();
}
void BattleGroundNA::Reset()
@@ -176,4 +175,3 @@ bool BattleGroundNA::SetupBattleGround()
0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................
0050: 00 00 00 00 00 00 | ......
*/
-1
View File
@@ -74,4 +74,3 @@ class BattleGroundNA : public BattleGround
bool HandlePlayerUnderMap(Player * plr);
};
#endif
+5 -7
View File
@@ -79,7 +79,7 @@ void BattleGroundRL::AddPlayer(Player *plr)
m_PlayerScores[plr->GetGUID()] = sc;
UpdateArenaUnitWorldState();
UpdateArenaWorldState();
}
void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
@@ -87,7 +87,7 @@ void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
UpdateArenaUnitWorldState();
UpdateArenaWorldState();
CheckArenaWinConditions();
}
@@ -104,7 +104,7 @@ void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
BattleGround::HandleKillPlayer(player,killer);
UpdateArenaUnitWorldState();
UpdateArenaWorldState();
CheckArenaWinConditions();
}
@@ -139,9 +139,8 @@ void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattleGroundRL::FillInitialWorldStates(WorldPacket &data)
{
data << uint32(0xbba) << uint32(1);
UpdateArenaUnitWorldState();
data << uint32(0xbba) << uint32(1); // 9
UpdateArenaWorldState();
}
void BattleGroundRL::Reset()
@@ -175,4 +174,3 @@ Packet S->C, id 600, SMSG_INIT_WORLD_STATES (706), len 86
0040: 00 00 00 00 00 00 D3 08 00 00 00 00 00 00 D4 08 | ................
0050: 00 00 00 00 00 00 | ......
*/
-1
View File
@@ -70,4 +70,3 @@ class BattleGroundRL : public BattleGround
bool HandlePlayerUnderMap(Player * plr);
};
#endif
+10 -5
View File
@@ -120,7 +120,8 @@ void BattleGroundRV::AddPlayer(Player *plr)
m_PlayerScores[plr->GetGUID()] = sc;
UpdateArenaUnitWorldState();
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
}
void BattleGroundRV::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
@@ -128,7 +129,9 @@ void BattleGroundRV::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
UpdateArenaUnitWorldState();
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
CheckArenaWinConditions();
}
@@ -145,7 +148,9 @@ void BattleGroundRV::HandleKillPlayer(Player *player, Player *killer)
BattleGround::HandleKillPlayer(player, killer);
UpdateArenaUnitWorldState();
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
CheckArenaWinConditions();
}
@@ -175,9 +180,9 @@ void BattleGroundRV::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattleGroundRV::FillInitialWorldStates(WorldPacket &data)
{
data << uint32(BG_RV_WORLD_STATE_A) << uint32(GetAlivePlayersCountByTeam(ALLIANCE));
data << uint32(BG_RV_WORLD_STATE_H) << uint32(GetAlivePlayersCountByTeam(HORDE));
data << uint32(BG_RV_WORLD_STATE) << uint32(1);
UpdateArenaUnitWorldState();
}
void BattleGroundRV::Reset()
+3 -1
View File
@@ -92,7 +92,9 @@ enum BattleGroundRVData
BG_RV_FIRE_TO_PILAR_TIMER = 20000,
BG_RV_PILAR_TO_FIRE_TIMER = 5000,
BG_RV_FIRST_TIMER = 20133,
BG_RV_WORLD_STATE = 0xE1A,
BG_RV_WORLD_STATE_A = 0xe10,
BG_RV_WORLD_STATE_H = 0xe11,
BG_RV_WORLD_STATE = 0xe1a,
};
class BattleGroundRVScore : public BattleGroundScore
+37 -3
View File
@@ -823,7 +823,7 @@ bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args)
return true;
}
bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args)
bool ChatHandler::HandleDebugGetItemValueCommand(const char* args)
{
if (!*args)
return false;
@@ -835,14 +835,48 @@ bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args)
return false;
uint32 guid = (uint32)atoi(e);
uint32 flag = (uint32)atoi(f);
uint32 index = (uint32)atoi(f);
Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
if (!i)
return false;
i->SetUInt32Value(ITEM_FIELD_FLAGS, flag);
if (index >= i->GetValuesCount())
return false;
uint32 value = i->GetUInt32Value(index);
PSendSysMessage("Item %u: value at %u is %u", guid, index, value);
return true;
}
bool ChatHandler::HandleDebugSetItemValueCommand(const char* args)
{
if (!*args)
return false;
char* e = strtok((char*)args, " ");
char* f = strtok(NULL, " ");
char* g = strtok(NULL, " ");
if (!e || !f || !g)
return false;
uint32 guid = (uint32)atoi(e);
uint32 index = (uint32)atoi(f);
uint32 value = (uint32)atoi(g);
Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
if (!i)
return false;
if (index >= i->GetValuesCount())
return false;
i->SetUInt32Value(index, value);
return true;
}
+9 -7
View File
@@ -827,7 +827,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
Map* cMap = target->GetMap();
if (cMap->Instanceable() && cMap->GetInstanceId() != pMap->GetInstanceId())
{
target->UnbindInstance(pMap->GetInstanceId(), target->GetDifficulty(), true);
target->UnbindInstance(pMap->GetInstanceId(), target->GetDungeonDifficulty(), true);
// cannot summon from instance to instance
//PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,nameLink.c_str());
//SetSentErrorMessage(true);
@@ -968,24 +968,26 @@ bool ChatHandler::HandleGonameCommand(const char* args)
// if the player or the player's group is bound to another instance
// the player will not be bound to another one
InstancePlayerBind *pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty());
InstancePlayerBind *pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(cMap->IsRaid()));
if (!pBind)
{
Group *group = _player->GetGroup();
// if no bind exists, create a solo bind
InstanceGroupBind *gBind = group ? group->GetBoundInstance(target->GetMapId(), target->GetDifficulty()) : NULL;
// if no bind exists, create a solo bind
InstanceGroupBind *gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
if (!gBind)
if (InstanceSave *save = sInstanceSaveManager.GetInstanceSave(target->GetInstanceId()))
_player->BindToInstance(save, !save->CanReset());
}
_player->SetDifficulty(target->GetDifficulty());
if(cMap->IsRaid())
_player->SetRaidDifficulty(target->GetRaidDifficulty());
else
_player->SetDungeonDifficulty(target->GetDungeonDifficulty());
}
PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
if (needReportToTarget(target))
ChatHandler(target).PSendSysMessage(LANG_APPEARING_TO, GetNameLink().c_str());
//if (needReportToTarget(target))
// ChatHandler(target).PSendSysMessage(LANG_APPEARING_TO, GetNameLink().c_str());
// stop flight if need
if (_player->isInFlight())
+1 -1
View File
@@ -4250,7 +4250,7 @@ bool ChatHandler::HandleWintergraspStatusCommand(const char* args)
}
PSendSysMessage(LANG_BG_WG_STATUS, objmgr.GetTrinityStringForDBCLocale(
pvpWG->GetTeam() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE),
pvpWG->getDefenderTeam() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE),
secsToTimeString(pvpWG->GetTimer(), true).c_str(),
pvpWG->isWarTime() ? "Yes" : "No",
pvpWG->GetNumPlayersH(),
+2 -1
View File
@@ -33,7 +33,8 @@ enum RollType
{
ROLL_PASS = 0,
ROLL_NEED = 1,
ROLL_GREED = 2
ROLL_GREED = 2,
MAX_ROLL_TYPE = 3
};
#define MAX_NR_LOOT_ITEMS 16
+86 -20
View File
@@ -47,6 +47,7 @@
#include "AccountMgr.h"
#include "Vehicle.h"
#include "CreatureAI.h"
#include "DBCEnums.h"
void WorldSession::HandleRepopRequestOpcode( WorldPacket & recv_data )
{
@@ -468,7 +469,7 @@ void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data )
uint64 guid ;
recv_data >> guid;
_player->SetUInt32Value(UNIT_FIELD_TARGET,guid);
_player->SetUInt32Value(UNIT_FIELD_TARGET, guid);
// update reputation list if need
Unit* unit = ObjectAccessor::GetUnit(*_player, guid );
@@ -692,10 +693,8 @@ void WorldSession::HandleSetContactNotesOpcode( WorldPacket & recv_data )
void WorldSession::HandleBugOpcode( WorldPacket & recv_data )
{
uint32 suggestion, contentlen;
std::string content;
uint32 typelen;
std::string type;
uint32 suggestion, contentlen, typelen;
std::string content, type;
recv_data >> suggestion >> contentlen >> content;
@@ -988,8 +987,8 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
dest.resize(destSize);
WorldPacket data (SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize);
data << uint64(_player->GetGUID()); // player guid
WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize);
data << uint64(_player ? _player->GetGUID() : 0); // player guid
data << uint32(type); // type (0-7)
data << uint32(adata->Time); // unix time
data << uint32(size); // decompressed length
@@ -1053,7 +1052,12 @@ void WorldSession::HandleMoveTimeSkippedOpcode( WorldPacket & recv_data )
/* WorldSession::Update( getMSTime() );*/
DEBUG_LOG( "WORLD: Time Lag/Synchronization Resent/Update" );
recv_data.read_skip<uint64>();
uint64 guid;
if(!recv_data.readPackGUID(guid))
{
recv_data.rpos(recv_data.wpos());
return;
}
recv_data.read_skip<uint32>();
/*
uint64 guid;
@@ -1441,10 +1445,16 @@ void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ )
if(pGroup)
{
if(pGroup->IsLeader(_player->GetGUID()))
pGroup->ResetInstances(INSTANCE_RESET_ALL, _player);
{
pGroup->ResetInstances(INSTANCE_RESET_ALL, false, _player);
pGroup->ResetInstances(INSTANCE_RESET_ALL, true,_player);
}
}
else
_player->ResetInstances(INSTANCE_RESET_ALL);
{
_player->ResetInstances(INSTANCE_RESET_ALL, false);
_player->ResetInstances(INSTANCE_RESET_ALL, true);
}
}
void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
@@ -1454,15 +1464,15 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
uint32 mode;
recv_data >> mode;
if(mode == _player->GetDifficulty())
return;
if(mode > DIFFICULTY_HEROIC)
if(mode >= MAX_DUNGEON_DIFFICULTY)
{
sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
}
if(Difficulty(mode) == _player->GetDungeonDifficulty())
return;
// cannot reset while in an instance
Map *map = _player->GetMap();
if(map && map->IsDungeon())
@@ -1480,21 +1490,64 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
{
// the difficulty is set even if the instances can't be reset
//_player->SendDungeonDifficulty(true);
pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, _player);
pGroup->SetDifficulty(mode);
pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player);
pGroup->SetDungeonDifficulty(Difficulty(mode));
}
}
else
{
_player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY);
_player->SetDifficulty(mode);
_player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false);
_player->SetDungeonDifficulty(Difficulty(mode));
}
}
void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data )
{
sLog.outDebug("MSG_SET_RAID_DIFFICULTY");
uint32 mode;
recv_data >> mode;
if(mode >= MAX_RAID_DIFFICULTY)
{
sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
}
// cannot reset while in an instance
Map *map = _player->GetMap();
if(map && map->IsDungeon())
{
sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
}
if(Difficulty(mode) == _player->GetRaidDifficulty())
return;
if(_player->getLevel() < LEVELREQUIREMENT_HEROIC)
return;
if(Group *pGroup = _player->GetGroup())
{
if(pGroup->IsLeader(_player->GetGUID()))
{
// the difficulty is set even if the instances can't be reset
//_player->SendDungeonDifficulty(true);
pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player);
pGroup->SetRaidDifficulty(Difficulty(mode));
}
}
else
{
_player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true);
_player->SetRaidDifficulty(Difficulty(mode));
}
}
void WorldSession::HandleCancelMountAuraOpcode( WorldPacket & /*recv_data*/ )
{
sLog.outDebug("WORLD: CMSG_CANCEL_MOUNT_AURA");
//recv_data.hexlike();
//If player is not mounted, so go out :)
if (!_player->IsMounted()) // not blizz like; no any messages on blizz
@@ -1519,7 +1572,10 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode( WorldPacket & recv_data )
sLog.outDebug("WORLD: CMSG_MOVE_SET_CAN_FLY_ACK");
//recv_data.hexlike();
recv_data.read_skip<uint64>(); // guid
uint64 guid; // guid - unused
if(!recv_data.readPackGUID(guid))
return;
recv_data.read_skip<uint32>(); // unk
MovementInfo movementInfo;
@@ -1558,3 +1614,13 @@ void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data )
player->GetAchievementMgr().SendRespondInspectAchievements(_player);
}
void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& recv_data)
{
// empty opcode
sLog.outDebug("WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE");
WorldPacket data(SMSG_WORLD_STATE_UI_TIMER_UPDATE, 4);
data << uint32(time(NULL));
SendPacket(&data);
}
+111 -78
View File
@@ -570,8 +570,8 @@ void ObjectMgr::LoadCreatureTemplates()
sLog.outString( ">> Loaded %u creature definitions", sCreatureStorage.RecordCount );
sLog.outString();
std::set<uint32> heroicEntries; // already loaded heroic value in creatures
std::set<uint32> hasHeroicEntries; // already loaded creatures with heroic entry values
std::set<uint32> difficultyEntries[MAX_DIFFICULTY - 1]; // already loaded difficulty 1 value in creatures
std::set<uint32> hasDifficultyEntries[MAX_DIFFICULTY - 1]; // already loaded creatures with difficulty 1 values
// check data correctness
for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
@@ -580,84 +580,105 @@ void ObjectMgr::LoadCreatureTemplates()
if (!cInfo)
continue;
if (cInfo->HeroicEntry)
bool ok = true; // bool to allow continue outside this loop
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
{
CreatureInfo const* heroicInfo = GetCreatureTemplate(cInfo->HeroicEntry);
if (!heroicInfo)
if (!cInfo->DifficultyEntry[diff])
continue;
ok = false; // will be set to true at the end of this loop again
CreatureInfo const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
if (!difficultyInfo)
{
sLog.outErrorDb("Creature (Entry: %u) have `heroic_entry`=%u but creature entry %u not exist.", i, cInfo->HeroicEntry, cInfo->HeroicEntry);
sLog.outErrorDb("Creature (Entry: %u) have `difficulty_entry_%u`=%u but creature entry %u not exist.",
i, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]);
continue;
}
if (heroicEntries.find(i)!=heroicEntries.end())
if (difficultyEntries[diff].find(i) != difficultyEntries[diff].end())
{
sLog.outErrorDb("Creature (Entry: %u) listed as heroic but have value in `heroic_entry`.",i);
sLog.outErrorDb("Creature (Entry: %u) listed as difficulty %u but have value in `difficulty_entry_1`.", i, diff + 1);
continue;
}
if (heroicEntries.find(cInfo->HeroicEntry)!=heroicEntries.end())
bool ok2 = true;
for (uint32 diff2 = 0; diff2 < MAX_DIFFICULTY - 1 && ok2; ++diff2)
{
sLog.outErrorDb("Creature (Entry: %u) already listed as heroic for another entry.",cInfo->HeroicEntry);
ok2 = false;
if (difficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != difficultyEntries[diff2].end())
{
sLog.outErrorDb("Creature (Entry: %u) already listed as difficulty %u for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1);
continue;
}
if (hasDifficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != hasDifficultyEntries[diff2].end())
{
sLog.outErrorDb("Creature (Entry: %u) have `difficulty_entry_%u`=%u but creature entry %u have difficulty %u entry also.",
i, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1);
continue;
}
ok2 = true;
}
if (!ok2)
continue;
if (cInfo->unit_class != difficultyInfo->unit_class)
{
sLog.outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).",
i, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class);
continue;
}
if (hasHeroicEntries.find(cInfo->HeroicEntry)!=hasHeroicEntries.end())
if (cInfo->npcflag != difficultyInfo->npcflag)
{
sLog.outErrorDb("Creature (Entry: %u) have `heroic_entry`=%u but creature entry %u have heroic entry also.",i,cInfo->HeroicEntry,cInfo->HeroicEntry);
sLog.outErrorDb("Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->unit_class != heroicInfo->unit_class)
if (cInfo->trainer_class != difficultyInfo->trainer_class)
{
sLog.outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in heroic mode (Entry: %u, class %u).",i, cInfo->unit_class, cInfo->HeroicEntry, heroicInfo->unit_class);
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->npcflag != heroicInfo->npcflag)
if (cInfo->trainer_race != difficultyInfo->trainer_race)
{
sLog.outErrorDb("Creature (Entry: %u) listed in `creature_template_substitution` has different `npcflag` in heroic mode.",i);
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_class != heroicInfo->trainer_class)
if (cInfo->trainer_type != difficultyInfo->trainer_type)
{
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_class` in heroic mode (Entry: %u).",i,cInfo->HeroicEntry);
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_race != heroicInfo->trainer_race)
if (cInfo->trainer_spell != difficultyInfo->trainer_spell)
{
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_race` in heroic mode (Entry: %u).",i,cInfo->HeroicEntry);
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_type != heroicInfo->trainer_type)
if (difficultyInfo->AIName && *difficultyInfo->AIName)
{
sLog.outErrorDb("Creature (Entry: %u) listed in `creature_template_substitution` has different `trainer_type` in heroic mode.",i);
sLog.outErrorDb("Difficulty %u mode creature (Entry: %u) has `AIName`, but in any case will used difficulty 0 mode creature (Entry: %u) AIName.",
diff, cInfo->DifficultyEntry[diff], i);
continue;
}
if (cInfo->trainer_spell != heroicInfo->trainer_spell)
if (difficultyInfo->ScriptID)
{
sLog.outErrorDb("Creature (Entry: %u) listed in `creature_template_substitution` has different `trainer_spell` in heroic mode.",i);
sLog.outErrorDb("Difficulty %u mode creature (Entry: %u) has `ScriptName`, but in any case will used difficulty 0 mode creature (Entry: %u) ScriptName.",
diff, cInfo->DifficultyEntry[diff], i);
continue;
}
if (heroicInfo->AIName && *heroicInfo->AIName)
{
sLog.outErrorDb("Heroic mode creature (Entry: %u) has `AIName`, but in any case will used normal mode creature (Entry: %u) AIName.",cInfo->HeroicEntry,i);
continue;
}
if (heroicInfo->ScriptID)
{
sLog.outErrorDb("Heroic mode creature (Entry: %u) has `ScriptName`, but in any case will used normal mode creature (Entry: %u) ScriptName.",cInfo->HeroicEntry,i);
continue;
}
hasHeroicEntries.insert(i);
heroicEntries.insert(cInfo->HeroicEntry);
hasDifficultyEntries[diff].insert(i);
difficultyEntries[diff].insert(cInfo->DifficultyEntry[diff]);
ok = true;
}
if (!ok)
continue;
FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction_A);
if (!factionTemplate)
@@ -1232,11 +1253,20 @@ void ObjectMgr::LoadCreatures()
}
// build single time for check creature data
std::set<uint32> heroicCreatures;
std::set<uint32> difficultyCreatures[MAX_DIFFICULTY - 1];
for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i)
if(CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
if(cInfo->HeroicEntry)
heroicCreatures.insert(cInfo->HeroicEntry);
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff)
if (cInfo->DifficultyEntry[diff])
difficultyCreatures[diff].insert(cInfo->DifficultyEntry[diff]);
// build single time for check spawnmask
std::map<uint32,uint32> spawnMasks;
for(uint32 i = 0; i < sMapStore.GetNumRows(); ++i)
if(sMapStore.LookupEntry(i))
for(int k = 0; k < MAX_DIFFICULTY; ++k)
if (GetMapDifficultyData(i,Difficulty(k)))
spawnMasks[i] |= (1 << k);
//TODO: remove this
//gameeventmgr.mGameEventCreatureGuids.resize(52*2-1);
@@ -1280,12 +1310,29 @@ void ObjectMgr::LoadCreatures()
int16 gameEvent = fields[18].GetInt16();
int16 PoolId = fields[19].GetInt16();
if(heroicCreatures.find(data.id)!=heroicCreatures.end())
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
if(!mapEntry)
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as heroic template (entry: %u) in `creature_template_substitution`, skipped.",guid,data.id );
sLog.outErrorDb("Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.",guid, data.mapid );
continue;
}
if (data.spawnMask & ~spawnMasks[data.mapid])
sLog.outErrorDb("Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).",guid, data.spawnMask, data.mapid );
bool ok = true;
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
{
if (difficultyCreatures[diff].find(data.id) != difficultyCreatures[diff].end())
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
guid, diff + 1, data.id );
ok = false;
}
}
if (!ok)
continue;
// I do not know why but in db most display id are not zero
/*if(data.displayid == 11686 || data.displayid == 24719)
{
@@ -1313,8 +1360,7 @@ void ObjectMgr::LoadCreatures()
if(cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
{
MapEntry const* map = sMapStore.LookupEntry(data.mapid);
if(!map || !map->IsDungeon())
if(!mapEntry || !mapEntry->IsDungeon())
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.",guid,data.id);
}
@@ -3319,9 +3365,9 @@ void ObjectMgr::LoadGroups()
Group *group = NULL;
uint64 leaderGuid = 0;
uint32 count = 0;
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
QueryResult *result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, leaderGuid FROM groups");
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
QueryResult *result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty, leaderGuid FROM groups");
if( !result )
{
barGoLink bar( 1 );
@@ -3340,7 +3386,7 @@ void ObjectMgr::LoadGroups()
bar.step();
Field *fields = result->Fetch();
++count;
leaderGuid = MAKE_NEW_GUID(fields[15].GetUInt32(),0,HIGHGUID_PLAYER);
leaderGuid = MAKE_NEW_GUID(fields[16].GetUInt32(),0,HIGHGUID_PLAYER);
group = new Group;
if(!group->LoadGroupFromDB(leaderGuid, result, false))
@@ -3454,7 +3500,14 @@ void ObjectMgr::LoadGroups()
continue;
}
InstanceSave *save = sInstanceSaveManager.AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), fields[4].GetUInt8(), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true);
uint32 diff = fields[4].GetUInt8();
if(diff >= (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
{
sLog.outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
diff = 0; // default for both difficaly types
}
InstanceSave *save = sInstanceSaveManager.AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true);
group->BindToInstance(save, fields[3].GetBool(), true);
}while( result->NextRow() );
delete result;
@@ -4813,37 +4866,17 @@ void ObjectMgr::LoadInstanceTemplate()
for (uint32 i = 0; i < sInstanceTemplate.MaxEntry; i++)
{
InstanceTemplate* temp = (InstanceTemplate*)GetInstanceTemplate(i);
if(!temp) continue;
const MapEntry* entry = sMapStore.LookupEntry(temp->map);
if(!entry)
{
if(!temp)
continue;
if(!MapManager::IsValidMAP(temp->map))
sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", temp->map);
continue;
}
else if(!entry->HasResetTime())
continue;
//FIXME: now exist heroic instance, normal/heroic raid instances
// entry->resetTimeHeroic store reset time for both heroic mode instance (raid and non-raid)
// entry->resetTimeRaid store reset time for normal raid only
// for current state entry->resetTimeRaid == entry->resetTimeHeroic in case raid instances with heroic mode.
// but at some point wee need implement reset time dependent from raid instance mode
if(temp->reset_delay == 0)
if(!MapManager::IsValidMapCoord(temp->parent,temp->startLocX,temp->startLocY,temp->startLocZ,temp->startLocO))
{
// use defaults from the DBC
if(entry->resetTimeHeroic) // for both raid and non raids, read above
{
temp->reset_delay = entry->resetTimeHeroic / DAY;
}
else if (entry->resetTimeRaid && entry->map_type == MAP_RAID)
// for normal raid only
{
temp->reset_delay = entry->resetTimeRaid / DAY;
}
sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad parent entrance coordinates for map id %d template!", temp->map);
temp->parent = 0; // will have wrong continent 0 parent, at least existed
}
// the reset_delay must be at least one day
temp->reset_delay = std::max((uint32)1, (uint32)(temp->reset_delay * sWorld.getRate(RATE_INSTANCE_RESET_TIME)));
}
sLog.outString( ">> Loaded %u Instance Template definitions", sInstanceTemplate.RecordCount );
+1
View File
@@ -4163,6 +4163,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
{
Field *fields = resultMail->Fetch();
uint32 mail_id = fields[0].GetUInt32();
uint16 mailType = fields[1].GetUInt16();
uint16 mailTemplateId= fields[2].GetUInt16();
uint32 sender = fields[3].GetUInt32();
+11
View File
@@ -2591,3 +2591,14 @@ void World::ProcessStopEvent()
{
isEventKillStart = false;
}
void World::UpdateAreaDependentAuras()
{
SessionMap::const_iterator itr;
for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
if (itr->second && itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld())
{
itr->second->GetPlayer()->UpdateAreaDependentAuras(itr->second->GetPlayer()->GetAreaId());
itr->second->GetPlayer()->UpdateZoneDependentAuras(itr->second->GetPlayer()->GetZoneId());
}
}
+30 -10
View File
@@ -86,6 +86,13 @@ enum WorldTimers
WUPDATE_COUNT = 10
};
// States than may change after server started
enum WorldStates
{
WORLDSTATE_WINTERGRASP_CONTROLING_FACTION,
WORLDSTATE_VALUE_COUNT,
};
/// Configuration elements
enum WorldConfigs
{
@@ -557,17 +564,27 @@ class World
/// Set a server configuration element (see #WorldConfigs)
void setConfig(uint32 index,uint32 value)
{
if(index<CONFIG_VALUE_COUNT)
m_configs[index]=value;
if (index < CONFIG_VALUE_COUNT)
m_configs[index] = value;
}
/// Get a server configuration element (see #WorldConfigs)
uint32 getConfig(uint32 index) const
{
if(index<CONFIG_VALUE_COUNT)
return m_configs[index];
else
return 0;
return index < CONFIG_VALUE_COUNT ? m_configs[index] : 0;
}
// Set a server state - Those general values that can change after server have been setup
void setState(uint32 index, uint32 value)
{
if (index < WORLDSTATE_VALUE_COUNT)
m_states[index] = value;
}
// Get a server state element
uint32 getState(uint32 index) const
{
return index < WORLDSTATE_VALUE_COUNT ? m_states[index] : 0;
}
/// Are we on a "Player versus Player" server?
@@ -636,11 +653,13 @@ class World
void LoadAutobroadcasts();
void ProcessStartEvent();
void ProcessStopEvent();
bool GetEventKill() { return isEventKillStart; }
void UpdateAreaDependentAuras();
bool isEventKillStart;
void ProcessStartEvent();
void ProcessStopEvent();
bool GetEventKill() { return isEventKillStart; }
bool isEventKillStart;
protected:
void _UpdateGameTime();
// callback for UpdateRealmCharacters
@@ -683,6 +702,7 @@ class World
float rate_values[MAX_RATES];
uint32 m_configs[CONFIG_VALUE_COUNT];
uint32 m_states[WORLDSTATE_VALUE_COUNT];
int32 m_playerLimit;
AccountTypes m_allowedSecurityLevel;
LocaleConstant m_defaultDbcLocale; // from config for one from loaded DBC locales