Thread: [PI]Shops

Results 1 to 8 of 8
  1. #1 [PI]Shops 
    Donator

    Join Date
    Jul 2013
    Posts
    488
    Thanks given
    21
    Thanks received
    42
    Rep Power
    0
    317 rsps PI
    all of my shops work, however when i add a new shop, i cant buy anything from it but i can see the items in the shop.

    Quote Originally Posted by blackout View Post
    Post your shop assistant.
    Shop.cfg
    And tell me which shop.
    Shop assistant, shop is 20
    Code:
    Code:
    package server.model.shops;
    
    import server.Config;
    import server.Server;
    import server.model.items.Item;
    import server.model.players.Client;
    
    public class ShopAssistant {
    
    	private Client c;
    	
    	public ShopAssistant(Client client) {
    		this.c = client;
    	}
    	
    	/**
    	*Shops
    	**/
    	
    	public void openShop(int ShopID){		
    		c.getItems().resetItems(3823);
    		resetShop(ShopID);
    		c.isShopping = true;
    		c.myShopId = ShopID;
    		c.getPA().sendFrame248(3824, 3822);
    		c.getPA().sendFrame126(Server.shopHandler.ShopName[ShopID], 3901);
    	}
    	
    	public void updatePlayerShop() {
    		for (int i = 1; i < Config.MAX_PLAYERS; i++) {
    			if (Server.playerHandler.players[i] != null) {
    				if (Server.playerHandler.players[i].isShopping == true && Server.playerHandler.players[i].myShopId == c.myShopId && i != c.playerId) {
    					Server.playerHandler.players[i].updateShop = true;
    				}
    			}
    		}
    	}
    	
    	
    	public void updateshop(int i){
    		resetShop(i);
    	}
    	
    	public void resetShop(int ShopID) {
    		synchronized(c) {
    			int TotalItems = 0;
    			for (int i = 0; i < Server.shopHandler.MaxShopItems; i++) {
    				if (Server.shopHandler.ShopItems[ShopID][i] > 0) {
    					TotalItems++;
    				}
    			}
    			if (TotalItems > Server.shopHandler.MaxShopItems) {
    				TotalItems = Server.shopHandler.MaxShopItems;
    			}
    			c.getOutStream().createFrameVarSizeWord(53);
    			c.getOutStream().writeWord(3900);
    			c.getOutStream().writeWord(TotalItems);
    			int TotalCount = 0;
    			for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) {
    				if (Server.shopHandler.ShopItems[ShopID][i] > 0 || i <= Server.shopHandler.ShopItemsStandard[ShopID]) {
    					if (Server.shopHandler.ShopItemsN[ShopID][i] > 254) {
    						c.getOutStream().writeByte(255); 					
    						c.getOutStream().writeDWord_v2(Server.shopHandler.ShopItemsN[ShopID][i]);	
    					} else {
    						c.getOutStream().writeByte(Server.shopHandler.ShopItemsN[ShopID][i]);
    					}
    					if (Server.shopHandler.ShopItems[ShopID][i] > Config.ITEM_LIMIT || Server.shopHandler.ShopItems[ShopID][i] < 0) {
    						Server.shopHandler.ShopItems[ShopID][i] = Config.ITEM_LIMIT;
    					}
    					c.getOutStream().writeWordBigEndianA(Server.shopHandler.ShopItems[ShopID][i]);
    					TotalCount++;
    				}
    				if (TotalCount > TotalItems) {
    					break;
    				}
    			}
    			c.getOutStream().endFrameVarSizeWord();
    			c.flushOutStream();	
    		}
    	}
    	
    	
    	public double getItemShopValue(int ItemID, int Type, int fromSlot) {
    		double ShopValue = 1;
    		double Overstock = 0;
    		double TotPrice = 0;
    		for (int i = 0; i < Config.ITEM_LIMIT; i++) {
    			if (Server.itemHandler.ItemList[i] != null) {
    				if (Server.itemHandler.ItemList[i].itemId == ItemID) {
    					ShopValue = Server.itemHandler.ItemList[i].ShopValue;
    				}
    			}
    		}
    		
    		TotPrice = ShopValue;
    
    		if (Server.shopHandler.ShopBModifier[c.myShopId] == 1) {
    			TotPrice *= 1; 
    			TotPrice *= 1;
    			if (Type == 1) {
    				TotPrice *= 1; 
    			}
    		} else if (Type == 1) {
    			TotPrice *= 1; 
    		}
    		return TotPrice;
    	}
    	
    	public int getItemShopValue(int itemId) {
    		for (int i = 0; i < Config.ITEM_LIMIT; i++) {
    			if (Server.itemHandler.ItemList[i] != null) {
    				if (Server.itemHandler.ItemList[i].itemId == itemId) {
    					return (int)Server.itemHandler.ItemList[i].ShopValue;
    				}
    			}	
    		}
    		return 0;
    	}
    	
    	
    	
    	/**
    	*buy item from shop (Shop Price)
    	**/
    	
    	public void buyFromShopPrice(int removeId, int removeSlot){
    		int ShopValue = (int)Math.floor(getItemShopValue(removeId, 0, removeSlot));
    		ShopValue *= 1.15;
    		String ShopAdd = "";
    		if (c.myShopId >= 100) {
    			c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Rage points.");
    			return;
    		}
    		if (c.myShopId == 15) {
    			c.sendMessage("This item current costs " + c.getItems().getUntradePrice(removeId) + " coins.");
    			return;
    		}
    		if (ShopValue >= 1000 && ShopValue < 1000000) {
    			ShopAdd = " (" + (ShopValue / 1000) + "K)";
    		} else if (ShopValue >= 1000000) {
    			ShopAdd = " (" + (ShopValue / 1000000) + " million)";
    		}
    		c.sendMessage(c.getItems().getItemName(removeId)+": currently costs "+ShopValue+" coins"+ShopAdd);
    	}
    	
    	public int getSpecialItemValue(int id) {
    		switch (id) {
    			case 6889:
    			case 6914:
    			return 100;
    			case 6916:
    			case 6918:
    			case 6920:
    			case 6922:
    			case 6924:
    			return 50;
    			case 11663:
    			case 11664:
    			case 11665:
    			case 8842:
    			return 30;
    			case 8839:
    			case 8840:
    			return 75;
    			case 10499:
    			return 20;
    			case 8845:
    			return 5;
    			case 8846:
    			return 10;
    			case 8847:
    			return 15;
    			case 8848:
    			return 20;
    			case 8849:
    			case 8850:
    			case 15335:
    			return 25;
    			case 7462:
    			return 40;
    			case 10551:
    			return 50;
    			case 6570:
    			return 35;
    			case 11730:
    			return 150;
    			case 16020:
    			return 500;
    			case 16022:
    			return 375;
    			case 16021:
    			return 300;
    			case 11700:
    			return 230;
    			case 11698:
    			return 360;
    			case 11696:
    			return 300;
    			case 11694:
    			return 600;
    			case 6585:
    			return 15;
    			case 4151:
    			return 13;
    		}
    		return 0;
    	}
    	
    	
    	
    	/**
    	*Sell item to shop (Shop Price)
    	**/
    	public void sellToShopPrice(int removeId, int removeSlot) {
    		for (int i : Config.ITEM_SELLABLE) {
    			if (i == removeId) {
    				c.sendMessage("You can't sell "+c.getItems().getItemName(removeId).toLowerCase()+".");
    				return;
    			} 
    
    		}
    		boolean IsIn = false;
    		if (Server.shopHandler.ShopSModifier[c.myShopId] > 1) {
    			for (int j = 0; j <= Server.shopHandler.ShopItemsStandard[c.myShopId]; j++) {
    				if (removeId == (Server.shopHandler.ShopItems[c.myShopId][j] - 1)) {
    					IsIn = true;
    					break;
    				}
    			}
    		} else {
    			IsIn = true;
    		}
    		if (IsIn == false) {
    			c.sendMessage("You can't sell "+c.getItems().getItemName(removeId).toLowerCase()+" to this store.");
    		} else {
    			int ShopValue = (int)Math.floor(getItemShopValue(removeId, 1, removeSlot));
    			String ShopAdd = "";
    			if (ShopValue >= 1000 && ShopValue < 1000000) {
    				ShopAdd = " (" + (ShopValue / 1000) + "K)";
    			} else if (ShopValue >= 1000000) {
    				ShopAdd = " (" + (ShopValue / 1000000) + " million)";
    			}
    			c.sendMessage(c.getItems().getItemName(removeId)+": shop will buy for "+ShopValue+" coins"+ShopAdd);
    		}
    	}
    	
    	
    	
    	public boolean sellItem(int itemID, int fromSlot, int amount) {
     
    
    		if (c.myShopId == 14)
    			return false;
    		for (int i : Config.ITEM_SELLABLE) {
    			if (i == itemID) {
    				c.sendMessage("You can't sell "+c.getItems().getItemName(itemID).toLowerCase()+".");
    				return false;
    			} 
    		}
    		
    		if (amount > 0 && itemID == (c.playerItems[fromSlot] - 1)) {
    			if (Server.shopHandler.ShopSModifier[c.myShopId] > 1) {
    				boolean IsIn = false;
    				for (int i = 0; i <= Server.shopHandler.ShopItemsStandard[c.myShopId]; i++) {
    					if (itemID == (Server.shopHandler.ShopItems[c.myShopId][i] - 1)) {
    						IsIn = true;
    						break;
    					}
    				}
    				if (IsIn == false) {
    					c.sendMessage("You can't sell "+c.getItems().getItemName(itemID).toLowerCase()+" to this store.");
    					return false;
    				}
    			}
    
    			if (amount > c.playerItemsN[fromSlot] && (Item.itemIsNote[(c.playerItems[fromSlot] - 1)] == true || Item.itemStackable[(c.playerItems[fromSlot] - 1)] == true)) {
    				amount = c.playerItemsN[fromSlot];
    			} else if (amount > c.getItems().getItemAmount(itemID) && Item.itemIsNote[(c.playerItems[fromSlot] - 1)] == false && Item.itemStackable[(c.playerItems[fromSlot] - 1)] == false) {
    				amount = c.getItems().getItemAmount(itemID);
    			}
    			//double ShopValue;
    			//double TotPrice;
    			int TotPrice2 = 0;
    			//int Overstock;
    			for (int i = amount; i > 0; i--) {
    				TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 1, fromSlot));
    				if (c.getItems().freeSlots() > 0 || c.getItems().playerHasItem(995)) {
    					if (Item.itemIsNote[itemID] == false) {
    						c.getItems().deleteItem(itemID, c.getItems().getItemSlot(itemID), 1);
    					} else {
    						c.getItems().deleteItem(itemID, fromSlot, 1);
    					}
    					c.getItems().addItem(995, TotPrice2);
    					addShopItem(itemID, 1);
    				} else {
    					c.sendMessage("You don't have enough space in your inventory.");
    					break;
    				}
    			}
    			c.getItems().resetItems(3823);
    			resetShop(c.myShopId);
    			updatePlayerShop();
    			return true;
    		}
    		return true;
    	}
    	
    	public boolean addShopItem(int itemID, int amount) {
    		boolean Added = false;
    		if (amount <= 0) {
    			return false;
    		}
    		if (Item.itemIsNote[itemID] == true) {
    			itemID = c.getItems().getUnnotedItem(itemID);
    		}
    		for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) {
    			if ((Server.shopHandler.ShopItems[c.myShopId][i] - 1) == itemID) {
    				Server.shopHandler.ShopItemsN[c.myShopId][i] += amount;
    				Added = true;
    			}
    		}
    		if (Added == false) {
    			for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) {
    				if (Server.shopHandler.ShopItems[c.myShopId][i] == 0) {
    					Server.shopHandler.ShopItems[c.myShopId][i] = (itemID + 1);
    					Server.shopHandler.ShopItemsN[c.myShopId][i] = amount;
    					Server.shopHandler.ShopItemsDelay[c.myShopId][i] = 0;
    					break;
    				}
    			}
    		}
    		return true;
    	}
    	
    	public long buyDelay;
    	public boolean buyItem(int itemID, int fromSlot, int amount) {
    		if(System.currentTimeMillis() - buyDelay < 1500) {
    			return false;
    		}
    
    		if (c.myShopId == 14) {
    			skillBuy(itemID);
    			return false;
    
    		} else if (c.myShopId == 15) {
    			buyVoid(itemID);
    			return false;		
    		
    		} else if (c.myShopId == 1) {
    			buyVoid(itemID);
    			return false;
                    }
    		if(itemID != itemID) {
    			c.sendMessage("Don't dupe or you will be IP Banned");
    			return false;
    		}
    
    		if (amount > 0) {
    			if (amount > Server.shopHandler.ShopItemsN[c.myShopId][fromSlot]) {
    				amount = Server.shopHandler.ShopItemsN[c.myShopId][fromSlot];
    			}
    			//double ShopValue;
    			//double TotPrice;
    			int TotPrice2 = 0;
    			//int Overstock;
    			int Slot = 0;
    			int Slot1 = 0;//Tokkul
    			int Slot2 = 0;//Pking Points
    			int Slot3 = 0;//Donator Gold
    
    			if (c.myShopId >= 17) {
    				handleOtherShop(itemID);
    				return false;
    			}	
    			for (int i = amount; i > 0; i--) {
    				TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot));
    				Slot = c.getItems().getItemSlot(995);
    				Slot1 = c.getItems().getItemSlot(6529);
    				Slot3 = c.getItems().getItemSlot(5555);
    				if (Slot == -1 && c.myShopId != 11 && c.myShopId != 29 && c.myShopId != 30 && c.myShopId != 31 && c.myShopId != 47) {
    					c.sendMessage("You don't have enough coins.");
    					break;
    				}
    				if(Slot1 == -1 && c.myShopId == 29 || c.myShopId == 30 || c.myShopId == 31) {
    					c.sendMessage("You don't have enough tokkul.");
    					break;
    				}
    				if(Slot3 == -1 && c.myShopId == 11) {
    					c.sendMessage("You don't have enough donator gold.");
    					break;
    				}
    			
                    if(TotPrice2 <= 1) {
                    	TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot));
                    	TotPrice2 *= 1.66;
                    }
                    if(c.myShopId == 29 || c.myShopId == 30 || c.myShopId == 31) {
                    	if (c.playerItemsN[Slot1] >= TotPrice2) {
    						if (c.getItems().freeSlots() > 0) {
    							buyDelay = System.currentTimeMillis();
    							c.getItems().deleteItem(6529, c.getItems().getItemSlot(6529), TotPrice2);
    							c.getItems().addItem(itemID, 1);
    							Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
    							Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    							if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
    								Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
    							}
    						} else {
    							c.sendMessage("You don't have enough space in your inventory.");
    							break;
    						}
    					} else {
    						c.sendMessage("You don't have enough tokkul.");
    						break;
    					}
                    }
                    else if(c.myShopId == 47) {
                    	if (c.pkPoints >= TotPrice2) {
    						if (c.getItems().freeSlots() > 0) {
    							buyDelay = System.currentTimeMillis();
    							c.pkPoints -= TotPrice2;
    							c.getItems().addItem(itemID, 1);
    							Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
    							Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    							if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
    								Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
    							}
    						} else {
    							c.sendMessage("You don't have enough space in your inventory.");
    							break;
    						}
    					} else {
    						c.sendMessage("You don't have enough Pk Points.");
    						break;
    					}
                    }
                    else if(c.myShopId == 11) {
                    	if (c.playerItemsN[Slot3] >= TotPrice2) {
    						if (c.getItems().freeSlots() > 0) {
    							buyDelay = System.currentTimeMillis();
    							c.getItems().deleteItem(5555, c.getItems().getItemSlot(5555), TotPrice2);
    							c.getItems().addItem(itemID, 1);
    							Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
    							Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    							if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
    								Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
    							}
    						} else {
    							c.sendMessage("You don't have enough space in your inventory.");
    							break;
    						}
    					} else {
    						c.sendMessage("You don't have enough donator gold.");
    						break;
    					}
                    }
                    else if(c.myShopId != 11 && c.myShopId != 29 || c.myShopId != 30 || c.myShopId != 31 || c.myShopId != 47) {
    					if (c.playerItemsN[Slot] >= TotPrice2) {
    						if (c.getItems().freeSlots() > 0) {
    							buyDelay = System.currentTimeMillis();
    							c.getItems().deleteItem(995, c.getItems().getItemSlot(995), TotPrice2);
    							c.getItems().addItem(itemID, 1);
    							Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
    							Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    							if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
    								Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
    							}
    						} else {
    							c.sendMessage("You don't have enough space in your inventory.");
    							break;
    						}
    					} else {
    						c.sendMessage("You don't have enough coins.");
    						break;
    					}
                    }
    			}
    			c.getItems().resetItems(3823);
    			resetShop(c.myShopId);
    			updatePlayerShop();
    			return true;
    		}
    		return false;
    	}	
    	
    		public void handleOtherShop(int itemID) {
    
    			if (c.myShopId == 18) {
    				if (c.pcPoints >= getSpecialItemValue(itemID)) {
    					if (c.getItems().freeSlots() > 0){
    						c.pcPoints -= getSpecialItemValue(itemID);
    						c.getItems().addItem(itemID,1);
    						c.getItems().resetItems(3823);
    					}
    				} else {
    					c.sendMessage("You do not have enough Rage Points to buy this item.");			
    				}
    
    			}
    		}
    		
    		public void openSkillCape() {
    			int capes = get99Count();
    			if (capes > 1)
    				capes = 1;
    			else
    				capes = 0;
    			c.myShopId = 14;
    			setupSkillCapes(capes, get99Count());		
    		}
    		
    		
    		
    		/*public int[][] skillCapes = {{0,9747,4319,2679},{1,2683,4329,2685},{2,2680,4359,2682},{3,2701,4341,2703},{4,2686,4351,2688},{5,2689,4347,2691},{6,2692,4343,2691},
    									{7,2737,4325,2733},{8,2734,4353,2736},{9,2716,4337,2718},{10,2728,4335,2730},{11,2695,4321,2697},{12,2713,4327,2715},{13,2725,4357,2727},
    									{14,2722,4345,2724},{15,2707,4339,2709},{16,2704,4317,2706},{17,2710,4361,2712},{18,2719,4355,2721},****,2737,4331,2739},{20,2698,4333,2700}};*/
    	public int[] skillCapes = { 9747, 9753, 9750, 9768, 9756, 9759, 9762, 9801,
    			9807, 9783, 9798, 9804, 9780, 9795, 9792, 9774, 9771, 9777, 9786,
    			9810, 9765 };
    		public int get99Count() {
    			int count = 0;
    			for (int j = 0; j < c.playerLevel.length; j++) {
    				if (c.getLevelForXP(c.playerXP[j]) >= 99) {
    					count++;				
    				}			
    			}		
    			return count;
    		}
    		
    		public void setupSkillCapes(int capes, int capes2) {
    			synchronized(c) {
    				c.getItems().resetItems(3823);
    				c.isShopping = true;
    				c.myShopId = 14;
    				c.getPA().sendFrame248(3824, 3822);
    				c.getPA().sendFrame126("Skillcape Shop", 3901);
    				
    				int TotalItems = 0;
    				TotalItems = capes2;
    				if (TotalItems > Server.shopHandler.MaxShopItems) {
    					TotalItems = Server.shopHandler.MaxShopItems;
    				}
    				c.getOutStream().createFrameVarSizeWord(53);
    				c.getOutStream().writeWord(3900);
    				c.getOutStream().writeWord(TotalItems);
    				int TotalCount = 0;
    				for (int i = 0; i < 21; i++) {
    					if (c.getLevelForXP(c.playerXP[i]) < 99)
    						continue;
    					c.getOutStream().writeByte(1);
    					c.getOutStream().writeWordBigEndianA(skillCapes[i] + 2);
    					TotalCount++;
    				}
    				c.getOutStream().endFrameVarSizeWord();
    				c.flushOutStream();	
    			}
    		}
    		
    		public void skillBuy(int item) {
    			int nn = get99Count();
    			if (nn > 1)
    				nn = 1;
    			else
    				nn = 0;			
    			for (int j = 0; j < skillCapes.length; j++) {
    				if (skillCapes[j] == item || skillCapes[j]+1 == item) {
    					if (c.getItems().freeSlots() > 1) {
    						if (c.getItems().playerHasItem(995,99000)) {
    							if (c.getLevelForXP(c.playerXP[j]) >= 99) {
    								c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 99000);
    								c.getItems().addItem(skillCapes[j] + nn,1);
    								c.getItems().addItem(skillCapes[j] + 2,1);
    							} else {
    								c.sendMessage("You must have 99 in the skill of the cape you're trying to buy.");
    							}
    						} else {
    							c.sendMessage("You need 99k to buy this item.");
    						}
    					} else {
    						c.sendMessage("You must have at least 1 inventory spaces to buy this item.");					
    					}				
    				}
    				/*if (skillCapes[j][1 + nn] == item) {
    					if (c.getItems().freeSlots() >= 1) {
    						if (c.getItems().playerHasItem(995,99000)) {
    							if (c.getLevelForXP(c.playerXP[j]) >= 99) {
    								c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 99000);
    								c.getItems().addItem(skillCapes[j] + nn,1);
    								c.getItems().addItem(skillCapes[j] + 2,1);
    							} else {
    								c.sendMessage("You must have 99 in the skill of the cape you're trying to buy.");
    							}
    						} else {
    							c.sendMessage("You need 99k to buy this item.");
    						}
    					} else {
    						c.sendMessage("You must have at least 1 inventory spaces to buy this item.");					
    					}
    					break;				
    				}*/			
    			}
    			c.getItems().resetItems(3823);			
    		}
    		
    		public void openVoid() {
    			/*synchronized(c) {
    				c.getItems().resetItems(3823);
    				c.isShopping = true;
    				c.myShopId = 15;
    				c.getPA().sendFrame248(3824, 3822);
    				c.getPA().sendFrame126("Void Recovery", 3901);
    				
    				int TotalItems = 5;
    				c.getOutStream().createFrameVarSizeWord(53);
    				c.getOutStream().writeWord(3900);
    				c.getOutStream().writeWord(TotalItems);
    				for (int i = 0; i < c.voidStatus.length; i++) {
    					c.getOutStream().writeByte(c.voidStatus[i]);
    					c.getOutStream().writeWordBigEndianA(2519 + i * 2);
    				}
    				c.getOutStream().endFrameVarSizeWord();
    				c.flushOutStream();	
    			}*/		
    		}
    
    		public void buyVoid(int item) {
    			/*if (item > 2527 || item < 2518)
    				return;
    			//c.sendMessage("" + item);
    			if (c.voidStatus[(item-2518)/2] > 0) {
    				if (c.getItems().freeSlots() >= 1) {
    					if (c.getItems().playerHasItem(995,c.getItems().getUntradePrice(item))) {
    						c.voidStatus[(item-2518)/2]--;
    						c.getItems().deleteItem(995,c.getItems().getItemSlot(995), c.getItems().getUntradePrice(item));
    						c.getItems().addItem(item,1);
    						openVoid();
    					} else {
    						c.sendMessage("This item costs " + c.getItems().getUntradePrice(item) + " coins to rebuy.");				
    					}
    				} else {
    					c.sendMessage("I should have a free inventory space.");
    				}
    			} else {
    				c.sendMessage("I don't need to recover this item from the void knights.");
    			}*/
    		}
    
    
    }



    Shop.Cfg, shop 20 (at the bottom)
    Code:
    //-----ShopID---ShopName----------------------------------------Sell----Buy-----Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount
    shop = 1	General_Store	1	1
    shop = 2	Aubury's_Magic_Store	2	2	554	50000	555	50000	556	50000	557	50000	558	50000	559	50000	562	50000	563	50000	561	10000	565	10000	9075	10000	560	50000	1381	20	1383	20	1385	20	1387	20	4170	100	4089	200	4091	200	4093	200	4095	200	4097	200	2415	100	2416	100	2417	100	4099	200	4101	200	4103	200	4105	200	4107	200	6109	200	6107	200	6108	200	4109	200	4111	200	4113	200	4115	200	4117	200	6111	200	6110	200	4675	10
    shop = 7	Stall_Items	2	2	1897	1	1898	1	950	1	951	1	1635	1	1636	1	7650	1	7651	1	1613	1	1614	1
    shop = 3	Archer_Store	2	2	1133	100	10499	100	882	10000	884	10000	886	10000	888	10000	890	10000	892	5000	11212	500	861	200	9140	10000	9141	10000	9142	10000	9143	10000	9144	10000	9243	1000	9244	500	9185	200	1065	200	1099	200	1135	200	2487	200	2493	200	2497	200	1131	200	1129	200	2489	200	2495	200	2501	200	2491	200	2503	200	6328	200	4214	5	868	500
    shop = 11	yoyoyo	2	2	4716	2
    shop = 4	Armour_Store	2	2	1153	100	1115	100	1067	100	1191	100	1165	100	1125	100	1077	100	1195	100	1159	100	1121	100	1071	100	1197	100	1163	100	1127	100	1079	100	1201	100	3749	100	3751	100	3753	100	3755	100	10828	100	5574	100	5575	100	5576	100	3122	50
    shop = 5	Weapon_Store	2	2	1323	200	1333	200	4587	200	1215	200	1231	100	1309	200	1319	200	1305	200	1434	200	3204	200	4153	100	6528	100	953	100	590	100	1755	100	2347	100	952	100	946	100	1540	30	1523	100	228	10000	7947	10000		386	100000	7061	100000	314	10000		533	10000	2368	3	
    shop = 6	Supply_Store	2	2	3842	500	3840	500	2441	1000	2437	1000	2443	1000	3025	1000	6686	3000	2435	1000	2445	1000	3041	1000	7061	1000	533	1000	542	200	544	200	6107	200	6108	200	6110	200	6106	200	3105	200	1725	200	1731	200	5574	200	5575	200	5576	200	656	200	658	200	660	200	662	200	664	200	579	200	1017	200	7458	200	7459	200	7460	200	7461	5	2550	1000	6568	100
    shop = 8	Skilling_Store	2	2	590	100	1755	100	2347	100	946	100	1349	100	1359	100	1267	100	1275	100	228	100000	1437	100000	5291	100	5292	100	5293	100	5294	100	5295	100	5296	100	5297	100	5298	100	5299	100	5300	100	5301	100	5302	100	5303	100	5304	100	1623	10000	1621	10000	1619	10000	1617	10000	1631	10000	1745	10000	2505	10000	2507	10000	2509	10000	1733	1000	303	1000	311	1000	301	1000
    shop = 17	Mage_Arena_Store	2	2	6889	1	6914	1	6920	1	6918	1	6916	1	6924	1	6922	1
    shop = 100	Rage_Point shop	2	2	6889	1	6914	1	6920	1	6918	1	6916	1	6924	1	6922	1	6570	1	8839	1	8840	1	11663	1	11664	1	11665	1	10551	1	8842	1	8845	1	8846	1	8847	1	8848	1	8849	1	8850	1	7462	1	11730	1	15335	1	16022	1	16021	1	16020	1	4151	100
    shop = 9	Trimmed_Shop	2	2	391	10000	4387	10000	3144	10000	8844	5
    shop = 10	God_Shop	2	2	10458	1	10460	1	10462	1	10464	1	10466	1	10468	1	10360	1	10362	1	10364	1	10366	1	10368	1	10370	1	10372	1	10374	1	10456	1	10452	1	10454	1	10472	1	10474	1	10470	1	10378	1	10376	1	10380	1	10382	1	10384	1	10388	1	10386	1	10390	1		7398	1	7400	1	7399	1	10442	1	10444	1	10440	1	10446	1	10448	1	10450	1	
    shop = 19	Donator_Store	2	2	6889	1	6914	1	6920	1	6918	1	6916	1	6924	1	6922	1
    shop = 13	Donor_Store	2	2	6889	1	6914	1	6920	1	6918	1	6916	1	6924	1	6922	1	1038	1	1040	1	1042	1	1044	1	1046	1	1048	1	11777	1	11694	1	11698	1	4716	20	4718	20	4720	20	4722	20	4753	20	4755	20	4757	20	4759	20	3140	1	4087	1	11732	20	4151	20
    shop = 20	Dat_Armour	2	2	4716	20	4718	20
    [ENDOFSHOPLIST]
    Reply With Quote  
     

  2. #2  
    Donator

    Join Date
    Jul 2013
    Posts
    488
    Thanks given
    21
    Thanks received
    42
    Rep Power
    0
    bumppp
    Reply With Quote  
     

  3. #3  
    Donator

    Join Date
    Jul 2013
    Posts
    488
    Thanks given
    21
    Thanks received
    42
    Rep Power
    0
    your kidding me?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Dec 2011
    Posts
    286
    Thanks given
    10
    Thanks received
    4
    Rep Power
    27
    Quote Originally Posted by pabb View Post
    your kidding me?
    Excuse me?
    Reply With Quote  
     

  5. #5  
    Donator

    Join Date
    Jul 2013
    Posts
    488
    Thanks given
    21
    Thanks received
    42
    Rep Power
    0
    Quote Originally Posted by Mr Terror View Post
    Excuse me?
    i meant no one is helping but 30 views, could you please help?
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Dec 2011
    Posts
    286
    Thanks given
    10
    Thanks received
    4
    Rep Power
    27
    Quote Originally Posted by pabb View Post
    i meant no one is helping but 30 views, could you please help?
    When you click on ''buy'' nothing happens?
    Reply With Quote  
     

  7. #7  
    Donator

    Join Date
    Jul 2013
    Posts
    488
    Thanks given
    21
    Thanks received
    42
    Rep Power
    0
    Quote Originally Posted by Mr Terror View Post
    When you click on ''buy'' nothing happens?
    nothing happens
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Dec 2011
    Posts
    286
    Thanks given
    10
    Thanks received
    4
    Rep Power
    27
    Replace your boolean with mine:
    Code:
    public boolean buyItem(int itemID, int fromSlot, int amount) {
    		/*if(System.currentTimeMillis() - buyDelay < 900) {//Change the buy Delay here - Standard is: 1500
    			return false;
    		}*/
    		if (Server.shopHandler.ShopItems[c.myShopId][fromSlot]-1 != itemID && c.myShopId != 14) {
    			return false;
    		}
    		if (c.myShopId == 14) {
    			skillBuy(itemID);
    			return false;
    		} else if (c.myShopId == 48) {
    			handleOtherShop(itemID);
    			return false;	
    		} else if (c.myShopId == 18) {
    			handleOtherShop(itemID);
    			return false;
    		} else if (c.myShopId == 19) {
    			handleOtherShop(itemID);
    			return false;		
    		}
    		if (amount > 0) {
    			if (amount > Server.shopHandler.ShopItemsN[c.myShopId][fromSlot]) {
    				amount = Server.shopHandler.ShopItemsN[c.myShopId][fromSlot];
    			}
    			//double ShopValue;
    			//double TotPrice;
    			int TotPrice2 = 0;
    			//int Overstock;
    			int Slot = 0;
    			int Slot1 = 0;//Tokkul
    			int Slot2 = 0;//Pking Points
    			for (int i = amount; i > 0; i--) {
    				TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot));
    				TotPrice2 *= 1.15;
    				Slot = c.getItems().getItemSlot(995);
    				Slot1 = c.getItems().getItemSlot(6529);
    				if (Slot == -1 && c.myShopId != 48 && c.myShopId != 15) {
    					c.sendMessage("You don't have enough coins.");
    					break;
    				}
                    if(TotPrice2 <= 1) {
                    	TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot));
                    	TotPrice2 *= 1.66;
                    }
                    if(c.myShopId == 89) {
                        if (c.pcPoints >= TotPrice2) {
                                                if (c.getItems().freeSlots() > 0) {
                                                        c.pcPoints -= TotPrice2;
                                                        c.getItems().addItem(itemID, 1);
                                                        Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
                                                        Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
                                                        if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
                                                                Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
                                                        }
                                                } else {
                                                        c.sendMessage("You don't have enough space in your inventory.");
                                                        break;
                                                }
        								} else {
                                                c.sendMessage("You don't have enough Pest Control Points.");
                                             break;
                                         }
                }
                    if(c.myShopId != 48 && c.myShopId != 15) {
    					if (c.playerItemsN[Slot] >= TotPrice2) {
    						if (c.getItems().freeSlots() > 0) {
    							c.getItems().deleteItem(995, c.getItems().getItemSlot(995), TotPrice2);
    							c.getItems().addItem(itemID, 1);
    							Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
    							Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    							if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
    								Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
    							}
    						} else {
    							c.sendMessage("You don't have enough space in your inventory.");
    							break;
    						}
    					} else {
    						c.sendMessage("You don't have enough coins.");
    						break;
    					}
                    }
    			}
    			c.getItems().resetItems(3823);
    			resetShop(c.myShopId);
    			updatePlayerShop();
    			return true;
    		}
    		return false;
    	}
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. pi shops
    By ilike to own in forum Help
    Replies: 10
    Last Post: 07-23-2010, 04:01 AM
  2. [PI] Shops
    By Stew in forum Help
    Replies: 4
    Last Post: 07-07-2010, 08:05 AM
  3. PI Shop Error [Not Buying Items]
    By jameskmonger in forum Help
    Replies: 1
    Last Post: 06-27-2010, 01:09 PM
  4. PI-Shop
    By Romania Clan in forum Help
    Replies: 4
    Last Post: 06-12-2010, 11:55 AM
  5. [PI] Shop help?
    By PaNiiC Joe in forum Help
    Replies: 2
    Last Post: 06-08-2010, 02:20 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •