public override bool AddToWorld()
        {
            int color = Util.Random(0, 86);
            GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.Cloak, 3802);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 3390);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 3391);
            template.AddNPCEquipment(eInventorySlot.ArmsArmor, 3392);
            template.AddNPCEquipment(eInventorySlot.HandsArmor, 3393);
            template.AddNPCEquipment(eInventorySlot.FeetArmor, 3394);
            Inventory = template.CloseTemplate();
            Level = 60;
            Name = "Labyrinth Weapons";
            GuildName = "Hib Merchant";
            Model = 334;
            Size = 54;
            RespawnInterval = 2000;
            MaxSpeedBase = 0;
            Realm = 0;
            TradeItems = new MerchantTradeItems("HibLabWeaps");

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

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Hugh Gallen", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                hughGallen       = new GameNPC();
                hughGallen.Model = 40;
                hughGallen.Name  = "Hugh Gallen";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + hughGallen.Name + ", creating him ...");
                }
                hughGallen.GuildName       = "Part of " + questTitle + " Quest";
                hughGallen.Realm           = eRealm.Albion;
                hughGallen.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                hughGallen.Inventory = template.CloseTemplate();
                hughGallen.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                hughGallen.Size    = 49;
                hughGallen.Level   = 38;
                hughGallen.X       = 574640;
                hughGallen.Y       = 531109;
                hughGallen.Z       = 2896;
                hughGallen.Heading = 2275;

                //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)
                {
                    hughGallen.SaveIntoDatabase();
                }

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

            #endregion

            #region defineItems

            // item db check
            beltOfAnimation = GameServer.Database.FindObjectByKey <ItemTemplate>("belt_of_animation");
            if (beltOfAnimation == null)
            {
                beltOfAnimation      = new ItemTemplate();
                beltOfAnimation.Name = "Belt of Animation";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + beltOfAnimation.Name + ", creating it ...");
                }

                beltOfAnimation.Level  = 5;
                beltOfAnimation.Weight = 3;
                beltOfAnimation.Model  = 597;

                beltOfAnimation.Object_Type = (int)eObjectType.Magical;
                beltOfAnimation.Item_Type   = (int)eEquipmentItems.WAIST;
                beltOfAnimation.Id_nb       = "belt_of_animation";
                beltOfAnimation.Price       = 0;
                beltOfAnimation.IsPickable  = true;
                beltOfAnimation.IsDropable  = false;                // can't be sold to merchand

                beltOfAnimation.Bonus1     = 6;
                beltOfAnimation.Bonus1Type = (int)eProperty.MaxHealth;

                beltOfAnimation.Quality       = 100;
                beltOfAnimation.Condition     = 1000;
                beltOfAnimation.MaxCondition  = 1000;
                beltOfAnimation.Durability    = 1000;
                beltOfAnimation.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(beltOfAnimation);
            }

            #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));

            GameEventMgr.AddHandler(hughGallen, GameLivingEvent.Interact, new DOLEventHandler(TalkToHughGallen));
            GameEventMgr.AddHandler(hughGallen, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToHughGallen));

            /* Now we bring to Yetta Fletcher the possibility to give this quest to players */
            hughGallen.AddQuestToGive(typeof(ClericMulgrut));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Godeleva Dowden", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
                * this users Mob Database, so we simply create one ;-)
                * else we take the existing one. And if more than one exist, we take
                * the first ...
                */
            if (npcs.Length == 0)
            {
                godelevaDowden = new GameNPC();
                godelevaDowden.Model = 7;
                godelevaDowden.Name = "Godeleva Dowden";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + godelevaDowden.Name + ", creating him ...");
                godelevaDowden.GuildName = "Part of " + questTitle + " Quest";
                godelevaDowden.Realm = eRealm.Albion;
                godelevaDowden.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 138);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 134);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 135);
                godelevaDowden.Inventory = template.CloseTemplate();
                godelevaDowden.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                godelevaDowden.Size = 48;
                godelevaDowden.Level = 40;
                godelevaDowden.X = 559528;
                godelevaDowden.Y = 510953;
                godelevaDowden.Z = 2488;
                godelevaDowden.Heading = 1217;

                //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)
                    godelevaDowden.SaveIntoDatabase();

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

            #endregion

            #region defineItems

            // item db check
            woodenBucket = GameServer.Database.FindObjectByKey<ItemTemplate>("wooden_bucket");
            if (woodenBucket == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Wooden Bucket, creating it ...");
                woodenBucket = new ItemTemplate();
                woodenBucket.Name = "Wooden Bucket";
                woodenBucket.Level = 1;
                woodenBucket.Weight = 10;
                woodenBucket.Model = 1610;

                woodenBucket.Object_Type = (int)eObjectType.GenericItem;
                woodenBucket.Id_nb = "wooden_bucket";
                woodenBucket.Price = 0;
                woodenBucket.IsPickable = false;
                woodenBucket.IsDropable = false;

                woodenBucket.Quality = 100;
                woodenBucket.Condition = 1000;
                woodenBucket.MaxCondition = 1000;
                woodenBucket.Durability = 1000;
                woodenBucket.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(woodenBucket);
            }

            // item db check
            fullWoodenBucket = GameServer.Database.FindObjectByKey<ItemTemplate>("full_wooden_bucket");
            if (fullWoodenBucket == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Full Wooden Bucket, creating it ...");
                fullWoodenBucket = new ItemTemplate();
                fullWoodenBucket.Name = "Full Wooden Bucket";
                fullWoodenBucket.Level = 1;
                fullWoodenBucket.Weight = 250;
                fullWoodenBucket.Model = 1610;

                fullWoodenBucket.Object_Type = (int)eObjectType.GenericItem;
                fullWoodenBucket.Id_nb = "full_wooden_bucket";
                fullWoodenBucket.Price = 0;
                fullWoodenBucket.IsPickable = false;
                fullWoodenBucket.IsDropable = false;

                fullWoodenBucket.Quality = 100;
                fullWoodenBucket.Condition = 1000;
                fullWoodenBucket.MaxCondition = 1000;
                fullWoodenBucket.Durability = 1000;
                fullWoodenBucket.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(fullWoodenBucket);
            }

            // item db check
            reedBracer = GameServer.Database.FindObjectByKey<ItemTemplate>("reed_bracer");
            if (reedBracer == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Reed Bracer of Health creating it ...");
                reedBracer = new ItemTemplate();
                reedBracer.Name = "Reed Bracer";
                reedBracer.Level = 3;
                reedBracer.Weight = 1;
                reedBracer.Model = 598;

                reedBracer.Object_Type = (int)eObjectType.Magical;
                reedBracer.Item_Type = (int)eEquipmentItems.L_BRACER;
                reedBracer.Id_nb = "reed_bracer";

                reedBracer.Price = Money.GetMoney(0,0,0,0,30);
                reedBracer.IsPickable = true;
                reedBracer.IsDropable = true;

                reedBracer.Bonus = 1;
                reedBracer.Bonus1Type = (int)eProperty.MaxHealth;
                reedBracer.Bonus1 = 8;
                reedBracer.Bonus2Type = (int)eProperty.Resist_Cold;
                reedBracer.Bonus2 = 1;

                reedBracer.Quality = 100;
                reedBracer.Condition = 1000;
                reedBracer.MaxCondition = 1000;
                reedBracer.Durability = 1000;
                reedBracer.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(reedBracer);
            }

            #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));

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

            GameEventMgr.AddHandler(godelevaDowden, GameLivingEvent.Interact, new DOLEventHandler(TalkToGodelevaDowden));
            GameEventMgr.AddHandler(godelevaDowden, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToGodelevaDowden));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            godelevaDowden.AddQuestToGive(typeof(GodelevasNeed));

            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initialized");
        }
Exemple #4
0
        public static GameNPC GetMasterFrederick()
        {
            GameNPC[] npcs = WorldMgr.GetNPCsByName("Master Frederick", eRealm.Albion);

            GameNPC masterFrederick = null;

            if (npcs.Length == 0)
            {
                masterFrederick = new GameNPC();
                masterFrederick.Model = 32;
                masterFrederick.Name = "Master Frederick";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + masterFrederick.Name + ", creating him ...");
                masterFrederick.GuildName = "Part of Frederick Quests";
                masterFrederick.Realm = eRealm.Albion;
                masterFrederick.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 41);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 42);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.Cloak, 91);
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 4);
                masterFrederick.Inventory = template.CloseTemplate();
                masterFrederick.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

            //				masterFrederick.AddNPCEquipment((byte) eVisibleItems.TORSO, 41, 0, 0, 0);
            //				masterFrederick.AddNPCEquipment((byte) eVisibleItems.LEG, 42, 0, 0, 0);
            //				masterFrederick.AddNPCEquipment((byte) eVisibleItems.BOOT, 40, 0, 0, 0);
            //				masterFrederick.AddNPCEquipment((byte) eVisibleItems.CLOAK, 91, 0, 0, 0);
            //				masterFrederick.AddNPCEquipment((byte) eVisibleItems.RIGHT_HAND, 4, 0, 0, 0);

                masterFrederick.Size = 50;
                masterFrederick.Level = 50;
                masterFrederick.X = 567969;
                masterFrederick.Y = 509880;
                masterFrederick.Z = 2861;
                masterFrederick.Heading = 65;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                masterFrederick.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)
                    masterFrederick.SaveIntoDatabase();

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

            return masterFrederick;
        }
Exemple #5
0
        protected virtual void CreateMorgana()
        {
            if (Morgana == null)
            {
                Morgana = new GameNPC();
                Morgana.Model = 283;
                Morgana.Name = "Morgana";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + Morgana.Name + " , creating it ...");
                Morgana.GuildName = "";
                Morgana.Realm = eRealm.None;
                Morgana.CurrentRegionID = 1;
                Morgana.Size = 51;
                Morgana.Level = 90;
                Morgana.X = 306056;
                Morgana.Y = 670106;
                Morgana.Z = 3095;
                Morgana.Heading = 3261;

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

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 98, 43);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 133, 61);
                Morgana.Inventory = template.CloseTemplate();

            //				Morgana.AddNPCEquipment((byte) eVisibleItems.TORSO, 98, 43, 0, 0);
            //				Morgana.AddNPCEquipment((byte) eVisibleItems.BOOT, 133, 61, 0, 0);
            }

            Morgana.AddToWorld();
        }
        protected void CreateBriediClone()
        {
            GameNpcInventoryTemplate template;
            if (briediClone == null)
            {
                briediClone = new GameNPC();
                briediClone.Model = 157;
                briediClone.Name = "Master Briedi";
                briediClone.GuildName = "Part of " + questTitle + " Quest";
                briediClone.Realm = eRealm.Midgard;
                briediClone.CurrentRegionID = 100;

                briediClone.Size = 50;
                briediClone.Level = 45;
                briediClone.X = GameLocation.ConvertLocalXToGlobalX(45394, 100);
                briediClone.Y = GameLocation.ConvertLocalYToGlobalY(39768, 100);
                briediClone.Z = 4709;
                briediClone.Heading = 107;

                template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 348);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 349);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 350);
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 351);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 352);
                template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 640);
                briediClone.Inventory = template.CloseTemplate();
                briediClone.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

                //				briediClone.AddNPCEquipment((byte) eEquipmentItems.TORSO, 348, 0, 0, 0);
                //				briediClone.AddNPCEquipment((byte) eEquipmentItems.LEGS, 349, 0, 0, 0);
                //				briediClone.AddNPCEquipment((byte) eEquipmentItems.ARMS, 350, 0, 0, 0);
                //				briediClone.AddNPCEquipment((byte) eEquipmentItems.HAND, 351, 0, 0, 0);
                //				briediClone.AddNPCEquipment((byte) eEquipmentItems.FEET, 352, 0, 0, 0);
                //				briediClone.AddNPCEquipment((byte) eEquipmentItems.TWO_HANDED, 640, 0, 0, 0);

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

                briediClone.AddToWorld();

                GameEventMgr.AddHandler(briediClone, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterBriedi));
                GameEventMgr.AddHandler(briediClone, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterBriedi));
            }
            else
            {
                briediClone.MoveTo(100, GameLocation.ConvertLocalXToGlobalX(45394, 100), GameLocation.ConvertLocalYToGlobalY(39768, 100), 4709, 107);
            }

            foreach (GamePlayer visPlayer in briediClone.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                visPlayer.Out.SendEmoteAnimation(briediClone, eEmote.Bind);
            }

            for (int i = 0; i < recruits.Length; i++)
            {
                recruits[i] = new GameNPC();

                recruits[i].Name = "Recruit";

                recruits[i].GuildName = "Part of " + questTitle + " Quest";
                recruits[i].Realm = eRealm.Midgard;
                recruits[i].CurrentRegionID = briediClone.CurrentRegionID;

                recruits[i].Size = 50;
                recruits[i].Level = 6;
                recruits[i].X = briediClone.X + Util.Random(-150, 150);
                recruits[i].Y = briediClone.Y + Util.Random(-150, 150);

                recruits[i].Z = briediClone.Z;
                recruits[i].Heading = 187;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                recruits[i].SetOwnBrain(brain);
            }

            recruits[0].Name = "Recruit Hietan";
            recruits[0].Model = 189;
            template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 69);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 46);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
            template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
            template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);
            template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
            recruits[0].Inventory = template.CloseTemplate();
            recruits[0].SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.TWO_HANDED, 69, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.TORSO, 46, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.LEGS, 47, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.FEET, 50, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.ARMS, 48, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.HAND, 49, 0, 0, 0);

            recruits[1].Name = "Recruit Iduki";
            recruits[1].Model = 190;
            template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 6);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 41);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 42);
            template.AddNPCEquipment(eInventorySlot.FeetArmor, 45);
            template.AddNPCEquipment(eInventorySlot.ArmsArmor, 43);
            template.AddNPCEquipment(eInventorySlot.HandsArmor, 44);
            recruits[1].Inventory = template.CloseTemplate();
            recruits[1].SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.TWO_HANDED, 6, 0, 0, 0);
            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.TORSO, 41, 0, 0, 0);
            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.LEGS, 42, 0, 0, 0);
            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.FEET, 45, 0, 0, 0);
            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.ARMS, 43, 0, 0, 0);
            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.HAND, 44, 0, 0, 0);

            recruits[2].Name = "Recruit Odigi";
            recruits[2].Model = 774;
            template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 4);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
            recruits[2].Inventory = template.CloseTemplate();
            recruits[2].SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

            //			recruits[2].AddNPCEquipment((byte) eEquipmentItems.RIGHT_HAND, 4, 0, 0, 0);
            //			recruits[2].AddNPCEquipment((byte) eEquipmentItems.TORSO, 36, 0, 0, 0);
            //			recruits[2].AddNPCEquipment((byte) eEquipmentItems.LEGS, 37, 0, 0, 0);

            recruits[3].Name = "Recruit Thulder";
            recruits[3].Model = 775;
            template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 5);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
            recruits[3].Inventory = template.CloseTemplate();
            recruits[3].SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

            //			recruits[3].AddNPCEquipment((byte) eEquipmentItems.RIGHT_HAND, 5, 0, 0, 0);
            //			recruits[3].AddNPCEquipment((byte) eEquipmentItems.TORSO, 36, 0, 0, 0);
            //			recruits[3].AddNPCEquipment((byte) eEquipmentItems.LEGS, 37, 0, 0, 0);

            for (int i = 0; i < recruits.Length; i++)
            {
                recruits[i].AddToWorld();
            }
        }
        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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Commander Burcrif", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
                * this users Mob Database, so we simply create one ;-)
                * else we take the existing one. And if more than one exist, we take
                * the first ...
                */
            if (npcs.Length == 0)
            {
                commanderBurcrif = new GameNPC();
                commanderBurcrif.Model = 28;
                commanderBurcrif.Name = "Commander Burcrif";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + commanderBurcrif.Name + ", creating him ...");
                commanderBurcrif.GuildName = "Part of " + questTitle + " Quest";
                commanderBurcrif.Realm = eRealm.Albion;
                commanderBurcrif.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 26);
                template.AddNPCEquipment(eInventorySlot.HeadArmor, 93);
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 662);
                template.AddNPCEquipment(eInventorySlot.Cloak, 91);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);
                commanderBurcrif.Inventory = template.CloseTemplate();
                commanderBurcrif.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

                commanderBurcrif.Size = 53;
                commanderBurcrif.Level = 45;
                commanderBurcrif.X = 517270;
                commanderBurcrif.Y = 495711;
                commanderBurcrif.Z = 3352;
                commanderBurcrif.Heading = 2093;

                //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)
                    commanderBurcrif.SaveIntoDatabase();

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

            #endregion defineNPCS

            #region defineItems

            // item db check
            slithsTail = GameServer.Database.FindObjectByKey<ItemTemplate>("sliths_tail");
            if (slithsTail == null)
            {
                slithsTail = new ItemTemplate();
                slithsTail.Name = "Slith's Tail";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + slithsTail.Name + ", creating it ...");

                slithsTail.Level = 7;
                slithsTail.Weight = 10;
                slithsTail.Model = 515;

                slithsTail.Object_Type = (int)eObjectType.Magical;
                slithsTail.Item_Type = (int)eEquipmentItems.L_RING;
                slithsTail.Id_nb = "sliths_tail";
                slithsTail.Price = Money.GetMoney(0, 0, 0, 0, 30);
                slithsTail.IsPickable = true;
                slithsTail.IsDropable = true;

                slithsTail.Bonus1 = 3;
                slithsTail.Bonus1Type = (int)eProperty.Dexterity;

                slithsTail.Quality = 100;
                slithsTail.Condition = 1000;
                slithsTail.MaxCondition = 1000;
                slithsTail.Durability = 1000;
                slithsTail.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(slithsTail);
            }

            #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));

            GameEventMgr.AddHandler(commanderBurcrif, GameLivingEvent.Interact, new DOLEventHandler(TalkToCommanderBurcrif));
            GameEventMgr.AddHandler(commanderBurcrif, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToCommanderBurcrif));

            /* Now we bring to Yetta Fletcher the possibility to give this quest to players */
            commanderBurcrif.AddQuestToGive(typeof(HuntForSlith));

            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initialized");
        }
Exemple #8
0
        public static void OnScriptsCompiled(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_EXAMPLES)
                return;
            //We set a new random class
            m_rnd = new Random();

            //We create our guardmaster-trainer
            m_guardMaster = new FightingNPC();
            m_guardMaster.X = 531771;
            m_guardMaster.Y = 478755;
            m_guardMaster.Heading = 3570;
            m_guardMaster.Name = "Master Guard Trainer";
            //Now we add some nice equipment to the guard-trainer
            GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 843, 43, 13);
            template.AddNPCEquipment(eInventorySlot.Cloak, 57, 65);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 46);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
            template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);
            template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
            template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
            m_guardMaster.Inventory = template.CloseTemplate();
            m_guardMaster.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

            /*m_guardMaster.AddNPCEquipment((byte)eInventorySlot.TwoHandWeapon,843,43,13,0);
            m_guardMaster.AddNPCEquipment((byte)eInventorySlot.Cloak,57,65,0,0);
            m_guardMaster.AddNPCEquipment((byte)eInventorySlot.TorsoArmor,46,0,0,0);
            m_guardMaster.AddNPCEquipment((byte)eInventorySlot.LegsArmor,47,0,0,0);
            m_guardMaster.AddNPCEquipment((byte)eInventorySlot.ArmsArmor,48,0,0,0);
            m_guardMaster.AddNPCEquipment((byte)eInventorySlot.HandsArmor,49,0,0,0);
            m_guardMaster.AddNPCEquipment((byte)eInventorySlot.FeetArmor,50,0,0,0);
            m_guardMaster.ActiveWeaponSlot=GameLiving.eActiveWeaponSlot.TwoHanded;*/

            //Now we declare 5 guard trainees that will fight the master and
            //stand in a circle around him.
            m_guardTrainee = new FightingNPC[5];

            // same inventory template for all
            template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 843);
            template.AddNPCEquipment(eInventorySlot.Cloak, 57, 32);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
            template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
            template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
            template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
            template = template.CloseTemplate();

            for (int i = 0; i < 5; i++)
            {
                //Create a trainee
                m_guardTrainee[i] = new FightingNPC();
                m_guardTrainee[i].Name = "Guard Trainee";
                //Add some equipment to our trainee
                m_guardTrainee[i].Inventory = template;
                m_guardTrainee[i].SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

                /*m_guardTrainee[i].AddNPCEquipment((byte)eVisibleItems.TWO_HANDED,843,0,0,0);
                m_guardTrainee[i].AddNPCEquipment((byte)eVisibleItems.CLOAK,57,32,0,0);
                m_guardTrainee[i].AddNPCEquipment((byte)eVisibleItems.TORSO,36,0,0,0);
                m_guardTrainee[i].AddNPCEquipment((byte)eVisibleItems.LEG,37,0,0,0);
                m_guardTrainee[i].AddNPCEquipment((byte)eVisibleItems.ARMS,38,0,0,0);
                m_guardTrainee[i].AddNPCEquipment((byte)eVisibleItems.HAND,39,0,0,0);
                m_guardTrainee[i].AddNPCEquipment((byte)eVisibleItems.BOOT,40,0,0,0);
                m_guardTrainee[i].ActiveWeaponSlot=GameLiving.eActiveWeaponSlot.TwoHanded;*/

                //Our trainee will face the master in combat position
                m_guardTrainee[i].TargetObject = m_guardMaster;
            }

            //We set the position, model and size of our trainees
            m_guardTrainee[0].X = m_guardMaster.X - 70;
            m_guardTrainee[0].Y = m_guardMaster.Y - 66;
            m_guardTrainee[0].Heading = m_guardTrainee[0].GetHeading( m_guardMaster );
            m_guardTrainee[0].Model = (ushort) m_rnd.Next(32, 55);
            m_guardTrainee[0].Size = (byte) (45 + m_rnd.Next(10));

            m_guardTrainee[1].X = m_guardMaster.X + 76;
            m_guardTrainee[1].Y = m_guardMaster.Y - 29;
            m_guardTrainee[1].Heading = m_guardTrainee[1].GetHeading( m_guardMaster );
            ;
            m_guardTrainee[1].Model = (ushort) m_rnd.Next(32, 55);
            m_guardTrainee[1].Size = (byte) (45 + m_rnd.Next(10));

            m_guardTrainee[2].X = m_guardMaster.X - 110;
            m_guardTrainee[2].Y = m_guardMaster.Y + 22;
            m_guardTrainee[2].Heading = m_guardTrainee[2].GetHeading( m_guardMaster );
            ;
            m_guardTrainee[2].Model = (ushort) m_rnd.Next(32, 55);
            m_guardTrainee[2].Size = (byte) (45 + m_rnd.Next(10));

            m_guardTrainee[3].X = m_guardMaster.X - 34;
            m_guardTrainee[3].Y = m_guardMaster.Y + 88;
            m_guardTrainee[3].Heading = m_guardTrainee[3].GetHeading( m_guardMaster );
            ;
            m_guardTrainee[3].Model = (ushort) m_rnd.Next(32, 55);
            m_guardTrainee[3].Size = (byte) (45 + m_rnd.Next(10));

            m_guardTrainee[4].X = m_guardMaster.X + 52;
            m_guardTrainee[4].Y = m_guardMaster.Y + 64;
            m_guardTrainee[4].Heading = m_guardTrainee[4].GetHeading( m_guardMaster );
            ;
            m_guardTrainee[4].Model = (ushort) m_rnd.Next(32, 55);
            m_guardTrainee[4].Size = (byte) (45 + m_rnd.Next(10));

            //Now we try to add the master and all trainees to the world
            bool good = true;
            if (!m_guardMaster.AddToWorld())
                good = false;
            for (int i = 0; i < 5; i++)
                if (!m_guardTrainee[i].AddToWorld())
                    good = false;

            //We start our fight timer that will make the guards
            //act each second
            m_fightTimer = new Timer(1000);
            m_fightTimer.AutoReset = true;
            m_fightTimer.Elapsed += new ElapsedEventHandler(MakeAttackSequence);
            m_fightTimer.Start();

            if (log.IsInfoEnabled)
                if (log.IsInfoEnabled)
                    log.Info("FightingNPCEvent initialized: "+good);
        }
Exemple #9
0
        public void OnCommand(GameClient client, string[] args)
        {
            bool getcloak;

            if (Util.Random(1) == 0)
            {
                getcloak = false;
            }
            else
            {
                getcloak = true;
            }

            if (args.Length < 2)
            {
                DisplaySyntax(client);
                return;
            }

            string ClasseEpic = "";
            ushort color      = 0;
            ushort color1     = 0;
            ushort color2     = 0;
            ushort color3     = 0;
            ushort color4     = 0;
            ushort color5     = 0;
            ushort color6     = 0;
            ushort sloti      = 999;
            byte   slotb      = 0x00;

            if (args.Length >= 2)
            {
                // Epic Argument
                if (args[1] == "epic")
                {
                    if (args.Length < 3)
                    {
                        DisplaySyntax(client);
                        return;
                    }
                    if (args.Length > 4 && args.Length < 10)
                    {
                        DisplaySyntax(client);
                        return;
                    }
                    ClasseEpic = args[2];
                    if (args.Length >= 4)
                    {
                        color = Convert.ToUInt16(args[3]);
                    }
                    if (args.Length > 4)
                    {
                        color1 = Convert.ToUInt16(args[4]);
                        color2 = Convert.ToUInt16(args[5]);
                        color3 = Convert.ToUInt16(args[6]);
                        color4 = Convert.ToUInt16(args[7]);
                        color5 = Convert.ToUInt16(args[8]);
                        color6 = Convert.ToUInt16(args[9]);
                    }
                }
                else if (args[1] == "equip")
                {
                    // equip Argument
                    if (args.Length < 3)
                    {
                        DisplaySyntax(client);
                        return;
                    }
                    slotb = Convert.ToByte(Convert.ToUInt16(args[2]));
                    ushort z = 0;
                    foreach (byte finded in slots)
                    {
                        if (finded == slotb)
                        {
                            sloti = z;
                        }
                        z++;
                    }
                    if (sloti == 999)
                    {
                        DisplaySyntax(client);
                        return;
                    }
                    if (args.Length > 3)
                    {
                        color = Convert.ToUInt16(args[3]);
                    }
                }
                else
                {
                    // Armor and Claok Argument
                    if (args.Length > 3 && args.Length < 9)
                    {
                        DisplaySyntax(client);
                        return;
                    }
                    if (args.Length >= 3 && args[1] != "save")
                    {
                        color = Convert.ToUInt16(args[2]);
                    }
                    if (args.Length > 3)
                    {
                        color1 = Convert.ToUInt16(args[3]);
                        color2 = Convert.ToUInt16(args[4]);
                        color3 = Convert.ToUInt16(args[5]);
                        color4 = Convert.ToUInt16(args[6]);
                        color5 = Convert.ToUInt16(args[7]);
                        color6 = Convert.ToUInt16(args[8]);
                    }
                }
            }
            int[] colorArray = { color1, color2, color3, color4, color5, color6 };

            GameNPC npc = null;

            if (client.Player.TargetObject is GameNPC)
            {
                npc = (GameNPC)client.Player.TargetObject;
            }

            GameNpcInventoryTemplate template = npc.Inventory as GameNpcInventoryTemplate;

            if (template == null)
            {
                template = new GameNpcInventoryTemplate();
            }

            if (args[1] != "epic")
            {
                switch (args[1])
                {
                case "random":
                {
                    Clear(npc);
                    template = new GameNpcInventoryTemplate();
                    for (int i = 0; i < 6; i++)
                    {
                        if (args.Length > 2)
                        {
                            if (args.Length == 3)
                            {
                                switch (Util.Random(5))
                                {
                                case 0:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[0][i][Util.Random(armor[0][i].Length - 1)], color, 0);
                                    break;

                                case 1:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[1][i][Util.Random(armor[1][i].Length - 1)], color, 0);
                                    break;

                                case 2:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[2][i][Util.Random(armor[2][i].Length - 1)], color, 0);
                                    break;

                                case 3:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[3][i][Util.Random(armor[3][i].Length - 1)], color, 0);
                                    break;

                                case 4:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[4][i][Util.Random(armor[4][i].Length - 1)], color, 0);
                                    break;

                                case 5:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[5][i][Util.Random(armor[5][i].Length - 1)], color, 0);
                                    break;
                                }
                            }
                            else
                            {
                                switch (Util.Random(5))
                                {
                                case 0:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[0][i][Util.Random(armor[0][i].Length - 1)], colorArray[i], 0);
                                    break;

                                case 1:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[1][i][Util.Random(armor[1][i].Length - 1)], colorArray[i], 0);
                                    break;

                                case 2:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[2][i][Util.Random(armor[2][i].Length - 1)], colorArray[i], 0);
                                    break;

                                case 3:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[3][i][Util.Random(armor[3][i].Length - 1)], colorArray[i], 0);
                                    break;

                                case 4:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[4][i][Util.Random(armor[4][i].Length - 1)], colorArray[i], 0);
                                    break;

                                case 5:
                                    template.AddNPCEquipment((eInventorySlot)slots[i], armor[5][i][Util.Random(armor[5][i].Length - 1)], colorArray[i], 0);
                                    break;
                                }
                            }
                        }
                        else
                        {
                            switch (Util.Random(5))
                            {
                            case 0:
                                template.AddNPCEquipment((eInventorySlot)slots[i], armor[0][i][Util.Random(armor[0][i].Length - 1)], Util.Random(86), 0);
                                break;

                            case 1:
                                template.AddNPCEquipment((eInventorySlot)slots[i], armor[1][i][Util.Random(armor[1][i].Length - 1)], Util.Random(86), 0);
                                break;

                            case 2:
                                template.AddNPCEquipment((eInventorySlot)slots[i], armor[2][i][Util.Random(armor[2][i].Length - 1)], Util.Random(86), 0);
                                break;

                            case 3:
                                template.AddNPCEquipment((eInventorySlot)slots[i], armor[3][i][Util.Random(armor[3][i].Length - 1)], Util.Random(86), 0);
                                break;

                            case 4:
                                template.AddNPCEquipment((eInventorySlot)slots[i], armor[4][i][Util.Random(armor[4][i].Length - 1)], Util.Random(86), 0);
                                break;

                            case 5:
                                template.AddNPCEquipment((eInventorySlot)slots[i], armor[5][i][Util.Random(armor[5][i].Length - 1)], Util.Random(86), 0);
                                break;
                            }
                        }
                    }
                    if (getcloak)
                    {
                        goto case "cloak";
                    }
                    else
                    {
                        break;
                    }
                }

                case "cloth":
                {
                    Clear(npc);
                    template = new GameNpcInventoryTemplate();
                    if (args.Length > 2)
                    {
                        if (args.Length == 3)
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[0][0][Util.Random(armor[0][0].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[0][1][Util.Random(armor[0][1].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[0][2][Util.Random(armor[0][2].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[0][3][Util.Random(armor[0][3].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[0][4][Util.Random(armor[0][4].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[0][5][Util.Random(armor[0][5].Length - 1)], color, 0);
                        }
                        else
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[0][0][Util.Random(armor[0][0].Length - 1)], color1, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[0][1][Util.Random(armor[0][1].Length - 1)], color2, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[0][2][Util.Random(armor[0][2].Length - 1)], color3, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[0][3][Util.Random(armor[0][3].Length - 1)], color4, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[0][4][Util.Random(armor[0][4].Length - 1)], color5, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[0][5][Util.Random(armor[0][5].Length - 1)], color6, 0);
                        }
                    }
                    else
                    {
                        template.AddNPCEquipment((eInventorySlot)slots[0], armor[0][0][Util.Random(armor[0][0].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[1], armor[0][1][Util.Random(armor[0][1].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[2], armor[0][2][Util.Random(armor[0][2].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[3], armor[0][3][Util.Random(armor[0][3].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[4], armor[0][4][Util.Random(armor[0][4].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[5], armor[0][5][Util.Random(armor[0][5].Length - 1)], Util.Random(86), 0);
                    }
                    if (getcloak)
                    {
                        goto case "cloak";
                    }
                    else
                    {
                        break;
                    }
                }

                case "leather":
                {
                    Clear(npc);
                    template = new GameNpcInventoryTemplate();
                    if (args.Length > 2)
                    {
                        if (args.Length == 3)
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[1][0][Util.Random(armor[1][0].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[1][1][Util.Random(armor[1][1].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[1][2][Util.Random(armor[1][2].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[1][3][Util.Random(armor[1][3].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[1][4][Util.Random(armor[1][4].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[1][5][Util.Random(armor[1][5].Length - 1)], color, 0);
                        }
                        else
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[1][0][Util.Random(armor[1][0].Length - 1)], color1, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[1][1][Util.Random(armor[1][1].Length - 1)], color2, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[1][2][Util.Random(armor[1][2].Length - 1)], color3, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[1][3][Util.Random(armor[1][3].Length - 1)], color4, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[1][4][Util.Random(armor[1][4].Length - 1)], color5, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[1][5][Util.Random(armor[1][5].Length - 1)], color6, 0);
                        }
                    }
                    else
                    {
                        template.AddNPCEquipment((eInventorySlot)slots[0], armor[1][0][Util.Random(armor[1][0].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[1], armor[1][1][Util.Random(armor[1][1].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[2], armor[1][2][Util.Random(armor[1][2].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[3], armor[1][3][Util.Random(armor[1][3].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[4], armor[1][4][Util.Random(armor[1][4].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[5], armor[1][5][Util.Random(armor[1][5].Length - 1)], Util.Random(86), 0);
                    }
                    if (getcloak)
                    {
                        goto case "cloak";
                    }
                    else
                    {
                        break;
                    }
                }

                case "studded":
                {
                    Clear(npc);
                    template = new GameNpcInventoryTemplate();
                    if (args.Length > 2)
                    {
                        if (args.Length == 3)
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[2][0][Util.Random(armor[2][0].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[2][1][Util.Random(armor[2][1].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[2][2][Util.Random(armor[2][2].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[2][3][Util.Random(armor[2][3].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[2][4][Util.Random(armor[2][4].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[2][5][Util.Random(armor[2][5].Length - 1)], color, 0);
                        }
                        else
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[2][0][Util.Random(armor[2][0].Length - 1)], color1, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[2][1][Util.Random(armor[2][1].Length - 1)], color2, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[2][2][Util.Random(armor[2][2].Length - 1)], color3, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[2][3][Util.Random(armor[2][3].Length - 1)], color4, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[2][4][Util.Random(armor[2][4].Length - 1)], color5, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[2][5][Util.Random(armor[2][5].Length - 1)], color6, 0);
                        }
                    }
                    else
                    {
                        template.AddNPCEquipment((eInventorySlot)slots[0], armor[2][0][Util.Random(armor[2][0].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[1], armor[2][1][Util.Random(armor[2][1].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[2], armor[2][2][Util.Random(armor[2][2].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[3], armor[2][3][Util.Random(armor[2][3].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[4], armor[2][4][Util.Random(armor[2][4].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[5], armor[2][5][Util.Random(armor[2][5].Length - 1)], Util.Random(86), 0);
                    }
                    if (getcloak)
                    {
                        goto case "cloak";
                    }
                    else
                    {
                        break;
                    }
                }

                case "chain":
                {
                    Clear(npc);
                    template = new GameNpcInventoryTemplate();
                    if (args.Length > 2)
                    {
                        if (args.Length == 3)
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[3][0][Util.Random(armor[3][0].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[3][1][Util.Random(armor[3][1].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[3][2][Util.Random(armor[3][2].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[3][3][Util.Random(armor[3][3].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[3][4][Util.Random(armor[3][4].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[3][5][Util.Random(armor[3][5].Length - 1)], color, 0);
                        }
                        else
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[3][0][Util.Random(armor[3][0].Length - 1)], color1, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[3][1][Util.Random(armor[3][1].Length - 1)], color2, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[3][2][Util.Random(armor[3][2].Length - 1)], color3, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[3][3][Util.Random(armor[3][3].Length - 1)], color4, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[3][4][Util.Random(armor[3][4].Length - 1)], color5, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[3][5][Util.Random(armor[3][5].Length - 1)], color6, 0);
                        }
                    }
                    else
                    {
                        template.AddNPCEquipment((eInventorySlot)slots[0], armor[3][0][Util.Random(armor[3][0].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[1], armor[3][1][Util.Random(armor[3][1].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[2], armor[3][2][Util.Random(armor[3][2].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[3], armor[3][3][Util.Random(armor[3][3].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[4], armor[3][4][Util.Random(armor[3][4].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[5], armor[3][5][Util.Random(armor[3][5].Length - 1)], Util.Random(86), 0);
                    }
                    if (getcloak)
                    {
                        goto case "cloak";
                    }
                    else
                    {
                        break;
                    }
                }

                case "scale":
                {
                    Clear(npc);
                    template = new GameNpcInventoryTemplate();
                    if (args.Length > 2)
                    {
                        if (args.Length == 3)
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[4][0][Util.Random(armor[4][0].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[4][1][Util.Random(armor[4][1].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[4][2][Util.Random(armor[4][2].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[4][3][Util.Random(armor[4][3].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[4][4][Util.Random(armor[4][4].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[4][5][Util.Random(armor[4][5].Length - 1)], color, 0);
                        }
                        else
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[4][0][Util.Random(armor[4][0].Length - 1)], color1, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[4][1][Util.Random(armor[4][1].Length - 1)], color2, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[4][2][Util.Random(armor[4][2].Length - 1)], color3, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[4][3][Util.Random(armor[4][3].Length - 1)], color4, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[4][4][Util.Random(armor[4][4].Length - 1)], color5, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[4][5][Util.Random(armor[4][5].Length - 1)], color6, 0);
                        }
                    }
                    else
                    {
                        template.AddNPCEquipment((eInventorySlot)slots[0], armor[4][0][Util.Random(armor[4][0].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[1], armor[4][1][Util.Random(armor[4][1].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[2], armor[4][2][Util.Random(armor[4][2].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[3], armor[4][3][Util.Random(armor[4][3].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[4], armor[4][4][Util.Random(armor[4][4].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[5], armor[4][5][Util.Random(armor[4][5].Length - 1)], Util.Random(86), 0);
                    }
                    if (getcloak)
                    {
                        goto case "cloak";
                    }
                    else
                    {
                        break;
                    }
                }

                case "plate":
                {
                    Clear(npc);
                    template = new GameNpcInventoryTemplate();
                    if (args.Length > 2)
                    {
                        if (args.Length == 3)
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[5][0][Util.Random(armor[5][0].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[5][1][Util.Random(armor[5][1].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[5][2][Util.Random(armor[5][2].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[5][3][Util.Random(armor[5][3].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[5][4][Util.Random(armor[5][4].Length - 1)], color, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[5][5][Util.Random(armor[5][5].Length - 1)], color, 0);
                        }
                        else
                        {
                            template.AddNPCEquipment((eInventorySlot)slots[0], armor[5][0][Util.Random(armor[5][0].Length - 1)], color1, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[1], armor[5][1][Util.Random(armor[5][1].Length - 1)], color2, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[2], armor[5][2][Util.Random(armor[5][2].Length - 1)], color3, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[3], armor[5][3][Util.Random(armor[5][3].Length - 1)], color4, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[4], armor[5][4][Util.Random(armor[5][4].Length - 1)], color5, 0);
                            template.AddNPCEquipment((eInventorySlot)slots[5], armor[5][5][Util.Random(armor[5][5].Length - 1)], color6, 0);
                        }
                    }
                    else
                    {
                        template.AddNPCEquipment((eInventorySlot)slots[0], armor[5][0][Util.Random(armor[5][0].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[1], armor[5][1][Util.Random(armor[5][1].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[2], armor[5][2][Util.Random(armor[5][2].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[3], armor[5][3][Util.Random(armor[5][3].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[4], armor[5][4][Util.Random(armor[5][4].Length - 1)], Util.Random(86), 0);
                        template.AddNPCEquipment((eInventorySlot)slots[5], armor[5][5][Util.Random(armor[5][5].Length - 1)], Util.Random(86), 0);
                    }
                    if (getcloak)
                    {
                        goto case "cloak";
                    }
                    else
                    {
                        break;
                    }
                }

                case "cloak":
                {
                    if (args.Length > 2)
                    {
                        template.RemoveNPCEquipment((eInventorySlot)slots[6]);
                        template.AddNPCEquipment((eInventorySlot)slots[6], cloak[Util.Random(cloak.Length - 1)], color, 0);
                    }
                    else
                    {
                        template.RemoveNPCEquipment((eInventorySlot)slots[6]);
                        template.AddNPCEquipment((eInventorySlot)slots[6], cloak[Util.Random(cloak.Length - 1)], Util.Random(86), 0);
                    }
                    break;
                }

                case "equip":
                {
                    if (args.Length > 3)
                    {
                        template.RemoveNPCEquipment((eInventorySlot)slots[sloti]);
                        template.AddNPCEquipment((eInventorySlot)slots[sloti], equip[sloti][Util.Random(equip[sloti].Length - 1)], color, 0);
                    }
                    else
                    {
                        template.RemoveNPCEquipment((eInventorySlot)slots[sloti]);
                        template.AddNPCEquipment((eInventorySlot)slots[sloti], equip[sloti][Util.Random(equip[sloti].Length - 1)], Util.Random(86), 0);
                    }
                    if (sloti == 7 || sloti == 8)
                    {
                        npc.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);
                    }
                    if (sloti == 9)
                    {
                        npc.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);
                    }
                    if (sloti == 10)
                    {
                        npc.SwitchWeapon(GameLiving.eActiveWeaponSlot.Distance);
                    }
                    break;
                }

                case "save":
                {
                    if (args.Length == 3)
                    {
                        Save(client, npc, args[2]);
                        break;
                    }
                    if (args.Length == 2)
                    {
                        Save(npc);
                        break;
                    }
                    DisplaySyntax(client); break;
                }

                default: DisplaySyntax(client); break;
                }
            }
            else
            {
                // Epic
                Clear(npc);
                template = new GameNpcInventoryTemplate();

                ItemTemplate tgeneric0 = (ItemTemplate)GameServer.Database.FindObjectByKey <ItemTemplate> (ClasseEpic + "EpicHelm");
                ItemTemplate tgeneric1 = (ItemTemplate)GameServer.Database.FindObjectByKey <ItemTemplate> (ClasseEpic + "EpicGloves");
                ItemTemplate tgeneric2 = (ItemTemplate)GameServer.Database.FindObjectByKey <ItemTemplate> (ClasseEpic + "EpicArms");
                ItemTemplate tgeneric3 = (ItemTemplate)GameServer.Database.FindObjectByKey <ItemTemplate> (ClasseEpic + "EpicVest");
                ItemTemplate tgeneric4 = (ItemTemplate)GameServer.Database.FindObjectByKey <ItemTemplate> (ClasseEpic + "EpicLegs");
                ItemTemplate tgeneric5 = (ItemTemplate)GameServer.Database.FindObjectByKey <ItemTemplate> (ClasseEpic + "EpicBoots");

                if (args.Length > 3)
                {
                    if (args.Length == 4)
                    {
                        template.AddNPCEquipment((eInventorySlot)slots[0], Convert.ToUInt16(tgeneric0.Model), color, 0);
                        template.AddNPCEquipment((eInventorySlot)slots[1], Convert.ToUInt16(tgeneric1.Model), color, 0);
                        template.AddNPCEquipment((eInventorySlot)slots[2], Convert.ToUInt16(tgeneric2.Model), color, 0);
                        template.AddNPCEquipment((eInventorySlot)slots[3], Convert.ToUInt16(tgeneric3.Model), color, 0);
                        template.AddNPCEquipment((eInventorySlot)slots[4], Convert.ToUInt16(tgeneric4.Model), color, 0);
                        template.AddNPCEquipment((eInventorySlot)slots[5], Convert.ToUInt16(tgeneric5.Model), color, 0);
                    }
                    else
                    {
                        template.AddNPCEquipment((eInventorySlot)slots[0], Convert.ToUInt16(tgeneric0.Model), color1, 0);
                        template.AddNPCEquipment((eInventorySlot)slots[1], Convert.ToUInt16(tgeneric1.Model), color2, 0);
                        template.AddNPCEquipment((eInventorySlot)slots[2], Convert.ToUInt16(tgeneric2.Model), color3, 0);
                        template.AddNPCEquipment((eInventorySlot)slots[3], Convert.ToUInt16(tgeneric3.Model), color4, 0);
                        template.AddNPCEquipment((eInventorySlot)slots[4], Convert.ToUInt16(tgeneric4.Model), color5, 0);
                        template.AddNPCEquipment((eInventorySlot)slots[5], Convert.ToUInt16(tgeneric5.Model), color6, 0);
                    }
                }
                else
                {
                    template.AddNPCEquipment((eInventorySlot)slots[0], Convert.ToUInt16(tgeneric0.Model), Util.Random(86), 0);
                    template.AddNPCEquipment((eInventorySlot)slots[1], Convert.ToUInt16(tgeneric1.Model), Util.Random(86), 0);
                    template.AddNPCEquipment((eInventorySlot)slots[2], Convert.ToUInt16(tgeneric2.Model), Util.Random(86), 0);
                    template.AddNPCEquipment((eInventorySlot)slots[3], Convert.ToUInt16(tgeneric3.Model), Util.Random(86), 0);
                    template.AddNPCEquipment((eInventorySlot)slots[4], Convert.ToUInt16(tgeneric4.Model), Util.Random(86), 0);
                    template.AddNPCEquipment((eInventorySlot)slots[5], Convert.ToUInt16(tgeneric5.Model), Util.Random(86), 0);
                }
                if (args.Length > 3)
                {
                    template.RemoveNPCEquipment((eInventorySlot)slots[6]);
                    template.AddNPCEquipment((eInventorySlot)slots[6], cloak[Util.Random(cloak.Length - 1)], color, 0);
                }
                else
                {
                    template.RemoveNPCEquipment((eInventorySlot)slots[6]);
                    template.AddNPCEquipment((eInventorySlot)slots[6], cloak[Util.Random(cloak.Length - 1)], Util.Random(86), 0);
                }
            }
            npc.Inventory = template;
            npc.BroadcastLivingEquipmentUpdate();
            return;
        }
Exemple #10
0
        public static GameNPC GetMasterFrederick()
        {
            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Master Frederick", eRealm.Albion);

            GameNPC masterFrederick = null;

            if (npcs.Length == 0)
            {
                masterFrederick       = new GameNPC();
                masterFrederick.Model = 32;
                masterFrederick.Name  = "Master Frederick";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + masterFrederick.Name + ", creating him ...");
                }

                masterFrederick.GuildName       = "Part of Frederick Quests";
                masterFrederick.Realm           = eRealm.Albion;
                masterFrederick.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 41);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 42);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.Cloak, 91);
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 4);
                masterFrederick.Inventory = template.CloseTemplate();
                masterFrederick.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

// masterFrederick.AddNPCEquipment((byte) eVisibleItems.TORSO, 41, 0, 0, 0);
//              masterFrederick.AddNPCEquipment((byte) eVisibleItems.LEG, 42, 0, 0, 0);
//              masterFrederick.AddNPCEquipment((byte) eVisibleItems.BOOT, 40, 0, 0, 0);
//              masterFrederick.AddNPCEquipment((byte) eVisibleItems.CLOAK, 91, 0, 0, 0);
//              masterFrederick.AddNPCEquipment((byte) eVisibleItems.RIGHT_HAND, 4, 0, 0, 0);
                masterFrederick.Size    = 50;
                masterFrederick.Level   = 50;
                masterFrederick.X       = 567969;
                masterFrederick.Y       = 509880;
                masterFrederick.Z       = 2861;
                masterFrederick.Heading = 65;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                masterFrederick.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)
                {
                    masterFrederick.SaveIntoDatabase();
                }

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

            return(masterFrederick);
        }
Exemple #11
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 ...");
            }

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Sir Strain", eRealm.Albion);

            if (npcs == null || npcs.Length == 0)
            {
                sirStrain       = new GameNPC();
                sirStrain.Model = 28;
                sirStrain.Name  = "Sir Strain";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + sirStrain.Name + ", creating him ...");
                }
                sirStrain.GuildName       = "Part of " + questTitle + " Quest";
                sirStrain.Realm           = eRealm.Albion;
                sirStrain.CurrentRegionID = 27;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 696);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 697);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 693);
                template.AddNPCEquipment(eInventorySlot.Cloak, 676);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 694);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 695);
                sirStrain.Inventory = template.CloseTemplate();
                sirStrain.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

                sirStrain.Size    = 50;
                sirStrain.Level   = 50;
                sirStrain.X       = 98507;
                sirStrain.Y       = 90637;
                sirStrain.Z       = 5716;
                sirStrain.Heading = 147;

                //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)
                {
                    sirStrain.SaveIntoDatabase();
                }

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

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

            GameEventMgr.AddHandler(sirStrain, GameLivingEvent.Interact, new DOLEventHandler(TalkToSirStrain));
            GameEventMgr.AddHandler(sirStrain, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToSirStrain));

            sirStrain.AddQuestToGive(typeof(GreetingsPaladin));

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


            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.ANewHeroesWelcome.ScriptLoaded.Text1"), eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                MasterClaistan       = new GameNPC();
                MasterClaistan.Model = 33;
                MasterClaistan.Name  = LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.ANewHeroesWelcome.ScriptLoaded.Text1");
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + MasterClaistan.Name + ", creating him ...");
                }
                //MasterClaistan.GuildName = "Part of " + questTitle + " Quest";
                MasterClaistan.Realm           = eRealm.Albion;
                MasterClaistan.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                MasterClaistan.Inventory = template.CloseTemplate();
                MasterClaistan.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                MasterClaistan.Size    = 52;
                MasterClaistan.Level   = 51;
                MasterClaistan.X       = 562190;
                MasterClaistan.Y       = 512571;
                MasterClaistan.Z       = 2500;
                MasterClaistan.Heading = 1592;

                //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)
                {
                    MasterClaistan.SaveIntoDatabase();
                }

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

            //Pompin The Crier
            npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.ANewHeroesWelcome.ScriptLoaded.Text2"), eRealm.Albion);
            if (npcs.Length == 0)
            {
                PompinTheCrier       = new GameNPC();
                PompinTheCrier.Model = 10;
                PompinTheCrier.Name  = LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.ANewHeroesWelcome.ScriptLoaded.Text2");
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + PompinTheCrier.Name + ", creating him ...");
                }
                //MasterClaistan.GuildName = "Part of " + questTitle + " Quest";
                PompinTheCrier.Realm           = eRealm.Albion;
                PompinTheCrier.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                PompinTheCrier.Inventory = template.CloseTemplate();
                PompinTheCrier.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                PompinTheCrier.Size    = 50;
                PompinTheCrier.Level   = 5;
                PompinTheCrier.X       = 560484;
                PompinTheCrier.Y       = 511756;
                PompinTheCrier.Z       = 2344;
                PompinTheCrier.Heading = 420;

                //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)
                {
                    PompinTheCrier.SaveIntoDatabase();
                }

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

            #endregion

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

            GameEventMgr.AddHandler(MasterClaistan, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterClaistan));
            GameEventMgr.AddHandler(MasterClaistan, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterClaistan));

            GameEventMgr.AddHandler(PompinTheCrier, GameLivingEvent.Interact, new DOLEventHandler(TalkToPompinTheCrier));
            GameEventMgr.AddHandler(PompinTheCrier, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToPompinTheCrier));

            MasterClaistan.AddQuestToGive(typeof(ANewHeroesWelcome));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Exemple #13
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");
            }
        }
Exemple #14
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }
            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }


            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Sir Dorian", eRealm.Albion);

            if (npcs.Length == 0)
            {
                sirDorian       = new GameNPC();
                sirDorian.Model = 28;
                sirDorian.Name  = "Sir Dorian";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + sirDorian.Name + ", creating him ...");
                }
                //k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                //sirDorian.GuildName = "Part of " + questTitle + " Quest";
                sirDorian.Realm           = eRealm.Albion;
                sirDorian.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 46);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);
                sirDorian.Inventory = template.CloseTemplate();
                sirDorian.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                sirDorian.Size    = 52;
                sirDorian.Level   = 40;
                sirDorian.X       = 560869;
                sirDorian.Y       = 511737;
                sirDorian.Z       = 2344;
                sirDorian.Heading = 2930;

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

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

            #endregion

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

            GameEventMgr.AddHandler(sirDorian, GameLivingEvent.Interact, new DOLEventHandler(TalkTosirDorian));
            GameEventMgr.AddHandler(sirDorian, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkTosirDorian));

            sirDorian.AddQuestToGive(typeof(DredgeUpAPledge));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
        public override void Notify(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null || player.IsDoingQuest(typeof (RevengeTheOtherWhiteMeat)) == null)
                return;

            if (e == GameLivingEvent.EnemyKilled)
            {
                if(Step == 2)
                {
                    EnemyKilledEventArgs gArgs = (EnemyKilledEventArgs) args;
                    if (gArgs.Target.Name == "Wilbur")
                    {
                        player.Out.SendDialogBox(eDialogCode.SimpleWarning, 0x00, 0x00, 0x00, 0x00, eDialogType.Ok, true, "You've succeeded in killing Wilbur. In the \ndistance you hear the angry voice of \na pig herder. Make your escape!");
                        Step = 3;

                        player.GainExperience(GameLiving.eXPSource.Quest, player.ExperienceForNextLevel / 25, true);

                        GameNPC pigHerderWyatt = new GameNPC();
                        pigHerderWyatt.Model = 39;
                        pigHerderWyatt.Name = "Pig Herder Wyatt";
                        pigHerderWyatt.Realm = eRealm.Albion;
                        pigHerderWyatt.CurrentRegionID = 1;

                        GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                        template.AddNPCEquipment(eInventorySlot.FeetArmor, 143);
                        template.AddNPCEquipment(eInventorySlot.TorsoArmor, 1005);
                        pigHerderWyatt.Inventory = template.CloseTemplate();
                        pigHerderWyatt.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                        pigHerderWyatt.Size = 54;
                        pigHerderWyatt.Level = 33;
                        pigHerderWyatt.X = wilburSpawnLocation.X - 1000;
                        pigHerderWyatt.Y = wilburSpawnLocation.Y + 1500;
                        pigHerderWyatt.Z = wilburSpawnLocation.Z;
                        pigHerderWyatt.Heading = 2548;
                        pigHerderWyatt.AddToWorld();

                        GameEventMgr.AddHandler(pigHerderWyatt, GameNPCEvent.ArriveAtTarget, new DOLEventHandler(OnCloseToDeadWilbur));
                        pigHerderWyatt.WalkTo(gArgs.Target.X - 90, gArgs.Target.Y + 90, gArgs.Target.Z, 200);

                        return;
                    }
                }
            }
        }
Exemple #16
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 ...");
            }

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Captain Kinzee", eRealm.Albion);

            if (npcs == null || npcs.Length == 0)
            {
                captainKinzee       = new GameNPC();
                captainKinzee.Model = 39;
                captainKinzee.Name  = "Captain Kinzee";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + captainKinzee.Name + ", creating him ...");
                }
                captainKinzee.GuildName       = "Part of " + questTitle + " Quest";
                captainKinzee.Realm           = eRealm.Albion;
                captainKinzee.CurrentRegionID = 27;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 691);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 692);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 688);
                template.AddNPCEquipment(eInventorySlot.Cloak, 676);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 689);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 690);
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 3294);
                captainKinzee.Inventory = template.CloseTemplate();
                captainKinzee.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                captainKinzee.Size    = 50;
                captainKinzee.Level   = 50;
                captainKinzee.X       = 98343;
                captainKinzee.Y       = 90564;
                captainKinzee.Z       = 5716;
                captainKinzee.Heading = 3698;

                //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)
                {
                    captainKinzee.SaveIntoDatabase();
                }

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

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

            GameEventMgr.AddHandler(captainKinzee, GameLivingEvent.Interact, new DOLEventHandler(TalkToCaptainKinzee));
            GameEventMgr.AddHandler(captainKinzee, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToCaptainKinzee));

            captainKinzee.AddQuestToGive(typeof(GreetingsArmsman));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Brother Lawrence", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
                * this users Mob Database, so we simply create one ;-)
                * else we take the existing one. And if more than one exist, we take
                * the first ...
                */
            if (npcs.Length == 0)
            {
                brotherLawrence = new GameHealer();
                brotherLawrence.Model = 32;
                brotherLawrence.Name = "Brother Lawrence";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + brotherLawrence.Name + ", creating him ...");
                brotherLawrence.GuildName = "Part of " + questTitle + " Quest";
                brotherLawrence.Realm = eRealm.Albion;
                brotherLawrence.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 14, 20);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 98, 44);
                brotherLawrence.Inventory = template.CloseTemplate();
                brotherLawrence.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                brotherLawrence.Size = 54;
                brotherLawrence.Level = 29;
                brotherLawrence.X = 560559;
                brotherLawrence.Y = 511892;
                brotherLawrence.Z = 2344;
                brotherLawrence.Heading = 662;

                //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)
                    brotherLawrence.SaveIntoDatabase();

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

            #endregion

            #region defineItems

            // item db check
            lawrencesEmptyFlask = GameServer.Database.FindObjectByKey<ItemTemplate>("lawrences_empty_flask");
            if (lawrencesEmptyFlask == null)
            {
                lawrencesEmptyFlask = new ItemTemplate();
                lawrencesEmptyFlask.Name = "Lawrence's Empty Flask";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find "+lawrencesEmptyFlask.Name+", creating it ...");

                lawrencesEmptyFlask.Level = 0;
                lawrencesEmptyFlask.Weight = 1;
                lawrencesEmptyFlask.Model = 490;

                lawrencesEmptyFlask.Object_Type = (int) eObjectType.GenericItem;
                lawrencesEmptyFlask.Id_nb = "lawrences_empty_flask";
                lawrencesEmptyFlask.Price = 0;
                lawrencesEmptyFlask.IsPickable = false;
                lawrencesEmptyFlask.IsDropable = false;

                lawrencesEmptyFlask.Quality = 100;
                lawrencesEmptyFlask.Condition = 1000;
                lawrencesEmptyFlask.MaxCondition = 1000;
                lawrencesEmptyFlask.Durability = 1000;
                lawrencesEmptyFlask.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(lawrencesEmptyFlask);
            }

            // item db check
            lawrencesFilledFlask = GameServer.Database.FindObjectByKey<ItemTemplate>("lawrences_filled_flask");
            if (lawrencesFilledFlask == null)
            {
                lawrencesFilledFlask = new ItemTemplate();
                lawrencesFilledFlask.Name = "Lawrence's Filled Flask";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find "+lawrencesFilledFlask.Name+", creating it ...");

                lawrencesFilledFlask.Level = 0;
                lawrencesFilledFlask.Weight = 1;
                lawrencesFilledFlask.Model = 490;

                lawrencesFilledFlask.Object_Type = (int) eObjectType.GenericItem;
                lawrencesFilledFlask.Id_nb = "lawrences_filled_flask";
                lawrencesFilledFlask.Price = 0;
                lawrencesFilledFlask.IsPickable = false;
                lawrencesFilledFlask.IsDropable = false;

                lawrencesFilledFlask.Quality = 100;
                lawrencesFilledFlask.Condition = 1000;
                lawrencesFilledFlask.MaxCondition = 1000;
                lawrencesFilledFlask.Durability = 1000;
                lawrencesFilledFlask.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(lawrencesFilledFlask);
            }

            #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));

            GameEventMgr.AddHandler(brotherLawrence, GameLivingEvent.Interact, new DOLEventHandler(TalkToBrotherLawrence));
            GameEventMgr.AddHandler(brotherLawrence, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToBrotherLawrence));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            brotherLawrence.AddQuestToGive(typeof (LawrencesOil));

            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initialized");
        }
 /// <summary>
 /// Method to load all the templates into memory
 /// </summary>
 public static void LoadTemplates()
 {
     #region Albion
     #region Archer
     if (!Albion_Archer.LoadFromDatabase("albion_archer"))
     {
         Albion_Archer.AddNPCEquipment(eInventorySlot.Cloak, 3800);
         Albion_Archer.AddNPCEquipment(eInventorySlot.TorsoArmor, 728);
         Albion_Archer.AddNPCEquipment(eInventorySlot.LegsArmor, 663);
         Albion_Archer.AddNPCEquipment(eInventorySlot.ArmsArmor, 664);
         Albion_Archer.AddNPCEquipment(eInventorySlot.HandsArmor, 665);
         Albion_Archer.AddNPCEquipment(eInventorySlot.FeetArmor, 666);
         Albion_Archer.AddNPCEquipment(eInventorySlot.DistanceWeapon, 849);
         Albion_Archer.AddNPCEquipment(eInventorySlot.RightHandWeapon, 653);
         Albion_Archer.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 59);
         Albion_Archer = Albion_Archer.CloseTemplate();
         Albion_Archer.GetItem(eInventorySlot.DistanceWeapon).Hand        = (int)eHandFlag.Two;
         Albion_Archer.GetItem(eInventorySlot.LeftHandWeapon).Object_Type = (int)eObjectType.Shield;
     }
     #endregion
     #region Caster
     if (!Albion_Caster.LoadFromDatabase("albion_caster"))
     {
         Albion_Caster.AddNPCEquipment(eInventorySlot.Cloak, 3800);
         Albion_Caster.AddNPCEquipment(eInventorySlot.TorsoArmor, 58);
         Albion_Caster.AddNPCEquipment(eInventorySlot.HandsArmor, 142);
         Albion_Caster.AddNPCEquipment(eInventorySlot.FeetArmor, 143);
         Albion_Caster.AddNPCEquipment(eInventorySlot.RightHandWeapon, 13);
         Albion_Caster.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 1170);
         Albion_Caster = Albion_Caster.CloseTemplate();
         Albion_Caster.GetItem(eInventorySlot.TwoHandWeapon).Hand = (int)eHandFlag.Two;
     }
     #endregion
     #region Fighter
     if (!Albion_Fighter.LoadFromDatabase("albion_fighter"))
     {
         Albion_Fighter.AddNPCEquipment(eInventorySlot.Cloak, 3800);
         Albion_Fighter.AddNPCEquipment(eInventorySlot.TorsoArmor, 662);
         Albion_Fighter.AddNPCEquipment(eInventorySlot.LegsArmor, 663);
         Albion_Fighter.AddNPCEquipment(eInventorySlot.ArmsArmor, 664);
         Albion_Fighter.AddNPCEquipment(eInventorySlot.HandsArmor, 665);
         Albion_Fighter.AddNPCEquipment(eInventorySlot.FeetArmor, 666);
         Albion_Fighter.AddNPCEquipment(eInventorySlot.HeadArmor, 95);
         Albion_Fighter.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 60);
         Albion_Fighter.AddNPCEquipment(eInventorySlot.RightHandWeapon, 10);
         Albion_Fighter.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 649);
         Albion_Fighter = Albion_Fighter.CloseTemplate();
         Albion_Fighter.GetItem(eInventorySlot.LeftHandWeapon).Object_Type = (int)eObjectType.Shield;
         Albion_Fighter.GetItem(eInventorySlot.TwoHandWeapon).Hand         = (int)eHandFlag.Two;
     }
     #endregion
     #region Lord
     if (!Albion_Lord.LoadFromDatabase("albion_lord"))
     {
         Albion_Lord.AddNPCEquipment(eInventorySlot.Cloak, 3800); //676
         Albion_Lord.AddNPCEquipment(eInventorySlot.TorsoArmor, 662);
         Albion_Lord.AddNPCEquipment(eInventorySlot.LegsArmor, 663);
         Albion_Lord.AddNPCEquipment(eInventorySlot.ArmsArmor, 664);
         Albion_Lord.AddNPCEquipment(eInventorySlot.HandsArmor, 665);
         Albion_Lord.AddNPCEquipment(eInventorySlot.FeetArmor, 666);
         Albion_Lord.AddNPCEquipment(eInventorySlot.HeadArmor, 95);
         Albion_Lord.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 60);
         Albion_Lord.AddNPCEquipment(eInventorySlot.RightHandWeapon, 10);
         Albion_Lord.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 649);
         Albion_Lord.AddNPCEquipment(eInventorySlot.DistanceWeapon, 132);
         Albion_Lord = Albion_Lord.CloseTemplate();
         Albion_Lord.GetItem(eInventorySlot.DistanceWeapon).Hand        = (int)eHandFlag.Two;
         Albion_Lord.GetItem(eInventorySlot.LeftHandWeapon).Object_Type = (int)eObjectType.Shield;
         Albion_Lord.GetItem(eInventorySlot.TwoHandWeapon).Hand         = (int)eHandFlag.Two;
     }
     #endregion
     #region Healer
     if (!Albion_Healer.LoadFromDatabase("albion_healer"))
     {
         Albion_Healer.AddNPCEquipment(eInventorySlot.Cloak, 3800);
         Albion_Healer.AddNPCEquipment(eInventorySlot.TorsoArmor, 713);
         Albion_Healer.AddNPCEquipment(eInventorySlot.LegsArmor, 663);
         Albion_Healer.AddNPCEquipment(eInventorySlot.ArmsArmor, 664);
         Albion_Healer.AddNPCEquipment(eInventorySlot.HandsArmor, 665);
         Albion_Healer.AddNPCEquipment(eInventorySlot.FeetArmor, 666);
         Albion_Healer.AddNPCEquipment(eInventorySlot.HeadArmor, 94);
         Albion_Healer.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 61);
         Albion_Healer.AddNPCEquipment(eInventorySlot.RightHandWeapon, 3282);
         Albion_Healer = Albion_Healer.CloseTemplate();
         Albion_Fighter.GetItem(eInventorySlot.LeftHandWeapon).Object_Type = (int)eObjectType.Shield;
     }
     #endregion
     #region Stealther
     if (!Albion_Stealther.LoadFromDatabase("albion_stealther"))
     {
         Albion_Stealther.AddNPCEquipment(eInventorySlot.Cloak, 3800);
         Albion_Stealther.AddNPCEquipment(eInventorySlot.TorsoArmor, 792);
         Albion_Stealther.AddNPCEquipment(eInventorySlot.LegsArmor, 663);
         Albion_Stealther.AddNPCEquipment(eInventorySlot.ArmsArmor, 664);
         Albion_Stealther.AddNPCEquipment(eInventorySlot.HandsArmor, 665);
         Albion_Stealther.AddNPCEquipment(eInventorySlot.FeetArmor, 666);
         Albion_Stealther.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 653);
         Albion_Stealther.AddNPCEquipment(eInventorySlot.RightHandWeapon, 653);
         Albion_Stealther.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 653);
         Albion_Stealther = Albion_Stealther.CloseTemplate();
         Albion_Stealther.GetItem(eInventorySlot.LeftHandWeapon).Hand         = (int)eHandFlag.Left;
         Albion_Stealther.GetItem(eInventorySlot.LeftHandWeapon).SlotPosition = Slot.LEFTHAND;
     }
     #endregion
     #region PK
     //portal keep
     Albion_FighterPK.LoadFromDatabase("alb_fighter_pk");
     Albion_ArcherPK.LoadFromDatabase("alb_archer_pk");
     Albion_CasterPK.LoadFromDatabase("alb_caster_pk");
     #endregion
     #endregion
     #region Midgard
     #region Archer
     if (!Midgard_Archer.LoadFromDatabase("midgard_archer"))
     {
         Midgard_Archer.AddNPCEquipment(eInventorySlot.Cloak, 3801);
         Midgard_Archer.AddNPCEquipment(eInventorySlot.TorsoArmor, 668);
         Midgard_Archer.AddNPCEquipment(eInventorySlot.LegsArmor, 2943);
         Midgard_Archer.AddNPCEquipment(eInventorySlot.ArmsArmor, 2944);
         Midgard_Archer.AddNPCEquipment(eInventorySlot.HandsArmor, 2945);
         Midgard_Archer.AddNPCEquipment(eInventorySlot.FeetArmor, 2946);
         Midgard_Archer.AddNPCEquipment(eInventorySlot.HeadArmor, 2874);
         Midgard_Archer.AddNPCEquipment(eInventorySlot.DistanceWeapon, 1037);
         Midgard_Archer.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 328);
         Midgard_Archer.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 59);
         Midgard_Archer = Midgard_Archer.CloseTemplate();
         Midgard_Archer.GetItem(eInventorySlot.DistanceWeapon).Hand        = (int)eHandFlag.Two;
         Midgard_Archer.GetItem(eInventorySlot.TwoHandWeapon).Hand         = (int)eHandFlag.Two;
         Midgard_Archer.GetItem(eInventorySlot.LeftHandWeapon).Object_Type = (int)eObjectType.Shield;
     }
     #endregion
     #region Caster
     if (!Midgard_Caster.LoadFromDatabase("midgard_caster"))
     {
         Midgard_Caster.AddNPCEquipment(eInventorySlot.Cloak, 3801);
         Midgard_Caster.AddNPCEquipment(eInventorySlot.TorsoArmor, 98);
         Midgard_Caster.AddNPCEquipment(eInventorySlot.HandsArmor, 142);
         Midgard_Caster.AddNPCEquipment(eInventorySlot.FeetArmor, 143);
         Midgard_Caster.AddNPCEquipment(eInventorySlot.RightHandWeapon, 13);
         Midgard_Caster.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 566);
         Midgard_Caster = Midgard_Caster.CloseTemplate();
         Midgard_Caster.GetItem(eInventorySlot.TwoHandWeapon).Hand = (int)eHandFlag.Two;
     }
     #endregion
     #region Fighter
     if (!Midgard_Fighter.LoadFromDatabase("midgard_fighter"))
     {
         Midgard_Fighter.AddNPCEquipment(eInventorySlot.Cloak, 3801);
         Midgard_Fighter.AddNPCEquipment(eInventorySlot.TorsoArmor, 668);
         Midgard_Fighter.AddNPCEquipment(eInventorySlot.LegsArmor, 2943);
         Midgard_Fighter.AddNPCEquipment(eInventorySlot.ArmsArmor, 2944);
         Midgard_Fighter.AddNPCEquipment(eInventorySlot.HandsArmor, 2945);
         Midgard_Fighter.AddNPCEquipment(eInventorySlot.FeetArmor, 2946);
         Midgard_Fighter.AddNPCEquipment(eInventorySlot.HeadArmor, 2874);
         Midgard_Fighter.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 60);
         Midgard_Fighter.AddNPCEquipment(eInventorySlot.RightHandWeapon, 313);
         Midgard_Fighter.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 572);
         Midgard_Fighter = Midgard_Fighter.CloseTemplate();
         Midgard_Fighter.GetItem(eInventorySlot.LeftHandWeapon).Object_Type = (int)eObjectType.Shield;
         Midgard_Fighter.GetItem(eInventorySlot.TwoHandWeapon).Hand         = (int)eHandFlag.Two;
     }
     #endregion
     #region Lord
     if (!Midgard_Lord.LoadFromDatabase("midgard_lord"))
     {
         Midgard_Lord.AddNPCEquipment(eInventorySlot.Cloak, 3801);
         Midgard_Lord.AddNPCEquipment(eInventorySlot.TorsoArmor, 668);
         Midgard_Lord.AddNPCEquipment(eInventorySlot.LegsArmor, 2943);
         Midgard_Lord.AddNPCEquipment(eInventorySlot.ArmsArmor, 2944);
         Midgard_Lord.AddNPCEquipment(eInventorySlot.HandsArmor, 2945);
         Midgard_Lord.AddNPCEquipment(eInventorySlot.FeetArmor, 2946);
         Midgard_Lord.AddNPCEquipment(eInventorySlot.HeadArmor, 2874);
         Midgard_Lord.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 60);
         Midgard_Lord.AddNPCEquipment(eInventorySlot.RightHandWeapon, 313);
         Midgard_Lord.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 572);
         Midgard_Lord.AddNPCEquipment(eInventorySlot.DistanceWeapon, 564);
         Midgard_Lord = Midgard_Lord.CloseTemplate();
         Midgard_Lord.GetItem(eInventorySlot.DistanceWeapon).Hand         = (int)eHandFlag.Two;
         Midgard_Lord.GetItem(eInventorySlot.DistanceWeapon).Object_Type  = (int)eObjectType.Longbow;
         Midgard_Lord.GetItem(eInventorySlot.DistanceWeapon).SlotPosition = Slot.RANGED;
         Midgard_Lord.GetItem(eInventorySlot.LeftHandWeapon).Object_Type  = (int)eObjectType.Shield;
         Midgard_Lord.GetItem(eInventorySlot.TwoHandWeapon).Hand          = (int)eHandFlag.Two;
     }
     #endregion
     #region Healer
     if (!Midgard_Healer.LoadFromDatabase("midgard_healer"))
     {
         Midgard_Healer.AddNPCEquipment(eInventorySlot.Cloak, 3801);
         Midgard_Healer.AddNPCEquipment(eInventorySlot.TorsoArmor, 668);
         Midgard_Healer.AddNPCEquipment(eInventorySlot.LegsArmor, 2943);
         Midgard_Healer.AddNPCEquipment(eInventorySlot.ArmsArmor, 2944);
         Midgard_Healer.AddNPCEquipment(eInventorySlot.HandsArmor, 2945);
         Midgard_Healer.AddNPCEquipment(eInventorySlot.FeetArmor, 2946);
         Midgard_Healer.AddNPCEquipment(eInventorySlot.HeadArmor, 2874);
         Midgard_Healer.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 59);
         Midgard_Healer.AddNPCEquipment(eInventorySlot.RightHandWeapon, 3335);
         Midgard_Healer.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 3336);
         Midgard_Healer = Midgard_Healer.CloseTemplate();
         Midgard_Healer.GetItem(eInventorySlot.LeftHandWeapon).Object_Type = (int)eObjectType.Shield;
     }
     #endregion
     #region Hastener
     if (!Midgard_Hastener.LoadFromDatabase("midgard_hastener"))
     {
         Midgard_Hastener.AddNPCEquipment(eInventorySlot.Cloak, 443, 43);
         Midgard_Hastener.AddNPCEquipment(eInventorySlot.TorsoArmor, 230);
         Midgard_Hastener.AddNPCEquipment(eInventorySlot.HandsArmor, 233);
         Midgard_Hastener.AddNPCEquipment(eInventorySlot.FeetArmor, 234);
         Midgard_Hastener.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 228);
         Midgard_Hastener = Midgard_Hastener.CloseTemplate();
         Midgard_Hastener.GetItem(eInventorySlot.LeftHandWeapon).Hand         = (int)eHandFlag.Left;
         Midgard_Hastener.GetItem(eInventorySlot.LeftHandWeapon).SlotPosition = Slot.LEFTHAND;
     }
     #endregion
     #region Stealther
     if (!Midgard_Stealther.LoadFromDatabase("midgard_stealther"))
     {
         Midgard_Stealther.AddNPCEquipment(eInventorySlot.Cloak, 3801);
         Midgard_Stealther.AddNPCEquipment(eInventorySlot.TorsoArmor, 668);
         Midgard_Stealther.AddNPCEquipment(eInventorySlot.LegsArmor, 2943);
         Midgard_Stealther.AddNPCEquipment(eInventorySlot.ArmsArmor, 2944);
         Midgard_Stealther.AddNPCEquipment(eInventorySlot.HandsArmor, 2945);
         Midgard_Stealther.AddNPCEquipment(eInventorySlot.FeetArmor, 2946);
         Midgard_Stealther.AddNPCEquipment(eInventorySlot.HeadArmor, 335);
         Midgard_Stealther.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 573);
         Midgard_Stealther.AddNPCEquipment(eInventorySlot.RightHandWeapon, 573);
         Midgard_Stealther.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 577);
         Midgard_Stealther = Midgard_Stealther.CloseTemplate();
         Midgard_Stealther.GetItem(eInventorySlot.LeftHandWeapon).Hand        = (int)eHandFlag.Left;
         Albion_Stealther.GetItem(eInventorySlot.LeftHandWeapon).SlotPosition = Slot.LEFTHAND;
     }
     #endregion
     #region PK
     Midgard_FighterPK.LoadFromDatabase("mid_fighter_pk");
     Midgard_ArcherPK.LoadFromDatabase("mid_archer_pk");
     Midgard_CasterPK.LoadFromDatabase("mid_caster_pk");
     #endregion
     #endregion
     #region Hibernia
     #region Archer
     if (!Hibernia_Archer.LoadFromDatabase("hibernia_archer"))
     {
         Hibernia_Archer.AddNPCEquipment(eInventorySlot.Cloak, 3802);
         Hibernia_Archer.AddNPCEquipment(eInventorySlot.TorsoArmor, 667);
         Hibernia_Archer.AddNPCEquipment(eInventorySlot.LegsArmor, 989);
         Hibernia_Archer.AddNPCEquipment(eInventorySlot.ArmsArmor, 990);
         Hibernia_Archer.AddNPCEquipment(eInventorySlot.HandsArmor, 991);
         Hibernia_Archer.AddNPCEquipment(eInventorySlot.FeetArmor, 992);
         Hibernia_Archer.AddNPCEquipment(eInventorySlot.HeadArmor, 1207);
         Hibernia_Archer.AddNPCEquipment(eInventorySlot.DistanceWeapon, 919);
         Hibernia_Archer.AddNPCEquipment(eInventorySlot.RightHandWeapon, 643);
         Hibernia_Archer.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 643);
         Hibernia_Archer = Hibernia_Archer.CloseTemplate();
         Hibernia_Archer.GetItem(eInventorySlot.DistanceWeapon).Hand         = (int)eHandFlag.Two;
         Hibernia_Archer.GetItem(eInventorySlot.DistanceWeapon).Object_Type  = (int)eObjectType.RecurvedBow;
         Hibernia_Archer.GetItem(eInventorySlot.DistanceWeapon).SlotPosition = Slot.RANGED;
         Hibernia_Archer.GetItem(eInventorySlot.LeftHandWeapon).Hand         = (int)eHandFlag.Left;
     }
     #endregion
     #region Caster
     if (!Hibernia_Caster.LoadFromDatabase("hibernia_caster"))
     {
         Hibernia_Caster.AddNPCEquipment(eInventorySlot.Cloak, 3802);
         Hibernia_Caster.AddNPCEquipment(eInventorySlot.TorsoArmor, 97);
         Hibernia_Caster.AddNPCEquipment(eInventorySlot.HandsArmor, 142);
         Hibernia_Caster.AddNPCEquipment(eInventorySlot.FeetArmor, 143);
         Hibernia_Caster.AddNPCEquipment(eInventorySlot.RightHandWeapon, 13);
         Hibernia_Caster.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 1176);
         Hibernia_Caster = Hibernia_Caster.CloseTemplate();
         Hibernia_Caster.GetItem(eInventorySlot.TwoHandWeapon).Hand = (int)eHandFlag.Two;
     }
     #endregion
     #region Fighter
     if (!Hibernia_Fighter.LoadFromDatabase("hibernia_fighter"))
     {
         Hibernia_Fighter.AddNPCEquipment(eInventorySlot.Cloak, 3802);
         Hibernia_Fighter.AddNPCEquipment(eInventorySlot.TorsoArmor, 667);
         Hibernia_Fighter.AddNPCEquipment(eInventorySlot.LegsArmor, 989);
         Hibernia_Fighter.AddNPCEquipment(eInventorySlot.ArmsArmor, 990);
         Hibernia_Fighter.AddNPCEquipment(eInventorySlot.HandsArmor, 991);
         Hibernia_Fighter.AddNPCEquipment(eInventorySlot.FeetArmor, 992);
         Hibernia_Fighter.AddNPCEquipment(eInventorySlot.HeadArmor, 1207);
         Hibernia_Fighter.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 79);
         Hibernia_Fighter.AddNPCEquipment(eInventorySlot.RightHandWeapon, 897);
         Hibernia_Fighter.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 476);
         Hibernia_Fighter = Hibernia_Fighter.CloseTemplate();
         Hibernia_Fighter.GetItem(eInventorySlot.LeftHandWeapon).Object_Type = (int)eObjectType.Shield;
         Hibernia_Fighter.GetItem(eInventorySlot.TwoHandWeapon).Hand         = (int)eHandFlag.Two;
     }
     #endregion
     #region Lord
     if (!Hibernia_Lord.LoadFromDatabase("hibernia_lord"))
     {
         Hibernia_Lord.AddNPCEquipment(eInventorySlot.Cloak, 3802);
         Hibernia_Lord.AddNPCEquipment(eInventorySlot.TorsoArmor, 667);
         Hibernia_Lord.AddNPCEquipment(eInventorySlot.LegsArmor, 989);
         Hibernia_Lord.AddNPCEquipment(eInventorySlot.ArmsArmor, 990);
         Hibernia_Lord.AddNPCEquipment(eInventorySlot.HandsArmor, 991);
         Hibernia_Lord.AddNPCEquipment(eInventorySlot.FeetArmor, 992);
         Hibernia_Lord.AddNPCEquipment(eInventorySlot.HeadArmor, 1207);
         Hibernia_Lord.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 79);
         Hibernia_Lord.AddNPCEquipment(eInventorySlot.RightHandWeapon, 897);
         Hibernia_Lord.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 476);
         Hibernia_Lord.AddNPCEquipment(eInventorySlot.DistanceWeapon, 471);
         Hibernia_Lord.GetItem(eInventorySlot.DistanceWeapon).Hand         = (int)eHandFlag.Two;
         Hibernia_Lord.GetItem(eInventorySlot.DistanceWeapon).Object_Type  = (int)eObjectType.CompositeBow;
         Hibernia_Lord.GetItem(eInventorySlot.DistanceWeapon).SlotPosition = Slot.RANGED;
         Hibernia_Lord.GetItem(eInventorySlot.LeftHandWeapon).Object_Type  = (int)eObjectType.Shield;
         Hibernia_Lord.GetItem(eInventorySlot.TwoHandWeapon).Hand          = (int)eHandFlag.Two;
     }
     #endregion
     #region Healer
     if (!Hibernia_Healer.LoadFromDatabase("hibernia_healer"))
     {
         Hibernia_Healer.AddNPCEquipment(eInventorySlot.Cloak, 3802);
         Hibernia_Healer.AddNPCEquipment(eInventorySlot.TorsoArmor, 667);
         Hibernia_Healer.AddNPCEquipment(eInventorySlot.LegsArmor, 989);
         Hibernia_Healer.AddNPCEquipment(eInventorySlot.ArmsArmor, 990);
         Hibernia_Healer.AddNPCEquipment(eInventorySlot.HandsArmor, 991);
         Hibernia_Healer.AddNPCEquipment(eInventorySlot.FeetArmor, 992);
         Hibernia_Healer.AddNPCEquipment(eInventorySlot.HeadArmor, 1207);
         Hibernia_Healer.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 59);
         Hibernia_Healer.AddNPCEquipment(eInventorySlot.RightHandWeapon, 3247);
         Hibernia_Healer = Hibernia_Healer.CloseTemplate();
         Hibernia_Healer.GetItem(eInventorySlot.LeftHandWeapon).Object_Type = (int)eObjectType.Shield;
     }
     #endregion
     #region Stealther
     if (!Hibernia_Stealther.LoadFromDatabase("hibernia_stealther"))
     {
         Hibernia_Stealther.AddNPCEquipment(eInventorySlot.Cloak, 3802);
         Hibernia_Stealther.AddNPCEquipment(eInventorySlot.TorsoArmor, 667);
         Hibernia_Stealther.AddNPCEquipment(eInventorySlot.LegsArmor, 989);
         Hibernia_Stealther.AddNPCEquipment(eInventorySlot.ArmsArmor, 990);
         Hibernia_Stealther.AddNPCEquipment(eInventorySlot.HandsArmor, 991);
         Hibernia_Stealther.AddNPCEquipment(eInventorySlot.FeetArmor, 992);
         Hibernia_Stealther.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 2685);
         Hibernia_Stealther.AddNPCEquipment(eInventorySlot.RightHandWeapon, 2685);
         Hibernia_Stealther.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 2687);
         Hibernia_Stealther = Hibernia_Stealther.CloseTemplate();
         Hibernia_Stealther.GetItem(eInventorySlot.LeftHandWeapon).Hand       = (int)eHandFlag.Left;
         Albion_Stealther.GetItem(eInventorySlot.LeftHandWeapon).SlotPosition = Slot.LEFTHAND;
     }
     #endregion
     #region PK
     Hibernia_FighterPK.LoadFromDatabase("hib_fighter_pk");
     Hibernia_ArcherPK.LoadFromDatabase("hib_archer_pk");
     Hibernia_CasterPK.LoadFromDatabase("hib_caster_pk");
     #endregion
     #endregion
 }
        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");
        }
Exemple #20
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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Laridia the Minstrel", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                laridiaTheMinstrel       = new GameNPC();
                laridiaTheMinstrel.Model = 38;
                laridiaTheMinstrel.Name  = "Laridia the Minstrel";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + laridiaTheMinstrel.Name + ", creating him ...");
                }
                laridiaTheMinstrel.GuildName       = "Part of " + questTitle + " Quest";
                laridiaTheMinstrel.Realm           = eRealm.Albion;
                laridiaTheMinstrel.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 137, 9);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 138, 9);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 134, 9);
                template.AddNPCEquipment(eInventorySlot.Cloak, 96, 72);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 140, 43);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 141, 43);
                laridiaTheMinstrel.Inventory = template.CloseTemplate();
                laridiaTheMinstrel.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                laridiaTheMinstrel.Size    = 49;
                laridiaTheMinstrel.Level   = 25;
                laridiaTheMinstrel.X       = 562280;
                laridiaTheMinstrel.Y       = 512243;
                laridiaTheMinstrel.Z       = 2448;
                laridiaTheMinstrel.Heading = 3049;

                //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)
                {
                    laridiaTheMinstrel.SaveIntoDatabase();
                }

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


            npcs = WorldMgr.GetNPCsByName("Farmer Asma", eRealm.Albion);
            if (npcs.Length == 0)
            {
                farmerAsma       = new GameNPC();
                farmerAsma.Model = 82;
                farmerAsma.Name  = "Farmer Asma";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + farmerAsma.Name + ", creating him ...");
                }
                farmerAsma.GuildName       = "Part of " + questTitle + " Quest";
                farmerAsma.Realm           = eRealm.Albion;
                farmerAsma.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 31);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 32);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 33);
                farmerAsma.Inventory = template.CloseTemplate();
                farmerAsma.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                farmerAsma.Size    = 50;
                farmerAsma.Level   = 35;
                farmerAsma.X       = 563939;
                farmerAsma.Y       = 509234;
                farmerAsma.Z       = 2744;
                farmerAsma.Heading = 21;

                //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)
                {
                    farmerAsma.SaveIntoDatabase();
                }

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

            #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));

            GameEventMgr.AddHandler(laridiaTheMinstrel, GameLivingEvent.Interact, new DOLEventHandler(TalkToLaridiaTheMinstrel));
            GameEventMgr.AddHandler(laridiaTheMinstrel, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToLaridiaTheMinstrel));

            GameEventMgr.AddHandler(farmerAsma, GameObjectEvent.Interact, new DOLEventHandler(TalkToFarmerAsma));
            GameEventMgr.AddHandler(farmerAsma, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToFarmerAsma));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            laridiaTheMinstrel.AddQuestToGive(typeof(AgainstTheGrain));

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

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.WhenGoodBrowniesGoBad.ScriptLoaded.Text1"), eRealm.Albion);

            if (npcs.Length == 0)
            {
                MasterKless = new GameNPC();
                MasterKless.Model = 64;
                MasterKless.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.WhenGoodBrowniesGoBad.ScriptLoaded.Text1");
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + MasterKless.Name + ", creating him ...");
                //k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                //MasterKless.GuildName = "Part of " + questTitle + " Quest";
                MasterKless.Realm = eRealm.Albion;
                MasterKless.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 1005);  //Slot 25
                template.AddNPCEquipment(eInventorySlot.Cloak, 96);         //Slot 26
                template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 1166);     //Slot 12
                MasterKless.Inventory = template.CloseTemplate();
                MasterKless.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                MasterKless.Size = 51;
                MasterKless.Level = 50;
                MasterKless.X = 559370;
                MasterKless.Y = 513587;
                MasterKless.Z = 2428;
                MasterKless.Heading = 2685;

                if (SAVE_INTO_DATABASE)
                    MasterKless.SaveIntoDatabase();

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

            #endregion

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

            GameEventMgr.AddHandler(MasterKless, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterKless));
            GameEventMgr.AddHandler(MasterKless, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterKless));

            MasterKless.AddQuestToGive(typeof(WhenGoodBrowniesGoBad));

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

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

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Josson", eRealm.Hibernia);

            if (npcs.Length == 0)
            {
                Josson       = new GameNPC();
                Josson.Model = 382;
                Josson.Name  = "Josson";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + Josson.Name + ", creating him ...");
                }

                // k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                // Josson.GuildName = "Part of " + questTitle + " Quest";
                Josson.Realm           = eRealm.Hibernia;
                Josson.CurrentRegionID = 200;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 386);   // Slot 22
                template.AddNPCEquipment(eInventorySlot.HeadArmor, 835);    // Slot 21
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 387);    // Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 383);   // Slot 25
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 384);    // Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 385);    // Slot 28
                Josson.Inventory = template.CloseTemplate();
                Josson.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                Josson.Size    = 48;
                Josson.Level   = 50;
                Josson.X       = 346627;
                Josson.Y       = 491453;
                Josson.Z       = 5247;
                Josson.Heading = 2946;

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

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

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

            GameEventMgr.AddHandler(Josson, GameLivingEvent.Interact, new DOLEventHandler(TalkToJosson));
            GameEventMgr.AddHandler(Josson, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToJosson));

            Josson.AddQuestToGive(typeof(MagicalBacklash));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Sir Jerem", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
                * this users Mob Database, so we simply create one ;-)
                * else we take the existing one. And if more than one exist, we take
                * the first ...
                */
            if (npcs.Length == 0)
            {
                sirJerem = new GameNPC();
                sirJerem.Model = 254;
                sirJerem.Name = "Sir Jerem";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + sirJerem.Name + ", creating him ...");
                sirJerem.GuildName = "Part of " + questTitle + " Quest";
                sirJerem.Realm = eRealm.Albion;
                sirJerem.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 68, 21);
                template.AddNPCEquipment(eInventorySlot.HeadArmor, 64);
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 46);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 27);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 158);
                sirJerem.Inventory = template.CloseTemplate();
                sirJerem.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

                sirJerem.Size = 51;
                sirJerem.Level = 38;
                sirJerem.X = 573815;
                sirJerem.Y = 530850;
                sirJerem.Z = 2933;
                sirJerem.Heading = 2685;

                //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)
                    sirJerem.SaveIntoDatabase();

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

            npcs = WorldMgr.GetNPCsByName("Squire Galune", eRealm.Albion);
            if (npcs.Length == 0)
            {
                squireGalune = new GameNPC();
                squireGalune.Model = 254;
                squireGalune.Name = "Squire Galune";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + squireGalune.Name + ", creating him ...");
                squireGalune.GuildName = "Part of " + questTitle + " Quest";
                squireGalune.Realm = eRealm.Albion;
                squireGalune.CurrentRegionID = 21;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 320);
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 137);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 138);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 134);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 135);
                squireGalune.Inventory = template.CloseTemplate();
                squireGalune.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                squireGalune.Size = 45;
                squireGalune.Level = 8;
                squireGalune.X = 33219;
                squireGalune.Y = 31931;
                squireGalune.Z = 16240;
                squireGalune.Heading = 477;

                //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)
                    squireGalune.SaveIntoDatabase();

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

            foreach (GameNPC npc in squireGalune.GetNPCsInRadius(400))
            {
                if (npc.Name == "small spider")
                {
                    smallSpider = npc;
                    break;
                }
            }

            if (smallSpider == null)
            {
                smallSpider = new GameNPC();
                smallSpider.Model = 72;
                smallSpider.Name = "small spider";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + smallSpider.Name + ", creating him ...");
                smallSpider.GuildName = "Part of " + questTitle + " Quest";
                smallSpider.Realm = eRealm.None;
                smallSpider.CurrentRegionID = 21;
                smallSpider.Size = 17;
                smallSpider.Level = 5;
                smallSpider.X = 33158;
                smallSpider.Y = 31973;
                smallSpider.Z = 16240;

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

                smallSpider.Heading = 2605;
                smallSpider.MaxSpeedBase = 0;

                //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)
                    smallSpider.SaveIntoDatabase();

                smallSpider.AddToWorld();
            }

            #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));

            GameEventMgr.AddHandler(sirJerem, GameLivingEvent.Interact, new DOLEventHandler(TalkToSirJerem));
            GameEventMgr.AddHandler(sirJerem, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToSirJerem));

            GameEventMgr.AddHandler(squireGalune, GameLivingEvent.Interact, new DOLEventHandler(TalkToSquireGalune));
            GameEventMgr.AddHandler(squireGalune, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToSquireGalune));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            sirJerem.AddQuestToGive(typeof (ShakenSquire));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Andrew Wyatt", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                andrewWyatt       = new GameNPC();
                andrewWyatt.Model = 80;
                andrewWyatt.Name  = "Andrew Wyatt";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + andrewWyatt.Name + ", creating him ...");
                }
                andrewWyatt.GuildName       = "Part of " + questTitle + " Quest";
                andrewWyatt.Realm           = eRealm.Albion;
                andrewWyatt.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 80);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 54);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 51);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 52);
                andrewWyatt.Inventory = template.CloseTemplate();
                andrewWyatt.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                andrewWyatt.Size    = 48;
                andrewWyatt.Level   = 30;
                andrewWyatt.X       = 559590;
                andrewWyatt.Y       = 511039;
                andrewWyatt.Z       = 2488;
                andrewWyatt.Heading = 1524;

                //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)
                {
                    andrewWyatt.SaveIntoDatabase();
                }

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

            npcs = WorldMgr.GetNPCsByName("Geor Nadren", eRealm.Albion);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Geor Nadren, creating him ...");
                }
                georNadren                 = new GameNPC();
                georNadren.Model           = 9;
                georNadren.Name            = "Geor Nadren";
                georNadren.GuildName       = "Part of " + questTitle + " Quest";
                georNadren.Realm           = eRealm.Albion;
                georNadren.CurrentRegionID = 10;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                georNadren.Inventory = template.CloseTemplate();
                georNadren.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                georNadren.Size    = 51;
                georNadren.Level   = 8;
                georNadren.X       = 37355;
                georNadren.Y       = 30943;
                georNadren.Z       = 8002;
                georNadren.Heading = 3231;

                //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)
                {
                    georNadren.SaveIntoDatabase();
                }

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

            npcs = WorldMgr.GetNPCsByName("Ver Nuren", eRealm.Albion);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Ver Nuren, creating him ...");
                }
                verNuren                 = new GameNPC();
                verNuren.Model           = 9;
                verNuren.Name            = "Ver Nuren";
                verNuren.GuildName       = "Part of " + questTitle + " Quest";
                verNuren.Realm           = eRealm.Albion;
                verNuren.CurrentRegionID = 10;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 61);
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                verNuren.Inventory = template.CloseTemplate();
                verNuren.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                verNuren.Size    = 51;
                verNuren.Level   = 8;
                verNuren.X       = 36799;
                verNuren.Y       = 30786;
                verNuren.Z       = 8010;
                verNuren.Heading = 625;

                //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)
                {
                    verNuren.SaveIntoDatabase();
                }

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

            #endregion

            #region defineItems

            // item db check
            bundleOfBearSkins = GameServer.Database.FindObjectByKey <ItemTemplate>("bundle_of_bear_skins");
            if (bundleOfBearSkins == null)
            {
                bundleOfBearSkins      = new ItemTemplate();
                bundleOfBearSkins.Name = "Bundle of Bear Skins";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + bundleOfBearSkins.Name + ", creating it ...");
                }
                bundleOfBearSkins.Level  = 0;
                bundleOfBearSkins.Weight = 0;
                bundleOfBearSkins.Model  = 100;

                bundleOfBearSkins.Object_Type = (int)eObjectType.GenericItem;
                bundleOfBearSkins.Id_nb       = "bundle_of_bear_skins";
                bundleOfBearSkins.Price       = 0;
                bundleOfBearSkins.IsPickable  = false;
                bundleOfBearSkins.IsDropable  = false;

                bundleOfBearSkins.Quality       = 100;
                bundleOfBearSkins.Condition     = 1000;
                bundleOfBearSkins.MaxCondition  = 1000;
                bundleOfBearSkins.Durability    = 1000;
                bundleOfBearSkins.MaxDurability = 1000;
                GameServer.Database.AddObject(bundleOfBearSkins);
            }

            // item db check
            spoolOfLeatherworkingThread = GameServer.Database.FindObjectByKey <ItemTemplate>("spool_of_leatherworking_thread");
            if (spoolOfLeatherworkingThread == null)
            {
                spoolOfLeatherworkingThread      = new ItemTemplate();
                spoolOfLeatherworkingThread.Name = "Spool of Leatherworking Thread";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + spoolOfLeatherworkingThread.Name + ", creating it ...");
                }
                spoolOfLeatherworkingThread.Level  = 0;
                spoolOfLeatherworkingThread.Weight = 0;
                spoolOfLeatherworkingThread.Model  = 537;

                spoolOfLeatherworkingThread.Object_Type = (int)eObjectType.GenericItem;
                spoolOfLeatherworkingThread.Id_nb       = "spool_of_leatherworking_thread";
                spoolOfLeatherworkingThread.Price       = 0;
                spoolOfLeatherworkingThread.IsPickable  = false;
                spoolOfLeatherworkingThread.IsDropable  = false;

                spoolOfLeatherworkingThread.Quality       = 100;
                spoolOfLeatherworkingThread.Condition     = 1000;
                spoolOfLeatherworkingThread.MaxCondition  = 1000;
                spoolOfLeatherworkingThread.Durability    = 1000;
                spoolOfLeatherworkingThread.MaxDurability = 1000;
                GameServer.Database.AddObject(spoolOfLeatherworkingThread);
            }

            // item db check
            chokerOfTheBear = GameServer.Database.FindObjectByKey <ItemTemplate>("choker_of_the_bear");
            if (chokerOfTheBear == null)
            {
                chokerOfTheBear      = new ItemTemplate();
                chokerOfTheBear.Name = "Choker of the Bear";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + chokerOfTheBear.Name + ", creating it ...");
                }

                chokerOfTheBear.Level  = 5;
                chokerOfTheBear.Weight = 6;
                chokerOfTheBear.Model  = 101;

                chokerOfTheBear.Object_Type = (int)eObjectType.Magical;
                chokerOfTheBear.Item_Type   = (int)eEquipmentItems.NECK;
                chokerOfTheBear.Id_nb       = "choker_of_the_bear";

                chokerOfTheBear.Price      = Money.GetMoney(0, 0, 0, 0, 30);
                chokerOfTheBear.IsPickable = true;
                chokerOfTheBear.IsDropable = true;

                chokerOfTheBear.Bonus      = 1;
                chokerOfTheBear.Bonus1Type = (int)eProperty.Strength;
                chokerOfTheBear.Bonus1     = 4;
                chokerOfTheBear.Bonus2Type = (int)eProperty.Resist_Thrust;
                chokerOfTheBear.Bonus2     = 1;

                chokerOfTheBear.Quality       = 100;
                chokerOfTheBear.Condition     = 1000;
                chokerOfTheBear.MaxCondition  = 1000;
                chokerOfTheBear.Durability    = 1000;
                chokerOfTheBear.MaxDurability = 1000;
                GameServer.Database.AddObject(chokerOfTheBear);
            }

            #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));

            GameEventMgr.AddHandler(andrewWyatt, GameLivingEvent.Interact, new DOLEventHandler(TalkToAndrewWyatt));
            GameEventMgr.AddHandler(andrewWyatt, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToAndrewWyatt));

            GameEventMgr.AddHandler(georNadren, GameObjectEvent.Interact, new DOLEventHandler(TalkToGeorNadren));
            GameEventMgr.AddHandler(georNadren, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToGeorNadren));

            GameEventMgr.AddHandler(verNuren, GameObjectEvent.Interact, new DOLEventHandler(TalkToVerNuren));
            GameEventMgr.AddHandler(verNuren, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToVerNuren));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            andrewWyatt.AddQuestToGive(typeof(AndrewsSkins));

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

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

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName(questGiverName, eRealm.Hibernia);

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

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 813, 0);		//Slot 22
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 814, 0);			//Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 810, 0);		//Slot 25
                template.AddNPCEquipment(eInventorySlot.Cloak, 678, 0);				//Slot 26
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 811, 0);			//Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 812, 0);			//Slot 28
                questGiver.Inventory = template.CloseTemplate();
                questGiver.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                questGiver.Size = 50;
                questGiver.Level = 70;
                questGiver.X = 357695;
                questGiver.Y = 363457;
                questGiver.Z = 5340;
                questGiver.Heading = 3117;

                if (SAVE_INTO_DATABASE)
                    questGiver.SaveIntoDatabase();

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

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

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

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 391, 0);		//Slot 22
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 392, 0);			//Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 667, 0);		//Slot 25
                template.AddNPCEquipment(eInventorySlot.Cloak, 678, 0);				//Slot 26
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 389, 0);			//Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 390, 0);			//Slot 28
                questTarget.Inventory = template.CloseTemplate();
                questTarget.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                questTarget.Size = 50;
                questTarget.Level = 65;
                questTarget.X = 356932;
                questTarget.Y = 363575;
                questTarget.Z = 5248;
                questTarget.Heading = 2912;

                if (SAVE_INTO_DATABASE)
                    questTarget.SaveIntoDatabase();

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

            #endregion defineNPCS

            #region defineAreas

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

            #endregion defineAreas

            #region defineBehaviours

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

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

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

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

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

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

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

            #endregion defineBehaviours

            questGiver.AddQuestToGive(typeof(MovementAndInteraction));

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

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Rheda", eRealm.Albion);

            if (npcs.Length == 0)
            {
                Rheda       = new GameNPC();
                Rheda.Model = 6;
                Rheda.Name  = "Rheda";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + Rheda.Name + ", creating him ...");
                }

                // k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                // Rheda.GuildName = "Part of " + questTitle + " Quest";
                Rheda.Realm           = eRealm.Albion;
                Rheda.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 80);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 54);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 51);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 52);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 53);
                Rheda.Inventory = template.CloseTemplate();
                Rheda.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                Rheda.Size    = 52;
                Rheda.Level   = 25;
                Rheda.X       = 559712;
                Rheda.Y       = 513513;
                Rheda.Z       = 2428;
                Rheda.Heading = 3822;

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

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

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

            GameEventMgr.AddHandler(Rheda, GameLivingEvent.Interact, new DOLEventHandler(TalkToRheda));
            GameEventMgr.AddHandler(Rheda, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToRheda));

            Rheda.AddQuestToGive(typeof(RecruitingNothingButTrouble));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Exemple #27
