Holograph Emulator Plugins

Results 1 to 8 of 8
  1. #1
    Atomic Developer lab-hotel is offline
    MemberRank
    Apr 2007 Join Date
    261Posts

    Holograph Emulator Plugins

    Hello, this is my first release in here...

    Q: WTF?
    A: If you have a famous hotel, it's horrible to restart the server to add a new feature, I have adapted the Ion plugin system to work on Holograph Emulator, with this you can add new features without restarting your famous server.

    Q: Oh, nice, and how to put this in my server?
    A: Just create a class in your Holograph Emulator in your C# project with this code:

    [php]
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    using System.Reflection;
    using Holo.Virtual.Users;

    namespace Holo
    {
    static class PluginManager
    {
    static List<HolographPlugin> _Plugins;

    public static void Init()
    {
    Out.WriteLine("Starting Plugin Manager...");
    int qtd = 0;
    try
    {
    _Plugins = new List<HolographPlugin>();
    if (Directory.Exists(Environment.CurrentDirectory + "\\Plugins") == false)
    {
    Out.WriteError("Cannot init Plugin Manager, the directory \"\\Plugins\" does not exists.");
    return;
    }
    string[] pFiles = Directory.GetFiles(Environment.CurrentDirectory + "\\Plugins", "*.dll");
    for (int i = 0; i < pFiles.Length; i++)
    {
    HolographPlugin P = InitPlugin(pFiles[i]);
    if (P != null)
    _Plugins.Add(P);
    qtd++;
    }
    }
    catch
    {
    Out.WriteError("Error when starting Plugin Manager. Probably you have a broken plugin.");
    return;
    }
    Out.WriteLine((qtd++) + " Plugins loaded.");
    }

    public static void reloadPlugins()
    {
    foreach (HolographPlugin hP in _Plugins)
    hP.End();

    _Plugins.Clear();
    Init();
    }

    public static List<HolographPlugin> GetPlugins()
    {
    return _Plugins;
    }

    static HolographPlugin InitPlugin(string _File)
    {
    FileInfo fileInfo = new FileInfo(_File);
    string fileName = fileInfo.Name.Replace(".dll", "");
    Assembly pAssembly = Assembly.LoadFrom(_File);
    HolographPlugin hP = (HolographPlugin)pAssembly.CreateInstance(fileName);
    hP.Init();
    return hP;
    }

    public static void processAdditionalPacket(string currentPacket, virtualUser User)
    {
    foreach (HolographPlugin hP in _Plugins)
    {
    hP.processAdditionalPacket(currentPacket, User);
    }
    }
    }

    public abstract class HolographPlugin
    {
    #region N


  2. #2
    Account Upgraded | Title Enabled! Abes is offline
    MemberRank
    May 2009 Join Date
    Sesame StreetLocation
    498Posts

    Re: Holograph Emulator Plugins

    Wow.
    Pretty good.

    /EDIT
    First Post! WOO

  3. #3
    Member R4ph431 is offline
    MemberRank
    Jan 2009 Join Date
    51Posts

    Re: Holograph Emulator Plugins

    Good, Igor. Keep coding like that :D

  4. #4
    Account Upgraded | Title Enabled! Habbie is offline
    MemberRank
    Mar 2009 Join Date
    302Posts

    Re: Holograph Emulator Plugins

    Does it restart it or something i don't understand good what this doing?

  5. #5
    Old Habbo Developer AresCJ is offline
    MemberRank
    Jan 2009 Join Date
    USALocation
    1,183Posts

    Re: Holograph Emulator Plugins

    It prevents you from having to restart your emulator when you insert plugin(s) aka (Add-ons), it has it's own Plugin Manager and etc..

  6. #6
    Infraction Banned Swineflu is offline
    MemberRank
    May 2009 Join Date
    AmericaLocation
    770Posts

    Re: Holograph Emulator Plugins

    That is Sweet If u have 50 user online u dont want to restart it thanks

  7. #7
    Proficient Member latest07 is offline
    MemberRank
    Jan 2008 Join Date
    Yorkshire, EnglLocation
    166Posts

    Re: Holograph Emulator Plugins

    Wow this will be good for closed source servers so users can still edit the server in some way shape or form.

  8. #8
    Atomic Developer lab-hotel is offline
    MemberRank
    Apr 2007 Join Date
    261Posts

    Re: Holograph Emulator Plugins

    Thank your for the comments. :)

    _EDIT

    Plugin Example to enable new console search if you don't have:
    PHP Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Holo;

    public class 
    ConsoleSearchPlugin HolographPlugin
    {
        public 
    ConsoleSearchPlugin()
        {
            
    this._Name "Console Search Plugin";
            
    this._Description "Makes the 'Search' function of the console work. Credits to Holo Total Database Pooling";
            
    this._Author "Holo TDbP";
            
    this._Version = new Version(10);
        }

        public 
    override void Init()
        {
            
    Out.WriteLine("Console Search Enabled");
        }

        public 
    override void End()
        {
            
    Out.WriteLine("Console Search Disabled");
        }

        public 
    override void processAdditionalPacket(string currentPacketHolo.Virtual.Users.virtualUser User)
        {
            
    this._User User;
            if (
    currentPacket.Substring(02) == "@i")
            {
                
    Out.WriteLine("User searched '" currentPacket.Substring(4) + "' in the console.");

                
    // Variables 
                //Database dbClient = new Database(true, false, 204); 

                
    string Packet "Fs";
                
    string PacketFriends "";
                
    string PacketOthers "";
                
    string PacketAdd "";
                
    int CountFriends 0;
                
    int CountOthers 0;

                
    // Database 

                
    string[] IDs;
                
    using (DatabaseClient dbClient Eucalypt.dbManager.GetClient())
                {
                    
    string Search currentPacket.Substring(4);
                    
    Search Search.Replace(@"\", "\\").Replace("'", @"\'");
                    dbClient.AddParamWithValue("search", Search);
                    IDs = dataHandling.dColToArray((dbClient.getColumn("SELECT id FROM users WHERE name LIKE '" + Search + "
    %' LIMIT 20 ")));
                }

                // Loop through results 
                for (int i = 0; i < IDs.Length; i++)
                {

                    int thisID = Convert.ToInt32(IDs[i]);
                    bool online = userManager.containsUser(thisID);
                    string onlineStr = online ? "I" : "H";

                    DataRow row;
                    using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                    {
                        row = dbClient.getRow("SELECT name, mission, lastvisit, figure FROM users WHERE id = " + thisID.ToString());
                    }
                    PacketAdd = Encoding.encodeVL64(thisID)
                                 + row[0] + ""
                                 + row[1] + ""
                                 + onlineStr + onlineStr + ""
                                 + onlineStr + (online ? row[3] : "") + ""
                                 + (online ? "" : row[2]) + "";

                    // Friend or not? 
                    if (Messenger.hasFriendship(thisID))
                    {
                        CountFriends += 1;
                        PacketFriends += PacketAdd;
                    }
                    else
                    {
                        CountOthers += 1;
                        PacketOthers += PacketAdd;
                    }


                }

                // Add count headers 
                PacketFriends = Encoding.encodeVL64(CountFriends) + PacketFriends;
                PacketOthers = Encoding.encodeVL64(CountOthers) + PacketOthers;

                // Merge packets 
                Packet += PacketFriends + PacketOthers;

                // Send packets 
                sendData(Packet);
            }
        }




Advertisement