Merge commit 'origin/master' into 310

Conflicts:
	src/game/Player.cpp
This commit is contained in:
tomrus88 2009-04-28 19:08:53 +04:00
commit 950a4bf13f
52 changed files with 623 additions and 474 deletions

View file

@ -720,12 +720,12 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
continue;
// skip wrong arena achievements, if not achievIdByArenaSlot then normal total death counter
bool notfit = false;
for(int i = 0; i < MAX_ARENA_SLOT; ++i)
for(int j = 0; j < MAX_ARENA_SLOT; ++j)
{
if(achievIdByArenaSlot[i] == achievement->ID)
if(achievIdByArenaSlot[j] == achievement->ID)
{
BattleGround* bg = GetPlayer()->GetBattleGround();
if(!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != i)
if(!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != j)
notfit = true;
break;
@ -749,26 +749,26 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
// search case
bool found = false;
for(int i = 0; achievIdForDangeon[i][0]; ++i)
for(int j = 0; achievIdForDangeon[j][0]; ++j)
{
if(achievIdForDangeon[i][0] == achievement->ID)
if(achievIdForDangeon[j][0] == achievement->ID)
{
if(map->IsRaid())
{
// if raid accepted (ignore difficulty)
if(!achievIdForDangeon[i][2])
if(!achievIdForDangeon[j][2])
break; // for
}
else if(GetPlayer()->GetDifficulty()==DIFFICULTY_NORMAL)
{
// dungeon in normal mode accepted
if(!achievIdForDangeon[i][1])
if(!achievIdForDangeon[j][1])
break; // for
}
else
{
// dungeon in heroic mode accepted
if(!achievIdForDangeon[i][3])
if(!achievIdForDangeon[j][3])
break; // for
}
@ -890,12 +890,16 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
break;
bool matchFound = false;
for (int i = 0; i < 3; ++i)
for (int j = 0; j < MAX_WORLD_MAP_OVERLAY_AREA_IDX; ++j)
{
int32 exploreFlag = GetAreaFlagByAreaID(worldOverlayEntry->areatableID[i]);
if(exploreFlag < 0)
uint32 area_id = worldOverlayEntry->areatableID[j];
if(!area_id) // array have 0 only in empty tail
break;
int32 exploreFlag = GetAreaFlagByAreaID(area_id);
if(exploreFlag < 0)
continue;
uint32 playerIndexOffset = uint32(exploreFlag) / 32;
uint32 mask = 1<< (uint32(exploreFlag) % 32);
@ -1392,7 +1396,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
{
progress = &iter->second;
uint32 newValue;
uint32 newValue = 0;
switch(ptype)
{
case PROGRESS_SET:

View file

@ -60,8 +60,8 @@ AggressorAI::MoveInLineOfSight(Unit *u)
}
else if(sMapStore.LookupEntry(m_creature->GetMapId())->IsDungeon())
{
u->SetInCombatWith(m_creature);
m_creature->AddThreat(u, 0.0f);
u->SetInCombatWith(m_creature);
}
}
}
@ -152,13 +152,13 @@ AggressorAI::AttackStart(Unit *u)
if(m_creature->Attack(u,true))
{
m_creature->SetInCombatWith(u);
u->SetInCombatWith(m_creature);
m_creature->AddThreat(u, 0.0f);
// DEBUG_LOG("Creature %s tagged a victim to kill [guid=%u]", m_creature->GetName(), u->GetGUIDLow());
i_victimGuid = u->GetGUID();
m_creature->AddThreat(u, 0.0f);
m_creature->SetInCombatWith(u);
u->SetInCombatWith(m_creature);
m_creature->GetMotionMaster()->MoveChase(u);
}
}

View file

@ -1324,7 +1324,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
// so we must create it specific for this instance
GameObject * go = new GameObject;
if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, map,
PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,1))
PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY))
{
sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry);
sLog.outError("Cannot create gameobject template %u! BattleGround not created!", entry);
@ -1367,7 +1367,7 @@ void BattleGround::DoorClose(uint32 type)
if (obj)
{
//if doors are open, close it
if (obj->getLootState() == GO_ACTIVATED && !obj->GetGoState())
if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY)
{
//change state to allow door to be closed
obj->SetLootState(GO_READY);

View file

@ -103,9 +103,9 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
return;
// get bg instance or bg template if instance not found
BattleGround * bg = NULL;
BattleGround *bg = NULL;
if (instanceId)
BattleGround *bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
{
@ -353,7 +353,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
else
{
// get the bg we're invited to
BattleGround * bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId);
bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId);
status = STATUS_WAIT_JOIN;
}
@ -567,7 +567,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
}
else
{
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
if (!bg)
continue;
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(itrPlayerStatus->second.GroupInfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));

View file

@ -761,10 +761,10 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
FillPlayersToBG(bg, queue_id);
// now everything is set, invite players
for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++itr)
InviteGroupToBG((*itr), bg, (*itr)->Team);
for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++itr)
InviteGroupToBG((*itr), bg, (*itr)->Team);
for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg, (*citr)->Team);
for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg, (*citr)->Team);
if (!bg->HasFreeSlots())
{
@ -834,8 +834,8 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
}
//invite those selection pools
for(uint32 i = 0; i < BG_TEAMS_COUNT; i++)
for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++itr)
InviteGroupToBG((*itr), bg2, (*itr)->Team);
for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg2, (*citr)->Team);
//start bg
bg2->StartBattleGround();
//clear structures
@ -861,8 +861,8 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
// invite those selection pools
for(uint32 i = 0; i < BG_TEAMS_COUNT; i++)
for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++itr)
InviteGroupToBG((*itr), bg2, (*itr)->Team);
for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg2, (*citr)->Team);
// start bg
bg2->StartBattleGround();
}
@ -1825,10 +1825,11 @@ void BattleGroundMgr::DistributeArenaPoints()
void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player* plr, BattleGroundTypeId bgTypeId, uint8 fromWhere)
{
uint32 PlayerLevel = 10;
if (!plr)
return;
if (plr)
PlayerLevel = plr->getLevel();
uint32 PlayerLevel = 10;
PlayerLevel = plr->getLevel();
data->Initialize(SMSG_BATTLEFIELD_LIST);
*data << uint64(guid); // battlemaster guid

View file

@ -298,10 +298,11 @@ void Channel::Password(uint64 p, const char *pass)
void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
{
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
if(plr)
sec = plr->GetSession()->GetSecurity();
if (!plr)
return;
uint32 sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
{
@ -366,10 +367,11 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
void Channel::SetOwner(uint64 p, const char *newname)
{
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
if(plr)
sec = plr->GetSession()->GetSecurity();
if (!plr)
return;
uint32 sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
{

View file

@ -109,9 +109,10 @@ ChatCommand * ChatHandler::getCommandTable()
static ChatCommand characterCommandTable[] =
{
{ "rename", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterRenameCommand, "", NULL },
{ "customize", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterCustomizeCommand, "", NULL },
{ "delete", SEC_CONSOLE, true, &ChatHandler::HandleCharacterDeleteCommand, "", NULL },
{ "level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleCharacterLevelCommand, "", NULL },
{ "rename", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterRenameCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};

View file

@ -116,6 +116,7 @@ class ChatHandler
bool HandleCharacterCustomizeCommand(const char * args);
bool HandleCharacterDeleteCommand(const char* args);
bool HandleCharacterRenameCommand(const char * args);
bool HandleCharacterLevelCommand(const char* args);
bool HandleDebugAnimCommand(const char* args);
bool HandleDebugArenaCommand(const char * args);
@ -498,6 +499,7 @@ class ChatHandler
bool HandleBanHelper(BanMode mode,char const* args);
bool HandleBanInfoHelper(uint32 accountid, char const* accountname);
bool HandleUnBanHelper(BanMode mode,char const* args);
void HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel);
void SetSentErrorMessage(bool val){ sentErrorMessage = val;};
private:

View file

@ -46,6 +46,9 @@ class MANGOS_DLL_SPEC CreatureAI
// Called if IsVisible(Unit *who) is true at each *who move, reaction at visibility zone enter
virtual void MoveInLineOfSight(Unit *) {}
// Called for reaction at enter to combat if not in combat yet (enemy can be NULL)
virtual void EnterCombat(Unit* /*enemy*/) {}
// Called for reaction at stopping attack at no attackers or targets
virtual void EnterEvadeMode() {}

View file

@ -39,10 +39,10 @@ int CreatureEventAI::Permissible(const Creature *creature)
CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
{
CreatureEventAI_Event_Map::iterator CreatureEvents = CreatureEAI_Mgr.GetCreatureEventAIMap().find(m_creature->GetEntry());
CreatureEventAI_Event_Map::const_iterator CreatureEvents = CreatureEAI_Mgr.GetCreatureEventAIMap().find(m_creature->GetEntry());
if (CreatureEvents != CreatureEAI_Mgr.GetCreatureEventAIMap().end())
{
std::vector<CreatureEventAI_Event>::iterator i;
std::vector<CreatureEventAI_Event>::const_iterator i;
for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i)
{
@ -622,7 +622,7 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u
}
//Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered
bool canCast = !(caster->IsNonMeleeSpellCasted(false) && (param3 & CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS));
bool canCast = !caster->IsNonMeleeSpellCasted(false) || (param3 & (CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS));
// If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
if(param3 & CAST_AURA_NOT_PRESENT)
@ -678,9 +678,9 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u
Creature* pCreature = NULL;
if (param3)
pCreature = m_creature->SummonCreature(param1, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, param3);
pCreature = m_creature->SummonCreature(param1, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, param3);
else
pCreature = m_creature->SummonCreature(param1, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
pCreature = m_creature->SummonCreature(param1, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
if (!pCreature)
{
@ -912,8 +912,8 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u
//if not available, use pActionInvoker
if (Unit* pTarget = GetTargetByType(param2, pActionInvoker))
{
if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
pPlayer->RewardPlayerAndGroupAtEvent(param1, m_creature);
if (Player* pPlayer2 = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
pPlayer2->RewardPlayerAndGroupAtEvent(param1, m_creature);
}
}
}
@ -1118,7 +1118,7 @@ void CreatureEventAI::JustSummoned(Creature* pUnit)
}
}
void CreatureEventAI::Aggro(Unit *who)
void CreatureEventAI::EnterCombat(Unit *enemy)
{
//Check for on combat start events
if (!bEmptyList)
@ -1129,7 +1129,7 @@ void CreatureEventAI::Aggro(Unit *who)
{
case EVENT_T_AGGRO:
(*i).Enabled = true;
ProcessEvent(*i, who);
ProcessEvent(*i, enemy);
break;
//Reset all in combat timers
case EVENT_T_TIMER:
@ -1164,17 +1164,12 @@ void CreatureEventAI::AttackStart(Unit *who)
if (!who)
return;
bool inCombat = m_creature->isInCombat();
if (m_creature->Attack(who, MeleeEnabled))
{
m_creature->AddThreat(who, 0.0f);
m_creature->SetInCombatWith(who);
who->SetInCombatWith(m_creature);
if (!inCombat)
Aggro(who);
if (CombatMovementEnabled)
{
m_creature->GetMotionMaster()->MoveChase(who, AttackDistance, AttackAngle);
@ -1233,8 +1228,8 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
}
else if (m_creature->GetMap()->IsDungeon())
{
who->SetInCombatWith(m_creature);
m_creature->AddThreat(who, 0.0f);
who->SetInCombatWith(m_creature);
}
}
}

View file

@ -257,11 +257,11 @@ class MANGOS_DLL_SPEC CreatureEventAI : public CreatureAI
void JustRespawned();
void Reset();
void JustReachedHome();
void EnterCombat(Unit *enemy);
void EnterEvadeMode();
void JustDied(Unit* killer);
void KilledUnit(Unit* victim);
void JustSummoned(Creature* pUnit);
void Aggro(Unit *who);
void AttackStart(Unit *who);
void MoveInLineOfSight(Unit *who);
void SpellHit(Unit* pUnit, const SpellEntry* pSpell);

View file

@ -457,22 +457,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, temp.action[j].param3);
break;
case ACTION_T_EMOTE:
//TODO: load emotes and check it's store for existing
/*
if (!sEmotesStore.LookupEntry(temp.action[j].param1))
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, temp.action[j].param1);
*/
break;
case ACTION_T_RANDOM_EMOTE:
//TODO: load emotes and check it's store for existing
/*
if (!sEmotesStore.LookupEntry(temp.action[j].param1))
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, temp.action[j].param1);
if (temp.action[j].param2_s >= 0 && !sEmotesStore.LookupEntry(temp.action[j].param2))
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, temp.action[j].param2);
if (temp.action[j].param3_s >= 0 && !sEmotesStore.LookupEntry(temp.action[j].param3))
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, temp.action[j].param3);
*/
break;
case ACTION_T_CAST:
{

View file

@ -32,9 +32,9 @@ class CreatureEventAIMgr
void LoadCreatureEventAI_Summons();
void LoadCreatureEventAI_Scripts();
CreatureEventAI_Event_Map& GetCreatureEventAIMap() { return m_CreatureEventAI_Event_Map; }
CreatureEventAI_Summon_Map& GetCreatureEventAISummonMap() { return m_CreatureEventAI_Summon_Map; }
CreatureEventAI_TextMap& GetCreatureEventAITextMap() { return m_CreatureEventAI_TextMap; }
CreatureEventAI_Event_Map const& GetCreatureEventAIMap() const { return m_CreatureEventAI_Event_Map; }
CreatureEventAI_Summon_Map const& GetCreatureEventAISummonMap() const { return m_CreatureEventAI_Summon_Map; }
CreatureEventAI_TextMap const& GetCreatureEventAITextMap() const { return m_CreatureEventAI_TextMap; }
private:
CreatureEventAI_Event_Map m_CreatureEventAI_Event_Map;

View file

@ -146,8 +146,8 @@ DBCStorage <TotemCategoryEntry> sTotemCategoryStore(TotemCategoryEntryfmt);
DBCStorage <VehicleEntry> sVehicleStore(VehicleEntryfmt);
DBCStorage <VehicleSeatEntry> sVehicleSeatStore(VehicleSeatEntryfmt);
DBCStorage <WorldMapAreaEntry> sWorldMapAreaStore(WorldMapAreaEntryfmt);
DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore(WorldSafeLocsEntryfmt);
DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore(WorldMapOverlayEntryfmt);
DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore(WorldSafeLocsEntryfmt);
typedef std::list<std::string> StoreProblemList;
@ -461,8 +461,8 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleStore, dbcPath,"Vehicle.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleSeatStore, dbcPath,"VehicleSeat.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapAreaStore, dbcPath,"WorldMapArea.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapOverlayStore, dbcPath,"WorldMapOverlay.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc");
// error checks
if(bad_dbc_files.size() >= DBCFilesCount )

View file

@ -142,8 +142,8 @@ extern DBCStorage <TotemCategoryEntry> sTotemCategoryStore;
extern DBCStorage <VehicleEntry> sVehicleStore;
extern DBCStorage <VehicleSeatEntry> sVehicleSeatStore;
//extern DBCStorage <WorldMapAreaEntry> sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates
extern DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore;
extern DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore;
extern DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore;
void LoadDBCStores(const std::string& dataPath);

View file

@ -1650,6 +1650,18 @@ struct WorldMapAreaEntry
// int32 dungeonMap_id; // 9 pointer to DungeonMap.dbc (owerride x1,x2,y1,y2 coordinates)
};
#define MAX_WORLD_MAP_OVERLAY_AREA_IDX 4
struct WorldMapOverlayEntry
{
uint32 ID; // 0
//uint32 worldMapAreaId; // 1 idx in WorldMapArea.dbc
uint32 areatableID[MAX_WORLD_MAP_OVERLAY_AREA_IDX]; // 2-5
// 6-7 always 0, possible part of areatableID[]
//char* internal_name // 8
// 9-16 some ints
};
struct WorldSafeLocsEntry
{
uint32 ID; // 0
@ -1661,12 +1673,6 @@ struct WorldSafeLocsEntry
// 21 name flags, unused
};
struct WorldMapOverlayEntry
{
uint32 ID; // 0
uint32 areatableID[4]; // 2-5
};
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
#if defined( __GNUC__ )
#pragma pack()

View file

@ -101,7 +101,7 @@ const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifixxx";
const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
const char WorldMapAreaEntryfmt[]="xinxffffix";
const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx";
const char WorldMapOverlayEntryfmt[]="nxiiiixxxxxxxxxxx";
const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx";
#endif

View file

@ -683,17 +683,17 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
}
else // If not spawned
{
CreatureData const* data = objmgr.GetCreatureData(itr->first);
if (data && activate)
CreatureData const* data2 = objmgr.GetCreatureData(itr->first);
if (data2 && activate)
{
CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(data->id);
uint32 display_id = objmgr.ChooseDisplayId(0,cinfo,data);
CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(data2->id);
uint32 display_id = objmgr.ChooseDisplayId(0,cinfo,data2);
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
if (minfo)
display_id = minfo->modelid;
if (data->equipmentId == 0)
if (data2->equipmentId == 0)
itr->second.equipement_id_prev = cinfo->equipmentId;
else if (data->equipmentId != -1)
else if (data2->equipmentId != -1)
itr->second.equipement_id_prev = data->equipmentId;
itr->second.modelid_prev = display_id;
}
@ -751,7 +751,7 @@ MANGOS_DLL_SPEC bool IsHolidayActive( HolidayIds id )
GameEventMgr::ActiveEvents const& ae = gameeventmgr.GetActiveEventList();
for(GameEventMgr::ActiveEvents::const_iterator itr = ae.begin(); itr != ae.end(); ++itr)
if(events[id].holiday_id==id)
if(events[*itr].holiday_id==id)
return true;
return false;

View file

@ -89,7 +89,7 @@ void GameObject::RemoveFromWorld()
Object::RemoveFromWorld();
}
bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state)
bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state)
{
Relocate(x,y,z,ang);
SetMapId(map->GetId());
@ -185,7 +185,7 @@ void GameObject::Update(uint32 /*p_time*/)
Unit* caster = GetOwner();
if(caster && caster->GetTypeId()==TYPEID_PLAYER)
{
SetGoState(0);
SetGoState(GO_STATE_ACTIVE);
SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
UpdateData udata;
@ -243,11 +243,11 @@ void GameObject::Update(uint32 /*p_time*/)
case GAMEOBJECT_TYPE_DOOR:
case GAMEOBJECT_TYPE_BUTTON:
//we need to open doors if they are closed (add there another condition if this code breaks some usage, but it need to be here for battlegrounds)
if( !GetGoState() )
SwitchDoorOrButton(false);
if (GetGoState() != GO_STATE_READY)
ResetDoorOrButton();
//flags in AB are type_button and we need to add them here so no break!
default:
if(!m_spawnedByDefault) // despawn timer
if (!m_spawnedByDefault) // despawn timer
{
// can be despawned or destroyed
SetLootState(GO_JUST_DEACTIVATED);
@ -365,11 +365,8 @@ void GameObject::Update(uint32 /*p_time*/)
{
case GAMEOBJECT_TYPE_DOOR:
case GAMEOBJECT_TYPE_BUTTON:
if(GetAutoCloseTime() && (m_cooldownTime < time(NULL)))
{
SwitchDoorOrButton(false);
SetLootState(GO_JUST_DEACTIVATED);
}
if (GetAutoCloseTime() && (m_cooldownTime < time(NULL)))
ResetDoorOrButton();
break;
}
break;
@ -457,7 +454,7 @@ void GameObject::Delete()
{
SendObjectDeSpawnAnim(GetGUID());
SetGoState(1);
SetGoState(GO_STATE_READY);
SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags);
uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), TYPEID_GAMEOBJECT);
@ -542,8 +539,8 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+2) << ", "
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+3) << ", "
<< m_respawnDelayTime << ", "
<< (uint32)GetGoAnimProgress() << ", "
<< (uint32)GetGoState() << ")";
<< uint32(GetGoAnimProgress()) << ", "
<< uint32(GetGoState()) << ")";
WorldDatabase.BeginTransaction();
WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid);
@ -575,7 +572,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
float rotation3 = data->rotation3;
uint32 animprogress = data->animprogress;
uint32 go_state = data->go_state;
GOState go_state = data->go_state;
m_DBTableGuid = guid;
if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT);
@ -810,7 +807,17 @@ GameObject* GameObject::LookupFishingHoleAround(float range)
return ok;
}
void GameObject::UseDoorOrButton(uint32 time_to_restore)
void GameObject::ResetDoorOrButton()
{
if (m_lootState == GO_READY || m_lootState == GO_JUST_DEACTIVATED)
return;
SwitchDoorOrButton(false);
SetLootState(GO_JUST_DEACTIVATED);
m_cooldownTime = 0;
}
void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = false */)
{
if(m_lootState != GO_READY)
return;
@ -818,24 +825,23 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore)
if(!time_to_restore)
time_to_restore = GetAutoCloseTime();
SwitchDoorOrButton(true);
SwitchDoorOrButton(true,alternative);
SetLootState(GO_ACTIVATED);
m_cooldownTime = time(NULL) + time_to_restore;
}
void GameObject::SwitchDoorOrButton(bool activate)
void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false */)
{
if(activate)
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
else
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
if(GetGoState()) //if closed -> open
SetGoState(0);
if(GetGoState() == GO_STATE_READY) //if closed -> open
SetGoState(alternative ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_ACTIVE);
else //if open -> close
SetGoState(1);
SetGoState(GO_STATE_READY);
}
void GameObject::Use(Unit* user)

View file

@ -366,12 +366,29 @@ struct GameObjectInfo
uint32 ScriptId;
};
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
#if defined( __GNUC__ )
#pragma pack()
#else
#pragma pack(pop)
#endif
struct GameObjectLocale
{
std::vector<std::string> Name;
std::vector<std::string> CastBarCaption;
};
// client side GO show states
enum GOState
{
GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open)
GO_STATE_READY = 1, // show in world as ready (closed door close)
GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire)
};
#define MAX_GO_STATE 3
// from `gameobject`
struct GameObjectData
{
@ -388,17 +405,10 @@ struct GameObjectData
float rotation3;
int32 spawntimesecs;
uint32 animprogress;
uint32 go_state;
GOState go_state;
uint8 spawnMask;
};
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
#if defined( __GNUC__ )
#pragma pack()
#else
#pragma pack(pop)
#endif
// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
// For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
@ -425,7 +435,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
void AddToWorld();
void RemoveFromWorld();
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state);
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state);
void Update(uint32 p_time);
GameObjectInfo const* GetGOInfo() const;
@ -456,7 +466,6 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
bool LoadFromDB(uint32 guid, Map *map);
void DeleteFromDB();
void SetLootState(LootState s) { m_lootState = s; }
static uint32 GetLootId(GameObjectInfo const* info);
uint32 GetLootId() const { return GetLootId(GetGOInfo()); }
uint32 GetLockId() const
@ -523,8 +532,8 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
void getFishLoot(Loot *loot, Player* loot_owner);
GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); }
void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); }
uint8 GetGoState() const { return GetByteValue(GAMEOBJECT_BYTES_1, 0); }
void SetGoState(uint8 state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); }
GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); }
void SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); }
uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); }
void SetGoArtKit(uint8 artkit) { SetByteValue(GAMEOBJECT_BYTES_1, 2, artkit); }
uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
@ -533,6 +542,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
void Use(Unit* user);
LootState getLootState() const { return m_lootState; }
void SetLootState(LootState s) { m_lootState = s; }
void AddToSkillupList(uint32 PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
bool IsInSkillupList(uint32 PlayerGuidLow) const
@ -556,7 +566,10 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
bool hasQuest(uint32 quest_id) const;
bool hasInvolvedQuest(uint32 quest_id) const;
bool ActivateToQuest(Player *pTarget) const;
void UseDoorOrButton(uint32 time_to_restore = 0); // 0 = use `gameobject`.`spawntimesecs`
void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false);
// 0 = use `gameobject`.`spawntimesecs`
void ResetDoorOrButton();
// 0 = use `gameobject`.`spawntimesecs`
uint32 GetLinkedGameObjectEntry() const
{
@ -613,7 +626,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
GameObjectInfo const* m_goInfo;
uint64 m_rotation;
private:
void SwitchDoorOrButton(bool activate);
void SwitchDoorOrButton(bool activate, bool alternative = false);
GridReference<GameObject> m_gridRef;
};

View file

@ -70,8 +70,8 @@ Group::~Group()
// will be unloaded first so we must be prepared for both cases
// this may unload some instance saves
for(uint8 i = 0; i < TOTAL_DIFFICULTIES; i++)
for(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
itr->second.save->RemoveGroup(this);
for(BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2)
itr2->second.save->RemoveGroup(this);
// Sub group counters clean up
if (m_subGroupsCounts)

View file

@ -137,11 +137,11 @@ void GuardAI::AttackStart(Unit *u)
// DEBUG_LOG("Creature %s tagged a victim to kill [guid=%u]", i_creature.GetName(), u->GetGUIDLow());
if(m_creature->Attack(u,true))
{
i_victimGuid = u->GetGUID();
m_creature->AddThreat(u, 0.0f);
m_creature->SetInCombatWith(u);
u->SetInCombatWith(m_creature);
m_creature->AddThreat(u, 0.0f);
i_victimGuid = u->GetGUID();
m_creature->GetMotionMaster()->MoveChase(u);
}
}

View file

@ -1193,7 +1193,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
else // swap
{
gDest.clear();
uint8 msg = pGuild->CanStoreItem(BankTabDst,BankTabSlotDst,gDest,pItemSrc->GetCount(),pItemSrc,true);
msg = pGuild->CanStoreItem(BankTabDst,BankTabSlotDst,gDest,pItemSrc->GetCount(),pItemSrc,true);
if( msg != EQUIP_ERR_OK )
{
pl->SendEquipError( msg, pItemSrc, NULL );

View file

@ -52,16 +52,16 @@ InstanceSaveManager::~InstanceSaveManager()
for (InstanceSaveHashMap::iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end(); ++itr)
{
InstanceSave *save = itr->second;
for(InstanceSave::PlayerListType::iterator itr = save->m_playerList.begin(), next = itr; itr != save->m_playerList.end(); itr = next)
for(InstanceSave::PlayerListType::iterator itr2 = save->m_playerList.begin(), next = itr2; itr2 != save->m_playerList.end(); itr2 = next)
{
++next;
(*itr)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true);
(*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true);
}
save->m_playerList.clear();
for(InstanceSave::GroupListType::iterator itr = save->m_groupList.begin(), next = itr; itr != save->m_groupList.end(); itr = next)
for(InstanceSave::GroupListType::iterator itr2 = save->m_groupList.begin(), next = itr2; itr2 != save->m_groupList.end(); itr2 = next)
{
++next;
(*itr)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true);
(*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true);
}
save->m_groupList.clear();
delete save;
@ -550,6 +550,7 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr)
Group *group = *(gList.begin());
group->UnbindInstance(itr->second->GetMapId(), itr->second->GetDifficulty(), true);
}
delete itr->second;
m_instanceSaveById.erase(itr++);
lock_instLists = false;
}
@ -617,10 +618,10 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe
MapInstanced::InstancedMaps::iterator mitr;
for(mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr)
{
Map *map = mitr->second;
if(!map->IsDungeon()) continue;
if(warn) ((InstanceMap*)map)->SendResetWarnings(timeLeft);
else ((InstanceMap*)map)->Reset(INSTANCE_RESET_GLOBAL);
Map *map2 = mitr->second;
if(!map2->IsDungeon()) continue;
if(warn) ((InstanceMap*)map2)->SendResetWarnings(timeLeft);
else ((InstanceMap*)map2)->Reset(INSTANCE_RESET_GLOBAL);
}
// TODO: delete creature/gameobject respawn times even if the maps are not loaded

View file

@ -199,7 +199,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
// check dest->src move possibility
ItemPosCountVec sSrc;
uint16 eSrc;
uint16 eSrc = 0;
if( _player->IsInventoryPos( src ) )
{
msg = _player->CanStoreItem( srcbag, srcslot, sSrc, pDstItem, true );

View file

@ -553,7 +553,7 @@ bool ChatHandler::HandleGameObjectDeleteCommand(const char* args)
if(owner_guid)
{
Unit* owner = ObjectAccessor::GetUnit(*m_session->GetPlayer(),owner_guid);
if(!owner && !IS_PLAYER_GUID(owner_guid))
if(!owner || !IS_PLAYER_GUID(owner_guid))
{
PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(owner_guid), obj->GetGUIDLow());
SetSentErrorMessage(true);
@ -734,7 +734,7 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args)
GameObject* pGameObj = new GameObject;
uint32 db_lowGUID = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT);
if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, 1))
if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
delete pGameObj;
return false;
@ -1369,7 +1369,7 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args)
if(!cId)
return false;
uint32 lowguid = atoi(cId);
lowguid = atoi(cId);
/* FIXME: impossibel without entry
if(lowguid)

View file

@ -3896,6 +3896,124 @@ bool ChatHandler::HandleHoverCommand(const char* args)
return true;
}
void ChatHandler::HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel)
{
if(player)
{
player->GiveLevel(newlevel);
player->InitTalentForLevel();
player->SetUInt32Value(PLAYER_XP,0);
if(needReportToTarget(player))
{
if(oldlevel == newlevel)
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET,GetNameLink().c_str());
else if(oldlevel < newlevel)
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP,GetNameLink().c_str(),newlevel);
else // if(oldlevel > newlevel)
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN,GetNameLink().c_str(),newlevel);
}
}
else
{
// update level and XP at level, all other will be updated at loading
Tokens values;
Player::LoadValuesArrayFromDB(values,player_guid);
Player::SetUInt32ValueInArray(values,UNIT_FIELD_LEVEL,newlevel);
Player::SetUInt32ValueInArray(values,PLAYER_XP,0);
Player::SaveValuesArrayInDB(values,player_guid);
}
}
bool ChatHandler::HandleCharacterLevelCommand(const char* args)
{
char* px = strtok((char*)args, " ");
char* py = strtok((char*)NULL, " ");
// command format parsing
char* pname = (char*)NULL;
int32 newlevel = 0;
if(px && py) // .character level $name #level
{
newlevel = atoi(py);
pname = px;
}
else if(px && !py) // .character level $name OR .character level #level
{
if(isalpha(px[0])) // .character level $name
pname = px;
else // .character level #level
newlevel = atoi(px);
}
// // .character level - progress reset
if(newlevel < 1)
return false; // invalid level
if(newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
newlevel = STRONG_MAX_LEVEL;
// player
Player *chr = NULL;
uint64 chr_guid = 0;
std::string name;
if(pname) // player by name
{
name = extractPlayerNameFromLink(pname);
if(name.empty())
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
chr = objmgr.GetPlayer(name.c_str());
if(!chr) // not in game
{
chr_guid = objmgr.GetPlayerGUIDByName(name);
if (chr_guid == 0)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
}
}
else // player by selection
{
chr = getSelectedPlayer();
if (chr == NULL)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
name = chr->GetName();
}
assert(chr || chr_guid);
int32 oldlevel = chr ? chr->getLevel() : Player::GetUInt32ValueFromDB(UNIT_FIELD_LEVEL,chr_guid);
if(!px && !py) // .character level - progress reset
newlevel = oldlevel;
HandleCharacterLevel(chr,chr_guid,oldlevel,newlevel);
if(m_session && m_session->GetPlayer() != chr) // including player==NULL
{
std::string nameLink = playerLink(name);
PSendSysMessage(LANG_YOU_CHANGE_LVL,nameLink.c_str(),newlevel);
}
return true;
}
bool ChatHandler::HandleLevelUpCommand(const char* args)
{
char* px = strtok((char*)args, " ");
@ -3970,36 +4088,14 @@ bool ChatHandler::HandleLevelUpCommand(const char* args)
if(newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
newlevel = STRONG_MAX_LEVEL;
if(chr)
{
chr->GiveLevel(newlevel);
chr->InitTalentForLevel();
chr->SetUInt32Value(PLAYER_XP,0);
HandleCharacterLevel(chr,chr_guid,oldlevel,newlevel);
if(oldlevel == newlevel)
ChatHandler(chr).SendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET);
else
if(oldlevel < newlevel)
ChatHandler(chr).PSendSysMessage(LANG_YOURS_LEVEL_UP,newlevel-oldlevel);
else
if(oldlevel > newlevel)
ChatHandler(chr).PSendSysMessage(LANG_YOURS_LEVEL_DOWN,newlevel-oldlevel);
}
else
{
// update level and XP at level, all other will be updated at loading
Tokens values;
Player::LoadValuesArrayFromDB(values,chr_guid);
Player::SetUInt32ValueInArray(values,UNIT_FIELD_LEVEL,newlevel);
Player::SetUInt32ValueInArray(values,PLAYER_XP,0);
Player::SaveValuesArrayInDB(values,chr_guid);
}
if(m_session->GetPlayer() != chr) // including chr==NULL
if(m_session && m_session->GetPlayer() != chr) // including chr==NULL
{
std::string nameLink = playerLink(name);
PSendSysMessage(LANG_YOU_CHANGE_LVL,nameLink.c_str(),newlevel);
}
return true;
}

View file

@ -208,7 +208,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save,
}
// some instances only have one difficulty
if(!entry->SupportsHeroicMode()) difficulty = DIFFICULTY_NORMAL;
if (entry && !entry->SupportsHeroicMode()) difficulty = DIFFICULTY_NORMAL;
sLog.outDebug("MapInstanced::CreateInstance: %smap instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal");

View file

@ -1330,7 +1330,10 @@ void WorldSession::HandleReportSpamOpcode( WorldPacket & recv_data )
uint8 spam_type; // 0 - mail, 1 - chat
uint64 spammer_guid;
uint32 unk1, unk2, unk3, unk4 = 0;
uint32 unk1 = 0;
uint32 unk2 = 0;
uint32 unk3 = 0;
uint32 unk4 = 0;
std::string description = "";
recv_data >> spam_type; // unk 0x01 const, may be spam type (mail/chat)
recv_data >> spammer_guid; // player guid

View file

@ -601,12 +601,12 @@ void ObjectMgr::LoadCreatureTemplates()
sLog.outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u)", cInfo->Entry, cInfo->PetSpellDataId);
}
for(int i = 0; i < CREATURE_MAX_SPELLS; ++i)
for(int j = 0; j < CREATURE_MAX_SPELLS; ++j)
{
if(cInfo->spells[i] && !sSpellStore.LookupEntry(cInfo->spells[i]))
if(cInfo->spells[j] && !sSpellStore.LookupEntry(cInfo->spells[j]))
{
sLog.outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0", cInfo->Entry, i+1,cInfo->spells[i]);
const_cast<CreatureInfo*>(cInfo)->spells[i] = 0;
sLog.outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0", cInfo->Entry, j+1,cInfo->spells[j]);
const_cast<CreatureInfo*>(cInfo)->spells[j] = 0;
}
}
@ -1082,7 +1082,15 @@ void ObjectMgr::LoadGameobjects()
data.rotation3 = fields[10].GetFloat();
data.spawntimesecs = fields[11].GetInt32();
data.animprogress = fields[12].GetUInt32();
data.go_state = fields[13].GetUInt32();
uint32 go_state = fields[13].GetUInt32();
if (go_state >= MAX_GO_STATE)
{
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip",guid,data.id,go_state);
continue;
}
data.go_state = GOState(go_state);
data.spawnMask = fields[14].GetUInt8();
data.phaseMask = fields[15].GetUInt16();
int16 gameEvent = fields[16].GetInt16();
@ -2687,15 +2695,15 @@ void ObjectMgr::LoadGroups()
result = CharacterDatabase.Query("SELECT memberGuid, assistant, subgroup, leaderGuid FROM group_member ORDER BY leaderGuid");
if(!result)
{
barGoLink bar( 1 );
bar.step();
barGoLink bar2( 1 );
bar2.step();
}
else
{
barGoLink bar( result->GetRowCount() );
barGoLink bar2( result->GetRowCount() );
do
{
bar.step();
bar2.step();
Field *fields = result->Fetch();
count++;
leaderGuid = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER);
@ -2747,15 +2755,15 @@ void ObjectMgr::LoadGroups()
if(!result)
{
barGoLink bar( 1 );
bar.step();
barGoLink bar2( 1 );
bar2.step();
}
else
{
barGoLink bar( result->GetRowCount() );
barGoLink bar2( result->GetRowCount() );
do
{
bar.step();
bar2.step();
Field *fields = result->Fetch();
count++;
leaderGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
@ -3142,7 +3150,7 @@ void ObjectMgr::LoadQuests()
{
sLog.outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,id);
// no changes, quest can't be done for this requirement
continue;
}
if(!qinfo->ReqCreatureOrGOId[j])

View file

@ -339,10 +339,10 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
delete m_declinedname;
m_declinedname = new DeclinedName;
Field *fields = result->Fetch();
Field *fields2 = result->Fetch();
for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
m_declinedname->name[i] = fields[i].GetCppString();
m_declinedname->name[i] = fields2[i].GetCppString();
}
}
}
@ -1321,19 +1321,19 @@ bool Pet::addSpell(uint32 spell_id, uint16 active, PetSpellState state, PetSpell
}
else if(uint32 chainstart = spellmgr.GetFirstSpellInChain(spell_id))
{
for (PetSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
for (PetSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
{
if(itr->second->state == PETSPELL_REMOVED) continue;
if(itr2->second->state == PETSPELL_REMOVED) continue;
if(spellmgr.GetFirstSpellInChain(itr->first) == chainstart)
if(spellmgr.GetFirstSpellInChain(itr2->first) == chainstart)
{
newspell->active = itr->second->active;
newspell->active = itr2->second->active;
if(newspell->active == ACT_ENABLED)
ToggleAutocast(itr->first, false);
ToggleAutocast(itr2->first, false);
oldspell_id = itr->first;
unlearnSpell(itr->first);
oldspell_id = itr2->first;
unlearnSpell(itr2->first);
break;
}
}

View file

@ -194,10 +194,19 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
//auto turn to target unless possessed
if(result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->HasAuraType(SPELL_AURA_MOD_POSSESS))
{
pet->SetInFront(unit_target);
if( unit_target->GetTypeId() == TYPEID_PLAYER )
pet->SendUpdateToPlayer( (Player*)unit_target );
if(Unit* powner = pet->GetCharmerOrOwner())
if(unit_target)
{
pet->SetInFront(unit_target);
if (unit_target->GetTypeId() == TYPEID_PLAYER)
pet->SendUpdateToPlayer( (Player*)unit_target );
}
else if(Unit *unit_target2 = spell->m_targets.getUnitTarget())
{
pet->SetInFront(unit_target2);
if (unit_target2->GetTypeId() == TYPEID_PLAYER)
pet->SendUpdateToPlayer( (Player*)unit_target2 );
}
if (Unit* powner = pet->GetCharmerOrOwner())
if(powner->GetTypeId() == TYPEID_PLAYER)
pet->SendUpdateToPlayer((Player*)powner);
result = SPELL_CAST_OK;

View file

@ -279,8 +279,8 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
for(uint8 i = 1; i <= signs; i++)
{
Field *fields = result->Fetch();
uint64 plguid = fields[0].GetUInt64();
Field *fields2 = result->Fetch();
uint64 plguid = fields2[0].GetUInt64();
data << plguid; // Player GUID
data << (uint32)0; // there 0 ...
@ -690,8 +690,8 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
for(uint8 i = 1; i <= signs; i++)
{
Field *fields = result->Fetch();
uint64 plguid = fields[0].GetUInt64();
Field *fields2 = result->Fetch();
plguid = fields2[0].GetUInt64();
data << plguid; // Player GUID
data << (uint32)0; // there 0 ...

View file

@ -755,7 +755,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
}
// if this is ammo then use it
uint8 msg = CanUseAmmo( pItem->GetEntry() );
msg = CanUseAmmo( pItem->GetEntry() );
if( msg == EQUIP_ERR_OK )
SetAmmo( pItem->GetEntry() );
}
@ -859,8 +859,8 @@ void Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
DEBUG_LOG("We are fall to death, loosing 10 percents durability");
DurabilityLossAll(0.10f,false);
// durability lost message
WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0);
GetSession()->SendPacket(&data);
WorldPacket data2(SMSG_DURABILITY_DAMAGE_DEATH, 0);
GetSession()->SendPacket(&data2);
}
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM, 1, type);
@ -1130,7 +1130,7 @@ void Player::Update( uint32 p_time )
if (hasUnitState(UNIT_STAT_MELEE_ATTACKING))
{
Unit *pVictim = getVictim();
if( !IsNonMeleeSpellCasted(false) && pVictim)
if (pVictim && !IsNonMeleeSpellCasted(false))
{
// default combat reach 10
// TODO add weapon,skill check
@ -2798,39 +2798,39 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
// replace spells in action bars and spellbook to bigger rank if only one spell rank must be accessible
if(newspell->active && !newspell->disabled && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0)
{
for( PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr )
for( PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2 )
{
if(itr->second->state == PLAYERSPELL_REMOVED) continue;
SpellEntry const *i_spellInfo = sSpellStore.LookupEntry(itr->first);
if(itr2->second->state == PLAYERSPELL_REMOVED) continue;
SpellEntry const *i_spellInfo = sSpellStore.LookupEntry(itr2->first);
if(!i_spellInfo) continue;
if( spellmgr.IsRankSpellDueToSpell(spellInfo,itr->first) )
if( spellmgr.IsRankSpellDueToSpell(spellInfo,itr2->first) )
{
if(itr->second->active)
if(itr2->second->active)
{
if(spellmgr.IsHighRankOfSpell(spell_id,itr->first))
if(spellmgr.IsHighRankOfSpell(spell_id,itr2->first))
{
if(IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
WorldPacket data(SMSG_SUPERCEDED_SPELL, (4));
data << uint32(itr->first);
data << uint32(itr2->first);
data << uint32(spell_id);
GetSession()->SendPacket( &data );
}
// mark old spell as disable (SMSG_SUPERCEDED_SPELL replace it in client by new)
itr->second->active = false;
if(itr->second->state != PLAYERSPELL_NEW)
itr->second->state = PLAYERSPELL_CHANGED;
itr2->second->active = false;
if(itr2->second->state != PLAYERSPELL_NEW)
itr2->second->state = PLAYERSPELL_CHANGED;
superceded_old = true; // new spell replace old in action bars and spell book.
}
else if(spellmgr.IsHighRankOfSpell(itr->first,spell_id))
else if(spellmgr.IsHighRankOfSpell(itr2->first,spell_id))
{
if(IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
WorldPacket data(SMSG_SUPERCEDED_SPELL, (4));
data << uint32(spell_id);
data << uint32(itr->first);
data << uint32(itr2->first);
GetSession()->SendPacket( &data );
}
@ -2943,14 +2943,14 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
SpellLearnSpellMap::const_iterator spell_begin = spellmgr.GetBeginSpellLearnSpell(spell_id);
SpellLearnSpellMap::const_iterator spell_end = spellmgr.GetEndSpellLearnSpell(spell_id);
for(SpellLearnSpellMap::const_iterator itr = spell_begin; itr != spell_end; ++itr)
for(SpellLearnSpellMap::const_iterator itr2 = spell_begin; itr2 != spell_end; ++itr2)
{
if(!itr->second.autoLearned)
if(!itr2->second.autoLearned)
{
if(!IsInWorld() || !itr->second.active) // at spells loading, no output, but allow save
addSpell(itr->second.spell,itr->second.active,true,true,false);
if(!IsInWorld() || !itr2->second.active) // at spells loading, no output, but allow save
addSpell(itr2->second.spell,itr2->second.active,true,true,false);
else // at normal learning
learnSpell(itr->second.spell,true);
learnSpell(itr2->second.spell,true);
}
}
@ -5212,15 +5212,15 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal)
// temporary bonuses
AuraList const& mModSkill = GetAurasByType(SPELL_AURA_MOD_SKILL);
for(AuraList::const_iterator i = mModSkill.begin(); i != mModSkill.end(); ++i)
if ((*i)->GetModifier()->m_miscvalue == int32(id))
(*i)->ApplyModifier(true);
for(AuraList::const_iterator j = mModSkill.begin(); j != mModSkill.end(); ++j)
if ((*j)->GetModifier()->m_miscvalue == int32(id))
(*j)->ApplyModifier(true);
// permanent bonuses
AuraList const& mModSkillTalent = GetAurasByType(SPELL_AURA_MOD_SKILL_TALENT);
for(AuraList::const_iterator i = mModSkillTalent.begin(); i != mModSkillTalent.end(); ++i)
if ((*i)->GetModifier()->m_miscvalue == int32(id))
(*i)->ApplyModifier(true);
for(AuraList::const_iterator j = mModSkillTalent.begin(); j != mModSkillTalent.end(); ++j)
if ((*j)->GetModifier()->m_miscvalue == int32(id))
(*j)->ApplyModifier(true);
// Learn all spells for skill
learnSkillRewardedSpells(id, currVal);
@ -5672,11 +5672,11 @@ void Player::RewardReputation(Unit *pVictim, float rate)
donerep1 = int32(donerep1*rate);
FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(Rep->repfaction1);
uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1);
if(factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1)
if (factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1)
GetReputationMgr().ModifyReputation(factionEntry1, donerep1);
// Wiki: Team factions value divided by 2
if(Rep->is_teamaward1)
if (factionEntry1 && Rep->is_teamaward1)
{
FactionEntry const *team1_factionEntry = sFactionStore.LookupEntry(factionEntry1->team);
if(team1_factionEntry)
@ -5690,11 +5690,11 @@ void Player::RewardReputation(Unit *pVictim, float rate)
donerep2 = int32(donerep2*rate);
FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(Rep->repfaction2);
uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2);
if(factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2)
if (factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2)
GetReputationMgr().ModifyReputation(factionEntry2, donerep2);
// Wiki: Team factions value divided by 2
if(Rep->is_teamaward2)
if (factionEntry2 && Rep->is_teamaward2)
{
FactionEntry const *team2_factionEntry = sFactionStore.LookupEntry(factionEntry2->team);
if(team2_factionEntry)
@ -7070,12 +7070,6 @@ void Player::RemovedInsignia(Player* looterPlr)
looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA);
}
/*Loot type MUST be
1-corpse, go
2-skinning
3-Fishing
*/
void Player::SendLootRelease( uint64 guid )
{
WorldPacket data( SMSG_LOOT_RELEASE_RESPONSE, (8+1) );
@ -7107,18 +7101,18 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
loot = &go->loot;
if(go->getLootState() == GO_READY)
if (go->getLootState() == GO_READY)
{
uint32 lootid = go->GetLootId();
if(lootid)
if (lootid)
{
sLog.outDebug(" if(lootid)");
loot->clear();
loot->FillLoot(lootid, LootTemplates_Gameobject, this, false);
}
if(loot_type == LOOT_FISHING)
if (loot_type == LOOT_FISHING)
go->getFishLoot(loot,this);
go->SetLootState(GO_ACTIVATED);
@ -7134,50 +7128,28 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
return;
}
if(loot_type == LOOT_DISENCHANTING)
loot = &item->loot;
if (!item->m_lootGenerated)
{
loot = &item->loot;
item->m_lootGenerated = true;
loot->clear();
if(!item->m_lootGenerated)
switch(loot_type)
{
item->m_lootGenerated = true;
loot->clear();
loot->FillLoot(item->GetProto()->DisenchantID, LootTemplates_Disenchant, this,true);
}
}
else if(loot_type == LOOT_PROSPECTING)
{
loot = &item->loot;
if(!item->m_lootGenerated)
{
item->m_lootGenerated = true;
loot->clear();
loot->FillLoot(item->GetEntry(), LootTemplates_Prospecting, this,true);
}
}
else if(loot_type == LOOT_MILLING)
{
loot = &item->loot;
if(!item->m_lootGenerated)
{
item->m_lootGenerated = true;
loot->clear();
loot->FillLoot(item->GetEntry(), LootTemplates_Milling, this,true);
}
}
else
{
loot = &item->loot;
if(!item->m_lootGenerated)
{
item->m_lootGenerated = true;
loot->clear();
loot->FillLoot(item->GetEntry(), LootTemplates_Item, this,true);
loot->generateMoneyLoot(item->GetProto()->MinMoneyLoot,item->GetProto()->MaxMoneyLoot);
case LOOT_DISENCHANTING:
loot->FillLoot(item->GetProto()->DisenchantID, LootTemplates_Disenchant, this,true);
break;
case LOOT_PROSPECTING:
loot->FillLoot(item->GetEntry(), LootTemplates_Prospecting, this,true);
break;
case LOOT_MILLING:
loot->FillLoot(item->GetEntry(), LootTemplates_Milling, this,true);
break;
default:
loot->FillLoot(item->GetEntry(), LootTemplates_Item, this,true);
loot->generateMoneyLoot(item->GetProto()->MinMoneyLoot,item->GetProto()->MaxMoneyLoot);
break;
}
}
}
@ -7217,7 +7189,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
return;
}
if(loot_type == LOOT_PICKPOCKETING && IsFriendlyTo(creature))
if (loot_type == LOOT_PICKPOCKETING && IsFriendlyTo(creature))
{
SendLootRelease(guid);
return;
@ -7225,9 +7197,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
loot = &creature->loot;
if(loot_type == LOOT_PICKPOCKETING)
if (loot_type == LOOT_PICKPOCKETING)
{
if ( !creature->lootForPickPocketed )
if (!creature->lootForPickPocketed)
{
creature->lootForPickPocketed = true;
loot->clear();
@ -7257,7 +7229,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
loot->clear();
}
if(!creature->lootForBody)
if (!creature->lootForBody)
{
creature->lootForBody = true;
loot->clear();
@ -7267,7 +7239,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
loot->generateMoneyLoot(creature->GetCreatureInfo()->mingold,creature->GetCreatureInfo()->maxgold);
if(Group* group = recipient->GetGroup())
if (Group* group = recipient->GetGroup())
{
group->UpdateLooterGuid(creature,true);
@ -7300,13 +7272,13 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
{
if(Group* group = GetGroup())
{
if( group == recipient->GetGroup() )
if (group == recipient->GetGroup())
{
if(group->GetLootMethod() == FREE_FOR_ALL)
if (group->GetLootMethod() == FREE_FOR_ALL)
permission = ALL_PERMISSION;
else if(group->GetLooterGuid() == GetGUID())
else if (group->GetLooterGuid() == GetGUID())
{
if(group->GetLootMethod() == MASTER_LOOT)
if (group->GetLootMethod() == MASTER_LOOT)
permission = MASTER_PERMISSION;
else
permission = ALL_PERMISSION;
@ -7317,7 +7289,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
else
permission = NONE_PERMISSION;
}
else if(recipient == this)
else if (recipient == this)
permission = ALL_PERMISSION;
else
permission = NONE_PERMISSION;
@ -7327,12 +7299,13 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
SetLootGUID(guid);
// LOOT_PICKPOCKETING, LOOT_PROSPECTING, LOOT_DISENCHANTING, LOOT_INSIGNIA and LOOT_MILLING unsupported by client, sending LOOT_SKINNING instead
if(loot_type == LOOT_PICKPOCKETING || loot_type == LOOT_DISENCHANTING || loot_type == LOOT_PROSPECTING || loot_type == LOOT_INSIGNIA || loot_type == LOOT_MILLING)
loot_type = LOOT_SKINNING;
if(loot_type == LOOT_FISHINGHOLE)
loot_type = LOOT_FISHING;
// LOOT_INSIGNIA and LOOT_FISHINGHOLE unsupported by client
switch(loot_type)
{
case LOOT_INSIGNIA: loot_type = LOOT_SKINNING; break;
case LOOT_FISHINGHOLE: loot_type = LOOT_FISHING; break;
default: break;
}
WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size
@ -7346,7 +7319,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
if (permission != NONE_PERMISSION)
loot->AddLooter(GetGUID());
if ( loot_type == LOOT_CORPSE && !IS_ITEM_GUID(guid) )
if (loot_type == LOOT_CORPSE && !IS_ITEM_GUID(guid))
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
}
@ -9535,8 +9508,8 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
return EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE;
// if swap ignore item (equipped also)
if(uint8 res = CanEquipUniqueItem(pItem, swap ? eslot : NULL_SLOT))
return res;
if(uint8 res2 = CanEquipUniqueItem(pItem, swap ? eslot : NULL_SLOT))
return res2;
// check unique-equipped special item classes
if (pProto->Class == ITEM_CLASS_QUIVER)
@ -10127,97 +10100,96 @@ Item* Player::EquipNewItem( uint16 pos, uint32 item, bool update )
Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
{
if( pItem )
AddEnchantmentDurations(pItem);
AddItemDurations(pItem);
uint8 bag = pos >> 8;
uint8 slot = pos & 255;
Item *pItem2 = GetItemByPos( bag, slot );
if( !pItem2 )
{
AddEnchantmentDurations(pItem);
AddItemDurations(pItem);
VisualizeItem( slot, pItem);
uint8 bag = pos >> 8;
uint8 slot = pos & 255;
Item *pItem2 = GetItemByPos( bag, slot );
if( !pItem2 )
if(isAlive())
{
VisualizeItem( slot, pItem);
ItemPrototype const *pProto = pItem->GetProto();
if(isAlive())
// item set bonuses applied only at equip and removed at unequip, and still active for broken items
if(pProto && pProto->ItemSet)
AddItemsSetItem(this,pItem);
_ApplyItemMods(pItem, slot, true);
if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0)
{
ItemPrototype const *pProto = pItem->GetProto();
uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s;
// item set bonuses applied only at equip and removed at unequip, and still active for broken items
if(pProto && pProto->ItemSet)
AddItemsSetItem(this,pItem);
if (getClass() == CLASS_ROGUE)
cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s;
_ApplyItemMods(pItem, slot, true);
SpellEntry const* spellProto = sSpellStore.LookupEntry(cooldownSpell);
if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0)
if (!spellProto)
sLog.outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell);
else
{
uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s;
m_weaponChangeTimer = spellProto->StartRecoveryTime;
if (getClass() == CLASS_ROGUE)
cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s;
SpellEntry const* spellProto = sSpellStore.LookupEntry(cooldownSpell);
if (!spellProto)
sLog.outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell);
else
{
m_weaponChangeTimer = spellProto->StartRecoveryTime;
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4);
data << uint64(GetGUID());
data << uint8(1);
data << uint32(cooldownSpell);
data << uint32(0);
GetSession()->SendPacket(&data);
}
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4);
data << uint64(GetGUID());
data << uint8(1);
data << uint32(cooldownSpell);
data << uint32(0);
GetSession()->SendPacket(&data);
}
}
if( IsInWorld() && update )
{
pItem->AddToWorld();
pItem->SendUpdateToPlayer( this );
}
ApplyEquipCooldown(pItem);
if( slot == EQUIPMENT_SLOT_MAINHAND )
UpdateExpertise(BASE_ATTACK);
else if( slot == EQUIPMENT_SLOT_OFFHAND )
UpdateExpertise(OFF_ATTACK);
}
else
if( IsInWorld() && update )
{
pItem2->SetCount( pItem2->GetCount() + pItem->GetCount() );
if( IsInWorld() && update )
pItem2->SendUpdateToPlayer( this );
// delete item (it not in any slot currently)
//pItem->DeleteFromDB();
if( IsInWorld() && update )
{
pItem->RemoveFromWorld();
pItem->DestroyForPlayer( this );
}
RemoveEnchantmentDurations(pItem);
RemoveItemDurations(pItem);
pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor
pItem->SetState(ITEM_REMOVED, this);
pItem2->SetState(ITEM_CHANGED, this);
ApplyEquipCooldown(pItem2);
return pItem2;
pItem->AddToWorld();
pItem->SendUpdateToPlayer( this );
}
ApplyEquipCooldown(pItem);
if( slot == EQUIPMENT_SLOT_MAINHAND )
UpdateExpertise(BASE_ATTACK);
else if( slot == EQUIPMENT_SLOT_OFFHAND )
UpdateExpertise(OFF_ATTACK);
}
else
{
pItem2->SetCount( pItem2->GetCount() + pItem->GetCount() );
if( IsInWorld() && update )
pItem2->SendUpdateToPlayer( this );
// delete item (it not in any slot currently)
//pItem->DeleteFromDB();
if( IsInWorld() && update )
{
pItem->RemoveFromWorld();
pItem->DestroyForPlayer( this );
}
RemoveEnchantmentDurations(pItem);
RemoveItemDurations(pItem);
pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor
pItem->SetState(ITEM_REMOVED, this);
pItem2->SetState(ITEM_CHANGED, this);
ApplyEquipCooldown(pItem2);
return pItem2;
}
// only for full equip instead adding to stack
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
return pItem;
}
@ -10968,7 +10940,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
// check src->dest move possibility
ItemPosCountVec sDest;
uint16 eDest;
uint16 eDest = 0;
if( IsInventoryPos( dst ) )
msg = CanStoreItem( dstbag, dstslot, sDest, pSrcItem, true );
else if( IsBankPos( dst ) )
@ -10988,7 +10960,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
// check dest->src move possibility
ItemPosCountVec sDest2;
uint16 eDest2;
uint16 eDest2 = 0;
if( IsInventoryPos( src ) )
msg = CanStoreItem( srcbag, srcslot, sDest2, pDstItem, true );
else if( IsBankPos( src ) )
@ -12015,14 +11987,14 @@ bool Player::CanAddQuest( Quest const *pQuest, bool msg )
{
uint32 count = pQuest->GetSrcItemCount();
ItemPosCountVec dest;
uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count );
uint8 msg2 = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count );
// player already have max number (in most case 1) source item, no additional item needed and quest can be added.
if( msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS )
if( msg2 == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS )
return true;
else if( msg != EQUIP_ERR_OK )
else if( msg2 != EQUIP_ERR_OK )
{
SendEquipError( msg, NULL, NULL );
SendEquipError( msg2, NULL, NULL );
return false;
}
}
@ -12623,14 +12595,14 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg )
// each-from-all exclusive group ( < 0)
// can be start if only all quests in prev quest exclusive group completed and rewarded
ObjectMgr::ExclusiveQuestGroups::iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup());
ObjectMgr::ExclusiveQuestGroups::iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup());
ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup());
assert(iter!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0
assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0
for(; iter != end; ++iter)
for(; iter2 != end; ++iter2)
{
uint32 exclude_Id = iter->second;
uint32 exclude_Id = iter2->second;
// skip checked quest id, only state of other quests in group is interesting
if(exclude_Id == prevId)
@ -12658,14 +12630,14 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg )
// each-from-all exclusive group ( < 0)
// can be start if only all quests in prev quest exclusive group active
ObjectMgr::ExclusiveQuestGroups::iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup());
ObjectMgr::ExclusiveQuestGroups::iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup());
ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup());
assert(iter!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0
assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0
for(; iter != end; ++iter)
for(; iter2 != end; ++iter2)
{
uint32 exclude_Id = iter->second;
uint32 exclude_Id = iter2->second;
// skip checked quest id, only state of other quests in group is interesting
if(exclude_Id == prevId)
@ -17729,8 +17701,8 @@ void Player::AddComboPoints(Unit* target, int8 count)
else
{
if(m_comboTarget)
if(Unit* target = ObjectAccessor::GetUnit(*this,m_comboTarget))
target->RemoveComboPointHolder(GetGUIDLow());
if(Unit* target2 = ObjectAccessor::GetUnit(*this,m_comboTarget))
target2->RemoveComboPointHolder(GetGUIDLow());
m_comboTarget = target->GetGUID();
m_comboPoints = count;
@ -17853,10 +17825,10 @@ void Player::SendInitialPacketsAfterAddToMap()
// manual send package (have code in ApplyModifier(true,true); that don't must be re-applied.
if(HasAuraType(SPELL_AURA_MOD_ROOT))
{
WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10);
data.append(GetPackGUID());
data << (uint32)2;
SendMessageToSet(&data,true);
WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10);
data2.append(GetPackGUID());
data2 << (uint32)2;
SendMessageToSet(&data2,true);
}
SendAurasForTarget(this);

View file

@ -462,14 +462,16 @@ enum ActivateTaxiReplies
enum LootType
{
LOOT_CORPSE = 1,
LOOT_SKINNING = 2,
LOOT_PICKPOCKETING = 2,
LOOT_FISHING = 3,
LOOT_PICKPOCKETING = 4, // unsupported by client, sending LOOT_SKINNING instead
LOOT_DISENCHANTING = 5, // unsupported by client, sending LOOT_SKINNING instead
LOOT_PROSPECTING = 6, // unsupported by client, sending LOOT_SKINNING instead
LOOT_INSIGNIA = 7, // unsupported by client, sending LOOT_SKINNING instead
LOOT_FISHINGHOLE = 8, // unsupported by client, sending LOOT_FISHING instead
LOOT_MILLING = 9 // unsupported by client, sending LOOT_SKINNING instead
LOOT_DISENCHANTING = 4,
// ignored always by client
LOOT_SKINNING = 6,
LOOT_PROSPECTING = 7,
LOOT_MILLING = 8,
LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead
LOOT_INSIGNIA = 21 // unsupported by client, sending LOOT_CORPSE instead
};
enum MirrorTimerType

View file

@ -356,6 +356,8 @@ std::string PlayerDumpWriter::GetDump(uint32 guid)
}
else
sLog.outError("Table 'character_db_version' not have revision guard field, revision guard query not added to pdump.");
delete result;
}
else
sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump.");

View file

@ -48,11 +48,12 @@ ReactorAI::AttackStart(Unit *p)
if(m_creature->Attack(p,true))
{
DEBUG_LOG("Tag unit GUID: %u (TypeId: %u) as a victim", p->GetGUIDLow(), p->GetTypeId());
i_victimGuid = p->GetGUID();
m_creature->AddThreat(p, 0.0f);
m_creature->SetInCombatWith(p);
p->SetInCombatWith(m_creature);
m_creature->AddThreat(p, 0.0f);
i_victimGuid = p->GetGUID();
m_creature->GetMotionMaster()->MoveChase(p);
}
}

View file

@ -1158,6 +1158,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if(!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI())
((Creature*)unit)->AI()->AttackedBy(m_caster);
unit->AddThreat(m_caster, 0.0f);
unit->SetInCombatWith(m_caster);
m_caster->SetInCombatWith(unit);
@ -1165,7 +1166,6 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
{
m_caster->SetContestedPvP(attackedPlayer);
}
unit->AddThreat(m_caster, 0.0f);
}
}
else

View file

@ -2185,11 +2185,12 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
if( GetId()==24658 )
{
uint32 spellId = 24659;
if (apply)
if (apply && caster)
{
const SpellEntry *spell = sSpellStore.LookupEntry(spellId);
if (!spell)
return;
for (int i=0; i < spell->StackAmount; ++i)
caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID());
return;
@ -2201,7 +2202,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
if( GetId()==24661 )
{
uint32 spellId = 24662;
if (apply)
if (apply && caster)
{
const SpellEntry *spell = sSpellStore.LookupEntry(spellId);
if (!spell)
@ -3411,7 +3412,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
{
GameObject* pObj = new GameObject;
if(pObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 185584, m_target->GetMap(), m_target->GetPhaseMask(),
m_target->GetPositionX(), m_target->GetPositionY(), m_target->GetPositionZ(), m_target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1))
m_target->GetPositionX(), m_target->GetPositionY(), m_target->GetPositionZ(), m_target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
pObj->SetRespawnTime(GetAuraDuration()/IN_MILISECONDS);
pObj->SetSpellId(GetId());
@ -3539,7 +3540,7 @@ void Aura::HandleModStealth(bool apply, bool Real)
else if ((*i)->GetId() == 58426 && GetSpellProto()->SpellFamilyFlags & 0x0000000000400000LL)
{
pTarget->RemoveAurasDueToSpell(58428);
pTarget->CastSpell(m_target, 58427, true);
pTarget->CastSpell(pTarget, 58427, true);
}
}
}
@ -3577,7 +3578,7 @@ void Aura::HandleModStealth(bool apply, bool Real)
pTarget->CastSpell(pTarget,31666,true);
// Overkill
else if ((*i)->GetId() == 58426 && GetSpellProto()->SpellFamilyFlags & 0x0000000000400000LL)
pTarget->CastSpell(m_target, 58428, true);
pTarget->CastSpell(pTarget, 58428, true);
}
}
}