0
        protected void CreateDunwynClone()
        {
            GameNpcInventoryTemplate template;
            if (dunwynClone == null)
            {
                dunwynClone = new GameNPC();
                dunwynClone.Name = "Master Dunwyn";
                dunwynClone.Model = 9;
                dunwynClone.GuildName = "Part of " + questTitle + " Quest";
                dunwynClone.Realm = eRealm.Albion;
                dunwynClone.CurrentRegionID = 1;
                dunwynClone.Size = 50;
                dunwynClone.Level = 14;

                dunwynClone.X = GameLocation.ConvertLocalXToGlobalX(8602, 0) + Util.Random(-150, 150);
                dunwynClone.Y = GameLocation.ConvertLocalYToGlobalY(47193, 0) + Util.Random(-150, 150);
                dunwynClone.Z = 2409;
                dunwynClone.Heading = 342;

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

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

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

                dunwynClone.AddToWorld();

                GameEventMgr.AddHandler(dunwynClone, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterDunwyn));
                GameEventMgr.AddHandler(dunwynClone, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterDunwyn));
            }
            else
            {
                dunwynClone.MoveTo(1, 567604, 509619, 2813, 3292);
            }

            foreach (GamePlayer visPlayer in dunwynClone.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                visPlayer.Out.SendEmoteAnimation(dunwynClone, eEmote.Bind);
            }

            for (int i = 0; i < recruits.Length; i++)
            {
                recruits[i] = new GameNPC();

                recruits[i].Name = "Recruit";

                recruits[i].GuildName = "Part of " + questTitle + " Quest";
                recruits[i].Realm = eRealm.Albion;
                recruits[i].CurrentRegionID = 1;

                recruits[i].Size = 50;
                recruits[i].Level = 6;
                recruits[i].X = GameLocation.ConvertLocalXToGlobalX(8602, 0) + Util.Random(-150, 150);
                recruits[i].Y = GameLocation.ConvertLocalYToGlobalY(47193, 0) + Util.Random(-150, 150);

                recruits[i].Z = 2409;
                recruits[i].Heading = 187;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                recruits[i].SetOwnBrain(brain);

            }

            recruits[0].Name = "Recruit Armsman McTavish";
            recruits[0].Model = 40;
            template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 69);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 46);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
            template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
            template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);
            template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
            recruits[0].Inventory = template.CloseTemplate();
            recruits[0].SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.TWO_HANDED, 69, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.TORSO, 46, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.LEGS, 47, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.FEET, 50, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.ARMS, 48, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.HAND, 49, 0, 0, 0);

            recruits[1].Name = "Recruit Paladin Andral";
            recruits[1].Model = 41;
            template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 6);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 41);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 42);
            template.AddNPCEquipment(eInventorySlot.FeetArmor, 45);
            template.AddNPCEquipment(eInventorySlot.ArmsArmor, 43);
            template.AddNPCEquipment(eInventorySlot.HandsArmor, 44);
            recruits[1].Inventory = template.CloseTemplate();
            recruits[1].SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.TWO_HANDED, 6, 0, 0, 0);
            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.TORSO, 41, 0, 0, 0);
            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.LEGS, 42, 0, 0, 0);
            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.FEET, 45, 0, 0, 0);
            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.ARMS, 43, 0, 0, 0);
            //			recruits[1].AddNPCEquipment((byte) eEquipmentItems.HAND, 44, 0, 0, 0);

            recruits[2].Name = "Recruit Scout Gillman";
            recruits[2].Model = 32;
            template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 4);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
            recruits[2].Inventory = template.CloseTemplate();
            recruits[2].SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

            //			recruits[2].AddNPCEquipment((byte) eEquipmentItems.RIGHT_HAND, 4, 0, 0, 0);
            //			recruits[2].AddNPCEquipment((byte) eEquipmentItems.TORSO, 36, 0, 0, 0);
            //			recruits[2].AddNPCEquipment((byte) eEquipmentItems.LEGS, 37, 0, 0, 0);

            recruits[3].Name = "Recruit Scout Stuart";
            recruits[3].Model = 32;
            template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 5);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
            recruits[3].Inventory = template.CloseTemplate();
            recruits[3].SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

            //			recruits[3].AddNPCEquipment((byte) eEquipmentItems.RIGHT_HAND, 5, 0, 0, 0);
            //			recruits[3].AddNPCEquipment((byte) eEquipmentItems.TORSO, 36, 0, 0, 0);
            //			recruits[3].AddNPCEquipment((byte) eEquipmentItems.LEGS, 37, 0, 0, 0);

            for (int i = 0; i < recruits.Length; i++)
            {
                recruits[i].AddToWorld();
            }
        }
