void CDevilSquare::SendEventStartMsg()
{
    PMSG_NOTICE pToEventer;
    PMSG_NOTICE pWithOutEvneter;

    TNotice::MakeNoticeMsg(&pToEventer, 0, lMsg.Get(MSGGET(2, 195)));
    TNotice::MakeNoticeMsg(&pWithOutEvneter, 0, lMsg.Get(MSGGET(2, 196)));

    for ( int n=OBJ_STARTUSERINDEX; n<OBJMAX; n++)
    {
        if ( gObj[n].Connected == PLAYER_PLAYING )
        {
            if ( DS_MAP_RANGE(gObj[n].MapNumber) != FALSE )
            {
                DataSend(n, (BYTE *)&pToEventer, pToEventer.h.size);
            }
            else
            {
                DataSend(n, (BYTE *)&pWithOutEvneter, pWithOutEvneter.h.size);
            }
        }
    }

    LogAddTD("[DevilSquare] Start Event");
}
void CDevilSquare::CalcScore()
{
    int n;
    for ( n=0; n<MAX_DEVILSQUARE_GROUND; n++)
    {
        this->m_DevilSquareGround[n].ClearScore();
    }

    for ( n=OBJ_STARTUSERINDEX; n<OBJMAX; n++)
    {
        if ( gObj[n].Connected == PLAYER_PLAYING )
        {
            if ( DS_MAP_RANGE(gObj[n].MapNumber) != FALSE )
            {
                if ( DS_LEVEL_RANGE(gObj[n].m_bDevilSquareIndex) != FALSE )
                {
                    this->m_DevilSquareGround[gObj[n].m_bDevilSquareIndex].InsertObj(&gObj[n]);
                }
            }
        }
    }

    for (  n=0; n<MAX_DEVILSQUARE_GROUND; n++)
    {
        this->m_DevilSquareGround[n].SortScore();
        this->m_DevilSquareGround[n].SendScore();
    }
}
Example #3
0
void CDevilSquare::SendEventStartMsg()
{
	PMSG_NOTICE pToEventer;
	PMSG_NOTICE pWithOutEvneter;

	TNotice::MakeNoticeMsg(&pToEventer, 0, "[Devil Square] has started.");
	TNotice::MakeNoticeMsg(&pWithOutEvneter, 0, "[Devil Square] is closed. Try again next time.");

	for ( int n=OBJ_STARTUSERINDEX;n<OBJMAX;n++)
	{
		if ( gObj[n].Connected == PLAYER_PLAYING )
		{
			if ( DS_MAP_RANGE(gObj[n].MapNumber) != FALSE )
			{
				DataSend(n, (BYTE *)&pToEventer, pToEventer.h.size);
			}
			else
			{
				DataSend(n, (BYTE *)&pWithOutEvneter, pWithOutEvneter.h.size);
			}
		}
	}

	LogAdd("[DevilSquare] Start Event");
}
//00555810	-> 100%
int CTemporaryUserManager::CheckInEventMap(int SlotIndex)	//
{
	if( !IS_TEMP_SLOT(SlotIndex) )
	{
		return -1;
	}
	// ----
    if( BC_MAP_RANGE(this->m_UserData[SlotIndex].MapNumber) )
    {
      return TEMP_BLOODCASTLE;
    }
	// ----
    if( IT_MAP_RANGE(m_UserData[SlotIndex].MapNumber) )
	{
		return TEMP_ILLUSION;
	}
	// ----
    if( this->m_UserData[SlotIndex].MapNumber >= 69 && this->m_UserData[SlotIndex].MapNumber <= 72 )	//-> Need define
	{
		return TEMP_IMPERIAL;
	}
	// ----
	if( this->m_UserData[SlotIndex].MapNumber >= 65 && this->m_UserData[SlotIndex].MapNumber <= 68 )	//-> Need define
	{
		return TEMP_DOPPEL;
	}
	// ----
    if( DS_MAP_RANGE(m_UserData[SlotIndex].MapNumber) )
	{
		return TEMP_DEVILSQUARE;
	}
	// ----
	return false;
}
void CDevilSquare::SetMonster()
{
    int result;
    for ( int n=0; n<OBJ_MAXMONSTER; n++)
    {
        if ( DS_MAP_RANGE(gMSetBase.m_Mp[n].m_MapNumber) != FALSE )
        {
            WORD wMonIndex = gMSetBase.m_Mp[n].m_Type;
            BYTE btDSIndex = -1;

            if ( gMSetBase.m_Mp[n].m_X == 119 )
            {
                btDSIndex = DEVIL_SQUARE_GROUND_1;
            }
            else if ( gMSetBase.m_Mp[n].m_X == 121 )
            {
                btDSIndex = DEVIL_SQUARE_GROUND_2;
            }
            else if ( gMSetBase.m_Mp[n].m_X == 49 )
            {
                btDSIndex = DEVIL_SQUARE_GROUND_3;
            }
            else if ( gMSetBase.m_Mp[n].m_X == 53 )
            {
                btDSIndex = DEVIL_SQUARE_GROUND_4;
            }
            else if ( gMSetBase.m_Mp[n].m_X == 120 )
            {
                btDSIndex = DEVIL_SQUARE_GROUND_5;
            }
            else if ( gMSetBase.m_Mp[n].m_X == 122 )
            {
                btDSIndex = DEVIL_SQUARE_GROUND_6;
            }
            else if ( gMSetBase.m_Mp[n].m_X == 50 )
            {
                btDSIndex = DEVIL_SQUARE_GROUND_7;
            }

            if ( btDSIndex == 0xFF )
            {
                LogAddTD("[DevilSquare] [%d] Invalid MonterType", wMonIndex);
                continue;
            }

            result = gObjAddMonster(gMSetBase.m_Mp[n].m_MapNumber);

            if ( result >= 0 )
            {
                gObjSetPosMonster(result, n);
                gObjSetMonster(result, wMonIndex);
                gObj[result].MaxRegenTime = 1000;	// Rgeneration in 1 second
                gObj[result].m_bDevilSquareIndex = btDSIndex;
            }
        }
    }
}
void CDevilSquare::ClearMonstr()
{
    for ( int n=0; n<OBJ_MAXMONSTER; n++)
    {
        if ( DS_MAP_RANGE(gObj[n].MapNumber) != FALSE )
        {
            gObjDel(n);
        }
    }
}
Example #7
0
void CDevilSquare::ClearMonstr()
{
#if (MP==1)
#pragma omp parallel for
#endif
	for ( int n=0;n<OBJ_MAXMONSTER;n++)
	{
		if ( DS_MAP_RANGE(gObj[n].MapNumber) )
		{
			gObjDel(n);
		}
	}
}
Example #8
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;
}
void CDevilSquare::gObjScoreClear()
{
    for ( int n=OBJ_STARTUSERINDEX; n<OBJMAX; n++)
    {
        if ( gObj[n].Connected == PLAYER_PLAYING )
        {
            if ( DS_MAP_RANGE(gObj[n].MapNumber) != FALSE )
            {
                gObj[n].m_nEventScore = 0;
                gObj[n].m_nEventMoney = 0;
                gObj[n].m_nEventExp = 0;
            }
        }
    }
}
void CDevilSquare::CheckInvalidUser()
{
    for ( int n=OBJ_STARTUSERINDEX; n<OBJMAX; n++)
    {
        if ( gObj[n].Connected == PLAYER_PLAYING )
        {
            if ( DS_MAP_RANGE(gObj[n].MapNumber) != FALSE )
            {
                if ( this->m_eState == DevilSquare_CLOSE )
                {
                    LogAddC(2, "[DevilSquare] [%s][%s] Found user in DevilSquare [State:Close]",
                            gObj[n].AccountID, gObj[n].Name);
                    gObjUserKill(gObj[n].m_Index);
                }
            }
        }
    }
}
Example #11
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;
}
Example #12
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;
}
void CDevilSquare::ProcPlaying()
{
    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_PLAYING;

                for(int i = 0; i < OBJMAX; i++)
                {
                    if( gObj[i].Connected == PLAYER_PLAYING &&
                            gObj[i].Type == OBJ_USER &&
                            DS_MAP_RANGE(gObj[i].MapNumber) )
                    {
                        DataSend(i,(LPBYTE)&pMsg,sizeof(pMsg));
                    }
                }

                this->m_bSendTimeCount = TRUE;
            }



            if ( this->m_iremainTimeSec < 1 )
            {
                this->SetState(DevilSquare_CLOSE);
            }
        }
    }
    else
    {
        if ( this->m_iTime < GetTickCount() )
        {
            this->m_iRemainTime--;

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

                    TNotice::MakeNoticeMsgEx((TNotice *)&pNotice, 0, lMsg.Get(MSGGET(2, 194)), this->m_iRemainTime);
                    LogAddTD((char*)pNotice.Notice);
                    AllSendSameMapMsg((UCHAR*)&pNotice, pNotice.h.size, MAP_INDEX_DEVILSQUARE);
                    AllSendSameMapMsg((UCHAR*)&pNotice, pNotice.h.size, MAP_INDEX_DEVILSQUARE2);
                }

                for ( int i=0; i<MAX_DEVILSQUARE_GROUND; i++)
                {
                    this->m_DevilSquareGround[i].RegenBossMonster(this->m_iPlaytime - this->m_iRemainTime);
                }

                if ( this->m_iRemainTime == 1 && this->m_iremainTimeSec == -1 )
                {
                    this->m_iremainTimeSec = 60;
                    this->m_iTime = GetTickCount();
                }
                else
                {
                    this->m_iTime = GetTickCount() + 60000;
                }
            }
        }
    }
}
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;
        }
    }
}
Example #15
0
bool CObjBaseAttack::PkCheck(LPOBJ lpObj, LPOBJ lpTargetObj)
{
	/*if ( gLanguage == 0 || gLanguage == 2 || gLanguage == 4)
	{
		if ( lpObj->Type == OBJ_USER )
		{
			if (lpObj->m_PK_Level >= 6 )
			{
				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;
		}
		else if ( gObjGetRelationShip(lpObj, lpTargetObj) == 2 ) // Rivals
		{
			/*if ( gNonPK == FALSE )
			{
				return true;
			}*/
		}
		else 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 ( gUser.ChaosCastleMapRange(lpTargetObj->MapNumber) == false )
			{
				return false;
			}
		}

		if ( gUser.ChaosCastleMapRange(lpObj->MapNumber) == true )
		{
			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 ( gUser.BloodCastleMapRange(lpObj->MapNumber) == true )
		{
			return false;
		}

		if ( gDuel.AreOnDuel(lpObj, lpTargetObj) == false )
		{
			if ( gDuel.IsOnDuel(lpTargetObj) == true )
			{
				return false;
			}
		}

		if ( gLanguage == 0 || gLanguage == 2 )
		{
			if (lpObj->m_PK_Level >= 6 )
			{
				if ( lpObj->m_PK_Count >= 3 )
				{
					/*if ( gPkLimitFree == FALSE )
					{
						return false;
					}*/
				}
			}
			
			if (lpTargetObj->m_PK_Level >= 6 )
			{
				if ( lpTargetObj->m_PK_Count >= 3 )
				{
					/*if ( gPkLimitFree == FALSE )
					{
#if(GS_CASTLE)
						if(g_CastleSiege.GetCastleState() != 7)
						{
							return false;
						}
#else
						return false;
#endif
					}*/
				}
			}

		}
	}
	return true;
}