IsSwitched() 공개 메소드

public IsSwitched ( int switchID ) : bool
switchID int
리턴 bool
예제 #1
0
        public void OnResponse(Server.Network.NetState sender, Server.Gumps.RelayInfo info)
        {
            Mobile    from = sender.Mobile;
            TMSS4Skin skin = sk;

            SkillReportsHelper.EnableSelectionReport = info.IsSwitched(2000);
            SkillReportsHelper.EnableProfileReport   = info.IsSwitched(1000);
            //PluginSaver.SavePluginSettings(this);
            Dictionary <string, object> args = new Dictionary <string, object>();

            if (skin != null)
            {
                args.Add("Skin", skin);
            }
            else
            {
                SkillSettings.DoTell("Reports: Skin is null.");
            }
            if (from != null)
            {
                args.Add("Mobile", from);
            }
            else
            {
                SkillSettings.DoTell("Reports: From is null.");
            }
            from.SendGump(new TMQueryPage("Main Menu", args));
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            Handeling.Armor = info.IsSwitched(1);
            Handeling.MagicalArmor = info.IsSwitched(2);
            Handeling.Shields = info.IsSwitched(3);
            Handeling.Colored = info.IsSwitched(4);

            from.SendGump(new RVSSetup_Rules(Handeling));
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            Handeling.Weapons = info.IsSwitched(1);
            Handeling.Magical = info.IsSwitched(2);
            Handeling.Poisoned = info.IsSwitched(3);
            Handeling.RunicWeapons = info.IsSwitched(4);

            from.SendGump(new FieldSetup_Rules(Handeling));
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;
			
            Handeling.RvS = info.IsSwitched(1);
            Handeling.Orcs = info.IsSwitched(2);
            Handeling.Lizardmen = info.IsSwitched(3);
            Handeling.Ratmen = info.IsSwitched(4);
            Handeling.Undead = info.IsSwitched(5);

            from.SendGump(new RVSSetup_Rules(Handeling));
        }
예제 #5
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            Point3D fireLoc = new Point3D(from.X + 5, from.Y + 2, from.Z);

            bool deconstruct = info.IsSwitched(2);
            bool logout      = info.IsSwitched(3);

            if (deconstruct)
            {
                m_Bedroll.Delete();

                from.AddToBackpack(new TravelTent());

                Campfire fire = new Campfire();
                fire.Status = CampfireStatus.Off;
                fire.MoveToWorld(fireLoc, from.Map);
            }

            if (logout)
            {
                m_Bedroll.Delete();

                if (from.Backpack != null && from.Backpack.GetAmount(typeof(TentValidator)) > 0)
                {
                    from.Backpack.ConsumeTotal(typeof(TentValidator), 1);
                }

                from.AddToBackpack(new TravelTent());

                Campfire fire = new Campfire();
                fire.Status = CampfireStatus.Off;
                fire.MoveToWorld(fireLoc, from.Map);

                ((PlayerMobile)from).BedrollLogout = true;
                state.Dispose();
            }

            switch (info.ButtonID)
            {
            default:
            case 0:
            {
                from.CloseGump(typeof(TentManagementGump));
                break;
            }
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile m = sender.Mobile;

            if (info.ButtonID == 1)
            {
                if (m.InRange(m_Healer, 16))
                {
                    if (info.IsSwitched(0) && Banker.Withdraw(m, m_Price))
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(PaidRes), m);
                        m.Frozen = true;
                    }

                    else
                    {
                        m.Resurrect();
                        m.PlaySound(0x214);
                        m.FixedEffect(0x376A, 10, 16);
                    }
                }
                else
                    m.SendMessage("You have wandered to far off to gain any benefits from the healers practices.");
            }
        }
예제 #7
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from = sender.Mobile;
            PlayerMobile pm   = from as PlayerMobile;

            if (pm != null)
            {
                pm.ShowChat = info.IsSwitched(0);
            }

            switch (info.ButtonID)
            {
            case 0:
            {
                from.SendAsciiMessage(0x49, "You can rejoin chat anytime by using the [chat command.");
                m_System.RemovePlayer(from);
                break;
            }

            case 1:
            {
                m_System.ToggleVisible(from);
                m_System.UpdateGump();
                break;
            }
            }
        }
예제 #8
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (info.IsSwitched((int)Buttons.rdoYesJoin))
            {
                if (ScavengerSignup.signupEnabled && from is PlayerMobile)
                {
                    ScavengerBasket newBasket = new ScavengerBasket((PlayerMobile)from);
                    if (!from.Backpack.CheckHold(from, newBasket, false))
                    {
                        from.SendMessage("Your backpack is too full to even consider entering this event!");
                        newBasket.Delete();
                        return;
                    }

                    from.AddToBackpack(newBasket);
                    ScavengerSignup.ScavengerBaskets.Add(newBasket);
                    from.SendMessage("You are now entered in the scavenger hunt. Use the supplied basket to gather the scavenger items!");
                }
                else
                {
                    from.SendMessage("You have waited too long and signup for the scavenger hunt has ended");
                }
            }
            else
            {
                from.SendMessage("You have not been entered into the scavenger hunt event");
            }
        }
예제 #9
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            int btd = info.ButtonID;

            if (info.ButtonID == 2)
            {
                //20 would be the lowest roll, since 0 is a index
                bool switched = false;
                for (int i = 0; i <= this.diceToBeat; ++i)
                {
                    if (info.IsSwitched(i))
                    {
                        switched = true;
                        ds.UpdateGameChannelBluff(state.Mobile, i);
                        return;
                    }
                }
                if (switched == false)
                {
                    state.Mobile.SendMessage("Please select a dice value!");
                    state.Mobile.SendGump(this);
                }
            }
            else
            {
                state.Mobile.SendMessage("Illegal option selected");
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile m = sender.Mobile;

            if (info.ButtonID == 1)
            {
                if (m.InRange(m_Healer, 16))
                {
                    if (info.IsSwitched(0) && Banker.Withdraw(m, m_Price))
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(PaidRes), m);
                        m.Frozen = true;
                    }

                    else
                    {
                        m.Resurrect();
                        m.PlaySound(0x214);
                        m.FixedEffect(0x376A, 10, 16);
                    }
                }
                else
                {
                    m.SendMessage("You have wandered to far off to gain any benefits from the healers practices.");
                }
            }
        }
예제 #11
0
		public override void OnResponse( NetState sender, RelayInfo info )
		{
			if ( info.ButtonID == 1 )
			{
				Container pack = m_Mobile.Backpack;

				if ( pack != null && m_Item.IsChildOf( pack ) )
				{
					if ( pack.ConsumeTotal( typeof( Silver ), m_Definition.SilverCost ) )
					{
						int hue;

						if ( m_Item is SpellScroll )
							hue = 0;
						else if ( info.IsSwitched( 1 ) )
							hue = m_Faction.Definition.HuePrimary;
						else
							hue = m_Faction.Definition.HueSecondary;

						FactionItem.Imbue( m_Item, m_Faction, true, hue );
					}
					else
					{
						m_Mobile.SendLocalizedMessage( 1042204 ); // You do not have enough silver.
					}
				}
			}

			if ( m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0 )
				m_Mobile.SendGump( new CraftGump( m_Mobile, m_CraftSystem, m_Tool, m_Notice ) );
			else if ( m_Notice is string )
				m_Mobile.SendMessage( (string) m_Notice );
			else if ( m_Notice is int && ((int)m_Notice) > 0 )
				m_Mobile.SendLocalizedMessage( (int) m_Notice );
		}
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break;

                    case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break;

                    case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break;
                    }
                }

                Mobile m = from;

                Misc.Titles.AwardFame(from, -100, true);                   // TODO: Proper fame loss
            }
        }
예제 #13
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Sphynx == null || m_Sphynx.Deleted)
            {
                return;
            }

            PlayerMobile m = sender.Mobile as PlayerMobile;

            if (info.ButtonID == 1 && info.IsSwitched(1))
            {
                Container pack = m.Backpack;

                if (pack != null && pack.ConsumeTotal(typeof(Gold), 5000))
                {
                    m.SendLocalizedMessage(1060867);                       // You pay the fee.
                    TellFortune(m);
                    TellFortune(m);
                    m_Told.Add(m);
                    m.FortuneExpire = DateTime.Now + TimeSpan.FromHours(24);
                }
                else
                {
                    m.SendLocalizedMessage(1061006);                       // You haven't got the coin to make the proper donation to the Sphynx.  Your fortune has not been read.
                }
            }
            else
            {
                m.SendLocalizedMessage(1061007);                   // You decide against having your fortune told.
            }
        }
예제 #14
0
        public override void OnResponse( NetState state, RelayInfo info )
        {
            Mobile from = state.Mobile;

            if( info.IsSwitched( (int)Buttons.rdoYesJoin ) )
            {
                if( ScavengerSignup.signupEnabled && from is PlayerMobile )
                {
                    ScavengerBasket newBasket = new ScavengerBasket( (PlayerMobile)from );
                    if( !from.Backpack.CheckHold( from, newBasket, false ) )
                    {
                        from.SendMessage( "Your backpack is too full to even consider entering this event!" );
                        newBasket.Delete();
                        return;
                    }

                    from.AddToBackpack( newBasket );
                    ScavengerSignup.ScavengerBaskets.Add( newBasket );
                    from.SendMessage( "You are now entered in the scavenger hunt. Use the supplied basket to gather the scavenger items!" );
                }
                else
                {
                    from.SendMessage( "You have waited too long and signup for the scavenger hunt has ended" );
                }
            }
            else
            {
                from.SendMessage( "You have not been entered into the scavenger hunt event" );
            }
        }
예제 #15
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 20)
            {
                SetSettings
                (
                    m_Spawner,
                    Utility.ToInt32(info.GetTextEntry(11).Text),    // Count
                    Utility.ToTimeSpan(info.GetTextEntry(14).Text), // Min Delay,
                    Utility.ToTimeSpan(info.GetTextEntry(15).Text), // Max Delay
                    Utility.ToInt32(info.GetTextEntry(16).Text),    // Team
                    Utility.ToInt32(info.GetTextEntry(13).Text),    // Home Range
                    Utility.ToInt32(info.GetTextEntry(12).Text),    // Spawn Range
                    info.GetTextEntry(10).Text,                     // Creature Name
                    info.IsSwitched(17),                            // Cant Walk
                    info.IsSwitched(18),                            // Group
                    info.IsSwitched(19),                            // Running
                    info.IsSwitched(20),                            // Blessed
                    info.IsSwitched(21),                            // Murderer
                    info.IsSwitched(22),                            // Scaled Delay
                    info.IsSwitched(23)                             // saturated
                );

                if (m_Spawner.Active)
                {
                    m_Spawner.TotalRespawn();
                }
                else
                {
                    m_Spawner.Despawn();
                }

                sender.Mobile.SendMessage(0x64, "* Cambios Guardados Correctamente *");
            }
        }
예제 #16
0
/* The main thing from NetState state you will want is state.Mobile.  This is the Mobile that clicked the button.
 * RelayInfo contains information from the gump like ButtonID, Switches and TextEntries.  We will focus on Switches here.*/
		public override void OnResponse( NetState state, RelayInfo info )
		{
			Mobile from = state.Mobile;
			if( info.ButtonID == 20 )
			{
				string toSay = "";
/* info.Switches is an int array (int[]).
 * One way I've found to check the switches is to loop through the array
 * and do a switch/case for the SwitchIDs.
 * info.Switches will only contain the ID's if they are checked.
 */
				for( int i = 0; i < info.Switches.Length; i++ )
				{
					int m = info.Switches[i];
					switch( m )
					{
						case 1: toSay += "Radio 1 : "; break;
						case 2: toSay += "Radio 2 : "; break;
						case 3: toSay += "Radio 3 : "; break;
						case 4: toSay += "Radio 4 : "; break;
						case 10: toSay += "Check 1, "; break;
						case 11: toSay += "Check 2, "; break;
						case 12: toSay += "Check 3, "; break;
						case 13: toSay += "Check 4, "; break;
					}
				}
				from.SendMessage( toSay );

/* Another way of doing it is by doing info.IsSwitched( SwitchID ).
 * This call will return a true/false depending on if the switch is checked.
 */
				toSay = "";
				if( info.IsSwitched( 1 ) )
					toSay += "Radio 1 : ";
				else if( info.IsSwitched( 2 ) )
					toSay += "Radio 2 : ";
				else if( info.IsSwitched( 3 ) )
					toSay += "Radio 3 : ";
				else if( info.IsSwitched( 4 ) )
					toSay += "Radio 4 : ";

				toSay += String.Format( "Check 1={0}, 2={1}, 3={2}, 4={3}", info.IsSwitched( 10 ), info.IsSwitched( 11 ), info.IsSwitched( 12 ), info.IsSwitched( 13 ) );
				from.SendMessage( toSay );
			}
		}
예제 #17
0
        public override void OnResponse(Server.Network.NetState state, RelayInfo info)
        {
            if (info.ButtonID != (int)Buttons.Okay || this.m_Quest == null)
                return;
			
            if (this.m_Quest.ChainID != QuestChain.None && info.IsSwitched((int)Radios.Chain))
            { 
                this.m_Quest.OnResign(true);
            }
						
            if (info.IsSwitched((int)Radios.Quest))
            {
                this.m_Quest.OnResign(false);
            }
						
            if (info.IsSwitched((int)Radios.None) && this.m_Quest.Owner != null)
                this.m_Quest.Owner.SendGump(new MondainQuestGump(this.m_Quest.Owner));
        }
예제 #18
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            base.OnResponse(sender, info);

            PlayerMobile pm = sender.Mobile as PlayerMobile;

            if (!IsMember(pm, this.guild))
                return;

            pm.DisplayGuildTitle = info.IsSwitched(0);

            switch( info.ButtonID )
            {
                //1-3 handled by base.OnResponse
                case 4:
                    {
                        if (IsLeader(pm, this.guild))
                        {
                            pm.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max):

                            pm.BeginPrompt(new PromptCallback(SetCharter_Callback), true);	//Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
                        }
                        break;
                    }
                case 5:
                    {
                        if (IsLeader(pm, this.guild))
                        {
                            pm.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max):
                            pm.BeginPrompt(new PromptCallback(SetWebsite_Callback), true);	//Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
                        }
                        break;
                    }
                case 6:
                    {
                        //Alliance Roster
                        if (this.guild.Alliance != null && this.guild.Alliance.IsMember(this.guild))
                            pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, this.guild, this.guild.Alliance));

                        break;
                    }
                case 7:
                    {
                        //Resign
                        if (!this.m_IsResigning)
                        {
                            pm.SendLocalizedMessage(1063332); // Are you sure you wish to resign from your guild?
                            pm.SendGump(new GuildInfoGump(pm, this.guild, true));
                        }
                        else
                        {
                            this.guild.RemoveMember(pm, 1063411); // You resign from your guild.
                        }
                        break;
                    }
            }
        }
예제 #19
0
		public override void OnResponse( Server.Network.NetState state, RelayInfo info )
		{		
			if ( info.ButtonID == (int) Buttons.Confirm )
			{
				if ( info.IsSwitched( (int) Buttons.Break ) )
					Confirm( state.Mobile );
				else
					Refuse( state.Mobile );
			}
		}
 public override void OnResponse(NetState sender, RelayInfo info)
 {
     if (info.ButtonID == 1)
     {
         for (int i = 0; i < m_Restricted.Length; i++)
         {
             m_Restricted[i] = info.IsSwitched(i + ((m_type == TRestrictType.Spells) ? 100 : 500));
         }
     }
 }
예제 #21
0
        public override void OnResponse( GameClient sender, RelayInfo info )
        {
            if ( info.ButtonID == 7 )
            {
                if ( info.IsSwitched( 1 ) )
                {
                    Mobile from = sender.Mobile;

                    int price = m_Entry.GetPrice( from );

                    if ( from.Backpack == null || price > (int) m_Collection.Table[from] )
                        return;

                    if ( m_Entry.Type == typeof( RewardTitle ) )
                    {
                        PlayerMobile pm = from as PlayerMobile;

                        if ( pm.CollectionTitles.Contains( m_Entry.RewardTitle ) )
                        {
                            pm.SendLocalizedMessage( 1073626 ); // You already have that title!
                        }
                        else
                        {
                            m_Collection.Table[from] = (int) m_Collection.Table[from] - price;

                            pm.CollectionTitles.Add( m_Entry.RewardTitle );
                            pm.SendLocalizedMessage( 1073625, String.Format( "#{0}", m_Entry.RewardTitle.ToString() ) ); // The title "~1_TITLE~" has been bestowed upon you.

                            pm.CurrentCollectionTitle = pm.CollectionTitles.Count - 1;
                            pm.PlaySound( 0x5A7 );
                        }
                    }
                    else
                    {
                        m_Collection.Table[from] = (int) m_Collection.Table[from] - price;

                        Item reward = Activator.CreateInstance( m_Entry.Type, m_Entry.Args ) as Item;

                        if ( m_Hue != 0 )
                            reward.Hue = m_Hue;

                        m_Collection.OnRewardCreated( from, reward );

                        from.Backpack.DropItem( reward );

                        from.SendLocalizedMessage( 1073621 ); // Your reward has been placed in your backpack.
                        from.PlaySound( 0x5A7 );
                    }

                    m_Entry.OnRewardChosen( from );
                }

                sender.Mobile.SendGump( new CollectionRewardGump( m_Collection, m_From ) );
            }
        }
