コード例 #1
0
ファイル: ServerList.cs プロジェクト: ruaduck/ServUO
        private static void EventSink_ServerList(ServerListEventArgs e)
        {
            try
            {
                Network.NetState ns = e.State;
                Socket           s  = ns.Socket;

                IPEndPoint ipep = (IPEndPoint)s.LocalEndPoint;

                IPAddress localAddress = ipep.Address;
                int       localPort    = ipep.Port;

                if (IsPrivateNetwork(localAddress))
                {
                    ipep = (IPEndPoint)s.RemoteEndPoint;

                    if (!IsPrivateNetwork(ipep.Address) && _PublicAddress != null)
                    {
                        localAddress = _PublicAddress;
                    }
                }

                e.AddServer(ServerName, new IPEndPoint(localAddress, localPort));
            }
            catch
            {
                e.Rejected = true;
            }
        }
コード例 #2
0
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            PlayerMobile p = (PlayerMobile)sender.Mobile;

            if (p == null)
            {
                return;
            }

            if (info.ButtonID == 1)
            {
                p.Quest.ShowQuestLog();
            }
            else if (info.ButtonID == 2)
            {
                p.Quest.ShowQuestConversation();
            }
            else if (info.ButtonID == 3)
            {
                p.Quest.BeginCancelQuest();
            }
            else
            {
                p.CloseGump(typeof(QuestGump));
            }
        }
コード例 #3
0
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 0)
            {
                return;
            }
            if (info.ButtonID == 0xffff)
            {
                sender.Mobile.Target = new AddAuctionTarget(cont);
                sender.Mobile.SendMessage(StringList.SelectItem);
                return;
            }

            if (info.ButtonID - 1 >= cont.AuctionItems.Count)
            {
                sender.Mobile.SendMessage("Bad selection - ERROR: 0x2");
                sender.Mobile.SendGump(new AuctionGump(sender.Mobile, cont));
                return;
            }

            AuctionEntry tobid = cont.AuctionItems[info.ButtonID - 1];

            if (cont.AuctionItems.Contains(tobid))
            {
                ViewItemGump gump = new ViewItemGump(tobid, cont, sender.Mobile);
                sender.Mobile.SendGump(gump);
                //gump.bag.DisplayTo(sender.Mobile);
            }
            else
            {
                sender.Mobile.SendMessage("Bad Selection - ERROR: 0x3");
                sender.Mobile.SendGump(new AuctionGump(sender.Mobile, cont));
            }
        }
コード例 #4
0
        public override void OnResponse(Network.NetState state, RelayInfo info)
        {
            VoidPoolStats stats = VoidPoolStats.GetStats(Controller);

            switch (info.ButtonID)
            {
            default: break;

            case 1:
                User.SendGump(new ScoresGump(Controller, User, ScoreType.Current));
                break;

            case 2:
                User.SendGump(new ScoresGump(Controller, User, ScoreType.BestSingle));
                break;

            case 3:
                User.SendGump(new ScoresGump(Controller, User, ScoreType.OverallTotal));
                break;

            case 4:
                if (stats.BestWave != null)
                {
                    User.SendGump(new ScoresGump(Controller, User, ScoreType.BestWave));
                }
                break;
            }
        }
コード例 #5
0
            public override void OnResponse(Network.NetState sender, RelayInfo info)
            {
                ChampionSpawn spawn;
                int           idx;

                if (info.ButtonID > 0 && info.ButtonID <= 1000)
                {
                    idx = info.ButtonID - 1;
                    if (idx < 0 || idx >= Spawners.Count)
                    {
                        return;
                    }
                    spawn = Spawners[idx];
                    sender.Mobile.MoveToWorld(spawn.Location, spawn.Map);
                    sender.Mobile.SendGump(this);
                }
                else if (info.ButtonID > 1000)
                {
                    idx = info.ButtonID - 1001;
                    if (idx < 0 || idx > Spawners.Count)
                    {
                        return;
                    }
                    spawn = Spawners[idx];
                    spawn.SendGump(sender.Mobile);
                }
            }
