mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +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) {
|
void Mob::DelGlobal(const char *varname) {
|
||||||
// delglobal(varname)
|
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
char *query = 0;
|
|
||||||
int qgZoneid=zone->GetZoneID();
|
int qgZoneid=zone->GetZoneID();
|
||||||
int qgCharid=0;
|
int qgCharid=0;
|
||||||
int qgNpcid=0;
|
int qgNpcid=0;
|
||||||
|
|
||||||
if (this->IsNPC())
|
if (this->IsNPC())
|
||||||
{
|
|
||||||
qgNpcid = this->GetNPCTypeID();
|
qgNpcid = this->GetNPCTypeID();
|
||||||
}
|
|
||||||
|
|
||||||
if (this->IsClient())
|
if (this->IsClient())
|
||||||
{
|
|
||||||
qgCharid = this->CastToClient()->CharacterID();
|
qgCharid = this->CastToClient()->CharacterID();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
qgCharid = -qgNpcid; // make char id negative npc id as a fudge
|
qgCharid = -qgNpcid; // make char id negative npc id as a fudge
|
||||||
}
|
|
||||||
|
|
||||||
if (!database.RunQuery(query,
|
std::string query = StringFormat("DELETE FROM quest_globals "
|
||||||
MakeAnyLenString(&query,
|
"WHERE name='%s' && (npcid=0 || npcid=%i) "
|
||||||
"DELETE FROM quest_globals WHERE name='%s'"
|
"&& (charid=0 || charid=%i) "
|
||||||
" && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)",
|
"&& (zoneid=%i || zoneid=0)",
|
||||||
varname,qgNpcid,qgCharid,qgZoneid),errbuf))
|
varname, qgNpcid, qgCharid, qgZoneid);
|
||||||
{
|
|
||||||
//_log(QUESTS, "DelGlobal error deleting %s : %s", varname, errbuf);
|
database.QueryDatabase(query);
|
||||||
}
|
|
||||||
safe_delete_array(query);
|
|
||||||
|
|
||||||
if(zone)
|
if(zone)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user