Beispiel #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 ...");
            /* First thing we do in here is to search for the NPCs inside
            * the world who comes from the Albion realm. If we find a the players,
            * this means we don't have to create a new one.
            *
            * NOTE: You can do anything you want in this method, you don't have
            * to search for NPC's ... you could create a custom item, place it
            * on the ground and if a player picks it up, he will get the quest!
            * Just examples, do anything you like and feel comfortable with :)
            */

            #region defineNPCs

            dalikor = GetDalikor();

            GameNPC[] npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCVikingHyndla"), eRealm.Midgard);
            if (npcs.Length == 0)
            {
                hyndla = new GameNPC();
                hyndla.Model = 9;
                hyndla.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCVikingHyndla");
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + hyndla.Name + ", creating ...");
                hyndla.GuildName = "Part of " + questTitle + " Quest";
                hyndla.Realm = eRealm.Midgard;
                hyndla.CurrentRegionID = 100;

                hyndla.Size = 50;
                hyndla.Level = 40;
                hyndla.X = GameLocation.ConvertLocalXToGlobalX(53049, 100);
                hyndla.Y = GameLocation.ConvertLocalYToGlobalY(58068, 100);
                hyndla.Z = 4985;
                hyndla.Heading = 150;

                //You don't have to store the created mob 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)
                    hyndla.SaveIntoDatabase();

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

            npcs = (GameNPC[])WorldMgr.GetObjectsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCGriffinHandlerNjiedi"), eRealm.Midgard, typeof(GameStableMaster));

            if (npcs.Length == 0)
            {
                njiedi = new GameStableMaster();
                njiedi.Model = 158;
                njiedi.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCGriffinHandlerNjiedi");
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + njiedi.Name + ", creating ...");
                njiedi.GuildName = "Stable Master";
                njiedi.Realm = eRealm.Midgard;
                njiedi.CurrentRegionID = 100;
                njiedi.Size = 51;
                njiedi.Level = 50;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 81, 10);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 82, 10);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 84);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 32);
                njiedi.Inventory = template.CloseTemplate();

                //				njiedi.AddNPCEquipment(Slot.TORSO, 81, 10, 0, 0);
                //				njiedi.AddNPCEquipment(Slot.LEGS, 82, 10, 0, 0);
                //				njiedi.AddNPCEquipment(Slot.FEET, 84, 10, 0, 0);
                //				njiedi.AddNPCEquipment(Slot.CLOAK, 57, 32, 0, 0);

                njiedi.X = GameLocation.ConvertLocalXToGlobalX(55561, 100);
                njiedi.Y = GameLocation.ConvertLocalYToGlobalY(58225, 100);
                njiedi.Z = 5005;
                njiedi.Heading = 126;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                njiedi.SetOwnBrain(brain);

                //You don't have to store the created mob 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)
                    njiedi.SaveIntoDatabase();
                njiedi.AddToWorld();
            }
            else
            {
                njiedi = npcs[0] as GameStableMaster;
            }

            //			npcs = WorldMgr.GetNPCsByName("Askefruer Trainer", eRealm.None);
            npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCAskefruerTrainer"), eRealm.None);
            if (npcs.Length == 0)
            {
                askefruerTrainer = new GameNPC();

                askefruerTrainer.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCAskefruerTrainer");
                askefruerTrainer.X = GameLocation.ConvertLocalXToGlobalX(54739, 100);
                askefruerTrainer.Y = GameLocation.ConvertLocalYToGlobalY(18264, 100);
                askefruerTrainer.Z = 5195;
                askefruerTrainer.Heading = 79;
                askefruerTrainer.Model = 678;
                //askefruerTrainer.GuildName = "Part of " + questTitle + " Quest";
                askefruerTrainer.Realm = eRealm.None;
                askefruerTrainer.CurrentRegionID = 100;
                askefruerTrainer.Size = 49;
                askefruerTrainer.Level = 3;

                // Leave at default values to be one the save side ...
                //fairyDragonflyHandler.AggroLevel = 80;
                //fairyDragonflyHandler.AggroRange = 1000;

                //You don't have to store the created mob 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)
                    askefruerTrainer.SaveIntoDatabase();

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

            #endregion defineNPCs

            #region defineItems

            trainerWhip = GameServer.Database.FindObjectByKey<ItemTemplate>("askefruer_whip");
            if (trainerWhip == null)
            {
                trainerWhip = new ItemTemplate();
                trainerWhip.Name = "Askefruer Trainer's Whip";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + trainerWhip.Name + " , creating it ...");

                trainerWhip.Weight = 15;
                trainerWhip.Model = 859;

                trainerWhip.Object_Type = (int)eObjectType.GenericItem;

                trainerWhip.Id_nb = "askefruer_whip";
                trainerWhip.IsPickable = true;
                trainerWhip.IsDropable = false;

                GameServer.Database.AddObject(trainerWhip);
            }

            // item db check
            recruitsVest = GameServer.Database.FindObjectByKey<ItemTemplate>("recruits_studded_vest_mid");
            if (recruitsVest == null)
            {
                recruitsVest = new ItemTemplate();
                recruitsVest.Name = "Recruit's Studded Vest (Mid)";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + recruitsVest.Name + ", creating it ...");
                recruitsVest.Level = 8;

                recruitsVest.Weight = 60;
                recruitsVest.Model = 81; // studded vest

                recruitsVest.DPS_AF = 12; // Armour
                recruitsVest.SPD_ABS = 19; // Absorption

                recruitsVest.Object_Type = (int)eObjectType.Studded;
                recruitsVest.Item_Type = (int)eEquipmentItems.TORSO;
                recruitsVest.Id_nb = "recruits_studded_vest_mid";
                recruitsVest.Price = Money.GetMoney(0, 0, 0, 9, 0);
                recruitsVest.IsPickable = true;
                recruitsVest.IsDropable = true;
                recruitsVest.CanDropAsLoot = false;
                recruitsVest.Color = 14; // blue leather

                recruitsVest.Bonus = 5; // default bonus

                recruitsVest.Bonus1 = 3;
                recruitsVest.Bonus1Type = (int)eStat.STR;

                recruitsVest.Bonus2 = 4;
                recruitsVest.Bonus2Type = (int)eStat.CON;

                recruitsVest.Bonus3 = 1;
                recruitsVest.Bonus3Type = (int)eResist.Body;

                recruitsVest.Quality = 100;
                recruitsVest.Condition = 1000;
                recruitsVest.MaxCondition = 1000;
                recruitsVest.Durability = 1000;
                recruitsVest.MaxDurability = 1000;

                GameServer.Database.AddObject(recruitsVest);
            }

            // item db check
            recruitsQuiltedVest = GameServer.Database.FindObjectByKey<ItemTemplate>("recruits_quilted_vest");
            if (recruitsQuiltedVest == null)
            {
                recruitsQuiltedVest = new ItemTemplate();
                recruitsQuiltedVest.Name = "Recruit's Quilted Vest";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + recruitsQuiltedVest.Name + ", creating it ...");
                recruitsQuiltedVest.Level = 8;

                recruitsQuiltedVest.Weight = 20;
                recruitsQuiltedVest.Model = 151; // studded vest

                recruitsQuiltedVest.DPS_AF = 6; // Armour
                recruitsQuiltedVest.SPD_ABS = 0; // Absorption

                recruitsQuiltedVest.Object_Type = (int)eObjectType.Cloth;
                recruitsQuiltedVest.Item_Type = (int)eEquipmentItems.TORSO;
                recruitsQuiltedVest.Id_nb = "recruits_quilted_vest";
                recruitsQuiltedVest.Price = Money.GetMoney(0, 0, 0, 9, 0);
                recruitsQuiltedVest.IsPickable = true;
                recruitsQuiltedVest.IsDropable = true;
                recruitsQuiltedVest.Color = 36;

                recruitsQuiltedVest.Bonus = 5; // default bonus

                recruitsQuiltedVest.Bonus1 = 4;
                recruitsQuiltedVest.Bonus1Type = (int)eStat.INT;

                recruitsQuiltedVest.Bonus2 = 3;
                recruitsQuiltedVest.Bonus2Type = (int)eStat.DEX;

                recruitsQuiltedVest.Quality = 100;
                recruitsQuiltedVest.Condition = 1000;
                recruitsQuiltedVest.MaxCondition = 1000;
                recruitsQuiltedVest.Durability = 1000;
                recruitsQuiltedVest.MaxDurability = 1000;

                GameServer.Database.AddObject(recruitsQuiltedVest);
            }

            #endregion defineItems

            /* Now we add some hooks to the npc we found.
			* Actually, we want to know when a player interacts with him.
			* So, we hook the right-click (interact) and the whisper method
			* of npc and set the callback method to the "TalkToXXX"
			* method. This means, the "TalkToXXX" method is called whenever
			* a player right clicks on him or when he whispers to him.
			*/
            //We want to be notified whenever a player enters the world
            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(GamePlayerEvent.GameEntered, new DOLEventHandler(PlayerEnterWorld));

            GameEventMgr.AddHandler(dalikor, GameLivingEvent.Interact, new DOLEventHandler(TalkToDalikor));
            GameEventMgr.AddHandler(dalikor, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToDalikor));

            GameEventMgr.AddHandler(njiedi, GameLivingEvent.Interact, new DOLEventHandler(TalkToNjiedi));
            GameEventMgr.AddHandler(njiedi, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToNjiedi));

            GameEventMgr.AddHandler(hyndla, GameLivingEvent.Interact, new DOLEventHandler(TalkToHyndla));
            GameEventMgr.AddHandler(hyndla, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToHyndla));

            GameEventMgr.AddHandler(askefruerTrainer, GameNPCEvent.OnAICallback, new DOLEventHandler(CheckNearAskefruerTrainer));

            /* Now we bring to dalikor the possibility to give this quest to players */
            dalikor.AddQuestToGive(typeof(StolenEggs));

            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initialized");
        }
