Esempio n. 1
0
void NoLosCheckedTargetCursor::on_target_cursor( Mobile::Character* chr, PKTBI_6C* msgin )
{
  if ( msgin == NULL )
  {
    ( *func )( chr, NULL );
    return;
  }

  u32 selected_serial = cfBEu32( msgin->selected_serial );

  UObject* uobj = find_toplevel_object( selected_serial );
  // FIXME inefficient, but neither works well by itself.
  bool additlegal = false;
  if ( uobj == NULL )
    uobj = find_legal_item( chr, selected_serial, &additlegal );

  if ( uobj == NULL )
    uobj = system_find_multi( selected_serial );

  if ( uobj == NULL )
  {
    if ( chr->client != NULL ) send_sysmessage( chr->client, "What you selected does not seem to exist." );
    if ( inform_on_cancel_ )
      ( *func )( chr, NULL );
    return;
  }

  ( *func )( chr, uobj );
}
Esempio n. 2
0
	bool move_character_to( Mobile::Character* chr,
							unsigned short x,
							unsigned short y,
							short z,
							int flags,
							Plib::Realm* oldrealm )
	{
	  // FIXME consider consolidating with similar code in CHARACTER.CPP
	  short newz;
	  Multi::UMulti* supporting_multi = NULL;
	  Items::Item* walkon_item = NULL;
	  short new_boost = 0;

	  if ( flags & MOVEITEM_FORCELOCATION )
	  {
		if ( x >= chr->realm->width() || y >= chr->realm->height() )
		{
		  return false;
		}

		chr->realm->walkheight( x, y, z, &newz, &supporting_multi, &walkon_item, true, chr->movemode, &new_boost );
		newz = z;
	  }
	  else
	  {
		if ( !chr->realm->walkheight( chr, x, y, z, &newz, &supporting_multi, &walkon_item, &new_boost ) )
		{
		  return false;
		}
	  }
	  chr->set_dirty();

	  if ( ( oldrealm != NULL ) && ( oldrealm != chr->realm ) )
	  {
		chr->lastx = 0;
		chr->lasty = 0;
		chr->lastz = 0;
	  }
	  else
	  {
		chr->lastx = chr->x;
		chr->lasty = chr->y;
		chr->lastz = chr->z;
	  }
	  // probably easier and safer to just check if (chr->logged_in)
	  if ( chr->isa( UObject::CLASS_NPC ) || chr->client ) //dave 3/26/3 otherwise exception trying to move offline mobile not found in characters list
	  {
		MoveCharacterWorldPosition( chr->x, chr->y, x, y, chr, oldrealm );
	  }
	  chr->x = x;
	  chr->y = y;
	  chr->z = static_cast<s8>( newz );

	  chr->gradual_boost = new_boost;
	  chr->position_changed();
	  // FIXME: Need to add Walkon checks for multi right here if type is house.
	  if ( supporting_multi != NULL )
	  {
		supporting_multi->register_object( chr );
		Multi::UHouse* this_house = supporting_multi->as_house();
		if ( chr->registered_house == 0 )
		{
			chr->registered_house = supporting_multi->serial;

		    if ( this_house != NULL )
				this_house->walk_on( chr );
		}
	  }
	  else
	  {
		if ( chr->registered_house > 0 )
		{
          Multi::UMulti* multi = system_find_multi( chr->registered_house );
		  if ( multi != NULL )
		  {
			  multi->unregister_object( chr );
		  }
		  chr->registered_house = 0;
		}
	  }

	  // teleport( chr );
	  if ( chr->has_active_client() )
	  {
		passert_assume( chr->client != NULL ); // tells compiler to assume this is true during static code analysis

		if ( oldrealm != chr->realm )
		{
		  send_new_subserver( chr->client );
		  send_owncreate( chr->client, chr );
		}
		send_goxyz( chr->client, chr );

		// send_goxyz seems to stop the weather.  This will force a refresh, if the client cooperates.
		chr->client->gd->weather_region = NULL;
	  }
	  if ( chr->isa( UObject::CLASS_NPC ) || chr->client ) //dave 3/26/3 dont' tell moves of offline PCs
	  {
		chr->tellmove();
	  }
	  if ( chr->has_active_client() )
	  {
		send_objects_newly_inrange( chr->client );
		chr->check_light_region_change();
	  }
	  if ( walkon_item != NULL )
	  {
		walkon_item->walk_on( chr );
	  }

	  chr->lastx = chr->x;
	  chr->lasty = chr->y;
	  chr->lastz = chr->z;

	  return true;
	}
Esempio n. 3
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 );
		}
	}
Esempio n. 4
0
void ClientGameData::clear()
{
    while (!gumpmods.empty())
    {
        UOExecutorModule* uoemod = *gumpmods.begin();
        uoemod->uoexec.os_module->revive();
        uoemod->gump_chr = NULL;
        gumpmods.erase( gumpmods.begin() );
    }

    if (textentry_uoemod != NULL)
    {
        textentry_uoemod->uoexec.os_module->revive();
        textentry_uoemod->textentry_chr = NULL;
        textentry_uoemod = NULL;
    }

    if (menu_selection_uoemod != NULL)
    {
        menu_selection_uoemod->uoexec.os_module->revive();
        menu_selection_uoemod->menu_selection_chr = NULL;
        menu_selection_uoemod = NULL;
    }

    if (prompt_uoemod != NULL)
    {
        prompt_uoemod->uoexec.os_module->revive();
        prompt_uoemod->prompt_chr = NULL;
        prompt_uoemod = NULL;
    }

    if (resurrect_uoemod != NULL)
    {
        resurrect_uoemod->uoexec.os_module->revive();
        resurrect_uoemod->resurrect_chr = NULL;
        resurrect_uoemod = NULL;
    }

    if (selcolor_uoemod != NULL)
    {
        selcolor_uoemod->uoexec.os_module->revive();
        selcolor_uoemod->selcolor_chr = NULL;
        selcolor_uoemod = NULL;
    }

    if (target_cursor_uoemod != NULL)
    {
        target_cursor_uoemod->uoexec.os_module->revive();
        target_cursor_uoemod->target_cursor_chr = NULL;
        target_cursor_uoemod = NULL;
    }

	if (prompt_uniemod != NULL)
	{
		prompt_uniemod->os_module->revive();
		prompt_uniemod->prompt_chr = NULL;
		prompt_uniemod = NULL;
	}
    if (custom_house_serial != 0)
    {
        UMulti* multi = system_find_multi(custom_house_serial);
        if(multi != NULL)
        {
            UHouse* house = multi->as_house();
            if(house != NULL)
                house->editing = false;
        }
        custom_house_serial = 0;
    }

}