Example #1
0
        //This will plant a tree at x y and z and increase the TreeNumber.
        private int PlantTree(int treeX, int treeY, int treeZ)
        {
            GameHauntedTree hauntedTree = new GameHauntedTree();

            hauntedTree.Model           = 948;
            hauntedTree.Size            = 25;
            hauntedTree.Level           = (byte)Util.Random(6, 7);      //from live, they range in level from 6 to 7.
            hauntedTree.Name            = "haunted appletree seedling"; //from live
            hauntedTree.CurrentRegionID = 51;
            hauntedTree.Heading         = 3195;
            hauntedTree.Realm           = 0;
            hauntedTree.CurrentSpeed    = 0;
            hauntedTree.MaxSpeedBase    = 191;
            hauntedTree.GuildName       = "";
            hauntedTree.X               = treeX; //These have to vary depending on which
            hauntedTree.Y               = treeY; //spot we are planting a tree at.
            hauntedTree.Z               = treeZ; //Z is very important.  Strange behavior if Z is zero.
            hauntedTree.RoamingRange    = 0;
            hauntedTree.RespawnInterval = -1;
            hauntedTree.BodyType        = 0;

            StandardMobBrain brain = new StandardMobBrain();

            brain.AggroLevel = 100;
            brain.AggroRange = 500;
            hauntedTree.SetOwnBrain(brain);

            hauntedTree.AddToWorld();
            TreenumberWhilePlanting++;
            TreeNumber++;
            //Tell me when you die so I can TreeNumber--;
            GameEventMgr.AddHandler(hauntedTree, GameNPCEvent.Dying, new DOLEventHandler(TreeHasDied));

            return(0);
        }
        /// <summary>
        /// called when spell effect has to be started and applied to targets
        /// </summary>
        public override bool StartSpell(GameLiving target)
        {
            if (target == null)
            {
                return(false);
            }

            IList targets      = SelectTargets(target);
            IList realmtargets = SelectRealmTargets(target);

            foreach (GameLiving t in targets)
            {
                if (t.Level <= m_spell.Value)
                {
                    GameNPC mob = (GameNPC)t;
                    if (mob.Brain is StandardMobBrain)
                    {
                        StandardMobBrain sBrain = (StandardMobBrain)mob.Brain;
                        //mob.StopAttack();

                        foreach (GamePlayer player in realmtargets)
                        {
                            sBrain.RemoveFromAggroList(player);
                        }
                    }

                    mob.AddBrain(new FriendBrain(this));
                }
            }

            return(true);
        }
Example #3
0
        protected void initDragonflyHatchling()
        {
            dragonflyHatchling = new GameNPC();

            dragonflyHatchling.Model           = 819;
            dragonflyHatchling.Name            = "Dragonfly Hatchling";
            dragonflyHatchling.GuildName       = "Part of " + questTitle + " Quest";
            dragonflyHatchling.Flags          ^= GameNPC.eFlags.PEACE;
            dragonflyHatchling.CurrentRegionID = 1;
            dragonflyHatchling.Size            = 25;
            dragonflyHatchling.Level           = 3;
            dragonflyHatchling.X            = fairyDragonflyHandler.X + Util.Random(-150, 150);
            dragonflyHatchling.Y            = fairyDragonflyHandler.Y + Util.Random(-150, 150);
            dragonflyHatchling.Z            = fairyDragonflyHandler.Z;
            dragonflyHatchling.Heading      = 93;
            dragonflyHatchling.MaxSpeedBase = 200;

            StandardMobBrain brain = new StandardMobBrain();

            brain.AggroLevel = 0;
            brain.AggroRange = 0;
            dragonflyHatchling.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
            // dragonflyHatchling.SaveIntoDatabase();
            GameEventMgr.AddHandler(dragonflyHatchling, GameLivingEvent.Interact, new DOLEventHandler(TalkToDragonflyHatchling));
        }
Example #4
0
        protected void initGrifflet()
        {
            grifflet = new GameNPC();

            grifflet.Model = 1236;
            grifflet.Name  = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.StolenEggs.InitGrifflet.NPCGrifflet");

            // grifflet.GuildName = "Part of " + mQuestPlayer.GetName(0, false) + "'s " + questTitle + " Quest";
            grifflet.Flags          ^= GameNPC.eFlags.PEACE;
            grifflet.CurrentRegionID = askefruerTrainer.CurrentRegionID;
            grifflet.Size            = 20;
            grifflet.Level           = 3;
            grifflet.X            = askefruerTrainer.X + Util.Random(-150, 150);
            grifflet.Y            = askefruerTrainer.Y + Util.Random(-150, 150);
            grifflet.Z            = askefruerTrainer.Z;
            grifflet.Heading      = 93;
            grifflet.MaxSpeedBase = 200;

            StandardMobBrain brain = new StandardMobBrain();

            brain.AggroLevel = 0;
            brain.AggroRange = 0;
            grifflet.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
            // grifflet.SaveIntoDatabase();
            GameEventMgr.AddHandler(grifflet, GameLivingEvent.Interact, new DOLEventHandler(TalkToGrifflet));
        }
Example #5
0
        public void SpawnAGuard(int guardX, int guardY, int guardZ, ushort heading)
        {
            GameStairGuard guard = new GameStairGuard();

            guard.Model           = 1349;
            guard.Size            = 37;
            guard.Level           = 80;   //level 70 on live
            guard.Name            = "daleros ephoros";
            guard.CurrentRegionID = (ushort)Ianetor.playerregion;
            guard.Heading         = heading;
            guard.Realm           = 0;
            guard.CurrentSpeed    = 0;
            guard.MaxSpeedBase    = 300;
            guard.GuildName       = "";
            guard.X               = guardX;
            guard.Y               = guardY;
            guard.Z               = guardZ;
            guard.RoamingRange    = 0;
            guard.RespawnInterval = 0;
            guard.BodyType        = 0;
            guard.Strength        = 600;

            StandardMobBrain brain = new StandardMobBrain();

            brain.AggroLevel = 100;
            brain.AggroRange = 200;
            guard.SetOwnBrain(brain);

            guard.AddToWorld();
            StairGuardList.Add(guard);

            return;
        }
        public static GameNPC GetAddrir()
        {
            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("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);
        }
Example #7
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_EXAMPLES)
            {
                return;
            }

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Sir Quait", eRealm.Albion);
            npcs = WorldMgr.GetObjectsByName <GameNPC>("Sir Quait", (eRealm)1);
            GameNPC SirQuait = null;

            if (npcs.Length == 0)
            {
                SirQuait       = new DOL.GS.GameNPC();
                SirQuait.Model = 40;
                SirQuait.Name  = "Sir Quait";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + SirQuait.Name + ", creating ...");
                }

                SirQuait.Realm           = eRealm.Albion;
                SirQuait.CurrentRegionID = 1;
                SirQuait.Size            = 50;
                SirQuait.Level           = 10;
                SirQuait.MaxSpeedBase    = 100;
                SirQuait.Faction         = FactionMgr.GetFactionByID(0);
                SirQuait.X               = 531971;
                SirQuait.Y               = 478955;
                SirQuait.Z               = 0;
                SirQuait.Heading         = 3570;
                SirQuait.RespawnInterval = 0;
                SirQuait.BodyType        = 0;

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

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

            BaseBehaviour b = new BaseBehaviour(SirQuait);
            MessageAction a = new MessageAction(SirQuait, "This is just a simple test bahaviour.", eTextType.Emote);

            b.AddAction(a);
            InteractTrigger t = new InteractTrigger(SirQuait, b.NotifyHandler, SirQuait);

            b.AddTrigger(t);

            // store the behaviour in a list so it won't be garbage collected
            behaviours.Add(b);

            log.Info("Simple Test Behaviour added");
        }
Example #8
0
        public override void Notify(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null || player.IsDoingQuest(typeof(ClericMulgrut)) == null)
            {
                return;
            }

            if (e == GameLivingEvent.EnemyKilled)
            {
                EnemyKilledEventArgs gArgs = (EnemyKilledEventArgs)args;
                if (Step == 1)
                {
                    if (gArgs.Target.Name == "puny skeleton")
                    {
                        if (Util.Chance(25))
                        {
                            if (mulgrutMaggot == null)
                            {
                                mulgrutMaggot                 = new GameNPC();
                                mulgrutMaggot.Model           = 467;
                                mulgrutMaggot.Name            = "Mulgrut Maggot";
                                mulgrutMaggot.Realm           = eRealm.None;
                                mulgrutMaggot.CurrentRegionID = 1;

                                mulgrutMaggot.Size    = 60;
                                mulgrutMaggot.Level   = 5;
                                mulgrutMaggot.X       = 565941;
                                mulgrutMaggot.Y       = 528121;
                                mulgrutMaggot.Z       = 2152;
                                mulgrutMaggot.Heading = 2278;

                                StandardMobBrain brain = new StandardMobBrain();  // set a brain witch find a lot mob friend to attack the player
                                mulgrutMaggot.SetOwnBrain(brain);

                                mulgrutMaggot.RespawnInterval = 0; // don't respawn when killed

                                mulgrutMaggot.AddToWorld();
                            }
                        }
                    }
                    else if (gArgs.Target.Name == "Mulgrut Maggot")
                    {
                        GiveItem(gArgs.Target, player, beltOfAnimation);
                        if (mulgrutMaggot != null)
                        {
                            mulgrutMaggot = null;
                        }
                        FinishQuest();
                    }
                }
            }
        }
Example #9
0
        public override void Notify(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null || player.IsDoingQuest(typeof(HuntForSlith)) == null)
            {
                return;
            }

            if (e == GameLivingEvent.EnemyKilled)
            {
                EnemyKilledEventArgs gArgs = (EnemyKilledEventArgs)args;
                if (Step == 1)
                {
                    if (gArgs.Target.Name == "slith broodling")
                    {
                        if (Util.Chance(25))
                        {
                            if (slith == null)
                            {
                                slith                 = new GameNPC();
                                slith.Model           = 31;
                                slith.Name            = "Slith";
                                slith.Realm           = eRealm.None;
                                slith.CurrentRegionID = 1;

                                slith.Size    = 50;
                                slith.Level   = 7;
                                slith.X       = 524840;
                                slith.Y       = 490529;
                                slith.Z       = 2545;
                                slith.Heading = 2082;

                                StandardMobBrain brain = new StandardMobBrain();  // set a brain witch find a lot mob friend to attack the player
                                slith.SetOwnBrain(brain);

                                slith.RespawnInterval = 0; // don't respawn when killed

                                slith.AddToWorld();
                            }
                        }
                    }
                    else if (gArgs.Target.Name == "Slith")
                    {
                        GiveItem(gArgs.Target, player, slithsTail);
                        if (slith != null)
                        {
                            slith = null;
                        }
                        FinishQuest();
                    }
                }
            }
        }
Example #10
0
        /// <summary>
        /// Add targets to an NPC's aggro table.
        /// </summary>
        /// <param name="npc">The NPC to aggro on the targets.</param>
        private void ReportTargets(GameNPC npc)
        {
            if (npc == null)
            {
                return;
            }

            // Assign a random amount of aggro for each target, that way
            // different NPCs will attack different targets first.
            StandardMobBrain brain = npc.Brain as StandardMobBrain;

            foreach (GameLiving target in m_targetList)
            {
                brain.AddToAggroList(target, Util.Random(1, m_targetList.Count));
            }
        }
Example #11
0
        public override void WalkToSpawn(short speed)
        {
            if (PatrolGroup != null)
            {
                StopAttack();
                StopFollowing();

                StandardMobBrain brain = Brain as StandardMobBrain;
                if (brain != null && brain.HasAggro)
                {
                    brain.ClearAggroList();
                }

                PatrolGroup.StartPatrol();
                return;
            }
            base.WalkToSpawn(speed);
        }
Example #12
0
        /// <summary>
        /// Walk to the spawn point, always max speed for keep guards, or continue patrol.
        /// </summary>
        public override void WalkToSpawn()
        {
            if (PatrolGroup != null)
            {
                StopAttack();
                StopFollowing();

                StandardMobBrain brain = Brain as StandardMobBrain;
                if (brain != null && brain.HasAggro)
                {
                    brain.ClearAggroList();
                }

                PatrolGroup.StartPatrol();
            }
            else
            {
                WalkToSpawn(MaxSpeed);
            }
        }
Example #13
0
        protected virtual void CreateAskefruer()
        {
            askefruer                 = new GameNPC();
            askefruer.Model           = 678;
            askefruer.Name            = "Fallen Askefruer";
            askefruer.GuildName       = "Part of " + questTitle + " Quest";
            askefruer.Realm           = eRealm.None;
            askefruer.CurrentRegionID = askefruerLocation.RegionID;
            askefruer.Size            = 50;
            askefruer.Level           = 4;
            askefruer.Position        = askefruerLocation.Position + new Vector3(Util.Random(-150, 150), Util.Random(-150, 150), 0);
            askefruer.Heading         = askefruerLocation.Heading;

            StandardMobBrain brain = new StandardMobBrain();

            brain.AggroLevel = 20;
            brain.AggroRange = 200;
            askefruer.SetOwnBrain(brain);

            askefruer.AddToWorld();
        }
