예제 #1
0
        private void OnGumpReceived()
        {
            // very nasty hack
            // This method is called before sending gump packet to client,
            // so the gump is closed before client receives gump packet and
            // cannot close it. Core is completely rotten and needs to be rewritten
            // e.g. publishing events after completely processing a packet - maybe the
            // behavior has to be considered case by case and asking what state on client
            // does script expect.
            Task.Run(() =>
            {
                Thread.Sleep(10);

                lock (gumpLock)
                {
                    try
                    {
                        if (nextTriggerId.HasValue)
                        {
                            infusionApi.TriggerGump(new GumpControlId((uint)nextTriggerId));
                            nextTriggerId = null;
                        }
                    }
                    catch (GumpException ex)
                    {
                        console.Debug(ex.ToString());
                    }
                }
            });
        }