Example #1
0
void CCrywolf::CreateCrywolfCommonMonster()
{
	for ( int n=0;n<gMSetBase.m_Count;n++)
	{
		if ( CHECK_CLASS(gMSetBase.m_Mp[n].m_MapNumber, MAP_INDEX_CRYWOLF_FIRSTZONE) )
		{
			if ( gMSetBase.m_Mp[n].m_Type >= 204 && gMSetBase.m_Mp[n].m_Type <= 257 )
				continue;

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

			if ( iIndex >= 0 )
			{
				if ( gObjSetPosMonster(iIndex, n) == FALSE )
				{
					gObjDel(iIndex);
					continue;
				}
				
				if ( gObjSetMonster(iIndex, gMSetBase.m_Mp[n].m_Type) == FALSE )
				{
					gObjDel(iIndex);
					continue;
				}

				if ( gObj[iIndex].Type == OBJ_MONSTER )
				{
					g_Crywolf.m_ObjCommonMonster.AddObj(iIndex);
				}
			}
		}
	}
}
int MonsterAddAndSpawn(WORD Monster,BYTE Speed,BYTE Map,BYTE X, BYTE Y)
{
	int MobCount = *(DWORD *)(MonsterCount);

	if((MobCount + 1) < MonsterCount)
	{
		MobCount++;
		*(DWORD *)(MonsterCount) = MobCount;
		*(WORD *)(12 * MobCount + MonsterReads) = Monster;
		*(BYTE *)(12 * MobCount + MonsterReads+2) = Map;
		*(BYTE *)(12 * MobCount + MonsterReads+3) = Speed;
		*(BYTE *)(12 * MobCount + MonsterReads+4) = X;
		*(BYTE *)(12 * MobCount + MonsterReads+5) = Y;
		*(BYTE *)(12 * MobCount + MonsterReads+6) = 2;
		*(BYTE *)(12 * MobCount + MonsterReads+7) = X;
		*(BYTE *)(12 * MobCount + MonsterReads+8) = Y;

		int MobID = gObjAddMonster(*(BYTE *)(12 * MobCount + (MonsterReads+2)));
		if(MobID>=0)
		{
			int MobNr = *(WORD *)(12 * MobCount + MonsterReads);
			gObjSetPosMonster(MobID, MobCount);
			gObjSetMonster(MobID, MobNr);
		}

		return MobID;
	}else
	{		
		MessageBox(NULL,"Monster attribute max over!!", "Monsters overflow", 0);
		return -1;
	}
}
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;
            }
        }
    }
}
Example #4
0
void CCastleDeepEvent::AddMonster(int iAssultType, int iGroup) 
{
	std::map<int, std::vector<CASTLEDEEP_MONSTERINFO> >::iterator it = this->m_mapMonsterInfo.find(iAssultType);

	if( it == this->m_mapMonsterInfo.end() ) 
		return;

	//for( CASTLEDEEP_MONSTERINFO *it2 = it->second.begin(); it2 != it->second.end(); it2++ )
	for( std::vector<CASTLEDEEP_MONSTERINFO>::iterator it2 = it->second.begin(); it2 != it->second.end(); it2++ )
	{
		//CASTLEDEEP_MONSTERINFO *pMonsterInfo = it2;
		std::vector<CASTLEDEEP_MONSTERINFO>::iterator pMonsterInfo = it2;

		if( pMonsterInfo->m_iMonsterGroup != iGroup )
			continue;

		LogAddTD("[CastleDeep Event][AT:%d,GR:%d] - Adding Monsters ID: %d / QTY: %d",iAssultType,iGroup,pMonsterInfo->m_iMonsterType,pMonsterInfo->m_iMonsterNumber);
		for( int i = 0; i < pMonsterInfo->m_iMonsterNumber; i++ )
		{
			BYTE cX, cY;

			if( ::gObjGetRandomFreeArea(MAP_INDEX_CASTLESIEGE, cX, cY, pMonsterInfo->m_iSX, pMonsterInfo->m_iSY, pMonsterInfo->m_iDX, pMonsterInfo->m_iDY, 50) == TRUE )
			{
				int iMobIndex = gObjAddMonster(MAP_INDEX_CASTLESIEGE);

				if( iMobIndex >= 0 )
				{
					gObj[iMobIndex].m_PosNum = -1;
					gObj[iMobIndex].X = cX;
					gObj[iMobIndex].Y = cY;
					gObj[iMobIndex].MapNumber = MAP_INDEX_CASTLESIEGE;
					gObj[iMobIndex].TX = gObj[iMobIndex].X;
					gObj[iMobIndex].TY = gObj[iMobIndex].Y;
					gObj[iMobIndex].m_OldX = gObj[iMobIndex].X;
					gObj[iMobIndex].m_OldY = gObj[iMobIndex].Y;
					gObj[iMobIndex].Dir = 1;
					gObj[iMobIndex].StartX = gObj[iMobIndex].X;
					gObj[iMobIndex].StartY = gObj[iMobIndex].Y;

					gObjSetMonster(iMobIndex, pMonsterInfo->m_iMonsterType,"CCastleDeepEvent::AddMonster");

					gObj[iMobIndex].m_Attribute = 62;
					gObj[iMobIndex].Dir = ( rand() % 8 );
					gObj[iMobIndex].DieRegen = 0;
					gObj[iMobIndex].RegenTime = 1;
					gObj[iMobIndex].MaxRegenTime = 1000;
					gObj[iMobIndex].m_dwLastCheckTick = GetTickCount();

					gObj[iMobIndex].m_MoveRange = 5;
					gObj[iMobIndex].m_ViewRange = 15;
				}
			}
		}
	}
}
Example #5
0
BOOL CRaklionSelupan::CreateSelupan()
{
	int m_Type = -1;

	for ( int n=0;n<gMSetBase.m_Count;n++)
	{
		if( gMSetBase.m_Mp[n].m_Type == 459 )
		{
			m_Type = n;
		}
	}

	LPOBJ lpObj = NULL;
	int result = 0;


	result = gObjAddMonster(MAP_INDEX_RAKLION_BOSS);

	if ( result < 0 )
	{
		LogAddTD("[RAKLION] CreateSelupan error");
		return FALSE;
	}
	
	lpObj = &gObj[result];
	
	gObjSetPosMonster(result, m_Type);
	
	gObjSetMonster(result, 459); 
	
	LogAddTD("[RAKLION] Create Selupan : X (%d) / Y(%d)",lpObj->X,lpObj->Y);

	LPOBJ lpTargetObj = NULL;

	for(int n=0;n<OBJMAX;n++){

		lpTargetObj = &gObj[n];

		if(lpTargetObj->MapNumber == MAP_INDEX_RAKLION_BOSS){
			gObjStateSetCreate(n);
			gObjViewportListDestroy(n);
			gObjViewportListCreate(n);
			gObjViewportListProtocol(n);
		}
	}
	
	gObjSetState();

	this->m_iBossAttackMin = lpObj->m_AttackDamageMin;
	this->m_iBossAttackMax = lpObj->m_AttackDamageMax;

	return TRUE;
}
void CRaklionSelupan::CreateSummonMonster()
{
	LPOBJ lpObj = NULL;//loc2 
	int loc3 = -1;
	int loc4 = -1;

	for (int i = 0; i < OBJ_MAXMONSTER; ++i )
	{
		lpObj = &gObj[i];

		if ( lpObj->MapNumber != MAP_INDEX_RAKLIONBOSS )
		{
			continue;
		}

		if(lpObj->Class == 457 || lpObj->Class == 458)
		{
			if(lpObj->Connected == 3 && lpObj->DieRegen == 0 && lpObj->Live == 1) 
			{
				continue;
			}

			loc4 = lpObj->Class;
			loc3 = lpObj->m_PosNum;
			
			gObjCharZeroSet(i);
			
			gObjDel(lpObj->m_Index);

			lpObj->Class = 0;

			int iMonsterIndex = gObjAddMonster(MAP_INDEX_RAKLIONBOSS);

			lpObj = &gObj[iMonsterIndex];

			if (iMonsterIndex >= 0)
			{
				gObjSetPosMonster(iMonsterIndex, loc3);
				gObjSetMonster(iMonsterIndex, loc4); 
				lpObj->Live = 1;
				lpObj->DieRegen = 0;
				LogAddTD("[RAKLION] Summoned Monster : %s => X-(%d) Y-(%d)",lpObj->Name,lpObj->X,lpObj->Y);
				return;
			}

			LogAddTD("[RAKLION] CreateSelupan error");	
			return;
		}
	}
}
Example #7
0
void CDevilSquareGround::RegenBossMonster(int currtime)
{
	for ( int i=0;i<MAX_ST_DEVILSQUARE_MONSTER;i++)
	{
		if ( this->m_DevilSquareBossMonsterInfo[i].m_Type != -1 )
		{
			if ( currtime == this->m_DevilSquareBossMonsterInfo[i].m_RegenStartTime )
			{
				int iMapNumber = (this->m_DevilSquareBossMonsterInfo[i].m_iDevilSquareNumber >= DEVIL_SQUARE_GROUND_1&& this->m_DevilSquareBossMonsterInfo[i].m_iDevilSquareNumber <= DEVIL_SQUARE_GROUND_4)?MAP_INDEX_DEVILSQUARE:(this->m_DevilSquareBossMonsterInfo[i].m_iDevilSquareNumber>=DEVIL_SQUARE_GROUND_5  && this->m_DevilSquareBossMonsterInfo[i].m_iDevilSquareNumber <= DEVIL_SQUARE_GROUND_7 )?MAP_INDEX_DEVILSQUARE2:-1;

				int iMonIndex = gObjAddMonster(iMapNumber);

				if ( iMonIndex >= 0 )
				{
					gObjSetMonster(iMonIndex, this->m_DevilSquareBossMonsterInfo[i].m_Type,"CDevilSquareGround::RegenBossMonster");
					gObj[iMonIndex].MapNumber = iMapNumber;
					gMSetBase.GetBoxPosition(gObj[iMonIndex].MapNumber,
						this->m_DevilSquareBossMonsterInfo[i].X, this->m_DevilSquareBossMonsterInfo[i].Y,
						this->m_DevilSquareBossMonsterInfo[i].TX, this->m_DevilSquareBossMonsterInfo[i].TY,
						gObj[iMonIndex].X, gObj[iMonIndex].Y);
					int map = gObj[iMonIndex].MapNumber;
					int x = gObj[iMonIndex].X;
					int y = gObj[iMonIndex].Y;

					LogAddTD("[DevilSquare][%d][Boss] ID:%d Location: %d [%d,%d] create ", 
						this->m_DevilSquareBossMonsterInfo[i].m_iDevilSquareNumber,
						this->m_DevilSquareBossMonsterInfo[i].m_Type,
						map, x, y
					);

					gObj[iMonIndex].TX = gObj[iMonIndex].X;
					gObj[iMonIndex].TY = gObj[iMonIndex].Y;
					gObj[iMonIndex].MTX = gObj[iMonIndex].X;
					gObj[iMonIndex].MTY = gObj[iMonIndex].Y;
					gObj[iMonIndex].StartX = gObj[iMonIndex].X;
					gObj[iMonIndex].StartY = gObj[iMonIndex].Y;
						//gObj[iMonIndex].m_OldX = gObj[iMonIndex].X;
						//gObj[iMonIndex].m_OldY = gObj[iMonIndex].Y;
					
					gObj[iMonIndex].m_bDevilSquareIndex = this->m_iIndex;
					gObj[iMonIndex].DieRegen = FALSE;
					gObj[iMonIndex].m_PosNum = -1;
					gObj[iMonIndex].Live = TRUE;
					gObj[iMonIndex].m_State = 1;
				}
			}
		}
	}
}
Example #8
0
void cSummerEvent::SetMonsters()
{
    if(this->Enabled == 1 && this->Start == 1)
    {
        for(int i=0; i<this->MonsterCount; i++)
        {
            int MobID = gObjAddMonster(gMSetBase.m_Mp[this->Monster[i].Pos].m_MapNumber);
            if(MobID >= 0)
            {
                this->Monster[i].ID = MobID;
                gObjSetPosMonster(MobID, this->Monster[i].Pos);
                gObjSetMonster(MobID, gMSetBase.m_Mp[this->Monster[i].Pos].m_Type,"cSummerEvent::SetMonsters");
            }
        }
    }
}
// ----------------------------------------------------------------------------------------
void CDoubleGoer::AddMonster(unsigned char Map,short MonsterType,unsigned char X, unsigned char Y, unsigned char Type)
{
	int result = -1;
	// ----
	result = gObjAddMonster(Map);

	if ( result >= 0 )
	{
		gObj[result].X = X;
		gObj[result].Y = Y;
		gObj[result].MapNumber = Map;
		gObj[result].TX = gObj[result].X;
		gObj[result].TY = gObj[result].Y;
		gObj[result].m_OldX = gObj[result].X;
		gObj[result].m_OldY = gObj[result].Y;
		gObj[result].StartX = gObj[result].X;
		gObj[result].StartY = gObj[result].Y;
		gObjSetMonster(result, MonsterType);
		gObj[result].Dir = rand()%8;

		if ( MonsterType == 541 )
		{
			for (int i=0;i<3;i++)
			{
				if ( gDoubleGoer.ChestIndex[Type][i] == -1 )
				{
					gDoubleGoer.ChestIndex[Type][i] = result;
					break;
				}
			}
		}
		else if ( MonsterType == 532 )
		{
			gDoubleGoer.LarvaIndex[Type][gDoubleGoer.LarvaCount[Type]] = result;
			gDoubleGoer.LarvaCount[Type]++;
		}
		else
		{
			gDoubleGoer.GoldenChestIndex = result;
		}
		CLog.LogAdd("[DoubleGoer]: Add Monster -> Added Monster (%)",result);
	}
	else
	{
		CLog.LogAdd("[BUG TRACER][DoubleGoer]: Add Monster -> Add Monster Error");
	}
}
Example #10
0
void CSummer::AddMonsters()
{
	BYTE Map[6] = {7,4,33,8,37,57};
	BYTE MapNumber;
	int iMonsterIndex;
	// ----
	for (int i=0;i<gSummer.MaxGhost;i++)
	{
		MapNumber = Map[rand()%6];

		iMonsterIndex = gObjAddMonster(MapNumber);

		if( iMonsterIndex >= 0 )
		{
			LPOBJ lpObj = &gObj[iMonsterIndex];
			gObjSetMonster(iMonsterIndex, 463);

			while ( gMSetBase.GetBoxPosition(MapNumber, 80, 80, 170, 170, lpObj->X, lpObj->Y) == 0 )
			{

			}

			lpObj->Life = lpObj->MaxLife;
			lpObj->TX = lpObj->X;
			lpObj->TY = lpObj->Y;
			lpObj->MTX = lpObj->X;
			lpObj->MTY = lpObj->Y;
			lpObj->StartX = (BYTE)lpObj->X;
			lpObj->StartY = (BYTE)lpObj->Y;
			lpObj->MapNumber = MapNumber;
			//lpObj->m_MoveRange = 4;
			lpObj->Dir = rand()%8;

			gSummer.MonsterIndex[gSummer.MonsterCount] = iMonsterIndex;
			gSummer.MonsterCount++;

			CLog.LogAdd("Make Fire Flame Ghost Map %d Coords (%d,%d)",lpObj->MapNumber,lpObj->X,lpObj->Y);
		}
	}
}
void CDevilSquare::gDevilSquareMonsterRegen(LPOBJ lpObj)
{
    BYTE devilsquareindex = lpObj->m_bDevilSquareIndex;

    if ( devilsquareindex < 0 || devilsquareindex >= MAX_DEVILSQUARE_GROUND )
    {
        LogAddTD("[DevilSquare] Invalid DevilSquareIndex [%d]", devilsquareindex);
        return;
    }

    if ( lpObj->m_PosNum == -1 )
    {
        gObjDel(lpObj->m_Index);
        return;
    }

    WORD monstertype = this->m_DevilSquareGround[devilsquareindex].GetMonsterType(this->m_iPlaytime - this->m_iRemainTime );

    if ( monstertype == (BYTE)-1 )
    {
        LogAddTD("[DevilSquare] [%d] Invalid MonterType", monstertype);
        return;
    }

    for ( int n=0; n<MAX_MAGIC; n++)
    {
        lpObj->Magic[n].Clear();
    }

    gObjSetMonster(lpObj->m_Index, monstertype);
    lpObj->DieRegen = FALSE;
    gObjMonsterRegen(lpObj);
    CreateFrustrum(lpObj->X, lpObj->Y, lpObj->m_Index);
    lpObj->m_bDevilSquareIndex = devilsquareindex;
    lpObj->MaxRegenTime = 1000;

    LogAddTD("[DevilSquare] Monter Regen [%d][%d][%d,%d]",
             monstertype, devilsquareindex, lpObj->X, lpObj->Y);
}
Example #12
0
void CDoppelganger::AddMonster(int aIndex, int Class, int X, int Y){

	LPOBJ lpObj = &gObj[aIndex];
	  
	lpObj->MapNumber = this->EventMap;
	lpObj->X = X;
	lpObj->Y = Y;

	gObjSetMonster(aIndex,Class);

	if(lpObj->Class == 541 || lpObj->Class == 542) lpObj->m_MoveRange = 0;

	float PartyPercent = 0;
	if(this->PlayersCount == 2){
		PartyPercent = 0.2f;
	} else if(this->PlayersCount == 3){
		PartyPercent = 0.5f;
	} else if(this->PlayersCount == 4){
		PartyPercent = 1.0f;
	} else if(this->PlayersCount == 5){
		PartyPercent = 1.7f;
	}
	
	lpObj->Life += lpObj->Life * (this->EventLevel * 0.3f);
	lpObj->MaxLife = lpObj->Life;
	lpObj->m_Defense += (int)(lpObj->m_Defense * (this->EventLevel * 0.06f));
	lpObj->m_AttackDamageMin += (int)(lpObj->m_AttackDamageMin * (this->EventLevel * 0.13f));
	lpObj->m_AttackDamageMax += (int)(lpObj->m_AttackDamageMax * (this->EventLevel * 0.16f));

	if(this->PlayersCount > 1){
		lpObj->Life += lpObj->Life * PartyPercent;
		lpObj->MaxLife = lpObj->Life;
		lpObj->m_Defense += (int)(lpObj->m_Defense * PartyPercent);
		lpObj->m_AttackDamageMin += (int)(lpObj->m_AttackDamageMin * PartyPercent);
		lpObj->m_AttackDamageMax += (int)(lpObj->m_AttackDamageMax * PartyPercent);
	}
}
void CHatcheryEvent::SetMonsters(int iState)
{
	for (int i = 0; i < this->m_MonsterCount; i++)
	{
		if (this->m_MonsterInfo[i].m_MonsterState == iState)
		{
			int Result = gObjAddMonster(5);

			if (Result >= 0)
			{
				gObj[Result].X = this->m_MonsterInfo[i].m_MonsterX;
				gObj[Result].Y = this->m_MonsterInfo[i].m_MonsterY;
				gObj[Result].MapNumber = 5;
				gObj[Result].TX = gObj[Result].X;
				gObj[Result].TY = gObj[Result].Y;
				gObj[Result].m_OldX = gObj[Result].X;
				gObj[Result].m_OldY = gObj[Result].Y;
				gObj[Result].StartX = (BYTE)gObj[Result].X;
				gObj[Result].StartY = (BYTE)gObj[Result].Y;
				gObjSetMonster(Result, this->m_MonsterInfo[i].m_MonsterID);
				gObj[Result].Dir = rand() % 8;

				gObj[Result].Level = (1.2 * (this->m_MonsterInfo[i].m_MonsterLevel / 4)) + (this->m_MonsterInfo[i].m_MonsterState * 2);
				gObj[Result].Life = this->m_MonsterInfo[i].m_MonsterLife * (this->m_MonsterInfo[i].m_MonsterState + this->m_HatcheryEvent.m_UserCount);
				gObj[Result].m_Defense = this->m_MonsterInfo[i].m_MonsterDefense * (this->m_MonsterInfo[i].m_MonsterState + 1);
				gObj[Result].m_AttackDamageMin = this->m_MonsterInfo[i].m_MonsterDamageMin * (this->m_MonsterInfo[i].m_MonsterState);
				gObj[Result].m_AttackDamageMax = this->m_MonsterInfo[i].m_MonsterDamageMax * (this->m_MonsterInfo[i].m_MonsterState * 2);

				this->m_HatcheryEvent.m_SpawnedMonsters++;
				this->m_HatcheryEvent.m_MonsterIndex[this->m_HatcheryEvent.m_SpawnedMonsters] = Result;

				Log.Info("[HatcheryEvent] Mob Add: Level: %d, Defense: %d, DmgMin: %d, DmgMax: %d", gObj[Result].Level, gObj[Result].m_Defense, gObj[Result].m_AttackDamageMin, gObj[Result].m_AttackDamageMax);
			}
		}
	}
}
Example #14
0
int CLifeStone::CreateLifeStone(int iIndex)
{
	LPOBJ lpObj = &gObj[iIndex];
	int iMonsterIndex = -1;
	BYTE cX = (BYTE)lpObj->X;
	BYTE cY = (BYTE)lpObj->Y;

	if ( g_CastleSiegeSync.GetCastleState() != 7 )
	{
		MsgOutput(iIndex, "You can't summon the Life Stone after the Siege begins.");
		return FALSE;
	}

	if ( lpObj->GuildStatus != 0x80 )
		return FALSE;

	if ( lpObj->m_btCsJoinSide < 2 )
	{
		MsgOutput(iIndex, "Can only be used by the Offensive Alliance.");
		return FALSE;
	}

	if ( lpObj->lpGuild->lpLifeStone  )
	{
		MsgOutput(iIndex, "Life Stone has already been summoned.");
		return FALSE;
	}

	if ( cX > 150 && cX < 210 && cY > 175 && cY < 230 )
	{
		MsgOutput(iIndex, "You can't summon the Life Stone inside the Dragon Tower.");
		return FALSE;
	}

	BYTE btMapAttr = MapC[lpObj->MapNumber].GetAttr(cX, cY);

	if ( gObj[iIndex].MapNumber != MAP_INDEX_CASTLESIEGE )
	{
		MsgOutput(iIndex, "This is not a map of the Offensive Alliance.");
		return FALSE;
	}

	iMonsterIndex = gObjAddMonster(lpObj->MapNumber);

	if ( iMonsterIndex >= 0 )
	{
		MONSTER_ATTRIBUTE * MAttr = gMAttr.GetAttr(278);

		if ( MAttr == NULL )
		{
			gObjDel(iMonsterIndex);
			return FALSE;
		}

		gObjSetMonster(iMonsterIndex, 278);

		gObj[iMonsterIndex].Live = TRUE;
		gObj[iMonsterIndex].Life = MAttr->m_Hp;
		gObj[iMonsterIndex].MaxLife = MAttr->m_Hp;
		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 = lpObj->MapNumber;
		gObj[iMonsterIndex].m_MoveRange = 0;
		gObj[iMonsterIndex].Level = MAttr->m_Level;
		gObj[iMonsterIndex].Type = OBJ_MONSTER;
		gObj[iMonsterIndex].MaxRegenTime = 1000;
		gObj[iMonsterIndex].Dir = 1;
		gObj[iMonsterIndex].RegenTime = GetTickCount();
		gObj[iMonsterIndex].m_Attribute = 0;
		gObj[iMonsterIndex].DieRegen = 0;
		gObj[iMonsterIndex].m_btCsNpcType = OBJ_NPC;
		gObj[iMonsterIndex].m_btCsJoinSide = lpObj->m_btCsJoinSide;
		gObj[iMonsterIndex].lpGuild = lpObj->lpGuild;
		gObj[iMonsterIndex].m_btCreationState = 0;
		lpObj->lpGuild->lpLifeStone = &gObj[iMonsterIndex];

		MsgOutput(iIndex, "Life Stone summon succeeded!");

		LogAdd("[CastleSiege] LifeStone is created - [%s] [%s][%s] (Map:%d)(X:%d, Y:%d)",
			lpObj->lpGuild->Name, lpObj->AccountID, lpObj->Name, lpObj->MapNumber, cX, cY);

		lpObj->m_btLifeStoneCount++;

	}
	else
	{
		MsgOutput(iIndex, "Life Stone summon failed!");
		return FALSE;
	}

	return TRUE;
}
Example #15
0
void XMasEvent::XMasEventInvade()
{
	int iMapNumber = 0;
	WORD wType = 0;
	LPOBJ lpObj;
	int iResult;
	int iRegenCount = 0;

	for (int iCount=0;iCount<this->m_iMaxMonsterCount;iCount++)
	{
		if ( this->m_SetBaseInfo[iCount].wType != 0)
		{
			iResult = gObjAddMonster(this->m_SetBaseInfo[iCount].btMapNumber);

			if ( iResult < 0 )
				{
					LogAddTD("[ SANTA EVENT ][ Set Invasion Monster ] Fail - Type:%d Map[%d]-[%d][%d]",
						this->m_SetBaseInfo[iCount].wType,
						this->m_SetBaseInfo[iCount].btMapNumber,
						this->m_SetBaseInfo[iCount].btX,
						this->m_SetBaseInfo[iCount].btY);
				}
			else
				{
					lpObj = &gObj[iResult];

					lpObj->m_PosNum = -1;
					lpObj->X = this->m_SetBaseInfo[iCount].btX;
					lpObj->Y = this->m_SetBaseInfo[iCount].btY;
					lpObj->MapNumber = this->m_SetBaseInfo[iCount].btMapNumber;

/*				if ( this->GetPosition(iCount, lpObj->MapNumber, lpObj->X, lpObj->Y) == FALSE )
				{
					gObjDel(iResult);
					continue;
				}*/

					lpObj->TX = lpObj->X;
					lpObj->TY = lpObj->Y;
					lpObj->m_OldX = lpObj->X;
					lpObj->m_OldY = lpObj->Y;
					lpObj->StartX = lpObj->X;
					lpObj->StartY = lpObj->Y;
					lpObj->m_MoveRange = this->m_SetBaseInfo[iCount].btDistance;
					lpObj->DieRegen = FALSE;

				if ( this->m_SetBaseInfo[iCount].btDir == 0xFF )
				{
						lpObj->Dir = rand()%8;
				}
				else
				{
						lpObj->Dir = this->m_SetBaseInfo[iCount].btDir;
				}

				if ( gObjSetMonster(iResult, this->m_SetBaseInfo[iCount].wType) == FALSE )
				{
						gObjDel(iResult);
						continue;
				}

				if ( gObj[iResult].Type == OBJ_MONSTER )
				{
					this->m_XMasMonster.AddObj(iResult);
					this->m_iAliveMonsterCount++;

					LogAddTD("[ SANTA EVENT ][ SetInvadeMonster ][ACTIVE]");
				}

				iRegenCount++;
			}
		}
	}
	LogAddTD("[XMAS EVENT] START !!!");
	AllSendServerMsg("[XMAS EVENT] Start in Devias HAPPY HUNTING");
	return;
}
Example #16
0
void TMonsterAIGroup::Init(int iGroupNumber)
{
	if ( TMonsterAIGroup::s_iMonsterAIGroupMemberCount[iGroupNumber] == 0 )
		return;

	TMonsterAIGroup::DelGroupInstance(iGroupNumber);

	for ( int j=0;j<MAX_MONSTER_AI_GROUP_MEMBER;j++)
	{
		TMonsterAIGroupMember & Memb = TMonsterAIGroup::s_MonsterAIGroupMemberArray[iGroupNumber][j];

		if ( Memb.m_iGuid == -1 )
			continue;

		int iResult = gObjAddMonster(Memb.m_iMapNumber);

		if ( iResult >= 0 )
		{
			gObj[iResult].m_PosNum = -1;
			gObj[iResult].MapNumber = Memb.m_iMapNumber;
			gObj[iResult].Live = TRUE;

			gObjViewportListProtocolDestroy(&gObj[iResult]);
			gObjViewportClose(&gObj[iResult]);

			BYTE cX;
			BYTE cY;

			if ( Memb.m_iCreateType == 1 )
			{
				int iRadius = 10;
				BOOL bGetPosition = FALSE;
				int iCount = 100;

				while ( iCount-- != 0 )
				{
					cX = Random(0,iRadius) * ((Random(0,1)==0)?-1:1) + Memb.m_iStartX;
					cY = Random(0,iRadius) * ((Random(0,1)==0)?-1:1) + Memb.m_iStartY;

					BYTE btMapAttr = MapC[Memb.m_iMapNumber].GetAttr(cX, cY);

					if ( btMapAttr == 0 )
					{
						bGetPosition = TRUE;
						break;
					}
				}

				if ( bGetPosition == FALSE )
				{
					gObj[iResult].Live = FALSE;
					gObj[iResult].m_State = 4;
					gObj[iResult].RegenTime = GetTickCount();
					gObj[iResult].DieRegen = 1;

					return;
				}
			}
			else if ( Memb.m_iCreateType == 0 )
			{
				cX = Memb.m_iStartX;
				cY = Memb.m_iStartY;
			}

			gObj[iResult].X = cX;
			gObj[iResult].Y = cY;
			gObj[iResult].MTX = gObj[iResult].X;
			gObj[iResult].MTY = gObj[iResult].Y;
			gObj[iResult].TX = gObj[iResult].X;
			gObj[iResult].TY = gObj[iResult].Y;
			gObj[iResult].StartX = (BYTE)gObj[iResult].X;
			gObj[iResult].StartY = (BYTE)gObj[iResult].Y;


			gObjSetMonster(iResult, Memb.m_iClass);

			gObj[iResult].m_iGroupNumber = Memb.m_iGroupNumber;
			gObj[iResult].m_iGroupMemberGuid = Memb.m_iGuid;
			gObj[iResult].m_iCurrentAI = Memb.m_iStartAI;
			gObj[iResult].m_iBasicAI = Memb.m_iStartAI;
			gObj[iResult].m_iRegenType = Memb.m_iRegenType;
			gObj[iResult].Dir = Memb.m_iStartDir;
			gObj[iResult].m_State = 1;
			gObj[iResult].DieRegen = 0;
			Memb.m_iObjIndex = iResult;

			if ( Memb.m_iCreateType == -1 )
			{
				gObj[iResult].Live = FALSE;
				gObj[iResult].m_State = 4;
				gObj[iResult].RegenTime = GetTickCount();
				gObj[iResult].DieRegen = 1;

				continue;
			}
			
			LogAdd("[ KANTURU ][ SetAIMonster ] %s(Index:%d ObjIndex:%d) Map:%d-[%d][%d]",
				gObj[iResult].Name, gObj[iResult].Class, iResult, gObj[iResult].MapNumber,
				gObj[iResult].X, gObj[iResult].Y);
		}
	}
}
Example #17
0
//----- (00562770) --------------------------------------------------------
BOOL CLifeStone::CreateLifeStone(int iIndex)
{
	LPOBJ lpObj = &gObj[iIndex];
	int iMonsterIndex=-1;

	if ( g_CastleSiege.GetCastleState() != 7 )
	{
		//(98175472, 1248)	(4, 224)
		//(98175472, 1180)	(4, 156)	=> BASE: 1024
		//(98175472, 1500)	(5, 220)	=> 1500-1024 = 476 (220 = 476 - 256)
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 109)), lpObj->m_Index, 1);
		return FALSE;
	}

	if (lpObj->GuildStatus != GUILD_MASTER)
	{
		return FALSE;
	}

	if (lpObj->m_btCsJoinSide < 2 )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 105)), lpObj->m_Index, 1);
		return FALSE;
	}

	if (lpObj->lpGuild == NULL)
		return FALSE;

	if (!lpObj->lpGuild->back)
		return FALSE;

	if (lpObj->lpGuild->back->Number > 0)
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 106)), lpObj->m_Index, 1);
		return FALSE;
	}

	if ( (lpObj->X > 150 && lpObj->X < 210) && (lpObj->Y > 175 && lpObj->Y < 230) )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 108)), lpObj->m_Index, 1);
		return FALSE;
	}

	BYTE btMapAttr = MapC[lpObj->MapNumber].GetAttr(lpObj->X, lpObj->Y);
	if ( lpObj->MapNumber != MAP_INDEX_CASTLESIEGE )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 91)), lpObj->m_Index, 1);
		return FALSE;
	}

	iMonsterIndex = gObjAddMonster(lpObj->MapNumber);
	if ( iMonsterIndex < 0 )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 111)), lpObj->m_Index, 1);
		return FALSE;
	}

	LPMONSTER_ATTRIBUTE lpMATTR = gMAttr.GetAttr(278);
	if ( !lpMATTR )
	{
		gObjDel(iMonsterIndex);
		LogAddTD("[CastleSiege] [%s][%s] LifeStone Vanished (NextMap) - lpMATTR == NULL (SummonIndex:%d)",
			lpObj->AccountID, lpObj->Name, iMonsterIndex);
		return FALSE;
	}
	
	gObjSetMonster(iMonsterIndex, 278,"CLifeStone::CreateLifeStone");

	gObj[iMonsterIndex].Live = TRUE;
	gObj[iMonsterIndex].Life = lpMATTR->m_Hp;
	gObj[iMonsterIndex].MaxLife = lpMATTR->m_Hp;
	gObj[iMonsterIndex].m_PosNum = -1;
	gObj[iMonsterIndex].X = lpObj->X;
	gObj[iMonsterIndex].Y = lpObj->Y;
	gObj[iMonsterIndex].MTX = lpObj->X;
	gObj[iMonsterIndex].MTY = lpObj->Y;
	gObj[iMonsterIndex].TX = lpObj->X;
	gObj[iMonsterIndex].TY = lpObj->Y;
	gObj[iMonsterIndex].m_OldX = lpObj->X;
	gObj[iMonsterIndex].m_OldY = lpObj->Y;
	gObj[iMonsterIndex].StartX = lpObj->X;
	gObj[iMonsterIndex].StartY = lpObj->Y;
	gObj[iMonsterIndex].MapNumber = lpObj->MapNumber;
	gObj[iMonsterIndex].m_MoveRange = 0;
	gObj[iMonsterIndex].Level = lpMATTR->m_Level;	//*(_WORD *)(lpMATTR + 28)
	gObj[iMonsterIndex].Type = OBJ_MONSTER;		//2
	gObj[iMonsterIndex].MaxRegenTime = 1000;
	gObj[iMonsterIndex].Dir = 1;
	gObj[iMonsterIndex].RegenTime = GetTickCount();
	gObj[iMonsterIndex].m_Attribute = 0;
	gObj[iMonsterIndex].DieRegen = 0;
	gObj[iMonsterIndex].m_btCsNpcType = 3;
	gObj[iMonsterIndex].m_btCsJoinSide = lpObj->m_btCsJoinSide;
	gObj[iMonsterIndex].lpGuild = lpObj->lpGuild;
	gObj[iMonsterIndex].m_btCreationState = 0;
	lpObj->lpGuild->back->Number = gObj[iMonsterIndex].m_Index;

	GCServerMsgStringSend(lMsg.Get(MSGGET(6, 105)), lpObj->m_Index, 1);
	LogAddTD("[CastleSiege] LifeStone is created - [%s][%s] (Map:%d)(X:%d, Y:%d)",
		lpObj->AccountID,lpObj->Name,lpObj->MapNumber,lpObj->X,lpObj->Y);

	lpObj->m_btLifeStoneCount += 1;
	return TRUE;
}
Example #18
0
void ObjBotWarper::MakeBot()
{
	if(this->Enabled == true)
	{
		for(int botNum=0;botNum<MAX_BOTWARPER;botNum++)
		{
			if(this->bot[botNum].Enabled == true)
			{
				int result = gObjAddCallMon();

				if(result >= 0)
				{
					this->bot[botNum].index = result;
					gObj[result].m_PosNum = (WORD)-1;
					gObj[result].X = this->bot[botNum].X;
					gObj[result].Y = this->bot[botNum].Y;
					gObj[result].m_OldX = this->bot[botNum].X;
					gObj[result].m_OldY = this->bot[botNum].Y;
					gObj[result].TX = this->bot[botNum].X;
					gObj[result].TY = this->bot[botNum].Y;
					gObj[result].MTX = this->bot[botNum].X;
					gObj[result].MTY = this->bot[botNum].Y;
					gObj[result].Dir = this->bot[botNum].Dir;
					gObj[result].MapNumber = this->bot[botNum].Map;
					gObj[result].Live = TRUE;
					gObj[result].PathCount = 0;
					gObj[result].IsBot = 10;
					gObjSetMonster(result,this->bot[botNum].Class,"PetBot");

					gObj[result].ChangeUP = this->bot[botNum].Class & 0x07;	// Set Second Type of Character
					gObj[result].Class = this->bot[botNum].Class;
					gObj[result].Level = 400;
					gObj[result].Life = 1;
					gObj[result].MaxLife = 2;
					gObj[result].Mana = 1;
					gObj[result].MaxMana = 2;
					gObj[result].Experience = 0;
					gObj[result].DbClass = this->bot[botNum].Class;
					
					gObj[result].pInventory = new CItem[INVENTORY_NORMAL_SIZE];	
					gObj[result].Inventory1 = new CItem[INVENTORY_NORMAL_SIZE];
					gObj[result].InventoryMap1 = new BYTE[INVENTORY_NORMAL_SIZE];
					gObj[result].pInventoryMap = new BYTE[INVENTORY_NORMAL_SIZE];

					for (int i=0;i<INVENTORY_NORMAL_SIZE;i++)
					{
						gObj[result].pInventory[i].Clear();
						gObj[result].Inventory1[i].Clear();
					}

					memset(&gObj[result].pInventoryMap[0], (BYTE)-1, INVENTORY_NORMAL_SIZE);
					memset(&gObj[result].InventoryMap1[0], (BYTE)-1, INVENTORY_NORMAL_SIZE);

					strncpy(gObj[result].Name,this->bot[botNum].Name,sizeof(gObj[result].Name));


					for(int i=0;i<9;i++)
					{
						if(this->bot[botNum].body[i].num >= 0 && this->bot[botNum].body[i].Enabled == true)
						{
							CItem item;
							item.m_Level = this->bot[botNum].body[i].level;
							item.m_SkillOption = 0;
							item.m_LuckOption = 1;
							item.m_Z28Option = this->bot[botNum].body[i].opt;
							item.m_Durability = 255.0f;
							item.m_JewelOfHarmonyOption = 0;
							item.m_ItemOptionEx = 0;
							item.m_ItemSlot1 = 0;
							item.m_ItemSlot2 = 0;
							item.m_ItemSlot3 = 0;
							item.m_ItemSlot4 = 0;
							item.m_ItemSlot5 = 0;
							item.Convert(this->bot[botNum].body[i].num,item.m_SkillOption,item.m_LuckOption,item.m_Z28Option,0,0,item.m_ItemOptionEx,3);

							gObj[result].pInventory[i].m_SkillOption = item.m_SkillOption;
							gObj[result].pInventory[i].m_LuckOption = item.m_LuckOption;
							gObj[result].pInventory[i].m_Z28Option = item.m_Z28Option;
							gObj[result].pInventory[i].m_JewelOfHarmonyOption = item.m_JewelOfHarmonyOption;
							gObj[result].pInventory[i].m_ItemOptionEx = item.m_ItemOptionEx;

							item.m_Number = 0;
							
							gObjInventoryInsertItemPos(gObj[result].m_Index,item,i,0);
						}
					}
					
					gObj[result].Inventory1 = gObj[result].pInventory;
					gObj[result].InventoryMap1 = gObj[result].pInventoryMap;
					gObjMakePreviewCharSet(result);

					gObj[result].m_AttackType = 0;
					gObj[result].BotSkillAttack = 0;					

					gObj[result].m_Attribute = 100;
					gObj[result].TargetNumber = (WORD)-1;
					gObj[result].m_ActState.Emotion = 0;
					gObj[result].m_ActState.Attack = 0;
					gObj[result].m_ActState.EmotionCount = 0;
					gObj[result].PathCount = 0;
					gObj[result].BotPower = 0;
					gObj[result].BotDefense = this->bot[botNum].OnlyVip;
					gObj[result].BotLife = 1;
					gObj[result].BotMaxLife = 1;
					
					gObj[result].BotLvlUpDefense = 1;
					gObj[result].BotLvlUpPower = 1;
					gObj[result].BotLvlUpLife = 1;
					gObj[result].BotLvlUpMana = 1;
					gObj[result].BotLvlUpExp = 1;
					gObj[result].BotLvlUpMaxLevel = 1;

					gObj[result].m_MoveRange = 1;
					gObj[result].BotFollowMe = 0;
					gObj[result].NextExp = gLevelExperience[gObj[result].Level];

					GCRecallMonLife(gObj[result].m_RecallMon,gObj[result].MaxLife,gObj[result].Life);

					ChatSend(&gObj[result],"I'll Warp you!");
					GCActionSend(&gObj[result],AT_SALUTE1,result,result);
				}
			}
		}
	}
}
Example #19
0
void CSantaEvent::AddMonsters()
{
	int iMonsterIndex = gObjAddMonster(0);

	if( iMonsterIndex >= 0 )
	{
		LPOBJ lpObj = &gObj[iMonsterIndex];
		gObjSetMonster(iMonsterIndex, 476);

		while ( gMSetBase.GetBoxPosition(0, g_SantaMapPosition[0][0], g_SantaMapPosition[0][1], g_SantaMapPosition[0][2], g_SantaMapPosition[0][3], lpObj->X, lpObj->Y) == 0 )
		{

		}

		gSantaEvent.BossMapX = lpObj->X;
		gSantaEvent.BossMapY = lpObj->Y; 
			
		lpObj->X = gSantaEvent.BossMapX;
		lpObj->TX = gSantaEvent.BossMapX;
		lpObj->MTX = gSantaEvent.BossMapX;
		lpObj->m_OldX = gSantaEvent.BossMapX;
		lpObj->StartX = gSantaEvent.BossMapX;
		lpObj->Y = gSantaEvent.BossMapY;
		lpObj->TY = gSantaEvent.BossMapY;
		lpObj->MTY = gSantaEvent.BossMapY;
		lpObj->m_OldY = gSantaEvent.BossMapY;
		lpObj->StartY = gSantaEvent.BossMapY;
		lpObj->MapNumber = 0;
		lpObj->Dir = rand()%8;			
		lpObj->Level = 87;
		lpObj->RegenTime = 0;
		lpObj->DieRegen = 0;
		lpObj->m_MoveRange = 1;

		gSantaEvent.MonsterIndex[gSantaEvent.MonsterCount] = iMonsterIndex;
		gSantaEvent.MonsterCount++;

		CLog.LogAdd("Make Evil Santa Claus Map %d Coords (%d,%d)",0,gSantaEvent.BossMapX,gSantaEvent.BossMapY);
	}

	for (int n=0;n<15;n++)
	{
		int iMonsterIndex = gObjAddMonster(0);

		if( iMonsterIndex >= 0 )
		{
			LPOBJ lpObj = &gObj[iMonsterIndex];

			gObjSetMonster(iMonsterIndex, 466);

			gMSetBase.GetBoxPosition(0, gSantaEvent.BossMapX-4, gSantaEvent.BossMapY-4,gSantaEvent.BossMapX+4, gSantaEvent.BossMapY+4, lpObj->X, lpObj->Y);

			lpObj->TX = lpObj->X;
			lpObj->MTX = lpObj->X;
			lpObj->m_OldX = lpObj->X;
			lpObj->StartX = lpObj->X;
			lpObj->Y = lpObj->Y;
			lpObj->TY = lpObj->Y;
			lpObj->MTY = lpObj->Y;
			lpObj->m_OldY = lpObj->Y;
			lpObj->StartY = lpObj->Y;
			lpObj->MapNumber = 0;
			lpObj->Dir = rand()%8;			
			lpObj->Level = 87;
			lpObj->RegenTime = 0;
			lpObj->DieRegen = 0;
			lpObj->m_MoveRange = 1;

			gSantaEvent.MonsterIndex[gSantaEvent.MonsterCount] = iMonsterIndex;
			gSantaEvent.MonsterCount++;

			CLog.LogAdd("Make Cursed Goblin Map %d Coords (%d,%d)",lpObj->MapNumber,lpObj->X,lpObj->Y);
		}
	}
}
int CKanturuMonsterMng::SetKanturuMonster(int iGroupNumber)
{
	int iMapNumber = 0;
	WORD wType = 0;
	LPOBJ lpObj;
	int iResult;
	int iRegenCount = 0;
	
	for ( int iCount=0;iCount<MAX_KANTURU_MONSTER;iCount++)
	{
		if ( this->m_SetBaseInfo[iCount].btGroup == iGroupNumber &&
			 this->m_SetBaseInfo[iCount].wType != 0 )
		{
			iResult  = gObjAddMonster(this->m_SetBaseInfo[iCount].btMapNumber);

			if ( iResult < 0 )
			{
				LogAddTD("[ KANTURU ][ SetBossMapMonster ] Fail - Type:%d Map[%d]-[%d][%d]",
					this->m_SetBaseInfo[iCount].wType,
					this->m_SetBaseInfo[iCount].btMapNumber,
					this->m_SetBaseInfo[iCount].btX,
					this->m_SetBaseInfo[iCount].btY);
			}
			else
			{
				lpObj = &gObj[iResult];

				lpObj->m_PosNum = -1;
				lpObj->X = this->m_SetBaseInfo[iCount].btX;
				lpObj->Y = this->m_SetBaseInfo[iCount].btY;
				lpObj->MapNumber = this->m_SetBaseInfo[iCount].btMapNumber;

				if ( this->GetPosition(iCount, lpObj->MapNumber, lpObj->X, lpObj->Y) == FALSE )
				{
					gObjDel(iResult);
					continue;
				}

				lpObj->TX = lpObj->X;
				lpObj->TY = lpObj->Y;
				lpObj->m_OldX = lpObj->X;
				lpObj->m_OldY = lpObj->Y;
				lpObj->StartX = lpObj->X;
				lpObj->StartY = lpObj->Y;
				lpObj->m_MoveRange = this->m_SetBaseInfo[iCount].btDistance;
				lpObj->DieRegen = FALSE;

				if ( this->m_SetBaseInfo[iCount].btDir == 0xFF )
				{
					lpObj->Dir = rand()%8;
				}
				else
				{
					lpObj->Dir = this->m_SetBaseInfo[iCount].btDir;
				}

				if ( gObjSetMonster(iResult, this->m_SetBaseInfo[iCount].wType) == FALSE )
				{
					gObjDel(iResult);
					continue;
				}

				if ( this->m_SetBaseInfo[iCount].wType == 364 )	/// Maya Hand
				{
					this->m_iMayaObjIndex = iResult;

					LogAddTD("[ KANTURU ][ SetBossMapMonster ] %s(Index:%d / ObjIndex:%d) Map:%d-[%d][%d]",
						gObj[iResult].Name, gObj[iResult].Class, iResult, gObj[iResult].MapNumber,
						gObj[iResult].X, gObj[iResult].Y);

					continue;
				}

				if ( gObj[iResult].Type == OBJ_MONSTER )
				{
					this->m_KanturuMonster.AddObj(iResult);
					this->m_iMaxRegenMonsterCount++;
					this->m_iAliveMonsterCount++;

					LogAddTD("[ KANTURU ][ SetBossMapMonster ] Count:%d %s(Index:%d / ObjIndex:%d) Map:%d-[%d][%d]",
						this->m_iAliveMonsterCount, gObj[iResult].Name, gObj[iResult].Class, iResult,
						gObj[iResult].MapNumber,gObj[iResult].X, gObj[iResult].Y);
				}

				iRegenCount++;
			}
		}
	}

	return iRegenCount;
}
// ----------------------------------------------------------------------------------------
void CDoubleGoer::SetMonsters()
{
	char Type = gDoubleGoer.GetEventIndex(gDoubleGoer.EventMap);

	if ( Type == -1 )
	{
		CLog.LogAdd("[BUG TRACER][DoubleGoer]: Set Monsters -> Type Error");
		return;
	}

	if ( gDoubleGoer.NormalMonsterCount[Type] <= 0 )
	{
		CLog.LogAdd("[BUG TRACER][DoubleGoer]: Set Monsters -> Monster Count Error");
		return;
	}
	int result = -1;
	int MobCt = gDoubleGoer.NormalMonsterCount[Type];

	for (int i=0;i<gDoubleGoer.NormalMonsterCount[Type];i++)
	{
		if ( gDoubleGoer.NormalMonsterPos[Type][i] != -1 )
		{
			result = gObjAddMonster(gDoubleGoer.EventMap);

			if ( result >= 0 )
			{
				gObj[result].m_PosNum = gDoubleGoer.NormalMonsterPos[Type][i];
				gObj[result].X = gMSetBase.m_Mp[gDoubleGoer.NormalMonsterPos[Type][i]].m_X;
				gObj[result].Y = gMSetBase.m_Mp[gDoubleGoer.NormalMonsterPos[Type][i]].m_Y;
				gObj[result].MapNumber = gDoubleGoer.EventMap;
				gObj[result].TX = gObj[result].X;
				gObj[result].TY = gObj[result].Y;
				gObj[result].m_OldX = gObj[result].X;
				gObj[result].m_OldY = gObj[result].Y;
				gObj[result].StartX = gObj[result].X;
				gObj[result].StartY = gObj[result].Y;
				gObj[result].MTX = gDoubleGoer.EventX;
				gObj[result].MTY = gDoubleGoer.EventY;
				gObjSetMonster(result, gMSetBase.m_Mp[gDoubleGoer.NormalMonsterPos[Type][i]].m_Type);
				gObj[result].Dir = rand()%8;

				gDoubleGoer.MonstersAddIndex[gDoubleGoer.MonstersAddCount] = result;
				gDoubleGoer.MonstersAddCount++;
			}
			else
			{
				CLog.LogAdd("[BUG TRACER][DoubleGoer]: Set Monsters -> Add Monster Error");
			}
		}
	}
	for (int i=0;i<3;i++)
	{
		if ( gDoubleGoer.BossMonsterPos[Type][i] != -1 )
		{
			result = gObjAddMonster(gDoubleGoer.EventMap);

			if ( result >= 0 )
			{
				gObj[result].m_PosNum = gDoubleGoer.BossMonsterPos[Type][i];
				gObj[result].X = gMSetBase.m_Mp[gDoubleGoer.BossMonsterPos[Type][i]].m_X;
				gObj[result].Y = gMSetBase.m_Mp[gDoubleGoer.BossMonsterPos[Type][i]].m_Y;
				gObj[result].MapNumber = gDoubleGoer.EventMap;
				gObj[result].TX = gObj[result].X;
				gObj[result].TY = gObj[result].Y;
				gObj[result].m_OldX = gObj[result].X;
				gObj[result].m_OldY = gObj[result].Y;
				gObj[result].StartX = gObj[result].X;
				gObj[result].StartY = gObj[result].Y;
				gObj[result].MTX = gDoubleGoer.EventX;
				gObj[result].MTY = gDoubleGoer.EventY;
				gObj[result].MaxRegenTime = 0;
				gObjSetMonster(result, gMSetBase.m_Mp[gDoubleGoer.BossMonsterPos[Type][i]].m_Type);
				gObj[result].Dir = rand()%8;

				gDoubleGoer.BossMonsterIndex[i] = result;
			}
			else
			{
				CLog.LogAdd("[DoubleGoer]: Set Monsters -> Add Monster Error");
			}
		}
	}


}
Example #22
0
//004166C0 - identical
BOOL CKalimaGate::CreateKalimaGate2(int iIndex, int iMonMapNumber, BYTE cTX, BYTE cTY)
{	
	BOOL bKalimaGateCreateSucceed = FALSE;
	int iMonsterIndex = -1;

	EnterCriticalSection(&this->m_critKalimaGate);

	__try
	{
		if ( !gObjIsConnected(iIndex))
			return FALSE;

		LogAddTD("[Kalima] [%s][%s] Try to Create Kalima Gate (NextMap)",
			gObj[iIndex].AccountID, gObj[iIndex].Name);

		if ( iMonMapNumber < MAP_INDEX_KALIMA1 || iMonMapNumber > MAP_INDEX_KALIMA6-1 )
		{
			LogAddTD("[Kalima] [%s][%s] Failed to Summon Kalima Gate (NextMap) - MapNumber Error : %d",
				gObj[iIndex].AccountID, gObj[iIndex].Name, iMonMapNumber);

			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 (NextMap) - Already Have Gate (SummonIndex:%d)",
				gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].m_iKalimaGateIndex);
	
			return FALSE;
		}

		int iMonsterType = iMonMapNumber + 129;
		BYTE cX = cTX;
		BYTE cY = cTY;
		BYTE btMapAttr = MapC[iMonMapNumber].GetAttr(cX, cY);

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

				return FALSE;
			}
		}

		iMonsterIndex = gObjAddMonster(iMonMapNumber);

		if ( iMonsterIndex >= 0 )
		{
			MONSTER_ATTRIBUTE * lpMATTR = gMAttr.GetAttr(iMonsterType);

			if ( !lpMATTR )
			{
				gObjDel(iMonsterIndex);

				LogAddTD("[Kalima] [%s][%s] Kalima Gate Vanished (NextMap) - 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 = iMonMapNumber;
			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 = 58;
			gObj[iMonsterIndex].DieRegen = FALSE;
			
			LogAddTD("[Kalima] [%s][%s] Create Kalima Gate Successfuly (NextMap) (Live:%d, GateTick:%u, DieRegen:%d, Map:%d, X:%d, Y:%d, SummonIndex:%d, OwnerIndex:%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);
			bKalimaGateCreateSucceed = TRUE;


		}
	}
	__finally
	{
		LeaveCriticalSection(&this->m_critKalimaGate);
	}

	return TRUE;
}
Example #23
0
BOOL MonsterHerd::AddMonster(int iMonsterType, BOOL bRegen, BOOL bAttackFirst)
{
	if ( this->m_bHasInfo == 0 )
	{
		return false;
	}

	int iIndex;
	BYTE btMapNumber = this->m_iMapNumber;
	BYTE cX=0;
	BYTE cY=0;

	if (this->GetRandomLocation(cX, cY) == FALSE )
	{
		return false;
	}

	iIndex = gObjAddMonster(this->m_iMapNumber);

	if ( iIndex >= 0 )
	{
		gObj[iIndex].m_PosNum = -1;
		gObj[iIndex].X = cX;
		gObj[iIndex].Y = cY;
		gObj[iIndex].MapNumber = this->m_iMapNumber;
		gObj[iIndex].TX = gObj[iIndex].X;
		gObj[iIndex].TY = gObj[iIndex].Y;
		gObj[iIndex].m_OldX = gObj[iIndex].X;
		gObj[iIndex].m_OldY = gObj[iIndex].Y;
		gObj[iIndex].StartX = gObj[iIndex].X;
		gObj[iIndex].StartY = gObj[iIndex].Y;

		LPMONSTER_ATTRIBUTE iAttr = gMAttr.GetAttr(iMonsterType);

		if ( iAttr == NULL )
		{
			gObjDel(iIndex);
			return false;
		}

		gObj[iIndex].Level = iAttr->m_Level;
		gObjSetMonster(iIndex, iMonsterType);
		gObj[iIndex].MaxRegenTime = 1000;
		gObj[iIndex].Dir = rand() % 8;
		gObj[iIndex].m_bIsInMonsterHerd = 1;
		gObj[iIndex].m_bIsMonsterAttackFirst = bAttackFirst;
		gObj[iIndex].m_lpMonsterHerd = this;

		EnterCriticalSection(&this->m_critMonsterHerd);

		_MONSTER_HERD_DATA pMonsterData;
		pMonsterData.m_iIndex = iIndex;
		pMonsterData.m_iType = iMonsterType;
		pMonsterData.m_iX = cX;
		pMonsterData.m_iX = cY;	// #error Apply Deathway Fix, change btXMap for btYMap
		pMonsterData.m_bRegen = bRegen;

		this->m_mapMonsterHerd.insert( std::pair<int, _MONSTER_HERD_DATA>(iIndex, pMonsterData) );

		LeaveCriticalSection(&this->m_critMonsterHerd);
	}
	else
	{
		return FALSE;
	}

	return TRUE;

}
Example #24
0
// -----------------------------------------------------------------------------------------------------------------------
void CIllusionTemple::SetTempleMonsters(int iTempleIndex)
{
	if ( IT_FLOOR_RANGE(iTempleIndex) == FALSE )
	{
		return;
	}

	for(int iStatueIndex = 0; iStatueIndex < MAX_IT_STATUES; iStatueIndex++)
	{
		int result = 0;
		result = gObjAddMonster(iTempleIndex + MAP_INDEX_ILLUSION1);
		if ( result >= 0 && result < OBJMAX)
		{
			gObj[result].m_PosNum = -1;
			gObj[result].X = s_itStatuePosition[iStatueIndex].PositionX;
			gObj[result].Y = s_itStatuePosition[iStatueIndex].PositionY;
			gObj[result].MapNumber = MAP_INDEX_ILLUSION1 + iTempleIndex;
			gObj[result].TX = s_itStatuePosition[iStatueIndex].PositionX;
			gObj[result].TY = s_itStatuePosition[iStatueIndex].PositionY;
			gObj[result].m_OldX = s_itStatuePosition[iStatueIndex].PositionX;
			gObj[result].m_OldY = s_itStatuePosition[iStatueIndex].PositionY;
			gObj[result].Dir = s_itStatuePosition[iStatueIndex].Direction;
			gObj[result].StartX = s_itStatuePosition[iStatueIndex].PositionX;
			gObj[result].StartY = s_itStatuePosition[iStatueIndex].PositionY;
			gObjSetMonster(result, 380);
			gObj[result].MaxRegenTime = 200;
			this->m_IllusionTemple[iTempleIndex].m_Statues[iStatueIndex] = result;
		}
		else
		{
			this->SetTempleState(iTempleIndex, IT_STATE_CLOSED);
			CLog.LogAddC(2, "[IllusionTemple] Statue Setup Error! (Statue:%d, Temple:%d)", iStatueIndex, iTempleIndex + 1);
			return;
		}
	}

	this->m_IllusionTemple[iTempleIndex].m_BallOwner = this->m_IllusionTemple[iTempleIndex].m_Statues[rand()%2];

	for ( int n = 0; n < gMSetBase.m_Count; n++)
	{
		if ( IT_MAP_RANGE(gMSetBase.m_Mp[n].m_MapNumber) == TRUE )
		{

			if ( (gMSetBase.m_Mp[n].m_MapNumber - MAP_INDEX_ILLUSION1) != iTempleIndex )
			{
				continue;
			}

			if(gMSetBase.m_Mp[n].m_Type == 380) continue;

			int result = gObjAddMonster(gMSetBase.m_Mp[n].m_MapNumber);
			if ( result >= 0  && result <= OBJMAX)
			{
				gObj[result].m_PosNum = n;
				gObj[result].X = gMSetBase.m_Mp[n].m_X;
				gObj[result].Y = gMSetBase.m_Mp[n].m_Y;
				gObj[result].MapNumber = gMSetBase.m_Mp[n].m_MapNumber;
				gObj[result].TX = gObj[result].X;
				gObj[result].TY = gObj[result].Y;
				gObj[result].m_OldX = gObj[result].X;
				gObj[result].m_OldY = gObj[result].Y;
				gObj[result].Dir = gMSetBase.m_Mp[n].m_Dir;
				gObj[result].StartX = (BYTE)gObj[result].X;
				gObj[result].StartY = (BYTE)gObj[result].Y;
				gObjSetMonster(result, gMSetBase.m_Mp[n].m_Type);
				gObj[result].MaxRegenTime = 2000;
				this->m_IllusionTemple[iTempleIndex].m_SpawnedMonsters.push_back(result);
			}
		}
	}
}
Example #25
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;
}
Example #26
0
//----- (00563760) --------------------------------------------------------
BOOL CMercenary::CreateMercenary(int iIndex, int iMercenaryTypeIndex, BYTE cTX, BYTE cTY)
{
#if (GS_CASTLE==1)
	LPOBJ lpObj = &gObj[iIndex];
	int iMonsterIndex=-1;

	BYTE btMapAttr = MapC[lpObj->MapNumber].GetAttr(cTX, cTY);
	if ( lpObj->MapNumber != MAP_INDEX_CASTLESIEGE )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 91)), lpObj->m_Index, 1);
		return FALSE;
	}

	if ( g_CastleSiege.GetCastleState() != 7 )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 94)), lpObj->m_Index, 1);
		return FALSE;
	}

	if ( iMercenaryTypeIndex != 286 && iMercenaryTypeIndex != 287 )
		goto SKIP_CHK;

	if ( lpObj->m_btCsJoinSide != 1 )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 92)), lpObj->m_Index, 1);
		return FALSE;
	}
	
	if ( lpObj->GuildStatus != GUILD_MASTER && lpObj->GuildStatus != GUILD_ASSISTANT )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 93)), lpObj->m_Index, 1);
		return FALSE;
	}

