See PR comment
This commit is contained in:
Kyep
2016-07-30 19:58:04 -07:00
parent 96d3601bfc
commit 8a4dc07f70
13 changed files with 206 additions and 95 deletions
+8 -4
View File
@@ -127,8 +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/use_exp_tracking = 0
var/use_exp_restrictions_heads = 0
var/use_exp_restrictions_other = 0
var/simultaneous_pm_warning_timeout = 100
@@ -245,8 +246,11 @@
if("use_exp_tracking")
config.use_exp_tracking = 1
if("use_exp_restrictions")
config.use_exp_restrictions = 1
if("use_exp_restrictions_heads")
config.use_exp_restrictions_heads = 1
if("use_exp_restrictions_other")
config.use_exp_restrictions_other = 1
if("jobs_have_minimal_access")
config.jobs_have_minimal_access = 1
+7 -1
View File
@@ -67,6 +67,11 @@ var/round_start_time = 0
initialtpass = 1
votetimer()
/datum/controller/gameticker/proc/exptimer()
spawn(600)
update_exp(1,0)
exptimer()
/datum/controller/gameticker/proc/setup()
//Create and announce mode
if(master_mode=="secret")
@@ -228,6 +233,8 @@ var/round_start_time = 0
if(config.sql_enabled)
spawn(3000)
statistic_cycle() // Polls population totals regularly and stores them in an SQL DB
if(config.use_exp_tracking)
exptimer()
votetimer()
@@ -470,7 +477,6 @@ var/round_start_time = 0
if(findtext("[handler]","auto_declare_completion_"))
call(mode, handler)()
update_exp(round(ROUND_TIME / 60))
scoreboard()
karmareminder()
+3 -3
View File
@@ -17,7 +17,7 @@
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_requirements = 600
exp_type = "eng"
equip(var/mob/living/carbon/human/H)
@@ -55,7 +55,7 @@
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_requirements = 180
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
@@ -91,7 +91,7 @@
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_requirements = 180
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
+9 -2
View File
@@ -15,7 +15,7 @@
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_requirements = 600
exp_type = "med"
equip(var/mob/living/carbon/human/H)
@@ -53,6 +53,8 @@
minimal_access = list(access_medical, access_morgue, access_surgery, access_maint_tunnels)
alt_titles = list("Surgeon","Nurse","Coroner")
minimal_player_age = 3
exp_requirements = 60
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
@@ -116,7 +118,8 @@
minimal_access = list(access_medical, access_chemistry, access_maint_tunnels, access_mineral_storeroom)
alt_titles = list("Pharmacist","Pharmacologist")
minimal_player_age = 7
exp_requirements = 180
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
@@ -148,6 +151,8 @@
access = list(access_medical, access_morgue, access_surgery, access_chemistry, access_virology, access_genetics, access_research, access_mineral_storeroom)
minimal_access = list(access_medical, access_morgue, access_genetics, access_research, access_maint_tunnels)
minimal_player_age = 3
exp_requirements = 60
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
@@ -178,6 +183,8 @@
minimal_access = list(access_medical, access_virology, access_maint_tunnels, access_mineral_storeroom)
alt_titles = list("Pathologist","Microbiologist")
minimal_player_age = 7
exp_requirements = 180
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
+3 -3
View File
@@ -17,7 +17,7 @@
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_requirements = 600
exp_type = "sci"
// All science-y guys get bonuses for maxing out their tech.
@@ -57,7 +57,7 @@
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_requirements = 60
exp_type = "all"
// All science-y guys get bonuses for maxing out their tech.
@@ -95,7 +95,7 @@
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_requirements = 60
exp_type = "all"
required_objectives=list(
+4 -4
View File
@@ -17,7 +17,7 @@
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_requirements = 600
exp_type = "sec"
equip(var/mob/living/carbon/human/H)
@@ -62,7 +62,7 @@
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_requirements = 300
exp_type = "sec"
equip(var/mob/living/carbon/human/H)
@@ -110,7 +110,7 @@
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_requirements = 300
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
@@ -168,7 +168,7 @@
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_requirements = 300
exp_type = "all"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
+2 -2
View File
@@ -8,7 +8,7 @@
supervisors = "your laws"
req_admin_notify = 1
minimal_player_age = 30
exp_requirements = 240
exp_requirements = 300
exp_type = "sil"
equip(var/mob/living/carbon/human/H)
@@ -28,7 +28,7 @@
supervisors = "your laws and the AI" //Nodrak
selection_color = "#ddffdd"
minimal_player_age = 21
exp_requirements = 120
exp_requirements = 300
exp_type = "all"
alt_titles = list("Android", "Robot")
+4 -2
View File
@@ -12,7 +12,7 @@ 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_requirements = 600
exp_type = "com"
equip(var/mob/living/carbon/human/H)
if(!H) return 0
@@ -61,7 +61,7 @@ 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_requirements = 600
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,
@@ -242,6 +242,8 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1)
minimal_access = list(access_lawyer, access_court, access_sec_doors, access_maint_tunnels)
alt_titles = list("Lawyer","Public Defender")
minimal_player_age = 30
exp_requirements = 300
exp_type = "sec"
idtype = /obj/item/weapon/card/id/security
equip(var/mob/living/carbon/human/H)
+154 -71
View File
@@ -1,17 +1,75 @@
// Player Verbs
/client/verb/check_exp()
set name = "EXP"
set desc = "Shows your EXP status"
set category = "Special Verbs"
//if(!establish_db_connection())
// return 0
var/body = "<html><head><title>EXP for [key]</title></head><BR>"
body += get_exp_report()
body += "</HTML>"
src << browse(body, "window=playerexp;size=550x615")
// Admin Verbs
/client/proc/cmd_mentor_check_player_exp() //Allows mentors / admins to determine who the newer players are.
set category = "Admin"
set name = "Check Player XP"
if(!check_rights(R_MENTOR|R_MOD|R_ADMIN))
return
var/msg = "<html><head><title>EXP Report</title></head><BR>"
for(var/client/C in clients)
var/list/play_records = params2list(C.prefs.exp)
var/gen_exp_time = text2num(play_records["gen"])
gen_exp_time = num2text(round(gen_exp_time / 60)) + "h"
msg += "<BR> - [key_name_admin(C.mob)]: <A href='?_src_=holder;getexpwindow=\ref[C.mob]'>" + C.get_exp_general() + "</a> "
if(msg != "")
src << browse(msg, "window=Player_exp_check")
/client/proc/cmd_show_exp_panel(var/client/C in clients)
if(!check_rights(R_MENTOR|R_MOD|R_ADMIN))
return
var/body = "<html><head><title>EXP for [C.key]</title></head><BR>"
body += C.get_exp_report()
body += "</HTML>"
src << browse(body, "window=playerexp;size=550x615")
// Debug verbs
/client/verb/add_exp()
set name = "EXP Add"
set desc = "DEBUG"
set category = "Debug"
if(!check_rights(R_DEBUG))
return
update_exp(60, 1)
// Procs
/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)
if(!job_is_xp_locked(rank))
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/imm = text2num(play_records["imm"])
if(imm)
return 1
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>"
@@ -19,83 +77,100 @@
else
return 0
/client/verb/check_exp()
set name = "EXP Check"
set desc = "Shows your EXP status"
set category = "EXP"
if(!establish_db_connection())
/proc/job_is_xp_locked(jobtitle)
if(!config.use_exp_restrictions_heads && ((jobtitle in command_positions) || jobtitle == "AI"))
return 0
var/exp_text = get_exp_text(src)
to_chat(src,exp_text)
if(!config.use_exp_restrictions_other && !((jobtitle in command_positions) || jobtitle == "AI"))
return 0
return 1
/client/proc/get_exp_text(var/client/C)
/mob/proc/get_exp_report()
if(client)
return client.get_exp_report()
else
return "[src] has no client."
/client/proc/get_exp_report()
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"]
//to_chat(src,"MARK 1 [return_text]")
var/list/play_records = params2list(prefs.exp)
var/exp_gen = text2num(play_records["gen"])
var/exp_com = text2num(play_records["com"])
var/exp_sec = text2num(play_records["sec"])
var/exp_sci = text2num(play_records["sci"])
var/exp_eng = text2num(play_records["eng"])
var/exp_med = text2num(play_records["med"])
var/exp_sup = text2num(play_records["sup"])
var/exp_sil = text2num(play_records["sil"])
var/exp_ant = text2num(play_records["ant"])
var/exp_gho = text2num(play_records["gho"])
var/exp_imm = text2num(play_records["imm"])
if(play_records.len)
return_text += "General EXP: [exp_all]"
//to_chat(src,"MARK 2 [return_text]")
if(exp_gen > 0)
return_text += "Experience:<BR>- General: [exp_gen]"
if(exp_com > 0)
return_text += "<BR>Command EXP: [exp_com]"
return_text += "<BR>- Command: [exp_com]"
if(exp_sec > 0)
return_text += "<BR>Security EXP: [exp_sec]"
return_text += "<BR>- Security: [exp_sec]"
if(exp_sci > 0)
return_text += "<BR>Science EXP: [exp_sci]"
return_text += "<BR>- Science: [exp_sci]"
if(exp_eng > 0)
return_text += "<BR>Engineering EXP: [exp_eng]"
return_text += "<BR>- Engineering: [exp_eng]"
if(exp_med > 0)
return_text += "<BR>Medical EXP: [exp_med]"
return_text += "<BR>- Medical: [exp_med]"
if(exp_sup > 0)
return_text += "<BR>Support EXP: [exp_sup]"
return_text += "<BR>- Support: [exp_sup]"
if(exp_sil > 0)
return_text += "<BR>Silicon EXP: [exp_sil]"
return_text += "<BR>- Silicon: [exp_sil]"
if(exp_ant > 0)
return_text += "<BR>Antag EXP: [exp_ant]"
return_text += "<BR>- Special: [exp_ant]"
if(exp_gho > 0)
return_text += "<BR>Ghost EXP: [exp_gho]"
return_text += "<BR>Jobs"
return_text += "<BR>- Ghost: [exp_gho]"
if(exp_imm > 0)
return_text += "<BR>- Grandfathered: YES"
//to_chat(src,"MARK 3 [return_text]")
var/list/jobs_locked = list()
var/list/jobs_unlocked = list()
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> "
if(!job_is_xp_locked(job.title))
continue
else if(has_exp_for_job(mob, job.title))
jobs_unlocked += "<BR>- " + job.title
else
return_text += " | <span class='danger'>[job.title]</span> "
return(return_text)
jobs_locked += "<BR>- " + job.title + " (" + play_records[job.exp_type] + " / [job.exp_requirements] [job.exp_type] EXP)"
if(jobs_unlocked.len)
return_text += "<BR><BR>Jobs Unlocked: "
//var/counter = 0
for(var/text in jobs_unlocked)
//if(counter)
// return_text += ","
return_text += text
//counter++
if(jobs_locked.len)
return_text += "<BR><BR>Jobs Not Unlocked: "
//counter = 0
for(var/text in jobs_locked)
//if(counter)
// return_text += ","
return_text += text
//counter++
//to_chat(src,"MARK 4 [return_text]")
return return_text
else
return("[C.mob] has no EXP records.")
return "[src] has no EXP records."
/client/verb/add_exp()
set name = "EXP ADD"
set desc = "DEBUG"
set category = "EXP"
update_exp(25)
/client/proc/get_exp_general()
var/list/play_records = params2list(prefs.exp)
var/exp_gen = text2num(play_records["gen"])
return num2text(round(exp_gen / 60)) + "h"
/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)
/proc/update_exp(var/minutes, var/announce_changes = 0)
if(!establish_db_connection())
return -1
for(var/client/C in clients)
if(C.inactivity < (10 MINUTES))
//var/list/play_records = params2list(C.prefs.exp)
@@ -107,48 +182,56 @@
play_records = params2list(exp_read.item[1])
// -------------
for(var/rtype in list("all","com","sec","sci","eng","med","sup","sil","ant", "gho"))
for(var/rtype in list("gen","com","sec","sci","eng","med","sup","sil","ant", "gho", "imm"))
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!")
play_records["gen"] += minutes
if(announce_changes)
to_chat(C.mob,"<span class='notice'>You got: [minutes] General 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(announce_changes)
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(announce_changes)
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(announce_changes)
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(announce_changes)
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(announce_changes)
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(announce_changes)
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(announce_changes)
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!")
if(announce_changes)
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!")
if(announce_changes)
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()
update_query.Execute()
+1
View File
@@ -43,6 +43,7 @@ var/global/nologevent = 0
if(M.client)
body += " played by <b>[M.client]</b> "
body += "\[<A href='?_src_=holder;editrights=rank;ckey=[M.ckey]'>[M.client.holder ? M.client.holder.rank : "Player"]</A>\]"
body += " XP: <A href='?_src_=holder;getexpwindow=\ref[M]'>" + M.client.get_exp_general() + "</a> "
if(istype(M, /mob/new_player))
body += " <B>Hasn't Entered Game</B> "
+2 -1
View File
@@ -2,7 +2,8 @@
var/list/admin_verbs_default = list(
/client/proc/deadmin_self, /*destroys our own admin datum so we can play as a regular player*/
/client/proc/hide_verbs, /*hides all our adminverbs*/
/client/proc/cmd_mentor_check_new_players
/client/proc/cmd_mentor_check_new_players,
/client/proc/cmd_mentor_check_player_exp
)
var/list/admin_verbs_admin = list(
/client/proc/check_antagonists, /*shows all antags*/
+6
View File
@@ -2016,6 +2016,12 @@
fax_panel(usr)
else if(href_list["getexpwindow"])
if(!check_rights(R_MENTOR|R_MOD|R_ADMIN)) return
var/mob/M = locate(href_list["getexpwindow"])
usr.client.cmd_show_exp_panel(M.client)
else if(href_list["jumpto"])
if(!check_rights(R_ADMIN)) return
+3 -2
View File
@@ -17,9 +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.
## Unhash the first to track playtime in database. Unhash the second to restrict job access based on playtime for head jobs and the AI. Unhash the second to do so for other non-civ jobs. Playtime is based on actual playtime on this server. All of these require database to be enabled.
#USE_EXP_TRACKING
#USE_EXP_RESTRICTIONS
#USE_EXP_RESTRICTIONS_HEADS
#USE_EXP_RESTRICTIONS_OTHER
## 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