mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Implemented encounter timers - no spawn required
This commit is contained in:
@@ -173,6 +173,11 @@ Beacon *Entity::CastToBeacon()
|
||||
return static_cast<Beacon *>(this);
|
||||
}
|
||||
|
||||
Encounter *Entity::CastToEncounter()
|
||||
{
|
||||
return static_cast<Encounter *>(this);
|
||||
}
|
||||
|
||||
const Client *Entity::CastToClient() const
|
||||
{
|
||||
if (this == 0x00) {
|
||||
@@ -263,6 +268,11 @@ const Beacon* Entity::CastToBeacon() const
|
||||
return static_cast<const Beacon *>(this);
|
||||
}
|
||||
|
||||
const Encounter* Entity::CastToEncounter() const
|
||||
{
|
||||
return static_cast<const Encounter *>(this);
|
||||
}
|
||||
|
||||
#ifdef BOTS
|
||||
Bot *Entity::CastToBot()
|
||||
{
|
||||
@@ -533,6 +543,21 @@ void EntityList::BeaconProcess()
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::EncounterProcess()
|
||||
{
|
||||
auto it = encounter_list.begin();
|
||||
while (it != encounter_list.end()) {
|
||||
if (!it->second->Process()) {
|
||||
safe_delete(it->second);
|
||||
free_ids.push(it->first);
|
||||
it = encounter_list.erase(it);
|
||||
}
|
||||
else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::AddGroup(Group *group)
|
||||
{
|
||||
if (group == nullptr) //this seems to be happening somehow...
|
||||
@@ -708,6 +733,12 @@ void EntityList::AddBeacon(Beacon *beacon)
|
||||
beacon_list.insert(std::pair<uint16, Beacon *>(beacon->GetID(), beacon));
|
||||
}
|
||||
|
||||
void EntityList::AddEncounter(Encounter *encounter)
|
||||
{
|
||||
encounter->SetID(GetFreeID());
|
||||
encounter_list.insert(std::pair<uint16, Encounter *>(encounter->GetID(), encounter));
|
||||
}
|
||||
|
||||
void EntityList::AddToSpawnQueue(uint16 entityid, NewSpawn_Struct **ns)
|
||||
{
|
||||
uint32 count;
|
||||
@@ -935,6 +966,11 @@ Entity *EntityList::GetEntityBeacon(uint16 id)
|
||||
return beacon_list.count(id) ? beacon_list.at(id) : nullptr;
|
||||
}
|
||||
|
||||
Entity *EntityList::GetEntityEncounter(uint16 id)
|
||||
{
|
||||
return encounter_list.count(id) ? encounter_list.at(id) : nullptr;
|
||||
}
|
||||
|
||||
Entity *EntityList::GetID(uint16 get_id)
|
||||
{
|
||||
Entity *ent = 0;
|
||||
@@ -950,6 +986,8 @@ Entity *EntityList::GetID(uint16 get_id)
|
||||
return ent;
|
||||
else if ((ent=entity_list.GetEntityBeacon(get_id)) != 0)
|
||||
return ent;
|
||||
else if ((ent = entity_list.GetEntityEncounter(get_id)) != 0)
|
||||
return ent;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -3424,6 +3462,15 @@ bool EntityList::IsMobInZone(Mob *who)
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
||||
auto enc_it = encounter_list.begin();
|
||||
while (enc_it != encounter_list.end()) {
|
||||
if (enc_it->second == who) {
|
||||
return true;
|
||||
}
|
||||
++enc_it;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user