Skip to content

Instantly share code, notes, and snippets.

@tamalw
Created March 10, 2011 19:25
Show Gist options
  • Save tamalw/864723 to your computer and use it in GitHub Desktop.
Save tamalw/864723 to your computer and use it in GitHub Desktop.
How many bstaffs can be bought from Zaff & the GE without losing money
require 'runescape'
days = 1
amount_per_day = 64
ge_limit_per_day = 600
bstaff_shop_cost = 7000
bstaff_alch_amt = 9300
battlestaff = Runescape::Item.new(1391)
air_orb = Runescape::Item.new(573)
earth_orb = Runescape::Item.new(575)
fire_orb = Runescape::Item.new(569)
water_orb = Runescape::Item.new(571)
nature_rune = Runescape::Item.new(561)
compute_set = [
{ :name => "Water", :component => water_orb, :xp => 100 },
{ :name => "Earth", :component => earth_orb, :xp => 112.5 },
{ :name => "Fire", :component => fire_orb, :xp => 125 },
{ :name => "Air", :component => air_orb, :xp => 137.5 }
]
for bstaff in compute_set do
total_shop_amt = days * amount_per_day
alch_gp = total_shop_amt * bstaff_alch_amt
shop_cost = (total_shop_amt * bstaff_shop_cost) +
(total_shop_amt * bstaff[:component].market) +
(total_shop_amt * nature_rune.market)
profit = alch_gp - shop_cost
ge_cost_per = (battlestaff.market + 20) + bstaff[:component].market + nature_rune.market
ge_loss_per = ge_cost_per - bstaff_alch_amt
total_ge_amt = (profit/ge_loss_per).floor > ge_limit_per_day * days ? ge_limit_per_day * days : (profit/ge_loss_per).floor
total_amt = total_shop_amt + total_ge_amt
puts "==================="
puts "#{bstaff[:name]} battlestaff"
puts "==================="
puts "#{days} days"
puts "Shop: #{total_shop_amt} @ #{amount_per_day} per day"
puts "GE: #{total_ge_amt} (#{total_ge_amt * ge_cost_per}gp)"
puts "Total staffs: #{total_amt}"
puts "GE initial investment: #{total_ge_amt * ge_cost_per}"
puts "XP gained per day: #{(total_amt * bstaff[:xp]) / days}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment