Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 741803c

Browse filesBrowse files
committed
Finishes porting Admin Tickets and plethora of everything else that got in the way of doing this.
1 parent 18c0827 commit 741803c
Copy full SHA for 741803c

50 files changed

+4,143-144Lines changed: 4143 additions & 144 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎code/__DEFINES/admin.dm‎

Copy file name to clipboardExpand all lines: code/__DEFINES/admin.dm
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@
3434
#define R_VAREDIT 1024
3535
#define R_SOUNDS 2048
3636
#define R_SPAWN 4096
37+
#define R_NOJOIN 8192
38+
#define R_TICKET 16384
3739

38-
#define R_MAXPERMISSION 4096 //This holds the maximum value for a permission. It is used in iteration, so keep it updated.
40+
#define R_MAXPERMISSION 32768 //This holds the maximum value for a permission. It is used in iteration, so keep it updated.
3941

4042
#define TICKET_FLAG_LIST_ALL 1
4143
#define TICKET_FLAG_LIST_MINE 2
Collapse file

‎code/__HELPERS/credits.dm‎

Copy file name to clipboard
+190Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
/*
2+
Nanotrasen Credits helper by Kn0ss0s
3+
4+
This system requires a new column `credits` in the table `player` of the datatype BIGINT length 20
5+
6+
/datum/credit : Used only to return a list of players. Contains the player ckey and credits.
7+
8+
credits_reload_from_db(mob): Returns the number of credits for the given `mob`
9+
credits_top(num): Gives you the top `num` of players by credits earnt
10+
credits_earn(mob, num): Gives `num` credits to `mob`
11+
credits_spend(mob, num): Takes `num` credits from `mob`
12+
credits_set(mob, num): Sets `mob` credits to `num`
13+
*/
14+
15+
/client
16+
// Give all clients a corresponding credit line
17+
// This variable can be used as an "estimate" of a clients credit, but before making transactions, check with the database first!
18+
var/credits = 0
19+
20+
/datum/credit
21+
var/ckey
22+
var/credits
23+
24+
/datum/credit/New(var/ckey, var/credits)
25+
src.ckey = ckey
26+
src.credits = text2num(credits)
27+
28+
if(!src.ckey)
29+
throw new /exception("InvalidParameterException: When creating a credits datum, a ckey is expected")
30+
if(src.credits < 0)
31+
throw new /exception("InvalidParameterException: When creating a credits datum, a negative credits value is not expected")
32+
33+
/*
34+
Returns the number of credits that the user has stored in the DB.
35+
Takes a mob as an argument
36+
If the returned number is less than 0, then it was an error.
37+
38+
Possible values
39+
NO_DB_CONNECTION: No MySQL connection - do not work with credits for the current round - disable functions
40+
BAD_CLIENT: A badly passed mob that is either non-existant or has no client
41+
FAILED_QUERY: A bad query, usually should not happen - results from columns or the table missing from the DB
42+
NO_RESULT: No result, likely due to the current mob client key not having a row in the player database
43+
*/
44+
/proc/credits_reload_from_db(mob/M)
45+
var/client/C = get_client(M)
46+
if(!C || !istype(C, /client))
47+
return BAD_CLIENT
48+
49+
if(!dbcon.IsConnected())
50+
return NO_DB_CONNECTION
51+
52+
var ckey = get_ckey(C)
53+
if(!ckey)
54+
return BAD_CLIENT
55+
56+
var/DBQuery/query_credits = dbcon.NewQuery("SELECT `credits` FROM [format_table_name("player")] WHERE `ckey`='[ckey]' LIMIT 1")
57+
58+
if(!query_credits.Execute())
59+
return FAILED_QUERY
60+
61+
if(query_credits.NextRow())
62+
C.credits = text2num(query_credits.item[1])
63+
return C.credits
64+
65+
return NO_RESULT
66+
67+
/*
68+
Returns a list of the players with the most credits (limited to a certain number)
69+
The return value is in the form of a list of /datum/credit
70+
71+
Possible values
72+
NO_DB_CONNECTION: No MySQL connection - do not work with credits for the current round - disable functions
73+
FAILED_QUERY: A bad query, usually should not happen - results from columns or the table missing from the DB
74+
*/
75+
/proc/credits_top(var/limit)
76+
if(!dbcon.IsConnected())
77+
return NO_DB_CONNECTION
78+
79+
if(!limit)
80+
limit = 10
81+
82+
var/DBQuery/query_credits = dbcon.NewQuery("SELECT `ckey`, `credits` FROM [format_table_name("player")] ORDER BY `credits` DESC LIMIT [limit]")
83+
84+
if(!query_credits.Execute())
85+
return FAILED_QUERY
86+
87+
var/list/L = list()
88+
89+
while(query_credits.NextRow())
90+
L.Add(new /datum/credit(query_credits.item[1], text2num(query_credits.item[2])))
91+
92+
return L
93+
94+
/*
95+
Increase the clients credits in the database
96+
The return value is the new number of credits after earning
97+
98+
Possible values
99+
NO_DB_CONNECTION: No MySQL connection - do not work with credits for the current round - disable functions
100+
BAD_CLIENT: A badly passed mob that is either non-existant or has no client
101+
FAILED_QUERY: A bad query, usually should not happen - results from columns or the table missing from the DB
102+
NO_RESULT: No result, likely due to the current mob client key not having a row in the player database
103+
*/
104+
/proc/credits_earn(mob/M, var/credits)
105+
var/currentCredits = credits_reload_from_db(M)
106+
107+
// If the current value is a negative, then there was a proper error we need to forward
108+
if(currentCredits < 0)
109+
return currentCredits
110+
111+
var/client/C = get_client(M)
112+
C.credits = currentCredits + text2num(credits)
113+
114+
// Not necessary to prove this is safe, as it was already checked in credits_reload_from_db
115+
var ckey = get_ckey(M)
116+
117+
var/DBQuery/query_credits = dbcon.NewQuery("UPDATE [format_table_name("player")] SET `credits`=[C.credits] WHERE `ckey`='[ckey]'")
118+
119+
if(!query_credits.Execute())
120+
return FAILED_QUERY
121+
122+
return C.credits
123+
124+
/*
125+
Reduce the clients credits in the database
126+
The return value is the new number of credits after spending
127+
128+
Possible values
129+
NO_DB_CONNECTION: No MySQL connection - do not work with credits for the current round - disable functions
130+
BAD_CLIENT: A badly passed mob that is either non-existant or has no client
131+
FAILED_QUERY: A bad query, usually should not happen - results from columns or the table missing from the DB
132+
NO_RESULT: No result, likely due to the current mob client key not having a row in the player database
133+
INSUFFICIENT_CREDITS: Insufficient credits to complete this operation
134+
*/
135+
/proc/credits_spend(mob/M, var/credits)
136+
var/currentCredits = credits_reload_from_db(M)
137+
138+
// If the current value is a negative, then there was a proper error we need to forward
139+
if(currentCredits < 0)
140+
return currentCredits
141+
142+
// Reduce the number of credits the user has, if it is negative, we don't have enough credits
143+
currentCredits = currentCredits - text2num(credits)
144+
if(currentCredits < 0)
145+
return INSUFFICIENT_CREDITS
146+
147+
var/client/C = get_client(M)
148+
C.credits = currentCredits
149+
150+
// Not necessary to prove this is safe, as it was already checked in credits_reload_from_db
151+
var ckey = get_ckey(M)
152+
153+
var/DBQuery/query_credits = dbcon.NewQuery("UPDATE [format_table_name("player")] SET `credits`=[C.credits] WHERE `ckey`='[ckey]'")
154+
155+
if(!query_credits.Execute())
156+
return FAILED_QUERY
157+
158+
return C.credits
159+
160+
/*
161+
Set the clients credits in the database
162+
163+
Possible values
164+
NO_DB_CONNECTION: No MySQL connection - do not work with credits for the current round - disable functions
165+
BAD_CLIENT: A badly passed mob that is either non-existant or has no client
166+
FAILED_QUERY: A bad query, usually should not happen - results from columns or the table missing from the DB
167+
NO_RESULT: No result, likely due to the current mob client key not having a row in the player database
168+
QUERY_OK:
169+
*/
170+
/proc/credits_set(mob/M, var/credits)
171+
var/client/C = get_client(M)
172+
if(!C || !istype(C, /client))
173+
return BAD_CLIENT
174+
175+
if(!dbcon.IsConnected())
176+
return NO_DB_CONNECTION
177+
178+
var ckey = get_ckey(C)
179+
if(!ckey)
180+
return BAD_CLIENT
181+
182+
var/DBQuery/query_credits = dbcon.NewQuery("UPDATE [format_table_name("player")] SET `credits`=[credits] WHERE `ckey`='[ckey]'")
183+
184+
if(!query_credits.Execute())
185+
return FAILED_QUERY
186+
187+
C.credits = credits
188+
189+
return QUERY_OK
190+
Collapse file

