Merge branch 'master' of https://github.com/mangoszero/server
This commit is contained in:
commit
b041843ed5
@ -158,31 +158,31 @@ function GetPrerequisites()
|
|||||||
case ${VER} in
|
case ${VER} in
|
||||||
"sarah")
|
"sarah")
|
||||||
# Linux Mint 18 - Ubuntu Xenial based
|
# Linux Mint 18 - Ubuntu Xenial based
|
||||||
su -c "aptitude -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
su -c "aptitude -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
||||||
;;
|
;;
|
||||||
"rosa")
|
"rosa")
|
||||||
# Linux Mint 17.3 - Ubuntu Trusty based
|
# Linux Mint 17.3 - Ubuntu Trusty based
|
||||||
su -c "apt-get -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
su -c "apt-get -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
||||||
;;
|
;;
|
||||||
"rafaela")
|
"rafaela")
|
||||||
# Linux Mint 17.2 - Ubuntu Trusty based
|
# Linux Mint 17.2 - Ubuntu Trusty based
|
||||||
su -c "apt-get -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
su -c "apt-get -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
||||||
;;
|
;;
|
||||||
"rebecca")
|
"rebecca")
|
||||||
# Linux Mint 17.1 - Ubuntu Trusty based
|
# Linux Mint 17.1 - Ubuntu Trusty based
|
||||||
su -c "apt-get -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
su -c "apt-get -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
||||||
;;
|
;;
|
||||||
"qiana")
|
"qiana")
|
||||||
# Linux Mint 17 - Ubuntu Trusty based
|
# Linux Mint 17 - Ubuntu Trusty based
|
||||||
su -c "apt-get -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
su -c "apt-get -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
||||||
;;
|
;;
|
||||||
"maya")
|
"maya")
|
||||||
# Linux Mint 13 - Ubuntu Precise based
|
# Linux Mint 13 - Ubuntu Precise based
|
||||||
su -c "apt-get -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.1 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
su -c "apt-get -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.1 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
||||||
;;
|
;;
|
||||||
"betsy")
|
"betsy")
|
||||||
# LMDE 2 - Debian Jessie based
|
# LMDE 2 - Debian Jessie based
|
||||||
su -c "aptitude -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.2.8 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
|
su -c "aptitude -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.2.8 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
OS_VER=0
|
OS_VER=0
|
||||||
@ -193,35 +193,35 @@ function GetPrerequisites()
|
|||||||
case ${VER} in
|
case ${VER} in
|
||||||
"precise")
|
"precise")
|
||||||
# Ubuntu 12.04 LTS
|
# Ubuntu 12.04 LTS
|
||||||
su -c "apt-get -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.1 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
su -c "apt-get -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.1 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
||||||
;;
|
;;
|
||||||
"trusty")
|
"trusty")
|
||||||
# Ubuntu 14.04 LTS
|
# Ubuntu 14.04 LTS
|
||||||
su -c "apt-get -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
su -c "apt-get -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.0.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
||||||
;;
|
;;
|
||||||
"xenial")
|
"xenial")
|
||||||
# Ubuntu 16.04 LTS
|
# Ubuntu 16.04 LTS
|
||||||
su -c "apt-get -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
su -c "apt-get -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
||||||
;;
|
;;
|
||||||
"yakkety")
|
"yakkety")
|
||||||
# Ubuntu 16.10
|
# Ubuntu 16.10
|
||||||
su -c "apt-get -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
su -c "apt-get -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
OS_VER=0
|
OS_VER=0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
su -c "aptitude -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
su -c "aptitude -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zlib1g-dev" root
|
||||||
;;
|
;;
|
||||||
"Debian")
|
"Debian")
|
||||||
case ${VER} in
|
case ${VER} in
|
||||||
"jessie")
|
"jessie")
|
||||||
# Debian 8.0 "current"
|
# Debian 8.0 "current"
|
||||||
su -c "aptitude -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.2.8 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
|
su -c "aptitude -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.2.8 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
|
||||||
;;
|
;;
|
||||||
"stretch")
|
"stretch")
|
||||||
# Debian Next
|
# Debian Next
|
||||||
su -c "aptitude -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
|
su -c "aptitude -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
OS_VER=0
|
OS_VER=0
|
||||||
@ -232,11 +232,11 @@ function GetPrerequisites()
|
|||||||
case ${VER} in
|
case ${VER} in
|
||||||
"santiago")
|
"santiago")
|
||||||
# Red Hat 6.x
|
# Red Hat 6.x
|
||||||
su -c "yum -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.2.8 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
|
su -c "yum -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.2.8 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
|
||||||
;;
|
;;
|
||||||
"maipo")
|
"maipo")
|
||||||
# Red Hat 7.x
|
# Red Hat 7.x
|
||||||
su -c "yum -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
|
su -c "yum -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.3.3 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
OS_VER=0
|
OS_VER=0
|
||||||
@ -824,7 +824,7 @@ function UpdateDatabases()
|
|||||||
local DB_TOONS="$6"
|
local DB_TOONS="$6"
|
||||||
|
|
||||||
# Loop through the character files
|
# Loop through the character files
|
||||||
for pFile in $(ls $SRCPATH/database/Character/Updates/*.sql); do
|
for pFile in $(ls $SRCPATH/database/Character/Updates/$(ls -a $SRCPATH/database/Character/Updates/ | tail -1)/*.sql); do
|
||||||
if [ ! -f "$pFile" ]; then
|
if [ ! -f "$pFile" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -840,7 +840,7 @@ function UpdateDatabases()
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Loop through the realm files
|
# Loop through the realm files
|
||||||
for pFile in $(ls $SRCPATH/database/Realm/Updates/*.sql); do
|
for pFile in $(ls $SRCPATH/database/Realm/Updates/$(ls -a $SRCPATH/database/Realm/Updates/ | tail -1)/*.sql); do
|
||||||
if [ ! -f "$pFile" ]; then
|
if [ ! -f "$pFile" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -856,7 +856,7 @@ function UpdateDatabases()
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Loop through the world files
|
# Loop through the world files
|
||||||
for pFile in $(ls $SRCPATH/database/World/Updates/*.sql); do
|
for pFile in $(ls $SRCPATH/database/World/Updates/$(ls -a $SRCPATH/database/World/Updates/ | tail -1)/*.sql); do
|
||||||
if [ ! -f "$pFile" ]; then
|
if [ ! -f "$pFile" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -1086,7 +1086,7 @@ function HandleDatabases()
|
|||||||
# Function helper to extract resources (mmaps, vmaps, dbc, ...) from the game
|
# Function helper to extract resources (mmaps, vmaps, dbc, ...) from the game
|
||||||
function ExtractResources
|
function ExtractResources
|
||||||
{
|
{
|
||||||
INSTGAMEPATH=$(dirname $(find /home -name "WoW.exe" 2>>/dev/null))
|
INSTGAMEPATH=$(dirname $(find /home -name "WoW.exe"| head -1 2>>/dev/null))
|
||||||
|
|
||||||
GAMEPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "WoW Game Path" \
|
GAMEPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "WoW Game Path" \
|
||||||
--inputbox "Please, provide the path to your game directory. Default: $INSTGAMEPATH" 8 60 3>&2 2>&1 1>&3)
|
--inputbox "Please, provide the path to your game directory. Default: $INSTGAMEPATH" 8 60 3>&2 2>&1 1>&3)
|
||||||
@ -1111,7 +1111,8 @@ function ExtractResources
|
|||||||
Log "The mangos server is not build, cannot extract data" 1
|
Log "The mangos server is not build, cannot extract data" 1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#TODO What if DBC are not yet generated ??
|
||||||
if [[ $ACTIONS == *1* ]]; then
|
if [[ $ACTIONS == *1* ]]; then
|
||||||
if [ -d "$GAMEPATH/dbc" ]; then
|
if [ -d "$GAMEPATH/dbc" ]; then
|
||||||
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "DBC and Maps were already generated" \
|
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "DBC and Maps were already generated" \
|
||||||
@ -1151,9 +1152,30 @@ function ExtractResources
|
|||||||
cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
|
cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
|
||||||
cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
|
cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
rm -rf $GAMEPATH/map-extractor
|
||||||
|
cp "$INSTPATH/bin/tools/map-extractor" "$GAMEPATH"
|
||||||
|
|
||||||
|
Log "Extracting DBC and Maps" 0
|
||||||
|
cd $GAMEPATH
|
||||||
|
./map-extractor
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
Log "DBC and Maps are extracted" 0
|
||||||
|
Log "Copying DBC and Maps files to installation directory" 0
|
||||||
|
cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
|
||||||
|
cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
|
||||||
|
rm -rf "$GAMEPATH/map-extractor"
|
||||||
|
Log "Changing ownership of the extracted directories"
|
||||||
|
chown -R $USER:$USER "$INSTPATH"
|
||||||
|
else
|
||||||
|
Log "There was an issue while extracting DBC and Maps!" 1
|
||||||
|
rm -rf "$GAMEPATH/map-extractor"
|
||||||
|
rm -rf "$GAMEPATH/dbc"
|
||||||
|
rm -rf "$GAMEPATH/maps"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $ACTIONS == *2* ]]; then
|
if [[ $ACTIONS == *2* ]]; then
|
||||||
@ -1192,6 +1214,30 @@ function ExtractResources
|
|||||||
Log "Copying VMaps files to installation directory" 0
|
Log "Copying VMaps files to installation directory" 0
|
||||||
cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
|
cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
Log "Copying VMaps extractor" 0
|
||||||
|
rm -f "$GAMEPATH/vmap-extractor"
|
||||||
|
cp "$INSTPATH/bin/tools/vmap-extractor" "$GAMEPATH"
|
||||||
|
|
||||||
|
Log "Extracting VMaps" 0
|
||||||
|
cd $GAMEPATH
|
||||||
|
# Make sure there is no previous vmaps generation that cause issue.
|
||||||
|
rm -rf Buildings
|
||||||
|
./vmap-extractor
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
Log "VMaps are extracted" 0
|
||||||
|
Log "Copying VMaps files to installation directory" 0
|
||||||
|
cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
|
||||||
|
rm -rf "$GAMEPATH/vmap-extractor"
|
||||||
|
Log "Changing ownership of the extracted directories"
|
||||||
|
chown -R $USER:$USER "$INSTPATH"
|
||||||
|
else
|
||||||
|
Log "There was an issue while extracting VMaps!" 1
|
||||||
|
rm -rf "$GAMEPATH/vmap-extractor"
|
||||||
|
rm -rf "$GAMEPATH/vmaps"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1265,6 +1311,57 @@ function ExtractResources
|
|||||||
Log "Copying MMaps files to installation directory" 0
|
Log "Copying MMaps files to installation directory" 0
|
||||||
cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"
|
cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
Log "Copying MMaps extractor" 0
|
||||||
|
rm -f "$GAMEPATH/MoveMapGen.sh"
|
||||||
|
cp "$INSTPATH/bin/tools/MoveMapGen.sh" "$GAMEPATH"
|
||||||
|
cp "$INSTPATH/bin/tools/offmesh.txt" "$GAMEPATH"
|
||||||
|
cp "$INSTPATH/bin/tools/mmap_excluded.txt" "$GAMEPATH"
|
||||||
|
cp "$INSTPATH/bin/tools/movemap-generator" "$GAMEPATH"
|
||||||
|
CPU=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Please provide the number of CPU to be used to generate MMaps (1-4)" \
|
||||||
|
--inputbox "Default: 1" 8 80 3>&2 2>&1 1>&3)
|
||||||
|
|
||||||
|
# User cancelled his choice, set default to 1.
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
Log "User selection was cancelled. Max CPU set to 1." 1
|
||||||
|
CPU=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$CPU" ]; then
|
||||||
|
Log "User didn't gave any value. Max CPU set to 1." 1
|
||||||
|
CPU=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$CPU" -lt 1 ] || [ "$CPU" -gt 4 ]; then
|
||||||
|
Log "User entered invalid value. Max CPU set to 1." 1
|
||||||
|
CPU=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
Log "Extracting MMaps" 0
|
||||||
|
cd $GAMEPATH
|
||||||
|
# Making sure we can execute the script
|
||||||
|
chmod 700 MoveMapGen.sh
|
||||||
|
./MoveMapGen.sh $CPU
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
Log "MMaps are extracted" 0
|
||||||
|
Log "Copying MMaps files to installation directory" 0
|
||||||
|
cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"
|
||||||
|
rm -rf "$GAMEPATH/MoveMapGen.sh"
|
||||||
|
rm -rf "$GAMEPATH/offmesh.txt"
|
||||||
|
rm -rf "$GAMEPATH/mmap_excluded.txt"
|
||||||
|
rm -rf "$GAMEPATH/movemap-generator"
|
||||||
|
Log "Changing ownership of the extracted directories"
|
||||||
|
chown -R $USER:$USER "$INSTPATH"
|
||||||
|
else
|
||||||
|
Log "There was an issue while extracting MMaps!" 1
|
||||||
|
rm -rf "$GAMEPATH/MoveMapGen.sh"
|
||||||
|
rm -rf "$GAMEPATH/mmaps"
|
||||||
|
rm -rf "$GAMEPATH/offmesh.txt"
|
||||||
|
rm -rf "$GAMEPATH/mmap_excluded.txt"
|
||||||
|
rm -rf "$GAMEPATH/movemap-generator"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -7288,7 +7288,6 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
|||||||
{
|
{
|
||||||
DEBUG_LOG(" IS_GAMEOBJECT_GUID(guid)");
|
DEBUG_LOG(" IS_GAMEOBJECT_GUID(guid)");
|
||||||
GameObject* go = GetMap()->GetGameObject(guid);
|
GameObject* go = GetMap()->GetGameObject(guid);
|
||||||
GameObjectInfo const* goInfo = go->GetGOInfo();
|
|
||||||
|
|
||||||
// not check distance for GO in case owned GO (fishing bobber case, for example)
|
// not check distance for GO in case owned GO (fishing bobber case, for example)
|
||||||
// And permit out of range GO with no owner in case fishing hole
|
// And permit out of range GO with no owner in case fishing hole
|
||||||
@ -7298,6 +7297,8 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameObjectInfo const* goInfo = go->GetGOInfo();
|
||||||
|
|
||||||
loot = &go->loot;
|
loot = &go->loot;
|
||||||
|
|
||||||
Player* recipient = go->GetLootRecipient();
|
Player* recipient = go->GetLootRecipient();
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include "AccountMgr.h"
|
#include "AccountMgr.h"
|
||||||
|
|
||||||
Warden::Warden() : _session(NULL), _inputCrypto(16), _outputCrypto(16), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0),
|
Warden::Warden() : _session(NULL), _inputCrypto(16), _outputCrypto(16), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0),
|
||||||
_dataSent(false), _previousTimestamp(0), _module(NULL), _initialized(false)
|
_state(WardenState::STATE_INITIAL), _previousTimestamp(0), _module(NULL)
|
||||||
{
|
{
|
||||||
memset(_inputKey, 0, sizeof(_inputKey));
|
memset(_inputKey, 0, sizeof(_inputKey));
|
||||||
memset(_outputKey, 0, sizeof(_outputKey));
|
memset(_outputKey, 0, sizeof(_outputKey));
|
||||||
@ -48,7 +48,11 @@ Warden::~Warden()
|
|||||||
delete[] _module->CompressedData;
|
delete[] _module->CompressedData;
|
||||||
delete _module;
|
delete _module;
|
||||||
_module = NULL;
|
_module = NULL;
|
||||||
_initialized = false;
|
}
|
||||||
|
|
||||||
|
void Warden::InitializeModule()
|
||||||
|
{
|
||||||
|
SetNewState(WardenState::STATE_INITIALIZE_MODULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Warden::RequestHash()
|
void Warden::RequestHash()
|
||||||
@ -66,6 +70,8 @@ void Warden::RequestHash()
|
|||||||
WorldPacket pkt(SMSG_WARDEN_DATA, sizeof(WardenHashRequest));
|
WorldPacket pkt(SMSG_WARDEN_DATA, sizeof(WardenHashRequest));
|
||||||
pkt.append((uint8*)&Request, sizeof(WardenHashRequest));
|
pkt.append((uint8*)&Request, sizeof(WardenHashRequest));
|
||||||
_session->SendPacket(&pkt);
|
_session->SendPacket(&pkt);
|
||||||
|
|
||||||
|
SetNewState(WardenState::STATE_REQUESTED_HASH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Warden::SendModuleToClient()
|
void Warden::SendModuleToClient()
|
||||||
@ -92,6 +98,8 @@ void Warden::SendModuleToClient()
|
|||||||
pkt1.append((uint8*)&packet, burstSize + 3);
|
pkt1.append((uint8*)&packet, burstSize + 3);
|
||||||
_session->SendPacket(&pkt1);
|
_session->SendPacket(&pkt1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetNewState(WardenState::STATE_SENDED_MODULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Warden::RequestModule()
|
void Warden::RequestModule()
|
||||||
@ -112,17 +120,24 @@ void Warden::RequestModule()
|
|||||||
WorldPacket pkt(SMSG_WARDEN_DATA, sizeof(WardenModuleUse));
|
WorldPacket pkt(SMSG_WARDEN_DATA, sizeof(WardenModuleUse));
|
||||||
pkt.append((uint8*)&request, sizeof(WardenModuleUse));
|
pkt.append((uint8*)&request, sizeof(WardenModuleUse));
|
||||||
_session->SendPacket(&pkt);
|
_session->SendPacket(&pkt);
|
||||||
|
|
||||||
|
SetNewState(WardenState::STATE_REQUESTED_MODULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Warden::Update()
|
void Warden::Update()
|
||||||
{
|
{
|
||||||
if (_initialized)
|
uint32 currentTimestamp = WorldTimer::getMSTime();
|
||||||
{
|
uint32 diff = currentTimestamp - _previousTimestamp;
|
||||||
uint32 currentTimestamp = WorldTimer::getMSTime();
|
_previousTimestamp = currentTimestamp;
|
||||||
uint32 diff = currentTimestamp - _previousTimestamp;
|
|
||||||
_previousTimestamp = currentTimestamp;
|
|
||||||
|
|
||||||
if (_dataSent)
|
switch (_state)
|
||||||
|
{
|
||||||
|
case WardenState::STATE_INITIAL:
|
||||||
|
break;
|
||||||
|
case WardenState::STATE_REQUESTED_MODULE:
|
||||||
|
case WardenState::STATE_SENDED_MODULE:
|
||||||
|
case WardenState::STATE_REQUESTED_HASH:
|
||||||
|
case WardenState::STATE_REQUESTED_DATA:
|
||||||
{
|
{
|
||||||
uint32 maxClientResponseDelay = sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_RESPONSE_DELAY);
|
uint32 maxClientResponseDelay = sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_RESPONSE_DELAY);
|
||||||
|
|
||||||
@ -131,23 +146,34 @@ void Warden::Update()
|
|||||||
// Kick player if client response delays more than set in config
|
// Kick player if client response delays more than set in config
|
||||||
if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS)
|
if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS)
|
||||||
{
|
{
|
||||||
sLog.outWarden("%s (latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client",
|
sLog.outWarden("%s (latency: %u, IP: %s) exceeded Warden module response delay on state %s for more than %s - disconnecting client",
|
||||||
_session->GetPlayerName(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, true).c_str());
|
_session->GetPlayerName(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), WardenState::to_string(_state), secsToTimeString(maxClientResponseDelay, true).c_str());
|
||||||
_session->KickPlayer();
|
_session->KickPlayer();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_clientResponseTimer += diff;
|
_clientResponseTimer += diff;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WardenState::STATE_INITIALIZE_MODULE:
|
||||||
|
case WardenState::STATE_RESTING:
|
||||||
{
|
{
|
||||||
if (diff >= _checkTimer)
|
if (diff >= _checkTimer)
|
||||||
{
|
{
|
||||||
RequestData();
|
RequestData();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_checkTimer -= diff;
|
_checkTimer -= diff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sLog.outWarden("Unimplemented warden state!");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +187,28 @@ void Warden::EncryptData(uint8* buffer, uint32 length)
|
|||||||
_outputCrypto.UpdateData(length, buffer);
|
_outputCrypto.UpdateData(length, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Warden::SetNewState(WardenState::Value state)
|
||||||
|
{
|
||||||
|
//if we pass all initial checks, allow change
|
||||||
|
if (state < WardenState::STATE_REQUESTED_DATA)
|
||||||
|
{
|
||||||
|
if (state < _state)
|
||||||
|
{
|
||||||
|
sLog.outWarden("Warden Error: jump from %s to %s which is lower by initialization routine", WardenState::to_string(_state), WardenState::to_string(state));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_state = state;
|
||||||
|
|
||||||
|
//Reset timers
|
||||||
|
// Set hold off timer, minimum timer should at least be 1 second
|
||||||
|
uint32 holdOff = sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_CHECK_HOLDOFF);
|
||||||
|
_checkTimer = (holdOff < 1 ? 1 : holdOff) * IN_MILLISECONDS;
|
||||||
|
|
||||||
|
_clientResponseTimer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool Warden::IsValidCheckSum(uint32 checksum, const uint8* data, const uint16 length)
|
bool Warden::IsValidCheckSum(uint32 checksum, const uint8* data, const uint16 length)
|
||||||
{
|
{
|
||||||
uint32 newChecksum = BuildChecksum(data, length);
|
uint32 newChecksum = BuildChecksum(data, length);
|
||||||
@ -280,11 +328,14 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Warden::RequestData()
|
||||||
|
{
|
||||||
|
SetNewState(WardenState::STATE_REQUESTED_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
void Warden::HandleData(ByteBuffer& /*buff*/)
|
void Warden::HandleData(ByteBuffer& /*buff*/)
|
||||||
{
|
{
|
||||||
// Set hold off timer, minimum timer should at least be 1 second
|
SetNewState(WardenState::STATE_RESTING);
|
||||||
uint32 holdOff = sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_CHECK_HOLDOFF);
|
|
||||||
_checkTimer = (holdOff < 1 ? 1 : holdOff) * IN_MILLISECONDS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Warden::LogPositiveToDB(WardenCheck* check)
|
void Warden::LogPositiveToDB(WardenCheck* check)
|
||||||
|
@ -95,6 +95,42 @@ struct WardenHashRequest
|
|||||||
uint8 Seed[16];
|
uint8 Seed[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace WardenState
|
||||||
|
{
|
||||||
|
enum Value
|
||||||
|
{
|
||||||
|
STATE_INITIAL,
|
||||||
|
STATE_REQUESTED_MODULE,
|
||||||
|
STATE_SENDED_MODULE,
|
||||||
|
STATE_REQUESTED_HASH,
|
||||||
|
STATE_INITIALIZE_MODULE,
|
||||||
|
STATE_REQUESTED_DATA,
|
||||||
|
STATE_RESTING
|
||||||
|
};
|
||||||
|
|
||||||
|
inline char* to_string(WardenState::Value value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case WardenState::STATE_INITIAL:
|
||||||
|
return "STATE_INITIAL";
|
||||||
|
case WardenState::STATE_REQUESTED_MODULE:
|
||||||
|
return "STATE_REQUESTED_MODULE";
|
||||||
|
case WardenState::STATE_SENDED_MODULE:
|
||||||
|
return "STATE_SENDED_MODULE";
|
||||||
|
case WardenState::STATE_REQUESTED_HASH:
|
||||||
|
return "STATE_REQUESTED_HASH";
|
||||||
|
case WardenState::STATE_INITIALIZE_MODULE:
|
||||||
|
return "STATE_INITIALIZE_MODULE";
|
||||||
|
case WardenState::STATE_REQUESTED_DATA:
|
||||||
|
return "STATE_SENDED_DATA";
|
||||||
|
case WardenState::STATE_RESTING:
|
||||||
|
return "STATE_RESTING";
|
||||||
|
}
|
||||||
|
return "UNDEFINED STATE";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
#else
|
#else
|
||||||
@ -119,10 +155,10 @@ class Warden
|
|||||||
|
|
||||||
virtual void Init(WorldSession* session, BigNumber* k) = 0;
|
virtual void Init(WorldSession* session, BigNumber* k) = 0;
|
||||||
virtual ClientWardenModule* GetModuleForClient() = 0;
|
virtual ClientWardenModule* GetModuleForClient() = 0;
|
||||||
virtual void InitializeModule() = 0;
|
virtual void InitializeModule();
|
||||||
virtual void RequestHash();
|
virtual void RequestHash();
|
||||||
virtual void HandleHashResult(ByteBuffer &buff) = 0;
|
virtual void HandleHashResult(ByteBuffer &buff) = 0;
|
||||||
virtual void RequestData() = 0;
|
virtual void RequestData();
|
||||||
virtual void HandleData(ByteBuffer &buff);
|
virtual void HandleData(ByteBuffer &buff);
|
||||||
|
|
||||||
void SendModuleToClient();
|
void SendModuleToClient();
|
||||||
@ -131,6 +167,8 @@ class Warden
|
|||||||
void DecryptData(uint8* buffer, uint32 length);
|
void DecryptData(uint8* buffer, uint32 length);
|
||||||
void EncryptData(uint8* buffer, uint32 length);
|
void EncryptData(uint8* buffer, uint32 length);
|
||||||
|
|
||||||
|
void SetNewState(WardenState::Value state);
|
||||||
|
|
||||||
static bool IsValidCheckSum(uint32 checksum, const uint8 *data, const uint16 length);
|
static bool IsValidCheckSum(uint32 checksum, const uint8 *data, const uint16 length);
|
||||||
static uint32 BuildChecksum(const uint8 *data, uint32 length);
|
static uint32 BuildChecksum(const uint8 *data, uint32 length);
|
||||||
|
|
||||||
@ -148,10 +186,9 @@ class Warden
|
|||||||
ARC4 _outputCrypto;
|
ARC4 _outputCrypto;
|
||||||
uint32 _checkTimer; // Timer for sending check requests
|
uint32 _checkTimer; // Timer for sending check requests
|
||||||
uint32 _clientResponseTimer; // Timer for client response delay
|
uint32 _clientResponseTimer; // Timer for client response delay
|
||||||
bool _dataSent;
|
|
||||||
uint32 _previousTimestamp;
|
uint32 _previousTimestamp;
|
||||||
ClientWardenModule* _module;
|
ClientWardenModule* _module;
|
||||||
bool _initialized;
|
WardenState::Value _state;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -98,6 +98,7 @@ ClientWardenModule* WardenMac::GetModuleForClient()
|
|||||||
void WardenMac::InitializeModule()
|
void WardenMac::InitializeModule()
|
||||||
{
|
{
|
||||||
sLog.outWarden("Initialize module");
|
sLog.outWarden("Initialize module");
|
||||||
|
Warden::InitializeModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct keyData {
|
struct keyData {
|
||||||
@ -174,8 +175,6 @@ void WardenMac::HandleHashResult(ByteBuffer &buff)
|
|||||||
_inputCrypto.Init(_inputKey);
|
_inputCrypto.Init(_inputKey);
|
||||||
_outputCrypto.Init(_outputKey);
|
_outputCrypto.Init(_outputKey);
|
||||||
|
|
||||||
_initialized = true;
|
|
||||||
|
|
||||||
_previousTimestamp = WorldTimer::getMSTime();
|
_previousTimestamp = WorldTimer::getMSTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,16 +199,13 @@ void WardenMac::RequestData()
|
|||||||
pkt.append(buff);
|
pkt.append(buff);
|
||||||
_session->SendPacket(&pkt);
|
_session->SendPacket(&pkt);
|
||||||
|
|
||||||
_dataSent = true;
|
Warden::RequestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WardenMac::HandleData(ByteBuffer &buff)
|
void WardenMac::HandleData(ByteBuffer &buff)
|
||||||
{
|
{
|
||||||
sLog.outWarden("Handle data");
|
sLog.outWarden("Handle data");
|
||||||
|
|
||||||
_dataSent = false;
|
|
||||||
_clientResponseTimer = 0;
|
|
||||||
|
|
||||||
//uint16 Length;
|
//uint16 Length;
|
||||||
//buff >> Length;
|
//buff >> Length;
|
||||||
//uint32 Checksum;
|
//uint32 Checksum;
|
||||||
|
@ -132,6 +132,8 @@ void WardenWin::InitializeModule()
|
|||||||
WorldPacket pkt(SMSG_WARDEN_DATA, sizeof(WardenInitModuleRequest));
|
WorldPacket pkt(SMSG_WARDEN_DATA, sizeof(WardenInitModuleRequest));
|
||||||
pkt.append((uint8*)&Request, sizeof(WardenInitModuleRequest));
|
pkt.append((uint8*)&Request, sizeof(WardenInitModuleRequest));
|
||||||
_session->SendPacket(&pkt);
|
_session->SendPacket(&pkt);
|
||||||
|
|
||||||
|
Warden::InitializeModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WardenWin::HandleHashResult(ByteBuffer &buff)
|
void WardenWin::HandleHashResult(ByteBuffer &buff)
|
||||||
@ -154,8 +156,6 @@ void WardenWin::HandleHashResult(ByteBuffer &buff)
|
|||||||
_inputCrypto.Init(_inputKey);
|
_inputCrypto.Init(_inputKey);
|
||||||
_outputCrypto.Init(_outputKey);
|
_outputCrypto.Init(_outputKey);
|
||||||
|
|
||||||
_initialized = true;
|
|
||||||
|
|
||||||
_previousTimestamp = WorldTimer::getMSTime();
|
_previousTimestamp = WorldTimer::getMSTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,23 +305,20 @@ void WardenWin::RequestData()
|
|||||||
pkt.append(buff);
|
pkt.append(buff);
|
||||||
_session->SendPacket(&pkt);
|
_session->SendPacket(&pkt);
|
||||||
|
|
||||||
_dataSent = true;
|
|
||||||
|
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
stream << "Sent check id's: ";
|
stream << "Sent check id's: ";
|
||||||
for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr)
|
for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr)
|
||||||
stream << *itr << " ";
|
stream << *itr << " ";
|
||||||
|
|
||||||
sLog.outWarden("%s", stream.str().c_str());
|
sLog.outWarden("%s", stream.str().c_str());
|
||||||
|
|
||||||
|
Warden::RequestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WardenWin::HandleData(ByteBuffer &buff)
|
void WardenWin::HandleData(ByteBuffer &buff)
|
||||||
{
|
{
|
||||||
sLog.outWarden("Handle data");
|
sLog.outWarden("Handle data");
|
||||||
|
|
||||||
_dataSent = false;
|
|
||||||
_clientResponseTimer = 0;
|
|
||||||
|
|
||||||
uint16 Length;
|
uint16 Length;
|
||||||
buff >> Length;
|
buff >> Length;
|
||||||
uint32 Checksum;
|
uint32 Checksum;
|
||||||
|
@ -52,6 +52,13 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg
|
|||||||
{
|
{
|
||||||
if (lang != LANG_ADDON)
|
if (lang != LANG_ADDON)
|
||||||
{
|
{
|
||||||
|
//client can't send more than 255 character's, so if we break limit - that's cheater
|
||||||
|
if (msg.size() > 255)
|
||||||
|
{
|
||||||
|
sLog.outError("Player %s (GUID: %u) tries send a chatmessage with more than 255 symbols", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// strip invisible characters for non-addon messages
|
// strip invisible characters for non-addon messages
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_CHAT_FAKE_MESSAGE_PREVENTING))
|
if (sWorld.getConfig(CONFIG_BOOL_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||||
{ stripLineInvisibleChars(msg); }
|
{ stripLineInvisibleChars(msg); }
|
||||||
@ -93,7 +100,10 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||||||
SendNotification(LANG_UNKNOWN_LANGUAGE);
|
SendNotification(LANG_UNKNOWN_LANGUAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))
|
|
||||||
|
//prevent cheating, by sending LANG_UNIVERSAL
|
||||||
|
if ((langDesc->lang_id == LANG_UNIVERSAL && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT) && GetSecurity() == SEC_PLAYER) ||
|
||||||
|
(langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id)))
|
||||||
{
|
{
|
||||||
SendNotification(LANG_NOT_LEARNED_LANGUAGE);
|
SendNotification(LANG_NOT_LEARNED_LANGUAGE);
|
||||||
return;
|
return;
|
||||||
@ -103,7 +113,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||||||
{
|
{
|
||||||
// Disabled addon channel?
|
// Disabled addon channel?
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
|
if (!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
|
||||||
{ return; }
|
{ return; }
|
||||||
}
|
}
|
||||||
// LANG_ADDON should not be changed nor be affected by flood control
|
// LANG_ADDON should not be changed nor be affected by flood control
|
||||||
else
|
else
|
||||||
|
@ -4084,6 +4084,11 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
if (bg->GetStatus() == STATUS_WAIT_LEAVE)
|
if (bg->GetStatus() == STATUS_WAIT_LEAVE)
|
||||||
{ return SPELL_FAILED_DONT_REPORT; }
|
{ return SPELL_FAILED_DONT_REPORT; }
|
||||||
|
|
||||||
|
if (!m_IsTriggeredSpell && m_spellInfo->Id == 2479) //honorless target as non-triggered spell
|
||||||
|
{
|
||||||
|
return SPELL_FAILED_DONT_REPORT;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_IsTriggeredSpell && IsNonCombatSpell(m_spellInfo) &&
|
if (!m_IsTriggeredSpell && IsNonCombatSpell(m_spellInfo) &&
|
||||||
m_caster->IsInCombat())
|
m_caster->IsInCombat())
|
||||||
{ return SPELL_FAILED_AFFECTING_COMBAT; }
|
{ return SPELL_FAILED_AFFECTING_COMBAT; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user