Advertisement
akbare

random sell price every hour

Jan 29th, 2024
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. //emistry
  2. prontera,155,181,5 shop apple_shop 757,512:-1
  3.  
  4. - script apple_shop_main -1,{
  5.  
  6. OnInit:
  7. .item_id = 512;
  8. .max_amount = 2000000;
  9.  
  10. .shop_npc$ = "apple_shop";
  11.  
  12. OnMinute00: // update every hour
  13. hideonnpc .shop_npc$;
  14. npcshopdelitem .shop_npc$, .item_id;
  15. .@sql$ = .@sql$ + "SELECT `amount` FROM `inventory` WHERE `nameid` = "+.item_id;
  16. .@sql$ = .@sql$ + " UNION ";
  17. .@sql$ = .@sql$ + "SELECT `amount` FROM `cart_inventory` WHERE `nameid` = "+.item_id;
  18. .@sql$ = .@sql$ + " UNION ";
  19. .@sql$ = .@sql$ + "SELECT `amount` FROM `storage` WHERE `nameid` = "+.item_id;
  20. .@sql$ = .@sql$ + " UNION ";
  21. .@sql$ = .@sql$ + "SELECT `amount` FROM `guild_storage` WHERE `nameid` = "+.item_id;
  22. .@size = query_sql(.@sql$, .@amount);
  23. for (.@i = 0; .@i < .@size; .@i++)
  24. .@total_amount += .@amount[.@i];
  25.  
  26. setiteminfo .item_id, ITEMINFO_SELL, (.max_amount / .@total_amount);
  27. setiteminfo .item_id, ITEMINFO_BUY, (((.max_amount / .@total_amount) * 100) / rand(1, 3)));
  28.  
  29. npcshopadditem .shop_npc$, .item_id, (.max_amount / .@total_amount);
  30. hideoffnpc .shop_npc$;
  31. end;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement