Exemplo n.º 1
0
        public string Process(INonPlayerCharacter npc, string command)
        {
            if (command == null)
            {
                string lastCommunincation = null;
                string lastMessage        = null;
                while ((lastMessage = npc.DequeueMessage()) != null)
                {
                    if (lastMessage.StartsWith(CommunicationHeader))
                    {
                        lastCommunincation = lastMessage;
                    }
                }

                if (lastCommunincation != null)
                {
                    lastCommunincation = lastCommunincation.Replace(CommunicationHeader, "");
                    lastCommunincation = lastCommunincation.Replace(CommunicationTrailer, "");

                    string[] words = lastCommunincation.Split(' ');
                }
            }

            return(command);
        }
Exemplo n.º 2
0
        public string Process(INonPlayerCharacter npc, string command)
        {
            if (command == null)
            {
                string lastCommunincation = null;
                string lastMessage        = null;
                while ((lastMessage = npc.DequeueMessage()) != null)
                {
                    if (lastMessage.StartsWith(CommunicationHeader))
                    {
                        lastCommunincation = lastMessage;
                        break;
                    }
                }

                if (lastCommunincation != null)
                {
                    lastCommunincation = lastCommunincation.Replace(CommunicationHeader, "");
                    lastCommunincation = lastCommunincation.Replace(CommunicationTrailer, "");

                    string[] wordsRaw = lastCommunincation.Split(' ');

                    List <string> words = new List <string>();
                    int           start;

                    string mobKeyword = wordsRaw[0];
                    string communicationCommand;

                    if (wordsRaw[1] == "tells")
                    {
                        //Mob tells you ...
                        start = 3;
                        communicationCommand = "tell";
                    }
                    else if (wordsRaw[1] == "says")
                    {
                        //Mob says ...
                        start = 2;
                        communicationCommand = "say";
                    }
                    else
                    {
                        //don't do anything for shouts etc
                        return(command);
                    }

                    for (int i = start; i < wordsRaw.Length; i++)
                    {
                        words.Add(wordsRaw[i]);
                    }

                    foreach (IResponse response in Responses)
                    {
                        if (response.Match(words))
                        {
                            if (communicationCommand == "tell")
                            {
                                command = $"{communicationCommand} {mobKeyword} {response.Message}";
                                break;
                            }
                            else if (communicationCommand == "say")
                            {
                                command = $"{communicationCommand} {response.Message}";
                                break;
                            }
                        }
                    }
                }
            }

            return(command);
        }
Exemplo n.º 3
0
        private string NightTimeThings(INonPlayerCharacter npc)
        {
            if (npc.Room.Id == 20)
            {
                string message = null;
                StateMachine = State.GotoBalcony;

                while ((message = npc.DequeueMessage()) != null)
                {
                    if (message == "<Communication>King says Court is closed for the day. Please come back tomorrow.</Communication>")
                    {
                        npc.EnqueueCommand("Say Its about time.");
                        return("West");
                    }
                }

                if (GlobalReference.GlobalValues.GameDateTime.GameDateTime.Hour == 14)
                {
                    npc.EnqueueCommand("Say Court is closed for the day. Please come back tomorrow.");
                    return("West");
                }
            }

            if (StateMachine == State.GotoBalcony)
            {
                if (npc.Room.Zone == 24 &&
                    npc.Room.Id == 22)
                {
                    Step = 0;
                    return("North");
                }

                if (GlobalReference.GlobalValues.FindObjects.FindNpcInRoom(npc.Room, "King").Count > 0)
                {
                    StateMachine = State.SpendTimeWithKing;
                    Step         = 0;
                    return("Say Hello dear.");
                }
            }
            else if (StateMachine == State.SpendTimeWithKing)
            {
                if (Step % 5 == 0)
                {
                    string message = null;

                    while ((message = npc.DequeueMessage()) != null)
                    {
                        if (message == "<Communication>King says Hello my beautify Queen.</Communication>")
                        {
                            return("Say I wish we could just leave this all behind.");
                        }
                        else if (message == "<Communication>King says That sounds nice.  We should take a trip to the country to get away for a while.</Communication>")
                        {
                            return("Say A trip to the country sounds great  We can goto the villa.");
                        }
                        else if (message == "<Communication>King says Lets plan to do this when the weather gets a little nicer.</Communication>")
                        {
                            return("Say Agreed.");
                        }
                        else if (message == "<Communication>King says Good night my love.</Communication>")
                        {
                            StateMachine = State.Bath;
                            Step         = 0;
                            return("Say Goodnight my dear.");
                        }
                    }
                }
            }
            else if (StateMachine == State.Bath)
            {
                if (npc.Room.Zone == 24 &&
                    npc.Room.Id == 23)
                {
                    return("South");
                }
                else if (npc.Room.Zone == 24 &&
                         npc.Room.Id == 22)
                {
                    return("South");
                }
                else if (npc.Room.Zone == 24 &&
                         npc.Room.Id == 24)
                {
                    if (Step % 5 == 0)
                    {
                        StateMachine        = State.Undress;
                        Step                = 0;
                        npc.LookDescription = "The Queen's hair falls gently down the back of her naked figure.";
                        return("Emote removes her dress.");
                    }
                }
            }
            else if (StateMachine == State.Undress)
            {
                if (Step % 5 == 0)
                {
                    StateMachine        = State.InTub;
                    npc.LookDescription = "The Queen relaxes in the tub almost floating with only her head above the water.";

                    return("Emote climbs into bath tub.");
                }
            }
            else if (StateMachine == State.InTub)
            {
                if (GlobalReference.GlobalValues.GameDateTime.GameDateTime.Hour == 20)
                {
                    StateMachine        = State.GetDress;
                    Step                = 0;
                    npc.LookDescription = "The Queen's hair falls gently down the back of her naked figure.";
                    return("Emote slowly rises out of the tub.");
                }
            }
            else if (StateMachine == State.GetDress)
            {
                if (Step % 5 == 0)
                {
                    StateMachine        = State.GotoSleep;
                    npc.LookDescription = "The Queen is dressed in her white sleep gown.";

                    return("Emote puts on her night gown.");
                }
            }
            else if (StateMachine == State.GotoSleep)
            {
                if (Step % 5 == 0)
                {
                    if (npc.Room.Zone == 24 &&
                        npc.Room.Id == 24)
                    {
                        return("North");
                    }
                    else if (npc.Room.Zone == 24 &&
                             npc.Room.Id == 22)
                    {
                        return("Sleep");
                    }
                }
            }

            return(null);
        }
Exemplo n.º 4
0
        public string Process(INonPlayerCharacter npc, string command)
        {
            if (command != null)
            {
                return(command);
            }

            if (npc.IsInCombat)
            {
                return(null);
            }

            Step++;

            if (StateMachine == State.Wait)
            {
                string message = null;
                while ((message = npc.DequeueMessage()) != null)
                {
                    if (message == "<Communication>King says Servant, bring me my meal.</Communication>")
                    {
                        npc.EnqueueCommand("Wait");
                        npc.EnqueueCommand("Wait");
                        npc.EnqueueCommand("Emote bows.");
                        npc.EnqueueCommand("Wait");
                        npc.EnqueueCommand("Wait");
                        npc.EnqueueCommand("Say Your Honorable Majestic Majesty Graciousness, what would you like to eat?");
                        StateMachine = State.AskedWhatWanted;
                    }
                }
            }
            else if (StateMachine == State.AskedWhatWanted)
            {
                string message = null;
                while ((message = npc.DequeueMessage()) != null)
                {
                    if (message == "<Communication>King says Bring me hasenpfeffer.</Communication>")
                    {
                        npc.EnqueueCommand("Wait");
                        npc.EnqueueCommand("Wait");
                        npc.EnqueueCommand("Say Right away Your Honorable Royal Majestic Graciousness.");
                        npc.EnqueueCommand("Wait");
                        StateMachine = State.KingToldHasenpfeffer;
                    }
                }
            }
            else if (StateMachine == State.KingToldHasenpfeffer)
            {
                npc.EnqueueCommand("East");
                npc.EnqueueCommand("Wait");
                npc.EnqueueCommand("Down");
                npc.EnqueueCommand("Wait");
                npc.EnqueueCommand("North");
                npc.EnqueueCommand("Wait");
                StateMachine = State.OnWayToKitchen;
            }
            else if (StateMachine == State.OnWayToKitchen)
            {
                if (npc.Room.Id == 19)
                {
                    List <INonPlayerCharacter> nonPlayerCharacters = GlobalReference.GlobalValues.FindObjects.FindNpcInRoom(npc.Room, "cook");
                    if (nonPlayerCharacters.Count > 0)
                    {
                        StateMachine = State.AskCookForHasenpfeffer;
                        return("Say The King wants hasenpfeffer to eat.");
                    }
                    else
                    {
                        StateMachine = State.EmptyKitchen;
                        Step         = 0;
                    }
                }
            }
            else if (StateMachine == State.EmptyKitchen)
            {
                switch (Step)
                {
                case 1:
                    return("Say Hello?");

                case 5:
                    return("Say Is there anyone here?");

                case 10:
                    return("Say Great how am I going to make hasenpfeffer?");

                case 15:
                    return("Emote scurries around the kitchen looking for something to give the King.");

                case 20:
                    return("Emote scurries around the kitchen looking for something to give the King.");

                case 25:
                    return("Say Ah Ha!");

                case 30:
                    return("Say This carrot will work.");

                case 35:
                    npc.EnqueueCommand("Wait");
                    npc.EnqueueCommand("South");
                    npc.EnqueueCommand("Wait");
                    npc.EnqueueCommand("Up");
                    npc.EnqueueCommand("Wait");
                    npc.EnqueueCommand("West");
                    StateMachine = State.GiveToKingCarrot;
                    break;
                }
            }
            else if (StateMachine == State.AskCookForHasenpfeffer)
            {
                string message = null;
                while ((message = npc.DequeueMessage()) != null)
                {
                    if (message == "<Communication>Cook says here you go. Hasenpfeffer for the King.</Communication>")
                    {
                        npc.EnqueueCommand("Wait");
                        npc.EnqueueCommand("South");
                        npc.EnqueueCommand("Wait");
                        npc.EnqueueCommand("Up");
                        npc.EnqueueCommand("Wait");
                        npc.EnqueueCommand("West");
                        StateMachine = State.GiveToKingHasenpfeffer;
                    }
                }
            }
            else if (StateMachine == State.GiveToKingHasenpfeffer)
            {
                if (npc.Room.Id == 21 &&
                    GlobalReference.GlobalValues.FindObjects.FindNpcInRoom(npc.Room, "King").Count > 0)
                {
                    StateMachine = State.Wait;
                    return("Bon appetit Most Gracious Majesty.");
                }
            }
            else if (StateMachine == State.GiveToKingCarrot)
            {
                if (npc.Room.Id == 21 &&
                    GlobalReference.GlobalValues.FindObjects.FindNpcInRoom(npc.Room, "King").Count > 0)
                {
                    StateMachine = State.Wait;
                    return("Your hasenpfeffer Your Magisty.");
                }
            }

            return(null);
        }
Exemplo n.º 5
0
        private string CheckForTrigger(INonPlayerCharacter npc)
        {
            string message;

            while ((message = npc.DequeueMessage()) != null)
            {
                if (message == "<Communication>kings servant says The king wants hasenpfeffer to eat.</Communication>")
                {
                    List <INonPlayerCharacter> nonPlayerCharacters = new List <INonPlayerCharacter>(npc.Room.NonPlayerCharacters);
                    for (int i = 0; i < nonPlayerCharacters.Count; i++)
                    {
                        if (nonPlayerCharacters[i] == npc)
                        {
                            switch (cookId)
                            {
                            case 0:
                                npc.EnqueueCommand("Say Right away.");
                                EnqueueWait(npc, 2);
                                npc.EnqueueCommand("Emote begins to cut up a rabbit.");
                                EnqueueWait(npc, 5);
                                npc.EnqueueCommand("Emote puts the rabbit in the pot.");
                                break;

                            case 1:
                                npc.EnqueueCommand("Say As the king wishes.");
                                EnqueueWait(npc, 2);
                                npc.EnqueueCommand("Emote begins to cut up a potatoes.");
                                EnqueueWait(npc, 3);
                                npc.EnqueueCommand("Emote puts the potatoes in the pot.");
                                break;

                            case 2:
                                npc.EnqueueCommand("Say Sure.");
                                EnqueueWait(npc, 2);
                                npc.EnqueueCommand("Emote begins to cut up a carrots.");
                                EnqueueWait(npc, 4);
                                npc.EnqueueCommand("Emote puts the carrots in the pot.");
                                break;

                            case 3:
                                npc.EnqueueCommand("Say As the king wishes.");
                                EnqueueWait(npc, 2);
                                npc.EnqueueCommand("Emote stokes the cooking fire.");
                                EnqueueWait(npc, 4);
                                npc.EnqueueCommand("Emote stirs the pot.");
                                EnqueueWait(npc, 4);
                                npc.EnqueueCommand("Emote stirs the pot.");
                                EnqueueWait(npc, 4);
                                npc.EnqueueCommand("Emote stirs the pot.");
                                EnqueueWait(npc, 4);
                                npc.EnqueueCommand("Emote stirs the pot.");
                                EnqueueWait(npc, 2);
                                npc.EnqueueCommand("Say here you go.  Hasenpfeffer for the king.");
                                break;
                            }

                            break;
                        }
                    }
                }
            }

            return(message);
        }
Exemplo n.º 6
0
        private string DayTimeThings(INonPlayerCharacter npc)
        {
            if (StateMachine == State.Sleep)
            {
                switch (Step)
                {
                case 1:
                    return("Emote stretches and yawns loudly.");

                case 3:
                    return("Say Good morning world.");

                case 4:
                    StateMachine = State.MoveToBathRoom;
                    Step         = 0;
                    return("Stand");
                }
            }
            else if (StateMachine == State.MoveToBathRoom)
            {
                if (npc.Room.Id == 22)
                {
                    return("South");
                }
                else if (npc.Room.Id == 24)
                {
                    StateMachine = State.InBathRoom;
                    Step         = 0;
                }
            }
            else if (StateMachine == State.InBathRoom)
            {
                switch (Step)
                {
                case 1:
                    return("Emote brushes his teeth.");

                case 3:
                    return("Emote uses the bathroom.");

                case 5:
                    return("North");

                case 6:
                    StateMachine = State.ThroneRoom;
                    return("East");
                }
            }
            else if (StateMachine == State.ThroneRoom)
            {
                if (Step % 5 == 0 &&
                    GlobalReference.GlobalValues.Random.PercentDiceRoll(50) &&
                    GlobalReference.GlobalValues.FindObjects.FindNpcInRoom(npc.Room, "servant").Count > 0)
                {
                    StateMachine = State.AskedForMeal;
                    Step         = 0;
                    return("Say Servant, bring me my meal.");
                }
            }
            else if (StateMachine == State.AskedForMeal)
            {
                if (Step % 5 == 0 &&
                    GlobalReference.GlobalValues.FindObjects.FindNpcInRoom(npc.Room, "servant").Count > 0)
                {
                    bool   foundAskedForWhat = false;
                    string message           = null;
                    while ((message = npc.DequeueMessage()) != null)
                    {
                        if (message == "<Communication>Kings servant says Your Honorable Majestic Majesty Graciousness, what would you like to eat?</Communication>")
                        {
                            foundAskedForWhat = true;
                            break;
                        }
                    }

                    if (foundAskedForWhat)
                    {
                        StateMachine = State.AskedForHasenpfeffer;
                        Step         = 0;
                    }

                    return(null);
                }
            }
            else if (StateMachine == State.AskedForHasenpfeffer)
            {
                string message = null;
                while ((message = npc.DequeueMessage()) != null)
                {
                    if (message == "<Communication>Kings servant says Bon appetit Most Gracious Majesty.</Communication>")
                    {
                        StateMachine = State.ReceivedHasenpfeffer;
                        Step         = 0;
                        break;
                    }
                    else if (message == "<Communication>Kings servant says Your hasenpfeffer Your Magisty.</Communication>")
                    {
                        StateMachine = State.ReceivedCarrot;
                        Step         = 0;
                        break;
                    }
                }

                if (StateMachine == State.AskedForHasenpfeffer)
                {
                    switch (Step)
                    {
                    case 1:
                        return("Say Bring me hasenpfeffer.");

                    case 20:
                        return("Say Where is my hasenpfeffer?");
                    }
                }
            }
            else if (StateMachine == State.ReceivedHasenpfeffer)
            {
                StateMachine = State.ThroneRoom;
                return("Emote eats hasenpfeffer.");
            }
            else if (StateMachine == State.ReceivedCarrot)
            {
                switch (Step)
                {
                case 1:
                    return("Emote eats hasenpfeffer.");

                case 3:
                    StateMachine = State.ThroneRoom;
                    return("Say If I didn't know this was hasenpfeffer I'd swear it was carrots.");
                }
            }

            return(null);
        }
