Changeset 44 for trunk/src/game/GameObject.cpp
- Timestamp:
- 11/19/08 13:27:40 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/GameObject.cpp
r37 r44 1 1 /* 2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> 2 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> 3 * 4 * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> 3 5 * 4 6 * This program is free software; you can redistribute it and/or modify … … 9 11 * This program is distributed in the hope that it will be useful, 10 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 14 * GNU General Public License for more details. 13 15 * 14 16 * You should have received a copy of the GNU General Public License 15 17 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 19 */ 18 20 … … 36 38 #include "InstanceData.h" 37 39 #include "BattleGround.h" 40 #include "OutdoorPvPMgr.h" 38 41 #include "Util.h" 39 42 … … 90 93 } 91 94 92 bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state )95 bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state, uint32 ArtKit) 93 96 { 94 97 Relocate(x,y,z,ang); … … 142 145 143 146 SetGoAnimProgress(animprogress); 147 148 SetUInt32Value (GAMEOBJECT_ARTKIT, ArtKit); 144 149 145 150 // Spell charges for GAMEOBJECT_TYPE_SPELLCASTER (22) … … 296 301 bool NeedDespawn = (goInfo->trap.charges != 0); 297 302 298 CellPair p( MaNGOS::ComputeCellPair(GetPositionX(),GetPositionY()));303 CellPair p(Trinity::ComputeCellPair(GetPositionX(),GetPositionY())); 299 304 Cell cell(p); 300 305 cell.data.Part.reserved = ALL_DISTRICT; … … 304 309 if(owner && NeedDespawn) // hunter trap 305 310 { 306 MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, owner, radius);307 MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck> checker(ok, u_check);311 Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, owner, radius); 312 Trinity::UnitSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> checker(ok, u_check); 308 313 309 314 CellLock<GridReadGuard> cell_lock(cell, p); 310 315 311 TypeContainerVisitor< MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker);316 TypeContainerVisitor<Trinity::UnitSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker); 312 317 cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); 313 318 … … 315 320 if(!ok) 316 321 { 317 TypeContainerVisitor< MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker);322 TypeContainerVisitor<Trinity::UnitSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); 318 323 cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); 319 324 } … … 325 330 // affect only players 326 331 Player* p_ok = NULL; 327 MaNGOS::AnyPlayerInObjectRangeCheck p_check(this, radius);328 MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck> checker(p_ok, p_check);332 Trinity::AnyPlayerInObjectRangeCheck p_check(this, radius); 333 Trinity::PlayerSearcher<Trinity::AnyPlayerInObjectRangeCheck> checker(p_ok, p_check); 329 334 330 335 CellLock<GridReadGuard> cell_lock(cell, p); 331 336 332 TypeContainerVisitor< MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker);337 TypeContainerVisitor<Trinity::PlayerSearcher<Trinity::AnyPlayerInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); 333 338 cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); 334 339 ok = p_ok; … … 519 524 data.go_state = GetGoState(); 520 525 data.spawnMask = spawnMask; 526 data.ArtKit = GetUInt32Value (GAMEOBJECT_ARTKIT); 521 527 522 528 // updated in DB … … 569 575 uint32 animprogress = data->animprogress; 570 576 uint32 go_state = data->go_state; 577 uint32 ArtKit = data->ArtKit; 571 578 572 579 m_DBTableGuid = guid; 573 580 if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); 574 581 575 if (!Create(guid,entry, map, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state ) )582 if (!Create(guid,entry, map, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, ArtKit) ) 576 583 return false; 577 584 … … 779 786 { 780 787 // using original GO distance 781 CellPair p( MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()));788 CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); 782 789 Cell cell(p); 783 790 cell.data.Part.reserved = ALL_DISTRICT; 784 791 785 MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*target,trapEntry,range);786 MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(trapGO,go_check);787 788 TypeContainerVisitor< MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker);792 Trinity::NearestGameObjectEntryInObjectRangeCheck go_check(*target,trapEntry,range); 793 Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> checker(trapGO,go_check); 794 795 TypeContainerVisitor<Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker); 789 796 CellLock<GridReadGuard> cell_lock(cell, p); 790 797 cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); … … 801 808 GameObject* ok = NULL; 802 809 803 CellPair p( MaNGOS::ComputeCellPair(GetPositionX(),GetPositionY()));810 CellPair p(Trinity::ComputeCellPair(GetPositionX(),GetPositionY())); 804 811 Cell cell(p); 805 812 cell.data.Part.reserved = ALL_DISTRICT; 806 MaNGOS::NearestGameObjectFishingHole u_check(*this, range);807 MaNGOS::GameObjectSearcher<MaNGOS::NearestGameObjectFishingHole> checker(ok, u_check);813 Trinity::NearestGameObjectFishingHole u_check(*this, range); 814 Trinity::GameObjectSearcher<Trinity::NearestGameObjectFishingHole> checker(ok, u_check); 808 815 809 816 CellLock<GridReadGuard> cell_lock(cell, p); 810 817 811 TypeContainerVisitor< MaNGOS::GameObjectSearcher<MaNGOS::NearestGameObjectFishingHole>, GridTypeMapContainer > grid_object_checker(checker);818 TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::NearestGameObjectFishingHole>, GridTypeMapContainer > grid_object_checker(checker); 812 819 cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); 813 820 … … 828 835 m_cooldownTime = time(NULL) + time_to_restore; 829 836 837 } 838 839 void GameObject::SetGoArtKit(uint32 kit) 840 { 841 SetUInt32Value(GAMEOBJECT_ARTKIT, kit); 842 GameObjectData *data = const_cast<GameObjectData*>(objmgr.GetGOData(m_DBTableGuid)); 843 if(data) 844 data->ArtKit = kit; 830 845 } 831 846 … … 1234 1249 if(!spellInfo) 1235 1250 { 1236 sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType()); 1251 if(user->GetTypeId()!=TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this)) 1252 sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType()); 1253 else 1254 sLog.outDebug("WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId); 1237 1255 return; 1238 1256 }