コード例 #6
0
        public override void OnResponse(Network.NetState state, RelayInfo info)
        {
            switch (info.ButtonID)
            {
            case (int)Buttons.Accept:
                m_From.SelectRewardTitle(m_Page);
                break;

            case (int)Buttons.Next:
                if (m_Page == m_From.RewardTitles.Count - 1)
                {
                    m_From.SendGump(new SelectTitleGump(m_From, -1));
                }
                else if (m_Page < m_From.RewardTitles.Count - 1 && m_Page > -1)
                {
                    m_From.SendGump(new SelectTitleGump(m_From, m_Page + 1));
                }
                else
                {
                    m_From.SendGump(new SelectTitleGump(m_From, 0));
                }

                break;
            }
        }
コード例 #7
0
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            if (m_Player == null || m_Item == null)
            {
                return;
            }
            if (m_Item.Deleted)
            {
                return;
            }

            bool closeGump = true;

            switch (info.ButtonID)
            {
            // Guide
            case 1:
                closeGump = false;
                break;
            }

            if (!closeGump)
            {
                m_Player.CloseGump(typeof(ItemIdGump));
                m_Player.SendGump(new ItemIdGump(m_Player, m_Item, m_Success, m_ShowRarity, m_ShowWorldItemCount));
            }

            else
            {
                m_Player.SendSound(0x058);
            }
        }
コード例 #8
0
 public override void OnResponse(Network.NetState state, RelayInfo info)
 {
     if (m_Cliloc == 1075783)
     {
         state.Mobile.SendLocalizedMessage(1075787); // I feel that thou hast yet more to learn about Humility... Please ponder these things further, and visit me again on the 'morrow.
     }
 }
コード例 #9
0
 public override void OnResponse(Network.NetState sender, RelayInfo info)
 {
     if (info.ButtonID == 1 && m_Callback != null)
     {
         m_Callback(sender.Mobile, m_State);
     }
 }
コード例 #10
0
 public override void OnResponse(Network.NetState sender, RelayInfo info)
 {
     if (info.ButtonID >= 1000)
     {
         AttributeHandler handler = AttributeHandler.Definitions[info.ButtonID - 1000];
         Process.BeginUpgrade(handler);
     }
 }
コード例 #11
0
ファイル: Emote.cs プロジェクト: rberiot/imaginenation
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            int val = info.ButtonID - 1;

            if (val < 0)
            {
                return;
            }

            Mobile from  = m_From;
            int    type  = val % 15;
            int    index = val / 15;

            switch (type)
            {
            case 0:
            {
                EmotePage page;
                switch (index)
                {
                case 1: page = EmotePage.P1; break;

                case 2: page = EmotePage.P2; break;

                case 3: page = EmotePage.P3; break;

                case 4: page = EmotePage.P4; break;

                default: return;
                }

                from.SendGump(new EmoteGump(from, page));
                break;
            }

            case 1:
            {
                if (index > 0 && index < 13)
                {
                    from.SendGump(new EmoteGump(from, EmotePage.P1));
                }
                else if (index > 12 && index < 25)
                {
                    from.SendGump(new EmoteGump(from, EmotePage.P2));
                }
                else if (index > 24 && index < 37)
                {
                    from.SendGump(new EmoteGump(from, EmotePage.P3));
                }
                else if (index > 36 && index < 43)
                {
                    from.SendGump(new EmoteGump(from, EmotePage.P4));
                }
                new ESound(from, index);
                break;
            }
            }
        }
コード例 #12
0
        public override void OnCancel(Network.NetState state)
        {
            if (GuildMenu.BadLeader(m_Mobile, m_Guild))
            {
                return;
            }

            m_Mobile.SendMenu(new GuildmasterMenu(m_Mobile, m_Guild));
        }
コード例 #13
0
 public override void OnResponse(Network.NetState sender, RelayInfo info)
 {
     switch (info.ButtonID)
     {
     case 1:
         m_Spawn.SendGump(sender.Mobile);
         break;
     }
 }
