Wired Code [UberEMU]

Page 1 of 4 1234 LastLast
Results 1 to 15 of 46
  1. #1
    Account Upgraded | Title Enabled! FlyCoder is offline
    MemberRank
    Jan 2011 Join Date
    United KingdomLocation
    469Posts

    Wired Code [UberEMU]

    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:
    Code:
      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();
            }
    Inside the
    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:
    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;
            }
    Search for Public void Chat(
    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
    Last edited by FlyCoder; 27-02-11 at 08:59 PM.


  2. #2
    Apprentice nickvlug is offline
    MemberRank
    Jan 2011 Join Date
    14Posts

    Re: Wired Code [UberEMU]

    thanks

  3. #3
    Your Favorite Stalker Arnii is offline
    MemberRank
    Jul 2008 Join Date
    The NetherlandsLocation
    579Posts

    Re: Wired Code [UberEMU]

    looks nice, thanks

    Grr..
    Arnii

  4. #4
    C# | C++ Emerica is offline
    MemberRank
    Oct 2010 Join Date
    GermanyLocation
    437Posts

    Re: Wired Code [UberEMU]

    Nice, thanks, but is this laggy ?

  5. #5
    Account Upgraded | Title Enabled! FlyCoder is offline
    MemberRank
    Jan 2011 Join Date
    United KingdomLocation
    469Posts

    Re: Wired Code [UberEMU]

    Quote Originally Posted by Emerica View Post
    Nice, thanks, but is this laggy ?
    Only in the big rooms but it has some effects on Uber Emulator.

  6. #6
    Member Habbi is offline
    MemberRank
    Feb 2011 Join Date
    88Posts

    Re: Wired Code [UberEMU]

    Niceee !

  7. #7
    Enthusiast srdanilo2014 is offline
    MemberRank
    Jan 2010 Join Date
    25Posts

    Re: Wired Code [UberEMU]

    100% Fix?

  8. #8
    Account Upgraded | Title Enabled! FlyCoder is offline
    MemberRank
    Jan 2011 Join Date
    United KingdomLocation
    469Posts

    Re: Wired Code [UberEMU]

    Quote Originally Posted by srdanilo2014 View Post
    100% Fix?
    More like 90%.

  9. #9
    Member Sav. is offline
    MemberRank
    Feb 2011 Join Date
    England.Location
    96Posts

    Re: Wired Code [UberEMU]

    Nice release a little laggy
    Last edited by Sav.; 27-02-11 at 08:44 PM.

  10. #10
    i didnt do this. Donkjam is offline
    MemberRank
    Jul 2007 Join Date
    4,494Posts

    Re: Wired Code [UberEMU]

    Quote Originally Posted by Viza View Post
    We already have this in this section And this was explained but I guess good job for a new comer. ;)
    your on your 20th name now or something?

    ON topic Nice release, More fixes are better than none.

  11. #11
    Enthusiast srdanilo2014 is offline
    MemberRank
    Jan 2010 Join Date
    25Posts

    Re: Wired Code [UberEMU]

    No need to add any input in the database? Or he recognizes himself?

  12. #12
    Account Upgraded | Title Enabled! FlyCoder is offline
    MemberRank
    Jan 2011 Join Date
    United KingdomLocation
    469Posts

    Re: Wired Code [UberEMU]

    Quote Originally Posted by srdanilo2014 View Post
    No need to add any input in the database? Or he recognizes himself?
    Whos "he"? Since when is a Code alive? ;P

  13. #13
    Member Sav. is offline
    MemberRank
    Feb 2011 Join Date
    England.Location
    96Posts

    Re: Wired Code [UberEMU]

    Less lagg
    Code:
     public bool findsResult(string sQuery)
            {
                bool Found = false;
                try
                {
                    mCommand.CommandText = sQuery;
                    Found = dReader.HasRows;
                    dReader.Close();
                    
                }
                catch (Exception ex) { UberEnvironment.GetLogging().WriteLine(ex.Message + "\n(^^" + sQuery + "^^)"); }
                return Found;
            }

  14. #14
    Proficient Member HabsHotel is offline
    MemberRank
    Jan 2011 Join Date
    CanadaLocation
    167Posts

    Re: Wired Code [UberEMU]

    I need the Sql's for this Please?

  15. #15
    Right here, right now.. jordynegen11 is offline
    MemberRank
    Jul 2009 Join Date
    NetherlandsLocation
    398Posts

    Re: Wired Code [UberEMU]

    this code is from the old spazz emu



Page 1 of 4 1234 LastLast

Advertisement