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);
				}
			}
		}
	}
}
// ----------------------------------------------------------------------------------------
void CDoubleGoer::DeleteChests(char ChestType, char Type)
{
	if ( ChestType == 0 )	// Silver Chest
	{
		for ( int i=0;i<3;i++)
		{
			if ( gDoubleGoer.ChestIndex[Type][i] != -1 )
			{
				CLog.LogAdd("[DoubleGoer]: Delete Chests -> Delete Silver Chest (%d)",gDoubleGoer.ChestIndex[Type][i]);
				gObjDel(gDoubleGoer.ChestIndex[Type][i]);
				gDoubleGoer.ChestIndex[Type][i] = -1;
			}
		}
	}
	else if ( ChestType == 1 )	// Golden Chest
	{
		if ( gDoubleGoer.GoldenChestIndex != -1 )
		{
			CLog.LogAdd("[DoubleGoer]: Delete Chests -> Delete Golden Chest (%d)",gDoubleGoer.GoldenChestIndex);
			gObjDel(gDoubleGoer.GoldenChestIndex);
			gDoubleGoer.GoldenChestIndex = -1;
		}
	}

}
// ----------------------------------------------------------------------------------------
void CDoubleGoer::DeleteMonsters()
{
	for (int i=0;i<255;i++)
	{
		if ( gDoubleGoer.MonstersAddIndex[i] != -1 )
		{
			gObjDel(gDoubleGoer.MonstersAddIndex[i]);
			gDoubleGoer.MonstersAddIndex[i] = -1;
		}
	}
	gDoubleGoer.MonstersAddCount = 0;

	for (int i=0;i<50;i++)
	{
		if ( gDoubleGoer.LarvaIndex[0][i] != -1 )
		{
			gObjDel(gDoubleGoer.LarvaIndex[0][i]);
			gDoubleGoer.LarvaIndex[0][i] = -1;
		}
		if ( gDoubleGoer.LarvaIndex[1][i] != -1 )
		{
			gObjDel(gDoubleGoer.LarvaIndex[1][i]);
			gDoubleGoer.LarvaIndex[1][i] = -1;
		}
		if ( gDoubleGoer.LarvaIndex[2][i] != -1 )
		{
			gObjDel(gDoubleGoer.LarvaIndex[2][i]);
			gDoubleGoer.LarvaIndex[2][i] = -1;
		}
	}

	gDoubleGoer.LarvaCount[0] = 0;
	gDoubleGoer.LarvaCount[1] = 0;
	gDoubleGoer.LarvaCount[2] = 0;
}
void CRaklionSelupan::DeleteSelupan()
{
	int aIndex = this->GetSelupanObjIndex();
	gObjViewportListProtocolDestroy(&gObj[aIndex]);
	gObjViewportClose(&gObj[aIndex]);
	gObjDel(aIndex);
}
void CloseClient ( LPPER_SOCKET_CONTEXT lpPerSocketContext, BOOL bGraceful )
{
	int index = -1;
	index = lpPerSocketContext->nIndex ;

	if ( index >= OBJ_STARTUSERINDEX && index < OBJMAX )
	{
		//
		if( g_OfflineTrade.Update(index, 0) )
		{
			return;
		}
		//
		if ( gObj[index].m_socket != INVALID_SOCKET )
		{
			//
			g_CryptoSessionCS.Close(index);
            g_CryptoSessionSC.Close(index);
    
			//
			if (closesocket(gObj[index].m_socket) == -1 )
			{
				if ( WSAGetLastError() != 10038 )
				{
					return;
				}
			}

			gObj[index].m_socket = INVALID_SOCKET;
		}

		gObjDel(index);
	}
}
Example #6
0
BOOL TMonsterAIGroup::DelGroupInstance(int iGroupNumber)
{
	if ( iGroupNumber < 0 || iGroupNumber >= MAX_MONSTER_AI_GROUP )
	{
		LogAdd("[Monster AI Group] DelGroup() Error - (GroupNumber=%d)", iGroupNumber);
		return FALSE;
	}

	TMonsterAIGroupMember * lpMemb = NULL;

	for ( int j=0;j<TMonsterAIGroup::s_iMonsterAIGroupMemberCount[iGroupNumber];j++)
	{
		lpMemb = &TMonsterAIGroup::s_MonsterAIGroupMemberArray[iGroupNumber][j];

		if ( lpMemb->m_iGroupNumber == iGroupNumber )
		{
			if ( lpMemb->m_iObjIndex != -1 )
			{
				gObjDel(lpMemb->m_iObjIndex);
			}
		}
	}

	return FALSE;
}
void CRaklionSelupan::DeleteSummonMonster()
{
	LPOBJ lpObj = NULL;

	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)
		{
			gObjViewportListProtocolDestroy(lpObj);
			gObjViewportClose(lpObj);
			gObjDel(lpObj->m_Index);
			lpObj->Live = FALSE; 
			lpObj->DieRegen = TRUE;
		}
	}

	LogAddC(5,"[ RAKLION ] [ DeleteSummonMonster ] Delete All SummonMonster");
}
Example #8
0
//========================================================================================================================
void CGPShopAnsCloseHook(int aIndex, BYTE btResult)
{
    if(OfflineShop[aIndex].IsOffTrade)
		gObjDel(aIndex);
	
	CGPShopAnsClose(aIndex,btResult);
}
Example #9
0
//========================================================================================================================
void ResponErrorCloseClientHook(int aIndex)
{	
	if ( aIndex >= OBJECT_MIN && aIndex < OBJECT_MAX )
    {
		OBJECTSTRUCT *gObj = (OBJECTSTRUCT*) OBJECT_POINTER(aIndex);

		if ( aIndex < 0 || aIndex > OBJECT_MAX-1 )
			return;

		if(gObj->Connected == 3)
		{
			if(gObj->Life <= 0)
			{
				//Log.outError("ResponErrorCloseClientHook");
				return;
			}
		}

		if(OfflineShop[aIndex].IsOffTrade != 0)
			return; 

		if (gObj->Connected == PLAYER_EMPTY )
			return;

		closesocket(gObj->m_socket);
		gObj->m_socket = INVALID_SOCKET;

		gObjDel(aIndex);
	}
}
Example #10
0
//004163C0 - identical
BOOL CKalimaGate::DeleteKalimaGate(int iKalimaGateIndex, int iCallOwnerIndex)
{
	EnterCriticalSection(&this->m_critKalimaGate);

	__try
	{
		if ( OBJMAX_RANGE(iKalimaGateIndex )== false || OBJMAX_RANGE(iCallOwnerIndex ) == false)
		{
			LogAddTD("[Kalima] DeleteKalimaGate() - out of Index (iKalimaGateIndex:%d, iCallOwnerIndex:%d)",
				iKalimaGateIndex, iCallOwnerIndex);
			return 0;
		}

		GCDiePlayerSend( &gObj[iKalimaGateIndex], iKalimaGateIndex, 0 , 0);
		gObj[iCallOwnerIndex].m_cKalimaGateExist = FALSE;
		gObj[iCallOwnerIndex].m_iKalimaGateIndex = -1;
		gObjDel(iKalimaGateIndex);
		gObjCharZeroSet(iKalimaGateIndex);
	}
	__finally
	{
		LeaveCriticalSection(&this->m_critKalimaGate);
	}
	return true;
}
Example #11
0
void ResponErrorCloseClient(int index)
{
	if ( index < 0 || index > OBJMAX-1 )
	{
		LogAdd("error-L1 : CloseClient index error");
		return;
	}

	if ( gObj[index].Connected == PLAYER_EMPTY )
	{
		LogAdd("error-L1 : CloseClient connect error");
		return;
	}

	EnterCriticalSection(&criti);
	closesocket(gObj[index].m_socket);
	gObj[index].m_socket = INVALID_SOCKET;

	if(gObj[index].m_socket == INVALID_SOCKET)
	{
		LogAdd("error-L1 : CloseClient INVALID_SOCKET");
	}

	gObjDel(index);
	LeaveCriticalSection(&criti);
}
Example #12
0
//========================================================================================================================
void CloseClient2Hook(_PER_SOCKET_CONTEXT * lpPerSocketContext, int result)
{
    int index = -1;
    index = lpPerSocketContext->nIndex ;    

    if ( index >= OBJECT_MIN && index < OBJECT_MAX )
    {	
		OBJECTSTRUCT *gObj = (OBJECTSTRUCT*) OBJECT_POINTER(index);

		if(gObj->Connected == 3)
		{
			if(gObj->Life <= 0)
			{
				//Log.outError("ResponErrorCloseClientHook");
				return;
			}
		}

        if(OfflineShop[index].IsOffTrade != 0)
            return;

        if ( gObj->m_socket != INVALID_SOCKET )
        {
            if (closesocket(gObj->m_socket) == -1 )
            {
                if ( WSAGetLastError() != WSAENOTSOCK )
                    return;
            }
            gObj->m_socket = INVALID_SOCKET;

	
        }
        gObjDel(index);
    }
}
Example #13
0
void MonsterHerd::Stop()
{
	this->m_bHerdActive = 0;

	if ( this->m_mapMonsterHerd.empty() == false )
	{
		EnterCriticalSection(&this->m_critMonsterHerd);

		if ( this->m_mapMonsterHerd.empty() != false )
		{
			LeaveCriticalSection(&this->m_critMonsterHerd);
		}
		else
		{
			for ( std::map<int, _MONSTER_HERD_DATA>::iterator _Iter = this->m_mapMonsterHerd.begin() ; _Iter != this->m_mapMonsterHerd.end() ; _Iter++)
			{
				_MONSTER_HERD_DATA & pMH_DATA = _Iter->second;
				gObjDel(pMH_DATA.m_iIndex);
			}

			this->m_mapMonsterHerd.erase( this->m_mapMonsterHerd.begin(), this->m_mapMonsterHerd.end() );
			LeaveCriticalSection(&this->m_critMonsterHerd);
		}
	}

}
Example #14
0
/*void OffTradeLogin(int aIndex,LPBYTE aRecv)
{
	PMSG_IDPASS *lpMsg = (PMSG_IDPASS*)aRecv;

	char AccountID[11];
	AccountID[10] = 0;
	memcpy(AccountID,lpMsg->Id,sizeof(lpMsg->Id));
	BuxConvert(AccountID,10);

	for(int i = OBJECT_MIN; i<OBJECT_MAX;i++)
	{
		OBJECTSTRUCT *lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(i);

		if(lpObj->Connected == 3)
		{
			if(!strcmp(AccountID,lpObj->AccountID))
			{
				if(OfflineShop[i].IsOffTrade == 1)
				{
					GJPUserClose(lpObj->AccountID);
					g_Console.ConsoleOutput(4,"[OFFTRADE][%s][%s] Close Offline Shop",lpObj->AccountID,lpObj->Name);
					//LogAdder ("OFFTRADE","Close Offline Shop",i);
					gObjDel(i);
					OfflineShop[i].IsOffTrade = 0;
					//SQL.OffTradeOff(aIndex);
				
				}
			}
		}


	
	}
}*/
void OffTradeLogin(int aIndex,LPBYTE aRecv)
{
	PMSG_IDPASS *lpMsg = (PMSG_IDPASS*)aRecv;

	char AccountID[11];
	AccountID[10] = 0;
	memcpy(AccountID,lpMsg->Id,sizeof(lpMsg->Id));
	BuxConvert(AccountID,10);

	for(int i = OBJECT_MIN; i<OBJECT_MAX;i++)
	{
		OBJECTSTRUCT *lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(i);

		if(lpObj->Connected == 3)
		{
			if(!strcmp(AccountID,lpObj->AccountID))
			{
				if(OfflineShop[i].IsOffTrade == 1)
				{
					GJPUserClose(lpObj->AccountID);
					g_Console.ConsoleOutput(4,"[OFFTRADE][%s][%s] Close Offline Shop",lpObj->AccountID,lpObj->Name);
					//LogAdder ("OFFTRADE","Close Offline Shop",i);
					gObjDel(i);
					OfflineShop[i].IsOffTrade = 0;
					//SQL.OffTradeOff(aIndex);
				}
			}
		}
	}
}
Example #15
0
void CDoppelganger::ClearMonsters()
{
	int Map = this->EventMap - 65;

	for(int X=0; X < DOPPELGANGER_MAX_MONSTERS;X++){
		if(this->CurrentMonster[X] > 0){
			if(gObj[this->CurrentMonster[X]].MapNumber == this->EventMap){
				gObjDel(this->CurrentMonster[X]);
				this->CurrentMonster[X] = -1;
			}
		}
	}
	
	///Clear Larvas
	for(int X=0; X < 5;X++){
		if(this->Larvas[X] > 0){
			if(gObj[this->Larvas[X]].MapNumber == this->EventMap){
				gObjDel(this->Larvas[X]);
				this->Larvas[X] = -1;
			}
		}
	}
		
	//Clear Chest's
	for(int X=0; X < 2;++X){
		if(this->SiverChestIndex[X] != NULL){
			if(gObj[this->SiverChestIndex[X]].MapNumber == this->EventMap){
				gObjDel(this->SiverChestIndex[X]);
				this->SiverChestIndex[X] = -1;
			}
		}
	}

	for(int X=0; X < 3;++X){
		if(this->MonsterBoss[X] != NULL){
			if(gObj[this->MonsterBoss[X]].MapNumber == this->EventMap){
				gObjDel(this->MonsterBoss[X]);
				this->MonsterBoss[X] = -1;
			}
		}
	}
	
	this->GoldenChestIndex = -1;
	this->MonstersCount = 0;

	LogAddTD("[Doppelganger] Monster Cleared");
}
Example #16
0
void CCrywolf::RemoveCrywolfCommonMonster()
{
	for ( int i=0;i<this->m_ObjCommonMonster.m_iObjCount ; i++)
	{
		gObjDel(this->m_ObjCommonMonster.m_iObjIndex[i]);
	}

	this->m_ObjCommonMonster.Reset();
}
void CDevilSquare::ClearMonstr()
{
    for ( int n=0; n<OBJ_MAXMONSTER; n++)
    {
        if ( DS_MAP_RANGE(gObj[n].MapNumber) != FALSE )
        {
            gObjDel(n);
        }
    }
}
Example #18
0
void gObjAllDelete(int index)
{
	for(int n = 0; n < MAX_USEROBJECT; n++)
	{
		if( gObj[n].Connected && (gObj[n].GameServerIndex == index) )
		{			
			gObjDel(n, gObj[n].DBNumber);
		}
	}
}
Example #19
0
void CDoppelganger::OpenChest(int aIndex, int X, int Y, int ChestType)
{
	if(aIndex < (OBJMAX-OBJMAXUSER) || aIndex > (OBJMAX-1)) return;
	if(!gObjIsConnected(aIndex)) return;

	LPOBJ lpObj = &gObj[aIndex];
	
	ChestType -= 541; //0 or 1

	int Index = rand() % this->TotalItems[ChestType];

	if(ChestType == 0){

		memset(this->Larvas,-1,sizeof(this->Larvas));

		gObjDel(this->SiverChestIndex[0]); //Delete Silver 1
		gObjDel(this->SiverChestIndex[1]); //Delete Silver 2

		if((rand()%10000) < this->SilverChest_DropRate){
			DoppelgangerSilverChestItemBagOpen(lpObj,lpObj->MapNumber,X,Y);
		} else {
			this->Larvas[0] = gObjAddMonster(this->EventMap);
			this->Larvas[1] = gObjAddMonster(this->EventMap);
			this->Larvas[2] = gObjAddMonster(this->EventMap);
			this->Larvas[3] = gObjAddMonster(this->EventMap);
			this->Larvas[4] = gObjAddMonster(this->EventMap);

			if(this->Larvas[0] >= 0) this->AddMonster(this->Larvas[0],532,X+1,Y-2);
			if(this->Larvas[1] >= 0) this->AddMonster(this->Larvas[1],532,X-1,Y+1);
			if(this->Larvas[2] >= 0) this->AddMonster(this->Larvas[2],532,X-2,Y+1);
			if(this->Larvas[3] >= 0) this->AddMonster(this->Larvas[3],532,X+2,Y+1);
			if(this->Larvas[4] >= 0) this->AddMonster(this->Larvas[4],532,X-1,Y+2);
		}
	} else if(ChestType == 1) {
		
		DoppelgangerGoldenChestItemBagOpen(lpObj,lpObj->MapNumber,X,Y);
		gObjDel(this->GoldenChestIndex); //Delete Golden Chest!
		
		this->Status = SUCCESS; //Success
		this->State = FINISHED;
	}
}
void CKanturuMonsterMng::ResetRegenMonsterObjData()
{
	for ( int iCount=0;iCount<this->m_KanturuMonster.GetCount();iCount++)
	{
		if ( this->m_KanturuMonster.m_iObjIndex[iCount] != -1 )
		{
			gObjDel(this->m_KanturuMonster.m_iObjIndex[iCount]);
		}
	}

	if ( this->m_iMayaObjIndex != -1 )
	{
		gObjDel(this->m_iMayaObjIndex);
	}

	this->m_KanturuMonster.Reset();
	this->m_iMaxRegenMonsterCount = 0;
	this->m_iAliveMonsterCount = 0;
	this->m_iMayaObjIndex = -1;
}
Example #21
0
void CCastleDeepEvent::ClearMonster() 
{
	for( int iIndex = 0; iIndex < CASTLE_MAX_MONSTER; iIndex++ )
	{
		if( gObjIsConnected(iIndex) )
		{
			if( gObj[iIndex].m_Attribute == 62 )
				gObjDel(iIndex);
		}
	}
}
Example #22
0
void GateDelete()
{	
	for(int i=0;i<255;i++)
	{	
		if(ImperialGateCfg.GatesID[i] !=0)
		{
			gObjDel(ImperialGateCfg.GatesID[i]);
			ImperialGateCfg.GatesNum[i] = 0;
			ImperialGateCfg.GatesID[i] = 0;
		}
	}
}
Example #23
0
void CSummer::RemoveMonsters()
{
	for ( int i=0;i<200;i++)
	{
		if ( gSummer.MonsterIndex[i] != -1 )
		{
			gObjDel(gSummer.MonsterIndex[i]);
			gSummer.MonsterIndex[i] = -1;
		}
	}
	gSummer.MonsterCount = 0;
}
Example #24
0
void CSantaEvent::DeleteMonsters()
{
	for (int i=0;i<200;i++)
	{
		if ( gSantaEvent.MonsterIndex[i] != -1 )
		{
			gObjDel(gSantaEvent.MonsterIndex[i]);
			gSantaEvent.MonsterIndex[i] = -1;
		}
	}
	gSantaEvent.MonsterCount = 0;
}
Example #25
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 #26
0
// -----------------------------------------------------------------------------------------------------------------------
void CIllusionTemple::UnSetTempleMonsters(int iTempleIndex)
{
	if(this->m_IllusionTemple[iTempleIndex].m_Statues[IT_STATUE_UP] >= 0 && 
		this->m_IllusionTemple[iTempleIndex].m_Statues[IT_STATUE_UP] < OBJMAX)
	{
		gObjDel(this->m_IllusionTemple[iTempleIndex].m_Statues[IT_STATUE_UP]);
	}

	if(this->m_IllusionTemple[iTempleIndex].m_Statues[IT_STATUE_DOWN] >= 0 &&
		this->m_IllusionTemple[iTempleIndex].m_Statues[IT_STATUE_DOWN] < OBJMAX)
	{
		gObjDel(this->m_IllusionTemple[iTempleIndex].m_Statues[IT_STATUE_DOWN]);
	}

	for(list<int>::iterator it = this->m_IllusionTemple[iTempleIndex].m_SpawnedMonsters.begin(); 
		it != this->m_IllusionTemple[iTempleIndex].m_SpawnedMonsters.end(); it++)
	{
		gObjDel(*it);
	}

	this->m_IllusionTemple[iTempleIndex].m_SpawnedMonsters.clear();

}
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 #28
0
void XMasEvent::XMasEventEnd()
{
	for ( int iCount=0;iCount<this->m_XMasMonster.GetCount();iCount++)
	{
		if ( this->m_XMasMonster.m_iObjIndex[iCount] != -1 )
		{
			gObjDel(this->m_XMasMonster.m_iObjIndex[iCount]);
		}
	}

	this->m_XMasMonster.Reset();
	this->m_iMaxMonsterCount = 0;
	this->STATE = 0;
}
Example #29
0
void MonstersDelete()
{
	for(int i=0;i<255;i++)
	{	
		if(ImperialMobCfg.MobsID[i] != 0){
			gObjDel(ImperialMobCfg.MobsID[i]);
			ImperialMobCfg.MobsID[i] = 0;
			ImperialMobCfg.MobsMap[i] = 0;
			ImperialMobCfg.MobBoss[i] = 0;
			ImperialMobCfg.MobState[i] = 0;
			ImperialMobCfg.nMonsterOfEvent = 0;
		}
	}
}
Example #30
0
void GJPUserCloseIDMsg(LPSDHP_USERCLOSE_ID lpMsg, int aIndex)
{
	char szAccountId[MAX_IDSTRING+1];
	memcpy(szAccountId,lpMsg->szId,MAX_IDSTRING);
	szAccountId[MAX_IDSTRING] = 0;

	int n = gObjSearchUser(szAccountId);
	if( n == -1 )
	{
		g_Window.ServerLogAdd(ST_JOINSERVER,"error : account not found. (%s) (%s %d)", szAccountId, __FILE__,__LINE__);
		return;
	}

	gObjDel(n,gObj[n].DBNumber);
}