Show
Ignore:
Timestamp:
11/19/08 13:27:40 (17 years ago)
Author:
yumileroy
Message:

[svn] * Merge Temp dev SVN with Assembla.
* Changes include:

  • Implementation of w12x's Outdoor PvP and Game Event Systems.
  • Temporary removal of IRC Chat Bot (until infinite loop when disabled is fixed).
  • All mangos -> trinity (to convert your mangos_string table, please run mangos_string_to_trinity_string.sql).
  • Improved Config cleanup.
  • And many more changes.

Original author: Seline
Date: 2008-10-14 11:57:03-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/GameObject.cpp

    r37 r44  
    11/* 
    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/> 
    35 * 
    46 * This program is free software; you can redistribute it and/or modify 
     
    911 * This program is distributed in the hope that it will be useful, 
    1012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1214 * GNU General Public License for more details. 
    1315 * 
    1416 * You should have received a copy of the GNU General Public License 
    1517 * along with this program; if not, write to the Free Software 
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
    1719 */ 
    1820 
     
    3638#include "InstanceData.h" 
    3739#include "BattleGround.h" 
     40#include "OutdoorPvPMgr.h" 
    3841#include "Util.h" 
    3942 
     
    9093} 
    9194 
    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) 
     95bool 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) 
    9396{ 
    9497    Relocate(x,y,z,ang); 
     
    142145 
    143146    SetGoAnimProgress(animprogress); 
     147 
     148    SetUInt32Value (GAMEOBJECT_ARTKIT, ArtKit); 
    144149 
    145150    // Spell charges for GAMEOBJECT_TYPE_SPELLCASTER (22) 
     
    296301                bool NeedDespawn = (goInfo->trap.charges != 0); 
    297302 
    298                 CellPair p(MaNGOS::ComputeCellPair(GetPositionX(),GetPositionY())); 
     303                CellPair p(Trinity::ComputeCellPair(GetPositionX(),GetPositionY())); 
    299304                Cell cell(p); 
    300305                cell.data.Part.reserved = ALL_DISTRICT; 
     
    304309                if(owner && NeedDespawn)                    // hunter trap 
    305310                { 
    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); 
    308313 
    309314                    CellLock<GridReadGuard> cell_lock(cell, p); 
    310315 
    311                     TypeContainerVisitor<MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker); 
     316                    TypeContainerVisitor<Trinity::UnitSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker); 
    312317                    cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); 
    313318 
     
    315320                    if(!ok) 
    316321                    { 
    317                         TypeContainerVisitor<MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); 
     322                        TypeContainerVisitor<Trinity::UnitSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); 
    318323                        cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); 
    319324                    } 
     
    325330                    // affect only players 
    326331                    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); 
    329334 
    330335                    CellLock<GridReadGuard> cell_lock(cell, p); 
    331336 
    332                     TypeContainerVisitor<MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); 
     337                    TypeContainerVisitor<Trinity::PlayerSearcher<Trinity::AnyPlayerInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); 
    333338                    cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); 
    334339                    ok = p_ok; 
     
    519524    data.go_state = GetGoState(); 
    520525    data.spawnMask = spawnMask; 
     526    data.ArtKit = GetUInt32Value (GAMEOBJECT_ARTKIT); 
    521527 
    522528    // updated in DB 
     
    569575    uint32 animprogress = data->animprogress; 
    570576    uint32 go_state = data->go_state; 
     577    uint32 ArtKit = data->ArtKit; 
    571578 
    572579    m_DBTableGuid = guid; 
    573580    if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); 
    574581 
    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) ) 
    576583        return false; 
    577584 
     
    779786    { 
    780787        // using original GO distance 
    781         CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); 
     788        CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); 
    782789        Cell cell(p); 
    783790        cell.data.Part.reserved = ALL_DISTRICT; 
    784791 
    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); 
    789796        CellLock<GridReadGuard> cell_lock(cell, p); 
    790797        cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); 
     
    801808    GameObject* ok = NULL; 
    802809 
    803     CellPair p(MaNGOS::ComputeCellPair(GetPositionX(),GetPositionY())); 
     810    CellPair p(Trinity::ComputeCellPair(GetPositionX(),GetPositionY())); 
    804811    Cell cell(p); 
    805812    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); 
    808815 
    809816    CellLock<GridReadGuard> cell_lock(cell, p); 
    810817 
    811     TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::NearestGameObjectFishingHole>, GridTypeMapContainer > grid_object_checker(checker); 
     818    TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::NearestGameObjectFishingHole>, GridTypeMapContainer > grid_object_checker(checker); 
    812819    cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); 
    813820 
     
    828835    m_cooldownTime = time(NULL) + time_to_restore; 
    829836 
     837} 
     838 
     839void 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; 
    830845} 
    831846 
     
    12341249    if(!spellInfo) 
    12351250    { 
    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); 
    12371255        return; 
    12381256    }