SKIP_CHK:
	if ( this->m_iMercenaryCount > 100 )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 95)), lpObj->m_Index, 1);
		return FALSE;
	}

	iMonsterIndex = gObjAddMonster(lpObj->MapNumber);
	if ( iMonsterIndex < 0 )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(6, 97)), lpObj->m_Index, 1);
		return FALSE;
	}

	LPMONSTER_ATTRIBUTE lpMATTR = gMAttr.GetAttr(iMercenaryTypeIndex);
	if ( !lpMATTR )
	{
		gObjDel(iMonsterIndex);
		LogAddTD("[CastleSiege] [%s][%s]  Mercenary Vanished (NextMap) - lpMATTR == NULL (SummonIndex:%d)",
			lpObj->AccountID, lpObj->Name, iMonsterIndex);
		return FALSE;
	}

	gObjSetMonster(iMonsterIndex, iMercenaryTypeIndex,"CMercenary::CreateMercenary");

	gObj[iMonsterIndex].Live = TRUE;
	gObj[iMonsterIndex].Life = lpMATTR->m_Hp;
	gObj[iMonsterIndex].MaxLife = lpMATTR->m_Hp;
	gObj[iMonsterIndex].m_PosNum = -1;
	gObj[iMonsterIndex].X = cTX;
	gObj[iMonsterIndex].Y = cTY;
	gObj[iMonsterIndex].MTX = cTX;
	gObj[iMonsterIndex].MTY = cTY;
	gObj[iMonsterIndex].TX = cTX;
	gObj[iMonsterIndex].TY = cTY;
	gObj[iMonsterIndex].m_OldX = cTX;
	gObj[iMonsterIndex].m_OldY = cTY;
	gObj[iMonsterIndex].StartX = cTX;
	gObj[iMonsterIndex].StartY = cTY;
	gObj[iMonsterIndex].MapNumber = lpObj->MapNumber;
	gObj[iMonsterIndex].m_MoveRange = 0;
	gObj[iMonsterIndex].Level = lpMATTR->m_Level;		//*(_WORD *)(lpMATTR + 28) lpMATTR->m_Hp
	gObj[iMonsterIndex].Type = OBJ_MONSTER;				//2
	gObj[iMonsterIndex].MaxRegenTime = 1000;
	gObj[iMonsterIndex].Dir = 1;
	gObj[iMonsterIndex].RegenTime = GetTickCount();
	gObj[iMonsterIndex].m_Attribute = 0;
	gObj[iMonsterIndex].DieRegen = 0;
	gObj[iMonsterIndex].m_btCsNpcType = 2;
	gObj[iMonsterIndex].m_btCsJoinSide = 1;

	GCServerMsgStringSend(lMsg.Get(MSGGET(6, 96)), lpObj->m_Index, 1);

	this->m_iMercenaryCount += 1;

	if ( lpObj->lpGuild )
		LogAddTD("[CastleSiege] Mercenary is summoned [%d] - [%d][%d] [%s][%s][%d] - (Guild : %s)", gObj[iMonsterIndex].Class,gObj[iMonsterIndex].X,gObj[iMonsterIndex].Y,lpObj->AccountID,lpObj->Name,lpObj->MapNumber,lpObj->lpGuild->Name);
	else
		LogAddTD("[CastleSiege] Mercenary is summoned [%d] - [%d][%d] [%s][%s][%d]", gObj[iMonsterIndex].Class,gObj[iMonsterIndex].X,gObj[iMonsterIndex].Y,lpObj->AccountID,lpObj->Name,lpObj->MapNumber);
