void SetSkillSet(IRocketPlayer caller, string skillSetName) { SkillSet skillSet = SkillsUtils.FindSkillSetByName(skillSetName); if (skillSet == null) { UnturnedChat.Say(caller, string.Format("Unknown SkillSet \"{0}\"", skillSetName)); return; } if (!IsPermitted(caller, skillSet)) { CommandUtils.PermissionMissing(caller); return; } SkillsUtils.SetSkills((UnturnedPlayer)caller, skillSetName); _ = SkillSetsPlugin.Instance.GetStorage().Save(((UnturnedPlayer)caller).CSteamID, skillSetName); UnturnedChat.Say(caller, SkillSetsPlugin.Instance.Translate("SKILLSET_APPLIED")); }
internal void ApplySkillSetToPlayer(UnturnedPlayer player) { string skillSetName = GetStorage().Get(player.CSteamID); SkillSet skillset = SkillsUtils.FindSkillSetByName(skillSetName); if (skillset != null && !PermissionUtils.IsPermitted(player, skillset)) { // The SkillSet disappears or player doesn't have Permission anymore // Need to remove it from Storage GetStorage().Remove(player.CSteamID); skillset = null; } if (skillset == null) { skillset = SkillsUtils.GetHigherSkillSet(SkillsUtils.GetDefaultPermittedSkillSets(player)); } if (skillset != null) { SkillsUtils.SetSkills(player, skillset); } }