Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/scripts/Spells/spell_dk.cpp src/server/scripts/Spells/spell_priest.cpp
This commit is contained in:
commit
cb8f159cea
29 files changed
+681
-707
No files matched your search
@@ -1,80 +0,0 @@
|
||||
= TrinityCore -- General information =
|
||||
|
||||
Copyright (C) TrinityCore (http://www.trinitycore.org)
|
||||
|
||||
Trinity Core 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
|
||||
|
||||
In addition, as a special exception, the Trinity Core project
|
||||
gives permission to link the code of its release of Trinity Core with
|
||||
the OpenSSL project's "OpenSSL" library (or with modified versions of
|
||||
it that use the same license as the "OpenSSL" library), and distribute
|
||||
the linked executables. You must obey the GNU General Public License
|
||||
in all respects for all of the code used other than "OpenSSL". If you
|
||||
modify this file, you may extend this exception to your version of the
|
||||
file, but you are not obligated to do so. If you do not wish to do
|
||||
so, delete this exception statement from your version.
|
||||
|
||||
TrinityCore is a MMORPG Framework based mostly on C++. It is completely
|
||||
open source, and is community supported. It is derived
|
||||
from MaNGOS, the Massive Network Game Object Server, and is based on the
|
||||
code of that project with extensive changes over time to optimize, improve
|
||||
and cleanup the codebase at the same time as improving the ingame mechanics
|
||||
and functionality. If you wish to contribute ideas or code please visit
|
||||
our site linked below or make pull requests to our github repo at
|
||||
https://github.com/TrinityCore/TrinityCore
|
||||
|
||||
For further information on the TrinityCore project, please visit our
|
||||
project website at http://www.TrinityCore.org
|
||||
|
||||
Documentation including installation instructions can be found inside
|
||||
the doc directory.
|
||||
|
||||
SQL files to create the databases can be found in the sql/create and
|
||||
sql/base directories.
|
||||
You need to run sql/create/create_mysql.sql 1st and then
|
||||
sql/base/auth_database.sql and sql/base/characters_database.sql
|
||||
You need to download world database from http://www.trinitycore.org/f/files/
|
||||
be sure you get the higher numbered database.
|
||||
When installing a core the 1st time you need to import also all the files at
|
||||
sql/updates/world directory.
|
||||
sql/updates/auth and sql/updates/characters databases only needs to be run
|
||||
when updating one existing server.
|
||||
To save time importing multiple files, you can use copy *.sql world_updates.sql
|
||||
under Windows or cat *.sql > world_updates under Linux.
|
||||
|
||||
You need to update your core (recompile and overwrite binaries) when updating
|
||||
your database, usually you can't use one older core with a newer database or a
|
||||
newer core with an older database.
|
||||
When updating your core you also need to import the files at sql/updates/auth
|
||||
and sql/updates/characters along with the sql/updates/world files.
|
||||
You can't merge all the sql files on sql/updates into a single file, because
|
||||
they belong to 3 different databases and they don't use database name.
|
||||
|
||||
TrinityCore Requirements
|
||||
Platform: Linux, Windows or Mac
|
||||
Processor with SSE2 support
|
||||
ACE ≥ 5.8.3
|
||||
MySQL ≥ 5.1.0
|
||||
CMake ≥ 2.8.0
|
||||
OpenSSL ≥ 0.9.8o
|
||||
GCC ≥ 4.3 (Linux only)
|
||||
MS Visual Studio ≥ 9 (2008) (Windows only)
|
||||
A bit of brain, wiki can become outdated with the release of new TDB versions
|
||||
if wiki refers to TDB 50 and you see TDB 52 get the higher number.
|
||||
Some reading skills, search forum, read http://www.trinitycore.org/f/topic/1518-
|
||||
and http://www.trinitycore.org/f/topic/37- before posting a bug report or ask for
|
||||
help on forum.
|
||||
Search for existing bug reports before posting your own bug reports; don't post multiple
|
||||
bugs on a single ticket.
|
||||
@@ -0,0 +1,80 @@
|
||||
#  TrinityCore
|
||||
|
||||
|
||||
## Introduction
|
||||
|
||||
TrinityCore is a *MMORPG* Framework based mostly in C++.
|
||||
|
||||
It is derived from *MaNGOS*, the *Massive Network Game Object Server*, and is
|
||||
based on the code of that project with extensive changes over time to optimize,
|
||||
improve and cleanup the codebase at the same time as improving the in-game
|
||||
mechanics and functionality.
|
||||
|
||||
It is completely open source; community involvement is highly encouraged.
|
||||
|
||||
If you wish to contribute ideas or code please visit our site linked below or
|
||||
make pull requests to our [Github repository](https://github.com/TrinityCore/TrinityCore).
|
||||
|
||||
For further information on the TrinityCore project, please visit our project
|
||||
website at [TrinityCore.org](http://www.trinitycore.org).
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
+ Platform: Linux, Windows or Mac
|
||||
+ Processor with SSE2 support
|
||||
+ ACE ≥ 5.8.3 (included for Windows)
|
||||
+ MySQL ≥ 5.1.0 (included for Windows)
|
||||
+ CMake ≥ 2.8.0
|
||||
+ OpenSSL ≥ 0.9.8o
|
||||
+ GCC ≥ 4.3 (Linux only)
|
||||
+ MS Visual Studio ≥ 9 (2008) (Windows only)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
Detailed installation guides are available in the wiki for
|
||||
[Windows](http://collab.kpsn.org/display/tc/How-to_Win),
|
||||
[Linux](http://collab.kpsn.org/display/tc/How-to_Linux) and
|
||||
[Mac OSX](http://collab.kpsn.org/display/tc/How-to_Mac).
|
||||
|
||||
|
||||
## Reporting issues
|
||||
|
||||
Issues can be reported via the [Github issue tracker](https://github.com/TrinityCore/TrinityCore/issues?labels=Branch-3.3.5a).
|
||||
|
||||
Please take the time to review existing issues before submitting your own to
|
||||
prevent duplicates.
|
||||
|
||||
In addition, thoroughly read through the [issue tracker guide](http://www.trinitycore.org/f/topic/37-the-trinitycore-issuetracker-and-you/) to ensure
|
||||
your report contains the required information. Incorrect or poorly formed
|
||||
reports are wasteful and are subject to deletion.
|
||||
|
||||
|
||||
## Submitting fixes
|
||||
|
||||
Fixes are submitted as pull requests via Github. For more information on how to
|
||||
properly submit a pull request, read the [how-to: maintain a remote fork](http://www.trinitycore.org/f/topic/6037-howto-maintain-a-remote-fork-for-pull-requests-tortoisegit/).
|
||||
|
||||
|
||||
## Copyright
|
||||
|
||||
License: GPL 2.0
|
||||
|
||||
Read file [COPYING](COPYING)
|
||||
|
||||
|
||||
## Authors & Contributors
|
||||
|
||||
Read file [THANKS](THANKS)
|
||||
|
||||
|
||||
## Links
|
||||
|
||||
[Site](http://www.trinitycore.org)
|
||||
|
||||
[Wiki](http://trinitycore.info)
|
||||
|
||||
[Documentation](http://www.trinitycore.net) (powered by Doxygen)
|
||||
|
||||
[Forums](http://www.trinitycore.org/f/)
|
||||
@@ -0,0 +1,2 @@
|
||||
UPDATE `instance_template` SET `script`="instance_drak_tharon_keep" WHERE `map`=600;
|
||||
UPDATE `creature_template` SET `ScriptName`="boss_king_dred" WHERE `entry`=27483;
|
||||
@@ -0,0 +1,3 @@
|
||||
DELETE FROM `spelldifficulty_dbc` WHERE `id` = 48849;
|
||||
INSERT INTO `spelldifficulty_dbc` (`id`, `spellid0`, `spellid1`) VALUES
|
||||
(48849, 48849, 59422);
|
||||
@@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file main.cpp
|
||||
* @brief Authentication Server main program
|
||||
@@ -22,6 +23,7 @@
|
||||
* This file contains the main program for the
|
||||
* authentication server
|
||||
*/
|
||||
|
||||
#include <ace/Dev_Poll_Reactor.h>
|
||||
#include <ace/TP_Reactor.h>
|
||||
#include <ace/ACE.h>
|
||||
@@ -39,6 +41,12 @@
|
||||
#include "RealmList.h"
|
||||
#include "RealmAcceptor.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sched.h>
|
||||
#include <sys/resource.h>
|
||||
#define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0
|
||||
#endif
|
||||
|
||||
#ifndef _TRINITY_REALM_CONFIG
|
||||
# define _TRINITY_REALM_CONFIG "authserver.conf"
|
||||
#endif
|
||||
@@ -48,15 +56,15 @@ void StopDB();
|
||||
|
||||
bool stopEvent = false; // Setting it to true stops the server
|
||||
|
||||
LoginDatabaseWorkerPool LoginDatabase; // Accessor to the auth server database
|
||||
LoginDatabaseWorkerPool LoginDatabase; // Accessor to the authserver database
|
||||
|
||||
/// Handle authserver's termination signals
|
||||
class AuthServerSignalHandler : public Trinity::SignalHandler
|
||||
{
|
||||
public:
|
||||
virtual void HandleSignal(int SigNum)
|
||||
virtual void HandleSignal(int sigNum)
|
||||
{
|
||||
switch (SigNum)
|
||||
switch (sigNum)
|
||||
{
|
||||
case SIGINT:
|
||||
case SIGTERM:
|
||||
@@ -67,7 +75,7 @@ public:
|
||||
};
|
||||
|
||||
/// Print out the usage string for this program on the console.
|
||||
void usage(const char *prog)
|
||||
void usage(const char* prog)
|
||||
{
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Usage: \n %s [<options>]\n"
|
||||
" -c config_file use config_file as configuration file\n\r",
|
||||
@@ -75,37 +83,37 @@ void usage(const char *prog)
|
||||
}
|
||||
|
||||
/// Launch the auth server
|
||||
extern int main(int argc, char **argv)
|
||||
extern int main(int argc, char** argv)
|
||||
{
|
||||
// Command line parsing to get the configuration file name
|
||||
char const* cfg_file = _TRINITY_REALM_CONFIG;
|
||||
int c = 1;
|
||||
while (c < argc)
|
||||
char const* configFile = _TRINITY_REALM_CONFIG;
|
||||
int count = 1;
|
||||
while (count < argc)
|
||||
{
|
||||
if (strcmp(argv[c], "-c") == 0)
|
||||
if (strcmp(argv[count], "-c") == 0)
|
||||
{
|
||||
if (++c >= argc)
|
||||
if (++count >= argc)
|
||||
{
|
||||
printf("Runtime-Error: -c option requires an input argument\n");
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
cfg_file = argv[c];
|
||||
configFile = argv[count];
|
||||
}
|
||||
++c;
|
||||
++count;
|
||||
}
|
||||
|
||||
if (!sConfigMgr->LoadInitial(cfg_file))
|
||||
if (!sConfigMgr->LoadInitial(configFile))
|
||||
{
|
||||
printf("Invalid or missing configuration file : %s\n", cfg_file);
|
||||
printf("Invalid or missing configuration file : %s\n", configFile);
|
||||
printf("Verify that the file exists and has \'[authserver]\' written in the top of the file!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "%s (authserver)", _FULLVERSION);
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "<Ctrl-C> to stop.\n");
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using configuration file %s.", cfg_file);
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using configuration file %s.", configFile);
|
||||
|
||||
TC_LOG_WARN(LOG_FILTER_AUTHSERVER, "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
|
||||
|
||||
@@ -118,16 +126,16 @@ extern int main(int argc, char **argv)
|
||||
TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Max allowed open files is %d", ACE::max_handles());
|
||||
|
||||
// authserver PID file creation
|
||||
std::string pidfile = sConfigMgr->GetStringDefault("PidFile", "");
|
||||
if (!pidfile.empty())
|
||||
std::string pidFile = sConfigMgr->GetStringDefault("PidFile", "");
|
||||
if (!pidFile.empty())
|
||||
{
|
||||
uint32 pid = CreatePIDFile(pidfile);
|
||||
if (!pid)
|
||||
if (uint32 pid = CreatePIDFile(pidFile))
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Daemon PID: %u\n", pid);
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s.\n", pidfile.c_str());
|
||||
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s.\n", pidFile.c_str());
|
||||
return 1;
|
||||
}
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Daemon PID: %u\n", pid);
|
||||
}
|
||||
|
||||
// Initialize the database connection
|
||||
@@ -162,7 +170,7 @@ extern int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Initialise the signal handlers
|
||||
// Initialize the signal handlers
|
||||
AuthServerSignalHandler SignalINT, SignalTERM;
|
||||
|
||||
// Register authservers's signal handlers
|
||||
@@ -170,42 +178,69 @@ extern int main(int argc, char **argv)
|
||||
Handler.register_handler(SIGINT, &SignalINT);
|
||||
Handler.register_handler(SIGTERM, &SignalTERM);
|
||||
|
||||
///- Handle affinity for multiple processors and process priority on Windows
|
||||
#ifdef _WIN32
|
||||
///- Handle affinity for multiple processors and process priority
|
||||
uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0);
|
||||
bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false);
|
||||
|
||||
#ifdef _WIN32 // Windows
|
||||
{
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
|
||||
uint32 Aff = sConfigMgr->GetIntDefault("UseProcessors", 0);
|
||||
if (Aff > 0)
|
||||
if (affinity > 0)
|
||||
{
|
||||
ULONG_PTR appAff;
|
||||
ULONG_PTR sysAff;
|
||||
|
||||
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
|
||||
{
|
||||
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
|
||||
ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors
|
||||
|
||||
if (!curAff)
|
||||
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff);
|
||||
else if (SetProcessAffinityMask(hProcess, curAff))
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", curAff);
|
||||
if (!currentAffinity)
|
||||
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff);
|
||||
else if (SetProcessAffinityMask(hProcess, currentAffinity))
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", currentAffinity);
|
||||
else
|
||||
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x", curAff);
|
||||
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x", currentAffinity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool Prio = sConfigMgr->GetBoolDefault("ProcessPriority", false);
|
||||
|
||||
if (Prio)
|
||||
if (highPriority)
|
||||
{
|
||||
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "The auth server process priority class has been set to HIGH");
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "authserver process priority class set to HIGH");
|
||||
else
|
||||
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set auth server process priority class.");
|
||||
|
||||
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set authserver process priority class.");
|
||||
}
|
||||
}
|
||||
#elif __linux__ // Linux
|
||||
|
||||
if (affinity > 0)
|
||||
{
|
||||
cpu_set_t mask;
|
||||
CPU_ZERO(&mask);
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i)
|
||||
if (affinity & (1 << i))
|
||||
CPU_SET(i, &mask);
|
||||
|
||||
if (sched_setaffinity(0, sizeof(mask), &mask))
|
||||
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno));
|
||||
else
|
||||
{
|
||||
CPU_ZERO(&mask);
|
||||
sched_getaffinity(0, sizeof(mask), &mask);
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", *(uint32*)(&mask));
|
||||
}
|
||||
}
|
||||
|
||||
if (highPriority)
|
||||
{
|
||||
if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY))
|
||||
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set authserver process priority class, error: %s", strerror(errno));
|
||||
else
|
||||
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// maximum counter for next ping
|
||||
|
||||
@@ -71,7 +71,9 @@ PidFile = ""
|
||||
|
||||
#
|
||||
# UseProcessors
|
||||
# Description: Processors mask for Windows based multi-processor systems.
|
||||
# Description: Processors mask for Windows and Linux based multi-processor systems.
|
||||
# Example: A computer with 2 CPUs:
|
||||
# 1 - 1st CPU only, 2 - 2nd CPU only, 3 - 1st and 2nd CPU, because 1 | 2 is 3
|
||||
# Default: 0 - (Selected by OS)
|
||||
# 1+ - (Bit mask value of selected processors)
|
||||
|
||||
@@ -79,7 +81,8 @@ UseProcessors = 0
|
||||
|
||||
#
|
||||
# ProcessPriority
|
||||
# Description: Process priority setting for Windows based systems.
|
||||
# Description: Process priority setting for Windows and Linux based systems.
|
||||
# Details: On Linux, a nice value of -15 is used. On Windows, process is set to HIGH class.
|
||||
# Default: 1 - (High)
|
||||
# 0 - (Normal)
|
||||
|
||||
|
||||
@@ -469,9 +469,9 @@ void AddSC_boss_toravon();
|
||||
void AddSC_instance_archavon();
|
||||
void AddSC_boss_trollgore(); //Drak'Tharon Keep
|
||||
void AddSC_boss_novos();
|
||||
void AddSC_boss_dred();
|
||||
void AddSC_boss_king_dred();
|
||||
void AddSC_boss_tharon_ja();
|
||||
void AddSC_instance_drak_tharon();
|
||||
void AddSC_instance_drak_tharon_keep();
|
||||
void AddSC_boss_cyanigosa(); //Violet Hold
|
||||
void AddSC_boss_erekem();
|
||||
void AddSC_boss_ichoron();
|
||||
@@ -1215,9 +1215,9 @@ void AddNorthrendScripts()
|
||||
AddSC_instance_archavon();
|
||||
AddSC_boss_trollgore(); //Drak'Tharon Keep
|
||||
AddSC_boss_novos();
|
||||
AddSC_boss_dred();
|
||||
AddSC_boss_king_dred();
|
||||
AddSC_boss_tharon_ja();
|
||||
AddSC_instance_drak_tharon();
|
||||
AddSC_instance_drak_tharon_keep();
|
||||
AddSC_boss_cyanigosa(); //Violet Hold
|
||||
AddSC_boss_erekem();
|
||||
AddSC_boss_ichoron();
|
||||
|
||||
@@ -193,7 +193,7 @@ set(scripts_STAT_SRCS
|
||||
Northrend/DraktharonKeep/boss_novos.cpp
|
||||
Northrend/DraktharonKeep/drak_tharon_keep.h
|
||||
Northrend/DraktharonKeep/boss_tharon_ja.cpp
|
||||
Northrend/DraktharonKeep/boss_dred.cpp
|
||||
Northrend/DraktharonKeep/boss_king_dred.cpp
|
||||
)
|
||||
|
||||
message(" -> Prepared: Northrend")
|
||||
+92
-113
@@ -27,128 +27,54 @@ enum Spells
|
||||
{
|
||||
SPELL_BELLOWING_ROAR = 22686, // fears the group, can be resisted/dispelled
|
||||
SPELL_GRIEVOUS_BITE = 48920,
|
||||
SPELL_MANGLING_SLASH = 48873, //casted on the current tank, adds debuf
|
||||
SPELL_MANGLING_SLASH = 48873, // casted on the current tank, adds debuf
|
||||
SPELL_FEARSOME_ROAR = 48849,
|
||||
H_SPELL_FEARSOME_ROAR = 59422, //Not stacking, debuff
|
||||
SPELL_PIERCING_SLASH = 48878, //debuff -->Armor reduced by 75%
|
||||
SPELL_RAPTOR_CALL = 59416, //dummy
|
||||
SPELL_PIERCING_SLASH = 48878, // debuff --> Armor reduced by 75%
|
||||
SPELL_RAPTOR_CALL = 59416, // dummy
|
||||
SPELL_GUT_RIP = 49710,
|
||||
SPELL_REND = 13738
|
||||
};
|
||||
|
||||
enum Creatures
|
||||
{
|
||||
NPC_RAPTOR_1 = 26641,
|
||||
NPC_RAPTOR_2 = 26628
|
||||
};
|
||||
|
||||
enum Misc
|
||||
{
|
||||
ACTION_RAPTOR_KILLED = 1,
|
||||
DATA_KING_DRED = 2
|
||||
DATA_RAPTORS_KILLED = 2
|
||||
};
|
||||
|
||||
class boss_dred : public CreatureScript
|
||||
enum Events
|
||||
{
|
||||
EVENT_BELLOWING_ROAR = 1,
|
||||
EVENT_GRIEVOUS_BITE,
|
||||
EVENT_MANGLING_SLASH,
|
||||
EVENT_FEARSOME_ROAR,
|
||||
EVENT_PIERCING_SLASH,
|
||||
EVENT_RAPTOR_CALL
|
||||
};
|
||||
|
||||
class boss_king_dred : public CreatureScript
|
||||
{
|
||||
public:
|
||||
boss_dred() : CreatureScript("boss_dred") { }
|
||||
boss_king_dred() : CreatureScript("boss_king_dred") { }
|
||||
|
||||
struct boss_dredAI : public ScriptedAI
|
||||
struct boss_king_dredAI : public BossAI
|
||||
{
|
||||
boss_dredAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
instance = me->GetInstanceScript();
|
||||
}
|
||||
|
||||
uint32 uiBellowingRoarTimer;
|
||||
uint32 uiGrievousBiteTimer;
|
||||
uint32 uiManglingSlashTimer;
|
||||
uint32 uiFearsomeRoarTimer;
|
||||
uint32 uiPiercingSlashTimer;
|
||||
uint32 uiRaptorCallTimer;
|
||||
uint8 raptorsKilled;
|
||||
|
||||
InstanceScript* instance;
|
||||
boss_king_dredAI(Creature* creature) : BossAI(creature, DATA_KING_DRED) { }
|
||||
|
||||
void Reset() OVERRIDE
|
||||
{
|
||||
if (instance)
|
||||
instance->SetData(DATA_DRED_EVENT, NOT_STARTED);
|
||||
|
||||
uiBellowingRoarTimer = 33000;
|
||||
uiGrievousBiteTimer = 20000;
|
||||
uiManglingSlashTimer = 18500;
|
||||
uiFearsomeRoarTimer = urand(10000, 20000);
|
||||
uiPiercingSlashTimer = 17000;
|
||||
uiRaptorCallTimer = urand(20000, 25000);
|
||||
_Reset();
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE
|
||||
{
|
||||
if (instance)
|
||||
instance->SetData(DATA_DRED_EVENT, IN_PROGRESS);
|
||||
}
|
||||
_EnterCombat();
|
||||
|
||||
void UpdateAI(uint32 diff) OVERRIDE
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (uiBellowingRoarTimer <= diff)
|
||||
{
|
||||
DoCastAOE(SPELL_BELLOWING_ROAR, false);
|
||||
uiBellowingRoarTimer = 40000;
|
||||
}
|
||||
else
|
||||
uiBellowingRoarTimer -=diff;
|
||||
|
||||
if (uiGrievousBiteTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_GRIEVOUS_BITE, false);
|
||||
uiGrievousBiteTimer = 20000;
|
||||
}
|
||||
else
|
||||
uiGrievousBiteTimer -= diff;
|
||||
|
||||
if (uiManglingSlashTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_MANGLING_SLASH, false);
|
||||
uiManglingSlashTimer = 20000;
|
||||
}
|
||||
else
|
||||
uiManglingSlashTimer -= diff;
|
||||
|
||||
if (uiFearsomeRoarTimer <= diff)
|
||||
{
|
||||
DoCastAOE(SPELL_FEARSOME_ROAR, false);
|
||||
uiFearsomeRoarTimer = urand(16000, 18000);
|
||||
}
|
||||
else
|
||||
uiFearsomeRoarTimer -= diff;
|
||||
|
||||
if (uiPiercingSlashTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_PIERCING_SLASH, false);
|
||||
uiPiercingSlashTimer = 20000;
|
||||
}
|
||||
else
|
||||
uiPiercingSlashTimer -= diff;
|
||||
|
||||
if (uiRaptorCallTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_RAPTOR_CALL, false);
|
||||
|
||||
float x, y, z;
|
||||
|
||||
me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 10.0f);
|
||||
me->SummonCreature(RAND(NPC_RAPTOR_1, NPC_RAPTOR_2), x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000);
|
||||
|
||||
uiRaptorCallTimer = urand(20000, 25000);
|
||||
}
|
||||
else
|
||||
uiRaptorCallTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
events.ScheduleEvent(EVENT_BELLOWING_ROAR, 33000);
|
||||
events.ScheduleEvent(EVENT_GRIEVOUS_BITE, 20000);
|
||||
events.ScheduleEvent(EVENT_MANGLING_SLASH, 18500);
|
||||
events.ScheduleEvent(EVENT_FEARSOME_ROAR, urand(10000, 20000));
|
||||
events.ScheduleEvent(EVENT_PIERCING_SLASH, 17000);
|
||||
events.ScheduleEvent(EVENT_RAPTOR_CALL, urand(20000, 25000));
|
||||
}
|
||||
|
||||
void DoAction(int32 action) OVERRIDE
|
||||
@@ -159,7 +85,7 @@ class boss_dred : public CreatureScript
|
||||
|
||||
uint32 GetData(uint32 type) const OVERRIDE
|
||||
{
|
||||
if (type == DATA_KING_DRED)
|
||||
if (type == DATA_RAPTORS_KILLED)
|
||||
return raptorsKilled;
|
||||
|
||||
return 0;
|
||||
@@ -167,14 +93,67 @@ class boss_dred : public CreatureScript
|
||||
|
||||
void JustDied(Unit* /*killer*/) OVERRIDE
|
||||
{
|
||||
if (instance)
|
||||
instance->SetData(DATA_DRED_EVENT, DONE);
|
||||
_JustDied();
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) OVERRIDE
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_BELLOWING_ROAR:
|
||||
DoCastAOE(SPELL_BELLOWING_ROAR);
|
||||
events.ScheduleEvent(EVENT_BELLOWING_ROAR, 33000);
|
||||
break;
|
||||
case EVENT_GRIEVOUS_BITE:
|
||||
DoCastVictim(SPELL_GRIEVOUS_BITE);
|
||||
events.ScheduleEvent(EVENT_GRIEVOUS_BITE, 20000);
|
||||
break;
|
||||
case EVENT_MANGLING_SLASH:
|
||||
DoCastVictim(SPELL_MANGLING_SLASH);
|
||||
events.ScheduleEvent(EVENT_MANGLING_SLASH, 18500);
|
||||
break;
|
||||
case EVENT_FEARSOME_ROAR:
|
||||
DoCastAOE(SPELL_FEARSOME_ROAR);
|
||||
events.ScheduleEvent(EVENT_FEARSOME_ROAR, urand(10000, 20000));
|
||||
break;
|
||||
case EVENT_PIERCING_SLASH:
|
||||
DoCastVictim(SPELL_PIERCING_SLASH);
|
||||
events.ScheduleEvent(EVENT_PIERCING_SLASH, 17000);
|
||||
break;
|
||||
case EVENT_RAPTOR_CALL:
|
||||
DoCastVictim(SPELL_RAPTOR_CALL);
|
||||
|
||||
float x, y, z;
|
||||
|
||||
me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 10.0f);
|
||||
me->SummonCreature(RAND(NPC_DRAKKARI_GUTRIPPER, NPC_DRAKKARI_SCYTHECLAW), x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000);
|
||||
events.ScheduleEvent(EVENT_RAPTOR_CALL, urand(20000, 25000));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
uint8 raptorsKilled;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const OVERRIDE
|
||||
{
|
||||
return new boss_dredAI(creature);
|
||||
return GetDrakTharonKeepAI<boss_king_dredAI>(creature);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -217,14 +196,14 @@ class npc_drakkari_gutripper : public CreatureScript
|
||||
|
||||
void JustDied(Unit* /*killer*/) OVERRIDE
|
||||
{
|
||||
if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRED)))
|
||||
if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KING_DRED)))
|
||||
Dred->AI()->DoAction(ACTION_RAPTOR_KILLED);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const OVERRIDE
|
||||
{
|
||||
return new npc_drakkari_gutripperAI(creature);
|
||||
return GetDrakTharonKeepAI<npc_drakkari_gutripperAI>(creature);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -267,14 +246,14 @@ class npc_drakkari_scytheclaw : public CreatureScript
|
||||
|
||||
void JustDied(Unit* /*killer*/) OVERRIDE
|
||||
{
|
||||
if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRED)))
|
||||
if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KING_DRED)))
|
||||
Dred->AI()->DoAction(ACTION_RAPTOR_KILLED);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const OVERRIDE
|
||||
{
|
||||
return new npc_drakkari_scytheclawAI(creature);
|
||||
return GetDrakTharonKeepAI<npc_drakkari_scytheclawAI>(creature);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -291,17 +270,17 @@ class achievement_king_dred : public AchievementCriteriaScript
|
||||
return false;
|
||||
|
||||
if (Creature* Dred = target->ToCreature())
|
||||
if (Dred->AI()->GetData(DATA_KING_DRED) >= 6)
|
||||
if (Dred->AI()->GetData(DATA_RAPTORS_KILLED) >= 6)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_dred()
|
||||
void AddSC_boss_king_dred()
|
||||
{
|
||||
new boss_dred;
|
||||
new npc_drakkari_gutripper;
|
||||
new npc_drakkari_scytheclaw;
|
||||
new boss_king_dred();
|
||||
new npc_drakkari_gutripper();
|
||||
new npc_drakkari_scytheclaw();
|
||||
new achievement_king_dred();
|
||||
}
|
||||
@@ -32,8 +32,7 @@ enum Misc
|
||||
|
||||
enum Creatures
|
||||
{
|
||||
NPC_CRYSTAL_CHANNEL_TARGET = 26712,
|
||||
NPC_FETID_TROLL_CORPSE = 27597,
|
||||
NPC_FETID_TROLL_CORPSE = 27598,
|
||||
NPC_RISEN_SHADOWCASTER = 27600,
|
||||
NPC_HULKING_CORPSE = 27597
|
||||
};
|
||||
@@ -77,13 +76,11 @@ public:
|
||||
|
||||
struct boss_novosAI : public BossAI
|
||||
{
|
||||
boss_novosAI(Creature* creature) : BossAI(creature, DATA_NOVOS_EVENT) {}
|
||||
boss_novosAI(Creature* creature) : BossAI(creature, DATA_NOVOS) { }
|
||||
|
||||
void Reset() OVERRIDE
|
||||
{
|
||||
events.Reset();
|
||||
summons.DespawnAll();
|
||||
instance->SetData(DATA_NOVOS_EVENT, NOT_STARTED);
|
||||
_Reset();
|
||||
|
||||
_ohNovos = true;
|
||||
_crystalHandlerCount = 0;
|
||||
@@ -94,9 +91,7 @@ public:
|
||||
|
||||
void EnterCombat(Unit* /* victim */) OVERRIDE
|
||||
{
|
||||
me->setActive(true);
|
||||
DoZoneInCombat();
|
||||
instance->SetData(DATA_NOVOS_EVENT, IN_PROGRESS);
|
||||
_EnterCombat();
|
||||
|
||||
SetCrystalsStatus(true);
|
||||
SetSummonerStatus(true);
|
||||
@@ -148,7 +143,6 @@ public:
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* who) OVERRIDE
|
||||
|
||||
{
|
||||
BossAI::MoveInLineOfSight(who);
|
||||
|
||||
@@ -260,7 +254,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const OVERRIDE
|
||||
{
|
||||
return new boss_novosAI(creature);
|
||||
return GetDrakTharonKeepAI<boss_novosAI>(creature);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -323,7 +317,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const OVERRIDE
|
||||
{
|
||||
return new npc_crystal_channel_targetAI(creature);
|
||||
return GetDrakTharonKeepAI<npc_crystal_channel_targetAI>(creature);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -95,16 +95,13 @@ public:
|
||||
uiShadowVolleyTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS);
|
||||
Phase = SKELETAL;
|
||||
me->SetDisplayId(me->GetNativeDisplayId());
|
||||
if (instance)
|
||||
instance->SetData(DATA_THARON_JA_EVENT, NOT_STARTED);
|
||||
instance->SetBossState(DATA_THARON_JA, NOT_STARTED);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE
|
||||
{
|
||||
Talk(SAY_AGGRO);
|
||||
|
||||
if (instance)
|
||||
instance->SetData(DATA_THARON_JA_EVENT, IN_PROGRESS);
|
||||
instance->SetBossState(DATA_THARON_JA, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) OVERRIDE
|
||||
@@ -239,14 +236,14 @@ public:
|
||||
|
||||
DoCast(me, SPELL_ACHIEVEMENT_CHECK);
|
||||
|
||||
instance->SetData(DATA_THARON_JA_EVENT, DONE);
|
||||
instance->SetBossState(DATA_THARON_JA, DONE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const OVERRIDE
|
||||
{
|
||||
return new boss_tharon_jaAI(creature);
|
||||
return GetDrakTharonKeepAI<boss_tharon_jaAI>(creature);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -99,16 +99,13 @@ public:
|
||||
|
||||
me->RemoveAura(DUNGEON_MODE(SPELL_CONSUME_AURA, H_SPELL_CONSUME_AURA));
|
||||
|
||||
if (instance)
|
||||
instance->SetData(DATA_TROLLGORE_EVENT, NOT_STARTED);
|
||||
instance->SetData(DATA_TROLLGORE, NOT_STARTED);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE
|
||||
{
|
||||
Talk(SAY_AGGRO);
|
||||
|
||||
if (instance)
|
||||
instance->SetData(DATA_TROLLGORE_EVENT, IN_PROGRESS);
|
||||
instance->SetBossState(DATA_TROLLGORE, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) OVERRIDE
|
||||
@@ -167,8 +164,7 @@ public:
|
||||
|
||||
lSummons.DespawnAll();
|
||||
|
||||
if (instance)
|
||||
instance->SetData(DATA_TROLLGORE_EVENT, DONE);
|
||||
instance->SetBossState(DATA_TROLLGORE, DONE);
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type) const OVERRIDE
|
||||
@@ -197,7 +193,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const OVERRIDE
|
||||
{
|
||||
return new boss_trollgoreAI(creature);
|
||||
return GetDrakTharonKeepAI<boss_trollgoreAI>(creature);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -15,22 +15,26 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DEF_DRAK_THARON_H
|
||||
#define DEF_DRAK_THARON_H
|
||||
enum Data
|
||||
#ifndef DRAK_THARON_KEEP_H_
|
||||
#define DRAK_THARON_KEEP_H_
|
||||
|
||||
#include "Map.h"
|
||||
#include "Creature.h"
|
||||
|
||||
#define DrakTharonKeepScriptName "instance_drak_tharon_keep"
|
||||
|
||||
uint32 const EncounterCount = 4;
|
||||
|
||||
enum DataTypes
|
||||
{
|
||||
DATA_TROLLGORE_EVENT,
|
||||
DATA_NOVOS_EVENT,
|
||||
DATA_DRED_EVENT,
|
||||
DATA_THARON_JA_EVENT,
|
||||
DATA_KING_DRED_ACHIEV
|
||||
};
|
||||
enum Data64
|
||||
{
|
||||
DATA_TROLLGORE,
|
||||
DATA_NOVOS,
|
||||
DATA_DRED,
|
||||
DATA_THARON_JA,
|
||||
// Encounter States/Boss GUIDs
|
||||
DATA_TROLLGORE = 0,
|
||||
DATA_NOVOS = 1,
|
||||
DATA_KING_DRED = 2,
|
||||
DATA_THARON_JA = 3,
|
||||
|
||||
// Additional data
|
||||
//DATA_KING_DRED_ACHIEV,
|
||||
|
||||
DATA_NOVOS_CRYSTAL_1,
|
||||
DATA_NOVOS_CRYSTAL_2,
|
||||
@@ -43,4 +47,39 @@ enum Data64
|
||||
|
||||
ACTION_CRYSTAL_HANDLER_DIED
|
||||
};
|
||||
#endif
|
||||
|
||||
enum CreatureIds
|
||||
{
|
||||
NPC_TROLLGORE = 26630,
|
||||
NPC_NOVOS = 26631,
|
||||
NPC_KING_DRED = 27483,
|
||||
NPC_THARON_JA = 26632,
|
||||
|
||||
// Novos
|
||||
NPC_CRYSTAL_CHANNEL_TARGET = 26712,
|
||||
NPC_CRYSTAL_HANDLER = 26627,
|
||||
|
||||
// King Dred
|
||||
NPC_DRAKKARI_GUTRIPPER = 26641,
|
||||
NPC_DRAKKARI_SCYTHECLAW = 26628
|
||||
};
|
||||
|
||||
enum GameObjectIds
|
||||
{
|
||||
GO_NOVOS_CRYSTAL_1 = 189299,
|
||||
GO_NOVOS_CRYSTAL_2 = 189300,
|
||||
GO_NOVOS_CRYSTAL_3 = 189301,
|
||||
GO_NOVOS_CRYSTAL_4 = 189302
|
||||
};
|
||||
|
||||
template<class AI>
|
||||
AI* GetDrakTharonKeepAI(Creature* creature)
|
||||
{
|
||||
if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
|
||||
if (instance->GetInstanceScript())
|
||||
if (instance->GetScriptId() == sObjectMgr->GetScriptId(DrakTharonKeepScriptName))
|
||||
return new AI(creature);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif // DRAK_THARON_KEEP_H_
|
||||
@@ -20,279 +20,185 @@
|
||||
#include "InstanceScript.h"
|
||||
#include "drak_tharon_keep.h"
|
||||
|
||||
#define MAX_ENCOUNTER 4
|
||||
|
||||
/* Drak'Tharon Keep encounters:
|
||||
0 - Trollgore
|
||||
1 - Novos
|
||||
2 - King Dred
|
||||
3 - Tharon Ja
|
||||
*/
|
||||
|
||||
enum Creatures
|
||||
class instance_drak_tharon_keep : public InstanceMapScript
|
||||
{
|
||||
NPC_TROLLGORE = 26630,
|
||||
NPC_NOVOS = 26631,
|
||||
NPC_KING_DRED = 27483,
|
||||
NPC_THARON_JA = 26632,
|
||||
NPC_CRYSTAL_CHANNEL_TARGET = 26712,
|
||||
NPC_CRYSTAL_HANDLER = 26627
|
||||
};
|
||||
enum GameObjects
|
||||
{
|
||||
GO_NOVOS_CRYSTAL_1 = 189299,
|
||||
GO_NOVOS_CRYSTAL_2 = 189300,
|
||||
GO_NOVOS_CRYSTAL_3 = 189301,
|
||||
GO_NOVOS_CRYSTAL_4 = 189302
|
||||
};
|
||||
enum Achievements
|
||||
{
|
||||
ACM_CRITERIA_OH_NOVOS = 7361
|
||||
};
|
||||
public:
|
||||
instance_drak_tharon_keep() : InstanceMapScript(DrakTharonKeepScriptName, 600) { }
|
||||
|
||||
class instance_drak_tharon : public InstanceMapScript
|
||||
{
|
||||
public:
|
||||
instance_drak_tharon() : InstanceMapScript("instance_drak_tharon", 600) { }
|
||||
|
||||
struct instance_drak_tharon_InstanceScript : public InstanceScript
|
||||
{
|
||||
instance_drak_tharon_InstanceScript(Map* map) : InstanceScript(map) {}
|
||||
|
||||
uint8 dredAchievCounter;
|
||||
|
||||
uint64 trollgoreGUID;
|
||||
uint64 novosGUID;
|
||||
uint64 dredGUID;
|
||||
uint64 tharonJaGUID;
|
||||
|
||||
uint64 novosCrystalGUID1;
|
||||
uint64 novosCrystalGUID2;
|
||||
uint64 novosCrystalGUID3;
|
||||
uint64 novosCrystalGUID4;
|
||||
|
||||
uint64 novosSummonerGUID1;
|
||||
uint64 novosSummonerGUID2;
|
||||
uint64 novosSummonerGUID3;
|
||||
uint64 novosSummonerGUID4;
|
||||
|
||||
uint16 m_auiEncounter[MAX_ENCOUNTER];
|
||||
|
||||
std::string str_data;
|
||||
|
||||
void Initialize()
|
||||
struct instance_drak_tharon_keep_InstanceScript : public InstanceScript
|
||||
{
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
dredAchievCounter = 0;
|
||||
|
||||
trollgoreGUID = 0;
|
||||
novosGUID = 0;
|
||||
dredGUID = 0;
|
||||
tharonJaGUID = 0;
|
||||
|
||||
novosCrystalGUID1 = 0;
|
||||
novosCrystalGUID2 = 0;
|
||||
novosCrystalGUID3 = 0;
|
||||
novosCrystalGUID4 = 0;
|
||||
|
||||
novosSummonerGUID1 = 0;
|
||||
novosSummonerGUID2 = 0;
|
||||
novosSummonerGUID3 = 0;
|
||||
novosSummonerGUID4 = 0;
|
||||
}
|
||||
|
||||
bool IsEncounterInProgress() const
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (m_auiEncounter[i] == IN_PROGRESS)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void OnGameObjectCreate(GameObject* go)
|
||||
{
|
||||
switch (go->GetEntry())
|
||||
instance_drak_tharon_keep_InstanceScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
case GO_NOVOS_CRYSTAL_1:
|
||||
novosCrystalGUID1 = go->GetGUID();
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
case GO_NOVOS_CRYSTAL_2:
|
||||
novosCrystalGUID2 = go->GetGUID();
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
case GO_NOVOS_CRYSTAL_3:
|
||||
novosCrystalGUID3 = go->GetGUID();
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
case GO_NOVOS_CRYSTAL_4:
|
||||
novosCrystalGUID4 = go->GetGUID();
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
SetBossNumber(EncounterCount);
|
||||
|
||||
void OnCreatureCreate(Creature* creature)
|
||||
{
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
case NPC_TROLLGORE:
|
||||
trollgoreGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_NOVOS:
|
||||
novosGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_KING_DRED:
|
||||
dredGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_THARON_JA:
|
||||
tharonJaGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_CRYSTAL_CHANNEL_TARGET:
|
||||
InitializeNovosSummoner(creature);
|
||||
break;
|
||||
}
|
||||
}
|
||||
TrollgoreGUID = 0;
|
||||
NovosGUID = 0;
|
||||
KingDredGUID = 0;
|
||||
TharonJaGUID = 0;
|
||||
|
||||
void InitializeNovosSummoner(Creature* creature)
|
||||
{
|
||||
float x = creature->GetPositionX();
|
||||
float y = creature->GetPositionY();
|
||||
float z = creature->GetPositionZ();
|
||||
|
||||
if (x < -374.0f && x > -379.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f)
|
||||
novosSummonerGUID1 = creature->GetGUID();
|
||||
else if (x < -379.0f && x > -385.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f)
|
||||
novosSummonerGUID2 = creature->GetGUID();
|
||||
else if (x < -374.0f && x > -385.0f && y > -827.0f && y < -820.0f && z < 60.0f && z > 58.0f)
|
||||
novosSummonerGUID3 = creature->GetGUID();
|
||||
else if (x < -338.0f && x > -344.0f && y > -727.0f && y < 721.0f && z < 30.0f && z > 26.0f)
|
||||
novosSummonerGUID4 = creature->GetGUID();
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 identifier) const OVERRIDE
|
||||
{
|
||||
switch (identifier)
|
||||
{
|
||||
case DATA_TROLLGORE: return trollgoreGUID;
|
||||
case DATA_NOVOS: return novosGUID;
|
||||
case DATA_DRED: return dredGUID;
|
||||
case DATA_THARON_JA: return tharonJaGUID;
|
||||
case DATA_NOVOS_CRYSTAL_1: return novosCrystalGUID1;
|
||||
case DATA_NOVOS_CRYSTAL_2: return novosCrystalGUID2;
|
||||
case DATA_NOVOS_CRYSTAL_3: return novosCrystalGUID3;
|
||||
case DATA_NOVOS_CRYSTAL_4: return novosCrystalGUID4;
|
||||
case DATA_NOVOS_SUMMONER_1: return novosSummonerGUID1;
|
||||
case DATA_NOVOS_SUMMONER_2: return novosSummonerGUID2;
|
||||
case DATA_NOVOS_SUMMONER_3: return novosSummonerGUID3;
|
||||
case DATA_NOVOS_SUMMONER_4: return novosSummonerGUID4;
|
||||
memset(NovosCrystalGUIDs, 0, 4 * sizeof(uint64));
|
||||
memset(NovosSummonerGUIDs, 0, 4 * sizeof(uint64));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetData(uint32 type, uint32 data) OVERRIDE
|
||||
{
|
||||
switch (type)
|
||||
void OnCreatureCreate(Creature* creature)
|
||||
{
|
||||
case DATA_TROLLGORE_EVENT:
|
||||
m_auiEncounter[0] = data;
|
||||
break;
|
||||
case DATA_NOVOS_EVENT:
|
||||
m_auiEncounter[1] = data;
|
||||
break;
|
||||
case DATA_DRED_EVENT:
|
||||
m_auiEncounter[2] = data;
|
||||
break;
|
||||
case DATA_THARON_JA_EVENT:
|
||||
m_auiEncounter[3] = data;
|
||||
break;
|
||||
|
||||
case DATA_KING_DRED_ACHIEV:
|
||||
dredAchievCounter = data;
|
||||
break;
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
case NPC_TROLLGORE:
|
||||
TrollgoreGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_NOVOS:
|
||||
NovosGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_KING_DRED:
|
||||
KingDredGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_THARON_JA:
|
||||
TharonJaGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_CRYSTAL_CHANNEL_TARGET:
|
||||
InitializeNovosSummoner(creature);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (data == DONE)
|
||||
void OnGameObjectCreate(GameObject* go)
|
||||
{
|
||||
SaveToDB();
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case GO_NOVOS_CRYSTAL_1:
|
||||
NovosCrystalGUIDs[0] = go->GetGUID();
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
case GO_NOVOS_CRYSTAL_2:
|
||||
NovosCrystalGUIDs[1] = go->GetGUID();
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
case GO_NOVOS_CRYSTAL_3:
|
||||
NovosCrystalGUIDs[2] = go->GetGUID();
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
case GO_NOVOS_CRYSTAL_4:
|
||||
NovosCrystalGUIDs[3] = go->GetGUID();
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type) const OVERRIDE
|
||||
{
|
||||
switch (type)
|
||||
void InitializeNovosSummoner(Creature* creature)
|
||||
{
|
||||
case DATA_TROLLGORE_EVENT: return m_auiEncounter[0];
|
||||
case DATA_NOVOS_EVENT: return m_auiEncounter[1];
|
||||
case DATA_DRED_EVENT: return m_auiEncounter[2];
|
||||
case DATA_THARON_JA_EVENT: return m_auiEncounter[3];
|
||||
case DATA_KING_DRED_ACHIEV: return dredAchievCounter;
|
||||
float x = creature->GetPositionX();
|
||||
float y = creature->GetPositionY();
|
||||
float z = creature->GetPositionZ();
|
||||
|
||||
if (x < -374.0f && x > -379.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f)
|
||||
NovosCrystalGUIDs[0] = creature->GetGUID();
|
||||
else if (x < -379.0f && x > -385.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f)
|
||||
NovosCrystalGUIDs[1] = creature->GetGUID();
|
||||
else if (x < -374.0f && x > -385.0f && y > -827.0f && y < -820.0f && z < 60.0f && z > 58.0f)
|
||||
NovosCrystalGUIDs[2] = creature->GetGUID();
|
||||
else if (x < -338.0f && x > -344.0f && y > -727.0f && y < 721.0f && z < 30.0f && z > 26.0f)
|
||||
NovosCrystalGUIDs[3] = creature->GetGUID();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData()
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
uint64 GetData64(uint32 type) const OVERRIDE
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DATA_TROLLGORE:
|
||||
return TrollgoreGUID;
|
||||
case DATA_NOVOS:
|
||||
return NovosGUID;
|
||||
case DATA_KING_DRED:
|
||||
return KingDredGUID;
|
||||
case DATA_THARON_JA:
|
||||
return TharonJaGUID;
|
||||
case DATA_NOVOS_CRYSTAL_1:
|
||||
case DATA_NOVOS_CRYSTAL_2:
|
||||
case DATA_NOVOS_CRYSTAL_3:
|
||||
case DATA_NOVOS_CRYSTAL_4:
|
||||
return NovosCrystalGUIDs[type - DATA_NOVOS_CRYSTAL_1];
|
||||
case DATA_NOVOS_SUMMONER_1:
|
||||
case DATA_NOVOS_SUMMONER_2:
|
||||
case DATA_NOVOS_SUMMONER_3:
|
||||
case DATA_NOVOS_SUMMONER_4:
|
||||
return NovosSummonerGUIDs[type - DATA_NOVOS_SUMMONER_1];
|
||||
}
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "D K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
|
||||
<< m_auiEncounter[2] << ' ' << m_auiEncounter[3];
|
||||
return 0;
|
||||
}
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void OnUnitDeath(Unit* unit)
|
||||
{
|
||||
if (unit->GetEntry() == NPC_CRYSTAL_HANDLER)
|
||||
if (novosGUID)
|
||||
if (Creature* novos = instance->GetCreature(novosGUID))
|
||||
void OnUnitDeath(Unit* unit)
|
||||
{
|
||||
if (unit->GetEntry() == NPC_CRYSTAL_HANDLER)
|
||||
if (Creature* novos = instance->GetCreature(NovosGUID))
|
||||
novos->AI()->DoAction(ACTION_CRYSTAL_HANDLER_DIED);
|
||||
}
|
||||
|
||||
void Load(const char* in)
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(in);
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
uint16 data0, data1, data2, data3;
|
||||
|
||||
std::istringstream loadStream(in);
|
||||
loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3;
|
||||
|
||||
if (dataHead1 == 'D' && dataHead2 == 'K')
|
||||
std::string GetSaveData()
|
||||
{
|
||||
m_auiEncounter[0] = data0;
|
||||
m_auiEncounter[1] = data1;
|
||||
m_auiEncounter[2] = data2;
|
||||
m_auiEncounter[3] = data3;
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (m_auiEncounter[i] == IN_PROGRESS)
|
||||
m_auiEncounter[i] = NOT_STARTED;
|
||||
} else OUT_LOAD_INST_DATA_FAIL;
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "D K " << GetBossSaveData();
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(char const* str)
|
||||
{
|
||||
if (!str)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(str);
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
|
||||
std::istringstream loadStream(str);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
|
||||
if (dataHead1 == 'D' && dataHead2 == 'K')
|
||||
{
|
||||
for (uint32 i = 0; i < EncounterCount; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
|
||||
tmpState = NOT_STARTED;
|
||||
SetBossState(i, EncounterState(tmpState));
|
||||
}
|
||||
}
|
||||
else
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
protected:
|
||||
uint64 TrollgoreGUID;
|
||||
uint64 NovosGUID;
|
||||
uint64 KingDredGUID;
|
||||
uint64 TharonJaGUID;
|
||||
|
||||
uint64 NovosCrystalGUIDs[4];
|
||||
uint64 NovosSummonerGUIDs[4];
|
||||
};
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE
|
||||
{
|
||||
return new instance_drak_tharon_keep_InstanceScript(map);
|
||||
}
|
||||
};
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE
|
||||
{
|
||||
return new instance_drak_tharon_InstanceScript(map);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_instance_drak_tharon()
|
||||
void AddSC_instance_drak_tharon_keep()
|
||||
{
|
||||
new instance_drak_tharon;
|
||||
new instance_drak_tharon_keep();
|
||||
}
|
||||
@@ -95,7 +95,7 @@ class spell_item_aegis_of_preservation : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_AEGIS_HEAL, true, NULL, aurEff);
|
||||
@@ -279,7 +279,7 @@ class spell_item_desperate_defense : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_DESPERATE_RAGE, true, NULL, aurEff);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
char * command_finder(const char* text, int state)
|
||||
char* command_finder(const char* text, int state)
|
||||
{
|
||||
static int idx, len;
|
||||
const char* ret;
|
||||
@@ -70,19 +70,18 @@ char * command_finder(const char* text, int state)
|
||||
return ((char*)NULL);
|
||||
}
|
||||
|
||||
char ** cli_completion(const char * text, int start, int /*end*/)
|
||||
char** cli_completion(const char* text, int start, int /*end*/)
|
||||
{
|
||||
char ** matches;
|
||||
matches = (char**)NULL;
|
||||
char** matches = NULL;
|
||||
|
||||
if (start == 0)
|
||||
matches = rl_completion_matches((char*)text, &command_finder);
|
||||
else
|
||||
if (start)
|
||||
rl_bind_key('\t', rl_abort);
|
||||
return (matches);
|
||||
else
|
||||
matches = rl_completion_matches((char*)text, &command_finder);
|
||||
return matches;
|
||||
}
|
||||
|
||||
int cli_hook_func(void)
|
||||
int cli_hook_func()
|
||||
{
|
||||
if (World::IsStopped())
|
||||
rl_done = 1;
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
class CliRunnable : public ACE_Based::Runnable
|
||||
{
|
||||
public:
|
||||
void run();
|
||||
void run() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/// @}
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#ifndef _TRINITY_CORE_CONFIG
|
||||
# define _TRINITY_CORE_CONFIG "worldserver.conf"
|
||||
#endif //_TRINITY_CORE_CONFIG
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "ServiceWin32.h"
|
||||
@@ -56,7 +56,7 @@ LoginDatabaseWorkerPool LoginDatabase; ///< Accessor to the
|
||||
uint32 realmID; ///< Id of the realm
|
||||
|
||||
/// Print out the usage string for this program on the console.
|
||||
void usage(const char *prog)
|
||||
void usage(const char* prog)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" %s [<options>]\n", prog);
|
||||
@@ -70,14 +70,14 @@ void usage(const char *prog)
|
||||
}
|
||||
|
||||
/// Launch the Trinity server
|
||||
extern int main(int argc, char **argv)
|
||||
extern int main(int argc, char** argv)
|
||||
{
|
||||
///- Command line parsing to get the configuration file name
|
||||
char const* cfg_file = _TRINITY_CORE_CONFIG;
|
||||
int c = 1;
|
||||
while ( c < argc )
|
||||
while (c < argc)
|
||||
{
|
||||
if (strcmp(argv[c], "-c") == 0)
|
||||
if (!strcmp(argv[c], "-c"))
|
||||
{
|
||||
if (++c >= argc)
|
||||
{
|
||||
@@ -90,10 +90,7 @@ extern int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
////////////
|
||||
//Services//
|
||||
////////////
|
||||
if (strcmp(argv[c], "-s") == 0)
|
||||
if (strcmp(argv[c], "-s") == 0) // Services
|
||||
{
|
||||
if (++c >= argc)
|
||||
{
|
||||
@@ -101,6 +98,7 @@ extern int main(int argc, char **argv)
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp(argv[c], "install") == 0)
|
||||
{
|
||||
if (WinServiceInstall())
|
||||
@@ -120,11 +118,9 @@ extern int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(argv[c], "--service") == 0)
|
||||
{
|
||||
WinServiceRun();
|
||||
}
|
||||
////
|
||||
#endif
|
||||
++c;
|
||||
}
|
||||
|
||||
+127
-104
@@ -50,22 +50,28 @@
|
||||
extern int m_ServiceStatus;
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sched.h>
|
||||
#include <sys/resource.h>
|
||||
#define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0
|
||||
#endif
|
||||
|
||||
/// Handle worldservers's termination signals
|
||||
class WorldServerSignalHandler : public Trinity::SignalHandler
|
||||
{
|
||||
public:
|
||||
virtual void HandleSignal(int SigNum)
|
||||
virtual void HandleSignal(int sigNum)
|
||||
{
|
||||
switch (SigNum)
|
||||
switch (sigNum)
|
||||
{
|
||||
case SIGINT:
|
||||
World::StopNow(RESTART_EXIT_CODE);
|
||||
break;
|
||||
case SIGTERM:
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
case SIGBREAK:
|
||||
if (m_ServiceStatus != 1)
|
||||
#endif /* _WIN32 */
|
||||
#endif
|
||||
World::StopNow(SHUTDOWN_EXIT_CODE);
|
||||
break;
|
||||
}
|
||||
@@ -74,33 +80,35 @@ class WorldServerSignalHandler : public Trinity::SignalHandler
|
||||
|
||||
class FreezeDetectorRunnable : public ACE_Based::Runnable
|
||||
{
|
||||
private:
|
||||
uint32 _loops;
|
||||
uint32 _lastChange;
|
||||
uint32 _delaytime;
|
||||
public:
|
||||
FreezeDetectorRunnable() { _delaytime = 0; }
|
||||
uint32 m_loops, m_lastchange;
|
||||
uint32 w_loops, w_lastchange;
|
||||
uint32 _delaytime;
|
||||
|
||||
void SetDelayTime(uint32 t) { _delaytime = t; }
|
||||
void run(void)
|
||||
|
||||
void run() OVERRIDE
|
||||
{
|
||||
if (!_delaytime)
|
||||
return;
|
||||
|
||||
TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000);
|
||||
m_loops = 0;
|
||||
w_loops = 0;
|
||||
m_lastchange = 0;
|
||||
w_lastchange = 0;
|
||||
_loops = 0;
|
||||
_lastChange = 0;
|
||||
while (!World::IsStopped())
|
||||
{
|
||||
ACE_Based::Thread::Sleep(1000);
|
||||
uint32 curtime = getMSTime();
|
||||
// normal work
|
||||
if (w_loops != World::m_worldLoopCounter)
|
||||
if (_loops != World::m_worldLoopCounter)
|
||||
{
|
||||
w_lastchange = curtime;
|
||||
w_loops = World::m_worldLoopCounter;
|
||||
_lastChange = curtime;
|
||||
_loops = World::m_worldLoopCounter;
|
||||
}
|
||||
// possible freeze
|
||||
else if (getMSTimeDiff(w_lastchange, curtime) > _delaytime)
|
||||
else if (getMSTimeDiff(_lastChange, curtime) > _delaytime)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "World Thread hangs, kicking out server!");
|
||||
ASSERT(false);
|
||||
@@ -110,14 +118,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
Master::Master()
|
||||
{
|
||||
}
|
||||
|
||||
Master::~Master()
|
||||
{
|
||||
}
|
||||
|
||||
/// Main function
|
||||
int Master::Run()
|
||||
{
|
||||
@@ -138,17 +138,16 @@ int Master::Run()
|
||||
TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "http://TrinityCore.org \\/__/\n");
|
||||
|
||||
/// worldserver PID file creation
|
||||
std::string pidfile = sConfigMgr->GetStringDefault("PidFile", "");
|
||||
if (!pidfile.empty())
|
||||
std::string pidFile = sConfigMgr->GetStringDefault("PidFile", "");
|
||||
if (!pidFile.empty())
|
||||
{
|
||||
uint32 pid = CreatePIDFile(pidfile);
|
||||
if (!pid)
|
||||
if (uint32 pid = CreatePIDFile(pidFile))
|
||||
TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Daemon PID: %u\n", pid);
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot create PID file %s.\n", pidfile.c_str());
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot create PID file %s.\n", pidFile.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Daemon PID: %u\n", pid);
|
||||
}
|
||||
|
||||
///- Start the databases
|
||||
@@ -162,22 +161,22 @@ int Master::Run()
|
||||
sWorld->SetInitialWorldSettings();
|
||||
|
||||
///- Initialize the signal handlers
|
||||
WorldServerSignalHandler SignalINT, SignalTERM;
|
||||
WorldServerSignalHandler signalINT, signalTERM;
|
||||
#ifdef _WIN32
|
||||
WorldServerSignalHandler SignalBREAK;
|
||||
WorldServerSignalHandler signalBREAK;
|
||||
#endif /* _WIN32 */
|
||||
|
||||
///- Register worldserver's signal handlers
|
||||
ACE_Sig_Handler Handler;
|
||||
Handler.register_handler(SIGINT, &SignalINT);
|
||||
Handler.register_handler(SIGTERM, &SignalTERM);
|
||||
#ifdef _WIN32
|
||||
Handler.register_handler(SIGBREAK, &SignalBREAK);
|
||||
#endif /* _WIN32 */
|
||||
ACE_Sig_Handler handle;
|
||||
handle.register_handler(SIGINT, &signalINT);
|
||||
handle.register_handler(SIGTERM, &signalTERM);
|
||||
#ifdef _WIN32
|
||||
handle.register_handler(SIGBREAK, &signalBREAK);
|
||||
#endif
|
||||
|
||||
///- Launch WorldRunnable thread
|
||||
ACE_Based::Thread world_thread(new WorldRunnable);
|
||||
world_thread.setPriority(ACE_Based::Highest);
|
||||
ACE_Based::Thread worldThread(new WorldRunnable);
|
||||
worldThread.setPriority(ACE_Based::Highest);
|
||||
|
||||
ACE_Based::Thread* cliThread = NULL;
|
||||
|
||||
@@ -191,41 +190,35 @@ int Master::Run()
|
||||
cliThread = new ACE_Based::Thread(new CliRunnable);
|
||||
}
|
||||
|
||||
ACE_Based::Thread rar_thread(new RARunnable);
|
||||
ACE_Based::Thread rarThread(new RARunnable);
|
||||
|
||||
///- Handle affinity for multiple processors and process priority on Windows
|
||||
#ifdef _WIN32
|
||||
///- Handle affinity for multiple processors and process priority
|
||||
uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0);
|
||||
bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false);
|
||||
|
||||
#ifdef _WIN32 // Windows
|
||||
{
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
|
||||
uint32 Aff = sConfigMgr->GetIntDefault("UseProcessors", 0);
|
||||
if (Aff > 0)
|
||||
if (affinity > 0)
|
||||
{
|
||||
ULONG_PTR appAff;
|
||||
ULONG_PTR sysAff;
|
||||
|
||||
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
|
||||
{
|
||||
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
|
||||
ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors
|
||||
|
||||
if (!curAff)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff);
|
||||
}
|
||||
if (!currentAffinity)
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff);
|
||||
else if (SetProcessAffinityMask(hProcess, currentAffinity))
|
||||
TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", currentAffinity);
|
||||
else
|
||||
{
|
||||
if (SetProcessAffinityMask(hProcess, curAff))
|
||||
TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", curAff);
|
||||
else
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x", curAff);
|
||||
}
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x", currentAffinity);
|
||||
}
|
||||
}
|
||||
|
||||
bool Prio = sConfigMgr->GetBoolDefault("ProcessPriority", false);
|
||||
|
||||
//if (Prio && (m_ServiceStatus == -1) /* need set to default process priority class in service mode*/)
|
||||
if (Prio)
|
||||
if (highPriority)
|
||||
{
|
||||
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
|
||||
TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to HIGH");
|
||||
@@ -233,31 +226,61 @@ int Master::Run()
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#elif __linux__ // Linux
|
||||
|
||||
if (affinity > 0)
|
||||
{
|
||||
cpu_set_t mask;
|
||||
CPU_ZERO(&mask);
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i)
|
||||
if (affinity & (1 << i))
|
||||
CPU_SET(i, &mask);
|
||||
|
||||
if (sched_setaffinity(0, sizeof(mask), &mask))
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno));
|
||||
else
|
||||
{
|
||||
CPU_ZERO(&mask);
|
||||
sched_getaffinity(0, sizeof(mask), &mask);
|
||||
TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", *(uint32*)(&mask));
|
||||
}
|
||||
}
|
||||
|
||||
if (highPriority)
|
||||
{
|
||||
if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY))
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class, error: %s", strerror(errno));
|
||||
else
|
||||
TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//Start soap serving thread
|
||||
ACE_Based::Thread* soap_thread = NULL;
|
||||
ACE_Based::Thread* soapThread = NULL;
|
||||
|
||||
if (sConfigMgr->GetBoolDefault("SOAP.Enabled", false))
|
||||
{
|
||||
TCSoapRunnable* runnable = new TCSoapRunnable();
|
||||
runnable->setListenArguments(sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878)));
|
||||
soap_thread = new ACE_Based::Thread(runnable);
|
||||
runnable->SetListenArguments(sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878)));
|
||||
soapThread = new ACE_Based::Thread(runnable);
|
||||
}
|
||||
|
||||
///- Start up freeze catcher thread
|
||||
if (uint32 freeze_delay = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0))
|
||||
if (uint32 freezeDelay = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0))
|
||||
{
|
||||
FreezeDetectorRunnable* fdr = new FreezeDetectorRunnable();
|
||||
fdr->SetDelayTime(freeze_delay * 1000);
|
||||
ACE_Based::Thread freeze_thread(fdr);
|
||||
freeze_thread.setPriority(ACE_Based::Highest);
|
||||
fdr->SetDelayTime(freezeDelay * 1000);
|
||||
ACE_Based::Thread freezeThread(fdr);
|
||||
freezeThread.setPriority(ACE_Based::Highest);
|
||||
}
|
||||
|
||||
///- Launch the world listener socket
|
||||
uint16 wsport = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD));
|
||||
std::string bind_ip = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0");
|
||||
uint16 worldPort = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD));
|
||||
std::string bindIp = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0");
|
||||
|
||||
if (sWorldSocketMgr->StartNetwork(wsport, bind_ip.c_str()) == -1)
|
||||
if (sWorldSocketMgr->StartNetwork(worldPort, bindIp.c_str()) == -1)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Failed to start network");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
@@ -271,14 +294,14 @@ int Master::Run()
|
||||
|
||||
// when the main thread closes the singletons get unloaded
|
||||
// since worldrunnable uses them, it will crash if unloaded after master
|
||||
world_thread.wait();
|
||||
rar_thread.wait();
|
||||
worldThread.wait();
|
||||
rarThread.wait();
|
||||
|
||||
if (soap_thread)
|
||||
if (soapThread)
|
||||
{
|
||||
soap_thread->wait();
|
||||
soap_thread->destroy();
|
||||
delete soap_thread;
|
||||
soapThread->wait();
|
||||
soapThread->destroy();
|
||||
delete soapThread;
|
||||
}
|
||||
|
||||
// set server offline
|
||||
@@ -298,7 +321,7 @@ int Master::Run()
|
||||
// this only way to terminate CLI thread exist at Win32 (alt. way exist only in Windows Vista API)
|
||||
//_exit(1);
|
||||
// send keyboard input to safely unblock the CLI thread
|
||||
INPUT_RECORD b[5];
|
||||
INPUT_RECORD b[4];
|
||||
HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
|
||||
b[0].EventType = KEY_EVENT;
|
||||
b[0].Event.KeyEvent.bKeyDown = TRUE;
|
||||
@@ -354,78 +377,78 @@ bool Master::_StartDB()
|
||||
{
|
||||
MySQL::Library_Init();
|
||||
|
||||
std::string dbstring;
|
||||
uint8 async_threads, synch_threads;
|
||||
std::string dbString;
|
||||
uint8 asyncThreads, synchThreads;
|
||||
|
||||
dbstring = sConfigMgr->GetStringDefault("WorldDatabaseInfo", "");
|
||||
if (dbstring.empty())
|
||||
dbString = sConfigMgr->GetStringDefault("WorldDatabaseInfo", "");
|
||||
if (dbString.empty())
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "World database not specified in configuration file");
|
||||
return false;
|
||||
}
|
||||
|
||||
async_threads = uint8(sConfigMgr->GetIntDefault("WorldDatabase.WorkerThreads", 1));
|
||||
if (async_threads < 1 || async_threads > 32)
|
||||
asyncThreads = uint8(sConfigMgr->GetIntDefault("WorldDatabase.WorkerThreads", 1));
|
||||
if (asyncThreads < 1 || asyncThreads > 32)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "World database: invalid number of worker threads specified. "
|
||||
"Please pick a value between 1 and 32.");
|
||||
return false;
|
||||
}
|
||||
|
||||
synch_threads = uint8(sConfigMgr->GetIntDefault("WorldDatabase.SynchThreads", 1));
|
||||
///- Initialise the world database
|
||||
if (!WorldDatabase.Open(dbstring, async_threads, synch_threads))
|
||||
synchThreads = uint8(sConfigMgr->GetIntDefault("WorldDatabase.SynchThreads", 1));
|
||||
///- Initialize the world database
|
||||
if (!WorldDatabase.Open(dbString, asyncThreads, synchThreads))
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot connect to world database %s", dbstring.c_str());
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot connect to world database %s", dbString.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
///- Get character database info from configuration file
|
||||
dbstring = sConfigMgr->GetStringDefault("CharacterDatabaseInfo", "");
|
||||
if (dbstring.empty())
|
||||
dbString = sConfigMgr->GetStringDefault("CharacterDatabaseInfo", "");
|
||||
if (dbString.empty())
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Character database not specified in configuration file");
|
||||
return false;
|
||||
}
|
||||
|
||||
async_threads = uint8(sConfigMgr->GetIntDefault("CharacterDatabase.WorkerThreads", 1));
|
||||
if (async_threads < 1 || async_threads > 32)
|
||||
asyncThreads = uint8(sConfigMgr->GetIntDefault("CharacterDatabase.WorkerThreads", 1));
|
||||
if (asyncThreads < 1 || asyncThreads > 32)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Character database: invalid number of worker threads specified. "
|
||||
"Please pick a value between 1 and 32.");
|
||||
return false;
|
||||
}
|
||||
|
||||
synch_threads = uint8(sConfigMgr->GetIntDefault("CharacterDatabase.SynchThreads", 2));
|
||||
synchThreads = uint8(sConfigMgr->GetIntDefault("CharacterDatabase.SynchThreads", 2));
|
||||
|
||||
///- Initialise the Character database
|
||||
if (!CharacterDatabase.Open(dbstring, async_threads, synch_threads))
|
||||
///- Initialize the Character database
|
||||
if (!CharacterDatabase.Open(dbString, asyncThreads, synchThreads))
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot connect to Character database %s", dbstring.c_str());
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot connect to Character database %s", dbString.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
///- Get login database info from configuration file
|
||||
dbstring = sConfigMgr->GetStringDefault("LoginDatabaseInfo", "");
|
||||
if (dbstring.empty())
|
||||
dbString = sConfigMgr->GetStringDefault("LoginDatabaseInfo", "");
|
||||
if (dbString.empty())
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Login database not specified in configuration file");
|
||||
return false;
|
||||
}
|
||||
|
||||
async_threads = uint8(sConfigMgr->GetIntDefault("LoginDatabase.WorkerThreads", 1));
|
||||
if (async_threads < 1 || async_threads > 32)
|
||||
asyncThreads = uint8(sConfigMgr->GetIntDefault("LoginDatabase.WorkerThreads", 1));
|
||||
if (asyncThreads < 1 || asyncThreads > 32)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Login database: invalid number of worker threads specified. "
|
||||
"Please pick a value between 1 and 32.");
|
||||
return false;
|
||||
}
|
||||
|
||||
synch_threads = uint8(sConfigMgr->GetIntDefault("LoginDatabase.SynchThreads", 1));
|
||||
synchThreads = uint8(sConfigMgr->GetIntDefault("LoginDatabase.SynchThreads", 1));
|
||||
///- Initialise the login database
|
||||
if (!LoginDatabase.Open(dbstring, async_threads, synch_threads))
|
||||
if (!LoginDatabase.Open(dbString, asyncThreads, synchThreads))
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot connect to login database %s", dbstring.c_str());
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot connect to login database %s", dbString.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
class Master
|
||||
{
|
||||
public:
|
||||
Master();
|
||||
~Master();
|
||||
int Run();
|
||||
|
||||
private:
|
||||
@@ -41,5 +39,7 @@ class Master
|
||||
};
|
||||
|
||||
#define sMaster ACE_Singleton<Master, ACE_Null_Mutex>::instance()
|
||||
|
||||
#endif
|
||||
|
||||
/// @}
|
||||
@@ -61,22 +61,20 @@ void RARunnable::run()
|
||||
|
||||
ACE_Acceptor<RASocket, ACE_SOCK_ACCEPTOR> acceptor;
|
||||
|
||||
uint16 raport = uint16(sConfigMgr->GetIntDefault("Ra.Port", 3443));
|
||||
std::string stringip = sConfigMgr->GetStringDefault("Ra.IP", "0.0.0.0");
|
||||
ACE_INET_Addr listen_addr(raport, stringip.c_str());
|
||||
uint16 raPort = uint16(sConfigMgr->GetIntDefault("Ra.Port", 3443));
|
||||
std::string stringIp = sConfigMgr->GetStringDefault("Ra.IP", "0.0.0.0");
|
||||
ACE_INET_Addr listenAddress(raPort, stringIp.c_str());
|
||||
|
||||
if (acceptor.open(listen_addr, m_Reactor) == -1)
|
||||
if (acceptor.open(listenAddress, m_Reactor) == -1)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Trinity RA can not bind to port %d on %s", raport, stringip.c_str());
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Trinity RA can not bind to port %d on %s", raPort, stringIp.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Starting Trinity RA on port %d on %s", raport, stringip.c_str());
|
||||
TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Starting Trinity RA on port %d on %s", raPort, stringIp.c_str());
|
||||
|
||||
while (!World::IsStopped())
|
||||
{
|
||||
// don't be too smart to move this outside the loop
|
||||
// the run_reactor_event_loop will modify interval
|
||||
ACE_Time_Value interval(0, 100000);
|
||||
if (m_Reactor->run_reactor_event_loop(interval) == -1)
|
||||
break;
|
||||
|
||||
@@ -31,7 +31,7 @@ class RARunnable : public ACE_Based::Runnable
|
||||
public:
|
||||
RARunnable();
|
||||
virtual ~RARunnable();
|
||||
void run();
|
||||
void run() OVERRIDE;
|
||||
|
||||
private:
|
||||
ACE_Reactor* m_Reactor;
|
||||
@@ -39,4 +39,5 @@ private:
|
||||
};
|
||||
|
||||
#endif /* _TRINITY_RARUNNABLE_H_ */
|
||||
|
||||
/// @}
|
||||
@@ -36,26 +36,22 @@ RASocket::RASocket()
|
||||
_commandExecuting = false;
|
||||
}
|
||||
|
||||
RASocket::~RASocket()
|
||||
{
|
||||
}
|
||||
|
||||
int RASocket::open(void *)
|
||||
{
|
||||
ACE_INET_Addr remote_addr;
|
||||
ACE_INET_Addr remoteAddress;
|
||||
|
||||
if (peer().get_remote_addr(remote_addr) == -1)
|
||||
if (peer().get_remote_addr(remoteAddress) == -1)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Incoming connection from %s", remote_addr.get_host_addr());
|
||||
TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Incoming connection from %s", remoteAddress.get_host_addr());
|
||||
|
||||
return activate();
|
||||
}
|
||||
|
||||
int RASocket::handle_close(ACE_HANDLE, ACE_Reactor_Mask)
|
||||
int RASocket::handle_close(ACE_HANDLE /*handle*/, ACE_Reactor_Mask /*mask*/)
|
||||
{
|
||||
TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Closing connection");
|
||||
peer().close_reader();
|
||||
@@ -89,9 +85,7 @@ int RASocket::recv_line(ACE_Message_Block& buffer)
|
||||
ssize_t n = peer().recv(&byte, sizeof(byte));
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
@@ -110,8 +104,8 @@ int RASocket::recv_line(ACE_Message_Block& buffer)
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char null_term = '\0';
|
||||
if (buffer.copy(&null_term, sizeof(null_term)) == -1)
|
||||
const char nullTerm = '\0';
|
||||
if (buffer.copy(&nullTerm, sizeof(nullTerm)) == -1)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -31,33 +31,34 @@
|
||||
#include <ace/SOCK_Acceptor.h>
|
||||
|
||||
/// Remote Administration socket
|
||||
class RASocket: public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
|
||||
class RASocket : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
|
||||
{
|
||||
public:
|
||||
RASocket();
|
||||
virtual ~RASocket();
|
||||
virtual ~RASocket() { }
|
||||
|
||||
virtual int svc(void);
|
||||
virtual int open(void * = 0);
|
||||
virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
|
||||
virtual int svc() OVERRIDE;
|
||||
virtual int open(void* = 0) OVERRIDE;
|
||||
virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK) OVERRIDE;
|
||||
|
||||
private:
|
||||
int recv_line(std::string& out_line);
|
||||
int recv_line(std::string& outLine);
|
||||
int recv_line(ACE_Message_Block& buffer);
|
||||
int process_command(const std::string& command);
|
||||
int authenticate();
|
||||
int subnegotiate(); //! Used by telnet protocol RFC 854 / 855
|
||||
int subnegotiate(); ///< Used by telnet protocol RFC 854 / 855
|
||||
int check_access_level(const std::string& user);
|
||||
int check_password(const std::string& user, const std::string& pass);
|
||||
int send(const std::string& line);
|
||||
|
||||
static void zprint(void* callbackArg, const char * szText );
|
||||
static void zprint(void* callbackArg, const char* szText);
|
||||
static void commandFinished(void* callbackArg, bool success);
|
||||
|
||||
private:
|
||||
/// Minimum security level required to connect
|
||||
uint8 _minLevel;
|
||||
uint8 _minLevel; ///< Minimum security level required to connect
|
||||
ACE_Atomic_Op<ACE_Thread_Mutex, bool> _commandExecuting;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/// @}
|
||||
@@ -33,13 +33,13 @@ void TCSoapRunnable::run()
|
||||
soap.accept_timeout = 3;
|
||||
soap.recv_timeout = 5;
|
||||
soap.send_timeout = 5;
|
||||
if (!soap_valid_socket(soap_bind(&soap, m_host.c_str(), m_port, 100)))
|
||||
if (!soap_valid_socket(soap_bind(&soap, _host.c_str(), _port, 100)))
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_SOAP, "Couldn't bind to %s:%d", m_host.c_str(), m_port);
|
||||
TC_LOG_ERROR(LOG_FILTER_SOAP, "Couldn't bind to %s:%d", _host.c_str(), _port);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
TC_LOG_INFO(LOG_FILTER_SOAP, "Bound to http://%s:%d", m_host.c_str(), m_port);
|
||||
TC_LOG_INFO(LOG_FILTER_SOAP, "Bound to http://%s:%d", _host.c_str(), _port);
|
||||
|
||||
while (!World::IsStopped())
|
||||
{
|
||||
@@ -121,9 +121,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result)
|
||||
|
||||
int acc = connection.pendingCommands.acquire();
|
||||
if (acc)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_SOAP, "Error while acquiring lock, acc = %i, errno = %u", acc, errno);
|
||||
}
|
||||
|
||||
// alright, command finished
|
||||
|
||||
|
||||
@@ -24,21 +24,24 @@
|
||||
#include <ace/Task.h>
|
||||
#include <Threading.h>
|
||||
|
||||
class TCSoapRunnable: public ACE_Based::Runnable
|
||||
class TCSoapRunnable : public ACE_Based::Runnable
|
||||
{
|
||||
public:
|
||||
TCSoapRunnable() : m_host(""), m_port(0) { }
|
||||
void run();
|
||||
void setListenArguments(std::string host, uint16 port)
|
||||
TCSoapRunnable() : _port(0) { }
|
||||
|
||||
void run() OVERRIDE;
|
||||
|
||||
void SetListenArguments(const std::string& host, uint16 port)
|
||||
{
|
||||
m_host = host;
|
||||
m_port = port;
|
||||
_host = host;
|
||||
_port = port;
|
||||
}
|
||||
|
||||
private:
|
||||
void process_message(ACE_Message_Block* mb);
|
||||
|
||||
std::string m_host;
|
||||
uint16 m_port;
|
||||
std::string _host;
|
||||
uint16 _port;
|
||||
};
|
||||
|
||||
class SOAPCommand
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
class WorldRunnable : public ACE_Based::Runnable
|
||||
{
|
||||
public:
|
||||
void run();
|
||||
void run() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/// @}
|
||||
@@ -150,7 +150,9 @@ BindIP = "0.0.0.0"
|
||||
# PERFORMANCE SETTINGS
|
||||
#
|
||||
# UseProcessors
|
||||
# Description: Processors mask for Windows based multi-processor systems.
|
||||
# Description: Processors mask for Windows and Linux based multi-processor systems.
|
||||
# Example: A computer with 2 CPUs:
|
||||
# 1 - 1st CPU only, 2 - 2nd CPU only, 3 - 1st and 2nd CPU, because 1 | 2 is 3
|
||||
# Default: 0 - (Selected by OS)
|
||||
# 1+ - (Bit mask value of selected processors)
|
||||
|
||||
@@ -158,7 +160,8 @@ UseProcessors = 0
|
||||
|
||||
#
|
||||
# ProcessPriority
|
||||
# Description: Process priority setting for Windows based systems.
|
||||
# Description: Process priority setting for Windows and Linux based systems.
|
||||
# Details: On Linux, a nice value of -15 is used. On Windows, process is set to HIGH class.
|
||||
# Default: 1 - (High)
|
||||
# 0 - (Normal)
|
||||
|
||||
|
||||
@@ -716,8 +716,8 @@ namespace MMAP
|
||||
params.cs = config.cs;
|
||||
params.ch = config.ch;
|
||||
params.tileLayer = 0;
|
||||
params.buildBvTree = true;
|
||||
|
||||
params.buildBvTree = true;
|
||||
|
||||
// will hold final navmesh
|
||||
unsigned char* navData = NULL;
|
||||
int navDataSize = 0;
|
||||
|
||||
Reference in new issue
Block a user