# # file:: cmd_stats.rb # This source code copyright (C) 2009 Craig Smith # All rights reserved. # # Released under the terms of the TeensyMUD Public License # See LICENSE file for additional information. # module Cmd bindtextdomain("cmd") # The stats command def cmd_stats(args) level = stats[:level].to_s level = _("Builder") if world.is_builder? id level = _("God") if world.is_admin? id wper = (carry_weight / stats[:maxweight].to_f) * 100 encumbered = _("No") encumbered = _("A little") if wper > 50 encumbered = _("Yes") if wper > 75 # TODO: Convert this to some more international friendly msg=<<EOM ---------------[ [color Green]#{name}[/color] ]--------------- Level : [color Yellow]#{level}[/color] Strength : [color Yellow]#{stats[:strength]}[/color] Intelligence : [color Yellow]#{stats[:intel]}[/color] Endurance : [color Yellow]#{stats[:endurance]}[/color] Health : [color Yellow]#{health}[/color]/#{stats[:maxhp]} Movement : [color Yellow]#{stats[:mp]}[/color]/#{stats[:maxmp]} Experience : [color Yellow]#{stats[:exp]}[/color] Kills : [color Yellow]#{stats[:kills]}[/color] Cash : $[color Yellow]#{stats[:cash]}[/color] Encumbered : [color Yellow]#{encumbered}[/color] EOM if @account msg<<"Gender : [color Yellow]#{account.gender}[/color]\n" msg<<"Occupation : [color Yellow]#{account.occupation}[/color]\n" end msg << _("You are hungry.\n") if hungry? msg << _("You are thirsty.\n") if thirsty? msg << _("You are tired.\n") if tired? if @body.wearing.size > 0 @body.wearing.each do |oid| o = get_object(oid) msg << _("Wearing %{what} on %{where}\n" % {:what => o.shortname, :where => o.val["worn"]}) end end weapons = @body.wielding? if weapons.size > 0 weapon = get_object(weapons[0]) msg << _("You are wielding %{weapon}" % {:weapon => weapon.shortname}) if weapons.size == 2 weapon = get_object(weapons[1]) msg << _(" and %{weapon}" % {:weapon => weapon.shortname}) end msg << ".\n" end @body.bodyparts.each do |bpid| bp = get_object(bpid) if bp.crippled case bp.name when /head/ msg << _("Your eyes are swollen shut.\n") when /torso/ msg << _("You have a few broken ribs.\n") else msg << _("Your %{bodypart} is crippled.\n" % {:bodypart => bp.name}) end end end if @body.severed @body.severed.each do |bpid| bp = get_object(bpid) msg << _("You are missing your %{part}.\n" % {:part => bp.name}) end end sendto(msg) end end