510: Remove BYGEX completely, remove autoconvert notes

notes (never used + uses bygex specific things)
This commit is contained in:
Tigercat2000
2016-02-28 11:21:30 -08:00
parent d6b82bcbfd
commit 5294b4c223
12 changed files with 10 additions and 289 deletions
-66
View File
@@ -177,73 +177,7 @@
output += "<center><a href='?_src_=holder;addnoteempty=1'>\[Add Note\]</a></center>"
output += ruler
usr << browse(output, "window=show_notes;size=900x500")
/proc/regex_note_sql_extract(str, exp)
return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regEx_find")(str, exp))
// If the AUTOCONVERT_NOTES is turned on, any time a player connects this will be run to try and add all their notes to the database
/proc/convert_notes_sql(ckey)
if(!ckey)
return 0
var/playerfile = "data/player_saves/[copytext(ckey, 1, 2)]/[ckey]/info.sav"
var/savefile/info = new(playerfile)
var/list/infos
info >> infos
if(!infos || !infos.len)
fdel(playerfile)
return 0
ckey = ckey
for(var/datum/player_info/I in infos)
var/notetext = I.content
var/adminckey = I.author
var/server
if (config && config.server_name)
server = config.server_name
var/timestamp = I.timestamp
var/regex = "\[A-Za-z\]+\\, (\[A-Za-z\]+) (\[0-9\]+)\[A-Za-z\]+ of (\[0-9\]+)"
var/datum/regex/results = regex_note_sql_extract(timestamp, regex)
var/month = month2number(results.str(2))
var/day = results.str(3)
var/year = results.str(4)
timestamp = "[year]-[month]-[day] 00:00:00"
add_note(ckey, notetext, timestamp, adminckey, 0, server, 0)
fdel(playerfile)
return 1
// Using this proc causes lag - you have been warned.
/proc/mass_convert_notes()
if(!check_rights(R_SERVER))
return 0
world << "Beginning mass note conversion."
var/player_notes_file = "data/player_notes.sav"
var/savefile/notesfile = new(player_notes_file)
var/list/note_keys
notesfile >> note_keys
if(!notesfile)
log_game("Error: Cannot access player_notes.sav file.")
return 0
if(!note_keys || !note_keys.len)
log_game("Error: player_notes.sav file is empty. Deleting it.")
fdel(player_notes_file)
return 0
note_keys = sortList(note_keys)
var/i = 1
for(i, i <= note_keys.len, i++)
var/ckey = note_keys[i]
convert_notes_sql(ckey)
world << "Finished mass note conversion ([i] notes converted). Remember to turn off AUTOCONVERT_NOTES."
world << "Deleting the player_notes.sav file."
fdel(player_notes_file)
return 1
/proc/show_player_info_irc(var/key as text)
var/target_sql_ckey = sanitizeSQL(key)
var/DBQuery/query_get_notes = dbcon.NewQuery("SELECT timestamp, notetext, adminckey, server FROM [format_table_name("notes")] WHERE ckey = '[target_sql_ckey]' ORDER BY timestamp")
-3
View File
@@ -304,9 +304,6 @@
src << message
clientmessages.Remove(ckey)
if (config && config.autoconvert_notes)
convert_notes_sql(ckey)
send_resources()
@@ -138,7 +138,7 @@
@param replacestring: the string to replace the substring with
*/
interpreter.SetProc("replace", /proc/replacetext)
interpreter.SetProc("replace", /proc/n_replacetext)
/*
-> Locates an element/substring inside of a list or string
@@ -194,7 +194,7 @@
interpreter.SetProc("reverse", /proc/reverse_text)
interpreter.SetProc("tonum", /proc/n_str2num)
interpreter.SetProc("capitalize", /proc/capitalize)
interpreter.SetProc("replacetextEx",/proc/replacetextEx)
interpreter.SetProc("replacetextEx",/proc/n_replacetextEx)
// Numbers
interpreter.SetProc("tostring", /proc/n_num2str)
@@ -260,4 +260,10 @@ proc/n_round(var/num)
/proc/n_log(var/num)
if(isnum(num) && 0 < num)
return log(num)
return log(num)
/proc/n_replacetext(text, r, with)
return replacetext(text, r, with)
/proc/n_replacetextEx(text, r, with)
return replacetextEx(text, r, with)