예제 #1
0
        public override void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {
            // Make sure the player has the quest and hasn't already finished the objectives.
            if (!Target.GetPlayer().QtsInterface.HasQuest(30001) || Target.GetPlayer().QtsInterface.HasFinishQuest(30001))
            {
                return;
            }

            Target.GetPlayer().QtsInterface.HandleEvent(Objective_Type.QUEST_UNKNOWN, 1314, 1, true);

            Creature c    = Obj.GetCreature();
            Random   rand = new Random();

            //  Make the villager say something
            Double chance = rand.NextDouble();

            if (chance >= 0.8)
            {
                c.Say("Thanks for saving me!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else if (chance >= 0.6)
            {
                c.Say("Phew, that was close!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else if (chance >= 0.4)
            {
                c.Say("Ahh, run for your life!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else if (chance >= 0.2)
            {
                c.Say("I could have taken him myself!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else
            {
                c.Say("Please help my friend!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }


            //  Make the villager run to either the start or the village
            chance = rand.NextDouble();
            if (chance >= 0.5)
            {
                c.GetCreature().MvtInterface.Move(22347, 53688, 7425);
            }
            else
            {
                c.GetCreature().MvtInterface.Move(15548, 51104, 7228);
            }
        }