public Faction(FactionEntry entry, FactionTemplateEntry template) { this.Entry = entry; this.Template = template; this.Id = entry.Id; this.ReputationIndex = entry.FactionIndex; this.IsAlliance = template.FactionGroup.HasFlag((Enum)FactionGroupMask.Alliance); this.IsHorde = template.FactionGroup.HasFlag((Enum)FactionGroupMask.Horde); }
public Faction(FactionEntry entry, FactionTemplateEntry template) { Entry = entry; Template = template; Id = entry.Id; ReputationIndex = entry.FactionIndex; IsAlliance = template.FactionGroup.HasFlag(FactionGroupMask.Alliance); IsHorde = template.FactionGroup.HasFlag(FactionGroupMask.Horde); }
/// <summary> /// Default ctor can be used for customizing your own Faction /// </summary> public Faction() { Entry = new FactionEntry { Name = "Null Faction" }; Template = new FactionTemplateEntry { EnemyFactions = new FactionId[0], FriendlyFactions = new FactionId[0] }; }
private Faction(HashSet <Faction> enemies, HashSet <Faction> friends, HashSet <Faction> neutrals) { Enemies = enemies; Friends = friends; Neutrals = neutrals; Entry = new FactionEntry { Name = "Null Faction" }; Template = new FactionTemplateEntry { EnemyFactions = new FactionId[0], FriendlyFactions = new FactionId[0] }; }
private static void InitFactionTemplateDBC() { foreach (FactionTemplateEntry template in new MappedDBCReader <FactionTemplateEntry, FactionTemplateConverter>( RealmServerConfiguration.GetDBCFile("FactionTemplate.dbc")).Entries.Values) { FactionMgr.FactionTplEntries[template.Id] = template; if (template.FactionId != FactionId.None) { FactionEntry factionEntry = FactionMgr.FactionEntries[template.FactionId]; Faction val = new Faction(factionEntry, template); ArrayUtil.Set <Faction>(ref FactionMgr.ByTemplateId, template.Id, val); if (FactionMgr.Get(template.FactionId) == null) { ArrayUtil.Set <Faction>(ref FactionMgr.ById, (uint)factionEntry.Id, val); if (factionEntry.FactionIndex > FactionReputationIndex.None) { ArrayUtil.Set <Faction>(ref FactionMgr.ByReputationIndex, (uint)factionEntry.FactionIndex, val); } } } } (FactionMgr.ByRace[1] = FactionMgr.ById[1]).SetAlliancePlayer(); (FactionMgr.ByRace[3] = FactionMgr.ById[3]).SetAlliancePlayer(); (FactionMgr.ByRace[4] = FactionMgr.ById[4]).SetAlliancePlayer(); (FactionMgr.ByRace[7] = FactionMgr.ById[8]).SetAlliancePlayer(); (FactionMgr.ByRace[11] = FactionMgr.ById[927]).SetAlliancePlayer(); (FactionMgr.ByRace[2] = FactionMgr.ById[2]).SetHordePlayer(); (FactionMgr.ByRace[5] = FactionMgr.ById[5]).SetHordePlayer(); (FactionMgr.ByRace[6] = FactionMgr.ById[6]).SetHordePlayer(); (FactionMgr.ByRace[8] = FactionMgr.ById[9]).SetHordePlayer(); (FactionMgr.ByRace[10] = FactionMgr.ById[914]).SetHordePlayer(); foreach (Faction faction1 in FactionMgr.ById) { if (faction1 != null) { faction1.Init(); if (faction1.Entry.ParentId != FactionId.None) { Faction faction2 = FactionMgr.Get(faction1.Entry.ParentId); if (faction2 != null) { faction2.Children.Add(faction1); } } } } }
private Faction(HashSet <Faction> enemies, HashSet <Faction> friends, HashSet <Faction> neutrals) { this.Enemies = enemies; this.Friends = friends; this.Neutrals = neutrals; this.Entry = new FactionEntry() { Name = "Null Faction" }; this.Template = new FactionTemplateEntry() { EnemyFactions = new FactionId[0], FriendlyFactions = new FactionId[0] }; }
private int GetDefaultReputationValue(Faction faction) { FactionEntry entry = faction.Entry; for (int index = 0; index < 4; ++index) { if ((entry.ClassMask[index] == ClassMask.None || entry.ClassMask[index].HasAnyFlag(this.Owner.ClassMask)) && (entry.RaceMask[index] == ~RaceMask.AllRaces1 || entry.RaceMask[index].HasAnyFlag(this.Owner.RaceMask))) { return(entry.BaseRepValue[index]); } } return(0); }
private ReputationFlags GetDefaultReputationFlags(Faction faction) { FactionEntry entry = faction.Entry; for (int index = 0; index < 4; ++index) { if ((entry.ClassMask[index] == ClassMask.None || entry.ClassMask[index].HasAnyFlag(Owner.ClassMask)) && (entry.RaceMask[index] == ~RaceMask.AllRaces1 || entry.RaceMask[index].HasAnyFlag(Owner.RaceMask))) { return((ReputationFlags)entry.BaseFlags[index]); } } return(ReputationFlags.None); }