public ActionResult Logon(MemberModel model) { ModelState.Remove("IndustryId"); ModelState.Remove("Name"); ModelState.Remove("Company"); ModelState.Remove("CompanyNo"); ModelState.Remove("CompanyNum"); ModelState.Remove("CompanyTypeList"); ModelState.Remove("Email"); ModelState.Remove("RegDate"); ModelState.Remove("CheckPassword"); ModelState.Remove("ReceiveEpaperInfo"); string captcha = AccountUtil.GetCaptcha(); if (!captcha.Equals(model.ConfirmationCode, StringComparison.OrdinalIgnoreCase)) { ModelState.AddModelError("ConfirmationCode", "驗證碼錯誤"); } else { model.DoLogon(); } if (model.SendOrderOk) { return(View("LogOff", model)); } else { return(View(model)); } }
public ActionResult Join(MemberModel model) { ModelState.Remove("RegDate"); string captcha = AccountUtil.GetCaptcha(); if (!captcha.Equals(model.ConfirmationCode, StringComparison.OrdinalIgnoreCase)) { ModelState.AddModelError("ConfirmationCode", "驗證碼錯誤"); } else if (model.Password != model.CheckPassword) { ModelState.AddModelError("Password", ""); ModelState.AddModelError("CheckPassword", "登入密碼與確認密碼不一樣"); } else { if (model.IsValid()) { model.SendOrder(); } } if (model.SendOrderOk) { return(View("LogOff", model)); } else { return(View(model)); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { string UserName = this.username.Value; string Password = this.password.Value; string clientip = getIPAddress(); LoginInfo login = AccountUtil.LogIn(UserName, Password, null, "GisPortal", 0); if (login.Status == NM.Model.LoginStatus.Successed) { System.Web.Security.FormsAuthentication.SetAuthCookie(UserName, false); Session["loginuser"] = login; Session.Add("USERNAME", UserName); string mm = Request.QueryString["ReturnUrl"]; if (string.IsNullOrEmpty(mm)) { mm = "/Default.aspx"; } Response.Redirect(mm); } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "Error", "<script type='text/javascript'>alert('用户名或密码错误,请重试!');</script>"); } } }
public ActionResult SendOrder(EpaperExaminationModel model) { ModelState.Remove("PostDate"); ModelState.Remove("Question10"); ModelState.Remove("Question11"); ModelState.Remove("Question12"); string captcha = AccountUtil.GetCaptcha(); if (!captcha.Equals(model.ConfirmationCode, StringComparison.OrdinalIgnoreCase)) { ModelState.AddModelError("ConfirmationCode", "驗證碼錯誤"); } else { if (model.IsValid()) { model.Insert(); model.SendOrderOk = true; } } if (model.SendOrderOk) { return(View("SendOrderOK")); } else { return(View("Index", model)); } }
public static void Use(Client client, Client target) { if (!target.Exists) { return; } LevelRankCooldowns cooldowns = AccountUtil.GetCooldowns(client); LevelRanks ranks = AccountUtil.GetLevelRanks(client); if (!cooldowns.IsIntimidateReady || ranks.Intimidate <= 0) { return; } if (client.Position.DistanceTo2D(target.Position) > 4) { return; } cooldowns.IsIntimidateReady = false; Utilities.ForcePlayerCower(target, ranks.Intimidate * 1000); client.SendChatMessage($"~r~Intimidate ~w~You look quite intimidating and ~o~{target.Name}~w~ has noticed."); target.SendChatMessage($"~r~Intimidate ~o~{client.Name} ~w~looks very intimidating you cower in fear."); }
public static int Use(Client client) { int damageRollBonus = 0; if (!client.Exists) { return(damageRollBonus); } LevelRankCooldowns cooldowns = AccountUtil.GetCooldowns(client); LevelRanks ranks = AccountUtil.GetLevelRanks(client); if (ranks.DamageRoll <= 0) { return(damageRollBonus); } if (!cooldowns.IsDamageRollReady) { return(damageRollBonus); } damageRollBonus = ranks.DamageRoll / 2; cooldowns.IsDamageRollReady = false; client.SendNotification("Your shot hit for a little more damage."); return(damageRollBonus); }
private void FinishLogin(Client client) { AccountUtil.UpdatePlayerMoneyLocally(client); Utilities.FreezePlayerAccount(client, false); Utilities.DisablePlayerAccount(client, false); Utilities.LoginPlayerAccount(client, true); client.TriggerEvent("closeBrowser"); client.Dimension = 0; client.Transparency = 255; /* * * if (!NewAccount) * return; * * NewAccount = false; * Utilities.FreezePlayerAccount(client, true); * * Task task = new Task(() => * { * client.SendChatMessage("Please wait... setting up appearance menu for your new account."); * System.Threading.Thread.Sleep(1000); * client.TriggerEvent("OpenFacialMenu"); * * }); * task.Start(); * * Utilities.FreezePlayerAccount(client, false); * Database.UpdateData(this); */ }
public MyStatusCode ValidateAccount(string username, string password, ref long userId) { MyStatusCode state = MyStatusCode.Invalid; if (!AccountUtil.CheckAccountInfo(username, password)) { return(state); } string pw = loverDao.GetPw(username); if (pw == null) { logger.Debug("no such user : "******"wrong pw : {0} of {1}", pw, username)); state = MyStatusCode.WrongPw; } else { userId = loverDao.GetId(username); state = MyStatusCode.Validated; } return(state); }
private void HandleDeath(object source, Client client, Client killer) { AccountUtil.SetPlayerDeath(client, true); LevelRanks levelRanks = AccountUtil.GetLevelRanks(client); LevelRankCooldowns cooldowns = AccountUtil.GetCooldowns(client); DateTime timeOfDeath = AccountUtil.SetTimeOfDeath(client); int downerBonus = 0; if (levelRanks.Downer > 0 && cooldowns.IsDownerReady) { cooldowns.IsDownerReady = false; downerBonus = 5000 * levelRanks.Downer; client.SendChatMessage("~r~Downer ~w~You are using your extended downtime for dieing."); } NotifyPlayersOfDeath(client); NAPI.Task.Run(() => { if (!AccountUtil.IsPlayerDead(client)) { return; } if (timeOfDeath != AccountUtil.GetTimeOfDeath(client)) { return; } AccountUtil.SetPlayerDeath(client, false); }, 30000 + downerBonus); // 30 Seconds + Bonus }
public bool UpdateObjectives() { Objective clearedObjective = Objectives.Dequeue(); if (!FinishedObjectives.Contains(clearedObjective)) { FinishedObjectives.Add(clearedObjective); } if (GetObjectives().Length <= 0) { CleanupMission(); for (int i = 0; i < ActivePlayers.Count; i++) { Client client = NAPI.Player.GetPlayerFromHandle(ActivePlayers[i]); client.TriggerEvent("MissionInfo", "Mission_Active_Objectives", ""); client.TriggerEvent("eventCreatePlayerNotification", $"All Objectives Complete"); AccountUtil.AddExperience(client, clearedObjective.Experience); } return(true); } string activeObjectives = JsonConvert.SerializeObject(GetObjectives()); for (int i = 0; i < ActivePlayers.Count; i++) { Client client = NAPI.Player.GetPlayerFromHandle(ActivePlayers[i]); client.TriggerEvent("MissionInfo", "Mission_Active_Objectives", activeObjectives); client.TriggerEvent("eventCreatePlayerNotification", $"Objective Complete"); AccountUtil.AddExperience(client, clearedObjective.Experience); } return(true); }
public MyStatusCode RegisterAccount(string username, string password, string gender) { MyStatusCode state = MyStatusCode.Invalid; if (!AccountUtil.CheckAccountInfo(username, password) || !(gender.Equals("M") || gender.Equals("F"))) { return(state); } if (loverDao.GetPw(username) != null) { logger.Debug("existing name :" + username); state = MyStatusCode.Existing; } else { DogLover lover = new DogLover() { name = username, password = password, gender = gender, figure = DefaultUtil.DefaultLoverFigure, loves = 0, loveDogs = 0, adoptDogs = 0 }; loverDao.Add(lover); state = MyStatusCode.Validated; } return(state); }
/// <summary> /// Completely burns an item from the inventory. Stacks are taken into account. /// </summary> /// <param name="client"></param> /// <param name="itemName"></param> /// <returns></returns> public static bool BurnItemFromInventory(Client client, string itemName) { Account account = AccountUtil.RetrieveAccount(client); InventoryItem[] inventoryItems = account.GetAllItems(); int index = GetIndexFromName(inventoryItems, itemName); if (index == -1) { return(false); } Utilities.PlaySoundFrontend(client, "PIN_BUTTON", "ATM_SOUNDS"); inventoryItems[index].StackCount -= 1; if (inventoryItems[index].StackCount <= 0) { inventoryItems[index] = null; } SaveInventory(client, GetInventoryJson(inventoryItems)); return(true); }
/// <summary> /// Use the item if it has a specific effect available for it. /// </summary> /// <param name="client"></param> /// <param name="uniqueID"></param> public static void UseItem(Client client, int uniqueID) { Account account = AccountUtil.RetrieveAccount(client); InventoryItem[] inventoryItems = account.GetAllItems(); int index = GetIndexFromUniqueID(inventoryItems, uniqueID); if (index == -1 || account.IsDead) { return; } bool itemFound = UseItemEffect(client, inventoryItems[index]); if (!itemFound) { Utilities.PlaySoundFrontend(client, "ERROR", "HUD_FRONTEND_DEFAULT_SOUNDSET"); Utilities.PushBrowserEvent(client, BrowserData.Inventory_Item_Has_No_Use); return; } inventoryItems[index].StackCount -= 1; if (inventoryItems[index].StackCount <= 0) { inventoryItems[index] = null; } SaveInventory(client, GetInventoryJson(inventoryItems)); Utilities.PushBrowserEvent(client, BrowserData.Inventory_Used_Item); Utilities.PlaySoundFrontend(client, "PIN_BUTTON", "ATM_SOUNDS"); }
private void EnterButton_Click(object sender, RoutedEventArgs e) { LoginResult lr = af.Login(this.number.Text, this.password.Password); if (lr != null) { if (lr.code == "200") { if (AccountUtil.IsRole(AccountUtil.ADMIN, lr.data.roles)) { CacheService.Instance.AdminToken = lr.token; ConfigWindow configWindow = new ConfigWindow(); configWindow.Show(); configWindow.Owner = this.Owner; this.Close(); } else { LSMessageBox.Show("登录异常", "当前角色不是管理员"); } } else { LSMessageBox.Show("登录错误", lr.message); } } else { LSMessageBox.Show("网络错误", "网络异常"); } }
private void CheckPassive(object source, Client client) { if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Regenerate <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, "IsRegenerateReady", SkillCooldowns.Regenerate); if (!levelRankCooldowns.IsRegenerateReady) { return; } levelRankCooldowns.IsRegenerateReady = false; if (client.Health >= 95) { return; } client.SendNotification("~b~Regenerate ~w~You feel a bit healthier."); client.Health += levelRanks.Regenerate; }
public ActionResult <TalentRequestInfoVM> GetTalentRequestInfo(int talent_id) { try { var curUser = accountUtil.GetCurrentUser(User); if (!AccountUtil.IsUserCustomer(curUser)) { throw new Exception("Только клиенты могут смотреть эту информацию"); } var customer = CustomerService.GetByUserID(curUser.ID); if (customer == null) { throw new Exception("Вы не являетесь клиентом"); } Talent talent = TalentService.GetAvailableByID(talent_id); if (talent == null) { throw new Exception("Талант не найден"); } TalentRequestInfoVM talentRequestInfoVM = new TalentRequestInfoVM(talent); return(talentRequestInfoVM); } catch (Exception ex) { return(CustomBadRequest(ex)); } }
protected void Page_PreRender(object sender, EventArgs e) { var contest = ServiceFactory.ContestService.Get(GetContestId()); contestForm.GetContestNameTextBox().Text = contest.Name; contestForm.GetDescriptionTextBox().Text = contest.Description; contestForm.GetMaxDurationTextBox().Text = Convert.ToString(contest.MaxDuration.Minutes); var timeKeepersDropDownList = contestForm.GetTimeKeepersDropDownList(); var accountUtil = new AccountUtil(Context); var users = accountUtil.GetAllUsers(); foreach (var user in users.OrderBy(u => u.UserName)) { timeKeepersDropDownList.Items.Add(new ListItem(user.UserName, user.Id)); } timeKeepersDropDownList.Items.FindByValue(contest.TimeKeeperId).Selected = true; if (!String.IsNullOrWhiteSpace(contest.Status)) { contestForm.GetStatusDropDownList().Items.FindByValue(contest.Status).Selected = true; } }
public void PlayerSpawnHandler(Client client) { if (AccountUtil.IsAccountReady(client)) { return; } Console.WriteLine($"{client.Name} has joined the server."); Utilities.FreezePlayerAccount(client, true); Utilities.DisablePlayerAccount(client, true); client.Position = new Vector3(Settings.Settings.SpawnX, Settings.Settings.SpawnY, Settings.Settings.SpawnZ + 100); client.Dimension = Convert.ToUInt32(new Random().Next(1, 999)); client.Transparency = 0; foreach (MaleValidTopConfiguration top in MaleValidTopConfiguration.MaleValidTops) { client.TriggerEvent("GetMaleTorso", top.ID, top.Torso, top.Undershirt, top.Top); } foreach (FemaleValidTopConfiguration top in FemaleValidTopConfiguration.FemaleValidTops) { client.TriggerEvent("GetFemaleTorso", top.ID, top.Torso, top.Undershirt, top.Top); } foreach (JobInfo jobInfo in JobInfo.JobInformation) { client.TriggerEvent("eventAddJobInformation", JsonConvert.SerializeObject(jobInfo)); } }
public static void Use(Client client, Client target) { if (!client.Exists) { return; } if (!target.Exists) { return; } if (client.Position.DistanceTo2D(target.Position) > 5) { return; } LevelRankCooldowns cooldowns = AccountUtil.GetCooldowns(client); LevelRanks ranks = AccountUtil.GetLevelRanks(client); if (ranks.Drag <= 0) { return; } if (!cooldowns.IsDragReady) { return; } cooldowns.IsDragReady = false; Utilities.ForcePlayerToFollowPlayer(target, client, ranks.Drag * 1500); client.SendNotification($"You are dragging ~o~{target.Name}."); target.SendNotification($"You are being dragged by ~o~{client.Name}."); }
protected void Page_Load(object sender, EventArgs e) { RedirectUtil.RedirectUnauthenticatedUserToLoginPage(); RedirectUtil.RedirectNonAdminUserToHomePage(); BreadCrumbUtil.DataBind(Page, new List <BreadCrumb>() { new BreadCrumb(NavUtil.GetHomePageUrl(), "Home"), new BreadCrumb(NavUtil.GetUsersPageUrl(), "Users", IsActive: true), }); var items = new List <HyperlinkListPanelItem>(); var divisionService = ServiceFactory.DivisionService; var accountUtil = new AccountUtil(Context); foreach (var user in new AccountUtil(Context).GetAllUsers().OrderBy(u => u.UserName)) { string role = (accountUtil.IsUserAnAdmin(user.Id) ? "Administrator" : ""); role = (accountUtil.IsUserASuperuser(user.Id) ? "Superuser" : role); items.Add(new HyperlinkListPanelItem( URL: NavUtil.GetUpdateUserPageUrl(user.Id), Heading: user.UserName + (!String.IsNullOrWhiteSpace(role) ? " (" + role + ")" : ""), Text: user.Email)); } HyperlinkListPanelRenderer.Render(usersList, new HyperlinkListPanelConfig("Users", items)); }
/// <summary> /// Save the player's inventory. /// </summary> /// <param name="client"></param> /// <param name="jsonInventory"></param> public static void SaveInventory(Client client, string jsonInventory) { Account account = AccountUtil.RetrieveAccount(client); account.Inventory = jsonInventory; Account.PlayerUpdateEvent.Trigger(client, account); SendInventoryLocally(client); }
public void SetSocialSecurityNumber(long socialSecurityNumber) { if (socialSecurityNumber != null && !AccountUtil.GyldigFnr(socialSecurityNumber.ToString())) { throw new ArgumentException("socialSecurityNumber"); } this.socialSecurityNumber = socialSecurityNumber; }
public void CmdWeapon(Client client, string weapon) { client.RemoveAllWeapons(); WeaponHash hash = NAPI.Util.WeaponNameToModel(weapon); AccountUtil.AddPlayerWeapon(client, hash); }
public ActionResult CaptchaImg() { var builder = new XCaptcha.ImageBuilder(CaptchaHelper.GetRandomStringOnlyNum(6)); var result = builder.Create(); AccountUtil.SetCaptcha(result.Solution); return(new FileContentResult(result.Image, result.ContentType)); }
private void RefreshAccountLevelAndExp() { int accountLevel = GameProxy.instance.AccountLevel; float accountExpPercentToNextLevel = AccountUtil.GetAccountExpPercentToNextLevel(accountLevel); currentLevelText.text = accountLevel.ToString(); currentMaxLevelText.text = GlobalData.GetGlobalData().accountLevelMax.ToString(); accountExpSlider.value = accountExpPercentToNextLevel; accountExpPercentText.text = string.Format(Localization.Get("common.percent"), (int)(accountExpPercentToNextLevel * 100)); }
public static bool Weapon(Client client, string name) { LevelRanks levelRanks = AccountUtil.GetLevelRanks(client); WeaponHash hash = NAPI.Util.WeaponNameToModel(name); if (Array.IndexOf(WeaponNamesData.AssaultWeapons, name.ToLower()) >= 0) { if (levelRanks.MediumWeaponry <= 0) { client.SendChatMessage("~o~You are unable to wield this weapon type: ~y~Medium"); Utilities.PlaySoundFrontend(client, "ERROR", "HUD_FRONTEND_DEFAULT_SOUNDSET"); return(false); } } if (Array.IndexOf(WeaponNamesData.ShotgunWeapons, name.ToLower()) >= 0) { if (levelRanks.MediumWeaponry <= 0) { client.SendChatMessage("~o~You are unable to wield this weapon type: ~y~Medium"); Utilities.PlaySoundFrontend(client, "ERROR", "HUD_FRONTEND_DEFAULT_SOUNDSET"); return(false); } } if (Array.IndexOf(WeaponNamesData.SmgWeapons, name.ToLower()) >= 0) { if (levelRanks.LightWeaponry <= 0) { client.SendChatMessage("~o~You are unable to wield this weapon type: ~y~Light"); Utilities.PlaySoundFrontend(client, "ERROR", "HUD_FRONTEND_DEFAULT_SOUNDSET"); return(false); } } if (Array.IndexOf(WeaponNamesData.HeavyWeapons, name.ToLower()) >= 0) { if (levelRanks.HeavyWeaponry <= 0) { client.SendChatMessage("~o~You are unable to wield this weapon type: ~y~Heavy"); Utilities.PlaySoundFrontend(client, "ERROR", "HUD_FRONTEND_DEFAULT_SOUNDSET"); return(false); } } // Try adding the weapon to the player. if (!AccountUtil.AddPlayerWeapon(client, hash)) { return(false); } Utilities.PlaySoundFrontend(client, "PICK_UP_WEAPON", "HUD_FRONTEND_CUSTOM_SOUNDSET"); client.SendNotification("A weapon may be unequipped into your inventory by pressing ~o~R~w~."); return(true); }
public void Attach(Client client) { LoggedInAccounts.Add(this); // Basic Account client.SetData(EntityData.Account, this); client.Name = Name; client.Health = Health; client.Armor = Armor; Console.WriteLine($"{client.Name} has logged in."); // Set Position Vector3 position = JsonConvert.DeserializeObject <Vector3>(LastPosition); NAPI.Entity.SetEntityPosition(client, position); // Appearance Appearance appearance = Appearance.RetrieveAppearance(this); appearance.Attach(client); client.SendChatMessage(Exceptions.LoginLoadedAppearance); // Clothing Clothing clothing = Clothing.RetrieveClothing(this); clothing.Attach(client); client.SendChatMessage(Exceptions.LoginLoadedClothing); // Skills Skillsheet skills = JsonConvert.DeserializeObject <Skillsheet>(LevelSkills); skills.Attach(client); client.SendChatMessage(Exceptions.LoginLoadedSkills); // Levels AccountUtil.UpdateLevelSystemLocally(client); // Inventory InventoryHandler.SendInventoryLocally(client); // Reload existing weapons. AccountUtil.ReloadPlayerWeapons(client); if (IsDead) { IsDead = false; Health = 75; client.Health = 75; } // Finish FinishLogin(client); }
private void RefreshAccountInfo() { int accountLevel = GameProxy.instance.AccountLevel; float accountExpPercentToNextLevel = AccountUtil.GetAccountExpPercentToNextLevel(accountLevel); // accountNameText.text = GameProxy.instance.PlayerInfo.name; accountNameText.text = GameProxy.instance.AccountName; accountExpSlider.value = accountExpPercentToNextLevel; accountExpText.text = string.Format(Localization.Get("common.percent"), (int)(accountExpPercentToNextLevel * 100)); accountLevelText.text = string.Format(Localization.Get("ui.player_info_view.change_profession.account_level"), accountLevel); }
public SavingsAccount(long accountNumber, double initialAmount, Customer accountOwner) { if (!AccountUtil.ValidAccountNumber(accountNumber)) { throw new ArgumentException("AccountNumber"); } this.accountNumber = accountNumber; this.amount = initialAmount; this.accountOwner = accountOwner; }
public static bool IsAdministrator(HttpContextBase httpContext) { var authCooke = httpContext.Request.Cookies["__AUTH"]; if (authCooke == null) { return(false); } var accountUtil = new AccountUtil(ConfigHeper.AccountApiUrl); var user = accountUtil.GetUserByEmail(authCooke.Value); return(String.Equals("admin", user.Role.RoleName, StringComparison.CurrentCultureIgnoreCase)); }