Exemple #28
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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Godeleva Dowden", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                godelevaDowden       = new GameNPC();
                godelevaDowden.Model = 7;
                godelevaDowden.Name  = "Godeleva Dowden";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + godelevaDowden.Name + ", creating him ...");
                }
                godelevaDowden.GuildName       = "Part of " + questTitle + " Quest";
                godelevaDowden.Realm           = eRealm.Albion;
                godelevaDowden.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 138);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 134);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 135);
                godelevaDowden.Inventory = template.CloseTemplate();
                godelevaDowden.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                godelevaDowden.Size    = 48;
                godelevaDowden.Level   = 40;
                godelevaDowden.X       = 559528;
                godelevaDowden.Y       = 510953;
                godelevaDowden.Z       = 2488;
                godelevaDowden.Heading = 1217;

                //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)
                {
                    godelevaDowden.SaveIntoDatabase();
                }

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

            #endregion

            #region defineItems

            // item db check
            woodenBucket = GameServer.Database.FindObjectByKey <ItemTemplate>("wooden_bucket");
            if (woodenBucket == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Wooden Bucket, creating it ...");
                }
                woodenBucket        = new ItemTemplate();
                woodenBucket.Name   = "Wooden Bucket";
                woodenBucket.Level  = 1;
                woodenBucket.Weight = 10;
                woodenBucket.Model  = 1610;

                woodenBucket.Object_Type = (int)eObjectType.GenericItem;
                woodenBucket.Id_nb       = "wooden_bucket";
                woodenBucket.Price       = 0;
                woodenBucket.IsPickable  = false;
                woodenBucket.IsDropable  = false;

                woodenBucket.Quality       = 100;
                woodenBucket.Condition     = 1000;
                woodenBucket.MaxCondition  = 1000;
                woodenBucket.Durability    = 1000;
                woodenBucket.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(woodenBucket);
            }

            // item db check
            fullWoodenBucket = GameServer.Database.FindObjectByKey <ItemTemplate>("full_wooden_bucket");
            if (fullWoodenBucket == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Full Wooden Bucket, creating it ...");
                }
                fullWoodenBucket        = new ItemTemplate();
                fullWoodenBucket.Name   = "Full Wooden Bucket";
                fullWoodenBucket.Level  = 1;
                fullWoodenBucket.Weight = 250;
                fullWoodenBucket.Model  = 1610;

                fullWoodenBucket.Object_Type = (int)eObjectType.GenericItem;
                fullWoodenBucket.Id_nb       = "full_wooden_bucket";
                fullWoodenBucket.Price       = 0;
                fullWoodenBucket.IsPickable  = false;
                fullWoodenBucket.IsDropable  = false;

                fullWoodenBucket.Quality       = 100;
                fullWoodenBucket.Condition     = 1000;
                fullWoodenBucket.MaxCondition  = 1000;
                fullWoodenBucket.Durability    = 1000;
                fullWoodenBucket.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(fullWoodenBucket);
            }

            // item db check
            reedBracer = GameServer.Database.FindObjectByKey <ItemTemplate>("reed_bracer");
            if (reedBracer == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Reed Bracer of Health creating it ...");
                }
                reedBracer        = new ItemTemplate();
                reedBracer.Name   = "Reed Bracer";
                reedBracer.Level  = 3;
                reedBracer.Weight = 1;
                reedBracer.Model  = 598;

                reedBracer.Object_Type = (int)eObjectType.Magical;
                reedBracer.Item_Type   = (int)eEquipmentItems.L_BRACER;
                reedBracer.Id_nb       = "reed_bracer";

                reedBracer.Price      = Money.GetMoney(0, 0, 0, 0, 30);
                reedBracer.IsPickable = true;
                reedBracer.IsDropable = true;

                reedBracer.Bonus      = 1;
                reedBracer.Bonus1Type = (int)eProperty.MaxHealth;
                reedBracer.Bonus1     = 8;
                reedBracer.Bonus2Type = (int)eProperty.Resist_Cold;
                reedBracer.Bonus2     = 1;

                reedBracer.Quality       = 100;
                reedBracer.Condition     = 1000;
                reedBracer.MaxCondition  = 1000;
                reedBracer.Durability    = 1000;
                reedBracer.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(reedBracer);
            }

            #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));

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

            GameEventMgr.AddHandler(godelevaDowden, GameLivingEvent.Interact, new DOLEventHandler(TalkToGodelevaDowden));
            GameEventMgr.AddHandler(godelevaDowden, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToGodelevaDowden));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            godelevaDowden.AddQuestToGive(typeof(GodelevasNeed));

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

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Blercyn", eRealm.Hibernia);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                Blercyn = new GameNPC();
                Blercyn.Model = 700;
                Blercyn.Name = "Blercyn";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + Blercyn.Name + ", creating him ...");
                //Blercyn.GuildName = "Part of " + questTitle + " Quest";
                Blercyn.Realm = eRealm.Hibernia;
                Blercyn.CurrentRegionID = 200;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58);
                Blercyn.Inventory = template.CloseTemplate();
                Blercyn.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                Blercyn.Size = 50;
                Blercyn.Level = 50;
                Blercyn.X = 348614;
                Blercyn.Y = 492141;
                Blercyn.Z = 5199;
                Blercyn.Heading = 1539;

                //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)
                    Blercyn.SaveIntoDatabase();

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

            //Pompin The Crier
            npcs = WorldMgr.GetNPCsByName("Epona", eRealm.Hibernia);
            if (npcs.Length == 0)
            {
                Epona = new GameNPC();
                Epona.Model = 10;
                Epona.Name = "Epona";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + Epona.Name + ", creating him ...");
                //Blercyn.GuildName = "Part of " + questTitle + " Quest";
                Epona.Realm = eRealm.Hibernia;
                Epona.CurrentRegionID = 200;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58);
                Epona.Inventory = template.CloseTemplate();
                Epona.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                Epona.Size = 50;
                Epona.Level = 50;
                Epona.X = 347606;
                Epona.Y = 490658;
                Epona.Z = 5227;
                Epona.Heading = 1342;

                //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)
                    Epona.SaveIntoDatabase();

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

            #endregion defineNPCS

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

            GameEventMgr.AddHandler(Blercyn, GameLivingEvent.Interact, new DOLEventHandler(TalkToBlercyn));
            GameEventMgr.AddHandler(Blercyn, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToBlercyn));

            GameEventMgr.AddHandler(Epona, GameLivingEvent.Interact, new DOLEventHandler(TalkToEpona));
            GameEventMgr.AddHandler(Epona, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToEpona));

            Blercyn.AddQuestToGive(typeof(SearchForKnowledge));

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

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Elvar Ironhand", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                elvarIronhand       = new GameNPC();
                elvarIronhand.Model = 10;
                elvarIronhand.Name  = "Elvar Ironhand";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + elvarIronhand.Name + ", creating him ...");
                }

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

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 12);
                elvarIronhand.Inventory = template.CloseTemplate();
                elvarIronhand.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                elvarIronhand.Size    = 54;
                elvarIronhand.Level   = 17;
                elvarIronhand.X       = 561351;
                elvarIronhand.Y       = 510292;
                elvarIronhand.Z       = 2400;
                elvarIronhand.Heading = 3982;

                // 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)
                {
                    elvarIronhand.SaveIntoDatabase();
                }

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

            // item db check
            wellPreservedBones = GameServer.Database.FindObjectByKey <ItemTemplate>("well_preserved_bone");
            if (wellPreservedBones == null)
            {
                wellPreservedBones      = new ItemTemplate();
                wellPreservedBones.Name = "Well-Preserved Bone";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + wellPreservedBones.Name + ", creating it ...");
                }

                wellPreservedBones.Level  = 0;
                wellPreservedBones.Weight = 1;
                wellPreservedBones.Model  = 497;

                wellPreservedBones.Object_Type = (int)eObjectType.GenericItem;
                wellPreservedBones.Id_nb       = "well_preserved_bone";
                wellPreservedBones.Price       = 0;
                wellPreservedBones.IsPickable  = false;
                wellPreservedBones.IsDropable  = false;

                wellPreservedBones.Quality       = 100;
                wellPreservedBones.Condition     = 1000;
                wellPreservedBones.MaxCondition  = 1000;
                wellPreservedBones.Durability    = 1000;
                wellPreservedBones.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(wellPreservedBones);
            }

            // item db check
            twoWellPreservedBones = GameServer.Database.FindObjectByKey <ItemTemplate>("two_well_preserved_bones");
            if (twoWellPreservedBones == null)
            {
                twoWellPreservedBones      = new ItemTemplate();
                twoWellPreservedBones.Name = "Two Well-Preserved Bones";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + twoWellPreservedBones.Name + ", creating it ...");
                }

                twoWellPreservedBones.Level  = 0;
                twoWellPreservedBones.Weight = 1;
                twoWellPreservedBones.Model  = 497;

                twoWellPreservedBones.Object_Type = (int)eObjectType.GenericItem;
                twoWellPreservedBones.Id_nb       = "two_well_preserved_bones";
                twoWellPreservedBones.Price       = 0;
                twoWellPreservedBones.IsPickable  = false;
                twoWellPreservedBones.IsDropable  = false;

                twoWellPreservedBones.Quality       = 100;
                twoWellPreservedBones.Condition     = 1000;
                twoWellPreservedBones.MaxCondition  = 1000;
                twoWellPreservedBones.Durability    = 1000;
                twoWellPreservedBones.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(twoWellPreservedBones);
            }

            /* 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));

            GameEventMgr.AddHandler(elvarIronhand, GameLivingEvent.Interact, new DOLEventHandler(TalkToElvarIronhand));
            GameEventMgr.AddHandler(elvarIronhand, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToElvarIronhand));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            elvarIronhand.AddQuestToGive(typeof(BuildingABetterBow));

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

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Josson", eRealm.Hibernia);

            if (npcs.Length == 0)
            {
                Josson = new GameNPC();
                Josson.Model = 382;
                Josson.Name = "Josson";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + Josson.Name + ", creating him ...");
                //k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                //Josson.GuildName = "Part of " + questTitle + " Quest";
                Josson.Realm = eRealm.Hibernia;
                Josson.CurrentRegionID = 200;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 386);   //Slot 22
                template.AddNPCEquipment(eInventorySlot.HeadArmor, 835);    //Slot 21
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 387);     //Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 383);    //Slot 25
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 384);    //Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 385);    //Slot 28
                Josson.Inventory = template.CloseTemplate();
                Josson.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                Josson.Size = 48;
                Josson.Level = 50;
                Josson.X = 346627;
                Josson.Y = 491453;
                Josson.Z = 5247;
                Josson.Heading = 2946;

                if (SAVE_INTO_DATABASE)
                    Josson.SaveIntoDatabase();

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

            #endregion

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

            GameEventMgr.AddHandler(Josson, GameLivingEvent.Interact, new DOLEventHandler(TalkToJosson));
            GameEventMgr.AddHandler(Josson, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToJosson));

            Josson.AddQuestToGive(typeof(MagicalBacklash));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Andrew Wyatt", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
                * this users Mob Database, so we simply create one ;-)
                * else we take the existing one. And if more than one exist, we take
                * the first ...
                */
            if (npcs.Length == 0)
            {
                andrewWyatt = new GameNPC();
                andrewWyatt.Model = 80;
                andrewWyatt.Name = "Andrew Wyatt";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + andrewWyatt.Name + ", creating him ...");
                andrewWyatt.GuildName = "Part of " + questTitle + " Quest";
                andrewWyatt.Realm = eRealm.Albion;
                andrewWyatt.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 80);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 54);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 51);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 52);
                andrewWyatt.Inventory = template.CloseTemplate();
                andrewWyatt.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                andrewWyatt.Size = 48;
                andrewWyatt.Level = 30;
                andrewWyatt.X = 559590;
                andrewWyatt.Y = 511039;
                andrewWyatt.Z = 2488;
                andrewWyatt.Heading = 1524;

                //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)
                    andrewWyatt.SaveIntoDatabase();

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

            npcs = WorldMgr.GetNPCsByName("Geor Nadren", eRealm.Albion);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Geor Nadren, creating him ...");
                georNadren = new GameNPC();
                georNadren.Model = 9;
                georNadren.Name = "Geor Nadren";
                georNadren.GuildName = "Part of " + questTitle + " Quest";
                georNadren.Realm = eRealm.Albion;
                georNadren.CurrentRegionID = 10;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                georNadren.Inventory = template.CloseTemplate();
                georNadren.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                georNadren.Size = 51;
                georNadren.Level = 8;
                georNadren.X = 37355;
                georNadren.Y = 30943;
                georNadren.Z = 8002;
                georNadren.Heading = 3231;

                //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)
                    georNadren.SaveIntoDatabase();

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

            npcs = WorldMgr.GetNPCsByName("Ver Nuren", eRealm.Albion);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Ver Nuren, creating him ...");
                verNuren = new GameNPC();
                verNuren.Model = 9;
                verNuren.Name = "Ver Nuren";
                verNuren.GuildName = "Part of " + questTitle + " Quest";
                verNuren.Realm = eRealm.Albion;
                verNuren.CurrentRegionID = 10;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 61);
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                verNuren.Inventory = template.CloseTemplate();
                verNuren.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                verNuren.Size = 51;
                verNuren.Level = 8;
                verNuren.X = 36799;
                verNuren.Y = 30786;
                verNuren.Z = 8010;
                verNuren.Heading = 625;

                //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)
                    verNuren.SaveIntoDatabase();

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

            #endregion

            #region defineItems

            // item db check
            bundleOfBearSkins = GameServer.Database.FindObjectByKey<ItemTemplate>("bundle_of_bear_skins");
            if (bundleOfBearSkins == null)
            {
                bundleOfBearSkins = new ItemTemplate();
                bundleOfBearSkins.Name = "Bundle of Bear Skins";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find "+bundleOfBearSkins.Name+", creating it ...");
                bundleOfBearSkins.Level = 0;
                bundleOfBearSkins.Weight = 0;
                bundleOfBearSkins.Model = 100;

                bundleOfBearSkins.Object_Type = (int) eObjectType.GenericItem;
                bundleOfBearSkins.Id_nb = "bundle_of_bear_skins";
                bundleOfBearSkins.Price = 0;
                bundleOfBearSkins.IsPickable = false;
                bundleOfBearSkins.IsDropable = false;

                bundleOfBearSkins.Quality = 100;
                bundleOfBearSkins.Condition = 1000;
                bundleOfBearSkins.MaxCondition = 1000;
                bundleOfBearSkins.Durability = 1000;
                bundleOfBearSkins.MaxDurability = 1000;
                GameServer.Database.AddObject(bundleOfBearSkins);
            }

            // item db check
            spoolOfLeatherworkingThread = GameServer.Database.FindObjectByKey<ItemTemplate>("spool_of_leatherworking_thread");
            if (spoolOfLeatherworkingThread == null)
            {
                spoolOfLeatherworkingThread = new ItemTemplate();
                spoolOfLeatherworkingThread.Name = "Spool of Leatherworking Thread";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find "+spoolOfLeatherworkingThread.Name+", creating it ...");
                spoolOfLeatherworkingThread.Level = 0;
                spoolOfLeatherworkingThread.Weight = 0;
                spoolOfLeatherworkingThread.Model = 537;

                spoolOfLeatherworkingThread.Object_Type = (int) eObjectType.GenericItem;
                spoolOfLeatherworkingThread.Id_nb = "spool_of_leatherworking_thread";
                spoolOfLeatherworkingThread.Price = 0;
                spoolOfLeatherworkingThread.IsPickable = false;
                spoolOfLeatherworkingThread.IsDropable = false;

                spoolOfLeatherworkingThread.Quality = 100;
                spoolOfLeatherworkingThread.Condition = 1000;
                spoolOfLeatherworkingThread.MaxCondition = 1000;
                spoolOfLeatherworkingThread.Durability = 1000;
                spoolOfLeatherworkingThread.MaxDurability = 1000;
                GameServer.Database.AddObject(spoolOfLeatherworkingThread);
            }

            // item db check
            chokerOfTheBear = GameServer.Database.FindObjectByKey<ItemTemplate>("choker_of_the_bear");
            if (chokerOfTheBear == null)
            {
                chokerOfTheBear = new ItemTemplate();
                chokerOfTheBear.Name = "Choker of the Bear";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find "+chokerOfTheBear.Name+", creating it ...");

                chokerOfTheBear.Level = 5;
                chokerOfTheBear.Weight = 6;
                chokerOfTheBear.Model = 101;

                chokerOfTheBear.Object_Type = (int) eObjectType.Magical;
                chokerOfTheBear.Item_Type = (int) eEquipmentItems.NECK;
                chokerOfTheBear.Id_nb = "choker_of_the_bear";

                chokerOfTheBear.Price = Money.GetMoney(0,0,0,0,30);
                chokerOfTheBear.IsPickable = true;
                chokerOfTheBear.IsDropable = true;

                chokerOfTheBear.Bonus = 1;
                chokerOfTheBear.Bonus1Type = (int)eProperty.Strength;
                chokerOfTheBear.Bonus1 = 4;
                chokerOfTheBear.Bonus2Type = (int)eProperty.Resist_Thrust;
                chokerOfTheBear.Bonus2 = 1;

                chokerOfTheBear.Quality = 100;
                chokerOfTheBear.Condition = 1000;
                chokerOfTheBear.MaxCondition = 1000;
                chokerOfTheBear.Durability = 1000;
                chokerOfTheBear.MaxDurability = 1000;
                GameServer.Database.AddObject(chokerOfTheBear);
            }

            #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));

            GameEventMgr.AddHandler(andrewWyatt, GameLivingEvent.Interact, new DOLEventHandler(TalkToAndrewWyatt));
            GameEventMgr.AddHandler(andrewWyatt, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToAndrewWyatt));

            GameEventMgr.AddHandler(georNadren, GameObjectEvent.Interact, new DOLEventHandler(TalkToGeorNadren));
            GameEventMgr.AddHandler(georNadren, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToGeorNadren));

            GameEventMgr.AddHandler(verNuren, GameObjectEvent.Interact, new DOLEventHandler(TalkToVerNuren));
            GameEventMgr.AddHandler(verNuren, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToVerNuren));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            andrewWyatt.AddQuestToGive(typeof (AndrewsSkins));

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

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

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Richael", eRealm.Hibernia);

            if (npcs.Length == 0)
            {
                Richael       = new GameNPC();
                Richael.Model = 377;
                Richael.Name  = "Richael";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + Richael.Name + ", creating her ...");
                }

                // k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                // Richael.GuildName = "Part of " + questTitle + " Quest";
                Richael.Realm           = eRealm.Hibernia;
                Richael.CurrentRegionID = 200;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 416, 37);       // Slot 22
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 413, 37);       // Slot 25
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 417, 37);        // Slot 23
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 414, 35);        // Slot 27
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 35);             // Slot 26
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 415, 37);        // Slot 28
                Richael.Inventory = template.CloseTemplate();
                Richael.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                Richael.Size    = 48;
                Richael.Level   = 38;
                Richael.X       = 347089;
                Richael.Y       = 491290;
                Richael.Z       = 5247;
                Richael.Heading = 978;

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

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

            Demons_Breach_Area = WorldMgr.GetRegion(Demons_Breach.RegionID).AddArea(new Area.Circle(string.Empty, Demons_Breach.X, Demons_Breach.Y, Demons_Breach.Z, 200));
            Demons_Breach_Area.RegisterPlayerEnter(new DOLEventHandler(PlayerEnterDemonBreachArea));

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

            GameEventMgr.AddHandler(Richael, GameLivingEvent.Interact, new DOLEventHandler(TalkToRichael));
            GameEventMgr.AddHandler(Richael, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToRichael));

            Richael.AddQuestToGive(typeof(ToReachTheBreach));

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

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Cemmeth Budgwold", eRealm.Albion);

            if (npcs.Length == 0)
            {
                CemmethBudgwold = new GameNPC();
                CemmethBudgwold.Model = 28;
                CemmethBudgwold.Name = "Cemmeth Budgwold";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + CemmethBudgwold.Name + ", creating him ...");
                //k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                //Cemmeth.GuildName = "Part of " + questTitle + " Quest";
                CemmethBudgwold.Realm = eRealm.Albion;
                CemmethBudgwold.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);    //Slot 22
                template.AddNPCEquipment(eInventorySlot.HeadArmor, 93);     //Slot 21
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);     //Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 46);    //Slot 25
                template.AddNPCEquipment(eInventorySlot.Cloak, 91);         //Slot 26
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);     //Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);     //Slot 28
                template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 68); //Slot 12
                CemmethBudgwold.Inventory = template.CloseTemplate();
                CemmethBudgwold.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                CemmethBudgwold.Size = 50;
                CemmethBudgwold.Level = 38;
                CemmethBudgwold.X = 560528;
                CemmethBudgwold.Y = 513140;
                CemmethBudgwold.Z = 2394;
                CemmethBudgwold.Heading = 2275;

                if (SAVE_INTO_DATABASE)
                    CemmethBudgwold.SaveIntoDatabase();

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

            #endregion

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

            GameEventMgr.AddHandler(CemmethBudgwold, GameLivingEvent.Interact, new DOLEventHandler(TalkToCemmethBudgwold));
            GameEventMgr.AddHandler(CemmethBudgwold, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToCemmethBudgwold));

            CemmethBudgwold.AddQuestToGive(typeof(CemmethsOrders));

            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initialized");
        }
        /// <summary>
        /// Clones a player's appearance and melee abilities to a GameNPC
        /// </summary>
        /// <param name="player">The player to clone</param>
        /// <param name="clone">The target GameNPC to clone the player to</param>
        /// <param name="loadStyles">True to load styles</param>
        // Players cloned by name, from the database, tend to be a bit tougher than players cloned from a GamePlayer
        public static void ClonePlayer(GamePlayer player, GameNPC clone, bool loadStyles)
        {
            if (player == null || clone == null)
            {
                return;
            }

            //clone.Model = GetPlayerModel( (eRace)player.Race, player.PlayerCharacter.Gender );
            SetNPCModel(clone, player.Model);
            clone.Level = player.Level;
            clone.Name  = player.Name + (player.LastName.Length > 0 ? " " + player.LastName : "");
            clone.TempProperties.setProperty(CLONE_CLASS_NAME, player.CharacterClass.Name);
            clone.GuildName        = player.GuildName;
            clone.IsCloakHoodUp    = player.IsCloakHoodUp;
            clone.IsCloakInvisible = player.IsCloakInvisible;
            clone.IsHelmInvisible  = player.IsHelmInvisible;

            clone.Strength     = (short)player.GetModified(eProperty.Strength);
            clone.Constitution = (short)player.GetModified(eProperty.Constitution);
            clone.Dexterity    = (short)player.GetModified(eProperty.Dexterity);
            // stats work differently for mobs, and qui goes crazy above about 150
            clone.Quickness = (short)(100 + player.Level);

            clone.MeleeDamageType = player.AttackWeapon == null ? eDamageType.Slash : (eDamageType)player.AttackWeapon.Type_Damage;
            clone.MaxSpeedBase    = player.MaxSpeedBase;

            #region Inventory

            GameNpcInventoryTemplate npcInventory = new GameNpcInventoryTemplate();
            InventoryItem            item;

            foreach (eInventorySlot slot in itemsToCopy)
            {
                item = player.Inventory.GetItem(slot);

                if (item != null)
                {
                    int itemModel = item.Model;

                    // keep clothing manager uses model IDs of 3800-3802 for guild cloaks... doesn't seem to work here :(
                    //if ( item.SlotPosition == (int)eInventorySlot.Cloak && item.Emblem > 0 )
                    //	itemModel = 3799 + (int)player.Realm;

                    npcInventory.AddNPCEquipment(slot, item.Model, item.Color, item.Effect, item.Extension);
                }
            }

            npcInventory.CloseTemplate();
            clone.Inventory = npcInventory;
            clone.UpdateNPCEquipmentAppearance();
            #endregion Inventory

            #region Behavior
            if (player.AttackWeapon != null)
            {
                if (player.AttackWeapon.Hand == 2)
                {
                    clone.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);
                }
                else
                {
                    clone.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);
                }
            }

            if (player.CanUseLefthandedWeapon && player.Inventory.GetItem(eInventorySlot.LeftHandWeapon) != null && player.Inventory.GetItem(eInventorySlot.LeftHandWeapon).Object_Type != (int)eObjectType.Shield)
            {
                clone.LeftHandSwingChance = LEFTSWINGCHANCE;
            }

            // if a shield is equipped, copy the character's block chance
            // GamePlayer.GetBlockChance() returns a percentage from 1-99
            // GameNPC.BlockChance represents block chance percentage in the range 1-99
            if (player.Inventory.GetItem(eInventorySlot.LeftHandWeapon) != null && player.Inventory.GetItem(eInventorySlot.LeftHandWeapon).Object_Type == (int)eObjectType.Shield)
            {
                clone.BlockChance = (byte)player.GetBlockChance();
            }

            // GamePlayer.GetParryChance() returns a percentage from 1-99
            // GameNPC.ParryChance represents parry chance percentage in the range 1-99
            clone.ParryChance = (byte)player.GetParryChance();

            // GamePlayer.GetEvadeChance() returns a percentage from 1-99
            // GameNPC.EvadeChance represents evade chance percentage in the range 1-99
            clone.EvadeChance = (byte)player.GetEvadeChance();

            if (loadStyles)
            {
                clone.Styles = GetCharacterStyles(player.DBCharacter);
            }

            clone.SetOwnBrain(new MeleeStyler());
            #endregion Behavior

            //josh
        }
Exemple #37
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");
        }
        /// <summary>
        /// Clones a player's appearance and melee abilities to a GameNPC
        /// </summary>
        /// <param name="playerName">Name of the character - case-sensitive</param>
        /// <param name="clone">The target GameNPC to clone the player to</param>
        /// <param name="loadStyles">True to load styles</param>
        /// <param name="cloneLevel">Level to set the clone to (affects stat bonuses); 0 to copy player's level</param>
        /// <returns>True if the player was found and cloned, false if not clone supplied or character not found</returns>
        // Players cloned by name, from the database, tend to be a bit tougher than players cloned from a GamePlayer
        public static bool ClonePlayer(string playerName, GameNPC clone, bool loadStyles, byte cloneLevel)
        {
            if (clone == null)
            {
                return(false);
            }

            DOLCharacters dbchar = GameServer.Database.SelectObject <DOLCharacters>("Name = '" + GameServer.Database.Escape(playerName) + "'");

            if (dbchar == null)
            {
                return(false);
            }

            //clone.Model = GetPlayerModel( (eRace)dbchar.Race, dbchar.Gender );
            SetNPCModel(clone, (ushort)dbchar.CurrentModel);
            clone.Level = cloneLevel > 0 ? cloneLevel : (byte)dbchar.Level;
            clone.Name  = dbchar.Name + (dbchar.LastName.Length > 0 ? " " + dbchar.LastName : "");
            clone.TempProperties.setProperty(CLONE_CLASS_NAME, ((eCharacterClass)dbchar.Class).ToString());

            if (dbchar.GuildID.Length > 0)
            {
                Guild playerGuild = GuildMgr.GetGuildByGuildID(dbchar.GuildID);
                //DBGuild guild = GameServer.Database.SelectObject( typeof( DBGuild ), "GuildID = '" + dbchar.GuildID + "'" ) as DBGuild;

                if (playerGuild != null)
                {
                    clone.GuildName = playerGuild.Name;
                    //clone.GuildName = guild.GuildName;
                }
            }

            clone.IsCloakHoodUp    = dbchar.IsCloakHoodUp;
            clone.IsCloakInvisible = dbchar.IsCloakInvisible;
            clone.IsHelmInvisible  = dbchar.IsHelmInvisible;

            short baseBuffs = (short)(clone.Level * 1.25);
            short specBuffs = (short)(clone.Level * 1.25 * 1.5);
            short itemBonus = (short)((clone.Level * 1.5) + (clone.Level / 2.0 + 1.0));

            clone.Strength     = (short)(dbchar.Strength + baseBuffs + specBuffs + itemBonus);
            clone.Constitution = (short)(dbchar.Constitution + baseBuffs + specBuffs + itemBonus);
            clone.Dexterity    = (short)(dbchar.Dexterity + baseBuffs + specBuffs + itemBonus);
            // QUI affects mobs differently than players and goes nuts around 200+
            clone.Quickness       = (short)(165);
            clone.MeleeDamageType = eDamageType.Slash;

            clone.MaxSpeedBase = ((short)dbchar.MaxSpeed);

            // parryLevel is capped at 51 and at 51 accounts for 77% of parry chance (remaining 23% is from MoParry)
            byte parryLevel = GetCharacterSpecLevel(dbchar, Specs.Parry);
            // any parry beyond 51 is applied to parryBonus; at 23 parryBonus gives a 5% bonus to ParryChance
            byte parryBonus = 0;
            // same as for parry
            byte shieldLevel    = GetCharacterSpecLevel(dbchar, Specs.Shields);
            byte shieldBonus    = 0;
            byte evadeLevel     = GetCharacterAbilityLevel(dbchar, Abilities.Evade);
            byte moparryLevel   = GetCharacterAbilityLevel(dbchar, "Mastery of Parrying");
            byte moblockLevel   = GetCharacterAbilityLevel(dbchar, "Mastery of Blocking");
            byte mopainLevel    = GetCharacterAbilityLevel(dbchar, "Mastery of Pain");
            byte augStrLevel    = GetCharacterAbilityLevel(dbchar, "Augmented Strength");
            byte augConLevel    = GetCharacterAbilityLevel(dbchar, "Augmented Constitution");
            byte augDexLevel    = GetCharacterAbilityLevel(dbchar, "Augmented Dexterity");
            byte toughnessLevel = GetCharacterAbilityLevel(dbchar, "Toughness");
            byte pDefenseLevel  = GetCharacterAbilityLevel(dbchar, "Physical Defense");

            if (parryLevel > 0)
            {
                // if we have artificially increased the clone's level, apply the same increase to the parry spec level
                if (clone.Level > dbchar.Level)
                {
                    parryLevel = (byte)(parryLevel * ((double)cloneLevel / (double)dbchar.Level));
                }

                // item bonus
                parryLevel += (byte)(clone.Level / 5);
                // RR bonus
                parryLevel += (byte)((dbchar.RealmLevel + 10) / 10);
            }

            if (parryLevel > (clone.Level + 1))
            {
                parryBonus = (byte)(parryLevel - clone.Level - 1);
                parryLevel = (byte)(clone.Level + 1);
            }

            // now we normalize parry as if the character is level 50 and has a corresponding increase in spec level
            // hmmmm... only makes sense if the clone is lvl 50, yes?
            //parryLevel = (byte)( parryLevel * ( 51.0 / ( dbchar.Level + 1 ) ) );

            if (shieldLevel > 0)
            {
                // if we have artificially increased the clone's level, apply the same increase to the parry spec level
                if (clone.Level > dbchar.Level)
                {
                    shieldLevel = (byte)(shieldLevel * ((double)cloneLevel / (double)dbchar.Level));
                }

                // item bonus
                shieldLevel += (byte)(dbchar.Level / 5);
                // RR bonus
                shieldLevel += (byte)((dbchar.RealmLevel + 10) / 10);
            }

            if (shieldLevel > (dbchar.Level + 1))
            {
                shieldBonus = (byte)(shieldLevel - dbchar.Level - 1);
                shieldLevel = (byte)(dbchar.Level + 1);
            }

            // now we normalize shield as if the character is level 50 and has a corresponding increase in spec level
            //shieldLevel = (byte)( shieldLevel * ( 51.0 / ( dbchar.Level + 1 ) ) );

            clone.ParryChance = (byte)(MAX_PARRYCHANCE * ((parryLevel * 0.0151) + (m_masteryDefenseBonus[moparryLevel] * 0.01)));

            if (parryBonus > 0)
            {
                clone.ParryChance += (byte)(clone.ParryChance * (parryBonus / 23.0) * 0.05);
            }

            clone.BlockChance = (byte)(MAX_BLOCKCHANCE * ((shieldLevel * 0.0151) + (m_masteryDefenseBonus[moblockLevel] * 0.01)));

            if (shieldBonus > 0)
            {
                clone.BlockChance += (byte)(clone.BlockChance * (shieldBonus / 23.0) * 0.05);
            }

            clone.EvadeChance = (byte)(MAX_EVADECHANCE * evadeLevel / 7.0);

            clone.Strength     += (short)(m_augStatBonus[augStrLevel]);
            clone.Strength     += (short)(mopainLevel * 10.0);
            clone.Strength     += (short)((int)(dbchar.RealmLevel / 10.0) * 20.0);
            clone.Constitution += (short)(m_augStatBonus[augConLevel]);
            clone.Constitution += (short)(toughnessLevel * 4);
            clone.Constitution += (short)(pDefenseLevel * 5);
            clone.Constitution += (short)(dbchar.ChampionLevel * 5);
            clone.Dexterity    += (short)(m_augStatBonus[augDexLevel]);

            #region Inventory
            GameNpcInventoryTemplate npcInventory = new GameNpcInventoryTemplate();
            IList <InventoryItem>    charItems    = GameServer.Database.SelectObjects <InventoryItem>("OwnerID = '" + dbchar.ObjectId + "'");

            foreach (InventoryItem item in charItems)
            {
                if (itemsToCopy.Contains((eInventorySlot)item.SlotPosition))
                {
                    if ((item.SlotPosition == (int)eInventorySlot.RightHandWeapon && dbchar.ActiveWeaponSlot == 0) ||
                        (item.SlotPosition == (int)eInventorySlot.TwoHandWeapon && dbchar.ActiveWeaponSlot == 1))
                    {
                        clone.MeleeDamageType = (eDamageType)item.Type_Damage;
                    }
                    else if (item.SlotPosition == (int)eInventorySlot.LeftHandWeapon)
                    {
                        if (item.Object_Type != (int)eObjectType.Shield)
                        {
                            clone.LeftHandSwingChance = LEFTSWINGCHANCE;
                        }
                    }

                    int itemModel = item.Model;

                    // keep clothing manager uses model IDs of 3800-3802 for guild cloaks... doesn't seem to work here :(
                    //if ( item.SlotPosition == (int)eInventorySlot.Cloak && item.Emblem > 0 )
                    //	itemModel = 3799 + dbchar.Realm;

                    npcInventory.AddNPCEquipment((eInventorySlot)item.SlotPosition, item.Model, item.Color, item.Effect, item.Extension);
                }
            }

            npcInventory.CloseTemplate();
            clone.Inventory = npcInventory;

            switch (dbchar.ActiveWeaponSlot & 0x0F)
            {
            case (int)GameLiving.eActiveWeaponSlot.TwoHanded: clone.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded); break;

            case (int)GameLiving.eActiveWeaponSlot.Distance: clone.SwitchWeapon(GameLiving.eActiveWeaponSlot.Distance); break;

            default: clone.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard); break;
            }

            #endregion Inventory

            if (loadStyles)
            {
                clone.Styles = GetCharacterStyles(dbchar);
            }

            clone.SetOwnBrain(new MeleeStyler());
            //josh
            return(true);
        }
