Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Mar 14th, 2018 57 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #The Ratter plugin is, essentially, a one room auto-ratter.
  2. #It keeps track of the rats in your inventory, as well as how much you have earned so far.
  3. #It will send these variables on to kmuddy as the following variables,
  4. #so you can make status variables or guages or what have you
  5. #   current_rat_count (Total rats collected so far)
  6. #   total_rat_money (Total money you will earn after selling the rats)
  7.  
  8. #This has currently been customized for the Jester class and for ratting in Hashani.
  9. #Further configurability to come.
  10. class Ratter < BasePlugin
  11.  
  12.   attr_accessor :ratter_enabled, :balance_user, :attack_command, :available_rats
  13.   attr_accessor :inventory_rats, :rat_prices, :total_rat_money
  14.  
  15.   def setup
  16.     #By default, we will disable the ratter.
  17.     @ratter_enabled = false
  18.  
  19.     #This determines if we're a balance user or an equilibrium user...
  20.     @balance_user = true
  21.    
  22.     #What do we do when we want them dead?
  23.     @attack_command = "bop rat"
  24.  
  25.     #Set the current room's rats to 0
  26.     @available_rats = 0
  27.  
  28.     #Set the inventory's rats to 0
  29.     @inventory_rats = 0
  30.  
  31.     #Ratting prices taken from HELP RATTING
  32.     @rat_prices = {"baby rat" => 7, "young rat" => 14, "rat" => 21, "old rat" => 28, "black rat" => 35}
  33.  
  34.     #Total money collected so far.
  35.     @total_rat_money = 0
  36.  
  37.     #This group of triggers alerts the ratter that a rat is available in the room.
  38.     trigger /With a squeak, an*\s*\w* rat darts into the room, looking about wildly./, :rat_is_available
  39.     trigger /Your eyes are drawn to an*\s*\w* rat that darts suddenly into view./, :rat_is_available
  40.     trigger /An*\s*\w* rat noses its way cautiously out of the shadows./, :rat_is_available
  41.     trigger /An*\s*\w* rat wanders into view, nosing about for food./, :rat_is_available
  42.    
  43.     #Identifies when a rat has been killed, incrementing counters and such.
  44.     trigger /You have slain an*\s(.*\s*rat), retrieving the corpse./, :killed_rat
  45.  
  46.     #Identifies when a rat has left the room.
  47.     trigger /An*\s*\w* rat wanders back into its warren where you may not follow./, :rat_is_unavailable
  48.     trigger /With a flick of its small whiskers, an*\s*\w* rat dashes out of view./, :rat_is_unavailable
  49.     trigger /An*\s*\w* rat darts into the shadows and disappears./, :rat_is_unavailable
  50.  
  51.     #disable and enable the scripts with "rats" in the mud.
  52.     trigger /You will now notice the movement of rats\. Happy hunting\!/, :enable_ratter
  53.     trigger /You will no longer take notice of the movement of rats\./, :disable_ratter
  54.    
  55.     #sell your rats when you come into the room Liirup is in!
  56.     trigger /Liirup the Placid stands here/, :sell_rats
  57.     #Reset the money after selling to the ratter in hashan.
  58.     trigger /Liirup squeals with delight/, :reset_money
  59.  
  60.     trigger /You see exits/, :reset_available_rats
  61.     trigger /You see a single exit/, :reset_available_rats
  62.  
  63.     #After we gain balance, we need to decide if we should attack again or not.
  64.     after Character, :set_simple_stats, :should_i_attack_rat?
  65.     after Character, :set_extended_stats, :should_i_attack_rat?
  66.   end
  67.  
  68.   def ratter_enabled?
  69.     @ratter_enabled
  70.   end
  71.  
  72.   def rat_available?
  73.     @available_rats > 0
  74.   end
  75.  
  76.   def rat_is_available
  77.     #increment the available rats in the room by one.
  78.     @available_rats += 1
  79.   end
  80.  
  81.   def rat_is_unavailable
  82.     #decrement by one unless we're already at 0 for some reason.
  83.     @available_rats -= 1 unless @available_rats <= 0
  84.   end
  85.  
  86.   def killed_rat(match_object)
  87.     #decrement by one unless we're already at 0 for some reason
  88.     @available_rats -= 1 unless @available_rats <= 0
  89.  
  90.     #add the rat to our inventory rats
  91.     @inventory_rats += 1
  92.  
  93.     #take the match for the type of rat that we killed, look up it's price, and add it to the money
  94.     @total_rat_money += @rat_prices[match_object[1]]
  95.  
  96.     #send updated stats
  97.     set_kmuddy_variable("current_rat_count", @inventory_rats)
  98.     set_kmuddy_variable("total_rat_money", @total_rat_money)
  99.   end
  100.  
  101.   def enable_ratter
  102.     warn("RMuddy: Room Ratter Turned On.")
  103.     @ratter_enabled = true
  104.   end
  105.  
  106.   def disable_ratter
  107.     warn("RMuddy: Room Ratter Turned Off.")
  108.     @ratter_enabled = false
  109.   end
  110.  
  111.   #reset the stats and send them
  112.   def reset_money
  113.     @total_rat_money = 0
  114.  
  115.     set_kmuddy_variable("total_rat_money", 0)
  116.  
  117.     @inventory_rats = 0
  118.  
  119.     set_kmuddy_variable("current_rat_count", 0)
  120.     send_kmuddy_command("put sovereigns in pack")
  121.   end
  122.  
  123.   def reset_available_rats
  124.     @available_rats = 0
  125.   end
  126.  
  127.   def sell_rats
  128.     send_kmuddy_command("Sell rats to Liirup")
  129.   end
  130.  
  131.   #Decide whether or not we should attack a rat and do so if we can.
  132.   def should_i_attack_rat?
  133.     if @balance_user
  134.       if rat_available? && plugins[Character].balanced
  135.         send_kmuddy_command(@attack_command)
  136.       end
  137.     else
  138.       if rat_available? && plugins[Character].has_equilibrium
  139.         send_kmuddy_command(@attack_command)
  140.       end
  141.     end
  142.   end
  143. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top