Example #1
0
        private static void HiddenVillageEventSink_Login(LoginEventArgs args)
        {
            Mobile m = args.Mobile;

            Container pack = m.Backpack;

            if (pack != null)
            {
                List <HiddenVillagePass> passs = pack.FindItemsByType <HiddenVillagePass>();

                for (int i = 0; i < passs.Count; ++i)
                {
                    HiddenVillagePass pass = passs[i];

                    if (pass != null)
                    {
                        m.CloseGump(typeof(HiddenVillageIconGump));
                        m.SendGump(new HiddenVillageIconGump(m));
                    }
                }
            }
            if (m.AccessLevel >= AccessLevel.Counselor)
            {
                m.SendMessage(68, "Because your a GM you get the HV pass!!");
                m.CloseGump(typeof(HiddenVillageIconGump));
                m.SendGump(new HiddenVillageIconGump(m));
            }
        }
Example #2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 1)
            {
                Container pack = from.Backpack;
                if (pack != null)
                {
                    if (pack.ConsumeTotal(typeof(DragonKnightToken), 25))
                    {
                        List <HiddenVillagePass> hiddenvillagepasss = pack.FindItemsByType <HiddenVillagePass>();
                        for (int i2 = 0; i2 < hiddenvillagepasss.Count; ++i2)
                        {
                            HiddenVillagePass hiddenvillagepass = hiddenvillagepasss[i2];

                            if (hiddenvillagepass == null)
                            {
                                continue;
                            }
                            if (hiddenvillagepass != null)                              //how many token
                            {
                                hiddenvillagepass.LifeSpan = (hiddenvillagepass.LifeSpan + (TimeSpan.FromDays(7)));
                                from.SendMessage(68, "The Pass has been updated with more time.");
                                return;
                            }
                        }
                        from.SendMessage(68, "The Pass has been added to your backpack.");
                        from.AddToBackpack(new HiddenVillagePass(168));                          //168 hours = 1 week
                        from.CloseGump(typeof(HiddenVillageIconGump));
                        from.SendGump(new HiddenVillageIconGump(from));
                        return;
                    }
                    from.SendMessage(38, "You do not have enough tokens in your bag.");
                }
            }

            if (info.ButtonID == 0)
            {
//				from.SendMessage( "refused" );
            }
        }