#
# file:: cmd_canned_emote.rb
# author:: Craig Smith
# 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")
# Provides canned emotes
# if this is a special emote command (Has :me & :two values setup...) treat special
# [+args+] Any additional arguments specified
# [+i+] Mesasge to player not directed at anybody
# [+me+] Message to player when directing action
# [+you+] If a person is specified the message they will see
# [+rest+] The message the rest of the room sees
def cmd_canned_emote(args,i,me,you,room,rest)
# If this command wasn't meant to have args, remove them
if not me and not you and not rest
args = nil
end
case args
when nil,""
# If no i or room specified we assume this is meant to be directed
if not i and not room
sendto _("at what?")
return
end
# When no arguments are used the only valid options are you and room
if i
msg = Msg.new i
msg.ch1 = self
sendto(msg)
end
if room
msg = Msg.new room
msg.ch1 = self
sendroom(msg)
end
else
ppl = peopleinroom(args)
if ppl.size > 0
person = ppl[0]
if me
msg = Msg.new me
msg.ch1 = self
msg.ch2 = person
sendto(msg)
end
if you
msg = Msg.new you
msg.ch1 = self
msg.ch2 = person
add_event(id, person.id, :show, msg)
end
if rest
msg = Msg.new rest
msg.ch1 = self
msg.ch2 = person
sendrest(msg, person.id)
end
else
sendto _("You do not see them here.")
end
end
end
end