/// <summary> /// The begin host game. /// </summary> /// <param name="game"> /// The game. /// </param> /// <param name="gamename"> /// The gamename. /// </param> public void BeginHostGame(Octgn.DataNew.Entities.Game game, string gamename, string password, string actualgamename, string gameIconUrl, Version sasVersion, bool specators) { var hgr = new HostGameRequest(game.Id, game.Version, gamename, actualgamename, gameIconUrl, password ?? "", sasVersion, specators); //string data = string.Format("{0},:,{1},:,{2},:,{3},:,{4}", game.Id.ToString(), game.Version, gamename, password ?? "",actualgamename); Log.InfoFormat("BeginHostGame {0}", hgr); var m = new Message(this.Config.GameBotUser.JidUser, this.Me.JidUser, MessageType.normal, "", "hostgame"); m.GenerateId(); m.AddChild(hgr); this.xmpp.Send(m); }
public async Task <HostedGameInfo> HostGame(Octgn.DataNew.Entities.Game game, string gamename, string password, string actualgamename, string gameIconUrl, Version sasVersion, bool specators) { var request = new HostGameRequest(game.Id, game.Version, gamename, actualgamename, gameIconUrl, password ?? "", sasVersion, specators); Log.Info($"{request}"); var result = await _client.Request(new Package(_config.GameBotUser.UserName, request)); if (result == null) { throw new InvalidOperationException("Host game failed. No game data returned."); } return((result as Package)?.Contents as HostedGameInfo); }
public void HostGame(HostGameRequest req, User u) { var bport = 21237; if (AppConfig.Instance.Test) bport = 21235; var game = new HostedGame(Ports.NextPort, req.GameGuid, req.GameVersion, req.GameName, req.Name, req.Password, u, false, true,req.RequestId,bport); if (game.StartProcess(true)) { // Try to kill every other game this asshole started before this one. var others = GameListener.Games.Where(x => x.Username.Equals(u.UserName, StringComparison.InvariantCultureIgnoreCase)) .ToArray(); foreach (var g in others) { g.TryKillGame(); } } }
public Guid HostGame(HostGameRequest req, User u) { var bport = AppConfig.Instance.BroadcastPort; var game = new HostedGame(Ports.NextPort, req.GameGuid, req.GameVersion, req.GameName, req.Name, req.Password, u,req.Spectators ,false, true,req.RequestId,bport,req.SasVersion); if (game.StartProcess(true)) { // Try to kill every other game this asshole started before this one. var others = GameListener.Games.Where(x => x.Username.Equals(u.UserName, StringComparison.InvariantCultureIgnoreCase)) .ToArray(); foreach (var g in others) { g.TryKillGame(); } return game.Id; } return Guid.Empty; }
public Guid BeginHostGame(Guid gameid, Version gameVersion, string gamename, string gameIconUrl, string password, string actualgamename, Version sasVersion, bool specators) { var hgr = new HostGameRequest(gameid, gameVersion, gamename, actualgamename, gameIconUrl, password ?? "", sasVersion, specators); Log.InfoFormat("BeginHostGame {0}", hgr); var m = new Message(new Jid(AppConfig.Instance.GameServUsername, AppConfig.Instance.ServerPath, null), this.Xmpp.MyJID, MessageType.normal, "", "hostgame"); m.GenerateId(); m.AddChild(hgr); this.Xmpp.Send(m); return hgr.RequestId; }