Thread: Pointshop problem

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 Pointshop problem 
    There's only 1Day2Die
    1Day2Die's Avatar
    Join Date
    Oct 2012
    Posts
    467
    Thanks given
    22
    Thanks received
    33
    Rep Power
    8
    So when i buy something in a shop that uses Points (Donor points, PKP, etc), the "buy 10" "buy X" option etc is disabled, but i need it for items like rocktails etc.

    Example



    Also in general the buy X option is weirded out



    Dunno exactly which classes i have to post here so please just tell me and i will provide
    Attached image

    Quote Originally Posted by Charlie' View Post
    ^ to the assholes (...) above that hate on people when they don't know something, remember little kids you once didn't know shit so get off your high horse.
    Reply With Quote  
     

  2. #2  
    Donator

    Join Date
    Dec 2014
    Posts
    289
    Thanks given
    160
    Thanks received
    56
    Rep Power
    37
    Basically, for the general store "buy x" it seems to be buying 1 item and looping through them till it reaches the desired amount, you could fix this by declaring the amount as an integer and just adding the item with (id, amount).
    Reply With Quote  
     

  3. #3  
    There's only 1Day2Die
    1Day2Die's Avatar
    Join Date
    Oct 2012
    Posts
    467
    Thanks given
    22
    Thanks received
    33
    Rep Power
    8
    code please? im havent coded for 3 years and im just starting again....
    Attached image

    Quote Originally Posted by Charlie' View Post
    ^ to the assholes (...) above that hate on people when they don't know something, remember little kids you once didn't know shit so get off your high horse.
    Reply With Quote  
     

  4. #4  
    Donator

    Join Date
    Dec 2014
    Posts
    289
    Thanks given
    160
    Thanks received
    56
    Rep Power
    37
    Quote Originally Posted by 1Day2Die View Post
    code please? im havent coded for 3 years and im just starting again....
    I'm not entirely sure where you "buy x" method is added, post the snippet you followed here.
    Reply With Quote  
     

  5. #5  
    There's only 1Day2Die
    1Day2Die's Avatar
    Join Date
    Oct 2012
    Posts
    467
    Thanks given
    22
    Thanks received
    33
    Rep Power
    8
    Code:
    		if (c.buyingX) {
    			if (Xamount <= 3000) {
    				c.getShops().buyItem(c.xRemoveId, c.xRemoveSlot, Xamount);
    			} else {
    				c.sendMessage("You cannot buy more than 3000 at a time.");
    			}
    			c.xRemoveSlot = 0;
    			c.xInterfaceId = 0;
    			c.xRemoveId = 0;
    			c.buyingX = false;
    		}
    Attached image

    Quote Originally Posted by Charlie' View Post
    ^ to the assholes (...) above that hate on people when they don't know something, remember little kids you once didn't know shit so get off your high horse.
    Reply With Quote  
     

  6. #6  
    Donator

    Join Date
    Dec 2014
    Posts
    289
    Thanks given
    160
    Thanks received
    56
    Rep Power
    37
    Post your buyitem method from shopassistant.java
    Reply With Quote  
     

  7. #7  
    There's only 1Day2Die
    1Day2Die's Avatar
    Join Date
    Oct 2012
    Posts
    467
    Thanks given
    22
    Thanks received
    33
    Rep Power
    8
    Code:
    	public boolean buyItem(int itemID, int fromSlot, int amount) {
    		if (c.myShopId == 14) {
    			skillBuy(itemID);
    
    			return false;
    
    		}
    		if (amount > 0) {
    		if(!shopSellsItem(itemID))
                            return false;
    			if (amount > ShopHandler.ShopItemsN[c.myShopId][fromSlot]) {
    				amount = ShopHandler.ShopItemsN[c.myShopId][fromSlot];
    			}
    			int TotPrice2 = 0;
    			int Slot = 0; // Coins
    			int Slot1 = 0;// Tokkul
    			if (c.myShopId >= 30) {
    				handleOtherShop(itemID);
    				return false;
    			}
    			boolean loop = false;
    			            if (amount > 10000) {
    				TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot))*amount;
    				Slot = c.getItems().getItemSlot(995);
    				if (Slot == -1 && TotPrice2 != 0) {
    					c.sendMessage("You don't have enough coins.");
    				}
    				if(TotPrice2 <= 1) {
    					TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot));
    				}
    				if (TotPrice2 <= 0) {
    					if (c.getItems().freeSlotAmount() > 0) {
    						c.getItems().addItem(itemID, amount);
    						ShopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
    						ShopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    						if ((fromSlot + 1) > ShopHandler.ShopItemsStandard[c.myShopId]) {
    							ShopHandler.ShopItems[c.myShopId][fromSlot] = 0;
    						}
    					} else {
    						c.sendMessage("Not enough space in your inventory.");
    					}
    				} else if (c.playerItemsN[Slot] >= TotPrice2) {
    					if (c.getItems().freeSlotAmount() > 0) {
    						c.getItems().deleteItem(995, c.getItems().getItemSlot(995), TotPrice2);
    						c.getItems().addItem(itemID, amount);
    						ShopHandler.ShopItemsN[c.myShopId][fromSlot] -= amount;
    						ShopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    						if ((fromSlot + 1) > ShopHandler.ShopItemsStandard[c.myShopId]) {
    							ShopHandler.ShopItems[c.myShopId][fromSlot] = 0;
    						}
    					} else {
    						c.sendMessage("Not enough space in your inventory.");
    					}
    				} else {
    					c.sendMessage("You don't have enough coins.");
    				}
            
    		   }
    			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);
    				if (c.getMoneyPouch().getTotal() < TotPrice2 && Slot == -1
    						&& 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 (TotPrice2 <= 1) {
    					TotPrice2 = (int) Math.floor(getItemShopValue(itemID, 0,
    							fromSlot));
    					TotPrice2 *= 1.66;
    				}
    				if (c.myShopId != 29 || c.myShopId != 30 || c.myShopId != 31
    						|| c.myShopId != 47) {
    					if (c.getMoneyPouch().getTotal() >= TotPrice2) {
    						if (c.getItems().freeSlotAmount() > 0) {
    //							c.getMoneyPouch().buyItem(TotPrice2, c, loop,
    							//		amount);
    							loop = true;
    							c.getItems().addItem(itemID, 1);
    							ShopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
    							ShopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    							if ((fromSlot + 1) > ShopHandler.ShopItemsStandard[c.myShopId]) {
    								ShopHandler.ShopItems[c.myShopId][fromSlot] = 0;
    							}
    						} else {
    							c.sendMessage("You don't have enough space in your inventory.");
    							break;
    						}
    					} else if (c.getMoneyPouch().getTotal()
    							+ c.getItems().getItemCount(995) >= TotPrice2) {
    						if (c.getItems().freeSlotAmount() > 0) {
    							int pouch = c.getMoneyPouch().getTotal();
    							int remainder = TotPrice2 - pouch;
    //							c.getMoneyPouch().buyItem(pouch, c, loop, amount);
    							c.getItems().deleteItem(995, remainder);
    							loop = true;
    							c.getItems().addItem(itemID, 1);
    							ShopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
    							ShopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    							if ((fromSlot + 1) > ShopHandler.ShopItemsStandard[c.myShopId]) {
    								ShopHandler.ShopItems[c.myShopId][fromSlot] = 0;
    							}
    						} else {
    							c.sendMessage("You don't have enough space in your inventory.");
    							break;
    						}
    					} else if (c.getItems().getItemCount(995) >= TotPrice2) {
    						if (c.getItems().freeSlotAmount() > 0) {
    							c.getItems().deleteItem(995, TotPrice2);
    							c.getItems().addItem(itemID, 1);
    							ShopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
    							ShopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    							if ((fromSlot + 1) > ShopHandler.ShopItemsStandard[c.myShopId]) {
    								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;
    					}
    				}
    			}
    			loop = false;
    			c.getItems().resetItems(3823);
    			resetShop(c.myShopId);
    			return true;
    		}
    		return false;
    		}
    SellX works perfectly fine and instantly :L
    Attached image

    Quote Originally Posted by Charlie' View Post
    ^ to the assholes (...) above that hate on people when they don't know something, remember little kids you once didn't know shit so get off your high horse.
    Reply With Quote  
     

  8. #8  
    Donator

    Join Date
    Dec 2014
    Posts
    289
    Thanks given
    160
    Thanks received
    56
    Rep Power
    37
    I can see where it loops, give me a couple seconds to figure it out.
    Reply With Quote  
     

  9. #9  
    There's only 1Day2Die
    1Day2Die's Avatar
    Join Date
    Oct 2012
    Posts
    467
    Thanks given
    22
    Thanks received
    33
    Rep Power
    8
    Seconds ?
    Attached image

    Quote Originally Posted by Charlie' View Post
    ^ to the assholes (...) above that hate on people when they don't know something, remember little kids you once didn't know shit so get off your high horse.
    Reply With Quote  
     

  10. #10  
    Donator

    Join Date
    Dec 2014
    Posts
    289
    Thanks given
    160
    Thanks received
    56
    Rep Power
    37
    Quote Originally Posted by 1Day2Die View Post
    Seconds ?
    My Apoligies I went to bed I'll have it fixed for you soon
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. Fixing Log In\Out Problem
    By _Fear in forum Tutorials
    Replies: 11
    Last Post: 04-14-2010, 10:35 PM
  2. Stop mass mageing problem
    By rukia in forum Tutorials
    Replies: 8
    Last Post: 08-28-2007, 03:22 PM
  3. Simple Minigame - Puppet Problems
    By Whitey in forum Tutorials
    Replies: 28
    Last Post: 08-06-2007, 11:55 AM
  4. No Router, No Problem
    By Z in forum Tutorials
    Replies: 6
    Last Post: 07-24-2007, 10:29 AM
  5. Backround problem , ;dd.
    By Kevvah . in forum General
    Replies: 0
    Last Post: 07-10-2007, 11:41 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
  •