Esempio n. 1
0
        private WoWFactionTemplate(uint reqId)
        {
            init();
            FactionTemplateDbcRecord tempfactionTemplateDBC = new FactionTemplateDbcRecord();
            bool found = false;

            for (int i = 0; i < factionTemplateDB2.RecordsCount - 1; i++)
            {
                tempfactionTemplateDBC = _cachedRecords[i];
                if (tempfactionTemplateDBC.Id == reqId)
                {
                    found = true;
                    break;
                }
            }
            Record = found ? tempfactionTemplateDBC : new FactionTemplateDbcRecord();
        }
Esempio n. 2
0
        public Reaction GetReactionTowards(WoWFactionTemplate otherFaction)
        {
            FactionTemplateDbcRecord record  = Record;
            FactionTemplateDbcRecord record2 = otherFaction.Record;

            if ((record2.FightSupport & record.HostileMask) != 0)
            {
                return(Reaction.Hostile);
            }
            if (record.EnemyFactions != null)
            {
                for (int i = 0; i < 4; i++)
                {
                    if (record.EnemyFactions[i] == 0)
                    {
                        break;
                    }
                    if (record.EnemyFactions[i] == record2.FactionId)
                    {
                        return(Reaction.Hostile);
                    }
                }
            }
            if ((record2.FightSupport & record.FriendlyMask) != 0)
            {
                return(Reaction.Friendly);
            }
            if (record.FriendlyFactions != null)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (record.FriendlyFactions[j] == 0)
                    {
                        break;
                    }
                    if (record.FriendlyFactions[j] == record2.FactionId)
                    {
                        return(Reaction.Friendly);
                    }
                }
            }
            if ((record.FightSupport & record2.FriendlyMask) != 0)
            {
                return(Reaction.Friendly);
            }
            if (record2.FriendlyFactions != null)
            {
                for (int k = 0; k < 4; k++)
                {
                    if (record2.FriendlyFactions[k] == 0)
                    {
                        break;
                    }
                    if (record2.FriendlyFactions[k] == record.FactionId)
                    {
                        return(Reaction.Friendly);
                    }
                }
            }
            uint num4 = (uint)((~(record.FactionFlags >> 12) & 2) | 1);

            return((Reaction)num4);
        }