Skip to content

Commit

Permalink
Merge pull request #19 from koyeall/master
Browse files Browse the repository at this point in the history
Fixed CIM bug, changed quote system, added showcode button.
  • Loading branch information
Stephen001 committed Jun 28, 2013
2 parents 676ee61 + d1bf24a commit c171df4
Show file tree
Hide file tree
Showing 14 changed files with 245 additions and 1,217 deletions.
5 changes: 5 additions & 0 deletions Chatters.dme
Expand Up @@ -27,6 +27,7 @@
#include "code\controllers\managers\msghand.dm"
#include "code\controllers\managers\msgman.dm"
#include "code\controllers\managers\opman.dm"
#include "code\controllers\managers\quoteman.dm"
#include "code\controllers\managers\Server.dm"
#include "code\controllers\managers\textman.dm"
#include "code\libraries\ktext\kText.dm"
Expand Down Expand Up @@ -55,6 +56,10 @@
#include "code\models\chatter\procs.dm"
#include "code\views\default.dmf"
#include "code\views\color\_main.dm"
#include "code\views\ops\_main.dm"
#include "code\views\ops\general.dm"
#include "code\views\ops\privileges.dm"
#include "code\views\ops\ranks.dm"
#include "code\views\set\_main.dm"
#include "code\views\set\filters.dm"
#include "code\views\set\icons.dm"
Expand Down
5 changes: 4 additions & 1 deletion code/_global.dm
Expand Up @@ -95,7 +95,9 @@ var/global
Channel // Main server channel
Home

kText/kText = new
// Global Managers

BotManager/BotMan
ChannelManager/ChanMan
ChatterManager/ChatMan
Expand All @@ -106,6 +108,7 @@ var/global
MessageManager/MsgMan
OperatorManager/OpMan
TextManager/TextMan
QuoteManager/QuoteMan = new

savefile_version = "0.1.6" // savefile versioning to reduce needless wipes

Expand All @@ -129,4 +132,4 @@ proc
trim (text) return TextMan.Trim(text)
ltrim (text) return TextMan.lTrim(text)
rtrim (text) return TextMan.rTrim(text)
escapeQuotes(txt) return TextMan.escapeQuotes(txt)
escapeQuotes(txt) return TextMan.escapeQuotes(txt)
57 changes: 57 additions & 0 deletions code/controllers/managers/quoteman.dm
@@ -0,0 +1,57 @@
QuoteManager
New()
..()

loadQuotes()

var
list/quotes = null

proc
loadQuotes()
quotes = list()

var
f = kText.replaceText(file2text("data/quotes.txt"), "\n", "")
list/split = kText.text2list(f, ";;")

for(var/q in split)
if(q)
var/list/qsplit = kText.text2list(q, "##")

if(length(qsplit) >= 2)
var/Quote/quote = new
quote.author = qsplit[1]
quote.text = qsplit[2]
if(length(qsplit) >= 3) quote.link = qsplit[3]

quotes += quote

getQOTD()
var
t = time2text(world.timeofday, "MMDD")
month = text2num(copytext(t, 1, 3))
day = text2num(copytext(t, 3))

qloc = ((month - 1) * 12) + day // compute the location of today's quote in the quote list
Quote/q
qlen = length(quotes)

if(qloc && (qloc <= qlen)) q = quotes[qloc]
else
qloc = round(qloc % qlen)
if(qloc < 1) qloc = 1
if(qloc > qlen) qloc = qlen
q = quotes[qloc]

if(q)
var/qtxt = "\"[q.text]\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - [q.author]"
if(q.link) qtxt += " ([q.link])"

return qtxt

Quote
var
text = ""
link = ""
author = ""
21 changes: 8 additions & 13 deletions code/controllers/managers/textman.dm
Expand Up @@ -240,21 +240,16 @@ TextManager
if(!Target || !Target.client)
del Target
return
var/month = text2num(time2text(world.realtime+Target.time_offset,"MM"))
var/day = text2num(time2text(world.realtime+Target.time_offset, "DD"))
var/XML/Element/root = xmlRootFromFile("./data/xml/quotes/quotes[month].xml")
if(!root) return
var/list/Quotes = root.Descendants("quote")
if(day > Quotes.len) day = Quotes.len
var/XML/Element/Quote = Quotes[day]
Home.QOTD = TextMan.ParseTags(Quote.Text(), Target.show_colors, Target.show_highlight)

var/qotd = QuoteMan.getQOTD()

Home.QOTD = TextMan.ParseTags(qotd, Target.show_colors, Target.show_highlight)

if(Home.QOTD)
if(Target.show_colors)
Target << output("<b>[fadetext("Quote of the Day", list("102102255","255204000"))]:</b>", "[ckey(Target.Chan.name)].chat.default_output")
else
Target << output("<b>Quote of the Day:</b>", "[ckey(Target.Chan.name)].chat.default_output")
Target << output("<i style='font-family: Verdana'>[Home.QOTD]</i>\n", "[ckey(Target.Chan.name)].chat.default_output")
if(Target.show_colors) Target << output("<b>[fadetext("Developer Quote of the Day", list("102102255","255204000"))]:</b>", "[ckey(Target.Chan.name)].chat.default_output")
else Target << output("<b>Developer Quote of the Day:</b>", "[ckey(Target.Chan.name)].chat.default_output")

Target << output("<i style='font-family: Arial'>&nbsp;&nbsp;&nbsp;&nbsp;[Home.QOTD]</i>\n", "[ckey(Target.Chan.name)].chat.default_output")


// Simple string matching procedure.
Expand Down
2 changes: 0 additions & 2 deletions code/libraries/ktext/kText.dm
Expand Up @@ -2,8 +2,6 @@
kText by Keeth
*/

var/kText/kText = new

kText
var
const
Expand Down
3 changes: 2 additions & 1 deletion code/models/chatter/_main.dm
Expand Up @@ -137,7 +137,8 @@ mob
del(M)

Click()
IM(key)
var/Messenger/im = new(usr, key)
im.Display(usr)

Logout()
if(Console && Chan) ChanMan.Quit(src, Chan)
Expand Down
32 changes: 30 additions & 2 deletions code/views/default.dmf
Expand Up @@ -39,6 +39,34 @@ window "channel"
macro = "macro"
menu = "menu"
on-close = ""
elem "button4"
type = BUTTON
pos = 490,336
size = 72x22
anchor1 = 100,100
anchor2 = none
font-family = "Arial"
font-size = 10
font-style = ""
text-color = #000000
background-color = #cdcdcd
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = line
drop-zone = false
right-click = false
saved-params = "is-checked"
on-size = ""
text = "Showcode"
image = ""
command = "ShowCode"
is-flat = true
stretch = false
is-checked = false
group = ""
button-type = pushbutton
elem "button1"
type = BUTTON
pos = 565,336
Expand Down Expand Up @@ -96,11 +124,11 @@ window "channel"
elem "default_input"
type = INPUT
pos = 3,336
size = 559x22
size = 484x22
anchor1 = 0,100
anchor2 = 100,100
font-family = "Arial"
font-size = 11
font-size = 10
font-style = ""
text-color = #000000
background-color = #ffffff
Expand Down

0 comments on commit c171df4

Please sign in to comment.