예제 #22
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                 // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }

                        else
                        {
                            from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }

                    else
                    {
                        from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;
                    Misc.FameKarmaTitles.AwardFame(from, -amount, true);
                }

                if (from.Alive && m_HitsScalar > 0)
                {
                    from.Hits = (int)(from.HitsMax * m_HitsScalar);
                }
            }
        }
		public override void OnResponse( NetState sender, RelayInfo info )
		{
			Mobile from = sender.Mobile;

            Handeling.Spells = info.IsSwitched(1);

            switch (info.ButtonID)
            {
                case 0: // Closeing
                    {
                        from.SendGump(new DuelSetup_Rules(Handeling));
                        break;
                    }
                case 2: // First Circle
                    {
                        from.SendGump(new DuelSetup_Rules_Spells_1st(Handeling));
                        break;
                    }
                case 3: // Second Circle
                    {
                        from.SendGump(new DuelSetup_Rules_Spells_2nd(Handeling));
                        break;
                    }
                case 4: // Third Circle
                    {
                        from.SendGump(new DuelSetup_Rules_Spells_3rd(Handeling));
                        break;
                    }
                case 5: // Fourth Circle
                    {
                        from.SendGump(new DuelSetup_Rules_Spells_4th(Handeling));
                        break;
                    }
                case 6: // Fifth Circle
                    {
                        from.SendGump(new DuelSetup_Rules_Spells_5th(Handeling));
                        break;
                    }
                case 7: // Sixth Circle
                    {
                        from.SendGump(new DuelSetup_Rules_Spells_6th(Handeling));
                        break;
                    }
                case 8: // Seventh Circle
                    {
                        from.SendGump(new DuelSetup_Rules_Spells_7th(Handeling));
                        break;
                    }
                case 9: // Eigth Circle
                    {
                        from.SendGump(new DuelSetup_Rules_Spells_8th(Handeling));
                        break;
                    }
            }
		}
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            Handeling.Anatomy = info.IsSwitched(1);
            Handeling.DetectHidden = info.IsSwitched(2);
            Handeling.EvaluatingIntelligence = info.IsSwitched(3);
            Handeling.Hiding = info.IsSwitched(4);
            Handeling.Poisoning = info.IsSwitched(5);
            Handeling.Snooping = info.IsSwitched(6);
            Handeling.Stealing = info.IsSwitched(7);
            Handeling.SpiritSpeak = info.IsSwitched(8);
            Handeling.Stealth = info.IsSwitched(9);

            from.SendGump(new DuelSetup_Rules(Handeling));
        }
예제 #25
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile m = sender.Mobile;

            if (info.ButtonID == 1)
            {
                if (m_Struct.Event == null || m_Struct.Event.Deleted)
                {
                    m.SendGump(new IndexGump(0, m.AccessLevel >= AccessLevel.Administrator));
                    m.SendMessage("The event has been deleted, thus the timer could not be added.");
                    return;
                }

                bool add = true;

                string name = info.GetTextEntry(0).Text;
                int hour;
                int minute;

                if(!Int32.TryParse(info.GetTextEntry(1).Text, out hour))
                    add = false;

                if (!Int32.TryParse(info.GetTextEntry(2).Text, out minute))
                    add = false;

                bool[] barray = new bool[7];
                for (int i = 0; i < 7; i++)
                    barray[i] = info.IsSwitched(i);

                if (!add)
                {
                    m.SendGump(this);
                    m.SendMessage("The hour or minute are not valid Int32 values.");
                }

                else if (!AutoStartEvent.Enlisted.Contains(m_Struct))
                {
                    m_Struct.Name = name;
                    m_Struct.Hour = hour;
                    m_Struct.Minute = minute;
                    m_Struct.Days = barray;

                    if (m_Struct.Days[AutoStartEvent.NowDayOfWeek] && (AutoStartEvent.Now.Hour > m_Struct.Hour || (AutoStartEvent.Now.Hour == m_Struct.Hour && AutoStartEvent.Now.Minute > m_Struct.Minute)))
                        m_Struct.LastExecutedDay = AutoStartEvent.Now.Day;

                    m_Struct.SetNextExecution();
                    AutoStartEvent.AddNewTimedEvent(m_Struct);
                    m.SendGump(new IndexGump(0, m.AccessLevel >= AccessLevel.Administrator));
                    m.SendMessage("The timer has been succesfully added.");
                }

                else
                    m.SendMessage("Someone else has edited this entry in the meantime.");
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            bool id = info.ButtonID == 1;
            bool hasaccepted = info.IsSwitched(0);

            if (id && hasaccepted)
                ToSRulesChecker.SetAccepted(sender.Mobile);

            else
                sender.Mobile.SendGump(this);
        }
예제 #27
0
 public override void OnResponse(NetState sender, RelayInfo info)
 {
     if (info.ButtonID == 1)
     {
         for (int i = 0; i < m_Restricted.Length; i++)
         {
             m_Restricted[i] = info.IsSwitched(i + ((m_type == RestrictType.Spells) ? 100 : 500));
             //This way is faster after looking at decompiled BitArray.SetAll( bool )
         }
     }
 }
예제 #28
0
 public override void OnResponse(NetState sender, RelayInfo info)
 {
     if (info.ButtonID == 7 && info.IsSwitched(1))
     {
         m_Parent.OnPicked(sender.Mobile, m_Index);
     }
     else
     {
         sender.Mobile.SendGump(new RewardGump(m_Parent.Title, m_Parent.Rewards, m_Parent.Points, m_Parent.OnPicked));
     }
 }
예제 #29
0
        public virtual void OnResponse(NetState sender, RelayInfo info)
        {
            int buttonID = info.ButtonID;

            foreach (GumpCheck entry in this._Entries.OfType <GumpCheck>())
            {
                entry.InitialState = info.IsSwitched(entry.EntryID);
                entry.Invoke();
            }

            foreach (GumpRadio entry in this.Entries.OfType <GumpRadio>())
            {
                entry.InitialState = info.IsSwitched(entry.EntryID);
                entry.Invoke();
            }

            foreach (GumpTextEntry entry in this._Entries.OfType <GumpTextEntry>())
            {
                entry.InitialText = info.GetTextEntry(entry.EntryID).Text;
                entry.Invoke();
            }

            foreach (GumpTextEntryLimited entry in this._Entries.OfType <GumpTextEntryLimited>())
            {
                entry.InitialText = info.GetTextEntry(entry.EntryID).Text;
                entry.Invoke();
            }

            foreach (
                GumpImageTileButton button in
                this._Entries.OfType <GumpImageTileButton>().Where(button => button.EntryID == buttonID))
            {
                button.Invoke();
            }

            foreach (
                GumpButton button in this._Entries.OfType <GumpButton>().Where(button => button.EntryID == buttonID))
            {
                button.Invoke();
            }
        }
예제 #30
0
파일: Justice.cs 프로젝트: Godkong/RunUO
        public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
        {
            if ( info.ButtonID == 2 )
            {
                bool okay = info.IsSwitched( 1 );

                if ( okay )
                    JusticeVirtue.OnVirtueAccepted( m_Protector, m_Protectee );
                else
                    JusticeVirtue.OnVirtueRejected( m_Protector, m_Protectee );
            }
        }
예제 #31
0
        public override void OnResponse(Server.Network.NetState state, RelayInfo info)
        {
            if (info.ButtonID != (int)Buttons.Okay || m_Quest == null)
            {
                return;
            }

            if (m_Quest.ChainID != QuestChain.None && info.IsSwitched((int)Radios.Chain))
            {
                m_Quest.OnResign(true);
            }

            if (info.IsSwitched((int)Radios.Quest))
            {
                m_Quest.OnResign(false);
            }

            if (info.IsSwitched((int)Radios.None) && m_Quest.Owner != null)
            {
                m_Quest.Owner.SendGump(new MondainQuestGump(m_Quest.Owner));
            }
        }
예제 #32
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ScriptCorpseGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                Item corpse = from.Corpse;
                if (corpse != null)
                {
                    if (m_Price > 0)
                    {
                        if (info.IsSwitched(1))
                        {
                            if (Banker.Withdraw(from, m_Price))
                            {
                                from.SendLocalizedMessage(1060398, m_Price.ToString());                                   // Amount charged
                                from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());                   // Amount left, from bank
                            }
                            else
                            {
                                from.SendMessage("Unfortunately, you do not have enough cash in your bank to summon your corpse");
                                from.CantWalk = false;
                                return;
                            }
                        }
                        else
                        {
                            from.SendMessage("You decide against paying the stone, leaving your corpse behind.");
                            from.CantWalk = false;
                            return;
                        }
                    }
                    from.Corpse.Location = new Point3D(from.Location);

                    Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 30, 5052);

                    Effects.PlaySound(from.Location, from.Map, 0x201);

                    from.Corpse.Map = from.Map;

                    from.CantWalk = false;
                }
                else
                {
                    from.SendMessage("Your corpse has decayed, or you did not have one to start out with.");
                    from.CantWalk = false;
                }
            }
        }
예제 #33
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID > 0 && info.IsSwitched(m_Index + 1)) //correct answer
            {
                m_Objective.Update(null);

                if (m_Quest.Completed)
                {
                    m_Quest.OnCompleted();
                    m_From.SendGump(new MondainQuestGump(m_Quest, MondainQuestGump.Section.Complete, false, true));
                }
                else
                {
                    m_From.SendMessage("Correct!");
                    m_From.SendGump(new QAndAGump(m_From, m_Quest));
                }
            }
            else if (info.ButtonID != 0 && (info.IsSwitched(1) || info.IsSwitched(2) || info.IsSwitched(3) || info.IsSwitched(4)))
            {
                m_From.SendGump(new MondainQuestGump(m_Quest, MondainQuestGump.Section.Failed, false, true));
                m_Quest.OnResign(false);
            }
        }
예제 #34
0
 public override void OnResponse(NetState state, RelayInfo info)
 {
     if (info.ButtonID == (int)Buttons.Confirm)
     {
         if (info.IsSwitched((int)Buttons.Break))
         {
             Confirm(state.Mobile);
         }
         else
         {
             Refuse(state.Mobile);
         }
     }
 }
예제 #35
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            Player handler = _handler as Player;
            string comments = info.GetTextEntry(0).Text;
            int points = 0;

            if (handler == null)
                return;

            if (info.IsSwitched(1))
                points = 2;
            else if (info.IsSwitched(2))
                points = 1;
            else if (info.IsSwitched(3))
                points = 0;
            else if (info.IsSwitched(4))
                points = -1;
            else if (info.IsSwitched(5))
                points = -2;

            if (points > 0)
                handler.RepGood += points;
            else
                handler.RepBad += points;

            if (_entry != null)
            {
                try
                {
                    _entry.WriteLine();
                    _entry.WriteLine(String.Format("### --- Vote: {0} --- ###", points.ToString()));
                    _entry.WriteLine("### --- Comments: --- ###");
                    _entry.WriteLine(comments);
                }
                catch { }
            }
        }
예제 #36
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            bool id          = info.ButtonID == 1;
            bool hasaccepted = info.IsSwitched(0);

            if (id && hasaccepted)
            {
                ToSRulesChecker.SetAccepted(sender.Mobile);
            }

            else
            {
                sender.Mobile.SendGump(this);
            }
        }
예제 #37
0
        public override void OnResponse(GameClient sender, RelayInfo info)
        {
            Mobile m = sender.Mobile;

            if (info.IsSwitched(1))
            {
                if (m.InRange(m_Gate, 2))
                {
                    BaseCreature.TeleportPets(m, m_Gate.LocDest, m_Gate.MapDest);
                    m.MoveToWorld(m_Gate.LocDest, m_Gate.MapDest);
                }
                else
                {
                    m.SendLocalizedMessage(500446);                       // That is too far away.
                }
            }
        }
예제 #38
0
        public override void OnResponse( GameClient sender, RelayInfo info )
        {
            Mobile m = sender.Mobile;

            if ( info.IsSwitched( 1 ) )
            {
                if ( m.InRange( m_Gate, 2 ) )
                {
                    BaseCreature.TeleportPets( m, m_Gate.LocDest, m_Gate.MapDest );
                    m.MoveToWorld( m_Gate.LocDest, m_Gate.MapDest );
                }
                else
                {
                    m.SendLocalizedMessage( 500446 ); // That is too far away.
                }
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            Handeling.Potions = info.IsSwitched(1);
            Handeling.Bandages = info.IsSwitched(2);
            Handeling.TrappedContainers = info.IsSwitched(3);
            Handeling.Bolas = info.IsSwitched(4);
            Handeling.Mounts = info.IsSwitched(5);
            Handeling.Wands = info.IsSwitched(6);

            from.SendGump(new DuelSetup_Rules(Handeling));
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            Handeling.CombatAbilities = info.IsSwitched(1);
            Handeling.Stun = info.IsSwitched(2);
            Handeling.Disarm = info.IsSwitched(3);
            Handeling.ConcussionBlow = info.IsSwitched(4);
            Handeling.CrushingBlow = info.IsSwitched(5);
            Handeling.ParalyzingBlow = info.IsSwitched(6);

            from.SendGump(new FieldSetup_Rules(Handeling));
        }
예제 #41
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
            case 0:
            {
                break;
            }

            case 1001:
            {
                for (int i = 1; i < 4; i++)
                {
                    if (info.IsSwitched(i))
                    {
                        string[]         sep   = { " " };
                        string           text  = info.TextEntries[0].Text;
                        string[]         text1 = text.Split(sep, StringSplitOptions.RemoveEmptyEntries);
                        CommandEventArgs e     = new CommandEventArgs(from, "", text, text1);
                        switch (i)
                        {
                        case (int)CHAN.WORLD: { Bittiez.BoxerChat.Chat.On_Chat_World(e); break; }

                        case (int)CHAN.GUILD: { Bittiez.BoxerChat.Chat.On_Chat_Guild(e); break; }

                        case (int)CHAN.STAFF: { Bittiez.BoxerChat.Chat.On_Chat_Staff(e); break; }
                        }
                        if (from.HasGump(typeof(ChatBox)))
                        {
                            from.CloseGump(typeof(ChatBox));
                        }
                        from.SendGump(new ChatBox(from, i, SX, SY, ""));
                        break;
                    }
                }
                //Send text here..
                break;
            }
            }
        }
예제 #42
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from = sender.Mobile;
            PlayerMobile pm   = from as PlayerMobile;

            if (pm != null)
            {
                pm.ShowNews = info.IsSwitched(0);
            }

            switch (info.ButtonID)
            {
            //deposit
            case 1:
            {
                if (from.Account != null)
                {
                    Account account = from.Account as Account;

                    if (account.WalletBalance > 0)
                    {
                        from.BankBox.DropItem(new Platinum(account.WalletBalance));
                        from.SendAsciiMessage(String.Format("You have deposited {0} platinum coins in to your bank box.", account.WalletBalance));
                        account.WalletBalance = 0;
                    }
                    else
                    {
                        from.SendAsciiMessage("You have no platinum coins to deposit.");
                    }

                    from.CloseGump(typeof(LoginGump));
                }
                break;
            }

            case 2:     //learn
            {
                from.LaunchBrowser("http://www.uoorigins.com/threads/platinum-and-veteran-rewards.1863/");
                break;
            }
            }
        }
예제 #43
0
        public override void OnResponse(RelayInfo info)
        {
            if (info.ButtonID != 1)
            {
                return;
            }

            bool confirm = info.IsSwitched(1);

            if (confirm)
            {
                if (ConfirmCallback != null)
                {
                    ConfirmCallback(User, State);
                }
            }
            else if (CloseCallback != null)
            {
                CloseCallback(User, State);
            }
        }
예제 #44
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID > 0 && info.IsSwitched(m_Index + 1)) //correct answer
            {
                m_Objective.Update(null);

                if (m_Quest.Completed)
                {
                    m_Quest.OnCompleted();
                    m_From.SendGump(new MondainQuestGump(m_Quest, MondainQuestGump.Section.Complete, false, true));
                }
                else
                {
                    m_From.SendMessage("Correct!");
                    m_From.SendGump(new QAndAGump(m_From, m_Quest));
                }
            }
            else
            {
                m_From.SendGump(new MondainQuestGump(m_Quest, MondainQuestGump.Section.Failed, false, true));
                m_Quest.OnResign(false);
            }
        }
예제 #45
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            base.OnResponse(sender, info);

            PlayerMobile pm = sender.Mobile as PlayerMobile;

            if (pm == null || !IsMember(pm, this.guild))
                return;

            GuildDisplayType display = this.m_Display;

            if (info.ButtonID == 5)
            {
                for (int i = 0; i < 3; i++)
                {
                    if (info.IsSwitched(i))
                    {
                        display = (GuildDisplayType)i;
                        this.m_Callback(display);
                        break;
                    }
                }
            }
        }
예제 #46
0
		public override void OnResponse( NetState sender, RelayInfo info )
		{
			if ( info.ButtonID == 1 && info.IsSwitched( 1 ) )
			{
				PlayerMobile player = sender.Mobile as PlayerMobile;

				if ( player != null )
				{
					QuestSystem qs = player.Quest;

					if ( qs is CollectorQuest )
					{
						FindSheetMusicObjective obj = qs.FindObjective( typeof( FindSheetMusicObjective ) ) as FindSheetMusicObjective;

						if ( obj != null && !obj.Completed )
						{
							if ( player.BankBox != null && player.BankBox.ConsumeTotal( typeof( Gold ), 10 ) )
							{
								obj.Complete();
							}
							else
							{
								player.SendLocalizedMessage( 1055108 ); // You don't have enough gold to buy the sheet music.
							}
						}
					}
				}
			}
		}
예제 #47
0
 public override void OnResponse( NetState sender, RelayInfo info )
 {
     if ( info.ButtonID == 1 )
     {
         if ( info.IsSwitched( 1 ) )
             m_System.Accept();
         else
             m_System.Decline();
     }
 }
예제 #48
0
 public override void OnResponse( NetState sender, RelayInfo info )
 {
     if ( info.ButtonID == 1 )
         m_System.EndCancelQuest( info.IsSwitched( 1 ) );
 }
