mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 16:49:07 +00:00
Check if shop owned by player to sell items
This commit is contained in:
@@ -303,16 +303,27 @@ public class ShopAssistant {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean IsIn = false;
|
boolean IsIn = false;
|
||||||
if (ShopHandler.ShopSModifier[player.myShopId] > 1) {
|
switch (ShopHandler.ShopSModifier[player.myShopId]) {
|
||||||
|
// Only buys what is in stock
|
||||||
|
case 2:
|
||||||
for (int j = 0; j <= ShopHandler.ShopItemsStandard[player.myShopId]; j++) {
|
for (int j = 0; j <= ShopHandler.ShopItemsStandard[player.myShopId]; j++) {
|
||||||
if (removeId == (ShopHandler.ShopItems[player.myShopId][j] - 1)) {
|
if (removeId == (ShopHandler.ShopItems[player.myShopId][j] - 1)) {
|
||||||
IsIn = true;
|
IsIn = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
|
// General store
|
||||||
|
case 1:
|
||||||
IsIn = true;
|
IsIn = true;
|
||||||
|
break;
|
||||||
|
// Player owned store
|
||||||
|
case 0:
|
||||||
|
System.out.println("Is players shop: " + (ShopHandler.ShopName[player.myShopId].equalsIgnoreCase(player.properName + "'s Store") ? "true" : "false"));
|
||||||
|
IsIn = ShopHandler.ShopName[player.myShopId].equalsIgnoreCase(player.properName + "'s Store");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsIn == false) {
|
if (IsIn == false) {
|
||||||
player.getActionSender().sendMessage("You can't sell " + ItemAssistant.getItemName(removeId).toLowerCase() + " to this store.");
|
player.getActionSender().sendMessage("You can't sell " + ItemAssistant.getItemName(removeId).toLowerCase() + " to this store.");
|
||||||
} else {
|
} else {
|
||||||
@@ -355,26 +366,37 @@ public class ShopAssistant {
|
|||||||
if(!player.isShopping) {
|
if(!player.isShopping) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (player.TotalShopItems >= 39)
|
if (player.TotalShopItems >= 39) {
|
||||||
{
|
|
||||||
player.getActionSender().sendMessage("If you sell more individuals items in this shop, they won't be displayed.");
|
player.getActionSender().sendMessage("If you sell more individuals items in this shop, they won't be displayed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amount > 0 && itemID == (player.playerItems[fromSlot] - 1)) {
|
if (amount > 0 && itemID == (player.playerItems[fromSlot] - 1)) {
|
||||||
if (ShopHandler.ShopSModifier[player.myShopId] > 1) {
|
|
||||||
boolean IsIn = false;
|
boolean IsIn = false;
|
||||||
for (int i = 0; i <= ShopHandler.ShopItemsStandard[player.myShopId]; i++) {
|
switch (ShopHandler.ShopSModifier[player.myShopId]) {
|
||||||
if (itemID == (ShopHandler.ShopItems[player.myShopId][i] - 1)) {
|
// Only buys what is in stock
|
||||||
|
case 2:
|
||||||
|
for (int j = 0; j <= ShopHandler.ShopItemsStandard[player.myShopId]; j++) {
|
||||||
|
if (itemID == (ShopHandler.ShopItems[player.myShopId][j] - 1)) {
|
||||||
IsIn = true;
|
IsIn = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
// General store
|
||||||
|
case 1:
|
||||||
|
IsIn = true;
|
||||||
|
break;
|
||||||
|
// Player owned store
|
||||||
|
case 0:
|
||||||
|
System.out.println("Is players shop: " + (ShopHandler.ShopName[player.myShopId].equalsIgnoreCase(player.properName + "'s Store") ? "true" : "false"));
|
||||||
|
IsIn = ShopHandler.ShopName[player.myShopId].equalsIgnoreCase(player.properName + "'s Store");
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (IsIn == false) {
|
if (IsIn == false) {
|
||||||
player.getItemAssistant();
|
player.getItemAssistant();
|
||||||
player.getActionSender().sendMessage("You can't sell " + ItemAssistant.getItemName(itemID).toLowerCase() + " to this store.");
|
player.getActionSender().sendMessage("You can't sell " + ItemAssistant.getItemName(itemID).toLowerCase() + " to this store.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (amount > player.playerItemsN[fromSlot] && (ItemDefinitions.getDef()[player.playerItems[fromSlot] - 1].isNoteable == true || ItemDefinitions.getDef()[player.playerItems[fromSlot] - 1].isStackable == true)) {
|
if (amount > player.playerItemsN[fromSlot] && (ItemDefinitions.getDef()[player.playerItems[fromSlot] - 1].isNoteable == true || ItemDefinitions.getDef()[player.playerItems[fromSlot] - 1].isStackable == true)) {
|
||||||
amount = player.playerItemsN[fromSlot];
|
amount = player.playerItemsN[fromSlot];
|
||||||
} else if (amount > player.getItemAssistant().getItemAmount(itemID) && ItemDefinitions.getDef()[player.playerItems[fromSlot] - 1].isNoteable == false && ItemDefinitions.getDef()[player.playerItems[fromSlot] - 1].isStackable == false) {
|
} else if (amount > player.getItemAssistant().getItemAmount(itemID) && ItemDefinitions.getDef()[player.playerItems[fromSlot] - 1].isNoteable == false && ItemDefinitions.getDef()[player.playerItems[fromSlot] - 1].isStackable == false) {
|
||||||
@@ -405,7 +427,6 @@ public class ShopAssistant {
|
|||||||
addShopItem(itemID, amount); //Add item to the shop.
|
addShopItem(itemID, amount); //Add item to the shop.
|
||||||
if (player.getPlayerAssistant().isPlayer()) { //Logger
|
if (player.getPlayerAssistant().isPlayer()) { //Logger
|
||||||
GameLogger.writeLog(player.playerName, "shopselling", player.playerName + " sold " + itemName + " to store id: " + player.myShopId + " for" + GameLogger.formatCurrency(TotPrice2) + " coins");
|
GameLogger.writeLog(player.playerName, "shopselling", player.playerName + " sold " + itemName + " to store id: " + player.myShopId + " for" + GameLogger.formatCurrency(TotPrice2) + " coins");
|
||||||
//Remove this later. I added it to push this class because a fuck happened with my last commit.
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.getActionSender().sendMessage("You don't have enough space in your inventory.");
|
player.getActionSender().sendMessage("You don't have enough space in your inventory.");
|
||||||
|
|||||||
Reference in New Issue
Block a user