Merge. Revision history for source files should be all back now.

--HG--
branch : trunk
rename : sql/CMakeLists.txt => sql/tools/CMakeLists.txt
rename : src/server/game/Pools/PoolHandler.cpp => src/server/game/Pools/PoolMgr.cpp
rename : src/server/game/Pools/PoolHandler.h => src/server/game/Pools/PoolMgr.h
rename : src/server/game/PrecompiledHeaders/NixCorePCH.cpp => src/server/game/PrecompiledHeaders/gamePCH.cpp
rename : src/server/game/PrecompiledHeaders/NixCorePCH.h => src/server/game/PrecompiledHeaders/gamePCH.h
This commit is contained in:
Xanadu
2010-07-20 02:49:28 +02:00
3587 changed files with 301677 additions and 181018 deletions
+30 -7
View File
@@ -1,7 +1,30 @@
add_subdirectory(game)
if (DO_SCRIPTS)
add_subdirectory(scripts)
endif (DO_SCRIPTS)
add_subdirectory(shared)
add_subdirectory(worldserver)
add_subdirectory(authserver)
# Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
if(DO_WORLDSERVER)
add_subdirectory(shared)
add_subdirectory(game)
add_subdirectory(collision)
if(DO_SCRIPTS)
add_subdirectory(scripts)
endif()
add_subdirectory(worldserver)
else()
if(DO_TOOLS)
add_subdirectory(collision)
endif()
endif()
if (DO_AUTHSERVER)
if(NOT DO_WORLDSERVER)
add_subdirectory(shared)
endif()
add_subdirectory(authserver)
endif()
@@ -80,7 +80,7 @@ enum LoginResult
//3.3.2 build 11403
//3.3.3a build 11723
#define POST_BC_ACCEPTED_CLIENT_BUILD {11723, 11403, 11159, 10571, 10505, 10146, 9947, 8606, 0}
#define POST_BC_ACCEPTED_CLIENT_BUILD {12340, 11723, 11403, 11159, 10571, 10505, 10146, 9947, 8606, 0}
#define PRE_BC_ACCEPTED_CLIENT_BUILD {5875, 6005, 0}
#define POST_BC_EXP_FLAG 0x2
+72 -44
View File
@@ -1,60 +1,88 @@
########### next target ###############
# Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SET(trinity-realm_SRCS
AuthCodes.cpp
AuthCodes.h
AuthSocket.cpp
AuthSocket.h
Main.cpp
RealmList.cpp
RealmList.h
RealmSocket.h
RealmSocket.cpp
RealmAcceptor.h
########### authserver ###############
set(authserver_SRCS
Authentication/AuthCodes.cpp
Realms/RealmList.cpp
Server/AuthSocket.cpp
Server/RealmSocket.cpp
Main.cpp
)
include_directories(
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src/server/shared
${CMAKE_SOURCE_DIR}/src/server/shared/Database
${CMAKE_SOURCE_DIR}/src/server/framework
${MYSQL_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/src/server/shared/Packets
${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography
${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography/Authentication
${CMAKE_SOURCE_DIR}/src/server/shared/Logging
${CMAKE_SOURCE_DIR}/src/server/shared/Utilities
${CMAKE_SOURCE_DIR}/src/server/authserver
${CMAKE_SOURCE_DIR}/src/server/authserver/Authentication
${CMAKE_SOURCE_DIR}/src/server/authserver/Realms
${CMAKE_SOURCE_DIR}/src/server/authserver/Server
)
SET(trinity-realm_LINK_FLAGS "")
set(authserver_LINK_FLAGS "")
add_executable(trinity-realm ${trinity-realm_SRCS})
add_definitions(
-D_TRINITY_REALM_CONFIG='"${CONF_DIR}/trinityrealm.conf"'
)
IF (DO_MYSQL)
SET(trinity-realm_LINK_FLAGS "-pthread ${trinity-realm_LINK_FLAGS}")
ENDIF(DO_MYSQL)
IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
SET(trinity-realm_LINK_FLAGS "-framework Carbon ${trinity-realm_LINK_FLAGS}")
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
SET_TARGET_PROPERTIES(trinity-realm PROPERTIES LINK_FLAGS "${trinity-realm_LINK_FLAGS}")
target_link_libraries(
trinity-realm
shared
trinityframework
trinitysockets
trinitydatabase
trinityauth
trinityconfig
zlib
${SSLLIB}
${MYSQL_LIBRARIES}
${OSX_LIBS}
add_executable(authserver
${authserver_SRCS}
)
install(TARGETS trinity-realm DESTINATION bin)
add_dependencies(authserver revision.h)
if( NOT WIN32 )
add_definitions(-D_TRINITY_REALM_CONFIG='"${CONF_DIR}/authserver.conf"')
endif()
########### install files ###############
if( UNIX )
set(authserver_LINK_FLAGS "-pthread ${authserver_LINK_FLAGS}")
endif()
install(FILES trinityrealm.conf.dist DESTINATION etc)
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
set(authserver_LINK_FLAGS "-framework Carbon ${authserver_LINK_FLAGS}")
endif()
set_target_properties(authserver PROPERTIES LINK_FLAGS "${authserver_LINK_FLAGS}")
if( WIN32 )
target_link_libraries(
authserver
shared
trinitydatabase
trinityauth
trinityconfig
${MYSQL_LIBRARY}
${OPENSSL_LIBRARIES}
${OPENSSL_EXTRA_LIBRARIES}
)
else()
target_link_libraries(
authserver
shared
trinitydatabase
trinityauth
trinityconfig
${MYSQL_LIBRARY}
${OPENSSL_LIBRARIES}
${OSX_LIBS}
)
endif()
if( UNIX )
install(TARGETS authserver DESTINATION bin)
install(FILES authserver.conf.dist DESTINATION etc)
endif()
+13 -8
View File
@@ -24,8 +24,9 @@
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "Database/PreparedStatements.h"
#include "Config/ConfigEnv.h"
#include "Configuration/ConfigEnv.h"
#include "Log.h"
#include "SystemConfig.h"
#include "Util.h"
@@ -42,10 +43,10 @@
#include <openssl/crypto.h>
#ifndef _TRINITY_REALM_CONFIG
# define _TRINITY_REALM_CONFIG "TrinityRealm.conf"
# define _TRINITY_REALM_CONFIG "authserver.conf"
#endif //_TRINITY_REALM_CONFIG
#ifdef WIN32
#ifdef _WIN32
#include "ServiceWin32.h"
char serviceName[] = "TrinityRealm";
char serviceLongName[] = "Trinity realm service";
@@ -92,7 +93,7 @@ void usage(const char *prog)
{
sLog.outString("Usage: \n %s [<options>]\n"
" -c config_file use config_file as configuration file\n\r"
#ifdef WIN32
#ifdef _WIN32
" Running as service functions:\n\r"
" --service run as service\n\r"
" -s install install service\n\r"
@@ -122,7 +123,7 @@ extern int main(int argc, char **argv)
cfg_file = argv[c];
}
#ifdef WIN32
#ifdef _WIN32
////////////
//Services//
////////////
@@ -243,7 +244,7 @@ extern int main(int argc, char **argv)
#endif /* _WIN32 */();
///- Handle affinity for multiple processors and process priority on Windows
#ifdef WIN32
#ifdef _WIN32
{
HANDLE hProcess = GetCurrentProcess();
@@ -313,9 +314,9 @@ extern int main(int argc, char **argv)
{
loopCounter = 0;
sLog.outDetail("Ping MySQL to keep connection alive");
LoginDatabase.Query("SELECT 1 FROM realmlist LIMIT 1");
sPreparedStatement.Query(&LoginDatabase, "auth_ping");
}
#ifdef WIN32
#ifdef _WIN32
if (m_ServiceStatus == 0) stopEvent = true;
while (m_ServiceStatus == 2) Sleep(1000);
#endif
@@ -345,6 +346,10 @@ bool StartDB()
return false;
}
LoginDatabase.ThreadStart();
uint32 count = 0;
sPreparedStatement.LoadAuthserver(&LoginDatabase, count);
sLog.outString("Loaded %u prepared MySQL statements for auth DB.", count);
return true;
}
+2 -2
View File
@@ -25,13 +25,13 @@
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "ByteBuffer.h"
#include "Config/ConfigEnv.h"
#include "Configuration/ConfigEnv.h"
#include "Log.h"
#include "RealmList.h"
#include "AuthSocket.h"
#include "AuthCodes.h"
#include <openssl/md5.h>
#include "Auth/Sha1.h"
#include "SHA1.h"
//#include "Util.h" -- for commented utf8ToUpperOnlyLatin
extern DatabaseType LoginDatabase;
+1 -1
View File
@@ -26,7 +26,7 @@
#define _AUTHSOCKET_H
#include "Common.h"
#include "Auth/BigNumber.h"
#include "BigNumber.h"
#include "RealmSocket.h"
@@ -25,7 +25,6 @@
#ifndef __REALMSOCKET_H__
#define __REALMSOCKET_H__
#include <ace/Basic_Types.h>
#include <ace/Synch_Traits.h>
#include <ace/Svc_Handler.h>
#include <ace/SOCK_Stream.h>
@@ -125,14 +125,14 @@
#
###############################################################################
LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;realmd"
LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth"
LogsDir = ""
MaxPingTime = 30
RealmServerPort = 3724
BindIP = "0.0.0.0"
PidFile = ""
LogLevel = 0
LogFile = "realmd.log"
LogFile = "auth.log"
LogTimestamp = 0
LogFileLevel = 0
LogColors = ""

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

@@ -36,7 +36,7 @@
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APPICON ICON "TrinityRealm.ico"
IDI_APPICON ICON "authserver.ico"
/////////////////////////////////////////////////////////////////////////////
// Neutre (Par défaut système) resources
@@ -69,12 +69,12 @@ BEGIN
BEGIN
BLOCK "080004b0"
BEGIN
VALUE "FileDescription", "TrinityRealm"
VALUE "FileDescription", "authserver"
VALUE "FileVersion", STRFILEVER
VALUE "InternalName", "TrinityRealm"
VALUE "LegalCopyright", "Copyright (C) 2008-2009"
VALUE "OriginalFilename", "TrinityRealm.exe"
VALUE "ProductName", "TrinityRealm"
VALUE "InternalName", "authserver"
VALUE "LegalCopyright", "Copyright (C) 2008-2010"
VALUE "OriginalFilename", "authserver.exe"
VALUE "ProductName", "authserver"
VALUE "ProductVersion", STRPRODUCTVER
END
END
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "BIH.h"
#include "BoundingIntervalHierarchy.h"
void BIH::buildHierarchy(std::vector<uint32> &tempTree, buildData &dat, BuildStats &stats)
{
@@ -19,11 +19,11 @@
#ifndef _BIH_H
#define _BIH_H
#include <G3D/Vector3.h>
#include <G3D/Ray.h>
#include <G3D/AABox.h>
#include "G3D/Vector3.h"
#include "G3D/Ray.h"
#include "G3D/AABox.h"
#include <Platform/Define.h>
#include "Define.h"
#include <stdexcept>
#include <vector>
@@ -116,32 +116,36 @@ class BIH
template<typename RayCallback>
void intersectRay(const Ray &r, RayCallback& intersectCallback, float &maxDist, bool stopAtFirst=false) const
{
float intervalMin = 0.f;
float intervalMax = maxDist;
float intervalMin = -1.f;
float intervalMax = -1.f;
Vector3 org = r.origin();
Vector3 dir = r.direction();
Vector3 invDir;
float t1, t2;
for(int i=0; i<3; ++i)
for (int i=0; i<3; ++i)
{
invDir[i] = 1.f / dir[i];
t1 = (bounds.low()[i] - org[i]) * invDir[i];
t2 = (bounds.high()[i] - org[i]) * invDir[i];
if (invDir[i] > 0) {
if (dir[i] != 0.f)
{
float t1 = (bounds.low()[i] - org[i]) * invDir[i];
float t2 = (bounds.high()[i] - org[i]) * invDir[i];
if (t1 > t2)
std::swap(t1, t2);
if (t1 > intervalMin)
intervalMin = t1;
if (t2 < intervalMax)
if (t2 < intervalMax || intervalMax < 0.f)
intervalMax = t2;
} else {
if (t2 > intervalMin)
intervalMin = t2;
if (t1 < intervalMax)
intervalMax = t1;
// intervalMax can only become smaller for other axis,
// and intervalMin only larger respectively, so stop early
if (intervalMax <= 0 || intervalMin >= maxDist)
return;
}
if (intervalMin > intervalMax)
return;
}
if (intervalMin > intervalMax)
return;
intervalMin = std::max(intervalMin, 0.f);
intervalMax = std::min(intervalMax, maxDist);
uint32 offsetFront[3];
uint32 offsetBack[3];
uint32 offsetFront3[3];
+30 -22
View File
@@ -1,30 +1,38 @@
# Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
########### next target ###############
########### collision ###############
SET(vmaps_STAT_SRCS
BIH.h
BIH.cpp
IVMapManager.h
MapTree.cpp
MapTree.h
ModelInstance.cpp
ModelInstance.h
TileAssembler.cpp
TileAssembler.h
VMapDefinitions.h
VMapFactory.cpp
VMapFactory.h
VMapManager2.cpp
VMapManager2.h
VMapTools.h
WorldModel.cpp
WorldModel.h
set(collision_STAT_SRCS
BoundingIntervalHierarchy.cpp
Maps/MapTree.cpp
Maps/TileAssembler.cpp
Models/ModelInstance.cpp
Models/WorldModel.cpp
Management/VMapFactory.cpp
Management/VMapManager2.cpp
)
include_directories(
${ACE_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/src/server/framework
${CMAKE_SOURCE_DIR}/dep/include/g3dlite
${CMAKE_SOURCE_DIR}/externals/g3dlite
${CMAKE_SOURCE_DIR}/externals/mysql
${CMAKE_SOURCE_DIR}/src/server/shared
${CMAKE_SOURCE_DIR}/src/server/shared/Debugging
${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic
${CMAKE_SOURCE_DIR}/src/server/shared/Logging
${CMAKE_SOURCE_DIR}/src/server/collision
${CMAKE_SOURCE_DIR}/src/server/collision/Management
${CMAKE_SOURCE_DIR}/src/server/collision/Maps
${CMAKE_SOURCE_DIR}/src/server/collision/Models
${CMAKE_BINARY_DIR}
)
add_library(vmaps STATIC ${vmaps_STAT_SRCS})
add_library(collision STATIC ${collision_STAT_SRCS})
@@ -19,8 +19,8 @@
#ifndef _IVMAPMANAGER_H
#define _IVMAPMANAGER_H
#include<string>
#include <Platform/Define.h>
#include <string>
#include "Define.h"
//===========================================================
@@ -122,15 +122,10 @@ namespace VMAP
// delete all internal data structures
void VMapFactory::clear()
{
if(iIgnoreSpellIds)
{
delete iIgnoreSpellIds;
iIgnoreSpellIds = NULL;
}
if(gVMapManager)
{
delete gVMapManager;
gVMapManager = NULL;
}
delete iIgnoreSpellIds;
iIgnoreSpellIds = NULL;
delete gVMapManager;
gVMapManager = NULL;
}
}
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
@@ -25,6 +25,7 @@
#include "ModelInstance.h"
#include "WorldModel.h"
#include "VMapDefinitions.h"
#include "Log.h"
using G3D::Vector3;
@@ -56,7 +57,7 @@ namespace VMAP
Vector3 VMapManager2::convertPositionToInternalRep(float x, float y, float z) const
{
Vector3 pos;
const float mid = 0.5 * 64.0 * 533.33333333f;
const float mid = 0.5f * 64.0f * 533.33333333f;
pos.x = mid - x;
pos.y = mid - y;
pos.z = z;
@@ -69,7 +70,7 @@ namespace VMAP
Vector3 VMapManager2::convertPositionToMangosRep(float x, float y, float z) const
{
Vector3 pos;
const float mid = 0.5 * 64.0 * 533.33333333f;
const float mid = 0.5f * 64.0f * 533.33333333f;
pos.x = mid - x;
pos.y = mid - y;
pos.z = z;
@@ -109,7 +110,7 @@ namespace VMAP
ss2 >> map_num;
if (map_num >= 0)
{
std::cout << "ingoring Map " << map_num << " for VMaps\n";
sLog.outDebug("Ignoring Map %i for VMaps", map_num);
iIgnoreMapIds[map_num] = true;
// unload map in case it is loaded
unloadMap(map_num);
@@ -279,6 +280,7 @@ namespace VMAP
if (instanceTree->second->GetLocationInfo(pos, info))
{
floor = info.ground_Z;
ASSERT(floor < std::numeric_limits<float>::max());
type = info.hitModel->GetLiquidType();
if (ReqLiquidType && !(type & ReqLiquidType))
return false;
@@ -299,11 +301,11 @@ namespace VMAP
WorldModel *worldmodel = new WorldModel();
if (!worldmodel->readFile(basepath + filename + ".vmo"))
{
std::cout << "VMapManager2: could not load '" << basepath << filename << ".vmo'!\n";
sLog.outError("VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
delete worldmodel;
return NULL;
}
std::cout << "VMapManager2: loading file '" << basepath << filename << "'.\n";
sLog.outDebug("VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str());
model = iLoadedModelFiles.insert(std::pair<std::string, ManagedModel>(filename, ManagedModel())).first;
model->second.setModel(worldmodel);
}
@@ -316,12 +318,12 @@ namespace VMAP
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
if (model == iLoadedModelFiles.end())
{
std::cout << "VMapManager2: trying to unload non-loaded file '" << filename << "'!\n";
sLog.outError("VMapManager2: trying to unload non-loaded file '%s'", filename.c_str());
return;
}
if( model->second.decRefCount() == 0)
{
std::cout << "VMapManager2: unloading file '" << filename << "'.\n";
sLog.outDebug("VMapManager2: unloading file '%s'", filename.c_str());
delete model->second.getModel();
iLoadedModelFiles.erase(model);
}
@@ -20,8 +20,8 @@
#define _VMAPMANAGER2_H
#include "IVMapManager.h"
#include "Utilities/UnorderedMap.h"
#include "Platform/Define.h"
#include "Dynamic/UnorderedMap.h"
#include "Define.h"
#include <G3D/Vector3.h>
//===========================================================
+75 -46
View File
@@ -1,29 +1,37 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MapTree.h"
#include "ModelInstance.h"
#include "VMapManager2.h"
#include "VMapDefinitions.h"
#include "Log.h"
#include <string>
#include <sstream>
#include <iomanip>
#include <limits>
#ifndef NO_CORE_FUNCS
#include "Errors.h"
#else
#define ASSERT(x)
#endif
using G3D::Vector3;
@@ -33,13 +41,18 @@ namespace VMAP
class MapRayCallback
{
public:
MapRayCallback(ModelInstance *val): prims(val) {}
ModelInstance *prims;
MapRayCallback(ModelInstance *val): prims(val), hit(false) {}
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit=true)
{
return prims[entry].intersectRay(ray, distance, pStopAtFirstHit);
//std::cout << "trying to intersect '" << entity->name << "'\n";
bool result = prims[entry].intersectRay(ray, distance, pStopAtFirstHit);
if (result)
hit = true;
return result;
}
bool didHit() { return hit; }
protected:
ModelInstance *prims;
bool hit;
};
class AreaInfoCallback
@@ -49,7 +62,7 @@ namespace VMAP
void operator()(const Vector3& point, uint32 entry)
{
#ifdef VMAP_DEBUG
std::cout << "trying to intersect '" << prims[entry].name << "'\n";
sLog.outDebug("AreaInfoCallback: trying to intersect '%s'", prims[entry].name.c_str());
#endif
prims[entry].intersectPoint(point, aInfo);
}
@@ -65,7 +78,7 @@ namespace VMAP
void operator()(const Vector3& point, uint32 entry)
{
#ifdef VMAP_DEBUG
std::cout << "trying to intersect '" << prims[entry].name << "'\n";
sLog.outDebug("LocationInfoCallback: trying to intersect '%s'", prims[entry].name.c_str());
#endif
if (prims[entry].GetLocationInfo(point, locInfo))
result = true;
@@ -113,7 +126,7 @@ namespace VMAP
}
StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath):
iMapID(mapID), /* iTree(0), */ iTreeValues(0), iBasePath(basePath)
iMapID(mapID), iTreeValues(0), iBasePath(basePath)
{
if (iBasePath.length() > 0 && (iBasePath[iBasePath.length()-1] != '/' || iBasePath[iBasePath.length()-1] != '\\'))
{
@@ -130,33 +143,35 @@ namespace VMAP
//=========================================================
/**
return dist to hit or inf() if no hit
If intersection is found within pMaxDist, sets pMaxDist to intersection distance and returns true.
Else, pMaxDist is not modified and returns false;
*/
float StaticMapTree::getIntersectionTime(const G3D::Ray& pRay, float pMaxDist, bool pStopAtFirstHit) const
bool StaticMapTree::getIntersectionTime(const G3D::Ray& pRay, float &pMaxDist, bool pStopAtFirstHit) const
{
float distance = pMaxDist;
MapRayCallback intersectionCallBack(iTreeValues);
iTree.intersectRay(pRay, intersectionCallBack, distance, pStopAtFirstHit);
return distance;
if (intersectionCallBack.didHit())
pMaxDist = distance;
return intersectionCallBack.didHit();
}
//=========================================================
bool StaticMapTree::isInLineOfSight(const Vector3& pos1, const Vector3& pos2) const
{
bool result = true;
float maxDist = (pos2 - pos1).magnitude();
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
ASSERT(maxDist < std::numeric_limits<float>::max());
// prevent NaN values which can cause BIH intersection to enter infinite loop
if (maxDist < 1e-10f)
return true;
// direction with length of 1
G3D::Ray ray = G3D::Ray::fromOriginAndDirection(pos1, (pos2 - pos1)/maxDist);
float resultDist = getIntersectionTime(ray, maxDist, true);
if (resultDist < maxDist)
{
result = false;
}
return result;
if (getIntersectionTime(ray, maxDist, true))
return false;
return true;
}
//=========================================================
/**
@@ -168,6 +183,8 @@ namespace VMAP
{
bool result=false;
float maxDist = (pPos2 - pPos1).magnitude();
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
ASSERT(maxDist < std::numeric_limits<float>::max());
// prevent NaN values which can cause BIH intersection to enter infinite loop
if (maxDist < 1e-10f)
{
@@ -176,8 +193,8 @@ namespace VMAP
}
Vector3 dir = (pPos2 - pPos1)/maxDist; // direction with length of 1
G3D::Ray ray(pPos1, dir);
float dist = getIntersectionTime(ray, maxDist, false);
if (dist < maxDist)
float dist = maxDist;
if (getIntersectionTime(ray, dist, false))
{
pResultHitPos = pPos1 + dir * dist;
if (pModifyDist < 0)
@@ -213,10 +230,9 @@ namespace VMAP
Vector3 dir = Vector3(0,0,-1);
G3D::Ray ray(pPos, dir); // direction with length of 1
float maxDist = VMapDefinitions::getMaxCanFallDistance();
float dist = getIntersectionTime(ray, maxDist, false);
if (dist < maxDist)
if (getIntersectionTime(ray, maxDist, false))
{
height = pPos.z - dist;
height = pPos.z - maxDist;
}
return(height);
}
@@ -248,7 +264,11 @@ namespace VMAP
if (!tf)
success = false;
else
{
if (!readChunk(tf, chunk, VMAP_MAGIC, 8))
success = false;
fclose(tf);
}
}
fclose(rf);
return success;
@@ -258,7 +278,7 @@ namespace VMAP
bool StaticMapTree::InitMap(const std::string &fname, VMapManager2 *vm)
{
std::cout << "Initializing StaticMapTree '" << fname << "'\n";
sLog.outDebug("StaticMapTree::InitMap() : initializing StaticMapTree '%s'", fname.c_str());
bool success = true;
std::string fullname = iBasePath + fname;
FILE *rf = fopen(fullname.c_str(), "rb");
@@ -286,12 +306,12 @@ namespace VMAP
// only non-tiled maps have them, and if so exactly one (so far at least...)
ModelSpawn spawn;
#ifdef VMAP_DEBUG
std::cout << "Map isTiled:" << bool(iIsTiled) << std::endl;
sLog.outDebug("StaticMapTree::InitMap() : map isTiled: %u", static_cast<uint32>(iIsTiled));
#endif
if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn))
{
WorldModel *model = vm->acquireModelInstance(iBasePath, spawn.name);
std::cout << "StaticMapTree::InitMap(): loading " << spawn.name << std::endl;
sLog.outDebug("StaticMapTree::InitMap() : loading %s", spawn.name.c_str());
if (model)
{
// assume that global model always is the first and only tree value (could be improved...)
@@ -301,7 +321,7 @@ namespace VMAP
else
{
success = false;
std::cout << "error: could not acquire WorldModel pointer!\n";
sLog.outError("StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str());
}
}
@@ -337,7 +357,7 @@ namespace VMAP
}
if (!iTreeValues)
{
std::cout << "Tree has not been initialized!\n";
sLog.outError("StaticMapTree::LoadMapTile() : tree has not been initialized [%u,%u]", tileX, tileY);
return false;
}
bool result = true;
@@ -346,8 +366,12 @@ namespace VMAP
FILE* tf = fopen(tilefile.c_str(), "rb");
if (tf)
{
char chunk[8];
if (!readChunk(tf, chunk, VMAP_MAGIC, 8))
result = false;
uint32 numSpawns;
if (fread(&numSpawns, sizeof(uint32), 1, tf) != 1)
if (result && fread(&numSpawns, sizeof(uint32), 1, tf) != 1)
result = false;
for (uint32 i=0; i<numSpawns && result; ++i)
{
@@ -358,7 +382,8 @@ namespace VMAP
{
// acquire model instance
WorldModel *model = vm->acquireModelInstance(iBasePath, spawn.name);
if (!model) std::cout << "error: could not acquire WorldModel pointer!\n";
if (!model)
sLog.outError("StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u,%u]", tileX, tileY);
// update tree
uint32 referencedVal;
@@ -369,7 +394,7 @@ namespace VMAP
#ifdef VMAP_DEBUG
if (referencedVal > iNTreeValues)
{
std::cout << "invalid tree element! (" << referencedVal << "/" << iNTreeValues << ")\n";
sLog.outDebug("StaticMapTree::LoadMapTile() : invalid tree element (%u/%u)", referencedVal, iNTreeValues);
continue;
}
#endif
@@ -380,8 +405,10 @@ namespace VMAP
{
++iLoadedSpawns[referencedVal];
#ifdef VMAP_DEBUG
if (iTreeValues[referencedVal].ID != spawn.ID) std::cout << "error: trying to load wrong spawn in node!\n";
else if (iTreeValues[referencedVal].name != spawn.name) std::cout << "error: name collision on GUID="<< spawn.ID << "\n";
if (iTreeValues[referencedVal].ID != spawn.ID)
sLog.outDebug("StaticMapTree::LoadMapTile() : trying to load wrong spawn in node");
else if (iTreeValues[referencedVal].name != spawn.name)
sLog.outDebug("StaticMapTree::LoadMapTile() : name collision on GUID=%u", spawn.ID);
#endif
}
}
@@ -402,7 +429,7 @@ namespace VMAP
loadedTileMap::iterator tile = iLoadedTiles.find(tileID);
if (tile == iLoadedTiles.end())
{
std::cout << "WARNING: trying to unload non-loaded tile. Map:" << iMapID << " X:" << tileX << " Y:" << tileY << std::endl;
sLog.outError("StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY);
return;
}
if (tile->second) // file associated with tile
@@ -412,6 +439,9 @@ namespace VMAP
if (tf)
{
bool result=true;
char chunk[8];
if (!readChunk(tf, chunk, VMAP_MAGIC, 8))
result = false;
uint32 numSpawns;
if (fread(&numSpawns, sizeof(uint32), 1, tf) != 1)
result = false;
@@ -431,11 +461,10 @@ namespace VMAP
fread(&referencedNode, sizeof(uint32), 1, tf);
if (!iLoadedSpawns.count(referencedNode))
{
std::cout << "error! trying to unload non-referenced model '" << spawn.name << "' (ID:" << spawn.ID << ")\n";
sLog.outError("StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
}
else if (--iLoadedSpawns[referencedNode] == 0)
{
//std::cout << "MapTree: removing '" << spawn.name << "' from tree\n";
iTreeValues[referencedNode].setUnloaded();
iLoadedSpawns.erase(referencedNode);
}
+4 -4
View File
@@ -19,9 +19,9 @@
#ifndef _MAPTREE_H
#define _MAPTREE_H
#include "Platform/Define.h"
#include "Utilities/UnorderedMap.h"
#include "BIH.h"
#include "Define.h"
#include "Dynamic/UnorderedMap.h"
#include "BoundingIntervalHierarchy.h"
namespace VMAP
{
@@ -57,7 +57,7 @@ namespace VMAP
std::string iBasePath;
private:
float getIntersectionTime(const G3D::Ray& pRay, float pMaxDist, bool pStopAtFirstHit) const;
bool getIntersectionTime(const G3D::Ray& pRay, float &pMaxDist, bool pStopAtFirstHit) const;
//bool containsLoadedMapTile(unsigned int pTileIdent) const { return(iLoadedMapTiles.containsKey(pTileIdent)); }
public:
static std::string getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY);
+16 -14
View File
@@ -1,25 +1,25 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "WorldModel.h"
#include "TileAssembler.h"
#include "MapTree.h"
#include "BIH.h"
#include "BoundingIntervalHierarchy.h"
#include "VMapDefinitions.h"
#include <set>
@@ -82,6 +82,7 @@ namespace VMAP
// build global map tree
std::vector<ModelSpawn*> mapSpawns;
UniqueEntryMap::iterator entry;
printf("Calculating model bounds for map %u...\n", map_iter->first);
for (entry = map_iter->second->UniqueEntries.begin(); entry != map_iter->second->UniqueEntries.end(); ++entry)
{
// M2 models don't have a bound set in WDT/ADT placement data, i still think they're not used for LoS at all on retail
@@ -100,6 +101,7 @@ namespace VMAP
spawnedModelFiles.insert(entry->second.name);
}
printf("Creating map tree...\n", map_iter->first);
BIH pTree;
pTree.build(mapSpawns, BoundsTrait<ModelSpawn*>::getBounds);
@@ -107,8 +109,6 @@ namespace VMAP
std::map<uint32, uint32> modelNodeIdx;
for (uint32 i=0; i<mapSpawns.size(); ++i)
modelNodeIdx.insert(pair<uint32, uint32>(mapSpawns[i]->ID, i));
if (!modelNodeIdx.empty())
printf("min GUID: %u, max GUID: %u\n", modelNodeIdx.begin()->first, modelNodeIdx.rbegin()->first);
// write map tree file
std::stringstream mapfilename;
@@ -158,6 +158,8 @@ namespace VMAP
StaticMapTree::unpackTileID(tile->first, x, y);
tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile";
FILE *tilefile = fopen(tilefilename.str().c_str(), "wb");
// file header
if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8) success = false;
// write number of tile spawns
if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1) success = false;
// write tile spawns
+17 -13
View File
@@ -1,24 +1,25 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ModelInstance.h"
#include "WorldModel.h"
#include "MapTree.h"
#include "VMapDefinitions.h"
using G3D::Vector3;
using G3D::Ray;
@@ -56,8 +57,11 @@ namespace VMAP
Ray modRay(p, iInvRot * pRay.direction());
float distance = pMaxDist * iInvScale;
bool hit = iModel->IntersectRay(modRay, distance, pStopAtFirstHit);
distance *= iScale;
pMaxDist = distance;
if(hit)
{
distance *= iScale;
pMaxDist = distance;
}
return hit;
}
+1 -1
View File
@@ -24,7 +24,7 @@
#include <G3D/AABox.h>
#include <G3D/Ray.h>
#include "Platform/Define.h"
#include "Define.h"
namespace VMAP
{
+48 -15
View File
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "WorldModel.h"
@@ -148,15 +148,48 @@ namespace VMAP
bool WmoLiquid::GetLiquidHeight(const Vector3 &pos, float &liqHeight) const
{
uint32 tx = (pos.x - iCorner.x)/LIQUID_TILE_SIZE;
float tx_f = (pos.x - iCorner.x)/LIQUID_TILE_SIZE;
uint32 tx = uint32(tx_f);
if (tx<0 || tx >= iTilesX) return false;
uint32 ty = (pos.y - iCorner.y)/LIQUID_TILE_SIZE;
float ty_f = (pos.y - iCorner.y)/LIQUID_TILE_SIZE;
uint32 ty = uint32(ty_f);
if (ty<0 || ty >= iTilesY) return false;
// check if tile shall be used for liquid level
// checking for 0x08 *might* be enough, but disabled tiles always are 0x?F:
if ((iFlags[tx + ty*iTilesX] & 0x0F) == 0x0F)
return false;
//placeholder...use only lower left corner vertex
liqHeight = /* iCorner.z + */ iHeight[tx + ty*(iTilesX+1)];
// (dx, dy) coordinates inside tile, in [0,1]^2
float dx = tx_f - (float)tx;
float dy = ty_f - (float)ty;
/* Tesselate tile to two triangles (not sure if client does it exactly like this)
^ dy
|
1 x---------x (1,1)
| (b) / |
| / |
| / |
| / (a) |
x---------x---> dx
0 1
*/
const uint32 rowOffset = iTilesX + 1;
if (dx > dy) // case (a)
{
float sx = iHeight[tx+1 + ty * rowOffset] - iHeight[tx + ty * rowOffset];
float sy = iHeight[tx+1 + (ty+1) * rowOffset] - iHeight[tx+1 + ty * rowOffset];
liqHeight = iHeight[tx + ty * rowOffset] + dx * sx + dy * sy;
}
else // case (b)
{
float sx = iHeight[tx+1 + (ty+1) * rowOffset] - iHeight[tx + (ty+1) * rowOffset];
float sy = iHeight[tx + (ty+1) * rowOffset] - iHeight[tx + ty * rowOffset];
liqHeight = iHeight[tx + ty * rowOffset] + dx * sx + dy * sy;
}
return true;
}
+2 -2
View File
@@ -23,9 +23,9 @@
#include <G3D/Vector3.h>
#include <G3D/AABox.h>
#include <G3D/Ray.h>
#include "BIH.h"
#include "BoundingIntervalHierarchy.h"
#include "Platform/Define.h"
#include "Define.h"
namespace VMAP
{
+11 -11
View File
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2008-YYYY TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _VMAPDEFINITIONS_H
+1 -1
View File
@@ -231,7 +231,7 @@ void PetAI::UpdateAllies()
Unit* owner = me->GetCharmerOrOwner();
Group *pGroup = NULL;
m_updateAlliesTimer = 10*IN_MILISECONDS; //update friendly targets every 10 seconds, lesser checks increase performance
m_updateAlliesTimer = 10*IN_MILLISECONDS; //update friendly targets every 10 seconds, lesser checks increase performance
if (!owner)
return;
+1 -1
View File
@@ -21,7 +21,7 @@
#ifndef TRINITY_UNITAI_H
#define TRINITY_UNITAI_H
#include "Platform/Define.h"
#include "Define.h"
#include <list>
#include "Unit.h"
+2 -2
View File
@@ -21,8 +21,8 @@
#define TRINITY_CREATUREAIFACTORY_H
//#include "Policies/Singleton.h"
#include "Dynamic/ObjectRegistry.h"
#include "Dynamic/FactoryHolder.h"
#include "ObjectRegistry.h"
#include "FactoryHolder.h"
struct SelectableAI : public FactoryHolder<CreatureAI>, public Permissible<Creature>
{
+1 -1
View File
@@ -19,7 +19,7 @@
#define CREATUREAIIMPL_H
#include "Common.h"
#include "Platform/Define.h"
#include "Define.h"
#include "TemporarySummon.h"
#include "CreatureAI.h"
#include "SpellMgr.h"
+3 -6
View File
@@ -21,22 +21,19 @@
#include "Creature.h"
#include "CreatureAISelector.h"
#include "PassiveAI.h"
#include "Policies/SingletonImp.h"
#include "MovementGenerator.h"
#include "Pet.h"
#include "TemporarySummon.h"
#include "CreatureAIFactory.h"
#include "ScriptMgr.h"
INSTANTIATE_SINGLETON_1(CreatureAIRegistry);
INSTANTIATE_SINGLETON_1(MovementGeneratorRegistry);
namespace FactorySelector
{
CreatureAI* selectAI(Creature *creature)
{
const CreatureAICreator *ai_factory = NULL;
CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance());
CreatureAIRegistry& ai_registry(*CreatureAIRepository::instance());
if (creature->isPet())
ai_factory = ai_registry.GetRegistryItem("PetAI");
@@ -106,7 +103,7 @@ namespace FactorySelector
MovementGenerator* selectMovementGenerator(Creature *creature)
{
MovementGeneratorRegistry &mv_registry(MovementGeneratorRepository::Instance());
MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance());
assert(creature->GetCreatureInfo() != NULL);
const MovementGeneratorCreator *mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType());
@@ -456,7 +456,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
caster = target;
//Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered
bool canCast = !caster->IsNonMeleeSpellCasted(false) || (action.cast.castFlags & (CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS));
bool canCast = !caster->IsNonMeleeSpellCasted(false) || (action.cast.castFlags & (CAST_TRIGGERED | CAST_INTERRUPT_PREVIOUS));
// If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
if (action.cast.castFlags & CAST_AURA_NOT_PRESENT)
@@ -492,7 +492,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
else
{
//Interrupt any previous spell
if (caster->IsNonMeleeSpellCasted(false) && action.cast.castFlags & CAST_INTURRUPT_PREVIOUS)
if (caster->IsNonMeleeSpellCasted(false) && action.cast.castFlags & CAST_INTERRUPT_PREVIOUS)
caster->InterruptNonMeleeSpells(false);
caster->CastSpell(target, action.cast.spellId, (action.cast.castFlags & CAST_TRIGGERED));
@@ -1331,12 +1331,12 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
if ((*itr).Event.receive_emote.emoteId != text_emote)
return;
Condition* cond = new Condition();
cond->mConditionType = ConditionType((*itr).Event.receive_emote.condition);
cond->mConditionValue1 = (*itr).Event.receive_emote.conditionValue1;
cond->mConditionValue2 = (*itr).Event.receive_emote.conditionValue2;
Condition cond;
cond.mConditionType = ConditionType((*itr).Event.receive_emote.condition);
cond.mConditionValue1 = (*itr).Event.receive_emote.conditionValue1;
cond.mConditionValue2 = (*itr).Event.receive_emote.conditionValue2;
if (cond->Meets(pPlayer))
if (cond.Meets(pPlayer))
{
sLog.outDebug("CreatureEventAI: ReceiveEmote CreatureEventAI: Condition ok, processing");
ProcessEvent(*itr, pPlayer);
+1 -1
View File
@@ -150,7 +150,7 @@ enum Target
enum CastFlags
{
CAST_INTURRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
CAST_INTERRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
CAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time)
CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
@@ -17,19 +17,16 @@
*/
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "Database/SQLStorage.h"
#include "DatabaseEnv.h"
#include "SQLStorage.h"
#include "CreatureEventAI.h"
#include "CreatureEventAIMgr.h"
#include "ObjectMgr.h"
#include "ProgressBar.h"
#include "Policies/SingletonImp.h"
#include "ObjectDefines.h"
#include "GridDefines.h"
#include "ConditionMgr.h"
INSTANTIATE_SINGLETON_1(CreatureEventAIMgr);
// -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
{
@@ -362,11 +359,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
if (temp.receive_emote.condition)
{
Condition* cond = new Condition();
cond->mConditionType = ConditionType(temp.receive_emote.condition);
cond->mConditionValue1 = temp.receive_emote.conditionValue1;
cond->mConditionValue2 = temp.receive_emote.conditionValue2;
if (!sConditionMgr.isConditionTypeValid(cond))
Condition cond;
cond.mConditionType = ConditionType(temp.receive_emote.condition);
cond.mConditionValue1 = temp.receive_emote.conditionValue1;
cond.mConditionValue2 = temp.receive_emote.conditionValue2;
if (!sConditionMgr.isConditionTypeValid(&cond))
{
sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.",temp.creature_id, i, temp.receive_emote.condition);
continue;
@@ -24,8 +24,9 @@
class CreatureEventAIMgr
{
friend class ACE_Singleton<CreatureEventAIMgr, ACE_Null_Mutex>;
CreatureEventAIMgr(){};
public:
CreatureEventAIMgr(){};
~CreatureEventAIMgr(){};
void LoadCreatureEventAI_Texts();
@@ -42,5 +43,5 @@ class CreatureEventAIMgr
CreatureEventAI_TextMap m_CreatureEventAI_TextMap;
};
#define CreatureEAI_Mgr Trinity::Singleton<CreatureEventAIMgr>::Instance()
#define CreatureEAI_Mgr (*ACE_Singleton<CreatureEventAIMgr, ACE_Null_Mutex>::instance())
#endif
@@ -5,7 +5,7 @@
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#include "ScriptedPch.h"
#include "ScriptPCH.h"
#include "Item.h"
#include "Spell.h"
#include "ObjectMgr.h"
@@ -153,7 +153,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* pSource, uint32 uiSoundId)
if (!GetSoundEntriesStore()->LookupEntry(uiSoundId))
{
error_log("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", uiSoundId, pSource->GetTypeId(), pSource->GetGUIDLow());
sLog.outError("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", uiSoundId, pSource->GetTypeId(), pSource->GetGUIDLow());
return;
}
@@ -398,7 +398,7 @@ void ScriptedAI::DoResetThreat()
{
if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty())
{
error_log("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
sLog.outError("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
return;
}
@@ -441,7 +441,7 @@ void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, flo
if (!pUnit || pUnit->GetTypeId() != TYPEID_PLAYER)
{
if (pUnit)
error_log("TSCR: Creature %u (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: %u) to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), pUnit->GetTypeId(), pUnit->GetGUID(), fX, fY, fZ, fO);
sLog.outError("TSCR: Creature %u (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: %u) to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), pUnit->GetTypeId(), pUnit->GetGUID(), fX, fY, fZ, fO);
return;
}
@@ -578,7 +578,7 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff)
return false;
break;
default:
error_log("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition.", me->GetEntry());
sLog.outError("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition.", me->GetEntry());
return false;
}
@@ -9,7 +9,7 @@ SDComment:
SDCategory: Npc
EndScriptData */
#include "ScriptedPch.h"
#include "ScriptPCH.h"
#include "ScriptedEscortAI.h"
enum ePoints
@@ -104,7 +104,7 @@ void npc_escortAI::MoveInLineOfSight(Unit* pWho)
{
if (!me->getVictim())
{
pWho->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH);
pWho->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
AttackStart(pWho);
}
else if (me->GetMap()->IsDungeon())
@@ -177,7 +177,7 @@ void npc_escortAI::EnterEvadeMode()
{
AddEscortState(STATE_ESCORT_RETURNING);
ReturnToLastPoint();
debug_log("TSCR: EscortAI has left combat and is now returning to last point");
sLog.outDebug("TSCR: EscortAI has left combat and is now returning to last point");
}
else
{
@@ -224,7 +224,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
{
if (DespawnAtEnd)
{
debug_log("TSCR: EscortAI reached end of waypoints");
sLog.outDebug("TSCR: EscortAI reached end of waypoints");
if (m_bCanReturnToStart)
{
@@ -235,7 +235,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
m_uiWPWaitTimer = 0;
debug_log("TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
sLog.outDebug("TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
return;
}
@@ -251,7 +251,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
}
else
{
debug_log("TSCR: EscortAI reached end of waypoints with Despawn off");
sLog.outDebug("TSCR: EscortAI reached end of waypoints with Despawn off");
return;
}
@@ -260,7 +260,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
if (!HasEscortState(STATE_ESCORT_PAUSED))
{
me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
debug_log("TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
sLog.outDebug("TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
WaypointStart(CurrentWP->id);
@@ -278,7 +278,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
{
if (DespawnAtFar && !IsPlayerOrGroupInRange())
{
debug_log("TSCR: EscortAI failed because player/group was to far away or not found");
sLog.outDebug("TSCR: EscortAI failed because player/group was to far away or not found");
if (m_bCanInstantRespawn)
{
@@ -316,7 +316,7 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
//Combat start position reached, continue waypoint movement
if (uiPointId == POINT_LAST_POINT)
{
debug_log("TSCR: EscortAI has returned to original position before combat");
sLog.outDebug("TSCR: EscortAI has returned to original position before combat");
if (m_bIsRunning && me->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
@@ -330,7 +330,7 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
}
else if (uiPointId == POINT_HOME)
{
debug_log("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");
sLog.outDebug("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");
CurrentWP = WaypointList.begin();
m_uiWPWaitTimer = 1;
@@ -340,11 +340,11 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
//Make sure that we are still on the right waypoint
if (CurrentWP->id != uiPointId)
{
error_log("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", uiPointId, CurrentWP->id, me->GetEntry());
sLog.outError("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", uiPointId, CurrentWP->id, me->GetEntry());
return;
}
debug_log("TSCR: EscortAI Waypoint %u reached", CurrentWP->id);
sLog.outDebug("TSCR: EscortAI Waypoint %u reached", CurrentWP->id);
//Call WP function
WaypointReached(CurrentWP->id);
@@ -415,14 +415,14 @@ void npc_escortAI::SetRun(bool bRun)
if (!m_bIsRunning)
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else
debug_log("TSCR: EscortAI attempt to set run mode, but is already running.");
sLog.outDebug("TSCR: EscortAI attempt to set run mode, but is already running.");
}
else
{
if (m_bIsRunning)
me->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else
debug_log("TSCR: EscortAI attempt to set walk mode, but is already walking.");
sLog.outDebug("TSCR: EscortAI attempt to set walk mode, but is already walking.");
}
m_bIsRunning = bRun;
}
@@ -432,13 +432,13 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID,
{
if (me->getVictim())
{
error_log("TSCR ERROR: EscortAI attempt to Start while in combat. Scriptname: %s, creature entry: %u", me->GetScriptName().c_str(), me->GetEntry());
sLog.outError("TSCR ERROR: EscortAI attempt to Start while in combat. Scriptname: %s, creature entry: %u", me->GetScriptName().c_str(), me->GetEntry());
return;
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
error_log("TSCR: EscortAI attempt to Start while already escorting.");
sLog.outError("TSCR: EscortAI attempt to Start while already escorting.");
return;
}
@@ -454,7 +454,7 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID,
if (WaypointList.empty())
{
error_db_log("TSCR: EscortAI Start with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", pQuest ? pQuest->GetQuestId() : 0);
sLog.outErrorDb("TSCR: EscortAI Start with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", pQuest ? pQuest->GetQuestId() : 0);
return;
}
@@ -469,19 +469,19 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID,
m_bCanReturnToStart = bCanLoopPath;
if (m_bCanReturnToStart && m_bCanInstantRespawn)
debug_log("TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
sLog.outDebug("TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MoveIdle();
debug_log("TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
sLog.outDebug("TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
}
//disable npcflags
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
debug_log("TSCR: EscortAI started with %u waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %u", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
sLog.outDebug("TSCR: EscortAI started with %u waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %u", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
CurrentWP = WaypointList.begin();
@@ -9,7 +9,7 @@ SDComment: This AI is under development
SDCategory: Npc
EndScriptData */
#include "ScriptedPch.h"
#include "ScriptPCH.h"
#include "ScriptedFollowerAI.h"
const float MAX_PLAYER_DISTANCE = 100.0f;
@@ -102,7 +102,7 @@ void FollowerAI::MoveInLineOfSight(Unit* pWho)
{
if (!me->getVictim())
{
pWho->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH);
pWho->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
AttackStart(pWho);
}
else if (me->GetMap()->IsDungeon())
@@ -164,7 +164,7 @@ void FollowerAI::EnterEvadeMode()
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
debug_log("TSCR: FollowerAI left combat, returning to CombatStartPosition.");
sLog.outDebug("TSCR: FollowerAI left combat, returning to CombatStartPosition.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
{
@@ -190,7 +190,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
{
debug_log("TSCR: FollowerAI is set completed, despawns.");
sLog.outDebug("TSCR: FollowerAI is set completed, despawns.");
me->ForcedDespawn();
return;
}
@@ -201,7 +201,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_RETURNING))
{
debug_log("TSCR: FollowerAI is returning to leader.");
sLog.outDebug("TSCR: FollowerAI is returning to leader.");
RemoveFollowState(STATE_FOLLOW_RETURNING);
me->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
@@ -230,7 +230,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
if (bIsMaxRangeExceeded)
{
debug_log("TSCR: FollowerAI failed because player/group was to far away or not found");
sLog.outDebug("TSCR: FollowerAI failed because player/group was to far away or not found");
me->ForcedDespawn();
return;
}
@@ -273,13 +273,13 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const
{
if (me->getVictim())
{
debug_log("TSCR: FollowerAI attempt to StartFollow while in combat.");
sLog.outDebug("TSCR: FollowerAI attempt to StartFollow while in combat.");
return;
}
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
error_log("TSCR: FollowerAI attempt to StartFollow while already following.");
sLog.outError("TSCR: FollowerAI attempt to StartFollow while already following.");
return;
}
@@ -295,7 +295,7 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
debug_log("TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
sLog.outDebug("TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
}
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
@@ -304,7 +304,7 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const
me->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
debug_log("TSCR: FollowerAI start follow %s (GUID %u)", pLeader->GetName(), m_uiLeaderGUID);
sLog.outDebug("TSCR: FollowerAI start follow %s (GUID %u)", pLeader->GetName(), m_uiLeaderGUID);
}
Player* FollowerAI::GetLeaderForFollower()
@@ -323,7 +323,7 @@ Player* FollowerAI::GetLeaderForFollower()
if (pMember && pMember->isAlive() && me->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE))
{
debug_log("TSCR: FollowerAI GetLeader changed and returned new leader.");
sLog.outDebug("TSCR: FollowerAI GetLeader changed and returned new leader.");
m_uiLeaderGUID = pMember->GetGUID();
return pMember;
break;
@@ -333,7 +333,7 @@ Player* FollowerAI::GetLeaderForFollower()
}
}
debug_log("TSCR: FollowerAI GetLeader can not find suitable leader.");
sLog.outDebug("TSCR: FollowerAI GetLeader can not find suitable leader.");
return NULL;
}
@@ -21,7 +21,7 @@ SDComment:
SDCategory: Guards
EndScriptData */
#include "ScriptedPch.h"
#include "ScriptPCH.h"
#include "ScriptedGuardAI.h"
// **** This script is for use within every single guard to save coding time ****
@@ -8,11 +8,11 @@
#include "InstanceData.h"
#include "Map.h"
#define OUT_SAVE_INST_DATA debug_log("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
#define OUT_SAVE_INST_DATA_COMPLETE debug_log("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
#define OUT_LOAD_INST_DATA(a) debug_log("TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a)
#define OUT_LOAD_INST_DATA_COMPLETE debug_log("TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.",instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
#define OUT_LOAD_INST_DATA_FAIL error_log("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
#define OUT_SAVE_INST_DATA sLog.outDebug("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
#define OUT_SAVE_INST_DATA_COMPLETE sLog.outDebug("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
#define OUT_LOAD_INST_DATA(a) sLog.outDebug("TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a)
#define OUT_LOAD_INST_DATA_COMPLETE sLog.outDebug("TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.",instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
#define OUT_LOAD_INST_DATA_FAIL sLog.outError("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
#define ScriptedInstance InstanceData
@@ -21,7 +21,7 @@ SDComment: Base Class for SimpleAI creatures
SDCategory: Creatures
EndScriptData */
#include "ScriptedPch.h"
#include "ScriptPCH.h"
#include "ScriptedSimpleAI.h"
SimpleAI::SimpleAI(Creature *c) : ScriptedAI(c)
+3 -5
View File
@@ -18,19 +18,17 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Database/DatabaseEnv.h"
#include "Policies/SingletonImp.h"
#include "DatabaseEnv.h"
#include "AccountMgr.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Util.h"
#include "Auth/Sha1.h"
#include "SHA1.h"
extern DatabaseType LoginDatabase;
INSTANTIATE_SINGLETON_1(AccountMgr);
AccountMgr::AccountMgr()
{}
+1 -2
View File
@@ -24,7 +24,6 @@
#include <string>
#include "Common.h"
#include "Policies/Singleton.h"
enum AccountOpResult
{
@@ -59,6 +58,6 @@ class AccountMgr
static bool normalizeString(std::string& utf8str);
};
#define accmgr Trinity::Singleton<AccountMgr>::Instance()
#define accmgr (*ACE_Singleton<AccountMgr, ACE_Null_Mutex>::instance())
#endif
+54 -22
View File
@@ -21,8 +21,8 @@
#include "ObjectMgr.h"
#include "World.h"
#include "WorldPacket.h"
#include "Database/DatabaseEnv.h"
#include "Policies/SingletonImp.h"
#include "DatabaseEnv.h"
#include "AchievementMgr.h"
#include "ArenaTeam.h"
@@ -41,8 +41,6 @@
#include "Map.h"
#include "InstanceData.h"
INSTANTIATE_SINGLETON_1(AchievementGlobalMgr);
namespace Trinity
{
class AchievementChatBuilder
@@ -873,6 +871,36 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
SetCriteriaProgress(achievementCriteria, counter);
break;
}
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY:
{
time_t nextDailyResetTime = sWorld.GetNextDailyQuestsResetTime();
CriteriaProgress *progress = GetCriteriaProgress(achievementCriteria);
if (!miscvalue1) // Login case.
{
// reset if player missed one day.
if (progress && progress->date < (nextDailyResetTime - 2 * DAY))
SetCriteriaProgress(achievementCriteria, 0, PROGRESS_SET);
continue;
}
ProgressType progressType;
if (!progress)
// 1st time. Start count.
progressType = PROGRESS_SET;
else if (progress->date < (nextDailyResetTime - 2 * DAY))
// last progress is older than 2 days. Player missed 1 day => Retart count.
progressType = PROGRESS_SET;
else if (progress->date < (nextDailyResetTime - DAY))
// last progress is between 1 and 2 days. => 1st time of the day.
progressType = PROGRESS_ACCUMULATE;
else
// last progress is within the day before the reset => Already counted today.
continue;
SetCriteriaProgress(achievementCriteria, 1, progressType);
break;
}
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
{
// speedup for non-login case
@@ -935,7 +963,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if (!miscvalue1)
continue;
Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : MapManager::Instance().FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId());
Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : sMapMgr.FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId());
if (!map || !map->IsDungeon())
continue;
@@ -1428,7 +1456,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_RATING:
break;
// FIXME: not triggered in code as result, need to implement
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY:
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID:
case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE:
case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA:
@@ -1483,11 +1510,10 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
return false;
}
CriteriaProgressMap::const_iterator itr = m_criteriaProgress.find(achievementCriteria->ID);
if (itr == m_criteriaProgress.end())
CriteriaProgress const* progress = GetCriteriaProgress(achievementCriteria);
if (!progress)
return false;
CriteriaProgress const* progress = &itr->second;
switch(achievementCriteria->requiredType)
{
@@ -1516,6 +1542,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
return progress->counter >= 1;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT:
return progress->counter >= achievementCriteria->complete_quest_count.totalQuestCount;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY:
return progress->counter >= achievementCriteria->complete_daily_quest_daily.numberOfDays;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
return progress->counter >= achievementCriteria->complete_quests_in_zone.questCount;
case ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE:
@@ -1661,11 +1689,10 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
{
AchievementCriteriaEntry const* criteria = *itr;
CriteriaProgressMap::const_iterator itrProgress = m_criteriaProgress.find(criteria->ID);
if (itrProgress == m_criteriaProgress.end())
CriteriaProgress const* progress = GetCriteriaProgress(criteria);
if (!progress)
continue;
CriteriaProgress const* progress = &itrProgress->second;
count += progress->counter;
// for counters, field4 contains the main count requirement
@@ -1701,6 +1728,16 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
return false;
}
CriteriaProgress* AchievementMgr::GetCriteriaProgress(AchievementCriteriaEntry const* entry)
{
CriteriaProgressMap::iterator iter = m_criteriaProgress.find(entry->ID);
if (iter == m_criteriaProgress.end())
return NULL;
return &(iter->second);
}
void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype)
{
// Don't allow to cheat - doing timed achievements without timer active
@@ -1711,11 +1748,8 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
if ((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES) == 0)
sLog.outDetail("AchievementMgr::SetCriteriaProgress(%u, %u) for (GUID:%u)", entry->ID, changeValue, m_player->GetGUIDLow());
CriteriaProgress *progress = NULL;
CriteriaProgressMap::iterator iter = m_criteriaProgress.find(entry->ID);
if (iter == m_criteriaProgress.end())
CriteriaProgress* progress = GetCriteriaProgress(entry);
if (!progress)
{
// not create record for 0 counter but allow it for timed achievements
// we will need to send 0 progress to client to start the timer
@@ -1724,12 +1758,9 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
progress = &m_criteriaProgress[entry->ID];
progress->counter = changeValue;
progress->date = time(NULL);
}
else
{
progress = &iter->second;
uint32 newValue = 0;
switch(ptype)
{
@@ -1756,6 +1787,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
}
progress->changed = true;
progress->date = time(NULL); // set the date to the latest update.
uint32 timeElapsed = 0;
bool timedCompleted = false;
@@ -1765,7 +1797,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
//has to exist else we wouldn't be here
timedCompleted = IsCompletedCriteria(entry, sAchievementStore.LookupEntry(entry->referredAchievement));
// Client expects this in packet
timeElapsed = entry->timeLimit - (timedIter->second/IN_MILISECONDS);
timeElapsed = entry->timeLimit - (timedIter->second/IN_MILLISECONDS);
// Remove the timer, we wont need it anymore
if (timedCompleted)
@@ -1809,7 +1841,7 @@ void AchievementMgr::StartTimedAchievement(AchievementCriteriaTimedTypes type, u
if (m_timedAchievements.find((*i)->ID) == m_timedAchievements.end() && !IsCompletedCriteria(*i, achievement))
{
// Start the timer
m_timedAchievements[(*i)->ID] = (*i)->timeLimit * IN_MILISECONDS;
m_timedAchievements[(*i)->ID] = (*i)->timeLimit * IN_MILLISECONDS;
// and at client too
SetCriteriaProgress(*i, 0, PROGRESS_SET);
@@ -22,8 +22,8 @@
#include <string>
#include "Common.h"
#include "Policies/Singleton.h"
#include "Database/DatabaseEnv.h"
#include "ace/Singleton.h"
#include "DatabaseEnv.h"
#include "DBCEnums.h"
#include "DBCStores.h"
@@ -36,7 +36,7 @@ typedef std::map<uint32,AchievementEntryList> AchievementListByReference
struct CriteriaProgress
{
uint32 counter;
time_t date;
time_t date; // latest update time.
bool changed;
};
@@ -258,6 +258,7 @@ class AchievementMgr
enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST };
void SendAchievementEarned(AchievementEntry const* achievement);
void SendCriteriaUpdate(AchievementCriteriaEntry const* entry, CriteriaProgress const* progress, uint32 timeElapsed, bool timedCompleted);
CriteriaProgress* GetCriteriaProgress(AchievementCriteriaEntry const* entry);
void SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype = PROGRESS_SET);
void CompletedCriteriaFor(AchievementEntry const* achievement);
bool IsCompletedCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement);
@@ -341,6 +342,6 @@ class AchievementGlobalMgr
AchievementRewardLocales m_achievementRewardLocales;
};
#define achievementmgr Trinity::Singleton<AchievementGlobalMgr>::Instance()
#define achievementmgr (*ACE_Singleton<AchievementGlobalMgr, ACE_Null_Mutex>::instance())
#endif
+4 -7
View File
@@ -1,8 +1,7 @@
/*
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -18,20 +17,18 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Database/DatabaseEnv.h"
#include "Policies/SingletonImp.h"
#include "DatabaseEnv.h"
#include "AddonMgr.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Util.h"
#include "Auth/Sha1.h"
#include "SHA1.h"
#include "ProgressBar.h"
extern DatabaseType LoginDatabase;
INSTANTIATE_SINGLETON_1(AddonMgr);
AddonMgr::AddonMgr()
{
}
+5 -5
View File
@@ -1,8 +1,7 @@
/*
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -22,7 +21,7 @@
#define _ADDONMGR_H
#include "Common.h"
#include "Policies/Singleton.h"
#include "ace/Singleton.h"
#include <string>
@@ -68,9 +67,10 @@ typedef std::list<SavedAddon> SavedAddonsList;
class AddonMgr
{
friend class ACE_Singleton<AddonMgr, ACE_Null_Mutex>;
AddonMgr();
public:
AddonMgr();
~AddonMgr();
void LoadFromDB();
@@ -83,7 +83,7 @@ class AddonMgr
SavedAddonsList m_knownAddons; // Known addons.
};
#define sAddonMgr Trinity::Singleton<AddonMgr>::Instance()
#define sAddonMgr (*ACE_Singleton<AddonMgr, ACE_Null_Mutex>::instance())
#endif
@@ -1,11 +1,27 @@
/*
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ObjectMgr.h"
#include "AuctionHouseMgr.h"
#include "AuctionHouseBot.h"
#include <vector>
#include "Policies/SingletonImp.h"
INSTANTIATE_SINGLETON_1(AuctionHouseBot);
using namespace std;
vector<uint32> npcItems;
vector<uint32> lootItems;
@@ -23,6 +39,7 @@ vector<uint32> blueItemsBin;
vector<uint32> purpleItemsBin;
vector<uint32> orangeItemsBin;
vector<uint32> yellowItemsBin;
AuctionHouseBot::AuctionHouseBot()
{
debug_Out = false;
@@ -693,7 +710,7 @@ void AuctionHouseBot::Update()
WorldSession _session(AHBplayerAccount, NULL, SEC_PLAYER, true, 0, LOCALE_enUS);
Player _AHBplayer(&_session);
_AHBplayer.Initialize(AHBplayerGUID);
ObjectAccessor::Instance().AddObject(&_AHBplayer);
sObjectAccessor.AddObject(&_AHBplayer);
// Add New Bids
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
@@ -725,7 +742,7 @@ void AuctionHouseBot::Update()
addNewAuctionBuyerBotBid(&_AHBplayer, &NeutralConfig, &_session);
_lastrun_n = _newrun;
}
ObjectAccessor::Instance().RemoveObject(&_AHBplayer);
sObjectAccessor.RemoveObject(&_AHBplayer);
}
void AuctionHouseBot::Initialize()
@@ -1510,6 +1527,7 @@ void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char*
uint32 maxItems = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxitems = '%u' WHERE auctionhouse = '%u'", maxItems, ahMapID);
config->SetMaxItems(maxItems);
config->CalculatePercents();
}
break;
case 3: //min time Deprecated (Place holder for future commands)
@@ -1,8 +1,27 @@
/*
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AUCTION_HOUSE_BOT_H
#define AUCTION_HOUSE_BOT_H
#include "World.h"
#include "Config/ConfigEnv.h"
#include "ConfigEnv.h"
#include "ItemPrototype.h"
#define AHB_GREY 0
@@ -173,7 +192,8 @@ public:
void SetMaxItems(uint32 value)
{
maxItems = value;
CalculatePercents();
// CalculatePercents() needs to be called, but only if
// SetPercentages() has been called at least once already.
}
uint32 GetMaxItems()
{
@@ -1207,9 +1227,11 @@ private:
inline uint32 minValue(uint32 a, uint32 b) { return a <= b ? a : b; };
void addNewAuctions(Player *AHBplayer, AHBConfig *config);
void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session);
friend class ACE_Singleton<AuctionHouseBot, ACE_Null_Mutex>;
AuctionHouseBot();
public:
AuctionHouseBot();
~AuctionHouseBot();
void Update();
void Initialize();
@@ -1220,6 +1242,6 @@ public:
uint32 GetAHBplayerGUID() { return AHBplayerGUID; };
};
#define auctionbot Trinity::Singleton<AuctionHouseBot>::Instance()
#define auctionbot (*ACE_Singleton<AuctionHouseBot, ACE_Null_Mutex>::instance())
#endif
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Common.h"
@@ -22,21 +22,19 @@
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Database/DatabaseEnv.h"
#include "Database/SQLStorage.h"
#include "Policies/SingletonImp.h"
#include "DatabaseEnv.h"
#include "SQLStorage.h"
#include "DBCStores.h"
#include "AccountMgr.h"
#include "AuctionHouseMgr.h"
#include "Item.h"
#include "Language.h"
#include "Log.h"
#include "Logging/Log.h"
#include "ProgressBar.h"
#include <vector>
INSTANTIATE_SINGLETON_1(AuctionHouseMgr);
using namespace std;
AuctionHouseMgr::AuctionHouseMgr()
@@ -483,7 +481,11 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem
bool AuctionHouseObject::RemoveAuction(AuctionEntry *auction, uint32 item_template)
{
auctionbot.DecrementItemCounts(auction, item_template);
return AuctionsMap.erase(auction->Id) ? true : false;
bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false;
// we need to delete the entry, it is not referenced any more
delete auction;
return wasInMap;
}
void AuctionHouseObject::Update()
@@ -711,7 +713,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const
data << uint32(bid ? GetAuctionOutBid() : 0);
//minimal outbid
data << uint32(buyout); //auction->buyout
data << uint32((expire_time-time(NULL))*IN_MILISECONDS);//time left
data << uint32((expire_time-time(NULL))*IN_MILLISECONDS);//time left
data << uint64(bidder) ; //auction->bidder current
data << uint32(bid); //current bid
return true;
+45 -45
View File
@@ -1,27 +1,25 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _AUCTION_HOUSE_MGR_H
#define _AUCTION_HOUSE_MGR_H
#include "Policies/Singleton.h"
#include "ace/Singleton.h"
#include "SharedDefines.h"
@@ -121,51 +119,53 @@ class AuctionHouseObject
class AuctionHouseMgr
{
public:
friend class ACE_Singleton<AuctionHouseMgr, ACE_Null_Mutex>;
AuctionHouseMgr();
~AuctionHouseMgr();
public:
~AuctionHouseMgr();
typedef UNORDERED_MAP<uint32, Item*> ItemMap;
typedef UNORDERED_MAP<uint32, Item*> ItemMap;
AuctionHouseObject* GetAuctionsMap(uint32 factionTemplateId);
AuctionHouseObject* GetBidsMap(uint32 factionTemplateId);
AuctionHouseObject* GetAuctionsMap(uint32 factionTemplateId);
AuctionHouseObject* GetBidsMap(uint32 factionTemplateId);
Item* GetAItem(uint32 id)
{
ItemMap::const_iterator itr = mAitems.find(id);
if (itr != mAitems.end())
Item* GetAItem(uint32 id)
{
return itr->second;
ItemMap::const_iterator itr = mAitems.find(id);
if (itr != mAitems.end())
{
return itr->second;
}
return NULL;
}
return NULL;
}
//auction messages
void SendAuctionWonMail(AuctionEntry * auction);
void SendAuctionSalePendingMail(AuctionEntry * auction);
void SendAuctionSuccessfulMail(AuctionEntry * auction);
void SendAuctionExpiredMail(AuctionEntry * auction);
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem);
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
//auction messages
void SendAuctionWonMail(AuctionEntry * auction);
void SendAuctionSalePendingMail(AuctionEntry * auction);
void SendAuctionSuccessfulMail(AuctionEntry * auction);
void SendAuctionExpiredMail(AuctionEntry * auction);
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem);
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
public:
public:
//load first auction items, because of check if item exists, when loading
void LoadAuctionItems();
void LoadAuctions();
void LoadAuctionItems();
void LoadAuctions();
void AddAItem(Item* it);
bool RemoveAItem(uint32 id);
void AddAItem(Item* it);
bool RemoveAItem(uint32 id);
void Update();
void Update();
private:
AuctionHouseObject mHordeAuctions;
AuctionHouseObject mAllianceAuctions;
AuctionHouseObject mNeutralAuctions;
private:
AuctionHouseObject mHordeAuctions;
AuctionHouseObject mAllianceAuctions;
AuctionHouseObject mNeutralAuctions;
ItemMap mAitems;
ItemMap mAitems;
};
#define auctionmgr Trinity::Singleton<AuctionHouseMgr>::Instance()
#define auctionmgr (*ACE_Singleton<AuctionHouseMgr, ACE_Null_Mutex>::instance())
#endif
+10 -10
View File
@@ -323,7 +323,7 @@ void BattleGround::Update(uint32 diff)
plr->ResurrectPlayer(1.0f);
plr->CastSpell(plr, 6962, true);
plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true);
ObjectAccessor::Instance().ConvertCorpseForPlayer(*itr);
sObjectAccessor.ConvertCorpseForPlayer(*itr);
}
m_ResurrectQueue.clear();
}
@@ -356,16 +356,16 @@ void BattleGround::Update(uint32 diff)
{
uint32 newtime = m_PrematureCountDownTimer - diff;
// announce every minute
if (newtime > (MINUTE * IN_MILISECONDS))
if (newtime > (MINUTE * IN_MILLISECONDS))
{
if (newtime / (MINUTE * IN_MILISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS))
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS)));
if (newtime / (MINUTE * IN_MILLISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS))
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS)));
}
else
{
//announce every 15 seconds
if (newtime / (15 * IN_MILISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILISECONDS))
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / IN_MILISECONDS));
if (newtime / (15 * IN_MILLISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILLISECONDS))
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / IN_MILLISECONDS));
}
m_PrematureCountDownTimer = newtime;
}
@@ -436,7 +436,7 @@ void BattleGround::Update(uint32 diff)
AuraApplication * aurApp = iter->second;
Aura * aura = aurApp->GetBase();
if (!aura->IsPermanent()
&& aura->GetDuration() <= 30*IN_MILISECONDS
&& aura->GetDuration() <= 30*IN_MILLISECONDS
&& aurApp->IsPositive()
&& (!(aura->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
&& (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
@@ -856,7 +856,7 @@ void BattleGround::EndBattleGround(uint32 winner)
uint32 BattleGround::GetBonusHonorFromKill(uint32 kills) const
{
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
uint32 maxLevel = (GetMaxLevel()<80)?GetMaxLevel():80;
uint32 maxLevel = (GetMaxLevel() < 80) ? GetMaxLevel() : 80;
return Trinity::Honor::hk_honor_at_level(maxLevel, kills);
}
@@ -1525,7 +1525,7 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
/*
void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime)
{
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceId());
Map * map = sMapMgr.FindMap(GetMapId(),GetInstanceId());
if (!map)
return false;
@@ -1962,4 +1962,4 @@ void BattleGround::RewardXPAtKill(Player* plr, Player* victim)
if (Pet* pet = plr->GetPet())
pet->GivePetXP(xp);
}
}
}
@@ -22,7 +22,7 @@
#include "ObjectMgr.h"
#include "World.h"
#include "WorldPacket.h"
#include "Policies/SingletonImp.h"
#include "ArenaTeam.h"
#include "BattleGroundMgr.h"
@@ -49,8 +49,6 @@
#include "SharedDefines.h"
#include "Formulas.h"
INSTANTIATE_SINGLETON_1(BattleGroundMgr);
/*********************************************************/
/*** BATTLEGROUND QUEUE SYSTEM ***/
/*********************************************************/
@@ -1271,8 +1269,8 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
*data << uint32(bg->GetTypeID());
*data << uint16(0x1F90);
// End of uint64 segment, decomposed this way for simplicity
*data << uint8(0); // 3.3.0
*data << uint8(0); // 3.3.0
*data << uint8(0); // 3.3.0, some level, only saw 80...
*data << uint8(0); // 3.3.0, some level, only saw 80...
*data << uint32(bg->GetClientInstanceID());
// alliance/horde for BG and skirmish/rated for Arenas
// following displays the minimap-icon 0 = faction icon 1 = arenaicon
@@ -1287,10 +1285,12 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
break;
case STATUS_WAIT_JOIN: // status_invite
*data << uint32(bg->GetMapId()); // map id
*data << uint64(0); // 3.3.5, unknown
*data << uint32(Time1); // time to remove from queue, milliseconds
break;
case STATUS_IN_PROGRESS: // status_in_progress
*data << uint32(bg->GetMapId()); // map id
*data << uint64(0); // 3.3.5, unknown
*data << uint32(Time1); // time to bg auto leave, 0 at bg start, 120000 after bg end, milliseconds
*data << uint32(Time2); // time from bg start, milliseconds
*data << uint8(/*bg->isArena() ? 0 :*/ 1); // unk, possibly 0 == preparation phase, 1 == battle
@@ -1629,8 +1629,11 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
return 0;
}
// set battelground difficulty before initialization
bg->SetBracket(bracketEntry);
// generate a new instance id
bg->SetInstanceID(MapManager::Instance().GenerateInstanceId()); // set instance id
bg->SetInstanceID(sMapMgr.GenerateInstanceId()); // set instance id
bg->SetClientInstanceID(CreateClientVisibleInstanceId(isRandom ? BATTLEGROUND_RB : bgTypeId, bracketEntry->GetBracketId()));
// reset the new bg (set status to status_wait_queue from status_none)
@@ -1638,7 +1641,6 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
// start the joining of the bg
bg->SetStatus(STATUS_WAIT_JOIN);
bg->SetBracket(bracketEntry);
bg->SetArenaType(arenaType);
bg->SetRated(isRated);
bg->SetRandom(isRandom);
@@ -1893,8 +1895,8 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
uint32 win_arena = plr->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
uint32 loos_kills = plr->GetRandomWinner() ? BG_REWARD_LOOSER_HONOR_LAST : BG_REWARD_LOOSER_HONOR_FIRST;
win_kills = (uint32)Trinity::Honor::hk_honor_at_level(plr->getLevel(), win_kills);
loos_kills = (uint32)Trinity::Honor::hk_honor_at_level(plr->getLevel(), loos_kills);
win_kills = Trinity::Honor::hk_honor_at_level(plr->getLevel(), win_kills);
loos_kills = Trinity::Honor::hk_honor_at_level(plr->getLevel(), loos_kills);
data->Initialize(SMSG_BATTLEFIELD_LIST);
*data << uint64(guid); // battlemaster guid
@@ -22,7 +22,7 @@
#define __BATTLEGROUNDMGR_H
#include "Common.h"
#include "Policies/Singleton.h"
#include "ace/Singleton.h"
#include "DBCEnums.h"
#include "BattleGround.h"
@@ -180,9 +180,12 @@ class BGQueueRemoveEvent : public BasicEvent
class BattleGroundMgr
{
/// Todo: Thread safety?
/* Construction */
friend class ACE_Singleton<BattleGroundMgr, ACE_Null_Mutex>;
BattleGroundMgr();
public:
/* Construction */
BattleGroundMgr();
~BattleGroundMgr();
void Update(uint32 diff);
@@ -271,6 +274,6 @@ class BattleGroundMgr
bool m_Testing;
};
#define sBattleGroundMgr Trinity::Singleton<BattleGroundMgr>::Instance()
#define sBattleGroundMgr (*ACE_Singleton<BattleGroundMgr, ACE_Null_Mutex>::instance())
#endif
@@ -23,9 +23,9 @@
#include "BattleGround.h"
#include "BattleGroundAV.h"
#include "Formulas.h"
#include "Miscellaneous/Formulas.h"
#include "GameObject.h"
#include "Language.h"
#include "Miscellaneous/Language.h"
#include "Player.h"
#include "SpellAuras.h"
@@ -25,8 +25,8 @@
class BattleGround;
#define BG_EY_FLAG_RESPAWN_TIME (8*IN_MILISECONDS) //8 seconds
#define BG_EY_FPOINTS_TICK_TIME (2*IN_MILISECONDS) //2 seconds
#define BG_EY_FLAG_RESPAWN_TIME (8*IN_MILLISECONDS) //8 seconds
#define BG_EY_FPOINTS_TICK_TIME (2*IN_MILLISECONDS) //2 seconds
enum BG_EY_WorldStates
{
@@ -197,7 +197,7 @@ const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] =
{ 1431.3413f, -219.437f, 30.893f, 0.9736f },
{ 1227.667f, -212.555f, 55.372f, 0.5023f },
{ 1214.681f, 81.21f, 53.413f, 5.745f },
{ 878.555f, -108.989f, 119.835f, 0.0565f },
{ 878.555f, -108.2f, 117.845f, 0.0f },
{ 836.5f, -108.8f, 120.219f, 0.0f },
//Ships
{ 2679.696777, -826.891235, 3.712860, 5.78367f}, //rot2 1 rot3 0.0002
@@ -70,7 +70,7 @@ void BattleGroundWS::Update(uint32 diff)
if (GetStatus() == STATUS_IN_PROGRESS)
{
if (GetStartTime() >= 25*MINUTE*IN_MILISECONDS) // Òàéìåð òèêàòü íà÷èíàåò ïîñëå 25 ìèíóò
if (GetStartTime() >= 25*MINUTE*IN_MILLISECONDS)
{
if (GetTeamScore(ALLIANCE) == 0)
{
@@ -83,15 +83,15 @@ void BattleGroundWS::Update(uint32 diff)
else if (GetTeamScore(HORDE) == 0)
EndBattleGround(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins
else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the first flag
EndBattleGround(m_FirstFlagCaptureTeam);
else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag
EndBattleGround(m_LastFlagCaptureTeam);
else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score
EndBattleGround(HORDE);
else
EndBattleGround(ALLIANCE);
}
else if (GetStartTime() > m_minutesElapsed*MINUTE*IN_MILISECONDS)
else if (GetStartTime() > m_minutesElapsed*MINUTE*IN_MILLISECONDS)
{
++m_minutesElapsed;
UpdateWorldState(BG_WS_STATE_TIMER, 25-m_minutesElapsed);
@@ -325,8 +325,8 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
if (!m_FirstFlagCaptureTeam)
SetFirstFlagCapture(Source->GetTeam());
// update last flag capture to be used if teamscore is equal
SetLastFlagCapture(Source->GetTeam());
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
@@ -720,7 +720,7 @@ void BattleGroundWS::Reset()
m_HonorEndKills = (isBGWeekend) ? 4 : 2;
// For WorldState
m_minutesElapsed = 0;
m_FirstFlagCaptureTeam = 0;
m_LastFlagCaptureTeam = 0;
/* Spirit nodes is static at this BG and then not required deleting at BG reset.
if (m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
@@ -191,7 +191,7 @@ class BattleGroundWS : public BattleGround
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
void UpdateFlagState(uint32 team, uint32 value);
void SetFirstFlagCapture(uint32 team) { m_FirstFlagCaptureTeam = team; }
void SetLastFlagCapture(uint32 team) { m_LastFlagCaptureTeam = team; }
void UpdateTeamScore(uint32 team);
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;}
@@ -209,7 +209,7 @@ class BattleGroundWS : public BattleGround
uint8 m_FlagState[2]; // for checking flag state
int32 m_FlagsTimer[2];
int32 m_FlagsDropTimer[2];
uint32 m_FirstFlagCaptureTeam; // Winner is based on this if score is equal
uint32 m_LastFlagCaptureTeam; // Winner is based on this if score is equal
uint32 m_ReputationCapture;
uint32 m_HonorWinKills;
+245 -351
View File
@@ -1,373 +1,263 @@
# Enable precompiled headers when using the GCC compiler.
IF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
ENDIF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
# Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SET(game_STAT_SRCS
Account/AccountMgr.cpp
Account/AccountMgr.h
Achievements/AchievementMgr.h
Achievements/AchievementMgr.cpp
Addons/AddonMgr.cpp
Addons/AddonMgr.h
Addons/AddonHandler.cpp
Addons/AddonHandler.h
AI/AuctionHouseBot/AuctionHouseBot.cpp
AI/AuctionHouseBot/AuctionHouseBot.h
AI/EventAI/CreatureEventAI.cpp
AI/EventAI/CreatureEventAIMgr.cpp
AI/ScriptedAI/ScriptedSmartAI.cpp
AI/ScriptedAI/ScriptedSmartAI.h
AI/CombatAI.cpp
AI/CombatAI.h
AI/CreatureAI.cpp
AI/CreatureAI.h
AI/CreatureAIFactory.h
AI/CreatureAIImpl.h
AI/CreatureAIRegistry.cpp
AI/CreatureAIRegistry.h
AI/CreatureAISelector.cpp
AI/CreatureAISelector.h
AI/GuardAI.cpp
AI/GuardAI.h
AI/PassiveAI.cpp
AI/PassiveAI.h
AI/PetAI.cpp
AI/PetAI.h
AI/ReactorAI.cpp
AI/ReactorAI.h
AI/TotemAI.cpp
AI/TotemAI.h
AI/UnitAI.cpp
AI/UnitAI.h
AuctionHouse/AuctionHouseHandler.cpp
AuctionHouse/AuctionHouseMgr.cpp
AuctionHouse/AuctionHouseMgr.h
BattleGrounds/ArenaTeam.cpp
BattleGrounds/ArenaTeam.h
BattleGrounds/ArenaTeamHandler.cpp
BattleGrounds/BattleGround.cpp
BattleGrounds/BattleGroundAA.cpp
BattleGrounds/BattleGroundAB.cpp
BattleGrounds/BattleGroundRB.cpp
BattleGrounds/BattleGroundAV.cpp
BattleGrounds/BattleGroundBE.cpp
BattleGrounds/BattleGroundDS.cpp
BattleGrounds/BattleGroundEY.cpp
BattleGrounds/BattleGroundIC.cpp
BattleGrounds/BattleGroundNA.cpp
BattleGrounds/BattleGroundRL.cpp
BattleGrounds/BattleGroundRV.cpp
BattleGrounds/BattleGroundSA.cpp
BattleGrounds/BattleGroundWS.cpp
BattleGrounds/BattleGround.h
BattleGrounds/BattleGroundAA.h
BattleGrounds/BattleGroundAB.h
BattleGrounds/BattleGroundRB.h
BattleGrounds/BattleGroundAV.h
BattleGrounds/BattleGroundBE.h
BattleGrounds/BattleGroundDS.h
BattleGrounds/BattleGroundEY.h
BattleGrounds/BattleGroundIC.h
BattleGrounds/BattleGroundNA.h
BattleGrounds/BattleGroundRL.h
BattleGrounds/BattleGroundRV.h
BattleGrounds/BattleGroundSA.h
BattleGrounds/BattleGroundWS.h
BattleGrounds/BattleGroundHandler.cpp
BattleGrounds/BattleGroundMgr.cpp
BattleGrounds/BattleGroundMgr.h
Calendar/Calendar.cpp
Calendar/Calendar.h
Calendar/CalendarHandler.cpp
Chat/Channel.cpp
Chat/Channel.h
Chat/ChannelHandler.cpp
Chat/ChannelMgr.h
Chat/ChannelMgr.cpp
Chat/Chat.cpp
Chat/Chat.h
Chat/ChatHandler.cpp
Chat/Debugcmds.cpp
Chat/Level0.cpp
Chat/Level1.cpp
Chat/Level2.cpp
Chat/Level3.cpp
Combat/CombatHandler.cpp
Combat/HostileRefManager.cpp
Combat/HostileRefManager.h
Combat/ThreatManager.cpp
Combat/ThreatManager.h
ConditionMgr/ConditionMgr.cpp
ConditionMgr/ConditionMgr.h
DataStores/DBCEnums.h
DataStores/DBCStores.cpp
DataStores/DBCStores.h
DataStores/DBCStructure.h
DataStores/DBCfmt.h
Entities/Creature/Creature.cpp
Entities/Creature/Creature.h
Entities/Creature/CreatureGroups.cpp
Entities/Creature/CreatureGroups.h
Entities/Creature/GossipDef.cpp
Entities/Creature/GossipDef.h
Entities/Creature/NPCHandler.cpp
Entities/Creature/NPCHandler.h
Entities/Creature/TemporarySummon.cpp
Entities/Creature/TemporarySummon.h
Entities/GameObject/GameObject.cpp
Entities/GameObject/GameObject.h
Entities/Item/Bag.cpp
Entities/Item/Bag.h
Entities/Item/Item.cpp
Entities/Item/Item.h
Entities/Item/ItemEnchantmentMgr.cpp
Entities/Item/ItemEnchantmentMgr.h
Entities/Item/ItemHandler.cpp
Entities/Item/ItemPrototype.h
Entities/Object/Corpse.cpp
Entities/Object/Corpse.h
Entities/Object/DynamicObject.cpp
Entities/Object/DynamicObject.h
Entities/Object/ObjectAccessor.cpp
Entities/Object/ObjectAccessor.h
Entities/Object/Object.cpp
Entities/Object/ObjectDefines.h
Entities/Object/Object.h
Entities/Object/ObjectMgr.cpp
Entities/Object/ObjectMgr.h
Entities/Object/UpdateData.cpp
Entities/Object/UpdateData.h
Entities/Object/UpdateFields.h
Entities/Object/UpdateMask.h
Entities/Pet/Pet.cpp
Entities/Pet/Pet.h
Entities/Pet/PetHandler.cpp
Entities/Player/DuelHandler.cpp
Entities/Player/MiscHandler.cpp
Entities/Player/PetitionsHandler.cpp
Entities/Player/Player.cpp
Entities/Player/Player.h
Entities/Player/SocialMgr.cpp
Entities/Player/SocialMgr.h
Entities/Player/TicketHandler.cpp
Entities/Player/TradeHandler.cpp
Entities/Player/VoiceChatHandler.cpp
Entities/Player/CharacterHandler.cpp
Entities/Unit/StatSystem.cpp
Entities/Unit/Unit.cpp
Entities/Unit/Unit.h
Entities/Totem/Totem.cpp
Entities/Totem/Totem.h
Entities/Vehicle/Vehicle.cpp
Entities/Vehicle/Vehicle.h
Events/GameEventMgr.cpp
Events/GameEventMgr.h
Events/GlobalEvents.cpp
Events/GlobalEvents.h
Events/UnitEvents.h
Globals/Formulas.h
Globals/Language.h
Globals/SharedDefines.h
Groups/Group.cpp
Groups/Group.h
Groups/GroupHandler.cpp
Groups/GroupReference.cpp
Groups/GroupReference.h
Groups/GroupRefManager.h
Guilds/Guild.cpp
Guilds/Guild.h
Guilds/GuildHandler.cpp
Instances/InstanceData.cpp
Instances/InstanceData.h
Instances/InstanceSaveMgr.cpp
Instances/InstanceSaveMgr.h
LookingForGroup/LFG.h
LookingForGroup/LFGHandler.cpp
LookingForGroup/LFGMgr.cpp
LookingForGroup/LFGMgr.h
Loot/LootHandler.cpp
Loot/LootMgr.cpp
Loot/LootMgr.h
Mails/Mail.cpp
Mails/Mail.h
Map/Cell/Cell.h
Map/Cell/CellImpl.h
Map/Grid/GridDefines.h
Map/Grid/GridNotifiers.cpp
Map/Grid/GridNotifiers.h
Map/Grid/GridNotifiersImpl.h
Map/Grid/GridStates.cpp
Map/Grid/GridStates.h
Map/Grid/ObjectGridLoader.cpp
Map/Grid/ObjectGridLoader.h
Map/Map.cpp
Map/Map.h
Map/MapInstanced.cpp
Map/MapInstanced.h
Map/MapManager.cpp
Map/MapManager.h
Map/MapUpdater.cpp
Map/MapUpdater.h
Map/MapReference.h
Map/MapRefManager.h
Map/ObjectPosSelector.cpp
Map/ObjectPosSelector.h
Map/ZoneScript.h
Movement/MovementGenerators/ConfusedMovementGenerator.cpp
Movement/MovementGenerators/ConfusedMovementGenerator.h
Movement/MovementGenerators/FleeingMovementGenerator.cpp
Movement/MovementGenerators/FleeingMovementGenerator.h
Movement/MovementGenerators/HomeMovementGenerator.cpp
Movement/MovementGenerators/HomeMovementGenerator.h
Movement/MovementGenerators/IdleMovementGenerator.cpp
Movement/MovementGenerators/IdleMovementGenerator.h
Movement/MovementGenerators/MovementGenerator.cpp
Movement/MovementGenerators/MovementGenerator.h
Movement/MovementGenerators/MovementGeneratorImpl.h
Movement/MovementGenerators/PointMovementGenerator.cpp
Movement/MovementGenerators/PointMovementGenerator.h
Movement/MovementGenerators/RandomMovementGenerator.cpp
Movement/MovementGenerators/RandomMovementGenerator.h
Movement/MovementGenerators/TargetedMovementGenerator.cpp
Movement/MovementGenerators/TargetedMovementGenerator.h
Movement/MovementGenerators/WaypointMovementGenerator.cpp
Movement/MovementGenerators/WaypointMovementGenerator.h
Movement/DestinationHolder.cpp
Movement/DestinationHolder.h
Movement/DestinationHolderImp.h
Movement/FollowerReference.cpp
Movement/FollowerReference.h
Movement/FollowerRefManager.h
Movement/MotionMaster.cpp
Movement/MotionMaster.h
Movement/MovementHandler.cpp
Movement/Path.h
Movement/TaxiHandler.cpp
Movement/Transports.cpp
Movement/Transports.h
Movement/Traveller.h
Movement/WaypointManager.cpp
Movement/WaypointManager.h
Opcodes/Opcodes.cpp
Opcodes/Opcodes.h
OutdoorPvP/OutdoorPvP.cpp
OutdoorPvP/OutdoorPvP.h
OutdoorPvP/OutdoorPvPEP.cpp
OutdoorPvP/OutdoorPvPEP.h
OutdoorPvP/OutdoorPvPHP.cpp
OutdoorPvP/OutdoorPvPHP.h
OutdoorPvP/OutdoorPvPImpl.h
OutdoorPvP/OutdoorPvPMgr.cpp
OutdoorPvP/OutdoorPvPMgr.h
OutdoorPvP/OutdoorPvPNA.cpp
OutdoorPvP/OutdoorPvPNA.h
OutdoorPvP/OutdoorPvPSI.cpp
OutdoorPvP/OutdoorPvPSI.h
OutdoorPvP/OutdoorPvPTF.cpp
OutdoorPvP/OutdoorPvPTF.h
OutdoorPvP/OutdoorPvPZM.cpp
OutdoorPvP/OutdoorPvPZM.h
Pools/PoolHandler.cpp
Pools/PoolHandler.h
Quests/QueryHandler.cpp
Quests/QuestDef.cpp
Quests/QuestDef.h
Quests/QuestHandler.cpp
Reputation/ReputationMgr.cpp
Reputation/ReputationMgr.h
ScriptMgr/ScriptLoader.cpp
ScriptMgr/ScriptLoader.h
ScriptMgr/ScriptMgr.cpp
ScriptMgr/ScriptMgr.h
ScriptMgr/ScriptSystem.cpp
ScriptMgr/ScriptSystem.h
Skills/SkillHandler.cpp
Skills/SkillDiscovery.cpp
Skills/SkillDiscovery.h
Skills/SkillExtraItems.cpp
Skills/SkillExtraItems.h
Spells/Auras/SpellAuraDefines.h
Spells/Auras/SpellAuras.cpp
Spells/Auras/SpellAuras.h
Spells/Auras/SpellAuraEffects.cpp
Spells/Auras/SpellAuraEffects.h
Spells/Auras/SpellEffects.cpp
Spells/Spell.cpp
Spells/Spell.h
Spells/SpellHandler.cpp
Spells/SpellMgr.cpp
Spells/SpellMgr.h
Tools/PlayerDump.cpp
Tools/PlayerDump.h
Tools/Tools.cpp
Tools/Tools.h
Weather/Weather.cpp
Weather/Weather.h
World/World.cpp
World/World.h
World/WorldLog.cpp
World/WorldLog.h
World/WorldSession.cpp
World/WorldSession.h
World/WorldSocket.cpp
World/WorldSocket.h
World/WorldSocketMgr.cpp
World/WorldSocketMgr.h
######## game ########
# Enable precompiled headers when using the GCC compiler.
if(DO_PCH)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()
# Create game-libary
set(game_STAT_SRCS
Accounts/AccountMgr.cpp
Achievements/AchievementMgr.cpp
Addons/AddonMgr.cpp
AI/CoreAI/CombatAI.cpp
AI/CoreAI/GuardAI.cpp
AI/CoreAI/PassiveAI.cpp
AI/CoreAI/PetAI.cpp
AI/CoreAI/ReactorAI.cpp
AI/CoreAI/TotemAI.cpp
AI/CoreAI/UnitAI.cpp
AI/EventAI/CreatureEventAI.cpp
AI/EventAI/CreatureEventAIMgr.cpp
AI/ScriptedAI/ScriptedSmartAI.cpp
AI/CreatureAIRegistry.cpp
AI/CreatureAISelector.cpp
AI/CreatureAI.cpp
AuctionHouse/AuctionHouseMgr.cpp
AuctionHouse/AuctionHouseBot/AuctionHouseBot.cpp
BattleGrounds/ArenaTeam.cpp
BattleGrounds/Zones/BattleGroundAA.cpp
BattleGrounds/Zones/BattleGroundAB.cpp
BattleGrounds/Zones/BattleGroundRB.cpp
BattleGrounds/Zones/BattleGroundAV.cpp
BattleGrounds/Zones/BattleGroundBE.cpp
BattleGrounds/Zones/BattleGroundDS.cpp
BattleGrounds/Zones/BattleGroundEY.cpp
BattleGrounds/Zones/BattleGroundIC.cpp
BattleGrounds/Zones/BattleGroundNA.cpp
BattleGrounds/Zones/BattleGroundRL.cpp
BattleGrounds/Zones/BattleGroundRV.cpp
BattleGrounds/Zones/BattleGroundSA.cpp
BattleGrounds/Zones/BattleGroundWS.cpp
BattleGrounds/BattleGround.cpp
BattleGrounds/BattleGroundMgr.cpp
Calendar/Calendar.cpp
Chat/Channels/Channel.cpp
Chat/Channels/ChannelMgr.cpp
Chat/Commands/Debugcmds.cpp
Chat/Commands/Level0.cpp
Chat/Commands/Level1.cpp
Chat/Commands/Level2.cpp
Chat/Commands/Level3.cpp
Chat/Chat.cpp
Combat/HostileRefManager.cpp
Combat/ThreatManager.cpp
Conditions/ConditionMgr.cpp
DataStores/DBCStores.cpp
DungeonFinding/LFGMgr.cpp
Entities/Corpse/Corpse.cpp
Entities/Creature/Creature.cpp
Entities/Creature/CreatureGroups.cpp
Entities/Creature/GossipDef.cpp
Entities/Creature/TemporarySummon.cpp
Entities/DynamicObject/DynamicObject.cpp
Entities/GameObject/GameObject.cpp
Entities/Item/Container/Bag.cpp
Entities/Item/Item.cpp
Entities/Item/ItemEnchantmentMgr.cpp
Entities/Object/Updates/UpdateData.cpp
Entities/Object/Object.cpp
Entities/Object/ObjectPosSelector.cpp
Entities/Pet/Pet.cpp
Entities/Player/Player.cpp
Entities/Player/SocialMgr.cpp
Entities/Unit/StatSystem.cpp
Entities/Unit/Unit.cpp
Entities/Totem/Totem.cpp
Entities/Transport/Transport.cpp
Entities/Vehicle/Vehicle.cpp
Events/GameEventMgr.cpp
Globals/GlobalEvents.cpp
Globals/ObjectAccessor.cpp
Globals/ObjectMgr.cpp
Grids/Notifiers/GridNotifiers.cpp
Grids/GridStates.cpp
Grids/ObjectGridLoader.cpp
Groups/Group.cpp
Groups/GroupReference.cpp
Guilds/Guild.cpp
Instances/InstanceData.cpp
Instances/InstanceSaveMgr.cpp
Loot/LootMgr.cpp
Mails/Mail.cpp
Maps/Map.cpp
Maps/MapInstanced.cpp
Maps/MapManager.cpp
Maps/MapUpdater.cpp
Movement/MovementGenerators/ConfusedMovementGenerator.cpp
Movement/MovementGenerators/FleeingMovementGenerator.cpp
Movement/MovementGenerators/HomeMovementGenerator.cpp
Movement/MovementGenerators/IdleMovementGenerator.cpp
Movement/MovementGenerators/PointMovementGenerator.cpp
Movement/MovementGenerators/RandomMovementGenerator.cpp
Movement/MovementGenerators/TargetedMovementGenerator.cpp
Movement/MovementGenerators/WaypointMovementGenerator.cpp
Movement/Waypoints/WaypointManager.cpp
Movement/DestinationHolder.cpp
Movement/FollowerReference.cpp
Movement/MotionMaster.cpp
Movement/MovementGenerator.cpp
OutdoorPvP/Zones/OutdoorPvPEP.cpp
OutdoorPvP/Zones/OutdoorPvPHP.cpp
OutdoorPvP/Zones/OutdoorPvPNA.cpp
OutdoorPvP/Zones/OutdoorPvPSI.cpp
OutdoorPvP/Zones/OutdoorPvPTF.cpp
OutdoorPvP/Zones/OutdoorPvPZM.cpp
OutdoorPvP/OutdoorPvP.cpp
OutdoorPvP/OutdoorPvPMgr.cpp
Pools/PoolMgr.cpp
Quests/QuestDef.cpp
Reputation/ReputationMgr.cpp
Scripting/ScriptLoader.cpp
Scripting/ScriptMgr.cpp
Scripting/ScriptSystem.cpp
Server/Protocol/Handlers/AddonHandler.cpp
Server/Protocol/Handlers/ArenaTeamHandler.cpp
Server/Protocol/Handlers/AuctionHouseHandler.cpp
Server/Protocol/Handlers/BattleGroundHandler.cpp
Server/Protocol/Handlers/CalendarHandler.cpp
Server/Protocol/Handlers/ChannelHandler.cpp
Server/Protocol/Handlers/CharacterHandler.cpp
Server/Protocol/Handlers/ChatHandler.cpp
Server/Protocol/Handlers/CombatHandler.cpp
Server/Protocol/Handlers/DuelHandler.cpp
Server/Protocol/Handlers/GroupHandler.cpp
Server/Protocol/Handlers/GuildHandler.cpp
Server/Protocol/Handlers/ItemHandler.cpp
Server/Protocol/Handlers/LFGHandler.cpp
Server/Protocol/Handlers/LootHandler.cpp
Server/Protocol/Handlers/MiscHandler.cpp
Server/Protocol/Handlers/MovementHandler.cpp
Server/Protocol/Handlers/NPCHandler.cpp
Server/Protocol/Handlers/PetHandler.cpp
Server/Protocol/Handlers/PetitionsHandler.cpp
Server/Protocol/Handlers/QueryHandler.cpp
Server/Protocol/Handlers/QuestHandler.cpp
Server/Protocol/Handlers/SkillHandler.cpp
Server/Protocol/Handlers/SpellHandler.cpp
Server/Protocol/Handlers/TaxiHandler.cpp
Server/Protocol/Handlers/TicketHandler.cpp
Server/Protocol/Handlers/TradeHandler.cpp
Server/Protocol/Handlers/VoiceChatHandler.cpp
Server/Protocol/Opcodes.cpp
Server/Protocol/WorldLog.cpp
Server/WorldSession.cpp
Server/WorldSocket.cpp
Server/WorldSocketMgr.cpp
Skills/SkillDiscovery.cpp
Skills/SkillExtraItems.cpp
Spells/Auras/SpellAuras.cpp
Spells/Auras/SpellAuraEffects.cpp
Spells/Auras/SpellEffects.cpp
Spells/Spell.cpp
Spells/SpellMgr.cpp
Tools/PlayerDump.cpp
Tools/Tools.cpp
Weather/Weather.cpp
World/World.cpp
)
include_directories(
${ACE_INCLUDE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/dep/include
${CMAKE_SOURCE_DIR}/src/server/framework
${CMAKE_SOURCE_DIR}/externals/mersennetwister
${CMAKE_SOURCE_DIR}/externals/zlib
${CMAKE_SOURCE_DIR}/src/server/collision
${CMAKE_SOURCE_DIR}/src/server/collision/Management
${CMAKE_SOURCE_DIR}/src/server/shared
${CMAKE_SOURCE_DIR}/src/server/shared/vmap
${CMAKE_SOURCE_DIR}/src/server/shared/Configuration
${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography
${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography/Authentication
${CMAKE_SOURCE_DIR}/src/server/shared/Database
${CMAKE_SOURCE_DIR}/src/server/shared/DataStores
${CMAKE_SOURCE_DIR}/src/server/shared/Debugging
${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/CountedReference
${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/LinkedReference
${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic
${CMAKE_SOURCE_DIR}/src/server/shared/Logging
${CMAKE_SOURCE_DIR}/src/server/shared/Packets
${CMAKE_SOURCE_DIR}/src/server/shared/Policies
${CMAKE_SOURCE_DIR}/src/server/shared/Threading
${CMAKE_SOURCE_DIR}/src/server/shared/Utilities
${CMAKE_SOURCE_DIR}/src/server/game
${CMAKE_SOURCE_DIR}/src/server/game/Account
${CMAKE_SOURCE_DIR}/src/server/game/Accounts
${CMAKE_SOURCE_DIR}/src/server/game/Achievements
${CMAKE_SOURCE_DIR}/src/server/game/Addons
${CMAKE_SOURCE_DIR}/src/server/game/AI
${CMAKE_SOURCE_DIR}/src/server/game/AI/AuctionHouseBot
${CMAKE_SOURCE_DIR}/src/server/game/AI/CoreAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/EventAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse/AuctionHouseBot
${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds
${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
${CMAKE_SOURCE_DIR}/src/server/game/Chat
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Commands
${CMAKE_SOURCE_DIR}/src/server/game/Combat
${CMAKE_SOURCE_DIR}/src/server/game/ConditionMgr
${CMAKE_SOURCE_DIR}/src/server/game/Conditions
${CMAKE_SOURCE_DIR}/src/server/game/DataStores
${CMAKE_SOURCE_DIR}/src/server/game/DungeonFinding
${CMAKE_SOURCE_DIR}/src/server/game/Entities
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Creature
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Corpse
${CMAKE_SOURCE_DIR}/src/server/game/Entities/DynamicObject
${CMAKE_SOURCE_DIR}/src/server/game/Entities/GameObject
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item/Container
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Pet
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Player
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Totem
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Vehicle
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Transport
${CMAKE_SOURCE_DIR}/src/server/game/Events
${CMAKE_SOURCE_DIR}/src/server/game/Globals
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Cells
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Notifiers
${CMAKE_SOURCE_DIR}/src/server/game/Grids
${CMAKE_SOURCE_DIR}/src/server/game/Groups
${CMAKE_SOURCE_DIR}/src/server/game/Guilds
${CMAKE_SOURCE_DIR}/src/server/game/Instances
${CMAKE_SOURCE_DIR}/src/server/game/LookingForGroup
${CMAKE_SOURCE_DIR}/src/server/game/Loot
${CMAKE_SOURCE_DIR}/src/server/game/Mails
${CMAKE_SOURCE_DIR}/src/server/game/Map
${CMAKE_SOURCE_DIR}/src/server/game/Map/Cell
${CMAKE_SOURCE_DIR}/src/server/game/Map/Grid
${CMAKE_SOURCE_DIR}/src/server/game/Maps
${CMAKE_SOURCE_DIR}/src/server/game/Miscellaneous
${CMAKE_SOURCE_DIR}/src/server/game/Movement
${CMAKE_SOURCE_DIR}/src/server/game/Movement/MovementGenerators
${CMAKE_SOURCE_DIR}/src/server/game/Opcodes
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints
${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP
${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Pools
${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders
${CMAKE_SOURCE_DIR}/src/server/game/Quests
${CMAKE_SOURCE_DIR}/src/server/game/Reputation
${CMAKE_SOURCE_DIR}/src/server/game/ScriptMgr
${CMAKE_SOURCE_DIR}/src/server/game/Scripting
${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol
${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol/Handlers
${CMAKE_SOURCE_DIR}/src/server/game/Server
${CMAKE_SOURCE_DIR}/src/server/game/Skills
${CMAKE_SOURCE_DIR}/src/server/game/Spells
${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras
@@ -375,33 +265,37 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/Weather
${CMAKE_SOURCE_DIR}/src/server/game/World
${MYSQL_INCLUDE_DIR}
${ACE_INCLUDE_DIR}
)
if(NOT DO_SCRIPTS)
SET(game_STAT_SRCS ${game_STAT_SRCS}
AI/ScriptedAI/ScriptedEscortAI.cpp
AI/ScriptedAI/ScriptedEscortAI.h
ScriptMgr/ScriptedPch.cpp
ScriptMgr/ScriptedPch.h
AI/ScriptedAI/ScriptedCreature.cpp
AI/ScriptedAI/ScriptedCreature.h
AI/ScriptedAI/ScriptedFollowerAI.cpp
AI/ScriptedAI/ScriptedFollowerAI.h
AI/ScriptedAI/ScriptedGossip.h
AI/ScriptedAI/ScriptedGuardAI.cpp
AI/ScriptedAI/ScriptedGuardAI.h
AI/ScriptedAI/ScriptedInstance.h
AI/ScriptedAI/ScriptedSimpleAI.cpp
AI/ScriptedAI/ScriptedSimpleAI.h
)
message("-- Added Script Engine to GAME lib")
endif(NOT DO_SCRIPTS)
set(game_STAT_SRCS
${game_STAT_SRCS}
AI/ScriptedAI/ScriptedEscortAI.cpp
AI/ScriptedAI/ScriptedCreature.cpp
AI/ScriptedAI/ScriptedFollowerAI.cpp
AI/ScriptedAI/ScriptedGuardAI.cpp
AI/ScriptedAI/ScriptedSimpleAI.cpp
)
message("-- Added basic scriptAI-engines to GAME library")
endif()
# Add gamePCH.cpp to project on Windows
if(MSVC)
set(game_STAT_SRCS
PrecompiledHeaders/gamePCH.cpp
${game_STAT_SRCS})
endif()
add_library(game STATIC ${game_STAT_SRCS})
ADD_DEPENDENCIES(game revision.h)
add_dependencies(game revision.h)
# Generate precompiled header
IF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
ADD_PRECOMPILED_HEADER(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/pchlinux.h)
ENDIF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
if(DO_PCH)
if(CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/gamePCH.h)
elseif(MSVC)
add_native_precompiled_header(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/gamePCH)
endif()
endif()
+12 -4
View File
@@ -707,6 +707,14 @@ void Channel::Invite(uint64 p, const char *newname)
return;
}
if (IsBanned(newp->GetGUID()))
{
WorldPacket data;
MakePlayerInviteBanned(&data, newname);
SendToOne(&data, p);
return;
}
Player *plr = objmgr.GetPlayer(p);
if (!plr)
return;
@@ -983,10 +991,10 @@ void Channel::MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good)
}
// done 0x16
void Channel::MakePlayerNotBanned(WorldPacket *data, uint64 guid)
void Channel::MakePlayerNotBanned(WorldPacket *data, const std::string &name)
{
MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE);
*data << uint64(guid);
*data << name;
}
// done 0x17
@@ -1035,10 +1043,10 @@ void Channel::MakePlayerInvited(WorldPacket *data, const std::string& name)
}
// done 0x1E
void Channel::MakePlayerInviteBanned(WorldPacket *data, uint64 guid)
void Channel::MakePlayerInviteBanned(WorldPacket *data, const std::string& name)
{
MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE);
*data << uint64(guid);
*data << name;
}
// done 0x1F
+2 -2
View File
@@ -187,7 +187,7 @@ class Channel
void MakeBanned(WorldPacket *data); //? 0x13
void MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good); //? 0x14
void MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good); //? 0x15
void MakePlayerNotBanned(WorldPacket *data, uint64 guid); //? 0x16
void MakePlayerNotBanned(WorldPacket *data, const std::string& name); //? 0x16
void MakePlayerAlreadyMember(WorldPacket *data, uint64 guid); //+ 0x17
void MakeInvite(WorldPacket *data, uint64 guid); //? 0x18
void MakeInviteWrongFaction(WorldPacket *data); //? 0x19
@@ -195,7 +195,7 @@ class Channel
void MakeInvalidName(WorldPacket *data); //? 0x1B
void MakeNotModerated(WorldPacket *data); //? 0x1C
void MakePlayerInvited(WorldPacket *data, const std::string& name); //+ 0x1D
void MakePlayerInviteBanned(WorldPacket *data, uint64 guid); //? 0x1E
void MakePlayerInviteBanned(WorldPacket *data, const std::string &name);//? 0x1E
void MakeThrottled(WorldPacket *data); //? 0x1F
void MakeNotInArea(WorldPacket *data); //? 0x20
void MakeNotInLfg(WorldPacket *data); //? 0x21
+4 -7
View File
@@ -17,21 +17,18 @@
*/
#include "ChannelMgr.h"
#include "Policies/SingletonImp.h"
#include "World.h"
INSTANTIATE_SINGLETON_1(AllianceChannelMgr);
INSTANTIATE_SINGLETON_1(HordeChannelMgr);
#include "World.h"
ChannelMgr* channelMgr(uint32 team)
{
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
return &Trinity::Singleton<AllianceChannelMgr>::Instance(); // cross-faction
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance(); // cross-faction
if (team == ALLIANCE)
return &Trinity::Singleton<AllianceChannelMgr>::Instance();
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance();
if (team == HORDE)
return &Trinity::Singleton<HordeChannelMgr>::Instance();
return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance();
return NULL;
}
+1 -4
View File
@@ -22,14 +22,11 @@
#include "Common.h"
#include "Channel.h"
#include "Policies/Singleton.h"
#include "ace/Singleton.h"
#include <map>
#include <string>
#include "Policies/Singleton.h"
#include "Channel.h"
#include "World.h"
class ChannelMgr
+6 -1
View File
@@ -23,7 +23,7 @@
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "AccountMgr.h"
#include "CellImpl.h"
@@ -133,11 +133,13 @@ ChatCommand * ChatHandler::getCommandTable()
static ChatCommand channelSetCommandTable[] =
{
{ "public", SEC_ADMINISTRATOR, true, &ChatHandler::HandleChannelSetPublic, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
static ChatCommand channelCommandTable[] =
{
{ "set", SEC_ADMINISTRATOR, true, NULL, "", channelSetCommandTable },
{ NULL, 0, false, NULL, "", NULL }
};
static ChatCommand debugPlayCommandTable[] =
@@ -460,6 +462,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "creature_involvedrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestInvRelationsCommand,"",NULL },
{ "creature_linked_respawn", SEC_GAMEMASTER, true, &ChatHandler::HandleReloadCreatureLinkedRespawnCommand, "", NULL },
{ "creature_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesCreatureCommand, "", NULL },
{ "creature_onkill_reputation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadOnKillReputationCommand, "", NULL },
{ "creature_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestRelationsCommand, "", NULL },
{ "creature_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureTemplateCommand, "", NULL },
//{ "db_script_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDbScriptStringCommand, "", NULL },
@@ -476,10 +479,12 @@ ChatCommand * ChatHandler::getCommandTable()
{ "gossip_menu_option", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuOptionCommand, "", NULL },
{ "item_enchantment_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL },
{ "item_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL },
{ "item_set_names", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemSetNamesCommand, "", NULL },
{ "locales_achievement_reward", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesAchievementRewardCommand,"", NULL },
{ "locales_creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL },
{ "locales_gameobject", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL },
{ "locales_item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemCommand, "", NULL },
{ "locales_item_set_name", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemSetNameCommand, "", NULL },
{ "locales_npc_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesNpcTextCommand, "", NULL },
{ "locales_page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL },
{ "locales_points_of_interest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPointsOfInterestCommand, "", NULL },
+3
View File
@@ -364,6 +364,7 @@ class ChatHandler
bool HandleReloadEventAISummonsCommand(const char* args);
bool HandleReloadEventAIScriptsCommand(const char* args);
bool HandleReloadCommandCommand(const char* args);
bool HandleReloadOnKillReputationCommand(const char* args);
bool HandleReloadCreatureTemplateCommand(const char* args);
bool HandleReloadCreatureQuestRelationsCommand(const char* args);
bool HandleReloadCreatureQuestInvRelationsCommand(const char* args);
@@ -377,10 +378,12 @@ class ChatHandler
bool HandleReloadGOQuestRelationsCommand(const char* args);
bool HandleReloadGOQuestInvRelationsCommand(const char* args);
bool HandleReloadItemEnchantementsCommand(const char* args);
bool HandleReloadItemSetNamesCommand(const char* args);
bool HandleReloadLocalesAchievementRewardCommand(const char* args);
bool HandleReloadLocalesCreatureCommand(const char* args);
bool HandleReloadLocalesGameobjectCommand(const char* args);
bool HandleReloadLocalesItemCommand(const char* args);
bool HandleReloadLocalesItemSetNameCommand(const char* args);
bool HandleReloadLocalesNpcTextCommand(const char* args);
bool HandleReloadLocalesPageTextCommand(const char* args);
bool HandleReloadLocalesPointsOfInterestCommand(const char* args);
+1 -1
View File
@@ -19,7 +19,7 @@
*/
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "WorldPacket.h"
#include "Vehicle.h"
#include "Player.h"
+40 -32
View File
@@ -19,7 +19,7 @@
*/
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "World.h"
#include "Player.h"
#include "Opcodes.h"
@@ -87,7 +87,7 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/)
}
// cast spell Stuck
chr->CastSpell(chr,7355,false);
chr->CastSpell(chr, 7355, false);
return true;
}
@@ -103,14 +103,6 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
uint32 updateTime = sWorld.GetUpdateTime();
PSendSysMessage(_FULLVERSION);
//if (m_session)
// full = _FULLVERSION(REVISION_DATE,REVISION_TIME,"|cffffffff|Hurl:" REVISION_ID "|h" REVISION_ID "|h|r");
//else
// full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID);
//SendSysMessage(full);
//PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion());
//PSendSysMessage(LANG_USING_EVENT_AI,sWorld.GetCreatureEventAIVersion());
PSendSysMessage(LANG_CONNECTED_PLAYERS, PlayersNum, MaxPlayersNum);
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
PSendSysMessage(LANG_UPTIME, uptime.c_str());
@@ -143,9 +135,9 @@ bool ChatHandler::HandleDismountCommand(const char* /*args*/)
bool ChatHandler::HandleSaveCommand(const char* /*args*/)
{
Player *player=m_session->GetPlayer();
Player *player = m_session->GetPlayer();
// save GM account without delay and output message (testing, etc)
// save GM account without delay and output message
if (m_session->GetSecurity() > SEC_PLAYER)
{
player->SaveToDB();
@@ -153,9 +145,9 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/)
return true;
}
// save or plan save after 20 sec (logout delay) if current next save time more this value and _not_ output any messages to prevent cheat planning
// save if the player has last been saved over 20 seconds ago
uint32 save_interval = sWorld.getConfig(CONFIG_INTERVAL_SAVE);
if ((save_interval == 0 || save_interval > 20*IN_MILISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILISECONDS))
if ((save_interval == 0 || save_interval > 20*IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILLISECONDS))
player->SaveToDB();
return true;
@@ -165,8 +157,8 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
{
bool first = true;
ObjectAccessor::Guard guard(*HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType &m = ObjectAccessor::Instance().GetPlayers();
ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true);
HashMapHolder<Player>::MapType &m = sObjectAccessor.GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
@@ -192,35 +184,42 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
bool ChatHandler::HandleAccountPasswordCommand(const char* args)
{
if (!*args)
{
SendSysMessage(LANG_CMD_SYNTAX);
SetSentErrorMessage(true);
return false;
}
char *old_pass = strtok ((char*)args, " ");
char *new_pass = strtok (NULL, " ");
char *new_pass_c = strtok (NULL, " ");
char *old_pass = strtok((char*)args, " ");
char *new_pass = strtok(NULL, " ");
char *new_pass_c = strtok(NULL, " ");
if (!old_pass || !new_pass || !new_pass_c)
{
SendSysMessage(LANG_CMD_SYNTAX);
SetSentErrorMessage(true);
return false;
}
std::string password_old = old_pass;
std::string password_new = new_pass;
std::string password_new_c = new_pass_c;
if (strcmp(new_pass, new_pass_c) != 0)
if (!accmgr.CheckPassword(m_session->GetAccountId(), password_old))
{
SendSysMessage (LANG_NEW_PASSWORDS_NOT_MATCH);
SetSentErrorMessage (true);
SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
SetSentErrorMessage(true);
return false;
}
if (!accmgr.CheckPassword (m_session->GetAccountId(), password_old))
if (strcmp(new_pass, new_pass_c) != 0)
{
SendSysMessage (LANG_COMMAND_WRONGOLDPASSWORD);
SetSentErrorMessage (true);
SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
SetSentErrorMessage(true);
return false;
}
AccountOpResult result = accmgr.ChangePassword(m_session->GetAccountId(), password_new);
switch(result)
{
case AOR_OK:
@@ -230,7 +229,6 @@ bool ChatHandler::HandleAccountPasswordCommand(const char* args)
SendSysMessage(LANG_PASSWORD_TOO_LONG);
SetSentErrorMessage(true);
return false;
case AOR_NAME_NOT_EXIST: // not possible case, don't want get account name for output
default:
SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
SetSentErrorMessage(true);
@@ -243,15 +241,23 @@ bool ChatHandler::HandleAccountPasswordCommand(const char* args)
bool ChatHandler::HandleAccountAddonCommand(const char* args)
{
if (!*args)
{
SendSysMessage(LANG_CMD_SYNTAX);
SetSentErrorMessage(true);
return false;
}
char *szExp = strtok((char*)args," ");
char *szExp = strtok((char*)args, " ");
uint32 account_id = m_session->GetAccountId();
int expansion=atoi(szExp); //get int anyway (0 if error)
int expansion = atoi(szExp); //get int anyway (0 if error)
if (expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
return false;
{
SendSysMessage(LANG_IMPROPER_VALUE);
SetSentErrorMessage(true);
return false;
}
// No SQL injection
LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, account_id);
@@ -264,7 +270,8 @@ bool ChatHandler::HandleAccountLockCommand(const char* args)
if (!*args)
{
SendSysMessage(LANG_USE_BOL);
return true;
SetSentErrorMessage(true);
return false;
}
std::string argstr = (char*)args;
@@ -283,7 +290,8 @@ bool ChatHandler::HandleAccountLockCommand(const char* args)
}
SendSysMessage(LANG_USE_BOL);
return true;
SetSentErrorMessage(true);
return false;
}
/// Display the 'Message of the day' for the realm
+7 -7
View File
@@ -19,7 +19,7 @@
*/
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "World.h"
@@ -817,7 +817,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
if (pMap->IsBattleGroundOrArena())
{
// only allow if gm mode is on
if (!target->isGameMaster())
if (!_player->isGameMaster())
{
PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM,nameLink.c_str());
SetSentErrorMessage(true);
@@ -2381,7 +2381,7 @@ bool ChatHandler::HandleWhispersCommand(const char* args)
//Save all players in the world
bool ChatHandler::HandleSaveAllCommand(const char* /*args*/)
{
ObjectAccessor::Instance().SaveAllPlayers();
sObjectAccessor.SaveAllPlayers();
SendSysMessage(LANG_PLAYERS_SAVED);
return true;
}
@@ -2502,7 +2502,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), GetTrinityString(LANG_OFFLINE), tele->name.c_str());
Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,
MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid);
sMapMgr.GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid);
}
return true;
@@ -2768,7 +2768,7 @@ bool ChatHandler::HandleGoXYCommand(const char* args)
else
_player->SaveRecallPosition();
Map const *map = MapManager::Instance().CreateBaseMap(mapid);
Map const *map = sMapMgr.CreateBaseMap(mapid);
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
@@ -2861,7 +2861,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
// update to parent zone if exist (client map show only zones without parents)
AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry;
Map const *map = MapManager::Instance().CreateBaseMap(zoneEntry->mapid);
Map const *map = sMapMgr.CreateBaseMap(zoneEntry->mapid);
if (map->Instanceable())
{
@@ -2936,7 +2936,7 @@ bool ChatHandler::HandleGoGridCommand(const char* args)
else
_player->SaveRecallPosition();
Map const *map = MapManager::Instance().CreateBaseMap(mapid);
Map const *map = sMapMgr.CreateBaseMap(mapid);
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
+5 -5
View File
@@ -19,7 +19,7 @@
*/
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "ObjectMgr.h"
#include "Player.h"
@@ -32,7 +32,7 @@
#include "World.h"
#include "GameEventMgr.h"
#include "SpellMgr.h"
#include "PoolHandler.h"
#include "PoolMgr.h"
#include "AccountMgr.h"
#include "WaypointManager.h"
#include "Util.h"
@@ -1672,7 +1672,7 @@ bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/)
if (/*creature->GetMotionMaster()->empty() ||*/
creature->GetMotionMaster()->GetCurrentMovementGeneratorType () != TARGETED_MOTION_TYPE)
{
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU);
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName());
SetSentErrorMessage(true);
return false;
}
@@ -1682,7 +1682,7 @@ bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/)
if (mgen->GetTarget() != player)
{
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU);
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName());
SetSentErrorMessage(true);
return false;
}
@@ -2844,7 +2844,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
wpCreature2->LoadFromDB(wpCreature2->GetDBTableGUIDLow(), map);
map->Add(wpCreature2);
//MapManager::Instance().GetMap(npcCreature->GetMapId())->Add(wpCreature2);
//sMapMgr.GetMap(npcCreature->GetMapId())->Add(wpCreature2);
}
WorldDatabase.PExecuteLog("UPDATE waypoint_data SET position_x = '%f',position_y = '%f',position_z = '%f' where id = '%u' AND point='%u'",
+36 -16
View File
@@ -19,7 +19,7 @@
*/
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "World.h"
@@ -45,7 +45,7 @@
#include "SkillDiscovery.h"
#include "SkillExtraItems.h"
#include "SystemConfig.h"
#include "Config/ConfigEnv.h"
#include "ConfigEnv.h"
#include "Util.h"
#include "ItemEnchantmentMgr.h"
#include "BattleGroundMgr.h"
@@ -689,7 +689,7 @@ bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/)
{
sLog.outString("Re-Loading config settings...");
sWorld.LoadConfigSettings(true);
MapManager::Instance().InitializeVisibilityDistanceInfo();
sMapMgr.InitializeVisibilityDistanceInfo();
SendGlobalGMSysMessage("World config settings reloaded.");
return true;
}
@@ -749,6 +749,14 @@ bool ChatHandler::HandleReloadCommandCommand(const char*)
return true;
}
bool ChatHandler::HandleReloadOnKillReputationCommand(const char*)
{
sLog.outString("Re-Loading creature award reputation definitions...");
objmgr.LoadReputationOnKill();
SendGlobalGMSysMessage("DB table `creature_onkill_reputation` reloaded.");
return true;
}
bool ChatHandler::HandleReloadCreatureTemplateCommand(const char* args)
{
if (!*args)
@@ -787,24 +795,21 @@ bool ChatHandler::HandleReloadCreatureTemplateCommand(const char* args)
size_t len = 0;
if (const char* temp = fields[9].GetString())
{
if (cInfo->Name)
delete cInfo->Name;
delete[] cInfo->Name;
len = strlen(temp)+1;
const_cast<CreatureInfo*>(cInfo)->Name = new char[len];
strncpy(cInfo->Name, temp, len);
}
if (const char* temp = fields[10].GetString())
{
if (cInfo->SubName)
delete cInfo->SubName;
delete[] cInfo->SubName;
len = strlen(temp)+1;
const_cast<CreatureInfo*>(cInfo)->SubName = new char[len];
strncpy(cInfo->SubName, temp, len);
}
if (const char* temp = fields[11].GetString())
{
if (cInfo->IconName)
delete cInfo->IconName;
delete[] cInfo->IconName;
len = strlen(temp)+1;
const_cast<CreatureInfo*>(cInfo)->IconName = new char[len];
strncpy(cInfo->IconName, temp, len);
@@ -863,8 +868,7 @@ bool ChatHandler::HandleReloadCreatureTemplateCommand(const char* args)
const_cast<CreatureInfo*>(cInfo)->maxgold = fields[63].GetUInt32();
if (const char* temp = fields[64].GetString())
{
if (cInfo->AIName)
delete cInfo->AIName;
delete[] cInfo->AIName;
len = strlen(temp)+1;
const_cast<CreatureInfo*>(cInfo)->AIName = new char[len];
strncpy(const_cast<char*>(cInfo->AIName), temp, len);
@@ -1276,6 +1280,14 @@ bool ChatHandler::HandleReloadItemEnchantementsCommand(const char*)
return true;
}
bool ChatHandler::HandleReloadItemSetNamesCommand(const char*)
{
sLog.outString("Re-Loading Item set names...");
LoadRandomEnchantmentsTable();
SendGlobalGMSysMessage("DB table `item_set_names` reloaded.");
return true;
}
bool ChatHandler::HandleReloadGameObjectScriptsCommand(const char* arg)
{
if (sWorld.IsScriptScheduled())
@@ -1494,6 +1506,14 @@ bool ChatHandler::HandleReloadLocalesItemCommand(const char* /*arg*/)
return true;
}
bool ChatHandler::HandleReloadLocalesItemSetNameCommand(const char* /*arg*/)
{
sLog.outString("Re-Loading Locales Item set name... ");
objmgr.LoadItemSetNameLocales();
SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded.");
return true;
}
bool ChatHandler::HandleReloadLocalesNpcTextCommand(const char* /*arg*/)
{
sLog.outString("Re-Loading Locales NPC Text ... ");
@@ -4493,7 +4513,7 @@ bool ChatHandler::HandleReviveCommand(const char *args)
}
else
// will resurrected at login without corpse
ObjectAccessor::Instance().ConvertCorpseForPlayer(target_guid);
sObjectAccessor.ConvertCorpseForPlayer(target_guid);
return true;
}
@@ -5513,8 +5533,8 @@ bool ChatHandler::HandleResetAllCommand(const char * args)
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'",atLogin,atLogin);
ObjectAccessor::Guard guard(*HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType const& plist = ObjectAccessor::Instance().GetPlayers();
ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true);
HashMapHolder<Player>::MapType const& plist = sObjectAccessor.GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
itr->second->SetAtLoginFlag(atLogin);
@@ -7000,8 +7020,8 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char *args)
bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/)
{
PSendSysMessage("instances loaded: %d", MapManager::Instance().GetNumInstances());
PSendSysMessage("players in instances: %d", MapManager::Instance().GetNumPlayersInInstances());
PSendSysMessage("instances loaded: %d", sMapMgr.GetNumInstances());
PSendSysMessage("players in instances: %d", sMapMgr.GetNumPlayersInInstances());
PSendSysMessage("instance saves: %d", sInstanceSaveManager.GetNumInstanceSaves());
PSendSysMessage("players bound: %d", sInstanceSaveManager.GetNumBoundPlayersTotal());
PSendSysMessage("groups bound: %d", sInstanceSaveManager.GetNumBoundGroupsTotal());
+1 -1
View File
@@ -22,7 +22,7 @@
#define _HOSTILEREFMANAGER
#include "Common.h"
#include "Utilities/LinkedReference/RefManager.h"
#include "RefManager.h"
class Unit;
class ThreatManager;
+5
View File
@@ -36,8 +36,13 @@
float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
{
if (pThreatSpell)
{
if (pThreatSpell->AttributesEx & SPELL_ATTR_EX_NO_THREAT)
return 0.0f;
if (Player* modOwner = pHatedUnit->GetSpellModOwner())
modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, fThreat);
}
return pHatedUnit->ApplyTotalThreatModifier(fThreat, schoolMask);
}
+2 -2
View File
@@ -23,7 +23,7 @@
#include "Common.h"
#include "SharedDefines.h"
#include "Utilities/LinkedReference/Reference.h"
#include "LinkedReference/Reference.h"
#include "UnitEvents.h"
#include <list>
@@ -35,7 +35,7 @@ class Creature;
class ThreatManager;
struct SpellEntry;
#define THREAT_UPDATE_INTERVAL 1 * IN_MILISECONDS // Server should send threat update to client periodically each second
#define THREAT_UPDATE_INTERVAL 1 * IN_MILLISECONDS // Server should send threat update to client periodically each second
//==============================================================
// Class to calculate the real threat based
+64 -26
View File
@@ -19,7 +19,7 @@
*/
#include "Policies/SingletonImp.h"
#include "Player.h"
#include "SpellAuras.h"
#include "SpellMgr.h"
@@ -29,12 +29,10 @@
#include "InstanceData.h"
#include "ConditionMgr.h"
INSTANTIATE_SINGLETON_1(ConditionMgr);
// Checks if player meets the condition
// Can have CONDITION_SOURCE_TYPE_NONE && !mReferenceId if called from a special event (ie: eventAI)
bool Condition::Meets(Player * player, Unit* targetOverride)
{
{
if (!player)
{
sLog.outDebug("Condition player not found");
@@ -126,7 +124,7 @@ bool Condition::Meets(Player * player, Unit* targetOverride)
break;
}
case CONDITION_SPELL_SCRIPT_TARGET:
condMeets = true;//spell target condition is handled in spellsystem, here it is always true
condMeets = true;//spell target condition is handled in spellsystem, here it is always true
refId = 0;//cant have references! use CONDITION_SOURCE_TYPE_SPELL for it
break;
case CONDITION_CREATURE_TARGET:
@@ -165,7 +163,7 @@ bool Condition::Meets(Player * player, Unit* targetOverride)
break;
case CONDITION_ITEM_TARGET:
{
condMeets = true;//handled in Item::IsTargetValidForItemUse
condMeets = true;//handled in Item::IsTargetValidForItemUse
refId = 0;//cant have references for now
break;
}
@@ -201,6 +199,7 @@ ConditionMgr::ConditionMgr()
ConditionMgr::~ConditionMgr()
{
Clean();
}
ConditionList ConditionMgr::GetConditionReferences(uint32 refId)
@@ -236,12 +235,12 @@ bool ConditionMgr::IsPlayerMeetToConditionList(Player* player,const ConditionLis
}else{
sLog.outDebug("IsPlayerMeetToConditionList: Reference template -%u not found", (*i)->mReferenceId);//checked at loading, should never happen
}
} else//handle normal condition
{
if (!(*i)->Meets(player, targetOverride))
ElseGroupMap[(*i)->mElseGroup] = false;
}
}
}
}
for (std::map<uint32, bool>::const_iterator i = ElseGroupMap.begin(); i != ElseGroupMap.end(); ++i)
@@ -273,7 +272,7 @@ ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType
{
ConditionMap::const_iterator itr = m_ConditionMap.find(sType);
if (itr != m_ConditionMap.end())
{
{
ConditionTypeMap::const_iterator i = (*itr).second.find(uEntry);
if (i != (*itr).second.end())
{
@@ -287,8 +286,8 @@ ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType
void ConditionMgr::LoadConditions(bool isReload)
{
m_ConditionMap.clear(); // for reload case
m_ConditionReferenceMap.clear(); // for reload case
Clean();
//must clear all custom handled cases (groupped types) before reload
if (isReload)
{
@@ -336,11 +335,11 @@ void ConditionMgr::LoadConditions(bool isReload)
Field *fields = result->Fetch();
Condition* cond = new Condition();
int32 iSourceTypeOrReferenceId = fields[0].GetInt32();
int32 iSourceTypeOrReferenceId = fields[0].GetInt32();
cond->mSourceGroup = fields[1].GetUInt32();
cond->mSourceEntry = fields[2].GetUInt32();
cond->mElseGroup = fields[3].GetUInt32();
int32 iConditionTypeOrReference = fields[4].GetInt32();
int32 iConditionTypeOrReference = fields[4].GetInt32();
cond->mConditionValue1 = fields[5].GetUInt32();
cond->mConditionValue2 = fields[6].GetUInt32();
cond->mConditionValue3 = fields[7].GetUInt32();
@@ -351,9 +350,10 @@ void ConditionMgr::LoadConditions(bool isReload)
if (iConditionTypeOrReference < 0)//it has a reference
{
if (iConditionTypeOrReference == iSourceTypeOrReferenceId)//self referencing, skipp
if (iConditionTypeOrReference == iSourceTypeOrReferenceId)//self referencing, skip
{
sLog.outErrorDb("Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId);
delete cond;
continue;
}
cond->mReferenceId = uint32(abs(iConditionTypeOrReference));
@@ -373,8 +373,10 @@ void ConditionMgr::LoadConditions(bool isReload)
if (cond->mSourceEntry && iSourceTypeOrReferenceId < 0)
sLog.outErrorDb("Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->mSourceEntry);
}else if (!isConditionTypeValid(cond))//doesn't have reference, validate ConditionType
continue;
{
delete cond;
continue;
}
if (iSourceTypeOrReferenceId < 0)//it is a reference template
{
@@ -390,15 +392,19 @@ void ConditionMgr::LoadConditions(bool isReload)
}//end of reference templates
cond->mSourceType = ConditionSourceType(iSourceTypeOrReferenceId);
//if not a reference and SourceType is invalid, skip
if (iConditionTypeOrReference >= 0 && !isSourceTypeValid(cond))
{
delete cond;
continue;
}
//Grouping is only allowed for some types (loot templates, gossip menus, gossip items)
if (cond->mSourceGroup && !isGroupable(cond->mSourceType))
{
sLog.outErrorDb("Condition type %u has not allowed grouping %u!", uint32(cond->mSourceType), cond->mSourceGroup);
delete cond;
continue;
}else if (cond->mSourceGroup)
{
@@ -450,9 +456,15 @@ void ConditionMgr::LoadConditions(bool isReload)
break;
}
if (!bIsDone)
{
sLog.outErrorDb("Not handled grouped condition, SourceGroup %u", cond->mSourceGroup);
delete cond;
}
else
{
m_AllocatedMemory.push_back(cond);
++count;
}
continue;
}
@@ -505,11 +517,10 @@ bool ConditionMgr::addToGossipMenus(Condition* cond)
if ((*itr).second.entry == cond->mSourceGroup && (*itr).second.text_id == cond->mSourceEntry)
{
(*itr).second.conditions.push_back(cond);
sLog.outDebug("addToGossipMenus: entry %u textId %u", cond->mSourceGroup, cond->mSourceEntry);
return true;
}
}
}
}
sLog.outErrorDb("addToGossipMenus: GossipMenu %u not found", cond->mSourceGroup);
return false;
}
@@ -524,12 +535,11 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond)
if ((*itr).second.menu_id == cond->mSourceGroup && (*itr).second.id == cond->mSourceEntry)
{
(*itr).second.conditions.push_back(cond);
//sLog.outDebug("addToGossipMenuItems: menuId %u id %u", cond->mSourceGroup, cond->mSourceEntry);
return true;
}
}
}
sLog.outErrorDb("addToGossipMenuItems: GossipMenuIt %u Item %u not found", cond->mSourceGroup, cond->mSourceEntry);
sLog.outErrorDb("addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->mSourceGroup, cond->mSourceEntry);
return false;
}
@@ -591,7 +601,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
break;
}
case CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE:
{
{
if (!LootTemplates_Gameobject.HaveLootFor(cond->mSourceGroup))
{
sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->mSourceGroup);
@@ -607,7 +617,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
break;
}
case CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE:
{
{
if (!LootTemplates_Item.HaveLootFor(cond->mSourceGroup))
{
sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->mSourceGroup);
@@ -776,7 +786,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
return false;
}
break;
}
}
case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE:
{
if (!sCreatureStorage.LookupEntry<CreatureInfo>(cond->mSourceEntry))
@@ -1043,10 +1053,10 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
sLog.outErrorDb("SpellTarget condition has non existing spell target type (%u), skipped", cond->mConditionValue1);
return false;
}
}
switch(cond->mConditionValue1)
{
case SPELL_TARGET_TYPE_GAMEOBJECT:
case SPELL_TARGET_TYPE_GAMEOBJECT:
{
if (cond->mConditionValue2 && !sGOStorage.LookupEntry<GameObjectInfo>(cond->mConditionValue2))
{
@@ -1143,3 +1153,31 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
return true;
}
void ConditionMgr::Clean()
{
for (ConditionReferenceMap::iterator itr = m_ConditionReferenceMap.begin(); itr != m_ConditionReferenceMap.end(); ++itr)
{
for (ConditionList::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
delete *it;
itr->second.clear();
}
m_ConditionReferenceMap.clear();
for (ConditionMap::iterator itr = m_ConditionMap.begin(); itr != m_ConditionMap.end(); ++itr)
{
for (ConditionTypeMap::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
{
for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
delete *i;
it->second.clear();
}
itr->second.clear();
}
m_ConditionMap.clear();
// this is a BIG hack, feel free to fix it if you can figure out the ConditionMgr ;)
for (std::list<Condition*>::const_iterator itr = m_AllocatedMemory.begin(); itr != m_AllocatedMemory.end(); ++itr)
delete *itr;
m_AllocatedMemory.clear();
}
+10 -5
View File
@@ -47,7 +47,7 @@ enum ConditionType
CONDITION_CLASS = 15, // class 0 +referenceID true if player's class is equal to class
CONDITION_RACE = 16, // race 0 +referenceID true if player's race is equal to race
CONDITION_ACHIEVEMENT = 17, // achievement_id 0 +referenceID true if achievement is complete
CONDITION_SPELL_SCRIPT_TARGET = 18, // SpellScriptTargetType, TargetEntry, 0
CONDITION_SPELL_SCRIPT_TARGET = 18, // SpellScriptTargetType, TargetEntry, 0
CONDITION_CREATURE_TARGET = 19, // creature entry 0 +referenceID true if current target is creature with value1 entry
CONDITION_TARGET_HEALTH_BELOW_PCT = 20, // 0-100 0 +referenceID true if target's health is below value1 percent, false if over or no target
CONDITION_TARGET_RANGE = 21, // minDistance maxDist +referenceID true if target is closer then minDist and further then maxDist or if max is 0 then max dist is infinit
@@ -84,7 +84,7 @@ enum ConditionSourceType
#define MAX_CONDITIONSOURCETYPE 19
struct Condition
{
{
ConditionSourceType mSourceType; //SourceTypeOrReferenceId
uint32 mSourceGroup;
uint32 mSourceEntry;
@@ -121,14 +121,16 @@ typedef std::map<uint32, ConditionList > ConditionReferenceMap;//only used for r
class ConditionMgr
{
friend class ACE_Singleton<ConditionMgr, ACE_Null_Mutex>;
ConditionMgr();
public:
ConditionMgr();
~ConditionMgr();
void LoadConditions(bool isReload = false);
bool isConditionTypeValid(Condition* cond);
ConditionList GetConditionReferences(uint32 refId);
bool IsPlayerMeetToConditions(Player* player, ConditionList conditions, Unit* targetOverride = NULL);
ConditionList GetConditionsForNotGroupedEntry(ConditionSourceType sType, uint32 uEntry);
@@ -160,8 +162,11 @@ class ConditionMgr
sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU ||
sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION);
}
void Clean(); // free up resources
std::list<Condition*> m_AllocatedMemory; // some garbage collection :)
};
#define sConditionMgr Trinity::Singleton<ConditionMgr>::Instance()
#define sConditionMgr (*ACE_Singleton<ConditionMgr, ACE_Null_Mutex>::instance())
#endif
+14 -15
View File
@@ -19,8 +19,8 @@
*/
#include "DBCStores.h"
#include "Policies/SingletonImp.h"
#include "Log.h"
#include "Logging/Log.h"
#include "ProgressBar.h"
#include "SharedDefines.h"
#include "SpellMgr.h"
@@ -235,15 +235,15 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
else
errlist.push_back(dbc_filename);
}
if (sql)
delete sql;
delete sql;
}
void LoadDBCStores(const std::string& dataPath)
{
std::string dbcPath = dataPath+"dbc/";
const uint32 DBCFilesCount = 87;
const uint32 DBCFilesCount = 89;
barGoLink bar(DBCFilesCount);
@@ -506,8 +506,7 @@ void LoadDBCStores(const std::string& dataPath)
// fill data
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
sTaxiPathNodesByPath[entry->path][entry->index] = TaxiPathNode(entry->mapid,entry->x,entry->y,entry->z,entry->actionFlag,entry->delay);
sTaxiPathNodeStore.Clear();
sTaxiPathNodesByPath[entry->path].set(entry->index, entry);
// Initialize global taxinodes mask
// include existed nodes that have at least single not spell base (scripted) path
@@ -579,7 +578,7 @@ void LoadDBCStores(const std::string& dataPath)
// error checks
if (bad_dbc_files.size() >= DBCFilesCount)
{
sLog.outError("\nIncorrect DataDir value in Trinityd.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str());
sLog.outError("\nIncorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str());
exit(1);
}
else if (!bad_dbc_files.empty())
@@ -593,13 +592,13 @@ void LoadDBCStores(const std::string& dataPath)
}
// Check loaded DBC files proper version
if (!sAreaStore.LookupEntry(3617) || // last area (areaflag) added in 3.3.3a
!sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.3a
!sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.3a
!sItemStore.LookupEntry(54860) || // last gem property added in 3.3.3a
!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.3a
!sMapStore.LookupEntry(724) || // last map added in 3.3.3a
!sSpellStore.LookupEntry(76567) ) // last client known item added in 3.3.3a
if (!sAreaStore.LookupEntry(3617) || // last area (areaflag) added in 3.3.5a
!sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a
!sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.5a
!sItemStore.LookupEntry(56806) || // last gem property added in 3.3.5a
!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
{
sLog.outError("\nYou have _outdated_ DBC files. Please extract correct versions from current using client.");
exit(1);
+1 -1
View File
@@ -20,7 +20,7 @@
#define TRINITY_DBCSTORES_H
#include "Common.h"
#include "Database/DBCStore.h"
#include "DBCStore.h"
#include "DBCStructure.h"
#include <list>
+15 -18
View File
@@ -21,8 +21,10 @@
#ifndef TRINITY_DBCSTRUCTURE_H
#define TRINITY_DBCSTRUCTURE_H
#include "Common.h"
#include "DBCEnums.h"
#include "Platform/Define.h"
#include "Define.h"
#include "Path.h"
#include "Util.h"
#include <map>
@@ -1080,12 +1082,14 @@ struct ItemRandomSuffixEntry
uint32 prefix[5]; // 22-24 m_allocationPct
};
#define MAX_ITEM_SET_ITEMS 10
struct ItemSetEntry
{
//uint32 id // 0 m_ID
char* name[16]; // 1-16 m_name_lang
// 17 string flags, unused
//uint32 itemId[17]; // 18-34 m_itemID
uint32 itemId[MAX_ITEM_SET_ITEMS]; // 18-27 m_itemID
//uint32 unknown[7]; // 28-34 unk, all 0
uint32 spells[8]; // 35-42 m_setSpellID
uint32 items_to_triggerspell[8]; // 43-50 m_setThreshold
uint32 required_skill_id; // 51 m_requiredSkill
@@ -1509,9 +1513,6 @@ struct SpellEntry
//uint32 spellDescriptionVariableID; // 232 3.2.0
//uint32 SpellDifficultyId; // 233 3.3.0
// helpers
int32 CalculateSimpleValue(uint8 eff) const { return EffectBasePoints[eff]+int32(1); }
private:
// prevent creating custom entries (copy data from original in fact)
SpellEntry(SpellEntry const&); // DON'T must have implementation
@@ -1712,8 +1713,8 @@ struct TaxiPathNodeEntry
float z; // 6 m_LocZ
uint32 actionFlag; // 7 m_flags
uint32 delay; // 8 m_delay
// 9 m_arrivalEventID
// 10 m_departureEventID
uint32 arrivalEventID; // 9 m_arrivalEventID
uint32 departureEventID; // 10 m_departureEventID
};
struct TotemCategoryEntry
@@ -1909,19 +1910,15 @@ struct TaxiPathBySourceAndDestination
typedef std::map<uint32,TaxiPathBySourceAndDestination> TaxiPathSetForSource;
typedef std::map<uint32,TaxiPathSetForSource> TaxiPathSetBySource;
struct TaxiPathNode
struct TaxiPathNodePtr
{
TaxiPathNode() : mapid(0), x(0),y(0),z(0),actionFlag(0),delay(0) {}
TaxiPathNode(uint32 _mapid, float _x, float _y, float _z, uint32 _actionFlag, uint32 _delay) : mapid(_mapid), x(_x),y(_y),z(_z),actionFlag(_actionFlag),delay(_delay) {}
uint32 mapid;
float x;
float y;
float z;
uint32 actionFlag;
uint32 delay;
TaxiPathNodePtr() : i_ptr(NULL) {}
TaxiPathNodePtr(TaxiPathNodeEntry const* ptr) : i_ptr(ptr) {}
TaxiPathNodeEntry const* i_ptr;
operator TaxiPathNodeEntry const& () const { return *i_ptr; }
};
typedef std::vector<TaxiPathNode> TaxiPathNodeList;
typedef Path<TaxiPathNodePtr,TaxiPathNodeEntry const> TaxiPathNodeList;
typedef std::vector<TaxiPathNodeList> TaxiPathNodesByPath;
#define TaxiMaskSize 12
+3 -3
View File
@@ -72,7 +72,7 @@ const char ItemExtendedCostEntryfmt[]="niiiiiiiiiiiiiix";
const char ItemLimitCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxix";
const char ItemRandomPropertiesfmt[]="nxiiiiissssssssssssssssx";
const char ItemRandomSuffixfmt[]="nssssssssssssssssxxiiiiiiiiii";
const char ItemSetEntryfmt[]="dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii";
const char ItemSetEntryfmt[]="dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii";
const char LFGDungeonEntryfmt[]="nxxxxxxxxxxxxxxxxxiiiiiiixixxixixxxxxxxxxxxxxxxxx";
const char LockEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";
const char MailTemplateEntryfmt[]="nxxxxxxxxxxxxxxxxxssssssssssssssssx";
@@ -95,7 +95,7 @@ const std::string CustomSpellDifficultyfmt="ppppp";
const std::string CustomSpellDifficultyIndex="id";
const char SpellDurationfmt[]="niii";
const char SpellEntryfmt[]="niiiiiiiiiiiixixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixxxxxxx";
const std::string CustomSpellEntryfmt="pappppppppaaaaaapaaaaaaaaaaapaaapapppppppaaaaapaapaaaaaaaaaaaaaaaaaappppppppppppppppppppppppppppppppppppaaaaaapppppppppaaapppppppppaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaappppppppapppaaaaappaaaaaaa";
const std::string CustomSpellEntryfmt="pappppppppaapapapaaaaaaaaaaapaaapapppppppaaaaapaapaaaaaaaaaaaaaaaaaappppppppppppppppppppppppppppppppppppaaaaaapppppppppaaapppppppppaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaappppppppapppaaaaappaaaaaaa";
const std::string CustomSpellEntryIndex = "Id";
const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiiiii";
@@ -110,7 +110,7 @@ const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx";
const char TalentTabEntryfmt[]="nxxxxxxxxxxxxxxxxxxxiiix";
const char TaxiNodesEntryfmt[]="nifffssssssssssssssssxii";
const char TaxiPathEntryfmt[]="niii";
const char TaxiPathNodeEntryfmt[]="diiifffiixx";
const char TaxiPathNodeEntryfmt[]="diiifffiiii";
const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifiixx";
const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
+1 -1
View File
@@ -19,7 +19,7 @@
#ifndef _LFG_H
#define _LFG_H
#include "Platform/Define.h"
#include "Define.h"
#include "Object.h"
enum LfgRoles
+2 -5
View File
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Policies/SingletonImp.h"
#include "Common.h"
#include "SharedDefines.h"
#include "Group.h"
@@ -24,8 +24,6 @@
#include "ObjectMgr.h"
#include "WorldPacket.h"
INSTANTIATE_SINGLETON_1(LFGMgr);
/*********************************************************/
/*** LFG QUEUES ***/
/*********************************************************/
@@ -46,8 +44,7 @@ LFGQueue::~LFGQueue()
void LFGQueue::AddToQueue(uint64 guid, LfgQueueInfo* pqInfo)
{
if (LfgQueueInfo* qInfo = m_LfgQueue[guid])
delete qInfo;
delete m_LfgQueue[guid];
m_LfgQueue[guid] = pqInfo;
// ATM will only add it to the queue... No find group implementation... yet (on purpose)
}
+33 -32
View File
@@ -20,7 +20,7 @@
#define _LFGMGR_H
#include "Common.h"
#include "Policies/Singleton.h"
#include "ace/Singleton.h"
#include "Group.h"
#include "LFG.h"
@@ -237,43 +237,44 @@ typedef std::map<uint8, LFGQueue *> LFGQueueMap;
class LFGMgr
{
public:
friend class ACE_Singleton<LFGMgr, ACE_Null_Mutex>;
LFGMgr();
~LFGMgr();
public:
~LFGMgr();
void InitLFG();
void SendLfgPlayerInfo(Player *plr);
void SendLfgPartyInfo(Player *plr);
void Join(Player *plr);
void Leave(Player *plr, Group *grp = NULL);
void UpdateRoleCheck(Group *grp, Player *plr = NULL);
void Update(uint32 diff);
void InitLFG();
void SendLfgPlayerInfo(Player *plr);
void SendLfgPartyInfo(Player *plr);
void Join(Player *plr);
void Leave(Player *plr, Group *grp = NULL);
void UpdateRoleCheck(Group *grp, Player *plr = NULL);
void Update(uint32 diff);
private:
void BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck);
void BuildAvailableRandomDungeonList(WorldPacket &data, Player *plr);
void BuildRewardBlock(WorldPacket &data, uint32 dungeon, Player *plr);
void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet);
void BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap);
bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
private:
void BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck);
void BuildAvailableRandomDungeonList(WorldPacket &data, Player *plr);
void BuildRewardBlock(WorldPacket &data, uint32 dungeon, Player *plr);
void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet);
void BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap);
bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
LfgLockStatusMap* GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
LfgLockStatusSet* GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
LfgDungeonSet* GetRandomDungeons(uint8 level, uint8 expansion);
LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon);
LfgDungeonSet* GetAllDungeons();
LfgReward* GetRandomDungeonReward(uint32 dungeon, bool done, uint8 level);
uint8 GetDungeonGroupType(uint32 dungeon);
LfgLockStatusMap* GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
LfgLockStatusSet* GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
LfgDungeonSet* GetRandomDungeons(uint8 level, uint8 expansion);
LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon);
LfgDungeonSet* GetAllDungeons();
LfgReward* GetRandomDungeonReward(uint32 dungeon, bool done, uint8 level);
uint8 GetDungeonGroupType(uint32 dungeon);
LfgRewardList m_RewardList;
LfgRewardList m_RewardDoneList;
LfgDungeonMap m_DungeonsMap;
LfgRewardList m_RewardList;
LfgRewardList m_RewardDoneList;
LfgDungeonMap m_DungeonsMap;
LFGQueueMap m_Queues;
LfgRoleCheckMap m_RoleChecks;
uint32 m_QueueTimer;
bool m_update;
LFGQueueMap m_Queues;
LfgRoleCheckMap m_RoleChecks;
uint32 m_QueueTimer;
bool m_update;
};
#define sLFGMgr Trinity::Singleton<LFGMgr>::Instance()
#define sLFGMgr (*ACE_Singleton<LFGMgr, ACE_Null_Mutex>::instance())
#endif
+3 -3
View File
@@ -23,7 +23,7 @@
#include "Player.h"
#include "UpdateMask.h"
#include "ObjectAccessor.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "Opcodes.h"
#include "GossipDef.h"
#include "World.h"
@@ -54,7 +54,7 @@ void Corpse::AddToWorld()
{
///- Register the corpse for guid lookup
if (!IsInWorld())
ObjectAccessor::Instance().AddObject(this);
sObjectAccessor.AddObject(this);
Object::AddToWorld();
}
@@ -63,7 +63,7 @@ void Corpse::RemoveFromWorld()
{
///- Remove the corpse from the accessor
if (IsInWorld())
ObjectAccessor::Instance().RemoveObject(this);
sObjectAccessor.RemoveObject(this);
Object::RemoveFromWorld();
}
+1 -1
View File
@@ -22,7 +22,7 @@
#define TRINITYCORE_CORPSE_H
#include "Object.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "GridDefines.h"
#include "LootMgr.h"
+37 -33
View File
@@ -19,7 +19,7 @@
*/
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "WorldPacket.h"
#include "World.h"
#include "ObjectMgr.h"
@@ -28,7 +28,7 @@
#include "QuestDef.h"
#include "GossipDef.h"
#include "Player.h"
#include "PoolHandler.h"
#include "PoolMgr.h"
#include "Opcodes.h"
#include "Log.h"
#include "LootMgr.h"
@@ -49,7 +49,7 @@
#include "Vehicle.h"
#include "SpellAuraEffects.h"
// apply implementation of the singletons
#include "Policies/SingletonImp.h"
TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
{
@@ -171,11 +171,8 @@ Creature::~Creature()
{
m_vendorItemCounts.clear();
if (i_AI)
{
delete i_AI;
i_AI = NULL;
}
delete i_AI;
i_AI = NULL;
//if (m_uint32Values)
// sLog.outError("Deconstruct Creature Entry = %u", GetEntry());
@@ -188,7 +185,7 @@ void Creature::AddToWorld()
{
if (m_zoneScript)
m_zoneScript->OnCreatureCreate(this, true);
ObjectAccessor::Instance().AddObject(this);
sObjectAccessor.AddObject(this);
Unit::AddToWorld();
SearchFormation();
AIM_Initialize();
@@ -206,7 +203,7 @@ void Creature::RemoveFromWorld()
if (m_formation)
formation_mgr.RemoveCreatureFromGroup(m_formation, this);
Unit::RemoveFromWorld();
ObjectAccessor::Instance().RemoveObject(this);
sObjectAccessor.RemoveObject(this);
}
}
@@ -413,13 +410,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data)
if (isTrigger())
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if (isTotem() || isTrigger()
|| GetCreatureType() == CREATURE_TYPE_CRITTER)
SetReactState(REACT_PASSIVE);
/*else if (isCivilian())
SetReactState(REACT_DEFENSIVE);*/
else
SetReactState(REACT_AGGRESSIVE);
InitializeReactState();
if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_NO_TAUNT)
{
@@ -629,7 +620,7 @@ void Creature::RegenerateMana()
if ((*i)->GetMiscValue() == POWER_MANA)
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) * CREATURE_REGEN_INTERVAL / (5 * IN_MILISECONDS);
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
ModifyPower(POWER_MANA, addvalue);
}
@@ -666,7 +657,7 @@ void Creature::RegenerateHealth()
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * CREATURE_REGEN_INTERVAL / (5 * IN_MILISECONDS);
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
ModifyHealth(addvalue);
}
@@ -721,7 +712,7 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
Motion_Initialize();
i_AI = ai ? ai : FactorySelector::selectAI(this);
if (oldAI) delete oldAI;
delete oldAI;
IsAIEnabled = true;
i_AI->InitializeAI();
return true;
@@ -1271,16 +1262,26 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
}
}
uint32 curhealth = data->curhealth;
if (curhealth)
uint32 curhealth;
if (!m_regenHealth)
{
curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank));
if (curhealth < 1)
curhealth = 1;
curhealth = data->curhealth;
if (curhealth)
{
curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank));
if (curhealth < 1)
curhealth = 1;
}
SetPower(POWER_MANA,data->curmana);
}
else
{
curhealth = GetMaxHealth();
SetPower(POWER_MANA,GetMaxPower(POWER_MANA));
}
SetHealth(m_deathState == ALIVE ? curhealth : 0);
SetPower(POWER_MANA,data->curmana);
// checked at creature_template loading
m_defaultMovementType = MovementGeneratorType(data->movementType);
@@ -1472,7 +1473,7 @@ void Creature::setDeathState(DeathState s)
{
if ((s == JUST_DIED && !m_isDeadByDefault)||(s == JUST_ALIVED && m_isDeadByDefault))
{
m_deathTimer = m_corpseDelay*IN_MILISECONDS;
m_deathTimer = m_corpseDelay*IN_MILLISECONDS;
// always save boss respawn time at death to prevent crash cheating
if (sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss())
@@ -1605,6 +1606,9 @@ void Creature::Respawn(bool force)
uint16 poolid = GetDBTableGUIDLow() ? poolhandler.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0;
if (poolid)
poolhandler.UpdatePool<Creature>(poolid, GetDBTableGUIDLow());
//Re-initialize reactstate that could be altered by movementgenerators
InitializeReactState();
}
UpdateObjectVisibility();
@@ -1983,7 +1987,7 @@ void Creature::SaveRespawnTime()
if (m_respawnTime > time(NULL)) // dead (no corpse)
objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime);
else if (m_deathTimer > 0) // dead (corpse)
objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),time(NULL)+m_respawnDelay+m_deathTimer/IN_MILISECONDS);
objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),time(NULL)+m_respawnDelay+m_deathTimer/IN_MILLISECONDS);
}
// this should not be called by petAI or
@@ -2166,7 +2170,7 @@ void Creature::AddCreatureSpellCooldown(uint32 spellid)
modOwner->ApplySpellMod(spellid, SPELLMOD_COOLDOWN, cooldown);
if (cooldown)
_AddCreatureSpellCooldown(spellid, time(NULL) + cooldown/IN_MILISECONDS);
_AddCreatureSpellCooldown(spellid, time(NULL) + cooldown/IN_MILLISECONDS);
if (spellInfo->Category)
_AddCreatureCategoryCooldown(spellInfo->Category, time(NULL));
@@ -2185,7 +2189,7 @@ bool Creature::HasCategoryCooldown(uint32 spell_id) const
return true;
CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->Category);
return(itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->CategoryRecoveryTime / IN_MILISECONDS)) > time(NULL));
return(itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->CategoryRecoveryTime / IN_MILLISECONDS)) > time(NULL));
}
bool Creature::HasSpellCooldown(uint32 spell_id) const
@@ -2209,7 +2213,7 @@ time_t Creature::GetRespawnTimeEx() const
if (m_respawnTime > now) // dead (no corpse)
return m_respawnTime;
else if (m_deathTimer > 0) // dead (corpse)
return now+m_respawnDelay+m_deathTimer/IN_MILISECONDS;
return now+m_respawnDelay+m_deathTimer/IN_MILLISECONDS;
else
return now;
}
@@ -2251,7 +2255,7 @@ void Creature::AllLootRemovedFromCorpse()
// corpse was not skinnable -> apply corpse looted timer
if (!cinfo || !cinfo->SkinLootId)
nDeathTimer = (uint32)((m_corpseDelay * IN_MILISECONDS) * sWorld.getRate(RATE_CORPSE_DECAY_LOOTED));
nDeathTimer = (uint32)((m_corpseDelay * IN_MILLISECONDS) * sWorld.getRate(RATE_CORPSE_DECAY_LOOTED));
// corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
else
nDeathTimer = 0;
@@ -2413,7 +2417,7 @@ time_t Creature::GetLinkedCreatureRespawnTime() const
if (data->mapid == GetMapId()) // look up on the same map
targetMap = GetMap();
else // it shouldn't be instanceable map here
targetMap = MapManager::Instance().FindMap(data->mapid);
targetMap = sMapMgr.FindMap(data->mapid);
}
if (targetMap)
return objmgr.GetCreatureRespawnTime(targetGuid,targetMap->GetInstanceId());
+19 -5
View File
@@ -26,7 +26,7 @@
#include "UpdateMask.h"
#include "ItemPrototype.h"
#include "LootMgr.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "Cell.h"
#include <list>
@@ -66,7 +66,7 @@ enum CreatureFlagsExtra
#endif
#define MAX_KILL_CREDIT 2
#define CREATURE_REGEN_INTERVAL 2 * IN_MILISECONDS
#define CREATURE_REGEN_INTERVAL 2 * IN_MILLISECONDS
// from `creature_template` table
struct CreatureInfo
@@ -314,6 +314,9 @@ struct VendorItem
int32 maxcount; // 0 for infinity item amount
uint32 incrtime; // time for restore items amount if maxcount != 0
uint32 ExtendedCost;
//helpers
bool IsGoldRequired(ItemPrototype const* pProto) const { return pProto->Flags2 & ITEM_FLAGS_EXTRA_EXT_COST_REQUIRES_GOLD || !ExtendedCost; }
};
typedef std::vector<VendorItem*> VendorItemList;
@@ -424,9 +427,20 @@ class Creature : public Unit, public GridObject<Creature>
bool canWalk() const { return GetCreatureInfo()->InhabitType & INHABIT_GROUND; }
bool canSwim() const { return GetCreatureInfo()->InhabitType & INHABIT_WATER; }
//bool canFly() const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; }
void SetReactState(ReactStates st) { m_reactState = st; }
ReactStates GetReactState() { return m_reactState; }
bool HasReactState(ReactStates state) const { return (m_reactState == state); }
void InitializeReactState()
{
if (isTotem() || isTrigger() || GetCreatureType() == CREATURE_TYPE_CRITTER)
SetReactState(REACT_PASSIVE);
else
SetReactState(REACT_AGGRESSIVE);
/*else if (isCivilian())
SetReactState(REACT_DEFENSIVE);*/;
}
///// TODO RENAME THIS!!!!!
bool isCanTrainingOf(Player* player, bool msg) const;
bool isCanInteractWithBattleMaster(Player* player, bool msg) const;
@@ -607,10 +621,10 @@ class Creature : public Unit, public GridObject<Creature>
bool hasInvolvedQuest(uint32 quest_id) const;
bool isRegeneratingHealth() { return m_regenHealth; }
virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; }
virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; }
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
{
if (pos >= CREATURE_MAX_SPELLS || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
if (pos >= MAX_SPELL_CHARM || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
return 0;
else
return m_charmInfo->GetCharmSpell(pos)->GetAction();
@@ -696,7 +710,7 @@ class Creature : public Unit, public GridObject<Creature>
bool DisableReputationGain;
CreatureInfo const* m_creatureInfo; // in difficulty mode > 0 can different from ObjMgr::GetCreatureTemplate(GetEntry())
CreatureInfo const* m_creatureInfo; // in difficulty mode > 0 can different from objmgr.::GetCreatureTemplate(GetEntry())
CreatureData const* m_creatureData;
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
@@ -22,13 +22,11 @@
#include "CreatureGroups.h"
#include "ObjectMgr.h"
#include "ProgressBar.h"
#include "Policies/SingletonImp.h"
#include "CreatureAI.h"
#define MAX_DESYNC 5.0f
INSTANTIATE_SINGLETON_1(CreatureGroupManager);
CreatureGroupInfoType CreatureGroupMap;
void CreatureGroupManager::AddCreatureToGroup(uint32 groupId, Creature *member)
@@ -35,12 +35,15 @@ struct FormationInfo
class CreatureGroupManager
{
friend class ACE_Singleton<CreatureGroupManager, ACE_Null_Mutex>;
public:
void AddCreatureToGroup(uint32 group_id, Creature *creature);
void RemoveCreatureFromGroup(CreatureGroup *group, Creature *creature);
void LoadCreatureFormations();
};
#define formation_mgr (*ACE_Singleton<CreatureGroupManager, ACE_Null_Mutex>::instance())
typedef UNORDERED_MAP<uint32/*memberDBGUID*/, FormationInfo*> CreatureGroupInfoType;
extern CreatureGroupInfoType CreatureGroupMap;
@@ -73,6 +76,4 @@ class CreatureGroup
void MemberAttackStart(Creature* member, Unit *target);
};
#define formation_mgr Trinity::Singleton<CreatureGroupManager>::Instance()
#endif
@@ -522,7 +522,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID,
}
// rewarded honor points. Multiply with 10 to satisfy client
data << uint32(10*Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
data << 10 * Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills());
data << float(0); // new 3.3.0, honor multiplier?
data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
data << int32(pQuest->GetRewSpellCast()); // casted spell
@@ -616,7 +616,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const *pQuest)
data << int32(pQuest->GetRewSpellCast()); // casted spell
// rewarded honor points
data << uint32(Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
data << Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills());
data << float(0); // new reward honor (multipled by ~62 at client side)
data << uint32(pQuest->GetSrcItemId()); // source item id
data << uint32(pQuest->GetFlags() & 0xFFFF); // quest flags
@@ -775,7 +775,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, uint64 npcGUID,
data << uint32(pQuest->XPValue(pSession->GetPlayer())*sWorld.getRate(RATE_XP_QUEST));
// rewarded honor points. Multiply with 10 to satisfy client
data << uint32(10*Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
data << 10 * Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills());
data << float(0); // unk, honor multiplier?
data << uint32(0x08); // unused by client?
data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
@@ -23,7 +23,7 @@
#include "Opcodes.h"
#include "World.h"
#include "ObjectAccessor.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "GridNotifiers.h"
#include "CellImpl.h"
#include "GridNotifiersImpl.h"
@@ -46,7 +46,7 @@ void DynamicObject::AddToWorld()
///- Register the dynamicObject for guid lookup
if (!IsInWorld())
{
ObjectAccessor::Instance().AddObject(this);
sObjectAccessor.AddObject(this);
WorldObject::AddToWorld();
}
}
@@ -69,7 +69,7 @@ void DynamicObject::RemoveFromWorld()
}
}
WorldObject::RemoveFromWorld();
ObjectAccessor::Instance().RemoveObject(this);
sObjectAccessor.RemoveObject(this);
}
}
@@ -22,14 +22,14 @@
#include "QuestDef.h"
#include "GameObject.h"
#include "ObjectMgr.h"
#include "PoolHandler.h"
#include "PoolMgr.h"
#include "SpellMgr.h"
#include "Spell.h"
#include "UpdateMask.h"
#include "Opcodes.h"
#include "WorldPacket.h"
#include "World.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "LootMgr.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
@@ -117,7 +117,7 @@ void GameObject::AddToWorld()
if (m_zoneScript)
m_zoneScript->OnGameObjectCreate(this, true);
ObjectAccessor::Instance().AddObject(this);
sObjectAccessor.AddObject(this);
WorldObject::AddToWorld();
}
}
@@ -139,7 +139,7 @@ void GameObject::RemoveFromWorld()
sLog.outError("Delete GameObject (GUID: %u Entry: %u) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid));
}
WorldObject::RemoveFromWorld();
ObjectAccessor::Instance().RemoveObject(this);
sObjectAccessor.RemoveObject(this);
}
}
@@ -1626,7 +1626,7 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
if (m_goValue->building.health <= m_goInfo->building.damagedNumHits)
{
if (!m_goInfo->building.destroyedDisplayId)
m_goValue->building.health = 0;
m_goValue->building.health = m_goInfo->building.damagedNumHits;
else if (!m_goValue->building.health)
m_goValue->building.health = 1;
@@ -25,7 +25,7 @@
#include "SharedDefines.h"
#include "Object.h"
#include "LootMgr.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform
#if defined(__GNUC__)
@@ -479,7 +479,7 @@ struct GameObjectInfo
case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areadamage.autoCloseTime; break;
default: break;
}
return autoCloseTime / IN_MILISECONDS; // prior to 3.0.3, conversion was / 0x10000;
return autoCloseTime / IN_MILLISECONDS; // prior to 3.0.3, conversion was / 0x10000;
}
uint32 GetLootId() const
@@ -500,6 +500,16 @@ struct GameObjectInfo
default: return 0;
}
}
uint32 GetEventScriptId() const
{
switch(type)
{
case GAMEOBJECT_TYPE_GOOBER: return goober.eventId;
case GAMEOBJECT_TYPE_CHEST: return chest.eventId;
case GAMEOBJECT_TYPE_CAMERA: return camera.eventID;
default: return 0;
}
}
};
class OPvPCapturePoint;
@@ -20,7 +20,7 @@
#include "Common.h"
#include "ObjectMgr.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "Bag.h"
#include "Log.h"
@@ -117,11 +117,8 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result)
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
if (m_bagslot[i])
{
delete m_bagslot[i];
m_bagslot[i] = NULL;
}
delete m_bagslot[i];
m_bagslot[i] = NULL;
}
return true;
+12 -19
View File
@@ -18,11 +18,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <ace/Auto_Ptr.h>
#include "Common.h"
#include "Item.h"
#include "ObjectMgr.h"
#include "WorldPacket.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "ItemEnchantmentMgr.h"
#include "SpellMgr.h"
#include "ScriptMgr.h"
@@ -633,7 +635,7 @@ void Item::SetState(ItemUpdateState state, Player *forplayer)
{
// pretend the item never existed
RemoveFromUpdateQueueOf(forplayer);
forplayer->DeleteRefundReference(GetGUID());
forplayer->DeleteRefundReference(GetGUIDLow());
delete this;
return;
}
@@ -834,7 +836,7 @@ bool Item::IsTargetValidForItemUse(Unit* pUnitTarget)
for (ConditionList::const_iterator itr = conditions.begin(); itr != conditions.end(); ++itr)
{
ItemRequiredTarget *irt = new ItemRequiredTarget((ItemRequiredTargetType)(*itr)->mConditionValue1, (*itr)->mConditionValue2);
ACE_Auto_Ptr<ItemRequiredTarget> irt(new ItemRequiredTarget((ItemRequiredTargetType)(*itr)->mConditionValue1, (*itr)->mConditionValue2));
if (irt->IsFitToRequirements(pUnitTarget))
return true;
}
@@ -1035,20 +1037,11 @@ bool Item::IsBindedNotWith(Player const* player) const
if (GetOwnerGUID() == player->GetGUID())
return false;
// not BOA item case
if (!IsBoundAccountWide())
return true;
// online
if (Player* owner = objmgr.GetPlayer(GetOwnerGUID()))
{
return owner->GetSession()->GetAccountId() != player->GetSession()->GetAccountId();
}
// offline slow case
else
{
return objmgr.GetPlayerAccountIdByGUID(GetOwnerGUID()) != player->GetSession()->GetAccountId();
}
// BOA item case
if (IsBoundAccountWide())
return false;
return true;
}
bool ItemRequiredTarget::IsFitToRequirements(Unit* pUnitTarget) const
@@ -1106,7 +1099,7 @@ void Item::SetNotRefundable(Player *owner, bool changestate)
SetPaidExtendedCost(0);
DeleteRefundDataFromDB();
owner->DeleteRefundReference(GetGUID());
owner->DeleteRefundReference(GetGUIDLow());
}
void Item::UpdatePlayedTime(Player *owner)
@@ -1147,4 +1140,4 @@ uint32 Item::GetPlayedTime()
bool Item::IsRefundExpired()
{
return (GetPlayedTime() > 2*HOUR);
}
}
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <functional>
#include "ItemEnchantmentMgr.h"
#include "Database/DatabaseEnv.h"
#include "DatabaseEnv.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "ProgressBar.h"
@@ -91,18 +91,10 @@ uint32 GetItemEnchantMod(int32 entry)
if (!entry)
return 0;
EnchantmentStore::const_iterator tab;
if (entry == -1)
{
tab = RandomItemEnch.begin();
entry = urand(1, RandomItemEnch.size()) - 1;
for (uint32 i = 0; i < entry; ++i)
++tab;
}
else
tab = RandomItemEnch.find(entry);
return 0;
EnchantmentStore::const_iterator tab = RandomItemEnch.find(entry);
if (tab == RandomItemEnch.end())
{
sLog.outErrorDb("Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.",entry);
+15 -3
View File
@@ -111,8 +111,9 @@ enum ITEM_FLAGS
ITEM_FLAGS_OPENABLE = 0x00000004,
ITEM_FLAGS_WRAPPED = 0x00000008,
ITEM_FLAGS_BROKEN = 0x00000010, // appears red icon (like when item durability == 0)
ITEM_FLAGS_TOTEM = 0x00000020, // ?
ITEM_FLAGS_INDESTRUCTIBLE = 0x00000020, // Item can not be destroyed, except by using spell (item can be reagent for spell and then allowed)
ITEM_FLAGS_USABLE = 0x00000040, // ?
ITEM_FLAGS_NO_EQUIP_COOLDOWN = 0x00000080, // ?
ITEM_FLAGS_WRAPPER = 0x00000200, // used or not used wrapper
ITEM_FLAGS_PARTY_LOOT = 0x00000800, // determines if item is party loot or not
ITEM_FLAGS_REFUNDABLE = 0x00001000, // item cost can be refunded within 2 hours after purchase
@@ -135,7 +136,7 @@ enum ItemFlagsExtra
{
ITEM_FLAGS_EXTRA_HORDE_ONLY = 0x00000001,
ITEM_FLAGS_EXTRA_ALLIANCE_ONLY = 0x00000002,
ITEM_FLAGS_EXTRA_REFUNDABLE = 0x00000004,
ITEM_FLAGS_EXTRA_EXT_COST_REQUIRES_GOLD = 0x00000004, // when item uses extended cost, gold is also required
ITEM_FLAGS_EXTRA_NEED_ROLL_DISABLED = 0x00000100
};
@@ -623,7 +624,7 @@ struct ItemPrototype
uint32 GetMaxStackSize() const
{
return (Stackable == 2147483647 || Stackable <= 0 || Stackable == 1000) ? uint32(0x7FFFFFFF-1) : uint32(Stackable);
return (Stackable == 2147483647 || Stackable <= 0) ? uint32(0x7FFFFFFF-1) : uint32(Stackable);
}
float getDPS() const
@@ -661,6 +662,17 @@ struct ItemLocale
std::vector<std::string> Description;
};
struct ItemSetNameEntry
{
std::string name;
uint32 InventoryType;
};
struct ItemSetNameLocale
{
std::vector<std::string> Name;
};
// 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()
+37 -50
View File
@@ -35,7 +35,7 @@
#include "MapManager.h"
#include "ObjectAccessor.h"
#include "Log.h"
#include "Transports.h"
#include "Transport.h"
#include "TargetedMovementGenerator.h"
#include "WaypointMovementGenerator.h"
#include "VMapFactory.h"
@@ -110,16 +110,12 @@ Object::~Object()
{
sLog.outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
assert(false);
ObjectAccessor::Instance().RemoveUpdateObject(this);
sObjectAccessor.RemoveUpdateObject(this);
}
if (m_uint32Values)
{
//DEBUG_LOG("Object desctr 1 check (%p)",(void*)this);
delete [] m_uint32Values;
delete [] m_uint32Values_mirror;
//DEBUG_LOG("Object desctr 2 check (%p)",(void*)this);
}
delete [] m_uint32Values;
delete [] m_uint32Values_mirror;
}
void Object::_InitValues()
@@ -299,7 +295,11 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
{
//WPAssert(this->ToPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(const_cast<Player*>(this->ToPlayer())->GetMotionMaster()->top());
Player *player = const_cast<Object*>(this)->ToPlayer();
if (!player)
return;
FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(player->GetMotionMaster()->top());
uint32 flags3 = MOVEFLAG_GLIDE;
@@ -324,10 +324,10 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
}
}
Path &path = fmg->GetPath();
TaxiPathNodeList& path = const_cast<TaxiPathNodeList&>(fmg->GetPath());
float x, y, z;
this->ToPlayer()->GetPosition(x, y, z);
player->GetPosition(x, y, z);
uint32 inflighttime = uint32(path.GetPassedLength(fmg->GetCurrentNode(), x, y, z) * 32);
uint32 traveltime = uint32(path.GetTotalLength() * 32);
@@ -342,21 +342,21 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
*data << uint32(0); // added in 3.1
uint32 poscount = uint32(path.Size());
uint32 poscount = uint32(path.size());
*data << uint32(poscount); // points count
for (uint32 i = 0; i < poscount; ++i)
{
*data << path.GetNodes()[i].x;
*data << path.GetNodes()[i].y;
*data << path.GetNodes()[i].z;
*data << float(path[i].x);
*data << float(path[i].y);
*data << float(path[i].z);
}
*data << uint8(0); // added in 3.0.8
*data << path.GetNodes()[poscount-1].x;
*data << path.GetNodes()[poscount-1].y;
*data << path.GetNodes()[poscount-1].z;
*data << float(path[poscount-1].x);
*data << float(path[poscount-1].y);
*data << float(path[poscount-1].z);
}
}
else
@@ -731,7 +731,7 @@ void Object::ClearUpdateMask(bool remove)
if (m_objectUpdated)
{
if (remove)
ObjectAccessor::Instance().RemoveUpdateObject(this);
sObjectAccessor.RemoveUpdateObject(this);
m_objectUpdated = false;
}
}
@@ -804,7 +804,7 @@ void Object::SetInt32Value(uint16 index, int32 value)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -823,7 +823,7 @@ void Object::SetUInt32Value(uint16 index, uint32 value)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -849,7 +849,7 @@ void Object::SetUInt64Value(uint16 index, const uint64 &value)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -868,7 +868,7 @@ bool Object::AddUInt64Value(uint16 index, const uint64 &value)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -889,7 +889,7 @@ bool Object::RemoveUInt64Value(uint16 index, const uint64 &value)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -910,7 +910,7 @@ void Object::SetFloatValue(uint16 index, float value)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -936,7 +936,7 @@ void Object::SetByteValue(uint16 index, uint8 offset, uint8 value)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -962,7 +962,7 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -1031,7 +1031,7 @@ void Object::SetFlag(uint16 index, uint32 newFlag)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -1052,7 +1052,7 @@ void Object::RemoveFlag(uint16 index, uint32 oldFlag)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -1077,7 +1077,7 @@ void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -1102,7 +1102,7 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
@@ -1379,28 +1379,15 @@ bool Position::HasInArc(float arc, const Position *obj) const
return true;
// move arc to range 0.. 2*pi
while (arc >= 2.0f * M_PI)
arc -= 2.0f * M_PI;
while (arc < 0)
arc += 2.0f * M_PI;
arc = MapManager::NormalizeOrientation(arc);
float angle = GetAngle(obj);
angle -= m_orientation;
//if (angle > 100 || angle < -100)
//{
// sLog.outCrash("Invalid Angle %f: this %u %u %f %f %f %f, that %u %u %f %f %f %f", angle,
// GetEntry(), GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(),
// obj->GetEntry(), obj->GetGUIDLow(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation());
// assert(false);
// return false;
//}
// move angle to range -pi ... +pi
while (angle > M_PI)
angle -= 2.0f * M_PI;
while (angle < -M_PI)
angle += 2.0f * M_PI;
angle = MapManager::NormalizeOrientation(angle);
if(angle > M_PI)
angle -= 2.0f*M_PI;
float lborder = -1 * (arc/2.0f); // in range -pi..0
float rborder = (arc/2.0f); // in range 0..pi
@@ -1515,7 +1502,7 @@ void Object::ForceValuesUpdateAtIndex(uint32 i)
{
if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
sObjectAccessor.AddUpdateObject(this);
m_objectUpdated = true;
}
}
+1 -1
View File
@@ -24,7 +24,7 @@
#include "Common.h"
#include "UpdateFields.h"
#include "UpdateData.h"
#include "GameSystem/GridReference.h"
#include "GridReference.h"
#include "ObjectDefines.h"
#include "GridDefines.h"
#include "Map.h"
@@ -21,7 +21,7 @@
#ifndef TRINITY_OBJECTDEFINES_H
#define TRINITY_OBJECTDEFINES_H
#include "Platform/Define.h"
#include "Define.h"
// used for creating values for respawn for example
#define MAKE_PAIR64(l, h) uint64(uint32(l) | (uint64(h) << 32))
@@ -25,7 +25,7 @@
#include "Log.h"
#include "Opcodes.h"
#include "World.h"
#include <zlib/zlib.h>
#include "zlib.h"
UpdateData::UpdateData() : m_blockCount(0)
{

Some files were not shown because too many files have changed in this diff Show More