コード例 #14
0
        public override void OnResponse(Network.NetState state, RelayInfo info)
        {
            if (m_Collection == null || !m_Owner.InRange(m_Location, 2))
            {
                return;
            }

            if (info.ButtonID == (int)Buttons.Rewards)
            {
                m_Owner.SendGump(new CommunityCollectionGump(m_Owner, m_Collection, m_Location, Section.Rewards));
            }
            else if (info.ButtonID == (int)Buttons.Status)
            {
                m_Owner.SendGump(new CommunityCollectionGump(m_Owner, m_Collection, m_Location, Section.Donates));
            }
            else if (info.ButtonID >= 300 && m_Collection.Donations != null && info.ButtonID - 300 < m_Collection.Donations.Count && m_Section == Section.Donates)
            {
                CollectionItem item = m_Collection.Donations[info.ButtonID - 300];

                m_Owner.SendLocalizedMessage(1073178); // Please enter how much of that item you wish to donate:
                m_Owner.Prompt = new InternalPrompt(m_Collection, item, m_Location);
            }
            else if (info.ButtonID >= 200 && m_Collection.Rewards != null && info.ButtonID - 200 < m_Collection.Rewards.Count && m_Section == Section.Rewards)
            {
                CollectionItem item   = m_Collection.Rewards[info.ButtonID - 200];
                int            points = m_Owner.GetCollectionPoints(m_Collection.CollectionID);

                if (item.CanSelect(m_Owner))
                {
                    if (item.Points <= points)
                    {
                        if (item is CollectionHuedItem)
                        {
                            m_Owner.SendGump(new CommunityCollectionGump(m_Owner, m_Collection, m_Location, Section.Hues, (CollectionHuedItem)item));
                        }
                        else
                        {
                            m_Owner.CloseGump(typeof(ConfirmRewardGump));
                            m_Owner.SendGump(new ConfirmRewardGump(m_Collection, m_Location, item, 0));
                        }
                    }
                    else
                    {
                        m_Owner.SendLocalizedMessage(1073122); // You don't have enough points for that!
                    }
                }
            }
            else if (info.ButtonID >= 100 && m_Item != null && info.ButtonID - 200 < m_Item.Hues.Length && m_Section == Section.Hues)
            {
                m_Owner.CloseGump(typeof(ConfirmRewardGump));
                m_Owner.SendGump(new ConfirmRewardGump(m_Collection, m_Location, m_Item, m_Item.Hues[info.ButtonID - 100]));
            }
        }
コード例 #15
0
        public override void OnResponse(Network.NetState state, int index)
        {
            if (GuildMenu.BadLeader(m_Mobile, m_Guild))
            {
                return;
            }

            switch (index)
            {
            case 0:     //toggle protection
            {
                m_Mobile.SendMenu(new ConfirmToggle(m_Mobile, m_Guild, !m_Guild.IsProtected(m_Guild.Leader)));
                break;
            }

            case 1:     //set house sign
                m_Mobile.SendMenu(new HouseSignMenu(m_Mobile, m_Guild));
                break;

            case 2:     //grant protection
                if (m_Guild.IsProtected(m_Guild.Leader))
                {
                    List <Mobile> list = new List <Mobile>(m_Guild.Members);
                    list.Remove(m_Guild.Leader);
                    m_Mobile.SendMenu(new GrantProtectionMenu(m_Mobile, m_Guild, list, 0));
                }
                else
                {
                    m_Mobile.SendAsciiMessage("You must enable guild protection first.");
                    m_Mobile.SendMenu(new GuildProtectionMenu(m_Mobile, m_Guild));
                }
                break;

            case 3:     //revoke protection
                if (m_Guild.IsProtected(m_Guild.Leader))
                {
                    List <Mobile> list = new List <Mobile>(m_Guild.Protected);
                    list.Remove(m_Guild.Leader);
                    m_Mobile.SendMenu(new RevokeProtectionMenu(m_Mobile, m_Guild, list, 0));
                }
                else
                {
                    m_Mobile.SendAsciiMessage("You must enable guild protection first.");
                    m_Mobile.SendMenu(new GuildProtectionMenu(m_Mobile, m_Guild));
                }
                break;

            case 4:     //return to main menu
            default:
                m_Mobile.SendMenu(new GuildmasterMenu(m_Mobile, m_Guild));
                break;
            }
        }
コード例 #16
0
        public override void OnResponse(Network.NetState state, RelayInfo info)
        {
            if (m_Collection == null || m_Pet == null || m_Pet.Deleted || m_Pet.ControlMaster != state.Mobile || !state.Mobile.InRange(m_Location, 2))
            {
                return;
            }

            if (info.ButtonID == (int)Buttons.Continue && state.Mobile is PlayerMobile mobile)
            {
                m_Collection.DonatePet(mobile, m_Pet);
            }
        }
コード例 #17
0
ファイル: BasicInfoGump.cs プロジェクト: zmazza/ServUO
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            Mobile m = sender.Mobile;

            if (info.ButtonID == 1 && m_CancelCallback != null)
            {
                m_CancelCallback(m, m_State);
            }
            else if (info.ButtonID == 2 && m_ConfirmCallback != null)
            {
                m_ConfirmCallback(m, m_State);
            }
        }