‎code/_compile_options.dm‎

Copy file name to clipboardExpand all lines: code/_compile_options.dm
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//#define TESTING //By using the testing("message") proc you can create debug-feedback for people with this
44
//uncommented, but not visible in the release version)
55

6+
#define MAXAGREE 5
67
#define PRELOAD_RSC 1 /*set to:
78
0 to allow using external resources or on-demand behaviour;
89
1 to use the default behaviour;
Collapse file

‎code/_globalvars/configuration.dm‎

Copy file name to clipboardExpand all lines: code/_globalvars/configuration.dm
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var/guests_allowed = 1
1515
var/shuttle_frozen = 0
1616
var/shuttle_left = 0
1717
var/tinted_weldhelh = 1
18+
var/high_risk_item_notifications = 0
1819

1920

2021
// Debug is used exactly once (in living.dm) but is commented out in a lot of places. It is not set anywhere and only checked.
Collapse file

‎code/_globalvars/lists/objects.dm‎

Copy file name to clipboardExpand all lines: code/_globalvars/lists/objects.dm
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var/global/list/surgeries_list = list() //list of all surgeries by name, asso
1616
var/global/list/crafting_recipes = list() //list of all table craft recipes
1717
var/global/list/rcd_list = list() //list of Rapid Construction Devices.
1818
var/global/list/apcs_list = list() //list of all Area Power Controller machines, seperate from machines for powernet speeeeeeed.
19+
var/global/list/antag_objective_items = list() //all items that could be antag objecives.
1920
var/global/list/tracked_implants = list() //list of all current implants that are tracked to work out what sort of trek everyone is on. Sadly not on lavaworld not implemented...
2021
var/global/list/poi_list = list() //list of points of interest for observe/follow
2122
var/global/list/pinpointer_list = list() //list of all pinpointers. Used to change stuff they are pointing to all at once.
Collapse file

