prerelease version + implemented logfile support
This commit is contained in:
parent
dda1afada0
commit
fa4385c74f
@ -158,9 +158,9 @@ bool VarSet::ReadVarsFromFile(std::string fn)
|
|||||||
vn=prefix+v;
|
vn=prefix+v;
|
||||||
vv=line.substr(pos+1,line.length()-1);
|
vv=line.substr(pos+1,line.length()-1);
|
||||||
Set(vn,vv);
|
Set(vn,vv);
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("DEBUG: Var import [%s] = %s\n",vn.c_str(),vv.c_str());
|
printf("DEBUG: Var import [%s] = %s\n",vn.c_str(),vv.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// else invalid line, must have '='
|
// else invalid line, must have '='
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ bool DefScriptPackage::SCpause(CmdSet Set){
|
|||||||
bool DefScriptPackage::SCSendChatMessage(CmdSet Set){
|
bool DefScriptPackage::SCSendChatMessage(CmdSet Set){
|
||||||
if(!(((PseuInstance*)parentMethod)->GetWSession() && ((PseuInstance*)parentMethod)->GetWSession()->IsValid()))
|
if(!(((PseuInstance*)parentMethod)->GetWSession() && ((PseuInstance*)parentMethod)->GetWSession()->IsValid()))
|
||||||
{
|
{
|
||||||
printf("Invalid Script call: SCSendChatMessage: WorldSession not valid\n");
|
log("Invalid Script call: SCSendChatMessage: WorldSession not valid");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@ -64,7 +64,7 @@ bool DefScriptPackage::SCemote(CmdSet Set){
|
|||||||
return true;
|
return true;
|
||||||
if(!(((PseuInstance*)parentMethod)->GetWSession() && ((PseuInstance*)parentMethod)->GetWSession()->IsValid()))
|
if(!(((PseuInstance*)parentMethod)->GetWSession() && ((PseuInstance*)parentMethod)->GetWSession()->IsValid()))
|
||||||
{
|
{
|
||||||
printf("Invalid Script call: SCEmote: WorldSession not valid\n");
|
log("Invalid Script call: SCEmote: WorldSession not valid");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint32 id=atoi(Set.defaultarg.c_str());
|
uint32 id=atoi(Set.defaultarg.c_str());
|
||||||
@ -103,7 +103,7 @@ void DefScriptPackage::My_LoadUserPermissions(VarSet &vs)
|
|||||||
{
|
{
|
||||||
usr = variables[i].name.substr(strlen(prefix), variables[i].name.length() - strlen(prefix));
|
usr = variables[i].name.substr(strlen(prefix), variables[i].name.length() - strlen(prefix));
|
||||||
my_usrPermissionMap[usr] = atoi(variables[i].value.c_str());
|
my_usrPermissionMap[usr] = atoi(variables[i].value.c_str());
|
||||||
DEBUG( printf("Player '%s' permission = %u\n",usr.c_str(),atoi(variables[i].value.c_str())); )
|
DEBUG( log("Player '%s' permission = %u",usr.c_str(),atoi(variables[i].value.c_str())); )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,6 +68,7 @@ PseuInstance::~PseuInstance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PseuInstance::Init(void) {
|
bool PseuInstance::Init(void) {
|
||||||
|
log_prepare("logfile.txt",this);
|
||||||
|
|
||||||
if(_confdir.empty())
|
if(_confdir.empty())
|
||||||
_confdir="./conf/";
|
_confdir="./conf/";
|
||||||
@ -78,7 +79,7 @@ bool PseuInstance::Init(void) {
|
|||||||
RAND_set_rand_method(RAND_SSLeay()); // init openssl randomizer
|
RAND_set_rand_method(RAND_SSLeay()); // init openssl randomizer
|
||||||
|
|
||||||
if(SDL_Init(0)==-1) {
|
if(SDL_Init(0)==-1) {
|
||||||
printf("SDL_Init: %s\n", SDL_GetError());
|
log("SDL_Init: %s", SDL_GetError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,53 +87,57 @@ bool PseuInstance::Init(void) {
|
|||||||
_scp->SetParentMethod((void*)this);
|
_scp->SetParentMethod((void*)this);
|
||||||
_conf=new PseuInstanceConf();
|
_conf=new PseuInstanceConf();
|
||||||
|
|
||||||
|
log("Reading PseuWoW.conf...");
|
||||||
if(!_scp->variables.ReadVarsFromFile(_confdir + "PseuWoW.conf"))
|
if(!_scp->variables.ReadVarsFromFile(_confdir + "PseuWoW.conf"))
|
||||||
{
|
{
|
||||||
printf("Error reading conf file [%s]",_confdir.append("PseuWoW.conf").c_str());
|
log("Error reading conf file [%s]",_confdir.append("PseuWoW.conf").c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
logdetail("Applying configuration...");
|
||||||
_conf->ApplyFromVarSet(_scp->variables);
|
_conf->ApplyFromVarSet(_scp->variables);
|
||||||
|
|
||||||
|
log("Reading user permissions...");
|
||||||
if(_scp->variables.ReadVarsFromFile(_confdir + "users.conf"))
|
if(_scp->variables.ReadVarsFromFile(_confdir + "users.conf"))
|
||||||
{
|
{
|
||||||
printf("-> Done reading users.\n");
|
log("-> Done reading users.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Error reading conf file [%s] - NO PERMISSIONS SET!\n",_confdir.append("users.conf").c_str());
|
log("Error reading conf file [%s] - NO PERMISSIONS SET!",_confdir.append("users.conf").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// //DEBUG1(printf("Main_Init: Setting up DefScripts path '%s'\n",defScpPath.c_str()););
|
logdebug("Setting up DefScripts path '%s'",_scpdir.c_str());
|
||||||
_scp->SetPath(_scpdir);
|
_scp->SetPath(_scpdir);
|
||||||
|
|
||||||
// //DEBUG1(printf("Main_Init: Setting up predefined DefScript macros...\n"););
|
logdebug("Setting up predefined DefScript macros...");
|
||||||
_scp->variables.Set("@version_short",_ver_short);
|
_scp->variables.Set("@version_short",_ver_short);
|
||||||
_scp->variables.Set("@version",_ver);
|
_scp->variables.Set("@version",_ver);
|
||||||
|
|
||||||
|
logdetail("Applying user permissions...");
|
||||||
_scp->My_LoadUserPermissions(_scp->variables);
|
_scp->My_LoadUserPermissions(_scp->variables);
|
||||||
|
|
||||||
|
log("Loading DefScripts from folder '%s'",_scpdir.c_str());
|
||||||
// //DEBUG1(printf("Main_Init: Loading DefScripts from folder '%s'\n",defScpPath.c_str()););
|
|
||||||
if(!_scp->RunScript("_startup",NULL))
|
if(!_scp->RunScript("_startup",NULL))
|
||||||
{
|
{
|
||||||
printf("Main_Init: Error executing '_startup.def'\n");
|
printf("Error executing '_startup.def'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GetConf()->enablecli)
|
if(GetConf()->enablecli)
|
||||||
{
|
{
|
||||||
|
log("Starting CLI...");
|
||||||
_cli = new CliRunnable(this);
|
_cli = new CliRunnable(this);
|
||||||
ZThread::Thread t(_cli);
|
ZThread::Thread t(_cli);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_stop){
|
if(_stop){
|
||||||
printf("Errors while initializing, proc halted!!\n");
|
log("Errors while initializing, proc halted!!");
|
||||||
if(GetConf()->exitonerror)
|
if(GetConf()->exitonerror)
|
||||||
exit(0);
|
exit(0);
|
||||||
while(true)SDL_Delay(1000);
|
while(true)SDL_Delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(DEBUG)printf("Main_Init: Init complete.\n");
|
log("Init complete.\n");
|
||||||
_initialized=true;
|
_initialized=true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -167,10 +172,10 @@ void PseuInstance::Run(void)
|
|||||||
|
|
||||||
if(_fastquit)
|
if(_fastquit)
|
||||||
{
|
{
|
||||||
printf("Aborting Instance...\n");
|
log("Aborting Instance...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("Shutting down instance...\n");
|
log("Shutting down instance...");
|
||||||
|
|
||||||
SaveAllCache();
|
SaveAllCache();
|
||||||
|
|
||||||
@ -223,100 +228,6 @@ void PseuInstance::Sleep(uint32 msecs)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
printf("%s\n",ver);
|
|
||||||
for(unsigned int temp=0;temp<=strlen(ver);temp++)printf("~");printf("\n");
|
|
||||||
printf("[Compiled on: %s , %s]\n\n",__DATE__,__TIME__);
|
|
||||||
if (!initproc()) quitproc_error();
|
|
||||||
|
|
||||||
bool _auth_sent=false;
|
|
||||||
bool _first_wpacket=true;
|
|
||||||
clock_t ping_time=clock()-25000;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
|
|
||||||
if(something_went_wrong){
|
|
||||||
if(inworld){
|
|
||||||
SendChatMessage(CHAT_MSG_YELL,0,"ERROR! Something went wrong, exiting...","");
|
|
||||||
}
|
|
||||||
printf("!!! Something went wrong, proc halted.!!!\n");
|
|
||||||
ctrlCon.Close();
|
|
||||||
worldCon.Close();
|
|
||||||
realmCon.Close();
|
|
||||||
if(exitonerror)quitproc();
|
|
||||||
while(true)SDL_Delay(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !realmCon.IsConnected() && !worldCon.IsConnected() && !something_went_wrong){
|
|
||||||
printf("Opening realm TCP connection <%s:%d>\n",realmlist,rs_port);
|
|
||||||
while(!realmCon.ConnectTo(realmlist,rs_port));
|
|
||||||
_auth_sent=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(realmCon.IsConnected() && !worldCon.IsConnected() && !something_went_wrong){
|
|
||||||
if(!_auth_sent){
|
|
||||||
CLIENT_LOGON_CHALLENGE(accname, accpass);
|
|
||||||
_auth_sent=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(realmCon.HasData()){
|
|
||||||
Buf buf;
|
|
||||||
buf=realmCon.GetData();
|
|
||||||
rs_parser(buf.str,buf.len); // TODO: change type to Buf (also the func arg!)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while(worldCon.GetBufferLevel()>1){
|
|
||||||
////DEBUG3(
|
|
||||||
// printf("WS_IN, %d bytes. Buffer Level=%u\n",worldCon.GetKeepData().len,worldCon.GetBufferLevel());
|
|
||||||
// printchex(worldCon.GetKeepData().str,worldCon.GetKeepData().len,true);
|
|
||||||
//)
|
|
||||||
//_first_wpacket=false;
|
|
||||||
ByteBuffer pk2;
|
|
||||||
pk2.append(worldCon.GetDataString());
|
|
||||||
pk2.resize(pk2.size()-1);
|
|
||||||
HandleWorldPacket(pk2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// this covers the first serverseed packet, which get sometimes merged into 1 packet instead of 2
|
|
||||||
if(worldCon.HasData() && _first_wpacket && worldCon.GetKeepData().len==8){
|
|
||||||
_first_wpacket=false;
|
|
||||||
ByteBuffer pk2;
|
|
||||||
pk2.append(worldCon.GetDataString());
|
|
||||||
pk2.resize(pk2.size()-1);
|
|
||||||
HandleWorldPacket(pk2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(!worldCon.IsConnected() && inworld){
|
|
||||||
printf("Disconnected from World server!\n");
|
|
||||||
inworld=false;
|
|
||||||
_first_wpacket=true;
|
|
||||||
_auth_sent=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(clock()-ping_time>30000)
|
|
||||||
{
|
|
||||||
ping_time=clock();
|
|
||||||
SendPing(ping_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SDL_Delay(idleSleepTime);
|
|
||||||
if (error)return error;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _SaveAllCache(void){
|
|
||||||
bool result;
|
|
||||||
result=plrNameCache.SaveToFile();
|
|
||||||
// +++
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
PseuInstanceConf::PseuInstanceConf()
|
PseuInstanceConf::PseuInstanceConf()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#define _PSEUWOW_H
|
#define _PSEUWOW_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "log.h"
|
||||||
#include "Auth/BigNumber.h"
|
#include "Auth/BigNumber.h"
|
||||||
#include "DefScript/DefScript.h"
|
#include "DefScript/DefScript.h"
|
||||||
#include "Network/SocketHandler.h"
|
#include "Network/SocketHandler.h"
|
||||||
|
|||||||
@ -133,8 +133,6 @@ void RealmSocket::_HandleRealmList(void)
|
|||||||
uint8 cmd,count;
|
uint8 cmd,count;
|
||||||
realmbuf >> cmd >> len >> unk >> count;
|
realmbuf >> cmd >> len >> unk >> count;
|
||||||
|
|
||||||
printf("DEBUG: Realm cmd=%u, count=%u, size=%u, unk=%u\n",cmd,count,len,unk);
|
|
||||||
|
|
||||||
// no realm?
|
// no realm?
|
||||||
if(count==0)
|
if(count==0)
|
||||||
return;
|
return;
|
||||||
@ -163,16 +161,13 @@ void RealmSocket::_HandleRealmList(void)
|
|||||||
{
|
{
|
||||||
realmAddr=realms[i].addr_port;
|
realmAddr=realms[i].addr_port;
|
||||||
}
|
}
|
||||||
printf("Realm: %s (%s)",realms[i].name.c_str(),realms[i].addr_port.c_str());
|
log("Realm: %s (%s)",realms[i].name.c_str(),realms[i].addr_port.c_str());
|
||||||
printf("[chars:%d][population:%f][timezone:%d]",realms[i].chars_here,realms[i].population,realms[i].timezone);
|
logdetail(" [chars:%d][population:%f][timezone:%d]",realms[i].chars_here,realms[i].population,realms[i].timezone);
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now setup where the woldserver is and how to login there
|
// now setup where the woldserver is and how to login there
|
||||||
if(realmAddr.empty()){
|
if(realmAddr.empty()){
|
||||||
printf("Realm \"%s\" was not found on the realmlist!\n",GetInstance()->GetConf()->realmname.c_str());
|
log("Realm \"%s\" was not found on the realmlist!",GetInstance()->GetConf()->realmname.c_str());
|
||||||
//something_went_wrong=true;
|
|
||||||
//realmCon.Close();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +191,7 @@ void RealmSocket::OnRead(void)
|
|||||||
{
|
{
|
||||||
TcpSocket::OnRead();
|
TcpSocket::OnRead();
|
||||||
bool known=false;
|
bool known=false;
|
||||||
printf("RealmSocket::OnRead() %u bytes\n",ibuf.GetLength());
|
//printf("RealmSocket::OnRead() %u bytes\n",ibuf.GetLength());
|
||||||
if(!ibuf.GetLength())
|
if(!ibuf.GetLength())
|
||||||
return;
|
return;
|
||||||
uint8 cmd, i=0;
|
uint8 cmd, i=0;
|
||||||
@ -212,96 +207,17 @@ void RealmSocket::OnRead(void)
|
|||||||
}
|
}
|
||||||
if(!known)
|
if(!known)
|
||||||
{
|
{
|
||||||
printf("RealmSocket: Got unknown packet, cmd=%u\n",cmd);
|
log("RealmSocket: Got unknown packet, cmd=%u",cmd);
|
||||||
}
|
}
|
||||||
ibuf.Remove(ibuf.GetLength()); // if we have data crap left on the buf, delete it
|
ibuf.Remove(ibuf.GetLength()); // if we have data crap left on the buf, delete it
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
switch(rs_state){
|
|
||||||
unsigned int i;
|
|
||||||
case 1:{
|
|
||||||
if(pkt[2]==4){
|
|
||||||
printf("Realm Server did not find account \"%s\"!\n",accname);
|
|
||||||
something_went_wrong=true;
|
|
||||||
realmCon.Close();
|
|
||||||
} else
|
|
||||||
if(pkt[2]==6){
|
|
||||||
printf("Account \"%s\" is already logged in!\n",accname);
|
|
||||||
realmCon.Close();
|
|
||||||
something_went_wrong=true;
|
|
||||||
} else
|
|
||||||
if(pkt[2]!=0){
|
|
||||||
printf("Unknown realm server response! opcode=0x%x\n",(unsigned char)pkt[2]);
|
|
||||||
something_went_wrong=true;
|
|
||||||
realmCon.Close();
|
|
||||||
} else
|
|
||||||
if(pkt[2]==0){
|
|
||||||
//DEBUG1(printf("Login successful, now calculating proof packet...\n"););
|
|
||||||
ProcessClientLogonProof(pkt);
|
|
||||||
rs_state=2; // 2=waiting for server proof
|
|
||||||
}
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case 2:{
|
|
||||||
if(pkt[1]==4){
|
|
||||||
printf("Wrong password!\n");
|
|
||||||
something_went_wrong=true;
|
|
||||||
realmCon.Close();
|
|
||||||
} else
|
|
||||||
if(pkt[0]==1 && pkt[1]==0 && memcmp(&pkt[2],Auth_M2,20)!=0){
|
|
||||||
printf("Something with Authenticating went wrong, although the password seems correct!\n");
|
|
||||||
//DEBUG1(printf("-> expected M2=");printchex(Auth_M2,20,true);)
|
|
||||||
//DEBUG1(printf("-> got M2=");printchex(&pkt[2],20,true);)
|
|
||||||
something_went_wrong=true;
|
|
||||||
realmCon.Close();
|
|
||||||
} else
|
|
||||||
if(pkt[0]==1 && pkt[1]==0 && memcmp(&pkt[2],Auth_M2,20)==0){
|
|
||||||
printf("Password is correct!! Requesting Realmlist.\n");
|
|
||||||
rs_state=3; // requesting realmlist
|
|
||||||
// Request Realmlist
|
|
||||||
char realmrequest[]={0x10,0,0,0,0}; // 0x10 is opcode, rest is an uint32, nulled
|
|
||||||
realmCon.Send(realmrequest,5);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("Unknown ErrorID recieved, check the packet hexdump.\n");
|
|
||||||
printf("-> IDs=");printchex(pkt,2,true);
|
|
||||||
something_went_wrong=true;
|
|
||||||
realmCon.Close();
|
|
||||||
}
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case 3:{
|
|
||||||
if(pkt[0]!=0x10){
|
|
||||||
printf("Expected a realmlist packet, got something different. opcode=0x%x\n",(unsigned char)pkt[0]);
|
|
||||||
something_went_wrong=true;
|
|
||||||
realmCon.Close();
|
|
||||||
}
|
|
||||||
ByteBuffer bbuf;
|
|
||||||
bbuf.append(pkt,size);
|
|
||||||
if(HandleRealmList(bbuf)==true){
|
|
||||||
printf("Connecting to realm \"%s\" at \"%s\", port %d\n",realmname,worldhost.c_str(),ws_port);
|
|
||||||
while(!worldCon.IsConnected()){
|
|
||||||
worldCon.ConnectTo((char*)worldhost.c_str(),ws_port); // init world server connection, we have all info we need to enter
|
|
||||||
}
|
|
||||||
realmCon.Close(); // close the realm server connection, its no longer needed now
|
|
||||||
}
|
|
||||||
}break;
|
|
||||||
// more?
|
|
||||||
default:{
|
|
||||||
//...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void RealmSocket::SendLogonChallenge(void)
|
void RealmSocket::SendLogonChallenge(void)
|
||||||
{
|
{
|
||||||
if(!this->Ready())
|
if(!this->Ready())
|
||||||
{
|
{
|
||||||
printf("Error sending AUTH_LOGON_CHALLENGE, port is not ready!\n");
|
log("Error sending AUTH_LOGON_CHALLENGE, port is not ready!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string acc = stringToUpper(GetInstance()->GetConf()->accname);
|
std::string acc = stringToUpper(GetInstance()->GetConf()->accname);
|
||||||
@ -322,8 +238,6 @@ void RealmSocket::SendLogonChallenge(void)
|
|||||||
packet << (uint8)acc.length(); // length of acc name without \0
|
packet << (uint8)acc.length(); // length of acc name without \0
|
||||||
packet.append(acc.c_str(),acc.length()); // append accname, skip \0
|
packet.append(acc.c_str(),acc.length()); // append accname, skip \0
|
||||||
|
|
||||||
packet.hexlike();
|
|
||||||
|
|
||||||
SendBuf((char*)packet.contents(),packet.size());
|
SendBuf((char*)packet.contents(),packet.size());
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -335,21 +249,21 @@ PseuInstance *RealmSocket::GetInstance(void)
|
|||||||
|
|
||||||
void RealmSocket::_HandleLogonChallenge(void)
|
void RealmSocket::_HandleLogonChallenge(void)
|
||||||
{
|
{
|
||||||
printf("RealmSocket: Got AUTH_LOGON_CHALLENGE [%u of %u bytes]\n",ibuf.GetLength(),sizeof(sAuthLogonChallenge_S));
|
logdebug("RealmSocket: Got AUTH_LOGON_CHALLENGE [%u of %u bytes]",ibuf.GetLength(),sizeof(sAuthLogonChallenge_S));
|
||||||
sAuthLogonChallenge_S lc;
|
sAuthLogonChallenge_S lc;
|
||||||
ibuf.Read((char*)&lc, sizeof(sAuthLogonChallenge_S));
|
ibuf.Read((char*)&lc, sizeof(sAuthLogonChallenge_S));
|
||||||
|
|
||||||
switch (lc.error)
|
switch (lc.error)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
printf("Realm Server did not find account \"%s\"!\n",GetInstance()->GetConf()->accname.c_str());
|
log("Realm Server did not find account \"%s\"!",GetInstance()->GetConf()->accname.c_str());
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
printf("Account \"%s\" is already logged in!\n",GetInstance()->GetConf()->accname.c_str());
|
log("Account \"%s\" is already logged in!",GetInstance()->GetConf()->accname.c_str());
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
printf("Login successful, now calculating proof packet...\n");
|
logdetail("Login successful, now calculating proof packet...");
|
||||||
|
|
||||||
// now lets start calculating
|
// now lets start calculating
|
||||||
BigNumber N,A,B,a,u,x,v,S,salt,unk1,g,k(3); // init BNs, default k to 3
|
BigNumber N,A,B,a,u,x,v,S,salt,unk1,g,k(3); // init BNs, default k to 3
|
||||||
@ -362,17 +276,6 @@ void RealmSocket::_HandleLogonChallenge(void)
|
|||||||
salt.SetBinary(lc.salt,32);
|
salt.SetBinary(lc.salt,32);
|
||||||
unk1.SetBinary(lc.unk3,16);
|
unk1.SetBinary(lc.unk3,16);
|
||||||
|
|
||||||
/*
|
|
||||||
// debug output
|
|
||||||
//DEBUG3(printchex(B_str,BNLEN,true);)
|
|
||||||
//DEBUG3(printchex(g_str,1,true);)
|
|
||||||
//DEBUG3(printchex(N_str,BNLEN,true);)
|
|
||||||
//DEBUG3(printchex(salt_str,BNLEN,true);)
|
|
||||||
//DEBUG3(printchex(unk1_str,16,true);)
|
|
||||||
*/
|
|
||||||
|
|
||||||
// client-side BN calculations:
|
|
||||||
////DEBUG3(printf("--> k=%s\n",k.AsHexStr());)
|
|
||||||
a.SetRand(19*8);
|
a.SetRand(19*8);
|
||||||
Sha1Hash userhash,xhash,uhash;
|
Sha1Hash userhash,xhash,uhash;
|
||||||
userhash.UpdateData(_authstr);
|
userhash.UpdateData(_authstr);
|
||||||
@ -381,23 +284,23 @@ void RealmSocket::_HandleLogonChallenge(void)
|
|||||||
xhash.UpdateData(userhash.GetDigest(),userhash.GetLength());
|
xhash.UpdateData(userhash.GetDigest(),userhash.GetLength());
|
||||||
xhash.Finalize();
|
xhash.Finalize();
|
||||||
x.SetBinary(xhash.GetDigest(),xhash.GetLength());
|
x.SetBinary(xhash.GetDigest(),xhash.GetLength());
|
||||||
////DEBUG3(printf("--> x=%s\n",x.AsHexStr());)
|
logdebug("--> x=%s",x.AsHexStr());
|
||||||
v=g.ModExp(x,N);
|
v=g.ModExp(x,N);
|
||||||
////DEBUG3(printf("--> v=%s\n",v.AsHexStr());)
|
logdebug("--> v=%s",v.AsHexStr());
|
||||||
A=g.ModExp(a,N);
|
A=g.ModExp(a,N);
|
||||||
////DEBUG3(printf("--> A=%s\n",A.AsHexStr());)
|
logdebug("--> A=%s",A.AsHexStr());
|
||||||
uhash.UpdateBigNumbers(&A, &B, NULL);
|
uhash.UpdateBigNumbers(&A, &B, NULL);
|
||||||
uhash.Finalize();
|
uhash.Finalize();
|
||||||
u.SetBinary(uhash.GetDigest(), 20);
|
u.SetBinary(uhash.GetDigest(), 20);
|
||||||
////DEBUG3(printf("--> u=%s\n",u.AsHexStr());)
|
logdebug("--> u=%s",u.AsHexStr());
|
||||||
S=(B - k*g.ModExp(x,N) ).ModExp((a + u * x),N);
|
S=(B - k*g.ModExp(x,N) ).ModExp((a + u * x),N);
|
||||||
////DEBUG3(printf("--> S=%s\n",S.AsHexStr());)
|
logdebug("--> S=%s",S.AsHexStr());
|
||||||
|
|
||||||
// calc M1 & M2
|
// calc M1 & M2
|
||||||
unsigned int i=0;
|
unsigned int i=0;
|
||||||
char S1[16+1],S2[16+1]; // 32/2=16 :) +1 for \0
|
char S1[16+1],S2[16+1]; // 32/2=16 :) +1 for \0
|
||||||
// split it into 2 seperate strings, interleaved
|
// split it into 2 seperate strings, interleaved
|
||||||
for(i=0;i<=15;i++){
|
for(i=0;i<16;i++){
|
||||||
S1[i]=S.AsByteArray()[i*2];
|
S1[i]=S.AsByteArray()[i*2];
|
||||||
S2[i]=S.AsByteArray()[i*2+1];
|
S2[i]=S.AsByteArray()[i*2+1];
|
||||||
}
|
}
|
||||||
@ -445,10 +348,8 @@ void RealmSocket::_HandleLogonChallenge(void)
|
|||||||
M2hash.Finalize();
|
M2hash.Finalize();
|
||||||
|
|
||||||
|
|
||||||
////DEBUG3(
|
//logdebug("--> M1=");printchex((char*)M1hash.GetDigest(),20,true);
|
||||||
printf("--> M1=");printchex((char*)M1hash.GetDigest(),20,true);
|
//logdebug("--> M2=");printchex((char*)M2hash.GetDigest(),20,true);
|
||||||
printf("--> M2=");printchex((char*)M2hash.GetDigest(),20,true);
|
|
||||||
//)
|
|
||||||
|
|
||||||
// Calc CRC & CRC_hash
|
// Calc CRC & CRC_hash
|
||||||
// i don't know yet how to calc it, so set it to zero
|
// i don't know yet how to calc it, so set it to zero
|
||||||
@ -475,7 +376,7 @@ void RealmSocket::_HandleLogonChallenge(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Unknown realm server response! opcode=0x%x\n",(unsigned char)lc.error);
|
log("Unknown realm server response! opcode=0x%x\n",(unsigned char)lc.error);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -483,10 +384,10 @@ void RealmSocket::_HandleLogonChallenge(void)
|
|||||||
|
|
||||||
void RealmSocket::_HandleLogonProof(void)
|
void RealmSocket::_HandleLogonProof(void)
|
||||||
{
|
{
|
||||||
printf("RealmSocket: Got AUTH_LOGON_PROOF [%u of %u bytes]\n",ibuf.GetLength(),26);
|
logdetail("RealmSocket: Got AUTH_LOGON_PROOF [%u of %u bytes]\n",ibuf.GetLength(),26);
|
||||||
sAuthLogonProof_S lp;
|
sAuthLogonProof_S lp;
|
||||||
ibuf.Read((char*)&lp, 26); // the compiler didnt like 'sizeof(sAuthLogonProof_S)', said it was 28
|
ibuf.Read((char*)&lp, 26); // the compiler didnt like 'sizeof(sAuthLogonProof_S)', said it was 28
|
||||||
printchex((char*)&lp, sizeof(sAuthLogonProof_S),true);
|
//printchex((char*)&lp, sizeof(sAuthLogonProof_S),true);
|
||||||
if(!memcmp(lp.M2,this->_m2,20))
|
if(!memcmp(lp.M2,this->_m2,20))
|
||||||
{
|
{
|
||||||
// auth successful
|
// auth successful
|
||||||
@ -497,7 +398,7 @@ void RealmSocket::_HandleLogonProof(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Auth failed, M2 differs!\n");
|
log("Auth failed, M2 differs!");
|
||||||
printf("My M2 :"); printchex((char*)_m2,20,true);
|
printf("My M2 :"); printchex((char*)_m2,20,true);
|
||||||
printf("Srv M2:"); printchex((char*)lp.M2,20,true);
|
printf("Srv M2:"); printchex((char*)lp.M2,20,true);
|
||||||
|
|
||||||
@ -506,12 +407,12 @@ void RealmSocket::_HandleLogonProof(void)
|
|||||||
|
|
||||||
void RealmSocket::OnConnect()
|
void RealmSocket::OnConnect()
|
||||||
{
|
{
|
||||||
printf("DEBUG: RealmSocket connected!\n");
|
logdetail("RealmSocket connected!");
|
||||||
SendLogonChallenge();
|
SendLogonChallenge();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RealmSocket::OnConnectFailed(void)
|
void RealmSocket::OnConnectFailed(void)
|
||||||
{
|
{
|
||||||
printf("RealmSocket::OnConnectFailed()\n");
|
log("Connecting to Realm failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,6 @@ void WorldSession::SendChatMessage(uint32 type, uint32 lang, std::string msg, st
|
|||||||
case CHAT_MSG_GUILD:
|
case CHAT_MSG_GUILD:
|
||||||
case CHAT_MSG_OFFICER: // not sure about that
|
case CHAT_MSG_OFFICER: // not sure about that
|
||||||
packet<<msg;
|
packet<<msg;
|
||||||
//DEBUG2(printf("W:CHAT->: \"%s\"\n",msg.c_str()););
|
|
||||||
break;
|
break;
|
||||||
case CHAT_MSG_WHISPER:
|
case CHAT_MSG_WHISPER:
|
||||||
if(to.empty())
|
if(to.empty())
|
||||||
@ -51,7 +50,7 @@ void WorldSession::SendPing(uint32 ping){
|
|||||||
packet << ping;
|
packet << ping;
|
||||||
packet.SetOpcode(CMSG_PING);
|
packet.SetOpcode(CMSG_PING);
|
||||||
SendWorldPacket(packet);
|
SendWorldPacket(packet);
|
||||||
//DEBUG2(printf("Sent CMSG_PING, clock=%u\n",ping););
|
logdebug("Sent CMSG_PING, clock=%u",ping);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendEmote(uint32 id){
|
void WorldSession::SendEmote(uint32 id){
|
||||||
|
|||||||
@ -38,13 +38,13 @@ uint64 PlayerNameCache::GetGuid(std::string name){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerNameCache::SaveToFile(void){
|
bool PlayerNameCache::SaveToFile(void){
|
||||||
printf("Saving PlayerNameCache...\n");
|
log("Saving PlayerNameCache...");
|
||||||
char *fn="./cache/playernames.cache";
|
char *fn="./cache/playernames.cache";
|
||||||
std::fstream fh;
|
std::fstream fh;
|
||||||
fh.open(fn, std::ios_base::out | std::ios_base::binary);
|
fh.open(fn, std::ios_base::out | std::ios_base::binary);
|
||||||
if(!fh)
|
if(!fh)
|
||||||
{
|
{
|
||||||
printf("ERROR: could not write to file '%s'!\n",fn);
|
log("ERROR: could not write to file '%s'!",fn);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint32 size=_cache.size();
|
uint32 size=_cache.size();
|
||||||
@ -59,22 +59,22 @@ bool PlayerNameCache::SaveToFile(void){
|
|||||||
len=(*i)->_name.length();
|
len=(*i)->_name.length();
|
||||||
fh.write( (char*)&len,sizeof(uint8) );
|
fh.write( (char*)&len,sizeof(uint8) );
|
||||||
fh.write( (char*)(*i)->_name.c_str(),len );
|
fh.write( (char*)(*i)->_name.c_str(),len );
|
||||||
DEBUG(printf( "PlayerNameCache << " I64FMT " -> %s\n", (*i)->_guid, (*i)->_name.c_str()););
|
DEBUG(log( "PlayerNameCache << " I64FMT " -> %s", (*i)->_guid, (*i)->_name.c_str()););
|
||||||
}
|
}
|
||||||
fh.close();
|
fh.close();
|
||||||
printf("PlayerNameCache saved successfully.\n");
|
log("PlayerNameCache saved successfully.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerNameCache::ReadFromFile(void){
|
bool PlayerNameCache::ReadFromFile(void){
|
||||||
char *fn="./cache/playernames.cache";
|
char *fn="./cache/playernames.cache";
|
||||||
printf("Loading PlayerNameCache...\n");
|
log("Loading PlayerNameCache...");
|
||||||
bool success=true;
|
bool success=true;
|
||||||
std::fstream fh;
|
std::fstream fh;
|
||||||
fh.open(fn, std::ios_base::in | std::ios_base::binary);
|
fh.open(fn, std::ios_base::in | std::ios_base::binary);
|
||||||
if(!fh)
|
if(!fh)
|
||||||
{
|
{
|
||||||
printf("ERROR: could not open file '%s'!\n",fn);
|
log("ERROR: could not open file '%s'!",fn);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint32 size;
|
uint32 size;
|
||||||
@ -90,8 +90,8 @@ bool PlayerNameCache::ReadFromFile(void){
|
|||||||
fh.read((char*)&(cacheItem->_guid),sizeof(uint64));
|
fh.read((char*)&(cacheItem->_guid),sizeof(uint64));
|
||||||
fh.read((char*)&len,sizeof(uint8));
|
fh.read((char*)&len,sizeof(uint8));
|
||||||
if(len>12 || len<2){
|
if(len>12 || len<2){
|
||||||
printf("\nERROR: PlayerNameCache data seem corrupt [namelength=%d, should be <=12}]\n",len);
|
log("\nERROR: PlayerNameCache data seem corrupt [namelength=%d, should be <=12}]",len);
|
||||||
printf("-> Clearing cache, creating new.\n");
|
log("-> Clearing cache, creating new.\n");
|
||||||
_cache.clear();
|
_cache.clear();
|
||||||
success=false;
|
success=false;
|
||||||
break;
|
break;
|
||||||
@ -106,7 +106,7 @@ bool PlayerNameCache::ReadFromFile(void){
|
|||||||
delete nameptr;
|
delete nameptr;
|
||||||
fh.close();
|
fh.close();
|
||||||
if(success)
|
if(success)
|
||||||
printf("PlayerNameCache successfully loaded.\n");
|
log("PlayerNameCache successfully loaded.");
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ WorldSession::~WorldSession()
|
|||||||
|
|
||||||
void WorldSession::Start(void)
|
void WorldSession::Start(void)
|
||||||
{
|
{
|
||||||
printf("Connecting to '%s' on port %u\n",GetInstance()->GetConf()->worldhost.c_str(),GetInstance()->GetConf()->worldport);
|
log("Connecting to '%s' on port %u",GetInstance()->GetConf()->worldhost.c_str(),GetInstance()->GetConf()->worldport);
|
||||||
_socket->Open(GetInstance()->GetConf()->worldhost,GetInstance()->GetConf()->worldport);
|
_socket->Open(GetInstance()->GetConf()->worldhost,GetInstance()->GetConf()->worldport);
|
||||||
GetInstance()->GetRSession()->SetCloseAndDelete(); // realm socket is no longer needed
|
GetInstance()->GetRSession()->SetCloseAndDelete(); // realm socket is no longer needed
|
||||||
_valid=true;
|
_valid=true;
|
||||||
@ -108,7 +108,7 @@ void WorldSession::Update(void)
|
|||||||
|| ((!known) && GetInstance()->GetConf()->showopcodes==2)
|
|| ((!known) && GetInstance()->GetConf()->showopcodes==2)
|
||||||
|| (GetInstance()->GetConf()->showopcodes==3) )
|
|| (GetInstance()->GetConf()->showopcodes==3) )
|
||||||
{
|
{
|
||||||
printf(">> Opcode %u [%s]\n",packet->GetOpcode(),LookupName(packet->GetOpcode(),g_worldOpcodeNames));
|
log(">> Opcode %u [%s]",packet->GetOpcode(),LookupName(packet->GetOpcode(),g_worldOpcodeNames));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ void WorldSession::_HandleAuthChallengeOpcode(WorldPacket& recvPacket)
|
|||||||
std::string acc = stringToUpper(GetInstance()->GetConf()->accname);
|
std::string acc = stringToUpper(GetInstance()->GetConf()->accname);
|
||||||
uint32 serverseed;
|
uint32 serverseed;
|
||||||
recvPacket >> serverseed;
|
recvPacket >> serverseed;
|
||||||
printf("W:auth: serverseed=0x%X\n",serverseed);
|
logdebug("Auth: serverseed=0x%X",serverseed);
|
||||||
Sha1Hash digest;
|
Sha1Hash digest;
|
||||||
digest.UpdateData(acc);
|
digest.UpdateData(acc);
|
||||||
uint32 unk=0;
|
uint32 unk=0;
|
||||||
@ -235,10 +235,6 @@ void WorldSession::_HandleAuthChallengeOpcode(WorldPacket& recvPacket)
|
|||||||
auth<<(uint32)0; // no addons? no idea, but seems to work. MaNGOS doesnt accept without this.
|
auth<<(uint32)0; // no addons? no idea, but seems to work. MaNGOS doesnt accept without this.
|
||||||
auth.SetOpcode(CMSG_AUTH_SESSION);
|
auth.SetOpcode(CMSG_AUTH_SESSION);
|
||||||
|
|
||||||
//DEBUG3(
|
|
||||||
// printf("CMSG_AUTH_SESSION=");
|
|
||||||
// printchex((char*)outpkt.contents(),outpkt.size(),true);
|
|
||||||
//)
|
|
||||||
SendWorldPacket(auth);
|
SendWorldPacket(auth);
|
||||||
|
|
||||||
// note that if the sessionkey/auth is wrong or failed, the server sends the following packet UNENCRYPTED!
|
// note that if the sessionkey/auth is wrong or failed, the server sends the following packet UNENCRYPTED!
|
||||||
@ -254,12 +250,12 @@ void WorldSession::_HandleAuthResponseOpcode(WorldPacket& recvPacket)
|
|||||||
uint8 errcode;
|
uint8 errcode;
|
||||||
recvPacket >> errcode;
|
recvPacket >> errcode;
|
||||||
if(errcode==0xC){
|
if(errcode==0xC){
|
||||||
//DEBUG1(printf("World Authentication successful, preparing for char list request...\n"););
|
logdetail("World Authentication successful, preparing for char list request...");
|
||||||
WorldPacket pkt;
|
WorldPacket pkt;
|
||||||
pkt.SetOpcode(CMSG_CHAR_ENUM);
|
pkt.SetOpcode(CMSG_CHAR_ENUM);
|
||||||
SendWorldPacket(pkt);
|
SendWorldPacket(pkt);
|
||||||
} else {
|
} else {
|
||||||
printf("World Authentication failed, errcode=0x%X\n",(unsigned char)errcode);
|
log("World Authentication failed, errcode=0x%X",(unsigned char)errcode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,11 +268,11 @@ void WorldSession::_HandleCharEnumOpcode(WorldPacket& recvPacket)
|
|||||||
|
|
||||||
recvPacket >> num;
|
recvPacket >> num;
|
||||||
if(num==0){
|
if(num==0){
|
||||||
printf("W:No chars found!\n");
|
log("No chars found!\n");
|
||||||
GetInstance()->Stop();
|
GetInstance()->Stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("W: Chars in list: %u\n",num);
|
logdetail("W: Chars in list: %u\n",num);
|
||||||
for(unsigned int i=0;i<num;i++){
|
for(unsigned int i=0;i<num;i++){
|
||||||
recvPacket >> plr[i]._guid;
|
recvPacket >> plr[i]._guid;
|
||||||
recvPacket >> plr[i]._name;
|
recvPacket >> plr[i]._name;
|
||||||
@ -308,10 +304,10 @@ void WorldSession::_HandleCharEnumOpcode(WorldPacket& recvPacket)
|
|||||||
}
|
}
|
||||||
bool char_found=false;
|
bool char_found=false;
|
||||||
for(unsigned int i=0;i<num;i++){
|
for(unsigned int i=0;i<num;i++){
|
||||||
printf("## %s (%u) [%s/%s]\n",
|
log("## %s (%u) [%s/%s]",
|
||||||
plr[i]._name.c_str(),plr[i]._level,raceName[plr[i]._race],className[plr[i]._class]);
|
plr[i]._name.c_str(),plr[i]._level,raceName[plr[i]._race],className[plr[i]._class]);
|
||||||
//DEBUG1(printf("-> coords: map=%u zone=%u x=%f y=%f z=%f\n",
|
logdetail("-> coords: map=%u zone=%u x=%f y=%f z=%f",
|
||||||
// plr[i]._mapId,plr[i]._zoneId,plr[i]._x,plr[i]._y,plr[i]._z);)
|
plr[i]._mapId,plr[i]._zoneId,plr[i]._x,plr[i]._y,plr[i]._z);
|
||||||
if(plr[i]._name==GetInstance()->GetConf()->charname){
|
if(plr[i]._name==GetInstance()->GetConf()->charname){
|
||||||
char_found=true;
|
char_found=true;
|
||||||
_myGUID=plr[i]._guid;
|
_myGUID=plr[i]._guid;
|
||||||
@ -319,11 +315,11 @@ void WorldSession::_HandleCharEnumOpcode(WorldPacket& recvPacket)
|
|||||||
|
|
||||||
}
|
}
|
||||||
if(!char_found){
|
if(!char_found){
|
||||||
printf("W: Character \"%s\" was not found on char list!\n",GetInstance()->GetConf()->charname.c_str());
|
log("Character \"%s\" was not found on char list!",GetInstance()->GetConf()->charname.c_str());
|
||||||
GetInstance()->Stop();
|
GetInstance()->Stop();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
printf("W: Entering World with Character \"%s\"...\n",GetInstance()->GetConf()->charname.c_str());
|
log("Entering World with Character \"%s\"...",GetInstance()->GetConf()->charname.c_str());
|
||||||
WorldPacket pkt;
|
WorldPacket pkt;
|
||||||
pkt.SetOpcode(CMSG_PLAYER_LOGIN);
|
pkt.SetOpcode(CMSG_PLAYER_LOGIN);
|
||||||
pkt << _myGUID;
|
pkt << _myGUID;
|
||||||
@ -377,11 +373,11 @@ void WorldSession::_HandleMessageChatOpcode(WorldPacket& recvPacket)
|
|||||||
|
|
||||||
recvPacket >> msglen >> msg;
|
recvPacket >> msglen >> msg;
|
||||||
if (type == CHAT_MSG_SYSTEM){
|
if (type == CHAT_MSG_SYSTEM){
|
||||||
printf("W:SYSMSG: \"%s\"\n",msg.c_str());
|
log("SYSMSG: \"%s\"",msg.c_str());
|
||||||
} else if (type==CHAT_MSG_WHISPER ){
|
} else if (type==CHAT_MSG_WHISPER ){
|
||||||
printf("W:WHISP: %s [%s]: %s\n",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
log("W:WHISP: %s [%s]: %s",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
||||||
} else {
|
} else {
|
||||||
printf("W:CHAT: %s [%s]: %s\n",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
log("W:CHAT: %s [%s]: %s",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(target_guid!=_myGUID && msg.length()>1 && msg.at(0)=='-' && GetInstance()->GetConf()->allowgamecmd)
|
if(target_guid!=_myGUID && msg.length()>1 && msg.at(0)=='-' && GetInstance()->GetConf()->allowgamecmd)
|
||||||
@ -439,10 +435,9 @@ void WorldSession::_HandleNameQueryResponseOpcode(WorldPacket& recvPacket)
|
|||||||
// rest of the packet is not interesting for now
|
// rest of the packet is not interesting for now
|
||||||
if(plrNameCache.AddInfo(pguid,pname))
|
if(plrNameCache.AddInfo(pguid,pname))
|
||||||
{
|
{
|
||||||
printf("CACHE: Assigned new player name: '%s'",pname.c_str());
|
logdetail("CACHE: Assigned new player name: '%s' = " I64FMTD ,pname.c_str(),pguid);
|
||||||
SendChatMessage(CHAT_MSG_SAY,0,"Player "+pname+" added to cache.","");
|
if(GetInstance()->GetConf()->debug > 1)
|
||||||
//DEBUG2(printf(" to guid "I64FMTD,pguid););
|
SendChatMessage(CHAT_MSG_SAY,0,"Player "+pname+" added to cache.","");
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,7 +445,7 @@ void WorldSession::_HandlePongOpcode(WorldPacket& recvPacket)
|
|||||||
{
|
{
|
||||||
uint32 pong;
|
uint32 pong;
|
||||||
recvPacket >> pong;
|
recvPacket >> pong;
|
||||||
printf("Recieved Ping reply: %u ms latency.\n",clock()-pong);
|
log("Recieved Ping reply: %u ms latency.",clock()-pong);
|
||||||
}
|
}
|
||||||
void WorldSession::_HandleTradeStatusOpcode(WorldPacket& recvPacket)
|
void WorldSession::_HandleTradeStatusOpcode(WorldPacket& recvPacket)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -71,6 +71,7 @@ void abortproc(void)
|
|||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
printf("\n (C) 2006, Snowstorm Software\n\n\n");
|
||||||
|
|
||||||
_HookSignals();
|
_HookSignals();
|
||||||
|
|
||||||
|
|||||||
@ -159,6 +159,12 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\Client\DefScriptInterface.cpp">
|
RelativePath=".\Client\DefScriptInterface.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\log.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\log.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Client\main.cpp">
|
RelativePath=".\Client\main.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@ -26,6 +26,5 @@
|
|||||||
#include "DebugStuff.h"
|
#include "DebugStuff.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -197,7 +197,7 @@ std::string getDateString(void)
|
|||||||
{
|
{
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
tm* aTm = localtime(&t);
|
tm* aTm = localtime(&t);
|
||||||
char str[19];
|
char str[30];
|
||||||
// YYYY year
|
// YYYY year
|
||||||
// MM month (2 digits 01-12)
|
// MM month (2 digits 01-12)
|
||||||
// DD day (2 digits 01-31)
|
// DD day (2 digits 01-31)
|
||||||
@ -207,3 +207,4 @@ std::string getDateString(void)
|
|||||||
sprintf(str,"%-4d-%02d-%02d %02d:%02d:%02d ",aTm->tm_year+1900,aTm->tm_mon+1,aTm->tm_mday,aTm->tm_hour,aTm->tm_min,aTm->tm_sec);
|
sprintf(str,"%-4d-%02d-%02d %02d:%02d:%02d ",aTm->tm_year+1900,aTm->tm_mon+1,aTm->tm_mday,aTm->tm_hour,aTm->tm_min,aTm->tm_sec);
|
||||||
return std::string(str);
|
return std::string(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user