Ejemplo n.º 1
0
        /// <summary>Handles client's npc text query</summary>
        /// <param name="client">realm client</param>
        /// <param name="packet">packet incoming</param>
        public static void HandleNPCTextQuery(IRealmClient client, RealmPacketIn packet)
        {
            uint id = packet.ReadUInt32();

            packet.ReadEntityId();
            IGossipEntry entry = GossipMgr.GetEntry(id);

            if (entry == null)
            {
                return;
            }
            QueryHandler.SendNPCTextUpdate(client.ActiveCharacter, entry);
        }
Ejemplo n.º 2
0
        public virtual void FinalizeDataHolder()
        {
            if (Id != 0U)
            {
                GOId = (GOEntryId)Id;
            }
            else
            {
                Id = (uint)GOId;
            }
            if (FactionId != FactionTemplateId.None)
            {
                Faction = FactionMgr.Get(FactionId);
            }
            InitEntry();
            if (GossipId != 0U && DefaultGossip == null)
            {
                if (GossipMgr.GetEntry(GossipId) == null)
                {
                    ContentMgr.OnInvalidDBData("GOEntry {0} has missing GossipId: {1}", (object)this,
                                               (object)GossipId);
                    DefaultGossip = new GossipMenu();
                }
                else
                {
                    DefaultGossip = new GossipMenu(GossipId);
                }
            }
            else if (QuestHolderInfo != null)
            {
                DefaultGossip = new GossipMenu();
            }

            if (HandlerCreator == null)
            {
                HandlerCreator = GOMgr.Handlers[(int)Type];
            }
            if (GOCreator == null)
            {
                GOCreator = !IsTransport
          ? () => new GameObject()
          : (Func <GameObject>)(() => (GameObject) new Transport());
            }
            if (Fields == null)
            {
                return;
            }
            GOMgr.Entries[Id] = this;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles client's npc text query
        /// </summary>
        /// <param name="client">realm client</param>
        /// <param name="packet">packet incoming</param>
        //[ClientPacketHandler((RealmServerOpCode.CMSG_NPC_TEXT_QUERY)]
        public static void HandleNPCTextQuery(IRealmClient client, RealmPacketIn packet)
        {
            var textId   = packet.ReadUInt32();
            var entityId = packet.ReadEntityId();

            //var obj = client.ActiveCharacter.Map.GetObject(entityId) as IGossipEntry;

            //if (obj != null)
            //{
            //    SendNPCTextUpdate(client.ActiveCharacter, obj);
            //}
            //else

            var text = GossipMgr.GetEntry(textId);

            if (text != null)
            {
                SendNPCTextUpdate(client.ActiveCharacter, text);
            }
        }
Ejemplo n.º 4
0
        public virtual void FinalizeDataHolder()
        {
            if (Id != 0)
            {
                GOId = (GOEntryId)Id;
            }
            else
            {
                Id = (uint)GOId;
            }

            if (FactionId != 0)
            {
                Faction = FactionMgr.Get(FactionId);
            }

            InitEntry();

            // create GossipMenu
            if (GossipId != 0 && DefaultGossip == null)
            {
                var gossipEntry = GossipMgr.GetEntry(GossipId);
                if (gossipEntry == null)
                {
                    ContentMgr.OnInvalidDBData("GOEntry {0} has missing GossipId: {1}", this, GossipId);
                    DefaultGossip = new GossipMenu();
                }
                else
                {
                    DefaultGossip = new GossipMenu(GossipId);
                }
            }
            else if (QuestHolderInfo != null)
            {
                // Make sure, there is a gossip menu, so quests can be started/completed
                DefaultGossip = new GossipMenu();
            }

            // set HandlerCreator
            if (HandlerCreator == null)
            {
                HandlerCreator = GOMgr.Handlers[(int)Type];
            }

            if (GOCreator == null)
            {
                if (IsTransport)
                {
                    GOCreator = () => new Transport();
                }
                else
                {
                    GOCreator = () => new GameObject();
                }
            }

            if (Fields != null)                         // ignore invalid ones
            {
                //Fields = null;
                GOMgr.Entries[Id] = this;
            }
        }