Example #1
0
def item(name, chatlog):
    item = chatlog
    item = item[28:]
    item = item.split("!item ")[-1]
    item = item.replace("\n", "")
    action.send("give " + name +" "+ item +" 64", 0)
    return item
Example #2
0
def roll(name):
    roll = random.randint(1, 100)
    roll = str(roll)
    if roll == "100":
        action.say(name + " rolled "+roll+" and gets rewarded with a diamond!", 0.5)
        action.send("give " + name + " 57 1", 0)
    else:
        action.say(name + " rolled "+roll, 0)
    return roll
Example #3
0
def restart():
    #stop
    action.say("[Warning] Server restarting in 10 seconds!", 5)
    action.say("[Warning] Server restarting in 5 seconds!", 5)
    action.send("save-all", 2)
    action.stop_server()

    #start
    #yeah this is hard though rcon >.<
    action.start_server()
Example #4
0
def pull(name, chatlog):
    who = chatlog
    who = who[28:]
    who = who.split("> !tp")[-1]
    who = who.replace("\n", "")
    if who == "":
        action.say("Need a target!", 0)
        return " (No target) "
    else:
        who = who.split(" ")[-1]
        action.send("tp " + who +" "+ name, 0)
        return who
Example #5
0
def temphax(chatlog):

    #extract target
    who = chatlog
    who = who[28:]
    who = who.split("> !temphax")[-1]
    who = who.replace("\n", "")

    #if no target notify
    if who == "":
        action.say("Need a target!", 0)
        return "No target"
    #else hax target and add to templist
    else:
        who = who.split(" ")[-1]
        action.send("gamemode 1 " + who, 0)
        action.say(who+" is now haxed for this session.", 0)
        #templist here
        dbtemphax.add(who)
        return who
Example #6
0
def warp(name, chatlog):
    gwname = chatlog
    gwname = gwname.split("> !warp")[-1]
    gwname = gwname.replace("\n", "")
    if gwname == "":
        action.say("Please provide a valid gateway", 0.2)
        action.say("You can list all public gateways using !gateway list public", 0)
        return "NONE"
    else:
        gwname = gwname.split(" ")[1]

        #with gwname extracted, check if private gateway exist
        real = dbgateway.exist(name, gwname, "public")
        if real:
            #get coordinates
            coords = dbgateway.get_coords(name, gwname, "public")
            action.send("tp "+name+" "+coords['x']+" "+coords['y']+" "+coords['z'], 0)
            dbgateway.update_used(name, gwname, "public")
            return gwname

        else:
            action.say("That gateway does not exist!", 0)
            return gwname
Example #7
0
def late():
    #check who's online
    online = action.send("list", 0.1)
    online = online.split("There are ")[-1]
    online = online[5:]
    online = online.split("players online:")[-1]
    online = online.replace(',','')
    online = online.split()
    if not online:
        pass
        #print "NO USERS ONLINE"
    else:
        for user in online:
            achi.late_gamer(user)
Example #8
0
def temphax_unhax(name):
    action.say("[Warning] " + name + " is NOT authed for this session!", 4)
    action.say(name + " - You will be un-haxed!", 3)
    action.say(name + " - You have 10 seconds to get to safety!", 5)
    action.say(name + " - You have 5 seconds to get to safety!", 5)
    status = action.send("gamemode 0 "+ name, 0)
    if "Can't find user" in status:
        action.say(name+" left during de-hax, temphax-list was restored.", 0)
        #just gonna print something here for now, should return and logg instead
        print "TEMPHAX: "+name+" left during unhax, and list was untouched."
    else:
        action.say(name + " was un-haxed", 0.1)
        dbtemphax.remove(name)
        #just gonna print something here for now, should return and logg instead
        print "TEMPHAX: unhaxed "+name
