mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-18 04:20:19 -07:00
Fixed a problem with noted item pricing in shops
This commit is contained in:
parent
bff9af71b2
commit
05e8ff76b0
1 changed files with 6 additions and 2 deletions
|
|
@ -604,6 +604,7 @@ public class Shop {
|
||||||
*/
|
*/
|
||||||
public int getSellingValue(Item item, Player player) {
|
public int getSellingValue(Item item, Player player) {
|
||||||
if (!item.getDefinition().isUnnoted()) {
|
if (!item.getDefinition().isUnnoted()) {
|
||||||
|
player.setAttribute("shop:originalId",item.getId());
|
||||||
item = new Item(item.getNoteChange(), item.getAmount());
|
item = new Item(item.getNoteChange(), item.getAmount());
|
||||||
}
|
}
|
||||||
int amount = getContainer(1).getAmount(item);
|
int amount = getContainer(1).getAmount(item);
|
||||||
|
|
@ -622,8 +623,10 @@ public class Shop {
|
||||||
* @return the selling value.
|
* @return the selling value.
|
||||||
*/
|
*/
|
||||||
private int getSellValue(Player player, int amount, Item item) {
|
private int getSellValue(Player player, int amount, Item item) {
|
||||||
if(item.getAmount() > ContentAPI.amountInInventory(player, item.getId())){
|
int id = player.getAttribute("shop:originalId",item.getId());
|
||||||
item.setAmount(ContentAPI.amountInInventory(player, item.getId()));
|
if(item.getAmount() > ContentAPI.amountInInventory(player, id)){
|
||||||
|
item.setAmount(ContentAPI.amountInInventory(player, id));
|
||||||
|
player.removeAttribute("shop:originalId");
|
||||||
}
|
}
|
||||||
double diff = item.getDefinition().isStackable() ? 0.005 : 0.05;
|
double diff = item.getDefinition().isStackable() ? 0.005 : 0.05;
|
||||||
double maxMod = 1.0 - (amount * diff);
|
double maxMod = 1.0 - (amount * diff);
|
||||||
|
|
@ -635,6 +638,7 @@ public class Shop {
|
||||||
minMod = 0.25;
|
minMod = 0.25;
|
||||||
}
|
}
|
||||||
double mod = (maxMod + minMod) / 2;
|
double mod = (maxMod + minMod) / 2;
|
||||||
|
SystemLogger.logInfo("" + item.getDefinition().getAlchemyValue(highAlch) + " " + mod + " " + item.getAmount());
|
||||||
int value = (int) (item.getDefinition().getAlchemyValue(highAlch) * mod * item.getAmount());
|
int value = (int) (item.getDefinition().getAlchemyValue(highAlch) * mod * item.getAmount());
|
||||||
if(item.getId() == 12183){
|
if(item.getId() == 12183){
|
||||||
value = 25 * item.getAmount();
|
value = 25 * item.getAmount();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue