Hello,
I found some quite old Wired Code on my Computer, it's quite buggy. Dunno if it is useful or not but here goes...
Search: (RespectPet)
Then add these:
Code:RequestHandlers[3056] = new RequestHandler(InitializeWired);
RequestHandlers[3050] = new RequestHandler(RequestAddWired);
RequestHandlers[3051] = new RequestHandler(RequestAddTrigger);
RequestHandlers[3058] = new RequestHandler(GetFurniStates);
RequestHandlers[3052] = new RequestHandler(AddTriggerStatus);
RequestHandlers[3057] = new RequestHandler(RefreshWired);
RequestHandlers[3053] = new RequestHandler(DeleteWired);
RequestHandlers[3054] = new RequestHandler(DeleteWiredTrigger);
RequestHandlers[3055] = new RequestHandler(DeleteWiredAction);
In Rooms.cs add the following voids:
Inside theCode:private void SerializeWired()
{
GetResponse().Init(650);
DataTable Data = null;
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
Data = dbClient.ReadDataTable("SELECT * FROM wiredtrigger WHERE roomid = '" + Session.GetHabbo().CurrentRoomId + "'");
}
if (Data.Rows.Count == 0)
{
GetResponse().AppendStringWithBreak("H");
}
else
{
GetResponse().AppendInt32(Data.Rows.Count);
foreach (DataRow Row in Data.Rows)
{
GetResponse().AppendInt32(int.Parse(Row["slotid"].ToString()));
if (Row["triggertype"].ToString() == "say")
{
GetResponse().AppendStringWithBreak("HIH");
GetResponse().AppendStringWithBreak(Row["whattrigger"].ToString());
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
if (dbClient.findsResult("select * from wiredaction where slotid = '" + Row["slotid"].ToString() + "'"))
{
DataRow Action = null;
Action = dbClient.ReadDataRow("SELECT * from wiredaction where slotid = '" + Row["slotid"].ToString() + "'");
if (Action["typeaction"].ToString() == "status")
{
GetResponse().AppendString("HHHI");
GetResponse().AppendInt32(int.Parse(Action["itemid"].ToString()));
Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
RoomItem Item = Room.GetItem(uint.Parse(Action["itemid"].ToString()));
GetResponse().AppendString(Item.GetBaseItem().PublicName);
GetResponse().AppendStringWithBreak("");
GetResponse().AppendStringWithBreak(Action["whataction"].ToString());
GetResponse().AppendString("HHK");
}
else if (Action["typeaction"].ToString() == "kick")
{
GetResponse().AppendStringWithBreak("HHHIH");
GetResponse().AppendStringWithBreak("");
GetResponse().AppendString("HHJ");
}
}
else
{
GetResponse().AppendString("HHHH");
}
}
}
else if (Row["triggertype"].ToString() == "walkon")
{
GetResponse().AppendString("HI");
GetResponse().AppendInt32(int.Parse(Row["whattrigger"].ToString()));
Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
RoomItem Item = Room.GetItem(uint.Parse(Row["whattrigger"].ToString()));
GetResponse().AppendStringWithBreak(Item.GetBaseItem().PublicName);
GetResponse().AppendStringWithBreak("");
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
if (dbClient.findsResult("select * from wiredaction where slotid = '" + Row["slotid"].ToString() + "'"))
{
DataRow Action = null;
Action = dbClient.ReadDataRow("SELECT * from wiredaction where slotid = '" + Row["slotid"].ToString() + "'");
if (Action["typeaction"].ToString() == "status")
{
GetResponse().AppendString("HHII");
GetResponse().AppendInt32(int.Parse(Action["itemid"].ToString()));
Item = Room.GetItem(uint.Parse(Action["itemid"].ToString()));
GetResponse().AppendString(Item.GetBaseItem().PublicName);
GetResponse().AppendStringWithBreak("");
GetResponse().AppendStringWithBreak(Action["whataction"].ToString());
GetResponse().AppendString("HHK");
}
else if (Action["typeaction"].ToString() == "kick")
{
GetResponse().AppendStringWithBreak("HHIIH");
GetResponse().AppendStringWithBreak("");
GetResponse().AppendString("HHJ");
}
}
else
{
GetResponse().AppendString("HHIH");
}
}
}
else
GetResponse().AppendString("HHH");
}
GetResponse().AppendStringWithBreak("");
}
SendResponse();
}
private void InitializeWired()
{
SerializeWired();
}
private void RequestAddWired()
{
GetResponse().Init(650);
int SlotID = 0;
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
SlotID = dbClient.ReadInt32("select count(*) from wiredtrigger") + 1;
dbClient.ExecuteQuery("INSERT INTO wiredtrigger values ('" + SlotID +"','" + Session.GetHabbo().CurrentRoomId + "','','')");
}
SerializeWired();
}
private void RequestAddTrigger()
{
uint SlotID = Request.PopWiredUInt();
int Chose = Request.PopWiredInt32();
string ExtraData = null;
string Type = "";
if (Chose==0)
{
Request.AdvancePointer(3);
Type = "say";
ExtraData = Request.PopFixedString();
}
if (Chose==1)
{
ExtraData = Request.PopWiredInt32().ToString();
Request.AdvancePointer(3);
Type = "walkon";
}
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("update wiredtrigger set triggertype = '" + Type + "',whattrigger = '" + ExtraData + "' where slotid = '" + SlotID + "'");
}
SerializeWired();
}
private void GetFurniStates()
{
GetResponse().Init(651);
GetResponse().AppendStringWithBreak("JHI");
SendResponse();
}
private void AddTriggerStatus()
{
int slotID = Request.PopWiredInt32();
int Type = Request.PopWiredInt32();
int ItemID = 0;
string ItemName = "";
int status = 0;
if (Type == 3)
{
ItemID = Request.PopWiredInt32();
ItemName = Request.PopFixedString();
status = Request.PopFixedInt32();
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("INSERT INTO wiredaction values ('" + slotID + "','status','" + status + "','" + ItemID + "')");
}
}
if (Type ==2)
{
ItemID = Request.PopWiredInt32();
ItemName = Request.PopFixedString();
status = Request.PopFixedInt32();
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("INSERT INTO wiredaction values ('" + slotID + "','kick','','')");
}
}
SerializeWired();
}
private void DeleteWired()
{
int slotID = Request.PopWiredInt32();
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("delete from wiredtrigger where slotid= '" + slotID+"'");
dbClient.ExecuteQuery("delete from wiredaction where slotid= '" + slotID + "'");
}
SerializeWired();
}
private void RefreshWired()
{
SerializeWired();
}
private void DeleteWiredTrigger()
{
int slotID = Request.PopWiredInt32();
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("delete from wiredaction where slotid= '" + slotID + "'");
dbClient.ExecuteQuery("delete from wiredtrigger where slotid= '" + slotID + "'");
}
SerializeWired();
}
private void DeleteWiredAction()
{
int slotID = Request.PopWiredInt32();
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("delete from wiredaction where slotid= '" + slotID + "'");
}
SerializeWired();
}
foreach (RoomItem Item in ItemsOnSquare)
{
Add this code:
Code:DataTable Data = null;
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
Data = dbClient.ReadDataTable("SELECT * FROM wiredtrigger WHERE roomid = '" + RoomId + "'");
}
if (Data != null)
{
foreach (DataRow Row in Data.Rows)
{
if (Row["triggertype"].ToString() == "walkon")
{
if (int.Parse(Row["whattrigger"].ToString()) == Item.Id)
{
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
if (dbClient.findsResult("select * from wiredaction where slotid = '" + Row["slotid"].ToString() + "'"))
{
string type = dbClient.ReadString("select typeaction from wiredaction where slotid = '" + Row["slotid"] + "'");
if (type == "status")
{
RoomItem ItemToChange = GetItem(uint.Parse(dbClient.ReadString("select itemid from wiredaction where slotid = '" + Row["slotid"] + "'")));
ItemToChange.ExtraData = dbClient.ReadString("select whataction from wiredaction where slotid = '" + Row["slotid"] + "'");
ItemToChange.UpdateState();
}
else if (type == "kick")
{
RemoveUserFromRoom(User.GetClient(), true, false);
}
}
}
}
}
}
}
You may need to add this in Database.cs:
Search for Public void Chat(Code:public bool findsResult(string sQuery)
{
bool Found = false;
try
{
mCommand.CommandText = sQuery;
MySqlDataReader dReader = mCommand.ExecuteReader();
Found = dReader.HasRows;
dReader.Close();
}
catch (Exception ex) { UberEnvironment.GetLogging().WriteLine(ex.Message + "\n(^^" + sQuery + "^^)"); }
return Found;
}
Add:
Code:if (!IsBot)
{
DataTable Data = null;
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
Data = dbClient.ReadDataTable("SELECT * FROM wiredtrigger WHERE roomid = '" + Session.GetHabbo().CurrentRoomId + "'");
}
if (Data != null)
{
foreach (DataRow Row in Data.Rows)
{
if (Row["triggertype"].ToString() == "say")
{
if (Message.Contains(Row["whattrigger"].ToString()))
{
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
if (dbClient.findsResult("select * from wiredaction where slotid = '" + Row["slotid"].ToString() + "'"))
{
string type = dbClient.ReadString("select typeaction from wiredaction where slotid = '" + Row["slotid"] + "'");
if (type == "status")
{
Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
RoomItem Item = Room.GetItem(uint.Parse(dbClient.ReadString("select itemid from wiredaction where slotid = '" + Row["slotid"] + "'")));
Item.ExtraData = dbClient.ReadString("select whataction from wiredaction where slotid = '" + Row["slotid"] + "'");
Item.UpdateState();
}
else if (type == "kick")
{
GetRoom().RemoveUserFromRoom(Session, true, false);
}
}
}
}
}
}
}
}
Thanks,
FlyCoder