Exemple #39
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
                return;
            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initializing ...");

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Richael", eRealm.Hibernia);

            if (npcs.Length == 0)
            {
                Richael = new GameNPC();
                Richael.Model = 377;
                Richael.Name = "Richael";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + Richael.Name + ", creating her ...");
                //k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                //Richael.GuildName = "Part of " + questTitle + " Quest";
                Richael.Realm = eRealm.Hibernia;
                Richael.CurrentRegionID = 200;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 416, 37);       //Slot 22
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 413, 37);       //Slot 25
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 417, 37);        //Slot 23
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 414, 35);        //Slot 27
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 35);             //Slot 26
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 415, 37);             //Slot 28
                Richael.Inventory = template.CloseTemplate();
                Richael.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                Richael.Size = 48;
                Richael.Level = 38;
                Richael.X = 347089;
                Richael.Y = 491290;
                Richael.Z = 5247;
                Richael.Heading = 978;

                if (SAVE_INTO_DATABASE)
                    Richael.SaveIntoDatabase();

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

            #endregion
            #region defineAreas
            Demons_Breach_Area = WorldMgr.GetRegion(Demons_Breach.RegionID).AddArea(new Area.Circle("", Demons_Breach.X, Demons_Breach.Y, Demons_Breach.Z, 200));
            Demons_Breach_Area.RegisterPlayerEnter(new DOLEventHandler(PlayerEnterDemonBreachArea));
            #endregion

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

            GameEventMgr.AddHandler(Richael, GameLivingEvent.Interact, new DOLEventHandler(TalkToRichael));
            GameEventMgr.AddHandler(Richael, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToRichael));

            Richael.AddQuestToGive(typeof(ToReachTheBreach));

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


            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Lady Grynoch", eRealm.Albion);

            if (npcs.Length == 0)
            {
                LadyGrynoch       = new GameNPC();
                LadyGrynoch.Model = 5;
                LadyGrynoch.Name  = "Lady Grynoch";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + LadyGrynoch.Name + ", creating her ...");
                }
                //k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                //LadyGrynoch.GuildName = "Part of " + questTitle + " Quest";
                LadyGrynoch.Realm           = eRealm.Albion;
                LadyGrynoch.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58);                    //Slot 25
                LadyGrynoch.Inventory = template.CloseTemplate();
                LadyGrynoch.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                LadyGrynoch.Size    = 51;
                LadyGrynoch.Level   = 38;
                LadyGrynoch.X       = 559698;
                LadyGrynoch.Y       = 513578;
                LadyGrynoch.Z       = 2428;
                LadyGrynoch.Heading = 2742;

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

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

            #endregion
            #region defineAreas
            Burial_Tomb_Area = WorldMgr.GetRegion(Burial_Tomb.RegionID).AddArea(new Area.Circle("", Burial_Tomb.X, Burial_Tomb.Y, Burial_Tomb.Z, 200));
            Burial_Tomb_Area.RegisterPlayerEnter(new DOLEventHandler(PlayerEnterBurialTombArea));
            #endregion

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

            GameEventMgr.AddHandler(LadyGrynoch, GameLivingEvent.Interact, new DOLEventHandler(TalkToLadyGrynoch));
            GameEventMgr.AddHandler(LadyGrynoch, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToLadyGrynoch));

            LadyGrynoch.AddQuestToGive(typeof(TombWithAView));

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

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Sir Dorian", eRealm.Albion);

            if (npcs.Length == 0)
            {
                sirDorian = new GameNPC();
                sirDorian.Model = 28;
                sirDorian.Name = "Sir Dorian";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + sirDorian.Name + ", creating him ...");
                //k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                //sirDorian.GuildName = "Part of " + questTitle + " Quest";
                sirDorian.Realm = eRealm.Albion;
                sirDorian.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 46);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);
                sirDorian.Inventory = template.CloseTemplate();
                sirDorian.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                sirDorian.Size = 52;
                sirDorian.Level = 40;
                sirDorian.X = 560869;
                sirDorian.Y = 511737;
                sirDorian.Z = 2344;
                sirDorian.Heading = 2930;

                if (SAVE_INTO_DATABASE)
                    sirDorian.SaveIntoDatabase();

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

            #endregion

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

            GameEventMgr.AddHandler(sirDorian, GameLivingEvent.Interact, new DOLEventHandler(TalkTosirDorian));
            GameEventMgr.AddHandler(sirDorian, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkTosirDorian));

            sirDorian.AddQuestToGive(typeof(DredgeUpAPledge));

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


            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Blercyn", eRealm.Hibernia);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                Blercyn       = new GameNPC();
                Blercyn.Model = 700;
                Blercyn.Name  = "Blercyn";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + Blercyn.Name + ", creating him ...");
                }
                //Blercyn.GuildName = "Part of " + questTitle + " Quest";
                Blercyn.Realm           = eRealm.Hibernia;
                Blercyn.CurrentRegionID = 200;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58);
                Blercyn.Inventory = template.CloseTemplate();
                Blercyn.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                Blercyn.Size    = 50;
                Blercyn.Level   = 50;
                Blercyn.X       = 348614;
                Blercyn.Y       = 492141;
                Blercyn.Z       = 5199;
                Blercyn.Heading = 1539;

                //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)
                {
                    Blercyn.SaveIntoDatabase();
                }

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

            //Pompin The Crier
            npcs = WorldMgr.GetNPCsByName("Epona", eRealm.Hibernia);
            if (npcs.Length == 0)
            {
                Epona       = new GameNPC();
                Epona.Model = 10;
                Epona.Name  = "Epona";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + Epona.Name + ", creating him ...");
                }
                //Blercyn.GuildName = "Part of " + questTitle + " Quest";
                Epona.Realm           = eRealm.Hibernia;
                Epona.CurrentRegionID = 200;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58);
                Epona.Inventory = template.CloseTemplate();
                Epona.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                Epona.Size    = 50;
                Epona.Level   = 50;
                Epona.X       = 347606;
                Epona.Y       = 490658;
                Epona.Z       = 5227;
                Epona.Heading = 1342;

                //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)
                {
                    Epona.SaveIntoDatabase();
                }

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

            #endregion

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

            GameEventMgr.AddHandler(Blercyn, GameLivingEvent.Interact, new DOLEventHandler(TalkToBlercyn));
            GameEventMgr.AddHandler(Blercyn, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToBlercyn));

            GameEventMgr.AddHandler(Epona, GameLivingEvent.Interact, new DOLEventHandler(TalkToEpona));
            GameEventMgr.AddHandler(Epona, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToEpona));

            Blercyn.AddQuestToGive(typeof(SearchForKnowledge));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Exemple #43
