/// <summary> /// Overload: Gets the next random entry. Refills or /// </summary> /// <param name="mode">The mode to determine how to behave, when copied list is empty</param> /// <returns>Returns next entry or default(T), depending on mode</returns> public T DrawNext(LotteryMode mode) { if (IsEmtpy()) { switch (mode) { case LotteryMode.RefillOnEmpty: CopyEntries(); break; case LotteryMode.RemoveOnEmpty: LotteryManager <T> .Remove(Collection); return(default(T)); case LotteryMode.None: return(default(T)); } } var id = Random.Range(0, CollectionCopy.Count); var temp = CollectionCopy[id]; CollectionCopy.Remove(CollectionCopy[id]); return(temp); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { #region Variables int Cost = LotteryManager.Cost; int LotteryRoom = Convert.ToInt32(RoleplayData.GetData("bank", "room")); //bank = lottery #endregion #region Conditions if (Room.Id != LotteryRoom) { Session.SendWhisper("Você deve estar na loja da loteria para comprar um bilhete!", 1); return; } if (Session.GetHabbo().Credits < Cost) { Session.SendWhisper("Você não tem dinheiro suficiente para comprar um bilhete!", 1); return; } if (LotteryManager.LotteryTickets.ContainsKey(Session.GetHabbo().Id)) { Session.SendWhisper("Você já comprou um bilhete para esta loteria!", 1); return; } if (LotteryManager.LotteryFull()) { Session.SendWhisper("Desculpe, mas não há tickets para venda!", 1); return; } #endregion #region Execute int TicketId = LotteryManager.LotteryTickets.Count + 1; LotteryManager.LotteryTickets.TryAdd(Session.GetHabbo().Id, TicketId); Session.Shout("*Compra um bilhete de loteria da loja*", 4); Session.GetHabbo().Credits -= Cost; Session.GetHabbo().UpdateCreditsBalance(); using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO `rp_lottery` VALUES (@user, @ticket)"); dbClient.AddParameter("user", Session.GetHabbo().Id); dbClient.AddParameter("ticket", TicketId); dbClient.RunQuery(); } #endregion }
/// <summary> /// Removes all added collections from the dictionary. /// </summary> public static void Clear <T> (this IList <T> collection) { LotteryManager <T> .Clear(); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); lotteryID = TranslateUtils.ToInt(GetQueryString("lotteryID")); if (!IsPostBack) { var pageTitle = lotteryID > 0 ? "编辑摇摇乐" : "添加摇摇乐"; BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_YaoYao, pageTitle, AppManager.WeiXin.Permission.WebSite.YaoYao); ltlPageTitle.Text = pageTitle; ltlImageUrl.Text = $@"<img id=""preview_imageUrl"" src=""{LotteryManager.GetImageUrl(PublishmentSystemInfo, ELotteryType.YaoYao, string.Empty)}"" width=""370"" align=""middle"" />"; ltlContentImageUrl.Text = $@"<img id=""preview_contentImageUrl"" src=""{LotteryManager.GetContentImageUrl( PublishmentSystemInfo, ELotteryType.YaoYao, string.Empty)}"" width=""370"" align=""middle"" />"; ltlAwardImageUrl.Text = $@"<img id=""preview_awardImageUrl"" src=""{LotteryManager.GetAwardImageUrl(PublishmentSystemInfo, ELotteryType.YaoYao, string.Empty)}"" width=""370"" align=""middle"" />"; ltlEndImageUrl.Text = $@"<img id=""preview_endImageUrl"" src=""{LotteryManager.GetEndImageUrl(PublishmentSystemInfo, ELotteryType.YaoYao, string.Empty)}"" width=""370"" align=""middle"" />"; if (lotteryID == 0) { ltlAwardItems.Text = "itemController.itemCount = 2;itemController.items = [{}, {}];"; dtbEndDate.DateTime = DateTime.Now.AddMonths(1); } else { var lotteryInfo = DataProviderWX.LotteryDAO.GetLotteryInfo(lotteryID); tbKeywords.Text = DataProviderWX.KeywordDAO.GetKeywords(lotteryInfo.KeywordID); cbIsEnabled.Checked = !lotteryInfo.IsDisabled; dtbStartDate.DateTime = lotteryInfo.StartDate; dtbEndDate.DateTime = lotteryInfo.EndDate; tbTitle.Text = lotteryInfo.Title; if (!string.IsNullOrEmpty(lotteryInfo.ImageUrl)) { ltlImageUrl.Text = $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, lotteryInfo.ImageUrl)}"" width=""370"" align=""middle"" />"; } tbSummary.Text = lotteryInfo.Summary; if (!string.IsNullOrEmpty(lotteryInfo.ContentImageUrl)) { ltlContentImageUrl.Text = $@"<img id=""preview_contentImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, lotteryInfo.ContentImageUrl)}"" width=""370"" align=""middle"" />"; } tbContentUsage.Text = lotteryInfo.ContentUsage; tbAwardUsage.Text = lotteryInfo.AwardUsage; cbIsAwardTotalNum.Checked = lotteryInfo.IsAwardTotalNum; tbAwardMaxCount.Text = lotteryInfo.AwardMaxCount.ToString(); tbAwardMaxDailyCount.Text = lotteryInfo.AwardMaxDailyCount.ToString(); tbAwardCode.Text = lotteryInfo.AwardCode; cbIsFormRealName.Checked = lotteryInfo.IsFormRealName; tbFormRealNameTitle.Text = lotteryInfo.FormRealNameTitle; cbIsFormMobile.Checked = lotteryInfo.IsFormMobile; tbFormMobileTitle.Text = lotteryInfo.FormMobileTitle; cbIsFormEmail.Checked = lotteryInfo.IsFormEmail; tbFormEmailTitle.Text = lotteryInfo.FormEmailTitle; cbIsFormAddress.Checked = lotteryInfo.IsFormAddress; tbFormAddressTitle.Text = lotteryInfo.FormAddressTitle; if (!string.IsNullOrEmpty(lotteryInfo.AwardImageUrl)) { ltlAwardImageUrl.Text = $@"<img id=""preview_awardImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, lotteryInfo.AwardImageUrl)}"" width=""370"" align=""middle"" />"; } var awardInfoList = DataProviderWX.LotteryAwardDAO.GetLotteryAwardInfoList(PublishmentSystemID, lotteryID); var itemBuilder = new StringBuilder(); foreach (var awardInfo in awardInfoList) { itemBuilder.AppendFormat(@"{{id: '{0}', awardName: '{1}', title: '{2}', totalNum: '{3}', probability: '{4}'}},", awardInfo.ID, awardInfo.AwardName, awardInfo.Title, awardInfo.TotalNum, awardInfo.Probability); } if (itemBuilder.Length > 0) { itemBuilder.Length--; } ltlAwardItems.Text = $@" itemController.itemCount = {awardInfoList.Count};itemController.items = [{itemBuilder.ToString()}];"; tbEndTitle.Text = lotteryInfo.EndTitle; tbEndSummary.Text = lotteryInfo.EndSummary; if (!string.IsNullOrEmpty(lotteryInfo.EndImageUrl)) { ltlEndImageUrl.Text = $@"<img id=""preview_endImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, lotteryInfo.EndImageUrl)}"" width=""370"" align=""middle"" />"; } imageUrl.Value = lotteryInfo.ImageUrl; contentImageUrl.Value = lotteryInfo.ContentImageUrl; awardImageUrl.Value = lotteryInfo.AwardImageUrl; endImageUrl.Value = lotteryInfo.EndImageUrl; } btnReturn.Attributes.Add("onclick", $@"location.href=""{BackgroundLottery.GetRedirectUrl(PublishmentSystemID, ELotteryType.YaoYao)}"";return false"); } }
private IResponseMessageBase GetResponseMessage(KeywordInfo keywordInfo, string keyword) { try { if (keywordInfo != null && !keywordInfo.IsDisabled) { if (keywordInfo.KeywordType == EKeywordType.Text) { DataProviderWX.CountDAO.AddCount(publishmentSystemInfo.PublishmentSystemId, ECountType.RequestText); var responseMessage = CreateResponseMessage <ResponseMessageText>(); responseMessage.Content = keywordInfo.Reply; return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.News) { DataProviderWX.CountDAO.AddCount(publishmentSystemInfo.PublishmentSystemId, ECountType.RequestNews); var responseMessage = CreateResponseMessage <ResponseMessageNews>(); foreach (var resourceInfo in DataProviderWX.KeywordResourceDAO.GetResourceInfoList(keywordInfo.KeywordID)) { var imageUrl = PageUtils.AddProtocolToUrl(PageUtility.ParseNavigationUrl(publishmentSystemInfo, resourceInfo.ImageUrl)); var pageUrl = string.Empty; if (resourceInfo.ResourceType == EResourceType.Site) { if (resourceInfo.ChannelID > 0 && resourceInfo.ContentID > 0) { pageUrl = PageUtilityWX.GetContentUrl(publishmentSystemInfo, resourceInfo.ChannelID, resourceInfo.ContentID, false); } else if (resourceInfo.ChannelID > 0) { pageUrl = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, resourceInfo.ChannelID); } else { pageUrl = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, publishmentSystemInfo.PublishmentSystemId); } } else if (resourceInfo.ResourceType == EResourceType.Content) { pageUrl = PageUtilityWX.GetWeiXinFileUrl(publishmentSystemInfo, resourceInfo.KeywordID, resourceInfo.ResourceID); } else if (resourceInfo.ResourceType == EResourceType.Url) { pageUrl = resourceInfo.NavigationUrl; } responseMessage.Articles.Add(new Article() { Title = resourceInfo.Title, Description = MPUtils.GetSummary(resourceInfo.Summary, resourceInfo.Content), PicUrl = imageUrl, Url = pageUrl }); } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Coupon) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = CouponManager.Trigger(keywordInfo, keyword, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Vote) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = VoteManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Message) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = MessageManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Appointment) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = AppointmentManager.Trigger(keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Conference) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = ConferenceManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Map) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = MapManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.View360) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = View360Manager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Album) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = AlbumManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Scratch) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.Scratch, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.BigWheel) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.BigWheel, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.GoldEgg) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.GoldEgg, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Flap) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.Flap, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.YaoYao) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.YaoYao, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Search) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = SearchManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Store) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = StoreManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Collect) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = CollectManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Card) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = CardManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } } } catch (Exception ex) { LogUtils.AddLog(string.Empty, "Gexia Error", ex.StackTrace); } return(null); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemId"); _lotteryId = Body.GetQueryInt("lotteryID"); if (!IsPostBack) { var pageTitle = _lotteryId > 0 ? "编辑大转盘" : "添加大转盘"; BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdBigWheel, pageTitle, AppManager.WeiXin.Permission.WebSite.BigWheel); LtlPageTitle.Text = pageTitle; LtlImageUrl.Text = $@"<img id=""preview_imageUrl"" src=""{LotteryManager.GetImageUrl(PublishmentSystemInfo, ELotteryType.BigWheel, string.Empty)}"" width=""370"" align=""middle"" />"; LtlContentImageUrl.Text = $@"<img id=""preview_contentImageUrl"" src=""{LotteryManager.GetContentImageUrl( PublishmentSystemInfo, ELotteryType.BigWheel, string.Empty)}"" width=""370"" align=""middle"" />"; LtlContentAwardImageUrl.Text = $@"<img id=""preview_contentAwardImageUrl"" src=""{LotteryManager.GetContentAwardImageUrl( PublishmentSystemInfo, ELotteryType.BigWheel, string.Empty, 0)}"" width=""370"" align=""middle"" />"; LtlAwardImageUrl.Text = $@"<img id=""preview_awardImageUrl"" src=""{LotteryManager.GetAwardImageUrl(PublishmentSystemInfo, ELotteryType.BigWheel, string.Empty)}"" width=""370"" align=""middle"" />"; LtlEndImageUrl.Text = $@"<img id=""preview_endImageUrl"" src=""{LotteryManager.GetEndImageUrl(PublishmentSystemInfo, ELotteryType.BigWheel, string.Empty)}"" width=""370"" align=""middle"" />"; if (_lotteryId == 0) { LtlAwardItems.Text = "itemController.itemCount = 2;itemController.items = [{}, {}];"; DtbEndDate.DateTime = DateTime.Now.AddMonths(1); } else { var lotteryInfo = DataProviderWx.LotteryDao.GetLotteryInfo(_lotteryId); TbKeywords.Text = DataProviderWx.KeywordDao.GetKeywords(lotteryInfo.KeywordId); CbIsEnabled.Checked = !lotteryInfo.IsDisabled; DtbStartDate.DateTime = lotteryInfo.StartDate; DtbEndDate.DateTime = lotteryInfo.EndDate; TbTitle.Text = lotteryInfo.Title; if (!string.IsNullOrEmpty(lotteryInfo.ImageUrl)) { LtlImageUrl.Text = $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, lotteryInfo.ImageUrl)}"" width=""370"" align=""middle"" />"; } TbSummary.Text = lotteryInfo.Summary; if (!string.IsNullOrEmpty(lotteryInfo.ContentImageUrl)) { LtlContentImageUrl.Text = $@"<img id=""preview_contentImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, lotteryInfo.ContentImageUrl)}"" width=""370"" align=""middle"" />"; } TbContentUsage.Text = lotteryInfo.ContentUsage; TbAwardUsage.Text = lotteryInfo.AwardUsage; CbIsAwardTotalNum.Checked = lotteryInfo.IsAwardTotalNum; TbAwardMaxCount.Text = lotteryInfo.AwardMaxCount.ToString(); TbAwardMaxDailyCount.Text = lotteryInfo.AwardMaxDailyCount.ToString(); TbAwardCode.Text = lotteryInfo.AwardCode; CbIsFormRealName.Checked = lotteryInfo.IsFormRealName; TbFormRealNameTitle.Text = lotteryInfo.FormRealNameTitle; CbIsFormMobile.Checked = lotteryInfo.IsFormMobile; TbFormMobileTitle.Text = lotteryInfo.FormMobileTitle; CbIsFormEmail.Checked = lotteryInfo.IsFormEmail; TbFormEmailTitle.Text = lotteryInfo.FormEmailTitle; CbIsFormAddress.Checked = lotteryInfo.IsFormAddress; TbFormAddressTitle.Text = lotteryInfo.FormAddressTitle; if (!string.IsNullOrEmpty(lotteryInfo.ContentAwardImageUrl)) { LtlContentAwardImageUrl.Text = $@"<img id=""preview_contentAwardImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, lotteryInfo.ContentAwardImageUrl)}"" width=""370"" align=""middle"" />"; } if (!string.IsNullOrEmpty(lotteryInfo.AwardImageUrl)) { LtlAwardImageUrl.Text = $@"<img id=""preview_awardImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, lotteryInfo.AwardImageUrl)}"" width=""370"" align=""middle"" />"; } var awardInfoList = DataProviderWx.LotteryAwardDao.GetLotteryAwardInfoList(PublishmentSystemId, _lotteryId); var itemBuilder = new StringBuilder(); foreach (var awardInfo in awardInfoList) { itemBuilder.AppendFormat(@"{{id: '{0}', awardName: '{1}', title: '{2}', totalNum: '{3}', probability: '{4}'}},", awardInfo.Id, awardInfo.AwardName, awardInfo.Title, awardInfo.TotalNum, awardInfo.Probability); } if (itemBuilder.Length > 0) { itemBuilder.Length--; } LtlAwardItems.Text = $@" itemController.itemCount = {awardInfoList.Count};itemController.items = [{itemBuilder}];"; TbEndTitle.Text = lotteryInfo.EndTitle; TbEndSummary.Text = lotteryInfo.EndSummary; if (!string.IsNullOrEmpty(lotteryInfo.EndImageUrl)) { LtlEndImageUrl.Text = $@"<img id=""preview_endImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, lotteryInfo.EndImageUrl)}"" width=""370"" align=""middle"" />"; } ImageUrl.Value = lotteryInfo.ImageUrl; ContentImageUrl.Value = lotteryInfo.ContentImageUrl; ContentAwardImageUrl.Value = lotteryInfo.ContentAwardImageUrl; AwardImageUrl.Value = lotteryInfo.AwardImageUrl; EndImageUrl.Value = lotteryInfo.EndImageUrl; } BtnReturn.Attributes.Add("onclick", $@"location.href=""{PageLottery.GetRedirectUrl(PublishmentSystemId, ELotteryType.BigWheel)}"";return false"); } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Você deve incluir uma coisa para atualizar, e.x. :atualizar catalogo", 1); return; } string UpdateVariable = Params[1]; switch (UpdateVariable.ToLower()) { case "cata": case "catalog": case "catalogue": case "catalogo": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_catalog")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_catalog'.", 1); break; } PlusEnvironment.GetGame().GetCatalog().Init(PlusEnvironment.GetGame().GetItemManager()); PlusEnvironment.GetGame().GetClientManager().SendMessage(new CatalogUpdatedComposer()); Session.SendWhisper("Catálogo atualizado com sucesso.", 1); break; } case "items": case "furni": case "furniture": case "mobis": case "mobi": case "mobilias": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_furni")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_furni'.", 1); break; } PlusEnvironment.GetGame().GetItemManager().Init(); Session.SendWhisper("Itens/Mobis atualizados com sucesso.", 1); break; } case "models": case "modelos": case "model": case "quartos": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_models")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_models'.", 1); break; } PlusEnvironment.GetGame().GetRoomManager().LoadModels(); Session.SendWhisper("Modelos de quartos atualizados com sucesso.", 1); break; } case "promotions": case "promocoes": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_promotions")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_promotions'.", 1); break; } PlusEnvironment.GetGame().GetLandingManager().LoadPromotions(); Session.SendWhisper("Landing view promotions successfully updated.", 1); break; } case "youtube": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_youtube")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_youtube'", 1); break; } PlusEnvironment.GetGame().GetTelevisionManager().Init(); Session.SendWhisper("A lista de televisões do Youtube foi atualizada com sucesso. ", 1); break; } case "filter": case "filtro": case "filtros": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_filter")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_filter'", 1); break; } PlusEnvironment.GetGame().GetChatManager().GetFilter().Init(); Session.SendWhisper("Definições de filtro atualizadas com sucesso.", 1); break; } case "navigator": case "navegador": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_navigator")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_navigator'.", 1); break; } PlusEnvironment.GetGame().GetNavigator().Init(); Session.SendWhisper("Itens do navegador atualizados com sucesso.", 1); break; } case "ranks": case "rights": case "permissions": case "cargos": case "permissao": case "permissoes": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_permissions")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_rights'.", 1); break; } PlusEnvironment.GetGame().GetPermissionManager().Init(); foreach (GameClient Client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList()) { if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().GetPermissions() == null) { continue; } Client.GetHabbo().GetPermissions().Init(Client.GetHabbo()); } Session.SendWhisper("Definições de Cargo atualizadas com sucesso.", 1); break; } case "config": case "settings": case "configuracoes": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_configuration")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_configuration'.", 1); break; } PlusEnvironment.ConfigData = new ConfigData(); Session.SendWhisper("Configuração do servidor atualizada com sucesso.", 1); break; } case "bans": case "ban": case "banimentos": case "banidos": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_bans")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_bans'.", 1); break; } PlusEnvironment.GetGame().GetModerationManager().ReCacheBans(); Session.SendWhisper("A lista de banidos foi atualizada com sucesso.", 1); break; } case "quests": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_quests")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_quests'.", 1); break; } PlusEnvironment.GetGame().GetQuestManager().Init(); Session.SendWhisper("Definições de Tarefas atualizadas com êxito.", 1); break; } case "achievements": case "conquistas": case "conquista": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_achievements")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_achievements'.", 1); break; } PlusEnvironment.GetGame().GetAchievementManager().LoadAchievements(); Session.SendWhisper("Definições de conquistas atualizadas com êxito.", 1); break; } case "clothing": case "visuais": case "roupas": case "visual": case "roupa": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_clothing")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_clothing'.", 1); break; } PlusEnvironment.GetGame().GetCatalog().GetClothingManager().Init(); Session.SendWhisper("Mobiliário de vestuário e preços recarregados.", 1); break; } case "moderation": case "moderacao": case "mods": case "moderadores": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_moderation")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_moderation'.", 1); break; } PlusEnvironment.GetGame().GetModerationManager().Init(); PlusEnvironment.GetGame().GetClientManager().ModAlert("As predefinições de moderação foram atualizadas. Recarregue o cliente para ver as novas predefinições."); Session.SendWhisper("Configuração de moderação atualizada com sucesso.", 1); break; } case "tickets": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_tickets")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_tickets'.", 1); break; } if (PlusEnvironment.GetGame().GetModerationTool().Tickets.Count > 0) { PlusEnvironment.GetGame().GetModerationTool().Tickets.Clear(); } PlusEnvironment.GetGame().GetClientManager().ModAlert("Os ingressos foram atualizados. Recarregue o cliente."); Session.SendWhisper("Os ingressos foram atualizados com sucesso.", 1); break; } case "vouchers": case "brindes": case "codigos": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_vouchers")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_vouchers'.", 1); break; } PlusEnvironment.GetGame().GetCatalog().GetVoucherManager().Init(); Session.SendWhisper("Vouchers/Códigos brinde atualizado com sucesso.", 1); break; } case "polls": case "perguntas": case "quiz": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_polls")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_polls'.", 1); break; } int PollLoaded; PlusEnvironment.GetGame().GetPollManager().Init(out PollLoaded); Session.SendWhisper("Polls successfully updated.", 1); break; } case "gamecenter": case "centrodejogos": case "cjogos": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_game_center")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_game_center'.", 1); break; } PlusEnvironment.GetGame().GetGameDataManager().Init(); Session.SendWhisper("Cache do Centro de Jogos atualizado com sucesso.", 1); break; } case "pet_locale": case "lpet": case "petl": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_pet_locale")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_pet_locale'.", 1); break; } PlusEnvironment.GetGame().GetChatManager().GetPetLocale().Init(); Session.SendWhisper("Pet locale cache successfully updated.", 1); break; } case "locale": case "local": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_locale")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_locale'.", 1); break; } PlusEnvironment.GetGame().GetLanguageLocale().Init(); Session.SendWhisper("Local cache atualizado com sucesso.", 1); break; } case "mutant": case "mutante": case "mutantes": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_anti_mutant")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_anti_mutant'.", 1); break; } PlusEnvironment.GetGame().GetAntiMutant().Init(); Session.SendWhisper("Anti mutante recarregado com sucesso.", 1); break; } case "bots": case "bot": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_bots")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_bots'.", 1); break; } PlusEnvironment.GetGame().GetBotManager().Init(); Session.SendWhisper("O gerenciador de Bots foi recarregado com sucesso", 1); break; } case "bots_speech": case "bots speech": case "speech": case "speeches": case "response": case "responses": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_bots")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_bots'", 1); break; } RoleplayBotManager.FetchCachedSpeeches(); Session.SendWhisper("Bots speech and responses successfully reloaded", 1); break; } case "rewards": case "premios": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_rewards")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_rewards'.", 1); break; } PlusEnvironment.GetGame().GetRewardManager().Reload(); Session.SendWhisper("O Gerenciador de recompensas foi recarregado com sucesso.", 1); break; } case "chat_styles": case "echats": case "estilos": case "estilo": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_chat_styles")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_chat_styles'.", 1); break; } PlusEnvironment.GetGame().GetChatManager().GetChatStyles().Init(); Session.SendWhisper("Estilos de bate-papo recarregados com sucesso.", 1); break; } case "badges": case "badge_definitions": case "emblemas": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_badge_definitions")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_badge_definitions'.", 1); break; } PlusEnvironment.GetGame().GetBadgeManager().Init(); Session.SendWhisper("Definições de emblemas recarregadas com sucesso.", 1); break; } case "rpdata": case "roleplaydata": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_roleplay_data")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_roleplaydata'.", 1); break; } RoleplayData.Initialize(); RoleplayManager.UpdateRPData(); Session.SendWhisper("Dados do Roleplay recarregados com sucesso.", 1); break; } case "blacklist": case "listanegra": case "ln": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_blacklist")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_blacklist'.", 1); break; } BlackListManager.Initialize(); Session.SendWhisper("Lista negra recarregada com sucesso.", 1); break; } case "farming": case "agricultura": case "agricolas": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_farming")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_farming'.", 1); break; } FarmingManager.Initialize(); Session.SendWhisper("Artigos agrícolas recarregados com sucesso.", 1); break; } case "events": case "games": case "jogos": case "eventos": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_events")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_events'.", 1); break; } RoleplayGameManager.Initialize(); Session.SendWhisper("Eventos recarregados com sucesso.", 1); break; } case "corps": case "jobs": case "corporations": case "gangs": case "gangues": case "empregos": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_jobs")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_jobs'.", 1); break; } PlusEnvironment.GetGame().GetGroupManager().Initialize(); Session.SendWhisper("Trabalhos e Gangues recarregados com sucesso.", 1); break; } case "turfs": case "turfcaptures": case "gangcaptures": case "territorio": case "territorios": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_turfs")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_turfs'.", 1); break; } TurfManager.Initialize(); Session.SendWhisper("Territórios e Zona de Captura recarregados com sucesso.", 1); break; } case "weapons": case "guns": case "armas": case "arma": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_weapons")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_weapons'.", 1); break; } WeaponManager.Initialize(); #region Refresh User Weapons lock (PlusEnvironment.GetGame().GetClientManager().GetClients) { foreach (GameClient Client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList()) { if (Client == null || Client.GetHabbo() == null || Client.GetRoleplay() == null) { continue; } if (Client.GetRoleplay().EquippedWeapon == null) { continue; } Client.GetRoleplay().EquippedWeapon = null; Client.GetRoleplay().OwnedWeapons = null; Client.GetRoleplay().OwnedWeapons = Client.GetRoleplay().LoadAndReturnWeapons(); Client.SendWhisper("Um administrador atualizou as armas, sua arma foi retirada, equipe de novo!", 1); } } #endregion Session.SendWhisper("Armas recarregadas com sucesso.", 1); break; } case "food": case "drinks": case "bebidas": case "bebida": case "alimentos": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_food")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_food'.", 1); break; } FoodManager.Initialize(); Session.SendWhisper("Alimentos e bebidas recarregados com sucesso.", 1); break; } case "houses": case "house": case "casas": case "casa": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_houses")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_houses'.", 1); break; } PlusEnvironment.GetGame().GetHouseManager().Init(); Session.SendWhisper("Casas recarregadas com sucesso.", 1); break; } case "crafting": case "construir": case "construcao": case "craft": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_crafting")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_crafting'.", 1); break; } CraftingManager.Initialize(); Session.SendWhisper("Áreas de construção recarregadas com sucesso..", 1); break; } case "lottery": case "loteria": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_lottery")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_lottery'.", 1); break; } LotteryManager.Initialize(); Session.SendWhisper("Loteria recarregados com sucesso.", 1); break; } case "todo": case "tarefas": case "tarefa": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_todo")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_todo'.", 1); break; } ToDoManager.Initialize(); Session.SendWhisper("Lista de Tarefas recarregada com sucesso.", 1); break; } case "bounty": case "bl": case "bounties": case "recompensa": case "recompensas": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_bounty")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_bounty'.", 1); break; } BountyManager.Initialize(); Session.SendWhisper("Lista de recompensas recarregada com sucesso.", 1); break; } case "court": case "jury": case "juiz": case "politica": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_court")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_court'.", 1); break; } RoleplayManager.CourtVoteEnabled = false; RoleplayManager.InnocentVotes = 0; RoleplayManager.GuiltyVotes = 0; RoleplayManager.CourtJuryTime = 0; RoleplayManager.CourtTrialIsStarting = false; RoleplayManager.CourtTrialStarted = false; RoleplayManager.Defendant = null; RoleplayManager.InvitedUsersToJuryDuty.Clear(); Session.SendWhisper("Juiz atualizado com sucesso.", 1); break; } case "chat": case "chats": case "chatroom": case "chatrooms": case "batepapos": case "batepapo": case "whatsapps": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_websocket_chat")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_websocket_chat'.", 1); break; } HabboRoleplay.Web.Util.ChatRoom.WebSocketChatManager.Initialiaze(); Session.SendWhisper("Salas de chat atualizadas com sucesso.", 1); break; } case "gambling": case "texash": case "texas": case "texasholdem": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_gambling")) { Session.SendWhisper("Opa, você não tem permissão em 'command_update_gambling'.", 1); break; } TexasHoldEmManager.Initialize(); Session.SendWhisper("Jogos do Texas Holdem atualizados com sucesso.", 1); break; } default: Session.SendWhisper("'" + UpdateVariable + "' não é uma coisa válida para recarregar.", 1); break; } }
public Game() { this._packetManager = new PacketManager(); this._clientManager = new GameClientManager(); this._modManager = new ModerationManager(); this._moderationTool = new ModerationTool(); this._itemDataManager = new ItemDataManager(); this._itemDataManager.Init(); this._catalogManager = new CatalogManager(); this._catalogManager.Init(this._itemDataManager); this._televisionManager = new TelevisionManager(); this._navigatorManager = new NavigatorManager(); this._roomManager = new RoomManager(); this._chatManager = new ChatManager(); this._questManager = new QuestManager(); this._achievementManager = new AchievementManager(); this._talentTrackManager = new TalentTrackManager(); this._landingViewManager = new LandingViewManager(); this._gameDataManager = new GameDataManager(); this._globalUpdater = new ServerStatusUpdater(); this._globalUpdater.Init(); this._languageLocale = new LanguageLocale(); this._antiMutant = new AntiMutant(); this._botManager = new BotManager(); this._cacheManager = new CacheManager(); this._rewardManager = new RewardManager(); this._badgeManager = new BadgeManager(); this._badgeManager.Init(); this._permissionManager = new PermissionManager(); this._permissionManager.Init(); this._subscriptionManager = new SubscriptionManager(); this._subscriptionManager.Init(); this._guideManager = new GuideManager(); int pollLoaded; this._pollManager = new PollManager(); this._pollManager.Init(out pollLoaded); #region Roleplay Section RoleplayData.Initialize(); EventManager.Initialize(); CombatManager.Initialize(); RoleplayGameManager.Initialize(); this._groupManager = new GroupManager(); this._groupManager.Initialize(); TexasHoldEmManager.Initialize(); TurfManager.Initialize(); WeaponManager.Initialize(); FoodManager.Initialize(); FarmingManager.Initialize(); CraftingManager.Initialize(); LotteryManager.Initialize(); ToDoManager.Initialize(); BlackListManager.Initialize(); BountyManager.Initialize(); WebSocketChatManager.Initialiaze(); this._houseManager = new HouseManager(); this._houseManager.Init(); this._webEventManager = new WebEventManager(); this._webEventManager.Init(); #endregion }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1 && Params[0] != "checarloteria") { Session.SendWhisper("Digite um tipo de evento!", 1); return; } string Message; if (Params[0] == "checarloteria") { Message = "lottery"; } else { Message = Params[1].ToString().ToLower(); } switch (Message) { #region Brawl case "brawl": case "briga": { if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.Brawl)) { Session.SendWhisper("Não há evento de Briga acontecendo!", 1); } else { var Game = RoleplayGameManager.GetGame(GameMode.Brawl); if (Game.GetPlayers().Count > 0) { while (Game.GetPlayers().Count > 0) { foreach (var player in Game.GetPlayers()) { var Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(player); if (Client != null) { if (Client.GetRoomUser() != null) { Client.GetRoomUser().ClearMovement(true); } RoleplayManager.SpawnChairs(Client, "es_bench"); Game.RemovePlayerFromGame(Client); } if (Game.GetPlayers().Contains(player)) { Game.GetPlayers().Remove(player); } break; } if (Game.GetPlayers().Count <= 0) { break; } } } RoleplayGameManager.StopGame(GameMode.Brawl); Session.SendWhisper("Você parou o Evento de Briga!", 1); } break; } #endregion #region Team Brawl case "teambrawl": case "tbrawl": case "tb": case "brigatimes": case "bt": case "brigadetimes": { if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.TeamBrawl)) { Session.SendWhisper("Não há um evento de Briga de Times acontecendo!", 1); } else { var Game = RoleplayGameManager.GetGame(GameMode.TeamBrawl); if (Game.GetPlayers().Count > 0) { while (Game.GetPlayers().Count > 0) { foreach (var Player in Game.GetPlayers()) { var Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Player); if (Client != null) { Game.RemovePlayerFromGame(Client); RoleplayManager.SpawnChairs(Client, "es_bench"); } if (Game.GetPlayers().Contains(Player)) { Game.GetPlayers().Remove(Player); } break; } if (Game.GetPlayers().Count <= 0) { break; } } } RoleplayGameManager.StopGame(GameMode.TeamBrawl); Session.SendWhisper("Você parou o Evento Briga de Times!", 1); } break; } #endregion #region Colour Wars case "colorwars": case "colourwars": case "cw": case "guerradecores": case "guerracores": case "gc": { if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.ColourWars)) { Session.SendWhisper("Não há nenhum evento de Guerra de Cores acontecendo!", 1); } else { var Game = RoleplayGameManager.GetGame(GameMode.ColourWars); if (Game.GetPlayers().Count > 0) { while (Game.GetPlayers().Count > 0) { foreach (var Player in Game.GetPlayers()) { var Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Player); if (Client != null) { Game.RemovePlayerFromGame(Client); } if (Game.GetPlayers().Contains(Player)) { Game.GetPlayers().Remove(Player); } break; } if (Game.GetPlayers().Count <= 0) { break; } } } RoleplayGameManager.StopGame(GameMode.ColourWars); Session.SendWhisper("Você parou o Evento Guerra de Cores!", 1); } break; } #endregion #region Mafia Wars case "mafiawars": case "mwars": case "mw": case "gm": case "guerramafia": case "guerrademafias": case "guerrademafia": { if (!RoleplayGameManager.RunningGames.ContainsKey(GameMode.MafiaWars)) { Session.SendWhisper("Não há um evento de Guerra de Máfias acontecendo!", 1); } else { var Game = RoleplayGameManager.GetGame(GameMode.MafiaWars); if (Game.GetPlayers().Count > 0) { while (Game.GetPlayers().Count > 0) { foreach (var Player in Game.GetPlayers()) { var Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Player); if (Client != null) { Game.RemovePlayerFromGame(Client); } if (Game.GetPlayers().Contains(Player)) { Game.GetPlayers().Remove(Player); } break; } if (Game.GetPlayers().Count <= 0) { break; } } } RoleplayGameManager.StopGame(GameMode.MafiaWars); Session.SendWhisper("Você parou o Evento Guerra de Máfias!", 1); } break; } #endregion #region Purge case "purge": case "purga": case "tempodepurga": case "purg": { if (!RoleplayManager.PurgeStarted) { Session.SendWhisper("Este não há um evento de Purga acontecendo agora!"); break; } try { lock (PlusEnvironment.GetGame().GetClientManager().GetClients) { foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList()) { if (client == null) { continue; } if (client.GetHabbo() == null) { continue; } client.SendWhisper("Um membro da Equipe terminou o Evento de Purga. Nós esperamos que você tenha aproveitado! ;)", 34); } } RoleplayManager.PurgeStarted = false; } catch (Exception e) { Logging.LogCriticalException("Erro ao parar a purga: " + e); } break; } #endregion #region Lottery case "lottery": case "loteria": { if (!LotteryManager.LotteryFull()) { Session.SendWhisper("Nem todos os bilhetes foram vendidos! [" + LotteryManager.LotteryTickets.Count + "/" + LotteryManager.TicketLimit + "]", 1); break; } else { int Winner = LotteryManager.GetWinner(); LotteryManager.GivePrize(Winner); LotteryManager.ClearLottery(); Session.SendWhisper("A loteria foi limpa com sucesso!", 1); } break; } #endregion default: { Session.SendWhisper("Este tipo de evento não existe ou está desabilitado!", 1); break; } } }
public void Init(CommandLineParser cmd) { AngryWasp.Serializer.Serializer.Initialize(); if (cmd["donation-wallet-port"] != null) { cfg.DonationWalletPort = uint.Parse(cmd["donation-wallet-port"].Value); } if (cmd["user-wallet-port"] != null) { cfg.UserWalletPort = uint.Parse(cmd["user-wallet-port"].Value); } string donationWalletFile = string.Empty, donationWalletPassword = string.Empty; string userWalletFile = string.Empty, userWalletPassword = string.Empty; if (cmd["key-file"] != null) { string[] keys = File.ReadAllLines(cmd["key-file"].Value); string keyFilePassword = PasswordPrompt.Get("Please enter the key file decryption password"); donationWalletPassword = keys[0].Decrypt(keyFilePassword); userWalletPassword = keys[1].Decrypt(keyFilePassword); cfg.DonationPaymentIdKey = keys[2].Decrypt(keyFilePassword); keyFilePassword = null; } else { donationWalletPassword = PasswordPrompt.Get("Please enter the donation wallet password"); userWalletPassword = PasswordPrompt.Get("Please enter the user wallet password"); cfg.DonationPaymentIdKey = PasswordPrompt.Get("Please enter the payment id encryption key"); } if (cmd["donation-wallet-file"] != null) { donationWalletFile = cmd["donation-wallet-file"].Value; } if (cmd["user-wallet-file"] != null) { userWalletFile = cmd["user-wallet-file"].Value; } string jsonFile = Path.Combine(Environment.CurrentDirectory, $"Wallets/{donationWalletFile}.json"); Log.Write($"Loading Wallet JSON: {jsonFile}"); cfg.AccountJson = JsonConvert.DeserializeObject <AccountJson>(File.ReadAllText(jsonFile)); new OpenWallet(new OpenWalletRequestData { FileName = donationWalletFile, Password = donationWalletPassword }, (string result) => { Log.Write("Wallet loaded"); }, (RequestError error) => { Log.Write("Failed to load donation wallet"); Environment.Exit(1); }, cfg.WalletHost, cfg.DonationWalletPort).Run(); new OpenWallet(new OpenWalletRequestData { FileName = userWalletFile, Password = userWalletPassword }, (string r1) => { Log.Write("Wallet loaded"); new GetAccounts(null, (GetAccountsResponseData r2) => { foreach (var a in r2.Accounts) { ulong uid = 0; if (ulong.TryParse(a.Label, out uid)) { if (!cfg.UserWalletCache.ContainsKey(uid)) { cfg.UserWalletCache.Add(uid, new Tuple <uint, string>(a.Index, a.BaseAddress)); Log.Write($"Loaded wallet for user: {a.Label} - {a.BaseAddress}"); } else { Log.Write($"Duplicate wallet detected for user with id: {uid}"); } } else { //fusion owns address index 0 if (a.Index == 0) { cfg.UserWalletCache.Add(cfg.BotId, new Tuple <uint, string>(a.Index, a.BaseAddress)); } else { Log.Write($"Account index {a.Index} is not associated with a user"); } } } }, (RequestError error) => { Log.Write("Failed to load user wallet"); Environment.Exit(1); }, cfg.WalletHost, cfg.UserWalletPort).Run(); }, (RequestError error) => { Log.Write("Failed to load user wallet"); Environment.Exit(1); }, cfg.WalletHost, cfg.UserWalletPort).Run(); //todo: Check if an existing game is still running after restart and load that instead string fp = Path.Combine(Environment.CurrentDirectory, "lottery.xml"); if (File.Exists(fp)) { LotteryManager.Load(fp); } else { LotteryManager.Start(); } }
void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var lotteryInfo = new LotteryInfo(e.Item.DataItem); var ltlItemIndex = e.Item.FindControl("ltlItemIndex") as Literal; var ltlTitle = e.Item.FindControl("ltlTitle") as Literal; var ltlKeywords = e.Item.FindControl("ltlKeywords") as Literal; var ltlStartDate = e.Item.FindControl("ltlStartDate") as Literal; var ltlEndDate = e.Item.FindControl("ltlEndDate") as Literal; var ltlUserCount = e.Item.FindControl("ltlUserCount") as Literal; var ltlPVCount = e.Item.FindControl("ltlPVCount") as Literal; var ltlIsEnabled = e.Item.FindControl("ltlIsEnabled") as Literal; var ltlWinner = e.Item.FindControl("ltlWinner") as Literal; var ltlPreviewUrl = e.Item.FindControl("ltlPreviewUrl") as Literal; var ltlEditUrl = e.Item.FindControl("ltlEditUrl") as Literal; ltlItemIndex.Text = (e.Item.ItemIndex + 1).ToString(); ltlTitle.Text = lotteryInfo.Title; ltlKeywords.Text = DataProviderWX.KeywordDAO.GetKeywords(lotteryInfo.KeywordID); ltlStartDate.Text = DateUtils.GetDateAndTimeString(lotteryInfo.StartDate); ltlEndDate.Text = DateUtils.GetDateAndTimeString(lotteryInfo.EndDate); ltlUserCount.Text = lotteryInfo.UserCount.ToString(); ltlPVCount.Text = lotteryInfo.PVCount.ToString(); ltlIsEnabled.Text = StringUtils.GetTrueOrFalseImageHtml(!lotteryInfo.IsDisabled); ltlWinner.Text = $@"<a href=""{BackgroundLotteryWinner.GetRedirectUrl(PublishmentSystemID, lotteryType, lotteryInfo.ID, 0, GetRedirectUrl(PublishmentSystemID, lotteryType))}"">查看获奖名单</a>"; var urlPreview = LotteryManager.GetLotteryUrl(lotteryInfo, string.Empty); urlPreview = BackgroundPreview.GetRedirectUrlToMobile(urlPreview); ltlPreviewUrl.Text = $@"<a href=""{urlPreview}"" target=""_blank"">预览</a>"; var urlEdit = string.Empty; if (lotteryType == ELotteryType.Scratch) { urlEdit = BackgroundScratchAdd.GetRedirectUrl(PublishmentSystemID, lotteryInfo.ID); } else if (lotteryType == ELotteryType.BigWheel) { urlEdit = BackgroundBigWheelAdd.GetRedirectUrl(PublishmentSystemID, lotteryInfo.ID); } else if (lotteryType == ELotteryType.GoldEgg) { urlEdit = BackgroundGoldEggAdd.GetRedirectUrl(PublishmentSystemID, lotteryInfo.ID); } else if (lotteryType == ELotteryType.Flap) { urlEdit = BackgroundFlapAdd.GetRedirectUrl(PublishmentSystemID, lotteryInfo.ID); } else if (lotteryType == ELotteryType.YaoYao) { urlEdit = BackgroundYaoYaoAdd.GetRedirectUrl(PublishmentSystemID, lotteryInfo.ID); } ltlEditUrl.Text = $@"<a href=""{urlEdit}"">编辑</a>"; } }