コード例 #18
0
 public override void OnResponse(Network.NetState sender, RelayInfo info)
 {
     // TODO: need to be able to close the gump
     if (info.ButtonID >= 1 && info.ButtonID < 50)
     {
         if (m_skills.Contains(info.ButtonID))
         {
             m_skills.Remove(info.ButtonID);
             sender.Mobile.SendGump(new SkillBonusGump(m_player, m_skills));
         }
         else if (m_skills.Count < 4)
         {
             m_skills.Add(info.ButtonID);
             if (info.ButtonID == 4)
             {
                 sender.Mobile.SendGump(new SkillBonusWarningGump(info.ButtonID, m_skills));
             }
             else if (sender.Mobile.Skills[info.ButtonID - 1].Base >= m_pointstoboost[info.ButtonID - 1])
             {
                 sender.Mobile.SendGump(new SkillBonusWarningGump(100, m_skills));
             }
             else
             {
                 sender.Mobile.SendGump(new SkillBonusGump(m_player, m_skills));
             }
         }
         else
         {
             sender.Mobile.SendGump(new SkillBonusGump(m_player, m_skills));
         }
     }
     else if (info.ButtonID == 50)
     {
         if (m_skills.Count == 4)
         {
             if (sender.Mobile is PlayerMobile)
             {
                 ApplyResults((PlayerMobile)sender.Mobile, m_skills);
             }
         }
         else
         {
             sender.Mobile.SendGump(new SkillBonusGump(m_player, m_skills));
         }
     }
     else if (info.ButtonID == 0)
     {
         EnsureClosed(sender.Mobile);
     }
 }
コード例 #19
0
 public override void OnResponse(Network.NetState sender, RelayInfo info)
 {
     if (info.ButtonID == 2)
     {
         if (!m_Pet.Deleted && m_Pet.Controlled && m_From == m_Pet.ControlMaster && m_From.CheckAlive() /*&& m_Pet.CheckControlChance( m_From )*/)
         {
             if (m_Pet.Map == m_From.Map && m_Pet.InRange(m_From, 14))
             {
                 m_Pet.ControlTarget = null;
                 m_Pet.ControlOrder  = OrderType.Release;
             }
         }
     }
 }
コード例 #20
0
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (from is Player)
            {
                Player p = from as Player;

                if (p.EoC < 10000)
                {
                    p.SendMessage("You need atleast 10,000 EoC to purchase this item.");
                    p.CloseGump(typeof(EtherealSaleInterface));
                    p.SendGump(new EtherealSaleInterface()); return;
                }

                else
                {
                    switch (info.ButtonID)
                    {
                    case (int)Buttons.ancientScrollBtn:
                    {
                        p.ConsumeEoC(100000);
                        p.AddToBackpack(new AncientScroll());
                        p.SendMessage("You feel part of your life-force being drained..");
                        break;
                    }

                    case (int)Buttons.daemonBloodBtn:
                    {
                        p.ConsumeEoC(100000);
                        p.AddToBackpack(new DaemonBlood());
                        p.SendMessage("You feel part of your life-force being drained..");
                        break;
                    }

                    case (int)Buttons.soulStoneBtn:
                    {
                        p.ConsumeEoC(100000);
                        p.AddToBackpack(new SoulStone());
                        p.SendMessage("You feel part of your life-force being drained..");
                        break;
                    }

                    default: break;
                    }

                    p.PlaySound(0x1F9);
                }
            }
        }
コード例 #21
0
 public override void OnResponse(Network.NetState state, RelayInfo info)
 {
     if (info.ButtonID == (int)Buttons.Confirm)
     {
         if (info.IsSwitched((int)Buttons.Break))
         {
             Confirm(state.Mobile);
         }
         else
         {
             Refuse(state.Mobile);
         }
     }
 }
コード例 #22
0
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            bool makersMark = info.ButtonID == 1;

            if (makersMark)
            {
                m_From.SendLocalizedMessage(501808); // You mark the item.
            }
            else
            {
                m_From.SendLocalizedMessage(501809); // Cancelled mark.
            }
            m_CraftItem.CompleteCraft(m_Quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null);
        }
