Finally ready to like add this now oh man this is a huge thing sort of

Added CC-Nanotrasen, an IRC bot made by Skibiliano and given to us by him under CC-BY-SA 3.0 licensing
WHAT DOES THIS MEAN? It means all servers running this SVN now have the option to use an easy to configure IRC bot capable of relaying adminhelps from ingame to the server/channel of their choice.
- Runs on python 2.6 scripts with psyco support
- Relaying can be toggled from config.txt (so you don't runtime with every adminhelp if you decide not to use it)
- Comes with a bunch of other useful and fun tools too
- Added a new global proc, send2irc(msg,msg2) YOU'LL NEVER GUESS WHAT IT DOES CONSIDERING WHAT I JUST MENTIONED
----msg and msg2 are just what text gets relayed to irc, separated by a |, for instance send2irc(hello, world) would come out as
"CC_NanoTrasen: Hello | World


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2783 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
quartz235@gmail.com
2011-12-23 17:39:47 +00:00
parent 240a9bfac5
commit 4472cecbd2
33 changed files with 5954 additions and 2 deletions

96
bot/C_rtd.py Normal file
View File

@@ -0,0 +1,96 @@
import random
def rtd(data,debug,sender):
backo = data
try:
arg1,arg2 = backo.split("d")
except ValueError, err:
return("Too many or too small amount of arguments")
else:
if debug:
print sender+":!rtd "+arg1+"d"+arg2 #faster than using %s's
die,die2 = [],[]
current_mark = ""
outcome = 0
realnumberfound = False
checks = []
count = 0
arg1 = arg1.replace(" ","")
arg2 = arg2.replace(" ","")
try:
i_arg1 = int(arg1)
a_arg1 = abs(i_arg1)
if "+" in arg2 or "-" in arg2:
plus_spot = arg2.find("+")
minus_spot = arg2.find("-")
if plus_spot == -1 and minus_spot == -1:
nicer_form = ""
elif plus_spot != -1 and minus_spot == -1:
nicer_form = arg2[plus_spot:]
elif plus_spot == -1 and minus_spot != -1:
nicer_form = arg2[minus_spot:]
else:
if plus_spot < minus_spot:
nicer_form = arg2[plus_spot:]
else:
nicer_form = arg2[minus_spot:]
for letter in arg2:
if letter == "+" or letter == "-":
current_mark = letter
checks = []
count += 1
continue
checks.append(letter)
try:
next_up = arg2[count+1]
except:
if realnumberfound == False:
i_arg2 = int("".join(checks))
checks = []
realnumberfound = True
elif current_mark == "+":
outcome += int("".join(checks))
else:
outcome -= int("".join(checks))
else:
if next_up == "+" or next_up == "-":
if realnumberfound == False:
i_arg2 = int("".join(checks))
checks = []
realnumberfound = True
else:
if current_mark == "+":
outcome += int("".join(checks))
else:
outcome -= int("".join(checks))
checks = []
count += 1
else:
i_arg2 = int(arg2)
if a_arg1 == 0 or abs(i_arg2) == 0:
raise RuntimeError
except ValueError:
return("You lied! That's not a number!")
except RuntimeError:
return("Too many zeroes!")
else:
if a_arg1 > 100:
return("Too many rolls, I can only do one hundred at max.")
else:
for i in xrange(0,a_arg1):
if i_arg2 < 0:
dice = random.randint(i_arg2,0)
else:
dice = random.randint(1,i_arg2)
die.append(dice)
die2.append(str(dice))
if i_arg2 < 0:
flist = "".join(die2)
else:
flist = "+".join(die2)
if len(flist) > 350:
return(str(reduce(lambda x,y: x+y, die)+outcome))
else:
if current_mark == "":
return(flist+" = "+str(reduce(lambda x,y: x+y, die)+outcome))
else:
return(flist+" ("+nicer_form+") = "+str(reduce(lambda x,y: x+y, die)+outcome))