‎code/_onclick/ai.dm‎

Copy file name to clipboardExpand all lines: code/_onclick/ai.dm
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
Note that AI have no need for the adjacency proc, and so this proc is a lot cleaner.
1111
*/
1212
/mob/living/silicon/ai/DblClickOn(var/atom/A, params)
13+
if(client.prefs.afreeze)
14+
client << "<span class='userdanger'>You are frozen by an administrator.</span>"
15+
return
1316
if(client.click_intercept)
1417
if(call(client.click_intercept, "InterceptClickOn")(src, params, A))
1518
return
@@ -26,7 +29,9 @@
2629
if(world.time <= next_click)
2730
return
2831
next_click = world.time + 1
29-
32+
if(client.prefs.afreeze)
33+
client << "<span class='userdanger'>You are frozen by an administrator.</span>"
34+
return
3035
if(client.click_intercept)
3136
if(call(client.click_intercept, "InterceptClickOn")(src, params, A))
3237
return
Collapse file

‎code/_onclick/click.dm‎

Copy file name to clipboardExpand all lines: code/_onclick/click.dm
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
if(world.time <= next_click)
5353
return
5454
next_click = world.time + 1
55+
56+
if(client.prefs.afreeze)
57+
client << "<span class='userdanger'>You are frozen by an administrator.</span>"
58+
return
5559

5660
if(client.click_intercept)
5761
if(call(client.click_intercept, "InterceptClickOn")(src, params, A))
Collapse file

‎code/_onclick/cyborg.dm‎

Copy file name to clipboardExpand all lines: code/_onclick/cyborg.dm
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
if(world.time <= next_click)
1111
return
1212
next_click = world.time + 1
13-
13+
if(client.prefs.afreeze)
14+
client << "<span class='userdanger'>You are frozen by an administrator.</span>"
15+
return
1416
if(client.click_intercept)
1517
if(call(client.click_intercept,"InterceptClickOn")(src,params,A))
1618
return
Collapse file

‎code/_onclick/drag_drop.dm‎