Beispiel #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 ...");
            /* First thing we do in here is to search for the NPCs inside
            * the world who comes from the certain Realm. If we find a the players,
            * this means we don't have to create a new one.
            *
            * NOTE: You can do anything you want in this method, you don't have
            * to search for NPC's ... you could create a custom item, place it
            * on the ground and if a player picks it up, he will get the quest!
            * Just examples, do anything you like and feel comfortable with :)
            */

            #region defineNPCs

            masterFrederick = GetMasterFrederick();

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Nob the Stableboy", eRealm.Albion);
            if (npcs.Length == 0)
            {
                nob = new GameNPC();
                nob.Model = 9;
                nob.Name = "Nob the Stableboy";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + nob.Name + ", creating him ...");
                nob.GuildName = "Part of " + questTitle + " Quest";
                nob.Realm = eRealm.Albion;
                nob.CurrentRegionID = 1;

                nob.Size = 45;
                nob.Level = 4;
                nob.X = 573019;
                nob.Y = 504485;
                nob.Z = 2199;
                nob.Heading = 10;

                //You don't have to store the created mob 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)
                    nob.SaveIntoDatabase();

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

            npcs = (GameNPC[])WorldMgr.GetObjectsByName("Dragonfly Handler Colm", eRealm.Albion, typeof(GameStableMaster));
            if (npcs.Length == 0)
            {
                colm = new GameStableMaster();
                colm.Model = 78;
                colm.Name = "Dragonfly Handler Colm";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + colm.Name + ", creating ...");
                colm.GuildName = "Stable Master";
                colm.Realm = eRealm.Albion;
                colm.CurrentRegionID = 1;
                colm.Size = 51;
                colm.Level = 50;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 81, 10);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 82, 10);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 84, 10);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 32);
                colm.Inventory = template.CloseTemplate();

                //				colm.AddNPCEquipment(Slot.TORSO, 81, 10, 0, 0);
                //				colm.AddNPCEquipment(Slot.LEGS, 82, 10, 0, 0);
                //				colm.AddNPCEquipment(Slot.FEET, 84, 10, 0, 0);
                //				colm.AddNPCEquipment(Slot.CLOAK, 57, 32, 0, 0);

                colm.X = 562775;
                colm.Y = 512453;
                colm.Z = 2438;
                colm.Heading = 158;
                colm.MaxSpeedBase = 200;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                colm.SetOwnBrain(brain);

                //You don't have to store the created mob 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)
                    colm.SaveIntoDatabase();
                colm.AddToWorld();
            }
            else
            {
                colm = npcs[0] as GameStableMaster;
            }

            npcs = WorldMgr.GetNPCsByName("Haruld", eRealm.Albion);
            if (npcs.Length == 0 || !(npcs[0] is GameStableMaster))
            {
                haruld = new GameStableMaster();
                haruld.Model = 9;
                haruld.Name = "Haruld";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + haruld.Name + ", creating ...");
                haruld.GuildName = "Stable Master";
                haruld.Realm = eRealm.Albion;
                haruld.CurrentRegionID = 1;
                haruld.Size = 49;
                haruld.Level = 4;

                haruld.X = 572479;
                haruld.Y = 504410;
                haruld.Z = 2184;
                haruld.Heading = 944;
                haruld.MaxSpeedBase = 100;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                haruld.SetOwnBrain(brain);

                haruld.EquipmentTemplateID = "11701337";

                //You don't have to store the created mob 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)
                    haruld.SaveIntoDatabase();
                haruld.AddToWorld();
            }
            else
            {
                haruld = npcs[0] as GameStableMaster;
            }

            npcs = WorldMgr.GetNPCsByName("Fairy Dragonfly Handler", eRealm.None);
            if (npcs.Length == 0)
            {
                fairyDragonflyHandler = new GameNPC();
                fairyDragonflyHandler.Name = "Fairy Dragonfly Handler";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + fairyDragonflyHandler.Name + ", creating ...");
                fairyDragonflyHandler.X = 575334;
                fairyDragonflyHandler.Y = 506403;
                fairyDragonflyHandler.Z = 2331;
                fairyDragonflyHandler.Heading = 114;
                fairyDragonflyHandler.Model = 603;
                fairyDragonflyHandler.GuildName = "Part of " + questTitle + " Quest";
                fairyDragonflyHandler.Realm = eRealm.None;
                fairyDragonflyHandler.CurrentRegionID = 1;
                fairyDragonflyHandler.Size = 49;
                fairyDragonflyHandler.Level = 3;

                // Leave at default values to be one the save side ...
                //fairyDragonflyHandler.AggroLevel = 80;
                //fairyDragonflyHandler.AggroRange = 1000;

                //You don't have to store the created mob 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)
                    fairyDragonflyHandler.SaveIntoDatabase();

                fairyDragonflyHandler.AddToWorld();
            }
            else
                fairyDragonflyHandler = (GameNPC)npcs[0];

            #endregion defineNPCs

            #region defineItems

            dragonflyWhip = GameServer.Database.FindObjectByKey<ItemTemplate>("dragonfly_whip");
            if (dragonflyWhip == null)
            {
                dragonflyWhip = new ItemTemplate();
                dragonflyWhip.Name = "Dragonfly Whip";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + dragonflyWhip.Name + " , creating it ...");

                dragonflyWhip.Weight = 15;
                dragonflyWhip.Model = 859;

                dragonflyWhip.Object_Type = (int)eObjectType.GenericItem;

                dragonflyWhip.Id_nb = "dragonfly_whip";
                dragonflyWhip.IsPickable = true;
                dragonflyWhip.IsDropable = false;

                //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

                GameServer.Database.AddObject(dragonflyWhip);
            }

            // item db check
            recruitsVest = GameServer.Database.FindObjectByKey<ItemTemplate>("recruits_studded_vest");
            if (recruitsVest == null)
            {
                recruitsVest = new ItemTemplate();
                recruitsVest.Name = "Recruit's Studded Vest";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + recruitsVest.Name + ", creating it ...");
                recruitsVest.Level = 8;

                recruitsVest.Weight = 60;
                recruitsVest.Model = 81; // studded vest

                recruitsVest.DPS_AF = 12; // Armour
                recruitsVest.SPD_ABS = 19; // Absorption

                recruitsVest.Object_Type = (int)eObjectType.Studded;
                recruitsVest.Item_Type = (int)eEquipmentItems.TORSO;
                recruitsVest.Id_nb = "recruits_studded_vest";
                recruitsVest.Price = Money.GetMoney(0, 0, 0, 9, 0);
                recruitsVest.IsPickable = true;
                recruitsVest.IsDropable = true;
                recruitsVest.CanDropAsLoot = false;
                recruitsVest.Color = 9; // red leather

                recruitsVest.Bonus = 5; // default bonus

                recruitsVest.Bonus1 = 4;
                recruitsVest.Bonus1Type = (int)eStat.STR;

                recruitsVest.Bonus2 = 3;
                recruitsVest.Bonus2Type = (int)eStat.CON;

                recruitsVest.Quality = 100;
                recruitsVest.Condition = 1000;
                recruitsVest.MaxCondition = 1000;
                recruitsVest.Durability = 1000;
                recruitsVest.MaxDurability = 1000;

                //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

                GameServer.Database.AddObject(recruitsVest);
            }

            // item db check
            recruitsQuiltedVest = GameServer.Database.FindObjectByKey<ItemTemplate>("recruits_quilted_vest");
            if (recruitsQuiltedVest == null)
            {
                recruitsQuiltedVest = new ItemTemplate();
                recruitsQuiltedVest.Name = "Recruit's Quilted Vest";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + recruitsQuiltedVest.Name + ", creating it ...");
                recruitsQuiltedVest.Level = 8;

                recruitsQuiltedVest.Weight = 20;
                recruitsQuiltedVest.Model = 151; // studded vest

                recruitsQuiltedVest.DPS_AF = 6; // Armour
                recruitsQuiltedVest.SPD_ABS = 0; // Absorption

                recruitsQuiltedVest.Object_Type = (int)eObjectType.Cloth;
                recruitsQuiltedVest.Item_Type = (int)eEquipmentItems.TORSO;
                recruitsQuiltedVest.Id_nb = "recruits_quilted_vest";
                recruitsQuiltedVest.Price = Money.GetMoney(0, 0, 0, 9, 0);
                recruitsQuiltedVest.IsPickable = true;
                recruitsQuiltedVest.IsDropable = true;
                recruitsQuiltedVest.Color = 9; // red leather

                recruitsQuiltedVest.Bonus = 5; // default bonus

                recruitsQuiltedVest.Bonus1 = 4;
                recruitsQuiltedVest.Bonus1Type = (int)eStat.INT;

                recruitsQuiltedVest.Bonus2 = 3;
                recruitsQuiltedVest.Bonus2Type = (int)eStat.DEX;

                recruitsQuiltedVest.Quality = 100;
                recruitsQuiltedVest.Condition = 1000;
                recruitsQuiltedVest.MaxCondition = 1000;
                recruitsQuiltedVest.Durability = 1000;
                recruitsQuiltedVest.MaxDurability = 1000;

                //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

                GameServer.Database.AddObject(recruitsQuiltedVest);
            }

            #endregion defineItems

            /* Now we add some hooks to the npc we found.
			* Actually, we want to know when a player interacts with him.
			* So, we hook the right-click (interact) and the whisper method
			* of npc and set the callback method to the "TalkToXXX"
			* method. This means, the "TalkToXXX" method is called whenever
			* a player right clicks on him or when he whispers to him.
			*/

            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            //We want to be notified whenever a player enters the world
            GameEventMgr.AddHandler(GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));

            GameEventMgr.AddHandler(masterFrederick, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterFrederick));
            GameEventMgr.AddHandler(masterFrederick, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterFrederick));

            GameEventMgr.AddHandler(colm, GameLivingEvent.Interact, new DOLEventHandler(TalkToColm));
            GameEventMgr.AddHandler(colm, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToColm));

            GameEventMgr.AddHandler(nob, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToNob));

            GameEventMgr.AddHandler(haruld, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToHaruld));

            GameEventMgr.AddHandler(fairyDragonflyHandler, GameNPCEvent.OnAICallback, new DOLEventHandler(CheckNearFairyDragonflyHandler));

            /* Now we bring to masterFrederick the possibility to give this quest to players */
            masterFrederick.AddQuestToGive(typeof(IreFairyIre));

            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initialized");
        }
Beispiel #3
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 ...");
            /* First thing we do in here is to search for the NPCs inside
                * the world who comes from the Albion realm. If we find a the players,
                * this means we don't have to create a new one.
                *
                * NOTE: You can do anything you want in this method, you don't have
                * to search for NPC's ... you could create a custom item, place it
                * on the ground and if a player picks it up, he will get the quest!
                * Just examples, do anything you like and feel comfortable with :)
                */

            #region DefineNPCs

            dalikor = GetDalikor();

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Stor Gothi Annark", eRealm.Midgard);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Stor Gothi Annark, creating ...");
                annark = new GameNPC();
                annark.Model = 215;
                annark.Name = "Stor Gothi Annark";
                annark.GuildName = "Part of " + questTitle + " Quest";
                annark.Realm = eRealm.Midgard;
                annark.CurrentRegionID = 100;
                annark.Size = 51;
                annark.Level = 66;
                annark.X = 765357;
                annark.Y = 668790;
                annark.Z = 5759;
                annark.Heading = 7711;

                //annark.AddNPCEquipment((byte)eEquipmentItems.TORSO, 798, 0, 0, 0);
                //annark.AddNPCEquipment((byte)eEquipmentItems.RIGHT_HAND, 19, 0, 0, 0);

                annark.EquipmentTemplateID = "5100090";

                //You don't have to store the created mob 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)
                    annark.SaveIntoDatabase();
                annark.AddToWorld();
            }
            else
                annark = npcs[0];

            npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.Frontiers.NPCScryerIdora"), eRealm.Midgard);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Scryer Idora, creating ...");
                idora = new GameNPC();
                idora.Model = 227;
                idora.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.Frontiers.NPCScryerIdora");
                idora.GuildName = "Part of " + questTitle + " Quest";
                idora.Realm = eRealm.Midgard;
                idora.CurrentRegionID = 234;
                idora.Size = 52;
                idora.Level = 50;
                idora.X = 558081;
                idora.Y = 573988;
                idora.Z = 8640;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 81);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 82);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 84);
                template.AddNPCEquipment(eInventorySlot.Cloak, 91);
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 3);
                idora.Inventory = template.CloseTemplate();
                idora.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

            //				idora.AddNPCEquipment(Slot.TORSO, 81, 0, 0, 0);
            //				idora.AddNPCEquipment(Slot.LEGS, 82, 0, 0, 0);
            //				idora.AddNPCEquipment(Slot.FEET, 84, 0, 0, 0);
            //				idora.AddNPCEquipment(Slot.CLOAK, 91, 0, 0, 0);
            //				idora.AddNPCEquipment(Slot.RIGHTHAND, 3, 0, 0, 0);

                idora.Heading = 1558;
                idora.MaxSpeedBase = 200;
                idora.EquipmentTemplateID = "200292";

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 500;
                idora.SetOwnBrain(brain);

                //You don't have to store the created mob 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)
                    idora.SaveIntoDatabase();
                idora.AddToWorld();
            }
            else
                idora = npcs[0];

            Point2D point = idora.GetPointFromHeading( idora.Heading, 30 );
            locationIdora = new GameLocation(idora.CurrentZone.Description, idora.CurrentRegionID, point.X, point.Y, idora.Z);

            ticketToSvasudFaste = CreateTicketTo("Svasud Faste", "hs_mularn_svasudfaste");
            ticketToMularn = CreateTicketTo("Mularn", "hs_svasudfaste_mularn");

            npcs = (GameNPC[])WorldMgr.GetObjectsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.Frontiers.NPCGriffinHandlerNjiedi"), eRealm.Midgard, typeof(GameStableMaster));
            if (npcs.Length == 0)
            {
                njiedi = new GameStableMaster();
                njiedi.Model = 158;
                njiedi.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.Frontiers.NPCGriffinHandlerNjiedi");

                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + njiedi.Name + ", creating ...");
                njiedi.GuildName = "Stable Master";
                njiedi.Realm = eRealm.Midgard;
                njiedi.CurrentRegionID = 100;
                njiedi.Size = 51;
                njiedi.Level = 50;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 81, 10);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 82, 10);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 84, 10);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 32);
                njiedi.Inventory = template.CloseTemplate();

            //				njiedi.AddNPCEquipment(Slot.TORSO, 81, 10, 0, 0);
            //				njiedi.AddNPCEquipment(Slot.LEGS, 82, 10, 0, 0);
            //				njiedi.AddNPCEquipment(Slot.FEET, 84, 10, 0, 0);
            //				njiedi.AddNPCEquipment(Slot.CLOAK, 57, 32, 0, 0);

                njiedi.X = GameLocation.ConvertLocalXToGlobalX(55561, 100);
                njiedi.Y = GameLocation.ConvertLocalYToGlobalY(58225, 100);
                njiedi.Z = 5005;
                njiedi.Heading = 126;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                njiedi.SetOwnBrain(brain);

                //You don't have to store the created mob 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)
                    njiedi.SaveIntoDatabase();
                njiedi.AddToWorld();
            }
            else
            {
                njiedi = npcs[0] as GameStableMaster;
            }

            njiedi.TradeItems = new MerchantTradeItems(null);
            if (!njiedi.TradeItems.AddTradeItem(1, eMerchantWindowSlot.FirstEmptyInPage, ticketToSvasudFaste))
                if (log.IsWarnEnabled)
                    log.Warn("ticketToSvasudFaste not added");

            foreach (GameNPC npc in njiedi.GetNPCsInRadius(400))
            {
                if (npc.Name == LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.Frontiers.NPCGryphon"))
                {
                    griffin = npc;
                    break;
                }
            }
            if (griffin == null)
            {
                griffin = new GameNPC();
                griffin.Model = 1236; // //819;
                griffin.Name = "tamed gryphon";

                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + griffin.Name + ", creating ...");
                griffin.GuildName = "Part of " + questTitle + " Quest";
                griffin.Realm = eRealm.Midgard;
                griffin.CurrentRegionID = njiedi.CurrentRegionID;
                griffin.Size = 50;
                griffin.Level = 50;
                griffin.X = njiedi.X + 80;
                griffin.Y = njiedi.Y + 100;
                griffin.Z = njiedi.Z;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                griffin.SetOwnBrain(brain);

                griffin.Heading = 93;
                griffin.MaxSpeedBase = 400;
                //dragonfly.EquipmentTemplateID = 200276;

                //You don't have to store the created mob 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)
                {
                    griffin.SaveIntoDatabase();
                }
                griffin.AddToWorld();
            }

            npcs = (GameNPC[]) WorldMgr.GetObjectsByName("Vorgar", eRealm.Midgard, typeof (GameStableMaster));
            if (npcs.Length == 0)
            {
                vorgar = new GameStableMaster();
                vorgar.Model = 52;
                vorgar.Name = "Vorgar";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + vorgar.Name + ", creating ...");
                vorgar.GuildName = "Stable Master";
                vorgar.Realm = eRealm.Midgard;
                vorgar.CurrentRegionID = 100;
                vorgar.Size = 51;
                vorgar.Level = 50;
                vorgar.X = GameLocation.ConvertLocalXToGlobalX(10660, 100);
                vorgar.Y = GameLocation.ConvertLocalYToGlobalY(3437, 100);
                vorgar.Z = 5717;
                vorgar.Heading = 327;
                vorgar.MaxSpeedBase = 200;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                vorgar.SetOwnBrain(brain);

                //ulliam.EquipmentTemplateID = 200276;

                //You don't have to store the created mob 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)
                {
                    vorgar.SaveIntoDatabase();
                }

                vorgar.AddToWorld();
            }
            else
                vorgar = npcs[0] as GameStableMaster;

            Point2D vorgarloc = vorgar.GetPointFromHeading( vorgar.Heading, 30 );
            locationVorgar = new GameLocation(vorgar.CurrentZone.Description, vorgar.CurrentRegionID, vorgarloc.X, vorgarloc.Y, vorgar.Z);

            #endregion

            #region DefineItems

            // item db check
            noteForNjiedi = GameServer.Database.FindObjectByKey<ItemTemplate>("njiedi_note");
            if (noteForNjiedi == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Njiedi's Note, creating it ...");
                noteForNjiedi = new ItemTemplate();
                noteForNjiedi.Name = "Njiedi's Note";

                noteForNjiedi.Weight = 3;
                noteForNjiedi.Model = 498;

                noteForNjiedi.Object_Type = (int) eObjectType.GenericItem;

                noteForNjiedi.Id_nb = "njiedi_note";
                noteForNjiedi.IsPickable = true;
                noteForNjiedi.IsDropable = false;

                GameServer.Database.AddObject(noteForNjiedi);
            }

            // item db check
            askefruerPlans = GameServer.Database.FindObjectByKey<ItemTemplate>("askefruer_plans");
            if (askefruerPlans == null)
            {
                askefruerPlans = new ItemTemplate();
                askefruerPlans.Name = "Askefruer Plans";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + askefruerPlans.Name + ", creating it ...");

                askefruerPlans.Weight = 3;
                askefruerPlans.Model = 498;

                askefruerPlans.Object_Type = (int) eObjectType.GenericItem;

                askefruerPlans.Id_nb = "askefruer_plans";
                askefruerPlans.IsPickable = true;
                askefruerPlans.IsDropable = false;

                GameServer.Database.AddObject(askefruerPlans);
            }

            translatedPlans = GameServer.Database.FindObjectByKey<ItemTemplate>("translated_askefruer_plans");
            if (translatedPlans == null)
            {
                translatedPlans = new ItemTemplate();
                translatedPlans.Name = "Translated Askefruer Plans";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + translatedPlans.Name + ", creating it ...");

                translatedPlans.Weight = 3;
                translatedPlans.Model = 498;

                translatedPlans.Object_Type = (int) eObjectType.GenericItem;

                translatedPlans.Id_nb = "translated_askefruer_plans";
                translatedPlans.IsPickable = true;
                translatedPlans.IsDropable = false;

                GameServer.Database.AddObject(translatedPlans);
            }

            // item db check
            recruitsLegs = GameServer.Database.FindObjectByKey<ItemTemplate>("recruits_studded_legs_mid");
            if (recruitsLegs == null)
            {
                recruitsLegs = new ItemTemplate();
                recruitsLegs.Name = "Recruit's Studded Legs (Mid)";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + recruitsLegs.Name + ", creating it ...");
                recruitsLegs.Level = 7;

                recruitsLegs.Weight = 42;
                recruitsLegs.Model = 82; // Studded Legs

                recruitsLegs.DPS_AF = 10; // Armour
                recruitsLegs.SPD_ABS = 19; // Absorption

                recruitsLegs.Object_Type = (int) eObjectType.Studded;
                recruitsLegs.Item_Type = (int) eEquipmentItems.LEGS;
                recruitsLegs.Id_nb = "recruits_studded_legs_mid";
                recruitsLegs.Price = Money.GetMoney(0,0,0,10,0);
                recruitsLegs.IsPickable = true;
                recruitsLegs.IsDropable = true;
                recruitsLegs.Color = 14; // blue leather

                recruitsLegs.Bonus = 5; // default bonus

                recruitsLegs.Bonus1 = 12;
                recruitsLegs.Bonus1Type = (int) eProperty.MaxHealth; // hit

                recruitsLegs.Bonus2 = 2;
                recruitsLegs.Bonus2Type = (int) eResist.Slash;

                recruitsLegs.Bonus3 = 1;
                recruitsLegs.Bonus3Type = (int) eResist.Cold;

                recruitsLegs.Quality = 100;
                recruitsLegs.Condition = 1000;
                recruitsLegs.MaxCondition = 1000;
                recruitsLegs.Durability = 1000;
                recruitsLegs.MaxDurability = 1000;

                GameServer.Database.AddObject(recruitsLegs);
            }

            // item db check
            recruitsPants = GameServer.Database.FindObjectByKey<ItemTemplate>("recruits_quilted_pants");
            if (recruitsPants == null)
            {
                recruitsPants = new ItemTemplate();
                recruitsPants.Name = "Recruit's Quilted Pants";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + recruitsPants.Name + ", creating it ...");
                recruitsPants.Level = 7;

                recruitsPants.Weight = 14;
                recruitsPants.Model = 152; // cloth Legs

                recruitsPants.DPS_AF = 5; // Armour
                recruitsPants.SPD_ABS = 0; // Absorption

                recruitsPants.Object_Type = (int) eObjectType.Cloth;
                recruitsPants.Item_Type = (int) eEquipmentItems.LEGS;
                recruitsPants.Id_nb = "recruits_quilted_pants";
                recruitsPants.Price = Money.GetMoney(0,0,0,10,0);
                recruitsPants.IsPickable = true;
                recruitsPants.IsDropable = true;
                recruitsPants.Color = 36;

                recruitsPants.Bonus = 5; // default bonus

                recruitsPants.Bonus1 = 12;
                recruitsPants.Bonus1Type = (int) eProperty.MaxHealth; // hit

                recruitsPants.Bonus2 = 2;
                recruitsPants.Bonus2Type = (int) eResist.Slash;

                recruitsPants.Bonus3 = 1;
                recruitsPants.Bonus3Type = (int) eResist.Cold;

                recruitsPants.Quality = 100;
                recruitsPants.Condition = 1000;
                recruitsPants.MaxCondition = 1000;
                recruitsPants.Durability = 1000;
                recruitsPants.MaxDurability = 1000;

                GameServer.Database.AddObject(recruitsPants);
            }

            #endregion

            /* Now we add some hooks to the npc we found.
            * Actually, we want to know when a player interacts with him.
            * So, we hook the right-click (interact) and the whisper method
            * of npc and set the callback method to the "TalkToXXX"
            * method. This means, the "TalkToXXX" method is called whenever
            * a player right clicks on him or when he whispers to him.
            */
            //We want to be notified whenever a player enters the world
            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(GamePlayerEvent.GameEntered, new DOLEventHandler(PlayerEnterWorld));

            GameEventMgr.AddHandler(dalikor, GameLivingEvent.Interact, new DOLEventHandler(TalkToDalikor));
            GameEventMgr.AddHandler(dalikor, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToDalikor));

            GameEventMgr.AddHandler(annark, GameObjectEvent.Interact, new DOLEventHandler(TalkToAnnark));

            GameEventMgr.AddHandler(njiedi, GameObjectEvent.Interact, new DOLEventHandler(TalkToNjiedi));

            GameEventMgr.AddHandler(idora, GameObjectEvent.Interact, new DOLEventHandler(TalkToIdora));
            GameEventMgr.AddHandler(idora, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToIdora));

            GameEventMgr.AddHandler(vorgar, GameObjectEvent.Interact, new DOLEventHandler(TalkToVorgar));
            GameEventMgr.AddHandler(vorgar, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToVorgar));

            /* Now we bring to dalikor the possibility to give this quest to players */
            dalikor.AddQuestToGive(typeof (Frontiers));

            if (log.IsInfoEnabled)
                if (log.IsInfoEnabled)
                    log.Info("Quest \"" + questTitle + "\" initialized");
        }
Beispiel #4
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 ...");
            }

            /* First thing we do in here is to search for the NPCs inside
             * the world who comes from the Albion realm. If we find a the players,
             * this means we don't have to create a new one.
             *
             * NOTE: You can do anything you want in this method, you don't have
             * to search for NPC's ... you could create a custom item, place it
             * on the ground and if a player picks it up, he will get the quest!
             * Just examples, do anything you like and feel comfortable with :)
             */

            dalikor = GetDalikor();

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCVikingHyndla"), eRealm.Midgard);
            if (npcs.Length == 0)
            {
                hyndla       = new GameNPC();
                hyndla.Model = 9;
                hyndla.Name  = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCVikingHyndla");
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + hyndla.Name + ", creating ...");
                }

                hyndla.GuildName       = "Part of " + questTitle + " Quest";
                hyndla.Realm           = eRealm.Midgard;
                hyndla.CurrentRegionID = 100;

                hyndla.Size    = 50;
                hyndla.Level   = 40;
                hyndla.X       = GameLocation.ConvertLocalXToGlobalX(53049, 100);
                hyndla.Y       = GameLocation.ConvertLocalYToGlobalY(58068, 100);
                hyndla.Z       = 4985;
                hyndla.Heading = 150;

                // You don't have to store the created mob 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)
                {
                    hyndla.SaveIntoDatabase();
                }

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

            npcs = WorldMgr.GetObjectsByName <GameStableMaster>(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCGriffinHandlerNjiedi"), eRealm.Midgard);

            if (npcs.Length == 0)
            {
                njiedi       = new GameStableMaster();
                njiedi.Model = 158;
                njiedi.Name  = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCGriffinHandlerNjiedi");
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + njiedi.Name + ", creating ...");
                }

                njiedi.GuildName       = "Stable Master";
                njiedi.Realm           = eRealm.Midgard;
                njiedi.CurrentRegionID = 100;
                njiedi.Size            = 51;
                njiedi.Level           = 50;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 81, 10);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 82, 10);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 84);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 32);
                njiedi.Inventory = template.CloseTemplate();

// njiedi.AddNPCEquipment(Slot.TORSO, 81, 10, 0, 0);
//              njiedi.AddNPCEquipment(Slot.LEGS, 82, 10, 0, 0);
//              njiedi.AddNPCEquipment(Slot.FEET, 84, 10, 0, 0);
//              njiedi.AddNPCEquipment(Slot.CLOAK, 57, 32, 0, 0);
                njiedi.X       = GameLocation.ConvertLocalXToGlobalX(55561, 100);
                njiedi.Y       = GameLocation.ConvertLocalYToGlobalY(58225, 100);
                njiedi.Z       = 5005;
                njiedi.Heading = 126;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                njiedi.SetOwnBrain(brain);

                // You don't have to store the created mob 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)
                {
                    njiedi.SaveIntoDatabase();
                }

                njiedi.AddToWorld();
            }
            else
            {
                njiedi = npcs[0] as GameStableMaster;
            }

// npcs = WorldMgr.GetObjectsByName<GameNPC>("Askefruer Trainer", eRealm.None);
            npcs = WorldMgr.GetObjectsByName <GameNPC>(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCAskefruerTrainer"), eRealm.None);
            if (npcs.Length == 0)
            {
                askefruerTrainer = new GameNPC();

                askefruerTrainer.Name    = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.NPCAskefruerTrainer");
                askefruerTrainer.X       = GameLocation.ConvertLocalXToGlobalX(54739, 100);
                askefruerTrainer.Y       = GameLocation.ConvertLocalYToGlobalY(18264, 100);
                askefruerTrainer.Z       = 5195;
                askefruerTrainer.Heading = 79;
                askefruerTrainer.Model   = 678;

                // askefruerTrainer.GuildName = "Part of " + questTitle + " Quest";
                askefruerTrainer.Realm           = eRealm.None;
                askefruerTrainer.CurrentRegionID = 100;
                askefruerTrainer.Size            = 49;
                askefruerTrainer.Level           = 3;

                // Leave at default values to be one the save side ...
                // fairyDragonflyHandler.AggroLevel = 80;
                // fairyDragonflyHandler.AggroRange = 1000;

                // You don't have to store the created mob 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)
                {
                    askefruerTrainer.SaveIntoDatabase();
                }

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

            trainerWhip = GameServer.Database.FindObjectByKey <ItemTemplate>("askefruer_whip");
            if (trainerWhip == null)
            {
                trainerWhip      = new ItemTemplate();
                trainerWhip.Name = "Askefruer Trainer's Whip";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + trainerWhip.Name + " , creating it ...");
                }

                trainerWhip.Weight = 15;
                trainerWhip.Model  = 859;

                trainerWhip.Object_Type = (int)eObjectType.GenericItem;

                trainerWhip.Id_nb      = "askefruer_whip";
                trainerWhip.IsPickable = true;
                trainerWhip.IsDropable = false;

                GameServer.Database.AddObject(trainerWhip);
            }

            // item db check
            recruitsVest = GameServer.Database.FindObjectByKey <ItemTemplate>("recruits_studded_vest_mid");
            if (recruitsVest == null)
            {
                recruitsVest      = new ItemTemplate();
                recruitsVest.Name = "Recruit's Studded Vest (Mid)";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + recruitsVest.Name + ", creating it ...");
                }

                recruitsVest.Level = 8;

                recruitsVest.Weight = 60;
                recruitsVest.Model  = 81;  // studded vest

                recruitsVest.DPS_AF  = 12; // Armour
                recruitsVest.SPD_ABS = 19; // Absorption

                recruitsVest.Object_Type   = (int)eObjectType.Studded;
                recruitsVest.Item_Type     = (int)eEquipmentItems.TORSO;
                recruitsVest.Id_nb         = "recruits_studded_vest_mid";
                recruitsVest.Price         = Money.GetMoney(0, 0, 0, 9, 0);
                recruitsVest.IsPickable    = true;
                recruitsVest.IsDropable    = true;
                recruitsVest.CanDropAsLoot = false;
                recruitsVest.Color         = 14; // blue leather

                recruitsVest.Bonus = 5;          // default bonus

                recruitsVest.Bonus1     = 3;
                recruitsVest.Bonus1Type = (int)eStat.STR;

                recruitsVest.Bonus2     = 4;
                recruitsVest.Bonus2Type = (int)eStat.CON;

                recruitsVest.Bonus3     = 1;
                recruitsVest.Bonus3Type = (int)eResist.Body;

                recruitsVest.Quality       = 100;
                recruitsVest.Condition     = 1000;
                recruitsVest.MaxCondition  = 1000;
                recruitsVest.Durability    = 1000;
                recruitsVest.MaxDurability = 1000;

                GameServer.Database.AddObject(recruitsVest);
            }

            // item db check
            recruitsQuiltedVest = GameServer.Database.FindObjectByKey <ItemTemplate>("recruits_quilted_vest");
            if (recruitsQuiltedVest == null)
            {
                recruitsQuiltedVest      = new ItemTemplate();
                recruitsQuiltedVest.Name = "Recruit's Quilted Vest";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + recruitsQuiltedVest.Name + ", creating it ...");
                }

                recruitsQuiltedVest.Level = 8;

                recruitsQuiltedVest.Weight = 20;
                recruitsQuiltedVest.Model  = 151; // studded vest

                recruitsQuiltedVest.DPS_AF  = 6;  // Armour
                recruitsQuiltedVest.SPD_ABS = 0;  // Absorption

                recruitsQuiltedVest.Object_Type = (int)eObjectType.Cloth;
                recruitsQuiltedVest.Item_Type   = (int)eEquipmentItems.TORSO;
                recruitsQuiltedVest.Id_nb       = "recruits_quilted_vest";
                recruitsQuiltedVest.Price       = Money.GetMoney(0, 0, 0, 9, 0);
                recruitsQuiltedVest.IsPickable  = true;
                recruitsQuiltedVest.IsDropable  = true;
                recruitsQuiltedVest.Color       = 36;

                recruitsQuiltedVest.Bonus = 5; // default bonus

                recruitsQuiltedVest.Bonus1     = 4;
                recruitsQuiltedVest.Bonus1Type = (int)eStat.INT;

                recruitsQuiltedVest.Bonus2     = 3;
                recruitsQuiltedVest.Bonus2Type = (int)eStat.DEX;

                recruitsQuiltedVest.Quality       = 100;
                recruitsQuiltedVest.Condition     = 1000;
                recruitsQuiltedVest.MaxCondition  = 1000;
                recruitsQuiltedVest.Durability    = 1000;
                recruitsQuiltedVest.MaxDurability = 1000;

                GameServer.Database.AddObject(recruitsQuiltedVest);
            }

            /* Now we add some hooks to the npc we found.
             * Actually, we want to know when a player interacts with him.
             * So, we hook the right-click (interact) and the whisper method
             * of npc and set the callback method to the "TalkToXXX"
             * method. This means, the "TalkToXXX" method is called whenever
             * a player right clicks on him or when he whispers to him.
             */

            // We want to be notified whenever a player enters the world
            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(GamePlayerEvent.GameEntered, new DOLEventHandler(PlayerEnterWorld));

            GameEventMgr.AddHandler(dalikor, GameLivingEvent.Interact, new DOLEventHandler(TalkToDalikor));
            GameEventMgr.AddHandler(dalikor, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToDalikor));

            GameEventMgr.AddHandler(njiedi, GameLivingEvent.Interact, new DOLEventHandler(TalkToNjiedi));
            GameEventMgr.AddHandler(njiedi, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToNjiedi));

            GameEventMgr.AddHandler(hyndla, GameLivingEvent.Interact, new DOLEventHandler(TalkToHyndla));
            GameEventMgr.AddHandler(hyndla, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToHyndla));

            GameEventMgr.AddHandler(askefruerTrainer, GameNPCEvent.OnAICallback, new DOLEventHandler(CheckNearAskefruerTrainer));

            /* Now we bring to dalikor the possibility to give this quest to players */
            dalikor.AddQuestToGive(typeof(StolenEggs));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Beispiel #5
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 ...");
            }

            /* First thing we do in here is to search for the NPCs inside
             * the world who comes from the Albion realm. If we find a the players,
             * this means we don't have to create a new one.
             *
             * NOTE: You can do anything you want in this method, you don't have
             * to search for NPC's ... you could create a custom item, place it
             * on the ground and if a player picks it up, he will get the quest!
             * Just examples, do anything you like and feel comfortable with :)
             */

            #region DefineNPCs

            dalikor = GetDalikor();

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Stor Gothi Annark", eRealm.Midgard);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Stor Gothi Annark, creating ...");
                }
                annark                 = new GameNPC();
                annark.Model           = 215;
                annark.Name            = "Stor Gothi Annark";
                annark.GuildName       = "Part of " + questTitle + " Quest";
                annark.Realm           = eRealm.Midgard;
                annark.CurrentRegionID = 100;
                annark.Size            = 51;
                annark.Level           = 66;
                annark.X               = 765357;
                annark.Y               = 668790;
                annark.Z               = 5759;
                annark.Heading         = 7711;

                //annark.AddNPCEquipment((byte)eEquipmentItems.TORSO, 798, 0, 0, 0);
                //annark.AddNPCEquipment((byte)eEquipmentItems.RIGHT_HAND, 19, 0, 0, 0);

                annark.EquipmentTemplateID = "5100090";

                //You don't have to store the created mob 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)
                {
                    annark.SaveIntoDatabase();
                }
                annark.AddToWorld();
            }
            else
            {
                annark = npcs[0];
            }

            npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.Frontiers.NPCScryerIdora"), eRealm.Midgard);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Scryer Idora, creating ...");
                }
                idora                 = new GameNPC();
                idora.Model           = 227;
                idora.Name            = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.Frontiers.NPCScryerIdora");
                idora.GuildName       = "Part of " + questTitle + " Quest";
                idora.Realm           = eRealm.Midgard;
                idora.CurrentRegionID = 234;
                idora.Size            = 52;
                idora.Level           = 50;
                idora.X               = 558081;
                idora.Y               = 573988;
                idora.Z               = 8640;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 81);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 82);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 84);
                template.AddNPCEquipment(eInventorySlot.Cloak, 91);
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 3);
                idora.Inventory = template.CloseTemplate();
                idora.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

//				idora.AddNPCEquipment(Slot.TORSO, 81, 0, 0, 0);
//				idora.AddNPCEquipment(Slot.LEGS, 82, 0, 0, 0);
//				idora.AddNPCEquipment(Slot.FEET, 84, 0, 0, 0);
//				idora.AddNPCEquipment(Slot.CLOAK, 91, 0, 0, 0);
//				idora.AddNPCEquipment(Slot.RIGHTHAND, 3, 0, 0, 0);

                idora.Heading             = 1558;
                idora.MaxSpeedBase        = 200;
                idora.EquipmentTemplateID = "200292";

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 500;
                idora.SetOwnBrain(brain);

                //You don't have to store the created mob 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)
                {
                    idora.SaveIntoDatabase();
                }
                idora.AddToWorld();
            }
            else
            {
                idora = npcs[0];
            }

            Point2D point = idora.GetPointFromHeading(idora.Heading, 30);
            locationIdora = new GameLocation(idora.CurrentZone.Description, idora.CurrentRegionID, point.X, point.Y, idora.Z);

            ticketToSvasudFaste = CreateTicketTo("Svasud Faste", "hs_mularn_svasudfaste");
            ticketToMularn      = CreateTicketTo("Mularn", "hs_svasudfaste_mularn");

            npcs = (GameNPC[])WorldMgr.GetObjectsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.Frontiers.NPCGriffinHandlerNjiedi"), eRealm.Midgard, typeof(GameStableMaster));
            if (npcs.Length == 0)
            {
                njiedi       = new GameStableMaster();
                njiedi.Model = 158;
                njiedi.Name  = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.Frontiers.NPCGriffinHandlerNjiedi");

                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + njiedi.Name + ", creating ...");
                }
                njiedi.GuildName       = "Stable Master";
                njiedi.Realm           = eRealm.Midgard;
                njiedi.CurrentRegionID = 100;
                njiedi.Size            = 51;
                njiedi.Level           = 50;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 81, 10);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 82, 10);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 84, 10);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 32);
                njiedi.Inventory = template.CloseTemplate();

//				njiedi.AddNPCEquipment(Slot.TORSO, 81, 10, 0, 0);
//				njiedi.AddNPCEquipment(Slot.LEGS, 82, 10, 0, 0);
//				njiedi.AddNPCEquipment(Slot.FEET, 84, 10, 0, 0);
//				njiedi.AddNPCEquipment(Slot.CLOAK, 57, 32, 0, 0);

                njiedi.X       = GameLocation.ConvertLocalXToGlobalX(55561, 100);
                njiedi.Y       = GameLocation.ConvertLocalYToGlobalY(58225, 100);
                njiedi.Z       = 5005;
                njiedi.Heading = 126;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                njiedi.SetOwnBrain(brain);

                //You don't have to store the created mob 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)
                {
                    njiedi.SaveIntoDatabase();
                }
                njiedi.AddToWorld();
            }
            else
            {
                njiedi = npcs[0] as GameStableMaster;
            }

            njiedi.TradeItems = new MerchantTradeItems(null);
            if (!njiedi.TradeItems.AddTradeItem(1, eMerchantWindowSlot.FirstEmptyInPage, ticketToSvasudFaste))
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("ticketToSvasudFaste not added");
                }
            }

            foreach (GameNPC npc in njiedi.GetNPCsInRadius(400))
            {
                if (npc.Name == LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.Frontiers.NPCGryphon"))
                {
                    griffin = npc;
                    break;
                }
            }
            if (griffin == null)
            {
                griffin       = new GameNPC();
                griffin.Model = 1236;                 // //819;
                griffin.Name  = "tamed gryphon";

                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + griffin.Name + ", creating ...");
                }
                griffin.GuildName       = "Part of " + questTitle + " Quest";
                griffin.Realm           = eRealm.Midgard;
                griffin.CurrentRegionID = njiedi.CurrentRegionID;
                griffin.Size            = 50;
                griffin.Level           = 50;
                griffin.X = njiedi.X + 80;
                griffin.Y = njiedi.Y + 100;
                griffin.Z = njiedi.Z;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                griffin.SetOwnBrain(brain);

                griffin.Heading      = 93;
                griffin.MaxSpeedBase = 400;
                //dragonfly.EquipmentTemplateID = 200276;

                //You don't have to store the created mob 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)
                {
                    griffin.SaveIntoDatabase();
                }
                griffin.AddToWorld();
            }

            npcs = (GameNPC[])WorldMgr.GetObjectsByName("Vorgar", eRealm.Midgard, typeof(GameStableMaster));
            if (npcs.Length == 0)
            {
                vorgar       = new GameStableMaster();
                vorgar.Model = 52;
                vorgar.Name  = "Vorgar";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + vorgar.Name + ", creating ...");
                }
                vorgar.GuildName       = "Stable Master";
                vorgar.Realm           = eRealm.Midgard;
                vorgar.CurrentRegionID = 100;
                vorgar.Size            = 51;
                vorgar.Level           = 50;
                vorgar.X            = GameLocation.ConvertLocalXToGlobalX(10660, 100);
                vorgar.Y            = GameLocation.ConvertLocalYToGlobalY(3437, 100);
                vorgar.Z            = 5717;
                vorgar.Heading      = 327;
                vorgar.MaxSpeedBase = 200;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                vorgar.SetOwnBrain(brain);

                //ulliam.EquipmentTemplateID = 200276;

                //You don't have to store the created mob 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)
                {
                    vorgar.SaveIntoDatabase();
                }

                vorgar.AddToWorld();
            }
            else
            {
                vorgar = npcs[0] as GameStableMaster;
            }

            Point2D vorgarloc = vorgar.GetPointFromHeading(vorgar.Heading, 30);
            locationVorgar = new GameLocation(vorgar.CurrentZone.Description, vorgar.CurrentRegionID, vorgarloc.X, vorgarloc.Y, vorgar.Z);

            #endregion

            #region DefineItems

            // item db check
            noteForNjiedi = GameServer.Database.FindObjectByKey <ItemTemplate>("njiedi_note");
            if (noteForNjiedi == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Njiedi's Note, creating it ...");
                }
                noteForNjiedi      = new ItemTemplate();
                noteForNjiedi.Name = "Njiedi's Note";

                noteForNjiedi.Weight = 3;
                noteForNjiedi.Model  = 498;

                noteForNjiedi.Object_Type = (int)eObjectType.GenericItem;

                noteForNjiedi.Id_nb      = "njiedi_note";
                noteForNjiedi.IsPickable = true;
                noteForNjiedi.IsDropable = false;

                GameServer.Database.AddObject(noteForNjiedi);
            }

            // item db check
            askefruerPlans = GameServer.Database.FindObjectByKey <ItemTemplate>("askefruer_plans");
            if (askefruerPlans == null)
            {
                askefruerPlans      = new ItemTemplate();
                askefruerPlans.Name = "Askefruer Plans";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + askefruerPlans.Name + ", creating it ...");
                }

                askefruerPlans.Weight = 3;
                askefruerPlans.Model  = 498;

                askefruerPlans.Object_Type = (int)eObjectType.GenericItem;

                askefruerPlans.Id_nb      = "askefruer_plans";
                askefruerPlans.IsPickable = true;
                askefruerPlans.IsDropable = false;

                GameServer.Database.AddObject(askefruerPlans);
            }

            translatedPlans = GameServer.Database.FindObjectByKey <ItemTemplate>("translated_askefruer_plans");
            if (translatedPlans == null)
            {
                translatedPlans      = new ItemTemplate();
                translatedPlans.Name = "Translated Askefruer Plans";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + translatedPlans.Name + ", creating it ...");
                }

                translatedPlans.Weight = 3;
                translatedPlans.Model  = 498;

                translatedPlans.Object_Type = (int)eObjectType.GenericItem;

                translatedPlans.Id_nb      = "translated_askefruer_plans";
                translatedPlans.IsPickable = true;
                translatedPlans.IsDropable = false;

                GameServer.Database.AddObject(translatedPlans);
            }

            // item db check
            recruitsLegs = GameServer.Database.FindObjectByKey <ItemTemplate>("recruits_studded_legs_mid");
            if (recruitsLegs == null)
            {
                recruitsLegs      = new ItemTemplate();
                recruitsLegs.Name = "Recruit's Studded Legs (Mid)";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + recruitsLegs.Name + ", creating it ...");
                }
                recruitsLegs.Level = 7;

                recruitsLegs.Weight = 42;
                recruitsLegs.Model  = 82;                // Studded Legs

                recruitsLegs.DPS_AF  = 10;               // Armour
                recruitsLegs.SPD_ABS = 19;               // Absorption

                recruitsLegs.Object_Type = (int)eObjectType.Studded;
                recruitsLegs.Item_Type   = (int)eEquipmentItems.LEGS;
                recruitsLegs.Id_nb       = "recruits_studded_legs_mid";
                recruitsLegs.Price       = Money.GetMoney(0, 0, 0, 10, 0);
                recruitsLegs.IsPickable  = true;
                recruitsLegs.IsDropable  = true;
                recruitsLegs.Color       = 14;          // blue leather

                recruitsLegs.Bonus = 5;                 // default bonus

                recruitsLegs.Bonus1     = 12;
                recruitsLegs.Bonus1Type = (int)eProperty.MaxHealth;                  // hit

                recruitsLegs.Bonus2     = 2;
                recruitsLegs.Bonus2Type = (int)eResist.Slash;

                recruitsLegs.Bonus3     = 1;
                recruitsLegs.Bonus3Type = (int)eResist.Cold;

                recruitsLegs.Quality       = 100;
                recruitsLegs.Condition     = 1000;
                recruitsLegs.MaxCondition  = 1000;
                recruitsLegs.Durability    = 1000;
                recruitsLegs.MaxDurability = 1000;

                GameServer.Database.AddObject(recruitsLegs);
            }

            // item db check
            recruitsPants = GameServer.Database.FindObjectByKey <ItemTemplate>("recruits_quilted_pants");
            if (recruitsPants == null)
            {
                recruitsPants      = new ItemTemplate();
                recruitsPants.Name = "Recruit's Quilted Pants";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + recruitsPants.Name + ", creating it ...");
                }
                recruitsPants.Level = 7;

                recruitsPants.Weight = 14;
                recruitsPants.Model  = 152;               // cloth Legs

                recruitsPants.DPS_AF  = 5;                // Armour
                recruitsPants.SPD_ABS = 0;                // Absorption

                recruitsPants.Object_Type = (int)eObjectType.Cloth;
                recruitsPants.Item_Type   = (int)eEquipmentItems.LEGS;
                recruitsPants.Id_nb       = "recruits_quilted_pants";
                recruitsPants.Price       = Money.GetMoney(0, 0, 0, 10, 0);
                recruitsPants.IsPickable  = true;
                recruitsPants.IsDropable  = true;
                recruitsPants.Color       = 36;

                recruitsPants.Bonus = 5;                 // default bonus

                recruitsPants.Bonus1     = 12;
                recruitsPants.Bonus1Type = (int)eProperty.MaxHealth;                  // hit

                recruitsPants.Bonus2     = 2;
                recruitsPants.Bonus2Type = (int)eResist.Slash;

                recruitsPants.Bonus3     = 1;
                recruitsPants.Bonus3Type = (int)eResist.Cold;

                recruitsPants.Quality       = 100;
                recruitsPants.Condition     = 1000;
                recruitsPants.MaxCondition  = 1000;
                recruitsPants.Durability    = 1000;
                recruitsPants.MaxDurability = 1000;

                GameServer.Database.AddObject(recruitsPants);
            }

            #endregion

            /* Now we add some hooks to the npc we found.
             * Actually, we want to know when a player interacts with him.
             * So, we hook the right-click (interact) and the whisper method
             * of npc and set the callback method to the "TalkToXXX"
             * method. This means, the "TalkToXXX" method is called whenever
             * a player right clicks on him or when he whispers to him.
             */
            //We want to be notified whenever a player enters the world
            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(GamePlayerEvent.GameEntered, new DOLEventHandler(PlayerEnterWorld));

            GameEventMgr.AddHandler(dalikor, GameLivingEvent.Interact, new DOLEventHandler(TalkToDalikor));
            GameEventMgr.AddHandler(dalikor, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToDalikor));

            GameEventMgr.AddHandler(annark, GameObjectEvent.Interact, new DOLEventHandler(TalkToAnnark));

            GameEventMgr.AddHandler(njiedi, GameObjectEvent.Interact, new DOLEventHandler(TalkToNjiedi));

            GameEventMgr.AddHandler(idora, GameObjectEvent.Interact, new DOLEventHandler(TalkToIdora));
            GameEventMgr.AddHandler(idora, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToIdora));

            GameEventMgr.AddHandler(vorgar, GameObjectEvent.Interact, new DOLEventHandler(TalkToVorgar));
            GameEventMgr.AddHandler(vorgar, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToVorgar));

            /* Now we bring to dalikor the possibility to give this quest to players */
            dalikor.AddQuestToGive(typeof(Frontiers));

            if (log.IsInfoEnabled)
            {
                if (log.IsInfoEnabled)
                {
                    log.Info("Quest \"" + questTitle + "\" initialized");
                }
            }
        }
Beispiel #6
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 ...");
            /* First thing we do in here is to search for the NPCs inside
             * the world who comes from the certain Realm. If we find a the players,
             * this means we don't have to create a new one.
             *
             * NOTE: You can do anything you want in this method, you don't have
             * to search for NPC's ... you could create a custom item, place it
             * on the ground and if a player picks it up, he will get the quest!
             * Just examples, do anything you like and feel comfortable with :)
             */

            #region DefineNPCs

            masterFrederick = GetMasterFrederick();

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Master Visur", eRealm.Albion);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Master Visur, creating ...");
                masterVisur = new GameNPC();
                masterVisur.Model = 61;
                masterVisur.Name = "Master Visur";
                masterVisur.GuildName = "Part of " + questTitle + " Quest";
                masterVisur.Realm = eRealm.Albion;
                masterVisur.CurrentRegionID = 1;
                masterVisur.Size = 49;
                masterVisur.Level = 55;
                masterVisur.X = 585589;
                masterVisur.Y = 478396;
                masterVisur.Z = 3368;
                masterVisur.Heading = 56;
                masterVisur.MaxSpeedBase = 200;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 798);
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 19);
                masterVisur.Inventory = template.CloseTemplate();
                masterVisur.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

            //				masterVisur.AddNPCEquipment((byte) eEquipmentItems.TORSO, 798, 0, 0, 0);
            //				masterVisur.AddNPCEquipment((byte) eEquipmentItems.RIGHT_HAND, 19, 0, 0, 0);

                masterVisur.EquipmentTemplateID = "3400843";

                //You don't have to store the created mob 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)
                    masterVisur.SaveIntoDatabase();
                masterVisur.AddToWorld();
            }
            else
                masterVisur = npcs[0];

            npcs = WorldMgr.GetNPCsByName("Scryer Alice", eRealm.Albion);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Alice, creating ...");
                alice = new GameNPC();
                alice.Model = 52;
                alice.Name = "Scryer Alice";
                alice.GuildName = "Part of " + questTitle + " Quest";
                alice.Realm = eRealm.Albion;
                alice.CurrentRegionID = 1;
                alice.Size = 51;
                alice.Level = 50;
                alice.X = 436598;
                alice.Y = 650425;
                alice.Z = 2448;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 81);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 82);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 84);
                template.AddNPCEquipment(eInventorySlot.Cloak, 91);
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 3);
                alice.Inventory = template.CloseTemplate();
                alice.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

            //				alice.AddNPCEquipment(Slot.TORSO, 81, 0, 0, 0);
            //				alice.AddNPCEquipment(Slot.LEGS, 82, 0, 0, 0);
            //				alice.AddNPCEquipment(Slot.FEET, 84, 0, 0, 0);
            //				alice.AddNPCEquipment(Slot.CLOAK, 91, 0, 0, 0);
            //				alice.AddNPCEquipment(Slot.RIGHTHAND, 3, 0, 0, 0);

                alice.Heading = 3766;
                alice.MaxSpeedBase = 200;
                alice.EquipmentTemplateID = "200276";
                alice.Flags = (GameNPC.eFlags) 18;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                alice.SetOwnBrain(brain);

                //You don't have to store the created mob 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)
                    alice.SaveIntoDatabase();
                alice.AddToWorld();
            }
            else
                alice = npcs[0];

            Point2D point = alice.GetPointFromHeading( alice.Heading, 30 );
            locationAlice = new GameLocation(alice.CurrentZone.Description, alice.CurrentRegionID, point.X, point.Y, alice.Z);

            dragonflyTicket = CreateTicketTo("Castle Sauvage", "hs_src_castlesauvage");
            horseTicket = CreateTicketTo("Camelot Hills", "hs_src_camelothills");

            npcs = (GameNPC[]) WorldMgr.GetObjectsByName("Dragonfly Handler Colm", eRealm.Albion, typeof (GameStableMaster));
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Dragonfly Handler Colm, creating ...");
                colm = new GameStableMaster();
                colm.Model = 78;
                colm.Name = "Dragonfly Handler Colm";
                colm.GuildName = "Stable Master";
                colm.Realm = eRealm.Albion;
                colm.CurrentRegionID = 1;
                colm.Size = 51;
                colm.Level = 50;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 81, 10);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 82, 10);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 84, 10);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 32);
                colm.Inventory = template.CloseTemplate();

            //				colm.AddNPCEquipment(Slot.TORSO, 81, 10, 0, 0);
            //				colm.AddNPCEquipment(Slot.LEGS, 82, 10, 0, 0);
            //				colm.AddNPCEquipment(Slot.FEET, 84, 10, 0, 0);
            //				colm.AddNPCEquipment(Slot.CLOAK, 57, 32, 0, 0);

                colm.X = 562775;
                colm.Y = 512453;
                colm.Z = 2438;
                colm.Heading = 158;
                colm.MaxSpeedBase = 200;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                colm.SetOwnBrain(brain);

                //You don't have to store the created mob 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)
                    colm.SaveIntoDatabase();
                colm.AddToWorld();
            }
            else
            {
                colm = npcs[0] as GameStableMaster;
            }

            colm.TradeItems = new MerchantTradeItems(null);
            if (!colm.TradeItems.AddTradeItem(0, eMerchantWindowSlot.FirstEmptyInPage, dragonflyTicket))
                if (log.IsWarnEnabled)
                    log.Warn("dragonflyTicket not added");

            foreach (GameNPC npc in colm.GetNPCsInRadius(400))
            {
                if (npc.Name == "dragonfly hatchling")
                {
                    dragonfly = npc;
                    break;
                }
            }
            if (dragonfly == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Dragon Fly, creating ...");
                dragonfly = new GameNPC();
                dragonfly.Model = 1207;
                dragonfly.Name = "dragonfly hatchling";
                dragonfly.GuildName = "Part of " + questTitle + " Quest";
                dragonfly.Realm = eRealm.None;
                dragonfly.CurrentRegionID = 1;
                dragonfly.Size = 25;
                dragonfly.Level = 31;
                dragonfly.X = colm.X + 80;
                dragonfly.Y = colm.Y + 100;
                dragonfly.Z = colm.Z;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                dragonfly.SetOwnBrain(brain);

                dragonfly.Heading = 2434;
                dragonfly.MaxSpeedBase = 400;
                //dragonfly.EquipmentTemplateID = 200276;

                //You don't have to store the created mob 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)
                    dragonfly.SaveIntoDatabase();
                dragonfly.AddToWorld();
            }

            npcs = (GameNPC[]) WorldMgr.GetObjectsByName("Uliam", eRealm.Albion, typeof (GameStableMaster));
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Uliam, creating ...");
                uliam = new GameStableMaster();
                uliam.Model = 52;
                uliam.Name = "Uliam";
                uliam.GuildName = "Stable Master";
                uliam.Realm = eRealm.Albion;
                uliam.CurrentRegionID = 1;
                uliam.Size = 51;
                uliam.Level = 50;
                uliam.X = 585609;
                uliam.Y = 478980;
                uliam.Z = 2183;
                uliam.Heading = 93;
                uliam.MaxSpeedBase = 200;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                uliam.SetOwnBrain(brain);

                //ulliam.EquipmentTemplateID = 200276;

                //You don't have to store the created mob 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)
                    uliam.SaveIntoDatabase();

                uliam.AddToWorld();
            }
            else
                uliam = npcs[0] as GameStableMaster;

            Point2D uliamloc = uliam.GetPointFromHeading( uliam.Heading, 30 );
            locationUliam = new GameLocation(uliam.CurrentZone.Description, uliam.CurrentRegionID, uliam.X, uliam.Y, uliam.Z);

            /*
            foreach (GameNPC npc in WorldMgr.GetNPCsCloseToObject(uliam, 400))
            {
                if (npc.Name == "horse")
                {
                    horse = npc;
                    break;
                }
            }

            if (horse == null)
            {
                if(Log.IsWarnEnabled)
                                    Log.Warn("Could not find Horse near Uliam, creating ...");
                horse = new GameNPC();
                horse.Model = 450; // //819;
                horse.Name = "horse";
                horse.GuildName = "Part of " + questTitle + " Quest";
                horse.Realm = (byte)eRealm.None;
                horse.CurrentRegionID = 1;
                horse.Size = 63;
                horse.Level = 55;
                horse.X = uliam.X + 80;
                horse.Y = uliam.Y + 130;
                horse.Z = uliam.Z;
                horse.Heading = 93;

                horse.AggroLevel = 0;
                horse.AggroRange = 0;
                //horse.EquipmentTemplateID = 200276;

                //You don't have to store the created mob 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)
                    horse.SaveIntoDatabase();
                horse.AddToWorld();
            }
             */

            #endregion

            #region DefineItems

            // item db check
            noteFormColm = GameServer.Database.FindObjectByKey<ItemTemplate>("colms_note");
            if (noteFormColm == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Colm's Note, creating it ...");
                noteFormColm = new ItemTemplate();
                noteFormColm.Name = "Colm's Note";

                noteFormColm.Weight = 3;
                noteFormColm.Model = 498;

                noteFormColm.Object_Type = (int) eObjectType.GenericItem;

                noteFormColm.Id_nb = "colms_note";
                noteFormColm.IsPickable = true;
                noteFormColm.IsDropable = false;

                //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

                    GameServer.Database.AddObject(noteFormColm);
            }

            // item db check
            fairyPlans = GameServer.Database.FindObjectByKey<ItemTemplate>("ire_fairy_plans");
            if (fairyPlans == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Ire Fairy Plans, creating it ...");
                fairyPlans = new ItemTemplate();
                fairyPlans.Name = "Ire Fairy Plans";

                fairyPlans.Weight = 3;
                fairyPlans.Model = 498;

                fairyPlans.Object_Type = (int) eObjectType.GenericItem;

                fairyPlans.Id_nb = "ire_fairy_plans";
                fairyPlans.IsPickable = true;
                fairyPlans.IsDropable = false;

                //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

                    GameServer.Database.AddObject(fairyPlans);
            }

            translatedPlans = GameServer.Database.FindObjectByKey<ItemTemplate>("translated_ire_fairy_plans");
            if (translatedPlans == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Translated Ire Fairy Plans, creating it ...");
                translatedPlans = new ItemTemplate();
                translatedPlans.Name = "Translated Ire Fairy Plans";

                translatedPlans.Weight = 3;
                translatedPlans.Model = 498;

                translatedPlans.Object_Type = (int) eObjectType.GenericItem;

                translatedPlans.Id_nb = "translated_ire_fairy_plans";
                translatedPlans.IsPickable = true;
                translatedPlans.IsDropable = false;

                //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

                    GameServer.Database.AddObject(translatedPlans);
            }

            // item db check
            recruitsLegs = GameServer.Database.FindObjectByKey<ItemTemplate>("recruits_studded_legs");
            if (recruitsLegs == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Recruit's Studded Legs, creating it ...");
                recruitsLegs = new ItemTemplate();
                recruitsLegs.Name = "Recruit's Studded Legs";
                recruitsLegs.Level = 7;

                recruitsLegs.Weight = 42;
                recruitsLegs.Model = 82; // Studded Legs

                recruitsLegs.DPS_AF = 10; // Armour
                recruitsLegs.SPD_ABS = 19; // Absorption

                recruitsLegs.Object_Type = (int) eObjectType.Studded;
                recruitsLegs.Item_Type = (int) eEquipmentItems.LEGS;
                recruitsLegs.Id_nb = "recruits_studded_legs";
                recruitsLegs.Price = Money.GetMoney(0,0,0,10,0);
                recruitsLegs.IsPickable = true;
                recruitsLegs.IsDropable = true;
                recruitsLegs.Color = 9; // red leather

                recruitsLegs.Bonus = 5; // default bonus

                recruitsLegs.Bonus1 = 10;
                recruitsLegs.Bonus1Type = (int) eProperty.MaxHealth; // hit

                recruitsLegs.Bonus2 = 2;
                recruitsLegs.Bonus2Type = (int) eResist.Slash;

                recruitsLegs.Bonus3 = 1;
                recruitsLegs.Bonus3Type = (int) eResist.Cold;

                recruitsLegs.Quality = 100;
                recruitsLegs.Condition = 1000;
                recruitsLegs.MaxCondition = 1000;
                recruitsLegs.Durability = 1000;
                recruitsLegs.MaxDurability = 1000;

                //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

                    GameServer.Database.AddObject(recruitsLegs);
            }

            // item db check
            recruitsPants = GameServer.Database.FindObjectByKey<ItemTemplate>("recruits_quilted_pants");
            if (recruitsPants == null)
            {
                recruitsPants = new ItemTemplate();
                recruitsPants.Name = "Recruit's Quilted Pants";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + recruitsPants.Name + ", creating it ...");
                recruitsPants.Level = 7;

                recruitsPants.Weight = 14;
                recruitsPants.Model = 152; // cloth Legs

                recruitsPants.DPS_AF = 5; // Armour
                recruitsPants.SPD_ABS = 0; // Absorption

                recruitsPants.Object_Type = (int) eObjectType.Cloth;
                recruitsPants.Item_Type = (int) eEquipmentItems.LEGS;
                recruitsPants.Id_nb = "recruits_quilted_pants";
                recruitsPants.Price = Money.GetMoney(0,0,0,10,0);
                recruitsPants.IsPickable = true;
                recruitsPants.IsDropable = true;
                recruitsPants.Color = 17; // red leather

                recruitsPants.Bonus = 5; // default bonus

                recruitsPants.Bonus1 = 12;
                recruitsPants.Bonus1Type = (int) eProperty.MaxHealth; // hit

                recruitsPants.Bonus2 = 2;
                recruitsPants.Bonus2Type = (int) eResist.Slash;

                recruitsPants.Bonus3 = 1;
                recruitsPants.Bonus3Type = (int) eResist.Cold;

                recruitsPants.Quality = 100;
                recruitsPants.Condition = 1000;
                recruitsPants.MaxCondition = 1000;
                recruitsPants.Durability = 1000;
                recruitsPants.MaxDurability = 1000;

                //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

                    GameServer.Database.AddObject(recruitsPants);
            }

            #endregion

            /* Now we add some hooks to the npc we found.
             * Actually, we want to know when a player interacts with him.
             * So, we hook the right-click (interact) and the whisper method
             * of npc and set the callback method to the "TalkToXXX"
             * method. This means, the "TalkToXXX" method is called whenever
             * a player right clicks on him or when he whispers to him.
             */

            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            //We want to be notified whenever a player enters the world
            GameEventMgr.AddHandler(GamePlayerEvent.GameEntered, new DOLEventHandler(PlayerEnterWorld));

            GameEventMgr.AddHandler(masterFrederick, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterFrederick));
            GameEventMgr.AddHandler(masterFrederick, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterFrederick));

            GameEventMgr.AddHandler(masterVisur, GameObjectEvent.Interact, new DOLEventHandler(TalkToMasterVisur));

            GameEventMgr.AddHandler(colm, GameObjectEvent.Interact, new DOLEventHandler(TalkToColm));

            GameEventMgr.AddHandler(alice, GameObjectEvent.Interact, new DOLEventHandler(TalkToAlice));
            GameEventMgr.AddHandler(alice, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToAlice));

            /* Now we bring to masterFrederick the possibility to give this quest to players */
            masterFrederick.AddQuestToGive(typeof (Frontiers));

            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initialized");
        }
Beispiel #7
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 ...");
            }

            /* First thing we do in here is to search for the NPCs inside
             * the world who comes from the certain Realm. If we find a the players,
             * this means we don't have to create a new one.
             *
             * NOTE: You can do anything you want in this method, you don't have
             * to search for NPC's ... you could create a custom item, place it
             * on the ground and if a player picks it up, he will get the quest!
             * Just examples, do anything you like and feel comfortable with :)
             */

            masterFrederick = GetMasterFrederick();

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Nob the Stableboy", eRealm.Albion);
            if (npcs.Length == 0)
            {
                nob       = new GameNPC();
                nob.Model = 9;
                nob.Name  = "Nob the Stableboy";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + nob.Name + ", creating him ...");
                }

                nob.GuildName       = "Part of " + questTitle + " Quest";
                nob.Realm           = eRealm.Albion;
                nob.CurrentRegionID = 1;

                nob.Size    = 45;
                nob.Level   = 4;
                nob.X       = 573019;
                nob.Y       = 504485;
                nob.Z       = 2199;
                nob.Heading = 10;

                // You don't have to store the created mob 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)
                {
                    nob.SaveIntoDatabase();
                }

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

            npcs = WorldMgr.GetObjectsByName <GameStableMaster>("Dragonfly Handler Colm", eRealm.Albion);
            if (npcs.Length == 0)
            {
                colm       = new GameStableMaster();
                colm.Model = 78;
                colm.Name  = "Dragonfly Handler Colm";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + colm.Name + ", creating ...");
                }

                colm.GuildName       = "Stable Master";
                colm.Realm           = eRealm.Albion;
                colm.CurrentRegionID = 1;
                colm.Size            = 51;
                colm.Level           = 50;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 81, 10);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 82, 10);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 84, 10);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 32);
                colm.Inventory = template.CloseTemplate();

// colm.AddNPCEquipment(Slot.TORSO, 81, 10, 0, 0);
//              colm.AddNPCEquipment(Slot.LEGS, 82, 10, 0, 0);
//              colm.AddNPCEquipment(Slot.FEET, 84, 10, 0, 0);
//              colm.AddNPCEquipment(Slot.CLOAK, 57, 32, 0, 0);
                colm.X            = 562775;
                colm.Y            = 512453;
                colm.Z            = 2438;
                colm.Heading      = 158;
                colm.MaxSpeedBase = 200;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                colm.SetOwnBrain(brain);

                // You don't have to store the created mob 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)
                {
                    colm.SaveIntoDatabase();
                }

                colm.AddToWorld();
            }
            else
            {
                colm = npcs[0] as GameStableMaster;
            }

            npcs = WorldMgr.GetObjectsByName <GameNPC>("Haruld", eRealm.Albion);
            if (npcs.Length == 0 || !(npcs[0] is GameStableMaster))
            {
                haruld       = new GameStableMaster();
                haruld.Model = 9;
                haruld.Name  = "Haruld";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + haruld.Name + ", creating ...");
                }

                haruld.GuildName       = "Stable Master";
                haruld.Realm           = eRealm.Albion;
                haruld.CurrentRegionID = 1;
                haruld.Size            = 49;
                haruld.Level           = 4;

                haruld.X            = 572479;
                haruld.Y            = 504410;
                haruld.Z            = 2184;
                haruld.Heading      = 944;
                haruld.MaxSpeedBase = 100;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                haruld.SetOwnBrain(brain);

                haruld.EquipmentTemplateID = "11701337";

                // You don't have to store the created mob 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)
                {
                    haruld.SaveIntoDatabase();
                }

                haruld.AddToWorld();
            }
            else
            {
                haruld = npcs[0] as GameStableMaster;
            }

            npcs = WorldMgr.GetObjectsByName <GameNPC>("Fairy Dragonfly Handler", eRealm.None);
            if (npcs.Length == 0)
            {
                fairyDragonflyHandler      = new GameNPC();
                fairyDragonflyHandler.Name = "Fairy Dragonfly Handler";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + fairyDragonflyHandler.Name + ", creating ...");
                }

                fairyDragonflyHandler.X               = 575334;
                fairyDragonflyHandler.Y               = 506403;
                fairyDragonflyHandler.Z               = 2331;
                fairyDragonflyHandler.Heading         = 114;
                fairyDragonflyHandler.Model           = 603;
                fairyDragonflyHandler.GuildName       = "Part of " + questTitle + " Quest";
                fairyDragonflyHandler.Realm           = eRealm.None;
                fairyDragonflyHandler.CurrentRegionID = 1;
                fairyDragonflyHandler.Size            = 49;
                fairyDragonflyHandler.Level           = 3;

                // Leave at default values to be one the save side ...
                // fairyDragonflyHandler.AggroLevel = 80;
                // fairyDragonflyHandler.AggroRange = 1000;

                // You don't have to store the created mob 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)
                {
                    fairyDragonflyHandler.SaveIntoDatabase();
                }

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

            dragonflyWhip = GameServer.Database.FindObjectByKey <ItemTemplate>("dragonfly_whip");
            if (dragonflyWhip == null)
            {
                dragonflyWhip      = new ItemTemplate();
                dragonflyWhip.Name = "Dragonfly Whip";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + dragonflyWhip.Name + " , creating it ...");
                }

                dragonflyWhip.Weight = 15;
                dragonflyWhip.Model  = 859;

                dragonflyWhip.Object_Type = (int)eObjectType.GenericItem;

                dragonflyWhip.Id_nb      = "dragonfly_whip";
                dragonflyWhip.IsPickable = true;
                dragonflyWhip.IsDropable = false;

                // 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
                GameServer.Database.AddObject(dragonflyWhip);
            }

            // item db check
            recruitsVest = GameServer.Database.FindObjectByKey <ItemTemplate>("recruits_studded_vest");
            if (recruitsVest == null)
            {
                recruitsVest      = new ItemTemplate();
                recruitsVest.Name = "Recruit's Studded Vest";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + recruitsVest.Name + ", creating it ...");
                }

                recruitsVest.Level = 8;

                recruitsVest.Weight = 60;
                recruitsVest.Model  = 81;  // studded vest

                recruitsVest.DPS_AF  = 12; // Armour
                recruitsVest.SPD_ABS = 19; // Absorption

                recruitsVest.Object_Type   = (int)eObjectType.Studded;
                recruitsVest.Item_Type     = (int)eEquipmentItems.TORSO;
                recruitsVest.Id_nb         = "recruits_studded_vest";
                recruitsVest.Price         = Money.GetMoney(0, 0, 0, 9, 0);
                recruitsVest.IsPickable    = true;
                recruitsVest.IsDropable    = true;
                recruitsVest.CanDropAsLoot = false;
                recruitsVest.Color         = 9; // red leather

                recruitsVest.Bonus = 5;         // default bonus

                recruitsVest.Bonus1     = 4;
                recruitsVest.Bonus1Type = (int)eStat.STR;

                recruitsVest.Bonus2     = 3;
                recruitsVest.Bonus2Type = (int)eStat.CON;

                recruitsVest.Quality       = 100;
                recruitsVest.Condition     = 1000;
                recruitsVest.MaxCondition  = 1000;
                recruitsVest.Durability    = 1000;
                recruitsVest.MaxDurability = 1000;

                // 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
                GameServer.Database.AddObject(recruitsVest);
            }

            // item db check
            recruitsQuiltedVest = GameServer.Database.FindObjectByKey <ItemTemplate>("recruits_quilted_vest");
            if (recruitsQuiltedVest == null)
            {
                recruitsQuiltedVest      = new ItemTemplate();
                recruitsQuiltedVest.Name = "Recruit's Quilted Vest";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + recruitsQuiltedVest.Name + ", creating it ...");
                }

                recruitsQuiltedVest.Level = 8;

                recruitsQuiltedVest.Weight = 20;
                recruitsQuiltedVest.Model  = 151; // studded vest

                recruitsQuiltedVest.DPS_AF  = 6;  // Armour
                recruitsQuiltedVest.SPD_ABS = 0;  // Absorption

                recruitsQuiltedVest.Object_Type = (int)eObjectType.Cloth;
                recruitsQuiltedVest.Item_Type   = (int)eEquipmentItems.TORSO;
                recruitsQuiltedVest.Id_nb       = "recruits_quilted_vest";
                recruitsQuiltedVest.Price       = Money.GetMoney(0, 0, 0, 9, 0);
                recruitsQuiltedVest.IsPickable  = true;
                recruitsQuiltedVest.IsDropable  = true;
                recruitsQuiltedVest.Color       = 9; // red leather

                recruitsQuiltedVest.Bonus = 5;       // default bonus

                recruitsQuiltedVest.Bonus1     = 4;
                recruitsQuiltedVest.Bonus1Type = (int)eStat.INT;

                recruitsQuiltedVest.Bonus2     = 3;
                recruitsQuiltedVest.Bonus2Type = (int)eStat.DEX;

                recruitsQuiltedVest.Quality       = 100;
                recruitsQuiltedVest.Condition     = 1000;
                recruitsQuiltedVest.MaxCondition  = 1000;
                recruitsQuiltedVest.Durability    = 1000;
                recruitsQuiltedVest.MaxDurability = 1000;

                // 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
                GameServer.Database.AddObject(recruitsQuiltedVest);
            }

            /* Now we add some hooks to the npc we found.
             * Actually, we want to know when a player interacts with him.
             * So, we hook the right-click (interact) and the whisper method
             * of npc and set the callback method to the "TalkToXXX"
             * method. This means, the "TalkToXXX" method is called whenever
             * a player right clicks on him or when he whispers to him.
             */

            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            // We want to be notified whenever a player enters the world
            GameEventMgr.AddHandler(GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));

            GameEventMgr.AddHandler(masterFrederick, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterFrederick));
            GameEventMgr.AddHandler(masterFrederick, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterFrederick));

            GameEventMgr.AddHandler(colm, GameLivingEvent.Interact, new DOLEventHandler(TalkToColm));
            GameEventMgr.AddHandler(colm, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToColm));

            GameEventMgr.AddHandler(nob, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToNob));

            GameEventMgr.AddHandler(haruld, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToHaruld));

            GameEventMgr.AddHandler(fairyDragonflyHandler, GameNPCEvent.OnAICallback, new DOLEventHandler(CheckNearFairyDragonflyHandler));

            /* Now we bring to masterFrederick the possibility to give this quest to players */
            masterFrederick.AddQuestToGive(typeof(IreFairyIre));

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