コード例 #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);
        }
コード例 #2
0
ファイル: GOEntry.cs プロジェクト: 0xFh/Asda2-Project
        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;
        }
コード例 #3
0
ファイル: QueryHandler.cs プロジェクト: 0xFh/Asda2-Project
        /// <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);
            }
        }
コード例 #4
0
ファイル: GOEntry.cs プロジェクト: 0xFh/Asda2-Project
        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;
            }
        }