0
        public static GameNPC GetAddrir()
        {
            GameNPC[] npcs = WorldMgr.GetNPCsByName("Addrir", eRealm.Hibernia);

            GameNPC addrir = null;

            if (npcs.Length == 0)
            {
                addrir = new GameNPC();
                addrir.Model = 335;
                addrir.Name = "Addrir";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + addrir.Name + ", creating him ...");
                addrir.GuildName = "Part of Addrir Quests";
                addrir.Realm = eRealm.Hibernia;
                addrir.CurrentRegionID = 200;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58, 35);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 32);
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 1173);
                addrir.Inventory = template.CloseTemplate();
                addrir.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

            //				addrir.AddNPCEquipment((byte) eVisibleItems.TORSO, 58, 35, 0, 0);
            //				addrir.AddNPCEquipment((byte) eVisibleItems.CLOAK, 57, 32, 0, 0);
            //				addrir.AddNPCEquipment((byte) eVisibleItems.RIGHT_HAND, 1173, 0, 0, 0);

                addrir.Size = 50;
                addrir.Level = 50;
                addrir.X = GameLocation.ConvertLocalXToGlobalX(26955, 200);
                addrir.Y = GameLocation.ConvertLocalYToGlobalY(7789, 200);
                addrir.Z = 5196;
                addrir.Heading = 22;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                addrir.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)
                    addrir.SaveIntoDatabase();

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

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


            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Sir Prescott", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                SirPrescott       = new GameNPC();
                SirPrescott.Model = 28;
                SirPrescott.Name  = "Sir Prescott";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + SirPrescott.Name + ", creating him ...");
                }
                //SirPrescott.GuildName = "Part of " + questTitle + " Quest";
                SirPrescott.Realm           = eRealm.Albion;
                SirPrescott.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                SirPrescott.Inventory = template.CloseTemplate();
                SirPrescott.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                SirPrescott.Size    = 50;
                SirPrescott.Level   = 50;
                SirPrescott.X       = 559862;
                SirPrescott.Y       = 513092;
                SirPrescott.Z       = 2408;
                SirPrescott.Heading = 2480;

                //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)
                {
                    SirPrescott.SaveIntoDatabase();
                }

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

            #endregion

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

            GameEventMgr.AddHandler(SirPrescott, GameLivingEvent.Interact, new DOLEventHandler(TalkToSirPrescott));
            GameEventMgr.AddHandler(SirPrescott, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToSirPrescott));

            SirPrescott.AddQuestToGive(typeof(AfterTheAccident));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Eowyln Astos", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
                * this users Mob Database, so we simply create one ;-)
                * else we take the existing one. And if more than one exist, we take
                * the first ...
                */
            if (npcs.Length == 0)
            {
                eowylnAstos = new GameNPC();
                eowylnAstos.Model = 35;
                eowylnAstos.Name = "Eowyln Astos";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + eowylnAstos.Name + ", creating him ...");
                eowylnAstos.GuildName = "Part of " + questTitle + " Quest";
                eowylnAstos.Realm = eRealm.Albion;
                eowylnAstos.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58, 40);
                eowylnAstos.Inventory = template.CloseTemplate();
                eowylnAstos.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                eowylnAstos.Size = 54;
                eowylnAstos.Level = 17;
                eowylnAstos.X = 559680;
                eowylnAstos.Y = 513793;
                eowylnAstos.Z = 2619;
                eowylnAstos.Heading = 3185;

                //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)
                    eowylnAstos.SaveIntoDatabase();

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

            #endregion defineNPCS

            #region defineItems

            // item db check
            sephucothsHeart = GameServer.Database.FindObjectByKey<ItemTemplate>("sephucoths_heart");
            if (sephucothsHeart == null)
            {
                sephucothsHeart = new ItemTemplate();
                sephucothsHeart.Name = "Sephucoth's Heart";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + sephucothsHeart.Name + ", creating it ...");
                sephucothsHeart.Level = 0;
                sephucothsHeart.Weight = 0;
                sephucothsHeart.Model = 595;

                sephucothsHeart.Object_Type = (int)eObjectType.GenericItem;
                sephucothsHeart.Id_nb = "sephucoths_heart";
                sephucothsHeart.Price = 0;
                sephucothsHeart.IsPickable = false;
                sephucothsHeart.IsDropable = false;

                sephucothsHeart.Quality = 100;
                sephucothsHeart.Condition = 1000;
                sephucothsHeart.MaxCondition = 1000;
                sephucothsHeart.Durability = 1000;
                sephucothsHeart.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(sephucothsHeart);
            }

            // item db check
            polishedBone = GameServer.Database.FindObjectByKey<ItemTemplate>("polished_bone");
            if (polishedBone == null)
            {
                polishedBone = new ItemTemplate();
                polishedBone.Name = "Polished Bone";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + polishedBone.Name + ", creating it ...");
                polishedBone.Level = 0;
                polishedBone.Weight = 15;
                polishedBone.Model = 497;

                polishedBone.Object_Type = (int)eObjectType.GenericItem;
                polishedBone.Id_nb = "polished_bone";
                polishedBone.Price = 0;
                polishedBone.IsPickable = false;
                polishedBone.IsDropable = false;

                polishedBone.Quality = 100;
                polishedBone.Condition = 1000;
                polishedBone.MaxCondition = 1000;
                polishedBone.Durability = 1000;
                polishedBone.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(polishedBone);
            }

            // item db check
            fieryCrystalPendant = GameServer.Database.FindObjectByKey<ItemTemplate>("fiery_crystal_pendant");
            if (fieryCrystalPendant == null)
            {
                fieryCrystalPendant = new ItemTemplate();
                fieryCrystalPendant.Name = "Fiery Crystal Pendant";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + fieryCrystalPendant.Name + ", creating it ...");

                fieryCrystalPendant.Level = 8;
                fieryCrystalPendant.Weight = 8;
                fieryCrystalPendant.Model = 101;

                fieryCrystalPendant.Object_Type = (int)eObjectType.Magical;
                fieryCrystalPendant.Item_Type = (int)eEquipmentItems.NECK;
                fieryCrystalPendant.Id_nb = "fiery_crystal_pendant";
                fieryCrystalPendant.Price = Money.GetMoney(0, 0, 0, 0, 30);
                fieryCrystalPendant.IsPickable = true;
                fieryCrystalPendant.IsDropable = true;

                fieryCrystalPendant.Bonus1 = 1;
                fieryCrystalPendant.Bonus1Type = (int)eProperty.Skill_Fire;
                fieryCrystalPendant.Bonus2 = 1;
                fieryCrystalPendant.Bonus2Type = (int)eProperty.Intelligence;

                fieryCrystalPendant.Quality = 100;
                fieryCrystalPendant.Condition = 1000;
                fieryCrystalPendant.MaxCondition = 1000;
                fieryCrystalPendant.Durability = 1000;
                fieryCrystalPendant.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(fieryCrystalPendant);
            }

            #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));

            GameEventMgr.AddHandler(eowylnAstos, GameLivingEvent.Interact, new DOLEventHandler(TalkToEowylnAstos));
            GameEventMgr.AddHandler(eowylnAstos, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToEowylnAstos));

            /* Now we bring to Yetta Fletcher the possibility to give this quest to players */
            eowylnAstos.AddQuestToGive(typeof(HeartOfSephucoth));

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

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Ydenia Philpott", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                ydeniaPhilpott       = new GameNPC();
                ydeniaPhilpott.Model = 6;
                ydeniaPhilpott.Name  = "Ydenia Philpott";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + ydeniaPhilpott.Name + ", creating him ...");
                }

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

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 227);
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 80);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 54);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 51);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 52);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 53);
                ydeniaPhilpott.Inventory = template.CloseTemplate();
                ydeniaPhilpott.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

                ydeniaPhilpott.Size    = 51;
                ydeniaPhilpott.Level   = 40;
                ydeniaPhilpott.X       = 559315;
                ydeniaPhilpott.Y       = 510705;
                ydeniaPhilpott.Z       = 2488;
                ydeniaPhilpott.Heading = 3993;

                // 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)
                {
                    ydeniaPhilpott.SaveIntoDatabase();
                }

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

            npcs = WorldMgr.GetObjectsByName <GameNPC>("Elvar Tambor", eRealm.Albion);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Elvar Tambor, creating him ...");
                }

                elvarTambor                 = new GameNPC();
                elvarTambor.Model           = 9;
                elvarTambor.Name            = "Elvar Tambor";
                elvarTambor.GuildName       = "Part of " + questTitle + " Quest";
                elvarTambor.Realm           = eRealm.Albion;
                elvarTambor.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 3);
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 159, 67);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 160, 63);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 156, 67);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 157, 63);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 158, 67);
                elvarTambor.Inventory = template.CloseTemplate();
                elvarTambor.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                elvarTambor.Size    = 50;
                elvarTambor.Level   = 15;
                elvarTambor.X       = 574711;
                elvarTambor.Y       = 529887;
                elvarTambor.Z       = 2896;
                elvarTambor.Heading = 2366;

                // 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)
                {
                    elvarTambor.SaveIntoDatabase();
                }

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

            // item db check
            letterToElvar = GameServer.Database.FindObjectByKey <ItemTemplate>("letter_to_elvar_tambor");
            if (letterToElvar == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Letter to Healvar, creating it ...");
                }

                letterToElvar        = new ItemTemplate();
                letterToElvar.Name   = "Letter to Elvar";
                letterToElvar.Level  = 0;
                letterToElvar.Weight = 10;
                letterToElvar.Model  = 499;

                letterToElvar.Object_Type = (int)eObjectType.GenericItem;
                letterToElvar.Id_nb       = "letter_to_elvar_tambor";
                letterToElvar.Price       = 0;
                letterToElvar.IsPickable  = false;
                letterToElvar.IsDropable  = false;

                letterToElvar.Quality       = 100;
                letterToElvar.Condition     = 1000;
                letterToElvar.MaxCondition  = 1000;
                letterToElvar.Durability    = 1000;
                letterToElvar.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(letterToElvar);
            }

            // item db check
            letterToYdenia = GameServer.Database.FindObjectByKey <ItemTemplate>("letter_to_yderia_philpott");
            if (letterToYdenia == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Letter to Yderia creating it ...");
                }

                letterToYdenia        = new ItemTemplate();
                letterToYdenia.Name   = "Letter to Ydenia";
                letterToYdenia.Level  = 0;
                letterToYdenia.Weight = 10;
                letterToYdenia.Model  = 499;

                letterToYdenia.Object_Type = (int)eObjectType.GenericItem;
                letterToYdenia.Id_nb       = "letter_to_yderia_philpott";
                letterToYdenia.Price       = 0;
                letterToYdenia.IsPickable  = false;
                letterToYdenia.IsDropable  = false;

                letterToYdenia.Quality       = 100;
                letterToYdenia.Condition     = 1000;
                letterToYdenia.MaxCondition  = 1000;
                letterToYdenia.Durability    = 1000;
                letterToYdenia.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(letterToYdenia);
            }

            // item db check
            silverRingOfHealth = GameServer.Database.FindObjectByKey <ItemTemplate>("silver_ring_of_health");
            if (silverRingOfHealth == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Silver Ring of Health creating it ...");
                }

                silverRingOfHealth        = new ItemTemplate();
                silverRingOfHealth.Name   = "Silver Ring of Health";
                silverRingOfHealth.Level  = 3;
                silverRingOfHealth.Weight = 1;
                silverRingOfHealth.Model  = 103;

                silverRingOfHealth.Object_Type = (int)eObjectType.Magical;
                silverRingOfHealth.Item_Type   = (int)eEquipmentItems.L_RING;
                silverRingOfHealth.Id_nb       = "silver_ring_of_health";

                silverRingOfHealth.Price      = Money.GetMoney(0, 0, 0, 0, 30);
                silverRingOfHealth.IsPickable = true;
                silverRingOfHealth.IsDropable = true;

                silverRingOfHealth.Bonus      = 1;
                silverRingOfHealth.Bonus1Type = (int)eProperty.MaxHealth;
                silverRingOfHealth.Bonus1     = 8;
                silverRingOfHealth.Bonus2Type = (int)eProperty.Resist_Slash;
                silverRingOfHealth.Bonus2     = 1;

                silverRingOfHealth.Quality       = 100;
                silverRingOfHealth.Condition     = 1000;
                silverRingOfHealth.MaxCondition  = 1000;
                silverRingOfHealth.Durability    = 1000;
                silverRingOfHealth.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(silverRingOfHealth);
            }

            /* 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));

            GameEventMgr.AddHandler(ydeniaPhilpott, GameLivingEvent.Interact, new DOLEventHandler(TalkToYdeniaPhilpott));
            GameEventMgr.AddHandler(ydeniaPhilpott, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToYdeniaPhilpott));

            GameEventMgr.AddHandler(elvarTambor, GameObjectEvent.Interact, new DOLEventHandler(TalkToElvarTambor));
            GameEventMgr.AddHandler(elvarTambor, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToElvarTambor));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            ydeniaPhilpott.AddQuestToGive(typeof(YdeniasCrush));

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

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.ANewHeroesWelcome.ScriptLoaded.Text1"), eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                MasterClaistan = new GameNPC();
                MasterClaistan.Model = 33;
                MasterClaistan.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.ANewHeroesWelcome.ScriptLoaded.Text1");
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + MasterClaistan.Name + ", creating him ...");
                //MasterClaistan.GuildName = "Part of " + questTitle + " Quest";
                MasterClaistan.Realm = eRealm.Albion;
                MasterClaistan.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                MasterClaistan.Inventory = template.CloseTemplate();
                MasterClaistan.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                MasterClaistan.Size = 52;
                MasterClaistan.Level = 51;
                MasterClaistan.X = 562190;
                MasterClaistan.Y = 512571;
                MasterClaistan.Z = 2500;
                MasterClaistan.Heading = 1592;

                //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)
                    MasterClaistan.SaveIntoDatabase();

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

            //Pompin The Crier
            npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.ANewHeroesWelcome.ScriptLoaded.Text2"), eRealm.Albion);
            if (npcs.Length == 0)
            {
                PompinTheCrier = new GameNPC();
                PompinTheCrier.Model = 10;
                PompinTheCrier.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.ANewHeroesWelcome.ScriptLoaded.Text2");
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + PompinTheCrier.Name + ", creating him ...");
                //MasterClaistan.GuildName = "Part of " + questTitle + " Quest";
                PompinTheCrier.Realm = eRealm.Albion;
                PompinTheCrier.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                PompinTheCrier.Inventory = template.CloseTemplate();
                PompinTheCrier.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                PompinTheCrier.Size = 50;
                PompinTheCrier.Level = 5;
                PompinTheCrier.X = 560484;
                PompinTheCrier.Y = 511756;
                PompinTheCrier.Z = 2344;
                PompinTheCrier.Heading = 420;

                //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)
                    PompinTheCrier.SaveIntoDatabase();

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

            #endregion

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

            GameEventMgr.AddHandler(MasterClaistan, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterClaistan));
            GameEventMgr.AddHandler(MasterClaistan, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterClaistan));

            GameEventMgr.AddHandler(PompinTheCrier, GameLivingEvent.Interact, new DOLEventHandler(TalkToPompinTheCrier));
            GameEventMgr.AddHandler(PompinTheCrier, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToPompinTheCrier));

            MasterClaistan.AddQuestToGive(typeof(ANewHeroesWelcome));

            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initialized");
        }
Exemple #48
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");
            }
        }
Exemple #49
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
                return;
            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initializing ...");

            #region defineNPCs

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Master Ferowl", eRealm.Albion);
            if (npcs.Length == 0)
            {
                Ferowl = new GameNPC();
                Ferowl.Model = 61;
                Ferowl.Name = "Master Ferowl";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + Ferowl.Name + " , creating it ...");
                Ferowl.GuildName = "";
                Ferowl.Realm = eRealm.Albion;
                Ferowl.CurrentRegionID = 1;
                Ferowl.Size = 51;
                Ferowl.Level = 40;
                Ferowl.X = 559716;
                Ferowl.Y = 510733;
                Ferowl.Z = 2720;
                Ferowl.Heading = 703;
                Ferowl.AddToWorld();

                if (SAVE_INTO_DATABASE)
                    Ferowl.SaveIntoDatabase();
            }
            else
                Ferowl = npcs[0];
            // end npc

            npcs = WorldMgr.GetNPCsByName("Morgana", eRealm.None);
            if (npcs.Length == 0)
            {
                Morgana = new GameNPC();
                Morgana.Model = 283;
                Morgana.Name = "Morgana";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + Morgana.Name + " , creating it ...");
                Morgana.GuildName = "";
                Morgana.Realm = eRealm.None;
                Morgana.CurrentRegionID = 1;
                Morgana.Size = 51;
                Morgana.Level = 90;
                Morgana.X = 306056;
                Morgana.Y = 670106;
                Morgana.Z = 3095;
                Morgana.Heading = 3261;

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

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 98, 43);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 133, 61);
                Morgana.Inventory = template.CloseTemplate();

            //				Morgana.AddNPCEquipment((byte) eVisibleItems.TORSO, 98, 43, 0, 0);
            //				Morgana.AddNPCEquipment((byte) eVisibleItems.BOOT, 133, 61, 0, 0);

                //Morgana.AddToWorld(); will be added later during quest

                if (SAVE_INTO_DATABASE)
                    Morgana.SaveIntoDatabase();
            }
            else
                Morgana = npcs[0];

            npcs = WorldMgr.GetNPCsByName("Bechard", eRealm.None);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Bechard , creating it ...");
                Bechard = new GameNPC();
                Bechard.Model = 606;
                Bechard.Name = "Bechard";
                Bechard.GuildName = "";
                Bechard.Realm = eRealm.None;
                Bechard.CurrentRegionID = 1;
                Bechard.Size = 50;
                Bechard.Level = 63;
                Bechard.X = 306025;
                Bechard.Y = 670473;
                Bechard.Z = 2863;
                Bechard.Heading = 3754;
                Bechard.AddToWorld();

                if (SAVE_INTO_DATABASE)
                    Bechard.SaveIntoDatabase();
            }
            else
                Bechard = npcs[0];
            // end npc

            npcs = WorldMgr.GetNPCsByName("Silcharde", eRealm.None);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Silcharde , creating it ...");
                Silcharde = new GameNPC();
                Silcharde.Model = 606;
                Silcharde.Name = "Silcharde";
                Silcharde.GuildName = "";
                Silcharde.Realm = eRealm.None;
                Silcharde.CurrentRegionID = 1;
                Silcharde.Size = 50;
                Silcharde.Level = 63;
                Silcharde.X = 306252;
                Silcharde.Y = 670274;
                Silcharde.Z = 2857;
                Silcharde.Heading = 3299;
                Silcharde.AddToWorld();

                if (SAVE_INTO_DATABASE)
                    Silcharde.SaveIntoDatabase();

            }
            else
                Silcharde = npcs[0];
            // end npc

            #endregion

            #region Item Declarations

            sealed_pouch = GameServer.Database.FindObjectByKey<ItemTemplate>("sealed_pouch");
            if (sealed_pouch == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Sealed Pouch , creating it ...");
                sealed_pouch = new ItemTemplate();
                sealed_pouch.Id_nb = "sealed_pouch";
                sealed_pouch.Name = "Sealed Pouch";
                sealed_pouch.Level = 8;
                sealed_pouch.Item_Type = 29;
                sealed_pouch.Model = 488;
                sealed_pouch.IsDropable = false;
                sealed_pouch.IsPickable = false;
                sealed_pouch.DPS_AF = 0;
                sealed_pouch.SPD_ABS = 0;
                sealed_pouch.Object_Type = 41;
                sealed_pouch.Hand = 0;
                sealed_pouch.Type_Damage = 0;
                sealed_pouch.Quality = 100;
                sealed_pouch.Weight = 12;

                    GameServer.Database.AddObject(sealed_pouch);
            }
            // end item

            ItemTemplate item = null;

            WizardEpicBoots = GameServer.Database.FindObjectByKey<ItemTemplate>("WizardEpicBoots");
            if (WizardEpicBoots == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Wizards Epic Boots , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "WizardEpicBoots";
                item.Name = "Bernor's Numinous Boots";
                item.Level = 50;
                item.Item_Type = 23;
                item.Model = 143;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 4;
                item.Bonus1Type = (int) eProperty.Skill_Cold;

                item.Bonus2 = 22;
                item.Bonus2Type = (int) eStat.DEX;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Body;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Energy;

                    GameServer.Database.AddObject(item);

                WizardEpicBoots = item;
            }
            //end item
            //Bernor's Numinous Coif
            WizardEpicHelm = GameServer.Database.FindObjectByKey<ItemTemplate>("WizardEpicHelm");
            if (WizardEpicHelm == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Wizards Epic Helm , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "WizardEpicHelm";
                item.Name = "Bernor's Numinous Cap";
                item.Level = 50;
                item.Item_Type = 21;
                item.Model = 1290; //NEED TO WORK ON..
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 13;
                item.Bonus1Type = (int) eStat.DEX;

                item.Bonus2 = 21;
                item.Bonus2Type = (int) eStat.INT;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Thrust;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Spirit;

                    GameServer.Database.AddObject(item);

                WizardEpicHelm = item;
            }
            //end item
            //Bernor's Numinous Gloves
            WizardEpicGloves = GameServer.Database.FindObjectByKey<ItemTemplate>("WizardEpicGloves");
            if (WizardEpicGloves == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Wizards Epic Gloves , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "WizardEpicGloves";
                item.Name = "Bernor's Numinous Gloves ";
                item.Level = 50;
                item.Item_Type = 22;
                item.Model = 142;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 16;
                item.Bonus1Type = (int) eStat.DEX;

                item.Bonus2 = 18;
                item.Bonus2Type = (int) eStat.INT;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Matter;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Heat;

                    GameServer.Database.AddObject(item);

                WizardEpicGloves = item;
            }

            //Bernor's Numinous Hauberk
            WizardEpicVest = GameServer.Database.FindObjectByKey<ItemTemplate>("WizardEpicVest");
            if (WizardEpicVest == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Wizards Epic Vest , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "WizardEpicVest";
                item.Name = "Bernor's Numinous Robes";
                item.Level = 50;
                item.Item_Type = 25;
                item.Model = 798;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 4;
                item.Bonus1Type = (int) eResist.Cold;

                item.Bonus2 = 14;
                item.Bonus2Type = (int) eProperty.PowerRegenerationRate;

                item.Bonus3 = 24;
                item.Bonus3Type = (int) eProperty.MaxHealth;

                    GameServer.Database.AddObject(item);

                WizardEpicVest = item;

            }
            //Bernor's Numinous Legs
            WizardEpicLegs = GameServer.Database.FindObjectByKey<ItemTemplate>("WizardEpicLegs");
            if (WizardEpicLegs == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Wizards Epic Legs , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "WizardEpicLegs";
                item.Name = "Bernor's Numinous Pants";
                item.Level = 50;
                item.Item_Type = 27;
                item.Model = 140;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 4;
                item.Bonus1Type = (int) eProperty.Skill_Fire;

                item.Bonus2 = 8;
                item.Bonus2Type = (int) eResist.Cold;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Energy;

                    GameServer.Database.AddObject(item);

                WizardEpicLegs = item;

            }
            //Bernor's Numinous Sleeves
            WizardEpicArms = GameServer.Database.FindObjectByKey<ItemTemplate>("WizardEpicArms");
            if (WizardEpicArms == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Wizard Epic Arms , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "WizardEpicArms";
                item.Name = "Bernor's Numinous Sleeves";
                item.Level = 50;
                item.Item_Type = 28;
                item.Model = 141;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 4;
                item.Bonus1Type = (int) eProperty.Skill_Earth;

                item.Bonus2 = 18;
                item.Bonus2Type = (int) eStat.DEX;

                item.Bonus3 = 16;
                item.Bonus3Type = (int) eStat.INT;

                    GameServer.Database.AddObject(item);

                WizardEpicArms = item;

            }
            //Minstrel Epic Sleeves End
            MinstrelEpicBoots = GameServer.Database.FindObjectByKey<ItemTemplate>("MinstrelEpicBoots");
            if (MinstrelEpicBoots == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Minstrels Epic Boots , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "MinstrelEpicBoots";
                item.Name = "Boots of Coruscating Harmony";
                item.Level = 50;
                item.Item_Type = 23;
                item.Model = 727;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 100;
                item.SPD_ABS = 27;
                item.Object_Type = 35;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 7;
                item.Bonus1Type = (int) eStat.DEX;

                item.Bonus2 = 27;
                item.Bonus2Type = (int) eStat.QUI;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Slash;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Cold;

                    GameServer.Database.AddObject(item);

                MinstrelEpicBoots = item;

            }
            //end item
            //of Coruscating Harmony  Coif
            MinstrelEpicHelm = GameServer.Database.FindObjectByKey<ItemTemplate>("MinstrelEpicHelm");
            if (MinstrelEpicHelm == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Minstrels Epic Helm , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "MinstrelEpicHelm";
                item.Name = "Coif of Coruscating Harmony";
                item.Level = 50;
                item.Item_Type = 21;
                item.Model = 1290; //NEED TO WORK ON..
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 100;
                item.SPD_ABS = 27;
                item.Object_Type = 35;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 16;
                item.Bonus1Type = (int) eStat.CON;

                item.Bonus2 = 18;
                item.Bonus2Type = (int) eStat.CHR;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Thrust;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Energy;

                    GameServer.Database.AddObject(item);

                MinstrelEpicHelm = item;

            }
            //end item
            //of Coruscating Harmony  Gloves
            MinstrelEpicGloves = GameServer.Database.FindObjectByKey<ItemTemplate>("MinstrelEpicGloves");
            if (MinstrelEpicGloves == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Minstrels Epic Gloves , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "MinstrelEpicGloves";
                item.Name = "Gauntlets of Coruscating Harmony";
                item.Level = 50;
                item.Item_Type = 22;
                item.Model = 726;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 100;
                item.SPD_ABS = 27;
                item.Object_Type = 35;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 15;
                item.Bonus1Type = (int) eStat.CON;

                item.Bonus2 = 19;
                item.Bonus2Type = (int) eStat.DEX;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Crush;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Heat;

                    GameServer.Database.AddObject(item);

                MinstrelEpicGloves = item;

            }
            //of Coruscating Harmony  Hauberk
            MinstrelEpicVest = GameServer.Database.FindObjectByKey<ItemTemplate>("MinstrelEpicVest");
            if (MinstrelEpicVest == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Minstrels Epic Vest , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "MinstrelEpicVest";
                item.Name = "Habergeon of Coruscating Harmony";
                item.Level = 50;
                item.Item_Type = 25;
                item.Model = 723;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 100;
                item.SPD_ABS = 27;
                item.Object_Type = 35;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 6;
                item.Bonus1Type = (int) eResist.Cold;

                item.Bonus2 = 8;
                item.Bonus2Type = (int) eProperty.PowerRegenerationRate;

                item.Bonus3 = 39;
                item.Bonus3Type = (int) eProperty.MaxHealth;

                item.Bonus4 = 6;
                item.Bonus4Type = (int) eResist.Energy;

                    GameServer.Database.AddObject(item);

                MinstrelEpicVest = item;

            }
            //of Coruscating Harmony  Legs
            MinstrelEpicLegs = GameServer.Database.FindObjectByKey<ItemTemplate>("MinstrelEpicLegs");
            if (MinstrelEpicLegs == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Minstrels Epic Legs , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "MinstrelEpicLegs";
                item.Name = "Chaussess of Coruscating Harmony";
                item.Level = 50;
                item.Item_Type = 27;
                item.Model = 724;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 100;
                item.SPD_ABS = 27;
                item.Object_Type = 35;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 15;
                item.Bonus1Type = (int) eStat.STR;

                item.Bonus2 = 19;
                item.Bonus2Type = (int) eStat.CON;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Body;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Heat;

                    GameServer.Database.AddObject(item);

                MinstrelEpicLegs = item;

            }
            //of Coruscating Harmony  Sleeves
            MinstrelEpicArms = GameServer.Database.FindObjectByKey<ItemTemplate>("MinstrelEpicArms");
            if (MinstrelEpicArms == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Minstrel Epic Arms , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "MinstrelEpicArms";
                item.Name = "Sleeves of Coruscating Harmony";
                item.Level = 50;
                item.Item_Type = 28;
                item.Model = 725;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 100;
                item.SPD_ABS = 27;
                item.Object_Type = 35;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 16;
                item.Bonus1Type = (int) eStat.STR;

                item.Bonus2 = 21;
                item.Bonus2Type = (int) eStat.DEX;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Crush;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Body;

                    GameServer.Database.AddObject(item);

                MinstrelEpicArms = item;
            }

            SorcerorEpicBoots = GameServer.Database.FindObjectByKey<ItemTemplate>("SorcerorEpicBoots");
            if (SorcerorEpicBoots == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Sorceror Epic Boots , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "SorcerorEpicBoots";
                item.Name = "Boots of Mental Acuity";
                item.Level = 50;
                item.Item_Type = 23;
                item.Model = 143;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 4;
                item.Bonus1Type = (int) eProperty.Focus_Matter;

                item.Bonus2 = 22;
                item.Bonus2Type = (int) eStat.DEX;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Matter;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Energy;

                    GameServer.Database.AddObject(item);

                SorcerorEpicBoots = item;

            }
            //end item
            //of Mental Acuity Coif
            SorcerorEpicHelm = GameServer.Database.FindObjectByKey<ItemTemplate>("SorcerorEpicHelm");
            if (SorcerorEpicHelm == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Sorceror Epic Helm , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "SorcerorEpicHelm";
                item.Name = "Cap of Mental Acuity";
                item.Level = 50;
                item.Item_Type = 21;
                item.Model = 1290; //NEED TO WORK ON..
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 13;
                item.Bonus1Type = (int) eStat.DEX;

                item.Bonus2 = 21;
                item.Bonus2Type = (int) eStat.INT;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Slash;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Thrust;

                    GameServer.Database.AddObject(item);

                SorcerorEpicHelm = item;

            }
            //end item
            //of Mental Acuity Gloves
            SorcerorEpicGloves = GameServer.Database.FindObjectByKey<ItemTemplate>("SorcerorEpicGloves");
            if (SorcerorEpicGloves == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Sorceror Epic Gloves , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "SorcerorEpicGloves";
                item.Name = "Gloves of Mental Acuity";
                item.Level = 50;
                item.Item_Type = 22;
                item.Model = 142;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 16;
                item.Bonus1Type = (int) eStat.DEX;

                item.Bonus2 = 18;
                item.Bonus2Type = (int) eStat.INT;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Cold;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Heat;

                    GameServer.Database.AddObject(item);

                SorcerorEpicGloves = item;

            }
            //of Mental Acuity Hauberk
            SorcerorEpicVest = GameServer.Database.FindObjectByKey<ItemTemplate>("SorcerorEpicVest");
            if (SorcerorEpicVest == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Sorceror Epic Vest , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "SorcerorEpicVest";
                item.Name = "Vest of Mental Acuity";
                item.Level = 50;
                item.Item_Type = 25;
                item.Model = 804;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 4;
                item.Bonus1Type = (int) eResist.Spirit;

                item.Bonus2 = 14;
                item.Bonus2Type = (int) eProperty.PowerRegenerationRate;

                item.Bonus3 = 24;
                item.Bonus3Type = (int) eProperty.MaxHealth;

                    GameServer.Database.AddObject(item);

                SorcerorEpicVest = item;

            }
            //of Mental Acuity Legs
            SorcerorEpicLegs = GameServer.Database.FindObjectByKey<ItemTemplate>("SorcerorEpicLegs");
            if (SorcerorEpicLegs == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Sorceror Epic Legs , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "SorcerorEpicLegs";
                item.Name = "Pants of Mental Acuity";
                item.Level = 50;
                item.Item_Type = 27;
                item.Model = 140;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 4;
                item.Bonus1Type = (int) eProperty.Focus_Mind;

                item.Bonus2 = 19;
                item.Bonus2Type = (int) eStat.CON;

                item.Bonus3 = 8;
                item.Bonus3Type = (int) eResist.Body;

                item.Bonus4 = 8;
                item.Bonus4Type = (int) eResist.Spirit;

                    GameServer.Database.AddObject(item);

                SorcerorEpicLegs = item;

            }
            //of Mental Acuity Sleeves
            SorcerorEpicArms = GameServer.Database.FindObjectByKey<ItemTemplate>("SorcerorEpicArms");
            if (SorcerorEpicArms == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Sorceror Epic Arms , creating it ...");
                item = new ItemTemplate();
                item.Id_nb = "SorcerorEpicArms";
                item.Name = "Sleeves of Mental Acuity";
                item.Level = 50;
                item.Item_Type = 28;
                item.Model = 141;
                item.IsDropable = true;
                item.IsPickable = true;
                item.DPS_AF = 50;
                item.SPD_ABS = 0;
                item.Object_Type = 32;
                item.Quality = 100;
                item.Weight = 22;
                item.Bonus = 35;
                item.MaxCondition = 50000;
                item.MaxDurability = 50000;
                item.Condition = 50000;
                item.Durability = 50000;

                item.Bonus1 = 4;
                item.Bonus1Type = (int) eProperty.Focus_Body;

                item.Bonus2 = 16;
                item.Bonus2Type = (int) eStat.DEX;

                item.Bonus3 = 18;
                item.Bonus3Type = (int) eStat.INT;

                    GameServer.Database.AddObject(item);

                SorcerorEpicArms = item;
            }
            //Item Descriptions End

            #endregion

            morganaArea = WorldMgr.GetRegion(Morgana.CurrentRegionID).AddArea(new Area.Circle(null, Morgana.X, Morgana.Y, 0, 1000));
            morganaArea.RegisterPlayerEnter(new DOLEventHandler(PlayerEnterMorganaArea));

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

            GameEventMgr.AddHandler(Ferowl, GameObjectEvent.Interact, new DOLEventHandler(TalkToFerowl));
            GameEventMgr.AddHandler(Ferowl, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToFerowl));

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

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Eowyln Astos", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                eowylnAstos       = new GameNPC();
                eowylnAstos.Model = 35;
                eowylnAstos.Name  = "Eowyln Astos";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + eowylnAstos.Name + ", creating him ...");
                }
                eowylnAstos.GuildName       = "Part of " + questTitle + " Quest";
                eowylnAstos.Realm           = eRealm.Albion;
                eowylnAstos.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58, 40);
                eowylnAstos.Inventory = template.CloseTemplate();
                eowylnAstos.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                eowylnAstos.Size    = 54;
                eowylnAstos.Level   = 17;
                eowylnAstos.X       = 559680;
                eowylnAstos.Y       = 513793;
                eowylnAstos.Z       = 2619;
                eowylnAstos.Heading = 3185;

                //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)
                {
                    eowylnAstos.SaveIntoDatabase();
                }

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

            #endregion

            #region defineItems

            // item db check
            sephucothsHeart = GameServer.Database.FindObjectByKey <ItemTemplate>("sephucoths_heart");
            if (sephucothsHeart == null)
            {
                sephucothsHeart      = new ItemTemplate();
                sephucothsHeart.Name = "Sephucoth's Heart";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + sephucothsHeart.Name + ", creating it ...");
                }
                sephucothsHeart.Level  = 0;
                sephucothsHeart.Weight = 0;
                sephucothsHeart.Model  = 595;

                sephucothsHeart.Object_Type = (int)eObjectType.GenericItem;
                sephucothsHeart.Id_nb       = "sephucoths_heart";
                sephucothsHeart.Price       = 0;
                sephucothsHeart.IsPickable  = false;
                sephucothsHeart.IsDropable  = false;

                sephucothsHeart.Quality       = 100;
                sephucothsHeart.Condition     = 1000;
                sephucothsHeart.MaxCondition  = 1000;
                sephucothsHeart.Durability    = 1000;
                sephucothsHeart.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(sephucothsHeart);
            }

            // item db check
            polishedBone = GameServer.Database.FindObjectByKey <ItemTemplate>("polished_bone");
            if (polishedBone == null)
            {
                polishedBone      = new ItemTemplate();
                polishedBone.Name = "Polished Bone";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + polishedBone.Name + ", creating it ...");
                }
                polishedBone.Level  = 0;
                polishedBone.Weight = 15;
                polishedBone.Model  = 497;

                polishedBone.Object_Type = (int)eObjectType.GenericItem;
                polishedBone.Id_nb       = "polished_bone";
                polishedBone.Price       = 0;
                polishedBone.IsPickable  = false;
                polishedBone.IsDropable  = false;

                polishedBone.Quality       = 100;
                polishedBone.Condition     = 1000;
                polishedBone.MaxCondition  = 1000;
                polishedBone.Durability    = 1000;
                polishedBone.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(polishedBone);
            }

            // item db check
            fieryCrystalPendant = GameServer.Database.FindObjectByKey <ItemTemplate>("fiery_crystal_pendant");
            if (fieryCrystalPendant == null)
            {
                fieryCrystalPendant      = new ItemTemplate();
                fieryCrystalPendant.Name = "Fiery Crystal Pendant";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + fieryCrystalPendant.Name + ", creating it ...");
                }

                fieryCrystalPendant.Level  = 8;
                fieryCrystalPendant.Weight = 8;
                fieryCrystalPendant.Model  = 101;

                fieryCrystalPendant.Object_Type = (int)eObjectType.Magical;
                fieryCrystalPendant.Item_Type   = (int)eEquipmentItems.NECK;
                fieryCrystalPendant.Id_nb       = "fiery_crystal_pendant";
                fieryCrystalPendant.Price       = Money.GetMoney(0, 0, 0, 0, 30);
                fieryCrystalPendant.IsPickable  = true;
                fieryCrystalPendant.IsDropable  = true;

                fieryCrystalPendant.Bonus1     = 1;
                fieryCrystalPendant.Bonus1Type = (int)eProperty.Skill_Fire;
                fieryCrystalPendant.Bonus2     = 1;
                fieryCrystalPendant.Bonus2Type = (int)eProperty.Intelligence;

                fieryCrystalPendant.Quality       = 100;
                fieryCrystalPendant.Condition     = 1000;
                fieryCrystalPendant.MaxCondition  = 1000;
                fieryCrystalPendant.Durability    = 1000;
                fieryCrystalPendant.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(fieryCrystalPendant);
            }

            #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));

            GameEventMgr.AddHandler(eowylnAstos, GameLivingEvent.Interact, new DOLEventHandler(TalkToEowylnAstos));
            GameEventMgr.AddHandler(eowylnAstos, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToEowylnAstos));

            /* Now we bring to Yetta Fletcher the possibility to give this quest to players */
            eowylnAstos.AddQuestToGive(typeof(HeartOfSephucoth));

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

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Lady Grynoch", eRealm.Albion);

            if (npcs.Length == 0)
            {
                LadyGrynoch = new GameNPC();
                LadyGrynoch.Model = 5;
                LadyGrynoch.Name = "Lady Grynoch";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + LadyGrynoch.Name + ", creating her ...");
                //k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                //LadyGrynoch.GuildName = "Part of " + questTitle + " Quest";
                LadyGrynoch.Realm = eRealm.Albion;
                LadyGrynoch.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58);    //Slot 25
                LadyGrynoch.Inventory = template.CloseTemplate();
                LadyGrynoch.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                LadyGrynoch.Size = 51;
                LadyGrynoch.Level = 38;
                LadyGrynoch.X = 559698;
                LadyGrynoch.Y = 513578;
                LadyGrynoch.Z = 2428;
                LadyGrynoch.Heading = 2742;

                if (SAVE_INTO_DATABASE)
                    LadyGrynoch.SaveIntoDatabase();

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

            #endregion
            #region defineAreas
            Demons_Breach_Area = WorldMgr.GetRegion(Demons_Breach.RegionID).AddArea(new Area.Circle("", Demons_Breach.X, Demons_Breach.Y, Demons_Breach.Z, 200));
            Demons_Breach_Area.RegisterPlayerEnter(new DOLEventHandler(PlayerEnterDemonBreachArea));
            #endregion

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

            GameEventMgr.AddHandler(LadyGrynoch, GameLivingEvent.Interact, new DOLEventHandler(TalkToLadyGrynoch));
            GameEventMgr.AddHandler(LadyGrynoch, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToLadyGrynoch));

            LadyGrynoch.AddQuestToGive(typeof(ToReachTheBreach));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Farmer Asma", eRealm.Albion);
            if (npcs.Length == 0)
            {
                farmerAsma       = new GameNPC();
                farmerAsma.Model = 82;
                farmerAsma.Name  = "Farmer Asma";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + farmerAsma.Name + ", creating him ...");
                }
                farmerAsma.GuildName       = "Part of " + questTitle + " Quest";
                farmerAsma.Realm           = eRealm.Albion;
                farmerAsma.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 31);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 32);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 33);
                farmerAsma.Inventory = template.CloseTemplate();
                farmerAsma.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                farmerAsma.Size    = 50;
                farmerAsma.Level   = 35;
                farmerAsma.X       = 563939;
                farmerAsma.Y       = 509234;
                farmerAsma.Z       = 2744;
                farmerAsma.Heading = 21;

                //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)
                {
                    farmerAsma.SaveIntoDatabase();
                }

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

            #endregion

            #region defineItems

            // item db check
            farmerAsmasMap = GameServer.Database.FindObjectByKey <ItemTemplate>("farmer_asma_map");
            if (farmerAsmasMap == null)
            {
                farmerAsmasMap      = new ItemTemplate();
                farmerAsmasMap.Name = "Farmer Asma's Map";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + farmerAsmasMap.Name + ", creating it ...");
                }
                farmerAsmasMap.Level  = 0;
                farmerAsmasMap.Weight = 1;
                farmerAsmasMap.Model  = 499;

                farmerAsmasMap.Object_Type = (int)eObjectType.GenericItem;
                farmerAsmasMap.Id_nb       = "farmer_asma_map";
                farmerAsmasMap.Price       = 0;
                farmerAsmasMap.IsPickable  = false;
                farmerAsmasMap.IsDropable  = false;

                farmerAsmasMap.Quality       = 100;
                farmerAsmasMap.Condition     = 1000;
                farmerAsmasMap.MaxCondition  = 1000;
                farmerAsmasMap.Durability    = 1000;
                farmerAsmasMap.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(farmerAsmasMap);
            }

            #endregion


            firstFieldArea = WorldMgr.GetRegion(firstField.RegionID).AddArea(new Area.Circle("First Vacant Field", firstField.Position, 1450));
            firstFieldArea.RegisterPlayerEnter(new DOLEventHandler(PlayerEnterFirstFieldArea));

            secondFieldArea = WorldMgr.GetRegion(secondField.RegionID).AddArea(new Area.Circle("Second Vacant Field", secondField.Position, 1100));
            secondFieldArea.RegisterPlayerEnter(new DOLEventHandler(PlayerEnterSecondFieldArea));

            thirdFieldArea = WorldMgr.GetRegion(thirdField.RegionID).AddArea(new Area.Circle("Third Vacant Field", thirdField.Position, 1100));
            thirdFieldArea.RegisterPlayerEnter(new DOLEventHandler(PlayerEnterThirdFieldArea));

            /* 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));

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

            GameEventMgr.AddHandler(farmerAsma, GameObjectEvent.Interact, new DOLEventHandler(TalkToFarmerAsma));
            GameEventMgr.AddHandler(farmerAsma, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToFarmerAsma));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            farmerAsma.AddQuestToGive(typeof(GreenerPastures));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Laridia the Minstrel", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
                * this users Mob Database, so we simply create one ;-)
                * else we take the existing one. And if more than one exist, we take
                * the first ...
                */
            if (npcs.Length == 0)
            {
                laridiaTheMinstrel = new GameNPC();
                laridiaTheMinstrel.Model = 38;
                laridiaTheMinstrel.Name = "Laridia the Minstrel";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + laridiaTheMinstrel.Name + ", creating him ...");
                laridiaTheMinstrel.GuildName = "Part of " + questTitle + " Quest";
                laridiaTheMinstrel.Realm = eRealm.Albion;
                laridiaTheMinstrel.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 137, 9);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 138, 9);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 134, 9);
                template.AddNPCEquipment(eInventorySlot.Cloak, 96, 72);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 140, 43);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 141, 43);
                laridiaTheMinstrel.Inventory = template.CloseTemplate();
                laridiaTheMinstrel.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                laridiaTheMinstrel.Size = 49;
                laridiaTheMinstrel.Level = 25;
                laridiaTheMinstrel.X = 562280;
                laridiaTheMinstrel.Y = 512243;
                laridiaTheMinstrel.Z = 2448 ;
                laridiaTheMinstrel.Heading = 3049;

                //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)
                    laridiaTheMinstrel.SaveIntoDatabase();

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

            npcs = WorldMgr.GetNPCsByName("Farmer Asma", eRealm.Albion);
            if (npcs.Length == 0)
            {
                farmerAsma = new GameNPC();
                farmerAsma.Model = 82;
                farmerAsma.Name = "Farmer Asma";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + farmerAsma.Name + ", creating him ...");
                farmerAsma.GuildName = "Part of " + questTitle + " Quest";
                farmerAsma.Realm = eRealm.Albion;
                farmerAsma.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 31);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 32);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 33);
                farmerAsma.Inventory = template.CloseTemplate();
                farmerAsma.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                farmerAsma.Size = 50;
                farmerAsma.Level = 35;
                farmerAsma.X = 563939;
                farmerAsma.Y = 509234;
                farmerAsma.Z = 2744 ;
                farmerAsma.Heading = 21;

                //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)
                    farmerAsma.SaveIntoDatabase();

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

            #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));

            GameEventMgr.AddHandler(laridiaTheMinstrel, GameLivingEvent.Interact, new DOLEventHandler(TalkToLaridiaTheMinstrel));
            GameEventMgr.AddHandler(laridiaTheMinstrel, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToLaridiaTheMinstrel));

            GameEventMgr.AddHandler(farmerAsma, GameObjectEvent.Interact, new DOLEventHandler(TalkToFarmerAsma));
            GameEventMgr.AddHandler(farmerAsma, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToFarmerAsma));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            laridiaTheMinstrel.AddQuestToGive(typeof (AgainstTheGrain));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Steward Willie", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no Sir Quait exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                stewardWillie       = new GameNPC();
                stewardWillie.Model = 27;
                stewardWillie.Name  = "Steward Willie";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + stewardWillie.Name + ", creating him ...");
                }
                stewardWillie.GuildName       = "Part of " + questTitle;
                stewardWillie.Realm           = eRealm.Albion;
                stewardWillie.CurrentRegionID = 1;
                stewardWillie.Size            = 52;
                stewardWillie.Level           = 35;
                stewardWillie.X       = 503547;
                stewardWillie.Y       = 474330;
                stewardWillie.Z       = 2788;
                stewardWillie.Heading = 3163;

                //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)
                {
                    stewardWillie.SaveIntoDatabase();
                }


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

            /* Now we do the same for the Lynnet.
             */
            npcs = WorldMgr.GetNPCsByName("Seamstress Lynnet", eRealm.Albion);
            if (npcs.Length == 0)
            {
                lynnet       = new GameNPC();
                lynnet.Model = 5;
                lynnet.Name  = "Seamstress Lynnet";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + lynnet.Name + ", creating ...");
                }
                lynnet.GuildName       = "Part of " + questTitle;
                lynnet.Realm           = eRealm.Albion;       //Needs to be none, else we can't kill him ;-)
                lynnet.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58, 30);
                lynnet.Inventory = template.CloseTemplate();

