// Returns Bonus Damage on use. public static int Event(Client client) { int bonusDamage = 0; if (!client.HasData(EntityData.Account)) { return(bonusDamage); } if (!(client.GetData(EntityData.Account) is Account account)) { return(bonusDamage); } if (client.CurrentWeapon != WeaponHash.Unarmed) { return(bonusDamage); } LevelRanks levelRanks = account.GetLevelRanks(); bonusDamage = levelRanks.Fisticuffs; return(bonusDamage); }
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 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}."); }
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 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 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 void GetPoints(Client client) { Account account = client.GetData(EntityData.Account); LevelRanks levelRanks = JsonConvert.DeserializeObject <LevelRanks>(account.LevelRanks); client.SendChatMessage($"{levelRanks.GetUnallocatedRankPointCount(account.CurrentExperience)}"); }
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); }
/// <summary> /// Update the player's local game with the required information for the Level System. /// </summary> /// <param name="client"></param> public static void UpdateLevelSystemLocally(Client client) { Account account = RetrieveAccount(client); LevelRanks levelRanks = JsonConvert.DeserializeObject <LevelRanks>(account.LevelRanks); int currentXP = account.CurrentExperience; int unallocatedPoints = levelRanks.GetUnallocatedRankPointCount(currentXP); int lastXP = LevelSystem.GetLastLevelExperience(currentXP); int nextLevelXP = LevelSystem.GetNextLevelExperience(currentXP); int currentLvl = LevelSystem.GetCurrentLevel(currentXP); client.TriggerEvent("eventRecieveRanks", account.LevelRanks); client.TriggerEvent("UpdateExperienceHUD", lastXP, currentXP, nextLevelXP, currentLvl, unallocatedPoints); }
public static int Use(Client client, int number) { LevelRankCooldowns cooldowns = AccountUtil.GetCooldowns(client); LevelRanks ranks = AccountUtil.GetLevelRanks(client); if (!cooldowns.IsQuickReady || ranks.Quick <= 0) { return(number); } cooldowns.IsQuickReady = false; client.SendNotification("You used your increased dodge chance."); return(number += ranks.Quick); }
public static bool Use(Client client) { LevelRankCooldowns cooldowns = AccountUtil.GetCooldowns(client); LevelRanks ranks = AccountUtil.GetLevelRanks(client); if (!cooldowns.IsCalculatedReady || ranks.Calculated <= 0) { return(false); } client.SendNotification("Your shot hit with 100% accuracy."); cooldowns.IsCalculatedReady = false; return(true); }
public static int Use(Client client, int number) { LevelRankCooldowns cooldowns = AccountUtil.GetCooldowns(client); LevelRanks ranks = AccountUtil.GetLevelRanks(client); if (!cooldowns.IsConcentrateReady || ranks.Concentrate <= 0) { return(number); } cooldowns.IsConcentrateReady = false; client.SendNotification("Your shot hit for double damage."); return(number * 2); }
public static bool Use(Client client) { LevelRankCooldowns cooldowns = AccountUtil.GetCooldowns(client); LevelRanks ranks = AccountUtil.GetLevelRanks(client); if (!cooldowns.IsDeadeyeReady || ranks.Deadeye <= 0) { return(false); } cooldowns.IsDeadeyeReady = false; client.SendNotification("Your shot had increased accuracy."); return(true); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) client.SetData(VariableName + Notification, false); if (!(client.GetData(EntityData.Account) is Account account)) return; LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Electric <= 0) return; LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Electric); if (!levelRankCooldowns.IsElectricReady) { client.SetData(VariableName + Notification, false); return; } if (client.IsInVehicle) { // Check if the vehicle is electric. if (!client.Vehicle.HasData("ElectricVehicle")) return; // Get the electric vehicle class. if (!(client.GetData("ElectricVehicle") is ElectricVehicle electricVehicle)) return; // If the electric vehicle's power is greater than 100. Don't try recharging. if (electricVehicle.Power > 100) return; // If the electric vehicle has less than 100 power. Add some power based on ranks put into Electric. levelRankCooldowns.IsElectricReady = false; electricVehicle.Power += levelRanks.Electric; client.SendChatMessage("~b~Electric ~w~This vehicle has recieved a little more power."); } // Has the notification been sent. if (client.GetData(VariableName + Notification)) return; client.SetData(VariableName + Notification, true); client.SendChatMessage("~b~Electric ~w~You will recharge a vehicle slightly when you enter it."); }
public void UpdateCurrentLevelResults(int score, Definitions.SurvivalRank rank) { while (LevelScores.Count <= LastSelectedLevel) { LevelScores.Add(0); } LevelScores[LastSelectedLevel] = score; while (LevelRanks.Count <= LastSelectedLevel) { LevelRanks.Add(Definitions.SurvivalRank.NotSet); } if ((LevelRanks[LastSelectedLevel] == Definitions.SurvivalRank.NotSet) || ((int)LevelRanks[LastSelectedLevel] > (int)rank)) { LevelRanks[LastSelectedLevel] = rank; } }
public void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Brute <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Brute); if (!levelRankCooldowns.IsBruteReady) { client.SetData(VariableName + Notification, false); return; } levelRankCooldowns.IsBruteReady = false; if (client.Armor >= levelRanks.Brute) { return; } if (!client.GetData(VariableName + Notification)) { client.SetData(VariableName + Notification, true); client.SendChatMessage("~r~Brute ~w~You feel your skin tighten."); client.Armor = levelRanks.Brute; } }
public static void Use(Client client, Vehicle vehicle) { if (!vehicle.Exists) { return; } LevelRankCooldowns cooldowns = AccountUtil.GetCooldowns(client); LevelRanks ranks = AccountUtil.GetLevelRanks(client); if (!cooldowns.IsSmashReady || ranks.Smash <= 0) { return; } if (client.Position.DistanceTo2D(vehicle.Position) > 2.5) { return; } if (!vehicle.Locked) { return; } cooldowns.IsSmashReady = false; bool didPlayerSucceed = Skillcheck.SkillCheckPlayer(client, Skillcheck.Skills.strength, new Random().Next(15, 28), clientModifier: ranks.Smash, impact: -1); if (!didPlayerSucceed) { client.SendNotification("You try to smash the vehicle window but end up hurting your fist."); return; } vehicle.Locked = false; client.SendNotification("You successfully smash the vehicle window."); Utilities.BreakVehicleWindow(client, vehicle); }
public static void AllocateRankPoint(Client client, params object[] args) { if (args[1] == null) { return; } if (!client.HasData(EntityData.Account)) { return; } if (!(client.GetData(EntityData.Account) is Account account)) { return; } string argumentString = args[1] as string; if (argumentString.Contains(":")) { argumentString = argumentString.Substring(0, argumentString.Length - 3); argumentString = Regex.Replace(argumentString, @"[0-9\s:]", String.Empty); } LevelRanks levelRanks = JsonConvert.DeserializeObject <LevelRanks>(account.LevelRanks); bool success = levelRanks.AllocateSkillPoint(account.CurrentExperience, argumentString); if (!success) { Utilities.PushBrowserEvent(client, BrowserData.Skilltree_Error_Point_Assign); Utilities.PlaySoundFrontend(client, "Hack_Failed", "DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS"); return; } levelRanks.UpdateLevelRanks(client); Utilities.PushBrowserEvent(client, BrowserData.Skilltree_Update_Data); Utilities.PlaySoundFrontend(client, "Hack_Success", "DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS"); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Downer <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Downer); if (!levelRankCooldowns.IsDownerReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendChatMessage("~r~Downer ~w~You have an extended down time available."); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Hidden <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Hidden); if (!levelRankCooldowns.IsHiddenReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendChatMessage("~o~Hidden ~w~You are able to hide your nametag from others for a period of time."); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Quick <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Quick); if (!levelRankCooldowns.IsQuickReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendNotification("~g~Quick ~w~You have increased dodge chance for your next hit."); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Attention <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Attention); if (!levelRankCooldowns.IsAttentionReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendChatMessage("~o~Attention ~w~You are able to draw the attention of everyone around you."); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Brains <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Brains); if (!levelRankCooldowns.IsBrainsReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendChatMessage("~o~Brains ~w~Your next complete objective grants additional currency."); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Leadership <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Leadership); if (!levelRankCooldowns.IsLeadershipReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendChatMessage("~o~Leadership ~w~You can increase your teammates ability scores again."); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Drag <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Drag); if (!levelRankCooldowns.IsDragReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendNotification("~r~Drag ~w~You're able to drag someone again."); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.VehicleSense <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.VehicleSense); if (!levelRankCooldowns.IsVehicleSenseReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendChatMessage("~b~VehicleSense ~w~You're able to see your owned vehicles and moving vehicles again."); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.CrowdControl <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.CrowdControl); if (!levelRankCooldowns.IsCrowdControlReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendChatMessage("~b~CrowdControl ~w~You are able to disable a person or vehicle temporarily again."); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Smash <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Smash - (levelRanks.Smash * 7)); if (!levelRankCooldowns.IsSmashReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendChatMessage("~r~Smash ~w~You're able to break a window again."); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Lockpick <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Lockpick - (levelRanks.Lockpick * 5)); if (!levelRankCooldowns.IsLockpickReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendChatMessage("~b~Lockpick ~w~Your next lockpick will have a higher chance to succeed."); }
private void CheckPassive(object source, Client client) { if (!client.HasData(VariableName + Notification)) { client.SetData(VariableName + Notification, false); } if (!(client.GetData(EntityData.Account) is Account account)) { return; } LevelRanks levelRanks = account.GetLevelRanks(); if (levelRanks.Disguise <= 0) { return; } LevelRankCooldowns levelRankCooldowns = AccountUtil.GetCooldowns(client); levelRankCooldowns.UpdateCooldownTime(client, VariableName, SkillCooldowns.Disguise); if (!levelRankCooldowns.IsDisguiseReady) { client.SetData(VariableName + Notification, false); return; } if (client.GetData(VariableName + Notification)) { return; } client.SetData(VariableName + Notification, true); client.SendChatMessage("~o~Disguise ~w~You can swap to a new outfit again."); }