mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
Merge branch 'master' into 303
Conflicts: src/game/WorldSocket.cpp src/shared/Database/DBCStructure.h src/shared/Database/DBCfmt.cpp
This commit is contained in:
commit
6fae544fbe
23 changed files with 280 additions and 118 deletions
|
|
@ -16,13 +16,21 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// config
|
||||||
|
|
||||||
#define NUM_REMOTES 2
|
#define NUM_REMOTES 2
|
||||||
|
|
||||||
char remotes[NUM_REMOTES][256] = {
|
char remotes[NUM_REMOTES][256] = {
|
||||||
"git@github.com:mangos/mangos.git",
|
"git@github.com:mangos/mangos.git",
|
||||||
"git://github.com/mangos/mangos.git"
|
"git://github.com/mangos/mangos.git" // used for fetch if present
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool allow_replace = false;
|
||||||
|
bool local = false;
|
||||||
|
bool do_fetch = false;
|
||||||
|
|
||||||
|
// aux
|
||||||
|
|
||||||
char origins[NUM_REMOTES][256];
|
char origins[NUM_REMOTES][256];
|
||||||
int rev;
|
int rev;
|
||||||
char head_message[16384];
|
char head_message[16384];
|
||||||
|
|
@ -31,11 +39,9 @@ char write_file[2048];
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
FILE *cmd_pipe;
|
FILE *cmd_pipe;
|
||||||
|
|
||||||
bool allow_replace = false;
|
|
||||||
bool local = false;
|
|
||||||
|
|
||||||
bool find_path()
|
bool find_path()
|
||||||
{
|
{
|
||||||
|
printf("+ finding path\n");
|
||||||
char cur_path[2048], *ptr;
|
char cur_path[2048], *ptr;
|
||||||
getcwd(cur_path, 2048);
|
getcwd(cur_path, 2048);
|
||||||
int len = strnlen(cur_path, 2048);
|
int len = strnlen(cur_path, 2048);
|
||||||
|
|
@ -70,7 +76,8 @@ bool find_path()
|
||||||
|
|
||||||
bool find_origin()
|
bool find_origin()
|
||||||
{
|
{
|
||||||
if( (cmd_pipe = popen( "git remote -v", "rt" )) == NULL )
|
printf("+ finding origin\n");
|
||||||
|
if( (cmd_pipe = popen( "git remote -v", "r" )) == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
@ -91,6 +98,48 @@ bool find_origin()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool fetch_origin()
|
||||||
|
{
|
||||||
|
printf("+ fetching origin\n");
|
||||||
|
char cmd[256];
|
||||||
|
// use the public clone url if present because the private may require a password
|
||||||
|
sprintf(cmd, "git fetch %s master", origins[1][0] ? origins[1] : origins[0]);
|
||||||
|
int ret = system(cmd);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool check_fwd()
|
||||||
|
{
|
||||||
|
printf("+ checking fast forward\n");
|
||||||
|
char cmd[256];
|
||||||
|
sprintf(cmd, "git log -n 1 --pretty=\"format:%%H\" %s/master", origins[1][0] ? origins[1] : origins[0]);
|
||||||
|
if( (cmd_pipe = popen( cmd, "r" )) == NULL )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char hash[256];
|
||||||
|
if(!fgets(buffer, 256, cmd_pipe)) return false;
|
||||||
|
strncpy(hash, buffer, 256);
|
||||||
|
pclose(cmd_pipe);
|
||||||
|
|
||||||
|
if( (cmd_pipe = popen( "git log --pretty=\"format:%H\"", "r" )) == NULL )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
while(fgets(buffer, 256, cmd_pipe))
|
||||||
|
{
|
||||||
|
buffer[strnlen(buffer, 256) - 1] = '\0';
|
||||||
|
if(strncmp(hash, buffer, 256) == 0)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pclose(cmd_pipe);
|
||||||
|
|
||||||
|
if(!found) printf("WARNING: non-fastforward, use rebase!\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int get_rev(const char *from_msg)
|
int get_rev(const char *from_msg)
|
||||||
{
|
{
|
||||||
// accept only the rev number format, not the sql update format
|
// accept only the rev number format, not the sql update format
|
||||||
|
|
@ -102,6 +151,7 @@ int get_rev(const char *from_msg)
|
||||||
|
|
||||||
bool find_rev()
|
bool find_rev()
|
||||||
{
|
{
|
||||||
|
printf("+ finding next revision number\n");
|
||||||
// find the highest rev number on either of the remotes
|
// find the highest rev number on either of the remotes
|
||||||
for(int i = 0; i < NUM_REMOTES; i++)
|
for(int i = 0; i < NUM_REMOTES; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -110,7 +160,7 @@ bool find_rev()
|
||||||
char cmd[512];
|
char cmd[512];
|
||||||
if(local) sprintf(cmd, "git log HEAD --pretty=\"format:%%s\"");
|
if(local) sprintf(cmd, "git log HEAD --pretty=\"format:%%s\"");
|
||||||
else sprintf(cmd, "git log %s/master --pretty=\"format:%%s\"", origins[i]);
|
else sprintf(cmd, "git log %s/master --pretty=\"format:%%s\"", origins[i]);
|
||||||
if( (cmd_pipe = popen( cmd, "rt" )) == NULL )
|
if( (cmd_pipe = popen( cmd, "r" )) == NULL )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int nr;
|
int nr;
|
||||||
|
|
@ -123,6 +173,8 @@ bool find_rev()
|
||||||
pclose(cmd_pipe);
|
pclose(cmd_pipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(rev > 0) printf("Found [%d].\n", rev);
|
||||||
|
|
||||||
return rev > 0;
|
return rev > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -138,6 +190,7 @@ std::string generateHeader(char const* rev_str)
|
||||||
|
|
||||||
bool write_rev()
|
bool write_rev()
|
||||||
{
|
{
|
||||||
|
printf("+ writing revision_nr.h\n");
|
||||||
char rev_str[256];
|
char rev_str[256];
|
||||||
sprintf(rev_str, "%d", rev);
|
sprintf(rev_str, "%d", rev);
|
||||||
std::string header = generateHeader(rev_str);
|
std::string header = generateHeader(rev_str);
|
||||||
|
|
@ -154,7 +207,8 @@ bool write_rev()
|
||||||
|
|
||||||
bool find_head_msg()
|
bool find_head_msg()
|
||||||
{
|
{
|
||||||
if( (cmd_pipe = popen( "git log -n 1 --pretty=\"format:%s%n%n%b\"", "rt" )) == NULL )
|
printf("+ finding last message on HEAD\n");
|
||||||
|
if( (cmd_pipe = popen( "git log -n 1 --pretty=\"format:%s%n%n%b\"", "r" )) == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int poz = 0;
|
int poz = 0;
|
||||||
|
|
@ -163,9 +217,14 @@ bool find_head_msg()
|
||||||
|
|
||||||
pclose(cmd_pipe);
|
pclose(cmd_pipe);
|
||||||
|
|
||||||
if(get_rev(head_message))
|
if(int head_rev = get_rev(head_message))
|
||||||
{
|
{
|
||||||
if(!allow_replace) return false;
|
if(!allow_replace)
|
||||||
|
{
|
||||||
|
printf("Last commit on HEAD is [%d]. Use -r to replace it with [%d].\n", head_rev, rev);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// skip the rev number in the commit
|
// skip the rev number in the commit
|
||||||
char *p = strchr(head_message, ']'), *q = head_message;
|
char *p = strchr(head_message, ']'), *q = head_message;
|
||||||
assert(p && *(p+1));
|
assert(p && *(p+1));
|
||||||
|
|
@ -180,9 +239,10 @@ bool find_head_msg()
|
||||||
|
|
||||||
bool amend_commit()
|
bool amend_commit()
|
||||||
{
|
{
|
||||||
|
printf("+ amending last commit\n");
|
||||||
char cmd[512];
|
char cmd[512];
|
||||||
sprintf(cmd, "git commit --amend -F- %s", write_file);
|
sprintf(cmd, "git commit --amend -F- %s", write_file);
|
||||||
if( (cmd_pipe = popen( cmd, "wt" )) == NULL )
|
if( (cmd_pipe = popen( cmd, "w" )) == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
fprintf(cmd_pipe, "[%d] %s", rev, head_message);
|
fprintf(cmd_pipe, "[%d] %s", rev, head_message);
|
||||||
|
|
@ -191,29 +251,47 @@ bool amend_commit()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DO(cmd) if(!cmd) { printf("FAILED\n"); return 1; }
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
for(int i = 1; i < argc; i++)
|
for(int i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
if(argv[i] == NULL) continue;
|
if(argv[i] == NULL) continue;
|
||||||
if(strncmp(argv[i], "-r", 2) == 0)
|
if(strncmp(argv[i], "-r", 2) == 0 || strncmp(argv[i], "--replace", 2) == 0)
|
||||||
allow_replace = true;
|
allow_replace = true;
|
||||||
if(strncmp(argv[i], "-l", 2) == 0)
|
if(strncmp(argv[i], "-l", 2) == 0 || strncmp(argv[i], "--local", 2) == 0)
|
||||||
local = true;
|
local = true;
|
||||||
if(strncmp(argv[i], "-h", 2) == 0)
|
if(strncmp(argv[i], "-f", 2) == 0 || strncmp(argv[i], "--fetch", 2) == 0)
|
||||||
|
do_fetch = true;
|
||||||
|
if(strncmp(argv[i], "-h", 2) == 0 || strncmp(argv[i], "--help", 2) == 0)
|
||||||
{
|
{
|
||||||
|
printf("Usage: git_id [OPTION]\n");
|
||||||
|
printf("Generates a new rev number and updates revision_nr.h and the commit message.\n");
|
||||||
|
printf("Should be used just before push.\n");
|
||||||
|
printf(" -h, --help show the usage\n");
|
||||||
|
printf(" -r, --replace replace the rev number if it was already applied to the last\n");
|
||||||
|
printf(" commit\n");
|
||||||
|
printf(" -l, --local search for the highest rev number on HEAD\n");
|
||||||
|
printf(" -f, --fetch fetch from origin before searching for the new rev\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!find_path()) { printf("ERROR: can't find path\n"); return 1; }
|
DO( find_path() );
|
||||||
if(!local && !find_origin()) { printf("ERROR: can't find origin\n"); return 1; }
|
if(!local)
|
||||||
if(!find_rev()) { printf("ERROR: can't find rev\n"); return 1; }
|
{
|
||||||
if(!find_head_msg()) { printf("ERROR: can't find head message\n"); return 1; }
|
DO( find_origin() );
|
||||||
if(!write_rev()) { printf("ERROR: can't write revision_nr.h\n"); return 1; }
|
if(do_fetch)
|
||||||
if(!amend_commit()) { printf("ERROR: can't ammend commit\n"); return 1; }
|
{
|
||||||
|
DO( fetch_origin() );
|
||||||
printf("Generated rev %d\n", rev);
|
DO( check_fwd() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DO( find_rev() );
|
||||||
|
DO( find_head_msg() );
|
||||||
|
DO( write_rev() );
|
||||||
|
DO( amend_commit() );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
DROP TABLE IF EXISTS `db_version`;
|
DROP TABLE IF EXISTS `db_version`;
|
||||||
CREATE TABLE `db_version` (
|
CREATE TABLE `db_version` (
|
||||||
`version` varchar(120) default NULL,
|
`version` varchar(120) default NULL,
|
||||||
`required_2008_11_09_02_mangos_command` bit(1) default NULL
|
`required_2008_11_09_03_mangos_mangos_string` bit(1) default NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
@ -2474,7 +2474,6 @@ INSERT INTO `mangos_string` VALUES
|
||||||
(450,'Graveyard #%u already linked to zone #%u (current).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(450,'Graveyard #%u already linked to zone #%u (current).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(451,'Graveyard #%u linked to zone #%u (current).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(451,'Graveyard #%u linked to zone #%u (current).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(452,'Graveyard #%u can\'t be linked to subzone or not existed zone #%u (internal error).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(452,'Graveyard #%u can\'t be linked to subzone or not existed zone #%u (internal error).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(453,'Graveyard can be linked to zone at another map only for all factions (no faction value).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
|
||||||
(454,'No faction in Graveyard with id= #%u , fix your DB',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(454,'No faction in Graveyard with id= #%u , fix your DB',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(455,'invalid team, please fix database',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(455,'invalid team, please fix database',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(456,'any',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(456,'any',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
|
|
||||||
3
sql/updates/2008_11_09_03_mangos_mangos_string.sql
Normal file
3
sql/updates/2008_11_09_03_mangos_mangos_string.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
ALTER TABLE db_version CHANGE COLUMN required_2008_11_09_02_mangos_command required_2008_11_09_03_mangos_mangos_string bit;
|
||||||
|
|
||||||
|
DELETE FROM mangos_string WHERE entry IN (453);
|
||||||
|
|
@ -129,6 +129,7 @@ pkgdata_DATA = \
|
||||||
2008_11_07_04_realmd_account.sql \
|
2008_11_07_04_realmd_account.sql \
|
||||||
2008_11_09_01_mangos_command.sql \
|
2008_11_09_01_mangos_command.sql \
|
||||||
2008_11_09_02_mangos_command.sql \
|
2008_11_09_02_mangos_command.sql \
|
||||||
|
2008_11_09_03_mangos_mangos_string.sql \
|
||||||
README
|
README
|
||||||
|
|
||||||
## Additional files to include when running 'make dist'
|
## Additional files to include when running 'make dist'
|
||||||
|
|
@ -239,4 +240,5 @@ EXTRA_DIST = \
|
||||||
2008_11_07_04_realmd_account.sql \
|
2008_11_07_04_realmd_account.sql \
|
||||||
2008_11_09_01_mangos_command.sql \
|
2008_11_09_01_mangos_command.sql \
|
||||||
2008_11_09_02_mangos_command.sql \
|
2008_11_09_02_mangos_command.sql \
|
||||||
|
2008_11_09_03_mangos_mangos_string.sql \
|
||||||
README
|
README
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#if COMPILER == COMPILER_INTEL
|
#if COMPILER == COMPILER_INTEL
|
||||||
#include <ext/hash_map>
|
#include <ext/hash_map>
|
||||||
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 4
|
#elif COMPILER == COMPILER_GNU && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3)
|
||||||
#include <tr1/unordered_map>
|
#include <tr1/unordered_map>
|
||||||
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3
|
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3
|
||||||
#include <ext/hash_map>
|
#include <ext/hash_map>
|
||||||
|
|
@ -45,10 +45,10 @@ using stdext::hash_map;
|
||||||
#elif COMPILER == COMPILER_INTEL
|
#elif COMPILER == COMPILER_INTEL
|
||||||
#define UNORDERED_MAP std::hash_map
|
#define UNORDERED_MAP std::hash_map
|
||||||
using std::hash_map;
|
using std::hash_map;
|
||||||
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 4
|
#elif COMPILER == COMPILER_GNU && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3)
|
||||||
#define UNORDERED_MAP std::tr1::unordered_map
|
#define UNORDERED_MAP std::tr1::unordered_map
|
||||||
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3
|
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3
|
||||||
#define UNORDERED_MAP std::__gnu_cxx::hash_map
|
#define UNORDERED_MAP __gnu_cxx::hash_map
|
||||||
|
|
||||||
namespace __gnu_cxx
|
namespace __gnu_cxx
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2023,3 +2023,19 @@ TrainerSpellData const* Creature::GetTrainerSpells() const
|
||||||
{
|
{
|
||||||
return objmgr.GetNpcTrainerSpells(GetEntry());
|
return objmgr.GetNpcTrainerSpells(GetEntry());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// overwrite WorldObject function for proper name localization
|
||||||
|
const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const
|
||||||
|
{
|
||||||
|
if (loc_idx >= 0)
|
||||||
|
{
|
||||||
|
CreatureLocale const *cl = objmgr.GetCreatureLocale(GetEntry());
|
||||||
|
if (cl)
|
||||||
|
{
|
||||||
|
if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty())
|
||||||
|
return cl->Name[loc_idx].c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetName();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -511,6 +511,9 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
||||||
void TextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId,TargetGuid,IsBossEmote); }
|
void TextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId,TargetGuid,IsBossEmote); }
|
||||||
void Whisper(int32 textId, uint64 receiver, bool IsBossWhisper = false) { MonsterWhisper(textId,receiver,IsBossWhisper); }
|
void Whisper(int32 textId, uint64 receiver, bool IsBossWhisper = false) { MonsterWhisper(textId,receiver,IsBossWhisper); }
|
||||||
|
|
||||||
|
// overwrite WorldObject function for proper name localization
|
||||||
|
const char* GetNameForLocaleIdx(int32 locale_idx) const;
|
||||||
|
|
||||||
void setDeathState(DeathState s); // overwrite virtual Unit::setDeathState
|
void setDeathState(DeathState s); // overwrite virtual Unit::setDeathState
|
||||||
|
|
||||||
bool LoadFromDB(uint32 guid, Map *map);
|
bool LoadFromDB(uint32 guid, Map *map);
|
||||||
|
|
|
||||||
|
|
@ -1281,3 +1281,19 @@ void GameObject::Use(Unit* user)
|
||||||
|
|
||||||
spell->prepare(&targets);
|
spell->prepare(&targets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// overwrite WorldObject function for proper name localization
|
||||||
|
const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const
|
||||||
|
{
|
||||||
|
if (loc_idx >= 0)
|
||||||
|
{
|
||||||
|
GameObjectLocale const *cl = objmgr.GetGameObjectLocale(GetEntry());
|
||||||
|
if (cl)
|
||||||
|
{
|
||||||
|
if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty())
|
||||||
|
return cl->Name[loc_idx].c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetName();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -449,6 +449,9 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
||||||
void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); }
|
void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); }
|
||||||
void Whisper(int32 textId, uint64 receiver) { MonsterWhisper(textId,receiver); }
|
void Whisper(int32 textId, uint64 receiver) { MonsterWhisper(textId,receiver); }
|
||||||
|
|
||||||
|
// overwrite WorldObject function for proper name localization
|
||||||
|
const char* GetNameForLocaleIdx(int32 locale_idx) const;
|
||||||
|
|
||||||
void SaveToDB();
|
void SaveToDB();
|
||||||
void SaveToDB(uint32 mapid, uint8 spawnMask);
|
void SaveToDB(uint32 mapid, uint8 spawnMask);
|
||||||
bool LoadFromDB(uint32 guid, Map *map);
|
bool LoadFromDB(uint32 guid, Map *map);
|
||||||
|
|
|
||||||
|
|
@ -566,6 +566,7 @@ struct ItemPrototype
|
||||||
{
|
{
|
||||||
case INVTYPE_RELIC:
|
case INVTYPE_RELIC:
|
||||||
case INVTYPE_SHIELD:
|
case INVTYPE_SHIELD:
|
||||||
|
case INVTYPE_HOLDABLE:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,7 @@ enum MangosStrings
|
||||||
LANG_COMMAND_GRAVEYARDALRLINKED = 450,
|
LANG_COMMAND_GRAVEYARDALRLINKED = 450,
|
||||||
LANG_COMMAND_GRAVEYARDLINKED = 451,
|
LANG_COMMAND_GRAVEYARDLINKED = 451,
|
||||||
LANG_COMMAND_GRAVEYARDWRONGZONE = 452,
|
LANG_COMMAND_GRAVEYARDWRONGZONE = 452,
|
||||||
LANG_COMMAND_GRAVEYARDWRONGTEAM = 453,
|
// = 453,
|
||||||
LANG_COMMAND_GRAVEYARDERROR = 454,
|
LANG_COMMAND_GRAVEYARDERROR = 454,
|
||||||
LANG_COMMAND_GRAVEYARD_NOTEAM = 455,
|
LANG_COMMAND_GRAVEYARD_NOTEAM = 455,
|
||||||
LANG_COMMAND_GRAVEYARD_ANY = 456,
|
LANG_COMMAND_GRAVEYARD_ANY = 456,
|
||||||
|
|
|
||||||
|
|
@ -3527,13 +3527,6 @@ bool ChatHandler::HandleLinkGraveCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(graveyard->map_id != areaEntry->mapid && g_team != 0)
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_COMMAND_GRAVEYARDWRONGTEAM);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(objmgr.AddGraveYardLink(g_id,player->GetZoneId(),g_team))
|
if(objmgr.AddGraveYardLink(g_id,player->GetZoneId(),g_team))
|
||||||
PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id,zoneId);
|
PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id,zoneId);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1278,7 +1278,7 @@ namespace MaNGOS
|
||||||
data = new WorldPacket(SMSG_MESSAGECHAT, 200);
|
data = new WorldPacket(SMSG_MESSAGECHAT, 200);
|
||||||
|
|
||||||
// TODO: i_object.GetName() also must be localized?
|
// TODO: i_object.GetName() also must be localized?
|
||||||
i_object.BuildMonsterChat(data,i_msgtype,text,i_language,i_object.GetName(),i_targetGUID);
|
i_object.BuildMonsterChat(data,i_msgtype,text,i_language,i_object.GetNameForLocaleIdx(loc_idx),i_targetGUID);
|
||||||
|
|
||||||
i_data_cache[cache_idx] = data;
|
i_data_cache[cache_idx] = data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -411,6 +411,8 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
||||||
const char* GetName() const { return m_name.c_str(); }
|
const char* GetName() const { return m_name.c_str(); }
|
||||||
void SetName(std::string newname) { m_name=newname; }
|
void SetName(std::string newname) { m_name=newname; }
|
||||||
|
|
||||||
|
virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); }
|
||||||
|
|
||||||
float GetDistance( const WorldObject* obj ) const;
|
float GetDistance( const WorldObject* obj ) const;
|
||||||
float GetDistance(const float x, const float y, const float z) const;
|
float GetDistance(const float x, const float y, const float z) const;
|
||||||
float GetDistance2d(const WorldObject* obj) const;
|
float GetDistance2d(const WorldObject* obj) const;
|
||||||
|
|
|
||||||
|
|
@ -4784,12 +4784,6 @@ void ObjectMgr::LoadGraveyardZones()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entry->map_id != areaEntry->mapid && team != 0)
|
|
||||||
{
|
|
||||||
sLog.outErrorDb("Table `game_graveyard_zone` has record for ghost zone (%u) at map %u and graveyard (%u) at map %u for team %u, but in case maps are different, player faction setting is ignored. Use faction 0 instead.",zoneId,areaEntry->mapid, safeLocId, entry->map_id, team);
|
|
||||||
team = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!AddGraveYardLink(safeLocId,zoneId,team,false))
|
if(!AddGraveYardLink(safeLocId,zoneId,team,false))
|
||||||
sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.",safeLocId,zoneId);
|
sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.",safeLocId,zoneId);
|
||||||
} while( result->NextRow() );
|
} while( result->NextRow() );
|
||||||
|
|
@ -4811,7 +4805,7 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
|
||||||
// if mapId == graveyard.mapId (ghost in plain zone or city or battleground) and search graveyard at same map
|
// if mapId == graveyard.mapId (ghost in plain zone or city or battleground) and search graveyard at same map
|
||||||
// then check faction
|
// then check faction
|
||||||
// if mapId != graveyard.mapId (ghost in instance) and search any graveyard associated
|
// if mapId != graveyard.mapId (ghost in instance) and search any graveyard associated
|
||||||
// then skip check faction
|
// then check faction
|
||||||
GraveYardMap::const_iterator graveLow = mGraveYardMap.lower_bound(zoneId);
|
GraveYardMap::const_iterator graveLow = mGraveYardMap.lower_bound(zoneId);
|
||||||
GraveYardMap::const_iterator graveUp = mGraveYardMap.upper_bound(zoneId);
|
GraveYardMap::const_iterator graveUp = mGraveYardMap.upper_bound(zoneId);
|
||||||
if(graveLow==graveUp)
|
if(graveLow==graveUp)
|
||||||
|
|
@ -4820,11 +4814,21 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// at corpse map
|
||||||
bool foundNear = false;
|
bool foundNear = false;
|
||||||
float distNear;
|
float distNear;
|
||||||
WorldSafeLocsEntry const* entryNear = NULL;
|
WorldSafeLocsEntry const* entryNear = NULL;
|
||||||
|
|
||||||
|
// at entrance map for corpse map
|
||||||
|
bool foundEntr = false;
|
||||||
|
float distEntr;
|
||||||
|
WorldSafeLocsEntry const* entryEntr = NULL;
|
||||||
|
|
||||||
|
// some where other
|
||||||
WorldSafeLocsEntry const* entryFar = NULL;
|
WorldSafeLocsEntry const* entryFar = NULL;
|
||||||
|
|
||||||
|
MapEntry const* mapEntry = sMapStore.LookupEntry(MapId);
|
||||||
|
|
||||||
for(GraveYardMap::const_iterator itr = graveLow; itr != graveUp; ++itr)
|
for(GraveYardMap::const_iterator itr = graveLow; itr != graveUp; ++itr)
|
||||||
{
|
{
|
||||||
GraveYardData const& data = itr->second;
|
GraveYardData const& data = itr->second;
|
||||||
|
|
@ -4836,20 +4840,44 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remember first graveyard at another map and ignore other
|
// skip enemy faction graveyard
|
||||||
if(MapId != entry->map_id)
|
|
||||||
{
|
|
||||||
if(!entryFar)
|
|
||||||
entryFar = entry;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// skip enemy faction graveyard at same map (normal area, city, or battleground)
|
|
||||||
// team == 0 case can be at call from .neargrave
|
// team == 0 case can be at call from .neargrave
|
||||||
if(data.team != 0 && team != 0 && data.team != team)
|
if(data.team != 0 && team != 0 && data.team != team)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// find now nearest graveyard at other map
|
||||||
|
if(MapId != entry->map_id)
|
||||||
|
{
|
||||||
|
// if find graveyard at different map from where entrance placed (or no entrance data), use any first
|
||||||
|
if (!mapEntry || mapEntry->entrance_map < 0 || mapEntry->entrance_map != entry->map_id ||
|
||||||
|
mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0)
|
||||||
|
{
|
||||||
|
// not have any corrdinates for check distance anyway
|
||||||
|
entryFar = entry;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// at entrance map calculate distance (2D);
|
||||||
|
float dist2 = (entry->x - mapEntry->entrance_x)*(entry->x - mapEntry->entrance_x)
|
||||||
|
+(entry->y - mapEntry->entrance_y)*(entry->y - mapEntry->entrance_y);
|
||||||
|
if(foundEntr)
|
||||||
|
{
|
||||||
|
if(dist2 < distEntr)
|
||||||
|
{
|
||||||
|
distEntr = dist2;
|
||||||
|
entryEntr = entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foundEntr = true;
|
||||||
|
distEntr = dist2;
|
||||||
|
entryEntr = entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
// find now nearest graveyard at same map
|
// find now nearest graveyard at same map
|
||||||
|
else
|
||||||
|
{
|
||||||
float dist2 = (entry->x - x)*(entry->x - x)+(entry->y - y)*(entry->y - y)+(entry->z - z)*(entry->z - z);
|
float dist2 = (entry->x - x)*(entry->x - x)+(entry->y - y)*(entry->y - y)+(entry->z - z)*(entry->z - z);
|
||||||
if(foundNear)
|
if(foundNear)
|
||||||
{
|
{
|
||||||
|
|
@ -4866,10 +4894,14 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
|
||||||
entryNear = entry;
|
entryNear = entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(entryNear)
|
if(entryNear)
|
||||||
return entryNear;
|
return entryNear;
|
||||||
|
|
||||||
|
if(entryEntr)
|
||||||
|
return entryEntr;
|
||||||
|
|
||||||
return entryFar;
|
return entryFar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10258,9 +10258,26 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
|
||||||
|
|
||||||
if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0)
|
if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0)
|
||||||
{
|
{
|
||||||
m_weaponChangeTimer = DEFAULT_SWITCH_WEAPON;
|
uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s;
|
||||||
|
|
||||||
if (getClass() == CLASS_ROGUE)
|
if (getClass() == CLASS_ROGUE)
|
||||||
m_weaponChangeTimer = ROGUE_SWITCH_WEAPON;
|
cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s;
|
||||||
|
|
||||||
|
SpellEntry const* spellProto = sSpellStore.LookupEntry(cooldownSpell);
|
||||||
|
|
||||||
|
if (!spellProto)
|
||||||
|
sLog.outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_weaponChangeTimer = spellProto->StartRecoveryTime;
|
||||||
|
|
||||||
|
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4);
|
||||||
|
data << uint64(GetGUID());
|
||||||
|
data << uint8(1);
|
||||||
|
data << uint32(cooldownSpell);
|
||||||
|
data << uint32(0);
|
||||||
|
GetSession()->SendPacket(&data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -697,12 +697,6 @@ struct ItemPosCount
|
||||||
};
|
};
|
||||||
typedef std::vector<ItemPosCount> ItemPosCountVec;
|
typedef std::vector<ItemPosCount> ItemPosCountVec;
|
||||||
|
|
||||||
enum SwitchWeapon
|
|
||||||
{
|
|
||||||
DEFAULT_SWITCH_WEAPON = 1500, //cooldown in ms
|
|
||||||
ROGUE_SWITCH_WEAPON = 1000
|
|
||||||
};
|
|
||||||
|
|
||||||
enum TradeSlots
|
enum TradeSlots
|
||||||
{
|
{
|
||||||
TRADE_SLOT_COUNT = 7,
|
TRADE_SLOT_COUNT = 7,
|
||||||
|
|
|
||||||
|
|
@ -1890,6 +1890,8 @@ enum CorpseDynFlags
|
||||||
#define SPELL_ID_GENERIC_LEARN_PET 55884 // used for learning mounts and companions
|
#define SPELL_ID_GENERIC_LEARN_PET 55884 // used for learning mounts and companions
|
||||||
#define SPELL_ID_PASSIVE_BATTLE_STANCE 2457
|
#define SPELL_ID_PASSIVE_BATTLE_STANCE 2457
|
||||||
#define SPELL_ID_PASSIVE_RESURRECTION_SICKNESS 15007
|
#define SPELL_ID_PASSIVE_RESURRECTION_SICKNESS 15007
|
||||||
|
#define SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s 6119
|
||||||
|
#define SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s 6123
|
||||||
|
|
||||||
enum WeatherType
|
enum WeatherType
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5631,7 +5631,7 @@ void Aura::PeriodicTick()
|
||||||
|
|
||||||
// DO NOT ACCESS MEMBERS OF THE AURA FROM NOW ON (DealDamage can delete aura)
|
// DO NOT ACCESS MEMBERS OF THE AURA FROM NOW ON (DealDamage can delete aura)
|
||||||
|
|
||||||
pCaster->ProcDamageAndSpell(target, PROC_FLAG_HIT_SPELL, PROC_FLAG_TAKE_DAMAGE, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), GetSpellSchoolMask(spellProto), spellProto);
|
pCaster->ProcDamageAndSpell(target, PROC_FLAG_NONE, PROC_FLAG_TAKE_DAMAGE, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), GetSpellSchoolMask(spellProto), spellProto);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPELL_AURA_PERIODIC_LEECH:
|
case SPELL_AURA_PERIODIC_LEECH:
|
||||||
|
|
@ -5744,7 +5744,7 @@ void Aura::PeriodicTick()
|
||||||
|
|
||||||
// DO NOT ACCESS MEMBERS OF THE AURA FROM NOW ON (DealDamage can delete aura)
|
// DO NOT ACCESS MEMBERS OF THE AURA FROM NOW ON (DealDamage can delete aura)
|
||||||
|
|
||||||
pCaster->ProcDamageAndSpell(target, PROC_FLAG_HIT_SPELL, PROC_FLAG_TAKE_DAMAGE, new_damage, GetSpellSchoolMask(spellProto), spellProto);
|
pCaster->ProcDamageAndSpell(target, PROC_FLAG_HEALED, PROC_FLAG_TAKE_DAMAGE, new_damage, GetSpellSchoolMask(spellProto), spellProto);
|
||||||
if (!target->isAlive() && pCaster->IsNonMeleeSpellCasted(false))
|
if (!target->isAlive() && pCaster->IsNonMeleeSpellCasted(false))
|
||||||
{
|
{
|
||||||
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
|
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
|
||||||
|
|
@ -5848,7 +5848,7 @@ void Aura::PeriodicTick()
|
||||||
|
|
||||||
// ignore item heals
|
// ignore item heals
|
||||||
if(procSpell && !haveCastItem)
|
if(procSpell && !haveCastItem)
|
||||||
pCaster->ProcDamageAndSpell(target,PROC_FLAG_HEAL, PROC_FLAG_HEALED, pdamage, SPELL_SCHOOL_MASK_NONE, spellProto);
|
pCaster->ProcDamageAndSpell(target,PROC_FLAG_NONE, PROC_FLAG_HEALED, pdamage, SPELL_SCHOOL_MASK_NONE, spellProto);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPELL_AURA_PERIODIC_MANA_LEECH:
|
case SPELL_AURA_PERIODIC_MANA_LEECH:
|
||||||
|
|
|
||||||
|
|
@ -198,13 +198,16 @@ World::AddSession_ (WorldSession* s)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldSession* old = m_sessions[s->GetAccountId ()];
|
|
||||||
m_sessions[s->GetAccountId ()] = s;
|
|
||||||
|
|
||||||
// if session already exist, prepare to it deleting at next world update
|
// if session already exist, prepare to it deleting at next world update
|
||||||
// NOTE - KickPlayer() should be called on "old" in RemoveSession()
|
// NOTE - KickPlayer() should be called on "old" in RemoveSession()
|
||||||
if (old)
|
{
|
||||||
m_kicked_sessions.insert (old);
|
SessionMap::const_iterator old = m_sessions.find(s->GetAccountId ());
|
||||||
|
|
||||||
|
if(old != m_sessions.end())
|
||||||
|
m_kicked_sessions.insert (old->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sessions[s->GetAccountId ()] = s;
|
||||||
|
|
||||||
uint32 Sessions = GetActiveAndQueuedSessionCount ();
|
uint32 Sessions = GetActiveAndQueuedSessionCount ();
|
||||||
uint32 pLimit = GetPlayerAmountLimit ();
|
uint32 pLimit = GetPlayerAmountLimit ();
|
||||||
|
|
@ -286,9 +289,7 @@ void World::RemoveQueuedPlayer(WorldSession* sess)
|
||||||
{
|
{
|
||||||
if(*iter==sess)
|
if(*iter==sess)
|
||||||
{
|
{
|
||||||
Queue::iterator iter2 = iter;
|
iter = m_QueuedPlayer.erase(iter);
|
||||||
++iter;
|
|
||||||
m_QueuedPlayer.erase(iter2);
|
|
||||||
decrease_session = false; // removing queued session
|
decrease_session = false; // removing queued session
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ int WorldSocket::handle_input (ACE_HANDLE)
|
||||||
if ((errno == EWOULDBLOCK) ||
|
if ((errno == EWOULDBLOCK) ||
|
||||||
(errno == EAGAIN))
|
(errno == EAGAIN))
|
||||||
{
|
{
|
||||||
return Update (); // interesting line ,isnt it ?
|
return Update (); // interesting line ,isn't it ?
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG ("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
|
DEBUG_LOG ("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
|
||||||
|
|
@ -460,20 +460,20 @@ int WorldSocket::handle_input_missing_data (void)
|
||||||
{
|
{
|
||||||
if (m_Header.space () > 0)
|
if (m_Header.space () > 0)
|
||||||
{
|
{
|
||||||
//need to recieve the header
|
//need to receive the header
|
||||||
const size_t to_header = (message_block.length () > m_Header.space () ? m_Header.space () : message_block.length ());
|
const size_t to_header = (message_block.length () > m_Header.space () ? m_Header.space () : message_block.length ());
|
||||||
m_Header.copy (message_block.rd_ptr (), to_header);
|
m_Header.copy (message_block.rd_ptr (), to_header);
|
||||||
message_block.rd_ptr (to_header);
|
message_block.rd_ptr (to_header);
|
||||||
|
|
||||||
if (m_Header.space () > 0)
|
if (m_Header.space () > 0)
|
||||||
{
|
{
|
||||||
//couldnt recieve the whole header this time
|
// Couldn't receive the whole header this time.
|
||||||
ACE_ASSERT (message_block.length () == 0);
|
ACE_ASSERT (message_block.length () == 0);
|
||||||
errno = EWOULDBLOCK;
|
errno = EWOULDBLOCK;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//we just recieved nice new header
|
// We just received nice new header
|
||||||
if (handle_input_header () == -1)
|
if (handle_input_header () == -1)
|
||||||
{
|
{
|
||||||
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
|
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
|
||||||
|
|
@ -482,16 +482,16 @@ int WorldSocket::handle_input_missing_data (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Its possible on some error situations that this happens
|
// Its possible on some error situations that this happens
|
||||||
// for example on closing when epoll recieves more chunked data and stuff
|
// for example on closing when epoll receives more chunked data and stuff
|
||||||
// hope this is not hack ,as proper m_RecvWPct is asserted around
|
// hope this is not hack ,as proper m_RecvWPct is asserted around
|
||||||
if (!m_RecvWPct)
|
if (!m_RecvWPct)
|
||||||
{
|
{
|
||||||
sLog.outError ("Forsing close on input m_RecvWPct = NULL");
|
sLog.outError ("Forcing close on input m_RecvWPct = NULL");
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have full readed header, now check the data payload
|
// We have full read header, now check the data payload
|
||||||
if (m_RecvPct.space () > 0)
|
if (m_RecvPct.space () > 0)
|
||||||
{
|
{
|
||||||
//need more data in the payload
|
//need more data in the payload
|
||||||
|
|
@ -501,14 +501,14 @@ int WorldSocket::handle_input_missing_data (void)
|
||||||
|
|
||||||
if (m_RecvPct.space () > 0)
|
if (m_RecvPct.space () > 0)
|
||||||
{
|
{
|
||||||
//couldnt recieve the whole data this time
|
// Couldn't receive the whole data this time.
|
||||||
ACE_ASSERT (message_block.length () == 0);
|
ACE_ASSERT (message_block.length () == 0);
|
||||||
errno = EWOULDBLOCK;
|
errno = EWOULDBLOCK;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//just recieved fresh new payload
|
//just received fresh new payload
|
||||||
if (handle_input_payload () == -1)
|
if (handle_input_payload () == -1)
|
||||||
{
|
{
|
||||||
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
|
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
|
||||||
|
|
@ -570,7 +570,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
|
||||||
if (closing_)
|
if (closing_)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// dump recieved packet
|
// Dump received packet.
|
||||||
if (sWorldLog.LogWorld ())
|
if (sWorldLog.LogWorld ())
|
||||||
{
|
{
|
||||||
sWorldLog.Log ("CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
|
sWorldLog.Log ("CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
|
||||||
|
|
@ -635,7 +635,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
|
||||||
|
|
||||||
int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||||
{
|
{
|
||||||
// NOTE: ATM the socket is singlethreaded, have this in mind ...
|
// NOTE: ATM the socket is singlethread, have this in mind ...
|
||||||
uint8 digest[20];
|
uint8 digest[20];
|
||||||
uint32 clientSeed;
|
uint32 clientSeed;
|
||||||
uint32 unk2, unk3;
|
uint32 unk2, unk3;
|
||||||
|
|
@ -927,7 +927,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
|
||||||
if (m_Session && m_Session->GetSecurity () == SEC_PLAYER)
|
if (m_Session && m_Session->GetSecurity () == SEC_PLAYER)
|
||||||
{
|
{
|
||||||
sLog.outError ("WorldSocket::HandlePing: Player kicked for "
|
sLog.outError ("WorldSocket::HandlePing: Player kicked for "
|
||||||
"overspeeded pings address = %s",
|
"over-speed pings address = %s",
|
||||||
GetRemoteAddress ().c_str ());
|
GetRemoteAddress ().c_str ());
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -53,36 +53,36 @@ typedef ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> WorldHandler;
|
||||||
/**
|
/**
|
||||||
* WorldSocket.
|
* WorldSocket.
|
||||||
*
|
*
|
||||||
* This class is responsible for the comunication with
|
* This class is responsible for the communication with
|
||||||
* remote clients.
|
* remote clients.
|
||||||
* Most methods return -1 on failure.
|
* Most methods return -1 on failure.
|
||||||
* The class uses refferece counting.
|
* The class uses reference counting.
|
||||||
*
|
*
|
||||||
* For output the class uses one buffer (64K usually) and
|
* For output the class uses one buffer (64K usually) and
|
||||||
* a queue where it stores packet if there is no place on
|
* a queue where it stores packet if there is no place on
|
||||||
* the queue. The reason this is done, is because the server
|
* the queue. The reason this is done, is because the server
|
||||||
* does realy a lot of small-size writes to it, and it doesn't
|
* does really a lot of small-size writes to it, and it doesn't
|
||||||
* scale well to allocate memory for every. When something is
|
* scale well to allocate memory for every. When something is
|
||||||
* writen to the output buffer the socket is not immideately
|
* written to the output buffer the socket is not immediately
|
||||||
* activated for output (again for the same reason), there
|
* activated for output (again for the same reason), there
|
||||||
* is 10ms celling (thats why there is Update() method).
|
* is 10ms celling (thats why there is Update() method).
|
||||||
* This concept is simmilar to TCP_CORK, but TCP_CORK
|
* This concept is similar to TCP_CORK, but TCP_CORK
|
||||||
* usses 200ms celling. As result overhead generated by
|
* uses 200ms celling. As result overhead generated by
|
||||||
* sending packets from "producer" threads is minimal,
|
* sending packets from "producer" threads is minimal,
|
||||||
* and doing a lot of writes with small size is tollerated.
|
* and doing a lot of writes with small size is tolerated.
|
||||||
*
|
*
|
||||||
* The calls to Upate () method are managed by WorldSocketMgr
|
* The calls to Update () method are managed by WorldSocketMgr
|
||||||
* and ReactorRunnable.
|
* and ReactorRunnable.
|
||||||
*
|
*
|
||||||
* For input ,the class uses one 1024 bytes buffer on stack
|
* For input ,the class uses one 1024 bytes buffer on stack
|
||||||
* to which it does recv() calls. And then recieved data is
|
* to which it does recv() calls. And then received data is
|
||||||
* distributed where its needed. 1024 matches pritey well the
|
* distributed where its needed. 1024 matches pretty well the
|
||||||
* traffic generated by client for now.
|
* traffic generated by client for now.
|
||||||
*
|
*
|
||||||
* The input/output do speculative reads/writes (AKA it tryes
|
* The input/output do speculative reads/writes (AKA it tryes
|
||||||
* to read all data avaible in the kernel buffer or tryes to
|
* to read all data available in the kernel buffer or tryes to
|
||||||
* write everything avaible in userspace buffer),
|
* write everything available in userspace buffer),
|
||||||
* which is ok for using with Level and Edge Trigered IO
|
* which is ok for using with Level and Edge Triggered IO
|
||||||
* notification.
|
* notification.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -97,7 +97,7 @@ class WorldSocket : protected WorldHandler
|
||||||
/// Declare the acceptor for this class
|
/// Declare the acceptor for this class
|
||||||
typedef ACE_Acceptor< WorldSocket, ACE_SOCK_ACCEPTOR > Acceptor;
|
typedef ACE_Acceptor< WorldSocket, ACE_SOCK_ACCEPTOR > Acceptor;
|
||||||
|
|
||||||
/// Mutex type used for various syncronizations.
|
/// Mutex type used for various synchronizations.
|
||||||
typedef ACE_Thread_Mutex LockType;
|
typedef ACE_Thread_Mutex LockType;
|
||||||
typedef ACE_Guard<LockType> GuardType;
|
typedef ACE_Guard<LockType> GuardType;
|
||||||
|
|
||||||
|
|
@ -118,10 +118,10 @@ class WorldSocket : protected WorldHandler
|
||||||
/// @return -1 of failure
|
/// @return -1 of failure
|
||||||
int SendPacket (const WorldPacket& pct);
|
int SendPacket (const WorldPacket& pct);
|
||||||
|
|
||||||
/// Add refference to this object.
|
/// Add reference to this object.
|
||||||
long AddReference (void);
|
long AddReference (void);
|
||||||
|
|
||||||
/// Remove refference to this object.
|
/// Remove reference to this object.
|
||||||
long RemoveReference (void);
|
long RemoveReference (void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -183,7 +183,7 @@ class WorldSocket : protected WorldHandler
|
||||||
/// Time in which the last ping was received
|
/// Time in which the last ping was received
|
||||||
ACE_Time_Value m_LastPingTime;
|
ACE_Time_Value m_LastPingTime;
|
||||||
|
|
||||||
/// Keep track of overspeed pings ,to prevent ping flood.
|
/// Keep track of over-speed pings ,to prevent ping flood.
|
||||||
uint32 m_OverSpeedPings;
|
uint32 m_OverSpeedPings;
|
||||||
|
|
||||||
/// Address of the remote peer
|
/// Address of the remote peer
|
||||||
|
|
@ -195,21 +195,21 @@ class WorldSocket : protected WorldHandler
|
||||||
/// Mutex lock to protect m_Session
|
/// Mutex lock to protect m_Session
|
||||||
LockType m_SessionLock;
|
LockType m_SessionLock;
|
||||||
|
|
||||||
/// Session to which recieved packets are routed
|
/// Session to which received packets are routed
|
||||||
WorldSession* m_Session;
|
WorldSession* m_Session;
|
||||||
|
|
||||||
/// here are stored the fragmens of the recieved data
|
/// here are stored the fragments of the received data
|
||||||
WorldPacket* m_RecvWPct;
|
WorldPacket* m_RecvWPct;
|
||||||
|
|
||||||
/// This block actually refers to m_RecvWPct contents,
|
/// This block actually refers to m_RecvWPct contents,
|
||||||
/// which alows easy and safe writing to it.
|
/// which allows easy and safe writing to it.
|
||||||
/// It wont free memory when its deleted. m_RecvWPct takes care of freeing.
|
/// It wont free memory when its deleted. m_RecvWPct takes care of freeing.
|
||||||
ACE_Message_Block m_RecvPct;
|
ACE_Message_Block m_RecvPct;
|
||||||
|
|
||||||
/// Fragment of the recieved header.
|
/// Fragment of the received header.
|
||||||
ACE_Message_Block m_Header;
|
ACE_Message_Block m_Header;
|
||||||
|
|
||||||
/// Mutex for protecting otuput related data.
|
/// Mutex for protecting output related data.
|
||||||
LockType m_OutBufferLock;
|
LockType m_OutBufferLock;
|
||||||
|
|
||||||
/// Buffer used for writing output.
|
/// Buffer used for writing output.
|
||||||
|
|
@ -219,7 +219,7 @@ class WorldSocket : protected WorldHandler
|
||||||
size_t m_OutBufferSize;
|
size_t m_OutBufferSize;
|
||||||
|
|
||||||
/// Here are stored packets for which there was no space on m_OutBuffer,
|
/// Here are stored packets for which there was no space on m_OutBuffer,
|
||||||
/// this alows not-to kick player if its buffer is overflowed.
|
/// this allows not-to kick player if its buffer is overflowed.
|
||||||
PacketQueueT m_PacketQueue;
|
PacketQueueT m_PacketQueue;
|
||||||
|
|
||||||
/// True if the socket is registered with the reactor for output
|
/// True if the socket is registered with the reactor for output
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6810"
|
#define REVISION_NR "6816"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue