Thread: buy diff from sell help

Results 1 to 9 of 9
  1. #1 buy diff from sell help 
    Banned
    Join Date
    Oct 2011
    Posts
    184
    Thanks given
    2
    Thanks received
    0
    Rep Power
    0
    I want it where you say buy a blue charm for 5m and sell for 50% of it, but i dont wamnna go through and do tht to everything in the shops. Is there a way i can make where verything that you can sell back is 50% less?
    Reply With Quote  
     

  2. #2  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    on sellitem method like

    Code:
    if(itemId = Blue charm id){
    c.getItems.additem(totprice2/2,995);
    }
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Oct 2011
    Posts
    184
    Thanks given
    2
    Thanks received
    0
    Rep Power
    0
    Code:
    	public boolean sellItem(int itemID, int fromSlot, int amount) {
    			if(c.inTrade) {
                		c.sendMessage("You cant sell items to the shop while your in trade!");
               		return false;
                		}
    		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;
    	}
    anyone add in there so everything is 50% of buy price? It help a lot
    Reply With Quote  
     

  4. #4  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    here u go
    Code:
    public boolean sellItem(int itemID, int fromSlot, int amount) {
    			if(c.inTrade) {
                		c.sendMessage("You cant sell items to the shop while your in trade!");
               		return false;
                		}
    		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/2);
    					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;
    	}
    Reply With Quote  
     

  5. #5  
    Banned
    Join Date
    Oct 2011
    Posts
    184
    Thanks given
    2
    Thanks received
    0
    Rep Power
    0
    Didnt work, it still is same as the buy price
    Reply With Quote  
     

  6. #6  
    Donator

    Thock321's Avatar
    Join Date
    Jul 2011
    Posts
    1,804
    Thanks given
    706
    Thanks received
    363
    Rep Power
    416
    Code:
    			for (int i = amount; i > 0; i--) {
    				TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 1, fromSlot))/2;
    				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;
    				}
    			}
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Nov 2009
    Posts
    422
    Thanks given
    3
    Thanks received
    20
    Rep Power
    7
    Just change the second price in item.cfg
    Code:
    item = #### Blue_charm A_blue_charm 5000000 2500000
    Quote Originally Posted by Joshinator View Post
    doesnt work when i comile now i get this

    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Press any key to continue . . .
    Reply With Quote  
     

  8. #8  
    Banned
    Join Date
    Oct 2011
    Posts
    184
    Thanks given
    2
    Thanks received
    0
    Rep Power
    0
    ipk thats not how mine is my prices go off of prices.txt, in item.cfg there isnt any, and thock i get errors
    Reply With Quote  
     

  9. #9  
    Banned
    Join Date
    Oct 2011
    Posts
    184
    Thanks given
    2
    Thanks received
    0
    Rep Power
    0
    many people have told me to change it in item.cfg, so i decided to delete the price for whip from prices.txt and add it to item.cfg
    this is the code
    Code:
    item = 4151	Abyssal_whip	A_weapon_from_the_Abyss.	15000000	1000000	5000	10000	82	0	0	0	0	0
    I made them all diff to see what the prices would be, unfortunately they only go off the second one as the buy and sell is the same.
    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. Replies: 6
    Last Post: 07-17-2013, 05:42 AM
  2. Sell X? not buy..
    By BryceTheCoder in forum Help
    Replies: 2
    Last Post: 06-17-2012, 09:22 PM
  3. Adding Buy X and Sell X
    By Bauce in forum Help
    Replies: 2
    Last Post: 10-31-2011, 10:36 PM
  4. [PI] Shops sell or buy only
    By Arithium in forum Help
    Replies: 3
    Last Post: 10-20-2010, 10:56 PM
  5. Replies: 0
    Last Post: 03-28-2010, 04:50 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •