예제 #1
0
파일: target.cpp 프로젝트: gtozzi/polserver
void TargetCursor::handle_target_cursor( Mobile::Character* chr, PKTBI_6C* msg )
{
  if ( msg->selected_serial != 0 )   // targetted something
  {

    if ( chr->dead() )            // but is dead
    {
      if ( chr->client != NULL ) send_sysmessage( chr->client, "I am dead and cannot do that." );
      cancel( chr );
      return;
    }

    if ( ( chr->frozen() || chr->paralyzed() ) && !chr->setting_enabled( "freemove" ) )
    {
      if ( chr->client != NULL )
      {
        if ( chr->frozen() )
          private_say_above( chr, chr, "I am frozen and cannot do that." );
        else if ( chr->paralyzed() )
          private_say_above( chr, chr, "I am paralyzed and cannot do that." );
      }
      cancel( chr );
      return;
    }

    u32 selected_serial = cfBEu32( msg->selected_serial );
    UObject* obj = system_find_object( selected_serial );
    if ( obj != NULL && obj->script_isa( POLCLASS_MOBILE ) &&
         !obj->script_isa( POLCLASS_NPC ) )
    {
      Mobile::Character* targeted = find_character( selected_serial );
      // check for when char is not logged on
      if ( targeted != NULL )
      {
        if ( !chr->is_visible_to_me( targeted ) )
        {
          cancel( chr );
          return;
        }

        if ( msg->cursor_type == 1 )
        {
          if ( ( JusticeRegion::RunNoCombatCheck( chr->client ) == true )
               || ( JusticeRegion::RunNoCombatCheck( targeted->client ) == true ) )
          {
            send_sysmessage( chr->client, "Combat is not allowed in this area." );
            cancel( chr );
            return;
          }
        }
      }
    }
  }

  if ( msg->x != 0xffff || msg->selected_serial != 0 )
    on_target_cursor( chr, msg );
  else
    cancel( chr );
}
예제 #2
0
void handle_se_object_list( Client* client, PKTBI_D6_IN* msgin )
{
	UObject* obj = NULL;
	int length=cfBEu16(msgin->msglen)-3;
	if ( length < 0 || (length%4) != 0 )
		return;
	int count = length/4;
	
	for( int i = 0; i < count; ++i )
	{
		obj = system_find_object(cfBEu32( msgin->serials[i].serial ));
		if (obj != NULL)
			SendAOSTooltip(client,obj);
	}
}
예제 #3
0
파일: target.cpp 프로젝트: gtozzi/polserver
void NoLosUObjectCursor::on_target_cursor( Mobile::Character* targetter, PKTBI_6C* msgin )
{
  if ( msgin == NULL )
  {
    ( *func )( targetter, NULL );
    return;
  }
  u32 selected_serial = cfBEu32( msgin->selected_serial );

  UObject* obj = system_find_object( selected_serial );
  if ( obj )
  {
    ( *func )( targetter, obj );
  }
  else if ( inform_on_cancel_ )
  {
    ( *func )( targetter, NULL );
  }
}
예제 #4
0
void handle_msg_BF( Client* client, PKTBI_BF* msg )
	{
	UObject* obj = NULL;
	UMulti* multi = NULL;
	UHouse* house = NULL;
	switch(cfBEu16(msg->subcmd))
		{
		case PKTBI_BF::TYPE_CLIENT_LANGUAGE:
			client->chr->uclang = strlower(msg->client_lang);
			break;
		case PKTBI_BF::TYPE_REQ_FULL_CUSTOM_HOUSE:
			if( (client->UOExpansionFlag & AOS) == 0 )
				return;
			multi = system_find_multi(cfBEu32(msg->reqfullcustomhouse.house_serial));
			if(multi != NULL)
				{
				house = multi->as_house();
				if(house != NULL)
					{
					if(client->UOExpansionFlag & AOS)
						{
						send_object_cache(client, (UObject*)(house));
						}
					//consider sending working design to certain players, to assist building, or GM help
					CustomHousesSendFull( house, client, HOUSE_DESIGN_CURRENT );
					}
				}
			break;
		case PKTBI_BF::TYPE_OBJECT_CACHE:
			if( (client->UOExpansionFlag & AOS) == 0)
				return;
			obj = system_find_object(cfBEu32(msg->objectcache.serial));
			if(obj != NULL)
				{
				SendAOSTooltip(client,obj);
				}
			break;
		case PKTBI_BF::TYPE_SESPAM:
			return;
			break;
		case PKTBI_BF::TYPE_SPELL_SELECT:
			do_cast(client, cfBEu16(msg->spellselect.selected_spell) );
			break;
		case PKTBI_BF::TYPE_CHARACTER_RACE_CHANGER:
			character_race_changer_handler( client, msg );
			break;
		case PKTBI_BF::TYPE_PARTY_SYSTEM:
			party_cmd_handler( client, msg );
			break;
		case PKTBI_BF::TYPE_EXTENDED_STATS_IN:
			ext_stats_in(client, msg);
			break;
		case PKTBI_BF::TYPE_CLOSED_STATUS_GUMP:
			return;
			break;
		case PKTBI_BF::TYPE_SCREEN_SIZE:
			return;
			break;
		case PKTBI_BF::TYPE_TOGGLE_FLYING:
			if (client->chr->race==RACE_GARGOYLE)
				{
				// FIXME: add checks if its possible to stand with new movemode
				client->chr->movemode = (MOVEMODE)(client->chr->movemode ^ MOVEMODE_FLY);
				send_move_mobile_to_nearby_cansee( client->chr );
				send_goxyz( client, client->chr );
				}
			break;
		case PKTBI_BF::TYPE_CLIENTTYPE:
			client->UOExpansionFlagClient = ctBEu32( msg->clienttype.clientflag );
			break;
		default:
			handle_unknown_packet( client );
		}
	}