Esempio n. 1
0
        private void CreatePatrolGuard(int type)
        {
            Assembly asm = Assembly.GetAssembly(typeof(GameServer));

            if (type < 0)
            {
                type = 0;
            }
            if (type > GuardTypes.Length - 1)
            {
                type = GuardTypes.Length - 1;
            }

            GameKeepGuard guard = (GameKeepGuard)asm.CreateInstance(GuardTypes[type].FullName, true);

            guard.TemplateID  = PatrolID;
            guard.Component   = Component;
            guard.PatrolGroup = this;
            PositionMgr.LoadGuardPosition(SpawnPosition, guard);
            guard.RefreshTemplate();
            PatrolGuards.Add(guard);
            Component.Keep.Guards.Add(Database.UniqueID.IDGenerator.GenerateID(), guard);
            guard.AddToWorld();

            if (ServerProperties.Properties.ENABLE_DEBUG)
            {
                guard.Name += " PatrolID " + PatrolID;
            }
        }
Esempio n. 2
0
        private void CreatePatrolGuard(int type)
        {
            Assembly asm = Assembly.GetAssembly(typeof(GameServer));

            if (type < 0)
            {
                type = 0;
            }

            if (type > GuardTypes.Length - 1)
            {
                type = GuardTypes.Length - 1;
            }

            GameKeepGuard guard = (GameKeepGuard)asm.CreateInstance(GuardTypes[type].FullName, true);

            guard.TemplateID  = PatrolID;
            guard.Component   = Component;
            guard.PatrolGroup = this;
            PositionMgr.LoadGuardPosition(SpawnPosition, guard);
            if (Component != null && Component.AbstractKeep != null)
            {
                Component.AbstractKeep.TemplateManager.GetMethod("RefreshTemplate").Invoke(null, new object[] { guard });
            }
            else
            {
                TemplateMgr.RefreshTemplate(guard);
            }

            PatrolGuards.Add(guard);
            Component.AbstractKeep.Guards.Add(DOL.Database.UniqueID.IDGenerator.GenerateID(), guard);
            guard.AddToWorld();

            if (ServerProperties.Properties.ENABLE_DEBUG)
            {
                guard.Name += " PatrolID " + PatrolID;
            }
        }