GE Improvements

This commit is contained in:
Ceikry
2021-07-13 15:26:19 +00:00
parent b02c50e3f7
commit b74e1a3ee3
10 changed files with 523 additions and 486 deletions
@@ -3,6 +3,7 @@ package core.game.ge;
import core.game.component.Component;
import core.game.node.entity.player.Player;
import core.tools.StringUtils;
import rs09.game.ge.OfferManager;
/**
* Represents the glass used to open the guide prices for the different type of
@@ -139,7 +140,7 @@ public final class GEGuidePrice {
player.getPacketDispatch().sendInterfaceConfig(642, i, false);
}
for (GuideItem item : getItems()) {
player.getPacketDispatch().sendString("" + GrandExchangeDatabase.getDatabase().get(item.getItem()).getValue() + " gp", COMPONENT.getId(), item.getChildData()[0]);
player.getPacketDispatch().sendString("" + OfferManager.getRecommendedPrice(item.item, false) + " gp", COMPONENT.getId(), item.getChildData()[0]);
}
}
}
@@ -22,6 +22,7 @@ import core.plugin.Initializable;
import core.plugin.Plugin;
import kotlin.Unit;
import rs09.game.ge.GrandExchangeOffer;
import rs09.game.ge.OfferManager;
import rs09.game.ge.PlayerGrandExchange;
import rs09.game.interaction.npc.BogrogPouchSwapper;
import rs09.game.world.GameWorld;
@@ -69,7 +70,7 @@ public class GrandExchangeInterface extends ComponentPlugin {
if (offer == null || value < 1 || offer.getOfferState() != OfferState.PENDING) {
return;
}
if (value == GrandExchangeDatabase.getDatabase().get(offer.getItemID()).getValue()) {
if (value == OfferManager.getRecommendedPrice(offer.getItemID(), false)) {
player.getAudioManager().send(new Audio(4043, 1, 1));
} else if (value > offer.getOfferedValue()) {
player.getAudioManager().send(new Audio(4041, 1, 1));
@@ -77,7 +78,7 @@ public class GrandExchangeInterface extends ComponentPlugin {
player.getAudioManager().send(new Audio(4045, 1, 1));
}
offer.setOfferedValue(value);
player.getConfigManager().send(1111, offer.getOfferedValue());
player.varpManager.get(1111).setVarbit(0,offer.getOfferedValue()).send(player);
}
@Override
@@ -348,14 +349,14 @@ public class GrandExchangeInterface extends ComponentPlugin {
return false;
case 180:
if (offer != null) {
setOfferValue(player, offer, GrandExchangeDatabase.getDatabase().get(offer.getItemID()).getValue());
setOfferValue(player, offer, OfferManager.getRecommendedPrice(offer.getItemID(), false));
return true;
}
return false;
case 177: // mid - 5% value
case 183: // mid + 5% value
if (offer != null) {
setOfferValue(player, offer, (int) (GrandExchangeDatabase.getDatabase().get(offer.getItemID()).getValue() * (button == 177 ? 0.95 : 1.05)));
setOfferValue(player, offer, (int) (OfferManager.getRecommendedPrice(offer.getItemID(), false) * (button == 177 ? 0.95 : 1.05)));
return true;
}
return false;
@@ -19,6 +19,7 @@ import rs09.game.ai.AIPlayer;
import rs09.game.ai.AIRepository;
import rs09.game.ai.general.GeneralBotCreator;
import rs09.game.content.global.NPCDropTable;
import rs09.game.ge.OfferManager;
import rs09.game.system.config.ItemConfigParser;
import rs09.game.world.repository.Repository;
@@ -177,7 +178,7 @@ public final class NPCDropTables {
}
}
player.sendMessage(player.getInterfaceManager().isResizable()+"");
int price = item.getName().endsWith("charm") ? 100 : GrandExchangeDatabase.getDatabase().get(itemId).getValue();
int price = item.getName().endsWith("charm") ? 100 : OfferManager.getRecommendedPrice(itemId, false);
looter.getGlobalData().setLootSharePoints(looter.getGlobalData().getLootSharePoints() - (price) + ((price / looters.size())));
looter.sendMessage((player.getInterfaceManager().isResizable() ? "<col=32CD32>" : "<col=009900>") + "You received: " + item.getAmount() + " " + item.getName());
for (Player p : looters) {
@@ -8,6 +8,7 @@ import core.game.interaction.Interaction;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
import core.game.node.entity.combat.equipment.DegradableEquipment;
import rs09.game.ge.OfferManager;
/**
* Represents an item.
@@ -99,10 +100,7 @@ public class Item extends Node{
*/
public long getValue() {
long value = 1;
GrandExchangeEntry entry = GrandExchangeDatabase.getDatabase().get(getId());
if (entry != null) {
value = entry.getValue();
}
value = OfferManager.getRecommendedPrice(getId(), false);
if (definition.getValue() > value) {
value = definition.getValue();
}
@@ -161,7 +161,7 @@ public class GrandExchangeTab extends ConsoleTab {
} catch (NumberFormatException e) {
}
for (GrandExchangeOffer o : OfferManager.Companion.getOffersForItem(itemId)) {
for (GrandExchangeOffer o : OfferManager.getOffersForItem(itemId)) {
if (o == null) {
continue;
}
@@ -184,7 +184,7 @@ public class GrandExchangeTab extends ConsoleTab {
JOptionPane.showMessageDialog(null, "Error! No data in DB yet. Press load.");
return;
}
for (GrandExchangeOffer offer : OfferManager.Companion.getOFFER_MAPPING().values()) {
for (GrandExchangeOffer offer : OfferManager.getOFFER_MAPPING().values()) {
model.addElement(offer);
}
}