예제 #49
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 1 && info.IsSwitched(1))
            {
                Tournament tourny = this.m_Tournament;
                Mobile from = this.m_From;

                switch ( tourny.Stage )
                {
                    case TournamentStage.Fighting:
                        {
                            if (this.m_Registrar != null)
                            {
                                if (this.m_Tournament.HasParticipant(from))
                                {
                                    this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                        0x35, false, "Excuse me? You are already signed up.", from.NetState);
                                }
                                else
                                {
                                    this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                        0x22, false, "The tournament has already begun. You are too late to signup now.", from.NetState);
                                }
                            }

                            break;
                        }
                    case TournamentStage.Inactive:
                        {
                            if (this.m_Registrar != null)
                                this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                    0x35, false, "The tournament is closed.", from.NetState);

                            break;
                        }
                    case TournamentStage.Signup:
                        {
                            if (this.m_Players.Count != tourny.PlayersPerParticipant)
                            {
                                if (this.m_Registrar != null)
                                {
                                    this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                        0x35, false, "You have not yet chosen your team.", from.NetState);
                                }

                                this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));
                                break;
                            }

                            Ladder ladder = Ladder.Instance;

                            for (int i = 0; i < this.m_Players.Count; ++i)
                            {
                                Mobile mob = (Mobile)this.m_Players[i];

                                LadderEntry entry = (ladder == null ? null : ladder.Find(mob));

                                if (entry != null && Ladder.GetLevel(entry.Experience) < tourny.LevelRequirement)
                                {
                                    if (this.m_Registrar != null)
                                    {
                                        if (mob == from)
                                        {
                                            this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                                0x35, false, "You have not yet proven yourself a worthy dueler.", from.NetState);
                                        }
                                        else
                                        {
                                            this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                                0x35, false, String.Format("{0} has not yet proven themselves a worthy dueler.", mob.Name), from.NetState);
                                        }
                                    }

                                    this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));
                                    return;
                                }
                                else if (tourny.HasParticipant(mob))
                                {
                                    if (this.m_Registrar != null)
                                    {
                                        if (mob == from)
                                        {
                                            this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                                0x35, false, "You have already entered this tournament.", from.NetState);
                                        }
                                        else
                                        {
                                            this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                                0x35, false, String.Format("{0} has already entered this tournament.", mob.Name), from.NetState);
                                        }
                                    }

                                    this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));
                                    return;
                                }
                                else if (mob is PlayerMobile && ((PlayerMobile)mob).DuelContext != null)
                                {
                                    if (this.m_Registrar != null)
                                    {
                                        if (mob == from)
                                        {
                                            this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                                0x35, false, "You are already assigned to a duel. You must yield it before joining this tournament.", from.NetState);
                                        }
                                        else
                                        {
                                            this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                                0x35, false, String.Format("{0} is already assigned to a duel. They must yield it before joining this tournament.", mob.Name), from.NetState);
                                        }
                                    }

                                    this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));
                                    return;
                                }
                            }

                            if (this.m_Registrar != null)
                            {
                                string fmt;

                                if (tourny.PlayersPerParticipant == 1)
                                    fmt = "As you say m'{0}. I've written your name to the bracket. The tournament will begin {1}.";
                                else if (tourny.PlayersPerParticipant == 2)
                                    fmt = "As you wish m'{0}. The tournament will begin {1}, but first you must name your partner.";
                                else
                                    fmt = "As you wish m'{0}. The tournament will begin {1}, but first you must name your team.";

                                string timeUntil;
                                int minutesUntil = (int)Math.Round(((tourny.SignupStart + tourny.SignupPeriod) - DateTime.Now).TotalMinutes);

                                if (minutesUntil == 0)
                                    timeUntil = "momentarily";
                                else
                                    timeUntil = String.Format("in {0} minute{1}", minutesUntil, minutesUntil == 1 ? "" : "s");

                                this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                    0x35, false, String.Format(fmt, from.Female ? "Lady" : "Lord", timeUntil), from.NetState);
                            }

                            TournyParticipant part = new TournyParticipant(from);
                            part.Players.Clear();
                            part.Players.AddRange(this.m_Players);

                            tourny.Participants.Add(part);

                            break;
                        }
                }
            }
            else if (info.ButtonID > 1)
            {
                int index = info.ButtonID - 1;

                if (index > 0 && index < this.m_Players.Count)
                {
                    this.m_Players.RemoveAt(index);
                    this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));
                }
                else if (this.m_Players.Count < this.m_Tournament.PlayersPerParticipant)
                {
                    this.m_From.BeginTarget(12, false, TargetFlags.None, new TargetCallback(AddPlayer_OnTarget));
                    this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));
                }
            }
        }
예제 #50
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (ResurrectMessage.SilverSapling == this.m_Msg && 1 == info.ButtonID)
            {
                PlayerMobile pm = from as PlayerMobile;
                if (null != pm && pm.Region.IsPartOf("Abyss"))
                {
                    pm.Location = pm.SSSeedLocation;
                    pm.Map      = pm.SSSeedMap;
                    if (null != pm.Corpse)
                    {
                        pm.Corpse.Location = pm.Location;
                        pm.Corpse.Map      = pm.Map;
                    }
                    pm.Resurrect();
                }
                return;
            }

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
                    return;
                }

                if (this.m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, this.m_Price))
                        {
                            from.SendLocalizedMessage(1060398, this.m_Price.ToString());            // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (this.m_Healer != null && from != this.m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(this.m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker:
                        from.Hits = AOS.Scale(from.HitsMax, 20);
                        break;

                    case VirtueLevel.Follower:
                        from.Hits = AOS.Scale(from.HitsMax, 40);
                        break;

                    case VirtueLevel.Knight:
                        from.Hits = AOS.Scale(from.HitsMax, 80);
                        break;
                    }
                }

                if (this.m_FromSacrifice && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack   = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        List <Item> items = new List <Item>(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = items[i];

                            if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }

                if (!Core.AOS && from.ShortTermMurders >= 5)
                {
                    double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0; // 5 to 15% loss

                    if (loss < 0.85)
                    {
                        loss = 0.85;
                    }
                    else if (loss > 0.95)
                    {
                        loss = 0.95;
                    }

                    if (from.RawStr * loss > 10)
                    {
                        from.RawStr = (int)(from.RawStr * loss);
                    }
                    if (from.RawInt * loss > 10)
                    {
                        from.RawInt = (int)(from.RawInt * loss);
                    }
                    if (from.RawDex * loss > 10)
                    {
                        from.RawDex = (int)(from.RawDex * loss);
                    }

                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base * loss > 35)
                        {
                            from.Skills[s].Base *= loss;
                        }
                    }
                }

                if (from.Alive && this.m_HitsScalar > 0)
                {
                    from.Hits = (int)(from.HitsMax * this.m_HitsScalar);
                }
            }
        }
예제 #51
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            int item = info.ButtonID;

            switch (info.ButtonID)
            {
            case 0:
            { if (from.HasGump(typeof(ItemPicker)))
              {
                  from.CloseGump(typeof(ItemPicker));
              }
              break; }

            case 20001: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(1)); break; }

            case 20002: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(1000)); break; }

            case 20003: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(2000)); break; }

            case 20004: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(3000)); break; }

            case 20005: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(4000)); break; }

            case 20006: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(5000)); break; }

            case 20007: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(6000)); break; }

            case 20008: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(7000)); break; }

            case 20009: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(8000)); break; }

            case 20010: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(9000)); break; }

            case 20011: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(10000)); break; }

            case 20012: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(11000)); break; }

            case 20013: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(12000)); break; }

            case 20014: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(13000)); break; }

            case 20015: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(14000)); break; }

            case 20016: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(15000)); break; }

            case 20017: { if (from.HasGump(typeof(ItemPicker)))
                          {
                              from.CloseGump(typeof(ItemPicker));
                          }
                          from.SendGump(new ItemPicker(15382)); break; }

            default:
            {
                string com1 = "";
                string com2 = " set movable false";

                if (info.IsSwitched(0) == true)
                {
                    com1 = "[m add item ";
                }
                else if (info.IsSwitched(1) == true)
                {
                    com1 = "[add item ";
                }
                else if (info.IsSwitched(2) == true)
                {
                    com1 = "[tile item ";
                }
                else
                {
                    com1 = "[m set itemid ";
                }

                CommandSystem.Handle(from, String.Format(com1 + item + com2));
                from.SendGump(new ItemPicker(item));
                break;
            }
            }
        }
