Revolution Emulator [C#, R63B, Encryption Cracked, DAO, Fluent NHibernate, Lua Plugin, Mono]

Status
Not open for further replies.

Adil

DevBest CEO
May 28, 2011
1,278
716
PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Revolution.Application.HabboHotel.Commands.Interface
{
    interface ISendableCommand
    {
 
        public void Register();
        public void SendCommand(Mango.Communication.Sessions.Session Session);
        public void Unregister();
    }
}
This is an interface which commands implement.
PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using  Revolution.Application.HabboHotel.Commands.Interface;
namespace Revolution.Application.HabboHotel.Commands.SendableCommands
{
    class ExampleCommand : ISendableCommand
    {
        public void Register()
        { }
        public void SendCommand(Mango.Communication.Sessions.Session Session)
        {
            if (Session != null )
            {
                Session.SendAlert("aduidf");
                Session.Disconnect();
            }
        }
        public void Unregister()
        { }
    }
}
Example command
All commands are invoked from a dictionary based on their "call". I.e
:help will invoke the help command.
This allows you to customise rev easily and safely.
I just started the system, I will post more information soon! :p
 

Sledmur

Web-Developer
Nov 29, 2011
459
98
PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Revolution.Application.HabboHotel.Commands.Interface
{
    interface ISendableCommand
    {
 
        public void Register();
        public void SendCommand(Mango.Communication.Sessions.Session Session);
        public void Unregister();
    }
}
This is an interface which commands implement.
PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using  Revolution.Application.HabboHotel.Commands.Interface;
namespace Revolution.Application.HabboHotel.Commands.SendableCommands
{
    class ExampleCommand : ISendableCommand
    {
        public void Register()
        { }
        public void SendCommand(Mango.Communication.Sessions.Session Session)
        {
            if (Session != null )
            {
                Session.SendAlert("aduidf");
                Session.Disconnect();
            }
        }
        public void Unregister()
        { }
    }
}
Example command
All commands are invoked from a dictionary based on their "call". I.e
:help will invoke the help command.
This allows you to customise rev easily and safely.
I just started the system, I will post more information soon! :p
So, ExampleCommand : ISendableCommand. The ExampleCommand arguement, is the command that is sent? so i changed that to FuckYou, the command could be :FuckYou?
 

Adil

DevBest CEO
May 28, 2011
1,278
716
So, ExampleCommand : ISendableCommand. The ExampleCommand arguement, is the command that is sent? so i changed that to FuckYou, the command could be :FuckYou?
Er no, example command is the class name :p
Also, would you rather have:
  • A system where the class invokes itself (command = class name)
or
  • A system where you specify the command (command != class name)
 

Sledmur

Web-Developer
Nov 29, 2011
459
98
Er no, example command is the class name :p
Also, would you rather have:
  • A system where the class invokes itself (command = class name)
or

  • A system where you specify the command (command != class name)

Class, be easier for larger scale plugins.
 

Adil

DevBest CEO
May 28, 2011
1,278
716
Updates for today, just done some work now.
  • Started on a banner class
  • Started finishing up the commands system
  • Researched into how I can implement a small scripting engine
These updates should be more interesting to developers :)
 

Adil

DevBest CEO
May 28, 2011
1,278
716
PHP:
public void Invoke(Session session, string command)
        {
            using (DictionaryAdapter<string, ISendableCommand> DA = new DictionaryAdapter<string, ISendableCommand>(this.Commands))
            {
                DA.TryPopValue(command).SendCommand(session);
            }
 
         
        }
Probably will be refactored soon (if the need arises). This will basically allow you guys to use stuff like:
PHP:
/// <summary>
        /// Execute the specified command
        /// </summary>
        /// <param name="session">The session the command is coming from</param>
        /// <param name="command">The command parameter</param>
        public void ExecuteCommand(Session session, string command)
        {
            string RawCommand = command.Substring(1); //improve
            Application.Commands.Invoke(this, RawCommand);
        }

What that does is listen for commands from a session, and then invoke them. If the command doesn't exist:
PHP:
session.SendAlert("Command " + command + " does not exist!");
 

