Exemplo n.º 1
0
void CZoneInstance::DecreaseZoneCounter(CCharEntity* PChar)
{
    CInstance* instance = PChar->PInstance;

    if (instance)
    {
        instance->DecreaseZoneCounter(PChar);
        instance->DespawnPC(PChar);
        CharZoneOut(PChar);
        PChar->StatusEffectContainer->DelStatusEffectSilent(EFFECT_LEVEL_RESTRICTION);
        PChar->PInstance = nullptr;

        if (instance->CharListEmpty())
        {
            if (instance->Failed() || instance->Completed())
            {
                instanceList.erase(std::find(instanceList.begin(), instanceList.end(), instance));
                delete instance;
            }
            else
            {
                instance->SetWipeTime(server_clock::now());
            }
        }
    }
}
Exemplo n.º 2
0
void CZoneInstance::DecreaseZoneCounter(CCharEntity* PChar)
{
	CInstance* instance = PChar->PInstance;

	if (instance)
	{
		instance->DecreaseZoneCounter(PChar);
		instance->DespawnPC(PChar);
		CharZoneOut(PChar);
		PChar->PInstance = NULL;

		if (instance->CharListEmpty())
		{
			if (instance->Failed() || instance->Completed())
			{
				instanceList.erase(std::find(instanceList.begin(), instanceList.end(), instance));
				delete instance;
			}
			else
			{
				instance->SetWipeTime(instance->GetElapsedTime(gettick()));
			}
		}
	}
}
Exemplo n.º 3
0
void CZoneInstance::ZoneServer(time_point tick)
{
    auto it = instanceList.begin();
    while (it != instanceList.end())
    {
        CInstance* instance = *it;

        instance->ZoneServer(tick);
        instance->CheckTime(tick);

        if ((instance->Failed() || instance->Completed()) && instance->CharListEmpty())
        {
            it = instanceList.erase(it);
            delete instance;
            continue;
        }
        it++;
    }
}