コード例 #23
0
ファイル: MagicKey.cs プロジェクト: travismills82/TrueUO
            public override void OnResponse(Network.NetState state, RelayInfo info)
            {
                Mobile from = state.Mobile;

                if (info.ButtonID == 1)
                {
                    MagicKey key = new MagicKey();
                    from.AddToBackpack(key);

                    key.Movable = true;
                    key.StartTimer();

                    from.SendLocalizedMessage(1113389); // As long as you carry this key, you will be granted access to the Puzzle Room.
                }
            }
コード例 #24
0
            public override void OnResponse(Network.NetState state, RelayInfo info)
            {
                Mobile from = state.Mobile;

                if (info.ButtonID == 1)
                {
                    m_Filter--;
                    from.SendGump(new BestKillGump(m_Filter));
                }
                else if (info.ButtonID == 2)
                {
                    m_Filter++;
                    from.SendGump(new BestKillGump(m_Filter));
                }
            }
コード例 #25
0
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            if (m_Callback == null)
            {
                return;
            }

            if (info.ButtonID == 1)
            {
                m_Callback(true);
            }
            else
            {
                m_Callback.Invoke(false);
            }
        }
コード例 #26
0
        public override void OnResponse(Network.NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0 && User.Quest != null && User.Quest is TimeForLegendsQuest)
            {
                User.Quest.Cancel();
            }

            int id = info.ButtonID - 1;

            if (id >= 0 && id < SkillInfo.Table.Length)
            {
                Quest.Mastery = (SkillName)id;
                Quest.ToSlay  = TimeForLegendsQuest.TargetOfTheDay;
                Quest.AddObjective(new TimeForLegendsObjective());
            }
        }
コード例 #27
0
ファイル: BodyGuard.cs プロジェクト: ygtkms/ServUO
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 2)
            {
                bool okay = info.IsSwitched(1);

                if (okay)
                {
                    m_Spell.AcceptBodyGuard(m_Protectee);
                }
                else
                {
                    m_Spell.DeclineBodyGuard(m_Protectee);
                }
            }
        }
コード例 #28
0
ファイル: HarvestGump.cs プロジェクト: Pumpk1ns/outlands
 public override void OnResponse(Network.NetState sender, RelayInfo info)
 {
     if (info.ButtonID == 0)
     {
         sender.Mobile.SendMessage("You choose to discard the harvest");
     }
     else if (info.ButtonID == m_CorrectButton)
     {
         OnHarvestSuccess(sender.Mobile);
     }
     else
     {
         OnHarvestFail(sender.Mobile);
     }
     base.OnResponse(sender, info);
 }
コード例 #29
0
            public override void OnResponse(Network.NetState state, int index)
            {
                if (GuildMenu.BadLeader(m_Mobile, m_Guild))
                {
                    return;
                }

                if (index == 0)   //yes
                {
                    if (TurnOn)
                    {
                        Container bank = m_Mobile.FindBankNoCreate();

                        // Add guild leader as protected
                        if (!m_Guild.AddProtection(m_Mobile))
                        {
                            m_Mobile.SendAsciiMessage("You already have guild protection on another character.");
                            return;
                        }

                        if (bank != null && bank.ConsumeTotal(typeof(Gold), 10000))
                        {
                            m_Guild.LastProtectionPayment = DateTime.Now;
                        }
                        else
                        {
                            m_Guild.RemoveProtection(m_Mobile);
                            m_Mobile.SendAsciiMessage("You lack the required funds in your bank account to enable protection.");
                        }
                    }
                    else
                    {
                        m_Guild.ClearAllProtection();
                    }

                    m_Mobile.SendMenu(new GuildProtectionMenu(m_Mobile, m_Guild));
                }
                else //no
                {
                    m_Mobile.SendMenu(new GuildProtectionMenu(m_Mobile, m_Guild));
                }
            }
コード例 #30
0
ファイル: BaseRewardGump.cs プロジェクト: mahal907/ServUO
        public override void OnResponse(Network.NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (info.ButtonID >= 200 && from is PlayerMobile)
            {
                CollectionItem item   = Collection[info.ButtonID - 200];
                double         points = GetPoints(from);

                if (item != null && item.Points <= points)
                {
                    from.CloseGump(typeof(aConfirmRewardGump));
                    from.SendGump(new aConfirmRewardGump(Owner, item, info.ButtonID - 200, OnConfirmed));
                }
                else
                {
                    from.SendLocalizedMessage(1073122); // You don't have enough points for that!
                }
            }
        }