Example #14
0
        protected virtual void CreateSluagh()
        {
            sluagh                 = new GameNPC();
            sluagh.Model           = 603;
            sluagh.Name            = "Sluagh Footsoldier";
            sluagh.GuildName       = "Part of " + questTitle + " Quest";
            sluagh.Realm           = eRealm.None;
            sluagh.CurrentRegionID = 200;
            sluagh.Size            = 50;
            sluagh.Level           = 4;
            sluagh.Position        = sluaghLocation.Position + new Vector3(Util.Random(-150, 150), Util.Random(-150, 150), 0);
            sluagh.Heading         = sluaghLocation.Heading;

            StandardMobBrain brain = new StandardMobBrain();

            brain.AggroLevel = 20;
            brain.AggroRange = 200;
            sluagh.SetOwnBrain(brain);

            sluagh.AddToWorld();
        }
Example #15
0
        protected virtual void CreateFairy()
        {
            ireFairy                 = new GameNPC();
            ireFairy.Model           = 603;
            ireFairy.Name            = "Ire Fairy";
            ireFairy.GuildName       = "Part of " + questTitle + " Quest";
            ireFairy.Realm           = eRealm.None;
            ireFairy.CurrentRegionID = 1;
            ireFairy.Size            = 50;
            ireFairy.Level           = 4;
            ireFairy.X               = GameLocation.ConvertLocalXToGlobalX(12336, 0) + Util.Random(-150, 150);
            ireFairy.Y               = GameLocation.ConvertLocalYToGlobalY(22623, 0) + Util.Random(-150, 150);
            ireFairy.Z               = 2405;
            ireFairy.Heading         = 226;

            StandardMobBrain brain = new StandardMobBrain();

            brain.AggroLevel = 20;
            brain.AggroRange = 200;
            ireFairy.SetOwnBrain(brain);

            ireFairy.AddToWorld();
        }
