skills.rb
rbmud-0.2/commands/skills.rb · 1.2 KB
From the archive RbMUD-0.2.tar.bz2
Download the archive « Back to the archive contents
#!/usr/bin/env ruby
# $Revision: 1.2 $
# $Date: 2003/12/04 22:18:34 $
# $Author: jefus $
# skills.rb
# show the user's known skills and rankings in a neat and orderly fashion.
# well. it works, but it's not very neat. it's not important right now,
# but when it is, this will be nice and pretty with colors and everything.
# as a side note, the variable name 'doer' starts looking rather odd after
# a while, but it seemed appropriate because of the do_
def Commands.do_skills(doer, arg = nil)
# we'll start by iterating over the known skill list, looking for broad
# skills, and showing all the specialty skills of each.
skills = doer.skills.keys
doer.skills.keys.each {|skill| # i love ruby and OOP in general
score = "#{doer.getSkillScore(skill, Skill.Ordinary)}/"
score << "#{doer.getSkillScore(skill, Skill.Good)}/"
score << "#{doer.getSkillScore(skill, Skill.Amazing)}"
if skill.broad?
doer.puts("#{skill.name} #{score}")
skill.specialties.each {|skill|
if doer.skills.keys.include?(skill)
score = "#{doer.getSkillScore(skill, Skill.Ordinary)}/"
score << "#{doer.getSkillScore(skill, Skill.Good)}/"
score << "#{doer.getSkillScore(skill, Skill.Amazing)}"
doer.puts(" #{skill.name} #{score}")
end
}
end
}
end