This commit is contained in:
Kinglykrab 2019-10-31 23:38:21 -04:00
commit 40c835c576
7 changed files with 78 additions and 26 deletions

View File

@ -97,7 +97,7 @@ uint32 Database::CheckLogin(const char* name, const char* password, const char *
DoEscapeString(tmpUN, name, strlen(name));
DoEscapeString(tmpPW, password, strlen(password));
std::string query = StringFormat("SELECT id, status FROM account WHERE name='%s' AND ls_id='%s' AND password is not null "
std::string query = StringFormat("SELECT id, status FROM account WHERE `name`='%s' AND ls_id='%s' AND password is not null "
"and length(password) > 0 and (password='%s' or password=MD5('%s'))",
tmpUN, EscapeString(loginserver).c_str(), tmpPW, tmpPW);
@ -251,7 +251,7 @@ uint32 Database::CreateAccount(
}
bool Database::DeleteAccount(const char* name, const char *loginserver) {
std::string query = StringFormat("DELETE FROM account WHERE name='%s' AND ls_id='%s'", name, loginserver);
std::string query = StringFormat("DELETE FROM account WHERE `name`='%s' AND ls_id='%s'", name, loginserver);
LogInfo("Account Attempting to be deleted:'[{}]:[{}]'", loginserver, name);
auto results = QueryDatabase(query);
@ -1226,7 +1226,7 @@ uint32 Database::GetAccountIDFromLSID(
{
uint32 account_id = 0;
auto query = fmt::format(
"SELECT id, name, status FROM account WHERE lsaccount_id = {0} AND ls_id = '{1}'",
"SELECT id, `name`, status FROM account WHERE lsaccount_id = {0} AND ls_id = '{1}'",
in_loginserver_account_id,
in_loginserver_id
);
@ -1257,7 +1257,7 @@ uint32 Database::GetAccountIDFromLSID(
void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) {
std::string query = StringFormat("SELECT name, status FROM account WHERE id=%i", id);
std::string query = StringFormat("SELECT `name`, status FROM account WHERE id=%i", id);
auto results = QueryDatabase(query);
if (!results.Success()){

View File

@ -203,6 +203,10 @@ int EQ::Net::TCPConnection::LocalPort() const
std::string EQ::Net::TCPConnection::RemoteIP() const
{
if (!m_socket) {
return "";
}
sockaddr_storage addr;
int addr_len = sizeof(addr);
uv_tcp_getpeername(m_socket, (sockaddr*)&addr, &addr_len);

View File

@ -132,18 +132,36 @@ std::string SharedDatabase::GetMailKey(int CharID, bool key_only)
{
std::string query = StringFormat("SELECT `mailkey` FROM `character_data` WHERE `id`='%i' LIMIT 1", CharID);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log(Logs::Detail, Logs::MySQLError, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str());
return std::string();
}
auto row = results.begin();
std::string mail_key = row[0];
if (!results.RowCount()) {
if (mail_key.length() > 8 && key_only)
return mail_key.substr(8);
else
return mail_key;
Log(Logs::General, Logs::ClientLogin, "Error: Mailkey for character id [%i] does not exist or could not be found", CharID);
return std::string();
}
auto row = results.begin();
if (row != results.end()) {
std::string mail_key = row[0];
if (mail_key.length() > 8 && key_only) {
return mail_key.substr(8);
}
else {
return mail_key;
}
}
else {
Log(Logs::General, Logs::MySQLError, "Internal MySQL error in SharedDatabase::GetMailKey(int, bool)");
return std::string();
}
}
bool SharedDatabase::SaveCursor(uint32 char_id, std::list<EQEmu::ItemInstance*>::const_iterator &start, std::list<EQEmu::ItemInstance*>::const_iterator &end)

View File

@ -3061,6 +3061,7 @@ void command_texture(Client *c, const Seperator *sep)
{
uint16 texture;
if (sep->IsNumber(1) && atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 255) {
texture = atoi(sep->arg[1]);
uint8 helm = 0xFF;
@ -3072,9 +3073,9 @@ void command_texture(Client *c, const Seperator *sep)
{
c->SendTextureWC(i, texture);
}
else if ((c->GetTarget()->GetRace() > 0 && c->GetTarget()->GetRace() <= 12) ||
c->GetTarget()->GetRace() == 128 || c->GetTarget()->GetRace() == 130 ||
c->GetTarget()->GetRace() == 330 || c->GetTarget()->GetRace() == 522) {
else if ((c->GetTarget()->GetModel() > 0 && c->GetTarget()->GetModel() <= 12) ||
c->GetTarget()->GetModel() == 128 || c->GetTarget()->GetModel() == 130 ||
c->GetTarget()->GetModel() == 330 || c->GetTarget()->GetModel() == 522) {
for (i = EQEmu::textures::textureBegin; i <= EQEmu::textures::LastTintableTexture; i++)
{
c->GetTarget()->SendTextureWC(i, texture);
@ -3093,7 +3094,7 @@ void command_texture(Client *c, const Seperator *sep)
}
if ((c->GetTarget()) && (c->Admin() >= commandTextureOthers))
c->GetTarget()->SendIllusionPacket(c->GetTarget()->GetRace(), 0xFF, texture, helm);
c->GetTarget()->SendIllusionPacket(c->GetTarget()->GetModel(), 0xFF, texture, helm);
else
c->SendIllusionPacket(c->GetRace(), 0xFF, texture, helm);
}
@ -7430,11 +7431,11 @@ void command_roambox(Client *c, const Seperator *sep)
delay = {}
WHERE id = {}
),
box_size,
npc->GetX() - 100,
npc->GetX() + 100,
npc->GetY() - 100,
npc->GetY() + 100,
(box_size / 2),
npc->GetX() - (box_size / 2),
npc->GetX() + (box_size / 2),
npc->GetY() - (box_size / 2),
npc->GetY() + (box_size / 2),
delay,
spawn_group_id
);

View File

@ -1736,7 +1736,11 @@ void Mob::SendIllusionPacket(
uint32 new_drakkin_tattoo;
uint32 new_drakkin_details;
race = (in_race) ? in_race : GetBaseRace();
race = in_race;
if (race == 0)
{
race = (use_model) ? use_model : GetBaseRace();
}
if (in_gender != 0xFF)
{

View File

@ -449,6 +449,7 @@ public:
virtual inline uint16 GetDeity() const { return deity; }
virtual EQEmu::deity::DeityTypeBit GetDeityBit() { return EQEmu::deity::ConvertDeityTypeToDeityTypeBit((EQEmu::deity::DeityType)deity); }
inline uint16 GetRace() const { return race; }
inline uint16 GetModel() const { return (use_model == 0) ? race : use_model; }
inline uint8 GetGender() const { return gender; }
inline uint8 GetTexture() const { return texture; }
inline uint8 GetHelmTexture() const { return helmtexture; }

View File

@ -973,10 +973,12 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
chance = mod_tradeskill_chance(chance, spec);
if (((spec->tradeskill==75) || GetGM() || (chance > res)) || zone->random.Roll(aa_chance)) {
success_modifier = 1;
if(over_trivial < 0)
if (over_trivial < 0) {
CheckIncreaseTradeskill(bonusstat, stat_modifier, skillup_modifier, success_modifier, spec->tradeskill);
}
MessageString(Chat::LightBlue, TRADESKILL_SUCCEED, spec->name.c_str());
@ -984,21 +986,43 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
itr = spec->onsuccess.begin();
while(itr != spec->onsuccess.end() && !spec->quest) {
//should we check this crap?
SummonItem(itr->first, itr->second);
item = database.GetItem(itr->first);
if (this->GetGroup()) {
entity_list.MessageGroup(this, true, Chat::Skills, "%s has successfully fashioned %s!", GetName(), item->Name);
if (item) {
if (GetGroup()) {
entity_list.MessageGroup(this, true, Chat::Skills, "%s has successfully fashioned %s!", GetName(), item->Name);
}
}
else {
Log(
Logs::General,
Logs::Tradeskills,
StringFormat(
"Failure (null item pointer [id: %u, qty: %u]) :: recipe_id:%i tskillid:%i trivial:%i chance:%4.2f in zoneid:%i instid:%i",
itr->first,
itr->second,
spec->recipe_id,
spec->tradeskill,
spec->trivial,
chance,
this->GetZoneID(),
this->GetInstanceID()
).c_str()
);
}
/* QS: Player_Log_Trade_Skill_Events */
if (RuleB(QueryServ, PlayerLogTradeSkillEvents)){
if (RuleB(QueryServ, PlayerLogTradeSkillEvents)) {
std::string event_desc = StringFormat("Success :: fashioned recipe_id:%i tskillid:%i trivial:%i chance:%4.2f in zoneid:%i instid:%i", spec->recipe_id, spec->tradeskill, spec->trivial, chance, this->GetZoneID(), this->GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Trade_Skill_Events, this->CharacterID(), event_desc);
}
if(RuleB(TaskSystem, EnableTaskSystem))
if (RuleB(TaskSystem, EnableTaskSystem)) {
UpdateTasksForItem(ActivityTradeSkill, itr->first, itr->second);
}
++itr;
}
return(true);