Exemple #1
0
main(){
	int fd1, fd2;

	exp_loguser = 1;
	exp_timeout = 3600;

	fd1 = exp_spawnl("chess","chess",(char *)0);

	if (-1 == exp_expectl(fd1,exp_glob,"Chess\r\n",0,exp_end)) exit;

	if (-1 == write(fd1,"first\r",6)) exit;

	read_first_move(fd1);

	fd2 = exp_spawnl("chess","chess",(char *)0);

	if (-1 == exp_expectl(fd2,exp_glob,"Chess\r\n",0,exp_end)) exit;

	for (;;) {
		send_move(fd2);
		read_counter_move(fd2);

		send_move(fd1);
		read_move(fd1);
	}
}
void Guild::update_online_members()
{
// FIXME : All of guilds.cpp iterator's need rewritten. Turley found a much better method
// used in the party system.
// NOTE: stlport seems to not return save itr on erase, but with a list container the iterator should stay valid
	for( SerialSet::iterator itr = _member_serials.begin(); itr != _member_serials.end(); /* */)
    {
        unsigned long mserial = (*itr);
        SerialSet::iterator last_itr = itr;
        ++itr;

        Character* chr = system_find_mobile( mserial );
        if (chr != NULL)
        {
			if (chr->client)
			{
				send_move( chr->client, chr );
				send_remove_character_to_nearby_cansee( chr );
				send_create_mobile_to_nearby_cansee( chr );
			}
        }
        else
        {
            _member_serials.erase( last_itr );
        }
    }
}
void Guild::update_online_members_remove( Character* chr )
{
	if (chr->client)
	{
		send_move( chr->client, chr );
		send_remove_character_to_nearby_cansee( chr );
		send_create_mobile_to_nearby_cansee( chr );
	}
}
Exemple #4
0
void KClient::ingameSender()
{
    tick++;

    int dx = -1 + ( random() % 3 );
    int dy = -1 + ( random() % 3 );
    send_move( myCoord.x + dx,
               myCoord.y + dy );
    sendCounter[FUNCTION_MOVE]++;

    // 自分以外のmovableに興味を持つ。
    std::map<vce::VUint32,TestMovable*>::iterator it;
    int cnt=0;
    for(it=movmap.begin(); it != movmap.end(); ++it ){
        TestMovable *m = (*it).second;
        assert(m);
        if( m->typeID == k_proto::MOVABLE_GOBLIN ){
            send_attack( m->id );
            sendCounter[ FUNCTION_ATTACK]++;
            cnt++;
            if( cnt == 15) break; // 一度にあまりたくさん攻撃しない
        }
    }

    // 地形取得
    if( recvCounter[FUNCTION_LANDSCAPERESULT] == 0 ){
        // 全部一気に取得
        send_landscape( 0, 0,0, 32,32 );
        sendCounter[FUNCTION_LANDSCAPE]++;
        send_landscape( 0, 32,0, 64,32 );
        sendCounter[FUNCTION_LANDSCAPE]++;
        send_landscape( 1, 0,0, 32,32 );
        sendCounter[FUNCTION_LANDSCAPE]++;
        send_landscape( 1, 32,0, 64,32 );
        sendCounter[FUNCTION_LANDSCAPE]++;
        send_landscape( 1, 0,0, 32,32 );
        sendCounter[FUNCTION_LANDSCAPE]++;
        send_landscape( 1, 32,0, 64,32 );
        sendCounter[FUNCTION_LANDSCAPE]++;
    }
    if( recvCounter[FUNCTION_ITEMNOTIFY] == 0 ){
        send_item();
        sendCounter[FUNCTION_ITEM]++;
    }
    
}
void handle_mode_set( Client *client, PKTBI_72 *msg )
{
	if ( client->chr->warmode_wait > read_gameclock() )
	{
        send_move( client, client->chr );
		return;
	}
	else
	{
		client->chr->warmode_wait = read_gameclock() + combat_config.warmode_delay;
	}

	bool msg_warmode = msg->warmode ? true : false;

	// FIXME: Should reply with 0x77 packet!? (so says various docs!) [TJ]
	transmit( client, msg, sizeof *msg );

    client->chr->set_warmode( msg_warmode );
}