Thread: [pi] restock a general store

Results 1 to 7 of 7
  1. #1 [pi] restock a general store 
    Registered Member
    Join Date
    Jul 2012
    Posts
    406
    Thanks given
    68
    Thanks received
    43
    Rep Power
    20
    For some reason, my other stores that aren't general stores can restock. What i want is for the general store to restock and delete the player items once in a while?


    How can i do dat
    Reply With Quote  
     

  2. #2  
    Donator

    Robgob69's Avatar
    Join Date
    Oct 2010
    Age
    33
    Posts
    749
    Thanks given
    71
    Thanks received
    139
    Rep Power
    117
    add a timer for when each item that is added(and isn't a stock item) to be removed after a certain time has passed.
    potatoes.
    Reply With Quote  
     

  3. #3  
    Registered Member Aintaro.'s Avatar
    Join Date
    Sep 2010
    Posts
    998
    Thanks given
    188
    Thanks received
    213
    Rep Power
    37
    This is my ShopHandler process() and it restocks items as for the delete items I don't have at the moment.


    Code:
    public void process() {
    		boolean DidUpdate = false;
    		for(int i = 1; i <= TotalShops; i++) {
    			for(int j = 0; j < MaxShopItems; j++) {
    				if (ShopItems[i][j] > 0) {
    					if (ShopItemsDelay[i][j] >= MaxShowDelay) {
    						if (j <= ShopItemsStandard[i] && ShopItemsN[i][j] <= ShopItemsSN[i][j]) {
    							if (ShopItemsN[i][j] < ShopItemsSN[i][j]) {
    								ShopItemsN[i][j] += 1;
    								DidUpdate = true;
    								ShopItemsDelay[i][j] = 1;
    								ShopItemsDelay[i][j] = 0;
    								DidUpdate = true;
    							}
    						} else if (ShopItemsDelay[i][j] >= MaxSpecShowDelay) {
    							DiscountItem(i, j);
    							ShopItemsDelay[i][j] = 0;
    							DidUpdate = true;
    						}
    					}
    					ShopItemsDelay[i][j]++;
    				}
    			}
    			if (DidUpdate == true) {
    				for (int k = 1; k < Config.MAX_PLAYERS; k++) {
    					if (Server.playerHandler.players[k] != null) {
    						if (Server.playerHandler.players[k].isShopping == true && Server.playerHandler.players[k].myShopId == i) {
    							Server.playerHandler.players[k].updateShop = true;
    							DidUpdate =false;
    							Server.playerHandler.players[k].updateshop(i);
    						}
    					}
    				}
    				DidUpdate = false;
    			}
    		}
    	}
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Jul 2012
    Posts
    406
    Thanks given
    68
    Thanks received
    43
    Rep Power
    20
    Quote Originally Posted by Aintaro. View Post
    This is my ShopHandler process() and it restocks items as for the delete items I don't have at the moment.


    Code:
    public void process() {
    		boolean DidUpdate = false;
    		for(int i = 1; i <= TotalShops; i++) {
    			for(int j = 0; j < MaxShopItems; j++) {
    				if (ShopItems[i][j] > 0) {
    					if (ShopItemsDelay[i][j] >= MaxShowDelay) {
    						if (j <= ShopItemsStandard[i] && ShopItemsN[i][j] <= ShopItemsSN[i][j]) {
    							if (ShopItemsN[i][j] < ShopItemsSN[i][j]) {
    								ShopItemsN[i][j] += 1;
    								DidUpdate = true;
    								ShopItemsDelay[i][j] = 1;
    								ShopItemsDelay[i][j] = 0;
    								DidUpdate = true;
    							}
    						} else if (ShopItemsDelay[i][j] >= MaxSpecShowDelay) {
    							DiscountItem(i, j);
    							ShopItemsDelay[i][j] = 0;
    							DidUpdate = true;
    						}
    					}
    					ShopItemsDelay[i][j]++;
    				}
    			}
    			if (DidUpdate == true) {
    				for (int k = 1; k < Config.MAX_PLAYERS; k++) {
    					if (Server.playerHandler.players[k] != null) {
    						if (Server.playerHandler.players[k].isShopping == true && Server.playerHandler.players[k].myShopId == i) {
    							Server.playerHandler.players[k].updateShop = true;
    							DidUpdate =false;
    							Server.playerHandler.players[k].updateshop(i);
    						}
    					}
    				}
    				DidUpdate = false;
    			}
    		}
    	}


    AH thank you very much. I will try it. I will probably use the idea and delete added items.
    Reply With Quote  
     

  5. #5  
    Registered Member Aintaro.'s Avatar
    Join Date
    Sep 2010
    Posts
    998
    Thanks given
    188
    Thanks received
    213
    Rep Power
    37
    Quote Originally Posted by rs4life View Post
    AH thank you very much. I will try it. I will probably use the idea and delete added items.
    No problem, enjoy

    Edit: I also figured out that the item you will sell in the shop start decreasing with 1 every 10 seconds or so and once the item is <1 it will delete it.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Jul 2012
    Posts
    406
    Thanks given
    68
    Thanks received
    43
    Rep Power
    20
    Quote Originally Posted by Aintaro. View Post
    No problem, enjoy

    Edit: I also figured out that the item you will sell in the shop start decreasing with 1 every 10 seconds or so and once the item is <1 it will delete it.
    I got a weird problem tho, if i sell a player item into a general store like maybe 10 of the item, then i click to buy 1, it removes all of the items from the store and gives me 1...
    Reply With Quote  
     

  7. #7  
    Registered Member Aintaro.'s Avatar
    Join Date
    Sep 2010
    Posts
    998
    Thanks given
    188
    Thanks received
    213
    Rep Power
    37
    Quote Originally Posted by rs4life View Post
    I got a weird problem tho, if i sell a player item into a general store like maybe 10 of the item, then i click to buy 1, it removes all of the items from the store and gives me 1...
    Yeah I noticed, If I fixed it i'll send you a pm
    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. How do I restock a PI store?
    By auto talker in forum Help
    Replies: 0
    Last Post: 01-10-2012, 01:32 AM
  2. PI general store restock.
    By RSZhuk in forum Help
    Replies: 1
    Last Post: 11-13-2011, 10:52 PM
  3. general store
    By Leanbow in forum Help
    Replies: 0
    Last Post: 03-06-2010, 05:58 PM
  4. General Store?
    By Xuzk in forum Help
    Replies: 8
    Last Post: 01-19-2010, 11:13 PM
  5. General Store?
    By Kduffy45 in forum Help
    Replies: 2
    Last Post: 01-03-2010, 06:01 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
  •