View file

@ -796,7 +796,7 @@ void Spell::EffectDummy(uint32 i)
// create before death for get proper coordinates
if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 179644, map, m_caster->GetPhaseMask(),
creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(),
creatureTarget->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1) )
creatureTarget->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY) )
{
delete pGameObj;
return;
@ -888,7 +888,7 @@ void Spell::EffectDummy(uint32 i)
// return; -- implemented at client side
case 28006: // Arcane Cloaking
{
if( unitTarget->GetTypeId() == TYPEID_PLAYER )
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER )
m_caster->CastSpell(unitTarget,29294,true);
return;
}
@ -1292,7 +1292,7 @@ void Spell::EffectDummy(uint32 i)
}
// Think its not need (also need remove Life Tap from SpellDamageBonus or add new value)
// damage = m_caster->SpellDamageBonus(m_caster, m_spellInfo,uint32(damage > 0 ? damage : 0), SPELL_DIRECT_DAMAGE);
if(int32(unitTarget->GetHealth()) > damage)
if(unitTarget && (int32(unitTarget->GetHealth()) > damage))
{
// Shouldn't Appear in Combat Log
unitTarget->ModifyHealth(-damage);
@ -1681,9 +1681,9 @@ void Spell::EffectDummy(uint32 i)
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
for(int i = BASE_ATTACK; i <= OFF_ATTACK; ++i)
for(int j = BASE_ATTACK; j <= OFF_ATTACK; ++j)
{
if(Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(i)))
if(Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(j)))
{
if(item->IsFitToSpellRequirements(m_spellInfo))
{
@ -1912,7 +1912,7 @@ void Spell::EffectTriggerSpell(uint32 i)
if (!spell)
return;
for (int i=0; i < spell->StackAmount; ++i)
for (int j=0; j < spell->StackAmount; ++j)
m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID);
return;
}
@ -1923,7 +1923,7 @@ void Spell::EffectTriggerSpell(uint32 i)
if (!spell)
return;
for (int i=0; i < spell->StackAmount; ++i)
for (int j=0; j < spell->StackAmount; ++j)
m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID);
return;
}
@ -3044,10 +3044,10 @@ void Spell::EffectSummonChangeItem(uint32 i)
if( !pNewItem )
return;
for(uint8 i= PERM_ENCHANTMENT_SLOT; i<=TEMP_ENCHANTMENT_SLOT; ++i)
for(uint8 j= PERM_ENCHANTMENT_SLOT; j<=TEMP_ENCHANTMENT_SLOT; ++j)
{
if(m_CastItem->GetEnchantmentId(EnchantmentSlot(i)))
pNewItem->SetEnchantment(EnchantmentSlot(i), m_CastItem->GetEnchantmentId(EnchantmentSlot(i)), m_CastItem->GetEnchantmentDuration(EnchantmentSlot(i)), m_CastItem->GetEnchantmentCharges(EnchantmentSlot(i)));
if(m_CastItem->GetEnchantmentId(EnchantmentSlot(j)))
pNewItem->SetEnchantment(EnchantmentSlot(j), m_CastItem->GetEnchantmentId(EnchantmentSlot(j)), m_CastItem->GetEnchantmentDuration(EnchantmentSlot(j)), m_CastItem->GetEnchantmentCharges(EnchantmentSlot(j)));
}
if(m_CastItem->GetUInt32Value(ITEM_FIELD_DURABILITY) < m_CastItem->GetUInt32Value(ITEM_FIELD_MAXDURABILITY))
@ -4251,11 +4251,14 @@ void Spell::EffectLearnPetSpell(uint32 i)
void Spell::EffectTaunt(uint32 /*i*/)
{
if (!unitTarget)
return;
// this effect use before aura Taunt apply for prevent taunt already attacking target
// for spell as marked "non effective at already attacking target"
if(unitTarget && unitTarget->GetTypeId() != TYPEID_PLAYER)
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
{
if(unitTarget->getVictim()==m_caster)
if (unitTarget->getVictim()==m_caster)
{
SendCastResult(SPELL_FAILED_DONT_REPORT);
return;
@ -4263,7 +4266,7 @@ void Spell::EffectTaunt(uint32 /*i*/)
}
// Also use this effect to set the taunter's threat to the taunted creature's highest value
if(unitTarget->CanHaveThreatList() && unitTarget->getThreatManager().getCurrentVictim())
if (unitTarget->CanHaveThreatList() && unitTarget->getThreatManager().getCurrentVictim())
unitTarget->getThreatManager().addThreat(m_caster,unitTarget->getThreatManager().getCurrentVictim()->getThreat());
}
@ -4377,12 +4380,12 @@ void Spell::EffectWeaponDmg(uint32 i)
if(m_spellInfo->SpellFamilyFlags & 0x001000000000LL)
{
Unit::AuraList const& m_OverrideClassScript = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for(Unit::AuraList::const_iterator i = m_OverrideClassScript.begin(); i != m_OverrideClassScript.end(); ++i)
for(Unit::AuraList::const_iterator citr = m_OverrideClassScript.begin(); citr != m_OverrideClassScript.end(); ++citr)
{
// Stormstrike AP Buff
if ( (*i)->GetModifier()->m_miscvalue == 5634 )
if ( (*citr)->GetModifier()->m_miscvalue == 5634 )
{
m_caster->CastSpell(m_caster,38430,true,NULL,*i);
m_caster->CastSpell(m_caster,38430,true,NULL,*citr);
break;
}
}
@ -4561,7 +4564,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
Map *map = target->GetMap();
if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map,
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1))
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
delete pGameObj;
return;
@ -4609,7 +4612,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
{
GameObject* linkedGO = new GameObject;
if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map,
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1))
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
linkedGO->SetSpellId(m_spellInfo->Id);
@ -4832,7 +4835,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
if(!unitTarget)
return;
uint32 spellId;
uint32 spellId = 0;
switch(rand()%4)
{
case 0: spellId = 46740; break;
@ -5263,7 +5266,7 @@ void Spell::EffectDuel(uint32 i)
m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2 ,
m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2 ,
m_caster->GetPositionZ(),
m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, 1))
m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
delete pGameObj;
return;
@ -5653,7 +5656,7 @@ void Spell::EffectSummonObject(uint32 i)
Map *map = m_caster->GetMap();
if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, 1))
m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
delete pGameObj;
return;
@ -6243,7 +6246,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
GameObject* pGameObj = new GameObject;
if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap,
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1))
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
delete pGameObj;
return;
@ -6260,7 +6263,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
// end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo))
// start time == fish-FISHING_BOBBER_READY_TIME (0..GetDuration(m_spellInfo)-FISHING_BOBBER_READY_TIME)
int32 lastSec;
int32 lastSec = 0;
switch(urand(0, 3))
{
case 0: lastSec = 3; break;
@ -6310,7 +6313,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
{
GameObject* linkedGO = new GameObject;
if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap,
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1))
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() );

