Example #1
0
        protected virtual void OnGiveReward(ConquestState s, XmlAttachment reward)
        {
            if (s == null || s.User == null || reward == null || reward.Deleted)
            {
                return;
            }

            if (!XmlAttach.AttachTo(s.User, reward))
            {
                reward.Delete();
            }
        }
Example #2
0
            public override void OnResponse(NetState state, RelayInfo info)
            {
                if (info == null || state == null || state.Mobile == null)
                {
                    return;
                }

                int radiostate = -1;

                if (info.Switches.Length > 0)
                {
                    radiostate = info.Switches[0];
                }
                switch (info.ButtonID)
                {
                default:
                {
                    if (radiostate == 1 && SearchList != null && SelectedList != null)
                    {            // accept
                        for (int i = 0; i < SearchList.Count; i++)
                        {
                            int index = i - DisplayFrom;
                            if ((index >= 0 && index < SelectedList.Length && SelectedList[index] == true) || selectAll)
                            {
                                XmlAttachment o = SearchList[i];
                                // some objects may not delete gracefully (null map items are particularly error prone) so trap them
                                try
                                {
                                    o.Delete();
                                }
                                catch { }
                            }
                        }
                        // refresh the gump
                        state.Mobile.CloseGump(typeof(XmlGetAttGump));
                        state.Mobile.SendGump(new XmlGetAttGump(state.Mobile, m_target, 0, 0));
                    }
                    break;
                }
                }
            }