Jump to content
×
×
  • Create New...
  • Please do not post a message for the purpose of insulting, incitement to hatred, sexual remarks and any other which does not respect our terms of use !

Partage commande " Furniture "


ßRÂИÐØИ
 Share

Recommended Posts

Bonjour je vous partage une commande furniture (PlusEmu) #SourceRageZone

 

Elle sert à modifier vos mobis de la table funiture, directement dans votre client.

 

using System; 
using System.Linq; 
using System.Text; 
using System.Collections.Generic; 


using Plus.Communication.Packets.Outgoing.Moderation; 
using Plus.HabboHotel.Items; 
using Plus.Communication.Packets.Outgoing.Notifications; 
using Plus.Database.Interfaces; 
using System.Data; 


namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator 
{ 
    class FurnitureCommand : IChatCommand 
    { 
        public string PermissionRequired 
        { 
            get { return "command_furniture"; } 
        } 

        public string Parameters 
        { 
            get { return "(Type) (montant)"; } 
        } 


        public string Description 
        { 
            get { return "Correction des mobiliers."; } 
        } 
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) 
        { 
            RoomUser RUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); 
            List<Item> Items = Room.GetGameMap().GetRoomItemForSquare(RUser.X, RUser.Y); 
            if (Params.Length == 1 || Params[1] == "help") 
            { 
                StringBuilder Lista = new StringBuilder(); 
                Lista.Append("Avertissement : Cette commande sert à modifier vos mobis depuis la table furniture.): \r\r"); 
                Lista.Append("1) :item width number (Edit item witdh) \r"); 
                Lista.Append("2) :item length number (Edit item length) \r"); 
                Lista.Append("3) :item height number (Edit item height) \r"); 
                Lista.Append("4) :item cansit yes/no (Allow / Disallow Sit on the Item) \r"); 
                Lista.Append("5) :item canwalk yes/no (Allow / Disallow Walk on the Item) \r"); 
                Lista.Append("6) :item canstack yes/no (Allow / Disallow Stack on the Item) \r"); 
                Lista.Append("7) :item market yes/no (Allow / Disallow Market place sell) \r"); 
                Lista.Append("8) :item interaction name (Set the Item interaction) \r"); 
                Lista.Append("9) :item interactioncount number (Set the amount of interactions of the Item) \r\r"); 
                Lista.Append("Info : unload votre appart une fois que ton mobis est modifier."); 
                Session.SendMessage(new MOTDNotificationComposer(Lista.ToString())); 
                return; 
            } 
            String Type = Params[1].ToLower(); 
            int numeroint = 0, FurnitureID = 0; 
            double numerodouble = 0; 
            DataRow Item = null; 
            String opcion = ""; 
            switch (Type) 
            { 
                case "width": 
                    { 
                        try 
                        { 
                            numeroint = Convert.ToInt32(Params[2]); 
                            foreach (Item IItem in Items.ToList()) 
                            { 
                                if (IItem == null) 
                                    continue; 
                                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) 
                                { 
                                    dbClient.SetQuery("SELECT base_item FROM items WHERE id = '" + IItem.Id + "' LIMIT 1"); 
                                    Item = dbClient.getRow(); 
                                    if (Item == null) 
                                        continue; 
                                    FurnitureID = Convert.ToInt32(Item[0]); 
                                    dbClient.RunQuery("UPDATE `furniture` SET `width` = '" + numeroint + "' WHERE `id` = '" + FurnitureID + "' LIMIT 1"); 
                                } 
                                Session.SendWhisper("Item width: " + FurnitureID + " updated (New width: "+numeroint.ToString()+")"); 
                            } 
                            PlusEnvironment.GetGame().GetItemManager().Init(); 
                        } 
                        catch (Exception) 
                        { 
                            Session.SendNotification("Oops! Something wrong! (Only valid numbers)"); 
                        } 
                    } 
                    break; 
                case "length": 
                    { 
                        try 
                        { 
                            numeroint = Convert.ToInt32(Params[2]); 
                            foreach (Item IItem in Items.ToList()) 
                            { 
                                if (IItem == null) 
                                    continue; 
                                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) 
                                { 
                                    dbClient.SetQuery("SELECT base_item FROM items WHERE id = '" + IItem.Id + "' LIMIT 1"); 
                                    Item = dbClient.getRow(); 
                                    if (Item == null) 
                                        continue; 
                                    FurnitureID = Convert.ToInt32(Item[0]); 
                                    dbClient.RunQuery("UPDATE `furniture` SET `length` = '" + numeroint + "' WHERE `id` = '" + FurnitureID + "' LIMIT 1"); 
                                } 
                                Session.SendWhisper("Item length: " + FurnitureID + " updated (New length: " + numeroint.ToString() + ")"); 
                            } 
                            PlusEnvironment.GetGame().GetItemManager().Init(); 
                        } 
                        catch (Exception) 
                        { 
                            Session.SendNotification("Oops! Something wrong! (Only valid numbers)"); 
                        } 
                    } 
                    break; 
                case "height": 
                    { 
                        try 
                        { 
                            numerodouble = Convert.ToDouble(Params[2]); 
                            foreach (Item IItem in Items.ToList()) 
                            { 
                                if (IItem == null) 
                                    continue; 
                                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) 
                                { 
                                    dbClient.SetQuery("SELECT base_item FROM items WHERE id = '" + IItem.Id + "' LIMIT 1"); 
                                    Item = dbClient.getRow(); 
                                    if (Item == null) 
                                        continue; 
                                    FurnitureID = Convert.ToInt32(Item[0]); 
                                    dbClient.RunQuery("UPDATE `furniture` SET `stack_height` = '" + numerodouble + "' WHERE `id` = '" + FurnitureID + "' LIMIT 1"); 
                                } 
                                Session.SendWhisper("Item height: " + FurnitureID + " updated (New height: " + numerodouble.ToString() + ")"); 
                            } 
                            PlusEnvironment.GetGame().GetItemManager().Init(); 
                        } 
                        catch (Exception) 
                        { 
                            Session.SendNotification("Oops! Something wrong! (Only valid numbers)"); 
                        } 
                    } 
                    break; 
                case "interactioncount": 
                    { 
                        try 
                        { 
                            numeroint = Convert.ToInt32(Params[2]); 
                            foreach (Item IItem in Items.ToList()) 
                            { 
                                if (IItem == null) 
                                    continue; 
                                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) 
                                { 
                                    dbClient.SetQuery("SELECT base_item FROM items WHERE id = '" + IItem.Id + "' LIMIT 1"); 
                                    Item = dbClient.getRow(); 
                                    if (Item == null) 
                                        continue; 
                                    FurnitureID = Convert.ToInt32(Item[0]); 
                                    dbClient.RunQuery("UPDATE `furniture` SET `interaction_modes_count` = '" + numeroint + "' WHERE `id` = '" + FurnitureID + "' LIMIT 1"); 
                                } 
                                Session.SendWhisper("Interaction count: " + FurnitureID + " updated (New interaction count: " + numeroint.ToString() + ")"); 
                            } 
                            PlusEnvironment.GetGame().GetItemManager().Init(); 
                        } 
                        catch (Exception) 
                        { 
                            Session.SendNotification("Oops! Something wrong! (Only valid numbers)"); 
                        } 
                    } 
                    break; 
                case "cansit": 
                    { 
                        try 
                        { 
                            opcion = Params[2].ToLower(); 
                            if (!opcion.Equals("yes") && !opcion.Equals("no")) 
                            { 
                                Session.SendWhisper("Only use yes OR no)"); 
                                return; 
                            } 
                            if (opcion.Equals("yes")) 
                                opcion = "1"; 
                            else if (opcion.Equals("no")) 
                                opcion = "0"; 
                            foreach (Item IItem in Items.ToList()) 
                            { 
                                if (IItem == null) 
                                    continue; 
                                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) 
                                { 
                                    dbClient.SetQuery("SELECT base_item FROM items WHERE id = '" + IItem.Id + "' LIMIT 1"); 
                                    Item = dbClient.getRow(); 
                                    if (Item == null) 
                                        continue; 
                                    FurnitureID = Convert.ToInt32(Item[0]); 
                                    dbClient.RunQuery("UPDATE `furniture` SET `can_sit` = '" + opcion + "' WHERE `id` = '" + FurnitureID + "' LIMIT 1"); 
                                } 
                                Session.SendWhisper("Item can_sit: " + FurnitureID + " updated"); 
                            } 
                            PlusEnvironment.GetGame().GetItemManager().Init(); 
                        } 
                        catch (Exception) 
                        { 
                            Session.SendNotification("Oops! Something wrong!"); 
                        } 
                    } 
                    break; 
                case "canstack": 
                    { 
                        try 
                        { 
                            opcion = Params[2].ToLower(); 
                            if (!opcion.Equals("yes") && !opcion.Equals("no")) 
                            { 
                                Session.SendWhisper("Only use yes OR no)"); 
                                return; 
                            } 
                            if (opcion.Equals("yes")) 
                                opcion = "1"; 
                            else if (opcion.Equals("no")) 
                                opcion = "0"; 
                            foreach (Item IItem in Items.ToList()) 
                            { 
                                if (IItem == null) 
                                    continue; 
                                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) 
                                { 
                                    dbClient.SetQuery("SELECT base_item FROM items WHERE id = '" + IItem.Id + "' LIMIT 1"); 
                                    Item = dbClient.getRow(); 
                                    if (Item == null) 
                                        continue; 
                                    FurnitureID = Convert.ToInt32(Item[0]); 
                                    dbClient.RunQuery("UPDATE `furniture` SET `can_stack` = '" + opcion + "' WHERE `id` = '" + FurnitureID + "' LIMIT 1"); 
                                } 
                                Session.SendWhisper("Item can_stack: " + FurnitureID + " updated"); 
                            } 
                            PlusEnvironment.GetGame().GetItemManager().Init(); 
                        } 
                        catch (Exception) 
                        { 
                            Session.SendNotification("Oops! Something wrong!"); 
                        } 
                    } 
                    break; 
                case "canwalk": 
                    { 
                        try 
                        { 
                            opcion = Params[2].ToLower(); 
                            if (!opcion.Equals("yes") && !opcion.Equals("no")) 
                            { 
                                Session.SendWhisper("Only use yes OR no)"); 
                                return; 
                            } 
                            if (opcion.Equals("yes")) 
                                opcion = "1"; 
                            else if (opcion.Equals("no")) 
                                opcion = "0"; 
                            foreach (Item IItem in Items.ToList()) 
                            { 
                                if (IItem == null) 
                                    continue; 
                                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) 
                                { 
                                    dbClient.SetQuery("SELECT base_item FROM items WHERE id = '" + IItem.Id + "' LIMIT 1"); 
                                    Item = dbClient.getRow(); 
                                    if (Item == null) 
                                        continue; 
                                    FurnitureID = Convert.ToInt32(Item[0]); 
                                    dbClient.RunQuery("UPDATE `furniture` SET `is_walkable` = '" + opcion + "' WHERE `id` = '" + FurnitureID + "' LIMIT 1"); 
                                } 
                                Session.SendWhisper("Item can_walk: " + FurnitureID + " updated"); 
                            } 
                            PlusEnvironment.GetGame().GetItemManager().Init(); 
                        } 
                        catch (Exception) 
                        { 
                            Session.SendNotification("Oops! Something wrong!"); 
                        } 
                    } 
                    break; 
                case "market": 
                    { 
                        try 
                        { 
                            opcion = Params[2].ToLower(); 
                            if (!opcion.Equals("yes") && !opcion.Equals("no")) 
                            { 
                                Session.SendWhisper("Only use yes OR no)"); 
                                return; 
                            } 
                            if (opcion.Equals("yes")) 
                                opcion = "1"; 
                            else if (opcion.Equals("no")) 
                                opcion = "0"; 
                            foreach (Item IItem in Items.ToList()) 
                            { 
                                if (IItem == null) 
                                    continue; 
                                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) 
                                { 
                                    dbClient.SetQuery("SELECT base_item FROM items WHERE id = '" + IItem.Id + "' LIMIT 1"); 
                                    Item = dbClient.getRow(); 
                                    if (Item == null) 
                                        continue; 
                                    FurnitureID = Convert.ToInt32(Item[0]); 
                                    dbClient.RunQuery("UPDATE `furniture` SET `is_rare` = '" + opcion + "' WHERE `id` = '" + FurnitureID + "' LIMIT 1"); 
                                } 
                                Session.SendWhisper("Market place option: " + FurnitureID + " updated"); 
                            } 
                            PlusEnvironment.GetGame().GetItemManager().Init(); 
                        } 
                        catch (Exception) 
                        { 
                            Session.SendNotification("Oops! Something wrong!"); 
                        } 
                    } 
                    break; 
                case "interaction": 
                    { 
                        try 
                        { 
                            opcion = Params[2].ToLower(); 
                            foreach (Item IItem in Items.ToList()) 
                            { 
                                if (IItem == null) 
                                    continue; 
                                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) 
                                { 
                                    dbClient.SetQuery("SELECT base_item FROM items WHERE id = '" + IItem.Id + "' LIMIT 1"); 
                                    Item = dbClient.getRow(); 
                                    if (Item == null) 
                                        continue; 
                                    FurnitureID = Convert.ToInt32(Item[0]); 
                                    dbClient.RunQuery("UPDATE `furniture` SET `interaction_type` = '" + opcion + "' WHERE `id` = '" + FurnitureID + "' LIMIT 1"); 
                                } 
                                Session.SendWhisper("Item interaction: "+FurnitureID+" updated. (New interaction: "+opcion+")"); 
                            } 
                            PlusEnvironment.GetGame().GetItemManager().Init(); 
                        } 
                        catch (Exception) 
                        { 
                            Session.SendNotification("Oops! Something wrong!"); 
                        } 
                    } 
                    break; 
                default: 
                    { 
                        Session.SendNotification("Oops! Something wrong! If you need help, see :item help"); 
                        return; 
                    }break; 
            } 
        } 
   } 
}  

 


 

