Example #1
0
BOOL CMapServerManager::CheckMapCanMove(WORD wServerCode, int iMAP_NUM)
{
	if ( MapNumberCheck(iMAP_NUM) == 0 )
	{
		return FALSE;
	}

	_MAPSVR_DATA * lpMapSvrData = NULL;
	std::map<int, _MAPSVR_DATA *>::iterator it = this->m_mapSVRCODE_MAP.find(wServerCode);

	if ( it != this->m_mapSVRCODE_MAP.end() )
	{
		lpMapSvrData = it->second;
	}

	if ( lpMapSvrData == NULL )
	{
		return FALSE;
	}

	if ( lpMapSvrData->m_bIN_USE == FALSE )
	{
		return FALSE;
	}

	short sMAP_MOVE_INFO = lpMapSvrData->m_sMAP_MOVE[iMAP_NUM];

	if ( sMAP_MOVE_INFO != -3 )
	{
		return FALSE;
	}

	return TRUE;
}
Example #2
0
// --------------------------------------------------------------------------------------------------------------------------------------------------
void CMoveSystem::CheckRequirements(int aIndex, int MapNumber, BYTE X, BYTE Y)
{
	LPOBJ lpObj = &gObj[aIndex];
	// -----
	//--  Check Target Map Status
	if ( MapNumberCheck(MapNumber) == FALSE)
	{
		CLog.LogAddC(TColor.Red(), "Error: [%s][%s] Unknown Map Number [%d].", lpObj->AccountID, lpObj->Name, MapNumber);
		SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: You are attempting to move to Unknown Map.");
		return;
	}
	// -----
	//-- Check The Coordonates Status
	if ( X > MOVMAX || X < MOVMIN ) return;
	if ( Y > MOVMAX || Y < MOVMIN ) return;
	// -----
	//-- Checking Required Money
	if ( lpObj->Money < MOVSTR[MapNumber].Money )
	{
		if ( HRB_CheckMoveMoneyMsg == TRUE )
		{
			SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: You don't have enough zen to warp.");
		}
		return;
	}
	// -----
	//-- Checking Required Level
	if( !REQ_LEVEL_MOVE_RANGE(lpObj->Level) )
	{
		CLog.LogAddC(TColor.Red(), "Error: [%s][%s]: Trying to moving, While he is out of Range of Required Level!", lpObj->AccountID, lpObj->Name);
		// ----
		if ( HRB_CheckMoveLevelMsg == TRUE )
		{
			SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: You are Out Of Range Of Required Level.");
			SendMsg.MessageOut(aIndex, 0x01, "MinLevel:(%d) - MaxLevel:(%d) to warp to [%s].", MOVSTR[MapNumber].MinLevel, MOVSTR[MapNumber].MaxLevel,
				GetMapName(MapNumber));
		}
		return;
	}
	// -----
	//-- Characters Type Specificity & Ability to Move
	if ( MOVSTR[MapNumber].MoveForChar == 1 ) //------------> For Normal Players Only
	{
		if ( (lpObj->AuthorityCode&1) == TRUE ) 
		{
			SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: This Map is Only available for Normal Players Only.");
			return;
		}
	}
	else if ( MOVSTR[MapNumber].MoveForChar == 2 ) //-------> For Game Masters Only
	{
		if ( (lpObj->AuthorityCode&1) == FALSE )
		{
			SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: This Map is Only available for Game Masters Only.");
			return;
		}
	}
	else if ( MOVSTR[MapNumber].MoveForChar == -1 ) //------> For All ( Normal & Game Masters )
	{
	}
	else
	{
		CLog.LogAddC(TColor.Red(), "Error: [%s][%s]: There is a Wrong Value in MoveSystem.txt in 'MoveForChar'.", lpObj->AccountID, lpObj->Name);
		return;
	}
	// -----
	//-- Checking BattleZones
	if ( MOVSTR[MapNumber].IsBattleZone == 1 )
	{
	}
	else
	{
	}
	// -----
	//--  Check Equipment To Move Atlans
	if ( MapNumber == MAP_INDEX_ATLANS )
	{
		if ( lpObj->pInventory[GUARDIAN].IsItem() != FALSE )
		{
			if ( lpObj->pInventory[GUARDIAN].m_Type == ITEMGET(13,2) ) // Horn Of Uniria
			{
				SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s While Riding a Uniria.",GetMapName(MapNumber));
				return;
			}
			// ----
			if ( lpObj->pInventory[GUARDIAN].m_Type == ITEMGET(13,3) ) // Dinorant
			{
				SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s While Riding a Dinorant.",GetMapName(MapNumber));
				return;
			}
		}
	}
	// -----
	//--  Check Equipment To Move Icarus
	if ( MapNumber == MAP_INDEX_ICARUS )
	{
		if(  lpObj->pInventory[GUARDIAN].m_Type != ITEMGET(13,3)  && 
			 lpObj->pInventory[WINGS].m_Type != ITEMGET(13,30) &&
			 lpObj->pInventory[GUARDIAN].m_Type != ITEMGET(13,37) &&
		    (lpObj->pInventory[WINGS].m_Type < ITEMGET(12,0)   ||  lpObj->pInventory[WINGS].m_Type > ITEMGET(12,6) ) &&
		    (lpObj->pInventory[WINGS].m_Type < ITEMGET(12,36)  ||  lpObj->pInventory[WINGS].m_Type > ITEMGET(12,43)) )
		{
			SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s without Wing or Dinorant or Fernir.", GetMapName(MapNumber));
			return;
		}
		// ----
		if(lpObj->pInventory[GUARDIAN].m_Type == ITEMGET(13,2))
		{
			SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s while Riding a Uniria.",GetMapName(MapNumber));
			return;
		}
		// ----
		if(lpObj->pInventory[RING_02].m_Type == ITEMGET(13,10) || lpObj->pInventory[RING_01].m_Type == ITEMGET(13,10))
		{
			SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s while wearing Transformation Ring.",GetMapName(MapNumber));
			return;
		}
	}
	// -----
	//-- Checking Character If in Trade.
	if ( lpObj->m_IfState.use == 1 && lpObj->m_IfState.type == 1 )
	{
		CGTradeCancelButtonRecv(lpObj->m_Index);
	}
	// -----
	//-- Checking Personal Shop Status
	if ( lpObj->m_bPShopOpen == 1 )
	{
		CPShop.ClosePersonalShop(lpObj->m_Index);
	}
	// -----
	//-- Checking The Vault Status
	if ( lpObj->m_IfState.use == 1 && lpObj->m_IfState.type == 6 )
	{
		CGWarehouseUseEnd(lpObj->m_Index);
	}
	// -----
	//-- Checking NPC Status
	if ( lpObj->m_IfState.use == 1 && lpObj->m_IfState.type == 3 )
	{
		lpObj->TargetShopNumber = -1;
		lpObj->m_IfState.type	= 0;
		lpObj->m_IfState.use	= 0;
	}
	// -----
	//-- Checking If the User in Duel
	if( gDuel.IsOnDuel(lpObj) == true )
	{
		SendMsg.MessageOut(aIndex, 0x01, "You are in a Duel. You can't warp");
		return;
	}
}