View file

@ -470,9 +470,9 @@ class PetAura
return itr->second;
else
{
std::map<uint16, uint16>::const_iterator itr = auras.find(0);
if(itr != auras.end())
return itr->second;
std::map<uint16, uint16>::const_iterator itr2 = auras.find(0);
if(itr2 != auras.end())
return itr2->second;
else
return 0;
}
@ -649,9 +649,9 @@ class SpellMgr
// Not found, try lookup for 1 spell rank if exist
if (uint32 rank_1 = GetFirstSpellInChain(spellId))
{
SpellBonusMap::const_iterator itr = mSpellBonusMap.find(rank_1);
if( itr != mSpellBonusMap.end( ) )
return &itr->second;
SpellBonusMap::const_iterator itr2 = mSpellBonusMap.find(rank_1);
if( itr2 != mSpellBonusMap.end( ) )
return &itr2->second;
}
return NULL;
}

View file

@ -172,7 +172,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);
SetGoState(1);
SetGoState(GO_STATE_READY);
SetGoType(GameobjectTypes(goinfo->type));
SetGoAnimProgress(animprogress);

View file

@ -2104,12 +2104,12 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
if(pVictim->GetTypeId()==TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY) )
{
int32 tmp = int32(parry_chance);
if ( (tmp > 0) // check if unit _can_ parry
&& ((tmp -= skillBonus) > 0)
&& (roll < (sum += tmp)))
int32 tmp2 = int32(parry_chance);
if ( (tmp2 > 0) // check if unit _can_ parry
&& ((tmp2 -= skillBonus) > 0)
&& (roll < (sum += tmp2)))
{
DEBUG_LOG ("RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp, sum);
DEBUG_LOG ("RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum);
return MELEE_HIT_PARRY;
}
}
@ -2990,7 +2990,7 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell )
{
assert(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
uint32 CSpellType = pSpell->GetCurrentContainer();
CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
if (pSpell == m_currentSpells[CSpellType]) return; // avoid breaking self
@ -8679,7 +8679,7 @@ void Unit::SetInCombatWith(Unit* enemy)
Unit* eOwner = enemy->GetCharmerOrOwnerOrSelf();
if(eOwner->IsPvP())
{
SetInCombatState(true);
SetInCombatState(true,enemy);
return;
}
@ -8689,14 +8689,14 @@ void Unit::SetInCombatWith(Unit* enemy)
Unit const* myOwner = GetCharmerOrOwnerOrSelf();
if(((Player const*)eOwner)->duel->opponent == myOwner)
{
SetInCombatState(true);
SetInCombatState(true,enemy);
return;
}
}
SetInCombatState(false);
SetInCombatState(false,enemy);
}
void Unit::SetInCombatState(bool PvP)
void Unit::SetInCombatState(bool PvP, Unit* enemy)
{
// only alive units can be in combat
if(!isAlive())
@ -8704,10 +8704,16 @@ void Unit::SetInCombatState(bool PvP)
if(PvP)
m_CombatTimer = 5000;
bool creatureNotInCombat = GetTypeId()==TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
if(isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->isPet()))
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
if(creatureNotInCombat && ((Creature*)this)->AI())
((Creature*)this)->AI()->EnterCombat(enemy);
}
void Unit::ClearInCombat()

View file

@ -1018,7 +1018,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
bool isInFlight() const { return hasUnitState(UNIT_STAT_IN_FLIGHT); }
bool isInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); }
void SetInCombatState(bool PvP);
void SetInCombatState(bool PvP, Unit* enemy = NULL);
void SetInCombatWith(Unit* enemy);
void ClearInCombat();
uint32 GetCombatTimer() const { return m_CombatTimer; }

View file

@ -2002,18 +2002,18 @@ void World::ScriptsProcess()
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, object_checker, *caster->GetMap());
if ( !door )
if (!door)
{
sLog.outError("SCRIPT_COMMAND_OPEN_DOOR failed for gameobject(guid: %u).", step.script->datalong);
break;
}
if ( door->GetGoType() != GAMEOBJECT_TYPE_DOOR )
if (door->GetGoType() != GAMEOBJECT_TYPE_DOOR)
{
sLog.outError("SCRIPT_COMMAND_OPEN_DOOR failed for non-door(GoType: %u).", door->GetGoType());
break;
}
if( !door->GetGoState() )
if (door->GetGoState() != GO_STATE_READY)
break; //door already open
door->UseDoorOrButton(time_to_close);
@ -2069,7 +2069,7 @@ void World::ScriptsProcess()
break;
}
if( door->GetGoState() )
if( door->GetGoState() == GO_STATE_READY )
break; //door already closed
door->UseDoorOrButton(time_to_open);

View file

@ -395,9 +395,9 @@ bool ChatHandler::HandleDebugGetItemState(const char* args)
Bag *bag = (Bag*)item;
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
{
Item* item = bag->GetItemByPos(j);
if (item && item->GetState() == state)
PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()));
Item* item2 = bag->GetItemByPos(j);
if (item2 && item2->GetState() == state)
PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()));
}
}
}
@ -491,58 +491,58 @@ bool ChatHandler::HandleDebugGetItemState(const char* args)
Bag *bag = (Bag*)item;
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
{
Item* item = bag->GetItemByPos(j);
if (!item) continue;
Item* item2 = bag->GetItemByPos(j);
if (!item2) continue;
if (item->GetSlot() != j)
if (item2->GetSlot() != j)
{
PSendSysMessage("the item in bag %d slot %d, guid %d has an incorrect slot value: %d", bag->GetSlot(), j, item->GetGUIDLow(), item->GetSlot());
PSendSysMessage("the item in bag %d slot %d, guid %d has an incorrect slot value: %d", bag->GetSlot(), j, item2->GetGUIDLow(), item2->GetSlot());
error = true; continue;
}
if (item->GetOwnerGUID() != player->GetGUID())
if (item2->GetOwnerGUID() != player->GetGUID())
{
PSendSysMessage("for the item in bag %d at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow());
PSendSysMessage("for the item in bag %d at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()), player->GetGUIDLow());
error = true; continue;
}
Bag *container = item->GetContainer();
Bag *container = item2->GetContainer();
if (!container)
{
PSendSysMessage("the item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow());
PSendSysMessage("the item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow());
error = true; continue;
}
if (container != bag)
{
PSendSysMessage("the item in bag %d at slot %d with guid %d has a different container(slot %d guid %d)!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow());
PSendSysMessage("the item in bag %d at slot %d with guid %d has a different container(slot %d guid %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow());
error = true; continue;
}
if (item->IsInUpdateQueue())
if (item2->IsInUpdateQueue())
{
uint16 qp = item->GetQueuePos();
uint16 qp = item2->GetQueuePos();
if (qp > updateQueue.size())
{
PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp);
PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp);
error = true; continue;
}
if (updateQueue[qp] == NULL)
{
PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp);
PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp);
error = true; continue;
}
if (updateQueue[qp] != item)
if (updateQueue[qp] != item2)
{
PSendSysMessage("item in bag: %d at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow());
PSendSysMessage("item in bag: %d at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow());
error = true; continue;
}
}
else if (item->GetState() != ITEM_UNCHANGED)
else if (item2->GetState() != ITEM_UNCHANGED)
{
PSendSysMessage("item in bag: %d at slot: %d guid: %d is not in queue but should be (state: %d)!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), item->GetState());
PSendSysMessage("item in bag: %d at slot: %d guid: %d is not in queue but should be (state: %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), item2->GetState());
error = true; continue;
}
}

View file

@ -129,10 +129,10 @@ bool WinServiceUninstall()
serviceName, SERVICE_QUERY_STATUS | DELETE);
if (service)
{
SERVICE_STATUS serviceStatus;
if (QueryServiceStatus(service, &serviceStatus))
SERVICE_STATUS serviceStatus2;
if (QueryServiceStatus(service, &serviceStatus2))
{
if (serviceStatus.dwCurrentState == SERVICE_STOPPED)
if (serviceStatus2.dwCurrentState == SERVICE_STOPPED)
DeleteService(service);
}
CloseServiceHandle(service);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7713"
#define REVISION_NR "7728"
#endif // __REVISION_NR_H__