/// <summary> /// Gets the string to draw for a list item. /// </summary> /// <param name="x">The list item.</param> /// <returns>The string to draw for a list item.</returns> static string GetDrawString(AllianceID x) { var t = AllianceManager.Instance[x]; if (t == null) return "ID " + x; else return t.ID + ". " + t.Name; }
/// <summary> /// Initializes a new instance of the <see cref="Alliance"/> class. /// </summary> /// <param name="id">The ID of this Alliance.</param> /// <param name="name">Name of the Alliance.</param> /// <param name="attackables">Information for Alliances that this Alliance can attack.</param> /// <param name="hostiles">Information for Alliances that this Alliance is hostile towards.</param> public Alliance(AllianceID id, string name, IEnumerable<AllianceAttackableTable> attackables, IEnumerable<AllianceHostileTable> hostiles) { Debug.Assert(attackables.All(x => x.AllianceID == id)); Debug.Assert(hostiles.All(x => x.AllianceID == id)); _id = id; _name = name ?? string.Empty; _hostile = hostiles.Select(x => x.HostileID).Distinct().ToCompact(); // If we have something in Hostile, we need it to also be in Attackable (doesn't make sense to be hostile // towards something you can't attack) _attackable = attackables.Select(x => x.AttackableID).Concat(_hostile).Distinct().ToCompact(); }
/// <summary> /// Initializes a new instance of the <see cref="EditorAlliance"/> class. /// </summary> /// <param name="id">The <see cref="AllianceID"/>.</param> /// <param name="dbController">The <see cref="IDbController"/>.</param> /// <exception cref="ArgumentException">No <see cref="Alliance"/> exists for the given <paramref name="id"/>.</exception> public EditorAlliance(AllianceID id, IDbController dbController) { _id = id; var table = dbController.GetQuery<SelectAllianceQuery>().Execute(id); if (table == null) { const string errmsg = "No Alliance with ID `{0}` exists."; throw new ArgumentException(string.Format(errmsg, id), "id"); } Debug.Assert(id == table.ID); Name = table.Name; var attackable = dbController.GetQuery<SelectAllianceAttackableQuery>().Execute(id); _attackable = new List<AllianceID>(attackable.Select(x => x.AttackableID)); var hostile = dbController.GetQuery<SelectAllianceHostileQuery>().Execute(id); _hostile = new List<AllianceID>(hostile.Select(x => x.HostileID)); }
/// <summary> /// Initializes a new instance of the <see cref="CharacterTemplateTable"/> class. /// </summary> /// <param name="aIID">The initial value for the corresponding property.</param> /// <param name="allianceID">The initial value for the corresponding property.</param> /// <param name="bodyID">The initial value for the corresponding property.</param> /// <param name="chatDialog">The initial value for the corresponding property.</param> /// <param name="exp">The initial value for the corresponding property.</param> /// <param name="giveCash">The initial value for the corresponding property.</param> /// <param name="giveExp">The initial value for the corresponding property.</param> /// <param name="iD">The initial value for the corresponding property.</param> /// <param name="level">The initial value for the corresponding property.</param> /// <param name="moveSpeed">The initial value for the corresponding property.</param> /// <param name="name">The initial value for the corresponding property.</param> /// <param name="respawn">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> /// <param name="statPoints">The initial value for the corresponding property.</param> /// <param name="statAgi">The initial value for the corresponding property.</param> /// <param name="statDefence">The initial value for the corresponding property.</param> /// <param name="statInt">The initial value for the corresponding property.</param> /// <param name="statMaxhit">The initial value for the corresponding property.</param> /// <param name="statMaxhp">The initial value for the corresponding property.</param> /// <param name="statMaxmp">The initial value for the corresponding property.</param> /// <param name="statMinhit">The initial value for the corresponding property.</param> /// <param name="statStr">The initial value for the corresponding property.</param> public CharacterTemplateTable(AIID? @aIID, AllianceID @allianceID, BodyID @bodyID, NPCChatDialogID? @chatDialog, Int32 @exp, UInt16 @giveCash, UInt16 @giveExp, CharacterTemplateID @iD, Byte @level, UInt16 @moveSpeed, String @name, UInt16 @respawn, ShopID? @shopID, Int32 @statPoints, Int16 @statAgi, Int16 @statDefence, Int16 @statInt, Int16 @statMaxhit, Int16 @statMaxhp, Int16 @statMaxmp, Int16 @statMinhit, Int16 @statStr) { AIID = @aIID; AllianceID = @allianceID; BodyID = @bodyID; ChatDialog = @chatDialog; Exp = @exp; GiveCash = @giveCash; GiveExp = @giveExp; ID = @iD; Level = @level; MoveSpeed = @moveSpeed; Name = @name; Respawn = @respawn; ShopID = @shopID; StatPoints = @statPoints; SetStat(StatType.Agi, @statAgi); SetStat(StatType.Defence, @statDefence); SetStat(StatType.Int, @statInt); SetStat(StatType.MaxHit, @statMaxhit); SetStat(StatType.MaxHP, @statMaxhp); SetStat(StatType.MaxMP, @statMaxmp); SetStat(StatType.MinHit, @statMinhit); SetStat(StatType.Str, @statStr); }
/// <summary> /// Initializes a new instance of the <see cref="AllianceAttackableTable"/> class. /// </summary> /// <param name="allianceID">The initial value for the corresponding property.</param> /// <param name="attackableID">The initial value for the corresponding property.</param> public AllianceAttackableTable(AllianceID @allianceID, AllianceID @attackableID) { AllianceID = @allianceID; AttackableID = @attackableID; }
/// <summary> /// Provides the extra text for the <see cref="AdvancedPropertyDescriptor"/> for a /// <see cref="AllianceID"/>. /// </summary> /// <param name="v">The value.</param> /// <returns>The extra text to display.</returns> static string ExtraTextProvider_AllianceID(AllianceID v) { var alliance = AllianceManager.Instance[v]; if (alliance == null) return null; return alliance.Name; }
/// <summary> /// Initializes a new instance of the <see cref="AllianceTable"/> class. /// </summary> /// <param name="iD">The initial value for the corresponding property.</param> /// <param name="name">The initial value for the corresponding property.</param> public AllianceTable(AllianceID @iD, String @name) { ID = @iD; Name = @name; }
/// <summary> /// Checks this Alliance is hostile towards the given Alliance. /// </summary> /// <param name="allianceID">Alliance ID to check against.</param> /// <returns>True if hostile towards the given Alliance, else false.</returns> public bool IsHostile(AllianceID allianceID) { return Hostile.Contains(allianceID); }
/// <summary> /// Checks this alliance can attack the given alliance. /// </summary> /// <param name="allianceID">Alliance ID to check against.</param> /// <returns>True if can attack the given alliance, else false.</returns> public bool CanAttack(AllianceID allianceID) { return Attackable.Contains(allianceID); }
/// <summary> /// Initializes a new instance of the <see cref="AllianceHostileTable"/> class. /// </summary> /// <param name="allianceID">The initial value for the corresponding property.</param> /// <param name="hostileID">The initial value for the corresponding property.</param> public AllianceHostileTable(AllianceID @allianceID, AllianceID @hostileID) { AllianceID = @allianceID; HostileID = @hostileID; }