Beispiel #1
0
int CNWNXMessages::SendMessageToPlayer( CNWSObject * ply, char * text, int nType ){

	CNWSMessage * mess = (*NWN_AppManager)->app_server->GetNWSMessage();
	CNWSPlayer * cli = (*NWN_AppManager)->app_server->GetClientObjectByObjectId( ply->obj_generic.obj_id );
	
	if( !cli )
		return 0;

	DWORD nLen = strlen( text );
	DWORD ID=OBJECT_INVALID;
	
	for( DWORD n=0;n<nLen; n++ ){
		
		if( text[n]==' '){
			
			text[n]='\0';

			LASTSTR->CExoStringCpy( &text[n+1] );

			sscanf( text, "%x", &ID );
			break;
		}
	}

	if( ID == OBJECT_INVALID ){
	
		return 0;
	}	

	int nRet;

	if( nType == 1 ){
		nRet = CNWSMessage__SendServerToPlayerChat_Talk( mess, cli->pl_id, ID, *LASTSTR );
	}
	else if( nType == 2 ){
		nRet = CNWSMessage__SendServerToPlayerChat_Whisper( mess, cli->pl_id, ID, *LASTSTR ); 
	}
	else if( nType == 3 ){
		nRet = CNWSMessage__SendServerToPlayerChat_Party( mess, cli->pl_id, ID, *LASTSTR ); 
	}
	else if( nType == 4 ){
		nRet = CNWSMessage__SendServerToPlayerChat_Tell( mess, cli->pl_id, ID, *LASTSTR ); 
	}
	else if( nType == 5 ){
		nRet = CNWSMessage__SendServerToPlayerChat_Shout( mess, cli->pl_id, ID, *LASTSTR ); 
	}
	else if( nType == 6 ){
		nRet = CNWSMessage__SendServerToPlayerChat_DM_Silent_Shout( mess, cli->pl_id, ID, *LASTSTR ); 
	}
	else{
		nRet=0;
	}

	if( nRet > 0 && LOGLEVEL>0 )
		Log( "o SendMessage (%i): %08X -> %08X: (%u) %s\n", nType, ID, ply->obj_generic.obj_id, LASTSTR->len, LASTSTR->text );

	return nRet;
}
int CNWSMessage_s::SendServerToPlayerChat_Party(uint32_t Receiver, nwn_objid_t Sender, CExoString Msg) {
	return CNWSMessage__SendServerToPlayerChat_Party(this, Receiver, Sender, Msg);
}