Zak

Posting Freak
Mar 12, 2011
848
453
While Adil working smoothly on the game stuff, i'll work on the performance site for the week, currently figuring out the best way to modify accepting Sessions with .NET 4.5 with Supersockets 1.4 Stable.
 

Adil

DevBest CEO
May 28, 2011
1,278
716
PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LuaInterface;
using System.IO;
using Revolution.Core;
 
namespace Revolution.Application.Api.Scripting
{
    /// <summary>
    /// Manages Lua scripts and the main Lua VM (virtual machine).
    /// </summary>
    public class LuaManager
    {
        /// <summary>
        /// Count how many scripts are loaded.
        /// </summary>
        private int ScriptCount;
 
        /// <summary>
        /// Holds all the script files.
        /// </summary>
        private Dictionary<dynamic, dynamic> Scripts;
 
        /// <summary>
        /// Folder path as a UTF-8 ASCII compliant string.
        /// </summary>
        private string FolderPath { get; set; }
 
        private DirectoryInfo ScriptDirectory;
 
        /// <summary>
        /// The virtual machine instance for Lua.
        /// </summary>
        private Lua LuaVM;
 
 
        public LuaManager(string FolderPath)
        {
            this.FolderPath = FolderPath;
            this.ScriptDirectory = new DirectoryInfo(FolderPath);
            this.LuaVM = new Lua();
        }
 
        public LuaManager(string FolderPath, Lua Vm)
        {
            this.FolderPath = FolderPath;
            this.ScriptDirectory = new DirectoryInfo(FolderPath);
            this.LuaVM = Vm;
        }
 
        public bool LoadScripts()
        {
            if (this.ScriptDirectory.Exists)
            {
                foreach (FileInfo Fi in this.ScriptDirectory.GetFiles())
                {
                    var ScriptFile = this.LuaVM.DoFile(Fi.FullName);
 
                    this.Scripts.Add(Fi.Name, ScriptFile);
                    Logging.GetLogging().WriteLine("Loaded " + this.Scripts.Count() + " scripts");
                    this.ScriptCount = this.Scripts.Count();
                }
 
                return true;
            }
            Logging.GetLogging().WriteLine("Failed to load scripts from path.");
            return false;
        }
    }
}
Untested & dirty (kinda).
This is a totally abstracted script engine. You could theoretically build your own game on it and run it as a standalone app. Our next step is to look exposing classes in the main binary for the Lua engine.

Cecer1/Chris has told me LuaInterface is not compatible with Mono, so that may be ditched.
CS-Script is a likely alternative (maybe even some sort of js interface!) 
Boo is also a consideration;
PHP:
import System
 import Gtk from "gtk-sharp"

 def Window_Delete (o, args as DeleteEventArgs):
         Gtk.Application.Quit ()

 def Button_Clicked (o, args as EventArgs):
         print "Hello, World!"

 Gtk.Application.Init ()
 w = Gtk.Window ("Gtk# Basics")
 b = Gtk.Button ("Hit me")

 w.DeleteEvent += Window_Delete
 b.Clicked += Button_Clicked

 w.Add (b)
 w.SetDefaultSize (200, 100)
 w.ShowAll ()
 Gtk.Application.Run ()
Compatible with Mono too.
 

Zak

Posting Freak
Mar 12, 2011
848
453
Well, we can make 2 repo's so CS-Script for the Mac and Linux users, and Lua for the Windows users.

If they wanna develop in Lua that badly, they can always use VMWare or w.e
 

Kayte

Living La Dolce Vita.
Apr 19, 2011
365
151
I'm totally looking forward to Rev, so I look at this thread every day for updates.
Turns out I don't understand anything you're all saying facepalm.jpg.

But yeah, I can't wait nao.
 

Adil

DevBest CEO
May 28, 2011
1,278
716
This is a class I fished from an old source of mine:
PHP:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using CSScriptLibrary;
 
namespace Revolution.Application.Api.Scripting
{
    {
    /// <summary>
    /// Manages CS-Script plugins.
    /// </summary>
    class ScriptManager
    {
        /// <summary>
        /// Dictionary which holds all known scripts.
        /// </summary>
        private Dictionary<string, dynamic> Scripts;
 
        /// <summary>
        /// Holds information about the directory where scripts are.
        /// </summary>
        private DirectoryInfo ScriptDirectory;
 
        /// <summary>
        /// The path to the scripts, specified as a string object.
        /// </summary>
        private string ScriptPath;
 
 
 
        /// <summary>
        /// Initialise the class.
        /// </summary>
        /// <param name="ScriptPath">The path where scripts are located.</param>
        
 
        public ScriptManager(string ScriptPath)
        {
            this.ScriptPath = ScriptPath;
            this.ScriptDirectory = new DirectoryInfo(this.ScriptPath);
           
            this.Scripts = new Dictionary<string, dynamic>();
        }
 
        /// <summary>
        /// Initialise the plugins.
        /// </summary>
        public void InitializePlugins()
        {
            Application.Logging.WriteLine("Attempting to boot plugins..",Core.Logging.Status.Information);
            if (this.ScriptDirectory.Exists)
            {
                foreach (FileInfo FI in this.ScriptDirectory.GetFiles()) //foreach through each file
                {
                    if (FI.Exists) //check if file(s) exist(s)
                    {
                         var ScriptFile = new AsmHelper(CSScript.Load(FI.FullName)); //dynamic assembly loading
 
                        try
                        {
                            using (StreamReader Reader = new StreamReader(FI.Open(FileMode.Open))) //read through the file
                            {
                                ScriptFile.Invoke("*.Main"); //Invoke the Main() method, with the wildcard (any main method invoked).
                                
                                this.Scripts.Add(FI.Name, ScriptFile); //add to dictionary
 
 
 
 
                            }
                        }
                        catch (Exception e)
                        {
                            Application.Logging.WriteLine(e.Message,Core.Logging.Status.Error); //something went wrong
                            
                        }
                    }
 
                }
               Application.Logging.WriteLine(this.Scripts.Count()+" plugins loaded.",Core.Logging.Status.Information);
                
                
            }
            else
            {
                Application.Logging.WriteLine("Plugin directory could not be found.",Core.Logging.Status.Warning);
            }
 
           
        }
 
       
 
    }
This will allow you to use CS-Script as your plugin system.
 

iRekan

XboxOneFTW!
Nov 8, 2011
349
47
-Writes a letter to sulake telling them why they haven't released habbo illumuni ui yet- Now lets see if this emu is released more soon ;)
 

Adil

DevBest CEO
May 28, 2011
1,278
716
I have a few cool ideas planned.. Discussing them with Zak to see what he thinks about them.
We'll update in due course. ;) 
We're using Javascript.NET for our API implementation.
This will allow us to use a V8-esque approach; JavaScript for coding, C# for the backend (instead of C++).
I'll post some docs tomorrow when I wake up..
:)
 

Zak

Posting Freak
Mar 12, 2011
848
453
About time i posted some code!

HabboServer is now finally running of the SuperSockets AppServer

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mango.Communication.Sessions;
using SuperSocket.SocketBase;
using SuperSocket.SocketBase.Command;
using SuperSocket.SocketBase.Config;

namespace Revolution.Application.Communication
{
    public class HabboServer : AppServer<Session>
    {
        public HabboServer()
        {
            SuperSocket.SocketBase.Config.RootConfig r = new SuperSocket.SocketBase.Config.RootConfig();

            SuperSocket.SocketBase.Config.ServerConfig s = new SuperSocket.SocketBase.Config.ServerConfig();
            s.Name = "HabboServer";
            s.ServiceName = "HabboServer";
            s.Ip = "Any";
            s.Port = 21;
            s.Mode = SocketMode.Async;
            

            SuperSocket.SocketEngine.SocketServerFactory f = new SuperSocket.SocketEngine.SocketServerFactory();

            base.Setup(r, s, f);
        }
    }
}
 
Status
Not open for further replies.

Users who are viewing this thread

Top