Copy file name to clipboardExpand all lines: code/_onclick/drag_drop.dm
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
if(!usr || !over) return
1010
if(over == src)
1111
return usr.client.Click(src, src_location, src_control, params)
12+
13+
if(usr.client && usr.client.prefs.afreeze)
14+
usr.client << "<span class='userdanger'>You are frozen by an administrator.</span>"
15+
return
16+
1217
if(!Adjacent(usr) || !over.Adjacent(usr)) return // should stop you from dragging through windows
1318

1419
over.MouseDrop_T(src,usr)
Collapse file

‎code/_onclick/hud/screen_objects.dm‎

Copy file name to clipboardExpand all lines: code/_onclick/hud/screen_objects.dm
+29Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@
157157
layer = HUD_LAYER
158158

159159
/obj/screen/drop/Click()
160+
if(usr.client && usr.client.prefs.afreeze)
161+
usr.client << "<span class='userdanger'>You are frozen by an administrator.</span>"
162+
return 1
160163
usr.drop_item_v()
161164

162165
/obj/screen/act_intent
@@ -165,6 +168,11 @@
165168
screen_loc = ui_acti
166169

167170
/obj/screen/act_intent/Click(location, control, params)
171+
172+
if(usr.client && usr.client.prefs.afreeze)
173+
usr.client << "<span class='userdanger'>You are frozen by an administrator.</span>"
174+
return 1
175+
168176
if(ishuman(usr) && (usr.client.prefs.toggles & INTENT_STYLE))
169177

170178
var/_x = text2num(params2list(params)["icon-x"])
@@ -199,6 +207,9 @@
199207
screen_loc = ui_internal
200208

201209
/obj/screen/internals/Click()
210+
if(usr.client && usr.client.prefs.afreeze)
211+
usr.client << "<span class='userdanger'>You are frozen by an administrator.</span>"
212+
return 1
202213
if(!iscarbon(usr))
203214
return
204215
var/mob/living/carbon/C = usr
@@ -261,6 +272,9 @@
261272
icon_state = "running"
262273

263274
/obj/screen/mov_intent/Click()
275+
if(usr.client && usr.client.prefs.afreeze)
276+
usr.client << "<span class='userdanger'>You are frozen by an administrator.</span>"
277+
return 1
264278
switch(usr.m_intent)
265279
if("run")
266280
usr.m_intent = "walk"
@@ -276,6 +290,9 @@
276290
icon_state = "pull"
277291

278292
/obj/screen/pull/Click()
293+
if(usr.client && usr.client.prefs.afreeze)
294+
usr.client << "<span class='userdanger'>You are frozen by an administrator.</span>"
295+
return 1
279296
usr.stop_pulling()
280297

281298
/obj/screen/pull/update_icon(mob/mymob)
@@ -292,6 +309,9 @@
292309
layer = HUD_LAYER
293310

294311
/obj/screen/resist/Click()
312+
if(usr.client && usr.client.prefs.afreeze)
313+
usr.client << "<span class='userdanger'>You are frozen by an administrator.</span>"
314+
return 1
295315
if(isliving(usr))
296316
var/mob/living/L = usr
297317
L.resist()
@@ -302,6 +322,9 @@
302322
/obj/screen/storage/Click(location, control, params)
303323
if(world.time <= usr.next_move)
304324
return 1
325+
if(usr.client && usr.client.prefs.afreeze)
326+
usr.client << "<span class='userdanger'>You are frozen by an administrator.</span>"
327+
return 1
305328
if(usr.stat || usr.paralysis || usr.stunned || usr.weakened)
306329
return 1
307330
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech
@@ -318,6 +341,9 @@
318341
icon_state = "act_throw_off"
319342

320343
/obj/screen/throw_catch/Click()
344+
if(usr.client && usr.client.prefs.afreeze)
345+
usr.client << "<span class='userdanger'>You are frozen by an administrator.</span>"
346+
return 1
321347
if(iscarbon(usr))
322348
var/mob/living/carbon/C = usr
323349
C.toggle_throw_mode()
@@ -329,6 +355,9 @@
329355
var/selecting = "chest"
330356

331357
/obj/screen/zone_sel/Click(location, control,params)
358+
if(usr.client && usr.client.prefs.afreeze)
359+
usr.client << "<span class='userdanger'>You are frozen by an administrator.</span>"
360+
return 1
332361
var/list/PL = params2list(params)
333362
var/icon_x = text2num(PL["icon-x"])
334363
var/icon_y = text2num(PL["icon-y"])

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.