Пример #1
0
BOOL CMoveCommand::CheckMainToMove(LPOBJ lpObj)
{
	if ( BC_MAP_RANGE(lpObj->MapNumber) != FALSE )
	{
		return FALSE;
	}

	if ( CC_MAP_RANGE(lpObj->MapNumber) != FALSE )
	{
		return FALSE;
	}

	if ( KALIMA_MAP_RANGE(lpObj->MapNumber) != FALSE )
	{
		return FALSE;
	}

	if ( DS_MAP_RANGE(lpObj->MapNumber) != FALSE )
	{
		return FALSE;
	}


	if ( DOPPELGANGER_MAP_RANGE(lpObj->MapNumber) != FALSE )
	{
		return FALSE;
	}

	
	if ( IMPERIAL_MAP_RANGE(lpObj->MapNumber) != FALSE )
	{
		return FALSE;
	}

	if ( lpObj->MapNumber == MAP_INDEX_KANTURU_BOSS )
	{
		return FALSE;
	}

	if ( IT_MAP_RANGE(lpObj->MapNumber) != FALSE )
	{
		if(g_IllusionTempleEvent.CheckTeleport(lpObj->m_Index) != FALSE)
		{
			return FALSE;
		}
	}

	return TRUE;
}
Пример #2
0
//0051dcd0	->
BOOL CObjBaseAttack::PkCheck(LPOBJ lpObj, LPOBJ lpTargetObj)
{
	if ( gLanguage == 0 || gLanguage == 2 || gLanguage == 4)
	{
		if ( lpObj->Type == OBJ_USER )
		{
			BOOL bPlayerKiller = FALSE; //Season 2.5 add-on
	
			if(lpObj->PartyNumber >= 0) //Season 2.5 add-on
			{
				if(gParty.GetPKPartyPenalty(lpObj->PartyNumber) >= 6)
				{
					bPlayerKiller = TRUE;
				}
			}
			else if(lpObj->m_PK_Level >= 6)
			{
				bPlayerKiller = TRUE;
			}

			if(bPlayerKiller == TRUE) //Season 2.5 add-on
			{
				if (lpObj->PartyNumber >= 0 )
				{
					if ( gPkLimitFree == FALSE )
					{
						return FALSE;
					}
				}
				else if ( lpObj->m_PK_Count >= 3 )
				{
					if ( gPkLimitFree == FALSE )
					{
						return FALSE;
					}
				}
			}
		}
	}

	if ( lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER)
	{
		if ( lpTargetObj->Level <= 5 || lpObj->Level <= 5 )
		{
			return FALSE;
		}

		if ( gObjGetRelationShip(lpObj, lpTargetObj) == 2 ) // Rivals
		{
			if ( gNonPK == FALSE )
			{
				return TRUE;
			}
		}

		if ( lpObj->lpGuild != NULL && lpTargetObj->lpGuild != NULL )
		{
			if ( lpObj->lpGuild->WarState == 1 && lpTargetObj->lpGuild->WarState == 1 )
			{
				if ( lpObj->lpGuild->Number == lpTargetObj->lpGuild->Number )
				{
					return FALSE;
				}
			}
		}

		if ( gObjTargetGuildWarCheck(lpObj, lpTargetObj) == FALSE && lpTargetObj->lpGuild != NULL && lpTargetObj->lpGuild->WarState != 0)
		{
			if ( lpTargetObj->lpGuild->WarType == 1 )
			{
				if ( lpTargetObj->MapNumber != 6 )
				{
					if ( !gNonPK )
					{
						return TRUE;
					}
				}
			}

			if ( CC_MAP_RANGE(lpTargetObj->MapNumber) == FALSE )
			{
				return FALSE;
			}
		}

		if ( IT_MAP_RANGE(lpObj->MapNumber) != FALSE ) //season2.5 add-on
		{
			//
		}
		else if ( CC_MAP_RANGE(lpObj->MapNumber) != FALSE )
		{
			if ( g_ChaosCastle.GetCurrentState(g_ChaosCastle.GetChaosCastleIndex(lpObj->MapNumber)) != 2 )
			{
				return FALSE;
			}
		}
		else if ( gNonPK != FALSE )
		{
			return FALSE;
		}

		if ( DS_MAP_RANGE(lpObj->MapNumber) ) // DEvil
		{
			return FALSE;
		}

		if ( BC_MAP_RANGE(lpObj->MapNumber) )
		{
			return FALSE;
		}

		if ( gObjDuelCheck(lpObj, lpTargetObj) == FALSE )
		{
			if ( gObjDuelCheck(lpTargetObj) )
			{
				return FALSE;
			}
		}

		if ( gLanguage == 0 || gLanguage == 2 )
		{
			BOOL bPlayerKiller = FALSE; //Season 2.5 add-on
	
			if(lpObj->PartyNumber >= 0) //Season 2.5 add-on
			{
				if(gParty.GetPKPartyPenalty(lpObj->PartyNumber) >= 6)
				{
					bPlayerKiller = TRUE;
				}
			}
			else if(lpObj->m_PK_Level >= 6)
			{
				bPlayerKiller = TRUE;
			}

			if(bPlayerKiller == TRUE) //Season 2.5 add-on
			{
				if (lpObj->PartyNumber >= 0 )
				{
					if ( gPkLimitFree == FALSE )
					{
						return FALSE;
					}
				}
				else if ( lpObj->m_PK_Count >= 3 )
				{
					if ( gPkLimitFree == FALSE )
					{
						return FALSE;
					}
				}
			}

			bPlayerKiller = FALSE; //Season 2.5 add-on
	
			if(lpTargetObj->PartyNumber >= 0) //Season 2.5 add-on
			{
				if(gParty.GetPKPartyPenalty(lpTargetObj->PartyNumber) >= 6)
				{
					bPlayerKiller = TRUE;
				}
			}
			else if(lpTargetObj->m_PK_Level >= 6)
			{
				bPlayerKiller = TRUE;
			}

			if(bPlayerKiller == 1) //Season 2.5 add-on
			{
				if (lpTargetObj->PartyNumber >= 0 )
				{
					if ( gPkLimitFree == FALSE )
					{
						if(g_CastleSiege.GetCastleState() != CASTLESIEGE_STATE_STARTSIEGE)
						{
							return FALSE;
						}
					}
				}
				else if ( lpTargetObj->m_PK_Count >= 3 )
				{
					if ( gPkLimitFree == FALSE )
					{
						if(g_CastleSiege.GetCastleState() != CASTLESIEGE_STATE_STARTSIEGE)
						{
							return FALSE;
						}
					}
				}
			}


		}
	}
	return TRUE;
}
Пример #3
0
//00414B10 - identical
BOOL CKalimaGate::CreateKalimaGate(int iIndex, BYTE btLevel, BYTE cTX, BYTE cTY)
{
	BOOL bKalimaGateCreateSucceed=FALSE;
	int iMonsterIndex=-1;

	
	EnterCriticalSection(&this->m_critKalimaGate );
	
	__try
	{
		int iKalimaGateLevel;
		int iMapNumber;
		BYTE btMapAttr;
		int iMonsterType;
		BYTE cX;
		BYTE cY;

		
		if ( gObjIsConnected(iIndex) == PLAYER_EMPTY )
		{
			return false;
		}

		LogAddTD("[Kalima] [%s][%s] Try to Create Kalima Gate", gObj[iIndex].AccountID, gObj[iIndex].Name);
		iKalimaGateLevel = this->GetKalimaGateLevel(iIndex);

		if ( iKalimaGateLevel < btLevel-1 )
		{
			return false;
		}

		iKalimaGateLevel = btLevel-1;

		if (  DS_MAP_RANGE(gObj[iIndex].MapNumber) )
		{
			return false;
		}

		if ( BC_MAP_RANGE(gObj[iIndex].MapNumber) )
		{
			return false;
		}

		if ( CC_MAP_RANGE(gObj[iIndex].MapNumber) )
		{
			return false;
		}

		if ( CHECK_ILLUSIONTEMPLE(gObj[iIndex].MapNumber) )//NEW
		{
			return false;
		}

#ifdef IMPERIAL
		if( CImperialGuardian::IsEventMap(gObj[iIndex].MapNumber) )
		{
			return false;
		}
#endif

		if ( KALIMA_FLOOR_RANGE(iKalimaGateLevel)== FALSE )
		{
			LogAddTD("[Kalima] [%s][%s] Failed to Summon Kalima Gate - Gate Level Check Error : %d",
				gObj[iIndex].AccountID, gObj[iIndex].Name, iKalimaGateLevel+1);
			return false;
		}

		iMapNumber = gObj[iIndex].MapNumber;

		btMapAttr = MapC[iMapNumber].GetAttr(gObj[iIndex].X, gObj[iIndex].Y);

		if ( btMapAttr &1 != 0 )
		{
			LogAddTD("[Kalima] [%s][%s] Failed to Summon Kalima Gate - Called in Saftey Area (Map:%d, X:%d, Y:%d)",
				gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].MapNumber,
				gObj[iIndex].X, gObj[iIndex].Y);
			return false;
		}

		if ( gObj[iIndex].m_cKalimaGateExist == TRUE )
		{
			GCServerMsgStringSend(lMsg.Get( MSGGET( 4, 224)), iIndex, 1);
			LogAddTD("[Kalima] [%s][%s] Failed to Summon Kalima Gate - Already Have Gate (SummonIndex:%d)",
				gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].m_iKalimaGateIndex);
			return false;
		}

		iMonsterType = iKalimaGateLevel+152;
		cX = cTX;
		cY = cTY;

		btMapAttr = MapC[iMapNumber].GetAttr(cX, cY);

		if ( btMapAttr != 0 )
		{
			if (this->GetRandomLocation(iMapNumber, cX, cY) == 0)
			{
			LogAddTD("[Kalima] [%s][%s] Failed to Summon Kalima Gate - Failed to get Location (MapNumber:%d, X:%d, Y:%d)",
				gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].MapNumber, cX, cY);
			return false;
			}
		}

		if ( gObj[iIndex].MapNumber == 10 )
		{
			LogAddTD("[Kalima] [%s][%s] Failed to Summon Kalima Gate - Uable to Summon in this Map (MapNumber:%d)",
				gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].MapNumber);
			return false;
		}

		iMonsterIndex = gObjAddMonster(iMapNumber);

		if ( iMonsterIndex >= 0 )
		{
			LPMONSTER_ATTRIBUTE lpMATTR = gMAttr.GetAttr(iMonsterType);
			
			if ( lpMATTR == NULL )
			{
				gObjDel(iMonsterIndex);
				LogAddTD("[Kalima] [%s][%s] Kalima Gate Vanished - lpMATTR == NULL (SummonIndex:%d)",
					gObj[iIndex].AccountID, gObj[iIndex].Name, iMonsterIndex);
				return false;
			}

			gObjSetMonster(iMonsterIndex, iMonsterType);
			gObj[iMonsterIndex].Live = TRUE;
			gObj[iMonsterIndex].Life = 1000.0;
			gObj[iMonsterIndex].MaxLife = 1000.0;
			gObj[iMonsterIndex].m_PosNum = -1;
			gObj[iMonsterIndex].X = cX;
			gObj[iMonsterIndex].Y = cY;
			gObj[iMonsterIndex].MTX = cX;
			gObj[iMonsterIndex].MTY = cY;
			gObj[iMonsterIndex].TX = cX;
			gObj[iMonsterIndex].TY = cY;
			gObj[iMonsterIndex].m_OldX = cX;
			gObj[iMonsterIndex].m_OldY = cY;
			gObj[iMonsterIndex].StartX = cX;
			gObj[iMonsterIndex].StartY = cY;
			gObj[iMonsterIndex].MapNumber = iMapNumber;
			gObj[iMonsterIndex].m_MoveRange = 0;
			gObj[iMonsterIndex].m_cKalimaGateEnterCount = 0;

			gObj[iIndex].m_cKalimaGateExist = TRUE;
			gObj[iIndex].m_iKalimaGateIndex = iMonsterIndex;

			gObj[iMonsterIndex].Level = lpMATTR->m_Level;
			gObj[iMonsterIndex].Type = OBJ_MONSTER;
			gObj[iMonsterIndex].MaxRegenTime = 1000;
			gObj[iMonsterIndex].Dir = 1;

			gObj[iMonsterIndex].m_RecallMon = iIndex;
			gObj[iMonsterIndex].RegenTime = GetTickCount();
			gObj[iMonsterIndex].m_Attribute = iKalimaGateLevel + 51;
			gObj[iMonsterIndex].DieRegen = FALSE;
			
			LogAddTD("[Kalima] [%s][%s] Create Kalima Gate Successfuly (Live:%d, GateTick:%u, DieRegen:%d, Map:%d, X:%d, Y:%d, SummonIndex:%d, OwnerIndex:%d, GateNo.:%d)",
				gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iMonsterIndex].Live, gObj[iMonsterIndex].RegenTime,
				gObj[iMonsterIndex].DieRegen, gObj[iMonsterIndex].MapNumber, gObj[iMonsterIndex].X,
				gObj[iMonsterIndex].Y, iMonsterIndex, iIndex, iKalimaGateLevel+1);
			bKalimaGateCreateSucceed = TRUE;
		}
	}
	__finally
	{
		LeaveCriticalSection(&this->m_critKalimaGate);
	}

	return true;
}
Пример #4
0
void CDevilSquare::ProcOpen()
{
    if ( this->m_iremainTimeSec != -1 )
    {

        int lc2 = (GetTickCount() - this->m_iTime)/1000;

        if ( lc2 != 0 )
        {
            this->m_iremainTimeSec -= lc2;
            this->m_iTime += lc2 * 1000;

            if ( this->m_iremainTimeSec <= 30 && this->m_bSendTimeCount == FALSE )
            {
                PMSG_SET_DEVILSQUARE pMsg;

                PHeadSetB((LPBYTE)&pMsg, 0x92, sizeof(pMsg));
                pMsg.Type = DevilSquare_OPEN;

                for ( int i=OBJ_STARTUSERINDEX; i<OBJMAX; i++)
                {
                    if ( gObj[i].Connected == PLAYER_PLAYING && gObj[i].Type == OBJ_USER)
                    {
                        if ( BC_MAP_RANGE(gObj[i].MapNumber) == FALSE )
                        {
                            if ( CC_MAP_RANGE(gObj[i].MapNumber) == FALSE )
                            {
                                DataSend(i, (BYTE *)&pMsg, pMsg.h.size);
                            }
                        }
                    }
                }

                this->m_bSendTimeCount = TRUE;
            }

            if (this->m_iremainTimeSec < 1 )
            {
                this->SendEventStartMsg();
                this->SetState(DevilSquare_PLAYING);
            }

        }
    }
    else
    {
        if ( this->m_iTime < GetTickCount() )
        {
            this->ClearMonstr();
            this->m_iRemainTime--;

            if ( this->m_iRemainTime > 0 )
            {
                PMSG_NOTICE pNotice;

                TNotice::MakeNoticeMsgEx(&pNotice, 0, lMsg.Get(MSGGET(2, 193)), this->m_iRemainTime);

                for ( int i=OBJ_STARTUSERINDEX; i<OBJMAX; i++)
                {
                    if ( gObj[i].Connected == PLAYER_PLAYING && gObj[i].Type == OBJ_USER)
                    {
                        if ( BC_MAP_RANGE(gObj[i].MapNumber) == FALSE )
                        {
                            if ( CC_MAP_RANGE(gObj[i].MapNumber) == FALSE )
                            {
                                DataSend(i, (BYTE *)&pNotice, pNotice.h.size);
                            }
                        }
                    }
                }

                LogAddTD((char*)pNotice.Notice);

                this->m_iTime = GetTickCount();
            }

            if (this->m_iRemainTime == 1 && this->m_iremainTimeSec == -1)
            {
                this->m_iremainTimeSec = 60;
                this->m_iTime = GetTickCount();
            }
            else
            {
                this->m_iTime = GetTickCount() + 60000;
            }
        }
    }
}
Пример #5
0
void CDevilSquare::ProcClose()
{
    if ( this->m_iremainTimeSec != -1 )
    {
        int lc2 = (GetTickCount() - this->m_iTime)/1000;

        if ( lc2 != 0 )
        {
            this->m_iremainTimeSec -= lc2;
            this->m_iTime += lc2 * 1000;

            if ( this->m_iremainTimeSec <= 30 && this->m_bSendTimeCount == FALSE )
            {
                PMSG_SET_DEVILSQUARE pMsg;

                PHeadSetB((LPBYTE)&pMsg, 0x92, sizeof(pMsg));
                pMsg.Type = DevilSquare_CLOSE;

                for ( int i=OBJ_STARTUSERINDEX; i<OBJMAX; i++)
                {
                    if ( gObj[i].Connected == PLAYER_PLAYING && gObj[i].Type == OBJ_USER)
                    {
                        if ( BC_MAP_RANGE(gObj[i].MapNumber) == FALSE )
                        {
                            if ( CC_MAP_RANGE(gObj[i].MapNumber) == FALSE )
                            {
                                DataSend(i, (BYTE *)&pMsg, pMsg.h.size);
                            }
                        }
                    }
                }


                this->m_bSendTimeCount = TRUE;
            }

            if (this->m_iremainTimeSec < 1 )
            {
                PMSG_NOTICE pNotice;

                TNotice::MakeNoticeMsg((TNotice *)&pNotice, 0, lMsg.Get(MSGGET(2, 191)));

                for ( int i=OBJ_STARTUSERINDEX; i<OBJMAX; i++)
                {
                    if ( gObj[i].Connected == PLAYER_PLAYING && gObj[i].Type == OBJ_USER)
                    {
                        if ( BC_MAP_RANGE(gObj[i].MapNumber) == FALSE )
                        {
                            if ( CC_MAP_RANGE(gObj[i].MapNumber) == FALSE )
                            {
                                DataSend(i, (BYTE *)&pNotice, pNotice.h.size);
                            }
                        }
                    }
                }

                LogAddTD(pNotice.Notice);
                this->SetState(DevilSquare_OPEN);
            }

        }
    }
    else if ( this->m_iTime < GetTickCount() )
    {
        this->ClearMonstr();
        this->m_iRemainTime--;

        if ( this->m_bFlag == 0 )
        {
            for ( int i=OBJ_STARTUSERINDEX; i<OBJMAX; i++)
            {
                if ( gObj[i].Connected == PLAYER_PLAYING )
                {
                    if ( DS_MAP_RANGE(gObj[i].MapNumber) != FALSE )
                    {
                        gObjMoveGate(i, 27);
                    }
                }
            }

            this->ItemClear();
        }
        else
        {
            this->CheckInvalidUser();
        }

        if ( this->m_iRemainTime <= 15 )
        {
            if ( (this->m_iRemainTime%5)== 0 )
            {
                PMSG_NOTICE pNotice;

                TNotice::MakeNoticeMsgEx((TNotice *)&pNotice, 0, lMsg.Get(MSGGET(2, 192)), this->m_iRemainTime);

                for ( int i=OBJ_STARTUSERINDEX; i<OBJMAX; i++)
                {
                    if ( gObj[i].Connected == PLAYER_PLAYING && gObj[i].Type == OBJ_USER)
                    {
                        if ( BC_MAP_RANGE(gObj[i].MapNumber) == FALSE )
                        {
                            if ( CC_MAP_RANGE(gObj[i].MapNumber) == FALSE )
                            {
                                DataSend(i, (BYTE *)&pNotice, pNotice.h.size);
                            }
                        }
                    }
                }

                LogAddTD((char*)pNotice.Notice);
            }
        }

        if ( this->m_iRemainTime == 1 && this->m_iremainTimeSec == -1 )
        {
            this->m_iremainTimeSec = 60;
            this->m_iTime = GetTickCount();
        }
        else
        {
            this->m_iTime = GetTickCount() + 60000;
        }
    }
}
Пример #6
0
void CHacktoolBlockEx::SetUseForceMove2Town(LPOBJ lpObj)
{
	if( BC_MAP_RANGE(lpObj->MapNumber) )
	{
		int iBridgeIndex = g_BloodCastle.GetBridgeIndexByMapNum(lpObj->MapNumber);
		// ----
		if( g_BloodCastle.GetCurrentState(iBridgeIndex) == BC_STATE_PLAYING )
		{
			g_BloodCastle.SearchUserDropQuestItem(lpObj->m_Index);
		}
		else
		{
			g_BloodCastle.SearchUserDeleteQuestItem(lpObj->m_Index);
		}
	}
	// ----
	if( IT_MAP_RANGE(lpObj->MapNumber) )
	{
		g_IllusionTempleEvent.DropRelicsItem(lpObj->MapNumber, lpObj->m_Index);
	}
	// ----
	if( (lpObj->m_IfState.use) != 0 )
	{
		if( lpObj->m_IfState.type  == 3 )
		{
			lpObj->TargetShopNumber = -1;
			lpObj->m_IfState.type	= 0;
			lpObj->m_IfState.use	= 0;
		}
	}
	// ----
	if( lpObj->MapNumber == MAP_INDEX_DEVIAS )
	{
		gObjMoveGate(lpObj->m_Index, 22);
	}
	else if( lpObj->MapNumber == MAP_INDEX_NORIA )
	{
		gObjMoveGate(lpObj->m_Index, 27);
	}
	else if( lpObj->MapNumber == MAP_INDEX_LOSTTOWER )
	{
		gObjMoveGate(lpObj->m_Index, 42);
	}
	else if( lpObj->MapNumber == MAP_INDEX_ATHLANSE )
	{
		gObjMoveGate(lpObj->m_Index, 49);
	}
	else if( lpObj->MapNumber == MAP_INDEX_TARKAN )
	{
		gObjMoveGate(lpObj->m_Index, 57);
	}
	else if( BC_MAP_RANGE(lpObj->MapNumber) )
	{
		gObjMoveGate(lpObj->m_Index, 22);
	}
	else if( CC_MAP_RANGE(lpObj->MapNumber) )
	{
		gObjMoveGate(lpObj->m_Index, 22);
	}
	else if( KALIMA_MAP_RANGE(lpObj->MapNumber) )
	{
		gObjMoveGate(lpObj->m_Index, 22);
	}
	else if( CC_MAP_RANGE(lpObj->MapNumber) )
	{
		gObjMoveGate(lpObj->m_Index, 22);
	}
	else if( lpObj->MapNumber == MAP_INDEX_AIDA )
	{
		gObjMoveGate(lpObj->m_Index, 27);
	}
	else if( lpObj->MapNumber == MAP_INDEX_CRYWOLF_FIRSTZONE )
	{
		gObjMoveGate(lpObj->m_Index, 27);
	}
	else if( lpObj->MapNumber == MAP_INDEX_ELBELAND )
	{
		gObjMoveGate(lpObj->m_Index, 267);
	}
	else if( lpObj->MapNumber == MAP_INDEX_SWAMP_OF_CALMNESS )
	{
		gObjMoveGate(lpObj->m_Index, 273);
	}
	else if( lpObj->MapNumber == MAP_INDEX_RAKLION_FIELD )
	{
		gObjMoveGate(lpObj->m_Index, 286);
	}
	else if( g_NewPVP.IsVulcanusMap(lpObj->MapNumber) )
	{
		gObjMoveGate(lpObj->m_Index, 294);
	}
	else if( g_NewPVP.IsPKFieldMap(lpObj->MapNumber) )
	{
		g_NewPVP.Reset(*lpObj);
		gObjMoveGate(lpObj->m_Index, 294);
	}
	else
	{
		gObjMoveGate(lpObj->m_Index, 17);
	}
}