This commit is contained in:
kentai 2019-03-16 17:27:08 +11:00
commit 6da0f84e18
2 changed files with 30 additions and 17 deletions

View File

@ -171,30 +171,27 @@ void Database::LoginIP(uint32 AccountID, const char* LoginIP) {
QueryDatabase(query); QueryDatabase(query);
} }
int16 Database::CheckStatus(uint32 account_id) { int16 Database::CheckStatus(uint32 account_id)
std::string query = StringFormat("SELECT `status`, UNIX_TIMESTAMP(`suspendeduntil`) as `suspendeduntil`, UNIX_TIMESTAMP() as `current`" {
" FROM `account` WHERE `id` = %i", account_id); std::string query = StringFormat(
"SELECT `status`, TIMESTAMPDIFF(SECOND, NOW(), `suspendeduntil`) FROM `account` WHERE `id` = %i",
account_id);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success())
return 0; return 0;
}
if (results.RowCount() != 1) if (results.RowCount() != 1)
return 0; return 0;
auto row = results.begin();
int16 status = atoi(row[0]);
int32 suspendeduntil = 0;
// MariaDB initalizes with NULL if unix_timestamp() is out of range auto row = results.begin();
if (row[1] != nullptr) { int16 status = atoi(row[0]);
suspendeduntil = atoi(row[1]); int32 date_diff = 0;
}
int32 current = atoi(row[2]); if (row[1] != nullptr)
date_diff = atoi(row[1]);
if(suspendeduntil > current) if (date_diff > 0)
return -1; return -1;
return status; return status;

View File

@ -100,6 +100,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "bot.h" #include "bot.h"
#endif #endif
#include "mob_movement_manager.h"
extern Zone* zone; extern Zone* zone;
@ -4818,7 +4819,22 @@ void Mob::Spin() {
safe_delete(outapp); safe_delete(outapp);
} }
else { else {
GMMove(GetX(), GetY(), GetZ(), GetHeading()+5); float x,y,z,h;
x=GetX();
y=GetY();
z=GetZ();
h=GetHeading()+5;
if (IsCorpse() || (IsClient() && !IsAIControlled())) {
m_Position.x = x;
m_Position.y = y;
m_Position.z = z;
mMovementManager->SendCommandToClients(this, 0.0, 0.0, 0.0, 0.0, 0, ClientRangeAny);
}
else {
Teleport(glm::vec4(x, y, z, h));
}
} }
} }