Example #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 ...");
            }

            #region defineNPCs
            GameNPC[] npcs;

            npcs = WorldMgr.GetNPCsByName("Audun", (eRealm)2);
            if (npcs.Length == 0)
            {
                if (!WorldMgr.GetRegion(101).IsDisabled)
                {
                    Audun       = new DOL.GS.GameNPC();
                    Audun.Model = 232;
                    Audun.Name  = "Audun";
                    if (log.IsWarnEnabled)
                    {
                        log.Warn("Could not find " + Audun.Name + ", creating ...");
                    }
                    Audun.GuildName       = "Part of " + questTitle + " Quest";
                    Audun.Realm           = eRealm.Midgard;
                    Audun.CurrentRegionID = 101;
                    Audun.Size            = 48;
                    Audun.Level           = 49;
                    Audun.MaxSpeedBase    = 191;
                    Audun.Faction         = FactionMgr.GetFactionByID(0);
                    Audun.X               = 33283;
                    Audun.Y               = 35305;
                    Audun.Z               = 8027;
                    Audun.Heading         = 1763;
                    Audun.RespawnInterval = -1;
                    Audun.BodyType        = 0;


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

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

            npcs = WorldMgr.GetNPCsByName("Guard Olja", (eRealm)2);
            if (npcs.Length == 0)
            {
                if (!WorldMgr.GetRegion(229).IsDisabled)
                {
                    GuardOlja       = new DOL.GS.GameNPC();
                    GuardOlja.Model = 180;
                    GuardOlja.Name  = "Guard Olja";
                    if (log.IsWarnEnabled)
                    {
                        log.Warn("Could not find " + GuardOlja.Name + ", creating ...");
                    }
                    GuardOlja.GuildName       = "Part of " + questTitle + " Quest";
                    GuardOlja.Realm           = eRealm.Midgard;
                    GuardOlja.CurrentRegionID = 229;
                    GuardOlja.Size            = 50;
                    GuardOlja.Level           = 50;
                    GuardOlja.MaxSpeedBase    = 191;
                    GuardOlja.Faction         = FactionMgr.GetFactionByID(0);
                    GuardOlja.X               = 47994;
                    GuardOlja.Y               = 37341;
                    GuardOlja.Z               = 21812;
                    GuardOlja.Heading         = 204;
                    GuardOlja.RespawnInterval = -1;
                    GuardOlja.BodyType        = 0;


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

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


            #endregion

            #region defineItems

            emptybottle = GameServer.Database.FindObjectByKey <ItemTemplate>("emptybottle");
            if (emptybottle == null)
            {
                emptybottle      = new ItemTemplate();
                emptybottle.Name = "Empty Bottle";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + emptybottle.Name + ", creating it ...");
                }
                emptybottle.Level            = 50;
                emptybottle.Weight           = 5;
                emptybottle.Model            = 554;
                emptybottle.Object_Type      = 0;
                emptybottle.Item_Type        = 40;
                emptybottle.Id_nb            = "emptybottle";
                emptybottle.Hand             = 0;
                emptybottle.Price            = 0;
                emptybottle.IsPickable       = true;
                emptybottle.IsDropable       = true;
                emptybottle.IsTradable       = true;
                emptybottle.CanDropAsLoot    = false;
                emptybottle.Color            = 0;
                emptybottle.Bonus            = 35;      // default bonus
                emptybottle.Bonus1           = 0;
                emptybottle.Bonus1Type       = (int)0;
                emptybottle.Bonus2           = 0;
                emptybottle.Bonus2Type       = (int)0;
                emptybottle.Bonus3           = 0;
                emptybottle.Bonus3Type       = (int)0;
                emptybottle.Bonus4           = 0;
                emptybottle.Bonus4Type       = (int)0;
                emptybottle.Bonus5           = 0;
                emptybottle.Bonus5Type       = (int)0;
                emptybottle.Bonus6           = 0;
                emptybottle.Bonus6Type       = (int)0;
                emptybottle.Bonus7           = 0;
                emptybottle.Bonus7Type       = (int)0;
                emptybottle.Bonus8           = 0;
                emptybottle.Bonus8Type       = (int)0;
                emptybottle.Bonus9           = 0;
                emptybottle.Bonus9Type       = (int)0;
                emptybottle.Bonus10          = 0;
                emptybottle.Bonus10Type      = (int)0;
                emptybottle.ExtraBonus       = 0;
                emptybottle.ExtraBonusType   = (int)0;
                emptybottle.Effect           = 0;
                emptybottle.Emblem           = 0;
                emptybottle.Charges          = 0;
                emptybottle.MaxCharges       = 0;
                emptybottle.SpellID          = 0;
                emptybottle.ProcSpellID      = 0;
                emptybottle.Type_Damage      = 0;
                emptybottle.Realm            = 0;
                emptybottle.MaxCount         = 1;
                emptybottle.PackSize         = 1;
                emptybottle.Extension        = 0;
                emptybottle.Quality          = 99;
                emptybottle.Condition        = 100;
                emptybottle.MaxCondition     = 100;
                emptybottle.Durability       = 100;
                emptybottle.MaxDurability    = 100;
                emptybottle.PoisonCharges    = 0;
                emptybottle.PoisonMaxCharges = 0;
                emptybottle.PoisonSpellID    = 0;
                emptybottle.ProcSpellID1     = 0;
                emptybottle.SpellID1         = 0;
                emptybottle.MaxCharges1      = 0;
                emptybottle.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(emptybottle);
                }
            }
            bottleofmead = GameServer.Database.FindObjectByKey <ItemTemplate>("bottleofmead");
            if (bottleofmead == null)
            {
                bottleofmead      = new ItemTemplate();
                bottleofmead.Name = "Bottle of Mead";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + bottleofmead.Name + ", creating it ...");
                }
                bottleofmead.Level            = 50;
                bottleofmead.Weight           = 5;
                bottleofmead.Model            = 554;
                bottleofmead.Object_Type      = 0;
                bottleofmead.Item_Type        = 40;
                bottleofmead.Id_nb            = "bottleofmead";
                bottleofmead.Hand             = 0;
                bottleofmead.Price            = 0;
                bottleofmead.IsPickable       = true;
                bottleofmead.IsDropable       = true;
                bottleofmead.IsTradable       = true;
                bottleofmead.CanDropAsLoot    = false;
                bottleofmead.Color            = 0;
                bottleofmead.Bonus            = 35;      // default bonus
                bottleofmead.Bonus1           = 0;
                bottleofmead.Bonus1Type       = (int)0;
                bottleofmead.Bonus2           = 0;
                bottleofmead.Bonus2Type       = (int)0;
                bottleofmead.Bonus3           = 0;
                bottleofmead.Bonus3Type       = (int)0;
                bottleofmead.Bonus4           = 0;
                bottleofmead.Bonus4Type       = (int)0;
                bottleofmead.Bonus5           = 0;
                bottleofmead.Bonus5Type       = (int)0;
                bottleofmead.Bonus6           = 0;
                bottleofmead.Bonus6Type       = (int)0;
                bottleofmead.Bonus7           = 0;
                bottleofmead.Bonus7Type       = (int)0;
                bottleofmead.Bonus8           = 0;
                bottleofmead.Bonus8Type       = (int)0;
                bottleofmead.Bonus9           = 0;
                bottleofmead.Bonus9Type       = (int)0;
                bottleofmead.Bonus10          = 0;
                bottleofmead.Bonus10Type      = (int)0;
                bottleofmead.ExtraBonus       = 0;
                bottleofmead.ExtraBonusType   = (int)0;
                bottleofmead.Effect           = 0;
                bottleofmead.Emblem           = 0;
                bottleofmead.Charges          = 0;
                bottleofmead.MaxCharges       = 0;
                bottleofmead.SpellID          = 0;
                bottleofmead.ProcSpellID      = 0;
                bottleofmead.Type_Damage      = 0;
                bottleofmead.Realm            = 0;
                bottleofmead.MaxCount         = 1;
                bottleofmead.PackSize         = 1;
                bottleofmead.Extension        = 0;
                bottleofmead.Quality          = 99;
                bottleofmead.Condition        = 100;
                bottleofmead.MaxCondition     = 100;
                bottleofmead.Durability       = 100;
                bottleofmead.MaxDurability    = 100;
                bottleofmead.PoisonCharges    = 0;
                bottleofmead.PoisonMaxCharges = 0;
                bottleofmead.PoisonSpellID    = 0;
                bottleofmead.ProcSpellID1     = 0;
                bottleofmead.SpellID1         = 0;
                bottleofmead.MaxCharges1      = 0;
                bottleofmead.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(bottleofmead);
                }
            }


            #endregion

            #region defineAreas

            #endregion

            #region defineQuestParts

            QuestBuilder   builder = QuestMgr.getBuilder(typeof(meadrun));
            QuestBehaviour a;
            a = builder.CreateBehaviour(Audun, -1);
            a.AddTrigger(eTriggerType.Interact, null, Audun);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.meadrun), Audun);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.meadrun), null, (eComparator)5);
            a.AddAction(eActionType.Talk, "Greetings. You appear to be down on your luck. I have a [proposition] for you if you're interested.", null);
            AddBehaviour(a);
            a = builder.CreateBehaviour(Audun, -1);
            a.AddTrigger(eTriggerType.Whisper, "proposition", Audun);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.meadrun), Audun);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.meadrun), null, (eComparator)5);
            a.AddAction(eActionType.Talk, "I need to deliver some mead to the guards just inside the Burial Grounds. There is a bit of coin to be had if you would deliver the mead for me.", Audun);
            a.AddAction(eActionType.OfferQuest, typeof(DOL.GS.Quests.Midgard.meadrun), "Will you deliver the mead for Audun? [Levels 1-4]");
            AddBehaviour(a);
            a = builder.CreateBehaviour(Audun, -1);
            a.AddTrigger(eTriggerType.DeclineQuest, null, typeof(DOL.GS.Quests.Midgard.meadrun));
            a.AddAction(eActionType.Talk, "No problem. See you", Audun);
            AddBehaviour(a);
            a = builder.CreateBehaviour(Audun, -1);
            a.AddTrigger(eTriggerType.AcceptQuest, null, typeof(DOL.GS.Quests.Midgard.meadrun));
            a.AddAction(eActionType.Talk, "Here take the mead to Guard Olja inside the entrance of the Burial Grounds.", Audun);
            a.AddAction(eActionType.GiveItem, bottleofmead, Audun);
            a.AddAction(eActionType.GiveQuest, typeof(DOL.GS.Quests.Midgard.meadrun), Audun);
            AddBehaviour(a);
            a = builder.CreateBehaviour(GuardOlja, -1);
            a.AddTrigger(eTriggerType.GiveItem, GuardOlja, bottleofmead);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.meadrun), null);
            a.AddAction(eActionType.Talk, "Thanks. Here, take this empty bottle back to Auduan.", GuardOlja);
            a.AddAction(eActionType.GiveItem, emptybottle, GuardOlja);
            a.AddAction(eActionType.TakeItem, bottleofmead, null);
            a.AddAction(eActionType.IncQuestStep, typeof(DOL.GS.Quests.Midgard.meadrun), null);
            AddBehaviour(a);
            a = builder.CreateBehaviour(Audun, -1);
            a.AddTrigger(eTriggerType.GiveItem, Audun, emptybottle);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.meadrun), 2, (eComparator)3);
            a.AddAction(eActionType.Talk, "Good work. Here is that bit of coin I was talking about. Check back with me later, and I may have more work for you.", Audun);
            a.AddAction(eActionType.GiveXP, 5, null);
            a.AddAction(eActionType.GiveGold, 27, null);
            a.AddAction(eActionType.FinishQuest, typeof(DOL.GS.Quests.Midgard.meadrun), null);
            AddBehaviour(a);

            #endregion

            // Custom Scriptloaded Code Begin

            // Custom Scriptloaded Code End
            if (Audun != null)
            {
                Audun.AddQuestToGive(typeof(meadrun));
            }
            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Example #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 ...");
            }

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Guard Alakyrr", eRealm.None);

            if (npcs.Length == 0)
            {
                GuardAlakyrr       = new DOL.GS.GameNPC();
                GuardAlakyrr.Model = 748;
                GuardAlakyrr.Name  = "Guard Alakyrr";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + GuardAlakyrr.Name + ", creating ...");
                }
                GuardAlakyrr.GuildName       = "Part of " + questTitle + " Quest";
                GuardAlakyrr.Realm           = eRealm.Albion;
                GuardAlakyrr.CurrentRegionID = 63;
                GuardAlakyrr.Size            = 50;
                GuardAlakyrr.Level           = 30;
                GuardAlakyrr.MaxSpeedBase    = 191;
                GuardAlakyrr.Faction         = FactionMgr.GetFactionByID(0);
                GuardAlakyrr.X               = 28707;
                GuardAlakyrr.Y               = 20147;
                GuardAlakyrr.Z               = 16760;
                GuardAlakyrr.Heading         = 4016;
                GuardAlakyrr.RespawnInterval = -1;
                GuardAlakyrr.BodyType        = 0;


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

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

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

            #endregion

            #region defineItems

            enchantedtenebrousflask = GameServer.Database.FindObjectByKey <ItemTemplate>("enchantedtenebrousflask");
            if (enchantedtenebrousflask == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Enchanted Tenebrous Flask, creating it ...");
                }
                enchantedtenebrousflask               = new ItemTemplate();
                enchantedtenebrousflask.Name          = "enchanted tenebrous flask";
                enchantedtenebrousflask.Level         = 1;
                enchantedtenebrousflask.Weight        = 10;
                enchantedtenebrousflask.Model         = 1610;
                enchantedtenebrousflask.Object_Type   = (int)eObjectType.GenericItem;
                enchantedtenebrousflask.Id_nb         = "enchantedtenebrousflask";
                enchantedtenebrousflask.Price         = 0;
                enchantedtenebrousflask.IsPickable    = false;
                enchantedtenebrousflask.IsDropable    = false;
                enchantedtenebrousflask.Quality       = 100;
                enchantedtenebrousflask.Condition     = 1000;
                enchantedtenebrousflask.MaxCondition  = 1000;
                enchantedtenebrousflask.Durability    = 1000;
                enchantedtenebrousflask.MaxDurability = 1000;

                GameServer.Database.AddObject(enchantedtenebrousflask);
            }
            quarterfulltenebrousflask = GameServer.Database.FindObjectByKey <ItemTemplate>("quarterfulltenebrousflask");
            if (quarterfulltenebrousflask == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Quarter Full Tenebrous Flask, creating it ...");
                }
                quarterfulltenebrousflask               = new ItemTemplate();
                quarterfulltenebrousflask.Name          = "quarter full tenebrous flask";
                quarterfulltenebrousflask.Level         = 1;
                quarterfulltenebrousflask.Weight        = 250;
                quarterfulltenebrousflask.Model         = 1610;
                quarterfulltenebrousflask.Object_Type   = (int)eObjectType.GenericItem;
                quarterfulltenebrousflask.Id_nb         = "quarterfulltenebrousflask";
                quarterfulltenebrousflask.Price         = 0;
                quarterfulltenebrousflask.IsPickable    = false;
                quarterfulltenebrousflask.IsDropable    = false;
                quarterfulltenebrousflask.Quality       = 100;
                quarterfulltenebrousflask.Condition     = 1000;
                quarterfulltenebrousflask.MaxCondition  = 1000;
                quarterfulltenebrousflask.Durability    = 1000;
                quarterfulltenebrousflask.MaxDurability = 1000;

                GameServer.Database.AddObject(quarterfulltenebrousflask);
            }
            halffulltenebrousflask = GameServer.Database.FindObjectByKey <ItemTemplate>("halffulltenebrousflask");
            if (halffulltenebrousflask == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Half Full Tenebrous Flask, creating it ...");
                }
                halffulltenebrousflask               = new ItemTemplate();
                halffulltenebrousflask.Name          = "half full tenebrous flask";
                halffulltenebrousflask.Level         = 1;
                halffulltenebrousflask.Weight        = 250;
                halffulltenebrousflask.Model         = 1610;
                halffulltenebrousflask.Object_Type   = (int)eObjectType.GenericItem;
                halffulltenebrousflask.Id_nb         = "halffulltenebrousflask";
                halffulltenebrousflask.Price         = 0;
                halffulltenebrousflask.IsPickable    = false;
                halffulltenebrousflask.IsDropable    = false;
                halffulltenebrousflask.Quality       = 100;
                halffulltenebrousflask.Condition     = 1000;
                halffulltenebrousflask.MaxCondition  = 1000;
                halffulltenebrousflask.Durability    = 1000;
                halffulltenebrousflask.MaxDurability = 1000;

                GameServer.Database.AddObject(halffulltenebrousflask);
            }
            threequarterfulltenebrousflask = GameServer.Database.FindObjectByKey <ItemTemplate>("threequarterfulltenebrousflask");
            if (threequarterfulltenebrousflask == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Three Quarter Full Tenebrous Flask, creating it ...");
                }
                threequarterfulltenebrousflask               = new ItemTemplate();
                threequarterfulltenebrousflask.Name          = "three quarter full tenebrous flask";
                threequarterfulltenebrousflask.Level         = 1;
                threequarterfulltenebrousflask.Weight        = 250;
                threequarterfulltenebrousflask.Model         = 1610;
                threequarterfulltenebrousflask.Object_Type   = (int)eObjectType.GenericItem;
                threequarterfulltenebrousflask.Id_nb         = "threequarterfulltenebrousflask";
                threequarterfulltenebrousflask.Price         = 0;
                threequarterfulltenebrousflask.IsPickable    = false;
                threequarterfulltenebrousflask.IsDropable    = false;
                threequarterfulltenebrousflask.Quality       = 100;
                threequarterfulltenebrousflask.Condition     = 1000;
                threequarterfulltenebrousflask.MaxCondition  = 1000;
                threequarterfulltenebrousflask.Durability    = 1000;
                threequarterfulltenebrousflask.MaxDurability = 1000;

                GameServer.Database.AddObject(threequarterfulltenebrousflask);
            }
            fullflaskoftenebrousessence = GameServer.Database.FindObjectByKey <ItemTemplate>("fullflaskoftenebrousessence");
            if (fullflaskoftenebrousessence == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Full Flask Of Tenebrous Essence, creating it ...");
                }
                fullflaskoftenebrousessence               = new ItemTemplate();
                fullflaskoftenebrousessence.Name          = "full flask of tenebrous essence";
                fullflaskoftenebrousessence.Level         = 1;
                fullflaskoftenebrousessence.Weight        = 250;
                fullflaskoftenebrousessence.Model         = 1610;
                fullflaskoftenebrousessence.Object_Type   = (int)eObjectType.GenericItem;
                fullflaskoftenebrousessence.Id_nb         = "fullflaskoftenebrousessence";
                fullflaskoftenebrousessence.Price         = 0;
                fullflaskoftenebrousessence.IsPickable    = false;
                fullflaskoftenebrousessence.IsDropable    = false;
                fullflaskoftenebrousessence.Quality       = 100;
                fullflaskoftenebrousessence.Condition     = 1000;
                fullflaskoftenebrousessence.MaxCondition  = 1000;
                fullflaskoftenebrousessence.Durability    = 1000;
                fullflaskoftenebrousessence.MaxDurability = 1000;

                GameServer.Database.AddObject(fullflaskoftenebrousessence);
            }

            #endregion

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

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

            GameEventMgr.AddHandler(GuardAlakyrr, GameLivingEvent.Interact, new DOLEventHandler(TalkToGuardAlakyrr));
            GameEventMgr.AddHandler(GuardAlakyrr, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToGuardAlakyrr));

            GuardAlakyrr.AddQuestToGive(typeof(AidingGuardAlakyrr));

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

            #region defineNPCs

            generalLocations[0] = new GameLocation(generalNames[0], 100, 100, 40124, 44594, 4712, 216);
            generalLocations[1] = new GameLocation(generalNames[1], 100, 100, 46821, 40884, 4972, 21);
            generalLocations[2] = new GameLocation(generalNames[2], 100, 100, 56104, 43865, 5460, 48);

            GameNPC[] npcs = null;
            for (int i = 0; i < general.Length; i++)
            {
                npcs = WorldMgr.GetNPCsByName(generalNames[i], eRealm.None);
                if (npcs.Length > 0)
                {
                    general[i] = npcs[0] as GameNPC;
                }
                else
                {
                    if (log.IsWarnEnabled)
                    {
                        log.Warn("Could not find " + generalNames[i] + ", creating ...");
                    }
                    general[i] = new GameNPC();

                    general[i].Model = 678;

                    general[i].GuildName = "Part of " + questTitle + " Quest";
                    general[i].Name      = generalNames[i];
                    general[i].Position  = generalLocations[i].Position;
                    general[i].Heading   = generalLocations[i].Heading;

                    general[i].Realm           = eRealm.None;
                    general[i].CurrentRegionID = generalLocations[i].RegionID;
                    general[i].Size            = 49;
                    general[i].Level           = 2;

                    StandardMobBrain brain = new StandardMobBrain();
                    brain.AggroLevel = 80;
                    brain.AggroRange = 1000;
                    general[i].SetOwnBrain(brain);

                    if (SAVE_INTO_DATABASE)
                    {
                        general[i].SaveIntoDatabase();
                    }

                    general[i].AddToWorld();
                }
            }

            #endregion

            #region defineItems

            /*
             * TODO Model for Campfire doesn't work. Very Stange!
             */
            /*
             * // Add campfires to generals
             * for (int i = 0; i < generalLocations.Length; i++)
             * {
             *      GameStaticItem campfire = null;
             *
             *      IEnumerable items =  WorldMgr.GetItemsCloseToSpot(generalLocations[i].RegionID,generalLocations[i].X, generalLocations[i].Y, generalLocations[i].Z, 400,true);
             *      foreach (GameObject obj in items)
             *      {
             *              if (obj is GameStaticItem && obj.Name=="Camp Fire")
             *              {
             *                      campfire= (GameStaticItem) obj;
             *                      break;
             *              }
             *      }
             *
             *      if (campfire==null)
             *      {
             *              campfire = new GameStaticItem();
             *              campfire.Name="Camp Fire";
             *
             *              campfire.Model = 2593;
             *              campfire.Heading = generalLocations[i].Heading;
             *              campfire.X = generalLocations[i].X;
             *              campfire.Y = generalLocations[i].Y;
             *              campfire.Z = generalLocations[i].Z;
             *              campfire.CurrentRegionID = generalLocations[i].RegionID;
             *
             *              if (SAVE_INTO_DATABASE)
             *                      campfire.SaveIntoDatabase();
             *
             *              campfire.AddToWorld();
             *
             *              DOLConsole.WriteLine("Camp Fire added"+generalNames[i]);
             *      }
             * }
             */

            askefruerWings = GameServer.Database.FindObjectByKey <ItemTemplate>("askefruer_wings");
            if (askefruerWings == null)
            {
                askefruerWings      = new ItemTemplate();
                askefruerWings.Name = "Wings of Askefruer";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + askefruerWings.Name + " , creating it ...");
                }

                askefruerWings.Weight = 2;
                askefruerWings.Model  = 551;

                askefruerWings.Object_Type = (int)eObjectType.GenericItem;

                askefruerWings.Id_nb      = "askefruer_wings";
                askefruerWings.IsPickable = true;
                askefruerWings.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
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(askefruerWings);
                }
            }

            dustyOldMap = GameServer.Database.FindObjectByKey <ItemTemplate>("dusty_old_map");
            if (dustyOldMap == null)
            {
                dustyOldMap      = new ItemTemplate();
                dustyOldMap.Name = "Dusty Old Map";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + dustyOldMap.Name + " , creating it ...");
                }

                dustyOldMap.Weight = 10;
                dustyOldMap.Model  = 498;

                dustyOldMap.Object_Type = (int)eObjectType.GenericItem;

                dustyOldMap.Id_nb      = "dusty_old_map";
                dustyOldMap.IsPickable = true;
                dustyOldMap.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
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(dustyOldMap);
                }
            }


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

                recruitsArms.Weight = 36;
                recruitsArms.Model  = 83;                // studded Boots

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

                recruitsArms.Object_Type = (int)eObjectType.Studded;
                recruitsArms.Item_Type   = (int)eEquipmentItems.ARMS;
                recruitsArms.Id_nb       = "recruits_studded_arms_mid";
                recruitsArms.Price       = Money.GetMoney(0, 0, 0, 4, 0);
                recruitsArms.IsPickable  = true;
                recruitsArms.IsDropable  = true;
                recruitsArms.Color       = 36;          // blue cloth

                recruitsArms.Bonus = 5;                 // default bonus

                recruitsArms.Bonus1     = 4;
                recruitsArms.Bonus1Type = (int)eStat.QUI;

                recruitsArms.Bonus2     = 1;
                recruitsArms.Bonus2Type = (int)eResist.Body;

                recruitsArms.Quality       = 100;
                recruitsArms.Condition     = 1000;
                recruitsArms.MaxCondition  = 1000;
                recruitsArms.Durability    = 1000;
                recruitsArms.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
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(recruitsArms);
                }
            }

            recruitsSleeves = GameServer.Database.FindObjectByKey <ItemTemplate>("recruits_quilted_sleeves");
            if (recruitsSleeves == null)
            {
                recruitsSleeves      = new ItemTemplate();
                recruitsSleeves.Name = "Recruit's Quilted Sleeves";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + recruitsSleeves.Name + ", creating it ...");
                }
                recruitsSleeves.Level = 7;

                recruitsSleeves.Weight = 12;
                recruitsSleeves.Model  = 153;

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

                recruitsSleeves.Object_Type = (int)eObjectType.Cloth;
                recruitsSleeves.Item_Type   = (int)eEquipmentItems.ARMS;
                recruitsSleeves.Id_nb       = "recruits_quilted_sleeves";
                recruitsSleeves.Price       = Money.GetMoney(0, 0, 0, 4, 0);
                recruitsSleeves.IsPickable  = true;
                recruitsSleeves.IsDropable  = true;
                recruitsSleeves.Color       = 27;          // red cloth

                recruitsSleeves.Bonus = 5;                 // default bonus

                recruitsSleeves.Bonus1     = 4;
                recruitsSleeves.Bonus1Type = (int)eStat.DEX;

                recruitsSleeves.Bonus2     = 1;
                recruitsSleeves.Bonus2Type = (int)eResist.Body;

                recruitsSleeves.Quality       = 100;
                recruitsSleeves.Condition     = 1000;
                recruitsSleeves.MaxCondition  = 1000;
                recruitsSleeves.Durability    = 1000;
                recruitsSleeves.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
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(recruitsSleeves);
                }
            }

            #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.GameEntered, new DOLEventHandler(PlayerEnterWorld));

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

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

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

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

            GameNPC[] npcs;

            npcs = WorldMgr.GetObjectsByName <GameNPC>("Aegan", (eRealm)2);
            if (npcs.Length == 0)
            {
                Aegan       = new DOL.GS.GameNPC();
                Aegan.Model = 232;
                Aegan.Name  = "Aegan";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + Aegan.Name + ", creating ...");
                }

                Aegan.GuildName       = "Part of " + questTitle + " Quest";
                Aegan.Realm           = eRealm.Midgard;
                Aegan.CurrentRegionID = 100;
                Aegan.Size            = 51;
                Aegan.Level           = 41;
                Aegan.MaxSpeedBase    = 191;
                Aegan.Faction         = FactionMgr.GetFactionByID(0);
                Aegan.X               = 805398;
                Aegan.Y               = 725829;
                Aegan.Z               = 4700;
                Aegan.Heading         = 3595;
                Aegan.RespawnInterval = -1;
                Aegan.BodyType        = 0;

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

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

            clawofblackmauler = GameServer.Database.FindObjectByKey <ItemTemplate>("clawofblackmauler");
            if (clawofblackmauler == null)
            {
                clawofblackmauler      = new ItemTemplate();
                clawofblackmauler.Name = "Claw of Black Mauler";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + clawofblackmauler.Name + ", creating it ...");
                }

                clawofblackmauler.Level            = 50;
                clawofblackmauler.Weight           = 5;
                clawofblackmauler.Model            = 1;
                clawofblackmauler.Object_Type      = 0;
                clawofblackmauler.Item_Type        = 40;
                clawofblackmauler.Id_nb            = "clawofblackmauler";
                clawofblackmauler.Hand             = 0;
                clawofblackmauler.Price            = 0;
                clawofblackmauler.IsPickable       = true;
                clawofblackmauler.IsDropable       = true;
                clawofblackmauler.IsTradable       = true;
                clawofblackmauler.CanDropAsLoot    = false;
                clawofblackmauler.Color            = 0;
                clawofblackmauler.Bonus            = 35; // default bonus
                clawofblackmauler.Bonus1           = 0;
                clawofblackmauler.Bonus1Type       = (int)0;
                clawofblackmauler.Bonus2           = 0;
                clawofblackmauler.Bonus2Type       = (int)0;
                clawofblackmauler.Bonus3           = 0;
                clawofblackmauler.Bonus3Type       = (int)0;
                clawofblackmauler.Bonus4           = 0;
                clawofblackmauler.Bonus4Type       = (int)0;
                clawofblackmauler.Bonus5           = 0;
                clawofblackmauler.Bonus5Type       = (int)0;
                clawofblackmauler.Bonus6           = 0;
                clawofblackmauler.Bonus6Type       = (int)0;
                clawofblackmauler.Bonus7           = 0;
                clawofblackmauler.Bonus7Type       = (int)0;
                clawofblackmauler.Bonus8           = 0;
                clawofblackmauler.Bonus8Type       = (int)0;
                clawofblackmauler.Bonus9           = 0;
                clawofblackmauler.Bonus9Type       = (int)0;
                clawofblackmauler.Bonus10          = 0;
                clawofblackmauler.Bonus10Type      = (int)0;
                clawofblackmauler.ExtraBonus       = 0;
                clawofblackmauler.ExtraBonusType   = (int)0;
                clawofblackmauler.Effect           = 0;
                clawofblackmauler.Emblem           = 0;
                clawofblackmauler.Charges          = 0;
                clawofblackmauler.MaxCharges       = 0;
                clawofblackmauler.SpellID          = 0;
                clawofblackmauler.ProcSpellID      = 0;
                clawofblackmauler.Type_Damage      = 0;
                clawofblackmauler.Realm            = 0;
                clawofblackmauler.MaxCount         = 1;
                clawofblackmauler.PackSize         = 1;
                clawofblackmauler.Extension        = 0;
                clawofblackmauler.Quality          = 99;
                clawofblackmauler.Condition        = 100;
                clawofblackmauler.MaxCondition     = 100;
                clawofblackmauler.Durability       = 100;
                clawofblackmauler.MaxDurability    = 100;
                clawofblackmauler.PoisonCharges    = 0;
                clawofblackmauler.PoisonMaxCharges = 0;
                clawofblackmauler.PoisonSpellID    = 0;
                clawofblackmauler.ProcSpellID1     = 0;
                clawofblackmauler.SpellID1         = 0;
                clawofblackmauler.MaxCharges1      = 0;
                clawofblackmauler.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(clawofblackmauler);
                }
            }

            QuestBuilder   builder = QuestMgr.GetBuilder(typeof(Learnthehunt));
            QuestBehaviour a;

            a = builder.CreateBehaviour(Aegan, -1);
            a.AddTrigger(eTriggerType.Interact, null, Aegan);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.Learnthehunt), Aegan);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.Learnthehunt), null, (eComparator)5);
            a.AddAction(eActionType.Talk, "Greetings, are you [worthy of the hunt]?", Aegan);
            AddBehaviour(a);
            a = builder.CreateBehaviour(Aegan, -1);
            a.AddTrigger(eTriggerType.Whisper, "worthy of the hunt", Aegan);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.Learnthehunt), Aegan);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.Learnthehunt), null, (eComparator)5);
            a.AddAction(eActionType.Talk, "Oh ho! Another bright young come to help Midgard fend off her enemies, eh? Wonderful, that's what I say! Wonderful! With the rise of the Albion and Hibernia armies,Midgard will need all the she can get!", Aegan);
            a.AddAction(eActionType.Talk, "I have spent a great deal of my life hunting the [maulers] of this region", Aegan);
            AddBehaviour(a);
            a = builder.CreateBehaviour(Aegan, -1);
            a.AddTrigger(eTriggerType.Whisper, "maulers", Aegan);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.Learnthehunt), Aegan);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.Learnthehunt), null, (eComparator)5);
            a.AddAction(eActionType.Talk, "Bring me the claws of a mauler cub and I shall reward you", Aegan);
            a.AddAction(eActionType.OfferQuest, typeof(DOL.GS.Quests.Midgard.Learnthehunt), "Accept Learn the Hunt quest?");
            AddBehaviour(a);
            a = builder.CreateBehaviour(Aegan, -1);
            a.AddTrigger(eTriggerType.DeclineQuest, null, typeof(DOL.GS.Quests.Midgard.Learnthehunt));
            a.AddAction(eActionType.Talk, "No problem. See you.", Aegan);
            AddBehaviour(a);
            a = builder.CreateBehaviour(Aegan, -1);
            a.AddTrigger(eTriggerType.AcceptQuest, null, typeof(DOL.GS.Quests.Midgard.Learnthehunt));
            a.AddAction(eActionType.GiveQuest, typeof(DOL.GS.Quests.Midgard.Learnthehunt), Aegan);
            a.AddAction(eActionType.SetQuestStep, typeof(DOL.GS.Quests.Midgard.Learnthehunt), 2);
            AddBehaviour(a);
            a = builder.CreateBehaviour(Aegan, -1);
            a.AddTrigger(eTriggerType.EnemyKilled, "black mauler cub", null);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.Learnthehunt), 1, (eComparator)2);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.Learnthehunt), 7, (eComparator)1);
            a.AddAction(eActionType.GiveItem, clawofblackmauler, null);
            a.AddAction(eActionType.IncQuestStep, typeof(DOL.GS.Quests.Midgard.Learnthehunt), null);
            AddBehaviour(a);
            a = builder.CreateBehaviour(Aegan, -1);
            a.AddTrigger(eTriggerType.Interact, null, Aegan);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.Learnthehunt), 7, (eComparator)3);
            a.AddAction(eActionType.Talk, "You are doing well! Continue to pass me the bear claws!", Aegan);
            a.AddAction(eActionType.Talk, "You have proven yourself well youngster! I hope the coin serves you well.", Aegan);
            a.AddAction(eActionType.GiveXP, 20, null);
            a.AddAction(eActionType.GiveGold, 100, null);
            a.AddAction(eActionType.FinishQuest, typeof(DOL.GS.Quests.Midgard.Learnthehunt), null);
            a.AddAction(eActionType.TakeItem, clawofblackmauler, 5);
            AddBehaviour(a);

            // Custom Scriptloaded Code Begin

            // Custom Scriptloaded Code End
            Aegan.AddQuestToGive(typeof(Learnthehunt));
            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Example #21
0
        public void SetVariables(GameNPC mob)
        {
            mob.X               = this.X + 10;
            mob.Y               = this.Y + 10;
            mob.Z               = this.Z;
            mob.CurrentRegion   = this.CurrentRegion;
            mob.Heading         = this.Heading;
            mob.Level           = this.Level;
            mob.Realm           = this.Realm;
            mob.Name            = "Dork's Minion";
            mob.Model           = this.Model;
            mob.Flags           = this.Flags;
            mob.MeleeDamageType = this.MeleeDamageType;
            mob.RespawnInterval = -1; // dont respawn
            mob.RoamingRange    = this.RoamingRange;
            mob.MaxDistance     = 4000;

            // also copies the stats

            mob.Strength     = this.Strength;
            mob.Constitution = this.Constitution;
            mob.Dexterity    = this.Dexterity;
            mob.Quickness    = this.Quickness;
            mob.Intelligence = this.Intelligence;
            mob.Empathy      = this.Empathy;
            mob.Piety        = this.Piety;
            mob.Charisma     = this.Charisma;

            //Fill the living variables
            mob.CurrentSpeed = 0;

            mob.MaxSpeedBase        = this.MaxSpeedBase;
            mob.Size                = this.Size;
            mob.NPCTemplate         = this.NPCTemplate;
            mob.Inventory           = this.Inventory;
            mob.EquipmentTemplateID = this.EquipmentTemplateID;
            if (mob.Inventory != null)
            {
                mob.SwitchWeapon(this.ActiveWeaponSlot);
            }

            ABrain brain = null;

            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                brain = (ABrain)assembly.CreateInstance(this.Brain.GetType().FullName, true);
                if (brain != null)
                {
                    break;
                }
            }

            if (brain == null)
            {
                mob.SetOwnBrain(new StandardMobBrain());
            }
            else if (brain is StandardMobBrain)
            {
                StandardMobBrain sbrain  = (StandardMobBrain)brain;
                StandardMobBrain tsbrain = (StandardMobBrain)this.Brain;
                sbrain.AggroLevel = tsbrain.AggroLevel;
                sbrain.AggroRange = tsbrain.AggroRange;
                mob.SetOwnBrain(sbrain);
            }
        }
Example #22
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();

            generalLocations[0] = new GameLocation(generalNames[0], 1, 568589, 501801, 2134, 23);
            generalLocations[1] = new GameLocation(generalNames[1], 1, 572320, 499246, 2472, 14);
            generalLocations[2] = new GameLocation(generalNames[2], 1, 571900, 510559, 2210, 170);

            GameNPC[] npcs = null;
            for (int i = 0; i < general.Length; i++)
            {
                npcs = WorldMgr.GetObjectsByName <GameNPC>(generalNames[i], eRealm.None);
                if (npcs.Length > 0)
                {
                    general[i] = npcs[0] as GameNPC;
                }
                else
                {
                    if (log.IsWarnEnabled)
                    {
                        log.Warn("Could not find " + generalNames[i] + ", creating her ...");
                    }

                    general[i] = new GameNPC();

                    general[i].Model = 603;

                    general[i].Name    = generalNames[i];
                    general[i].X       = generalLocations[i].X;
                    general[i].Y       = generalLocations[i].Y;
                    general[i].Z       = generalLocations[i].Z;
                    general[i].Heading = generalLocations[i].Heading;

                    general[i].GuildName       = "Part of " + questTitle + " Quest";
                    general[i].Realm           = eRealm.None;
                    general[i].CurrentRegionID = generalLocations[i].RegionID;

                    general[i].Size     = 49;
                    general[i].Level    = 2;
                    general[i].Race     = 2007;
                    general[i].BodyType = 8;

                    StandardMobBrain brain = new StandardMobBrain();
                    brain.AggroLevel = 80;
                    brain.AggroRange = 1000;
                    general[i].SetOwnBrain(brain);

                    if (SAVE_INTO_DATABASE)
                    {
                        general[i].SaveIntoDatabase();
                    }

                    general[i].AddToWorld();
                }
            }

            fairyGeneralWings = GameServer.Database.FindObjectByKey <ItemTemplate>("fairy_general_wings");
            if (fairyGeneralWings == null)
            {
                fairyGeneralWings      = new ItemTemplate();
                fairyGeneralWings.Name = "Wings of Fairy General";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + fairyGeneralWings.Name + " , creating it ...");
                }

                fairyGeneralWings.Weight = 2;
                fairyGeneralWings.Model  = 551;

                fairyGeneralWings.Object_Type = (int)eObjectType.GenericItem;

                fairyGeneralWings.Id_nb      = "fairy_general_wings";
                fairyGeneralWings.IsPickable = true;
                fairyGeneralWings.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(fairyGeneralWings);
            }

            dustyOldMap = GameServer.Database.FindObjectByKey <ItemTemplate>("dusty_old_map");
            if (dustyOldMap == null)
            {
                dustyOldMap      = new ItemTemplate();
                dustyOldMap.Name = "Dusty Old Map";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + dustyOldMap.Name + " , creating it ...");
                }

                dustyOldMap.Weight = 10;
                dustyOldMap.Model  = 498;

                dustyOldMap.Object_Type = (int)eObjectType.GenericItem;

                dustyOldMap.Id_nb      = "dusty_old_map";
                dustyOldMap.IsPickable = true;
                dustyOldMap.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(dustyOldMap);
            }

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

                recruitsArms.Level = 7;

                recruitsArms.Weight = 36;
                recruitsArms.Model  = 83;  // studded Boots

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

                recruitsArms.Object_Type = (int)eObjectType.Studded;
                recruitsArms.Item_Type   = (int)eEquipmentItems.ARMS;
                recruitsArms.Id_nb       = "recruits_studded_arms";
                recruitsArms.Price       = Money.GetMoney(0, 0, 0, 4, 0);
                recruitsArms.IsPickable  = true;
                recruitsArms.IsDropable  = true;
                recruitsArms.Color       = 9; // red leather

                recruitsArms.Bonus = 5;       // default bonus

                recruitsArms.Bonus1     = 4;
                recruitsArms.Bonus1Type = (int)eStat.QUI;

                recruitsArms.Bonus2     = 1;
                recruitsArms.Bonus2Type = (int)eResist.Body;

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

            recruitsSleeves = GameServer.Database.FindObjectByKey <ItemTemplate>("recruits_quilted_sleeves");
            if (recruitsSleeves == null)
            {
                recruitsSleeves      = new ItemTemplate();
                recruitsSleeves.Name = "Recruit's Quilted Sleeves";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + recruitsSleeves.Name + ", creating it ...");
                }

                recruitsSleeves.Level = 7;

                recruitsSleeves.Weight = 12;
                recruitsSleeves.Model  = 153;

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

                recruitsSleeves.Object_Type = (int)eObjectType.Cloth;
                recruitsSleeves.Item_Type   = (int)eEquipmentItems.ARMS;
                recruitsSleeves.Id_nb       = "recruits_quilted_sleeves";
                recruitsSleeves.Price       = Money.GetMoney(0, 0, 0, 4, 0);
                recruitsSleeves.IsPickable  = true;
                recruitsSleeves.IsDropable  = true;
                recruitsSleeves.Color       = 27; // red cloth

                recruitsSleeves.Bonus = 5;        // default bonus

                recruitsSleeves.Bonus1     = 4;
                recruitsSleeves.Bonus1Type = (int)eStat.DEX;

                recruitsSleeves.Bonus2     = 1;
                recruitsSleeves.Bonus2Type = (int)eResist.Body;

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

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

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

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

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

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

            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;

            npcs = WorldMgr.GetObjectsByName <GameNPC>(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.ABearyBadProblem.NPCKreimhilde"), (eRealm)2);
            if (npcs.Length == 0)
            {
                VikingKreimhilde       = new DOL.GS.GameNPC();
                VikingKreimhilde.Model = 218;
                VikingKreimhilde.Name  = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.ABearyBadProblem.NPCKreimhilde");
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + VikingKreimhilde.Name + ", creating ...");
                }

                VikingKreimhilde.GuildName       = "Part of " + questTitle + " Quest";
                VikingKreimhilde.Realm           = eRealm.Midgard;
                VikingKreimhilde.CurrentRegionID = 100;
                VikingKreimhilde.Size            = 51;
                VikingKreimhilde.Level           = 50;
                VikingKreimhilde.MaxSpeedBase    = 191;
                VikingKreimhilde.Faction         = FactionMgr.GetFactionByID(0);
                VikingKreimhilde.X               = 803999;
                VikingKreimhilde.Y               = 726551;
                VikingKreimhilde.Z               = 4752;
                VikingKreimhilde.Heading         = 2116;
                VikingKreimhilde.RespawnInterval = -1;
                VikingKreimhilde.BodyType        = 0;

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

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

            silverringofhealth = GameServer.Database.FindObjectByKey <ItemTemplate>("silverringofhealth");
            if (silverringofhealth == null)
            {
                silverringofhealth      = new ItemTemplate();
                silverringofhealth.Name = "Silver Ring of Health";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + silverringofhealth.Name + ", creating it ...");
                }

                silverringofhealth.Level            = 5;
                silverringofhealth.Weight           = 5;
                silverringofhealth.Model            = 103;
                silverringofhealth.Object_Type      = 0;
                silverringofhealth.Item_Type        = 35;
                silverringofhealth.Id_nb            = "silverringofhealth";
                silverringofhealth.Hand             = 0;
                silverringofhealth.Price            = 0;
                silverringofhealth.IsPickable       = true;
                silverringofhealth.IsDropable       = true;
                silverringofhealth.IsTradable       = false;
                silverringofhealth.CanDropAsLoot    = false;
                silverringofhealth.Color            = 0;
                silverringofhealth.Bonus            = 5; // default bonus
                silverringofhealth.Bonus1           = 12;
                silverringofhealth.Bonus1Type       = (int)10;
                silverringofhealth.Bonus2           = 0;
                silverringofhealth.Bonus2Type       = (int)0;
                silverringofhealth.Bonus3           = 0;
                silverringofhealth.Bonus3Type       = (int)0;
                silverringofhealth.Bonus4           = 0;
                silverringofhealth.Bonus4Type       = (int)0;
                silverringofhealth.Bonus5           = 0;
                silverringofhealth.Bonus5Type       = (int)0;
                silverringofhealth.Bonus6           = 0;
                silverringofhealth.Bonus6Type       = (int)0;
                silverringofhealth.Bonus7           = 0;
                silverringofhealth.Bonus7Type       = (int)0;
                silverringofhealth.Bonus8           = 0;
                silverringofhealth.Bonus8Type       = (int)0;
                silverringofhealth.Bonus9           = 0;
                silverringofhealth.Bonus9Type       = (int)0;
                silverringofhealth.Bonus10          = 0;
                silverringofhealth.Bonus10Type      = (int)0;
                silverringofhealth.ExtraBonus       = 0;
                silverringofhealth.ExtraBonusType   = (int)0;
                silverringofhealth.Effect           = 0;
                silverringofhealth.Emblem           = 0;
                silverringofhealth.Charges          = 0;
                silverringofhealth.MaxCharges       = 0;
                silverringofhealth.SpellID          = 0;
                silverringofhealth.ProcSpellID      = 0;
                silverringofhealth.Type_Damage      = 0;
                silverringofhealth.Realm            = 0;
                silverringofhealth.MaxCount         = 1;
                silverringofhealth.PackSize         = 1;
                silverringofhealth.Extension        = 0;
                silverringofhealth.Quality          = 100;
                silverringofhealth.Condition        = 100;
                silverringofhealth.MaxCondition     = 100;
                silverringofhealth.Durability       = 100;
                silverringofhealth.MaxDurability    = 100;
                silverringofhealth.PoisonCharges    = 0;
                silverringofhealth.PoisonMaxCharges = 0;
                silverringofhealth.PoisonSpellID    = 0;
                silverringofhealth.ProcSpellID1     = 0;
                silverringofhealth.SpellID1         = 0;
                silverringofhealth.MaxCharges1      = 0;
                silverringofhealth.Charges1         = 0;

                GameServer.Database.AddObject(silverringofhealth);
            }

            blackmaulercubpelt = GameServer.Database.FindObjectByKey <ItemTemplate>("blackmaulercubpelt");
            if (blackmaulercubpelt == null)
            {
                blackmaulercubpelt      = new ItemTemplate();
                blackmaulercubpelt.Name = "Black Mauler Cub Pelt";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + blackmaulercubpelt.Name + ", creating it ...");
                }

                blackmaulercubpelt.Level            = 1;
                blackmaulercubpelt.Weight           = 5;
                blackmaulercubpelt.Model            = 100;
                blackmaulercubpelt.Object_Type      = 0;
                blackmaulercubpelt.Item_Type        = 40;
                blackmaulercubpelt.Id_nb            = "blackmaulercubpelt";
                blackmaulercubpelt.Hand             = 0;
                blackmaulercubpelt.Price            = 0;
                blackmaulercubpelt.IsPickable       = true;
                blackmaulercubpelt.IsDropable       = true;
                blackmaulercubpelt.IsTradable       = true;
                blackmaulercubpelt.CanDropAsLoot    = false;
                blackmaulercubpelt.Color            = 0;
                blackmaulercubpelt.Bonus            = 35; // default bonus
                blackmaulercubpelt.Bonus1           = 0;
                blackmaulercubpelt.Bonus1Type       = (int)0;
                blackmaulercubpelt.Bonus2           = 0;
                blackmaulercubpelt.Bonus2Type       = (int)0;
                blackmaulercubpelt.Bonus3           = 0;
                blackmaulercubpelt.Bonus3Type       = (int)0;
                blackmaulercubpelt.Bonus4           = 0;
                blackmaulercubpelt.Bonus4Type       = (int)0;
                blackmaulercubpelt.Bonus5           = 0;
                blackmaulercubpelt.Bonus5Type       = (int)0;
                blackmaulercubpelt.Bonus6           = 0;
                blackmaulercubpelt.Bonus6Type       = (int)0;
                blackmaulercubpelt.Bonus7           = 0;
                blackmaulercubpelt.Bonus7Type       = (int)0;
                blackmaulercubpelt.Bonus8           = 0;
                blackmaulercubpelt.Bonus8Type       = (int)0;
                blackmaulercubpelt.Bonus9           = 0;
                blackmaulercubpelt.Bonus9Type       = (int)0;
                blackmaulercubpelt.Bonus10          = 0;
                blackmaulercubpelt.Bonus10Type      = (int)0;
                blackmaulercubpelt.ExtraBonus       = 0;
                blackmaulercubpelt.ExtraBonusType   = (int)0;
                blackmaulercubpelt.Effect           = 0;
                blackmaulercubpelt.Emblem           = 0;
                blackmaulercubpelt.Charges          = 0;
                blackmaulercubpelt.MaxCharges       = 0;
                blackmaulercubpelt.SpellID          = 0;
                blackmaulercubpelt.ProcSpellID      = 0;
                blackmaulercubpelt.Type_Damage      = 0;
                blackmaulercubpelt.Realm            = 0;
                blackmaulercubpelt.MaxCount         = 1;
                blackmaulercubpelt.PackSize         = 1;
                blackmaulercubpelt.Extension        = 0;
                blackmaulercubpelt.Quality          = 99;
                blackmaulercubpelt.Condition        = 100;
                blackmaulercubpelt.MaxCondition     = 100;
                blackmaulercubpelt.Durability       = 100;
                blackmaulercubpelt.MaxDurability    = 100;
                blackmaulercubpelt.PoisonCharges    = 0;
                blackmaulercubpelt.PoisonMaxCharges = 0;
                blackmaulercubpelt.PoisonSpellID    = 0;
                blackmaulercubpelt.ProcSpellID1     = 0;
                blackmaulercubpelt.SpellID1         = 0;
                blackmaulercubpelt.MaxCharges1      = 0;
                blackmaulercubpelt.Charges1         = 0;

                GameServer.Database.AddObject(blackmaulercubpelt);
            }

            QuestBuilder   builder = QuestMgr.GetBuilder(typeof(Abearybadproblem));
            QuestBehaviour a;

            a = builder.CreateBehaviour(VikingKreimhilde, -1);
            a.AddTrigger(eTriggerType.Interact, null, VikingKreimhilde);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.Abearybadproblem), VikingKreimhilde);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.Abearybadproblem), null, (eComparator)5);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.ABearyBadProblem.Talk1"), VikingKreimhilde);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.ABearyBadProblem.Talk2"), VikingKreimhilde);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.ABearyBadProblem.Talk3"), VikingKreimhilde);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.ABearyBadProblem.Talk4"), VikingKreimhilde);
            a.AddAction(eActionType.OfferQuest, typeof(DOL.GS.Quests.Midgard.Abearybadproblem), LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.ABearyBadProblem.OfferQuest"));
            AddBehaviour(a);
            a = builder.CreateBehaviour(VikingKreimhilde, -1);
            a.AddTrigger(eTriggerType.AcceptQuest, null, typeof(DOL.GS.Quests.Midgard.Abearybadproblem));
            a.AddAction(eActionType.GiveQuest, typeof(DOL.GS.Quests.Midgard.Abearybadproblem), VikingKreimhilde);
            a.AddAction(eActionType.SetQuestStep, typeof(DOL.GS.Quests.Midgard.Abearybadproblem), 1);
            AddBehaviour(a);
            a = builder.CreateBehaviour(VikingKreimhilde, -1);
            a.AddTrigger(eTriggerType.DeclineQuest, null, typeof(DOL.GS.Quests.Midgard.Abearybadproblem));
            AddBehaviour(a);
            a = builder.CreateBehaviour(VikingKreimhilde, -1);
            a.AddTrigger(eTriggerType.EnemyKilled, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.ABearyBadProblem.EnemyKilled"), null);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.Abearybadproblem), 1, (eComparator)3);
            a.AddAction(eActionType.GiveItem, blackmaulercubpelt, null);
            a.AddAction(eActionType.SetQuestStep, typeof(DOL.GS.Quests.Midgard.Abearybadproblem), 2);
            AddBehaviour(a);
            a = builder.CreateBehaviour(VikingKreimhilde, -1);
            a.AddTrigger(eTriggerType.Interact, null, VikingKreimhilde);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.Abearybadproblem), 2, (eComparator)3);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.ABearyBadProblem.GoodJob"), VikingKreimhilde);
            a.AddAction(eActionType.GiveXP, 22, null);
            a.AddAction(eActionType.GiveGold, 23, null);
            a.AddAction(eActionType.TakeItem, blackmaulercubpelt, null);
            a.AddAction(eActionType.GiveItem, silverringofhealth, VikingKreimhilde);
            a.AddAction(eActionType.FinishQuest, typeof(DOL.GS.Quests.Midgard.Abearybadproblem), null);
            AddBehaviour(a);

            // Custom Scriptloaded Code Begin

            // Custom Scriptloaded Code End
            VikingKreimhilde.AddQuestToGive(typeof(Abearybadproblem));
            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Example #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 ...");
            }

            #region defineNPCs
            GameNPC[] npcs;

            npcs = WorldMgr.GetNPCsByName("Mistress Laws", (eRealm)1);
            if (npcs.Length == 0)
            {
                if (!WorldMgr.GetRegion(51).IsDisabled)
                {
                    MistressLaws       = new DOL.GS.GameNPC();
                    MistressLaws.Model = 68;
                    MistressLaws.Name  = "Mistress Laws";
                    if (log.IsWarnEnabled)
                    {
                        log.Warn("Could not find " + MistressLaws.Name + ", creating ...");
                    }
                    MistressLaws.GuildName       = "Part of " + questTitle + " Quest";
                    MistressLaws.Realm           = eRealm.Albion;
                    MistressLaws.CurrentRegionID = 51;
                    MistressLaws.Size            = 52;
                    MistressLaws.Level           = 40;
                    MistressLaws.MaxSpeedBase    = 191;
                    MistressLaws.Faction         = FactionMgr.GetFactionByID(0);
                    MistressLaws.X               = 536859;
                    MistressLaws.Y               = 548403;
                    MistressLaws.Z               = 4800;
                    MistressLaws.Heading         = 1035;
                    MistressLaws.RespawnInterval = -1;
                    MistressLaws.BodyType        = 0;


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

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

            npcs = WorldMgr.GetNPCsByName("Ylaine Barrett", (eRealm)1);
            if (npcs.Length == 0)
            {
                if (!WorldMgr.GetRegion(51).IsDisabled)
                {
                    YlaineBarrett       = new DOL.GS.GameMerchant();
                    YlaineBarrett.Model = 87;
                    YlaineBarrett.Name  = "Ylaine Barrett";
                    if (log.IsWarnEnabled)
                    {
                        log.Warn("Could not find " + YlaineBarrett.Name + ", creating ...");
                    }
                    YlaineBarrett.GuildName       = "Part of " + questTitle + " Quest";
                    YlaineBarrett.Realm           = eRealm.Albion;
                    YlaineBarrett.CurrentRegionID = 51;
                    YlaineBarrett.Size            = 50;
                    YlaineBarrett.Level           = 40;
                    YlaineBarrett.MaxSpeedBase    = 191;
                    YlaineBarrett.Faction         = FactionMgr.GetFactionByID(0);
                    YlaineBarrett.X               = 522790;
                    YlaineBarrett.Y               = 542142;
                    YlaineBarrett.Z               = 3230;
                    YlaineBarrett.Heading         = 1661;
                    YlaineBarrett.RespawnInterval = -1;
                    YlaineBarrett.BodyType        = 0;


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

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


            #endregion

            #region defineItems

            slimyswampgooskin = GameServer.Database.FindObjectByKey <ItemTemplate>("slimyswampgooskin");
            if (slimyswampgooskin == null)
            {
                slimyswampgooskin      = new ItemTemplate();
                slimyswampgooskin.Name = "Slimy Swamp Goo Skin";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + slimyswampgooskin.Name + ", creating it ...");
                }
                slimyswampgooskin.Level            = 1;
                slimyswampgooskin.Weight           = 1;
                slimyswampgooskin.Model            = 100;
                slimyswampgooskin.Object_Type      = 0;
                slimyswampgooskin.Item_Type        = -1;
                slimyswampgooskin.Id_nb            = "slimyswampgooskin";
                slimyswampgooskin.Hand             = 0;
                slimyswampgooskin.Price            = 0;
                slimyswampgooskin.IsPickable       = true;
                slimyswampgooskin.IsDropable       = true;
                slimyswampgooskin.IsTradable       = true;
                slimyswampgooskin.CanDropAsLoot    = false;
                slimyswampgooskin.Color            = 0;
                slimyswampgooskin.Bonus            = 0;      // default bonus
                slimyswampgooskin.Bonus1           = 0;
                slimyswampgooskin.Bonus1Type       = (int)0;
                slimyswampgooskin.Bonus2           = 0;
                slimyswampgooskin.Bonus2Type       = (int)0;
                slimyswampgooskin.Bonus3           = 0;
                slimyswampgooskin.Bonus3Type       = (int)0;
                slimyswampgooskin.Bonus4           = 0;
                slimyswampgooskin.Bonus4Type       = (int)0;
                slimyswampgooskin.Bonus5           = 0;
                slimyswampgooskin.Bonus5Type       = (int)0;
                slimyswampgooskin.Bonus6           = 0;
                slimyswampgooskin.Bonus6Type       = (int)0;
                slimyswampgooskin.Bonus7           = 0;
                slimyswampgooskin.Bonus7Type       = (int)0;
                slimyswampgooskin.Bonus8           = 0;
                slimyswampgooskin.Bonus8Type       = (int)0;
                slimyswampgooskin.Bonus9           = 0;
                slimyswampgooskin.Bonus9Type       = (int)0;
                slimyswampgooskin.Bonus10          = 0;
                slimyswampgooskin.Bonus10Type      = (int)0;
                slimyswampgooskin.ExtraBonus       = 0;
                slimyswampgooskin.ExtraBonusType   = (int)0;
                slimyswampgooskin.Effect           = 0;
                slimyswampgooskin.Emblem           = 0;
                slimyswampgooskin.Charges          = 0;
                slimyswampgooskin.MaxCharges       = 0;
                slimyswampgooskin.SpellID          = 0;
                slimyswampgooskin.ProcSpellID      = 0;
                slimyswampgooskin.Type_Damage      = 0;
                slimyswampgooskin.Realm            = 0;
                slimyswampgooskin.MaxCount         = 1;
                slimyswampgooskin.PackSize         = 1;
                slimyswampgooskin.Extension        = 0;
                slimyswampgooskin.Quality          = 100;
                slimyswampgooskin.Condition        = 100;
                slimyswampgooskin.MaxCondition     = 100;
                slimyswampgooskin.Durability       = 100;
                slimyswampgooskin.MaxDurability    = 100;
                slimyswampgooskin.PoisonCharges    = 0;
                slimyswampgooskin.PoisonMaxCharges = 0;
                slimyswampgooskin.PoisonSpellID    = 0;
                slimyswampgooskin.ProcSpellID1     = 0;
                slimyswampgooskin.SpellID1         = 0;
                slimyswampgooskin.MaxCharges1      = 0;
                slimyswampgooskin.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

                GameServer.Database.AddObject(slimyswampgooskin);
            }


            #endregion

            #region defineAreas

            #endregion

            #region defineQuestParts

            QuestBuilder   builder = QuestMgr.getBuilder(typeof(Cellarinfestation));
            QuestBehaviour a;
            a = builder.CreateBehaviour(MistressLaws, -1);
            a.AddTrigger(eTriggerType.Interact, null, MistressLaws);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Albion.Cellarinfestation), MistressLaws);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Albion.Cellarinfestation), null, (eComparator)5);
            a.AddAction(eActionType.Talk, "You have barely begun training; yet already there is a need for you to lend your strength for the protection of this town. I know some of the locals are suspicious of the Inconnu, well, that is not to be helped. They are a mysterious people, and their sudden appearance one stormy night, well, that causes a large amount of [suspicion], as you can imagine, They are here to help us, I do believe that, and so must you. But some of the locals, they are not so sure.", MistressLaws);
            AddBehaviour(a);
            a = builder.CreateBehaviour(MistressLaws, -1);
            a.AddTrigger(eTriggerType.Whisper, "suspicion", MistressLaws);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Albion.Cellarinfestation), MistressLaws);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Albion.Cellarinfestation), null, (eComparator)5);
            a.AddAction(eActionType.Talk, "They have seen the Drakoran ruin their lands, they have witnessed Morgana's terrible magic first hand, so they cannot be expected to trust these new, powerful allies. I expect you to treat the Inconnu as allies, and to try and avoid the idle gossip of the local townsfolk. Saying that, I must send you to one of the loudest of the rabble. Ylaine Barrett. The food cellar has been swarming with swamp goo, and she wants someone to go out and clear the immediate area of swamp goo. Don't worry, I don't expect you to kill them all, just do what you can.", MistressLaws);
            a.AddAction(eActionType.OfferQuest, typeof(DOL.GS.Quests.Albion.Cellarinfestation), "Will you aid Ylaine Barrett in her attempt to rid the cellars of swamp goo?");
            AddBehaviour(a);
            a = builder.CreateBehaviour(MistressLaws, -1);
            a.AddTrigger(eTriggerType.DeclineQuest, null, typeof(DOL.GS.Quests.Albion.Cellarinfestation));
            a.AddAction(eActionType.Talk, "No problem. See you.", MistressLaws);
            AddBehaviour(a);
            a = builder.CreateBehaviour(MistressLaws, -1);
            a.AddTrigger(eTriggerType.AcceptQuest, null, typeof(DOL.GS.Quests.Albion.Cellarinfestation));
            a.AddAction(eActionType.Talk, "Right, I expected you would do so. Now, go talk to Ylaine Barrett.", MistressLaws);
            a.AddAction(eActionType.GiveQuest, typeof(DOL.GS.Quests.Albion.Cellarinfestation), MistressLaws);
            AddBehaviour(a);
            a = builder.CreateBehaviour(YlaineBarrett, -1);
            a.AddTrigger(eTriggerType.Interact, null, YlaineBarrett);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Albion.Cellarinfestation), 1, (eComparator)3);
            a.AddAction(eActionType.Talk, "Ah. G'day. And who might you be?", YlaineBarrett);
            a.AddAction(eActionType.Message, "Tell Ylaine Barrett your name.", (eTextType)2);
            a.AddAction(eActionType.Talk, "I see, you're a fighter. Has Mistress Laws, Master Reginald, or Delore sent you here to help me out? Why don't they just send you out after the goo? That's all I really want. You know, I don't remember that there were that many of these strange creatures crawling around the village [before].", YlaineBarrett);
            AddBehaviour(a);
            a = builder.CreateBehaviour(YlaineBarrett, -1);
            a.AddTrigger(eTriggerType.Whisper, "before", YlaineBarrett);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Albion.Cellarinfestation), 1, (eComparator)3);
            a.AddAction(eActionType.Talk, "Yes, well, before, well, before they came. Don't you remember? That night? All day long, everything's fine. Set itself uop for a fine next day, as well! The night, it was clear. Not a sign of a storm in sight! Why, no one prepared for it! Then, in the darkest part, suddenly, the storm starts! We were woken from the noise of it! It was awful, but we didn't dare go outside! Some of the men, they did, but they came back pale as a corpse! Were shaken to their core! And some of these being the fightin' men! Best of the town! Aye, but the [swamp goo].", YlaineBarrett);
            AddBehaviour(a);
            a = builder.CreateBehaviour(YlaineBarrett, -1);
            a.AddTrigger(eTriggerType.Whisper, "swamp goo", YlaineBarrett);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Albion.Cellarinfestation), 1, (eComparator)3);
            a.AddAction(eActionType.Talk, "They've gotten into the food cellar! The slimy things were creeping all over that place! I've gotten rid of most of the swamp goo, but I know there's more just outside town working their way to my food stores. I think you could do a small favor for us all and get rid of some. Oh and while you are at it, the skin of the swamp goo, I've some uses for it. I'll pay you for a swamp goo skin. Just go and get me one of their skins, and I'll be satisfied with ya.", YlaineBarrett);
            a.AddAction(eActionType.IncQuestStep, typeof(DOL.GS.Quests.Albion.Cellarinfestation), null);
            AddBehaviour(a);
            a = builder.CreateBehaviour(MistressLaws, -1);
            a.AddTrigger(eTriggerType.EnemyKilled, "swamp goo", null);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Albion.Cellarinfestation), 2, (eComparator)3);
            a.AddAction(eActionType.GiveItem, slimyswampgooskin, null);
            a.AddAction(eActionType.IncQuestStep, typeof(DOL.GS.Quests.Albion.Cellarinfestation), null);
            AddBehaviour(a);
            a = builder.CreateBehaviour(YlaineBarrett, -1);
            a.AddTrigger(eTriggerType.Interact, null, YlaineBarrett);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Albion.Cellarinfestation), 3, (eComparator)3);
            a.AddAction(eActionType.Talk, "Oh, you're back! Did you see how many there were? They are a nuisance, aren't they! Well, have you got me the skin?", YlaineBarrett);
            AddBehaviour(a);
            a = builder.CreateBehaviour(YlaineBarrett, -1);
            a.AddTrigger(eTriggerType.GiveItem, YlaineBarrett, slimyswampgooskin);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Albion.Cellarinfestation), 3, (eComparator)3);
            a.AddAction(eActionType.Talk, "Ah, a good and slimy one! It's odd, these creatures, they've got some strangeness about them, but they've got their uses, as well. Thank you, then. Here, I promised I'd pay ya, and I will!", YlaineBarrett);
            a.AddAction(eActionType.GiveGold, 330, null);
            a.AddAction(eActionType.GiveXP, 11, null);
            a.AddAction(eActionType.FinishQuest, typeof(DOL.GS.Quests.Albion.Cellarinfestation), null);
            AddBehaviour(a);

            #endregion

            // Custom Scriptloaded Code Begin

            // Custom Scriptloaded Code End
            if (MistressLaws != null)
            {
                MistressLaws.AddQuestToGive(typeof(Cellarinfestation));
            }
            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Example #25
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");
            }
        }
        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;

            npcs = WorldMgr.GetObjectsByName <GameNPC>(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.NPCBarkeepNognar"), (eRealm)2);

            if (npcs.Length == 0)
            {
                if (!WorldMgr.GetRegion(100).IsDisabled)
                {
                    BarkeepNognar       = new DOL.GS.GameMerchant();
                    BarkeepNognar.Model = 212;
                    BarkeepNognar.Name  = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.NPCBarkeepNognar");
                    if (log.IsWarnEnabled)
                    {
                        log.Warn("Could not find " + BarkeepNognar.Name + ", creating ...");
                    }

                    BarkeepNognar.GuildName       = "Part of " + questTitle + " Quest";
                    BarkeepNognar.Realm           = eRealm.Midgard;
                    BarkeepNognar.CurrentRegionID = 100;
                    BarkeepNognar.Size            = 58;
                    BarkeepNognar.Level           = 15;
                    BarkeepNognar.MaxSpeedBase    = 191;
                    BarkeepNognar.Faction         = FactionMgr.GetFactionByID(0);
                    BarkeepNognar.X               = 805429;
                    BarkeepNognar.Y               = 726478;
                    BarkeepNognar.Z               = 4717;
                    BarkeepNognar.Heading         = 4073;
                    BarkeepNognar.RespawnInterval = -1;
                    BarkeepNognar.BodyType        = 0;

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

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

            npcs = WorldMgr.GetObjectsByName <GameNPC>(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.NPCBarkeepPrugar"), (eRealm)2);

            if (npcs.Length == 0)
            {
                if (!WorldMgr.GetRegion(101).IsDisabled)
                {
                    BarkeepPrugar       = new DOL.GS.GameMerchant();
                    BarkeepPrugar.Model = 213;
                    BarkeepPrugar.Name  = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.NPCBarkeepPrugar");
                    if (log.IsWarnEnabled)
                    {
                        log.Warn("Could not find " + BarkeepPrugar.Name + ", creating ...");
                    }

                    BarkeepPrugar.GuildName       = "Part of " + questTitle + " Quest";
                    BarkeepPrugar.Realm           = eRealm.Midgard;
                    BarkeepPrugar.CurrentRegionID = 101;
                    BarkeepPrugar.Size            = 60;
                    BarkeepPrugar.Level           = 15;
                    BarkeepPrugar.MaxSpeedBase    = 191;
                    BarkeepPrugar.Faction         = FactionMgr.GetFactionByID(0);
                    BarkeepPrugar.X               = 33230;
                    BarkeepPrugar.Y               = 34802;
                    BarkeepPrugar.Z               = 8027;
                    BarkeepPrugar.Heading         = 1194;
                    BarkeepPrugar.RespawnInterval = -1;
                    BarkeepPrugar.BodyType        = 0;

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

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

            rattlingskeletonpendant = GameServer.Database.FindObjectByKey <ItemTemplate>("rattlingskeletonpendant");
            if (rattlingskeletonpendant == null)
            {
                rattlingskeletonpendant      = new ItemTemplate();
                rattlingskeletonpendant.Name = "Rattling Skeleton Pendant";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + rattlingskeletonpendant.Name + ", creating it ...");
                }

                rattlingskeletonpendant.Level            = 50;
                rattlingskeletonpendant.Weight           = 5;
                rattlingskeletonpendant.Model            = 101;
                rattlingskeletonpendant.Object_Type      = 0;
                rattlingskeletonpendant.Item_Type        = 40;
                rattlingskeletonpendant.Id_nb            = "rattlingskeletonpendant";
                rattlingskeletonpendant.Hand             = 0;
                rattlingskeletonpendant.Price            = 0;
                rattlingskeletonpendant.IsPickable       = true;
                rattlingskeletonpendant.IsDropable       = true;
                rattlingskeletonpendant.IsTradable       = true;
                rattlingskeletonpendant.CanDropAsLoot    = false;
                rattlingskeletonpendant.Color            = 0;
                rattlingskeletonpendant.Bonus            = 35; // default bonus
                rattlingskeletonpendant.Bonus1           = 0;
                rattlingskeletonpendant.Bonus1Type       = (int)0;
                rattlingskeletonpendant.Bonus2           = 0;
                rattlingskeletonpendant.Bonus2Type       = (int)0;
                rattlingskeletonpendant.Bonus3           = 0;
                rattlingskeletonpendant.Bonus3Type       = (int)0;
                rattlingskeletonpendant.Bonus4           = 0;
                rattlingskeletonpendant.Bonus4Type       = (int)0;
                rattlingskeletonpendant.Bonus5           = 0;
                rattlingskeletonpendant.Bonus5Type       = (int)0;
                rattlingskeletonpendant.Bonus6           = 0;
                rattlingskeletonpendant.Bonus6Type       = (int)0;
                rattlingskeletonpendant.Bonus7           = 0;
                rattlingskeletonpendant.Bonus7Type       = (int)0;
                rattlingskeletonpendant.Bonus8           = 0;
                rattlingskeletonpendant.Bonus8Type       = (int)0;
                rattlingskeletonpendant.Bonus9           = 0;
                rattlingskeletonpendant.Bonus9Type       = (int)0;
                rattlingskeletonpendant.Bonus10          = 0;
                rattlingskeletonpendant.Bonus10Type      = (int)0;
                rattlingskeletonpendant.ExtraBonus       = 0;
                rattlingskeletonpendant.ExtraBonusType   = (int)0;
                rattlingskeletonpendant.Effect           = 0;
                rattlingskeletonpendant.Emblem           = 0;
                rattlingskeletonpendant.Charges          = 0;
                rattlingskeletonpendant.MaxCharges       = 0;
                rattlingskeletonpendant.SpellID          = 0;
                rattlingskeletonpendant.ProcSpellID      = 0;
                rattlingskeletonpendant.Type_Damage      = 0;
                rattlingskeletonpendant.Realm            = 0;
                rattlingskeletonpendant.MaxCount         = 1;
                rattlingskeletonpendant.PackSize         = 1;
                rattlingskeletonpendant.Extension        = 0;
                rattlingskeletonpendant.Quality          = 99;
                rattlingskeletonpendant.Condition        = 50000;
                rattlingskeletonpendant.MaxCondition     = 50000;
                rattlingskeletonpendant.Durability       = 50000;
                rattlingskeletonpendant.MaxDurability    = 50000;
                rattlingskeletonpendant.PoisonCharges    = 0;
                rattlingskeletonpendant.PoisonMaxCharges = 0;
                rattlingskeletonpendant.PoisonSpellID    = 0;
                rattlingskeletonpendant.ProcSpellID1     = 0;
                rattlingskeletonpendant.SpellID1         = 0;
                rattlingskeletonpendant.MaxCharges1      = 0;
                rattlingskeletonpendant.Charges1         = 0;

                GameServer.Database.AddObject(rattlingskeletonpendant);
            }

            giftandnoteforprugar = GameServer.Database.FindObjectByKey <ItemTemplate>("giftandnoteforprugar");
            if (giftandnoteforprugar == null)
            {
                giftandnoteforprugar      = new ItemTemplate();
                giftandnoteforprugar.Name = "Gift and Note for Prugar";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + giftandnoteforprugar.Name + ", creating it ...");
                }

                giftandnoteforprugar.Level            = 50;
                giftandnoteforprugar.Weight           = 5;
                giftandnoteforprugar.Model            = 1347;
                giftandnoteforprugar.Object_Type      = 0;
                giftandnoteforprugar.Item_Type        = 40;
                giftandnoteforprugar.Id_nb            = "giftandnoteforprugar";
                giftandnoteforprugar.Hand             = 0;
                giftandnoteforprugar.Price            = 0;
                giftandnoteforprugar.IsPickable       = true;
                giftandnoteforprugar.IsDropable       = true;
                giftandnoteforprugar.IsTradable       = true;
                giftandnoteforprugar.CanDropAsLoot    = false;
                giftandnoteforprugar.Color            = 0;
                giftandnoteforprugar.Bonus            = 35; // default bonus
                giftandnoteforprugar.Bonus1           = 0;
                giftandnoteforprugar.Bonus1Type       = (int)0;
                giftandnoteforprugar.Bonus2           = 0;
                giftandnoteforprugar.Bonus2Type       = (int)0;
                giftandnoteforprugar.Bonus3           = 0;
                giftandnoteforprugar.Bonus3Type       = (int)0;
                giftandnoteforprugar.Bonus4           = 0;
                giftandnoteforprugar.Bonus4Type       = (int)0;
                giftandnoteforprugar.Bonus5           = 0;
                giftandnoteforprugar.Bonus5Type       = (int)0;
                giftandnoteforprugar.Bonus6           = 0;
                giftandnoteforprugar.Bonus6Type       = (int)0;
                giftandnoteforprugar.Bonus7           = 0;
                giftandnoteforprugar.Bonus7Type       = (int)0;
                giftandnoteforprugar.Bonus8           = 0;
                giftandnoteforprugar.Bonus8Type       = (int)0;
                giftandnoteforprugar.Bonus9           = 0;
                giftandnoteforprugar.Bonus9Type       = (int)0;
                giftandnoteforprugar.Bonus10          = 0;
                giftandnoteforprugar.Bonus10Type      = (int)0;
                giftandnoteforprugar.ExtraBonus       = 0;
                giftandnoteforprugar.ExtraBonusType   = (int)0;
                giftandnoteforprugar.Effect           = 0;
                giftandnoteforprugar.Emblem           = 0;
                giftandnoteforprugar.Charges          = 0;
                giftandnoteforprugar.MaxCharges       = 0;
                giftandnoteforprugar.SpellID          = 0;
                giftandnoteforprugar.ProcSpellID      = 0;
                giftandnoteforprugar.Type_Damage      = 0;
                giftandnoteforprugar.Realm            = 0;
                giftandnoteforprugar.MaxCount         = 1;
                giftandnoteforprugar.PackSize         = 1;
                giftandnoteforprugar.Extension        = 0;
                giftandnoteforprugar.Quality          = 99;
                giftandnoteforprugar.Condition        = 50000;
                giftandnoteforprugar.MaxCondition     = 50000;
                giftandnoteforprugar.Durability       = 50000;
                giftandnoteforprugar.MaxDurability    = 50000;
                giftandnoteforprugar.PoisonCharges    = 0;
                giftandnoteforprugar.PoisonMaxCharges = 0;
                giftandnoteforprugar.PoisonSpellID    = 0;
                giftandnoteforprugar.ProcSpellID1     = 0;
                giftandnoteforprugar.SpellID1         = 0;
                giftandnoteforprugar.MaxCharges1      = 0;
                giftandnoteforprugar.Charges1         = 0;

                GameServer.Database.AddObject(giftandnoteforprugar);
            }

            QuestBuilder   builder = QuestMgr.GetBuilder(typeof(thebirthdaygift));
            QuestBehaviour a;

            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.Interact, null, BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), null, (eComparator)5);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk1"), BarkeepNognar);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.Whisper, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Whisper1"), BarkeepNognar);

            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), null, (eComparator)5);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk2"), BarkeepNognar);

            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.Whisper, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Whisper2"), BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), null, (eComparator)5);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk3"), BarkeepNognar);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.Whisper, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Whisper3"), BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), null, (eComparator)5);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk4"), BarkeepNognar);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.Whisper, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Whisper4"), BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), null, (eComparator)5);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk5"), BarkeepNognar);
            a.AddAction(eActionType.OfferQuest, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.OfferQuest"));
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.DeclineQuest, null, typeof(DOL.GS.Quests.Midgard.thebirthdaygift));
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk6"), BarkeepNognar);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.AcceptQuest, null, typeof(DOL.GS.Quests.Midgard.thebirthdaygift));
            a.AddAction(eActionType.GiveQuest, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), BarkeepNognar);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk7"), BarkeepNognar);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.Whisper, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Whisper5"), BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), 1, (eComparator)3);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk8"), BarkeepNognar);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.EnemyKilled, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.EnemyKilled"), null);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), 1, (eComparator)3);
            a.AddAction(eActionType.GiveItem, rattlingskeletonpendant, null);
            a.AddAction(eActionType.IncQuestStep, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), null);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.Interact, null, BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), 2, (eComparator)3);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk9"), BarkeepNognar);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.GiveItem, BarkeepNognar, rattlingskeletonpendant);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), 2, (eComparator)3);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk10"), BarkeepNognar);
            a.AddAction(eActionType.TakeItem, rattlingskeletonpendant, null);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepNognar, -1);
            a.AddTrigger(eTriggerType.Whisper, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Whisper6"), BarkeepNognar);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), 2, (eComparator)3);
            a.AddRequirement(eRequirementType.InventoryItem, rattlingskeletonpendant, 0, (eComparator)3);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk11"), BarkeepNognar);
            a.AddAction(eActionType.IncQuestStep, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), null);
            a.AddAction(eActionType.GiveItem, giftandnoteforprugar, BarkeepNognar);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepPrugar, -1);
            a.AddTrigger(eTriggerType.Interact, null, BarkeepPrugar);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), 3, (eComparator)3);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk12"), BarkeepPrugar);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepPrugar, -1);
            a.AddTrigger(eTriggerType.GiveItem, BarkeepPrugar, giftandnoteforprugar);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), 3, (eComparator)3);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk13"), BarkeepPrugar);
            a.AddAction(eActionType.TakeItem, giftandnoteforprugar, null);
            AddBehaviour(a);
            a = builder.CreateBehaviour(BarkeepPrugar, -1);
            a.AddTrigger(eTriggerType.Whisper, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Whisper7"), BarkeepPrugar);
            a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), 3, (eComparator)3);
            a.AddRequirement(eRequirementType.InventoryItem, giftandnoteforprugar, 0, (eComparator)3);
            a.AddAction(eActionType.Talk, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Mid.TheBirthdayGift.Talk14"), BarkeepPrugar);
            a.AddAction(eActionType.GiveXP, 20, null);
            a.AddAction(eActionType.GiveGold, 27, null);
            a.AddAction(eActionType.FinishQuest, typeof(DOL.GS.Quests.Midgard.thebirthdaygift), null);
            AddBehaviour(a);

            // Custom Scriptloaded Code Begin

            // Custom Scriptloaded Code End
            if (BarkeepNognar != null)
            {
                BarkeepNognar.AddQuestToGive(typeof(thebirthdaygift));
            }

            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(HeartOfSephucoth)) == null)
            {
                return;
            }

            if (e == GameLivingEvent.EnemyKilled)
            {
                EnemyKilledEventArgs gArgs = (EnemyKilledEventArgs)args;
                if (Step == 1)
                {
                    if (gArgs.Target.Name == "river sprite")
                    {
                        if (Util.Chance(25))
                        {
                            if (sephucoth == null)
                            {
                                sephucoth                 = new GameNPC();
                                sephucoth.Model           = 136;
                                sephucoth.Name            = "Sephucoth";
                                sephucoth.Realm           = eRealm.None;
                                sephucoth.CurrentRegionID = 1;

                                sephucoth.Size    = 55;
                                sephucoth.Level   = 7;
                                sephucoth.X       = 560836;
                                sephucoth.Y       = 527260;
                                sephucoth.Z       = 2082;
                                sephucoth.Heading = 1480;

                                StandardMobBrain brain = new StandardMobBrain(); // set a brain witch find a lot mob friend to attack the player
                                sephucoth.SetOwnBrain(brain);                    // so this mob must be abble to cast

                                sephucoth.RespawnInterval = 0;                   // don't respawn when killed

                                sephucoth.AddToWorld();
                            }
                        }
                    }
                    else if (gArgs.Target.Name == "Sephucoth")
                    {
                        GiveItem(gArgs.Target, player, sephucothsHeart);
                        if (sephucoth != null)
                        {
                            sephucoth = null;
                        }

                        Step = 2;
                    }
                }
                else if (Step == 3)
                {
                    if (gArgs.Target.Name == "large skeleton")
                    {
                        if (Util.Chance(50))
                        {
                            GiveItem(gArgs.Target, player, polishedBone);
                            Step = 4;
                        }
                    }
                }
            }
            else if (e == GamePlayerEvent.GiveItem)
            {
                GiveItemEventArgs gArgs = (GiveItemEventArgs)args;
                if (gArgs.Target.Name == eowylnAstos.Name)
                {
                    if (gArgs.Item.Id_nb == sephucothsHeart.Id_nb && Step == 2)
                    {
                        RemoveItem(eowylnAstos, QuestPlayer, sephucothsHeart);

                        eowylnAstos.TurnTo(QuestPlayer);
                        eowylnAstos.SayTo(QuestPlayer, "You have done well traveler! I will still require one final object to complete the pendant. Seek out a large skeleton and bring from it a piece of polished bone! Return this to me and I shall finish your pendant.");
                        Step = 3;
                    }
                    else if (gArgs.Item.Id_nb == polishedBone.Id_nb && Step == 4)
                    {
                        RemoveItem(eowylnAstos, QuestPlayer, polishedBone);

                        eowylnAstos.TurnTo(QuestPlayer);
                        eowylnAstos.SayTo(QuestPlayer, "Eowyln draws two items before her. Gathering her strength, she shouts.");

                        new RegionTimer(eowylnAstos, new RegionTimerCallback(BuildNecklace), 5000);
                    }
                }
            }
        }
