#!/usr/bin/perl -w

# This script is provided for legacy support

# Use the FindBin module so we can get the scriptname
use FindBin;

# Get the script name
my $scriptname = $FindBin::Script;

# Get the scriptdir
my $scriptdir = $FindBin::RealBin;

# Remove rsu- from the name
$scriptname =~ s/rsu-//;

# If scriptname is runescape and no parameters are passed
if ($scriptname =~ /^runescape$/ && "@ARGV" eq '')
{
	# Try launch the launcher (if not it will fallback to starting runescape directly)
	system "\"$scriptdir/rsu/rsu-query\"";
}
# Else if scriptname is runescape and parameters are passed and the parameters do not start with - then
elsif($scriptname =~ /^runescape$/ && "@ARGV" ne '' && "@ARGV" !~ /^(-|jagex-jav:\/\/)/)
{
	# Do an rsu-query
	system "\"$scriptdir/rsu/rsu-query\" @ARGV";
}
# Else
else
{
	# Launch the actual script
	system "\"$scriptdir/rsu/rsu-query\" client.launch.$scriptname @ARGV";
}
