mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Added GetGlobal() support for all Mobs.
- Uses memory (no database hits) - Allows entity-based quest global checks
This commit is contained in:
@@ -4202,6 +4202,39 @@ int32 Mob::GetItemStat(uint32 itemid, const char *identifier)
|
||||
return stat;
|
||||
}
|
||||
|
||||
std::string Mob::GetGlobal(const char *varname) {
|
||||
int qgCharid = 0;
|
||||
int qgNpcid = 0;
|
||||
|
||||
if (this->IsNPC())
|
||||
qgNpcid = this->GetNPCTypeID();
|
||||
|
||||
if (this->IsClient())
|
||||
qgCharid = this->CastToClient()->CharacterID();
|
||||
|
||||
QGlobalCache *qglobals = nullptr;
|
||||
std::list<QGlobal> globalMap;
|
||||
|
||||
if (this->IsClient())
|
||||
qglobals = this->CastToClient()->GetQGlobals();
|
||||
|
||||
if (this->IsNPC())
|
||||
qglobals = this->CastToNPC()->GetQGlobals();
|
||||
|
||||
if(qglobals)
|
||||
QGlobalCache::Combine(globalMap, qglobals->GetBucket(), qgNpcid, qgCharid, zone->GetZoneID());
|
||||
|
||||
std::list<QGlobal>::iterator iter = globalMap.begin();
|
||||
while(iter != globalMap.end()) {
|
||||
if ((*iter).name.compare(varname) == 0)
|
||||
return (*iter).value;
|
||||
|
||||
++iter;
|
||||
}
|
||||
|
||||
return "Undefined";
|
||||
}
|
||||
|
||||
void Mob::SetGlobal(const char *varname, const char *newvalue, int options, const char *duration, Mob *other) {
|
||||
|
||||
int qgZoneid = zone->GetZoneID();
|
||||
|
||||
Reference in New Issue
Block a user