/
preferences.dm
1655 lines (1416 loc) · 60.7 KB
/
preferences.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
var/list/preferences_datums = list()
var/global/list/special_roles = list( //keep synced with the defines BE_* in setup.dm. THE ORDER MATTERS
//some autodetection here.
"traitor" = IS_MODE_COMPILED("traitor"), // 1 / 1
"operative" = IS_MODE_COMPILED("nuclear"), // 2 / 2
"changeling" = IS_MODE_COMPILED("changeling"), // 4 / 3
"wizard" = IS_MODE_COMPILED("wizard"), // 8 / 4
"malf AI" = IS_MODE_COMPILED("malfunction"), // 16 / 5
"revolutionary" = IS_MODE_COMPILED("revolution"), // 32 / 6
"alien" = 1, // 62 / 7
"pAI" = 1, // 128 / 8
"cultist" = IS_MODE_COMPILED("cult"), // 256 / 9
"ninja" = 1, // 512 / 10
"raider" = IS_MODE_COMPILED("heist"), // 1024 / 11
"vampire" = IS_MODE_COMPILED("vampire"), // 2048 / 12
"mutineer" = IS_MODE_COMPILED("mutiny"), // 4096 / 13
"blob" = IS_MODE_COMPILED("blob"), // 8192 / 14
"shadowling" = IS_MODE_COMPILED("shadowling"), //16384 / 15
"revenant" = 1 //32768 / 16
)
var/global/list/special_role_times = list( //minimum age (in days) for accounts to play these roles
num2text(BE_PAI) = 0,
num2text(BE_TRAITOR) = 7,
num2text(BE_CHANGELING) = 14,
num2text(BE_SHADOWLING) = 14,
num2text(BE_WIZARD) = 14,
num2text(BE_REV) = 14,
num2text(BE_VAMPIRE) = 14,
num2text(BE_BLOB) = 14,
num2text(BE_REVENANT) = 14,
num2text(BE_OPERATIVE) = 21,
num2text(BE_CULTIST) = 21,
num2text(BE_RAIDER) = 21,
num2text(BE_ALIEN) = 21,
num2text(BE_NINJA) = 21,
num2text(BE_MUTINEER) = 21,
num2text(BE_MALF) = 30,
)
/proc/player_old_enough_antag(client/C, role)
if(available_in_days_antag(C, role) == 0)
return 1 //Available in 0 days = available right now = player is old enough to play.
return 0
/proc/available_in_days_antag(client/C, role)
if(!C)
return 0
if(!role)
return 0
if(!config.use_age_restriction_for_antags)
return 0
if(!isnum(C.player_age))
return 0 //This is only a number if the db connection is established, otherwise it is text: "Requires database", meaning these restrictions cannot be enforced
var/minimal_player_age_antag = special_role_times[num2text(role)]
if(!isnum(minimal_player_age_antag))
return 0
return max(0, minimal_player_age_antag - C.player_age)
/proc/check_client_age(client/C, var/days) // If days isn't provided, returns the age of the client. If it is provided, it returns the days until the player_age is equal to or greater than the days variable
if(!days)
return C.player_age
else
return max(0, days - C.player_age)
return 0
//used for alternate_option
#define GET_RANDOM_JOB 0
#define BE_CIVILIAN 1
#define RETURN_TO_LOBBY 2
#define MAX_SAVE_SLOTS 10 // Save slots for regular players
#define MAX_SAVE_SLOTS_MEMBER 10 // Save slots for BYOND members
datum/preferences
//doohickeys for savefiles
// var/path
var/default_slot = 1 //Holder so it doesn't default to slot 1, rather the last one used
// var/savefile_version = 0
var/max_save_slots = MAX_SAVE_SLOTS
//non-preference stuff
var/warns = 0
var/muted = 0
var/last_ip
var/last_id
//game-preferences
// var/lastchangelog = "" //Saved changlog filesize to detect if there was a change
var/ooccolor = "#b82e00"
var/be_special = 0 //Special role selection
var/UI_style = "Midnight"
var/toggles = TOGGLES_DEFAULT
var/sound = SOUND_DEFAULT
var/UI_style_color = "#ffffff"
var/UI_style_alpha = 255
//character preferences
var/real_name //our character's name
var/be_random_name = 0 //whether we are a random name every round
var/gender = MALE //gender of character (well duh)
var/age = 30 //age of character
var/spawnpoint = "Arrivals Shuttle" //where this character will spawn (0-2).
var/b_type = "A+" //blood type (not-chooseable)
var/underwear = "Nude" //underwear type
var/undershirt = "Nude" //undershirt type
var/socks = "Nude" //socks type
var/backbag = 2 //backpack type
var/h_style = "Bald" //Hair type
var/r_hair = 0 //Hair color
var/g_hair = 0 //Hair color
var/b_hair = 0 //Hair color
var/f_style = "Shaved" //Face hair type
var/r_facial = 0 //Face hair color
var/g_facial = 0 //Face hair color
var/b_facial = 0 //Face hair color
var/s_tone = 0 //Skin tone
var/r_skin = 0 //Skin color
var/g_skin = 0 //Skin color
var/b_skin = 0 //Skin color
var/r_eyes = 0 //Eye color
var/g_eyes = 0 //Eye color
var/b_eyes = 0 //Eye color
var/species = "Human"
var/language = "None" //Secondary language
var/body_accessory = null
var/speciesprefs = 0//I hate having to do this, I really do (Using this for oldvox code, making names universal I guess
//Mob preview
var/icon/preview_icon = null
var/icon/preview_icon_front = null
var/icon/preview_icon_side = null
//Jobs, uses bitflags
var/job_support_high = 0
var/job_support_med = 0
var/job_support_low = 0
var/job_medsci_high = 0
var/job_medsci_med = 0
var/job_medsci_low = 0
var/job_engsec_high = 0
var/job_engsec_med = 0
var/job_engsec_low = 0
var/job_karma_high = 0
var/job_karma_med = 0
var/job_karma_low = 0
//Keeps track of preferrence for not getting any wanted jobs
var/alternate_option = 0
// maps each organ to either null(intact), "cyborg" or "amputated"
// will probably not be able to do this for head and torso ;)
var/list/organ_data = list()
var/list/rlimb_data = list()
var/list/player_alt_titles = new() // the default name of a job like "Medical Doctor"
// var/accent = "en-us"
// var/voice = "m1"
// var/pitch = 50
// var/talkspeed = 175
var/flavor_text = ""
var/med_record = ""
var/sec_record = ""
var/gen_record = ""
var/disabilities = 0
var/nanotrasen_relation = "Neutral"
// 0 = character settings, 1 = game preferences
var/current_tab = 0
// OOC Metadata:
var/metadata = ""
var/slot_name = ""
// Whether or not to use randomized character slots
var/randomslot = 0
// jukebox volume
var/volume = 100
// BYOND membership
var/unlock_content = 0
/datum/preferences/New(client/C)
b_type = pick(4;"O-", 36;"O+", 3;"A-", 28;"A+", 1;"B-", 20;"B+", 1;"AB-", 5;"AB+")
if(istype(C))
if(!IsGuestKey(C.key))
unlock_content = C.IsByondMember()
if(unlock_content)
max_save_slots = MAX_SAVE_SLOTS_MEMBER
var/loaded_preferences_successfully = load_preferences(C)
if(loaded_preferences_successfully)
if(load_character(C))
return
//we couldn't load character data so just randomize the character appearance + name
random_character() //let's create a random character then - rather than a fat, bald and naked man.
real_name = random_name(gender)
if(!loaded_preferences_successfully)
save_preferences(C)
save_character(C) //let's save this new random character so it doesn't keep generating new ones.
/datum/preferences
proc/ShowChoices(mob/user)
if(!user || !user.client) return
update_preview_icon()
user << browse_rsc(preview_icon_front, "previewicon.png")
user << browse_rsc(preview_icon_side, "previewicon2.png")
var/dat = "<html><body><center>"
dat += "<a href='?_src_=prefs;preference=tab;tab=0' [current_tab == 0 ? "class='linkOn'" : ""]>Character Settings</a>"
dat += "<a href='?_src_=prefs;preference=tab;tab=1' [current_tab == 1 ? "class='linkOn'" : ""]>Game Preferences</a>"
dat += "</center>"
dat += "<HR>"
switch(current_tab)
if (0) // Character Settings#
dat += "<center>"
dat += "Slot <b>[slot_name]</b> - "
dat += "<a href=\"byond://?src=\ref[user];preference=open_load_dialog\">Load slot</a> - "
dat += "<a href=\"byond://?src=\ref[user];preference=save\">Save slot</a> - "
dat += "<a href=\"byond://?src=\ref[user];preference=reload\">Reload slot</a>"
dat += "</center>"
dat += "<center><h2>Occupation Choices</h2>"
dat += "<a href='?_src_=prefs;preference=job;task=menu'>Set Occupation Preferences</a><br></center>"
dat += "<h2>Identity</h2>"
dat += "<table width='100%'><tr><td width='75%' valign='top'>"
if(appearance_isbanned(user))
dat += "<b>You are banned from using custom names and appearances. You can continue to adjust your characters, but you will be randomised once you join the game.</b><br>"
dat += "<b>Name:</b> "
dat += "<a href='?_src_=prefs;preference=name;task=input'><b>[real_name]</b></a><br>"
dat += "(<a href='?_src_=prefs;preference=name;task=random'>Random Name</A>) "
dat += "(<a href='?_src_=prefs;preference=name'>Always Random Name: [be_random_name ? "Yes" : "No"]</a>)"
dat += "<br>"
dat += "<b>Gender:</b> <a href='?_src_=prefs;preference=gender'><b>[gender == MALE ? "Male" : "Female"]</b></a><br>"
dat += "<b>Age:</b> <a href='?_src_=prefs;preference=age;task=input'>[age]</a>"
//dat += "<b>Spawn Point</b>: <a href='byond://?src=\ref[user];preference=spawnpoint;task=input'>[spawnpoint]</a>"
dat += "<br><table><tr><td><b>Body</b> "
dat += "(<a href='?_src_=prefs;preference=all;task=random'>®</A>)"
dat += "<br>"
dat += "Species: <a href='?_src_=prefs;preference=species;task=input'>[species]</a><br>"
if(species == "Vox")//oldvox code, sucks I know
dat += "N2 Tank: <a href='?_src_=prefs;preference=speciesprefs;task=input'>[speciesprefs ? "Large N2 Tank" : "Specialized N2 Tank"]</a><br>"
dat += "Secondary Language:<br><a href='?_src_=prefs;preference=language;task=input'>[language]</a><br>"
dat += "Blood Type: <a href='?_src_=prefs;preference=b_type;task=input'>[b_type]</a><br>"
if(species == "Human")
dat += "Skin Tone: <a href='?_src_=prefs;preference=s_tone;task=input'>[-s_tone + 35]/220</a><br>"
// dat += "Skin pattern: <a href='byond://?src=\ref[user];preference=skin_style;task=input'>Adjust</a><br>"
dat += "<br><b>Handicaps</b><br>"
dat += "\t<a href='?_src_=prefs;preference=disabilities'><b>\[Set Disabilities\]</b></a><br>"
dat += "Limbs: <a href='?_src_=prefs;preference=limbs;task=input'>Adjust</a><br>"
if(species != "Slime People" && species != "Machine")
dat += "Internal Organs: <a href='?_src_=prefs;preference=organs;task=input'>Adjust</a><br>"
//display limbs below
var/ind = 0
for(var/name in organ_data)
//world << "[ind] \ [organ_data.len]"
var/status = organ_data[name]
var/organ_name = null
switch(name)
if("l_arm")
organ_name = "left arm"
if("r_arm")
organ_name = "right arm"
if("l_leg")
organ_name = "left leg"
if("r_leg")
organ_name = "right leg"
if("l_foot")
organ_name = "left foot"
if("r_foot")
organ_name = "right foot"
if("l_hand")
organ_name = "left hand"
if("r_hand")
organ_name = "right hand"
if("heart")
organ_name = "heart"
if("eyes")
organ_name = "eyes"
if(status == "cyborg")
++ind
if(ind > 1)
dat += ", "
var/datum/robolimb/R
if(rlimb_data[name] && all_robolimbs[rlimb_data[name]])
R = all_robolimbs[rlimb_data[name]]
else
R = basic_robolimb
dat += "\t[R.company] [organ_name] prothesis"
else if(status == "amputated")
++ind
if(ind > 1)
dat += ", "
dat += "\tAmputated [organ_name]"
else if(status == "mechanical")
++ind
if(ind > 1)
dat += ", "
dat += "\tMechanical [organ_name]"
else if(status == "assisted")
++ind
if(ind > 1)
dat += ", "
switch(organ_name)
if("heart")
dat += "\tPacemaker-assisted [organ_name]"
if("voicebox") //on adding voiceboxes for speaking skrell/similar replacements
dat += "\tSurgically altered [organ_name]"
if("eyes")
dat += "\tRetinal overlayed [organ_name]"
else
dat += "\tMechanically assisted [organ_name]"
if(!ind)
dat += "\[...\]<br><br>"
else
dat += "<br><br>"
dat += "<b>Underwear:</b><BR><a href ='?_src_=prefs;preference=underwear;task=input'>[underwear]</a><BR>"
dat += "<b>Undershirt:</b><BR><a href ='?_src_=prefs;preference=undershirt;task=input'>[undershirt]</a><BR>"
dat += "<b>Socks:</b><BR><a href ='?_src_=prefs;preference=socks;task=input'>[socks]</a><BR>"
dat += "Backpack Type:<br><a href ='?_src_=prefs;preference=bag;task=input'><b>[backbaglist[backbag]]</b></a><br>"
dat += "Nanotrasen Relation:<br><a href ='?_src_=prefs;preference=nt_relation;task=input'><b>[nanotrasen_relation]</b></a><br>"
dat += "</td><td><b>Preview</b><br><img src=previewicon.png height=64 width=64><img src=previewicon2.png height=64 width=64></td></tr></table>"
dat += "</td><td width='300px' height='300px'>"
if(jobban_isbanned(user, "Records"))
dat += "<b>You are banned from using character records.</b><br>"
else
dat += "<b><a href=\"byond://?src=\ref[user];preference=records;record=1\">Character Records</a></b><br>"
dat += "<a href='byond://?src=\ref[user];preference=flavor_text;task=input'><b>Set Flavor Text</b></a><br>"
if(lentext(flavor_text) <= 40)
if(!lentext(flavor_text))
dat += "\[...\]"
else
dat += "[flavor_text]"
else
dat += "[TextPreview(flavor_text)]...<br>"
dat += "<br>"
var/hairname = "Hair"
if(species == "Machine")
hairname = "Frame Color"
dat += "<br><b>[hairname]</b><br>"
dat += "<a href='?_src_=prefs;preference=hair;task=input'>Change Color</a> <font face='fixedsys' size='3' color='#[num2hex(r_hair, 2)][num2hex(g_hair, 2)][num2hex(b_hair, 2)]'><table style='display:inline;' bgcolor='#[num2hex(r_hair, 2)][num2hex(g_hair, 2)][num2hex(b_hair)]'><tr><td>__</td></tr></table></font> "
dat += " <br>Style: <a href='?_src_=prefs;preference=h_style;task=input'>[h_style]</a><br>"
dat += "<br><b>Facial</b><br>"
dat += "<a href='?_src_=prefs;preference=facial;task=input'>Change Color</a> <font face='fixedsys' size='3' color='#[num2hex(r_facial, 2)][num2hex(g_facial, 2)][num2hex(b_facial, 2)]'><table style='display:inline;' bgcolor='#[num2hex(r_facial, 2)][num2hex(g_facial, 2)][num2hex(b_facial)]'><tr><td>__</td></tr></table></font> "
dat += " <br>Style: <a href='?_src_=prefs;preference=f_style;task=input'>[f_style]</a><br>"
dat += "<br><b>Eyes</b><br>"
dat += "<a href='?_src_=prefs;preference=eyes;task=input'>Change Color</a> <font face='fixedsys' size='3' color='#[num2hex(r_eyes, 2)][num2hex(g_eyes, 2)][num2hex(b_eyes, 2)]'><table style='display:inline;' bgcolor='#[num2hex(r_eyes, 2)][num2hex(g_eyes, 2)][num2hex(b_eyes)]'><tr><td>__</td></tr></table></font><br>"
if((species in list("Unathi", "Tajaran", "Skrell", "Slime People", "Vulpkanin", "Machine")) || body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user)) //admins can always fuck with this, because they are admins
dat += "<br><b>Body Color</b><br>"
dat += "<a href='?_src_=prefs;preference=skin;task=input'>Change Color</a> <font face='fixedsys' size='3' color='#[num2hex(r_skin, 2)][num2hex(g_skin, 2)][num2hex(b_skin, 2)]'><table style='display:inline;' bgcolor='#[num2hex(r_skin, 2)][num2hex(g_skin, 2)][num2hex(b_skin)]'><tr><td>__</td></tr></table></font>"
if(body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user))
dat += "<br><b>Body Accessory</b><br>"
dat += "Accessory: <a href='?_src_=prefs;preference=body_accessory;task=input'>[body_accessory ? "[body_accessory]" : "None"]</a><br>"
dat += "</td></tr></table><hr><center>"
if (1) // General Preferences
dat += "<table><tr><td width='340px' height='300px' valign='top'>"
dat += "<h2>General Settings</h2>"
dat += "<b>UI Style:</b> <a href='?_src_=prefs;preference=ui'><b>[UI_style]</b></a><br>"
dat += "<b>Custom UI settings:</b><br>"
dat += "<b>Color:</b> <a href='?_src_=prefs;preference=UIcolor'><b>[UI_style_color]</b></a> <table style='display:inline;' bgcolor='[UI_style_color]'><tr><td>__</td></tr></table><br>"
dat += "<b>Alpha (transparency):</b> <a href='?_src_=prefs;preference=UIalpha'><b>[UI_style_alpha]</b></a><br>"
dat += "<b>Play admin midis:</b> <a href='?_src_=prefs;preference=hear_midis'><b>[(sound & SOUND_MIDI) ? "Yes" : "No"]</b></a><br>"
dat += "<b>Play lobby music:</b> <a href='?_src_=prefs;preference=lobby_music'><b>[(sound & SOUND_LOBBY) ? "Yes" : "No"]</b></a><br>"
dat += "<b>Randomized character slot:</b> <a href='?_src_=prefs;preference=randomslot'><b>[randomslot ? "Yes" : "No"]</b></a><br>"
dat += "<b>Ghost ears:</b> <a href='?_src_=prefs;preference=ghost_ears'><b>[(toggles & CHAT_GHOSTEARS) ? "Nearest Creatures" : "All Speech"]</b></a><br>"
dat += "<b>Ghost sight:</b> <a href='?_src_=prefs;preference=ghost_sight'><b>[(toggles & CHAT_GHOSTSIGHT) ? "Nearest Creatures" : "All Emotes"]</b></a><br>"
dat += "<b>Ghost radio:</b> <a href='?_src_=prefs;preference=ghost_radio'><b>[(toggles & CHAT_GHOSTRADIO) ? "Nearest Speakers" : "All Chatter"]</b></a><br>"
if(config.allow_Metadata)
dat += "<b>OOC notes:</b> <a href='?_src_=prefs;preference=metadata;task=input'><b>Edit</b></a><br>"
if(user.client)
if(user.client.holder)
dat += "<b>Adminhelp sound:</b> "
dat += "<a href='?_src_=prefs;preference=hear_adminhelps'><b>[(sound & SOUND_ADMINHELP)?"On":"Off"]</b></a><br>"
if(check_rights(R_ADMIN,0))
dat += "<b>OOC:</b> <span style='border: 1px solid #161616; background-color: [ooccolor ? ooccolor : normal_ooc_colour];'> </span> <a href='?_src_=prefs;preference=ooccolor;task=input'><b>Change</b></a><br>"
if(unlock_content)
dat += "<b>BYOND Membership Publicity:</b> <a href='?_src_=prefs;preference=publicity'><b>[(toggles & MEMBER_PUBLIC) ? "Public" : "Hidden"]</b></a><br>"
dat += "</td><td width='300px' height='300px' valign='top'>"
dat += "<h2>Special Role Settings</h2>"
// dat += "<br><br>"
if(jobban_isbanned(user, "Syndicate"))
dat += "<b>You are banned from special roles.</b>"
src.be_special = 0
else
var/n = 0
for (var/i in special_roles)
if(special_roles[i]) //if mode is available on the server
var/special_role_flag = be_special_flags[i]
if(jobban_isbanned(user, i))
dat += "<b>Be [i]:</b> <font color=red><b> \[BANNED]</b></font><br>"
else if(!player_old_enough_antag(user.client,special_role_flag))
var/available_in_days_antag = available_in_days_antag(user.client,special_role_flag)
dat += "<b>Be [i]:</b> <font color=red><b> \[IN [(available_in_days_antag)] DAYS]</b></font><br>"
else
dat += "<b>Be [i]:</b> <a href='?_src_=prefs;preference=be_special;num=[n]'><b>[src.be_special&(1<<n) ? "Yes" : "No"]</b></a><br>"
n++
dat += "</td></tr></table><hr><center>"
if(!IsGuestKey(user.key))
dat += "<a href='?_src_=prefs;preference=load'>Undo</a> - "
dat += "<a href='?_src_=prefs;preference=save'>Save Setup</a> - "
dat += "<a href='?_src_=prefs;preference=reset_all'>Reset Setup</a>"
dat += "</center></body></html>"
// user << browse(dat, "window=preferences;size=560x580")
var/datum/browser/popup = new(user, "preferences", "<div align='center'>Character Setup</div>", 640, 810)
popup.set_content(dat)
popup.open(0)
proc/SetChoices(mob/user, limit = 12, list/splitJobs = list("Civilian","Research Director","AI","Bartender"), width = 760, height = 790)
if(!job_master)
return
//limit - The amount of jobs allowed per column. Defaults to 17 to make it look nice.
//splitJobs - Allows you split the table by job. You can make different tables for each department by including their heads. Defaults to CE to make it look nice.
//width - Screen' width. Defaults to 550 to make it look nice.
//height - Screen's height. Defaults to 500 to make it look nice.
var/HTML = "<body>"
HTML += "<tt><center>"
HTML += "<b>Choose occupation chances</b><br>Unavailable occupations are crossed out.<br><br>"
HTML += "<center><a href='?_src_=prefs;preference=job;task=close'>\[Done\]</a></center><br>" // Easier to press up here.
HTML += "<div align='center'>Left-click to raise an occupation preference, right-click to lower it.<br></div>"
HTML += "<script type='text/javascript'>function setJobPrefRedirect(level, rank) { window.location.href='?_src_=prefs;preference=job;task=setJobLevel;level=' + level + ';text=' + encodeURIComponent(rank); return false; }</script>"
HTML += "<table width='100%' cellpadding='1' cellspacing='0'><tr><td width='20%'>" // Table within a table for alignment, also allows you to easily add more colomns.
HTML += "<table width='100%' cellpadding='1' cellspacing='0'>"
var/index = -1
//The job before the current job. I only use this to get the previous jobs color when I'm filling in blank rows.
var/datum/job/lastJob
if (!job_master) return
for(var/datum/job/job in job_master.occupations)
index += 1
if((index >= limit) || (job.title in splitJobs))
if((index < limit) && (lastJob != null))
//If the cells were broken up by a job in the splitJob list then it will fill in the rest of the cells with
//the last job's selection color. Creating a rather nice effect.
for(var/i = 0, i < (limit - index), i += 1)
HTML += "<tr bgcolor='[lastJob.selection_color]'><td width='60%' align='right'> </td><td> </td></tr>"
HTML += "</table></td><td width='20%'><table width='100%' cellpadding='1' cellspacing='0'>"
index = 0
HTML += "<tr bgcolor='[job.selection_color]'><td width='60%' align='right'>"
var/rank = job.title
lastJob = job
if(!is_job_whitelisted(user, rank))
HTML += "<font color=red>[rank]</font></td><td><font color=red><b> \[KARMA]</b></font></td></tr>"
continue
if(jobban_isbanned(user, rank))
HTML += "<del>[rank]</del></td><td><b> \[BANNED]</b></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>"
continue
if((job_support_low & CIVILIAN) && (rank != "Civilian"))
HTML += "<font color=orange>[rank]</font></td><td></td></tr>"
continue
if((rank in command_positions) || (rank == "AI"))//Bold head jobs
HTML += "<b><span class='dark'>[rank]</span></b>"
else
HTML += "<span class='dark'>[rank]</span>"
HTML += "</td><td width='40%'>"
var/prefLevelLabel = "ERROR"
var/prefLevelColor = "pink"
var/prefUpperLevel = -1 // level to assign on left click
var/prefLowerLevel = -1 // level to assign on right click
if(GetJobDepartment(job, 1) & job.flag)
prefLevelLabel = "High"
prefLevelColor = "slateblue"
prefUpperLevel = 4
prefLowerLevel = 2
else if(GetJobDepartment(job, 2) & job.flag)
prefLevelLabel = "Medium"
prefLevelColor = "green"
prefUpperLevel = 1
prefLowerLevel = 3
else if(GetJobDepartment(job, 3) & job.flag)
prefLevelLabel = "Low"
prefLevelColor = "orange"
prefUpperLevel = 2
prefLowerLevel = 4
else
prefLevelLabel = "NEVER"
prefLevelColor = "red"
prefUpperLevel = 3
prefLowerLevel = 1
HTML += "<a class='white' href='?_src_=prefs;preference=job;task=setJobLevel;level=[prefUpperLevel];text=[rank]' oncontextmenu='javascript:return setJobPrefRedirect([prefLowerLevel], \"[rank]\");'>"
// HTML += "<a href='?_src_=prefs;preference=job;task=input;text=[rank]'>"
if(rank == "Civilian")//Civilian is special
if(job_support_low & CIVILIAN)
HTML += " <font color=green>\[Yes]</font></a>"
else
HTML += " <font color=red>\[No]</font></a>"
if(job.alt_titles)
HTML += "<br><b><a class='white' href=\"byond://?src=\ref[user];preference=job;task=alt_title;job=\ref[job]\">\[[GetPlayerAltTitle(job)]\]</a></b></td></tr>"
HTML += "</td></tr>"
continue
/*
if(GetJobDepartment(job, 1) & job.flag)
HTML += " <font color=blue>\[High]</font>"
else if(GetJobDepartment(job, 2) & job.flag)
HTML += " <font color=green>\[Medium]</font>"
else if(GetJobDepartment(job, 3) & job.flag)
HTML += " <font color=orange>\[Low]</font>"
else
HTML += " <font color=red>\[NEVER]</font>"
*/
HTML += "<font color=[prefLevelColor]>[prefLevelLabel]</font></a>"
if(job.alt_titles)
HTML += "<br><b><a class='white' href=\"byond://?src=\ref[user];preference=job;task=alt_title;job=\ref[job]\">\[[GetPlayerAltTitle(job)]\]</a></b></td></tr>"
HTML += "</td></tr>"
for(var/i = 1, i < (limit - index), i += 1) // Finish the column so it is even
HTML += "<tr bgcolor='[lastJob.selection_color]'><td width='60%' align='right'> </td><td> </td></tr>"
HTML += "</td'></tr></table>"
HTML += "</center></table>"
switch(alternate_option)
if(GET_RANDOM_JOB)
HTML += "<center><br><u><a href='?_src_=prefs;preference=job;task=random'><font color=white>Get random job if preferences unavailable</font></a></u></center><br>"
if(BE_CIVILIAN)
HTML += "<center><br><u><a href='?_src_=prefs;preference=job;task=random'><font color=white>Be a civilian if preferences unavailable</font></a></u></center><br>"
if(RETURN_TO_LOBBY)
HTML += "<center><br><u><a href='?_src_=prefs;preference=job;task=random'><font color=white>Return to lobby if preferences unavailable</font></a></u></center><br>"
HTML += "<center><a href='?_src_=prefs;preference=job;task=reset'>\[Reset\]</a></center>"
HTML += "</tt>"
user << browse(null, "window=preferences")
// user << browse(HTML, "window=mob_occupation;size=[width]x[height]")
var/datum/browser/popup = new(user, "mob_occupation", "<div align='center'>Occupation Preferences</div>", width, height)
popup.set_window_options("can_close=0")
popup.set_content(HTML)
popup.open(0)
return
proc/SetJobPreferenceLevel(var/datum/job/job, var/level)
if (!job)
return 0
if (level == 1) // to high
// remove any other job(s) set to high
job_support_med |= job_support_high
job_engsec_med |= job_engsec_high
job_medsci_med |= job_medsci_high
job_karma_med |= job_karma_high
job_support_high = 0
job_engsec_high = 0
job_medsci_high = 0
job_karma_high = 0
if (job.department_flag == SUPPORT)
job_support_low &= ~job.flag
job_support_med &= ~job.flag
job_support_high &= ~job.flag
switch(level)
if (1)
job_support_high |= job.flag
if (2)
job_support_med |= job.flag
if (3)
job_support_low |= job.flag
return 1
else if (job.department_flag == ENGSEC)
job_engsec_low &= ~job.flag
job_engsec_med &= ~job.flag
job_engsec_high &= ~job.flag
switch(level)
if (1)
job_engsec_high |= job.flag
if (2)
job_engsec_med |= job.flag
if (3)
job_engsec_low |= job.flag
return 1
else if (job.department_flag == MEDSCI)
job_medsci_low &= ~job.flag
job_medsci_med &= ~job.flag
job_medsci_high &= ~job.flag
switch(level)
if (1)
job_medsci_high |= job.flag
if (2)
job_medsci_med |= job.flag
if (3)
job_medsci_low |= job.flag
return 1
else if (job.department_flag == KARMA)
job_karma_low &= ~job.flag
job_karma_med &= ~job.flag
job_karma_high &= ~job.flag
switch(level)
if (1)
job_karma_high |= job.flag
if (2)
job_karma_med |= job.flag
if (3)
job_karma_low |= job.flag
return 1
return 0
proc/UpdateJobPreference(mob/user, role, desiredLvl)
var/datum/job/job = job_master.GetJob(role)
if(!job)
user << browse(null, "window=mob_occupation")
ShowChoices(user)
return
if (!isnum(desiredLvl))
user << "\red UpdateJobPreference - desired level was not a number. Please notify coders!"
ShowChoices(user)
return
if(role == "Civilian")
if(job_support_low & job.flag)
job_support_low &= ~job.flag
else
job_support_low |= job.flag
SetChoices(user)
return 1
SetJobPreferenceLevel(job, desiredLvl)
SetChoices(user)
return 1
proc/ShowDisabilityState(mob/user,flag,label)
if(flag==DISABILITY_FLAG_FAT && species!=("Human" || "Tajaran" || "Grey"))
return "<li><i>[species] cannot be fat.</i></li>"
return "<li><b>[label]:</b> <a href=\"?_src_=prefs;task=input;preference=disabilities;disability=[flag]\">[disabilities & flag ? "Yes" : "No"]</a></li>"
proc/SetDisabilities(mob/user)
var/HTML = "<body>"
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\Documents\Projects\vgstation13\code\modules\client\preferences.dm:474: HTML += "<tt><center>"
HTML += {"<tt><center>
<b>Choose disabilities</b><ul>"}
// END AUTOFIX
HTML += ShowDisabilityState(user,DISABILITY_FLAG_NEARSIGHTED,"Needs Glasses")
HTML += ShowDisabilityState(user,DISABILITY_FLAG_FAT,"Obese")
HTML += ShowDisabilityState(user,DISABILITY_FLAG_EPILEPTIC,"Seizures")
HTML += ShowDisabilityState(user,DISABILITY_FLAG_DEAF,"Deaf")
HTML += ShowDisabilityState(user,DISABILITY_FLAG_BLIND,"Blind")
HTML += ShowDisabilityState(user,DISABILITY_FLAG_MUTE,"Mute")
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\Documents\Projects\vgstation13\code\modules\client\preferences.dm:481: HTML += "</ul>"
HTML += {"</ul>
<a href=\"?_src_=prefs;task=close;preference=disabilities\">\[Done\]</a>
<a href=\"?_src_=prefs;task=reset;preference=disabilities\">\[Reset\]</a>
</center></tt>"}
// END AUTOFIX
user << browse(null, "window=preferences")
user << browse(HTML, "window=disabil;size=350x300")
return
proc/SetRecords(mob/user)
var/HTML = "<body>"
HTML += "<tt><center>"
HTML += "<b>Set Character Records</b><br>"
HTML += "<a href=\"byond://?src=\ref[user];preference=records;task=med_record\">Medical Records</a><br>"
if(lentext(med_record) <= 40)
HTML += "[med_record]"
else
HTML += "[copytext(med_record, 1, 37)]..."
HTML += "<br><br><a href=\"byond://?src=\ref[user];preference=records;task=gen_record\">Employment Records</a><br>"
if(lentext(gen_record) <= 40)
HTML += "[gen_record]"
else
HTML += "[copytext(gen_record, 1, 37)]..."
HTML += "<br><br><a href=\"byond://?src=\ref[user];preference=records;task=sec_record\">Security Records</a><br>"
if(lentext(sec_record) <= 40)
HTML += "[sec_record]<br>"
else
HTML += "[copytext(sec_record, 1, 37)]...<br>"
HTML += "<br>"
HTML += "<a href=\"byond://?src=\ref[user];preference=records;records=-1\">\[Done\]</a>"
HTML += "</center></tt>"
user << browse(null, "window=preferences")
user << browse(HTML, "window=records;size=350x300")
return
proc/GetPlayerAltTitle(datum/job/job)
return player_alt_titles.Find(job.title) > 0 \
? player_alt_titles[job.title] \
: job.title
proc/SetPlayerAltTitle(datum/job/job, new_title)
// remove existing entry
if(player_alt_titles.Find(job.title))
player_alt_titles -= job.title
// add one if it's not default
if(job.title != new_title)
player_alt_titles[job.title] = new_title
proc/SetJob(mob/user, role)
var/datum/job/job = job_master.GetJob(role)
if(!job)
user << browse(null, "window=mob_occupation")
ShowChoices(user)
return
if(role == "Civilian")
if(job_support_low & job.flag)
job_support_low &= ~job.flag
else
job_support_low |= job.flag
SetChoices(user)
return 1
if(GetJobDepartment(job, 1) & job.flag)
SetJobDepartment(job, 1)
else if(GetJobDepartment(job, 2) & job.flag)
SetJobDepartment(job, 2)
else if(GetJobDepartment(job, 3) & job.flag)
SetJobDepartment(job, 3)
else//job = Never
SetJobDepartment(job, 4)
SetChoices(user)
return 1
proc/ResetJobs()
job_support_high = 0
job_support_med = 0
job_support_low = 0
job_medsci_high = 0
job_medsci_med = 0
job_medsci_low = 0
job_engsec_high = 0
job_engsec_med = 0
job_engsec_low = 0
job_karma_high = 0
job_karma_med = 0
job_karma_low = 0
proc/GetJobDepartment(var/datum/job/job, var/level)
if(!job || !level) return 0
switch(job.department_flag)
if(SUPPORT)
switch(level)
if(1)
return job_support_high
if(2)
return job_support_med
if(3)
return job_support_low
if(MEDSCI)
switch(level)
if(1)
return job_medsci_high
if(2)
return job_medsci_med
if(3)
return job_medsci_low
if(ENGSEC)
switch(level)
if(1)
return job_engsec_high
if(2)
return job_engsec_med
if(3)
return job_engsec_low
if(KARMA)
switch(level)
if(1)
return job_karma_high
if(2)
return job_karma_med
if(3)
return job_karma_low
return 0
proc/SetJobDepartment(var/datum/job/job, var/level)
if(!job || !level) return 0
switch(level)
if(1)//Only one of these should ever be active at once so clear them all here
job_support_high = 0
job_medsci_high = 0
job_engsec_high = 0
job_karma_high = 0
return 1
if(2)//Set current highs to med, then reset them
job_support_med |= job_support_high
job_medsci_med |= job_medsci_high
job_engsec_med |= job_engsec_high
job_karma_med |= job_karma_high
job_support_high = 0
job_medsci_high = 0
job_engsec_high = 0
job_karma_high = 0
switch(job.department_flag)
if(SUPPORT)
switch(level)
if(2)
job_support_high = job.flag
job_support_med &= ~job.flag
if(3)
job_support_med |= job.flag
job_support_low &= ~job.flag
else
job_support_low |= job.flag
if(MEDSCI)
switch(level)
if(2)
job_medsci_high = job.flag
job_medsci_med &= ~job.flag
if(3)
job_medsci_med |= job.flag
job_medsci_low &= ~job.flag
else
job_medsci_low |= job.flag
if(ENGSEC)
switch(level)
if(2)
job_engsec_high = job.flag
job_engsec_med &= ~job.flag
if(3)
job_engsec_med |= job.flag
job_engsec_low &= ~job.flag
else
job_engsec_low |= job.flag
if(KARMA)
switch(level)
if(2)
job_karma_high = job.flag
job_karma_med &= ~job.flag
if(3)
job_karma_med |= job.flag
job_karma_low &= ~job.flag
else
job_karma_low |= job.flag
return 1
proc/process_link(mob/user, list/href_list)
if(!user) return
if(href_list["preference"] == "job")
switch(href_list["task"])
if("close")
user << browse(null, "window=mob_occupation")
ShowChoices(user)
if("reset")
ResetJobs()
SetChoices(user)
if("random")
if(alternate_option == GET_RANDOM_JOB || alternate_option == BE_CIVILIAN)
alternate_option += 1
else if(alternate_option == RETURN_TO_LOBBY)
alternate_option = 0
else
return 0
SetChoices(user)
if ("alt_title")
var/datum/job/job = locate(href_list["job"])
if (job)
var/choices = list(job.title) + job.alt_titles
var/choice = input("Pick a title for [job.title].", "Character Generation", GetPlayerAltTitle(job)) as anything in choices | null
if(choice)
SetPlayerAltTitle(job, choice)
SetChoices(user)
if("input")
SetJob(user, href_list["text"])
if("setJobLevel")
UpdateJobPreference(user, href_list["text"], text2num(href_list["level"]))
else
SetChoices(user)
return 1
else if(href_list["preference"] == "disabilities")
switch(href_list["task"])
if("close")
user << browse(null, "window=disabil")
ShowChoices(user)
if("reset")
disabilities=0
SetDisabilities(user)
if("input")
var/dflag=text2num(href_list["disability"])
if(dflag >= 0)
if(!(dflag==DISABILITY_FLAG_FAT && species!=("Human" || "Tajaran" || "Grey")))
disabilities ^= text2num(href_list["disability"]) //MAGIC
SetDisabilities(user)
else
SetDisabilities(user)
return 1
else if(href_list["preference"] == "records")
if(text2num(href_list["record"]) >= 1)
SetRecords(user)
return
else
user << browse(null, "window=records")
if(href_list["task"] == "med_record")
var/medmsg = input(usr,"Set your medical notes here.","Medical Records",html_decode(med_record)) as message
if(medmsg != null)
medmsg = copytext(medmsg, 1, MAX_PAPER_MESSAGE_LEN)
medmsg = html_encode(medmsg)
med_record = medmsg
SetRecords(user)
if(href_list["task"] == "sec_record")
var/secmsg = input(usr,"Set your security notes here.","Security Records",html_decode(sec_record)) as message
if(secmsg != null)
secmsg = copytext(secmsg, 1, MAX_PAPER_MESSAGE_LEN)
secmsg = html_encode(secmsg)
sec_record = secmsg
SetRecords(user)
if(href_list["task"] == "gen_record")
var/genmsg = input(usr,"Set your employment notes here.","Employment Records",html_decode(gen_record)) as message
if(genmsg != null)
genmsg = copytext(genmsg, 1, MAX_PAPER_MESSAGE_LEN)
genmsg = html_encode(genmsg)
gen_record = genmsg
SetRecords(user)
switch(href_list["task"])
if("random")
switch(href_list["preference"])
if("name")
real_name = random_name(gender,species)
if("age")
age = rand(AGE_MIN, AGE_MAX)
if("hair")