private GameServer(Configuration config) : base(config) { RegisterMappings(); CommandManager = new CommandManager(this); CommandManager.Add(new ServerCommand()) .Add(new ReloadCommand()) .Add(new GameCommands()) .Add(new BanCommands()) .Add(new UnbanCommands()) .Add(new UserkickCommand()) //.Add(new UserkickCommand()) .Add(new AdminCommands()) .Add(new NoticeCommand()) .Add(new ClanCommands()) .Add(new InventoryCommands()); PlayerManager = new PlayerManager(); ResourceCache = new ResourceCache(); ChannelManager = new ChannelManager(ResourceCache.GetChannels()); ClubManager = new ClubManager(ResourceCache.GetClubs()); _worker = new ThreadLoop(TimeSpan.FromMilliseconds(100), Worker); _serverlistManager = new ServerlistManager(); }
private GameServer(Configuration config) : base(config) { RegisterMappings(); //Logger.Information("To get sure that u know how to work with this server, i've added this"); //Logger.Information("Remove the lines located in the given file named by this log's prefix"); // //// //Environment.Exit(-1); //// //ServerTime = TimeSpan.Zero; CommandManager = new CommandManager(this); CommandManager.Add(new ServerCommand()) .Add(new ReloadCommand()) .Add(new GameCommands()) .Add(new BanCommands()) .Add(new AdminCommands()) .Add(new NoticeCommand()) .Add(new InventoryCommands()); PlayerManager = new PlayerManager(); ResourceCache = new ResourceCache(); ChannelManager = new ChannelManager(ResourceCache.GetChannels()); ClubManager = new ClubManager(ResourceCache.GetClubs()); _worker = new ThreadLoop(TimeSpan.FromMilliseconds(100), Worker); _serverlistManager = new ServerlistManager(); }
private void button1_Click(object sender, EventArgs e) { ClubManager nuevoClub = new ClubManager(); club nuevo = new club() { nombre = "", descripcion = "" }; nuevoClub.Save(nuevo); }
private void cmdLogon_ServerClick(object sender, System.EventArgs e) { if (ValidateUser(tbUserName.Text, tbUserPass.Text)) { FormsAuthenticationTicket tkt; string cookiestr; HttpCookie ck; string roleLevel = "1"; // set role level to Lowest or Guest if (usr.role.Trim().Substring(0, 4) == "gues") { roleLevel = "1"; } if (usr.role.Trim().Substring(0, 4) == "user") { roleLevel = "2"; } if (usr.role.Trim().Substring(0, 4) == "admi") { roleLevel = "3"; } if (usr.role.Trim().Substring(0, 4) == "mast") { roleLevel = "4"; } tkt = new FormsAuthenticationTicket(1, usr.UserID, DateTime.Now, DateTime.Now.AddMinutes(30), chkPersistCookie.Checked, roleLevel); cookiestr = FormsAuthentication.Encrypt(tkt); ck = new HttpCookie(FormsAuthentication.FormsCookieName, cookiestr); if (chkPersistCookie.Checked) { ck.Expires = tkt.Expiration; } ck.Path = FormsAuthentication.FormsCookiePath; Response.Cookies.Add(ck); Settings cs = new Settings(); cs.ClubID = usr.ClubID; cs.ClubInfo = ClubManager.GetSetting(cs.ClubID); Session["Settings"] = cs; string strRedirect; strRedirect = Request["ReturnUrl"]; if (strRedirect == null) { strRedirect = "default.aspx"; } Response.Redirect(strRedirect, true); } else { // Response.Redirect("logon.aspx", true); lblMsg.Text = "Invalid User ID or Password. Try again."; } }
internal void Init(UserData data) { this.PresentBuyStopwatch = new Stopwatch(); this.PresentBuyStopwatch.Start(); this.FavoriteRooms = data.favouritedRooms; this.InventoryComponent = new InventoryComponent(Id, mClient); this.InventoryComponent.SetActiveState(mClient); this.AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id, mClient, data); this.chatMessageManager = new ChatMessageManager(); this.premiumManager = PremiumManager.LoadPremiumData(Id); this.userclothingManager = new UserClothing(Id); clubManager = new ClubManager(Id, data); sanctionManager = new SanctionManager(Id, data); if (HasFuse("fuse_chat_staff")) { data.friends.Add(EmuSettings.CHAT_USER_ID, StaffChat.MessengerStaff); } this.Messenger = new HabboMessenger(Id, data.friends, data.requests); this.UpdateRooms(); }
private GameServer(Configuration config) : base(config) { RegisterMappings(); CommandManager = new CommandManager(this); CommandManager.Add(new ServerCommand()) .Add(new ReloadCommand()) .Add(new GameCommands()) .Add(new BanCommands()) .Add(new UnbanCommands()) .Add(new UserkickCommand()) .Add(new KickCommand()) .Add(new AllkickCommand()) .Add(new RoomkickCommand()) .Add(new AdminCommands()) .Add(new NoticeCommand()) .Add(new WholeNoticeCommand()) .Add(new ClanCommands()) .Add(new InventoryCommands()) .Add(new SearchCommand()) .Add(new CommandWrapper()) .Add(new HelpCommand()); PlayerManager = new PlayerManager(); ResourceCache = new ResourceCache(); ChannelManager = new ChannelManager(ResourceCache.GetChannels()); ClubManager = new ClubManager(ResourceCache.GetClubs()); _worker = new ThreadLoop(TimeSpan.FromMilliseconds(100), Worker); _worker2 = new ThreadLoop(TimeSpan.FromSeconds(1), Worker2); _workerDelta = new AccurateDelta(TimeSpan.Zero); _worker2Delta = new AccurateDelta(TimeSpan.Zero); _serverlistManager = new ServerlistMgr(); AverageWorkerDelta.Enqueue(0); HighWorkerDelta.TryAdd(0, 0); }
internal void OnDisconnect() { try { if (Disconnected) { return; } Disconnected = true; if (Messenger != null) { Messenger.AppearOffline = true; Messenger.Destroy(); Messenger = null; } if (IsPremium()) { GetPremiumManager().Destroy(); } saveWardrobe(); SaveBadges(); //HabboEnvironment.GetGame().GetMuteManager().RemoveUserMute(Id); var pollParticipation = ""; if (this.PollParticipation.Count > 0) { foreach (UInt32 value in this.PollParticipation) { pollParticipation += value + ";"; } pollParticipation = pollParticipation.Remove(pollParticipation.Length - 1); } var votedRooms = ""; if (this.RatedRooms.Count > 0) { foreach (UInt32 value in this.RatedRooms) { votedRooms += value + ";"; } votedRooms = votedRooms.Remove(votedRooms.Length - 1); } var actrewards = ""; if (this.WiredRewards.Count > 0) { foreach (WiredActReward wrd in this.WiredRewards.Values) { actrewards += wrd.ItemId + "," + wrd.LastUpdate + "," + wrd.ActualRewards + "," + wrd.OriginalInt + ";"; } actrewards = actrewards.Remove(actrewards.Length - 1); } var navilogs = ""; if (this.navigatorLogs.Count > 0) { foreach (NaviLogs navi in this.navigatorLogs.Values) { navilogs += navi.Id + "," + navi.Value1 + "," + navi.Value2 + ";"; } navilogs = navilogs.Remove(navilogs.Length - 1); } var targetedoffers = ""; if (this.TargetedOffers.Count > 0) { foreach (KeyValuePair <uint, uint> k in this.TargetedOffers) { targetedoffers += k.Key + "-" + k.Value + ";"; } targetedoffers = targetedoffers.Remove(targetedoffers.Length - 1); } using (var dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("UPDATE users SET namechanges = '" + NameChanges + "', respect = '" + Respect + "', daily_respect_points = '" + DailyRespectPoints + "', daily_pet_respect_points = '" + DailyPetRespectPoints + "'," + " diamonds = '" + Diamonds + "', machine_last = @machineLast, currentquestid = '" + CurrentQuestId + "', block_trade = '" + ((BlockTrade) ? "1" : "0") + "'," + " block_newfriends = '" + ((HasFriendRequestsDisabled) ? "1" : "0") + "', look = @look, motto = @motto, gender = @gender, last_online = '" + LastOnline.ToString() + "'," + " achievement_points = '" + AchievementPoints + "', home_room = '" + HomeRoom + "', volumenSystem = '" + volumenSystem + "', prefer_old_chat = '" + ((preferOldChat) ? "1" : "0") + "'," + " last_purchase = '" + LastPurchase + "'," + " poll_participation = '" + pollParticipation + "', voted_rooms = '" + votedRooms + "'," + " lastfollowinglogin = '******', ignoreRoomInvitations = '" + ((IgnoreRoomInvitations) ? "1" : "0") + "'," + " citizenship_level = '" + CitizenshipLevel + "', helper_level = '" + HelperLevel + "', actrewards = '" + actrewards + "', dontfocususers = '" + ((DontFocusUser) ? "1" : "0") + "'," + " navilogs = @navilogs, targeted_offers = @targetedoffers, alertasAtivados = '" + ((alertasAtivados) ? "1" : "0") + "', frankJaApareceu = '" + ((frankJaApareceu) ? "1" : "0") + "', FavoriteGroup = '" + FavoriteGroup + "', moedas = '" + Moedas + "', corAtual = @coratual, coresjaTenho = '" + coresjaTenho + "', new_identity = '" + NewIdentity + "', new_bot = '" + NewBot + "', coins_purchased = '" + CoinsPurchased + "' WHERE id = " + Id); dbClient.addParameter("look", Look); dbClient.addParameter("coratual", corAtual); dbClient.addParameter("motto", Motto); dbClient.addParameter("gender", Gender); dbClient.addParameter("machineLast", MachineId); dbClient.addParameter("navilogs", navilogs); dbClient.addParameter("targetedoffers", targetedoffers); dbClient.runQuery(); dbClient.runFastQuery("DELETE FROM users_online WHERE user_id = '" + Id + "'"); } if (this.AlfaServiceEnabled) { if (this.AlfaGuideEnabled) { OtanixEnvironment.GetGame().GetAlfaManager().GetTourManager().RemoveAlfa(this.Id); this.AlfaGuideEnabled = false; } if (this.AlfaHelperEnabled) { Help help = null; if (OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().Helps.ContainsKey(AlfaServiceId)) { help = OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().Helps[AlfaServiceId]; } if (help != null) { if (help.helpState == HelpState.TALKING) { help.helpState = HelpState.FINISHED; } else if (help.helpState == HelpState.SEARCHING_USER) { help.NeedUpdate = true; } } OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().RemoveAlfa(this.Id); this.AlfaHelperEnabled = false; } if (this.AlfaGuardianEnabled) { Bully bully = null; if (OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().Bullies.ContainsKey(AlfaServiceId)) { bully = OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().Bullies[AlfaServiceId]; } if (bully != null) { if (bully.bullyState == BullyState.WAITING_RESPONSE) { bully.bullySolution = BullySolution.EXIT; bully.bullyState = BullyState.FINISHED; } else if (bully.bullyState == BullyState.SEARCHING_USER) { bully.NeedUpdate = true; } } OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().RemoveGuardian(this.Id); this.AlfaGuardianEnabled = false; } } if (InRoom && CurrentRoom != null && CurrentRoom.GetRoomUserManager() != null) { CurrentRoom.GetRoomUserManager().RemoveUserFromRoom(mClient, false, false, false); } if (AvatarEffectsInventoryComponent != null) { AvatarEffectsInventoryComponent.Dispose(); AvatarEffectsInventoryComponent = null; } if (InventoryComponent != null) { InventoryComponent.SetIdleState(); InventoryComponent.RunDBUpdate(); InventoryComponent.Destroy(); InventoryComponent = null; } if (BadgeComponent != null) { BadgeComponentLoaded = false; BadgeComponent.Destroy(); BadgeComponent = null; } if (RelationshipComposer != null) { RelationsLoaded = false; RelationshipComposer.Destroy(); RelationshipComposer = null; } if (Achievements != null && Achievements.Count > 0) { AchievementsLoaded = false; Achievements.Clear(); Achievements = null; } if (quests != null && quests.Count > 0) { QuestsLoaded = false; quests.Clear(); quests = null; } if (wardrobes != null && wardrobes.Count > 0) { WardrobeLoaded = false; wardrobes.Clear(); wardrobes = null; } if (clubManager != null) { clubManager.Clear(); clubManager = null; } if (sanctionManager != null) { sanctionManager.Clear(); sanctionManager = null; } } catch (Exception e) { Logging.LogCriticalException("Disconnecting user " + e); } finally { OtanixEnvironment.GetGame().GetClientManager().UnregisterClient(Id, Username); Logging.WriteLine(Username + " has logged out."); } }
private static Driver CreateDriver(YamlMappingNode entity, Simulation sim, byte carIdx, int userId, BitmapSource suit = null, ICar car = null) { var driver = new Driver { Name = entity.GetString("UserName"), Id = userId, CarIdx = carIdx, Car = car ?? CreateCar(entity, sim), IsDriving = true, Initials = entity.GetString("Initials"), ShortName = ParseShortName(entity.GetString("AbbrevName")), Club = ClubManager.GetClub(entity.GetString("ClubName")), LastName = entity.GetString("AbbrevName").Split(',').FirstOrDefault()?.Trim() }; driver.DriversInt.Add(driver); driver.CurrentDriver = driver; // TODO: Results. // TODO: Suit. // TODO: Helmet. var suitDesign = entity.GetString("SuitDesignStr").Split(',', ';').ToArray(); if (suitDesign.Length == 4) { // ReSharper disable PossibleNullReferenceException driver.SuitDesignNumber = int.Parse(suitDesign[0]); driver.SuitColor1 = (Color)ColorConverter.ConvertFromString($"#{suitDesign[1]}"); driver.SuitColor2 = (Color)ColorConverter.ConvertFromString($"#{suitDesign[2]}"); driver.SuitColor2 = (Color)ColorConverter.ConvertFromString($"#{suitDesign[3]}"); // ReSharper restore PossibleNullReferenceException } var helmetDesign = entity.GetString("HelmetDesignStr").Split(',', ';').ToArray(); if (helmetDesign.Length == 4) { // ReSharper disable PossibleNullReferenceException driver.HelmetDesignNumber = int.Parse(helmetDesign[0]); driver.HelmetColor1 = (Color)ColorConverter.ConvertFromString($"#{helmetDesign[1]}"); driver.HelmetColor2 = (Color)ColorConverter.ConvertFromString($"#{helmetDesign[2]}"); driver.HelmetColor2 = (Color)ColorConverter.ConvertFromString($"#{helmetDesign[3]}"); // ReSharper restore PossibleNullReferenceException } object convertFromString = null; try { var colorString = "#FF" + entity.GetString("LicColor").Substring(2); convertFromString = ColorConverter.ConvertFromString(colorString); } catch { // ignore } convertFromString = convertFromString ?? Colors.White; driver.License = new License(entity.GetInt("LicLevel"), entity.GetInt("LicSubLevel"), (Color)convertFromString, entity.GetInt("IRating")); if (string.IsNullOrWhiteSpace(driver.LastName)) { driver.ThreeLetterCode = string.Empty; } else if (driver.LastName.Length < 2) { driver.ThreeLetterCode = (driver.Initials + driver.LastName[0]).ToUpper(); } else { driver.ThreeLetterCode = (driver.Initials + driver.LastName[1]).ToUpper(); } driver.Division = entity.GetString("DivisionName"); return(driver); }