Advertisement
roninator2

Kread-Ex Shoplifting addon

Dec 6th, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.14 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. #  ▼ Shoplifting
  3. #  Author: Kread-EX
  4. #  Addon: Roninator2
  5. #  Version 1.02.01 # addon
  6. #  Release date: 13/12/2019
  7. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  8.  
  9. #------------------------------------------------------------------------------
  10. #  ▼ UPDATES
  11. #------------------------------------------------------------------------------
  12. # # 13/12/2019. Added steal_item to stop stealing everything.
  13. # # 10/12/2012. Added class bonus and requirement. Couple bug fixes.
  14. # # 02/12/2012. Added a variable to keep track of steal attempts.
  15. #------------------------------------------------------------------------------
  16. #  ▼ TERMS OF USAGE
  17. #------------------------------------------------------------------------------
  18. # #  You are free to adapt this work to suit your needs.
  19. # #  You can use this work for commercial purposes if you like it.
  20. # #  Credit is appreciated.
  21. # #
  22. # # For support:
  23. # # grimoirecastle.wordpress.com
  24. # # rpgmakerweb.com
  25. #------------------------------------------------------------------------------
  26. #  ▼ INTRODUCTION
  27. #------------------------------------------------------------------------------
  28. # # You can steal from shops, making you a THIEF. You can customize the %
  29. # # chance of being caught, and how much agility and luck influence
  30. # # your chances.
  31. #------------------------------------------------------------------------------
  32. #  ▼ INSTRUCTIONS
  33. #------------------------------------------------------------------------------
  34. # # In the item/weapon/armor database tabs, you must use the following notetag
  35. # # to make the option to steal the item:
  36.  
  37. # # <steal_item> # must be used to specify if an item can be stolen
  38. # #
  39. #------------------------------------------------------------------------------
  40.  
  41. module KRX
  42.   module REGEXP
  43.     STEAL_ITEM = /<steal_item>/i
  44.   end
  45. end
  46.  
  47. module KRX
  48.   module SHOPLIFT
  49.     attr_reader   :steal_item
  50.     attr_reader   :steal_chance
  51.     attr_reader   :steal_agi
  52.     attr_reader   :steal_luk
  53.     def load_shoplift_notetags
  54.       @note.split(/[\r\n]+/).each do |line|
  55.         case line        
  56.         when KRX::REGEXP::STEAL_CHANCE
  57.           @steal_chance = $1.to_i
  58.         when KRX::REGEXP::STEAL_AGILITY
  59.           @steal_agi = $1.to_i
  60.         when KRX::REGEXP::STEAL_LUCK
  61.           @steal_luk = $1.to_i
  62.         when KRX::REGEXP::STEAL_ITEM
  63.           @steal_item = true
  64.         end
  65.       end
  66.     end
  67.    
  68.   end
  69. end
  70.  
  71. class Window_ShopSteal < Window_ShopBuy
  72.   def draw_item(index)
  73.     item = @data[index]
  74.     rect = item_rect(index)
  75.     draw_item_name(item, rect.x, rect.y, enable?(item))
  76.     rect.width -= 4
  77.     leader = $game_party.leader
  78.     chance = item.steal_chance || KRX::DEFAULT_STEAL_CHANCE
  79.     chance += (leader.agi * (item.steal_agi || 0) / 100.00)
  80.     chance += (leader.luk * (item.steal_luk || 0) / 100.00)
  81.     chance += (leader.class.steal_class || 0)
  82.     chance = 100 if chance > 100
  83.     chance = chance.round
  84.     draw_text(rect, chance.to_s + '%', 2) if item.steal_item
  85.   end
  86.  
  87.   def enable?(item)
  88.     item.steal_item
  89.   end
  90. end
  91.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement