Ari
Member
- Sep 29, 2010
- 320
- 48
These fixes will include:
stop bots appearing more than once
bot deloading
1. Go into virtualRoom
2. Find:
3. Replace with:
4. Add under that:
stop bots appearing more than once
bot deloading
1. Go into virtualRoom
2. Find:
Code:
internal void loadBots()
{
DataColumn dCol;
using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
dCol = dbClient.getColumn("SELECT id FROM roombots WHERE roomid = '" + this.roomID + "'");
}
int[] IDs = dataHandling.dColToArray(dCol, null);
for (int i = 0; i < IDs.Length; i++)
{
virtualBot roomBot = new virtualBot(IDs[i], getFreeRoomIdentifier(), this);
roomBot.H = sqFLOORHEIGHT[roomBot.X, roomBot.Y];
sqUNIT[roomBot.X, roomBot.Y] = true;
_Bots.Add(roomBot.roomUID, roomBot);
sendData(@"@\" + roomBot.detailsString);
sendData("@b" + roomBot.statusString);
}
}
3. Replace with:
Code:
internal void loadBots()
{
DataColumn dCol;
using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
dCol = dbClient.getColumn("SELECT id FROM roombots WHERE roomid = '" + this.roomID + "'");
}
int[] IDs = dataHandling.dColToArray(dCol, null);
for (int i = 0; i < IDs.Length; i++)
{
if (!_Bot.ContainsKey(IDs[i]))
{
virtualBot roomBot = new virtualBot(IDs[i], getFreeRoomIdentifier(), this);
roomBot.H = sqFLOORHEIGHT[roomBot.X, roomBot.Y];
sqUNIT[roomBot.X, roomBot.Y] = true;
_Bots.Add(roomBot.roomUID, roomBot);
_Bot.Add(roomBot.ID, roomBot);
sendData(@"@\" + roomBot.detailsString);
sendData("@b" + roomBot.statusString);
}
}
}
4. Add under that:
Code:
internal void deloadBot(string Name)
{
virtualBot roomBot = botManager.getBot(Name);
using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
dbClient.runQuery("UPDATE roombots SET roomid = '0' WHERE id = '" + roomBot.ID + "'");
roomBot.Poof();
_Bots.Remove(roomBot.roomUID);
_Bot.Remove(roomBot.ID);
sqUNIT[roomBot.X, roomBot.Y] = false;
sendData("@]" + roomBot.roomUID);
}