示例#1
0
        public static void OnScriptsCompiled(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_EXAMPLES)
            {
                return;
            }

            // We set a new random class
            m_rnd = new Random();

            // We create our guardmaster-trainer
            m_guardMaster         = new FightingNPC();
            m_guardMaster.X       = 531771;
            m_guardMaster.Y       = 478755;
            m_guardMaster.Heading = 3570;
            m_guardMaster.Name    = "Master Guard Trainer";

            // Now we add some nice equipment to the guard-trainer
            GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();

            template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 843, 43, 13);
            template.AddNPCEquipment(eInventorySlot.Cloak, 57, 65);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 46);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
            template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);
            template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
            template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
            m_guardMaster.Inventory = template.CloseTemplate();
            m_guardMaster.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

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

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

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

            for (int i = 0; i < 5; i++)
            {
                // Create a trainee
                m_guardTrainee[i]      = new FightingNPC();
                m_guardTrainee[i].Name = "Guard Trainee";

                // Add some equipment to our trainee
                m_guardTrainee[i].Inventory = template;
                m_guardTrainee[i].SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

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

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

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

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

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

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

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

            // Now we try to add the master and all trainees to the world
            bool good = true;

            if (!m_guardMaster.AddToWorld())
            {
                good = false;
            }

            for (int i = 0; i < 5; i++)
            {
                if (!m_guardTrainee[i].AddToWorld())
                {
                    good = false;
                }
            }

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

            if (log.IsInfoEnabled)
            {
                if (log.IsInfoEnabled)
                {
                    log.Info("FightingNPCEvent initialized: " + good);
                }
            }
        }
示例#2
0
        public static void OnScriptsCompiled(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_EXAMPLES)
                return;
            //We set a new random class
            m_rnd = new Random();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if (log.IsInfoEnabled)
                if (log.IsInfoEnabled)
                    log.Info("FightingNPCEvent initialized: "+good);
        }