Exemplo n.º 1
0
    public Quest AddQuest(string questKey)
    {
        Quest tempQuest = Content.Instance.GetQuest(questKey);

        if (tempQuest == null)
        {
            return(null);
        }

        tempQuest = tempQuest.Clone();

        Dictionary <string, int> inventoryCounts = Inventory.GetInventoryCounts();

        // loop through all conditions and add the item count from inventory to the quest progress
        for (int i = 0; i < tempQuest.Conditions.Count; i++)
        {
            QuestCondition cond = tempQuest.Conditions[i];
            if (cond.Condition == "loot" && inventoryCounts.ContainsKey(cond.Type))
            {
                cond.CurrentProgress = inventoryCounts[cond.Type];
            }
        }
        QuestsInProgress.Add(tempQuest);
        return(tempQuest);
    }
Exemplo n.º 2
0
        private static void HandleUse(GameSession session, PacketReader packet)
        {
            string           uuid  = packet.ReadMapleString();
            MapInteractActor actor = MapEntityStorage.GetInteractActors(session.Player.MapId).FirstOrDefault(x => x.Uuid == uuid);

            if (actor == null)
            {
                return;
            }
            if (actor.Type == InteractActorType.Binoculars)
            {
                List <QuestStatus> questList = session.Player.QuestList;
                foreach (QuestStatus item in questList.Where(x => x.Basic.QuestID >= 72000000 && x.Condition != null))
                {
                    QuestCondition condition = item.Condition.FirstOrDefault(x => x.Code != "" && int.Parse(x.Code) == actor.Id);
                    if (condition == null)
                    {
                        continue;
                    }

                    item.Completed         = true;
                    item.CompleteTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
                    session.Send(QuestPacket.CompleteExplorationGoal(item.Basic.QuestID));
                    session.Send(QuestPacket.CompleteQuest(item.Basic.QuestID));
                    break;
                }
            }

            session.Send(InteractActorPacket.UseObject(actor));
            session.Send(InteractActorPacket.Extra(actor));
        }
Exemplo n.º 3
0
        private void loadQuestDetails(dynamic resource)
        {
            foreach (dynamic questDetailRes in resource.QuestDetailList)
            {
                var questDetail = new QuestDetail();
                questDetail.Index            = questDetailRes.Index;
                questDetail.GameMode         = GameMode.Parse(questDetailRes.GameMode);
                questDetail.LevelRestriction = questDetailRes.LevelRestriction;

                int conditionIndex = 1;
                while (questDetailRes.Members.ContainsKey("ConditionType" + conditionIndex))
                {
                    var condition = new QuestCondition(QuestConditionType.Parse(questDetailRes.Members["ConditionType" + conditionIndex]),
                                                       ((string)questDetailRes.Members["ConditionCount" + conditionIndex]).Split(',').Select(int.Parse).ToList());
                    questDetail.Conditions.Add(condition);
                    conditionIndex++;
                }

                int requireItemIndex = 1;
                while (questDetailRes.Members.ContainsKey("RequireItem" + requireItemIndex))
                {
                    var requirement = new QuestItemRequirement(questDetailRes.Members["RequireItem" + requireItemIndex], questDetailRes.Members["Quantity" + requireItemIndex]);
                    questDetail.ItemRequirement.Add(requirement);
                    requireItemIndex++;
                }
                _questDetails.Add(questDetail.Index, questDetail);
            }
        }
Exemplo n.º 4
0
        public static void UpdateExplorationQuest(GameSession session, string code, string type)
        {
            List <QuestStatus> questList = session.Player.QuestList;

            foreach (QuestStatus quest in questList.Where(x => x.Basic.QuestType == QuestType.Exploration && x.Condition != null))
            {
                QuestCondition condition = quest.Condition.Where(x => x.Type == type)
                                           .FirstOrDefault(x => x.Codes.Length != 0 && x.Codes.Contains(code));
                if (condition == null)
                {
                    continue;
                }

                if (condition.Goal != condition.Current)
                {
                    condition.Current++;
                }

                session.Send(QuestPacket.UpdateCondition(quest.Basic.Id, quest.Condition.IndexOf(condition) + 1, condition.Current));

                if (condition.Goal != condition.Current) // Quest completed
                {
                    return;
                }
                quest.Completed         = true;
                quest.CompleteTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();

                session.Player.Levels.GainExp(quest.Reward.Exp);
                session.Player.Wallet.Meso.Modify(quest.Reward.Money);
                session.Send(QuestPacket.CompleteQuest(quest.Basic.Id, false));
                return;
            }
        }
    public Quest CreateQuest()
    {
        // Create empty quest for make QuestRequire
        List <Quest> questRequire;

        if (questRequireID.Length > 0)
        {
            questRequire = new List <Quest>();
            foreach (int questID in questRequireID)
            {
                questRequire.Add(new Quest(questID));
            }
        }
        else     // no quest require
        {
            questRequire = null;
        }
        // Create QuestCondition from questConditionData
        QuestCondition qcon = new QuestCondition(questConditionData.conditionType, questConditionData.targetID, questConditionData.amount);
        // Create Conversations[]
        List <Conversation> cons = new List <Conversation>();

        foreach (ConversationData conData in conversations)
        {
            Conversation con = conData.voices.Length > 0 ? // have voice ? by checking length
                               new Conversation(conData.dialogues, conData.voices):
                               new Conversation(conData.dialogues);
            if (conData.isFadeAfterDone)
            {
                con.fade = true;
            }
            cons.Add(con);
        }
        // Create Quest
        Quest quest;

        if (qcon.type == 1)
        {
            quest = new Quest(questID, questTitle, questDetail, questPlaceDetail, questRequire == null ? null : questRequire.ToArray(), qcon, npcOwnerID, cons.ToArray(), qcon.getTarget());
        }
        else
        {
            quest = new Quest(questID, questTitle, questDetail, questPlaceDetail, questRequire == null ? null : questRequire.ToArray(), qcon, npcOwnerID, cons.ToArray());
        }
        // if have questContinue, add to quest
        if (!QuestData.ReferenceEquals(questContinue, null))
        {
            quest.questContinue = questContinue.CreateQuest();
        }
        // if have EXP Reward add to quest reward
        if (EXP > 0)
        {
            quest.rewardEXP = EXP;
        }
        return(quest);
    }
Exemplo n.º 6
0
 public void Reset()
 {
     NowQuestProgressState = QuestProgressState.QUEST_PROGRESS_NOTHING;
     Info                  = new QuestInfo();
     Condition             = new QuestCondition();
     Preparation           = new QuestPreparation();
     Talk                  = new QuestTalk();
     Achievement           = new QuestAchievement();
     dicQuestTalks.Clear();
 }
Exemplo n.º 7
0
 public QuestObjective()
 {
     this.Name                = string.Empty;
     this.DisplayName         = string.Empty;
     this.RequiredItemType    = string.Empty;
     this.RequiredSkillType   = string.Empty;
     this.RequiredSpellType   = string.Empty;
     this.RequiredKilledTypes = new List <string>();
     this.MiscData            = string.Empty;
     this.IsComplete          = (p) => { return(Requirement <= Count); };
 }
