Esempio n. 1
0
BOOL TMonsterAIElement::ApplyElementNightmareWarp(int iIndex, int iTargetIndex, TMonsterAIState * pAIState)
{
	LPOBJ lpObj = &gObj[iIndex];

	BYTE x = this->m_iX;
	BYTE y = this->m_iY;
	PMSG_MAGICATTACK_RESULT pAttack;

	PHeadSetBE((unsigned char *)&pAttack,0x19,sizeof(pAttack));

	pAttack.MagicNumberH = SET_NUMBERH(AT_SKILL_TELEPORT);
	pAttack.MagicNumberL = SET_NUMBERL(AT_SKILL_TELEPORT);

	pAttack.SourceNumberH = SET_NUMBERH(iIndex);
	pAttack.SourceNumberL = SET_NUMBERL(iIndex);
	pAttack.TargetNumberH = SET_NUMBERH(iIndex);
	pAttack.TargetNumberL = SET_NUMBERL(iIndex);

	if ( lpObj->Type == OBJ_USER )
		DataSend(iIndex,(unsigned char *)&pAttack,pAttack.h.size);

	MsgSendV2(lpObj,(unsigned char*)&pAttack,pAttack.h.size);

	LogAddC(2, "[%s] Warp [%d,%d] -> [%d,%d]",
		lpObj->Name, lpObj->X, lpObj->Y, x, y);

	gObjTeleportMagicUse(iIndex,x,y);
	lpObj->TargetNumber = -1;

	return FALSE;
}
Esempio n. 2
0
BOOL TMonsterSkillElement::ApplyElementTeleportSkill(int iIndex, int iTargetIndex)
{
	if ( !OBJMAX_RANGE(iIndex))
		return FALSE;

	if ( gObjCheckUsedBuffEffect(&gObj[iIndex],BUFF_STUN) == TRUE )
		return FALSE;

	if ( gObjCheckUsedBuffEffect(&gObj[iIndex],BUFF_SLEEP) == TRUE )
		return FALSE;

	if ( gObjCheckUsedBuffEffect(&gObj[iIndex],BUFF_EARTHBINDS) == TRUE )
		return FALSE;

	LPOBJ lpObj = &gObj[iIndex];

	BYTE x;
	BYTE y;
	int depth = rand()%4 + 3;
	PMSG_MAGICATTACK_RESULT pAttack;

	if ( (rand()%2) == 0 )
		x = lpObj->X + depth;
	else
		x = lpObj->X - depth;

	if ( (rand()%2) == 0 )
		y = lpObj->Y + depth;
	else
		y = lpObj->Y - depth;

	if ( gObjCheckTeleportArea(iIndex, x, y) == FALSE )
	{
		LogAddC(2, "[%s] Try Teleport Not Move Area [%d,%d]", lpObj->Name,	x, y);
		return FALSE;
	}

	PHeadSetBE((LPBYTE)&pAttack, 0x19, sizeof(pAttack));

	pAttack.MagicNumberH = SET_NUMBERH(AT_SKILL_TELEPORT);
	pAttack.MagicNumberL = SET_NUMBERL(AT_SKILL_TELEPORT);

	pAttack.SourceNumberH = SET_NUMBERH(iIndex);
	pAttack.SourceNumberL = SET_NUMBERL(iIndex);
	pAttack.TargetNumberH = SET_NUMBERH(iIndex);
	pAttack.TargetNumberL = SET_NUMBERL(iIndex);

	if ( lpObj->Type == OBJ_USER )
		DataSend(iIndex, (LPBYTE)&pAttack, pAttack.h.size);	

	MsgSendV2(lpObj, (LPBYTE)&pAttack, pAttack.h.size);	

	LogAddC(2, "[%s] Warp [%d,%d] -> [%d,%d]", lpObj->Name, lpObj->X, lpObj->Y, x, y);

	gObjTeleportMagicUse(iIndex, x, y);
	lpObj->TargetNumber = -1;

	return FALSE;
}
Esempio n. 3
0
void CCrywolf::GiveRewardExp(int iUserIndex, int iRewardExp)
{
	if ( !gObjIsConnected(iUserIndex))
		return;

	if ( iRewardExp <= -1 )
		return;

	int iRET_EXP = 0;
	int iCAL_EXP = iRewardExp;
	int iMAX_LEVCOUNT = 0;

	if ( !gObjIsConnected(iUserIndex))
		return;

	iRET_EXP = iCAL_EXP;

	if ( gObj[iUserIndex].Type == OBJ_USER )
	{
		while ( iCAL_EXP > 0 )
		{
			if ( iCAL_EXP > 0 )
			{
				iCAL_EXP = UTIL.CrywolfMVPLevelUp(iUserIndex, iCAL_EXP);
			}

			iMAX_LEVCOUNT++;

			if ( iMAX_LEVCOUNT > 5 )
			{
				LogAdd("[ Crywolf ][GiveRewardExp] LevelUp Error [%s][%s]",
					gObj[iUserIndex].AccountID, gObj[iUserIndex].Name);

				break;
			}
		}

		PMSG_KILLPLAYER_EXT pMsg;

		PHeadSetBE((LPBYTE)&pMsg, 0x9C, sizeof(pMsg));
		pMsg.NumberH = -1;
		pMsg.NumberL = -1;
		pMsg.ExpH = SET_NUMBERHW(iRewardExp);
		pMsg.ExpL = SET_NUMBERLW(iRewardExp);
		pMsg.DamageH = 0;
		pMsg.DamageL = 0;

		DataSend(iUserIndex, (LPBYTE)&pMsg, pMsg.h.size);
	}
}
Esempio n. 4
0
void AutoExpClass__AddExp(void * lpParam)
{
	PMSG_KILLPLAYER pkillMsg;
	PHeadSetBE((LPBYTE)&pkillMsg, 0x16, sizeof(pkillMsg));

	while(AutoExp.Enabled)
	{
		Sleep(AutoExp.Time);
		for ( int n = OBJ_STARTUSERINDEX ; n < OBJMAX ; n++)
		{
			if ( gObj[n].Connected == PLAYER_PLAYING )
			{
				if ( gObj[n].Type == OBJ_USER )
				{
					if((gObj[n].Level < ReadConfig.Max_Normal_Level)||(gObj[n].MasterCharacterInfo->MasterLevel < ReadConfig.Max_Master_Level))
					{
						if(gObjItsInSafeZone(gObj[n].m_Index) == 1)//If safezone
						{
							int AddExp = 0;
							AddExp = (int)(AutoExp.BaseExp * gObj[n].Level) ;
						
							if(AddExp > 0x0FFFF)
								AddExp = 65534;

							if(AddExp > 0)
							{
								pkillMsg.NumberH = 0xFF;
								pkillMsg.NumberL = 0xFF;
								pkillMsg.ExpH = SET_NUMBERH(AddExp);
								pkillMsg.ExpL = SET_NUMBERL(AddExp);
								pkillMsg.DamageH = SET_NUMBERH(0x00);
								pkillMsg.DamageL = SET_NUMBERL(0x00);

								DataSend(gObj[n].m_Index, (UCHAR*)&pkillMsg, pkillMsg.h.size);

								gObjSetExpPetItem(n, AddExp);
								int LevelUp = 0;
								gObjLevelUp(&gObj[n],AddExp,gObj[n].Class,EVENT_TYPE_AUTOEXP,LevelUp);
							}
						}
					}
				}
			}
		}
	}
}
Esempio n. 5
0
void CCannonTower::CannonTowerAct(int iIndex) // 0x00560940  1.00.19
{
    if( ( rand() % 2 ) != 0 ) 	// review this
    {
        return;
    }
    LPOBJ lpObj = &gObj[iIndex];
    int count = 0;
    int ASBOfs = 0;
    PMSG_BEATTACK_COUNT pCount;
    PMSG_BEATTACK pAttack;

    pCount.h.c = 0xC1;
    pCount.h.headcode = 0x1D;
    pCount.h.size = 0x00;

    pCount.MagicNumberH = SET_NUMBERH(0);
    pCount.MagicNumberL = SET_NUMBERL(0);
    //pCount.MagicNumber = 0x00;
    pCount.Count = 0x00;
    pCount.X = lpObj->X;
    pCount.Y = lpObj->Y;

    ASBOfs = sizeof(PMSG_BEATTACK_COUNT);

    unsigned char AttackSendBuff[256];

    while( true )
    {
        if( lpObj->VpPlayer2[count].state )
        {
            if( lpObj->VpPlayer2[count].type == OBJ_USER )
            {
                int tObjNum = lpObj->VpPlayer2[count].number;

                if( tObjNum >= 0 )
                {
                    if( gObj[tObjNum].m_btCsJoinSide )
                    {
                        if( gObjCalDistance(lpObj, &gObj[tObjNum]) < 7 )
                        {
                            pAttack.NumberH = SET_NUMBERH(tObjNum);
                            pAttack.NumberL = SET_NUMBERL(tObjNum);
                            memcpy( (AttackSendBuff+ASBOfs), (PBYTE)&pAttack, sizeof(PMSG_BEATTACK));
                            ASBOfs += sizeof(PMSG_BEATTACK);
                            pCount.Count++;
                        }
                    }
                }
            }
        }
        count++;

        if( count > MAX_VIEWPORT-1 ) break;
    }
    if( pCount.Count > 0 )
    {
        pCount.h.size = ASBOfs;

        memcpy(AttackSendBuff, (LPBYTE)&pCount, sizeof(PMSG_BEATTACK_COUNT));
        CGBeattackRecv(AttackSendBuff, lpObj->m_Index, 1);

        struct PMSG_UNKNOW_STRUCT
        {
            PBMSG_HEAD h;	// C3:1E
            BYTE NumberX;	// 3
            BYTE NumberH;	// 4
            BYTE NumberL;	// 5
            BYTE X;			// 6
            BYTE Y;			// 7
            BYTE btUnk;		// 8
        };
        PMSG_UNKNOW_STRUCT pSend; // this is not the right Struct, but this will work
        PHeadSetBE((LPBYTE)&pSend, 0x1E, sizeof(PMSG_UNKNOW_STRUCT));
        pSend.NumberX	= 0x32;
        pSend.X			= lpObj->X;
        pSend.Y			= lpObj->Y;
        pSend.btUnk		= 0;
        pSend.NumberH	= SET_NUMBERH(iIndex);
        pSend.NumberL	= SET_NUMBERL(iIndex);

        ::MsgSendV2(lpObj, (PBYTE)&pSend, pSend.h.size);

    }
}
Esempio n. 6
0
void CCannonTower::CannonTowerAct(int iIndex)
{	
	if( ( rand() % 2 ) != 0 )
	{
		return;
	}

	LPOBJ lpObj = &gObj[iIndex];
	int tObjNum;
	int count = 0;
	PMSG_BEATTACK_COUNT pCount;
	PMSG_BEATTACK pAttack;
	BYTE AttackSendBuff[256];
	int ASBOfs;

	ASBOfs = 0;

	pCount.h.c = 0xC1;
	pCount.h.headcode = PROTOCOL_BEATTACK;
	pCount.h.size = 0x00;
	pCount.MagicNumberH = 0x00;
	pCount.MagicNumberL = 0x00;
	pCount.Count = 0x00;
	pCount.X = lpObj->X;
	pCount.Y = lpObj->Y;

	ASBOfs = sizeof(PMSG_BEATTACK_COUNT);

	while( true ) 
	{
		if( lpObj->VpPlayer2[count].state ) 
		{
			if( lpObj->VpPlayer2[count].type == OBJ_USER ) 
			{
				tObjNum = lpObj->VpPlayer2[count].number;

				if( tObjNum >= 0 ) 
				{
					if( gObj[tObjNum].m_btCsJoinSide != 1 )
					{
						if( gObjCalDistance(lpObj, &gObj[tObjNum]) < 7 ) 
						{
							pAttack.NumberH = SET_NUMBERH(tObjNum);
							pAttack.NumberL = SET_NUMBERL(tObjNum);
							memcpy( (AttackSendBuff+ASBOfs), (LPBYTE)&pAttack, sizeof(PMSG_BEATTACK));
							ASBOfs += sizeof(PMSG_BEATTACK);
							pCount.Count++;
						}
					}
				}
			}
		}
		count++;

		if( count > MAX_VIEWPORT-1 ) break;
	}
	if( pCount.Count > 0 ) 
	{
		pCount.h.size = ASBOfs;

		memcpy(AttackSendBuff, (LPBYTE)&pCount, sizeof(PMSG_BEATTACK_COUNT));
		CGBeattackRecv(AttackSendBuff, lpObj->m_Index, 1);

		PMSG_DURATION_MAGIC_SEND pSend;
		PHeadSetBE((LPBYTE)&pSend, 0x1E, sizeof(PMSG_DURATION_MAGIC_SEND));
		pSend.MagicNumberH	= 0;
		pSend.MagicNumberL	= 0x32;
		pSend.X			= lpObj->X;
		pSend.Y			= lpObj->Y;
		pSend.Dir		= 0;
		pSend.NumberH	= SET_NUMBERH(iIndex);
		pSend.NumberL	= SET_NUMBERL(iIndex);
			
		::MsgSendV2(lpObj, (LPBYTE)&pSend, pSend.h.size);

	}
}