예제 #1
0
        public static void DumpFactionTemplate(FactionTemplateEntry entry, IndentTextWriter writer)
        {
            writer.WriteLine("Id: " + entry.Id);
            writer.WriteLine("FactionId: " + entry.FactionId);
            writer.WriteLine("Flags: " + entry.Flags);
            /// <summary>
            /// The Faction-Group mask of this faction.
            /// </summary>
            writer.WriteLine("FactionGroup: " + entry.FactionGroup);
            /// <summary>
            /// Mask of Faction-Groups this faction is friendly towards
            /// </summary>
            writer.WriteLine("FriendGroup: " + entry.FriendGroup);
            /// <summary>
            /// Mask of Faction-Groups this faction is hostile towards
            /// </summary>
            writer.WriteLine("EnemyGroup: " + entry.EnemyGroup);

            writer.WriteLine("Explicit Enemies:");
            writer.IndentLevel++;
            for (var i = 0; i < entry.EnemyFactions.Length; i++)
            {
                writer.WriteLine(i + ": " + entry.EnemyFactions[i]);
            }
            writer.IndentLevel--;
            writer.WriteLine("Explicit Friends:");
            writer.IndentLevel++;
            for (var i = 0; i < entry.FriendlyFactions.Length; i++)
            {
                writer.WriteLine(i + ": " + entry.FriendlyFactions[i]);
            }
            writer.IndentLevel--;
            writer.WriteLine();
        }
예제 #2
0
        public static void DumpFactionTemplate(FactionTemplateEntry entry, IndentTextWriter writer)
        {
            writer.WriteLine("Id: " + entry.Id);
            writer.WriteLine("FactionId: " + entry.FactionId);
            writer.WriteLine("Flags: " + entry.Flags);
            /// <summary>
            /// The Faction-Group mask of this faction.
            /// </summary>
            writer.WriteLine("FactionGroup: " + entry.FactionGroup);
            /// <summary>
            /// Mask of Faction-Groups this faction is friendly towards
            /// </summary>
            writer.WriteLine("FriendGroup: " + entry.FriendGroup);
            /// <summary>
            /// Mask of Faction-Groups this faction is hostile towards
            /// </summary>
            writer.WriteLine("EnemyGroup: " + entry.EnemyGroup);

            writer.WriteLine("Explicit Enemies:");
            writer.IndentLevel++;
            for (var i = 0; i < entry.EnemyFactions.Length; i++)
            {
                writer.WriteLine(i + ": " + entry.EnemyFactions[i]);
            }
            writer.IndentLevel--;
            writer.WriteLine("Explicit Friends:");
            writer.IndentLevel++;
            for (var i = 0; i < entry.FriendlyFactions.Length; i++)
            {
                writer.WriteLine(i + ": " + entry.FriendlyFactions[i]);
            }
            writer.IndentLevel--;
            writer.WriteLine();
        }
예제 #3
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] };
		}
예제 #4
0
		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);
		}
예제 #5
0
        public static void HandleGossipHello(ref PacketReader packet, ref WorldSession session)
        {
            Log.outDebug("WORLD: Received CMSG_GOSSIP_HELLO");

            ulong guid = packet.ReadUInt64();

            Creature unit = session.GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.Gossip);

            if (unit == null)
            {
                Log.outDebug("WORLD: HandleGossipHelloOpcode - Unit (GUID: {0}) not found or you can not interact with him.", ObjectGuid.GuidLowPart(guid));
                return;
            }

            // set faction visible if needed
            FactionTemplateEntry factionTemplateEntry = DBCStorage.FactionTemplateStorage.LookupByKey(unit.getFaction());

            if (factionTemplateEntry != null)
            {
                session.GetPlayer().GetReputationMgr().SetVisible(factionTemplateEntry);
            }

            //GetPlayer()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);

            //if (unit.isArmorer() || unit.isCivilian() || unit.isQuestGiver() || unit.isServiceProvider() || unit.isGuard())
            //unit.StopMoving();

            // If spiritguide, no need for gossip menu, just put player into resurrect queue
            //if (unit.isSpiritGuide())
            {
                //Battleground* bg = _player->GetBattleground();
                //if (bg)
                {
                    //bg->AddPlayerToResurrectQueue(unit->GetGUID(), _player->GetGUID());
                    //sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, unit->GetGUID());
                    //return;
                }
            }

            //if (!sScriptMgr->OnGossipHello(_player, unit))
            {
                //        _player->TalkedToCreature(unit->GetEntry(), unit->GetGUID());
                //_player->PrepareGossipMenu(unit, unit->GetCreatureTemplate()->GossipMenuId, true);
                //_player->SendPreparedGossip(unit);
            }
            //unit.AI()->sGossipHello(_player);
        }
예제 #6
0
        public void SetVisible(FactionTemplateEntry factionTemplateEntry)
        {
            if (factionTemplateEntry.faction == 0)
            {
                return;
            }

            var factionEntry = DBCStorage.FactionStorage.LookupByKey(factionTemplateEntry.faction);

            if (factionEntry.ID != 0)
            {
                // Never show factions of the opposing team
                if (!Convert.ToBoolean(factionEntry.BaseRepRaceMask[1] & _player.getRaceMask()) && factionEntry.BaseRepValue[1] == Reputation_Bottom)
                {
                    SetVisible(factionEntry);
                }
            }
        }
예제 #7
0
 public ReputationRank GetForcedRankIfAny(FactionTemplateEntry factionTemplateEntry)
 {
     return(_forcedReactions.LookupByKey(factionTemplateEntry.faction));
 }