mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-29 10:31:34 +00:00
[MIRROR] Adds Skill Tracker app for tablets [MDB IGNORE] (#9897)
* Adds Skill Tracker app for tablets (#63013) Adds a skill tracker app for tablets. I allowed all tablets to install it, but it is currently not pre-installed by default. It is only available to tablets, with the conceptual compromise that it requires no extra hardware components, but uses sensors through your hands or something. * Adds Skill Tracker app for tablets Co-authored-by: Tastyfish <crazychris32@gmail.com>
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
/datum/computer_file/program/skill_tracker
|
||||
filename = "skilltracker"
|
||||
filedesc = "ExperTrak Skill Tracker"
|
||||
category = PROGRAM_CATEGORY_MISC
|
||||
program_icon_state = "generic"
|
||||
extended_desc = "Scan and view your current marketable job skills."
|
||||
size = 2
|
||||
tgui_id = "NtosSkillTracker"
|
||||
program_icon = "medal"
|
||||
usage_flags = PROGRAM_TABLET // Must be a handheld device to read read your chakras or whatever
|
||||
|
||||
/datum/computer_file/program/skill_tracker/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
|
||||
var/list/skills = list()
|
||||
data["skills"] = skills
|
||||
|
||||
var/datum/mind/targetmind = user.mind
|
||||
if(targetmind)
|
||||
for (var/type in GLOB.skill_types)
|
||||
var/datum/skill/skill = GetSkillRef(type)
|
||||
var/lvl_num = targetmind.get_skill_level(type)
|
||||
var/lvl_name = uppertext(targetmind.get_skill_level_name(type))
|
||||
var/exp = targetmind.get_skill_exp(type)
|
||||
var/xp_prog_to_level = targetmind.exp_needed_to_level_up(type)
|
||||
var/xp_req_to_level = 0
|
||||
if (xp_prog_to_level && lvl_num < length(SKILL_EXP_LIST)) // is it even possible to level up?
|
||||
xp_req_to_level = SKILL_EXP_LIST[lvl_num+1] - SKILL_EXP_LIST[lvl_num]
|
||||
|
||||
var/list/skilldata = list(
|
||||
"name" = skill.name,
|
||||
"desc" = skill.desc,
|
||||
"title" = skill.title,
|
||||
"lvl_name" = lvl_name
|
||||
)
|
||||
if (exp && xp_req_to_level)
|
||||
skilldata["progress_percent"] = (xp_req_to_level-xp_prog_to_level)/xp_req_to_level
|
||||
skilldata["overall_percent"] = exp / SKILL_EXP_LIST[length(SKILL_EXP_LIST)]
|
||||
if (lvl_num >= length(SKILL_EXP_LIST) && !(type in targetmind.skills_rewarded))
|
||||
skilldata["reward"] = TRUE
|
||||
skills[++skills.len] = skilldata
|
||||
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/skill_tracker/proc/find_skilltype(name)
|
||||
for(var/type in GLOB.skill_types)
|
||||
var/datum/skill/skill = GetSkillRef(type)
|
||||
if(skill.name == name)
|
||||
return type
|
||||
|
||||
return null
|
||||
|
||||
/datum/computer_file/program/skill_tracker/ui_act(action, params, datum/tgui/ui)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("PRG_reward")
|
||||
var/skill_type = find_skilltype(params["skill"])
|
||||
if(skill_type)
|
||||
var/datum/skill/skill = GetSkillRef(skill_type)
|
||||
var/datum/mind/mind = ui.user.mind
|
||||
var/new_level = mind.get_skill_level(skill_type)
|
||||
skill.try_skill_reward(mind, new_level)
|
||||
return TRUE
|
||||
@@ -3289,6 +3289,7 @@
|
||||
#include "code\modules\modular_computers\file_system\programs\robotact.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\secureye.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\signaler.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\skill_tracker.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\sm_monitor.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\techweb.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\antagonist\contract_uplink.dm"
|
||||
|
||||
87
tgui/packages/tgui/interfaces/NtosSkillTracker.js
Normal file
87
tgui/packages/tgui/interfaces/NtosSkillTracker.js
Normal file
@@ -0,0 +1,87 @@
|
||||
import { useBackend } from '../backend';
|
||||
import { Button, Section, Table, BlockQuote, ProgressBar, AnimatedNumber } from '../components';
|
||||
import { NtosWindow } from '../layouts';
|
||||
|
||||
export const NtosSkillTracker = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
skills = {},
|
||||
} = data;
|
||||
return (
|
||||
<NtosWindow
|
||||
width={500}
|
||||
height={600}>
|
||||
<NtosWindow.Content scrollable>
|
||||
<Section
|
||||
title="Skill Tracker">
|
||||
{skills.map((skill, idx) => (
|
||||
<Section
|
||||
key={idx}
|
||||
level={2}
|
||||
title={skill.name}>
|
||||
<BlockQuote>
|
||||
{skill.desc}
|
||||
</BlockQuote>
|
||||
<Section>
|
||||
<Table>
|
||||
<Table.Row header>
|
||||
<Table.Cell textAlign="center" collapsing>
|
||||
Level
|
||||
</Table.Cell>
|
||||
<Table.Cell textAlign="center">
|
||||
Level Progress
|
||||
</Table.Cell>
|
||||
<Table.Cell textAlign="center">
|
||||
Overall Progress
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
<Table.Row className="candystripe">
|
||||
<Table.Cell textAlign="center" collapsing>
|
||||
{skill.lvl_name}
|
||||
</Table.Cell>
|
||||
<Table.Cell textAlign="center">
|
||||
{skill.progress_percent ? (
|
||||
<ProgressBar
|
||||
value={skill.progress_percent}
|
||||
ranges={{
|
||||
good: [0.75, 1.0],
|
||||
}}>
|
||||
<AnimatedNumber
|
||||
value={Math.round(skill.progress_percent * 100)} />%
|
||||
</ProgressBar>
|
||||
) : ('—')}
|
||||
</Table.Cell>
|
||||
<Table.Cell textAlign="center">
|
||||
{skill.overall_percent ? (
|
||||
<ProgressBar
|
||||
value={skill.overall_percent}
|
||||
ranges={{
|
||||
good: [0.75, 1.0],
|
||||
}}>
|
||||
<AnimatedNumber
|
||||
value={Math.round(skill.overall_percent * 100)} />%
|
||||
</ProgressBar>
|
||||
) : ('—')}
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
{!!skill.reward && (
|
||||
<Table.Row className="candystripe">
|
||||
<Table.Cell textAlign="center" colspan="3">
|
||||
<Button
|
||||
icon="trophy"
|
||||
style={{ margin: '8px' }}
|
||||
onClick={() => act('PRG_reward', { skill: skill.name })}>
|
||||
Contact the Professional {skill.title} Association
|
||||
</Button>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
)}
|
||||
</Table>
|
||||
</Section>
|
||||
</Section>
|
||||
))}
|
||||
</Section>
|
||||
</NtosWindow.Content>
|
||||
</NtosWindow>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user