Exemplo n.º 7
0
        private string NightTimeThings(INonPlayerCharacter npc)
        {
            if (npc.Room.Id == 21)
            {
                npc.EnqueueCommand("Say Court is closed for the day. Please come back tomorrow.");
                StateMachine = State.SpendTimeWithQueen;
                return("West");
            }

            if (npc.Room.Id != 21 && npc.Room.Zone == 24)
            {
                if (npc.Room.PlayerCharacters.Count > 0)
                {
                    foreach (IPlayerCharacter pc in npc.Room.PlayerCharacters)
                    {
                        if (GlobalReference.GlobalValues.CanMobDoSomething.SeeObject(npc, pc))
                        {
                            int howManyKingsGuards = GlobalReference.GlobalValues.FindObjects.FindNpcInRoom(npc.Room, "King's guard").Count;
                            if (howManyKingsGuards < 4)
                            {
                                SummonKingsGuards(4 - howManyKingsGuards, npc.Room);
                                return("Say GUARDS!");
                            }
                        }
                    }
                }
            }

            if (StateMachine == State.SpendTimeWithQueen)
            {
                if (npc.Room.Id == 22)
                {
                    Step = 0;
                    return("North");
                }

                if (Step % 5 == 0)
                {
                    string message = null;

                    while ((message = npc.DequeueMessage()) != null)
                    {
                        if (message == "<Communication>Queen says Hello dear.</Communication>")
                        {
                            return("Say Hello my beautify queen.");
                        }
                        else if (message == "<Communication>Queen says I wish we could just leave this all behind.</Communication>")
                        {
                            return("Say That sounds nice.  We should take a trip to the country to get away for a while.");
                        }
                        else if (message == "<Communication>Queen says A trip to the country sounds great  We can goto the villa.</Communication>")
                        {
                            return("Say Lets plan to do this when the weather gets a little nicer.");
                        }
                        else if (message == "<Communication>Queen says Agreed.</Communication>")
                        {
                            return("Say Good night my love.");
                        }
                        else if (message == "<Communication>Queen says Goodnight my dear.</Communication>")
                        {
                            StateMachine = State.Sleep;
                            return("South");
                        }
                    }
                }
            }
            else if (StateMachine == State.Sleep)
            {
                if (npc.Room.Zone == 24 &&
                    npc.Room.Id == 14)
                {
                    if (npc.Position != MobileObject.CharacterPosition.Sleep)
                    {
                        return("Sleep");
                    }
                }
            }

            return(null);
        }