public static void SetGuardLevel(GameKeepGuard guard) { if (guard.Component != null) { guard.Component.AbstractKeep.SetGuardLevel(guard); } }
/// <summary> /// Sets the guards brain /// </summary> /// <param name="guard">The guard object</param> public static void SetGuardBrain(GameKeepGuard guard) { if (guard.Brain is KeepGuardBrain == false) { KeepGuardBrain brain = new KeepGuardBrain(); if (guard is GuardCaster) { brain = new CasterBrain(); } else if (guard is GuardHealer) { brain = new HealerBrain(); } else if (guard is GuardLord) { brain = new LordBrain(); } guard.AddBrain(brain); brain.guard = guard; } if (guard is MissionMaster) { (guard.Brain as KeepGuardBrain).SetAggression(90, 400); } }
/// <summary> /// Method to Set an Emblem to a Guards equipment /// </summary> /// <param name="guard">The guard object</param> public static void SetEmblem(GameKeepGuard guard) { if (guard.Inventory == null) { return; } if (guard.Component == null) { return; } int emblem = 0; if (guard.Component.AbstractKeep.Guild != null) { emblem = guard.Component.AbstractKeep.Guild.Emblem; } InventoryItem cloak = guard.Inventory.GetItem(eInventorySlot.Cloak); if (cloak != null) { cloak.Emblem = emblem; if (cloak.Emblem != 0) { cloak.Model = 558; // change to a model that looks ok with an emblem } } InventoryItem shield = guard.Inventory.GetItem(eInventorySlot.LeftHandWeapon); if (shield != null) { shield.Emblem = emblem; } guard.BroadcastLivingEquipmentUpdate(); }
private static void SetGuardRespawn(GameKeepGuard guard) { if (guard is FrontierHastener) { guard.RespawnInterval = 5000; // 5 seconds } else if (guard is GuardLord) { if (guard.Component != null) { guard.RespawnInterval = guard.Component.AbstractKeep.LordRespawnTime; } else { guard.RespawnInterval = 5000; } } else if (guard is MissionMaster) { guard.RespawnInterval = 10000; // 10 seconds } else { guard.RespawnInterval = Util.Random(5, 25) * 60 * 1000; } }
public virtual void SetGuardLevel(GameKeepGuard guard) { if (guard is FrontierHastener) { guard.Level = 1; } else { int bonusLevel = 0; double multiplier = ServerProperties.Properties.KEEP_GUARD_LEVEL_MULTIPLIER; if (guard.Component != null) { // level is usually 4 unless upgraded, BaseLevel is usually 50 bonusLevel = guard.Component.AbstractKeep.Level; if (guard.Component.AbstractKeep is GameKeepTower) { multiplier = ServerProperties.Properties.TOWER_GUARD_LEVEL_MULTIPLIER; } } guard.Level = (byte)(GetBaseLevel(guard) + (bonusLevel * multiplier)); } }
public virtual byte GetBaseLevel(GameKeepGuard guard) { if (guard.Component == null) { if (guard is GuardLord) { return(75); } else { return(65); } } if (guard is GuardLord) { if (guard.Component.AbstractKeep is GameKeep) { return((byte)(guard.Component.AbstractKeep.BaseLevel + ((guard.Component.AbstractKeep.BaseLevel / 10) + 1) * 2)); } else { return((byte)(guard.Component.AbstractKeep.BaseLevel + 2)); // flat increase for tower captains } } if (guard.Component.AbstractKeep is GameKeep) { return((byte)(guard.Component.AbstractKeep.BaseLevel + 1)); } return(guard.Component.AbstractKeep.BaseLevel); }
private static void SetGuardRespawn(GameKeepGuard guard) { if (guard is FrontierHastener) { guard.RespawnInterval = 5000; // 5 seconds } else if (guard is GuardLord) { if (guard.Component != null) { guard.RespawnInterval = guard.Component.Keep.LordRespawnTime; } else { guard.RespawnInterval = 5000; } } else if (guard is MissionMaster) { guard.RespawnInterval = 10000; // 10 seconds } else { guard.RespawnInterval = Util.Random(5, 25) * 60 * 1000; } }
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; } }
public static void LoadGuardPosition(DBKeepPosition pos, GameKeepGuard guard) { LoadKeepItemPosition(pos, guard); guard.SpawnPoint = guard.Position; guard.SpawnHeading = guard.Heading; }
/// <summary> /// Sets the guards speed /// </summary> /// <param name="guard">The guard object</param> public static void SetGuardSpeed(GameKeepGuard guard) { if (guard.IsPortalKeepGuard) { guard.MaxSpeedBase = 575; } if ((guard is GuardLord && guard.Component != null) || guard is GuardStaticArcher || guard is GuardStaticCaster) { guard.MaxSpeedBase = 0; } else if (guard.Level < 250) { if (guard.Realm == eRealm.None) { guard.MaxSpeedBase = 200; } else if (guard.Level < 50) { guard.MaxSpeedBase = 210; } else { guard.MaxSpeedBase = 250; } } else { guard.MaxSpeedBase = 575; } }
/// <summary> /// Gets the most usable position directly from the database /// </summary> /// <param name="guard">The guard object</param> /// <returns>The position object</returns> public static DBKeepPosition GetUsablePosition(GameKeepGuard guard) { return(GameServer.Database.SelectObjects <DBKeepPosition>( "`ClassType` != @ClassType AND `TemplateID` = @TemplateID AND `ComponentSkin` = @ComponentSkin AND `Height` <= @Height", new [] { new QueryParameter("@ClassType", "DOL.GS.Keeps.Banner"), new QueryParameter("@TemplateID", guard.TemplateID), new QueryParameter("@ComponentSkin", guard.Component.Skin), new QueryParameter("@Height", guard.Component.Height) }) .OrderByDescending(it => it.Height).FirstOrDefault()); }
/// <summary> /// Gets the position at the exact entry from the database /// </summary> /// <param name="guard">The guard object</param> /// <returns>The position object</returns> public static DBKeepPosition GetPosition(GameKeepGuard guard) { var filterTemplateID = DB.Column(nameof(DBKeepPosition.TemplateID)).IsEqualTo(guard.TemplateID); var filterComponentSkin = DB.Column(nameof(DBKeepPosition.ComponentSkin)).IsEqualTo(guard.Component.Skin); var filterHeight = DB.Column(nameof(DBKeepPosition.Height)).IsLessOrEqualTo(guard.Component.Height); return(DOLDB <DBKeepPosition> .SelectObject(filterTemplateID.And(filterComponentSkin).And(filterHeight))); }
public virtual bool IsEnemy(GameKeepGuard checker, GamePlayer target, bool checkGroup) { if (checker.Component == null || checker.Component.Keep == null) { return(GameServer.ServerRules.IsAllowedToAttack(checker, target, true)); } return(IsEnemy(checker.Component.Keep, target, checkGroup)); }
public static void LoadGuardPosition(DBKeepPosition pos, GameKeepGuard guard) { LoadKeepItemPosition(pos, guard); guard.SpawnPoint.X = guard.X; guard.SpawnPoint.Y = guard.Y; guard.SpawnPoint.Z = guard.Z; guard.SpawnHeading = guard.Heading; }
/// <summary> /// Actions to be taken on each Think pulse /// </summary> public override void Think() { if (guard == null) guard = Body as GameKeepGuard; if (guard == null) { Stop(); return; } if ((guard is GuardArcher || guard is GuardLord)) { if (guard.AttackState && guard.CanUseRanged) { guard.SwitchToRanged(guard.TargetObject); } } //if we are not doing an action, let us see if we should move somewhere if (guard.CurrentSpellHandler == null && !guard.IsMoving && !guard.AttackState && !guard.InCombat) { // Tolakram - always clear the aggro list so if this is done by mistake the list will correctly re-fill on next think ClearAggroList(); if (guard.GetDistanceTo(guard.SpawnPoint, 0) > 50) { guard.WalkToSpawn(); } } //Eden - Portal Keeps Guards max distance if (guard.Level > 200 && !guard.IsWithinRadius(guard.SpawnPoint, 2000)) { ClearAggroList(); guard.WalkToSpawn(); } else if (guard.InCombat == false && guard.IsWithinRadius(guard.SpawnPoint, 6000) == false) { ClearAggroList(); guard.WalkToSpawn(); } // We want guards to check aggro even when they are returning home, which StandardMobBrain does not, so add checks here if (guard.CurrentSpellHandler == null && !guard.AttackState && !guard.InCombat) { CheckPlayerAggro(); CheckNPCAggro(); if (HasAggro && Body.IsReturningHome) { Body.StopMoving(); AttackMostWanted(); } } base.Think(); }
/// <summary> /// Gets the most usable position directly from the database /// </summary> /// <param name="guard">The guard object</param> /// <returns>The position object</returns> public static DBKeepPosition GetUsablePosition(GameKeepGuard guard) { var filterClassType = DB.Column(nameof(DBKeepPosition.ClassType)).IsNotEqualTo("DOL.GS.Keeps.Banner"); var filterTemplateID = DB.Column(nameof(DBKeepPosition.TemplateID)).IsEqualTo(guard.TemplateID); var filterComponentSkin = DB.Column(nameof(DBKeepPosition.ComponentSkin)).IsEqualTo(guard.Component.Skin); var filterHeight = DB.Column(nameof(DBKeepPosition.Height)).IsLessOrEqualTo(guard.Component.Height); return(DOLDB <DBKeepPosition> .SelectObjects(filterClassType.And(filterTemplateID).And(filterComponentSkin).And(filterHeight)) .OrderByDescending(it => it.Height).FirstOrDefault()); }
/// <summary> /// Method to check the area for heals /// </summary> /// <param name="guard">The guard object</param> public static void CheckAreaForHeals(GameKeepGuard guard) { GameLiving target = null; foreach (GamePlayer player in guard.GetPlayersInRadius(2000)) { if(!player.IsAlive) continue; if (GameServer.ServerRules.IsSameRealm(player, guard, true)) { if (player.HealthPercent < 60) { target = player; break; } } } if (target == null) { foreach (GameNPC npc in guard.GetNPCsInRadius(2000)) { if (npc is GameSiegeWeapon) continue; if (GameServer.ServerRules.IsSameRealm(npc, guard, true)) { if (npc.HealthPercent < 60) { target = npc; break; } } } } if (target != null) { GamePlayer LOSChecker = null; if (target is GamePlayer) { LOSChecker = target as GamePlayer; } else { foreach (GamePlayer player in guard.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { LOSChecker = player; break; } } if (LOSChecker == null) return; if(!target.IsAlive) return; guard.TargetObject = target; LOSChecker.Out.SendCheckLOS(guard, target, new CheckLOSResponse(guard.GuardStartSpellHealCheckLOS)); } }
private static void SetGuardAggression(GameKeepGuard guard) { if (guard is GuardStaticCaster) { (guard.Brain as KeepGuardBrain).SetAggression(99, 1850); } else if (guard is GuardStaticArcher) { (guard.Brain as KeepGuardBrain).SetAggression(99, 2100); } }
/// <summary> /// Method for a lord to cast a heal spell /// </summary> /// <param name="lord">The lord object</param> public static void LordCastHealSpell(GameKeepGuard lord) { //decide which healing spell Spell spell = GetLordHealSpell((eRealm)lord.Realm); //cast the healing spell if (spell != null && !lord.IsStunned && !lord.IsMezzed) { lord.StopAttack(); lord.TargetObject = lord; lord.CastSpell(spell, SpellMgr.GuardSpellLine); } }
public static void CheckForNuke(GameKeepGuard guard) { if (guard == null) { return; } GameLiving target = guard.TargetObject as GameLiving; if (target == null) { return; } if (!target.IsAlive) { return; } if (target is GamePlayer && !GameServer.KeepManager.IsEnemy(guard, target as GamePlayer, true)) { return; } if (!guard.IsWithinRadius(target, WorldMgr.VISIBILITY_DISTANCE)) { guard.TargetObject = null; return; } GamePlayer LOSChecker = null; if (target is GamePlayer) { LOSChecker = target as GamePlayer; } else { foreach (GamePlayer player in guard.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { LOSChecker = player; break; } } if (LOSChecker == null) { return; } LOSChecker.Out.SendCheckLOS(guard, target, new CheckLOSResponse(guard.GuardStartSpellNukeCheckLOS)); }
/// <summary> /// Sets a guards Block, Parry and Evade change /// </summary> /// <param name="guard">The guard object</param> private static void SetBlockEvadeParryChance(GameKeepGuard guard) { guard.BlockChance = 0; guard.EvadeChance = 0; guard.ParryChance = 0; if (guard is GuardLord || guard is MissionMaster) { guard.BlockChance = 15; guard.ParryChance = 15; if (guard.ModelRealm != eRealm.Albion) { guard.EvadeChance = 10; guard.ParryChance = 5; } } else if (guard is GuardStealther) { guard.EvadeChance = 30; } else if (guard is GuardFighter) { guard.BlockChance = 10; guard.ParryChance = 10; if (guard.ModelRealm != eRealm.Albion) { guard.EvadeChance = 5; guard.ParryChance = 5; } } else if (guard is GuardHealer) { guard.BlockChance = 5; } else if (guard is GuardArcher) { if (guard.ModelRealm == eRealm.Albion) { guard.BlockChance = 10; guard.EvadeChance = 5; } else { guard.EvadeChance = 15; } } }
private static void SetGuardGuild(GameKeepGuard guard) { if (guard.Component == null) { guard.GuildName = string.Empty; } else if (guard.Component.AbstractKeep.Guild == null) { guard.GuildName = string.Empty; } else { guard.GuildName = guard.Component.AbstractKeep.Guild.Name; } }
private static void SetGuardGuild(GameKeepGuard guard) { if (guard.Component == null) { guard.GuildName = ""; } else if (guard.Component.Keep.Guild == null) { guard.GuildName = ""; } else { guard.GuildName = guard.Component.Keep.Guild.Name; } }
/// <summary> /// Sets a guards stats /// </summary> /// <param name="guard">The guard object</param> private static void SetGuardStats(GameKeepGuard guard) { if (guard is GuardLord) { guard.Strength = (short)(20 + (guard.Level * 8)); guard.Dexterity = (short)(guard.Level * 2); guard.Constitution = (short)DOL.GS.ServerProperties.Properties.GAMENPC_BASE_CON; guard.Quickness = 60; } else { guard.Strength = (short)(20 + (guard.Level * 7)); guard.Dexterity = (short)guard.Level; guard.Constitution = (short)DOL.GS.ServerProperties.Properties.GAMENPC_BASE_CON; guard.Quickness = 40; } }
public static void RefreshTemplate(GameKeepGuard guard) { SetGuardRealm(guard); SetGuardGuild(guard); SetGuardRespawn(guard); SetGuardGender(guard); SetGuardModel(guard); SetGuardName(guard); SetBlockEvadeParryChance(guard); SetGuardBrain(guard); SetGuardSpeed(guard); SetGuardLevel(guard); SetGuardResists(guard); SetGuardStats(guard); SetGuardAggression(guard); ClothingMgr.EquipGuard(guard); ClothingMgr.SetEmblem(guard); }
/// <summary> /// Sets a guards resists /// </summary> /// <param name="guard">The guard object</param> private static void SetGuardResists(GameKeepGuard guard) { for (int i = (int)eProperty.Resist_First; i <= (int)eProperty.Resist_Last; i++) { if (guard is GuardLord) { guard.BaseBuffBonusCategory[i] = 40; } else if (guard.Level < 50) { guard.BaseBuffBonusCategory[i] = guard.Level / 2 + 1; } else { guard.BaseBuffBonusCategory[i] = 26; } } }
private static void SetGuardGender(GameKeepGuard guard) { // portal keep guards are always male if (guard.IsPortalKeepGuard) { guard.Gender = eGender.Male; } else { if (Util.Chance(50)) { guard.Gender = eGender.Male; } else { guard.Gender = eGender.Female; } } }
/// <summary> /// Sends message to guild for guard death with enemy count in area /// </summary> /// <param name="guard">The guard object</param> public static void GuardSpam(GameKeepGuard guard) { if (guard.Component == null) { return; } if (guard.Component.AbstractKeep == null) { return; } if (guard.Component.AbstractKeep.Guild == null) { return; } int inArea = guard.GetEnemyCountInArea(); string message = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "GameKeepGuard.GuardSpam.Killed", guard.Name, guard.Component.AbstractKeep.Name, inArea); KeepGuildMgr.SendMessageToGuild(message, guard.Component.AbstractKeep.Guild); }
private static void SetGuardRealm(GameKeepGuard guard) { if (guard.Component != null) { guard.Realm = guard.Component.AbstractKeep.Realm; if (guard.Realm != eRealm.None) { guard.ModelRealm = guard.Realm; } else { guard.ModelRealm = (eRealm)Util.Random(1, 3); } } else { guard.Realm = guard.CurrentZone.Realm; guard.ModelRealm = guard.Realm; } }
public static void CheckForNuke(GameKeepGuard guard) { if(guard==null) return; GameLiving target = guard.TargetObject as GameLiving; if(target==null) return; if(!target.IsAlive) return; if(target is GamePlayer && !GameServer.KeepManager.IsEnemy(guard, target as GamePlayer, true)) return; if ( !guard.IsWithinRadius( target, WorldMgr.VISIBILITY_DISTANCE ) ) { guard.TargetObject = null; return; } GamePlayer LOSChecker = null; if (target is GamePlayer) LOSChecker = target as GamePlayer; else { foreach (GamePlayer player in guard.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { LOSChecker = player; break; } } if (LOSChecker == null) return; LOSChecker.Out.SendCheckLOS(guard, target, new CheckLOSResponse(guard.GuardStartSpellNukeCheckLOS)); }
private static void SetGuardRealm(GameKeepGuard guard) { if (guard.Component != null) { guard.Realm = guard.Component.Keep.Realm; if (guard.Realm != eRealm.None) { guard.ModelRealm = guard.Realm; } else { guard.ModelRealm = (eRealm)Util.Random(1, 3); } } else { guard.Realm = guard.CurrentZone.GetRealm(); guard.ModelRealm = guard.Realm; } }
public void GetMovementOffset(GameKeepGuard guard, out int x, out int y) { int modifier = 50; x = 0; y = 0; int index = PatrolGuards.IndexOf(guard); switch (index) { case 0: x = -modifier; y = modifier; break; case 1: x = 0; y = modifier; break; case 2: x = -modifier; y = 0; break; case 3: x = 0; y = 0; break; case 4: x = -modifier; y = -modifier; break; case 5: x = 0; y = -modifier; break; } }
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; } }
/// <summary> /// Sets the guards brain /// </summary> /// <param name="guard">The guard object</param> public static void SetGuardBrain(GameKeepGuard guard) { if (guard.Brain is KeepGuardBrain == false) { KeepGuardBrain brain = new KeepGuardBrain(); if (guard is GuardCaster) brain = new CasterBrain(); else if (guard is GuardHealer) brain = new HealerBrain(); else if (guard is GuardLord) brain = new LordBrain(); guard.AddBrain(brain); brain.guard = guard; } if (guard is MissionMaster) { (guard.Brain as KeepGuardBrain).SetAggression(90, 400); } }
/// <summary> /// Gets the position at the exact entry from the database /// </summary> /// <param name="guard">The guard object</param> /// <returns>The position object</returns> public static DBKeepPosition GetPosition(GameKeepGuard guard) { return GameServer.Database.SelectObject<DBKeepPosition>("TemplateID = '" + GameServer.Database.Escape(guard.TemplateID) + "' and ComponentSkin = '" + guard.Component.Skin + "' and Height = " + guard.Component.Height) as DBKeepPosition; }
/// <summary> /// Method to Change a Patrol's Level /// /// This method handles the add and removing of guards /// </summary> public void ChangePatrolLevel() { int guardsToPatrol = 1; if (Component != null && Component.AbstractKeep != null && Component.AbstractKeep is GameKeep) { guardsToPatrol++; if (Component.AbstractKeep.Level > 4) { guardsToPatrol++; } } PatrolPath = PositionMgr.LoadPatrolPath(PatrolID, Component); // Console.WriteLine(PatrolID + " guardstopatrol = " + guardsToPatrol + ", count = " + PatrolGuards.Count); while (guardsToPatrol > PatrolGuards.Count) { CreatePatrolGuard(PatrolGuards.Count); } int x = 0; int y = 0; List <GameKeepGuard> guardsToKeep = new List <GameKeepGuard>(); for (int i = 0; i < PatrolGuards.Count; i++) { GameKeepGuard guard = PatrolGuards[i] as GameKeepGuard; // Console.WriteLine(PatrolID + " loading guard " + guard.Name); if (i < guardsToPatrol) { // we need to reposition the patrol at their spawn point plus variation if (x == 0) { x = guard.SpawnPoint.X; y = guard.SpawnPoint.Y; } else { x += Util.Random(250, 350); y += Util.Random(250, 350); } if (guard.IsAlive) { if (guard.IsMovingOnPath) { guard.StopMovingOnPath(); } guard.MoveTo(guard.CurrentRegionID, x, y, guard.SpawnPoint.Z, guard.SpawnHeading); } guardsToKeep.Add(guard); } else { guard.Delete(); } } PatrolGuards = guardsToKeep; StartPatrol(); }
/// <summary> /// Sends message to guild for guard death with enemy count in area /// </summary> /// <param name="guard">The guard object</param> public static void GuardSpam(GameKeepGuard guard) { if (guard.Component == null) return; if (guard.Component.AbstractKeep == null) return; if (guard.Component.AbstractKeep.Guild == null) return; int inArea = guard.GetEnemyCountInArea(); string message = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "GameKeepGuard.GuardSpam.Killed", guard.Name, guard.Component.AbstractKeep.Name, inArea); KeepGuildMgr.SendMessageToGuild(message, guard.Component.AbstractKeep.Guild); }
public virtual void SetGuardLevel(GameKeepGuard guard) { if (guard is FrontierHastener) { guard.Level = 1; } else { int bonusLevel = 0; double multiplier = ServerProperties.Properties.KEEP_GUARD_LEVEL_MULTIPLIER; if (guard.Component != null) { // level is usually 4 unless upgraded, BaseLevel is usually 50 bonusLevel = guard.Component.AbstractKeep.Level; if (guard.Component.AbstractKeep is GameKeepTower) multiplier = ServerProperties.Properties.TOWER_GUARD_LEVEL_MULTIPLIER; } guard.Level = (byte)(GetBaseLevel(guard) + (bonusLevel * multiplier)); } }
/// <summary> /// Sets a guards model /// </summary> /// <param name="guard">The guard object</param> private static void SetGuardModel(GameKeepGuard guard) { if(!ServerProperties.Properties.AUTOMODEL_GUARDS_LOADED_FROM_DB && !guard.LoadedFromScript) { return; } if (guard is FrontierHastener) { switch (guard.Realm) { case eRealm.None: case eRealm.Albion: { guard.Model = AlbionHastener; guard.Size = 45; break; } case eRealm.Midgard: { guard.Model = MidgardHastener; guard.Size = 50; guard.Flags ^= GameNPC.eFlags.GHOST; break; } case eRealm.Hibernia: { guard.Model = HiberniaHastener; guard.Size = 45; break; } } return; } switch (guard.ModelRealm) { #region None case eRealm.None: #endregion #region Albion case eRealm.Albion: { if (guard is GuardArcher) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 3)) { case 0: guard.Model = SaracenMale; break;//Saracen Male case 1: guard.Model = HighlanderMale; break;//Highlander Male case 2: guard.Model = BritonMale; break;//Briton Male case 3: guard.Model = IcconuMale; break;//Icconu Male } } else { switch (Util.Random(0, 3)) { case 0: guard.Model = SaracenFemale; break;//Saracen Female case 1: guard.Model = HighlanderFemale; break;//Highlander Female case 2: guard.Model = BritonFemale; break;//Briton Female case 3: guard.Model = IcconuFemale; break;//Icconu Female } } } else if (guard is GuardCaster) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 2)) { case 0: guard.Model = AvalonianMale; break;//Avalonian Male case 1: guard.Model = BritonMale; break;//Briton Male case 2: guard.Model = HalfOgreMale; break;//Half Ogre Male } } else { switch (Util.Random(0, 2)) { case 0: guard.Model = AvalonianFemale; break;//Avalonian Female case 1: guard.Model = BritonFemale; break;//Briton Female case 2: guard.Model = HalfOgreFemale; break;//Half Ogre Female } } } else if (guard is GuardFighter) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 6)) { case 0: guard.Model = HighlanderMale; break;//Highlander Male case 1: guard.Model = BritonMale; break;//Briton Male case 2: guard.Model = SaracenMale; break;//Saracen Male case 3: guard.Model = AvalonianMale; break;//Avalonian Male case 4: guard.Model = HalfOgreMale; break;//Half Ogre Male case 5: guard.Model = IcconuMale; break;//Icconu Male case 6: guard.Model = MinotaurMaleAlb; break;//Minotuar } } else { switch (Util.Random(0, 5)) { case 0: guard.Model = HighlanderFemale; break;//Highlander Female case 1: guard.Model = BritonFemale; break;//Briton Female case 2: guard.Model = SaracenFemale; break;//Saracen Female case 3: guard.Model = AvalonianFemale; break;//Avalonian Female case 4: guard.Model = HalfOgreFemale; break;//Half Ogre Female case 5: guard.Model = IcconuFemale; break;//Icconu Female } } } else if (guard is GuardHealer) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 2)) { case 0: guard.Model = HighlanderMale; break;//Highlander Male case 1: guard.Model = BritonMale; break;//Briton Male case 2: guard.Model = AvalonianMale; break;//Avalonian Male } } else { switch (Util.Random(0, 2)) { case 0: guard.Model = HighlanderFemale; break;//Highlander Female case 1: guard.Model = BritonFemale; break;//Briton Female case 2: guard.Model = AvalonianFemale; break;//Avalonian Female } } } else if (guard is GuardLord || guard is MissionMaster) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 3)) { case 0: guard.Model = HighlanderMale; break;//Highlander Male case 1: guard.Model = BritonMale; break;//Briton Male case 2: guard.Model = AvalonianMale; break;//Avalonian Male case 3: guard.Model = MinotaurMaleAlb; break;//Minotaur } } else { switch (Util.Random(0, 2)) { case 0: guard.Model = HighlanderFemale; break;//Highlander Female case 1: guard.Model = BritonFemale; break;//Briton Female case 2: guard.Model = AvalonianFemale; break;//Avalonian Female } } } else if (guard is GuardStealther) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 2)) { case 0: guard.Model = SaracenMale; break;//Saracen Male case 1: guard.Model = BritonMale; break;//Briton Male case 2: guard.Model = IcconuMale; break;//Icconu Male } } else { switch (Util.Random(0, 2)) { case 0: guard.Model = SaracenFemale; break;//Saracen Female case 1: guard.Model = BritonFemale; break;//Briton Female case 2: guard.Model = IcconuFemale; break;//Icconu Female } } } break; } #endregion #region Midgard case eRealm.Midgard: { if (guard is GuardArcher) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 4)) { case 0: guard.Model = NorseMale; break;//Norse Male case 1: guard.Model = KoboldMale; break;//Kobold Male case 2: guard.Model = DwarfMale; break;//Dwarf Male case 3: guard.Model = ValkynMale; break;//Valkyn Male case 4: guard.Model = FrostalfMale; break;//Frostalf Male } } else { switch (Util.Random(0, 4)) { case 0: guard.Model = NorseFemale; break;//Norse Female case 1: guard.Model = KoboldFemale; break;//Kobold Female case 2: guard.Model = DwarfFemale; break;//Dwarf Female case 3: guard.Model = ValkynFemale; break;//Valkyn Female case 4: guard.Model = FrostalfFemale; break;//Frostalf Female } } } else if (guard is GuardCaster) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 3)) { case 0: guard.Model = KoboldMale; break;//Kobold Male case 1: guard.Model = NorseMale; break;//Norse Male case 2: guard.Model = DwarfMale; break;//Dwarf Male case 3: guard.Model = FrostalfMale; break;//Frostalf Male } } else { switch (Util.Random(0, 3)) { case 0: guard.Model = KoboldFemale; break;//Kobold Female case 1: guard.Model = NorseFemale; break;//Norse Female case 2: guard.Model = DwarfFemale; break;//Dwarf Female case 3: guard.Model = FrostalfFemale; break;//Frostalf Female } } } else if (guard is GuardFighter) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 5)) { case 0: guard.Model = TrollMale; break;//Troll Male case 1: guard.Model = NorseMale; break;//Norse Male case 2: guard.Model = DwarfMale; break;//Dwarf Male case 3: guard.Model = KoboldMale; break;//Kobold Male case 4: guard.Model = ValkynMale; break;//Valkyn Male case 5: guard.Model = MinotaurMaleMid; break;//Minotaur } } else { switch (Util.Random(0, 4)) { case 0: guard.Model = TrollFemale; break;//Troll Female case 1: guard.Model = NorseFemale; break;//Norse Female case 2: guard.Model = DwarfFemale; break;//Dwarf Female case 3: guard.Model = KoboldFemale; break;//Kobold Female case 4: guard.Model = ValkynFemale; break;//Valkyn Female } } } else if (guard is GuardHealer) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 2)) { case 0: guard.Model = DwarfMale; break;//Dwarf Male case 1: guard.Model = NorseMale; break;//Norse Male case 2: guard.Model = FrostalfMale; break;//Frostalf Male } } else { switch (Util.Random(0, 2)) { case 0: guard.Model = DwarfFemale; break;//Dwarf Female case 1: guard.Model = NorseFemale; break;//Norse Female case 2: guard.Model = FrostalfFemale; break;//Frostalf Female } } } else if (guard is GuardLord || guard is MissionMaster) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 4)) { case 0: guard.Model = DwarfMale; break;//Dwarf Male case 1: guard.Model = NorseMale; break;//Norse Male case 2: guard.Model = TrollMale; break;//Troll Male case 3: guard.Model = KoboldMale; break;//Kobold Male case 4: guard.Model = MinotaurMaleMid; break;//Minotaur } } else { switch (Util.Random(0, 3)) { case 0: guard.Model = DwarfFemale; break;//Dwarf Female case 1: guard.Model = NorseFemale; break;//Norse Female case 2: guard.Model = TrollFemale; break;//Troll Female case 3: guard.Model = KoboldFemale; break;//Kobold Female } } } else if (guard is GuardStealther) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 2)) { case 0: guard.Model = KoboldMale; break;//Kobold Male case 1: guard.Model = NorseMale; break;//Norse Male case 2: guard.Model = ValkynMale; break;//Valkyn Male } } else { switch (Util.Random(0, 2)) { case 0: guard.Model = KoboldFemale; break;//Kobold Female case 1: guard.Model = NorseFemale; break;//Norse Female case 2: guard.Model = ValkynFemale; break;//Valkyn Female } } } break; } #endregion #region Hibernia case eRealm.Hibernia: { if (guard is GuardArcher) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 3)) { case 0: guard.Model = LurikeenMale; break;//Lurikeen Male case 1: guard.Model = ElfMale; break;//Elf Male case 2: guard.Model = CeltMale; break;//Celt Male case 3: guard.Model = SharMale; break;//Shar Male } } else { switch (Util.Random(0, 3)) { case 0: guard.Model = LurikeenFemale; break;//Lurikeen Female case 1: guard.Model = ElfFemale; break;//Elf Female case 2: guard.Model = CeltFemale; break;//Celt Female case 3: guard.Model = SharFemale; break;//Shar Female } } } else if (guard is GuardCaster) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 1)) { case 0: guard.Model = ElfMale; break;//Elf Male case 1: guard.Model = LurikeenMale; break;//Lurikeen Male } } else { switch (Util.Random(0, 1)) { case 0: guard.Model = ElfFemale; break;//Elf Female case 1: guard.Model = LurikeenFemale; break;//Lurikeen Female } } } else if (guard is GuardFighter) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 4)) { case 0: guard.Model = FirbolgMale; break;//Firbolg Male case 1: guard.Model = LurikeenMale; break;//Lurikeen Male case 2: guard.Model = CeltMale; break;//Celt Male case 3: guard.Model = SharMale; break;//Shar Male case 4: guard.Model = MinotaurMaleHib; break;//Minotaur } } else { switch (Util.Random(0, 3)) { case 0: guard.Model = FirbolgFemale; break;//Firbolg Female case 1: guard.Model = LurikeenFemale; break;//Lurikeen Female case 2: guard.Model = CeltFemale; break;//Celt Female case 3: guard.Model = SharFemale; break;//Shar Female } } } else if (guard is GuardHealer) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 2)) { case 0: guard.Model = CeltMale; break;//Celt Male case 1: guard.Model = FirbolgMale; break;//Firbolg Male case 2: guard.Model = SylvianMale; break;//Sylvian Male } } else { switch (Util.Random(0, 2)) { case 0: guard.Model = CeltFemale; break;//Celt Female case 1: guard.Model = FirbolgFemale; break;//Firbolg Female case 2: guard.Model = SylvianFemale; break;//Sylvian Female } } } else if (guard is GuardLord || guard is MissionMaster) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 4)) { case 0: guard.Model = CeltMale; break;//Celt Male case 1: guard.Model = FirbolgMale; break;//Firbolg Male case 2: guard.Model = LurikeenMale; break;//Lurikeen Male case 3: guard.Model = ElfMale; break;//Elf Male case 4: guard.Model = MinotaurMaleHib; break;//Minotaur } } else { switch (Util.Random(0, 3)) { case 0: guard.Model = CeltFemale; break;//Celt Female case 1: guard.Model = FirbolgFemale; break;//Firbolg Female case 2: guard.Model = LurikeenFemale; break;//Lurikeen Female case 3: guard.Model = ElfFemale; break;//Elf Female } } } else if (guard is GuardStealther) { if (guard.Gender == eGender.Male) { switch (Util.Random(0, 1)) { case 0: guard.Model = ElfMale; break;//Elf Male case 1: guard.Model = LurikeenMale; break;//Lurikeen Male } } else { switch (Util.Random(0, 1)) { case 0: guard.Model = ElfFemale; break;//Elf Female case 1: guard.Model = LurikeenFemale; break;//Lurikeen Female } } } break; } #endregion } }
private static void SetGuardGender(GameKeepGuard guard) { //portal keep guards are always male if (guard.IsPortalKeepGuard) { guard.Gender = eGender.Male; } else { if (Util.Chance(50)) { guard.Gender = eGender.Male; } else { guard.Gender = eGender.Female; } } }
public static void SetGuardLevel(GameKeepGuard guard) { if (guard.Component != null) { guard.Component.Keep.SetGuardLevel(guard); } }
/// <summary> /// Sets a guards stats /// </summary> /// <param name="guard">The guard object</param> private static void SetGuardStats(GameKeepGuard guard) { if (guard is GuardLord) { guard.Strength = (short)(20 + (guard.Level * 8)); guard.Dexterity = (short)(guard.Level * 2); guard.Constitution = (short)(DOL.GS.ServerProperties.Properties.GAMENPC_BASE_CON); guard.Quickness = 60; } else { guard.Strength = (short)(20 + (guard.Level * 7)); guard.Dexterity = (short)(guard.Level); guard.Constitution = (short)(DOL.GS.ServerProperties.Properties.GAMENPC_BASE_CON); guard.Quickness = 40; } }
/// <summary> /// Sets a guards name /// </summary> /// <param name="guard">The guard object</param> private static void SetGuardName(GameKeepGuard guard) { if (guard is FrontierHastener) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Hastener"); return; } if (guard is GuardLord) { if (guard.Component == null) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Commander", guard.CurrentZone.Description); return; } else if (guard.IsTowerGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.TowerCaptain"); return; } } switch (guard.ModelRealm) { case eRealm.None: case eRealm.Albion: { if (guard is GuardArcher) { if (guard.IsPortalKeepGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.BowmanCommander"); } else { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Scout"); } } else if (guard is GuardCaster) { if (guard.IsPortalKeepGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.MasterWizard"); } else { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Wizard"); } } else if (guard is GuardFighter) { if (guard.IsPortalKeepGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.KnightCommander"); } else { if (guard.Gender == eGender.Male) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Armsman"); } else { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Armswoman"); } } } else if (guard is GuardHealer) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Cleric"); } else if (guard is GuardLord) { if (guard.Gender == eGender.Male) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Lord", GetKeepShortName(guard.Component.AbstractKeep.Name)); } else { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Lady", GetKeepShortName(guard.Component.AbstractKeep.Name)); } } else if (guard is GuardStealther) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Infiltrator"); } else if (guard is MissionMaster) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.CaptainCommander"); } break; } case eRealm.Midgard: { if (guard is GuardArcher) { if (guard.IsPortalKeepGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.NordicHunter"); } else { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Hunter"); } } else if (guard is GuardCaster) { if (guard.IsPortalKeepGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.MasterRunes"); } else { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Runemaster"); } } else if (guard is GuardFighter) { if (guard.IsPortalKeepGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.NordicJarl"); } else { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Huscarl"); } } else if (guard is GuardHealer) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Healer"); } else if (guard is GuardLord) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Jarl", GetKeepShortName(guard.Component.AbstractKeep.Name)); } else if (guard is GuardStealther) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Shadowblade"); } else if (guard is MissionMaster) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.HersirCommander"); } break; } case eRealm.Hibernia: { if (guard is GuardArcher) { if (guard.IsPortalKeepGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.MasterRanger"); } else { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Ranger"); } } else if (guard is GuardCaster) { if (guard.IsPortalKeepGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.MasterEldritch"); } else { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Eldritch"); } } else if (guard is GuardFighter) { if (guard.IsPortalKeepGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Champion"); } else { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Guardian"); } } else if (guard is GuardHealer) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Druid"); } else if (guard is GuardLord) { if (guard.Gender == eGender.Male) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Chieftain", GetKeepShortName(guard.Component.AbstractKeep.Name)); } else { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Chieftess", GetKeepShortName(guard.Component.AbstractKeep.Name)); } } else if (guard is GuardStealther) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Nightshade"); } else if (guard is MissionMaster) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.ChampionCommander"); } break; } } if (guard.Realm == eRealm.None) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Renegade", guard.Name); } }
public virtual byte GetBaseLevel(GameKeepGuard guard) { if (guard.Component == null) { if (guard is GuardLord) return 75; else return 65; } if (guard is GuardLord) { if (guard.Component.AbstractKeep is GameKeep) return (byte)(guard.Component.AbstractKeep.BaseLevel + ((guard.Component.AbstractKeep.BaseLevel / 10) + 1) * 2); else return (byte)(guard.Component.AbstractKeep.BaseLevel + 2); // flat increase for tower captains } if (guard.Component.AbstractKeep is GameKeep) return (byte)(guard.Component.AbstractKeep.BaseLevel + 1); return guard.Component.AbstractKeep.BaseLevel; }
/// <summary> /// Gets the most usable position directly from the database /// </summary> /// <param name="guard">The guard object</param> /// <returns>The position object</returns> public static DBKeepPosition GetUsablePosition(GameKeepGuard guard) { return GameServer.Database.SelectObjects<DBKeepPosition>("`ClassType` != @ClassType AND `TemplateID` = @TemplateID AND `ComponentSkin` = @ComponentSkin AND `Height` <= @Height", new [] { new QueryParameter("@ClassType", "DOL.GS.Keeps.Banner"), new QueryParameter("@TemplateID", guard.TemplateID), new QueryParameter("@ComponentSkin", guard.Component.Skin), new QueryParameter("@Height", guard.Component.Height) }) .OrderByDescending(it => it.Height).FirstOrDefault(); }
/// <summary> /// Checks if a keep guard is an enemy of the player /// </summary> /// <param name="checker">The guard checker</param> /// <param name="target">The player target</param> /// <returns>true if the player is an enemy of the guard</returns> public static bool IsEnemy(GameKeepGuard checker, GamePlayer target) { if (checker.Component == null || checker.Component.Keep == null) return GameServer.ServerRules.IsAllowedToAttack(checker, target, true); return IsEnemy(checker.Component.Keep, target); }
/// <summary> /// Gets the position at the exact entry from the database /// </summary> /// <param name="guard">The guard object</param> /// <returns>The position object</returns> public static DBKeepPosition GetPosition(GameKeepGuard guard) { return GameServer.Database.SelectObjects<DBKeepPosition>("`TemplateID` = @TemplateID AND `ComponentSkin` = @ComponentSkin AND `Height` <= @Height", new [] { new QueryParameter("@TemplateID", guard.TemplateID), new QueryParameter("@ComponentSkin", guard.Component.Skin), new QueryParameter("@Height", guard.Component.Height) }).FirstOrDefault(); }
public virtual bool IsEnemy(GameKeepGuard checker, GamePlayer target, bool checkGroup) { if (checker.Component == null || checker.Component.AbstractKeep == null) return GameServer.ServerRules.IsAllowedToAttack(checker, target, true); return IsEnemy(checker.Component.AbstractKeep, target, checkGroup); }
/// <summary> /// Sets a guards name /// </summary> /// <param name="guard">The guard object</param> private static void SetGuardName(GameKeepGuard guard) { if (guard is FrontierHastener) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Hastener"); return; } if (guard is GuardLord) { if (guard.Component == null) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Commander", guard.CurrentZone.Description); return; } else if (guard.IsTowerGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.TowerCaptain"); return; } } switch (guard.ModelRealm) { #region Albion / None case eRealm.None: case eRealm.Albion: { if (guard is GuardArcher) { if (guard.IsPortalKeepGuard) guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.BowmanCommander"); else guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Scout"); } else if (guard is GuardCaster) { if (guard.IsPortalKeepGuard) guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.MasterWizard"); else guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Wizard"); } else if (guard is GuardFighter) { if (guard.IsPortalKeepGuard) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.KnightCommander"); } else { if (guard.Gender == eGender.Male) guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Armsman"); else guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Armswoman"); } } else if (guard is GuardHealer) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Cleric"); } else if (guard is GuardLord) { if (guard.Gender == eGender.Male) guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Lord", GetKeepShortName(guard.Component.Keep.Name)); else guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Lady", GetKeepShortName(guard.Component.Keep.Name)); } else if (guard is GuardStealther) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Infiltrator"); } else if (guard is MissionMaster) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.CaptainCommander"); } break; } #endregion #region Midgard case eRealm.Midgard: { if (guard is GuardArcher) { if (guard.IsPortalKeepGuard) guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.NordicHunter"); else guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Hunter"); } else if (guard is GuardCaster) { if (guard.IsPortalKeepGuard) guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.MasterRunes"); else guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Runemaster"); } else if (guard is GuardFighter) { if (guard.IsPortalKeepGuard) guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.NordicJarl"); else guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Huscarl"); } else if (guard is GuardHealer) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Healer"); } else if (guard is GuardLord) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Jarl", GetKeepShortName(guard.Component.Keep.Name)); } else if (guard is GuardStealther) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Shadowblade"); } else if (guard is MissionMaster) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.HersirCommander"); } break; } #endregion #region Hibernia case eRealm.Hibernia: { if (guard is GuardArcher) { if (guard.IsPortalKeepGuard) guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.MasterRanger"); else guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Ranger"); } else if (guard is GuardCaster) { if (guard.IsPortalKeepGuard) guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.MasterEldritch"); else guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Eldritch"); } else if (guard is GuardFighter) { if (guard.IsPortalKeepGuard) guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Champion"); else guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Guardian"); } else if (guard is GuardHealer) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Druid"); } else if (guard is GuardLord) { if (guard.Gender == eGender.Male) guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Chieftain", GetKeepShortName(guard.Component.Keep.Name)); else guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Chieftess", GetKeepShortName(guard.Component.Keep.Name)); } else if (guard is GuardStealther) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Nightshade"); } else if (guard is MissionMaster) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.ChampionCommander"); } break; } #endregion } if (guard.Realm == eRealm.None) { guard.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "SetGuardName.Renegade", guard.Name); } }
/// <summary> /// Method to equip a guard /// </summary> /// <param name="guard">The guard object</param> public static void EquipGuard(GameKeepGuard guard) { if(!ServerProperties.Properties.AUTOEQUIP_GUARDS_LOADED_FROM_DB && !guard.LoadedFromScript) { return; } if (guard is FrontierHastener) { switch (guard.Realm) { case eRealm.None: case eRealm.Albion: case eRealm.Hibernia: case eRealm.Midgard: { guard.Inventory = ClothingMgr.Midgard_Hastener.CloneTemplate(); break; } } } switch (guard.ModelRealm) { case eRealm.None: case eRealm.Albion: { if (guard is GuardFighter) { if (guard.IsPortalKeepGuard) guard.Inventory = ClothingMgr.Albion_FighterPK.CloneTemplate(); else guard.Inventory = ClothingMgr.Albion_Fighter.CloneTemplate(); } else if (guard is GuardLord || guard is MissionMaster) guard.Inventory = ClothingMgr.Albion_Lord.CloneTemplate(); else if (guard is GuardHealer) guard.Inventory = ClothingMgr.Albion_Healer.CloneTemplate(); else if (guard is GuardArcher) { if (guard.IsPortalKeepGuard) guard.Inventory = ClothingMgr.Albion_ArcherPK.CloneTemplate(); else guard.Inventory = ClothingMgr.Albion_Archer.CloneTemplate(); } else if (guard is GuardCaster) { if (guard.IsPortalKeepGuard) guard.Inventory = ClothingMgr.Albion_CasterPK.CloneTemplate(); else guard.Inventory = ClothingMgr.Albion_Caster.CloneTemplate(); } else if (guard is GuardStealther) guard.Inventory = ClothingMgr.Albion_Stealther.CloneTemplate(); break; } case eRealm.Midgard: { if (guard is GuardFighter) { if (guard.IsPortalKeepGuard) guard.Inventory = ClothingMgr.Midgard_FighterPK.CloneTemplate(); else guard.Inventory = ClothingMgr.Midgard_Fighter.CloneTemplate(); } else if (guard is GuardLord || guard is MissionMaster) guard.Inventory = ClothingMgr.Midgard_Lord.CloneTemplate(); else if (guard is GuardHealer) guard.Inventory = ClothingMgr.Midgard_Healer.CloneTemplate(); else if (guard is GuardArcher) { if (guard.IsPortalKeepGuard) guard.Inventory = ClothingMgr.Midgard_ArcherPK.CloneTemplate(); else guard.Inventory = ClothingMgr.Midgard_Archer.CloneTemplate(); } else if (guard is GuardCaster) { if (guard.IsPortalKeepGuard) guard.Inventory = ClothingMgr.Midgard_CasterPK.CloneTemplate(); else guard.Inventory = ClothingMgr.Midgard_Caster.CloneTemplate(); } else if (guard is GuardStealther) guard.Inventory = ClothingMgr.Midgard_Stealther.CloneTemplate(); break; } case eRealm.Hibernia: { if (guard is GuardFighter) { if (guard.IsPortalKeepGuard) guard.Inventory = ClothingMgr.Hibernia_FighterPK.CloneTemplate(); else guard.Inventory = ClothingMgr.Hibernia_Fighter.CloneTemplate(); } else if (guard is GuardLord || guard is MissionMaster) guard.Inventory = ClothingMgr.Hibernia_Lord.CloneTemplate(); else if (guard is GuardHealer) guard.Inventory = ClothingMgr.Hibernia_Healer.CloneTemplate(); else if (guard is GuardArcher) { if (guard.IsPortalKeepGuard) guard.Inventory = ClothingMgr.Hibernia_ArcherPK.CloneTemplate(); else guard.Inventory = ClothingMgr.Hibernia_Archer.CloneTemplate(); } else if (guard is GuardCaster) { if (guard.IsPortalKeepGuard) guard.Inventory = ClothingMgr.Hibernia_CasterPK.CloneTemplate(); else guard.Inventory = ClothingMgr.Hibernia_Caster.CloneTemplate(); } else if (guard is GuardStealther) guard.Inventory = ClothingMgr.Hibernia_Stealther.CloneTemplate(); break; } } if (guard.Inventory == null) { GameServer.KeepManager.Log.Warn("Clothing Manager: Guard Inventory is null for " + guard.GetType().ToString()); return; } GameNpcInventoryTemplate template = guard.Inventory as GameNpcInventoryTemplate; guard.Inventory = new GameNPCInventory(template); const int renegadeArmorColor = 19; InventoryItem item = null; item = guard.Inventory.GetItem(eInventorySlot.TorsoArmor); if (item != null) { if (guard.Realm != eRealm.None) { item.Extension = (int)eExtension.Five; } else { item.Extension = (int)eExtension.Four; item.Color = renegadeArmorColor; } } item = guard.Inventory.GetItem(eInventorySlot.HandsArmor); if (item != null) { if (guard.Realm != eRealm.None) { item.Extension = (int)eExtension.Five; } else { item.Extension = (int)eExtension.Four; item.Color = renegadeArmorColor; } } item = guard.Inventory.GetItem(eInventorySlot.FeetArmor); if (item != null) { if (guard.Realm != eRealm.None) { item.Extension = (int)eExtension.Five; } else { item.Extension = (int)eExtension.Four; item.Color = renegadeArmorColor; } } if (guard.Realm == eRealm.None) { item = guard.Inventory.GetItem(eInventorySlot.Cloak); if (item != null) { item.Model = 3632; item.Color = renegadeArmorColor; } item = guard.Inventory.GetItem(eInventorySlot.TorsoArmor); if (item != null) { item.Color = renegadeArmorColor; } item = guard.Inventory.GetItem(eInventorySlot.ArmsArmor); if (item != null) { item.Color = renegadeArmorColor; } item = guard.Inventory.GetItem(eInventorySlot.LegsArmor); if (item != null) { item.Color = renegadeArmorColor; } } // set the active slot // casters use two handed weapons as default // archers use distance weapons as default if (guard is GuardCaster) guard.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded); else if (guard is GuardArcher) guard.SwitchWeapon(GameLiving.eActiveWeaponSlot.Distance); else if ((guard is GuardFighter || guard is GuardLord) && Util.Chance(50)) guard.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded); else guard.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard); }
/// <summary> /// We need an event after an attack is finished so we know when players are unreachable by archery /// </summary> /// <param name="e"></param> /// <param name="sender"></param> /// <param name="arguments"></param> public static void AttackFinished(DOLEvent e, object sender, EventArgs arguments) { GameKeepGuard guard = sender as GameKeepGuard; if (guard.TargetObject == null) { return; } if (!guard.AttackState) { return; } if (guard is GuardArcher == false && guard is GuardLord == false && guard is GuardCaster == false) { return; } AttackFinishedEventArgs afargs = arguments as AttackFinishedEventArgs; if (guard.ActiveWeaponSlot != eActiveWeaponSlot.Distance && !guard.IsMoving) { eAttackResult result = afargs.AttackData.AttackResult; if (result == eAttackResult.OutOfRange) { guard.StopAttack(); lock (guard.Attackers) { foreach (GameLiving living in guard.Attackers) { if (guard.IsWithinRadius(living, guard.AttackRange)) { guard.StartAttack(living); return; } } } if (guard.IsWithinRadius(guard.TargetObject, guard.AttackRangeDistance)) { if (guard.MaxSpeedBase == 0 || (guard is GuardArcher && !guard.BeenAttackedRecently)) { guard.SwitchToRanged(guard.TargetObject); } } } return; } if (guard.ActiveWeaponSlot == eActiveWeaponSlot.Distance) { if (GameServer.ServerRules.IsAllowedToAttack(guard, guard.TargetObject as GameLiving, true) == false) { guard.StopAttack(); return; } if (!guard.IsWithinRadius(guard.TargetObject, guard.AttackRange)) { guard.StopAttack(); return; } } GamePlayer player = null; if (guard.TargetObject is GamePlayer) { player = guard.TargetObject as GamePlayer; } else if (guard.TargetObject is GameNPC) { GameNPC npc = (guard.TargetObject as GameNPC); if (npc.Brain != null && ((npc is GameKeepGuard) == false) && npc.Brain is IControlledBrain) { player = (npc.Brain as IControlledBrain).GetPlayerOwner(); } } if (player != null) { player.Out.SendCheckLOS(guard, guard.TargetObject, new CheckLOSResponse(guard.GuardStopAttackCheckLOS)); } }
/// <summary> /// Method to Set an Emblem to a Guards equipment /// </summary> /// <param name="guard">The guard object</param> public static void SetEmblem(GameKeepGuard guard) { if (guard.Inventory == null) return; if (guard.Component == null) return; int emblem = 0; if (guard.Component.AbstractKeep.Guild != null) { emblem = guard.Component.AbstractKeep.Guild.Emblem; } InventoryItem cloak = guard.Inventory.GetItem(eInventorySlot.Cloak); if (cloak != null) { cloak.Emblem = emblem; if (cloak.Emblem != 0) cloak.Model = 558; // change to a model that looks ok with an emblem } InventoryItem shield = guard.Inventory.GetItem(eInventorySlot.LeftHandWeapon); if (shield != null) { shield.Emblem = emblem; } guard.BroadcastLivingEquipmentUpdate(); }
/// <summary> /// Gets the most usable position directly from the database /// </summary> /// <param name="guard">The guard object</param> /// <returns>The position object</returns> public static DBKeepPosition GetUsablePosition(GameKeepGuard guard) { return GameServer.Database.SelectObject<DBKeepPosition>("ClassType != 'DOL.GS.Keeps.Banner' and TemplateID = '" + GameServer.Database.Escape(guard.TemplateID) + "' and ComponentSkin = '" + guard.Component.Skin + "' and Height <= " + guard.Component.Height + " order by Height desc limit 0,1") as DBKeepPosition; }