Exemple #1
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            #region defineNPCS
            GameNPC[] npcs = WorldMgr.GetNPCsByName(questGiverName, eRealm.Hibernia);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + questGiverName + ", creating her ...");
                }

                questGiver                 = new GameNPC();
                questGiver.Name            = questGiverName;
                questGiver.Realm           = eRealm.Hibernia;
                questGiver.CurrentRegionID = 200;

                // select * from NPCEquipment where TemplateID in (select EquipmentTemplateID from Mob where name = ?)
                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 448, 0);                         // Slot 12
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 427, 0);                             // Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 423, 0);                            // Slot 25
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 424, 0);                             // Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 425, 0);                             // Slot 28
                questGiver.Inventory = template.CloseTemplate();
                questGiver.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                questGiver.Model   = 388;
                questGiver.Size    = 51;
                questGiver.Level   = 35;
                questGiver.X       = 346768;
                questGiver.Y       = 489521;
                questGiver.Z       = 5200;
                questGiver.Heading = 2594;

                if (SAVE_INTO_DATABASE)
                {
                    questGiver.SaveIntoDatabase();
                }

                questGiver.AddToWorld();
            }
            else
            {
                questGiver = npcs[0];
            }

            npcs = WorldMgr.GetNPCsByName(questTargetName, eRealm.Hibernia);

            if (npcs.Length == 0)
            {
                questTarget      = new GameNPC();
                questTarget.Name = questTargetName;
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + questTarget.Name + ", creating him ...");
                }
                questTarget.Realm           = eRealm.Hibernia;
                questTarget.CurrentRegionID = 200;

                // select * from NPCEquipment where TemplateID in (select EquipmentTemplateID from Mob where name = ?)
                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 411, 0);                            // Slot 22
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 412, 0);                             // Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 408, 0);                            // Slot 25
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 34);                                 // Slot 26
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 409, 0);                             // Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 410, 0);                             // Slot 28
                questTarget.Inventory = template.CloseTemplate();
                questTarget.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                questTarget.Model   = 381;
                questTarget.Size    = 50;
                questTarget.Level   = 12;
                questTarget.X       = 347327;
                questTarget.Y       = 492700;
                questTarget.Z       = 5199;
                questTarget.Heading = 2468;

                if (SAVE_INTO_DATABASE)
                {
                    questTarget.SaveIntoDatabase();
                }

                questTarget.AddToWorld();
            }
            else
            {
                questTarget = npcs[0];
            }
            #endregion

            /*
             #region defineAreas
             * targetArea = WorldMgr.GetRegion(targetLocation.RegionID).AddArea(new Area.Circle("", targetLocation.X, targetLocation.Y, targetLocation.Z, 200));
             #endregion
             */

            #region defineItems
            armBone = GameServer.Database.FindObjectByKey <ItemTemplate>("BonesToBlades-armbone");
            if (armBone == null)
            {
                armBone      = new ItemTemplate();
                armBone.Name = "Arm Bone";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + armBone.Name + ", creating it ...");
                }
                armBone.Level            = 1;
                armBone.Weight           = 1;
                armBone.Model            = 497;
                armBone.Object_Type      = (int)eObjectType.GenericItem;
                armBone.Item_Type        = -1;
                armBone.Id_nb            = "BonesToBlades-armbone";
                armBone.Hand             = 0;
                armBone.Price            = 0;
                armBone.IsTradable       = false;
                armBone.Color            = 0;
                armBone.Bonus            = 0;      // default bonus
                armBone.Bonus1           = 0;
                armBone.Bonus1Type       = (int)0;
                armBone.Bonus2           = 0;
                armBone.Bonus2Type       = (int)0;
                armBone.Bonus3           = 0;
                armBone.Bonus3Type       = (int)0;
                armBone.Bonus4           = 0;
                armBone.Bonus4Type       = (int)0;
                armBone.Bonus5           = 0;
                armBone.Bonus5Type       = (int)0;
                armBone.Bonus6           = 0;
                armBone.Bonus6Type       = (int)0;
                armBone.Bonus7           = 0;
                armBone.Bonus7Type       = (int)0;
                armBone.Bonus8           = 0;
                armBone.Bonus8Type       = (int)0;
                armBone.Bonus9           = 0;
                armBone.Bonus9Type       = (int)0;
                armBone.Bonus10          = 0;
                armBone.Bonus10Type      = (int)0;
                armBone.ExtraBonus       = 0;
                armBone.ExtraBonusType   = (int)0;
                armBone.Effect           = 0;
                armBone.Emblem           = 0;
                armBone.Charges          = 0;
                armBone.MaxCharges       = 0;
                armBone.SpellID          = 0;
                armBone.ProcSpellID      = 0;
                armBone.Type_Damage      = 0;
                armBone.Realm            = 0;
                armBone.MaxCount         = 1;
                armBone.PackSize         = 1;
                armBone.Extension        = 0;
                armBone.Quality          = 100;
                armBone.Condition        = 100;
                armBone.MaxCondition     = 100;
                armBone.Durability       = 100;
                armBone.MaxDurability    = 100;
                armBone.PoisonCharges    = 0;
                armBone.PoisonMaxCharges = 0;
                armBone.PoisonSpellID    = 0;
                armBone.ProcSpellID1     = 0;
                armBone.SpellID1         = 0;
                armBone.MaxCharges1      = 0;
                armBone.Charges1         = 0;

                //You don't have to store the created item in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(armBone);
                }
            }

            carvedBoneHilt = GameServer.Database.FindObjectByKey <ItemTemplate>("BonesToBlades-carvedBoneHilts");
            if (carvedBoneHilt == null)
            {
                carvedBoneHilt      = new ItemTemplate();
                carvedBoneHilt.Name = "Two Carved Bone Hilts";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + carvedBoneHilt.Name + ", creating it ...");
                }
                carvedBoneHilt.Level            = 1;
                carvedBoneHilt.Weight           = 1;
                carvedBoneHilt.Model            = 497;
                carvedBoneHilt.Object_Type      = (int)eObjectType.GenericItem;
                carvedBoneHilt.Item_Type        = -1;
                carvedBoneHilt.Id_nb            = "BonesToBlades-carvedBoneHilts";
                carvedBoneHilt.Hand             = 0;
                carvedBoneHilt.Price            = 0;
                carvedBoneHilt.IsTradable       = false;
                carvedBoneHilt.Color            = 0;
                carvedBoneHilt.Bonus            = 0;      // default bonus
                carvedBoneHilt.Bonus1           = 0;
                carvedBoneHilt.Bonus1Type       = (int)0;
                carvedBoneHilt.Bonus2           = 0;
                carvedBoneHilt.Bonus2Type       = (int)0;
                carvedBoneHilt.Bonus3           = 0;
                carvedBoneHilt.Bonus3Type       = (int)0;
                carvedBoneHilt.Bonus4           = 0;
                carvedBoneHilt.Bonus4Type       = (int)0;
                carvedBoneHilt.Bonus5           = 0;
                carvedBoneHilt.Bonus5Type       = (int)0;
                carvedBoneHilt.Bonus6           = 0;
                carvedBoneHilt.Bonus6Type       = (int)0;
                carvedBoneHilt.Bonus7           = 0;
                carvedBoneHilt.Bonus7Type       = (int)0;
                carvedBoneHilt.Bonus8           = 0;
                carvedBoneHilt.Bonus8Type       = (int)0;
                carvedBoneHilt.Bonus9           = 0;
                carvedBoneHilt.Bonus9Type       = (int)0;
                carvedBoneHilt.Bonus10          = 0;
                carvedBoneHilt.Bonus10Type      = (int)0;
                carvedBoneHilt.ExtraBonus       = 0;
                carvedBoneHilt.ExtraBonusType   = (int)0;
                carvedBoneHilt.Effect           = 0;
                carvedBoneHilt.Emblem           = 0;
                carvedBoneHilt.Charges          = 0;
                carvedBoneHilt.MaxCharges       = 0;
                carvedBoneHilt.SpellID          = 0;
                carvedBoneHilt.ProcSpellID      = 0;
                carvedBoneHilt.Type_Damage      = 0;
                carvedBoneHilt.Realm            = 0;
                carvedBoneHilt.MaxCount         = 1;
                carvedBoneHilt.PackSize         = 1;
                carvedBoneHilt.Extension        = 0;
                carvedBoneHilt.Quality          = 100;
                carvedBoneHilt.Condition        = 100;
                carvedBoneHilt.MaxCondition     = 100;
                carvedBoneHilt.Durability       = 100;
                carvedBoneHilt.MaxDurability    = 100;
                carvedBoneHilt.PoisonCharges    = 0;
                carvedBoneHilt.PoisonMaxCharges = 0;
                carvedBoneHilt.PoisonSpellID    = 0;
                carvedBoneHilt.ProcSpellID1     = 0;
                carvedBoneHilt.SpellID1         = 0;
                carvedBoneHilt.MaxCharges1      = 0;
                carvedBoneHilt.Charges1         = 0;

                //You don't have to store the created item in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(carvedBoneHilt);
                }
            }
            #endregion

            #region defineBehaviours
            QuestBuilder   builder   = QuestMgr.getBuilder(typeof(BonesToBlades));
            QuestBehaviour a         = null;
            string         message1  = "Oh, have you been standing there long, <Class>? If you have, I apologize for ignoring you. I find my mind is quite distracted these days after the meeting I had yesterday with a [new client].";
            string         message2  = "Ah, I would love to tell you the name of the client, but I promised to keep their identity a secret. I keep the identity of all my clients secret because I don't want the other merchants in this area to try to steal them away from me! See, there I go again, getting distracted when I should be thinking about [those blades].";
            string         message3  = "Day in and day out I sell these plain, everyday blades. But from time to time clients do approach me to commission special blades to be made. My newest client came to me and requested that I make a set of matched falcatas to be given as [a gift] to this client's daughter upon her next birthday.";
            string         message4  = "The daughter is a highly skilled blademaster who is preparing to venture into the Frontiers. My client wants the daughter to be as well armed as possible and I seemed to have developed a reputation as a maker of some of the best custom blades out there. I hope I can [live up to] that reputation.";
            string         message5  = "I fear I have agreed to make these falcatas before I checked to see if I have all the supplies I need. It turns out I'm missing a few things, and I need to have the blades done within a few days. Making the blades alone will take me all that time without having to gather the materials for [the hilt] of each blade.";
            string         message6  = "My client has asked that the hilts of these falcatas be carved from bone. I would be happy to do that, but I don't have the bones I need. I need to get them and send them over to Jahan so he can carve them for me. Say, if you're not busy, perhaps [you can go] get the bones I need. I can pay you for your time.";
            string         message7  = "I cannot thank you enough for agreeing to help me. I've found that when people ask for carved bone hilts that the best bones come from the skeletal pawns and minions that roam the lands [just outside] of Mag Mell.";
            string         message8  = "You'll find the skeletal pawns and minions across the road on the hill northwest of here. I've also seen them in the field and by the standing stone in the woods east-southeast of Rumdor the Stable Master here in Mag Mell. Get two arm bones from either the pawns or the minions. When you have them, take them to Jahan here in Mag Mell. He will carve them for me. Good luck, <Class>!";
            string         message9  = "Ah, you must be the young <Class> that Wony told me about. She said you would have two arm bones that needed carving for hilts. Wony thinks it will take me a few days to get those bones carved but I have [a surprise] for her.";
            string         message10 = "I already had some bones among my supplies. I went ahead and carved them while you were out obtaining more bones. I'll give you the carved ones and I'll take the ones you have so I can keep my supplies well stocked. Why don't you hand me those two arm bones now?";
            string         message11 = "There you go, <Class>. Take those two carved bones to Wony right now. It will put her mind at ease having those hilts already taken care of. Don't worry about payment for my work; Wony has taken care of that already.";
            string         message12 = "<Class>, what are you doing back here already? I told you to take the arm bones to Jahan so he can carve them! You should have listened to me! Now what am I going to do?";
            string         message13 = "What is this? These hilts are already carved! Jahan played a trick on me, didn't he? He already had these done. I guess the arm bones I had you collect will get used the next time I need bone hilts. I am sorry for yelling at you when I should have been offering you [the payment] I promised you.";
            string         message14 = "There we go, <Class>. Thank you so much for helping me get these bone hilts. I shall be able to get the matching falcatas done on time and keep my new client. Perhaps one day you will have enough platinum to hire me to make custom blades for you. Until then, be well!";

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Interact, null, questGiver);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver);
            a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5);
            a.AddAction(eActionType.Talk, message1, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Whisper, "new client", questGiver);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver);
            a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5);
            a.AddAction(eActionType.Talk, message2, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Whisper, "those blades", questGiver);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver);
            a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5);
            a.AddAction(eActionType.Talk, message3, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Whisper, "a gift", questGiver);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver);
            a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5);
            a.AddAction(eActionType.Talk, message4, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Whisper, "live up to", questGiver);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver);
            a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5);
            a.AddAction(eActionType.Talk, message5, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Whisper, "the hilt", questGiver);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver);
            a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5);
            a.AddAction(new MessageAction(questGiver, questGiverName + " blushes a deep red.", eTextType.Emote));
            a.AddAction(eActionType.Talk, message6, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Whisper, "you can go", questGiver);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver);
            a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5);
            a.AddAction(eActionType.OfferQuest, typeof(BonesToBlades), "Do you want to help Wony?");
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, 1);
            a.AddTrigger(eTriggerType.AcceptQuest, null, typeof(BonesToBlades));
            a.AddAction(eActionType.Talk, message7, questGiver);
            a.AddAction(eActionType.GiveQuest, typeof(BonesToBlades), questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Whisper, "just outside", questGiver);
            a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 1, eComparator.Equal);
            a.AddAction(eActionType.Talk, message8, questGiver);
            AddBehaviour(a);

            //a = builder.CreateBehaviour(questGiver, -1);
            //a.AddTrigger(eTriggerType.EnemyKilled, "skeletal pawn", null);
            //a.AddTrigger(eTriggerType.EnemyKilled, "skeletal minion", null);
            //a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 0, eComparator.Greater);
            //a.AddRequirement(eRequirementType.InventoryItem, armBone, 2, eComparator.Less);
            //a.AddAction(eActionType.GiveItem, armBone, null);
            //AddBehaviour(a);

            //a = builder.CreateBehaviour(questGiver, -1);
            //a.AddTrigger(eTriggerType.EnemyKilled, mobTypes[0], null);
            //a.AddTrigger(eTriggerType.EnemyKilled, mobTypes[1], null);
            //a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 1, eComparator.Equal);
            //a.AddRequirement(eRequirementType.InventoryItem, armBone, 1, eComparator.Greater);
            //a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 2);
            //AddBehaviour(a);

            a = builder.CreateBehaviour(questTarget, -1);
            a.AddTrigger(eTriggerType.Interact, null, questTarget);
            a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 2, eComparator.Equal);
            a.AddAction(eActionType.Talk, message9, questTarget);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questTarget, -1);
            a.AddTrigger(eTriggerType.Whisper, "a surprise", questTarget);
            a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 2, eComparator.Equal);
            a.AddAction(eActionType.Talk, message10, questTarget);
            a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 3);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questTarget, -1);
            a.AddTrigger(eTriggerType.GiveItem, questTarget, armBone);
            a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 4, eComparator.Equal);
            a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 5);
            a.AddAction(eActionType.TakeItem, armBone, null);
            a.AddAction(eActionType.GiveItem, carvedBoneHilt, null);
            a.AddAction(eActionType.Talk, message11, questTarget);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questTarget, -1);
            a.AddTrigger(eTriggerType.GiveItem, questTarget, armBone);
            a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 3, eComparator.Equal);
            a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 4);
            a.AddAction(eActionType.TakeItem, armBone, null);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Interact, null, questGiver);
            a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 5, eComparator.Equal);
            a.AddAction(eActionType.Talk, message12, questGiver);
            a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 6);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.GiveItem, questGiver, carvedBoneHilt);
            a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 6, eComparator.Equal);
            a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 7);
            a.AddAction(eActionType.TakeItem, carvedBoneHilt, null);
            a.AddAction(eActionType.Talk, message13, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Whisper, "the payment", questGiver);
            a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 7, eComparator.Equal);
            a.AddAction(eActionType.Talk, message14, questGiver);
            a.AddAction(eActionType.GiveXP, 20, null);
            a.AddAction(eActionType.GiveGold, 37, null);
            a.AddAction(eActionType.FinishQuest, typeof(BonesToBlades), null);
            AddBehaviour(a);
            #endregion

            questGiver.AddQuestToGive(typeof(BonesToBlades));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Exemple #2
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            #region defineNPCS
            GameNPC[] npcs = WorldMgr.GetNPCsByName(questGiverName, eRealm.Albion);

            if (npcs.Length == 0)
            {
                questGiver       = new GameNPC();
                questGiver.Model = 1960;
                questGiver.Name  = questGiverName;
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + questGiver.Name + ", creating him ...");
                }
                questGiver.Realm           = eRealm.Albion;
                questGiver.CurrentRegionID = 27;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 691, 0);                            //Slot 22
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 692, 0);                             //Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 688, 0);                            //Slot 25
                template.AddNPCEquipment(eInventorySlot.Cloak, 676, 0);                                 //Slot 26
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 689, 0);                             //Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 690, 0);                             //Slot 28
                questGiver.Inventory = template.CloseTemplate();
                questGiver.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                questGiver.Size    = 55;
                questGiver.Level   = 70;
                questGiver.X       = 95510;
                questGiver.Y       = 101313;
                questGiver.Z       = 5340;
                questGiver.Heading = 3060;

                if (SAVE_INTO_DATABASE)
                {
                    questGiver.SaveIntoDatabase();
                }

                questGiver.AddToWorld();
            }
            else
            {
                questGiver = npcs[0];
            }

            npcs = WorldMgr.GetNPCsByName(questTargetName, eRealm.Albion);

            if (npcs.Length == 0)
            {
                questTarget       = new GameNPC();
                questTarget.Model = 73;
                questTarget.Name  = questTargetName;
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + questTarget.Name + ", creating him ...");
                }
                questTarget.Realm           = eRealm.Albion;
                questTarget.CurrentRegionID = 27;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 665, 0);                            //Slot 22
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 666, 0);                             //Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 662, 0);                            //Slot 25
                template.AddNPCEquipment(eInventorySlot.Cloak, 676, 0);                                 //Slot 26
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 663, 0);                             //Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 664, 0);                             //Slot 28
                questTarget.Inventory = template.CloseTemplate();
                questTarget.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                questTarget.Size    = 50;
                questTarget.Level   = 38;
                questTarget.X       = 94789;
                questTarget.Y       = 101439;
                questTarget.Z       = 5248;
                questTarget.Heading = 2878;

                if (SAVE_INTO_DATABASE)
                {
                    questTarget.SaveIntoDatabase();
                }

                questTarget.AddToWorld();
            }
            else
            {
                questTarget = npcs[0];
            }
            #endregion

            #region defineAreas
            targetArea = WorldMgr.GetRegion(targetLocation.RegionID).AddArea(new Area.Circle("", targetLocation.X, targetLocation.Y, targetLocation.Z, 200));
            #endregion

            #region defineBehaviours
            QuestBuilder   builder  = QuestMgr.getBuilder(typeof(MovementAndInteraction));
            QuestBehaviour a        = null;
            string         message1 = "Welcome to " + zoneName + ", <Class>. Here you will learn the basic skills needed to defend yourself as you explore our realm and grow in power and wisdom. Now, without further delay, let's get you started on your [training].";
            string         message2 = "If you exit through the doors behind me, you will enter the courtyard. In the courtyard, you will find Master Gethin, who will be your training instructor. Go now and speak to Master Gethin.";

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Interact, null, questGiver);
            a.AddRequirement(eRequirementType.QuestPending, typeof(MovementAndInteraction), null, (eComparator)5);
            a.AddAction(eActionType.GiveQuest, typeof(MovementAndInteraction), questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Interact, null, questGiver);
            a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 1, (eComparator)3);
            a.AddAction(eActionType.Talk, message1, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Whisper, "training", questGiver);
            a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 1, (eComparator)3);
            a.AddAction(eActionType.IncQuestStep, typeof(MovementAndInteraction), null);
            a.AddAction(eActionType.Talk, message2, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Interact, null, questGiver);
            a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 2, (eComparator)3);
            a.AddAction(eActionType.Talk, message2, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.EnterArea, null, targetArea);
            a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 2, (eComparator)3);
            a.AddAction(eActionType.IncQuestStep, typeof(MovementAndInteraction), null);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questTarget, -1);
            a.AddTrigger(eTriggerType.Interact, null, questTarget);
            a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 3, (eComparator)3);
            a.AddAction(eActionType.FinishQuest, typeof(MovementAndInteraction), null);
            AddBehaviour(a);
            #endregion

            questGiver.AddQuestToGive(typeof(MovementAndInteraction));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }