Exemple #1
0
/**
* @brief	Executes the death process.
*
* @param	pKiller	The killer.
*/
void CNpc::OnDeathProcess(Unit *pKiller)
{
	CUser * pUser = TO_USER(pKiller);

	if (TO_NPC(this) != nullptr && pUser != nullptr)
	{
		if (pUser->isPlayer())
		{
			if (!m_bMonster)
			{
				switch (m_tNpcType)
				{
				case NPC_BIFROST_MONUMENT:
					pUser->BifrostProcess(pUser);
					break;
				case NPC_PVP_MONUMENT:
					PVPMonumentProcess(pUser);
					break;
				case NPC_BATTLE_MONUMENT:
					BattleMonumentProcess(pUser);
					break;
				case NPC_HUMAN_MONUMENT:
					NationMonumentProcess(pUser);
					break;
				case NPC_KARUS_MONUMENT:
					NationMonumentProcess(pUser);
					break;
				case NPC_CHAOS_STONE:
			         {
			         	if (pUser == nullptr)
			         	return ;
			         	if (pUser->isInPKZone())
			         	ChaosStoneProcess(pUser,5);
			         }
			               break;
				   
				   }
					
				}
			}
			else if (m_bMonster)
			{
				if (m_sSid == 700 || m_sSid == 750)
				{
					if (pUser->CheckExistEvent(STARTER_SEED_QUEST, 1))
						pUser->SaveEvent(STARTER_SEED_QUEST, 2);
				}
				else if (g_pMain->m_MonsterRespawnListArray.GetData(m_sSid) != nullptr) {
					if (pUser->isInPKZone() || GetZoneID() == ZONE_JURAD_MOUNTAIN)
						g_pMain->SpawnEventNpc(g_pMain->m_MonsterRespawnListArray.GetData(m_sSid)->sSid, true, GetZoneID(), GetX(), GetY(), GetZ(), g_pMain->m_MonsterRespawnListArray.GetData(m_sSid)->sCount);
				} else if (m_tNpcType == NPC_CHAOS_STONE && pUser->isInPKZone()) {
					ChaosStoneProcess(pUser,5);
				}
			}

			DateTime time;
			g_pMain->WriteDeathUserLogFile(string_format("[ %s - %d:%d:%d ] Killer=%s,SID=%d,Target=%s,Zone=%d,X=%d,Z=%d\n",m_bMonster ? "MONSTER" : "NPC",time.GetHour(),time.GetMinute(),time.GetSecond(),pKiller->GetName().c_str(),m_sSid,GetName().c_str(),GetZoneID(),uint16(GetX()),uint16(GetZ())));
		}
	}
Exemple #2
0
/**
* @brief	Executes the death action.
*
* @param	pKiller	The killer.
*/
void CNpc::OnDeath(Unit *pKiller)
{
	if (m_NpcState == NPC_DEAD)
		return;

	ASSERT(GetMap() != nullptr);
	ASSERT(GetRegion() != nullptr);

	m_NpcState = NPC_DEAD;

	if (m_byObjectType == SPECIAL_OBJECT)
	{
		_OBJECT_EVENT *pEvent = GetMap()->GetObjectEvent(GetProtoID());
		if (pEvent != nullptr)
			pEvent->byLife = 0;
	}

	Unit::OnDeath(pKiller);

	CNpc * pNpc = TO_NPC(this);
	CUser * pUser = TO_USER(pKiller);

	if (pNpc != nullptr && pUser != nullptr)
	{
		if (pNpc->isMonster() && pUser->isPlayer())
		{
			if (pNpc->m_sSid == 700 || pNpc->m_sSid == 750)
			{
				if (pUser->CheckExistEvent(STARTER_SEED_QUEST, 0) || pUser->CheckExistEvent(STARTER_SEED_QUEST, 1))
					pUser->SaveEvent(STARTER_SEED_QUEST, 2);
			}
		}
	}

	GetRegion()->Remove(TO_NPC(this));
	SetRegion();
}
Exemple #3
0
/**
* @brief	Executes the death process.
*
* @param	pKiller	The killer.
*/
void CNpc::OnDeathProcess(Unit *pKiller)
{
	CUser * pUser = TO_USER(pKiller);

	if (TO_NPC(this) != nullptr && pUser != nullptr)
	{
		if (pUser->isPlayer())
		{
			if (!m_bMonster)
			{
				switch (m_tNpcType)
				{
				case NPC_BIFROST_MONUMENT:
					pUser->BifrostProcess(pUser);
					break;
				case NPC_PVP_MONUMENT:
					PVPMonumentProcess(pUser);
					break;
				case NPC_BATTLE_MONUMENT:
					BattleMonumentProcess(pUser);
					break;
				case NPC_HUMAN_MONUMENT:
					NationMonumentProcess(pUser);
					break;
				case NPC_KARUS_MONUMENT:
					NationMonumentProcess(pUser);
					break;
				}
			}
			else if (m_bMonster)
			{
				if (m_sSid == 700 || m_sSid == 750)
				{
					if (pUser->CheckExistEvent(STARTER_SEED_QUEST, 1))
						pUser->SaveEvent(STARTER_SEED_QUEST, 2);
				}
				else if (g_pMain->m_MonsterRespawnListArray.GetData(m_sSid) != nullptr) {
					if (pUser->isInPKZone() || GetZoneID() == ZONE_JURAD_MOUNTAIN)
						g_pMain->SpawnEventNpc(g_pMain->m_MonsterRespawnListArray.GetData(m_sSid)->sSid, true, GetZoneID(), GetX(), GetY(), GetZ(), g_pMain->m_MonsterRespawnListArray.GetData(m_sSid)->sCount);
				} else if (m_tNpcType == NPC_CHAOS_STONE && pUser->isInPKZone()) {
					ChaosStoneProcess(pUser,5);
				}
			}
		}
	}
}