示例#1
0
文件: Quest.cpp 项目: Chero/abcwow
void QuestLogEntry::UpdatePlayerFields()
{
	if(!m_plr)
		return;

	uint32 base = GetBaseField(m_slot);
	m_plr->SetUInt32Value(base + 0, m_quest->id);

	// next field is kills and shit like that
	uint32 field1 = 0;
	int i;
	
	// explored areas
	if(m_quest->count_requiredtriggers)
	{
		uint32 count = 0;
		for(i = 0; i < 4; ++i)
		{
			if(m_quest->required_triggers[i])
			{
				if(m_explored_areas[i] == 1)
				{
					count++;
				}
			}
		}

		if(count == m_quest->count_requiredtriggers)
		{
			field1 |= 0x01000000;
		}
	}

	// mob hunting
	if(m_quest->count_required_mob)
	{
		/*uint8 cnt;
		for(int i = 0; i < 4; ++i)
		{
			if(m_quest->required_mob[i] && m_mobcount[i] > 0)
			{
				// 1 << (offset * 6)
				cnt = m_mobcount[i];
				field1 |= (cnt << (i*8));
			}
		}*/

		// optimized this - burlex
		uint8 * p = (uint8*)&field1;
		for(int i = 0; i < 4; ++i)
		{
			if( m_quest->required_mob[i] && m_mobcount[i] > 0 )
				p[i] |= (uint8)m_mobcount[i];
		}
	}

	m_plr->SetUInt32Value(base + 1, 0);
	m_plr->SetUInt32Value(base + 2, field1);
	m_plr->SetUInt32Value(base + 3, m_time_left);
}
示例#2
0
文件: Quest.cpp 项目: Goatform/ascent
void QuestLogEntry::Finish()
{
	uint32 base = GetBaseField(m_slot);
	m_plr->SetUInt32Value(base + 0, 0);
	m_plr->SetUInt32Value(base + 1, 0);
	m_plr->SetUInt32Value(base + 2, 0);

	// clear from player log
	m_plr->SetQuestLogSlot(NULL, m_slot);
	m_plr->PushToRemovedQuests(m_quest->id);

	// delete ourselves
	delete this;
}
示例#3
0
void QuestLogEntry::Fail( bool timerexpired ){
	sEventMgr.RemoveEvents( m_plr, EVENT_TIMED_QUEST_EXPIRE );

	completed = QUEST_FAILED;
	expirytime = 0;
	mDirty = true;
	
	uint32 base = GetBaseField( m_slot );
	m_plr->SetUInt32Value( base + 1, 2 );

	if( timerexpired )
		sQuestMgr.SendQuestUpdateFailedTimer( m_quest, m_plr );
	else
		sQuestMgr.SendQuestUpdateFailed( m_quest, m_plr );
}
示例#4
0
void QuestLogEntry::Finish()
{
	sEventMgr.RemoveEvents( m_plr, EVENT_TIMED_QUEST_EXPIRE );

	uint32 base = GetBaseField(m_slot);
	m_plr->SetUInt32Value(base + 0, 0);
	m_plr->SetUInt32Value(base + 1, 0);
	m_plr->SetUInt64Value(base + 2, 0);
	m_plr->SetUInt32Value(base + 4, 0);

	// clear from player log
	m_plr->SetQuestLogSlot(NULL, m_slot);
	m_plr->PushToRemovedQuests(m_quest->id);
	m_plr->UpdateNearbyGameObjects();
	// delete ourselves

	delete this;
}
示例#5
0
static void SetFonFlags(FonSpecInfo *specInfo, RecVersions *collection,
		RecRaster *recRast) {
	int i, j;
	welet *wel;
	uint32_t nField[NFIELDDWORD];
	Bool isInField;

	if (!specInfo)
		return;
	if (!FONCheckItself((uchar) specInfo->nLet, specInfo->nInCTB,
			specInfo->col, specInfo->row))
		return;

	if (collection->lnAltCnt > 1) {
		if (collection->Alt[0].Prob - collection->Alt[1].Prob < POROG_TWIN)
			specInfo->wFonFlags |= FFC_FON_TWIN;

		if (collection->Alt[0].Prob == collection->Alt[1].Prob
				&& collection->Alt[1].Code == specInfo->nLet) {
			RecAlt tmpAlt = collection->Alt[0];
			collection->Alt[0] = collection->Alt[1];
			collection->Alt[1] = tmpAlt;
		}
	}

	if (collection->lnAltCnt > 0) {
		if (specInfo->nLet) {
			if (collection->Alt[0].Code == specInfo->nLet)
				specInfo->wFonFlags |= FFC_FON_CONFIRMED;
			else
				specInfo->wFonFlags |= FFC_FON_CHANGE;
		}

		if (collection->Alt[0].Prob < POROG_ALERT)
			specInfo->wFonFlags |= FFC_FON_ALERT;
		return;
	}

	if (specInfo->nLet == 0)
		return;

	// test reject
	// translate to base fields
	if (GetBaseField(specInfo->nFieldRow, &fonbase, nField) == 0
			|| EmptyField(nField))
		return;
	// goto metkaAlert;

	isInField = FALSE;

	for (i = 0, j = 0, wel = fonbase.start; i < fonbase.inBase; i++, wel++) {
		if (!(wel->attr & FON_CLU_SOLID))
			continue;

		if (wel->let != specInfo->nLet)
			continue;

		// из одного поля ?
		if (!IntersectFields(nField, wel->fields))
		// из одного шрифта ?
		{
			int k, all = MIN(fonbase.countFont, 4);
			for (k = 0; k < all; k++) {
				if (IntersectFields ( nField, fonbase.fontFields[k] )
						&& IntersectFields ( wel->fields, fonbase.fontFields[k] ))
					break;
			}
			if (k >= all)
				continue;
		}

		j = i + 1;
		//  иных размеров ?
		if (abs(recRast->lnPixWidth - wel->mw) > POROG_WID_REJECT || abs(
				recRast->lnPixHeight - wel->mh) > POROG_HEI_REJECT)
			isInField = TRUE;
	}

	if (j == 0) // нет такой буквы
		return;

	//metkaAlert:
	// есть иной кластер ?
	if (isInField)
		specInfo->wFonFlags |= FFC_FON_REJECT;
	else
		// if(!goodHeight)
		specInfo->wFonFlags |= FFC_FON_ALERT;

	return;
}
示例#6
0
void QuestLogEntry::UpdatePlayerFields()
{
	if(!m_plr)
		return;

	uint32 base = GetBaseField(m_slot);
	m_plr->SetUInt32Value(base + 0, m_quest->id);
	uint32 field0 = 0; // 0x01000000 = "Objective Complete" - 0x02 = Quest Failed - 0x04 = Quest Accepted

	// next field is count (kills, etc)
	uint64 field1 = 0;

	// explored areas
	if(m_quest->count_requiredtriggers)
	{
		uint32 count = 0;
		for(int i = 0; i < 4; ++i)
		{
			if(m_quest->required_triggers[i])
			{
				if(m_explored_areas[i] == 1)
				{
					count++;
				}
			}
		}

		if(count == m_quest->count_requiredtriggers)
		{
			field1 |= 0x01000000;
		}
	}

	// spell casts / emotes
	if(iscastquest)
	{
		bool cast_complete = true;
		for(int i = 0; i < 4; ++i)
		{
			if(m_quest->required_spell[i] && m_quest->required_mobcount[i] > m_mobcount[i])
			{
				cast_complete = false;
				break;
			}
		}
		if(cast_complete)
		{
			field0 |= 0x01000000; // "Objective Complete"
		}
	}
	else if(isemotequest)
	{
		bool emote_complete = true;
		for(int i = 0; i < 4; ++i)
		{
			if(m_quest->required_emote[i] && m_quest->required_mobcount[i] > m_mobcount[i])
			{
				emote_complete = false;
				break;
			}
		}
		if(emote_complete)
		{
			field0 |= 0x01000000; // "Objective Complete"
		}
	}

	// mob hunting / counter
	if(m_quest->count_required_mob)
	{
		/*uint8 cnt;
		for(int i = 0; i < 4; ++i)
		{
			if(m_quest->required_mob[i] && m_mobcount[i] > 0)
			{
				// 1 << (offset * 6)
				cnt = m_mobcount[i];
				field1 |= (cnt << (i*8));
			}
		}*/

		// optimized this - burlex
		uint8* p = (uint8*)&field1;
		for(int i = 0; i < 4; ++i)
		{
			if(m_quest->required_mob[i] && m_mobcount[i] > 0)
				p[2 * i] |= (uint8)m_mobcount[i];
		}
	}

	if( ( m_quest->time != 0 ) && ( expirytime < UNIXTIME ) )
		completed = QUEST_FAILED;

	if( completed == QUEST_FAILED )
		field0 |= 2;

	m_plr->SetUInt32Value(base + 1, field0);
	m_plr->SetUInt64Value(base + 2, field1);

	if( ( m_quest->time != 0 ) && ( completed != QUEST_FAILED ) ){
		m_plr->SetUInt32Value( base + 4, expirytime );
		sEventMgr.AddEvent( m_plr, &Player::EventTimedQuestExpire, m_quest->id, EVENT_TIMED_QUEST_EXPIRE, ( expirytime - UNIXTIME ) * 1000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT );
	}else
		m_plr->SetUInt32Value( base + 4, 0 );
}