Link to comment
Share on other sites

Merci du partage, mais je pense que c'est plus facile de passer par une page php qui fait les modifications directement.

Link to comment
Share on other sites

J'ai corrigé les requêtes et un peu plus traduit : 
Créer un nouveau .cs nommé FurnitureCommand.cs dans le dossier > HabboHotel > Rooms > Chat > Commands > Moderator

Et coller ceci dans le fichier FurnitureCommand.cs : http://pastebin.com/SvRaREjt

Ajouté à CommandManager.cs qui se trouve : HabboHotel > Rooms > Chat > Commands
Cherché ceci : private void RegisterModerator()
Ajouté ceci : this.Register("item", new FurnitureCommand());    (après le { )

Ajouter ceci à votre base de donnée : 
INSERT INTO `permissions_commands` (`command`, `group_id`, `subscription_id`, `descriptions`) VALUES ('command_furniture', '9', '0', '');

Modifier le '9' si vous voulez changer le rank minimum !

Enjoy !

 


 

Link to comment
Share on other sites

Je pense que tu peux modifier ton code pour avoir moins de redondance car quand on regarde ton code tout se ressemble juste quelques petites modifications dans certains cas.

 

Link to comment
Share on other sites

Il y a 4 heures, michel a dit :

Je pense que tu peux modifier ton code pour avoir moins de redondance car quand on regarde ton code tout se ressemble juste quelques petites modifications dans certains cas.

 

Ce n'ai pas mon code, comme je les dis " #SourceRageZone".


 

Link to comment
Share on other sites

  • 1 month later...
Le 03/01/2017 à 13:37, Brandon a dit :

J'ai corrigé les requêtes et un peu plus traduit : 
Créer un nouveau .cs nommé FurnitureCommand.cs dans le dossier > HabboHotel > Rooms > Chat > Commands > Moderator

Et coller ceci dans le fichier FurnitureCommand.cs : http://pastebin.com/SvRaREjt

Ajouté à CommandManager.cs qui se trouve : HabboHotel > Rooms > Chat > Commands
Cherché ceci : private void RegisterModerator()
Ajouté ceci : this.Register("item", new FurnitureCommand());    (après le { )

Ajouter ceci à votre base de donnée : 
INSERT INTO `permissions_commands` (`command`, `group_id`, `subscription_id`, `descriptions`) VALUES ('command_furniture', '9', '0', '');

Modifier le '9' si vous voulez changer le rank minimum !

Enjoy !

 

 

Admettons je veux fixé une chaise car ont peut pas s'assoir dessus.

Que dois-je écrire comme commande s'il te plait?

J'ai essayé 20 fois , j'ai pas réussis!

Link to comment
Share on other sites

  • 3 months later...
Le 2/3/2017 à 14:41, NevetS a dit :

 

Admettons je veux fixé une chaise car ont peut pas s'assoir dessus.

Que dois-je écrire comme commande s'il te plait?

J'ai essayé 20 fois , j'ai pas réussis!

:item cansit oui

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share