Ejemplo n.º 1
0
void RankingRegist(int rmode, int rtt, int rsc, int rli, int rlv, int rtime, int end, char *rname) {
	int		i, rank, temp;

	rank = RankingCheck(rmode, rtt, rsc, rtime, rlv, end);

	if(rank == -1) return;

	for(i = 4; i > rank ; i--) {
		temp = rmode* 10 + rtt* 5 + i;
		rksc[temp] = rksc[temp - 1];
		rkbl[temp] = rkbl[temp - 1];
		rklv[temp] = rklv[temp - 1];
		rktime[temp] = rktime[temp - 1];
		StrCpy(string[30 + temp], string[30 + temp - 1]);
		rkfl[temp] = rkfl[temp - 1];
	}

	temp = rmode* 10 + rtt* 5 + rank;
	rksc[temp] = rsc;
	rkbl[temp] = rli;
	rklv[temp] = rlv;
	rktime[temp] = rtime;
	StrCpy(string[30 + temp], rname);
	rkfl[temp] = end;
}
Ejemplo n.º 2
0
int CIllusionTempleEvent::Enter(int aIndex,BYTE Temple,BYTE Pos)
{
	if( g_bIllusionTemple == FALSE )
	{
		return FALSE;
	}

	if( IT_TEMPLE_RANGE(Temple) == FALSE )
	{
		return FALSE;
	}

	LPOBJ lpObj = &gObj[aIndex];

	PMSG_ILLUSIONTEMPLE_ENTER_RESULT pMsg;

	PHeadSubSetB((LPBYTE)&pMsg,0xBF,0,sizeof( pMsg ));
	pMsg.result = 0;

	if( lpObj->Type != OBJ_USER || lpObj->Connected <= PLAYER_LOGGED )
	{
		return FALSE;
	}

	if ( lpObj->m_IfState.use != 0 && lpObj->m_IfState.type != 12 )
	{
		return FALSE;
	}

	if ( lpObj->m_bPShopOpen == TRUE )
	{
		CGPShopReqClose(lpObj->m_Index);
	}

	int bFail = FALSE;
	int iLevel;
	int iSerial;

#if (ENABLE_FIX_PARTYPK == 0)

	if ( lpObj->PartyNumber >= 0 )
	{
		if( gParty.GetPartyPkLevel(lpObj->PartyNumber) >= 5 )
		{
			bFail = TRUE;
		}
	}
	else if( lpObj->m_PK_Level >= 4 )
	{
		bFail = TRUE;
	}

	if( bFail == TRUE )
	{
		pMsg.result = 7;
		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		return FALSE;
	}

#endif

	if( IsTransformEquipment(aIndex) )
	{
		pMsg.result = 8;
		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		return FALSE;
	}

	if( m_TempleData[Temple].GetState() != IT_STATE_CLOSED ||
		m_TempleData[Temple].OpenState() == FALSE )
	{
		pMsg.result = 2;
		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		return FALSE;
	}

	if( gObj[aIndex].pInventory[Pos].IsItem() == TRUE )
	{
		if( gObj[aIndex].pInventory[Pos].m_Type == ITEMGET(13,51) )
		{
			iLevel = gObj[aIndex].pInventory[Pos].m_Level;
			iSerial = gObj[aIndex].pInventory[Pos].m_Number;

			if( IT_TEMPLE_RANGE(iLevel-1) == FALSE && gObj[aIndex].pInventory[Pos].m_Durability != 1.0f )
			{
				pMsg.result = 1;
				DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
				return FALSE;
			}
		}
		else if( gObj[aIndex].pInventory[Pos].m_Type == ITEMGET(13,61) )
		{
			iSerial = gObj[aIndex].pInventory[Pos].m_Number;
			iLevel = GetEnterLevel(aIndex);

			if( iLevel <= 0 )
			{
				pMsg.result = 1;
				DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
				return FALSE;
			}
		}
		else
		{
			pMsg.result = 1;
			DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
			return FALSE;
		}
	}
	else
	{
		pMsg.result = 1;
		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		return FALSE;
	}

	if( RankingCheck(aIndex,Temple,Pos,iLevel) != FALSE )
	{
		return TRUE;
	}

	if( CheckCanEnter(aIndex,iLevel) == FALSE )
	{
		pMsg.result = 3;
		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		return FALSE;
	}

	m_TempleData[iLevel-1].CheckUsers();

	int bResult = m_TempleData[iLevel-1].EnterUser(aIndex,Temple,Pos);

	if( bResult == TRUE )
	{
		if( lpObj->PartyNumber >= 0 )
		{
			PMSG_PARTYDELUSER pMsg;
			int PartyIndex;
			PartyIndex = gParty.GetIndex(lpObj->PartyNumber,lpObj->m_Index,lpObj->DBNumber);

			if( PartyIndex >= 0 )
			{
				
				pMsg.Number = PartyIndex;

				CGPartyDelUser(&pMsg,lpObj->m_Index);
			}
		}

		if( lpObj->pInventory[Pos].m_Type == ITEMGET(13,51) )
		{
			lpObj->pInventory[Pos].m_Durability = 0;
			GCItemDurSend(lpObj->m_Index,Pos,(BYTE)lpObj->pInventory[Pos].m_Durability,0);
		}
		else if( lpObj->pInventory[Pos].m_Type == ITEMGET(13,61) )
		{
			if( lpObj->pInventory[Pos].m_Durability > 0.0f )
			{
				lpObj->pInventory[Pos].m_Durability -= 1.0f;
				GCItemDurSend(lpObj->m_Index,Pos,(BYTE)lpObj->pInventory[Pos].m_Durability,0);
			}
		}

		LogAddTD("[Illusion Temple] (%d) EnterUser: (%s)(%s) class:%d (Serial:%u).",
			iLevel,lpObj->AccountID,lpObj->Name,lpObj->DbClass,lpObj->pInventory[Pos].m_Number);

		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		gObjMoveGate(lpObj->m_Index,141 + iLevel);
	}

	m_TempleData[Temple].SendState(0,lpObj->m_Index);
	SendInfo();
return TRUE;
}