diff --git a/sql/mangos.sql b/sql/mangos.sql index 5e68dd49f..07f85514e 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_8693_01_mangos_spell_proc_event` bit(1) default NULL + `required_8720_01_mangos_quest_template` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -13677,10 +13677,14 @@ CREATE TABLE `quest_template` ( `RewItemId2` mediumint(8) unsigned NOT NULL default '0', `RewItemId3` mediumint(8) unsigned NOT NULL default '0', `RewItemId4` mediumint(8) unsigned NOT NULL default '0', + `ReqItemId5` mediumint(8) unsigned NOT NULL default '0', + `ReqItemId6` mediumint(8) unsigned NOT NULL default '0', `RewItemCount1` smallint(5) unsigned NOT NULL default '0', `RewItemCount2` smallint(5) unsigned NOT NULL default '0', `RewItemCount3` smallint(5) unsigned NOT NULL default '0', `RewItemCount4` smallint(5) unsigned NOT NULL default '0', + `ReqItemCount5` smallint(5) unsigned NOT NULL default '0', + `ReqItemCount6` smallint(5) unsigned NOT NULL default '0', `RewRepFaction1` smallint(5) unsigned NOT NULL default '0' COMMENT 'faction id from Faction.dbc in this case', `RewRepFaction2` smallint(5) unsigned NOT NULL default '0' COMMENT 'faction id from Faction.dbc in this case', `RewRepFaction3` smallint(5) unsigned NOT NULL default '0' COMMENT 'faction id from Faction.dbc in this case', diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index 3bcb54084..1dae67688 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -345,7 +345,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas /*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */ ( 0, 3,0x0000000020000000,0x00000000, -1, -1, -1, 2, -1,-1,'Arcane Blast', 'Spell::EffectSchoolDMG'), ( 0, 9,0x0000000000000800,0x00000000, -1, -1, -1, 2, -1,-1,'Arcane Shot', 'Spell::EffectSchoolDMG'), -( 0, 5,0x0000000000004000,0x00000000, -1, -1, -1, -1, -1,-1,'Drain Soul', 'Aura::HandlePeriodicDamage'), +( 0, 5,0x0000000000004000,0x00000000, -1, -1, -1, -1, -1,-1,'Drain Soul', 'Unit::SpellDamageBonus'), ( 0,10,0x0000000000004000,0x00000000, -1, -1, -1, 2, -1,-1,'Avenger\'s Shield', 'Spell::EffectSchoolDMG'), ( 0, 4,0x0000040000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Bloodthirst', 'Spell::EffectSchoolDMG'), (0, 4,0x0000000000000001,0x00000000, -1, 867, -1, 3, -1,-1,'Charge', 'Spell::EffectDummy'), diff --git a/sql/updates/8720_01_mangos_quest_template.sql b/sql/updates/8720_01_mangos_quest_template.sql new file mode 100644 index 000000000..9cc1c99e3 --- /dev/null +++ b/sql/updates/8720_01_mangos_quest_template.sql @@ -0,0 +1,7 @@ +ALTER TABLE db_version CHANGE COLUMN required_8693_01_mangos_spell_proc_event required_8720_01_mangos_quest_template bit; + +alter table `quest_template` + add column `ReqItemId5` mediumint(8) UNSIGNED DEFAULT '0' NOT NULL after `ReqItemId4`, + add column `ReqItemId6` mediumint(8) UNSIGNED DEFAULT '0' NOT NULL after `ReqItemId5`, + add column `ReqItemCount5` smallint(5) UNSIGNED DEFAULT '0' NOT NULL after `ReqItemCount4`, + add column `ReqItemCount6` smallint(5) UNSIGNED DEFAULT '0' NOT NULL after `ReqItemCount5`; diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 800b9a85e..03c547e6d 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -139,6 +139,7 @@ pkgdata_DATA = \ 8688_01_mangos_creature_template.sql \ 8693_01_mangos_spell_proc_event.sql \ 8702_01_characters_character_reputation.sql \ + 8720_01_mangos_quest_template.sql \ README ## Additional files to include when running 'make dist' @@ -258,4 +259,5 @@ EXTRA_DIST = \ 8688_01_mangos_creature_template.sql \ 8693_01_mangos_spell_proc_event.sql \ 8702_01_characters_character_reputation.sql \ + 8720_01_mangos_quest_template.sql \ README diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp index 0e95766b7..1bb61b006 100644 --- a/src/game/AccountMgr.cpp +++ b/src/game/AccountMgr.cpp @@ -71,13 +71,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid) uint64 guid = MAKE_NEW_GUID(guidlo, 0, HIGHGUID_PLAYER); // kick if player currently - if(Player* p = ObjectAccessor::GetObjectInWorld(guid, (Player*)NULL)) - { - WorldSession* s = p->GetSession(); - s->KickPlayer(); // mark session to remove at next session list update - s->LogoutPlayer(false); // logout player without waiting next session list update - } - + ObjectAccessor::KickPlayer(guid); Player::DeleteFromDB(guid, accid, false); // no need to update realm characters } while (result->NextRow()); diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index 8a7ed49e8..42a44b984 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -457,7 +457,7 @@ void BattleGroundAB::Reset() //call parent's class reset BattleGround::Reset(); - for (uint8 i = 0; i <= BG_TEAMS_COUNT; ++i) + for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) { m_TeamScores[i] = 0; m_lastTick[i] = 0; diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index 17f76c74d..166bc34ce 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -126,7 +126,7 @@ void Corpse::SaveToDB() void Corpse::DeleteBonesFromWorld() { assert(GetType() == CORPSE_BONES); - Corpse* corpse = ObjectAccessor::GetCorpse(*this, GetGUID()); + Corpse* corpse = GetMap()->GetCorpse(GetGUID()); if (!corpse) { diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 99b77722f..140aa7880 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -603,7 +603,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) { objmgr.RemoveCreatureFromGrid(*itr, data); - if( Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL) ) + if( Creature* pCreature = ObjectAccessor::GetCreatureInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT)) ) pCreature->AddObjectToRemoveList(); } } @@ -621,7 +621,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) { objmgr.RemoveGameobjectFromGrid(*itr, data); - if( GameObject* pGameobject = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL) ) + if( GameObject* pGameobject = ObjectAccessor::Instance().GetGameObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT)) ) pGameobject->AddObjectToRemoveList(); } } @@ -647,7 +647,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) continue; // Update if spawned - Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id,HIGHGUID_UNIT), (Creature*)NULL); + Creature* pCreature = ObjectAccessor::GetCreatureInWorld(MAKE_NEW_GUID(itr->first, data->id,HIGHGUID_UNIT)); if (pCreature) { if (activate) diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp index 5ff6d5d79..858abdd18 100644 --- a/src/game/GridNotifiers.cpp +++ b/src/game/GridNotifiers.cpp @@ -129,7 +129,7 @@ VisibleNotifier::Notify() if(!IS_PLAYER_GUID(*iter)) continue; - if (Player* plr = ObjectAccessor::GetPlayer(i_player,*iter)) + if (Player* plr = ObjectAccessor::FindPlayer(*iter)) plr->UpdateVisibilityOf(plr->GetViewPoint(),&i_player); } } diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index ec9706652..1e09d4b61 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -5960,8 +5960,11 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char* args) uint32 mapid = 0; bool got_map = false; - if (args != "all") + if (strncmp(args,"all",strlen(args)) != 0) { + if(!isNumeric(args[0])) + return false; + got_map = true; mapid = atoi(args); } diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 14dead0a4..f607775f1 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -67,7 +67,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data ) } else if (IS_CORPSE_GUID(lguid)) { - Corpse *bones = ObjectAccessor::GetCorpse(*player, lguid); + Corpse *bones = player->GetMap()->GetCorpse(lguid); if (!bones) { player->SendLootRelease(lguid); @@ -180,7 +180,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ ) } case HIGHGUID_CORPSE: // remove insignia ONLY in BG { - Corpse *bones = ObjectAccessor::GetCorpse(*GetPlayer(), guid); + Corpse *bones = _player->GetMap()->GetCorpse(guid); if (bones && bones->IsWithinDistInMap(_player,INTERACTION_DISTANCE) ) pLoot = &bones->loot; @@ -367,7 +367,7 @@ void WorldSession::DoLootRelease( uint64 lguid ) } else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG { - Corpse *corpse = ObjectAccessor::GetCorpse(*player, lguid); + Corpse *corpse = _player->GetMap()->GetCorpse(lguid); if (!corpse || !corpse->IsWithinDistInMap(_player,INTERACTION_DISTANCE) ) return; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 83c3143e2..c8ecdcf0c 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -203,7 +203,7 @@ Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _par m_activeNonPlayersIter(m_activeNonPlayers.end()), i_gridExpiry(expiry), m_parentMap(_parent ? _parent : this), m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE), - m_hiDynObjectGuid(1), m_hiVehicleGuid(1) + m_hiDynObjectGuid(1), m_hiPetGuid(1), m_hiVehicleGuid(1) { for(unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx) { @@ -776,8 +776,8 @@ bool Map::RemoveBones(uint64 guid, float x, float y) { if (IsRemovalGrid(x, y)) { - Corpse* corpse = ObjectAccessor::GetObjectInWorld(guid, (Corpse*)NULL); - if(!corpse || corpse->GetMapId() != GetId()) + Corpse* corpse = ObjectAccessor::GetCorpseInMap(guid,GetId()); + if (!corpse) return false; CellPair p = MaNGOS::ComputeCellPair(x,y); @@ -2146,28 +2146,29 @@ void Map::RemoveAllObjectsInRemoveList() { case TYPEID_CORPSE: { - Corpse* corpse = ObjectAccessor::Instance().GetCorpse(*obj, obj->GetGUID()); + // ??? WTF + Corpse* corpse = GetCorpse(obj->GetGUID()); if (!corpse) sLog.outError("Try delete corpse/bones %u that not in map", obj->GetGUIDLow()); else Remove(corpse,true); break; } - case TYPEID_DYNAMICOBJECT: - Remove((DynamicObject*)obj,true); - break; - case TYPEID_GAMEOBJECT: - Remove((GameObject*)obj,true); - break; - case TYPEID_UNIT: - // in case triggered sequence some spell can continue casting after prev CleanupsBeforeDelete call - // make sure that like sources auras/etc removed before destructor start - ((Creature*)obj)->CleanupsBeforeDelete (); - Remove((Creature*)obj,true); - break; - default: - sLog.outError("Non-grid object (TypeId: %u) in grid object removing list, ignored.",obj->GetTypeId()); - break; + case TYPEID_DYNAMICOBJECT: + Remove((DynamicObject*)obj,true); + break; + case TYPEID_GAMEOBJECT: + Remove((GameObject*)obj,true); + break; + case TYPEID_UNIT: + // in case triggered sequence some spell can continue casting after prev CleanupsBeforeDelete call + // make sure that like sources auras/etc removed before destructor start + ((Creature*)obj)->CleanupsBeforeDelete (); + Remove((Creature*)obj,true); + break; + default: + sLog.outError("Non-grid object (TypeId: %u) in grid object removing list, ignored.",obj->GetTypeId()); + break; } } //sLog.outDebug("Object remover 2 check."); @@ -3425,6 +3426,16 @@ Pet* Map::GetPet(uint64 guid) return m_objectsStore.find(guid, (Pet*)NULL); } +Corpse* Map::GetCorpse(uint64 guid) +{ + Corpse * ret = ObjectAccessor::GetCorpseInMap(guid,GetId()); + if (!ret) + return NULL; + if (ret->GetInstanceId() != GetInstanceId()) + return NULL; + return ret; +} + Creature* Map::GetCreatureOrPetOrVehicle(uint64 guid) { if (IS_PLAYER_GUID(guid)) @@ -3449,6 +3460,25 @@ DynamicObject* Map::GetDynamicObject(uint64 guid) return m_objectsStore.find(guid, (DynamicObject*)NULL); } +WorldObject* Map::GetWorldObject(uint64 guid) +{ + switch(GUID_HIPART(guid)) + { + case HIGHGUID_PLAYER: return ObjectAccessor::FindPlayer(guid); + case HIGHGUID_GAMEOBJECT: return GetGameObject(guid); + case HIGHGUID_UNIT: return GetCreature(guid); + case HIGHGUID_PET: return GetPet(guid); + case HIGHGUID_VEHICLE: return GetVehicle(guid); + case HIGHGUID_DYNAMICOBJECT:return GetDynamicObject(guid); + case HIGHGUID_CORPSE: return GetCorpse(guid); + case HIGHGUID_MO_TRANSPORT: + case HIGHGUID_TRANSPORT: + default: break; + } + + return NULL; +} + void Map::SendObjectUpdates() { UpdateDataMapType update_players; @@ -3483,6 +3513,13 @@ uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh) World::StopNow(ERROR_EXIT_CODE); } return m_hiDynObjectGuid++; + case HIGHGUID_PET: + if(m_hiPetGuid>=0x00FFFFFE) + { + sLog.outError("Pet guid overflow!! Can't continue, shutting down server. "); + World::StopNow(ERROR_EXIT_CODE); + } + return m_hiPetGuid++; case HIGHGUID_VEHICLE: if(m_hiVehicleGuid>=0x00FFFFFF) { diff --git a/src/game/Map.h b/src/game/Map.h index d6fb2d5a8..569231368 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -433,6 +433,8 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj Creature* GetCreatureOrPetOrVehicle(uint64 guid); GameObject* GetGameObject(uint64 guid); DynamicObject* GetDynamicObject(uint64 guid); + Corpse* GetCorpse(uint64 guid); + WorldObject* GetWorldObject(uint64 guid); TypeUnorderedMapContainer& GetObjectsStore() { return m_objectsStore; } @@ -532,6 +534,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj // Map local low guid counters uint32 m_hiDynObjectGuid; + uint32 m_hiPetGuid; uint32 m_hiVehicleGuid; // Type specific code for add/remove to/from grid diff --git a/src/game/Object.cpp b/src/game/Object.cpp index ea14e7545..491c8f958 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -79,14 +79,21 @@ Object::Object( ) : m_PackGUID(sizeof(uint64)+1) Object::~Object( ) { + if(IsInWorld()) + { + ///- Do NOT call RemoveFromWorld here, if the object is a player it will crash + sLog.outError("Object::~Object (GUID: %u TypeId: %u) deleted but still in world!!", GetGUIDLow(), GetTypeId()); + ASSERT(false); + } + + if(m_objectUpdated) + { + sLog.outError("Object::~Object (GUID: %u TypeId: %u) deleted but still have updated status!!", GetGUIDLow(), GetTypeId()); + ASSERT(false); + } + if(m_uint32Values) { - if(IsInWorld()) - { - ///- Do NOT call RemoveFromWorld here, if the object is a player it will crash - sLog.outError("Object::~Object (GUID: %u TypeId: %u) deleted but still in world!!", GetGUIDLow(), GetTypeId()); - //assert(0); - } //DEBUG_LOG("Object desctr 1 check (%p)",(void*)this); delete [] m_uint32Values; @@ -735,10 +742,13 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * void Object::ClearUpdateMask(bool remove) { - for( uint16 index = 0; index < m_valuesCount; ++index ) + if(m_uint32Values) { - if(m_uint32Values_mirror[index]!= m_uint32Values[index]) - m_uint32Values_mirror[index] = m_uint32Values[index]; + for( uint16 index = 0; index < m_valuesCount; ++index ) + { + if(m_uint32Values_mirror[index]!= m_uint32Values[index]) + m_uint32Values_mirror[index] = m_uint32Values[index]; + } } if(m_objectUpdated) diff --git a/src/game/Object.h b/src/game/Object.h index 67a183ad9..4707f4717 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -129,8 +129,7 @@ class MANGOS_DLL_SPEC Object virtual void RemoveFromWorld() { // if we remove from world then sending changes not required - if(m_uint32Values) - ClearUpdateMask(true); + ClearUpdateMask(true); m_inWorld = false; } diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 3959d4afb..9e7789e20 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -65,38 +65,17 @@ ObjectAccessor::GetUnit(WorldObject const &u, uint64 guid) return u.GetMap()->GetCreatureOrPetOrVehicle(guid); } -Corpse* -ObjectAccessor::GetCorpse(WorldObject const &u, uint64 guid) +Corpse* ObjectAccessor::GetCorpseInMap( uint64 guid, uint32 mapid ) { - Corpse * ret = GetObjectInWorld(guid, (Corpse*)NULL); + Corpse * ret = HashMapHolder::Find(guid); if(!ret) return NULL; - if(ret->GetMapId() != u.GetMapId()) - return NULL; - if(ret->GetInstanceId() != u.GetInstanceId()) + if(ret->GetMapId() != mapid) return NULL; + return ret; } -WorldObject* ObjectAccessor::GetWorldObject(WorldObject const &p, uint64 guid) -{ - switch(GUID_HIPART(guid)) - { - case HIGHGUID_PLAYER: return FindPlayer(guid); - case HIGHGUID_GAMEOBJECT: return p.GetMap()->GetGameObject(guid); - case HIGHGUID_UNIT: return p.GetMap()->GetCreature(guid); - case HIGHGUID_PET: return p.GetMap()->GetPet(guid); - case HIGHGUID_VEHICLE: return p.GetMap()->GetVehicle(guid); - case HIGHGUID_DYNAMICOBJECT:return p.GetMap()->GetDynamicObject(guid); - case HIGHGUID_TRANSPORT: return NULL; - case HIGHGUID_CORPSE: return GetCorpse(p,guid); - case HIGHGUID_MO_TRANSPORT: return NULL; - default: break; - } - - return NULL; -} - Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, uint32 typemask) { switch(GUID_HIPART(guid)) @@ -141,7 +120,7 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, u Player* ObjectAccessor::FindPlayer(uint64 guid) { - Player * plr = GetObjectInWorld(guid, (Player*)NULL); + Player * plr = HashMapHolder::Find(guid);; if(!plr || !plr->IsInWorld()) return NULL; @@ -170,6 +149,16 @@ ObjectAccessor::SaveAllPlayers() itr->second->SaveToDB(); } +void ObjectAccessor::KickPlayer(uint64 guid) +{ + if (Player* p = HashMapHolder::Find(guid)) + { + WorldSession* s = p->GetSession(); + s->KickPlayer(); // mark session to remove at next session list update + s->LogoutPlayer(false); // logout player without waiting next session list update + } +} + Corpse* ObjectAccessor::GetCorpseForPlayerGUID(uint64 guid) { diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 931610226..9c58222f4 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -88,46 +88,43 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton Player2CorpsesMapType; - // global - static Player* GetObjectInWorld(uint64 guid, Player* /*fake*/) { return HashMapHolder::Find(guid); } - static Corpse* GetObjectInWorld(uint64 guid, Corpse* /*fake*/) { return HashMapHolder::Find(guid); } - static Unit* GetObjectInWorld(uint64 guid, Unit* /*fake*/); + // global (obj used for map only location local guid objects (pets currently) + static Unit* GetUnitInWorld(WorldObject const& obj, uint64 guid); - // map local object with global search - static Creature* GetObjectInWorld(uint64 guid, Creature* /*fake*/) { return FindHelper(guid); } - static GameObject* GetObjectInWorld(uint64 guid, GameObject* /*fake*/) { return FindHelper(guid); } - static Pet* GetObjectInWorld(uint64 guid, Pet* /*fake*/) { return FindHelper(guid); } - static Vehicle* GetObjectInWorld(uint64 guid, Vehicle* /*fake*/); // no implementation, link error trap until creature move to Map + // FIXME: map local object with global search + static Creature* GetCreatureInWorld(uint64 guid) { return FindHelper(guid); } + static GameObject* GetGameObjectInWorld(uint64 guid) { return FindHelper(guid); } - static WorldObject* GetWorldObject(WorldObject const &, uint64); - static Object* GetObjectByTypeMask(WorldObject const &, uint64, uint32 typemask); + // possible local search for specific object map + static Object* GetObjectByTypeMask(WorldObject const &, uint64, uint32 typemask); static Unit* GetUnit(WorldObject const &, uint64); - static Player* GetPlayer(Unit const &, uint64 guid) { return FindPlayer(guid); } - static Corpse* GetCorpse(WorldObject const &u, uint64 guid); - static Pet* GetPet(uint64 guid) { return GetObjectInWorld(guid, (Pet*)NULL); } - static Player* FindPlayer(uint64); - Player* FindPlayerByName(const char *name) ; + // Player access + static Player* FindPlayer(uint64 guid); + static Player* FindPlayerByName(const char *name); + static void KickPlayer(uint64 guid); HashMapHolder::MapType& GetPlayers() { return HashMapHolder::GetContainer(); } + void SaveAllPlayers(); + + // Corpse access + Corpse* GetCorpseForPlayerGUID(uint64 guid); + static Corpse* GetCorpseInMap(uint64 guid, uint32 mapid); + void RemoveCorpse(Corpse *corpse); + void AddCorpse(Corpse* corpse); + void AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* map); + Corpse* ConvertCorpseForPlayer(uint64 player_guid, bool insignia = false); + // For call from Player/Corpse AddToWorld/RemoveFromWorld only void AddObject(Corpse *object) { HashMapHolder::Insert(object); } void AddObject(Player *object) { HashMapHolder::Insert(object); } void RemoveObject(Corpse *object) { HashMapHolder::Remove(object); } void RemoveObject(Player *object) { HashMapHolder::Remove(object); } - void SaveAllPlayers(); - - Corpse* GetCorpseForPlayerGUID(uint64 guid); - void RemoveCorpse(Corpse *corpse); - void AddCorpse(Corpse* corpse); - void AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* map); - Corpse* ConvertCorpseForPlayer(uint64 player_guid, bool insignia = false); - // TODO: This methods will need lock in MT environment static void LinkMap(Map* map) { i_mapList.push_back(map); } static void DelinkMap(Map* map) { i_mapList.remove(map); } @@ -159,24 +156,18 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton::Find(guid); - if(!u || !u->IsInWorld()) - return NULL; - - return u; - } + return FindPlayer(guid); if (IS_PET_GUID(guid)) - return GetObjectInWorld(guid, (Pet*)NULL); + return obj.IsInWorld() ? obj.GetMap()->GetPet(guid) : NULL; - return GetObjectInWorld(guid, (Creature*)NULL); + return GetCreatureInWorld(guid); } #endif diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 9a7ba0cd8..edfca2b95 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -129,7 +129,6 @@ ObjectMgr::ObjectMgr() { m_hiCharGuid = 1; m_hiCreatureGuid = 1; - m_hiPetGuid = 1; m_hiItemGuid = 1; m_hiGoGuid = 1; m_hiCorpseGuid = 1; @@ -5677,13 +5676,6 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) World::StopNow(ERROR_EXIT_CODE); } return m_hiCreatureGuid++; - case HIGHGUID_PET: - if(m_hiPetGuid>=0x00FFFFFE) - { - sLog.outError("Pet guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } - return m_hiPetGuid++; case HIGHGUID_PLAYER: if(m_hiCharGuid>=0xFFFFFFFE) { diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index f1c69b261..c58f196ec 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -787,7 +787,6 @@ class ObjectMgr // first free low guid for seelcted guid type uint32 m_hiCharGuid; uint32 m_hiCreatureGuid; - uint32 m_hiPetGuid; uint32 m_hiItemGuid; uint32 m_hiGoGuid; uint32 m_hiCorpseGuid; diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 97bb876c3..994d7ae83 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -156,7 +156,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool } Map *map = owner->GetMap(); - uint32 guid = objmgr.GenerateLowGuid(HIGHGUID_PET); + uint32 guid = map->GenerateLocalLowGuid(HIGHGUID_PET); if (!Create(guid, map, owner->GetPhaseMask(), petentry, pet_number)) { delete result; @@ -743,7 +743,8 @@ bool Pet::CreateBaseAtCreature(Creature* creature) sLog.outError("CRITICAL: NULL pointer parsed into CreateBaseAtCreature()"); return false; } - uint32 guid=objmgr.GenerateLowGuid(HIGHGUID_PET); + + uint32 guid = creature->GetMap()->GenerateLocalLowGuid(HIGHGUID_PET); sLog.outBasic("Create pet"); uint32 pet_number = objmgr.GeneratePetNumber(); diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 83741cfec..057dbc077 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -380,9 +380,9 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data ) recv_data >> name; recv_data >> isdeclined; - Pet* pet = ObjectAccessor::GetPet(petguid); + Pet* pet = _player->GetMap()->GetPet(petguid); // check it! - if( !pet || !pet->isPet() || ((Pet*)pet)->getPetType()!= HUNTER_PET || + if( !pet || pet->getPetType() != HUNTER_PET || pet->GetByteValue(UNIT_FIELD_BYTES_2, 2) != UNIT_RENAME_ALLOWED || pet->GetOwnerGUID() != _player->GetGUID() || !pet->GetCharmInfo() ) return; @@ -402,9 +402,8 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data ) pet->SetName(name); - Unit *owner = pet->GetOwner(); - if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) - ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME); + if(_player->GetGroup()) + _player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME); pet->SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_NOT_ALLOWED); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e01544759..8e69128f1 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -7488,7 +7488,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) } else if (IS_CORPSE_GUID(guid)) // remove insignia { - Corpse *bones = ObjectAccessor::GetCorpse(*this, guid); + Corpse *bones = GetMap()->GetCorpse(guid); if (!bones || !((loot_type == LOOT_CORPSE) || (loot_type == LOOT_INSIGNIA)) || (bones->GetType() != CORPSE_BONES) ) { @@ -16505,7 +16505,7 @@ Pet* Player::GetMiniPet() { if(!m_miniPet) return NULL; - return ObjectAccessor::GetPet(m_miniPet); + return GetMap()->GetPet(m_miniPet); } void Player::Uncharm() @@ -18054,7 +18054,7 @@ WorldObject const* Player::GetViewPoint() const { if(uint64 far_sight = GetFarSight()) { - WorldObject const* viewPoint = ObjectAccessor::GetWorldObject(*this,far_sight); + WorldObject const* viewPoint = GetMap()->GetWorldObject(far_sight); return viewPoint ? viewPoint : this; // always expected not NULL } else diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp index 7824654cb..44c6cabeb 100644 --- a/src/game/PoolHandler.cpp +++ b/src/game/PoolHandler.cpp @@ -147,7 +147,7 @@ void PoolGroup::Despawn1Object(uint32 guid) { objmgr.RemoveCreatureFromGrid(guid, data); - if (Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT), (Creature*)NULL)) + if (Creature* pCreature = ObjectAccessor::GetCreatureInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT))) pCreature->AddObjectToRemoveList(); } } @@ -160,7 +160,7 @@ void PoolGroup::Despawn1Object(uint32 guid) { objmgr.RemoveGameobjectFromGrid(guid, data); - if (GameObject* pGameobject = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL)) + if (GameObject* pGameobject = ObjectAccessor::GetGameObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_GAMEOBJECT))) pGameobject->AddObjectToRemoveList(); } } @@ -314,7 +314,7 @@ bool PoolGroup::ReSpawn1Object(uint32 guid) { if (CreatureData const* data = objmgr.GetCreatureData(guid)) { - if (Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT), (Creature*)NULL)) + if (Creature* pCreature = ObjectAccessor::GetCreatureInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT))) pCreature->GetMap()->Add(pCreature); return true; } @@ -327,7 +327,7 @@ bool PoolGroup::ReSpawn1Object(uint32 guid) { if (GameObjectData const* data = objmgr.GetGOData(guid)) { - if (GameObject* pGameobject = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL)) + if (GameObject* pGameobject = ObjectAccessor::GetGameObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_GAMEOBJECT))) pGameobject->GetMap()->Add(pGameobject); return true; } diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 45762a66f..a96b80a8c 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1940,8 +1940,12 @@ enum HolidayIds HOLIDAY_DARKMOON_FAIRE_ELWYNN = 374, HOLIDAY_DARKMOON_FAIRE_THUNDER = 375, HOLIDAY_DARKMOON_FAIRE_SHATTRATH = 376, + HOLIDAY_PIRATES_DAY = 398, HOLIDAY_CALL_TO_ARMS_SA = 400, - HOLIDAY_WOTLK_LAUNCH = 406 + HOLIDAY_PILGRIMS_BOUNTY = 404, + HOLIDAY_WOTLK_LAUNCH = 406, + HOLIDAY_DAY_OF_DEAD = 409, + HOLIDAY_CALL_TO_ARMS_ISLE_OF_C = 420 }; // values based at QuestInfo.dbc diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 979fb6f4e..e3e520757 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2197,7 +2197,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap) TagUnitMap.push_back(m_targets.getUnitTarget()); if (m_targets.getCorpseTargetGUID()) { - Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID()); + Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGUID()); if(corpse) { Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID()); @@ -2262,7 +2262,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap) TagUnitMap.push_back(m_targets.getUnitTarget()); else if (m_targets.getCorpseTargetGUID()) { - if (Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID())) + if (Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGUID())) if (Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID())) TagUnitMap.push_back(owner); } @@ -4318,12 +4318,15 @@ SpellCastResult Spell::CheckCast(bool strict) } case SPELL_EFFECT_TAMECREATURE: { - if (m_caster->GetTypeId() != TYPEID_PLAYER || + // Spell can be triggered, we need to check original caster prior to caster + Unit* caster = m_originalCaster ? m_originalCaster : m_caster; + + if (caster->GetTypeId() != TYPEID_PLAYER || !m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER) return SPELL_FAILED_BAD_TARGETS; - Player* plrCaster = (Player*)m_caster; + Player* plrCaster = (Player*)caster; if(plrCaster->getClass() != CLASS_HUNTER) { @@ -5785,7 +5788,7 @@ bool Spell::CheckTarget( Unit* target, uint32 eff ) if(!m_targets.getCorpseTargetGUID()) return false; - Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID()); + Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGUID()); if(!corpse) return false; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 75a166efb..4aa6c7b48 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -577,7 +577,7 @@ Unit* Aura::GetCaster() const //return ObjectAccessor::GetUnit(*m_target,m_caster_guid); //must return caster even if it's in another grid/map - Unit *unit = ObjectAccessor::GetObjectInWorld(m_caster_guid, (Unit*)NULL); + Unit *unit = ObjectAccessor::GetUnitInWorld(*m_target,m_caster_guid); return unit && unit->IsInWorld() ? unit : NULL; } @@ -4509,17 +4509,6 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) } break; } - case SPELLFAMILY_WARLOCK: - { - // Drain Soul - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) - { - if (m_target->GetHealth() * 100 / m_target->GetMaxHealth() <= 25) - m_modifier.m_amount *= 4; - return; - } - break; - } case SPELLFAMILY_DRUID: { // Rake @@ -6160,11 +6149,6 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) DoneActualBenefit = caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto)) * 0.75f; } break; - case SPELLFAMILY_DRUID: - // Savage Defense (amount store original percent of attack power applied) - if (m_spellProto->SpellIconID == 50) // only spell with this aura fit - m_modifier.m_amount = int32(m_modifier.m_amount * m_target->GetTotalAttackPowerValue(BASE_ATTACK) / 100); - break; default: break; } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 91922cafe..268577939 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1817,19 +1817,21 @@ void Spell::EffectDummy(uint32 i) // Cleansing Totem if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000004000000)) && m_spellInfo->SpellIconID==1673) { - m_caster->CastSpell(unitTarget, 52025, true); + if (unitTarget) + m_caster->CastSpell(unitTarget, 52025, true); return; } // Healing Stream Totem if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000002000)) { - m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); + if (unitTarget) + m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); return; } // Mana Spring Totem if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000)) { - if (unitTarget->getPowerType()!=POWER_MANA) + if (!unitTarget || unitTarget->getPowerType()!=POWER_MANA) return; m_caster->CastCustomSpell(unitTarget, 52032, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); return; @@ -3384,7 +3386,7 @@ void Spell::EffectSummon(uint32 i) Map *map = m_caster->GetMap(); uint32 pet_number = objmgr.GeneratePetNumber(); - if (!spawnCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), + if (!spawnCreature->Create(map->GenerateLocalLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), m_spellInfo->EffectMiscValue[i], pet_number)) { sLog.outErrorDb("Spell::EffectSummon: no such creature entry %u",m_spellInfo->EffectMiscValue[i]); @@ -3799,7 +3801,7 @@ void Spell::EffectSummonGuardian(uint32 i) Map *map = m_caster->GetMap(); uint32 pet_number = objmgr.GeneratePetNumber(); - if (!spawnCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map,m_caster->GetPhaseMask(), + if (!spawnCreature->Create(map->GenerateLocalLowGuid(HIGHGUID_PET), map,m_caster->GetPhaseMask(), m_spellInfo->EffectMiscValue[i], pet_number)) { sLog.outError("no such creature entry %u", m_spellInfo->EffectMiscValue[i]); @@ -4156,7 +4158,8 @@ void Spell::EffectEnchantItemTmp(uint32 i) void Spell::EffectTameCreature(uint32 /*i*/) { // Caster must be player, checked in Spell::CheckCast - Player* plr = (Player*)m_caster; + // Spell can be triggered, we need to check original caster prior to caster + Player* plr = (Player*)(m_originalCaster ? m_originalCaster : m_caster); Creature* creatureTarget = (Creature*)unitTarget; @@ -4267,7 +4270,7 @@ void Spell::EffectSummonPet(uint32 i) Map *map = m_caster->GetMap(); uint32 pet_number = objmgr.GeneratePetNumber(); - if(!NewSummon->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), + if(!NewSummon->Create(map->GenerateLocalLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), petentry, pet_number)) { delete NewSummon; @@ -6288,7 +6291,7 @@ void Spell::EffectSummonCritter(uint32 i) Map *map = m_caster->GetMap(); uint32 pet_number = objmgr.GeneratePetNumber(); - if(!critter->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), + if(!critter->Create(map->GenerateLocalLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), pet_entry, pet_number)) { sLog.outError("Spell::EffectSummonCritter, spellid %u: no such creature entry %u", m_spellInfo->Id, pet_entry); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index f2971702a..75e07ff40 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -100,21 +100,19 @@ uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo) if(DotDuration > 30000) DotDuration = 30000; - int j = 0; - for( ; j < 3; j++) + for (int j = 0; j < 3; ++j) { - if( spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA && ( + if (spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA && ( spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_HEAL || spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) ) { + if (spellInfo->EffectAmplitude[j] != 0) + return DotDuration / spellInfo->EffectAmplitude[j]; break; } } - if(spellInfo->EffectAmplitude[j] != 0) - return DotDuration / spellInfo->EffectAmplitude[j]; - return 6; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a1e47da82..de5669324 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1568,17 +1568,17 @@ void Unit::HandleEmoteCommand(uint32 anim_id) uint32 Unit::CalcNotIgnoreAbsorbDamage( uint32 damage, SpellSchoolMask damageSchoolMask, SpellEntry const* spellInfo /*= NULL*/) { float absorb_affected_rate = 1.0f; - Unit::AuraList const& ignoreAbsorb = GetAurasByType(SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL); - for(Unit::AuraList::const_iterator i = ignoreAbsorb.begin(); i != ignoreAbsorb.end(); ++i) + Unit::AuraList const& ignoreAbsorbSchool = GetAurasByType(SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL); + for(Unit::AuraList::const_iterator i = ignoreAbsorbSchool.begin(); i != ignoreAbsorbSchool.end(); ++i) if ((*i)->GetMiscValue() & damageSchoolMask) absorb_affected_rate *= (100.0f - (*i)->GetModifier()->m_amount)/100.0f; if(spellInfo) { - Unit::AuraList const& ignoreAbsorb = GetAurasByType(SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL); - for(Unit::AuraList::const_iterator i = ignoreAbsorb.begin(); i != ignoreAbsorb.end(); ++i) - if ((*i)->isAffectedOnSpell(spellInfo)) - absorb_affected_rate *= (100.0f - (*i)->GetModifier()->m_amount)/100.0f; + Unit::AuraList const& ignoreAbsorbForSpell = GetAurasByType(SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL); + for(Unit::AuraList::const_iterator citr = ignoreAbsorbForSpell.begin(); citr != ignoreAbsorbForSpell.end(); ++citr) + if ((*citr)->isAffectedOnSpell(spellInfo)) + absorb_affected_rate *= (100.0f - (*citr)->GetModifier()->m_amount)/100.0f; } return absorb_affected_rate <= 0.0f ? 0 : (absorb_affected_rate < 1.0f ? uint32(damage * absorb_affected_rate) : damage); @@ -7235,6 +7235,12 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return false; break; } + // Druid - Savage Defense + case 62606: + { + basepoints[0] = int32(GetTotalAttackPowerValue(BASE_ATTACK) * triggerAmount / 100); + break; + } } if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(trigger_spell_id)) @@ -7951,7 +7957,7 @@ Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() { uint64 guid = GetCharmerOrOwnerGUID(); if(IS_PLAYER_GUID(guid)) - return ObjectAccessor::GetPlayer(*this, guid); + return ObjectAccessor::FindPlayer(guid); return GetTypeId()==TYPEID_PLAYER ? (Player*)this : NULL; } @@ -7960,7 +7966,7 @@ Pet* Unit::GetPet() const { if(uint64 pet_guid = GetPetGUID()) { - if(Pet* pet = ObjectAccessor::GetPet(pet_guid)) + if(Pet* pet = GetMap()->GetPet(pet_guid)) return pet; sLog.outError("Unit::GetPet: Pet %u not exist.",GUID_LOPART(pet_guid)); @@ -8024,7 +8030,7 @@ void Unit::RemoveGuardians() while(!m_guardianPets.empty()) { uint64 guid = *m_guardianPets.begin(); - if(Pet* pet = ObjectAccessor::GetPet(guid)) + if(Pet* pet = GetMap()->GetPet(guid)) pet->Remove(PET_SAVE_AS_DELETED); m_guardianPets.erase(guid); @@ -8036,11 +8042,9 @@ Pet* Unit::FindGuardianWithEntry(uint32 entry) // pet guid middle part is entry (and creature also) // and in guardian list must be guardians with same entry _always_ for(GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr) - { - if(Pet* pet = ObjectAccessor::GetPet(*itr)) + if(Pet* pet = GetMap()->GetPet(*itr)) if (pet->GetEntry() == entry) return pet; - } return NULL; } @@ -8348,6 +8352,16 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } break; } + case SPELLFAMILY_WARLOCK: + { + // Drain Soul + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) + { + if (pVictim->GetHealth() * 100 / pVictim->GetMaxHealth() <= 25) + DoneTotalMod *= 4; + } + break; + } case SPELLFAMILY_DEATHKNIGHT: { // Icy Touch, Howling Blast and Frost Strike diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 51b1be8ca..7ebc4dd25 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8710" + #define REVISION_NR "8720" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 73a6bbfed..aa84bca80 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_8702_01_characters_character_reputation" - #define REVISION_DB_MANGOS "required_8693_01_mangos_spell_proc_event" + #define REVISION_DB_MANGOS "required_8720_01_mangos_quest_template" #define REVISION_DB_REALMD "required_8332_01_realmd_realmcharacters" #endif // __REVISION_SQL_H__ diff --git a/win/VC100/ACE_vc10.vcxproj b/win/VC100/ACE_vc10.vcxproj index 209c989fd..ddcb5a69d 100644 --- a/win/VC100/ACE_vc10.vcxproj +++ b/win/VC100/ACE_vc10.vcxproj @@ -1,4 +1,5 @@ - + + Debug_NoPCH @@ -196,7 +197,7 @@ true Level3 ProgramDatabase - 4355;%(DisableSpecificWarnings) + 4355;4244;%(DisableSpecificWarnings) _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) @@ -269,7 +270,7 @@ MultiThreadedDLL true Level3 - 4355;%(DisableSpecificWarnings) + 4355;4244;%(DisableSpecificWarnings) NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) @@ -348,7 +349,7 @@ true Level3 ProgramDatabase - 4355;%(DisableSpecificWarnings) + 4355;4244;%(DisableSpecificWarnings) _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) diff --git a/win/VC100/mangosd.vcxproj b/win/VC100/mangosd.vcxproj index 4c2cbd38a..77325676c 100644 --- a/win/VC100/mangosd.vcxproj +++ b/win/VC100/mangosd.vcxproj @@ -1,4 +1,5 @@ - + + Debug_NoPCH @@ -187,7 +188,7 @@ false - $(OutDir)mangosd.lib + $(IntDir)mangosd.lib copy ..\..\dep\lib\$(Platform)_$(Configuration)\*.dll ..\..\bin\$(Platform)_$(Configuration) @@ -236,7 +237,7 @@ false - $(OutDir)mangosd.lib + $(IntDir)mangosd.lib MachineX64 @@ -288,7 +289,7 @@ false - $(OutDir)mangosd.lib + $(IntDir)mangosd.lib copy ..\..\dep\lib\$(Platform)_$(Configuration)\*.dll ..\..\bin\$(Platform)_$(Configuration) @@ -338,7 +339,7 @@ false - $(OutDir)mangosd.lib + $(IntDir)mangosd.lib MachineX64 @@ -390,7 +391,7 @@ false - $(OutDir)mangosd.lib + $(IntDir)mangosd.lib copy ..\..\dep\lib\$(Platform)_debug\*.dll ..\..\bin\$(Platform)_$(Configuration) @@ -440,7 +441,7 @@ false - $(OutDir)mangosd.lib + $(IntDir)mangosd.lib MachineX64 diff --git a/win/VC100/script.vcxproj b/win/VC100/script.vcxproj index 0f4ee5460..13ff773cd 100644 --- a/win/VC100/script.vcxproj +++ b/win/VC100/script.vcxproj @@ -1,4 +1,5 @@ - + + Debug_NoPCH @@ -161,7 +162,7 @@ false - $(OutDir)MaNGOSScript.lib + $(IntDir)MaNGOSScript.lib MachineX86 @@ -192,7 +193,7 @@ false - $(OutDir)MaNGOSScript.lib + $(IntDir)MaNGOSScript.lib MachineX64 @@ -219,7 +220,7 @@ false - $(OutDir)MaNGOSScript.lib + $(IntDir)MaNGOSScript.lib MachineX86 @@ -249,7 +250,7 @@ false - $(OutDir)MaNGOSScript.lib + $(IntDir)MaNGOSScript.lib MachineX64 @@ -277,7 +278,7 @@ false - $(OutDir)MaNGOSScript.lib + $(IntDir)MaNGOSScript.lib MachineX86 @@ -308,7 +309,7 @@ false - $(OutDir)MaNGOSScript.lib + $(IntDir)MaNGOSScript.lib MachineX64