Example #1
0
File: aa.cpp Project: af4t/Server
void Client::ResetAlternateAdvancementTimers() {
	auto outapp = new EQApplicationPacket(OP_AAAction, sizeof(UseAA_Struct));
	UseAA_Struct* uaaout = (UseAA_Struct*)outapp->pBuffer;

	PTimerList::iterator c, e;
	c = p_timers.begin();
	e = p_timers.end();
	std::vector<int> r_timers;
	for(; c != e; ++c) {
		PersistentTimer *cur = c->second;
		if(cur->GetType() < pTimerAAStart || cur->GetType() > pTimerAAEnd)
			continue;
		//send timer
		uaaout->begin = 0;
		uaaout->end = static_cast<uint32>(time(nullptr));
		uaaout->ability = cur->GetType() - pTimerAAStart;
		r_timers.push_back(cur->GetType());
		QueuePacket(outapp);
	}

	for(auto &i : r_timers) {
		p_timers.Clear(&database, i);
	}

	safe_delete(outapp);
}
Example #2
0
//sends all AA timers.
void Client::SendAATimers() {
	//we dont use SendAATimer because theres no reason to allocate the EQApplicationPacket every time
	EQApplicationPacket* outapp = new EQApplicationPacket(OP_AAAction, sizeof(UseAA_Struct));
	UseAA_Struct* uaaout = (UseAA_Struct*)outapp->pBuffer;

	//EQMac sends timers for all the abilities you have, even if they have never been used.
	uint8 macaaid = 0;
	for (uint32 i = 0; i < MAX_PP_AA_ARRAY; i++)
	{
		if (aa[i]->AA > 0)
		{
			SendAA_Struct* aa2 = nullptr;
			aa2 = zone->FindAA(aa[i]->AA);
			if (aa2 && aa2->spell_refresh > 0)
			{
				int32 starttime = 0;
				PTimerList::iterator c, e;
				c = p_timers.begin();
				e = p_timers.end();
				for (; c != e; ++c) {
					PersistentTimer *cur = c->second;
					if (cur->GetType() < pTimerAAStart || cur->GetType() > pTimerAAEnd)
						continue;	//not an AA timer
					else if (cur->GetType() == pTimerAAStart + aa2->spell_type)
					{
						starttime = cur->GetStartTime();
						break;
					}
					uaaout->begin = starttime;
					uaaout->end = static_cast<uint32>(time(nullptr));
					uaaout->ability = zone->EmuToEQMacAA(aa2->id);
					QueuePacket(outapp);
					Log.Out(Logs::Detail, Logs::AA, "Sending out timer for AA: %i. Timer start: %i Timer end: %i Recast Time: %i", uaaout->ability, uaaout->begin, uaaout->end, aa2->spell_refresh);
				}
				uaaout->begin = starttime;
				uaaout->end = static_cast<uint32>(time(nullptr));
				uaaout->ability = zone->EmuToEQMacAA(aa2->id);
				QueuePacket(outapp);
				Log.Out(Logs::General, Logs::Status, "Sending out timer for AA: %i. Timer start: %i Timer end: %i Recast Time: %i", uaaout->ability, uaaout->begin, uaaout->end, aa2->spell_refresh);
			}
		}
	}

	safe_delete(outapp);
}
Example #3
0
File: aa.cpp Project: af4t/Server
//sends all AA timers.
void Client::SendAlternateAdvancementTimers() {
	//we dont use SendAATimer because theres no reason to allocate the EQApplicationPacket every time
	auto outapp = new EQApplicationPacket(OP_AAAction, sizeof(UseAA_Struct));
	UseAA_Struct* uaaout = (UseAA_Struct*)outapp->pBuffer;

	PTimerList::iterator c, e;
	c = p_timers.begin();
	e = p_timers.end();
	for(; c != e; ++c) {
		PersistentTimer *cur = c->second;
		if(cur->GetType() < pTimerAAStart || cur->GetType() > pTimerAAEnd)
			continue;	//not an AA timer
		//send timer
		uaaout->begin = cur->GetStartTime();
		uaaout->end = static_cast<uint32>(time(nullptr));
		uaaout->ability = cur->GetType() - pTimerAAStart; // uuaaout->ability is really a shared timer number
		QueuePacket(outapp);
	}

	safe_delete(outapp);
}