public GetTextEntry ( int entryID ) : |
||
entryID | int | |
Résultat |
public override void OnResponse( NetState sender, RelayInfo info ) { PlayerMobile pm = sender.Mobile as PlayerMobile; if( pm == null || pm.Guild != null ) return; //Sanity switch( info.ButtonID ) { case 1: { TextRelay tName = info.GetTextEntry( 5 ); TextRelay tAbbrev = info.GetTextEntry( 6 ); string guildName = (tName == null) ? "" : tName.Text; string guildAbbrev = (tAbbrev == null) ? "" : tAbbrev.Text; guildName = Utility.FixHtml( guildName.Trim() ); guildAbbrev = Utility.FixHtml( guildAbbrev.Trim() ); if( guildName.Length <= 0 ) pm.SendLocalizedMessage( 1070884 ); // Guild name cannot be blank. else if( guildAbbrev.Length <= 0 ) pm.SendLocalizedMessage( 1070885 ); // You must provide a guild abbreviation. else if( guildName.Length > Guild.NameLimit ) pm.SendLocalizedMessage( 1063036, Guild.NameLimit.ToString() ); // A guild name cannot be more than ~1_val~ characters in length. else if( guildAbbrev.Length > Guild.AbbrevLimit ) pm.SendLocalizedMessage( 1063037, Guild.AbbrevLimit.ToString() ); // An abbreviation cannot exceed ~1_val~ characters in length. else if( Guild.FindByAbbrev( guildAbbrev ) != null || !BaseGuildGump.CheckProfanity( guildAbbrev ) ) pm.SendLocalizedMessage( 501153 ); // That abbreviation is not available. else if( Guild.FindByName( guildName ) != null || !BaseGuildGump.CheckProfanity( guildName ) ) pm.SendLocalizedMessage( 1063000 ); // That guild name is not available. else if( !Banker.Withdraw( pm, Guild.RegistrationFee ) ) pm.SendLocalizedMessage( 1063001, Guild.RegistrationFee.ToString() ); // You do not possess the ~1_val~ gold piece fee required to create a guild. else { pm.SendLocalizedMessage( 1060398, Guild.RegistrationFee.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. pm.SendGump(new GuildForm()); pm.SendLocalizedMessage( 1063238 ); // Your new guild has been founded. pm.Guild = new Guild( pm, guildName, guildAbbrev ); } break; } case 2: { pm.AcceptGuildInvites = !pm.AcceptGuildInvites; if( pm.AcceptGuildInvites ) pm.SendLocalizedMessage( 1070699 ); // You are now accepting guild invitations. else pm.SendLocalizedMessage( 1070698 ); // You are now ignoring guild invitations. break; } } }
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) { Mobile from = sender.Mobile; this.caller = sender.Mobile; switch (info.ButtonID) { case 1: { TextRelay entrySphereAcc = info.GetTextEntry(10); this.textSphereAcc = (entrySphereAcc == null ? "" : entrySphereAcc.Text.Trim()); TextRelay entrySphereChar = info.GetTextEntry(11); this.textSphereChar = (entrySphereChar == null ? "" : entrySphereChar.Text.Trim()); TextRelay entryRunUOAcc = info.GetTextEntry(12); this.textRunUOAcc = (entryRunUOAcc == null ? "" : entryRunUOAcc.Text.Trim()); TextRelay entryRunUOChar = info.GetTextEntry(13); this.textRunUOChar = (entryRunUOChar == null ? "" : entryRunUOChar.Text.Trim()); ArrayList Selections = new ArrayList(info.Switches); if (Selections.Contains(20)) this.importSkills = true; else this.importSkills = false; if (Selections.Contains(21)) this.importItensToPlayer = true; else this.importItensToPlayer = false; if (Selections.Contains(22)) this.importItensToStaff = true; else this.importItensToStaff = false; StartImport(); break; } case 0: default: caller.SendMessage("Importacao CANCELADA."); break; } }
public override void OnResponse( NetState sender, RelayInfo info ) { if ( info.ButtonID == 1 ) { try { if ( m_From.AccessLevel >= AccessLevel.GameMaster ) { TextRelay text = info.GetTextEntry( 0 ); if ( text != null ) { m_Skill.Base = Convert.ToDouble( text.Text ); CommandLogging.LogChangeProperty( m_From, m_Target, String.Format( "{0}.Base", m_Skill ), m_Skill.Base.ToString() ); } } else { m_From.SendMessage( "You may not change that." ); } m_From.SendGump( new SkillsGump( m_From, m_Target, m_Selected ) ); } catch { m_From.SendMessage( "Bad format. ###.# expected." ); m_From.SendGump( new EditSkillGump( m_From, m_Target, m_Skill, m_Selected ) ); } } else { m_From.SendGump( new SkillsGump( m_From, m_Target, m_Selected ) ); } }
public override void OnResponse( NetState sender, RelayInfo info ) { Mobile from = sender.Mobile; int button = info.ButtonID - 1; if ( m_Type == -1 ) { if ( button >= 0 && button < m_Types.Length ) from.SendGump( new AddStairsGump( button ) ); } else { if ( button >= 0 && button < 4 ) { TextRelay levelx = info.GetTextEntry(0); string slevel = (levelx == null ? null : levelx.Text.Trim()); int level = 0; if (slevel != null && slevel.Length != 0) int.TryParse(slevel, out level); if (level < 1) level = 1; if (level > 20) level = 20; from.SendGump( new AddStairsGump( m_Type, level) ); CommandSystem.Handle( from, String.Format( "{0}Add {1} {2} {3}", CommandSystem.Prefix, m_Types[m_Type].m_Type.Name, (Facing) button, level) ); } else { from.SendGump( new AddStairsGump() ); } } }
public override void OnResponse( NetState sender, RelayInfo info ) { if ( info.ButtonID == 0 ) { m_From.SendLocalizedMessage( 501235, "", 0x35 ); // Help request aborted. } else { TextRelay entry = info.GetTextEntry( 0 ); string text = ( entry == null ? "" : entry.Text.Trim() ); if ( text.Length == 0 ) { m_From.SendMessage( 0x35, "You must enter a description." ); m_From.SendGump( new PagePromptGump( m_From, m_Type ) ); } else { m_From.SendLocalizedMessage( 501234, "", 0x35 ); /* The next available Counselor/Game Master will respond as soon as possible. * Please check your Journal for messages every few minutes. */ PageQueue.Enqueue( new PageEntry( m_From, text, m_Type ) ); } } }
public override void OnResponse( Server.Network.NetState sender, RelayInfo info ) { if( _canEdit && _editMode ) { string entryText = ""; TextRelay relay; for( int i = 0; i < _numEntries; i++ ) { relay = info.GetTextEntry( 100 + i ); if( relay != null ) entryText += relay.Text; else break; } if( entryText != _beheld.Profile ) _beheld.Profile = entryText.Trim(); } if( info.ButtonID == 5 ) sender.Mobile.SendGump( new CharacterProfileGump( sender.Mobile, _beheld, _numEntries, !_editMode ) ); else if( info.ButtonID == 10 ) sender.Mobile.SendGump( new CharacterProfileGump( sender.Mobile, _beheld, Math.Min( MaxTextEntries, (_numEntries + 1) ), _editMode ) ); else if( info.ButtonID == 20 ) sender.Mobile.SendGump( new CharacterProfileGump( sender.Mobile, _beheld, Math.Max( MinTextEntries, (_numEntries - 1) ), _editMode ) ); }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { Mobile pm = ( Mobile )sender.Mobile; if( pm == null ) return; switch (info.ButtonID) { case 2: { TextRelay text = info.GetTextEntry( 1 ); if (text == null || text.Text == "") { pm.CloseGump(typeof(AccountSearch)); pm.SendGump(new AccountSearch()); return; } ArrayList authors = new ArrayList(); if (ForumCore.AuthorExists( out authors, text.Text)) { pm.CloseGump( typeof(AccountListingGump)); pm.SendGump( new AccountListingGump( authors, 0 ) ); } else { pm.SendMessage("Either that player does not exist, or no posts have been made by that player."); } break; } } }
public List<string> CreateArray( RelayInfo info, Mobile from ) { List<string> creaturesName = new List<string>(); for ( int i = 0; i < 13; i++ ) { TextRelay te = info.GetTextEntry( i ); if ( te != null ) { string str = te.Text; if ( str.Length > 0 ) { str = str.Trim(); string t = Spawner.ParseType( str ); Type type = ScriptCompiler.FindTypeByName( t ); if ( type != null ) creaturesName.Add( str ); else from.SendMessage( "{0} is not a valid type name.", t ); } } } return creaturesName; }
public ArrayList CreateArray( RelayInfo info, Mobile from ) { ArrayList subSpawnerD = new ArrayList(); for ( int i = 0; i < 15; i++ ) { TextRelay te = info.GetTextEntry( i ); if ( te != null ) { string str = te.Text; if ( str.Length > 0 ) { str = str.Trim(); Type type = SpawnerType.GetType( str ); if ( type != null ) subSpawnerD.Add( str ); else from.SendMessage( "{0} is not a valid type name.", str ); } } } return subSpawnerD; }
public override void OnResponse( GameClient state, RelayInfo info ) { Mobile from = state.Mobile; switch ( info.ButtonID ) { case 0: // Close/Cancel { from.SendLocalizedMessage( 501235, "", 0x35 ); // Help request aborted. break; } case 1: // OK { TextRelay entry = info.GetTextEntry( 0 ); string code = ( entry == null ? "" : entry.Text.Trim() ); if ( code != "" ) { from.SendLocalizedMessage( 1062098 ); // Your promotional code has been submitted. We are processing your request. PromotionalType type = PromotionalType.None; bool success = false; ( (PlayerMobile) from ).LastPromotionCode = code; // TODO: Send query for inputed promo-code to database // We must receive following results: bool success, PromotionalType type, string code from.SendGump( new PromotionMessageGump( success, type, code ) ); } break; } } }
public override void OnResponse( NetState sender, RelayInfo info ) { Mobile from = sender.Mobile; switch ( info.ButtonID ) { case 1: { from.CloseGump( typeof( KillSearch ) ); from.SendGump( new KillIndex( from, m_Book, m_KillList ) ); break; } case 2: { TextRelay s = info.GetTextEntry( 0 ); if ( s != null ) { string search = s.Text; from.SendGump( new KillSearch( search, m_Book, m_KillList )); } break; } } }
public override void OnResponse( Server.Network.NetState sender, RelayInfo info ) { if( info.ButtonID == 0 ) { _from.SendLocalizedMessage( 501235, "", 0x35 ); //Help request aborted. return; } else { TextRelay txtEntry = info.GetTextEntry( 0 ); string text = (txtEntry == null ? "" : txtEntry.Text); if( text.Length == 0 ) { _from.SendMessage( 0x35, "You must enter a description of your problem." ); _from.SendGump( new PagePromptGump( _from, _type ) ); } else { _from.SendMessage( 0x35, "The next available staff member will be with you as soon as possible. If your issue is resolved early, please revoke it from the page queue. To check the statue of your page, type \'[CheckPage\'." ); PageQueue.AddNewPage( new PageEntry( _from, text, _type ) ); } } }
public List<string> CreateArray( RelayInfo info, Mobile from ) { List<string> itemsName = new List<string>(); for ( int i = 0; i < 13; i++ ) { TextRelay te = info.GetTextEntry( i ); if ( te != null ) { string str = te.Text; if ( str.Length > 0 ) { str = str.Trim(); Type type = ItemSpawnerType.GetType( str ); if ( type != null ) itemsName.Add( str ); else from.SendMessage( "{0} is not a valid type name.", str ); } } } return itemsName; }
public override void OnResponse( Server.Network.NetState sender, RelayInfo info ) { Mobile m_Player = ( Mobile )sender.Mobile; if( m_Player == null ) return; switch( info.ButtonID ) { case 2: { TextRelay value = info.GetTextEntry( 1 ); int number; try { number = Convert.ToInt32( value.Text ); } catch { m_Player.SendMessage( "That value was not valid please try again." ); m_Player.CloseGump( typeof( InputGump ) ); m_Player.SendGump( new InputGump( m_Value, m_Property ) ); break; } if( number > 2147483647 || number < 0 ) { m_Player.SendMessage( "This value may not be below 0 or above 2147483647. Please try again." ); m_Player.CloseGump( typeof( InputGump ) ); m_Player.SendGump( new InputGump( m_Value, m_Property ) ); break; } switch( m_Property.ToLower() ) { case "purge days": { ForumCore.AutoCleanupDays = number; break; } case "minimum characters": { ForumCore.MinPostCharactersCount = number; break; } case "maximum characters": { ForumCore.MaxPostCharactersCount = number; break; } } m_Player.CloseGump( typeof( AdministrationGump ) ); m_Player.SendGump( new AdministrationGump( ) ); break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; switch (info.ButtonID) { case 0: // Close { from.SendGump(new FieldSetup_Main(Handeling)); break; } case 1: { TextRelay text = (TextRelay)info.GetTextEntry(3); int amount = 0; try { amount = Convert.ToInt32(text.Text); } catch(Exception) { from.SendMessage("Invalid amount entered."); from.SendGump(new FieldSetup_SetBuyIn(Handeling)); return; } switch (Mode) { case "remove": { RefundBuyIn((PlayerMobile)from, amount); break; } case "set": { if (amount <= 0) { from.SendMessage("You must enter more then 0."); from.SendGump(new FieldSetup_SetBuyIn(Handeling)); return; } if (!HasGold((PlayerMobile)from, amount)) { from.SendMessage("You do not have that much gold."); from.SendGump(new FieldSetup_SetBuyIn(Handeling)); return; } SetBuyIn((PlayerMobile)from, amount); break; } } from.SendGump(new FieldSetup_SetBuyIn(Handeling)); break; } } }
public override void OnResponse(NetState state, RelayInfo info) { if (m_Player == null || m_Player == null) return; //Crash Prevention TextRelay textentry = (TextRelay)info.GetTextEntry(0); string RealName = textentry.Text.Trim(); textentry = (TextRelay)info.GetTextEntry(1); string ShowName = textentry.Text.Trim(); ShowName += " (" + m_Player.Race.Name + ")"; m_Player.SendAsciiMessage("Real name: " + RealName + " show name: " + ShowName ); m_Player.Name = ShowName; PlayerMobile m_PlayerMobile = m_Player as PlayerMobile; m_PlayerMobile.RealName = RealName; }
public override void OnResponse(NetState sender, RelayInfo info) { switch (info.ButtonID) { case 0: { TextRelay entry0 = info.GetTextEntry(0); string text0 = (entry0 == null ? "" : entry0.Text.Trim()); question = text0.ToLower(); TextRelay entry1 = info.GetTextEntry(1); string text1 = (entry1 == null ? "" : entry1.Text.Trim()); answer = text1.ToLower(); World.Broadcast(133, true, question); break; } } }
public override void OnResponse( NetState state, RelayInfo info ) { Mobile from = state.Mobile; switch ( info.ButtonID ) { case 1: { try { TextRelay te = info.GetTextEntry( 0 ); if( te != null ) { int price = Convert.ToInt32( te.Text, 10 ); if( price < BountyBoardEntry.DefaultMinBounty ) { from.SendMessage( "The bounty must be at least {0} gold.", BountyBoardEntry.DefaultMinBounty ); from.SendGump( new AddBountyGump( from, m_Killer ) ); return; } if( m_Killer != null && !m_Killer.Deleted ) { //remove bounty gold if ( !Banker.Withdraw( from, price ) ) { from.SendMessage( "You cannot afford a bounty of {0}!", price ); from.SendGump( new AddBountyGump( from, m_Killer ), false ); return; } BountyBoard.AddEntry( from, m_Killer, price, DateTime.Now + BountyBoardEntry.DefaultDecayRate ); m_Killer.SendMessage( "A bounty hath been issued for thee!" ); from.SendAsciiMessage("You placed a bounty on {0} for {1} gold", m_Killer.Name, price); } } } catch { from.SendMessage( "Bad format. #### expected." ); from.SendGump( new AddBountyGump( from, m_Killer ) ); } break; } case 2: { from.SendLocalizedMessage( 500518 ); break; } } }
public override void OnResponse( GameClient sender, RelayInfo info ) { Mobile from = sender.Mobile; if ( info.ButtonID == 1 ) { if ( !m_Owner.IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1116249 ); // That must be in your backpack for you to use it. } else { m_Owner.Line1 = info.GetTextEntry( 0 ).Text; m_Owner.Line2 = info.GetTextEntry( 1 ).Text; m_Owner.Line3 = info.GetTextEntry( 2 ).Text; m_Owner.EditEnd = DateTime.Now + TimeSpan.FromMinutes( 10.0 ); } } }
public override void OnResponse( NetState sender, RelayInfo info ) { ChatInfo chatInfo = ChatManager.GetInfo( _client ); switch( info.ButtonID ) { case 1: //send message { string msg = Utility.FixHtml( info.GetTextEntry( 5 ).Text ); if( _isGuildMsg && _client.Guild is Guild ) ((Guild)_client.Guild).GuildChat( _client, msg ); else ChatManager.SendMessage( _client, _recipient, msg ); break; } case 2: //adjust buddy list { if( chatInfo.BuddyList.Contains( _recipient ) ) { chatInfo.Remove( ChatInfo.UpdateType.Buddy, _recipient ); _client.SendMessage( "You have removed {0} from your buddy list.", _recipient.RawName ); } else { chatInfo.Add( ChatInfo.UpdateType.Buddy, _recipient ); _client.SendMessage( "You have added {0} to your buddy list.", _recipient.RawName ); } Resend(); break; } case 3: //adjust ignore list { if( chatInfo.IgnoreList.Contains( _recipient ) ) { chatInfo.Remove( ChatInfo.UpdateType.Ignore, _recipient ); _client.SendMessage( "You have removed {0} from your ignore list.", _recipient.RawName ); } else { chatInfo.Add( ChatInfo.UpdateType.Ignore, _recipient ); _client.SendMessage( "You have added {0} to your ignore list.", _recipient.RawName ); } Resend(); break; } } }
public override void OnResponse( NetState state, RelayInfo info ) { if ( info.ButtonID == 1 ) // Add Email { Mobile from = state.Mobile; Account acct = (Account)from.Account; string user = (string)info.GetTextEntry( 1 ).Text; string pass = (string)info.GetTextEntry( 2 ).Text; if ( user == acct.Username && acct.CheckPassword( pass ) ) { from.SendMessage( 64, "Login Confirmed." ); from.SendGump( new AccountInfo( from ) ); } else { from.SendMessage( 38, "Either the username or password you entered was incorrect, Please recheck your spelling and remember that passwords and usernames are case sensitive. Please try again." ); } } }
public override void OnResponse( NetState state, RelayInfo info ) { if ( info.ButtonID == 1 ) // Add Email { Mobile from = state.Mobile; Account acct = (Account)from.Account; string cpass = (string)info.GetTextEntry( 1 ).Text; string newpass = (string)info.GetTextEntry( 2 ).Text; string newpass2 = (string)info.GetTextEntry( 3 ).Text; if ( acct.CheckPassword( cpass ) ) { if ( newpass == null || newpass2 == null ) { from.SendMessage( 38, "You must type in a new password and confirm it." ); } else if ( newpass.Length <= m_PassLength ) { from.SendMessage( 38, "Your new password must be at least characters {0} long.", m_PassLength ); } else if ( newpass == newpass2 ) { from.SendMessage( "Your password has been changed to {0}.", newpass ); acct.SetPassword( newpass ); CommandLogging.WriteLine( from, "{0} {1} has changed thier password for account {2} using the [accountlogin command", from.AccessLevel, CommandLogging.Format( from ), acct.Username ); } else { from.SendMessage( 38, "Your new password did not match your confirm password. Please check your spelling and try again." ); from.SendMessage( 38, "Just a reminder. Passwords are case sensitive." ); } } else { from.SendMessage( 38, "The current password you typed in did not match your current password on record. Please check your spelling and try again." ); from.SendMessage( 38, "Just a reminder. Passwords are case sensitive." ); } } }
public override void OnResponse( NetState sender, RelayInfo info ) { PlayerMobile m = sender.Mobile as PlayerMobile; if ( m == null ) return; switch ( info.ButtonID ) { case 0: { break; } case 1: { if( m_pm.Feats.GetFeatLevel(FeatList.Painter) > 1 ) { TextRelay target = info.GetTextEntry( 2 ); m_painting.Name = target.Text; } if( m_pm.Feats.GetFeatLevel(FeatList.Painter) > 2 ) { TextRelay target2 = info.GetTextEntry( 3 ); m_painting.Description = target2.Text; } break; } case 4: { if( m_pm.Feats.GetFeatLevel(FeatList.Painter) > 1 ) { TextRelay target = info.GetTextEntry( 2 ); m_painting.Name = target.Text; } if( m_pm.Feats.GetFeatLevel(FeatList.Painter) > 2 ) { TextRelay target2 = info.GetTextEntry( 3 ); m_painting.Description = target2.Text; } Painting.ChangeID( m_painting, m_painting.Index + 1 ); m_pm.SendGump( new PaintingGump( m_pm, m_painting ) ); break; } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case (int)Buttons.OK: { TextRelay xrelay = info.GetTextEntry((int)Buttons.XCoordTextBox); TextRelay yrelay = info.GetTextEntry((int)Buttons.YCoordTextBox); string xtext = (xrelay == null ? null : xrelay.Text.Trim()); string ytext = (yrelay == null ? null : yrelay.Text.Trim()); if (xtext == null || xtext.Length == 0 || ytext == null || ytext.Length == 0) { from.SendMessage("You must enter an integer value in each box. (0 , 400, 245 )"); } else { int x = m_Shovel.XStart; int y = m_Shovel.YStart; try { x = Int32.Parse(xtext); y = Int32.Parse(ytext); m_Shovel.XStart = x; m_Shovel.YStart = y; } catch { from.SendMessage("You must enter an integer value in each box. (0 , 400, 245 )"); } } from.SendGump(new YardGump(from, m_Shovel, m_Shovel.Category, m_Shovel.Page, 0, 0)); break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; TextRelay entry0 = info.GetTextEntry(0); string text0 = (entry0 == null ? "" : entry0.Text.Trim()); PlayerMobile pm = from as PlayerMobile; if ( pm == null ) return; Item di = pm.Backpack.FindItemByType(typeof(DoNDGameDeed) ); DoNDGameDeed gd = di as DoNDGameDeed; DoNDAdminStone si = Stone as DoNDAdminStone; switch(info.ButtonID) { case 0: { if ( gd == null ) return; gd.Commercial = false; if (pm.HasGump( typeof( DoNDCommercialGump ))) pm.CloseGump( typeof( DoNDCommercialGump ) ); break; } case 1: { if ( si == null ) break; if ( text0 == null ) { pm.SendMessage( pm.Name + ", you've not entered any text, please type something!"); if (pm.HasGump( typeof( DoNDCommercialGump ))) pm.CloseGump( typeof( DoNDCommercialGump ) ); pm.SendGump( new DoNDCommercialGump( pm ) ); break; } si.SCommercial = text0; pm.SendMessage( pm.Name + ", your text has been saved and will be used for the commercial!"); if (pm.HasGump( typeof( DoNDCommercialGump ))) pm.CloseGump( typeof( DoNDCommercialGump ) ); break; } } }
public override void OnResponse( NetState state, RelayInfo info ) { if ( info.ButtonID == 1 ) // Add Email { Mobile from = state.Mobile; Account acct = (Account)from.Account; string newEmail = (string)info.GetTextEntry( 0 ).Text; acct.SetTag( "Email", newEmail ); m_From.SendMessage( "Thank you." ); m_From.SendMessage( 38, "You can update your email address at anytime by saying [updateemail in game." ); } }
public override void OnResponse( NetState state, RelayInfo info ) { if ( m_State == null || state == null ) return; Mobile focus = m_State.Mobile; Mobile from = state.Mobile; switch ( info.ButtonID ) { case 1: // Tell if (focus == null) { from.SendMessage("That character is no longer online."); return; } if (focus.Deleted) { from.SendMessage("That character no longer exists."); return; } if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel) { from.SendMessage("That character is no longer visible."); return; } TextRelay text = info.GetTextEntry(0); if (text != null && !focus.HasFilter) { focus.SendMessage(134, "[{0}] {1}", from.Name, text.Text); from.SendAsciiMessage("You sent a message to {0}", focus.Name); } else from.SendAsciiMessage("Your message to {0} was not sent", focus.Name); from.SendGump(new OnlineClientGump(from, m_State)); break; } }
public override void OnResponse( NetState state, RelayInfo info ) { if ( m_State == null ) return; Mobile focus = m_State.Mobile; Mobile from = state.Mobile; if ( focus == null ) { from.SendMessage( "That character is no longer online." ); return; } else if ( focus.Deleted ) { from.SendMessage( "That character no longer exists." ); return; } else if ( from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel ) { from.SendMessage( "That character is no longer visible." ); return; } switch ( info.ButtonID ) { case 1: // Tell { TextRelay text = info.GetTextEntry( 0 ); if ( text != null ) { focus.SendMessage( 0x482, "{0} tells you:", from.Name ); focus.SendMessage( 0x482, text.Text ); } from.SendGump( new OnlineClientGump( from, m_State ) ); break; } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 1: PlayerLetter letter = new PlayerLetter(); TextRelay text = info.GetTextEntry(1); string un = (text == null ? null : text.Text.Trim()); letter.BodyText = un; letter.m_From = m_Owner; letter.m_To = m_From; letter.m_Time = DateTime.Now; m_Owner.AddToBackpack(letter); from.CloseGump(typeof(WriteLetterGump)); break; case 2: from.Target = new ParcelTarget(m_Owner, m_From); break; } }
public override void OnResponse(NetState sender, RelayInfo info) { var from = sender.Mobile; if (from.AccessLevel < AccessLevel.Administrator) { return; } var d = info.GetTextEntry(0); var h = info.GetTextEntry(1); var m = info.GetTextEntry(2); var s = info.GetTextEntry(3); var c = info.GetTextEntry(10); TimeSpan duration; bool shouldSet; switch (info.ButtonID) { case 0: { for (var i = 0; i < m_List.Count; ++i) { var a = m_List[i]; a.SetUnspecifiedBan(from); } from.SendMessage("Duration unspecified."); return; } case 1: // infinite { duration = TimeSpan.MaxValue; shouldSet = true; break; } case 2: // From D:H:M:S { if (d != null && h != null && m != null && s != null) { try { duration = new TimeSpan( Utility.ToInt32(d.Text), Utility.ToInt32(h.Text), Utility.ToInt32(m.Text), Utility.ToInt32(s.Text) ); shouldSet = true; break; } catch { // ignored } } duration = TimeSpan.Zero; shouldSet = false; break; } case 3: // From D { if (d != null) { try { duration = TimeSpan.FromDays(Utility.ToDouble(d.Text)); shouldSet = true; break; } catch { // ignored } } duration = TimeSpan.Zero; shouldSet = false; break; } case 4: // From H { if (h != null) { try { duration = TimeSpan.FromHours(Utility.ToDouble(h.Text)); shouldSet = true; break; } catch { // ignored } } duration = TimeSpan.Zero; shouldSet = false; break; } case 5: // From M { if (m != null) { try { duration = TimeSpan.FromMinutes(Utility.ToDouble(m.Text)); shouldSet = true; break; } catch { // ignored } } duration = TimeSpan.Zero; shouldSet = false; break; } case 6: // From S { if (s != null) { try { duration = TimeSpan.FromSeconds(Utility.ToDouble(s.Text)); shouldSet = true; break; } catch { // ignored } } duration = TimeSpan.Zero; shouldSet = false; break; } default: return; } if (shouldSet) { var comment = c?.Text.Trim().DefaultIfNullOrEmpty(null); for (var i = 0; i < m_List.Count; ++i) { var a = m_List[i]; a.SetBanTags(from, DateTime.UtcNow, duration); if (comment != null) { a.Comments.Add( new AccountComment( from.RawName, $"Duration: {(duration == TimeSpan.MaxValue ? "Infinite" : duration.ToString())}, Comment: {comment}" ) ); } } if (duration == TimeSpan.MaxValue) { from.SendMessage("Ban Duration: Infinite"); } else { from.SendMessage("Ban Duration: {0}", duration); } } else { from.SendMessage("Time values were improperly formatted."); from.SendGump(new BanDurationGump(m_List)); } }
private void Resend(Mobile to, RelayInfo info) { TextRelay te = info.GetTextEntry(0); to.SendGump(new ClientGump(to, m_State, te == null ? "" : te.Text)); }
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) { this.m_QuestItem.Name = tr.Text.Trim(); } tr = info.GetTextEntry(102); // title if (tr != null) { this.m_QuestItem.TitleString = tr.Text.Trim(); } tr = info.GetTextEntry(103); // notestring if (tr != null) { this.m_QuestItem.NoteString = tr.Text; } tr = info.GetTextEntry(200); // objectives if (tr != null) { this.m_QuestItem.Objective1 = tr.Text.Trim(); } tr = info.GetTextEntry(201); if (tr != null) { this.m_QuestItem.Objective2 = tr.Text.Trim(); } tr = info.GetTextEntry(202); if (tr != null) { this.m_QuestItem.Objective3 = tr.Text.Trim(); } tr = info.GetTextEntry(203); if (tr != null) { this.m_QuestItem.Objective4 = tr.Text.Trim(); } tr = info.GetTextEntry(204); if (tr != null) { this.m_QuestItem.Objective5 = tr.Text.Trim(); } tr = info.GetTextEntry(205); if (tr != null && tr.Text != null && tr.Text.Length > 0) // descriptions { this.m_QuestItem.Description1 = tr.Text.Trim(); } else { this.m_QuestItem.Description1 = null; } tr = info.GetTextEntry(206); if (tr != null && tr.Text != null && tr.Text.Length > 0) { this.m_QuestItem.Description2 = tr.Text.Trim(); } else { this.m_QuestItem.Description2 = null; } tr = info.GetTextEntry(207); if (tr != null && tr.Text != null && tr.Text.Length > 0) { this.m_QuestItem.Description3 = tr.Text.Trim(); } else { this.m_QuestItem.Description3 = null; } tr = info.GetTextEntry(208); if (tr != null && tr.Text != null && tr.Text.Length > 0) { this.m_QuestItem.Description4 = tr.Text.Trim(); } else { this.m_QuestItem.Description4 = null; } tr = info.GetTextEntry(209); if (tr != null && tr.Text != null && tr.Text.Length > 0) { this.m_QuestItem.Description5 = tr.Text.Trim(); } else { this.m_QuestItem.Description5 = null; } tr = info.GetTextEntry(210); // expiration if (tr != null && tr.Text != null && tr.Text.Length > 0) { try { this.m_QuestItem.Expiration = double.Parse(tr.Text.Trim()); } catch { } } // check all of the check boxes this.m_QuestItem.PartyEnabled = info.IsSwitched(300); this.m_QuestItem.CanSeeReward = info.IsSwitched(301); // refresh the time created this.m_QuestItem.TimeCreated = DateTime.UtcNow; switch (info.ButtonID) { case 0: // Okay { break; } case 1: // Select Reward { sender.Mobile.Target = new RewardTarget(this.m_QuestItem); break; } case 2: // Select Reward Return { sender.Mobile.Target = new ReturnTarget(this.m_QuestItem); break; } } }
public override void OnResponse(NetState state, RelayInfo info) { if (m_State == null) { return; } Mobile focus = m_State.Mobile; Mobile from = state.Mobile; if (focus == null) { from.SendMessage("That character is no longer online."); return; } else if (focus.Deleted) { from.SendMessage("That character no longer exists."); return; } else if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel && (!(focus is PlayerMobile) || !((PlayerMobile)focus).VisibilityList.Contains(from))) { from.SendMessage("That character is no longer visible."); return; } switch (info.ButtonID) { case 1: // Tell { TextRelay text = info.GetTextEntry(0); if (text != null) { focus.SendMessage(0x482, "{0} tells you:", from.Name); focus.SendMessage(0x482, text.Text); CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text); } from.SendGump(new ClientGump(from, m_State)); break; } case 4: // Props { Resend(from, info); if (!BaseCommand.IsAccessible(from, focus)) { from.SendMessage("That is not accessible."); } else { from.SendGump(new PropertiesGump(from, focus)); CommandLogging.WriteLine(from, "{0} {1} opening properties gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } break; } case 5: // Go to { if (focus.Map == null || focus.Map == Map.Internal) { from.SendMessage("That character is not in the world."); } else { from.MoveToWorld(focus.Location, focus.Map); Resend(from, info); CommandLogging.WriteLine(from, "{0} {1} going to {2}, Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map); } break; } case 6: // Get { if (from.Map == null || from.Map == Map.Internal) { from.SendMessage("You cannot bring that person here."); } else { focus.MoveToWorld(from.Location, from.Map); Resend(from, info); CommandLogging.WriteLine(from, "{0} {1} bringing {2} to Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map); } break; } case 7: // Move { from.Target = new MoveTarget(focus); Resend(from, info); break; } case 8: // Kick { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.Say("I've been kicked!"); m_State.Dispose(); CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } break; } case 9: // Kill { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.Kill(); CommandLogging.WriteLine(from, "{0} {1} killing {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } Resend(from, info); break; } case 10: //Res { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.PlaySound(0x214); focus.FixedEffect(0x376A, 10, 16); focus.Resurrect(); CommandLogging.WriteLine(from, "{0} {1} resurrecting {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } Resend(from, info); break; } case 11: // Skills { Resend(from, info); if (from.AccessLevel > focus.AccessLevel) { from.SendGump(new SkillsGump(from, (Mobile)focus)); CommandLogging.WriteLine(from, "{0} {1} Opening Skills gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { Point3D toSet; bool shouldSet, shouldSend; switch (info.ButtonID) { case 1: // Current location { toSet = m_Mobile.Location; shouldSet = true; shouldSend = true; break; } case 2: // Pick location { m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List); toSet = Point3D.Zero; shouldSet = false; shouldSend = false; break; } case 3: // Use values { TextRelay x = info.GetTextEntry(0); TextRelay y = info.GetTextEntry(1); TextRelay z = info.GetTextEntry(2); toSet = new Point3D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text), z == null ? 0 : Utility.ToInt32(z.Text)); shouldSet = true; shouldSend = true; break; } default: { toSet = Point3D.Zero; shouldSet = false; shouldSend = true; break; } } if (shouldSet) { try { Server.Scripts.Commands.CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString()); m_Property.SetValue(m_Object, toSet, null); PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack); if (Miscellanious.ValidateLabeling(m_Object)) { if (m_Object is Item) { ((Item)m_Object).Cheater_Name = String.Format("This item modified by GM {0}", m_Mobile.Name); } if (m_Object is Mobile) { ((Mobile)m_Object).Cheater_Name = String.Format("This mobile modified by GM {0}", m_Mobile.Name); } } } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); } }
public override void OnResponse(NetState sender, RelayInfo info) { TimeSpan toSet; bool shouldSet, shouldSend; var h = info.GetTextEntry(0); var m = info.GetTextEntry(1); var s = info.GetTextEntry(2); switch (info.ButtonID) { case 1: // Zero { toSet = TimeSpan.Zero; shouldSet = true; shouldSend = true; break; } case 2: // From H:M:S { var successfulParse = false; if (h != null && m != null && s != null) { successfulParse = TimeSpan.TryParse($"{h.Text}:{m.Text}:{s.Text}", out toSet); } else { toSet = TimeSpan.Zero; } shouldSet = shouldSend = successfulParse; break; } case 3: // From H { if (h != null) { try { toSet = TimeSpan.FromHours(Utility.ToDouble(h.Text)); shouldSet = true; shouldSend = true; break; } catch { // ignored } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } case 4: // From M { if (m != null) { try { toSet = TimeSpan.FromMinutes(Utility.ToDouble(m.Text)); shouldSet = true; shouldSend = true; break; } catch { // ignored } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } case 5: // From S { if (s != null) { try { toSet = TimeSpan.FromSeconds(Utility.ToDouble(s.Text)); shouldSet = true; shouldSend = true; break; } catch { // ignored } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } default: { toSet = TimeSpan.Zero; shouldSet = false; shouldSend = true; break; } } if (shouldSet) { try { CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString()); m_Property.SetValue(m_Object, toSet, null); m_PropertiesGump.OnValueChanged(m_Object, m_Property); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { m_PropertiesGump.SendPropertiesGump(); } }
public override void OnResponse(NetState state, RelayInfo info) { if (m_State == null) { return; } Mobile focus = m_State.Mobile; Mobile from = state.Mobile; if (focus == null) { from.SendMessage("Le personnage n'est plus connecte."); return; } else if (focus.Deleted) { from.SendMessage("Le personnage n'existe plus."); return; } else if (focus.AccessLevel > from.AccessLevel && from.AccessLevel == AccessLevel.Player) { from.SendMessage("Vous ne pouvez envoyer un message à un maitre du jeu. Veuillez utiliser le systèmes de pages."); return; } else if (from != focus && (focus.Hidden && focus.HideAdmin && from.AccessLevel < focus.AccessLevel)) { from.SendMessage("Le personnage n'est plus visible."); return; } switch (info.ButtonID) { case 1: // Tell { TextRelay text = info.GetTextEntry(0); if (text != null) { focus.SendMessage(0x482, "{0} {1} vous a envoye un message HRP: ", from.GetNameUsedBy(focus)); focus.SendMessage(0x482, text.Text); CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text); } from.SendGump(new ClientGump(from, m_State)); break; } case 2: // Tell + Reply Gump { TextRelay text = info.GetTextEntry(0); if (text != null) { string name = from.GetNameUsedBy(focus); if (focus is PlayerMobile) { PlayerMobile pm = focus as PlayerMobile; int q = (int)pm.QuiOptions; bool cantBeDelivered = (q & 0x100) != 0 || (name == "Anonyme" && (q & 0x001) != 0) || (name == "Identite Cachee" && (q & 0x010) != 0); Console.WriteLine("q = {0:X}, canBeDelivered = {1}, q & 0x100 = {2}, name == \"Anonyme\" = {3}", q, cantBeDelivered, q & 0x100, name == "Anonyme"); if (from.AccessLevel > AccessLevel.Player || !cantBeDelivered) { focus.SendGump(new ClientGump(focus, state, from.GetNameUsedBy(focus), "", text.Text)); CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text); } else { from.SendMessage("{0} refuse de recevoir votre message", focus.GetNameUsedBy(from)); } } } //from.SendGump(new ClientGump(from, m_State)); break; } case 4: // Props { Resend(from, info); if (!BaseCommand.IsAccessible(from, focus)) { from.SendMessage("Cela ne vous est pas accessible."); } else { from.SendGump(new PropertiesGump(from, focus)); CommandLogging.WriteLine(from, "{0} {1} ouverture des propriétés de {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } break; } case 5: // Go to { if (focus.Map == null || focus.Map == Map.Internal) { from.SendMessage("Ce personnage n'est pas dans ce monde."); } else { from.MoveToWorld(focus.Location, focus.Map); Resend(from, info); CommandLogging.WriteLine(from, "{0} {1} se dirige sur {2}, Localisation {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map); } break; } case 6: // Get { if (from.Map == null || from.Map == Map.Internal) { from.SendMessage("Vous ne pouvez pas amener ce personnage en ce lieu."); } else { focus.MoveToWorld(from.Location, from.Map); Resend(from, info); CommandLogging.WriteLine(from, "{0} {1} amène {2} à la Localisation {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map); } break; } case 7: // Move { from.Target = new MoveTarget(focus); Resend(from, info); break; } case 8: // Kick { if (from.AccessLevel >= AccessLevel.Batisseur && from.AccessLevel > focus.AccessLevel) { focus.Say("I've been kicked!"); m_State.Dispose(); CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } break; } case 9: // Kill { if (from.AccessLevel >= AccessLevel.Batisseur && from.AccessLevel > focus.AccessLevel) { focus.Kill(); CommandLogging.WriteLine(from, "{0} {1} tue {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } Resend(from, info); break; } case 10: //Res { if (from.AccessLevel >= AccessLevel.Batisseur && from.AccessLevel > focus.AccessLevel) { focus.PlaySound(0x214); Effects.SendTargetEffect(focus, 0x376A, 10, 16); focus.Resurrect(); CommandLogging.WriteLine(from, "{0} {1} résurrecte {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } Resend(from, info); break; } case 11: // .Voir { Resend(from, info); /*if (from is PlayerMobile && focus is PlayerMobile && from.AccessLevel > AccessLevel.GameMaster && focus.AccessLevel == AccessLevel.Player) * { * from.SendGump(new CotationVoirGump((PlayerMobile)from, (PlayerMobile)focus)); * }*/ break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID != 0) { // Always update name m_Criteria.Name = info.GetTextEntry(1).Text; } switch (info.ButtonID) { case 0: // Cancel { break; } case 1: // Search { if (m_Criteria.Count == 0) { Resend(1154586); // Please select some criteria to search for. break; } StartSearch(m_Mobile, m_Criteria, 0); break; } case 2: // Clear search criteria { m_Criteria.Clear(); Resend(); break; } case 3: // Submit price criteria { m_Criteria.MinPrice = Utility.ToInt32(info.GetTextEntry(2).Text); m_Criteria.MaxPrice = Utility.ToInt32(info.GetTextEntry(3).Text); Resend(); break; } case 4: // Reset Item Name { m_Criteria.Name = ""; Resend(); break; } case 5: // Reset Item Price { m_Criteria.MinPrice = SearchCriteria.DefaultMinPrice; m_Criteria.MaxPrice = SearchCriteria.DefaultMaxPrice; Resend(); break; } default: { if (info.ButtonID < 100) { int criterionIdx = (info.ButtonID - 50); if (criterionIdx >= 0 && criterionIdx < m_SelectedCriteria.Length) { SearchCriterion criterion = m_SelectedCriteria[criterionIdx]; m_Criteria.Remove(criterion); } } else { if (m_Criteria.Count >= SearchCriteria.MaxCount) { Resend(1154681); // You may not add any more search criteria items. break; } int categoryIdx = (info.ButtonID / 100) - 1; int criterionIdx = (info.ButtonID % 100); var categories = SearchCriteriaCategory.AllCategories; if (categoryIdx >= 0 && categoryIdx < categories.Length) { SearchCriteriaCategory category = categories[categoryIdx]; if (criterionIdx >= 0 && criterionIdx < category.Criteria.Length) { SearchCriterionEntry entry = category.Criteria[criterionIdx]; SearchCriterion sc = entry.Criterion.Clone(); if (sc is ValuedSearchCriterion) { ((ValuedSearchCriterion)sc).Value = Utility.ToInt32(info.GetTextEntry(info.ButtonID).Text); } m_Criteria.Add(sc); } } } Resend(); break; } } }
private string GetString(RelayInfo info, int id) { TextRelay t = info.GetTextEntry(id); return(t == null ? null : t.Text.Trim()); }
public override void OnResponse(NetState state, RelayInfo info) { if (info == null || state == null || state.Mobile == null) { return; } if (m_questitem == null || m_questitem.Deleted) { return; } bool update_entry = false; //bool edit_entry = false; switch (info.ButtonID) { case 0: // Close { update_entry = false; break; } case 1: // Okay { update_entry = true; break; } case 2: // Edit { //edit_entry = true; break; } default: update_entry = true; break; } if (update_entry) { string entrytext = null; string entryid = null; TextRelay entry = info.GetTextEntry(0); if (entry != null) { entrytext = entry.Text; } entry = info.GetTextEntry(1); if (entry != null) { entryid = entry.Text; } m_questitem.AddJournalEntry = entryid + ":" + entrytext; } // open a new journal gump state.Mobile.CloseGump(typeof(XmlQuestStatusGump)); state.Mobile.SendGump(new XmlQuestStatusGump(m_questitem, m_gumptitle, m_X, m_Y, m_solid, 1)); }
public string GetTextField(RelayInfo info, int index) { TextRelay relay = info.GetTextEntry(index); return(relay == null ? null : relay.Text.Trim()); }
public override void OnResponse(NetState sender, RelayInfo info) { TimeSpan toSet; bool shouldSet, shouldSend; TextRelay h = info.GetTextEntry(0); TextRelay m = info.GetTextEntry(1); TextRelay s = info.GetTextEntry(2); switch (info.ButtonID) { case 1: // Zero { toSet = TimeSpan.Zero; shouldSet = true; shouldSend = true; break; } case 2: // From H:M:S { if (h != null && m != null && s != null) { try { toSet = TimeSpan.Parse(h.Text + ":" + m.Text + ":" + s.Text); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } case 3: // From H { if (h != null) { try { toSet = TimeSpan.FromHours(Utility.ToDouble(h.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } case 4: // From M { if (m != null) { try { toSet = TimeSpan.FromMinutes(Utility.ToDouble(m.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } case 5: // From S { if (s != null) { try { toSet = TimeSpan.FromSeconds(Utility.ToDouble(s.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } default: { toSet = TimeSpan.Zero; shouldSet = false; shouldSend = true; break; } } if (shouldSet) { try { Server.Scripts.Commands.CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString()); m_Property.SetValue(m_Object, toSet, null); PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { if (m_List.Count != 0) { m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); } else { var stackEntry = (PropertiesGump.IStackEntry)m_Stack.Pop(); stackEntry.SendGump(m_Mobile, m_Stack); } } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (from.AccessLevel < AccessLevel.Coordinateur) { return; } TextRelay d = info.GetTextEntry(0); TextRelay h = info.GetTextEntry(1); TextRelay m = info.GetTextEntry(2); TextRelay s = info.GetTextEntry(3); TextRelay c = info.GetTextEntry(10); TimeSpan duration; bool shouldSet; string fromString = from.ToString(); switch (info.ButtonID) { case 0: { for (int i = 0; i < m_List.Count; ++i) { Account a = (Account)m_List[i]; a.SetUnspecifiedBan(from); } from.SendMessage("Duration unspecified."); return; } case 1: // infinite { duration = TimeSpan.MaxValue; shouldSet = true; break; } case 2: // From D:H:M:S { if (d != null && h != null && m != null && s != null) { try { duration = new TimeSpan(Utility.ToInt32(d.Text), Utility.ToInt32(h.Text), Utility.ToInt32(m.Text), Utility.ToInt32(s.Text)); shouldSet = true; break; } catch { } } duration = TimeSpan.Zero; shouldSet = false; break; } case 3: // From D { if (d != null) { try { duration = TimeSpan.FromDays(Utility.ToDouble(d.Text)); shouldSet = true; break; } catch { } } duration = TimeSpan.Zero; shouldSet = false; break; } case 4: // From H { if (h != null) { try { duration = TimeSpan.FromHours(Utility.ToDouble(h.Text)); shouldSet = true; break; } catch { } } duration = TimeSpan.Zero; shouldSet = false; break; } case 5: // From M { if (m != null) { try { duration = TimeSpan.FromMinutes(Utility.ToDouble(m.Text)); shouldSet = true; break; } catch { } } duration = TimeSpan.Zero; shouldSet = false; break; } case 6: // From S { if (s != null) { try { duration = TimeSpan.FromSeconds(Utility.ToDouble(s.Text)); shouldSet = true; break; } catch { } } duration = TimeSpan.Zero; shouldSet = false; break; } default: return; } if (shouldSet) { string comment = null; if (c != null) { comment = c.Text.Trim(); if (comment.Length == 0) { comment = null; } } for (int i = 0; i < m_List.Count; ++i) { Account a = (Account)m_List[i]; a.SetBanTags(from, DateTime.Now, duration); if (comment != null) { a.Comments.Add(new AccountComment(from.RawName, String.Format("Duration: {0}, Comment: {1}", ((duration == TimeSpan.MaxValue)? "Infinite" : duration.ToString()), comment))); } } if (duration == TimeSpan.MaxValue) { from.SendMessage("Ban Duration: Infinite"); } else { from.SendMessage("Ban Duration: {0}", duration); } } else { from.SendMessage("Time values were improperly formatted."); from.SendGump(new BanDurationGump(m_List)); } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; int buttonNum = 0; ArrayList currentList = new ArrayList(tempList); int page = m_page; if (info.ButtonID > 0 && info.ButtonID < 10000) { buttonNum = 1; } else if (info.ButtonID > 20004) { buttonNum = 30000; } else { buttonNum = info.ButtonID; } switch (buttonNum) { case 0: { //Close break; } case 1: { selSpawner = currentList[info.ButtonID - 1] as Item; SpawnEditor_OnCommand(from, page, currentList, 1, selSpawner); break; } case 10000: { if (m_page * 10 < currentList.Count) { page = m_page += 1; SpawnEditor_OnCommand(from, page, currentList); } break; } case 10001: { if (m_page != 0) { page = m_page -= 1; SpawnEditor_OnCommand(from, page, currentList); } break; } case 10002: { //Close break; } case 10003: { FilterByRegion(from, tempList, from.Region, from.Map, page); break; } case 10004: { TextRelay oDis = info.GetTextEntry(0); string sDis = (oDis == null ? "" : oDis.Text.Trim()); if (sDis != "") { try { int distance = Convert.ToInt32(sDis); FilterByDistance(tempList, from, distance, page); } catch { from.SendMessage("Distance must be a number"); SpawnEditor_OnCommand(from, page, currentList); } } else { from.SendMessage("You must specify a distance"); SpawnEditor_OnCommand(from, page, currentList); } break; } case 10005: { from.Location = new Point3D(selSpawner.X, selSpawner.Y, selSpawner.Z); SpawnEditor_OnCommand(from, page, currentList, 1, selSpawner); break; } case 10006: { selSpawner.Delete(); SpawnEditor_OnCommand(from); break; } case 10007: { SpawnEditor_OnCommand(from, page, currentList, 2, selSpawner); break; } case 10008: { SpawnEditor_OnCommand(from); break; } case 10009: { TextRelay oSearch = info.GetTextEntry(1); string sSearch = (oSearch == null ? null : oSearch.Text.Trim()); SearchByName(tempList, from, sSearch, page); break; } case 10010: { TextRelay oID = info.GetTextEntry(2); string sID = (oID == null ? "" : oID.Text.Trim()); if (sID != "") { try { int SearchID = Convert.ToInt32(sID); SearchByID(tempList, from, SearchID, page); } catch { from.SendMessage("SpawnID must be a number"); SpawnEditor_OnCommand(from, page, currentList); } } else { from.SendMessage("You must specify a SpawnID"); SpawnEditor_OnCommand(from, page, currentList); } break; } case 20000: { PremiumSpawner spawner = selSpawner as PremiumSpawner; spawner.CreaturesName = CreateArray(info, state.Mobile); break; } case 20001: { PremiumSpawner spawner = selSpawner as PremiumSpawner; SpawnEditor_OnCommand(from, page, currentList, 2, selSpawner); spawner.BringToHome(); break; } case 20002: { PremiumSpawner spawner = selSpawner as PremiumSpawner; SpawnEditor_OnCommand(from, page, currentList, 2, selSpawner); spawner.Respawn(); break; } case 20003: { PremiumSpawner spawner = selSpawner as PremiumSpawner; SpawnEditor_OnCommand(from, page, currentList, 2, selSpawner); state.Mobile.SendGump(new PropertiesGump(state.Mobile, spawner)); break; } case 30000: { int buttonID = info.ButtonID - 20004; int index = buttonID / 2; int type = buttonID % 2; PremiumSpawner spawner = selSpawner as PremiumSpawner; TextRelay entry = info.GetTextEntry(index); if (entry != null && entry.Text.Length > 0) { if (type == 0) // Spawn creature { spawner.Spawn(entry.Text); } else // Remove creatures { spawner.RemoveCreatures(entry.Text); } spawner.CreaturesName = CreateArray(info, state.Mobile); } break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { Point3D toSet; bool shouldSet, shouldSend; switch (info.ButtonID) { case 1: // Current location { toSet = m_Mobile.Location; shouldSet = true; shouldSend = true; break; } case 2: // Pick location { m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List); toSet = Point3D.Zero; shouldSet = false; shouldSend = false; break; } case 3: // Use values { TextRelay x = info.GetTextEntry(0); TextRelay y = info.GetTextEntry(1); TextRelay z = info.GetTextEntry(2); toSet = new Point3D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text), z == null ? 0 : Utility.ToInt32(z.Text)); shouldSet = true; shouldSend = true; break; } default: { toSet = Point3D.Zero; shouldSet = false; shouldSend = true; break; } } if (shouldSet) { try { CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString()); m_Property.SetValue(m_Object, toSet, null); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { m_Mobile.SendGump(new XmlPropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; BonusPackControl b_control = null; BonusPackOrb b_orb = null; bool isInt = true; foreach (Item i in World.Items.Values) { if (i is BonusPackControl) { b_control = i as BonusPackControl; } } foreach (Item i in World.Items.Values) { if (i is BonusPackOrb) { b_orb = i as BonusPackOrb; if (b_orb.BPNumber == b_control.B_Current) { break; } } } for (int i = 0; i < 54; i++) { if ((i + 1) == info.ButtonID) { if (b_orb.AmountSkills != 5) { b_orb.BPSkills[b_orb.AmountSkills] = from.Skills[i].Name; TextRelay m_bo = info.GetTextEntry(1); string text_bo = (m_bo == null ? "" : m_bo.Text.Trim()); if (text_bo.Length == 0) { m_From.SendMessage(0x35, "You must enter a Value"); b_orb.BPSkills[b_orb.AmountSkills] = null; m_From.SendGump(new BonusPickGump(from, b_orb)); } else { isInt = true; try { int ibp = Convert.ToInt32(text_bo); } catch { from.SendMessage(0x35, "Value must be a number!"); b_orb.BPSkills[b_orb.AmountSkills] = null; m_From.SendGump(new BonusPickGump(from, b_orb)); isInt = false; } if (isInt) { int b_pri = Convert.ToInt32(text_bo); if (b_pri > 120) { m_From.SendMessage(0x35, "Value is above 120"); b_orb.BPSkills[b_orb.AmountSkills] = null; m_From.SendGump(new BonusPickGump(from, b_orb)); } else if (b_pri < 0) { m_From.SendMessage(0x35, "Value is below 0"); b_orb.BPSkills[b_orb.AmountSkills] = null; m_From.SendGump(new BonusPickGump(from, b_orb)); } else { b_orb.BPValues[b_orb.AmountSkills] = b_pri; b_orb.AmountSkills += 1; m_From.SendGump(new BonusPickGump(from, b_orb)); m_From.SendMessage(6, b_orb.BPSkills[b_orb.AmountSkills - 1] + " added as a Bonus Pack Skill with a cap of " + b_orb.BPValues[b_orb.AmountSkills - 1]); } } } } else { m_From.SendMessage(0x35, "You have reached the Maximum Bonus Pack Skills"); m_From.SendGump(new BonusPickGump(from, b_orb)); } } } if (info.ButtonID == 0) { for (int i = 0; i < 5; i++) { b_orb.BPSkills[i] = null; } m_From.SendGump(new BonusPackGump(from, b_orb)); } if (info.ButtonID == 60) { if (b_orb.AmountSkills == 0) { m_From.SendMessage(0x35, "You have not chosen any Skills"); m_From.SendGump(new BonusPickGump(from, b_orb)); } else { Bag b_bag = new Bag(); b_bag.Name = b_orb.BPName + " Bonus Pack"; Bag i_bag = new Bag(); i_bag.Name = b_orb.BPName + " Items"; b_bag.AddItem(i_bag); b_orb.Name = b_orb.BPName + " Bonus Pack"; b_control.A_BP += 1; b_orb.Activated = true; b_bag.AddItem(b_orb); foreach (Item i in World.Items.Values) { if (i is Bag && i.Name == "BONUS PACKS") { i.AddItem(b_bag); } } m_From.SendMessage(6, "Bonus Pack Generated"); } } }
public override void OnResponse(NetState state, RelayInfo info) { bool SendGumpAgain = true; Mobile m = state.Mobile; if (m.AccessLevel < AccessLevel.Administrator) { return; } #region Sanity if (IsDeleted(a1)) { a1 = null; } if (IsDeleted(a2)) { a2 = null; } #endregion int id = info.ButtonID; if (id == 0) { if (InSwapMode) { m.SendGump(new CharacterControlGump(a1, a2, "Character swap canceled")); } } if (id == 1) { #region Find Acct from Input string firstStr = info.GetTextEntry(2).Text; string secondStr = info.GetTextEntry(3).Text; Account first = Accounts.GetAccount(firstStr) as Account; Account second = Accounts.GetAccount(secondStr) as Account; string ErrorMessage = ""; if (first == null || second == null) { if (first == null && firstStr != "" && secondStr == "") { ErrorMessage = String.Format("Account: '{0}' NOT found", firstStr); } else if (second == null && secondStr != "" && firstStr == "") { ErrorMessage = String.Format("Account: '{0}' NOT found", secondStr); } else if (firstStr == "" && secondStr == "") { ErrorMessage = "Please enter in an Account name"; } else if (second == null && first == null) { ErrorMessage = String.Format("Accounts: '{0}' and '{1}' NOT found", firstStr, secondStr); } } if (a1 != null && first == null) { first = a1; } if (a2 != null && second == null) { second = a2; } m.SendGump(new CharacterControlGump(first, second, ErrorMessage)); #endregion } else if (id > 4) //left side { #region Sanity & Declarations int button = id % 10; int charIndex = ((id < 100)? id : (id - 100)) / 10; string error = "Invalid Button"; Account acct; Account secondAcct; acct = (id >= 100) ? a2 : a1; secondAcct = (id < 100) ? a2 : a1; if (IsDeleted(acct)) { error = "Selected Account is null or Deleted"; } else if (acct[charIndex] == null) { error = "That character is not found"; } #endregion else { Mobile mob = acct[charIndex]; switch (button) { #region Swap case 5: //Swap Selection And/Or Props { if (InSwapMode) { if (!swap.AlreadyChose(acct) && !swap.AlreadyChose(secondAcct)) { //Both Empty, even though this should NEVER happen. Just a sanity check swap.a1 = acct; swap.a1CharIndex = charIndex; error = "Please choose a character from the Other acct to swap with"; } else if ((swap.AlreadyChose(swap.a1) && !swap.AlreadyChose(swap.a2)) || (swap.AlreadyChose(swap.a2) && !swap.AlreadyChose(swap.a1))) { //First is filled, second is empty if (swap.AlreadyChose(swap.a1)) { swap.a2 = acct; swap.a2CharIndex = charIndex; } else { swap.a1 = acct; swap.a1CharIndex = charIndex; } if (swap.SwapEm()) { error = String.Format("Mobile {0} (0x{1:X}) and Mobile {2} (0x{3:X}) sucessfully swapped between Accounts {4} and {5}", swap.a1[swap.a1CharIndex], ((Mobile)swap.a1[swap.a1CharIndex]).Serial.Value, swap.a2[swap.a2CharIndex], ((Mobile)swap.a2[swap.a2CharIndex]).Serial.Value, swap.a2.ToString(), swap.a1.ToString()); CommandLogging.WriteLine(m, error); } else { error = "Swap unsucessful"; } swap = null; } } else { m.SendGump(new PropertiesGump(m, mob)); error = "Properties gump sent"; } break; } case 6: //Swap { if (IsDeleted(secondAcct)) { error = "Both accounts must exist to swap characters"; } else if (HasSpace(acct) == 0 || HasSpace(secondAcct) == 0) { error = "Both accounts must have at least one character to swap."; } else { error = "Please Choose the other character to swap."; swap = new SwapInfo(a1, a2); if (acct == a1) { swap.a1CharIndex = charIndex; } else { swap.a2CharIndex = charIndex; } } break; } #endregion #region Delete Character case 7: //Del { object[] o = new object[] { acct, mob, this }; m.SendGump( new WarningGump(1060635, 30720, String.Format("You are about to delete Mobile {0} (0x{1:X}) of Acct {2}. This can not be reversed without a complete server revert. Please note that this'll delete any items on that Character, but it'll still leave their house standing. Do you wish to continue?", mob.Name, mob.Serial.Value, acct.ToString()), 0xFFC000, 360, 260, new WarningGumpCallback(CharacterDelete_Callback), o)); SendGumpAgain = false; break; } #endregion #region Move Character case 8: //Move { if (secondAcct == null) { error = String.Format("Can't move Mobile {0} (0x{1:X} because the other account is null", mob.Name, mob.Serial.Value); break; } int newCharLocation = HasSpace(secondAcct); if (newCharLocation < 0) { error = String.Format("Can't move Mobile {0} (0x{1:X}) to account {2} because that account is full", mob.Name, mob.Serial.Value, secondAcct.ToString()); break; } acct[charIndex] = null; secondAcct[newCharLocation] = mob; mob.Say("I've been moved to another Account!"); if (mob.NetState != null) { mob.NetState.Dispose(); } error = String.Format("Mobile {0} (0x{1:X}) of Account {2} moved to Account {3}.", mob.Name, mob.Serial.Value, acct.ToString(), secondAcct.ToString()); CommandLogging.WriteLine(m, error); break; } #endregion } } if (SendGumpAgain) { m.SendGump(new CharacterControlGump(a1, a2, error, swap)); } } }
public override void OnResponse(NetState sender, RelayInfo info) { object toSet; bool shouldSet, shouldSend = true; switch (info.ButtonID) { case 1: { TextRelay text = info.GetTextEntry(0); if (text != null) { try { toSet = PropertiesGump.GetObjectFromString(m_Property.PropertyType, text.Text); shouldSet = true; } catch { toSet = null; shouldSet = false; m_Mobile.SendMessage("Bad format"); } } else { toSet = null; shouldSet = false; } break; } case 2: // Null { toSet = null; shouldSet = true; break; } case 3: // Hue Picker { toSet = null; shouldSet = false; shouldSend = false; m_Mobile.SendHuePicker(new InternalPicker(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List)); break; } case 4: // Body Picker { toSet = null; shouldSet = false; shouldSend = false; m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List)); break; } default: { toSet = null; shouldSet = false; break; } } if (shouldSet) { try { CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet == null ? "(null)" : toSet.ToString()); m_Property.SetValue(m_Object, toSet, null); PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); } }
public override void OnResponse(NetState state, RelayInfo info) { if (m_State == null) { return; } Mobile focus = m_State.Mobile; Mobile from = state.Mobile; if (focus == null) { from.SendMessage("That character is no longer online."); return; } else if (focus.Deleted) { from.SendMessage("That character no longer exists."); return; } else if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel) { from.SendMessage("That character is no longer visible."); return; } switch (info.ButtonID) { case 1: // Tell { TextRelay text = info.GetTextEntry(0); if (text != null) { focus.SendMessage(0x482, "{0} tells you:", from.Name); focus.SendMessage(0x482, text.Text); } from.SendGump(new ClientGump(from, m_State)); break; } case 4: // Props { Resend(from, info); from.SendGump(new PropertiesGump(from, focus)); break; } case 5: // Go to { if (focus.Map == null || focus.Map == Map.Internal) { from.SendMessage("That character is not in the world."); } else { from.MoveToWorld(focus.Location, focus.Map); Resend(from, info); } break; } case 6: // Get { if (from.Map == null || from.Map == Map.Internal) { from.SendMessage("You cannot bring that person here."); } else { focus.MoveToWorld(from.Location, from.Map); Resend(from, info); } break; } case 7: // Move { from.Target = new MoveTarget(focus); Resend(from, info); break; } case 8: // Kick { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.Say("I've been kicked!"); m_State.Dispose(); } break; } case 9: // Kill { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.Kill(); } Resend(from, info); break; } case 10: //Res { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.PlaySound(0x214); focus.FixedEffect(0x376A, 10, 16); focus.Resurrect(); } Resend(from, info); break; } case 11: // Skills { Resend(from, info); if (from.AccessLevel > focus.AccessLevel) { from.SendGump(new SkillsGump(from, (Mobile)focus)); } break; } } }
public override void OnResponse(NetState state, RelayInfo info) { if (state == null || info == null || state.Mobile == null || this.m_gauntlet == null || this.m_gauntlet.Challenger == null) { return; } XmlPoints afrom = (XmlPoints)XmlAttach.FindAttachment(state.Mobile, typeof(XmlPoints)); switch (info.ButtonID) { case 1: // refresh //m_gauntlet.CheckForDisqualification(); state.Mobile.SendGump(new CTFGump(this.m_gauntlet, state.Mobile, this.viewpage)); break; case 10: // Entry fee int val = 0; TextRelay tr = info.GetTextEntry(10); if (tr != null) { try { val = int.Parse(tr.Text); } catch { } } this.m_gauntlet.EntryFee = val; this.m_gauntlet.ResetAcceptance(); // update all the gumps RefreshAllGumps(this.m_gauntlet, true); state.Mobile.SendGump(new CTFGump(this.m_gauntlet, state.Mobile, this.viewpage)); break; case 11: // update teams if (this.m_WorkingList != null) { for (int i = 0; i < this.m_WorkingList.Count; i++) { // is this on the visible page? if ((int)(i / this.PlayersPerPage) != this.viewpage) { continue; } CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry) this.m_WorkingList[i]; if (entry != null) { int tval = 0; tr = info.GetTextEntry(500 + i); if (tr != null) { try { tval = int.Parse(tr.Text); } catch { } } entry.Team = tval; } } } this.m_gauntlet.ResetAcceptance(); // update all the gumps RefreshAllGumps(this.m_gauntlet, true); state.Mobile.SendGump(new CTFGump(this.m_gauntlet, state.Mobile, this.viewpage)); break; case 12: // page up // try doing the default for non-participants int nplayers = 0; if (this.m_gauntlet.Participants != null) { nplayers = this.m_gauntlet.Participants.Count; } int page = this.viewpage + 1; if (page > (int)(nplayers / this.PlayersPerPage)) { page = (int)(nplayers / this.PlayersPerPage); } if (this.m_WorkingList != null) { for (int i = 0; i < this.m_WorkingList.Count; i++) { CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry) this.m_WorkingList[i]; if (entry != null) { if (entry.Participant == state.Mobile) { entry.PageBeingViewed++; if (entry.PageBeingViewed > (int)(nplayers / this.PlayersPerPage)) { entry.PageBeingViewed = (int)(nplayers / this.PlayersPerPage); } page = entry.PageBeingViewed; //break; } } } } state.Mobile.SendGump(new CTFGump(this.m_gauntlet, state.Mobile, page)); break; case 13: // page down // try doing the default for non-participants page = this.viewpage - 1; if (page < 0) { page = 0; } if (this.m_WorkingList != null) { for (int i = 0; i < this.m_WorkingList.Count; i++) { CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry) this.m_WorkingList[i]; if (entry != null) { if (entry.Participant == state.Mobile) { entry.PageBeingViewed--; if (entry.PageBeingViewed < 0) { entry.PageBeingViewed = 0; } page = entry.PageBeingViewed; //break; } } } } state.Mobile.SendGump(new CTFGump(this.m_gauntlet, state.Mobile, page)); break; case 20: // arena size val = 0; tr = info.GetTextEntry(20); if (tr != null) { try { val = int.Parse(tr.Text); } catch { } } this.m_gauntlet.ArenaSize = val; this.m_gauntlet.ResetAcceptance(); // update all the gumps RefreshAllGumps(this.m_gauntlet, true); state.Mobile.SendGump(new CTFGump(this.m_gauntlet, state.Mobile, this.viewpage)); break; case 30: // target score val = 0; tr = info.GetTextEntry(30); if (tr != null) { try { val = int.Parse(tr.Text); } catch { } } this.m_gauntlet.TargetScore = val; this.m_gauntlet.ResetAcceptance(); // update all the gumps RefreshAllGumps(this.m_gauntlet, true); state.Mobile.SendGump(new CTFGump(this.m_gauntlet, state.Mobile, this.viewpage)); break; case 40: // match length double dval = 0; tr = info.GetTextEntry(40); if (tr != null) { try { dval = double.Parse(tr.Text); } catch { } } this.m_gauntlet.MatchLength = TimeSpan.FromMinutes(dval); this.m_gauntlet.ResetAcceptance(); // update all the gumps RefreshAllGumps(this.m_gauntlet, true); state.Mobile.SendGump(new CTFGump(this.m_gauntlet, state.Mobile, this.viewpage)); break; case 100: // add to Participants if (this.m_gauntlet.Participants == null) { this.m_gauntlet.Participants = new ArrayList(); } if (this.MaxTeamSize > 0 && this.m_gauntlet.Participants.Count >= this.MaxTeamSize) { XmlPoints.SendText(state.Mobile, 100535); // "Challenge is full!" } else { state.Mobile.Target = new MemberTarget(this.m_gauntlet, this.m_gauntlet.Participants); } state.Mobile.SendGump(new CTFGump(this.m_gauntlet, state.Mobile, this.viewpage)); break; case 300: // Start game if (this.m_WorkingList == null) { return; } bool complete = true; foreach (CTFGauntlet.ChallengeEntry entry in this.m_WorkingList) { if (entry != null) { Mobile m = entry.Participant; if (m == null) { continue; } if (!this.m_gauntlet.CheckQualify(m)) { complete = false; break; } if (!entry.Accepted) { XmlPoints.SendText(this.m_gauntlet.Challenger, 100539, m.Name); // "{0} has not accepted yet." complete = false; break; } // and they have a team if (entry.Team <= 0) { XmlPoints.SendText(this.m_gauntlet.Challenger, 100594, m.Name); // "{0} has not been assigned a team." complete = false; } } } if (this.m_WorkingList.Count < 2) { XmlPoints.SendText(this.m_gauntlet.Challenger, 100540); // "Insufficient number of players." complete = false; } // make sure all the bases have been defined ArrayList Teams = this.m_gauntlet.GetTeams(); // make sure that all bases have teams defined if (Teams != null) { foreach (TeamInfo t in Teams) { bool hasteam = false; foreach (CTFBase b in this.m_gauntlet.HomeBases) { if (t.ID == b.Team) { hasteam = true; break; } } if (!hasteam) { XmlPoints.SendText(this.m_gauntlet.Challenger, 100621, t.ID); // "Team {0} base not defined." complete = false; } } } else { complete = false; } if (complete) { this.m_gauntlet.Participants = new ArrayList(); foreach (CTFGauntlet.ChallengeEntry entry in this.m_WorkingList) { if (entry != null) { Mobile m = entry.Participant; if (m == null) { continue; } // try to collect any entry fee if (!this.m_gauntlet.CollectEntryFee(m, this.m_gauntlet.EntryFee)) { continue; } // set up the challenge on each player XmlPoints a = (XmlPoints)XmlAttach.FindAttachment(m, typeof(XmlPoints)); if (a != null) { a.ChallengeGame = this.m_gauntlet; } entry.Status = ChallengeStatus.Active; this.m_gauntlet.Participants.Add(entry); } } // and lock the game this.m_gauntlet.StartGame(); // refresh all gumps RefreshAllGumps(this.m_gauntlet, true); } else { state.Mobile.SendGump(new CTFGump(this.m_gauntlet, state.Mobile, this.viewpage)); } break; default: { // forfeit buttons if (info.ButtonID >= 4000) { int selection = info.ButtonID - 4000; if (selection < this.m_WorkingList.Count) { CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry) this.m_WorkingList[selection]; // find the master participants list entry with the same participant if (this.m_gauntlet.Participants != null) { CTFGauntlet.ChallengeEntry forfeitentry = null; foreach (CTFGauntlet.ChallengeEntry masterentry in this.m_gauntlet.Participants) { if (entry == masterentry) { forfeitentry = masterentry; break; } } // and remove it if (forfeitentry != null) { forfeitentry.Status = ChallengeStatus.Forfeit; // inform him that he has been kicked this.m_gauntlet.Forfeit(forfeitentry.Participant); } } } } // kick buttons if (info.ButtonID >= 2000) { int selection = info.ButtonID - 2000; if (selection < this.m_WorkingList.Count) { CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry) this.m_WorkingList[selection]; // find the master participants list entry with the same participant if (this.m_gauntlet.Participants != null) { CTFGauntlet.ChallengeEntry kickentry = null; foreach (CTFGauntlet.ChallengeEntry masterentry in this.m_gauntlet.Participants) { if (entry == masterentry) { kickentry = masterentry; break; } } // and remove it if (kickentry != null) { this.m_gauntlet.Participants.Remove(kickentry); // refresh his gump and inform him that he has been kicked if (kickentry.Participant != null) { XmlPoints.SendText(kickentry.Participant, 100545, this.m_gauntlet.ChallengeName); // "You have been kicked from {0}" kickentry.Participant.SendGump(new CTFGump(this.m_gauntlet, kickentry.Participant, this.viewpage)); } } } this.m_gauntlet.ResetAcceptance(); } // refresh all gumps RefreshAllGumps(this.m_gauntlet, true); //state.Mobile.SendGump( new CTFGump( m_gauntlet, state.Mobile)); } else if (info.ButtonID >= 1000) { int selection = info.ButtonID - 1000; // set the acceptance flag of the participant if (selection < this.m_WorkingList.Count) { CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry) this.m_WorkingList[selection]; entry.Accepted = !entry.Accepted; } // refresh all gumps RefreshAllGumps(this.m_gauntlet, true); //state.Mobile.SendGump( new CTFGump( m_gauntlet, state.Mobile)); } break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; int m_Offer; switch (info.ButtonID) { case 0: { // You have decided to tithe no gold to the shrine. from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193); break; } case 1: { if (from.TithingPoints >= MaxTithing) { from.SendLocalizedMessage(1060840); // You have reached the maximum amount of Tithing Points available. break; } int totalGold = Banker.GetBalance(from); if (totalGold <= 0) { // You have decided to tithe no gold to the shrine. from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193); break; } m_Offer = MaxTithing - from.TithingPoints; if (m_Offer > totalGold) { m_Offer = totalGold; } from.SendGump(new TithingGump(from, m_Offer)); break; } case 2: { if (from.TithingPoints >= MaxTithing) { from.SendLocalizedMessage(1060840); // You have reached the maximum amount of Tithing Points available. break; } int totalGold = Banker.GetBalance(from); if (totalGold <= 0) { // You have decided to tithe no gold to the shrine. from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193); break; } TextRelay tr = info.GetTextEntry(1); if (tr != null) { string text = tr.Text; int num = Utility.ToInt32(text); if (num > 0) { if (num > totalGold) { m_Offer = totalGold; } else { m_Offer = num; } if ((from.TithingPoints + m_Offer) > MaxTithing) { m_Offer = MaxTithing - from.TithingPoints; } Container pack = from.Backpack; if (Banker.Withdraw(from, m_Offer, true)) { // You tithe gold to the shrine as a sign of devotion. from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060195); from.TithingPoints += m_Offer; from.PlaySound(0x243); from.PlaySound(0x2E6); } else { // You do not have enough gold to tithe that amount! from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060194); } } else { from.SendLocalizedMessage(1159140); // You have entered an invalid entry. You must enter a number between 1 and 100,000. } } break; } } }
public override void OnResponse(Server.Network.NetState state, RelayInfo info) { if (info == null || state == null || state.Mobile == null) { return; } Mobile from = state.Mobile; if (m_gumpcallback != null) { if (info.ButtonID == 0) { m_gumpcallback(from, m_invoker, String.Empty); } else { switch (m_gumptype) { case 0: // simple acknowledgement gump m_gumpcallback(from, m_invoker, "done"); break; case 1: // yes/no gump if (info.Switches != null && info.Switches.Length > 0) { if (info.Switches[0] == 1) { m_gumpcallback(from, m_invoker, "yes"); } else { m_gumpcallback(from, m_invoker, "no"); } } break; case 2: // text entry gump TextRelay entry = info.GetTextEntry(99); if (entry != null && entry.Text.Length > 0) { // return the response string m_gumpcallback(from, m_invoker, entry.Text); } break; case 3: // accept/decline gump if (info.Switches != null && info.Switches.Length > 0) { if (info.Switches[0] == 1) { from.SendLocalizedMessage(1049019); // You have accepted the Quest. m_gumpcallback(from, m_invoker, "accept"); } else { from.SendLocalizedMessage(1049018); // You have declined the Quest. m_gumpcallback(from, m_invoker, "decline"); } } break; case 4: // multiple option gump if (info.Switches != null && info.Switches.Length > 0) { int select = info.Switches[0]; if (select >= 0 && select < gumpSelections.Count) { // return the response string for that selection m_gumpcallback(from, m_invoker, ((GumpSelection)gumpSelections[select]).Response); } } break; case 5: string buttonresponse = String.Empty; string radioresponse = String.Empty; string textresponse = String.Empty; if (info.ButtonID >= 1000) { int select = info.ButtonID - 1000; // get the gump response associated with the button if (select >= 0 && select < gumpSelections.Count) { // return the response string for that selection buttonresponse = ((GumpSelection)gumpSelections[select]).Response; } } if (info.Switches != null && info.Switches.Length > 0) { int radiostate = info.Switches[0]; if (radiostate >= 0 && radiostate < gumpSelections.Count) { radioresponse = ((GumpSelection)gumpSelections[radiostate]).Response; } } // check for any textentries for (int j = 0; j < gumpSelections.Count; j++) { if (((GumpSelection)gumpSelections[j]).GumpItemType == 1) { try { TextRelay te = info.GetTextEntry(j); if (te != null && te.Text.Length > 0) { textresponse += te.Text + " "; } } catch {} } } // build the composite reponse string string responsestring = null; if (buttonresponse != null && buttonresponse.Length > 0) { responsestring = buttonresponse; } if (radioresponse != null && radioresponse.Length > 0) { responsestring += " " + radioresponse; } if (textresponse != null && textresponse.Length > 0) { responsestring += " " + textresponse; } m_gumpcallback(from, m_invoker, responsestring); break; } } } // get rid of any temporary gump keyword tokens if (m_invoker is XmlSpawner) { ((XmlSpawner)m_invoker).DeleteTag(m_keywordtag); } }
public override void OnResponse(NetState ns, RelayInfo info) { Mobile mob_m = ns.Mobile; PlayerMobile pm = mob_m as PlayerMobile; UOETool dd = i_Tool as UOETool; if (pm == null || dd == null) { return; } int si; if (dd.StcT == true) { TextRelay entry1 = info.GetTextEntry(1); string text1 = (entry1 == null ? "" : entry1.Text.Trim()); bool r1 = Int32.TryParse(text1, out si); if (r1 != false) { dd.StcID = si; } if (dd.MultiT == false) { TextRelay entry2 = info.GetTextEntry(2); string text2 = (entry2 == null ? "" : entry2.Text.Trim()); bool r2 = Int32.TryParse(text2, out si); if (r2 != false) { dd.StcX = si; } TextRelay entry3 = info.GetTextEntry(3); string text3 = (entry3 == null ? "" : entry3.Text.Trim()); bool r3 = Int32.TryParse(text3, out si); if (r3 != false) { dd.StcY = si; } TextRelay entry4 = info.GetTextEntry(4); string text4 = (entry4 == null ? "" : entry4.Text.Trim()); bool r4 = Int32.TryParse(text4, out si); if (r4 != false) { dd.StcZ = si; } } } if (dd.LndT == true) { TextRelay entry1 = info.GetTextEntry(1); string text1 = (entry1 == null ? "" : entry1.Text.Trim()); bool r1 = Int32.TryParse(text1, out si); if (r1 != false) { dd.LndID = si; } if (dd.MultiT == false) { TextRelay entry2 = info.GetTextEntry(2); string text2 = (entry2 == null ? "" : entry2.Text.Trim()); bool r2 = Int32.TryParse(text2, out si); if (r2 != false) { dd.LndX = si; } TextRelay entry3 = info.GetTextEntry(3); string text3 = (entry3 == null ? "" : entry3.Text.Trim()); bool r3 = Int32.TryParse(text3, out si); if (r3 != false) { dd.LndY = si; } TextRelay entry4 = info.GetTextEntry(4); string text4 = (entry4 == null ? "" : entry4.Text.Trim()); bool r4 = Int32.TryParse(text4, out si); if (r4 != false) { dd.LndZ = si; } } } switch (info.ButtonID) { case 0: { pm.SendMessage(pm.Name + ", Thanks for using the UO Editor!"); dd.SendSYSBCK(pm, dd); break; } case 1: { bool MapCheck = dd.MapCKUOE(pm, dd); if (MapCheck == false) { pm.SendMessage(pm.Name + ", You entered improper values in the XYZ fields!"); dd.SendSYSBCK(pm, dd); if (dd.SndOn == true) { pm.PlaySound(dd.Snd7); } break; } bool IDCheck = dd.IDCKUOE(pm, dd); if (IDCheck == false) { pm.SendMessage(pm.Name + ", You entered improper values in the ID field!"); dd.SendSYSBCK(pm, dd); if (dd.SndOn == true) { pm.PlaySound(dd.Snd7); } break; } bool HueCK = dd.HueCKUOE(pm, dd); if (HueCK == false) { pm.SendMessage(pm.Name + ", You can only enter 1-3000 for the value!"); dd.SendSYSBCK(pm, dd); if (dd.SndOn == true) { pm.PlaySound(dd.Snd7); } break; } if (dd.StcT == true) { if (dd.MultiT == true) { CommandSystem.Handle(pm, String.Format("{0}m addStatic {1}", CommandSystem.Prefix, dd.StcID)); } if (dd.StcX == 0 || dd.StcY == 0) { CommandSystem.Handle(pm, String.Format("{0}addStatic {1}", CommandSystem.Prefix, dd.StcID)); } else { new UltimaLive.AddStatic(pm.Map.MapID, dd.StcID, dd.StcZ, dd.StcX, dd.StcY, dd.Hue_S).DoOperation(); } dd.SendSYSBCK(pm, dd); if (dd.SndOn == true) { pm.PlaySound(dd.Snd5); } break; } if (dd.LndT == true) { if (dd.MultiT == true) { CommandSystem.Handle(pm, String.Format("{0}m setLandId {1}", CommandSystem.Prefix, dd.LndID)); } if (dd.StcX == 0 || dd.StcY == 0) { CommandSystem.Handle(pm, String.Format("{0}setLandId {1}", CommandSystem.Prefix, dd.LndID)); } if (IDCheck == true) { new UltimaLive.SetLandID(dd.LndX, dd.LndY, pm.Map.MapID, dd.LndID).DoOperation(); new UltimaLive.SetLandAltitude(dd.LndX, dd.LndY, pm.Map.MapID, dd.LndZ).DoOperation(); } dd.SendSYSBCK(pm, dd); if (dd.SndOn == true) { pm.PlaySound(dd.Snd5); } break; } dd.SendSYSBCK(pm, dd); break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { DateTime toSet; bool shouldSet, shouldSend; string year = ""; if (info.ButtonID == 2 || info.ButtonID == 3 || info.ButtonID == 5) { year = info.GetTextEntry(0).Text; } string month = ""; if (info.ButtonID == 2 || info.ButtonID == 3 || info.ButtonID == 6) { month = info.GetTextEntry(1).Text; } string day = ""; if (info.ButtonID == 2 || info.ButtonID == 3 || info.ButtonID == 7) { day = info.GetTextEntry(2).Text; } string hour = ""; if (info.ButtonID == 2 || info.ButtonID == 4 || info.ButtonID == 8) { hour = info.GetTextEntry(3).Text; } string min = ""; if (info.ButtonID == 2 || info.ButtonID == 4 || info.ButtonID == 9) { min = info.GetTextEntry(4).Text; } switch (info.ButtonID) { case 1: // MinValue { toSet = DateTime.MinValue; shouldSet = true; shouldSend = true; break; } case 2: // From YYYY MM DD H:M { bool successfulParse = false; string toapply = String.Format( "{0}/{1}/{2} {3}:{4}:00", (year != string.Empty ? year : String.Format("{0:yyyy}", m_OldDT)), (month != string.Empty ? month : String.Format("{0:MM}", m_OldDT)), (day != string.Empty ? day : String.Format("{0:dd}", m_OldDT)), (hour != string.Empty ? hour : String.Format("{0:HH}", m_OldDT)), (min != string.Empty ? min : String.Format("{0:mm}", m_OldDT))); successfulParse = DateTime.TryParse(toapply, out toSet); shouldSet = shouldSend = successfulParse; break; } case 3: case 4: case 5: case 6: case 7: case 8: case 9: goto case 2; case 10: { toSet = DateTime.MaxValue; shouldSet = true; shouldSend = true; break; } default: { toSet = DateTime.MinValue; shouldSet = false; shouldSend = true; break; } } if (shouldSet) { try { CommandLogging.LogChangeProperty( m_Mobile, m_Object, m_Property.Name, toSet.ToString(CultureInfo.InvariantCulture)); m_Property.SetValue(m_Object, toSet, null); PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); } }
public void Maj(NubiaPlayer from, RelayInfo info) { TextRelay tName = info.GetTextEntry(0); m_SortNubia.Nom = (tName == null) ? "Sort nubien" : tName.Text; TextRelay tEmote = info.GetTextEntry(1); m_SortNubia.Emote = (tEmote == null) ? "incante" : tEmote.Text; if (m_SortNubia is SortNubiaDestruction) { SortNubiaDestruction newSortNubia = m_SortNubia as SortNubiaDestruction; TextRelay tminDeg = info.GetTextEntry(50); string min = (tminDeg == null) ? "0" : tminDeg.Text; try{ newSortNubia.minDegat = Convert.ToInt32(min); }catch {} TextRelay tmaxDeg = info.GetTextEntry(51); string max = (tmaxDeg == null) ? "0" : tmaxDeg.Text; try{ newSortNubia.maxDegat = Convert.ToInt32(max); }catch {} TextRelay tDistance = info.GetTextEntry(52); string dist = (tDistance == null) ? "0" : tDistance.Text; try{ newSortNubia.distance = Convert.ToInt32(dist); }catch {} TextRelay tNumber = info.GetTextEntry(53); string num = (tNumber == null) ? "0" : tNumber.Text; try{ newSortNubia.number = Convert.ToInt32(num); }catch {} } if (m_SortNubia is SortNubiaSoin) { SortNubiaSoin newSortNubia = m_SortNubia as SortNubiaSoin; TextRelay tminDeg = info.GetTextEntry(75); string min = (tminDeg == null) ? "0" : tminDeg.Text; try{ newSortNubia.minDegat = Convert.ToInt32(min); }catch {} TextRelay tmaxDeg = info.GetTextEntry(76); string max = (tmaxDeg == null) ? "0" : tmaxDeg.Text; try{ newSortNubia.maxDegat = Convert.ToInt32(max); }catch {} TextRelay tDistance = info.GetTextEntry(77); string dist = (tDistance == null) ? "0" :tDistance.Text; try{ newSortNubia.distance = Convert.ToInt32(dist); }catch {} TextRelay tNumber = info.GetTextEntry(78); string num = (tNumber == null) ? "0" : tNumber.Text; try{ newSortNubia.number = Convert.ToInt32(num); }catch {} } if (m_SortNubia is SortNubiaInvocationArme) { SortNubiaInvocationArme newSortNubia = m_SortNubia as SortNubiaInvocationArme; TextRelay tspeed = info.GetTextEntry(90); string speed = (tspeed == null) ? "0" : tspeed.Text; try{ newSortNubia.wSpeed = Convert.ToInt32(speed); }catch {} TextRelay twName = info.GetTextEntry(93); string wname = (twName == null) ? "0" : twName.Text; try{ newSortNubia.wNom = wname; }catch {} // newSortNubia.color = KonohaCompHelper.getCompColor(newSortNubia.competence); } if (m_SortNubia is SortNubiaTao) { SortNubiaTao newSortNubia = m_SortNubia as SortNubiaTao; TextRelay tdegs = info.GetTextEntry(100); string degs = (tdegs == null) ? "0" : tdegs.Text; try{ newSortNubia.degats = Convert.ToInt32(degs); }catch {} TextRelay tTurn = info.GetTextEntry(101); string tt = (tTurn == null) ? "0" : tTurn.Text; try{ newSortNubia.turn = Convert.ToInt32(tt); }catch {} TextRelay tstun = info.GetTextEntry(102); string st = (tstun == null) ? "0" : tstun.Text; try{ newSortNubia.stun = Convert.ToDouble(st); }catch {} //newSortNubia.color = KonohaCompHelper.getCompColor(newSortNubia.competence); } if (m_SortNubia is SortNubiaParalyze) { SortNubiaParalyze newSortNubia = m_SortNubia as SortNubiaParalyze; TextRelay tminDeg = info.GetTextEntry(110); string min = (tminDeg == null) ? "0" : tminDeg.Text; try{ newSortNubia.minDegat = Convert.ToInt32(min); }catch {} TextRelay tmaxDeg = info.GetTextEntry(111); string max = (tmaxDeg == null) ? "0" : tmaxDeg.Text; try{ newSortNubia.maxDegat = Convert.ToInt32(max); }catch {} TextRelay tDistance = info.GetTextEntry(112); string dist = (tDistance == null) ? "0" : tDistance.Text; try{ newSortNubia.distance = Convert.ToInt32(dist); }catch {} TextRelay tNumber = info.GetTextEntry(113); string num = (tNumber == null) ? "0" : tNumber.Text; try{ newSortNubia.number = Convert.ToInt32(num); }catch {} } if (m_SortNubia is SortNubiaPoison) { SortNubiaPoison newSortNubia = m_SortNubia as SortNubiaPoison; TextRelay tminDeg = info.GetTextEntry(120); string min = (tminDeg == null) ? "0" : tminDeg.Text; int plev = 0; try{ plev = Convert.ToInt32(min); }catch {} if (plev > 3) { plev = 3; } if (plev < 0) { plev = 0; } newSortNubia.PoisonLevel = plev; TextRelay tDistance = info.GetTextEntry(121); string dist = (tDistance == null) ? "0" : tDistance.Text; try{ newSortNubia.distance = Convert.ToInt32(dist); }catch {} TextRelay tNumber = info.GetTextEntry(122); string num = (tNumber == null) ? "0" : tNumber.Text; try{ newSortNubia.number = Convert.ToInt32(num); }catch {} } if (m_SortNubia is SortNubiaMur) { SortNubiaMur newSortNubia = m_SortNubia as SortNubiaMur; TextRelay tdegWalk = info.GetTextEntry(135); string dwalk = (tdegWalk == null) ? "0" : tdegWalk.Text; try{ newSortNubia.damageWalk = Convert.ToInt32(dwalk); }catch {} } from.CloseGump(typeof(SortCreationGump)); from.SendGump(new SortCreationGump(m_owner, m_SortNubia)); }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (from.AccessLevel < AccessLevel.Administrator) { return; } TextRelay d = info.GetTextEntry(0); TextRelay h = info.GetTextEntry(1); TextRelay m = info.GetTextEntry(2); TextRelay s = info.GetTextEntry(3); TimeSpan duration; bool shouldSet; string fromString = from.ToString(); switch (info.ButtonID) { case 0: { for (int i = 0; i < m_List.Count; ++i) { Account a = (Account)m_List[i]; a.SetUnspecifiedBan(from); } from.SendMessage("Duration unspecified."); return; } case 1: // infinite { duration = TimeSpan.MaxValue; shouldSet = true; break; } case 2: // From D:H:M:S { if (d != null && h != null && m != null && s != null) { try { duration = new TimeSpan(Utility.ToInt32(d.Text), Utility.ToInt32(h.Text), Utility.ToInt32(m.Text), Utility.ToInt32(s.Text)); shouldSet = true; break; } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } duration = TimeSpan.Zero; shouldSet = false; break; } case 3: // From D { if (d != null) { try { duration = TimeSpan.FromDays(Utility.ToDouble(d.Text)); shouldSet = true; break; } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } duration = TimeSpan.Zero; shouldSet = false; break; } case 4: // From H { if (h != null) { try { duration = TimeSpan.FromHours(Utility.ToDouble(h.Text)); shouldSet = true; break; } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } duration = TimeSpan.Zero; shouldSet = false; break; } case 5: // From M { if (m != null) { try { duration = TimeSpan.FromMinutes(Utility.ToDouble(m.Text)); shouldSet = true; break; } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } duration = TimeSpan.Zero; shouldSet = false; break; } case 6: // From S { if (s != null) { try { duration = TimeSpan.FromSeconds(Utility.ToDouble(s.Text)); shouldSet = true; break; } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } duration = TimeSpan.Zero; shouldSet = false; break; } default: return; } if (shouldSet) { for (int i = 0; i < m_List.Count; ++i) { Account a = (Account)m_List[i]; a.SetBanTags(from, DateTime.Now, duration); } if (duration == TimeSpan.MaxValue) { from.SendMessage("Duration is infinite."); } else { from.SendMessage("Duration is {0}.", duration); } } else { from.SendMessage("Values improperly formatted."); from.SendGump(new BanDurationGump(m_List)); } }
public override void OnResponse(NetState state, RelayInfo info) { bool powerball = info.IsSwitched(0); if (PowerBall.Game == null || m_Ticket.GameNumber != PowerBall.Game.GameNumber) { return; } int white = PowerBall.Game.MaxWhiteBalls; int red = PowerBall.Game.MaxRedBalls; switch (info.ButtonID) { default: case 0: m_From.CloseGump(typeof(PowerballTicketGump)); break; case 1: { int pick1 = 0; int pick2 = 0; int pick3 = 0; int pick4 = 0; int pick5 = 0; int pick6 = 0; TextRelay s1 = info.GetTextEntry(1); TextRelay s2 = info.GetTextEntry(2); TextRelay s3 = info.GetTextEntry(3); TextRelay s4 = info.GetTextEntry(4); TextRelay s5 = info.GetTextEntry(5); TextRelay s6 = info.GetTextEntry(6); try { pick1 = Convert.ToInt32(s1.Text); pick2 = Convert.ToInt32(s2.Text); pick3 = Convert.ToInt32(s3.Text); pick4 = Convert.ToInt32(s4.Text); pick5 = Convert.ToInt32(s5.Text); pick6 = Convert.ToInt32(s6.Text); } catch { } if (PowerBall.Instance != null && PowerBall.Game != null) { if (pick1 < 1 || pick2 < 1 || pick3 < 1 || pick4 < 1 || pick5 < 1) { m_From.SendMessage(String.Format("You must choose a number from 1 to {0} on a non-powerball pick.", white.ToString())); } else if (pick1 == pick2 || pick1 == pick3 || pick1 == pick4 || pick1 == pick5 || pick2 == pick3 || pick2 == pick4 || pick2 == pick5 || pick3 == pick4 || pick3 == pick5 || pick4 == pick5) { m_From.SendMessage("You should think twice before picking the same number twice."); } else if (pick1 > white || pick2 > white || pick3 > white || pick4 > white || pick5 > white) { m_From.SendMessage(String.Format("White numbers cannot be any higher than {0}.", white.ToString())); } else if (pick6 > red) { m_From.SendMessage(String.Format("Red numbers cannot be any higher than {0}.", red.ToString())); } else if (powerball) { if (pick6 < 1) { m_From.SendMessage(String.Format("You must choose a number from 1 to {0} on your powerball pick.", red.ToString())); } else { Container pack = m_From.Backpack; int price = PowerBall.Game.TicketEntryPrice + PowerBall.Game.PowerBallPrice; if (pack != null && pack.GetAmount(typeof(Gold)) >= price) { pack.ConsumeTotal(typeof(Gold), price); m_From.SendMessage("You purchase a powerball ticket with {0} gold from your backpack.", price); new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, pick6, false); PowerBall.Instance.Profit += price; } else if (Banker.Withdraw(m_From, price, true)) { new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, pick6, false); PowerBall.Instance.Profit += price; } else { m_From.SendLocalizedMessage(500191); //Begging thy pardon, but thy bank account lacks these funds. } } } else { Container pack = m_From.Backpack; int price = PowerBall.Game.TicketEntryPrice; if (pack != null && pack.GetAmount(typeof(Gold)) >= price) { pack.ConsumeTotal(typeof(Gold), price); m_From.SendMessage("You purchase a powerball ticket with {0} gold from your backpack.", price); new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, false); PowerBall.Instance.Profit += price; } else if (Banker.Withdraw(m_From, price, true)) { new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, false); PowerBall.Instance.Profit += price; } else { m_From.SendLocalizedMessage(500191); //Begging thy pardon, but thy bank account lacks these funds. } } } m_From.SendGump(new PowerballTicketGump(m_Ticket, m_From, powerball)); break; } case 2: //Quickpick { Container pack = m_From.Backpack; int price; if (powerball) { price = PowerBall.Game.TicketEntryPrice + PowerBall.Game.PowerBallPrice; } else { price = PowerBall.Game.TicketEntryPrice; } if (pack != null && pack.GetAmount(typeof(Gold)) >= price) { m_From.SendMessage("You purchase a powerball ticket with {0} gold from your backpack.", price); pack.ConsumeTotal(typeof(Gold), price); } else if (!Banker.Withdraw(m_From, price, true)) { m_From.SendLocalizedMessage(1060398, price.ToString()); //~1_AMOUNT~ gold has been withdrawn from your bank box. m_From.SendLocalizedMessage(500191); //Begging thy pardon, but thy bank account lacks these funds. m_From.SendGump(new PowerballTicketGump(m_Ticket, m_From, powerball)); break; } int pick1 = 0; int pick2 = 0; int pick3 = 0; int pick4 = 0; int pick5 = 0; int pick6 = 0; List <int> whiteList = new List <int>(); for (int i = 1; i < white + 1; ++i) { whiteList.Add(i); } int count = 0; while (++count < 6) { int ran = Utility.Random(whiteList.Count); if (count == 1) { pick1 = whiteList[ran]; } else if (count == 2) { pick2 = whiteList[ran]; } else if (count == 3) { pick3 = whiteList[ran]; } else if (count == 4) { pick4 = whiteList[ran]; } else { pick5 = whiteList[ran]; } whiteList.Remove(whiteList[ran]); pick6 = Utility.RandomMinMax(1, red); } if (powerball) { new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, pick6, false); PowerBall.Instance.Profit += price; } else { new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, false); PowerBall.Instance.Profit += price; } m_From.SendGump(new PowerballTicketGump(m_Ticket, m_From, powerball)); } break; } }
public override void OnResponse(NetState sender, RelayInfo info) { TimeSpan toSet; bool shouldSet, shouldSend; TextRelay h = info.GetTextEntry(0); TextRelay m = info.GetTextEntry(1); TextRelay s = info.GetTextEntry(2); switch (info.ButtonID) { case 1: // Zero { toSet = TimeSpan.Zero; shouldSet = true; shouldSend = true; break; } case 2: // From H:M:S { bool successfulParse = false; if (h != null || m != null || s != null) { successfulParse = TimeSpan.TryParse(String.Format("{0}:{1}:{2}", h != null ? h.Text : "0", m != null ? m.Text : "0", s != null ? s.Text : "0"), out toSet); } else { toSet = TimeSpan.Zero; } shouldSet = shouldSend = successfulParse; break; } case 3: // From H { if (h != null) { try { toSet = TimeSpan.FromHours(Utility.ToDouble(h.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } case 4: // From M { if (m != null) { try { toSet = TimeSpan.FromMinutes(Utility.ToDouble(m.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } case 5: // From S { if (s != null) { try { toSet = TimeSpan.FromSeconds(Utility.ToDouble(s.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } default: { toSet = TimeSpan.Zero; shouldSet = false; shouldSend = true; break; } } if (shouldSet) { try { object getval = m_Property.GetValue(m_Object, null); CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, getval == null ? "(null)" : getval.ToString(), toSet.ToString()); m_Property.SetValue(m_Object, toSet, null); PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); } }
public static string GetTextRelayString(RelayInfo info, int id) { TextRelay t = info.GetTextEntry(id); return(t == null ? String.Empty : t.Text.Trim()); }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; BonusPackControl b_control = null; BonusPackOrb b_orb = null; BonusPackOrb t_orb = null; bool name_used = false; bool is_void = false; bool isInt = true; string c_name = null; string n_name = null; foreach (Item i in World.Items.Values) { if (i is BonusPackControl) { b_control = i as BonusPackControl; } } foreach (Item i in World.Items.Values) { if (i is BonusPackOrb) { b_orb = i as BonusPackOrb; if (b_orb.BPNumber == b_control.B_Current) { break; } } } if (info.ButtonID == 0) { b_orb.Delete(); } if (info.ButtonID == 1) { if (b_orb != null) { TextRelay m_name = info.GetTextEntry(1); string text_name = (m_name == null ? "" : m_name.Text.Trim()); if (text_name.Length == 0) { m_From.SendMessage(0x35, "You must enter a Bonus Pack Name."); m_From.SendGump(new BonusPackGump(from, b_orb)); is_void = true; } else { foreach (Item x in World.Items.Values) { if (x is BonusPackOrb) { t_orb = x as BonusPackOrb; if (text_name != null) { n_name = text_name.ToLower(); } if (t_orb.BPName != null) { c_name = t_orb.BPName.ToLower(); } if (c_name == n_name) { name_used = true; } } } if (name_used) { m_From.SendMessage(0x35, "That Bonus Pack Name is already used."); if (!is_void) { m_From.SendGump(new BonusPackGump(from, b_orb)); is_void = true; } } else { b_orb.BPName = text_name; b_orb.BackUpName = text_name; } } TextRelay m_bp = info.GetTextEntry(2); string text_bp = (m_bp == null ? "" : m_bp.Text.Trim()); if (text_bp.Length == 0) { m_From.SendMessage(0x35, "You must enter a Secondary Skill Value"); if (!is_void) { m_From.SendGump(new BonusPackGump(from, b_orb)); is_void = true; } } else { isInt = true; try { int ibp = Convert.ToInt32(text_bp); } catch { from.SendMessage(0x35, "Value must be a number!"); if (!is_void) { m_From.SendGump(new BonusPackGump(from, b_orb)); is_void = true; } isInt = false; } if (isInt) { int r_bp = Convert.ToInt32(text_bp); if (r_bp > 9) { from.SendMessage(0x35, "Value must be under 10"); if (!is_void) { m_From.SendGump(new BonusPackGump(from, b_orb)); is_void = true; } } else if (r_bp < 1) { from.SendMessage(0x35, "Value must be over 0"); if (!is_void) { m_From.SendGump(new BonusPackGump(from, b_orb)); is_void = true; } } else { b_orb.Sec_Skill_Cost = r_bp; } } } if (!is_void) { m_From.SendGump(new BonusPickGump(from, b_orb)); } } } }