예제 #52
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            var from = state.Mobile;

            from.CloseGump <ResurrectGump>();

            if (info.ButtonID != 1 && info.ButtonID != 2)
            {
                return;
            }

            if (from.Map?.CanFit(from.Location, 16, false, false) != true)
            {
                from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
                return;
            }

            if (m_Price > 0)
            {
                if (info.IsSwitched(1))
                {
                    if (Banker.Withdraw(from, m_Price))
                    {
                        from.SendLocalizedMessage(
                            1060398,
                            m_Price.ToString()
                            ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                        from.SendLocalizedMessage(
                            1060022,
                            Banker.GetBalance(from).ToString()
                            ); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                    }
                    else
                    {
                        from.SendLocalizedMessage(
                            1060020
                            ); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                        return;
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead.
                    return;
                }
            }

            from.PlaySound(0x214);
            from.FixedEffect(0x376A, 10, 16);

            from.Resurrect();

            if (m_Healer != null && from != m_Healer)
            {
                var level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                from.Hits = level switch
                {
                    VirtueLevel.Seeker => AOS.Scale(from.HitsMax, 20),
                    VirtueLevel.Follower => AOS.Scale(from.HitsMax, 40),
                    VirtueLevel.Knight => AOS.Scale(from.HitsMax, 80),
                    _ => from.Hits
                };
            }

            if (m_FromSacrifice && from is PlayerMobile mobile)
            {
                mobile.AvailableResurrects -= 1;

                var pack   = mobile.Backpack;
                var corpse = mobile.Corpse;

                if (pack != null && corpse != null)
                {
                    var items = new List <Item>(corpse.Items);

                    for (var i = 0; i < items.Count; ++i)
                    {
                        var item = items[i];

                        if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                        {
                            pack.DropItem(item);
                        }
                    }
                }
            }

            if (from.Fame > 0)
            {
                var amount = from.Fame / 10;

                Titles.AwardFame(from, -amount, true);
            }

            if (!Core.AOS && from.ShortTermMurders >= 5)
            {
                var loss = (100.0 - (4.0 + from.ShortTermMurders / 5.0)) / 100.0; // 5 to 15% loss

                if (loss < 0.85)
                {
                    loss = 0.85;
                }
                else if (loss > 0.95)
                {
                    loss = 0.95;
                }

                if (from.RawStr * loss > 10)
                {
                    from.RawStr = (int)(from.RawStr * loss);
                }

                if (from.RawInt * loss > 10)
                {
                    from.RawInt = (int)(from.RawInt * loss);
                }

                if (from.RawDex * loss > 10)
                {
                    from.RawDex = (int)(from.RawDex * loss);
                }

                for (var s = 0; s < from.Skills.Length; s++)
                {
                    if (from.Skills[s].Base * loss > 35)
                    {
                        from.Skills[s].Base *= loss;
                    }
                }
            }

            if (from.Alive && m_HitsScalar > 0)
            {
                from.Hits = (int)(from.HitsMax * m_HitsScalar);
            }
        }
    }
예제 #53
0
파일: Sphynx.cs 프로젝트: Ravenwolfe/xrunuo
            public override void OnResponse( GameClient sender, RelayInfo info )
            {
                if ( info.ButtonID == 2 )
                {
                    if ( info.IsSwitched( 1 ) )
                    {
                        if ( from.Backpack.ConsumeTotal( typeof( Gold ), 5000 ) )
                        {
                            from.SendLocalizedMessage( 1060867 ); // You pay the fee.

                            Sphynx.Say( Utility.RandomList( m_Messages ) );

                            Sphynx.Say( Utility.RandomList( m_Messages ) );

                            Sphynx.m_Table[from] = true;
                        }
                        else
                        {
                            from.SendLocalizedMessage( 1061006 ); // You haven't got the coin to make the proper donation to the Sphynx.  Your fortune has not been read.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage( 1061007 ); // You decide against having your fortune told.
                    }
                }
            }
예제 #54
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info == null || sender == null || sender.Mobile == null)
            {
                return;
            }

            // read the text entries for the search criteria
            TextRelay tr = info.GetTextEntry(100);             // quest name

            if (tr != null)
            {
                m_QuestItem.Name = tr.Text.Trim();
            }

            tr = info.GetTextEntry(102);             // title
            if (tr != null)
            {
                m_QuestItem.TitleString = tr.Text.Trim();
            }

            tr = info.GetTextEntry(103);             // notestring
            if (tr != null)
            {
                m_QuestItem.NoteString = tr.Text;
            }

            tr = info.GetTextEntry(200);             // objectives
            if (tr != null)
            {
                m_QuestItem.Objective1 = tr.Text.Trim();
            }

            tr = info.GetTextEntry(201);
            if (tr != null)
            {
                m_QuestItem.Objective2 = tr.Text.Trim();
            }

            tr = info.GetTextEntry(202);
            if (tr != null)
            {
                m_QuestItem.Objective3 = tr.Text.Trim();
            }

            tr = info.GetTextEntry(203);
            if (tr != null)
            {
                m_QuestItem.Objective4 = tr.Text.Trim();
            }

            tr = info.GetTextEntry(204);
            if (tr != null)
            {
                m_QuestItem.Objective5 = tr.Text.Trim();
            }

            tr = info.GetTextEntry(205);
            if (tr != null && tr.Text != null && tr.Text.Length > 0)             // descriptions
            {
                m_QuestItem.Description1 = tr.Text.Trim();
            }
            else
            {
                m_QuestItem.Description1 = null;
            }

            tr = info.GetTextEntry(206);
            if (tr != null && tr.Text != null && tr.Text.Length > 0)
            {
                m_QuestItem.Description2 = tr.Text.Trim();
            }
            else
            {
                m_QuestItem.Description2 = null;
            }

            tr = info.GetTextEntry(207);
            if (tr != null && tr.Text != null && tr.Text.Length > 0)
            {
                m_QuestItem.Description3 = tr.Text.Trim();
            }
            else
            {
                m_QuestItem.Description3 = null;
            }

            tr = info.GetTextEntry(208);
            if (tr != null && tr.Text != null && tr.Text.Length > 0)
            {
                m_QuestItem.Description4 = tr.Text.Trim();
            }
            else
            {
                m_QuestItem.Description4 = null;
            }

            tr = info.GetTextEntry(209);
            if (tr != null && tr.Text != null && tr.Text.Length > 0)
            {
                m_QuestItem.Description5 = tr.Text.Trim();
            }
            else
            {
                m_QuestItem.Description5 = null;
            }

            tr = info.GetTextEntry(210);             // expiration
            if (tr != null && tr.Text != null && tr.Text.Length > 0)
            {
                try
                {
                    m_QuestItem.Expiration = double.Parse(tr.Text.Trim());
                }
                catch
                { }
            }

            // check all of the check boxes
            m_QuestItem.PartyEnabled = info.IsSwitched(300);
            m_QuestItem.CanSeeReward = info.IsSwitched(301);

            // refresh the time created
            m_QuestItem.TimeCreated = DateTime.UtcNow;

            switch (info.ButtonID)
            {
            case 0:                     // Okay
            {
                break;
            }

            case 1:                     // Select Reward
            {
                sender.Mobile.Target = new RewardTarget(m_QuestItem);
                break;
            }

            case 2:                     // Select Reward Return
            {
                sender.Mobile.Target = new ReturnTarget(m_QuestItem);
                break;
            }
            }
        }
예제 #55
0
		public override void OnResponse( NetState sender, RelayInfo info )
		{
			if( info.ButtonID == 1 )
			{
				for( int i = 0; i < m_Restricted.Length; i++ )
				{
					m_Restricted[ i ] = info.IsSwitched( i + ((m_type == RestrictType.Spells) ? 100 : 500 ));
					//This way is faster after looking at decompiled BitArray.SetAll( bool )
				}
			}
		}
예제 #56
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            m_cycle = 0;
            from.CloseGump(typeof(GetPetGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        ArrayList pets = new ArrayList();

                        foreach (Mobile m in World.Mobiles.Values)
                        {
                            if (m is BaseCreature)
                            {
                                BaseCreature bc = (BaseCreature)m;

                                if ((bc.Controlled && bc.ControlMaster == from) || (bc.Summoned && bc.SummonMaster == from))
                                {
                                    pets.Add(bc);
                                }
                            }
                        }

                        if (pets.Count > 0)
                        {
                            m_Price = 100 * pets.Count;////Price per Pet 3500

/*   To use Gold Ledger remove this line
*                                                          Item[] items = from.Backpack.FindItemsByType(typeof(GoldLedger));
*                                                          foreach (GoldLedger tl in items)
*                                                          {
*                                                              if (tl.Owner == from.Serial && tl.Gold - m_Price >= 0)
*                                                              {
*                                                                  tl.Gold = (tl.Gold - m_Price); //withdraw gold
*                                                                  //Delete();
*                                                                  from.SendMessage(1174, "{0} Gold to your Gold had been withdrawn from ledger.", m_Price); //send a message to the player gold was taken from ledger
*                                                                  m_cycle = 1;
*
*                                                                  for (int i = 0; i < pets.Count; ++i)
*                                                                  {
*                                                                      Mobile pet = (Mobile)pets[i];
*
*                                                                      if (pet is IMount)
*                                                                          ((IMount)pet).Rider = null; // make sure it's dismounted
*
*                                                                      pet.MoveToWorld(from.Location, from.Map);
*                                                                      Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 30, 5052);
*                                                                      Effects.PlaySound(from.Location, from.Map, 0x201);
*                                                                      //return;
*                                                                  }
*                                                              }
*                                                          }
*  To use Gold Ledger remove this line   */

                            if (m_cycle == 0)
                            {
                                if (Banker.Withdraw(from, m_Price))
                                {
                                    from.SendLocalizedMessage(1060398, m_Price.ToString());                 // Amount charged
                                    from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // Amount left, from bank

                                    for (int i = 0; i < pets.Count; ++i)
                                    {
                                        Mobile pet = (Mobile)pets[i];

                                        if (pet is IMount)
                                        {
                                            ((IMount)pet).Rider = null;     // make sure it's dismounted
                                        }
                                        pet.MoveToWorld(from.Location, from.Map);

                                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 30, 5052);
                                        Effects.PlaySound(from.Location, from.Map, 0x201);
                                    }
                                }
                                else
                                {
                                    from.SendMessage("Unfortunately, you do not have enough cash in your bank to summon your pets");
                                }
                                return;
                            }
                        }
                    }
                }
            }
        }
예제 #57
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = this.m_From;
            Mobile mob = this.m_Requested;

            if (info.ButtonID != 1 || !this.m_Active)
                return;

            this.m_Active = false;

            if (info.IsSwitched(1))
            {
                PlayerMobile pm = mob as PlayerMobile;

                if (pm == null)
                    return;

                if (AcceptDuelGump.IsIgnored(mob, from) || mob.Blessed)
                {
                    this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));

                    if (this.m_Registrar != null)
                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                            0x22, false, "They ignore your invitation.", from.NetState);
                }
                else if (pm.DuelContext != null)
                {
                    this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));

                    if (this.m_Registrar != null)
                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                            0x22, false, "They are already assigned to another duel.", from.NetState);
                }
                else if (this.m_Players.Contains(mob))
                {
                    this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));

                    if (this.m_Registrar != null)
                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                            0x22, false, "You have already named them as a team member.", from.NetState);
                }
                else if (this.m_Tournament.HasParticipant(mob))
                {
                    this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));

                    if (this.m_Registrar != null)
                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                            0x22, false, "They have already entered this tournament.", from.NetState);
                }
                else if (this.m_Players.Count >= this.m_Tournament.PlayersPerParticipant)
                {
                    this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));

                    if (this.m_Registrar != null)
                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                            0x22, false, "Your team is full.", from.NetState);
                }
                else
                {
                    this.m_Players.Add(mob);

                    this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));

                    if (this.m_Registrar != null)
                    {
                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                            0x59, false, String.Format("{0} has accepted your offer of partnership.", mob.Name), from.NetState);

                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                            0x59, false, String.Format("You have accepted the partnership with {0}.", from.Name), mob.NetState);
                    }
                }
            }
            else
            {
                if (info.IsSwitched(3))
                    AcceptDuelGump.BeginIgnore(this.m_Requested, this.m_From);

                this.m_From.SendGump(new ConfirmSignupGump(this.m_From, this.m_Registrar, this.m_Tournament, this.m_Players));

                if (this.m_Registrar != null)
                {
                    this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                        0x22, false, String.Format("{0} has declined your offer of partnership.", mob.Name), from.NetState);

                    this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                        0x22, false, String.Format("You have declined the partnership with {0}.", from.Name), mob.NetState);
                }
            }
        }
예제 #58
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            int  val         = info.ButtonID;
            bool bResendGump = false;

            if (val <= 0)
            {
                return;
            }

            if (m_Account == null)
            {
                return;
            }

            try
            {
                TextRelay tr          = info.GetTextEntry(0);
                string    oldpassword = (tr == null ? null : tr.Text.Trim());

                if (oldpassword != null && oldpassword.Length != 0 && Account.CheckAllPasswords(m_Account.Username, oldpassword) /*m_Account.CheckPassword(oldpassword)*/)
                {
                    //valid password, proceed
                    switch (val)
                    {
                    case SET_EMAIL_BUTTON:                             //set email address
                    {
                        TextRelay tr1 = info.GetTextEntry(1);
                        TextRelay tr2 = info.GetTextEntry(2);

                        string newemail        = (tr1 == null ? null : tr1.Text.Trim());
                        string confirmnewemail = (tr2 == null ? null : tr2.Text.Trim());

                        if (newemail == null || confirmnewemail == null ||
                            newemail.Length == 0 || confirmnewemail.Length == 0)
                        {
                            m_From.SendMessage(0x35, "Please enter email and verify email.");
                            bResendGump = true;
                        }
                        else if (newemail != confirmnewemail)
                        {
                            m_From.SendMessage(0x35, "Email input doesn't match");
                            bResendGump = true;
                        }
                        else if (SMTP.SmtpDirect.CheckEmailAddy(newemail, false) == false)
                        {
                            m_From.SendMessage(0x35, "Entered address isn't a valid email address.");
                            bResendGump = true;
                        }
                        else if (newemail.IndexOf('@', 2, newemail.Length - 5) == -1)
                        {
                            m_From.SendMessage(0x35, "Email address not of proper format");
                            bResendGump = true;
                        }
                        else if (m_Account.AccountActivated && m_Account.EmailAddress != null && newemail.ToLower() == m_Account.EmailAddress.ToLower())
                        {
                            m_From.SendMessage(0x35, "Email address matches current email address.");
                            bResendGump = true;
                        }
                        else
                        {
                            string newActivationKey = CreateActivationKey(8);

                            //Send Email
                            bool bSent = SendActivationEmail(newemail, newActivationKey, false);
                            if (bSent)
                            {
                                string regSubject = "Email address change";
                                string regBody    = "Email address change made.\n";
                                if (m_Account.AccountActivated == false)
                                {
                                    regSubject = "Account Activation request";
                                    regBody    = "Account Activation: Email address change made.\n";
                                }
                                regBody += "Info of from: \n";
                                regBody += "\n";
                                regBody += "Account: " + (m_Account == null ? "<unknown>" : m_Account.Username) + "\n";
                                regBody += "Character: " + m_From.Name + "\n";
                                regBody += "IP: " + sender.Address.ToString() + "\n";
                                regBody += "Old Email: " + m_Account.EmailAddress + "\n";
                                regBody += "New Email: " + newemail + "\n";
                                regBody += "Activation Key: " + newActivationKey + "\n";
                                regBody += "\n";

                                Emailer mail = new Emailer();
                                mail.SendEmail("*****@*****.**", regSubject, regBody, false);

                                if (m_Account.AccountActivated &&
                                    newemail.ToLower() != m_Account.EmailAddress.ToLower())
                                {
                                    string subject2 = "Angel Island Account email changed";
                                    string body2    = "\nThis email is being sent to notify that someone has changed your email for your ";
                                    body2 += "Angel Island account from ";
                                    body2 += m_Account.EmailAddress;
                                    body2 += " to ";
                                    body2 += newemail;
                                    body2 += "\n\nIf you did not request this change, please contact an Angel Island ";
                                    body2 += "administrator as soon as possible.";
                                    body2 += "\n\nRegards,\n  The Angel Island Team\n\n";

                                    mail = new Emailer();
                                    mail.SendEmail(m_Account.EmailAddress, subject2, body2, false);
                                }

                                //success
                                string[] tmp = new string[m_Account.EmailHistory.Length + 1];
                                tmp[0] = newemail;
                                m_Account.EmailHistory.CopyTo(tmp, 1);
                                m_Account.EmailHistory = tmp;

                                m_Account.EmailAddress = newemail;

                                m_Account.ActivationKey            = newActivationKey;
                                m_Account.AccountActivated         = false;
                                m_Account.LastActivationResendTime = DateTime.Now;


                                //Notify user.
                                m_From.SendMessage(0x35, "Email address accepted.");
                                m_From.SendMessage(0x35, "An activation key has been sent to " + newemail);
                                m_From.SendMessage(0x35, "After you get the key, use the [profile command again to complete activation.");
                            }
                            else
                            {
                                //failure
                                //Notify user.
                                m_From.SendMessage(0x35, "Error with email.");
                                m_From.SendMessage(0x35, "Email address not changed.");
                            }
                        }

                        break;
                    }

                    case RESEND_ACTIVATION:
                    {
                        if (m_Account.LastActivationResendTime + TimeSpan.FromHours(24.0) > DateTime.Now)
                        {
                            m_From.SendMessage(0x35, "You can only send an activation email once every 24 hours.");
                        }
                        else
                        {
                            string email = m_Account.EmailAddress;
                            string key   = m_Account.ActivationKey;
                            bool   bSent = SendActivationEmail(email, key, true);

                            if (bSent)
                            {
                                m_Account.LastActivationResendTime = DateTime.Now;
                                m_From.SendMessage(0x35, "The activation email has been resent to " + email);
                            }
                            else
                            {
                                m_From.SendMessage(0x35, "There was a problem resending the activation email to " + email);
                                bResendGump = true;
                            }
                        }
                        break;
                    }

                    case ENTER_ACTIVATION_KEY:
                    {
                        TextRelay tr1 = info.GetTextEntry(1);

                        string activationEntry = (tr1 == null ? null : tr1.Text.Trim());

                        if (activationEntry == m_Account.ActivationKey)
                        {
                            m_Account.AccountActivated = true;
                            m_Account.ActivationKey    = "";

                            m_From.SendMessage(0x35, "Your account is now activated.");
                        }
                        else
                        {
                            m_From.SendMessage(0x35, "That is not the correct activation key.");
                            m_From.SendMessage(0x35, "Make sure you have the correct capitalization.");
                        }

                        bResendGump = true;
                        break;
                    }

                    case RESET_ACTIVATION_ATTEMPT:
                    {
                        m_Account.AccountActivated = false;
                        m_Account.EmailAddress     = "";
                        m_Account.ActivationKey    = "";

                        m_From.SendMessage(0x35, "Your activation attempt has been reset.");
                        bResendGump = true;
                        break;
                    }

                    case SET_PASSWORD:                             //set password
                    {
                        TextRelay tr3 = info.GetTextEntry(3);
                        TextRelay tr4 = info.GetTextEntry(4);

                        string newpassword        = (tr3 == null ? null : tr3.Text.Trim());
                        string confirmnewpassword = (tr4 == null ? null : tr4.Text.Trim());

                        if (newpassword == null || confirmnewpassword == null ||
                            newpassword.Length == 0 || confirmnewpassword.Length == 0)
                        {
                            m_From.SendMessage(0x35, "Please enter new password and confirm new password.");
                            bResendGump = true;
                        }
                        else if (newpassword != confirmnewpassword)
                        {
                            m_From.SendMessage(0x35, "Password input doesn't match");
                            bResendGump = true;
                        }
                        else if (!m_Account.AccountActivated)
                        {
                            m_From.SendMessage(0x35, "You may not change your password until you activate your account by providing a email address.");
                        }
                        else if (newpassword.Length < 6)
                        {
                            m_From.SendMessage(0x35, "Your password must be at least 6 characters long.");
                            bResendGump = true;
                        }
                        else if (newpassword.Length > 16)
                        {
                            m_From.SendMessage(0x35, "Your password can be at most 16 characters long.");
                            bResendGump = true;
                        }
                        else if (newpassword.IndexOfAny(new char[] { ' ', '@' }) != -1)
                        {
                            m_From.SendMessage(0x35, "Your password cannot contain the following characters: <space>, @");
                            bResendGump = true;
                        }
                        else
                        {
                            m_Account.SetPassword(newpassword);
                            m_From.SendMessage(0x35, "New password set.");

                            if (!m_Account.AccountActivated && oldpassword == m_Account.ActivationKey)
                            {
                                m_Account.AccountActivated = true;
                                Console.WriteLine("Account {0} just got activated by entering the ActivationKey.", m_Account.Username);
                            }

                            if (m_Account.AccountActivated)
                            {
                                //Send Email
                                string subject = "Account Information for Angel Island";
                                string body    = "\nYour password has been changed in game.\n";
                                body += "It is now: " + newpassword;
                                body += "\n\nYou can change your password using the [profile command.\n\n";
                                body += "Regards,\n  The Angel Island Team\n\n";

                                Emailer mail = new Emailer();
                                if (mail.SendEmail(m_Account.EmailAddress, subject, body, false))
                                {
                                    string regSubject = "Password change";
                                    string regBody    = "Password change made.\n";
                                    regBody += "Info of from: \n";
                                    regBody += "\n";
                                    regBody += "Account: " + (m_Account == null ? "<unknown>" : m_Account.Username) + "\n";
                                    regBody += "Character: " + m_From.Name + "\n";
                                    regBody += "IP: " + sender.Address.ToString() + "\n";
                                    regBody += "Email: " + m_Account.EmailAddress + "\n";
                                    regBody += "New Password: "******"\n";
                                    regBody += "\n";

                                    mail = new Emailer();
                                    mail.SendEmail("*****@*****.**", regSubject, regBody, false);

                                    //Notify user
                                    m_From.SendMessage(0x35, "Your new password has been sent to " + m_Account.EmailAddress);
                                }
                                else
                                {
                                    //Notify user
                                    m_From.SendMessage(0x35, "Error sending email to " + m_Account.EmailAddress + "!!");
                                }
                            }
                        }
                        break;
                    }

                    case SET_NOTIFICATION:
                    {
                        if (info.IsSwitched(5))
                        {
                            m_Account.DoNotSendEmail = false;
                            m_From.SendMessage("Your account is set to receive email about Angel Island.");
                        }
                        else
                        {
                            m_Account.DoNotSendEmail = true;
                            m_From.SendMessage("Your account is set to not receive email about Angel Island.");
                        }
                        bResendGump = true;
                        break;
                    }
                    }
                }
                else
                {
                    m_From.SendMessage(0x35, "Invalid password supplied");
                    bResendGump = true;
                }
            }
            catch (Exception exception)
            {
                LogHelper.LogException(exception);
                Console.WriteLine("!!!!!!!!!!!!!!!!!!!!!!");
                Console.WriteLine("Exception caught in ProfileGump.OnResponse() : " + exception.Message);
                Console.WriteLine(exception.StackTrace);
                Console.WriteLine("!!!!!!!!!!!!!!!!!!!!!!");
            }

            if (bResendGump)
            {
                m_From.SendGump(new ProfileGump(m_From));
            }
        }
예제 #59
0
		public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
		{
            if(info == null || sender == null || sender.Mobile == null) return;

            // read the text entries for the search criteria
      	    TextRelay tr = info.GetTextEntry( 100 );        // quest name
      	    if(tr != null)
                m_QuestItem.Name = tr.Text.Trim();

      	    tr = info.GetTextEntry( 102 );        // title
      	    if(tr != null)
                m_QuestItem.TitleString  = tr.Text.Trim();

      	    tr = info.GetTextEntry( 103 );        // notestring
      	    if(tr != null)
                m_QuestItem.NoteString = tr.Text;

      	    tr = info.GetTextEntry( 200 );        // objectives
      	    if(tr != null)
                m_QuestItem.Objective1 = tr.Text.Trim();

      	    tr = info.GetTextEntry( 201 );
      	    if(tr != null)
                m_QuestItem.Objective2 = tr.Text.Trim();

      	    tr = info.GetTextEntry( 202 );
      	    if(tr != null)
      	    m_QuestItem.Objective3 = tr.Text.Trim();

      	    tr = info.GetTextEntry( 203 );
			if (tr != null)
                m_QuestItem.Objective4 = tr.Text.Trim();

      	    tr = info.GetTextEntry( 204 );
      	    if(tr != null)
                m_QuestItem.Objective5 = tr.Text.Trim();

            tr = info.GetTextEntry( 205 );
            if(tr != null && tr.Text != null && tr.Text.Length > 0)       // descriptions
      	       m_QuestItem.Description1 = tr.Text.Trim();
      	    else
      	       m_QuestItem.Description1 = null;

      	    tr = info.GetTextEntry( 206 );
      	    if(tr != null && tr.Text != null && tr.Text.Length > 0)
      	       m_QuestItem.Description2 = tr.Text.Trim();
      	    else
      	       m_QuestItem.Description2 = null;

      	    tr = info.GetTextEntry( 207 );
      	    if(tr != null && tr.Text != null && tr.Text.Length > 0)
      	       m_QuestItem.Description3 = tr.Text.Trim();
      	    else
      	       m_QuestItem.Description3 = null;

      	    tr = info.GetTextEntry( 208 );
      	    if(tr != null && tr.Text != null && tr.Text.Length > 0)
      	       m_QuestItem.Description4 = tr.Text.Trim();
      	    else
      	       m_QuestItem.Description4 = null;

      	    tr = info.GetTextEntry( 209 );
      	    if(tr != null && tr.Text != null && tr.Text.Length > 0)
      	       m_QuestItem.Description5 = tr.Text.Trim();
      	    else
      	       m_QuestItem.Description5 = null;

      	    tr = info.GetTextEntry( 210 );         // expiration
      	    if(tr != null && tr.Text != null && tr.Text.Length > 0){
                  try{m_QuestItem.Expiration = double.Parse(tr.Text.Trim());} catch{}
              }

      	    // check all of the check boxes
  			m_QuestItem.PartyEnabled = info.IsSwitched(300);
  			m_QuestItem.CanSeeReward = info.IsSwitched(301);
  			
  			// refresh the time created
  			m_QuestItem.TimeCreated = DateTime.Now;


			switch ( info.ButtonID )
			{
				case 0: // Okay
				{

					break;
				}
				case 1: // Select Reward
				{
				    sender.Mobile.Target = new RewardTarget(m_QuestItem);
				    break;
				}
				case 2: // Select Reward Return
				{
				    sender.Mobile.Target = new ReturnTarget(m_QuestItem);
				    break;
				}

			}
		}
예제 #60
0
        public override void OnResponse(GameClient state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);

                from.Resurrect(m_Healer);

                if (from is PlayerMobile)
                {
                    ((PlayerMobile)from).CheckKRStartingQuestStep(26);
                }

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker:
                        from.Hits = AOS.Scale(from.HitsMax, 20);
                        break;

                    case VirtueLevel.Follower:
                        from.Hits = AOS.Scale(from.HitsMax, 40);
                        break;

                    case VirtueLevel.Knight:
                        from.Hits = AOS.Scale(from.HitsMax, 80);
                        break;
                    }
                }

                if (m_FromSacrifice && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack   = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        ArrayList items = new ArrayList(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = (Item)items[i];

                            if (item.Movable && item.LootType != LootType.Cursed)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }
            }
        }