Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lastTimeIdx = ''
- currentRoll = []
- lastRoll = []
- buffCounts = {
- 0 => 0,
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 0
- }
- def check_buff(event, buff, roll_array)
- if event.include?(buff) and event.include?('gains')
- if not roll_array.include? buff
- roll_array.push(buff)
- end
- elsif event.include?(buff) and event.include?('fades')
- if roll_array.include? buff
- roll_array.delete(buff)
- end
- end
- end
- for fileno in 1..24
- File.open("#{fileno}.csv", 'r') do |csv|
- csv.gets #ignore first line
- while line = csv.gets
- parts = line.split(',')
- if parts[0] != lastTimeIdx
- lastTimeIdx = parts[0]
- lastRoll = currentRoll.clone()
- end
- #add previous rolls on new cast
- if parts[1].include?('casts') and parts[1].include?('Roll the Bones')
- buffCounts[lastRoll.length] += 1
- #puts parts[0] if lastRoll.length == 0
- end
- check_buff(parts[1], 'Jolly Roger', currentRoll)
- check_buff(parts[1], 'Broadsides', currentRoll)
- check_buff(parts[1], 'Buried Treasure', currentRoll)
- check_buff(parts[1], 'Shark Infested Waters', currentRoll)
- check_buff(parts[1], 'True Bearing', currentRoll)
- check_buff(parts[1], 'Grand Melee', currentRoll)
- end
- end
- end
- #add last cast
- buffCounts[lastRoll.length] += 1
- puts buffCounts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement