I added new quest system to my server , and added a new questlistgump for it.
I could open the gump with [QuestList gump but I want this gump opened while clicking quests button in paperdoll is it possible ? How Can I do it?
I used eventsink but not worked , or I used wrong help me .

I used EventSink code like that :
public static void Initialize()
{
EventSink.QuestGumpRequest += new QuestGumpRequestHandler(EventSink_QuestGumpRequest);
CommandSystem.Register("QuestList", AccessLevel.Player, new CommandEventHandler(QuestListCommand));
}
[Usage("QuestList")]
public static void QuestListCommand(CommandEventArgs e)
{
if (e.Mobile is PlayerMobile)
{
e.Mobile.SendGump(new QuestGump(e.Mobile));
}
}

private static void EventSink_QuestGumpRequest( QuestGumpRequestArgs e )
{


foreach ( Gump g in e.Mobile.NetState.Gumps )
{
if ( g is QuestGump )
return;
}

e.Mobile.SendGump( new QuestGump( e.Mobile ) );
}
 
There is an option in Xmlspawner to override the Quest button, if you want to replace the OSI quest system with XmlQuestPoints. I'm not sure which file it is exactly in the Xmlspawner folder(s), but I'm sure the code is there, just commented. I'd say that would be the code you need to "borrow" ;)
 
This is an example of part of the code I have for mine.

It doesnt show everything, but still enough to need to know what your doing.

Code:
public static void Initialize()
        {
            EventSink.QuestGumpRequest += QuestButtonGump;

            CommandUtility.Register("Info", AccessLevel.Player, e => DisplayTo(e.Mobile as PlayerMobile));
            CommandUtility.RegisterAlias("Info", "ShardsInfo");
            CommandUtility.RegisterAlias("Info", "ShardInfo");

            EventSink.Connected += e =>
            {
                if (!(e.Mobile is PlayerMobile))
                {
                    return;
                }

                var pm = (PlayerMobile)e.Mobile;

                if (pm.LastOnline.AddSeconds(30) < DateTime.UtcNow)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(20.0), DisplayTo, pm);
                }
            };

            EventSink.Speech += e =>
            {
                if (!String.IsNullOrWhiteSpace(e.Speech) &&
                    (Insensitive.Equals(e.Speech, "shards info") || Insensitive.Equals(e.Speech, "shard info")))
                {
                    DisplayTo(e.Mobile as PlayerMobile);
                }
            };
        }

public static void QuestButtonGump(QuestGumpRequestArgs e)
        {
            new ShardsMenuUI(e.Mobile, null).Send();
        }

        public static void QuestButtonGump_NET(NetState state, IEntity e, EncodedReader reader)
        {
            new ShardsMenuUI(state.Mobile, null).Send();
        }

        public static void DisplayTo(PlayerMobile user)
        {
            DisplayTo(user, false);
        }

        public static void DisplayTo(Mobile user, bool refreshOnly)
        {
            var info = EnumerateInstances<ShardsMenuUI>(user).FirstOrDefault(g => g != null && !g.IsDisposed && g.IsOpen);

            if (info == null)
            {
                if (refreshOnly)
                {
                    return;
                }

                info = new ShardsMenuUI(user, null);
            }

            info.Refresh(true);
        }

The above code is all in my custom Gump's class.

In PacketOverrides.cs, I have this..

Code:
public static void Override()
{
PacketHandlers.RegisterEncoded(0x32, true, new OnEncodedPacketReceive(ShardsMenuUI.QuestButtonGump_NET));
PacketHandlers.RegisterExtended(0x2A, true, new OnPacketReceive(HeritageTransform));
}

That really should be all you need to get it working.


Now, the formatting of sending the Gump and all that will likely need to be changed because I use Voxpire's Super Gumps instead of normal gumps. But look at how I'm using the EventSink and you should be able to figure it out from that.
 
Back