cmd_kill.rb
znmud-0.0.1/cmd/zombie/cmd_kill.rb · 2.0 KB
From the archive znmud-minimal-0.0.1.tar.gz
Download the archive « Back to the archive contents
#
# file:: cmd_kill.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 kill command
def cmd_kill(args)
case args
when "", nil
sendto _("Kill whom?")
else
room = get_object(location)
if room.has_attribute? :peaceful and not world.is_admin? id
if not room.owner == id or not world.can_build? id
sendto(_("No. You do not want to do that here."))
return
end
end
ppl = peopleinroom(args)
case ppl.size
when 0
sendto _("Nobody here by that name")
when 1
person = ppl[0]
if world.is_admin? id
if world.is_admin? person.id
sendto _("You can not kill a fellow admin. Shame on you!")
else
sendto _("You smote %{person}!!" % {:person => person.name})
sendroom _("%{name} smotes %{person} with a lightning bolt from the heavens!!!" % {:name => name, :person => person.name})
person.make_corpse
end
elsif world.can_build? person.id
sendto _("You are stupid but not THAT stupid!")
elsif person.account and @account
if options['player_killing'] == true
add_event(person.id, id, :show, _("You attack %{person}!!!" % {:person => person.name}))
add_event(id, person.id, :show, _("%{name} attacks you!!!" % {:name => name}))
add_event(person.id, id, :showrest, _("%{name} attacks %{person}!!!" % {:name => name, :person => person.name}))
@targetattack = person.id
add_combatant(person.id)
else
sendto _("You should not attack a fellow player!")
end
else # Mobile
add_event(person.id, id, :show, _("You attack %{person}!!!" % {:person => person.name}))
add_event(id, person.id, :show, _("%{name} attacks you!!!" % {:name => name}))
@targetattack = person.id
add_combatant(person.id)
end
else
sendto _("Which one?")
end
end
end
end