//				lynnet.AddNPCEquipment((byte) eEquipmentItems.TORSO, 58, 30, 0, 0);
                lynnet.Size    = 48;
                lynnet.Level   = 15;
                lynnet.X       = 530112;
                lynnet.Y       = 478662;
                lynnet.Z       = 2200;
                lynnet.Heading = 3203;

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

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

            npcs = WorldMgr.GetNPCsByName("Brother Don", eRealm.Albion);
            if (npcs.Length == 0)
            {
                don       = new GameNPC();
                don.Model = 34;
                don.Name  = "Brother Don";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + don.Name + ", creating ...");
                }
                don.GuildName       = "Part of " + questTitle;
                don.Realm           = eRealm.Albion;       //Needs to be none, else we can't kill him ;-)
                don.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58, 44);
                don.Inventory = template.CloseTemplate();

//				don.AddNPCEquipment((byte) eEquipmentItems.TORSO, 58, 44, 0, 0);
                don.Size    = 48;
                don.Level   = 15;
                don.X       = 505411;
                don.Y       = 495024;
                don.Z       = 2495;
                don.Heading = 2048;

                //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)
                {
                    don.SaveIntoDatabase();
                }

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

            #endregion

            #region defineItems

            wolfPeltCloak = GameServer.Database.FindObjectByKey <ItemTemplate>("wolf_pelt_cloak");
            if (wolfPeltCloak == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Wolf Pelt Cloak, creating it ...");
                }
                wolfPeltCloak            = new ItemTemplate();
                wolfPeltCloak.Name       = "Wolf Pelt Cloak";
                wolfPeltCloak.Level      = 3;
                wolfPeltCloak.Weight     = 3;
                wolfPeltCloak.Model      = 326;
                wolfPeltCloak.Bonus      = 1;
                wolfPeltCloak.Bonus1     = 1;
                wolfPeltCloak.Bonus1Type = (int)eStat.QUI;
                ;

                wolfPeltCloak.Bonus2     = -1;
                wolfPeltCloak.Bonus2Type = (int)eStat.CHR;

                wolfPeltCloak.Object_Type   = (int)eObjectType.Magical;
                wolfPeltCloak.Item_Type     = (int)eEquipmentItems.CLOAK;
                wolfPeltCloak.Id_nb         = "wolf_pelt_cloak";
                wolfPeltCloak.Price         = Money.GetMoney(0, 0, 0, 4, 3);
                wolfPeltCloak.IsPickable    = true;
                wolfPeltCloak.IsDropable    = true;
                wolfPeltCloak.Color         = 44;
                wolfPeltCloak.Quality       = 100;
                wolfPeltCloak.Condition     = 1000;
                wolfPeltCloak.MaxCondition  = 1000;
                wolfPeltCloak.Durability    = 1000;
                wolfPeltCloak.MaxDurability = 1000;


                //You don't have to store the created wolfPeltCloak 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(wolfPeltCloak);
            }

            wolfFur = GameServer.Database.FindObjectByKey <ItemTemplate>("wolf_fur");
            if (wolfFur == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Wolf Fur, creating it ...");
                }
                wolfFur             = new ItemTemplate();
                wolfFur.Object_Type = 0;
                wolfFur.Id_nb       = "wolf_fur";
                wolfFur.Name        = "Wolf Fur";
                wolfFur.Level       = 1;
                wolfFur.Model       = 57;
                wolfFur.IsDropable  = false;
                wolfFur.IsPickable  = 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(wolfFur);
            }

            wolfHeadToken = GameServer.Database.FindObjectByKey <ItemTemplate>("wolf_head_token");
            if (wolfHeadToken == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Wolf Head Token, creating it ...");
                }
                wolfHeadToken             = new ItemTemplate();
                wolfHeadToken.Object_Type = 0;
                wolfHeadToken.Id_nb       = "wolf_head_token";
                wolfHeadToken.Name        = "Wolf Head Token";
                wolfHeadToken.Level       = 1;
                wolfHeadToken.Model       = 1366;
                wolfHeadToken.IsDropable  = false;
                wolfHeadToken.IsPickable  = 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(wolfHeadToken);
            }

            #endregion

            /* Now we add some hooks to the Sir Quait 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 Sir Quait 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));

            GameEventMgr.AddHandler(stewardWillie, GameLivingEvent.Interact, new DOLEventHandler(TalkToStewardWillie));
            GameEventMgr.AddHandler(stewardWillie, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToStewardWillie));

            GameEventMgr.AddHandler(don, GameLivingEvent.Interact, new DOLEventHandler(TalkToBrotherDon));
            GameEventMgr.AddHandler(don, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToBrotherDon));

            GameEventMgr.AddHandler(lynnet, GameLivingEvent.Interact, new DOLEventHandler(TalkToSeamstressLynnet));

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

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

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

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

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

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

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

                if (SAVE_INTO_DATABASE)
                    questGiver.SaveIntoDatabase();

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

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

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

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

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

                if (SAVE_INTO_DATABASE)
                    questTarget.SaveIntoDatabase();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            questGiver.AddQuestToGive(typeof(BonesToBlades));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Brother Lawrence", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                brotherLawrence       = new GameHealer();
                brotherLawrence.Model = 32;
                brotherLawrence.Name  = "Brother Lawrence";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + brotherLawrence.Name + ", creating him ...");
                }
                brotherLawrence.GuildName       = "Part of " + questTitle + " Quest";
                brotherLawrence.Realm           = eRealm.Albion;
                brotherLawrence.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 14, 20);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 98, 44);
                brotherLawrence.Inventory = template.CloseTemplate();
                brotherLawrence.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                brotherLawrence.Size    = 54;
                brotherLawrence.Level   = 29;
                brotherLawrence.X       = 560559;
                brotherLawrence.Y       = 511892;
                brotherLawrence.Z       = 2344;
                brotherLawrence.Heading = 662;

                //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)
                {
                    brotherLawrence.SaveIntoDatabase();
                }

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

            #endregion

            #region defineItems

            // item db check
            lawrencesEmptyFlask = GameServer.Database.FindObjectByKey <ItemTemplate>("lawrences_empty_flask");
            if (lawrencesEmptyFlask == null)
            {
                lawrencesEmptyFlask      = new ItemTemplate();
                lawrencesEmptyFlask.Name = "Lawrence's Empty Flask";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + lawrencesEmptyFlask.Name + ", creating it ...");
                }

                lawrencesEmptyFlask.Level  = 0;
                lawrencesEmptyFlask.Weight = 1;
                lawrencesEmptyFlask.Model  = 490;

                lawrencesEmptyFlask.Object_Type = (int)eObjectType.GenericItem;
                lawrencesEmptyFlask.Id_nb       = "lawrences_empty_flask";
                lawrencesEmptyFlask.Price       = 0;
                lawrencesEmptyFlask.IsPickable  = false;
                lawrencesEmptyFlask.IsDropable  = false;

                lawrencesEmptyFlask.Quality       = 100;
                lawrencesEmptyFlask.Condition     = 1000;
                lawrencesEmptyFlask.MaxCondition  = 1000;
                lawrencesEmptyFlask.Durability    = 1000;
                lawrencesEmptyFlask.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(lawrencesEmptyFlask);
            }

            // item db check
            lawrencesFilledFlask = GameServer.Database.FindObjectByKey <ItemTemplate>("lawrences_filled_flask");
            if (lawrencesFilledFlask == null)
            {
                lawrencesFilledFlask      = new ItemTemplate();
                lawrencesFilledFlask.Name = "Lawrence's Filled Flask";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + lawrencesFilledFlask.Name + ", creating it ...");
                }

                lawrencesFilledFlask.Level  = 0;
                lawrencesFilledFlask.Weight = 1;
                lawrencesFilledFlask.Model  = 490;

                lawrencesFilledFlask.Object_Type = (int)eObjectType.GenericItem;
                lawrencesFilledFlask.Id_nb       = "lawrences_filled_flask";
                lawrencesFilledFlask.Price       = 0;
                lawrencesFilledFlask.IsPickable  = false;
                lawrencesFilledFlask.IsDropable  = false;

                lawrencesFilledFlask.Quality       = 100;
                lawrencesFilledFlask.Condition     = 1000;
                lawrencesFilledFlask.MaxCondition  = 1000;
                lawrencesFilledFlask.Durability    = 1000;
                lawrencesFilledFlask.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(lawrencesFilledFlask);
            }

            #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));

            GameEventMgr.AddHandler(brotherLawrence, GameLivingEvent.Interact, new DOLEventHandler(TalkToBrotherLawrence));
            GameEventMgr.AddHandler(brotherLawrence, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToBrotherLawrence));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            brotherLawrence.AddQuestToGive(typeof(LawrencesOil));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Elvar Ironhand", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
                * this users Mob Database, so we simply create one ;-)
                * else we take the existing one. And if more than one exist, we take
                * the first ...
                */
            if (npcs.Length == 0)
            {
                elvarIronhand = new GameNPC();
                elvarIronhand.Model = 10;
                elvarIronhand.Name = "Elvar Ironhand";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + elvarIronhand.Name + ", creating him ...");
                elvarIronhand.GuildName = "Part of " + questTitle + " Quest";
                elvarIronhand.Realm = eRealm.Albion;
                elvarIronhand.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 12);
                elvarIronhand.Inventory = template.CloseTemplate();
                elvarIronhand.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                elvarIronhand.Size = 54;
                elvarIronhand.Level = 17;
                elvarIronhand.X = 561351;
                elvarIronhand.Y = 510292;
                elvarIronhand.Z = 2400;
                elvarIronhand.Heading = 3982;

                //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)
                    elvarIronhand.SaveIntoDatabase();

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

            #endregion

            #region defineItems

            // item db check
            wellPreservedBones = GameServer.Database.FindObjectByKey<ItemTemplate>("well_preserved_bone");
            if (wellPreservedBones == null)
            {
                wellPreservedBones = new ItemTemplate();
                wellPreservedBones.Name = "Well-Preserved Bone";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find "+wellPreservedBones.Name+", creating it ...");

                wellPreservedBones.Level = 0;
                wellPreservedBones.Weight = 1;
                wellPreservedBones.Model = 497;

                wellPreservedBones.Object_Type = (int) eObjectType.GenericItem;
                wellPreservedBones.Id_nb = "well_preserved_bone";
                wellPreservedBones.Price = 0;
                wellPreservedBones.IsPickable = false;
                wellPreservedBones.IsDropable = false;

                wellPreservedBones.Quality = 100;
                wellPreservedBones.Condition = 1000;
                wellPreservedBones.MaxCondition = 1000;
                wellPreservedBones.Durability = 1000;
                wellPreservedBones.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(wellPreservedBones);
            }

            // item db check
            twoWellPreservedBones = GameServer.Database.FindObjectByKey<ItemTemplate>("two_well_preserved_bones");
            if (twoWellPreservedBones == null)
            {
                twoWellPreservedBones = new ItemTemplate();
                twoWellPreservedBones.Name = "Two Well-Preserved Bones";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find "+twoWellPreservedBones.Name+", creating it ...");

                twoWellPreservedBones.Level = 0;
                twoWellPreservedBones.Weight = 1;
                twoWellPreservedBones.Model = 497;

                twoWellPreservedBones.Object_Type = (int) eObjectType.GenericItem;
                twoWellPreservedBones.Id_nb = "two_well_preserved_bones";
                twoWellPreservedBones.Price = 0;
                twoWellPreservedBones.IsPickable = false;
                twoWellPreservedBones.IsDropable = false;

                twoWellPreservedBones.Quality = 100;
                twoWellPreservedBones.Condition = 1000;
                twoWellPreservedBones.MaxCondition = 1000;
                twoWellPreservedBones.Durability = 1000;
                twoWellPreservedBones.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(twoWellPreservedBones);
            }

            #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));

            GameEventMgr.AddHandler(elvarIronhand, GameLivingEvent.Interact, new DOLEventHandler(TalkToElvarIronhand));
            GameEventMgr.AddHandler(elvarIronhand, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToElvarIronhand));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            elvarIronhand.AddQuestToGive(typeof (BuildingABetterBow));

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

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

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.WhenGoodBrowniesGoBad.ScriptLoaded.Text1"), eRealm.Albion);

            if (npcs.Length == 0)
            {
                MasterKless       = new GameNPC();
                MasterKless.Model = 64;
                MasterKless.Name  = LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.WhenGoodBrowniesGoBad.ScriptLoaded.Text1");
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + MasterKless.Name + ", creating him ...");
                }

                // k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                // MasterKless.GuildName = "Part of " + questTitle + " Quest";
                MasterKless.Realm           = eRealm.Albion;
                MasterKless.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 1005);    // Slot 25
                template.AddNPCEquipment(eInventorySlot.Cloak, 96);           // Slot 26
                template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 1166); // Slot 12
                MasterKless.Inventory = template.CloseTemplate();
                MasterKless.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                MasterKless.Size    = 51;
                MasterKless.Level   = 50;
                MasterKless.X       = 559370;
                MasterKless.Y       = 513587;
                MasterKless.Z       = 2428;
                MasterKless.Heading = 2685;

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

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

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

            GameEventMgr.AddHandler(MasterKless, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterKless));
            GameEventMgr.AddHandler(MasterKless, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterKless));

            MasterKless.AddQuestToGive(typeof(WhenGoodBrowniesGoBad));

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

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Hugh Gallen", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
                * this users Mob Database, so we simply create one ;-)
                * else we take the existing one. And if more than one exist, we take
                * the first ...
                */
            if (npcs.Length == 0)
            {
                hughGallen = new GameNPC();
                hughGallen.Model = 40;
                hughGallen.Name = "Hugh Gallen";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + hughGallen.Name + ", creating him ...");
                hughGallen.GuildName = "Part of " + questTitle + " Quest";
                hughGallen.Realm = eRealm.Albion;
                hughGallen.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                hughGallen.Inventory = template.CloseTemplate();
                hughGallen.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                hughGallen.Size = 49;
                hughGallen.Level = 38;
                hughGallen.X = 574640;
                hughGallen.Y = 531109;
                hughGallen.Z = 2896;
                hughGallen.Heading = 2275;

                //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)
                    hughGallen.SaveIntoDatabase();

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

            #endregion

            #region defineItems

            // item db check
            beltOfAnimation = GameServer.Database.FindObjectByKey<ItemTemplate>("belt_of_animation");
            if (beltOfAnimation == null)
            {
                beltOfAnimation = new ItemTemplate();
                beltOfAnimation.Name = "Belt of Animation";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find "+beltOfAnimation.Name+", creating it ...");

                beltOfAnimation.Level = 5;
                beltOfAnimation.Weight = 3;
                beltOfAnimation.Model = 597;

                beltOfAnimation.Object_Type = (int) eObjectType.Magical;
                beltOfAnimation.Item_Type = (int) eEquipmentItems.WAIST;
                beltOfAnimation.Id_nb = "belt_of_animation";
                beltOfAnimation.Price = 0;
                beltOfAnimation.IsPickable = true;
                beltOfAnimation.IsDropable = false; // can't be sold to merchand

                beltOfAnimation.Bonus1 = 6;
                beltOfAnimation.Bonus1Type = (int)eProperty.MaxHealth;

                beltOfAnimation.Quality = 100;
                beltOfAnimation.Condition = 1000;
                beltOfAnimation.MaxCondition = 1000;
                beltOfAnimation.Durability = 1000;
                beltOfAnimation.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(beltOfAnimation);
            }

            #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));

            GameEventMgr.AddHandler(hughGallen, GameLivingEvent.Interact, new DOLEventHandler(TalkToHughGallen));
            GameEventMgr.AddHandler(hughGallen, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToHughGallen));

            /* Now we bring to Yetta Fletcher the possibility to give this quest to players */
            hughGallen.AddQuestToGive(typeof (ClericMulgrut));

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

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

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>(questGiverName, eRealm.Albion);

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

                questGiver.Realm           = eRealm.Albion;
                questGiver.CurrentRegionID = 27;

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

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

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

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

            npcs = WorldMgr.GetObjectsByName <GameNPC>(questTargetName, eRealm.Albion);

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

                questTarget.Realm           = eRealm.Albion;
                questTarget.CurrentRegionID = 27;

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

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

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

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

            targetArea = WorldMgr.GetRegion(targetLocation.RegionID).AddArea(new Area.Circle(string.Empty, targetLocation.X, targetLocation.Y, targetLocation.Z, 200));

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

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

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

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

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

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

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

            questGiver.AddQuestToGive(typeof(MovementAndInteraction));

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