Пример #1
0
BOOL CGuildClass::SetGuildMemberStatus(char* szGuildName, char* szMemberName, int iGuildStatus)
{
	_GUILD_INFO_STRUCT * pNode = this->SearchGuild(szGuildName);
	int iKey = -1;

	if ( pNode == NULL )
	{
		return -1;
	}

	for ( int n=0;n<MAX_USER_GUILD;n++)
	{
		if ( pNode->Use[n] == TRUE )
		{
			if ( strcmp(pNode->Names[n], szMemberName) == 0 )
			{
				iKey = n;
			}
		}
	}

	if ( iKey < 0 )
	{
		return 0;
	}
	
	pNode->GuildStatus[iKey] = iGuildStatus;

	if ( pNode->Index[iKey] > 0 )
	{
		if ( gObjIsConnectedGP(pNode->Index[iKey]) == FALSE )
		{
			LogAdd("@SetGuildMemberStatus() error-L2 : Index %s %d", __FILE__, __LINE__);
			return false;
		}

		if ( !OBJMAX_RANGE(pNode->Index[iKey]) )
		{
			return 0;
		}
		
		LPOBJ lpObj = &gObj[pNode->Index[iKey]];

		if ( strcmp(lpObj->Name, szMemberName) == 0 )
		{
			lpObj->GuildStatus = iGuildStatus;
			GCGuildViewportNowPaint(lpObj->m_Index, lpObj->GuildName, 0, 0);
		}

	}

	return true;
}
Пример #2
0
BOOL CGuildClass::SetGuildType(char* szGuildName, int iGuildType)
{
	
	_GUILD_INFO_STRUCT * pNode = this->SearchGuild(szGuildName);

	if (pNode == NULL )
	{
		return FALSE;
	}

	pNode->btGuildType = iGuildType;

	for ( int n=0;n<MAX_USER_GUILD;n++)
	{
		if ( pNode->Use[n] == TRUE )
		{
			if ( pNode->Index[n] > 0 )
			{
				if ( gObjIsConnectedGP(pNode->Index[n]) == FALSE )
				{
					LogAdd("SetGuildType() error-L2 : Index %s %d", __FILE__, __LINE__);
					continue;
				}

				if ( !OBJMAX_RANGE(pNode->Index[n]) )
				{
					continue;
				}

				LPOBJ lpObj = &gObj[pNode->Index[n]];
				GCGuildViewportNowPaint(lpObj->m_Index, lpObj->GuildName, 0, 0);
			}
		}
	}

	return TRUE;
}
Пример #3
0
void GuildMatch::DGAnsJoinReqAnswer(GUILDMATCH_DGANS_REQUESTANSWER* lpData)
{
	if(		!OBJMAX_RANGE(lpData->UserIndex)
		||	gObj[lpData->UserIndex].Connected != PLAYER_PLAYING )
	{
		return;
	}
	// ----
	GUILDMATCH_GCANS_REQUESTANSWER lpAnswer = { 0 };
	lpAnswer.h.c			= 0xC1;
	lpAnswer.h.headcode		= 0xED;
	lpAnswer.h.subcode		= 0x06;
	lpAnswer.h.size			= sizeof(GUILDMATCH_GCANS_REQUESTANSWER);
	lpAnswer.Type			= lpData->Type;
	memcpy(lpAnswer.Character, lpData->Character, 10);
	// ----
	if( lpData->Type == 0 )
	{
		if( lpData->Result == -1 )
		{
			lpAnswer.Type = -1;
			DataSend(lpData->UserIndex, (LPBYTE)&lpAnswer, sizeof(GUILDMATCH_GCANS_REQUESTANSWER));
			return;
		}
		// ----
		DataSend(lpData->UserIndex, (LPBYTE)&lpAnswer, sizeof(GUILDMATCH_GCANS_REQUESTANSWER));
	}
	else if( lpData->Type == 1 )
	{
		if( lpData->Result == -1 )
		{
			lpAnswer.Type = -1;
			DataSend(lpData->UserIndex, (LPBYTE)&lpAnswer, sizeof(GUILDMATCH_GCANS_REQUESTANSWER));
			return;
		}
		// ----
		if( lpData->Result == 0 ) //User already in guild
		{
			lpAnswer.Type = -1;
			DataSend(lpData->UserIndex, (LPBYTE)&lpAnswer, sizeof(GUILDMATCH_GCANS_REQUESTANSWER));
			return;
		}
		// ----
		for( int i = OBJ_STARTUSERINDEX; i < OBJMAX; i++ )
		{
			if( gObj[i].Name != NULL && !strcmp(lpData->Character, gObj[i].Name) )
			{
				if( gObj[i].Connected == PLAYER_PLAYING )
				{
					_GUILD_INFO_STRUCT* lpGuild = Guild.AddMember(gObj[lpData->UserIndex].lpGuild->Name, gObj[i].Name, i, -1, 0, gGameServerCode / 20);
					// ----
					if( lpGuild != NULL )
					{
						gObj[i].lpGuild = lpGuild;
						gObj[i].GuildStatus = 0;
						gObj[i].GuildNumber = lpGuild->Number;
						gObj[i].iGuildUnionTimeStamp = 0;
						GCGuildViewportNowPaint(i, gObj[lpData->UserIndex].lpGuild->Name, gObj[i].lpGuild->Mark, FALSE);
						break;
					}
				}
			}
		}
		// ----
		DataSend(lpData->UserIndex, (LPBYTE)&lpAnswer, sizeof(GUILDMATCH_GCANS_REQUESTANSWER));
	}
}