[Mini-Release] Target save

11/12/2018 07:07 Velitta#1
-
11/12/2018 09:16 Avalion#2
this is what i have OwO did i add correct
Code:
void CDPClient::OnMoverDeath( OBJID objid, CAr & ar )
{
	DWORD dwMsg;
	OBJID objidAttacker;
	ar >> objidAttacker >> dwMsg;

	CMover* pMover = prj.GetMover(objid);
	if (IsValidObj(pMover))
	{
		const int nHitPoint = pMover->GetHitPoint();
		pMover->IncHitPoint(-nHitPoint);

		CWorld* pMoverWorld = pMover->GetWorld();
		if (g_pPlayer == pMover)
		{
			if (pMoverWorld)
				pMoverWorld->SetObjFocus(nullptr);
			SAFE_DELETE(g_WndMng.m_pWndDuelConfirm);
			SAFE_DELETE(g_WndMng.m_pWndPenaltyPK);
			g_WndMng.m_pWndWorld->SetLastTarget(NULL_ID);
			g_WndMng.m_pWndWorld->m_bAutoAttack = false;
			g_WndMng.m_pWndWorld->m_objidTracking = NULL_ID;
		}

		if (pMover->IsActiveMover())
		{
			bool bBossDie = false;
			bool guildovo = false;
			bool arena = false;

			if (pMoverWorld)
			{		
				if (pMoverWorld->GetID() == WI_DUNGEON_MUSCLE || pMoverWorld->GetID() == WI_DUNGEON_KRRR || pMoverWorld->GetID() == WI_DUNGEON_BEAR)
					bBossDie = true;
				else if ((pMoverWorld->GetID() >= WI_WORLD_GUILDWAR1TO1_0 && pMoverWorld->GetID() <= WI_WORLD_GUILDWAR1TO1_L) && pMover->m_nGuildCombatState != 0)
					guildovo = true;
				else if (pMoverWorld->IsArena())
					arena = true;
			}

			if (!guildovo)
			{
//playsnd
#ifdef __JEFF_11_4
				if (arena)
					g_WndMng.PutString(prj.GetText(TID_GAME_DEATH_ARENA), nullptr, prj.GetTextColor(TID_GAME_DEATH_ARENA));
				else
					g_WndMng.PutString(prj.GetText(TID_GAME_DEATH), nullptr, prj.GetTextColor(TID_GAME_DEATH));
#else
				g_WndMng.PutString(prj.GetText(TID_GAME_DEATH), NULL, prj.GetTextColor(TID_GAME_DEATH));
#endif
			}
			g_DamageNumMng.AddNumber(pMover->GetPos(), nHitPoint, 0);

			if (pMover->m_nGuildCombatState == 1 || g_eLocal.GetState(EVE_SCHOOL))
				SendHdr(PACKETTYPE_REVIVAL_TO_LODESTAR);
			else if (g_WndMng.m_pWndRevival)
			{
				g_WndMng.m_pWndRevival = new CWndRevival;
				g_WndMng.m_pWndRevival->Initialize(&g_WndMng, 0);

				if (bBossDie)
					g_WndMng.m_pWndRevival->EnableButton(WIDC_REVIVAL_TO_LODELIGHT, false);
			}
		}
#if __VER >= 8 //__CSC_VER8_5
		if (pMover->IsPlayer() && pMover->m_pAngelFlag)
		{
			if (pMover->m_pAngel)
				SAFE_DELETE(pMover->m_pAngel);
			pMover->m_pAngel = nullptr;
			pMover->m_pAngelFlag = false;
		}
#endif
#if __VER >= 11 // __CSC_VER11_2
		if (static_cast<CObj*>(pMover) == g_WndMng.m_pWndWorld->m_pNextTargetObj)
		{
			if (g_WndMng.m_pWndWorld->m_pNextTargetObj == g_WndMng.m_pWndWorld->m_pRenderTargetObj)
			{
				g_WndMng.m_pWndWorld->m_pNextTargetObj = nullptr;
				g_WndMng.m_pWndWorld->m_pRenderTargetObj = g_WorldMng()->GetObjFocus();
			}
			else
				g_WndMng.m_pWndWorld->m_pNextTargetObj = nullptr;
		}
#endif 

		CMover* pAttacker = prj.GetMover(objidAttacker);
		if (pAttacker)
		{
			if (g_pPlayer == pAttacker)
			{
				CWorld* playerWorld = g_pPlayer->GetWorld();
				if (playerWorld)
				{
					CObj* focusObj = playerWorld->GetObjFocus();
					if (static_cast<CMover*>(focusObj) == pMover)
					{
#if __VER >= 11 // __CSC_VER11_2
						if (g_WndMng.m_pWndWorld->m_pNextTargetObj)
						{
							g_WndMng.m_pWndWorld->SetNextTarget();
							g_WndMng.m_pWndWorld->m_bAutoAttack = true;
						}
						else
#endif
						{
							playerWorld->SetObjFocus(nullptr);
							g_WndMng.m_pWndWorld->m_bAutoAttack = false;
						}
					}
				}
			}

			if (pAttacker->IsPlayer())
				pMover->m_idMurderer = pAttacker->m_idPlayer;

			if (pAttacker->IsActiveMover())
				g_DamageNumMng.AddNumber(pMover->GetPos(), nHitPoint, 1);

			if (pAttacker->m_pActMover->GetObjHit() == objid)
				pAttacker->m_pActMover->SetObjHit(NULL_ID);
			if (pAttacker->GetDestId() == objid)
				pAttacker->ClearDestObj();
		}

		if (g_WndMng.m_pWndWorld->m_objidTracking == pMover->GetId())
			g_WndMng.m_pWndWorld->m_objidTracking = NULL_ID;
		pMover->SendActMsg(OBJMSG_DIE, dwMsg, reinterpret_cast<int>(pAttacker));		
	}
}
09/20/2024 21:39 Justme1113#3
Quote:
Originally Posted by Velitta View Post
-
Can someone repost this please?
The one posted above doesn't work well on V15 it seems.