Example #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("Atheleys Sy'Lian", 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)
            {
                atheleys       = new GameNPC();
                atheleys.Model = 87;
                atheleys.Name  = "Atheleys Sy'Lian";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + atheleys.Name + ", creating him ...");
                }
                atheleys.Realm           = eRealm.Albion;
                atheleys.CurrentRegionID = 1;
                atheleys.Size            = 50;
                atheleys.Level           = 30;
                atheleys.X       = 574375;
                atheleys.Y       = 530243;
                atheleys.Z       = 2906;
                atheleys.Heading = 1922;

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


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

            npcs = WorldMgr.GetNPCsByName("Mostram", eRealm.None);


            if (npcs.Length == 0)
            {
                //TODO insert proper attributes
                mostram       = new GameNPC();
                mostram.Model = 18;
                mostram.Name  = "Mostram";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Mostram, creating him ...");
                }
                mostram.GuildName       = "";
                mostram.Realm           = eRealm.None;
                mostram.CurrentRegionID = 1;
                mostram.Size            = 52;
                mostram.Level           = 9;
                mostram.X       = 574338;
                mostram.Y       = 536865;
                mostram.Z       = 2361;
                mostram.Heading = 57;

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


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


            #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(atheleys, GameLivingEvent.Interact, new DOLEventHandler(TalkToAtheleys));
            GameEventMgr.AddHandler(atheleys, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToAtheleys));

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

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Example #29
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>("Lady Hinda", eRealm.None);
            if (npcs.Length == 0)
            {
                // if (Log.IsWarnEnabled) Log.Warn("Could not find Lady Hinda, creating her ...");
                ladyHinda                 = new GameNPC();
                ladyHinda.Model           = 678;
                ladyHinda.Name            = "Lady Hinda";
                ladyHinda.GuildName       = "Part of " + questTitle + " Quest";
                ladyHinda.Realm           = eRealm.None;
                ladyHinda.CurrentRegionID = hindaStart.RegionID;
                ladyHinda.Size            = 50;
                ladyHinda.Level           = 30;
                ladyHinda.X               = hindaStart.X;
                ladyHinda.Y               = hindaStart.Y;
                ladyHinda.Z               = hindaStart.Z;
                ladyHinda.Heading         = hindaStart.Heading;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                ladyHinda.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
                // ladyHinda.SaveIntoDatabase();
                // ladyHinda.AddToWorld();
            }
            else
            {
                ladyHinda = npcs[0];
            }

            // item db check
            necklaceOfDoppelganger = GameServer.Database.FindObjectByKey <ItemTemplate>("necklace_of_the_doppelganger");
            if (necklaceOfDoppelganger == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Necklace of the Doppelganger, creating it ...");
                }

                necklaceOfDoppelganger        = new ItemTemplate();
                necklaceOfDoppelganger.Name   = "Necklace of the Doppelganger";
                necklaceOfDoppelganger.Level  = 2;
                necklaceOfDoppelganger.Weight = 2;
                necklaceOfDoppelganger.Model  = 101;

                necklaceOfDoppelganger.Object_Type = (int)eObjectType.Magical;
                necklaceOfDoppelganger.Item_Type   = (int)eEquipmentItems.NECK;
                necklaceOfDoppelganger.Id_nb       = "necklace_of_the_doppelganger";
                necklaceOfDoppelganger.Price       = 0;
                necklaceOfDoppelganger.IsPickable  = true;
                necklaceOfDoppelganger.IsDropable  = false;

                necklaceOfDoppelganger.Quality       = 100;
                necklaceOfDoppelganger.Condition     = 1000;
                necklaceOfDoppelganger.MaxCondition  = 1000;
                necklaceOfDoppelganger.Durability    = 1000;
                necklaceOfDoppelganger.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
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(necklaceOfDoppelganger);
                }
            }

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

                askefruerPlans      = new ItemTemplate();
                askefruerPlans.Name = "Akefruer Plans";

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

                askefruerPlans.Object_Type = (int)eObjectType.GenericItem;

                askefruerPlans.Id_nb      = "askefruer_plans";
                askefruerPlans.IsPickable = true;
                askefruerPlans.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
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(askefruerPlans);
                }
            }

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

                recruitsBoots.Level = 7;

                recruitsBoots.Weight = 24;
                recruitsBoots.Model  = 84;  // studded Boots

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

                recruitsBoots.Object_Type = (int)eObjectType.Studded;
                recruitsBoots.Item_Type   = (int)eEquipmentItems.FEET;
                recruitsBoots.Id_nb       = "recruits_studded_boots_mid";
                recruitsBoots.Price       = Money.GetMoney(0, 0, 0, 10, 0);
                recruitsBoots.IsPickable  = true;
                recruitsBoots.IsDropable  = true;
                recruitsBoots.Color       = 14;

                recruitsBoots.Bonus = 1; // default bonus

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

                recruitsBoots.Bonus2     = 1;
                recruitsBoots.Bonus2Type = (int)eStat.CON;

                recruitsBoots.Bonus3     = 1;
                recruitsBoots.Bonus3Type = (int)eResist.Spirit;

                recruitsBoots.Quality       = 100;
                recruitsBoots.Condition     = 1000;
                recruitsBoots.MaxCondition  = 1000;
                recruitsBoots.Durability    = 1000;
                recruitsBoots.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
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(recruitsBoots);
                }
            }

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

                recruitsQuiltedBoots.Level = 7;

                recruitsQuiltedBoots.Weight = 8;
                recruitsQuiltedBoots.Model  = 155; // studded Boots

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

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

                recruitsQuiltedBoots.Bonus = 5; // default bonus

                recruitsQuiltedBoots.Bonus1     = 3;
                recruitsQuiltedBoots.Bonus1Type = (int)eStat.CON;

                recruitsQuiltedBoots.Bonus2     = 1;
                recruitsQuiltedBoots.Bonus2Type = (int)eStat.STR;

                recruitsQuiltedBoots.Bonus3     = 1;
                recruitsQuiltedBoots.Bonus3Type = (int)eResist.Spirit;

                recruitsQuiltedBoots.Quality       = 100;
                recruitsQuiltedBoots.Condition     = 1000;
                recruitsQuiltedBoots.MaxCondition  = 1000;
                recruitsQuiltedBoots.Durability    = 1000;
                recruitsQuiltedBoots.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
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(recruitsQuiltedBoots);
                }
            }

            /* 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(ladyHinda, GameLivingEvent.Interact, new DOLEventHandler(TalkToLadyHinda));
            GameEventMgr.AddHandler(ladyHinda, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToLadyHinda));

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

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
        public static GameNPC GetDalikor()
        {
            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Dalikor", eRealm.Midgard);

            GameNPC dalikor = null;

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

                dalikor.GuildName       = "Part of Dalikor Quests";
                dalikor.Realm           = eRealm.Midgard;
                dalikor.CurrentRegionID = locationDalikor.RegionID;

                GameNpcInventoryTemplate 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.RightHandWeapon, 4);
                dalikor.Inventory = template.CloseTemplate();
                dalikor.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

// dalikor.AddNPCEquipment((byte) eEquipmentItems.TORSO, 348, 0, 0, 0);
//              dalikor.AddNPCEquipment((byte) eEquipmentItems.LEGS, 349, 0, 0, 0);
//              dalikor.AddNPCEquipment((byte) eEquipmentItems.ARMS, 350, 0, 0, 0);
//              dalikor.AddNPCEquipment((byte) eEquipmentItems.HAND, 351, 0, 0, 0);
//              dalikor.AddNPCEquipment((byte) eEquipmentItems.FEET, 352, 0, 0, 0);
//              dalikor.AddNPCEquipment((byte) eVisibleItems.RIGHT_HAND, 4, 0, 0, 0);
                dalikor.Size    = 50;
                dalikor.Level   = 50;
                dalikor.X       = locationDalikor.X;
                dalikor.Y       = locationDalikor.Y;
                dalikor.Z       = locationDalikor.Z;
                dalikor.Heading = locationDalikor.Heading;

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

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

            return(dalikor);
        }