public void Placement_OnTarget(Mobile from, object targeted) { if (targeted is not IPoint3D p || Deleted) { return; } if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. return; } var loc = new Point3D(p); var house = BaseHouse.FindHouseAt(loc, from.Map, 16); if (house?.IsOwner(from) == true) { Item addon = new Guildstone(_guild, _guildName, _guildAbbrev); addon.MoveToWorld(loc, from.Map); house.Add(house.Addons, addon); Delete(); } else { from.SendLocalizedMessage(1042036); // That location is not in your house. } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; Container cont = from.BankBox; bool backMoney = false; switch (info.ButtonID) { case 0: { m_Mobile.CloseGump(typeof(JoinGuildGump)); break; } case 1: { int Amount = 25000; string name = info.GetTextEntry(1).Text; name = name.Trim(); if (name == "") { from.CloseGump(typeof(JoinGuildGump)); from.SendLocalizedMessage(1070884); // Guild name cannot be blank. return; } string abbr = info.GetTextEntry(2).Text; abbr = abbr.Trim(); if (abbr == "") { from.CloseGump(typeof(JoinGuildGump)); from.SendLocalizedMessage(1070885); // You must provide a guild abbreviation. return; } if (abbr.Length > 4) { from.CloseGump(typeof(JoinGuildGump)); from.SendLocalizedMessage(1063037, "4"); // An abbreviation cannot exceed ~1_val~ characters in length. return; } if (cont != null && cont.ConsumeTotal(typeof(Gold), Amount)) { from.SendLocalizedMessage(1060398, Amount.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. if (!ValidateName(from, name)) { from.CloseGump(typeof(JoinGuildGump)); backMoney = true; } BaseGuild[] guilds = Guild.Search(""); for (int i = 0; i < guilds.Length; i++) { if (abbr.ToLower() == (guilds[i] as BaseGuild).Abbreviation.ToLower()) { from.CloseGump(typeof(JoinGuildGump)); from.SendLocalizedMessage(501153); // That abbreviation is not available. backMoney = true; } } if (!backMoney) { Guild guild = new Guild(from, name, "none"); from.Guild = guild; (from as PlayerMobile).GuildRank = 5; Guildstone gm = new Guildstone(guild); gm.MoveToWorld(new Point3D(0, 0, 0), from.Map); guild.Guildstone = gm; Guild g = from.Guild as Guild; g.Abbreviation = abbr; from.SendLocalizedMessage(1063238); // Your new guild has been founded. } if (backMoney && cont != null) { cont.AddItem(new Gold(Amount)); from.SendLocalizedMessage(1060397, Amount.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. } from.CloseGump(typeof(JoinGuildGump)); } else { from.SendLocalizedMessage(1063001, Amount.ToString()); // You do not possess the ~1_val~ gold piece fee required to create a guild. } break; } case 2: { if ((from as PlayerMobile).AllowGuildInvites == true) { (from as PlayerMobile).AllowGuildInvites = false; from.SendLocalizedMessage(1070698); // You are now ignoring guild invitations. from.CloseGump(typeof(JoinGuildGump)); } else { (from as PlayerMobile).AllowGuildInvites = true; from.SendLocalizedMessage(1070699); // You are now accepting guild invitations. from.CloseGump(typeof(JoinGuildGump)); } break; } } }
public override void OnResponse( GameClient state, RelayInfo info ) { Mobile from = state.Mobile; Container cont = from.BankBox; bool backMoney = false; switch ( info.ButtonID ) { case 0: { break; } case 200: { int Amount = 25000; string name = info.GetTextEntry( 444 ).Text; name = name.Trim(); if ( name == "" ) { from.SendLocalizedMessage( 1070884 ); // Guild name cannot be blank. return; } string abbr = info.GetTextEntry( 555 ).Text; abbr = abbr.Trim(); if ( abbr == "" ) { from.SendLocalizedMessage( 1070885 ); // You must provide a guild abbreviation. return; } if ( abbr.Length > 4 ) { from.SendLocalizedMessage( 1063037, "4" ); // An abbreviation cannot exceed ~1_val~ characters in length. return; } foreach ( Faction faction in Faction.Factions ) { if ( abbr == faction.Definition.Abbreviation ) { from.SendLocalizedMessage( 501153 ); // That abbreviation is not available. return; } } if ( cont != null && cont.ConsumeTotal( typeof( Gold ), Amount ) ) { from.SendLocalizedMessage( 1060398, Amount.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. if ( !ValidateName( from, name ) ) backMoney = true; BaseGuild[] guilds = Guild.Search( "" ); for ( int i = 0; i < guilds.Length; i++ ) { if ( abbr.ToLower() == ( guilds[i] as BaseGuild ).Abbreviation.ToLower() ) { from.SendLocalizedMessage( 501153 ); // That abbreviation is not available. backMoney = true; } } if ( !backMoney ) { Guild guild = new Guild( from, name, "none" ); from.Guild = guild; ( from as PlayerMobile ).GuildRank = 5; Guildstone gm = new Guildstone( guild ); gm.MoveToWorld( new Point3D( 0, 0, 0 ), Map.Trammel ); guild.Guildstone = gm; Guild g = from.Guild as Guild; g.Abbreviation = abbr; from.SendLocalizedMessage( 1063238 ); // Your new guild has been founded. } if ( backMoney && cont != null ) { cont.AddItem( new Gold( Amount ) ); from.SendLocalizedMessage( 1060397, Amount.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box. } } else { from.SendLocalizedMessage( 1063001, Amount.ToString() ); // You do not possess the ~1_val~ gold piece fee required to create a guild. } break; } case 151: { if ( ( from as PlayerMobile ).AcceptGuildInvites == true ) { ( from as PlayerMobile ).AcceptGuildInvites = false; from.SendLocalizedMessage( 1070698 ); // You are now ignoring guild invitations. } else { ( from as PlayerMobile ).AcceptGuildInvites = true; from.SendLocalizedMessage( 1070699 ); // You are now accepting guild invitations. } break; } } }