Example #9
0
def login(chatlog, v, helpurl):

    #get nick
    name = chatlog
    name = name[27:]
    bort = ' joined'
    name = name.split(bort, 1)[0]

    #Choose greeting
    hello = ["Welcome ", "Greetings ", "Hai ", "Hai thar ", "Oh hai ", "Hello "]
    greetnum = random.randint(0,5)
    hail = (hello[greetnum])

    #check who's online
    #check who's online
    online = action.send("list", 0.1)
    online = online.split("There are ")[-1]
    online = online[5:]
    online = online.split("players online:")[-1]
    online = online.split(name, 1)[0] #remove playername from online
    if online == "":
        online = "None. "
    online = online[:-2]

    #greet and return nick
    action.say("§a"+hail + name + "! Online: " + online, 0)
    mysql.login(name, v)

    #Currently not working
    #check if a new MM version was deployed since last visit.
    #vermatch = mysql.version(name, v)
    #if vermatch:
    #    time.sleep(1)
    #    action.say("§bA §cnew version§b of MineMon was deployed since your last visit!", 2)
    #    action.say("§bUse §c!version§b for a summary of changes", 0.2)
    #    mysql.upd_version(name, v)

    #check if user was temphaxed
    temphax_check(name)

    #check for 100 logins achi
    achi.loyal_cust(name)

    return name
Example #10
0
def playtime():
    try:
        #check who's online
        online = action.send("list", 0.1)
        online = online.split("There are ")[-1]
        online = online[5:]
        online = online.split("players online:")[-1]
        online = online.split()
        #print online
        if not online:
            pass
            #print "NO USERS ONLINE"
        else:
            for user in online:
                #pass
                mysql.playtime(user)

        #Return OK
        return True
    except:
        print "Failed to send RCON data and reconnect. Server down? stopping timetrack."

        #Return false, will result in timetrack-module shutdown.
        return False
Example #11
0
def login(chatlog):

    #get nick
    name = chatlog
    name = name[27:]
    bort = ' '
    name = name.split(bort, 1)[0]

    #Choose greeting
    hello = ["Welcome ", "Greetings ", "Hai ", "Hai thar ", "Oh hai ", "Hello "]
    greetnum = random.randint(0,5)
    hail = (hello[greetnum])

    #check who's online
    online = action.send("list", 0.1)
    online = online.split("Connected players: ")[-1]
    online = online.split(name, 1)[0] #remove playername from online
    if online == "":
        online = "None. "
    online = online[:-2]

    #greet and return nick
    action.say(hail + name + "! Online: " + online, 0)
    return name
Example #12
0
def rain():
    action.send("toggledownfall", 0)
    action.say("Loading ...", 1.5)
    action.say("rain/snow was turned on/off", 0)
Example #13
0
def clear(name):
    action.send("clear "+name, 0)
Example #14
0
def food(name):
    for antal in range(0,5):
        action.send("give " + name + " 363 64", 0.1)
Example #15
0
def rail(name):
    for antal in range(0,4):
        action.send("give " + name + " 27 64", 0.1)
    for antal in range(0,2):
        action.send("give " + name + " 28 64", 0.1)
Example #16
0
def sleep(name):
    action.send("give " + name + " 355 5 ", 0)
Example #17
0
def train(name):
    action.send("give " + name + " 328 5", 0.1)
    action.send("tell " + name + " Do _NOT_ leave empty trains on the rail!", 0)
Example #18
0
def bow(name):
    action.send("give " + name + " 261 1", 0)
    for antal in range(0,3):
        action.send("give " + name + " 262 64", 0.1)
Example #19
0
def diamondset(name):
    item = 309
    for antal in range(0,4):
        item = item + 1
        action.send("give " + name +" "+ str(item) + " 1", 0.1)
    action.send("give " + name + " 276 1", 0)
Example #20
0
def train(name):
    action.send("give " + name + " 328 5", 0.1)
    action.say("Do _NOT_ leave empty wagons on the rail!", 0)
Example #21
0
def spawn(name):
    action.send("spawnpoint "+name, 0.2)
    action.say("New spawnpoint registered!", 0)
Example #22
0
def day():
    action.send("time set 10", 0)
Example #23
0
def hax(name):
    action.send("gamemode " + name + " 1", 0)
Example #24
0
def unhax(name):
    action.send("gamemode 0 " + name, 0)
Example #25
0
def hax(name):
    action.send("gamemode 1 " +name, 0)
Example #26
0
def unhax(name):
    action.send("gamemode " + name + " 0", 0)
Example #27
0
def xp(name):
    for antal in range(0,4):
        action.send("xp " + name + " 5000", 0.2)
Example #28
0
def night():
    action.send("time set 14000", 0)
Example #29
0
def kit(name):
    item = 276
    for antal in range(0,3):
        item = item + 1
        action.send("give " + name +" "+ str(item) + " 1", 0.1)
Example #30
0
def leatherset(name):
    item = 297
    for antal in range(0,4):
        item = item + 1
        action.send("give " + name +" "+ str(item) + " 1", 0.1)
    action.send("give " + name + " 268 1", 0)
Example #31
0
    def go(self):
        libs.cat_doc()
        if len(self.argv) > 1:
            b1 = self.argv[1] == 'find-line'
            b2 = self.argv[1] == 'find-name'
            b3 = self.argv[1] == 'cat2'
            b4 = self.argv[1] == 'count'
            b5 = self.argv[1] == 'delete'
            b6 = self.argv[1] == 'tree'

            a = action.send(self.argv, self.work, self.err, self.pre,
                            self.user)

            if b1:
                libs.len_no_good(self.argv, 3, 1)

                # for any argv > 4 join to 4.
                if len(self.argv) > 5:
                    resto = (len(self.argv) - 1)
                    while resto > 4:
                        self.argv[4] += (' ' + self.argv[resto])
                        self.argv = self.argv[:resto]
                        resto -= 1

                libs.len_no_good(self.argv, 5, 0)
                dir_or_file(self.argv[2], a.find_line)
                print()
                print('#WORK!!')
                print()
                for el in self.work:
                    print(el)
                    cat2(el, self.argv[4])
                    print()
                print()
                print('#WORK in:', len(self.work))
                print('#NO WORK in:', len(self.err))

            elif b2 or b3 or b4 or b5:
                libs.len_no_good(self.argv, 4, 0)

                if b2:
                    dir_or_file(self.argv[2], a.find_name, a.find_name)
                    print()
                    print('#WORK!!')
                    print()
                    for el in self.work:
                        print(el)
                    print()
                    print('#WORK in:', len(self.work))
                    print('#NO WORK in:', len(self.err))

                elif b3:
                    print()
                    print('#WORK!!')
                    print()
                    print(self.argv[2])
                    cat2(self.argv[2], self.argv[3])
                    print()

                elif b4:
                    if argv[3].count('all'):
                        if argv[3] == 'all1':
                            dir_or_file(self.argv[2], a.count_obj)
                        elif argv[3] == 'all2':
                            dir_or_file(self.argv[2], a.count_obj, a.count_obj)
                    else:
                        dir_or_file(self.argv[2], a.count_obj, a.count_obj)

                    print()
                    print('#WORK!!')
                    print()
                    print('#COUNT is:', len(self.work))
                    print('#NO COUNT is:', len(self.err))

                elif b5:
                    if argv[3].count('all'):
                        if argv[3] == 'all1':
                            dir_or_file(self.argv[2], a.delete)
                        elif argv[3] == 'all2':
                            dir_or_file(self.argv[2], a.delete, a.delete)
                    else:
                        dir_or_file(self.argv[2], a.delete, a.delete)

                    print()
                    print('#WORK!!')
                    print()
                    for el in self.work:
                        print(el)
                    print()
                    print('#DELETE in:', len(self.work))
                    print('#NO DELETE in:', len(self.err))

            elif b6:
                libs.len_no_good(self.argv, 3, 0)

                action.createX(self.outTree)
                i = open(self.outTree, 'w')
                i.write('\n   TREE OF:' + self.argv[2] + '\n\n')
                i.close()
                dir_or_file(self.argv[2], a.tree, a.tree)
                i = open(self.outTree, 'a')
                i.write('\n   END OF TREE\n\n')
                i.close()
                print()
                print('#WORK!!')
                print('#OUT FILE in:', self.outTree)

        input("\n\t Press Enter key for finish. \n\n")