Exemplo n.º 8
0
        private static void AssignTo(this QuestItemRequirement itemRequirement, QuestCondition condition, RemotePlayer player)
        {
            condition.Type          = ConditionType.Item;
            condition.RequiredCount = (uint)itemRequirement.MinimumNumber;
            condition.CurrentCount  = (uint)player.Inventory.Items.Count(item => item.Definition == itemRequirement.Item);
            condition.RequirementId = itemRequirement.Item.GetItemType();
            var temporaryItem = new TemporaryItem();

            temporaryItem.Definition = itemRequirement.Item;
            temporaryItem.Durability = temporaryItem.GetMaximumDurabilityOfOnePiece();
            player.ItemSerializer.SerializeItem(condition.RequiredItemData, temporaryItem);
        }
Exemplo n.º 9
0
        private static void AssignTo(this QuestItemRequirement itemRequirement, QuestCondition condition, RemotePlayer player)
        {
            condition.Type          = ConditionType.Item;
            condition.RequiredCount = (uint)itemRequirement.MinimumNumber;
            condition.CurrentCount  = (uint)player.Inventory.Items.Count(item => item.Definition == itemRequirement.Item);
            condition.RequirementId = itemRequirement.Item.GetItemType();

            // The requirement does not contain an item, but only the ItemDefinition.
            // We could create and serialize a temporary item and copy just a part of the result.
            // However, we can also keep it simple and just set the last 5 socket bytes to 0xFF (No Socket).
            condition.RequiredItemData.Slice(condition.RequiredItemData.Length - 5).Fill(0xFF);
        }
Exemplo n.º 10
0
    public QuestCondition Clone()
    {
        QuestCondition tempCondition = new QuestCondition();

        tempCondition.Condition        = this.Condition;
        tempCondition.Type             = this.Type;
        tempCondition.CurrentProgress  = this.CurrentProgress;
        tempCondition.TargetProgress   = this.TargetProgress;
        tempCondition.ExtraDescription = this.ExtraDescription;

        return(tempCondition);
    }
Exemplo n.º 11
0
 protected void fillInitialProgress(Quest quest, JSONNode initialHunt)
 {
     for (int i = 0; i < quest.Conditions.Count; i++)
     {
         QuestCondition cond = quest.Conditions[i];
         if (initialHunt["hunt"][cond.Type] != null)
         {
             cond.CurrentProgress = initialHunt["hunt"][cond.Type][quest.Key].AsInt;
         }
         else if (initialHunt["ok"][cond.Type] != null)
         {
             cond.CurrentProgress = initialHunt["ok"][cond.Type][quest.Key].AsInt;
         }
     }
 }
Exemplo n.º 12
0
    public void UpdateProgress(string type, int value)
    {
        bool updatedAnything = false;

        for (int i = 0; i < QuestsInProgress.Count; i++)
        {
            QuestCondition cond = GetQuestCondition(QuestsInProgress[i], type);
            if (cond != null)
            {
                cond.CurrentProgress += value;
                updatedAnything       = true;
                Game.Instance.CurrentScene.UpdateQuestProgress(QuestsInProgress[i].Key);

                switch (cond.Condition)
                {
                case "loot":
                {
                    if (QuestsInProgress[i].WasNowCompleted)
                    {
                        InGameMainMenuUI.Instance.ShockMessageCenter.CallMessage(QuestsInProgress[i].Name + " Completed!", Color.black, false);
                    }
                    // if the quest condition wasn't completed already or if it was and now it isn't
                    else if (cond.CurrentProgress - value < cond.TargetProgress || cond.CurrentProgress < cond.TargetProgress)
                    {
                        InGameMainMenuUI.Instance.ShockMessageCenter.CallMessage(Content.Instance.GetItem(type).Name + " " + cond.CurrentProgress + " / " + cond.TargetProgress, Color.black, false);
                    }

                    break;
                }

                case "hunt":
                {
                    UpdateQuestProgress(QuestsInProgress[i].Key, cond.Type, cond.CurrentProgress);
                    break;
                }
                }
            }
        }
        if (updatedAnything)
        {
            // refresh only if anything has been updated
            InGameMainMenuUI.Instance.RefreshQuestProgress();
            InGameMainMenuUI.Instance.RefreshCompletedQuestProgress();
        }
    }
Exemplo n.º 13
0
        public static void UpdateQuest(GameSession session, string code, string type)
        {
            List <QuestStatus> questList = session.Player.QuestList;

            foreach (QuestStatus quest in questList.Where(x => x.Condition != null))
            {
                QuestCondition condition = quest.Condition.Where(x => x.Type == type).FirstOrDefault(x => x.Codes != null && x.Codes.Length != 0 && x.Codes.Contains(code));
                if (condition == null)
                {
                    continue;
                }

                if (condition.Goal == condition.Current)
                {
                    return;
                }
                condition.Current++;
                session.Send(QuestPacket.UpdateCondition(quest.Basic.Id, quest.Condition.IndexOf(condition) + 1, condition.Current));
                return;
            }
        }
        private QuestCondition CheckForQuestInteraction()
        {
            if (Type == InteractableType.Harvest)
            {
                return(null);
            }

            var x           = GetObject.PlayerSave.QuestLog.ActiveObjectives;
            var active      = x.SelectMany(y => y.ActiveConditions).Where(c => !c.IsDone).ToList();
            var iConditions = active.Select(a => a as InteractCondition).Where(c => c != null);;
            var dConditions = active.Select(a => a as DeliverCondition).Where(c => c != null);;

            QuestCondition foundCondition = iConditions.FirstOrDefault(i => i.InteractableID == ObjectID);

            if (foundCondition == null)
            {
                foundCondition = dConditions.FirstOrDefault(i => i.InteractableToDeliverToID == ObjectID);
            }

            return(foundCondition);
        }
Exemplo n.º 15
0
        private static void CheckForExplorationQuest(GameSession session, MapInteractActor actor)
        {
            List <QuestStatus> questList = session.Player.QuestList;

            foreach (QuestStatus quest in questList.Where(x => x.Basic.Id >= 72000000 && x.Condition != null))
            {
                QuestCondition condition = quest.Condition.Where(x => x.Type == "interact_object_rep").FirstOrDefault(x => x.Codes.Length != 0 && x.Codes.Contains(actor.InteractId.ToString()));
                if (condition == null)
                {
                    continue;
                }

                quest.Completed         = true;
                quest.CompleteTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();

                session.Player.Levels.GainExp(quest.Reward.Exp);
                session.Player.Wallet.Meso.Modify(quest.Reward.Money);
                session.Send(QuestPacket.CompleteExplorationGoal(quest.Basic.Id));
                session.Send(QuestPacket.CompleteQuest(quest.Basic.Id));
                break;
            }
        }
Exemplo n.º 16
0
        private void LoadQuestCondition(QuestCondition questCond, TreeNode e)
        {
            e.Nodes.Add("Id: " + questCond.Id);
            e.Nodes.Add("Type: " + questCond.Type);
            e.Nodes.Add("Matches: " + string.Join(", ", questCond.Matches));
            e.Nodes.Add("Mandatory: " + questCond.Mandatory);
            e.Nodes.Add("TargetValue: " + questCond.TargetValue);
            var state = e.Nodes.Add("State");

            state.Nodes.Add("Active: " + questCond.State.Active);
            state.Nodes.Add("Completed: " + questCond.State.Completed);
            state.Nodes.Add("CurrentValue: " + questCond.State.CurrentValue);
            var sub = e.Nodes.Add("SubConditions");
            var i   = 0;

            foreach (var subCond in questCond.SubConditions)
            {
                var c = sub.Nodes.Add("[" + i + "]");
                LoadQuestCondition(subCond, c);
                i++;
            }
        }
Exemplo n.º 17
0
 public void NotifyEventProceed()
 {
     if( kind == Kind.DialogEvent ) {
         Debug.Log ("[EventEntity] event:"+id +" | event complete!");
         if(isEndEvent) {
             kind = Kind.QuestClear;
         } else {
             condition = null;
             isCompleted  = true;
         }
     }
     else if( kind == Kind.Terop ) {
         Debug.Log ("[EventEntity] event:"+id +" | event complete!");
         condition = null;
         isCompleted  = true;
     }
     else if( kind == Kind.QuestClear ) {
         Debug.Log ("[EventEntity] event:"+id +" | event complete!");
         condition = null;
         isCompleted  = true;
     }
 }
Exemplo n.º 18
0
    public void UpdateQuestProgress(string questKey, string typeKey, int Value)
    {
        Quest          tempQuest = GetQuest(questKey);
        QuestCondition condition = GetQuestCondition(tempQuest, typeKey);

        condition.CurrentProgress = Value;


        if (tempQuest.WasNowCompleted)
        {
            InGameMainMenuUI.Instance.ShockMessageCenter.CallMessage(tempQuest.Name + " Completed!", Color.black, false);
            return;
        }

        if (condition.Condition == "hunt")
        {
            InGameMainMenuUI.Instance.ShockMessageCenter.CallMessage(Content.Instance.GetMonster(typeKey).MonsterName + " " + Value + " / " + condition.TargetProgress, Color.black, false);
        }
        else if (condition.Condition == "ok")
        {
            InGameMainMenuUI.Instance.ShockMessageCenter.CallMessage(typeKey + " " + Value + " / " + condition.TargetProgress, Color.black, false);
        }
    }
Exemplo n.º 19
0
 public void UpdateCondition(QuestCondition[] condition)
 {
     this.condition = condition;
 }
Exemplo n.º 20
0
 public void Add(QuestCondition qc)
 {
     m_conditions.Add (qc);
 }
Exemplo n.º 21
0
        static QuestRepository()
        {
            try
            {
                Quests = new List <Quest>();

                //Starting Quest
                Quests.Add(new Quest("Welcome to GTA:RPG", "Show me you've got what it takes.", false, false, 10, 500)
                           .AddCondiiton(QuestCondition.Custom("Complete the tutorial", "Tutorial", () => RPG.PlayerData.Tutorial.TutorialDoneExceptSpeak))
                           .WithCannotBeCancelled()
                           .WithOnStart(q => EventHandler.Do(o =>
                {
                    RPG.Subtitle("???: Welcome. Welcome. So you wanna make bank yeah?", 5000);
                    EventHandler.Wait(5000);
                    RPG.Subtitle("???: Alright, let's see what you've got. Complete some basic assignments and you're in.", 5000);
                    EventHandler.Wait(5000);
                    RPG.Subtitle("???: Good luck.", 5000);
                }))
                           .WithOnComplete(q => EventHandler.Do(o =>
                {
                    EventHandler.Wait(5000);
                    RPG.PlayerData.Quests.First(qu => qu.Name == "The Grind Begins").Start();
                }))
                           );
                Quests.Add(new Quest("The Grind Begins", "Complete a contract and return to Matthew.", false, false, 15, 600)
                           .AddCondiiton(QuestCondition.Custom("Contract completed", "q_Start_contract", () => RPG.PlayerData.CompletedContracts > 0))
                           .WithCannotBeCancelled()
                           .WithOnStart(q => EventHandler.Do(o =>
                {
                    RPG.Subtitle("???: I am Apex, the top of the food chain, leader of the Apexers. The one you want to impress.", 5000); EventHandler.Wait(5000);
                    RPG.Subtitle("Apex: Matthew has told me what you've done, not bad... for a rookie.", 5000); EventHandler.Wait(5000);
                    RPG.Subtitle("Apex: Access our network and purchase a contract through the actions interface.", 5000); EventHandler.Wait(5000);
                    RPG.Subtitle("Apex: Hope those words weren't to big for you, get a contract done, and then return to Matthew.", 5000); EventHandler.Wait(5000);
                    RPG.GetPopup <TutorialBox>().Pop("Contracts are an easy way to earn exp and loot outside of missions.", "Access the menu > Actions > Get Random Contract to get a new contract.");
                }))
                           );
                Quests.Add(new Quest("Potential", "Apex and co. are impressed by your abilities. Pass their test and prove you're truly good.", false, false, 25, 800)
                           .AddCondiiton(QuestCondition.Acquire("Acquire the package", "Boxed Package", 1))
                           .AddCondiiton(QuestCondition.Kill("Eliminate threats", 5, new Vector3(-302, -1136, 23), PedHash.Genstreet01AMO, PedHash.Genstreet01AMY)).WithSpawnedTargets(5)
                           .AddReward(QuestReward.Item("Bandages", 2), QuestReward.Item("Simple Protective Gear", 3))
                           );
                Quests.Add(new Quest("Trouble in the Cap", "Help John Doe get some money so he can get some snacks.", false, false, 10, 800)
                           .AddCondiiton(QuestCondition.LootAnyPed("Wallets Stolen", "Men's Wallet", "prop_ld_wallet_02", 80, 5))
                           .AddCondiiton(QuestCondition.LootAnyPed("Purses Stolen", "Woman's Purse", "prop_ld_purse_01", 80, 5))
                           .AddReward(QuestReward.Item("Bandages", 2), QuestReward.Item("Simple Protective Gear", 3))
                           .WithOnComplete(q => EventHandler.Do(o =>
                {
                    EventHandler.Wait(5000);
                    RPG.PlayerData.Quests.First(qu => qu.Name == "An Assassin's Greed").Start();
                }))
                           );
                Quests.Add(new Quest("An Assassin's Greed", "Assisinate the targets till you find the stolen phone", false, false, 15, 800)
                           .AddCondiiton(QuestCondition.Loot("Phone Recovered", "Incriminating Phone", "prop_npc_phone_02", 25, 1, PedHash.Genstreet01AMO, PedHash.Genstreet01AMY)).WithSpawnedTargets(1)
                           .AddReward(QuestReward.Item("Refurbished Kevlar", 5))
                           .WithOnComplete(q => EventHandler.Do(o =>
                {
                    RPG.Subtitle("Apex: Do you know what you have done? You've just killed one of our undercover agents inside CraftsSquad.", 5000); EventHandler.Wait(5000);
                    RPG.Subtitle("Apex: Be happy you were just following orders, John will get the real smack for this.", 5000); EventHandler.Wait(5000);
                    RPG.Subtitle("Apex: In the mean time you better sort out the armada that's converging on your position.", 5000); EventHandler.Wait(5000);
                    RPG.Subtitle("Apex: You better talk to Alicia. Look for the Sniper on your map.", 5000); EventHandler.Wait(8000);
                    RPG.Subtitle("Apex: Now.", 5000);
                }))
                           .WithAutoComplete()
                           );

                //-- John 'side-quest'
                Quests.Add(new Quest("Doe!", "Accept John's apology.", false, false, 25, 800)
                           .AddCondiiton(QuestCondition.Custom("Get to Jackson", "q_Reach_Jackson", () => Game.Player.Character.Position.DistanceTo(new Vector3(-567, -1071, 22)) < 5))
                           .AddReward(QuestReward.Item("Adv Health Kit", 5), QuestReward.Item("Adv Armor Kit", 5))
                           );

                Quests.Add(new Quest("Smash the CraftSquad", "Take out the enemies of CraftSquad", false, false, 35, 800)
                           .AddCondiiton(QuestCondition.Kill("Targets Killed", 20, PedHash.Genstreet01AMO, PedHash.Genstreet01AMY)).WithSpawnedTargets(5)
                           .AddReward(QuestReward.Item("Adv Health Kit", 1), QuestReward.Item("Adv Armor Kit", 1))
                           .WithAutoComplete()
                           .WithOnComplete(q => EventHandler.Do(o =>
                {
                    RPG.Subtitle("Apex: Woah, you actually did it.", 3000); EventHandler.Wait(5000);
                    RPG.Subtitle("Apex: Listen, good job, I'll have to think a while about this, you're suited for much bigger things.", 5000); EventHandler.Wait(5000);
                    RPG.Subtitle("Apex: We have a heist coming up, but it's not ready yet, give me some time and I'll let you know.", 5000); EventHandler.Wait(5000);
                    EventHandler.Wait(3000);
                    RPG.GetPopup <MessageToPlayer>().Show();
                }))
                           );



                //Contracts:
                Quests.Add(new Quest("Are you Chicken?", "Cluck cluck cluck, these are worse than the cows... silence them", true, true, 15, 500)
                           .AddCondiiton(QuestCondition.Kill("Chickens silenced", 5, PedHash.Hen)).WithSpawnedTargets(5)
                           .AddReward(QuestReward.Item("Bandages", 2), QuestReward.Item("Simple Protective Gear", 3))
                           .WithSpawnedTargets()
                           );
                Quests.Add(new Quest("Moooooove them", "Mooo. Moo.. MOO? Mooo? Are you kidding me? Remove these pests.", true, true, 15, 500)
                           .AddCondiiton(QuestCondition.Kill("Moos silenced", 5, PedHash.Cow)).WithSpawnedTargets(5)
                           .AddReward(QuestReward.Item("Bandages", 3))
                           .WithSpawnedTargets()
                           );

                Quests.Add(new Quest("Boar'd", "We've got some boars roaming around, sort em out will ya?", true, true, 15, 500)
                           .AddCondiiton(QuestCondition.Kill("Boars eliminated", 5, PedHash.Boar)).WithSpawnedTargets(5)
                           .AddReward(QuestReward.Item("Simple Protective Gear", 3))
                           .WithSpawnedTargets()
                           );

                Quests.Add(new Quest("Makin' Bank", "Time to fill those pockets. Pick your targets yourself... Just get their cash!", true, true, 25, 1000)
                           .AddCondiiton(QuestCondition.LootAnyPed("Money bags acquired", "Sweet Green", "prop_money_bag_01", 70, 5))
                           );

                Quests.Add(new Quest("Nacho' Cheese", "I just had a crate of promising goods stolen. Get them back for me will ya?", true, true, 50, 750)
                           .AddCondiiton(QuestCondition.Loot("Crate found", "'Promising Goods'", "prop_mil_crate_01", 20, 1, PedHash.StrPunk01GMY)).WithSpawnedTargets(1)
                           .AddReward(QuestReward.Item("Ammo Pack II", 2))
                           .WithSpawnedTargets()
                           );
                Quests.Add(new Quest("Guitar Hero", "No need to fret. One of my ventures is in need of some shredding machines. Get them for me.", true, true, 50, 750)
                           .AddCondiiton(QuestCondition.Loot("Guitars Acquired", "Shredding Machine", "prop_el_guitar_01", 80, 5, PedHash.Paparazzi, PedHash.MovieStar, PedHash.PoloGoon01GMY)).WithSpawnedTargets(5)
                           .AddReward(QuestReward.Item("Refurbished Kevlar", 5))
                           .WithSpawnedTargets()
                           );

                Quests.Add(new Quest("Grandrune", "Buddy of mine starting playing a new game, he's a roleplayer you know? Get some cowhides for him.", true, true, 15, 650)
                           .AddCondiiton(QuestCondition.Loot("Cowhides @ 130gp ea", "Cowhide", "prop_paper_box_01", 100, 5, PedHash.Cow)).WithSpawnedTargets(5)
                           .WithSpawnedTargets()
                           );
                Quests.Add(new Quest("Theftscape", "Buddy of mine starting playing a new game, he's a roleplayer you know? Get some feathers for him.", true, true, 15, 650)
                           .AddCondiiton(QuestCondition.Loot("Feathers collected", "Feather", "prop_cs_cardbox_01", 100, 50, PedHash.Hen)).WithSpawnedTargets(5)
                           .WithSpawnedTargets(10)
                           );

                Quests.Add(new Quest("Fed up", "Let's make some noise! Grab some radios, because why not? Then get me some police sirens too", true, true, 75, 1500)
                           .AddCondiiton(QuestCondition.LootAnyVehicle("Radios Salvaged", "Car Radio", "prop_mil_crate_01", 40, 3))
                           .AddCondiiton(QuestCondition.LootVehicles("Sirens stolen", "Police Sirens", "prop_mil_crate_02", 100, 1,
                                                                     VehicleHash.Police, VehicleHash.Police2, VehicleHash.Police3, VehicleHash.Police4, VehicleHash.PoliceOld1,
                                                                     VehicleHash.PoliceOld2, VehicleHash.PoliceT, VehicleHash.Policeb))
                           .AddReward(QuestReward.Item("Adv Health Kit", 2), QuestReward.Item("Adv Armor Kit", 2))
                           );

                Quests.Add(new Quest("Elimination", "You know what to do", true, true, 30, 500)
                           .AddCondiiton(QuestCondition.Kill("Kill Street Thugs", 5, PedHash.Genstreet01AMO, PedHash.Genstreet01AMY)).WithSpawnedTargets(5)
                           .AddCondiiton(QuestCondition.Kill("Kill Street Punks", 5, PedHash.StrPunk01GMY, PedHash.StrPunk01GMY)).WithSpawnedTargets(5)
                           .AddReward(QuestReward.Item("Ammo Pack I", 1), QuestReward.Item("Health Kit", 5), QuestReward.Item("Adv Health Kit", 2), QuestReward.Item("Vehicle Repair Kit", 1))
                           .WithSpawnedTargets()
                           );

                Quests.Add(new Quest("Gutter Trash", "Cleanse them. They are not as good as you.", true, true, 15, 500)
                           .AddCondiiton(QuestCondition.Kill("Street Thugs Cleansed", 5, PedHash.Genstreet01AMO, PedHash.Genstreet01AMY)).WithSpawnedTargets(5)
                           .AddReward(QuestReward.Item("Ammo Pack I", 1), QuestReward.Item("Health Kit", 5))
                           .WithSpawnedTargets()
                           );

                Quests.Add(new Quest("Punk'd", "These pests need to be killed. Why? You know better than to ask...", true, true, 15, 500)
                           .AddCondiiton(QuestCondition.Kill("Punk Eliminated", 5, PedHash.StrPunk01GMY, PedHash.StrPunk02GMY)).WithSpawnedTargets(5)
                           .AddReward(QuestReward.Item("Adv Health Kit", 2), QuestReward.Item("Vehicle Repair Kit", 1))
                           .WithSpawnedTargets()
                           );

                Quests.Add(new Quest("Rampage", "Trevor would like this one. Kill and destroy. That is all.", true, true, 25, 1000)
                           .AddCondiiton(QuestCondition.KillAny("Mindless kills", 10))
                           .AddCondiiton(QuestCondition.DestroyAnyVehicle("Vehicles Rekt", 5))
                           .AddReward(QuestReward.Item("Adv Health Kit", 2), QuestReward.Item("Vehicle Repair Kit", 1))
                           );
            }
            catch (Exception ex)
            {
                RPGLog.LogError(ex.GetType() + ": " + ex.Message + "\n" + ex.StackTrace);
            }
        }
Exemplo n.º 22
0
        private static QuestCondition ShowConditionInfo(QuestCondition condition)
        {
            var oldtype = condition.ConditionType;

            condition.ConditionType = (ConditionType)RPGMakerGUI.EnumPopup("Condition Type:", condition.ConditionType);
            if (condition.ConditionType != oldtype)
            {
                //TODO: if no longer interact node tree than delete that node tree

                switch (condition.ConditionType)
                {
                case ConditionType.Kill:
                    condition = new KillCondition();
                    break;

                case ConditionType.Item:
                    condition = new ItemCondition();
                    break;

                case ConditionType.Interact:
                    condition = new InteractCondition();
                    break;

                case ConditionType.Deliver:
                    condition = new DeliverCondition();
                    break;

                case ConditionType.Custom:
                    condition = new CustomCondition();
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            var killCondition     = condition as KillCondition;
            var itemCondition     = condition as ItemCondition;
            var interactCondition = condition as InteractCondition;
            var deliverCondition  = condition as DeliverCondition;
            var customCondition   = condition as CustomCondition;

            if (killCondition != null)
            {
                if (Rm_RPGHandler.Instance.Combat.NPCsCanFight && Rm_RPGHandler.Instance.Combat.CanAttackNPcs)
                {
                    RPGMakerGUI.Toggle("Is NPC?", ref killCondition.IsNPC);
                }
                else
                {
                    killCondition.IsNPC = false;
                }

                if (killCondition.IsNPC)
                {
                    RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to Kill:", ref killCondition.CombatantID);
                }
                else
                {
                    RPGMakerGUI.PopupID <CombatCharacter>("Enemy to Kill:", ref killCondition.CombatantID);
                }

                killCondition.NumberToKill = RPGMakerGUI.IntField("Number To Kill:", killCondition.NumberToKill);
            }

            if (itemCondition != null)
            {
                itemCondition.ItemType = (ItemConditionType)RPGMakerGUI.EnumPopup("Required Item Type:", itemCondition.ItemType);

                if (itemCondition.ItemType == ItemConditionType.CraftItem)
                {
                    RPGMakerGUI.PopupID <Item>("CraftItem To Collect:", ref itemCondition.ItemToCollectID, "ID", "Name", "Craft");
                }
                else if (itemCondition.ItemType == ItemConditionType.QuestItem)
                {
                    RPGMakerGUI.PopupID <Item>("Quest Item To Collect:", ref itemCondition.ItemToCollectID, "ID", "Name", "Quest");

                    if (Rm_RPGHandler.Instance.Combat.NPCsCanFight && Rm_RPGHandler.Instance.Combat.CanAttackNPcs)
                    {
                        RPGMakerGUI.Toggle("NPC Drops Items?", ref itemCondition.NPCDropsItem);
                    }
                    else
                    {
                        itemCondition.NPCDropsItem = false;
                    }

                    if (itemCondition.NPCDropsItem)
                    {
                        RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC that Drops Item:", ref itemCondition.CombatantIDThatDropsItem);
                    }
                    else
                    {
                        RPGMakerGUI.PopupID <CombatCharacter>("Enemy that Drops Item:", ref itemCondition.CombatantIDThatDropsItem);
                    }
                }
                else if (itemCondition.ItemType == ItemConditionType.Item)
                {
                    RPGMakerGUI.PopupID <Item>("Item To Collect:", ref itemCondition.ItemToCollectID);
                }

                itemCondition.NumberToObtain = RPGMakerGUI.IntField("Number To Obtain:", itemCondition.NumberToObtain);
            }

            if (interactCondition != null)
            {
                if (RPGMakerGUI.Toggle("Talk to NPC?", ref interactCondition.IsNpc))
                {
                    RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to talk to:", ref interactCondition.InteractableID);
                }
                else
                {
                    RPGMakerGUI.PopupID <Interactable>("Object to interact with:", ref interactCondition.InteractableID);
                }

                if (GUILayout.Button("Open Interaction Node Tree", "genericButton", GUILayout.MaxHeight(30)))
                {
                    var trees        = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees;
                    var existingTree = trees.FirstOrDefault(t => t.ID == interactCondition.InteractionNodeTreeID);
                    if (existingTree == null)
                    {
                        existingTree = NodeWindow.GetNewTree(NodeTreeType.Dialog);
                        Debug.Log("ExistingTree null? " + existingTree == null);
                        existingTree.ID = interactCondition.ID;

                        Debug.Log(existingTree.ID + ":::" + existingTree.Name);

                        var curSelectedQuest = Rme_Main.Window.CurrentPageIndex == 1 ? selectedQuestChainQuest : selectedQuest;

                        //todo: need unique name
                        existingTree.Name = curSelectedQuest.Name + "Interact";
                        trees.Add(existingTree);
                    }

                    DialogNodeWindow.ShowWindow(interactCondition.ID);
                    interactCondition.InteractionNodeTreeID = existingTree.ID;
                }
            }

            if (deliverCondition != null)
            {
                RPGMakerGUI.PopupID <Item>("Quest Item To Deliver:", ref deliverCondition.ItemToDeliverID, "ID", "Name", "Quest");
                if (RPGMakerGUI.Toggle("Deliver to NPC?", ref deliverCondition.DeliverToNPC))
                {
                    RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to deliver to:", ref deliverCondition.InteractableToDeliverToID);
                }
                else
                {
                    RPGMakerGUI.PopupID <Interactable>("Object to deliver with:", ref deliverCondition.InteractableToDeliverToID);
                }

                if (GUILayout.Button("Open Interaction On Deliver", "genericButton", GUILayout.MaxHeight(30)))
                {
                    var trees        = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees;
                    var existingTree = trees.FirstOrDefault(t => t.ID == deliverCondition.InteractionNodeTreeID);
                    if (existingTree == null)
                    {
                        existingTree    = NodeWindow.GetNewTree(NodeTreeType.Dialog);
                        existingTree.ID = deliverCondition.ID;
                        //todo: need unique name
                        var curSelectedQuest = Rme_Main.Window.CurrentPageIndex == 1 ? selectedQuestChainQuest : selectedQuest;

                        existingTree.Name = curSelectedQuest.Name + "Interact";
                        trees.Add(existingTree);
                    }

                    DialogNodeWindow.ShowWindow(deliverCondition.ID);
                    deliverCondition.InteractionNodeTreeID = existingTree.ID;
                }
            }

            if (customCondition != null)
            {
                var customVar = customCondition.CustomVariableRequirement;
                RPGMakerGUI.PopupID <Rmh_CustomVariable>("Custom Variable:", ref customVar.VariableID);
                var foundCvar = Rm_RPGHandler.Instance.DefinedVariables.Vars.FirstOrDefault(v => v.ID == customCondition.CustomVariableRequirement.VariableID);
                if (foundCvar != null)
                {
                    switch (foundCvar.VariableType)
                    {
                    case Rmh_CustomVariableType.Float:
                        customVar.FloatValue = RPGMakerGUI.FloatField("Required Value:", customVar.FloatValue);
                        break;

                    case Rmh_CustomVariableType.Int:
                        customVar.IntValue = RPGMakerGUI.IntField("Required Value:", customVar.IntValue);
                        break;

                    case Rmh_CustomVariableType.String:
                        customVar.StringValue = RPGMakerGUI.TextField("Required Value:", customVar.StringValue);
                        break;

                    case Rmh_CustomVariableType.Bool:
                        selectedVarSetterBoolResult = customVar.BoolValue ? 0 : 1;
                        selectedVarSetterBoolResult = EditorGUILayout.Popup("Required Value:",
                                                                            selectedVarSetterBoolResult,
                                                                            new[] { "True", "False" });
                        customVar.BoolValue = selectedVarSetterBoolResult == 0;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
            }

            if (condition.ConditionType != ConditionType.Custom)
            {
                RPGMakerGUI.Toggle("Use Custom Tracking Text:", ref condition.UseCustomText);
            }
            else
            {
                condition.UseCustomText = true;
            }

            if (condition.UseCustomText)
            {
                condition.CustomText          = RPGMakerGUI.TextField("Custom Incomplete Text:", condition.CustomText);
                condition.CustomCompletedText = RPGMakerGUI.TextField("Custom Completed Text:", condition.CustomCompletedText);
            }
            GUILayout.Space(5);

            return(condition);
        }
Exemplo n.º 23
0
    private void Initialize(QuestData.Param p, Quest q)
    {
        parent = q;
        id = p.id;
        step = p.step;
        isCompleted = false;
        isEndEvent = p.kind == "endevent";

        condition = QuestCondition.BuildCondition(step, p.condition);

        if( p.kind == "event" || p.kind == "endevent" ) {
            kind = Kind.DialogEvent;
        }
        if( p.kind == "terop" ) {
            kind = Kind.Terop;
        }

        if( p.dialog != null && p.dialog.Length > 0 ) {
            string[] msgs = p.dialog.Split('\n');
            messages = new List<string>();
            foreach(string m in msgs) {
                messages.Add ( string.Format(p.format,m) );
            }
        }

        if(p.gimic != null) {
            for(int i = 0; i<p.gimic.Length;++i) {
                _PutGimic(p.gimic[i], i);
            }
        }
    }
Exemplo n.º 24
0
        private static void HandleUse(GameSession session, PacketReader packet)
        {
            string           uuid  = packet.ReadMapleString();
            MapInteractActor actor = MapEntityStorage.GetInteractActors(session.Player.MapId).FirstOrDefault(x => x.Uuid == uuid);
            int numDrop            = 0;

            if (actor == null)
            {
                return;
            }
            if (actor.Type == InteractActorType.Binoculars)
            {
                List <QuestStatus> questList = session.Player.QuestList;
                foreach (QuestStatus item in questList.Where(x => x.Basic.QuestID >= 72000000 && x.Condition != null))
                {
                    QuestCondition condition = item.Condition.FirstOrDefault(x => x.Code != "" && int.Parse(x.Code) == actor.InteractId);
                    if (condition == null)
                    {
                        continue;
                    }

                    item.Completed         = true;
                    item.CompleteTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
                    session.Send(QuestPacket.CompleteExplorationGoal(item.Basic.QuestID));
                    session.Send(QuestPacket.CompleteQuest(item.Basic.QuestID));
                    break;
                }
            }
            else if (actor.Type == InteractActorType.Gathering)
            {
                RecipeMetadata    recipe         = RecipeMetadataStorage.GetRecipe(actor.RecipeId);
                long              requireMastery = int.Parse(recipe.RequireMastery);
                Enums.MasteryType type           = (Enums.MasteryType) int.Parse(recipe.MasteryType);

                session.Player.Levels.GainMasteryExp(type, 0);
                long currentMastery = session.Player.Levels.MasteryExp.FirstOrDefault(x => x.Type == type).CurrentExp;
                if (currentMastery < requireMastery)
                {
                    return;
                }

                session.Player.IncrementGatheringCount(actor.RecipeId, 0);
                int numCount = session.Player.GatheringCount[actor.RecipeId].Current;

                List <RecipeItem> items = RecipeMetadataStorage.GetResult(recipe);
                Random            rand  = new Random();
                int masteryDiffFactor   = numCount switch
                {
                    int n when n < recipe.HighPropLimitCount => MasteryFactorMetadataStorage.GetFactor(0),
                    int n when n < recipe.NormalPropLimitCount => MasteryFactorMetadataStorage.GetFactor(1),
                    int n when n < (int)(recipe.NormalPropLimitCount * 1.3) => MasteryFactorMetadataStorage.GetFactor(2),
                    _ => MasteryFactorMetadataStorage.GetFactor(3),
                };

                foreach (RecipeItem item in items)
                {
                    int prob = (int)(RarityChance[item.Rarity] * masteryDiffFactor) / 10000;
                    if (rand.Next(100) >= prob)
                    {
                        continue;
                    }
                    for (int i = 0; i < item.Amount; i++)
                    {
                        session.FieldManager.AddItem(session, new Item(item.Id));
                    }
                    numDrop += item.Amount;
                }
                if (numDrop > 0)
                {
                    session.Player.IncrementGatheringCount(actor.RecipeId, numDrop);
                    session.Player.Levels.GainMasteryExp(type, recipe.RewardMastery);
                }
            }
            session.Send(InteractActorPacket.UseObject(actor, numDrop > 0 ? 0 : 1, numDrop));
            session.Send(InteractActorPacket.Extra(actor));
        }
Exemplo n.º 25
0
 private static void AssignTo(this QuestMonsterKillRequirement killRequirement, QuestCondition condition, CharacterQuestState questState)
 {
     condition.Type          = ConditionType.MonsterKills;
     condition.RequiredCount = (uint)killRequirement.MinimumNumber;
     condition.RequirementId = (ushort)killRequirement.Monster.Number;
     condition.CurrentCount  = (uint)(questState.RequirementStates.FirstOrDefault(s => s.Requirement == killRequirement)?.KillCount ?? 0);
 }
    // Use this for initialization
    void Start()
    {
        NPCStatus ponlatatStatus  = ponlatatNPC.GetComponent <NPCStatus>();
        NPCStatus todzagunStatus  = TodZaGunNPC.GetComponent <NPCStatus>();
        NPCStatus sangahtidStatus = SangAhTidNPC.GetComponent <NPCStatus>();
        NPCStatus maleeStatus     = MaleeNPC.GetComponent <NPCStatus>();
        //Ponlatat
        QuestCondition pcond     = new QuestCondition(2, 10004, 3);                                                                                           // ฆ่า สามล้อ 3 คัน
        Conversation   q1openCon = new Conversation(new string[] { "รบกวนช่วยปราบสามล้อคลั่ง ที่อาละวาดอยู่นอกเมืองด้วยเถอะ", "ชาวเมืองเดือดร้อนกันมากเลย" }, // Dialogue
                                                    new AudioClip[] { ponlatatNPCVoice[0], ponlatatNPCVoice[1] });                                            // open Quest
        Conversation q1inproCon = new Conversation(new string[] { "หากจะออกไปนอกเมืองละก็ มันค่อนข้างไกลนะ ลองขึ้นป้ายรถเมล์หน้าวัดดูซิ" },
                                                   new AudioClip[] { ponlatatNPCVoice[2] });                                                                  // in process Quest
        Conversation q1doneCon = new Conversation(new string[] { "ขอบคุณมากเลยโยม เจริญพร" },
                                                  new AudioClip[] { ponlatatNPCVoice[3] });                                                                   // done Quest
        Quest q1 = new Quest(1, "กำจัดสามล้อนอกเมือง", "กำจัดสามล้อที่อยู่นอกเมืองจำนวน 3 คัน", "Test Place Detail", null, pcond, 100, new Conversation[3] {
            q1openCon, q1inproCon, q1doneCon
        });

        q1.rewardEXP = 50;
        ponlatatStatus.questList.Add(q1);
        //Ponlatat


        // แสงอาทิตย์
        QuestCondition scond        = new QuestCondition(1, 110, 0);                                                                                                                                                                                                // เดินไปหายักษ์ทศกัณฑ์
        Conversation   q2openCon    = new Conversation(new string[] { "ท่านช่วยข้ามแม่น้ำเจ้าพระยาที่อยู่ถัดจากที่นี่ ไปยังวัดอรุณเพื่อเจรจาบอกทศกัณฑ์ ยักษ์เขียวที่อยู่ที่นั่นให้หน่อยสิว่าตอนนี้ ข้ายังไม่พร้อมคืนเงินที่เคยติดไว้ ", "รบกวนช่วยข้าหน่อยนะ !" }); // open Quest // No sound
        Conversation   q2inproCon   = new Conversation(new string[] { "เจ้ายักษ์ทเขียวนั่นอยู่ที่วัดอรุณ ตรงข้ามแม่น้ำเจ้าะพระยาหน่ะ :3" });                                                                                                                        // in process Quest // No sound
        Conversation   q2doneCon    = new Conversation(new string[] { "อิอิ may be not use" });                                                                                                                                                                     // done Quest
        Conversation   q2recieveCon = new Conversation(new string[] { "หืม เจ้ากำลังตามหายักษ์เขียวอยู่งั้นหรือ", "ข้านี่แหละยักษ์เขียว ทศกัณฑ์" },
                                                       new AudioClip[] { TodZaGunNPCVoice[0], TodZaGunNPCVoice[1] });                                                                                                                                               // receiver Quest

        Quest q2 = new Quest(2, "การผ่อนผันหนี้ของพญาแสงอาทิตย์", "รบกวนเจ้าไปบอกผ่อนผันหนี้ของข้ากับเจ้ายักษ์ทศกัณฑ์ที่อยู่วัดแจ้งให้หน่อยสิ :3", "Test Place Detail", new Quest[1] {
            q1
        }, scond, sangahtidStatus.NPCID,
                             new Conversation[4] {
            q2openCon, q2inproCon, q2doneCon, q2recieveCon
        }, todzagunStatus.NPCID);

        sangahtidStatus.questList.Add(q2);

        /*sangahtidStatus.conversation = new Conversation[1] { new Conversation(new string[2] { "สวัสดีท่านนักเดินทาง ข้าฝากไหว้วานท่านช่วยข้าสักเรื่องทีได้ไหม",
         *  "ท่านช่วยข้ามแม่น้ำเจ้าพระยาที่อยู่ถัดจากที่นี่ ไปยังวัดอรุณเพื่อเจรจาบอกทศกัณฑ์ ยักษ์เขียวที่อยู่ที่นั่นให้หน่อยสิว่าตอนนี้ ข้ายังไม่พร้อมคืนเงินที่เคยติดไว้ รบกวนช่วยข้าหน่อยนะ !" }) };*/
        // แสงอาทิตย์ */
        // ทศกัณฑ์
        QuestCondition tcond     = new QuestCondition(3, 10001, 1);                              // ฆ่าทศกัณฑ์ (Boss id 10001) 1 ตัว
        Conversation   q3openCon = new Conversation(new string[] { "ว่าไงนะ นี่เจ้ามาผ่อนผันเรื่องหนี้แทนอย่างนั้นหรือ ตกลงนี่เจ้าเป็นพวกของยักษ์วัดโพธิ์อย่างนั้นสินะ เห็นทีข้าคงปล่อยเจ้าไปไม่ได้แล้ว" },
                                                    new AudioClip[] { TodZaGunNPCVoice[3] });    // open Quest
        Conversation q3inproCon = new Conversation(new string[] { "ต้องประลองกันสักตั้งแล้ว" }); // in process Quest
        Conversation q3doneCon  = new Conversation(new string[] { "ท่านแข็งแกร่งมากจริงๆ ท่านเป็นใครมาจากไหนหรือ", "อา…งั้นท่านก็ไม่ใช่พวกของยักษ์วัดโพธิ์สินะ ข้าต้องขออภัยจริงๆที่ไปหาเรื่องท่าน",
                                                                  "ที่จริงแล้วข้ากับพญาแสงอาทิตย์ ยักษ์ที่เฝ้าอยู่วัดโพธิ์นั้นเป็นเพื่อนรักกันมาก่อน วันหนึ่งยักษ์วัดโพธิ์ข้ามแม่น้ำเจ้าพระยามาขอยืมเงินข้า", "โดยบอกว่าจะนำเงินมาส่งข้าครบทุกจำนวน แต่วันเวลาผ่านไปข้ากลับไม่ได้เงินนั้นเสียที",
                                                                  "แต่เรื่องหนี้เป็นเรื่องของพวกข้าสองตน ดังนั้นข้าคิดว่าข้าต้องไปจัดการปัญหานี้ด้วยตนเอง เห็นทีคงปล่อยเจ้ายักษ์นั่นไปไม่ได้เสียแล้ว!" },
                                                   new AudioClip[] { TodZaGunNPCVoice[4], TodZaGunNPCVoice[5], TodZaGunNPCVoice[6], TodZaGunNPCVoice[7], TodZaGunNPCVoice[8] });// done Quest

        q3doneCon.fade = true;
        Quest q3 = new Quest(3, "การเจรจากับยักษ์วัดแจ้ง", "ข้าเองแหละ ยักษ์ทศกัณฑ์", "Test Place Detail", new Quest[1] {
            q2
        } /*null*/, tcond, todzagunStatus.NPCID, new Conversation[3] {
            q3openCon, q3inproCon, q3doneCon
        });

        todzagunStatus.questList.Add(q3);

        /*todzagunStatus.conversation = new Conversation[1] { new Conversation(new string[] { "ท่านมีธุระอะไรกับข้าหรือ",
         *  "ว่าไงนะ นี่เจ้ามาผ่อนผันเรื่องหนี้แทนอย่างนั้นหรือ ตกลงนี่เจ้าเป็นพวกของยักษ์วัดโพธิ์อย่างนั้นสินะ เห็นทีข้าคงปล่อยเจ้าไปไม่ได้แล้ว" }) };*/
        // ทศกัณฑ์ */
        // มาลี
        QuestCondition mcond     = new QuestCondition(1, 110, 0);
        Conversation   q4openCon = new Conversation(new string[] { "ขอบคุณมากเลยค่ะ ยักษ์วัดแจ้งกับยักษ์วัดโพธิ์มีพละกำลังมหาศาลมากถ้าคุณพี่ไม่ช่วย ต้นไม้ใบหญ้าบริเวณนั้นต้องราบเรียบเตียนหมดแน่ๆ",
                                                                   "โอม นะมัส ศิวายะ นี่เป็นบทสวดบูชาพระอิศวร คุณพี่ช่วยท่องบทสวดนี้เพื่ออัญเชิญให้พระอิศวร ช่วยมาห้ามปรามยักษ์ทั้งสองตนทีได้ไหม", "พระอิศวรท่านมีอำนาจมาก ท่านต้องช่วยไม่ให้บ้านเมืองเราโดนทำลายแน่นอนค่ะ ช่วยทีนะคะ" }
                                                    );                                                                                                // open Quest // No sound
        Conversation q4inproCon   = new Conversation(new string[] { "เร็วเข้า ยักษ์ทั้ง 2 ตนกำลังสู้อยู่ที่ท่าเตียน ฝั่งตรงข้ามแม่น้ำเจ้าพระยา.." }); // in process Quest // No sound
        Conversation q4doneCon    = new Conversation(new string[] { "not use malee 0" });                                                             // done Quest
        Conversation q4recieveCon = new Conversation(new string[] { "โอม นะมัส ศิวายะ", "อา… ไม่นะ นั่นพระอิศวรนี่ ได้โปรดอย่าทำอะไรข้าเลย", "ได้โปรดท่านผู้เมตตา อย่าสาปข้าให้เป็นหินเลย ข้าผิดไปแล้ว อ๊ากกกกก.." },
                                                     new AudioClip[] { null, TodZaGunNPCVoice[9], SangAhTidNPCVoice[0] });                            // receiver Quest

        q4recieveCon.fade = true;
        Quest q4 = new Quest(4, "ช่วยบ้านเมืองเราที", "มาลีไหว้วานให้เราห้ามศึกครั้งนี้ โดยที่ให้ไปค้นหาบทอัญเชิญพระศิวะผู้มีพลังในการสาปยักษ์ทั้งคู่ให้เป็นหินได้ โดยบทสวดสามารถหาได้จากมอนสเตอร์ในบริเวณใกล้เคียง เมื่อหาได้ให้ไปร่ายบทอัญเชิญกับยักษ์ จะมีออร่าเหมือนพระศิวะปรากฏขึ้นมาแล้วจะสามารถสาปยักษ์ให้เป็นหินได้"
                             , "Test Place Detail", new Quest[1] {
            q3
        }, mcond, maleeStatus.NPCID, new Conversation[4] {
            q4openCon, q4inproCon, q4doneCon, q4recieveCon
        }, todzagunStatus.NPCID);


        QuestCondition mcond2     = new QuestCondition(0, maleeStatus.NPCID, 0);          // รายงานหนูมาลี
        Conversation   q5openCon  = new Conversation(new string[] { "not use malee 1" }); // open Quest
        Conversation   q5inproCon = new Conversation(new string[] { "not use malee 2" }); // in process Quest
        Conversation   q5doneCon  = new Conversation(new string[] { "ขอบคุณคุณพี่มากๆเลยนะคะ ที่ช่วยกอบกู้บ้านเมืองของเราไว้ได้ ถึงแม้ว่าพื้นที่แห่งนั้นจะถูกทำลายจนราบเรียบเป็นหน้ากลองก็ตามที",
                                                                    "จากนี้ที่นี่คงเป็นตำนานการต่อสู้กันของยักษ์ทั้งสองวัดที่โดน สาปเป็นหินด้วยอำนาจของพระอิศวร ซึ่งชาวบ้านแถวนี้ต่างพากันเรียกสถานที่แห่งนั้นว่า ท่าเตียน ", "แต่หนูมาลีคิดว่าที่นี่จะเป็นตำนานให้คนรุ่นหลังมา ศึกษาต่อแน่นอนค่ะต่อจากนี้พวกเราจะช่วยกัน ดูแลรักษาบ้านเมืองให้น่าอยู่ขอบคุณคุณพี่มากนะคะ " },
                                                     new AudioClip[] { MaleeNPCCVoice[0], MaleeNPCCVoice[1], MaleeNPCCVoice[2] });// done Quest
        Quest q5 = new Quest(5, "กลับไปหาหนูมาลี", "ยักษ์ยุติการต่อสู้กันแล้ว ต้องรีบไปบอกหนูมาลี", "Test Place Detail", null, mcond2, maleeStatus.NPCID, new Conversation[3] {
            q5openCon, q5inproCon, q5doneCon
        });

        q4.questContinue = q5; // เพิ่มเควสต่อเนื่อง
        maleeStatus.questList.Add(q4);
        // มาลี */

        Debug.Log("Finished setting demo");
        GameObject.Find("NPC_System").BroadcastMessage("refreshUI"); // broadcast message to all child of NPC_System
    }