Ejemplo n.º 1
0
        public override void OnUserChat(RoomInstance Instance, RoomActor Actor, string MessageText, bool Shout)
        {
            string Message = MessageText.ToLower().Trim();
            string PetName = mSelfBot.PetData.Name.ToLower();

            if (mSelfActor == null || mSelfBot.PetData.OwnerId != Actor.ReferenceId || Actor.Type !=
                RoomActorType.UserCharacter || !Message.StartsWith(PetName + " ") || Message.Length <= PetName.Length)
            {
                return;
            }

            if (mSelfBot.PetData.Energy < 20)
            {
                mSelfActor.SetStatus("gst", "hng");
                RespondToEvent("TIRED");
                return;
            }

            if (mSelfBot.PetData.Happiness < 20)
            {
                mSelfActor.SetStatus("gst", "sad");
                RespondToEvent("UNHAPPY");
                return;
            }

            int    SkipLength = PetName.Length + 1;
            string Command    = MessageText.Substring(SkipLength, MessageText.Length - SkipLength).ToLower().Trim();

            switch (Command)
            {
            case "free":

                mSelfActor.ClearStatusses();
                mSelfActor.Chat("All statusses cleared");
                break;

            default:

                mSelfActor.SetStatus(Command.ToLower());
                mSelfActor.Chat("Effect applied: " + Command.ToLower());
                mSelfActor.UpdateNeeded = true;
                break;
            }
        }