I would love to assist you in your project. The first thing I would suggest is storing this information in the “guild stone” itself. What I personally would do is inside the guild stone script add and serialize a List<Mobile>. This will be your “rooster” and help you organize the members of the guild.
Then what I would do is make it so when you double click the guild stone that it sends itself as a variable to the gump:
Code:
From.SendGump(new TheivesGuildGump(this));
And the gump will look like this to receive the stone as a variable:
Code:
private TheivesGuildStone m_Stone; // change "TheivesGuildStone" to the name of the stone class
public TheivesGuildStoneGump( TheivesGuildStone Stone ) : base( 0, 0 )
{
m_Stone = Stone;
The reason I like to do this is so that we can make the stone control all actions that can be taken from the guild stone rather then the gump, which allows any other script (besides the gump) to also manipulate the thieves guild if you chose to do so in the future.
So, now we have the gump that is aware of the item that called it (being the guild stone) what we will want to do is in the guild stone make a method that will deal with new members joining. When making this method it is important to check to see if this person is already a member (since some people may accidentally double click the join button). So we will want to make a method that looks like this:
Code:
public void AddMember( Mobile from )
{
if( m_List.Contains( from ) )
{
from.SendMessage("you are alreaady a member");
return;
}
if ( pm.ProfessionNumber == 10 )
{
m_List.Add( from );
pm.Umbarian = 1;
pm.SendMessage( 68, "You have joined the Umbarian Shadows Thief Guild.");
pm.Backpack.DropItem( new UmbarianShadowsRobe() );
pm.AcceptGuildInvites = false;
}
}
Then in the button response for the join the guild all you have to place is:
Code:
case 1:
{
m_Stone.AddMember( pm );
}
And it will send the stone the playermobile who clicked the the button on the gump and perform the join method provided above.
So now you have the join method working you need a resign method. It’s very similar to the method provided above, only in reverse. You want to make sure that the list contains the thief still, and if it does then resign them (by the way, your remove method is bad coding. I’m not trying to be judgmental at all, but it has several big issues, such as if the person doesn’t have their shroud it won’t allow them to quit the guild; which you may have done intentionally). make sure to place this in the stone:
Code:
public void RemoveMember( Mobile from )
{
if( m_List.Contains( from ) )
{
m_List.Remove( from );
pm.SendMessage(68, "You have Resigned From The Umbarian Shadows Thief Guild.");
pm.AcceptGuildInvites = true;
pm.Umbarian = 0;
}
else
from.SendMessage("You are not a member");
}
Then you call this method exactly the same as you did the join method. So now you have a join and quit functioning. Onto the rooster page. You don’t need to sort the list because as members are added they are done so in chronological order, so the first member to join is in slot 0, the second is in slot 1, the third in slot 2, etc; and if someone were to quit, say a person in slot 9, then every member behind them will automatically shift up 1 slot.
So, now all you need to do is make a gump that can list pages of members (like list 10 members, and if the list gets larger then you click the “next page” button to see the next ten. To learn how to do this I would suggest looking at gumps like the AdminGump.cs, this demonstrates this technique several times.
Once you have learned this process all you need to do is cycle through the stones list and declare each entry as a mobile:
Code:
Mobile m = m_Stone.List[i];
Then once you have the mobile declared you will want to make a gump string using that mobiles RAWNAME.
Code:
this.AddLabel( X , Y, HUE, m.RawName.ToString() );
And bingo, you have that users name listed on the gump. Now remember to get this to work properly you are going to have to cycle through the list, declare each entry in the list as a mobile, and then offset their Y axis on the gump by like 30. Once you hit 10 (which is usually a large gump) you will need to create a new page for the next ten. Don’t worry you don’t have to do this manually, you can make a script code new pages for you as the gump gets larger, but that is something you will notice from looking at the AdminGump.cs.
Hopefully this is enough to get you started. Once you have this much going let me know if you run into more problems and I will be more than happy to assist you.
p.s. I wrote this to accommodate what you already have, but if you are interested in starting over (which won’t take much effort at all) you can make this a completely independent script that requires no distribution edits, making for a easier, cleaner system. I personally always prefer doing this, so that if some day I decide I want to remove the system I just delete the core and it’s as if it never existed, as appose to having to go in an remove serializations from the playermobile, and editing other misc distros that were altered in the project.
Also, Sorry if this was worded a little confusing and not 100% clear, I am at work and had to write this fast and off the top of my head, so I may have overlooked little tid bits of information, but if you come across something confusing we will clear it up for you!
good luck with your project, its an ambitious one, the type I like best!!!
