public ChestItemSpawnerGump(ChestItemSpawner spawner) : base(50, 50) { m_Spawner = spawner; m_SpawnBefore = new SpawnerMemory(); m_SpawnAfter = new SpawnerMemory(); AddPage(0); AddBackground(0, 0, 260, 371, 5054); AddLabel(95, 1, 0, "Items List"); AddButton(5, 347, 0xFB1, 0xFB3, 0, GumpButtonType.Reply, 0); AddLabel(38, 347, 0x384, "Cancel"); AddButton(5, 325, 0xFB7, 0xFB9, 1, GumpButtonType.Reply, 0); AddLabel(38, 325, 0x384, "Okay"); AddButton(110, 347, 0xFA8, 0xFAA, 2, GumpButtonType.Reply, 0); AddLabel(143, 347, 0x384, "Total Respawn"); AddButton(110, 325, 0xFA8, 0xFAA, 3, GumpButtonType.Reply, 0); AddLabel(143, 325, 0x384, "Set Container"); for (int i = 0; i < 13; i++) { AddButton(5, (22 * i) + 20, 0xFA5, 0xFA7, 4 + (i * 2), GumpButtonType.Reply, 0); AddButton(38, (22 * i) + 20, 0xFA2, 0xFA4, 5 + (i * 2), GumpButtonType.Reply, 0); AddImageTiled(71, (22 * i) + 20, 159, 23, 0x52); AddImageTiled(72, (22 * i) + 21, 157, 21, 0xBBC); string str = ""; if (i < spawner.ItemsName.Count) { str = (string)spawner.ItemsName[i]; int count = m_Spawner.CountItems(str); if (str != "") { m_SpawnBefore.Add(str); } AddLabel(232, (22 * i) + 20, 0, count.ToString()); } AddTextEntry(75, (22 * i) + 21, 154, 21, 0, i, str); } }
// Compare SpawnerMemory passed with this instance // and logs any changes to file public void Compare(SpawnerMemory sm) { ArrayList DiffList = new ArrayList(); for (int i = 0; i < 13; i++) { if (sm.Retrieve(m_Names[i]) != Retrieve(m_Names[i])) { DiffList.Add(m_Names[i] + " changed, " + Retrieve(m_Names[i]) + " to " + sm.Retrieve(m_Names[i])); } } for (int i = 0; i < 13; i++) { if (!sm.m_IsChecked[i] && sm.m_Names[i] != null) { DiffList.Add(sm.m_Names[i] + " changed, 0 to " + sm.m_Counts[i]); } } if (DiffList.Count > 0) { // There are differences, so log them! StreamWriter LogFile = new StreamWriter("logs/spawnerchange.log", true); foreach (string difference in DiffList) { // Log entries here LogFile.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", DateTime.Now, LinkedPerson.Account, m_Spawner.Location.X, m_Spawner.Location.Y, m_Spawner.Location.Z, difference); } LogFile.Close(); } return; }
public SpawnerGump( Spawner spawner ) : base( 50, 50 ) { m_Spawner = spawner; m_SpawnBefore = new SpawnerMemory(); m_SpawnAfter = new SpawnerMemory(); AddPage( 0 ); AddBackground( 0, 0, 260, 371, 5054 ); AddLabel( 95, 1, 0, "Creatures List" ); AddButton( 5, 347, 0xFB1, 0xFB3, 0, GumpButtonType.Reply, 0 ); AddLabel( 38, 347, 0x384, "Cancel" ); AddButton( 5, 325, 0xFB7, 0xFB9, 1, GumpButtonType.Reply, 0 ); AddLabel( 38, 325, 0x384, "Okay" ); AddButton( 110, 325, 0xFB4, 0xFB6, 2, GumpButtonType.Reply, 0 ); AddLabel( 143, 325, 0x384, "Bring to Home" ); AddButton( 110, 347, 0xFA8, 0xFAA, 3, GumpButtonType.Reply, 0 ); AddLabel( 143, 347, 0x384, "Total Respawn" ); for ( int i = 0; i < 13; i++ ) { AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, 4 + (i * 2), GumpButtonType.Reply, 0 ); AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, 5 + (i * 2), GumpButtonType.Reply, 0 ); AddImageTiled( 71, ( 22 * i ) + 20, 159, 23, 0xA40 ); AddImageTiled( 72, ( 22 * i ) + 21, 157, 21, 0xBBC ); string str = ""; if ( i < spawner.CreaturesName.Count ) { str = (string)spawner.CreaturesName[i]; int count = m_Spawner.CountCreatures( str ); if(str!="") m_SpawnBefore.Add(str); AddLabel( 232, ( 22 * i ) + 20, 0, count.ToString() ); } AddTextEntry( 75, ( 22 * i ) + 21, 154, 21, 0, i, str ); } }
// Compare SpawnerMemory passed with this instance // and logs any changes to file public void Compare(SpawnerMemory sm) { ArrayList DiffList = new ArrayList(); for(int i=0; i < 13; i++) { if(sm.Retrieve(m_Names[i])!=Retrieve(m_Names[i])) DiffList.Add(m_Names[i] + " changed, " + Retrieve(m_Names[i]) + " to " + sm.Retrieve(m_Names[i])); } for(int i=0; i < 13; i++) { if(!sm.m_IsChecked[i] && sm.m_Names[i]!=null) DiffList.Add(sm.m_Names[i] + " changed, 0 to " + sm.m_Counts[i]); } if(DiffList.Count > 0) { // There are differences, so log them! StreamWriter LogFile = new StreamWriter( "logs/spawnerchange.log", true ); foreach(string difference in DiffList) { // Log entries here LogFile.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", DateTime.Now, LinkedPerson.Account, m_Spawner.Location.X, m_Spawner.Location.Y, m_Spawner.Location.Z, difference); } LogFile.Close(); } return; }