Tukaram
Member
I used to love the bulletin boards on OSI shards, with the escorts/prisoner notifications. I know there is a bulletin board escort quest for the classic client. I have used it and enjoy it. Problem is I can't stand the classic client, and the enhanced does not support bulletin boards...
The casino scripts have a turboslotstat.cs. It is a constructable board that uses the bulletin board graphic. It links to the turboslotstatgump.cs to get info from an array and display stats of wins/losses etc on all the slot machines. It opens a gump, not a bulletin board, to display the stats. It displays and updates properly on the Enhanced Client.
So I have an idea but I am having problems figuring it out.
I want to see if I can get the bulletin board to send info to a gump, and use it to open and display the escorts/prisoners in the area.
This is the main section of code for the bulletin board (there is more, but this kinds of covers it. It repeats for escorts/camps/prisoners).
I am trying to figure basically, how to get that info into the gump.... I have a script I am playing with, but not getting there ha ha. I will keep trying - but if anyone has any pointers - I would appreciate a nudge in the right direction. As I have said before i am not much of a scripter right now, more of a cut/paste/cram it together kind scripter. 
I think my main question is, the existing bulletin board quest does everything with one script, the turbo slots uses 2 scripts - one to gather the info to the gump, another to display the info... so do I need to use 2 scripts the same way the turbo slots do? Like a BBgump and a BBboard script
This a snippet of the turboslotstatsgump.
The casino scripts have a turboslotstat.cs. It is a constructable board that uses the bulletin board graphic. It links to the turboslotstatgump.cs to get info from an array and display stats of wins/losses etc on all the slot machines. It opens a gump, not a bulletin board, to display the stats. It displays and updates properly on the Enhanced Client.
So I have an idea but I am having problems figuring it out.
I want to see if I can get the bulletin board to send info to a gump, and use it to open and display the escorts/prisoners in the area.
This is the main section of code for the bulletin board (there is more, but this kinds of covers it. It repeats for escorts/camps/prisoners).
Code:
#region BBS Quests
public class PrisonerMessage : BulletinMessage
{
private BaseCamp m_Camp;
public BaseCamp Camp { get { return m_Camp; } }
public PrisonerMessage(BaseCamp c, BaseEscortable escort)
: base(c.Prisoner, null, "", null)
{
m_Camp = c;
switch (Utility.Random(13))
{
case 0: Subject = "A kidnapping!"; break;
case 1: Subject = "Help!"; break;
case 2: Subject = "Help us, please!"; break;
case 3: Subject = "Adventurers needed!"; break;
case 4: Subject = "Seeking assistance"; break;
case 5: Subject = "In need of aid"; break;
case 6: Subject = "Canst thou help us?"; break;
case 7: Subject = "Shall any save our friend?"; break;
case 8: Subject = "A friend was kidnapped!"; break;
case 9: Subject = "Heroes wanted!"; break;
case 10: Subject = "Can any assist us?"; break;
case 11: Subject = "Kidnapped!"; break;
case 12: Subject = "Taken prisoner"; break;
}
double distance;
BulletinBoard board = FindClosestBB(c.Prisoner, out distance);
List<String> myLines = new List<String>();
string[] subtext1 = { "foul", "vile", "evil", "dark", "cruel", "vicious", "scoundrelly", "dastardly", "cowardly", "craven", "foul and monstrous", "monstrous", "hideous", "terrible", "cruel, evil", "truly vile", "vicious and cunning", "" };
string camp;
switch (c.Camp)
{
default:
case CampType.Default: camp = ""; break;
//case CampType.EvilMage: camp = "evil mages"; break;
//case CampType.GoodMage: camp = "mages"; break;
case CampType.Lizardman: camp = "lizardmen"; break;
case CampType.Orc: camp = "orcs"; break;
case CampType.Ratman: camp = "ratmen"; break;
case CampType.Brigand: camp = "brigands"; break;
//case CampType.Gypsy: camp = "gypsys"; break;
//case CampType.Warlord: camp = "a warlord"; break;
}
myLines.Add(String.Format("Help us please! {0} hath", escort.Name));
myLines.Add(String.Format("been kidnapped by "));
myLines.Add(String.Format("{0} {1}!", subtext1[Utility.Random(subtext1.Length)], camp));
myLines.Add(String.Format("We believe that {0} is held at", escort.Female ? "she" : "he"));
int xLong = 0, yLat = 0;
int xMins = 0, yMins = 0;
bool xEast = false, ySouth = false;
if (Sextant.Format(c.Location, c.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
{
myLines.Add(String.Format("{0}o {1}'{2}, {3}o {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W"));
}
/*myLines.Add(String.Format("{0}"));
myLines.Add(String.Format("{0}."));
myLines.Add(String.Format("{0}"));*/
Lines = myLines.ToArray();
if (board != null)
board.AddItem(this);
else
Delete();
}
I think my main question is, the existing bulletin board quest does everything with one script, the turbo slots uses 2 scripts - one to gather the info to the gump, another to display the info... so do I need to use 2 scripts the same way the turbo slots do? Like a BBgump and a BBboard script
This a snippet of the turboslotstatsgump.
Code:
public class TurboSlotsStatGump : Gump
{
private ArrayList m_SlotArray;
public TurboSlotsStatGump(Mobile from, ArrayList t)
: base(25, 25)
{
m_SlotArray = t;
string text = null;
int starty = 40;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage(0);
AddBackground(0, 0, 530, 325, 5170);
if (from.AccessLevel >= AccessLevel.GameMaster && m_SlotArray !=null && m_SlotArray.Count > 0)
AddButton(478, 30, 0xFAB, 0xFAD, 100, GumpButtonType.Reply, 0);
AddLabel(165, 3, 55, "Top Ten Recent Jackpot Winners");
m_SlotArray.Sort(new ListAmountSorter());
AddLabel(55, 20, 1149, "Name");
AddLabel(235, 20, 1149, "Date");
AddLabel(390, 20, 1149, "Value/Gold");
AddImageTiled(40, 65, 450, 45, 0xBBC);
AddImageTiled(40, 115, 450, 170, 9204);
for (int i = 0; i < 10; i++)
{
text = String.Format("{0:##}.", i + 1);
AddLabel(20, starty + i*25, 1152, @text);
}
if (m_SlotArray != null && m_SlotArray.Count > 0)
{
int count = m_SlotArray.Count > 9 ? 10 : m_SlotArray.Count;
for (int i = 0; i < count; i++)
{
if (m_SlotArray[i] == null || ((TurboSlot)m_SlotArray[i]).LastWonBy == null) { break; }
else
{
TurboSlot ts = (TurboSlot)m_SlotArray[i];
text = String.Format("{0}", ts.LastWonBy.Name);
AddLabel(45, starty, ts.Hue - 1, @text);
text = String.Format("{0}", ts.LastWonByDate);
AddLabel(175, starty, ts.Hue - 1, @text);
text = String.Format("{0:##,###,##0}", ts.LastWonAmount);
AddLabel(385, starty, ts.Hue - 1, @text);
}
starty += 25;
}
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
if (from == null)
return;
if (info.ButtonID == 100 && from.AccessLevel >= AccessLevel.GameMaster)// Admin Gump
{
ArrayList turboslotsarray = new ArrayList();
foreach (TurboSlot t in m_SlotArray) // Duplicate the array to avoid conflicts
turboslotsarray.Add(t);
from.SendGump(new TurboSlotsStatGump(from, m_SlotArray));
from.CloseGump(typeof(TurboSlotsAdminGump));
from.SendGump(new TurboSlotsAdminGump(from, turboslotsarray, 0, true, 0));
}
}
private class ListAmountSorter : IComparer
{
public ListAmountSorter()
: base()
{
}
public int Compare(object x, object y)
{
if (x == null || y == null || x == y) return 0;
if (((TurboSlot)x).LastWonAmount == ((TurboSlot)y).LastWonAmount)
{
return ((((TurboSlot)x).LastWonByDate > ((TurboSlot)y).LastWonByDate) ? -1 : 1);
}
return ((((TurboSlot)x).LastWonAmount > ((TurboSlot)y).LastWonAmount) ? -1 : 1);
}
}
}
Last edited: