mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +00:00
DelGlobal converted to QueryDatabase
This commit is contained in:
parent
87efd22394
commit
c6091c4f27
26
zone/mob.cpp
26
zone/mob.cpp
@ -3928,36 +3928,26 @@ void Mob::TarGlobal(const char *varname, const char *value, const char *duration
|
||||
}
|
||||
|
||||
void Mob::DelGlobal(const char *varname) {
|
||||
// delglobal(varname)
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
|
||||
int qgZoneid=zone->GetZoneID();
|
||||
int qgCharid=0;
|
||||
int qgNpcid=0;
|
||||
|
||||
if (this->IsNPC())
|
||||
{
|
||||
qgNpcid = this->GetNPCTypeID();
|
||||
}
|
||||
|
||||
if (this->IsClient())
|
||||
{
|
||||
qgCharid = this->CastToClient()->CharacterID();
|
||||
}
|
||||
else
|
||||
{
|
||||
qgCharid = -qgNpcid; // make char id negative npc id as a fudge
|
||||
}
|
||||
|
||||
if (!database.RunQuery(query,
|
||||
MakeAnyLenString(&query,
|
||||
"DELETE FROM quest_globals WHERE name='%s'"
|
||||
" && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)",
|
||||
varname,qgNpcid,qgCharid,qgZoneid),errbuf))
|
||||
{
|
||||
//_log(QUESTS, "DelGlobal error deleting %s : %s", varname, errbuf);
|
||||
}
|
||||
safe_delete_array(query);
|
||||
std::string query = StringFormat("DELETE FROM quest_globals "
|
||||
"WHERE name='%s' && (npcid=0 || npcid=%i) "
|
||||
"&& (charid=0 || charid=%i) "
|
||||
"&& (zoneid=%i || zoneid=0)",
|
||||
varname, qgNpcid, qgCharid, qgZoneid);
|
||||
|
||||
database.QueryDatabase(query);
|
||||
|
||||
if(zone)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user