implement api changes
This commit is contained in:
@@ -75,6 +75,14 @@ public interface ItemDefinition
|
|||||||
*/
|
*/
|
||||||
int getPrice();
|
int getPrice();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the high alchemy price for this item. All items have a high alchemy price,
|
||||||
|
* but not all items can be alched.
|
||||||
|
*
|
||||||
|
* @return the high alch price
|
||||||
|
*/
|
||||||
|
int getHaPrice();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the item is members only.
|
* Checks whether the item is members only.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -31,6 +31,13 @@ import net.runelite.api.kit.KitType;
|
|||||||
*/
|
*/
|
||||||
public interface PlayerAppearance
|
public interface PlayerAppearance
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Checks if the player is female.
|
||||||
|
*
|
||||||
|
* @return true if the player is female
|
||||||
|
*/
|
||||||
|
boolean isFemale();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an array of IDs related to equipment slots.
|
* Gets an array of IDs related to equipment slots.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ import java.net.Authenticator;
|
|||||||
import java.net.PasswordAuthentication;
|
import java.net.PasswordAuthentication;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.security.KeyManagementException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -52,6 +56,9 @@ import java.util.UUID;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
import joptsimple.ArgumentAcceptingOptionSpec;
|
import joptsimple.ArgumentAcceptingOptionSpec;
|
||||||
import joptsimple.OptionException;
|
import joptsimple.OptionException;
|
||||||
import joptsimple.OptionParser;
|
import joptsimple.OptionParser;
|
||||||
@@ -372,9 +379,16 @@ public class RuneLite
|
|||||||
log.error("Unable to load settings", ex);
|
log.error("Unable to load settings", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
final OkHttpClient okHttpClient = RuneLiteAPI.CLIENT.newBuilder()
|
final OkHttpClient.Builder okHttpClientBuilder = RuneLiteAPI.CLIENT.newBuilder()
|
||||||
.cache(new Cache(new File(CACHE_DIR, "okhttp"), MAX_OKHTTP_CACHE_SIZE))
|
.cache(new Cache(new File(CACHE_DIR, "okhttp"), MAX_OKHTTP_CACHE_SIZE));
|
||||||
.build();
|
|
||||||
|
final boolean insecureSkipTlsVerification = options.has("insecure-skip-tls-verification");
|
||||||
|
if (insecureSkipTlsVerification)
|
||||||
|
{
|
||||||
|
setupInsecureTrustManager(okHttpClientBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
final OkHttpClient okHttpClient = okHttpClientBuilder.build();
|
||||||
|
|
||||||
final ClientLoader clientLoader = new ClientLoader(okHttpClient, options.valueOf(updateMode));
|
final ClientLoader clientLoader = new ClientLoader(okHttpClient, options.valueOf(updateMode));
|
||||||
Completable.fromAction(clientLoader::get)
|
Completable.fromAction(clientLoader::get)
|
||||||
@@ -668,4 +682,37 @@ public class RuneLite
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void setupInsecureTrustManager(OkHttpClient.Builder okHttpClientBuilder)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
X509TrustManager trustManager = new X509TrustManager()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void checkClientTrusted(X509Certificate[] chain, String authType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkServerTrusted(X509Certificate[] chain, String authType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public X509Certificate[] getAcceptedIssuers()
|
||||||
|
{
|
||||||
|
return new X509Certificate[0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SSLContext sc = SSLContext.getInstance("SSL");
|
||||||
|
sc.init(null, new TrustManager[]{trustManager}, new SecureRandom());
|
||||||
|
okHttpClientBuilder.sslSocketFactory(sc.getSocketFactory(), trustManager);
|
||||||
|
}
|
||||||
|
catch (NoSuchAlgorithmException | KeyManagementException ex)
|
||||||
|
{
|
||||||
|
log.warn("unable to setup insecure trust manager", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.Constants;
|
import net.runelite.api.Constants;
|
||||||
import static net.runelite.api.Constants.CLIENT_DEFAULT_ZOOM;
|
import static net.runelite.api.Constants.CLIENT_DEFAULT_ZOOM;
|
||||||
import static net.runelite.api.Constants.HIGH_ALCHEMY_MULTIPLIER;
|
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.ItemDefinition;
|
import net.runelite.api.ItemDefinition;
|
||||||
import net.runelite.api.ItemID;
|
import net.runelite.api.ItemID;
|
||||||
@@ -340,7 +339,7 @@ public class ItemManager
|
|||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) Math.max(1, composition.getPrice() * HIGH_ALCHEMY_MULTIPLIER);
|
return Math.max(1, composition.getHaPrice());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAlchValue(int itemID)
|
public int getAlchValue(int itemID)
|
||||||
@@ -354,7 +353,7 @@ public class ItemManager
|
|||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) Math.max(1, getItemDefinition(itemID).getPrice() * HIGH_ALCHEMY_MULTIPLIER);
|
return Math.max(1, getItemDefinition(itemID).getHaPrice());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRepairValue(int itemId)
|
public int getRepairValue(int itemId)
|
||||||
|
|||||||
@@ -89,4 +89,12 @@ public abstract class RSItemDefinitionMixin implements RSItemDefinition
|
|||||||
|
|
||||||
return client.getRSItemDefinition(modelOverride).getModel(quantity);
|
return client.getRSItemDefinition(modelOverride).getModel(quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public int getHaPrice()
|
||||||
|
{
|
||||||
|
int price = getPrice();
|
||||||
|
return (int) ((float) price * 0.6f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user