Example #1
0
 public void ReloadProcessors()
 {
     lock (ProcessorsLock)
     {
         AuthProcessor      = Reload(AuthProcessor);
         LobbyProcessor     = Reload(LobbyProcessor);
         CharacterProcessor = Reload(CharacterProcessor);
         WorldProcessor     = Reload(WorldProcessor);
     }
 }
Example #2
0
        private void reloadScriptsCallback(Command command)
        {
            if (scriptController == null)
            {
                return;
            }

            scriptController.Scripts.ForEach(t => t.Unload());
            scriptController.LoadScripts();
            scriptController.Scripts.ForEach(t => t.Load());

            if (MainContext.IsPlayerIngame)
            {
                WorldProcessor.CreateWorldNotice("[ScriptController] Scripts have been reloaded.");
            }
        }
Example #3
0
        private void GameProxy_GameToServerPacket(object sender, BDPacket e)
        {
            foreach (Script plugin in scriptController.Scripts)
            {
                e = plugin.Game_CMSG(e);
            }

            if (e.PacketId == 0xCEE)
            {
                MainContext.IsPlayerIngame = true;
            }

            if (e.PacketId == 0xEA8)
            {
                var    messageLen = e.GetUShort(11) - 2;
                string message    = e.GetString(Encoding.Unicode, messageLen, 13);

                if (message.StartsWith("/"))
                {
                    string commandName = message.Replace("/", "").Split(' ')[0];

                    List <Command> list = new List <Command>(CommandProcessor.GetCommandsByName(commandName));
                    if (list.Count > 0)
                    {
                        for (int i = 0; i < list.Count; i++)
                        {
                            var      command    = list[i];
                            string[] parameters = message.Replace("/", "").Split(' ');
                            command.Parameters.Clear();
                            for (int j = 1; j < parameters.Length; j++)
                            {
                                command.Parameters.Add(parameters[j]);
                            }
                            command.Callback(command);
                        }
                    }
                    else
                    {
                        WorldProcessor.CreateWorldNotice("[CommandProcessor] Command does not exist.");
                    }
                    return;
                }
            }
            MainContext.gameProxy.SendToServer(e);
        }
Example #4
0
	static void CreateInstance() {
		// Lets look to see if we can find on in the scene
		_instance = FindObjectOfType(typeof(WorldProcessor)) as WorldProcessor;
		
		// If we failed to find one, create a new one
		if (null == _instance) {
			GameObject go = new GameObject("WorldProcessor");
			_instance = go.AddComponent<WorldProcessor>();
		}
		
		_instance.Init();
	}
Example #5
0
	void Awake() {
		// Singleton safety
		if (null != _instance) {
			if (_instance != this) {
				Destroy(gameObject);
				return;	
			}
		} else {
			_instance = this;
			Init();	
		}
	}
Example #6
0
 /// <summary>
 /// Creates an ingame Notice message.
 /// </summary>
 /// <param name="message">The message to be shown ingame.</param>
 public void CreateWorldNotice(string message)
 {
     WorldProcessor.CreateWorldNotice(message);
 }