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; } }
/// <summary> /// Method to Initialise the Guards /// /// Here we create the instances of the guard /// We add to the local array of guards /// We assign a Guard ID which is the Patrol ID /// We assign the guards component /// </summary> public void InitialiseGuards() { Component.AbstractKeep.Patrols.Add(PatrolID, this); //need this here becuase it's checked in add to world PatrolPath = PositionMgr.LoadPatrolPath(PatrolID, Component); int guardsOnPatrol = 1; if (Component != null && Component.AbstractKeep != null && Component.AbstractKeep is GameKeep) { guardsOnPatrol++; if (Component.AbstractKeep.Level > 4) { guardsOnPatrol++; } } if (PatrolGuards.Count < guardsOnPatrol) { for (int i = 0; i < guardsOnPatrol; i++) { CreatePatrolGuard(i); } } // tolakram - this might be redundant foreach (GameKeepGuard guard in PatrolGuards) { PositionMgr.LoadGuardPosition(SpawnPosition, guard); } ChangePatrolLevel(); }
/// <summary> /// Move a guard to a position /// </summary> /// <param name="position">The new position for the guard</param> public void MoveToPosition(DBKeepPosition position) { PositionMgr.LoadGuardPosition(position, this); if (!this.InCombat) { this.MoveTo(this.CurrentRegionID, this.X, this.Y, this.Z, this.Heading); } }
/// <summary> /// Move a guard to a position /// </summary> /// <param name="position">The new position for the guard</param> public void MoveToPosition(DBKeepPosition position) { PositionMgr.LoadGuardPosition(position, this); if (!InCombat) { MoveTo(CurrentRegionID, X, Y, Z, Heading); } }
public void LoadFromPosition(DBKeepPosition pos, GameKeepComponent component) { m_templateID = pos.TemplateID; m_component = component; component.Keep.Guards.Add(m_templateID + component.ID, this); PositionMgr.LoadGuardPosition(pos, this); RefreshTemplate(); this.AddToWorld(); }
/// <summary> /// Load the guard from a position /// </summary> /// <param name="pos">The position for the guard</param> /// <param name="component">The component it is being spawned on</param> public void LoadFromPosition(DBKeepPosition pos, GameKeepComponent component) { m_templateID = pos.TemplateID; m_component = component; component.AbstractKeep.Guards[m_templateID] = this; PositionMgr.LoadGuardPosition(pos, this); if (Component != null && Component.AbstractKeep != null) { Component.AbstractKeep.TemplateManager.GetMethod("RefreshTemplate").Invoke(null, new object[] { this }); } else { TemplateMgr.RefreshTemplate(this); } this.AddToWorld(); }
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; } }