#endif
	return TRUE;
}
Example #27
0
int CLifeStone::CreateLifeStone(int iIndex)
{
	LPOBJ lpObj = &gObj[iIndex];
	int iMonsterIndex = -1;
	BYTE cX = lpObj->X;
	BYTE cY = lpObj->Y;

	if ( g_CastleSiegeSync.GetCastleState() != CASTLESIEGE_STATE_STARTSIEGE )
	{
		MsgOutput(iIndex, lMsg.Get(1645));
		return FALSE;
	}

	if ( lpObj->GuildStatus != G_MASTER )
	{
		return FALSE;
	}

	if ( lpObj->m_btCsJoinSide < 2 )
	{
		MsgOutput(iIndex, lMsg.Get(1641)); //HermeX Fix
		return FALSE;
	}

	if ( lpObj->lpGuild->lpLifeStone  ) //HermeX Fix
	{
		MsgOutput(iIndex, lMsg.Get(1642)); //HermeX Fix
		return FALSE;
	}
	
	if( cX > 150 && cX < 210 && cY > 175 && cY < 230 )
	{
		MsgOutput(iIndex, lMsg.Get(1644)); //HermeX Fix
		return FALSE;
	}

	BYTE btMapAttr = MapC[lpObj->MapNumber].GetAttr(cX, cY);
	
	if ( btMapAttr & 16 != 16 ) //siege camp?
	{
		//return FALSE;
	}

	if ( gObj[iIndex].MapNumber != MAP_INDEX_CASTLESIEGE )
	{
		MsgOutput(iIndex, lMsg.Get(1627)); //HermeX Fix
		return FALSE;
	}
	
	iMonsterIndex = gObjAddMonster(lpObj->MapNumber);

	if ( iMonsterIndex >= 0 )
	{
	
		MONSTER_ATTRIBUTE * MAttr = gMAttr.GetAttr(278);
	
		if ( MAttr == NULL )
		{
			gObjDel(iMonsterIndex);
			return FALSE;
		}

		gObjSetMonster(iMonsterIndex, 278);
		gObj[iMonsterIndex].Live = TRUE;
		gObj[iMonsterIndex].Life = MAttr->m_Hp;
		gObj[iMonsterIndex].MaxLife = MAttr->m_Hp;
		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 = lpObj->MapNumber;
		gObj[iMonsterIndex].m_MoveRange = 0;
		gObj[iMonsterIndex].Level = MAttr->m_Level;
		gObj[iMonsterIndex].Type = OBJ_MONSTER;
		gObj[iMonsterIndex].MaxRegenTime = 1000;
		gObj[iMonsterIndex].Dir = 1;
		gObj[iMonsterIndex].RegenTime = GetTickCount();
		gObj[iMonsterIndex].m_Attribute = 0;
		gObj[iMonsterIndex].DieRegen = 0;
		gObj[iMonsterIndex].m_btCsNpcType = OBJ_NPC; //HermeX Fix
		gObj[iMonsterIndex].m_btCsJoinSide = lpObj->m_btCsJoinSide;
		gObj[iMonsterIndex].lpGuild = lpObj->lpGuild;
		gObj[iMonsterIndex].m_btCreationState = 0;

		lpObj->lpGuild->lpLifeStone = &gObj[iMonsterIndex]; //SirMaster Fix
		gObj[iMonsterIndex].m_iCreatedActivationTime = 0; //new

		MsgOutput(iIndex, lMsg.Get(1646));
		LogAddTD("[CastleSiege] LifeStone is created - [%s] [%s][%s] (Map:%d)(X:%d, Y:%d)",lpObj->lpGuild->Name,
		lpObj->AccountID,lpObj->Name,lpObj->MapNumber,cX,cY);
		lpObj->m_btLifeStoneCount++;
	}
	else
	{
		MsgOutput(iIndex, lMsg.Get(1647));
		return FALSE;
	}
	return TRUE;
}
int CLifeStone::CreateLifeStone(int iIndex)
{
	LPOBJ lpObj = &gObj[iIndex];
	int iMonsterIndex = -1;
	unsigned char cX = lpObj->X;
	unsigned char cY = lpObj->Y;

	if(g_CastleSiege.GetCastleState() != CASTLESIEGE_STATE_STARTSIEGE)
	{
		MsgOutput(iIndex,lMsg.Get(MSGGET(6,109)));
		return false;
	}

	if(lpObj->GuildStatus != G_MASTER)
		return false;

	if(lpObj->m_btCsJoinSide < 2)
	{
		MsgOutput(iIndex,lMsg.Get(MSGGET(6,105)));
		return false;
	}

	if(lpObj->lpGuild->lpLifeStone != NULL)
	{
		MsgOutput(iIndex,lMsg.Get(MSGGET(6,106)));
		return false;
	}

	if(cX > 150 && cX < 210 && cY > 175 && cY < 230)
	{
		MsgOutput(iIndex,lMsg.Get(MSGGET(6,108)));
		return false;
	}

	unsigned char btMapAttr = MapC[lpObj->MapNumber].GetAttr(cX,cY);

	if(gObj[iIndex].MapNumber != MAP_INDEX_CASTLESIEGE)
	{
		MsgOutput(iIndex,lMsg.Get(MSGGET(6,91)));
		return false;
	}

	iMonsterIndex = gObjAddMonster(lpObj->MapNumber);

	if(iMonsterIndex >= 0)
	{
		MONSTER_ATTRIBUTE * lpMATTR = gMAttr.GetAttr(278);

		if(lpMATTR == NULL)
		{
			gObjDel(iMonsterIndex);
			return false;
		}

		gObjSetMonster(iMonsterIndex,278);
		gObj[iMonsterIndex].Live = TRUE;
		gObj[iMonsterIndex].Life = (float)lpMATTR->m_Hp;
		gObj[iMonsterIndex].MaxLife = (float)lpMATTR->m_Hp;
		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 = lpObj->MapNumber;
		gObj[iMonsterIndex].m_MoveRange = 0;
		gObj[iMonsterIndex].Level = lpMATTR->m_Level;
		gObj[iMonsterIndex].Type = OBJ_MONSTER;
		gObj[iMonsterIndex].MaxRegenTime = 1000;
		gObj[iMonsterIndex].Dir = 1;
		gObj[iMonsterIndex].RegenTime = GetTickCount();
		gObj[iMonsterIndex].m_Attribute = 0;
		gObj[iMonsterIndex].DieRegen = FALSE;
		gObj[iMonsterIndex].m_btCsNpcType = 3;
		gObj[iMonsterIndex].m_btCsJoinSide = lpObj->m_btCsJoinSide;
		gObj[iMonsterIndex].lpGuild = lpObj->lpGuild;
		gObj[iMonsterIndex].m_btCreationState = 0;

		lpObj->lpGuild->lpLifeStone = &gObj[iMonsterIndex];

		MsgOutput(iIndex,lMsg.Get(MSGGET(6,110)));

		LogAddTD("[CastleSiege] LifeStone is created - [%s] [%s][%s] (Map:%d)(X:%d, Y:%d)",
			lpObj->lpGuild->Name,lpObj->AccountID,lpObj->Name,lpObj->MapNumber,cX,cY);

		lpObj->m_btLifeStoneCount++;

	}
	else
	{
		MsgOutput(iIndex,lMsg.Get(MSGGET(6,111)));
		return false;
	}

	return true;
}