[Plus Emulator] Add Badge Command

MasterJiq

Member
Jul 8, 2016
385
23
Hello,

I would to release my first (in my life) command edit with Plus Emulator, just playing around with it.
So here is the code, it would be 'AddBadgeCommand.cs' or whatever do you want.
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Plus.Communication.Packets.Outgoing.Catalog;
using Plus.Core;
using Plus.Database.Interfaces;
using Plus.Communication.Packets.Outgoing.Notifications;
using Plus.HabboHotel.GameClients;
namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator
{
    class AddBadgeCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_add_badge"; }
        }

        public string Parameters
        {
            get { return "%variable%"; }
        }

        public string Description
        {
            get { return "Insert the new badge"; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (!Session.GetHabbo().GetPermissions().HasCommand("command_add_badge"))
            {
                Session.SendWhisper("Oops, you do not have the permission.");
            }
            if (Params.Length == 1)
            {
                Session.SendWhisper("Put the correct badge code, title and description.");
                return;
            }
            string badge = Params[1];
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `badge_definitions` (code, required_right) VALUES (@badge, '');");
                dbClient.AddParameter("badge", badge);
                dbClient.RunQuery();
                Session.SendWhisper("Added the badge, please use :update badge_definitions to update the badge.");
            }
        }
    }
}

Thanks.
 

MasterJiq

Member
Jul 8, 2016
385
23
Add Class to the administrator or user folder, then create
Code:
this.Register("addbadge", AddBadgeCommand());
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683
Why do this on the client itself, and not just the housekeeping? Nice release, but it seems fucking stupid, aswell you cant edit past badges etc.

This is more like what something like that should be capable of in a CMS and not client-wise:

Sent from my SM-G928F using Tapatalk
 
Last edited:

MayoMayn

BestDev
Oct 18, 2016
1,423
683
I'm pretty sure I seen this released on RZ...
Its also pretty dumb, because it doesnt add a badge fully. It only inserts its it into definitions, and not client external badge texts or external variables texts. Useless "release".

Sent from my SM-G928F using Tapatalk
 

MasterJiq

Member
Jul 8, 2016
385
23
I should close this command, not working xD
 
Also I am on PRODUCTION-201607262204-86871104 and do someone find the packet id:
Code:
public const int CameraPhotoPreviewComposer = 2521;
2521 isn't correct for me.
 

Blasteh

big tits
Apr 3, 2013
1,156
521
I should close this command, not working xD
 
Also I am on PRODUCTION-201607262204-86871104 and do someone find the packet id:
Code:
public const int CameraPhotoPreviewComposer = 2521;
2521 isn't correct for me.
How's this even related to your command? Open another help thread.. this is the release section.
 

Users who are viewing this thread

Top