Initial Checkin

This commit is contained in:
Kyep
2016-07-28 02:53:57 -07:00
parent 13e7b9d248
commit c3ec34399a
17 changed files with 216 additions and 5 deletions
+1
View File
@@ -250,6 +250,7 @@ CREATE TABLE `player` (
`nanoui_fancy` smallint(4) DEFAULT '1',
`show_ghostitem_attack` smallint(4) DEFAULT '1',
`lastchangelog` varchar(32) NOT NULL,
`exp` mediumtext DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `ckey` (`ckey`)
) ENGINE=InnoDB AUTO_INCREMENT=32446 DEFAULT CHARSET=latin1;
+9
View File
@@ -127,6 +127,9 @@
var/use_age_restriction_for_jobs = 0 //Do jobs use account age restrictions? --requires database
var/use_age_restriction_for_antags = 0 //Do antags use account age restrictions? --requires database
var/use_exp_tracking = 1
var/use_exp_restrictions = 0
var/simultaneous_pm_warning_timeout = 100
var/assistant_maint = 0 //Do assistants get maint access?
@@ -239,6 +242,12 @@
if("use_age_restriction_for_antags")
config.use_age_restriction_for_antags = 1
if("use_exp_tracking")
config.use_exp_tracking = 1
if("use_exp_restrictions")
config.use_exp_restrictions = 1
if("jobs_have_minimal_access")
config.jobs_have_minimal_access = 1
+1
View File
@@ -470,6 +470,7 @@ var/round_start_time = 0
if(findtext("[handler]","auto_declare_completion_"))
call(mode, handler)()
update_exp(round(ROUND_TIME / 60))
scoreboard()
karmareminder()
+6 -3
View File
@@ -17,7 +17,8 @@
access_heads, access_construction, access_sec_doors,
access_ce, access_RC_announce, access_keycard_auth, access_tcomsat, access_minisat, access_mechanic, access_mineral_storeroom)
minimal_player_age = 21
exp_requirements = 240
exp_type = "eng"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
@@ -54,7 +55,8 @@
minimal_access = list(access_eva, access_engine, access_engine_equip, access_tech_storage, access_maint_tunnels, access_external_airlocks, access_construction)
alt_titles = list("Maintenance Technician","Engine Technician","Electrician")
minimal_player_age = 7
exp_requirements = 120
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
H.equip_or_collect(new /obj/item/device/radio/headset/headset_eng(H), slot_l_ear)
@@ -89,7 +91,8 @@
minimal_access = list(access_eva, access_atmospherics, access_maint_tunnels, access_external_airlocks, access_emergency_storage, access_construction)
alt_titles = list("Atmospheric Technician")
minimal_player_age = 7
exp_requirements = 120
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
H.equip_or_collect(new /obj/item/device/radio/headset/headset_eng(H), slot_l_ear)
+3
View File
@@ -41,6 +41,9 @@
//If you have use_age_restriction_for_jobs config option enabled and the database set up, this option will add a requirement for players to be at least minimal_player_age days old. (meaning they first signed in at least that many days before.)
var/minimal_player_age = 0
var/exp_requirements = 0
var/exp_type = ""
var/admin_only = 0
var/spawn_ert = 0
+2
View File
@@ -15,6 +15,8 @@
access_chemistry, access_virology, access_cmo, access_surgery, access_RC_announce,
access_keycard_auth, access_sec_doors, access_psychiatrist, access_maint_tunnels, access_paramedic, access_mineral_storeroom)
minimal_player_age = 21
exp_requirements = 240
exp_type = "med"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
+6
View File
@@ -17,6 +17,8 @@
access_research, access_robotics, access_xenobiology, access_ai_upload,
access_RC_announce, access_keycard_auth, access_tcomsat, access_gateway, access_xenoarch, access_minisat, access_maint_tunnels, access_mineral_storeroom)
minimal_player_age = 21
exp_requirements = 240
exp_type = "sci"
// All science-y guys get bonuses for maxing out their tech.
required_objectives=list(
@@ -55,6 +57,8 @@
minimal_access = list(access_tox, access_tox_storage, access_research, access_xenobiology, access_xenoarch, access_maint_tunnels, access_mineral_storeroom)
alt_titles = list("Xenoarcheologist", "Anomalist", "Plasma Researcher", "Xenobiologist", "Chemical Researcher")
minimal_player_age = 3
exp_requirements = 240
exp_type = "all"
// All science-y guys get bonuses for maxing out their tech.
required_objectives=list(
@@ -91,6 +95,8 @@
minimal_access = list(access_robotics, access_tech_storage, access_morgue, access_research, access_maint_tunnels, access_mineral_storeroom) //As a job that handles so many corpses, it makes sense for them to have morgue access.
alt_titles = list("Biomechanical Engineer","Mechatronic Engineer")
minimal_player_age = 3
exp_requirements = 120
exp_type = "all"
required_objectives=list(
/datum/job_objective/make_cyborg,
+8
View File
@@ -17,6 +17,8 @@
access_research, access_engine, access_mining, access_medical, access_construction, access_mailsorting,
access_heads, access_hos, access_RC_announce, access_keycard_auth, access_gateway, access_pilot, access_weapons)
minimal_player_age = 21
exp_requirements = 240
exp_type = "sec"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
@@ -60,6 +62,8 @@
access = list(access_security, access_sec_doors, access_brig, access_armory, access_court, access_maint_tunnels, access_morgue, access_weapons)
minimal_access = list(access_security, access_sec_doors, access_brig, access_armory, access_court, access_maint_tunnels, access_weapons)
minimal_player_age = 21
exp_requirements = 120
exp_type = "sec"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
@@ -106,6 +110,8 @@
minimal_access = list(access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_court, access_weapons)
alt_titles = list("Forensic Technician")
minimal_player_age = 14
exp_requirements = 120
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
H.equip_or_collect(new /obj/item/device/radio/headset/headset_sec/alt(H), slot_l_ear)
@@ -162,6 +168,8 @@
access = list(access_security, access_sec_doors, access_brig, access_court, access_maint_tunnels, access_morgue, access_weapons)
minimal_access = list(access_security, access_sec_doors, access_brig, access_court, access_maint_tunnels, access_weapons)
minimal_player_age = 14
exp_requirements = 120
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
H.equip_or_collect(new /obj/item/device/radio/headset/headset_sec/alt(H), slot_l_ear)
+5 -1
View File
@@ -8,6 +8,8 @@
supervisors = "your laws"
req_admin_notify = 1
minimal_player_age = 30
exp_requirements = 240
exp_type = "sil"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
@@ -15,7 +17,7 @@
/datum/job/ai/is_position_available()
return (empty_playable_ai_cores.len != 0)
/datum/job/cyborg
title = "Cyborg"
@@ -26,6 +28,8 @@
supervisors = "your laws and the AI" //Nodrak
selection_color = "#ddffdd"
minimal_player_age = 21
exp_requirements = 120
exp_type = "all"
alt_titles = list("Android", "Robot")
equip(var/mob/living/carbon/human/H)
+4
View File
@@ -12,6 +12,8 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1)
access = list() //See get_access()
minimal_access = list() //See get_access()
minimal_player_age = 30
exp_requirements = 240
exp_type = "com"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
H.equip_or_collect(new /obj/item/device/radio/headset/heads/captain/alt(H), slot_l_ear)
@@ -59,6 +61,8 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1)
idtype = /obj/item/weapon/card/id/silver
req_admin_notify = 1
minimal_player_age = 21
exp_requirements = 240
exp_type = "sup"
access = list(access_security, access_sec_doors, access_brig, access_court, access_forensics_lockers,
access_medical, access_engine, access_change_ids, access_ai_upload, access_eva, access_heads,
access_all_personal_lockers, access_maint_tunnels, access_bar, access_janitor, access_construction, access_morgue,
+3
View File
@@ -123,6 +123,9 @@ var/global/datum/controller/occupations/job_master
if(job.admin_only) // No admin positions either.
continue
if(!has_exp_for_job(player, job.title))
continue
if(jobban_isbanned(player, job.title))
Debug("GRJ isbanned failed, Player: [player], Job: [job.title]")
continue
+154
View File
@@ -0,0 +1,154 @@
/proc/has_exp_for_job(mob/M, rank)
var/datum/job/job = job_master.GetJob(rank)
if(!job)
return 1
if(!job.exp_requirements || !job.exp_type)
return 1
if(!config.use_exp_restrictions)
return 1
if(!M.client)
return 0
//if(check_rights(R_ADMIN, 0, M))
// return 1
var/list/play_records = params2list(M.client.prefs.exp)
var/my_exp = text2num(play_records[job.exp_type])
if(my_exp >= text2num(job.exp_requirements))
//return_text += "<BR><span class='notice'>[C.mob] has [my_exp] of the [job.exp_requirements] [job.exp_type] EXP required for [job.title].</span>"
return 1
else
return 0
/client/verb/check_exp()
set name = "EXP Check"
set desc = "Shows your EXP status"
set category = "EXP"
if(!establish_db_connection())
return 0
var/exp_text = get_exp_text(src)
to_chat(src,exp_text)
/client/proc/get_exp_text(var/client/C)
var/return_text = ""
var/list/play_records = params2list(C.prefs.exp)
var/exp_all = text2num(play_records["all"])
var/exp_com = play_records["com"]
var/exp_sec = play_records["sec"]
var/exp_sci = play_records["sci"]
var/exp_eng = play_records["eng"]
var/exp_med = play_records["med"]
var/exp_sup = play_records["sup"]
var/exp_sil = play_records["sil"]
var/exp_ant = play_records["ant"]
var/exp_gho = play_records["gho"]
if(play_records.len)
return_text += "General EXP: [exp_all]"
if(exp_com > 0)
return_text += "<BR>Command EXP: [exp_com]"
if(exp_sec > 0)
return_text += "<BR>Security EXP: [exp_sec]"
if(exp_sci > 0)
return_text += "<BR>Science EXP: [exp_sci]"
if(exp_eng > 0)
return_text += "<BR>Engineering EXP: [exp_eng]"
if(exp_med > 0)
return_text += "<BR>Medical EXP: [exp_med]"
if(exp_sup > 0)
return_text += "<BR>Support EXP: [exp_sup]"
if(exp_sil > 0)
return_text += "<BR>Silicon EXP: [exp_sil]"
if(exp_ant > 0)
return_text += "<BR>Antag EXP: [exp_ant]"
if(exp_gho > 0)
return_text += "<BR>Ghost EXP: [exp_gho]"
return_text += "<BR>Jobs"
for(var/datum/job/job in job_master.occupations)
if(job.exp_requirements && job.exp_type)
if(has_exp_for_job(C.mob, job.title))
return_text += " | <span class='notice'>[job.title]</span> "
else
return_text += " | <span class='danger'>[job.title]</span> "
return(return_text)
else
return("[C.mob] has no EXP records.")
/client/verb/add_exp()
set name = "EXP ADD"
set desc = "DEBUG"
set category = "EXP"
update_exp(25)
/client/proc/cmd_show_exp_panel(var/mob/living/M in mob_list)
set category = "EXP"
set name = "Show EXP Panel"
set desc=""
if(!check_rights(R_ADMIN))
return
if(M.client)
var/body = "<html><head><title>EXP for [M.key]</title></head>"
body += M.client.get_exp_text(M.client)
body += "</HTML>"
usr << browse(body, "window=adminplayerexp;size=550x615")
else
to_chat(usr,"<span class='danger'>Mob [M] has no client.</span>")
/proc/update_exp(var/minutes)
if(!establish_db_connection())
return -1
for(var/client/C in clients)
if(C.inactivity < (10 * 10 * 60))
//var/list/play_records = params2list(C.prefs.exp)
var/DBQuery/exp_read = dbcon.NewQuery("SELECT exp FROM [format_table_name("player")] WHERE ckey='[C.ckey]'")
exp_read.Execute()
var/list/play_records = list()
while(exp_read.NextRow())
play_records = params2list(exp_read.item[1])
// -------------
for(var/rtype in list("all","com","sec","sci","eng","med","sup","sil","ant", "gho"))
if(!text2num(play_records[rtype]))
play_records[rtype] = 0
else
play_records[rtype] = text2num(play_records[rtype])
if(C.mob.stat == CONSCIOUS && C.mob.mind.assigned_role)
play_records["all"] += minutes
to_chat(C.mob,"<span class='notice'>You got: [minutes] EXP!")
if(C.mob.mind.assigned_role in command_positions)
play_records["com"] += minutes
to_chat(C.mob,"<span class='notice'>You got: [minutes] Command EXP!")
if(C.mob.mind.assigned_role in security_positions)
play_records["sec"] += minutes
to_chat(C.mob,"<span class='notice'>You got: [minutes] Security EXP!")
if(C.mob.mind.assigned_role in science_positions)
play_records["sci"] += minutes
to_chat(C.mob,"<span class='notice'>You got: [minutes] Science EXP!")
if(C.mob.mind.assigned_role in engineering_positions)
play_records["eng"] += minutes
to_chat(C.mob,"<span class='notice'>You got: [minutes] Engineering EXP!")
if(C.mob.mind.assigned_role in medical_positions)
play_records["med"] += minutes
to_chat(C.mob,"<span class='notice'>You got: [minutes] Medical EXP!")
if(C.mob.mind.assigned_role in support_positions)
play_records["sup"] += minutes
to_chat(C.mob,"<span class='notice'>You got: [minutes] Support EXP!")
if(C.mob.mind.assigned_role in nonhuman_positions)
play_records["sil"] += minutes
to_chat(C.mob,"<span class='notice'>You got: [minutes] Silicon EXP!")
if(C.mob.mind.special_role)
play_records["ant"] += minutes
to_chat(C.mob,"<span class='notice'>You got: [minutes] Special EXP!")
else if(isobserver(C.mob))
play_records["gho"] += minutes
to_chat(C.mob,"<span class='notice'>You got: [minutes] Ghost EXP!")
else
return
var/new_exp = list2params(play_records)
C.prefs.exp = new_exp
new_exp = sanitizeSQL(new_exp)
var/DBQuery/update_query = dbcon.NewQuery("UPDATE [format_table_name("player")] SET exp = '[new_exp]' WHERE ckey='[C.ckey]'")
update_query.Execute()
@@ -84,6 +84,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
//game-preferences
var/lastchangelog = "" //Saved changlog filesize to detect if there was a change
var/exp
var/ooccolor = "#b82e00"
var/be_special = list() //Special role selection
var/UI_style = "Midnight"
@@ -551,6 +552,9 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
if(jobban_isbanned(user, rank))
HTML += "<del>[rank]</del></td><td><b> \[BANNED]</b></td></tr>"
continue
if(!has_exp_for_job(user, job.title))
HTML += "<del>[rank]</del></td><td> \[TIME]</td></tr>"
continue
if(!job.player_old_enough(user.client))
var/available_in_days = job.available_in_days(user.client)
HTML += "<del>[rank]</del></td><td> \[IN [(available_in_days)] DAYS]</td></tr>"
@@ -13,7 +13,8 @@
volume,
nanoui_fancy,
show_ghostitem_attack,
lastchangelog
lastchangelog,
exp
FROM [format_table_name("player")]
WHERE ckey='[C.ckey]'"}
)
@@ -40,6 +41,7 @@
nanoui_fancy = text2num(query.item[11])
show_ghostitem_attack = text2num(query.item[12])
lastchangelog = query.item[13]
exp = query.item[14]
//Sanitize
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
@@ -54,6 +56,7 @@
nanoui_fancy = sanitize_integer(nanoui_fancy, 0, 1, initial(nanoui_fancy))
show_ghostitem_attack = sanitize_integer(show_ghostitem_attack, 0, 1, initial(show_ghostitem_attack))
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
exp = sanitize_text(exp, initial(exp))
return 1
/datum/preferences/proc/save_preferences(client/C)
@@ -246,6 +246,7 @@
if(!is_job_whitelisted(src, rank)) return 0
if(!job.player_old_enough(src.client)) return 0
if(job.admin_only && !(check_rights(R_EVENT, 0))) return 0
if(!has_exp_for_job(src, rank)) return 0
if(config.assistantlimit)
if(job.title == "Civilian")
+4
View File
@@ -17,6 +17,10 @@ JOBS_HAVE_MINIMAL_ACCESS
## you have noone older than 0 days, since noone has been logged yet. Only turn this on once you have had the database up for 30 days.
#USE_AGE_RESTRICTION_FOR_JOBS
## Unhash the first to track playtime in database. Unhash the second to restrict job access based on playtime. Note: playtime is not account age, it is actual playtime on the server. Some jobs (e.g: head jobs) require playtime in their department to unlock.
#USE_EXP_TRACKING
#USE_EXP_RESTRICTIONS
## Unhash this entry to have certain antagonist roles require your account to be at least a certain number of days old to select. You can configure the exact age requirement for different antag roles by editing special_role_times in /code/modules/client/preferences.dm.
## See USE_AGE_RESTRICTION_FOR_JOBS for more information
#USE_AGE_RESTRICTION_FOR_ANTAGS
+1
View File
@@ -477,6 +477,7 @@
#include "code\game\gamemodes\xenos\xenos.dm"
#include "code\game\jobs\access.dm"
#include "code\game\jobs\job_controller.dm"
#include "code\game\jobs\job_exp.dm"
#include "code\game\jobs\job_objective.dm"
#include "code\game\jobs\jobs.dm"
#include "code\game\jobs\whitelist.dm"