Add calamity and events. - annna - Annna the nice friendly bot.
 (HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
       ---
 (DIR) commit 26d0d4180a7a588d7c5f470fb519e87bfc12c969
 (DIR) parent 7263fdee1b91f2a3db42206e749fcaba85721ae7
 (HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
       Date:   Wed, 30 Aug 2023 14:08:03 +0200
       
       Add calamity and events.
       
       Diffstat:
         A modules/idlerpg/events.txt          |      47 +++++++++++++++++++++++++++++++
         M modules/idlerpg/idlerpg-channel-se… |      28 ++++++++++++++++++++++------
       
       2 files changed, 69 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/modules/idlerpg/events.txt b/modules/idlerpg/events.txt
       @@ -0,0 +1,47 @@
       +%s fell into a hole at FOSDEM
       +%s bit their tongue while listening to a Poettering talk
       +%s set themself on fire after reading the XMPP RFC
       +%s used a MacBook
       +%s lost their mind on XML
       +%s died, temporarily while waiting for Windows to boot
       +%s was caught in a terrible snowstorm wardriving
       +%s EXPLODED, somewhat while trying to understand the boost library
       +%s got knifed in a dark alley with a soldering iron
       +%s got turned INSIDE OUT by quinq, practically
       +%s ate a very disagreeable Apple, getting a terrible case of heartburn
       +%s met up with a Microsoft hitman for not paying his license fees
       +%s has fallen ill with the SysTemD
       +%s was struck by Apple lightning
       +%s was attacked by a rabid Gentoo Larry
       +%s was attacked by a rabid BSD devil
       +%s was set on fire by emacs(1)
       +%s was decapitated, temporarily through a Redhat
       +%s was tipped by a #polish-cow
       +%s was bucked from a #fuck-my-horses
       +%s was bitten by a moose in the Linux kernel
       +%s was sat on by a giant C++ codebase
       +%s ate a plate of discounted, day-old sushi made from Puffy
       +%s got harassed by peer (the one from ICMP)
       +%s got lost in web
       +%s misplaced his password
       +%s broke his Google Glasses
       +%s lost his Google Glasses
       +%s walked face-first into a merkle tree
       +%s found a pair of memory/RAM
       +%s caught a unicorn programming language
       +%s discovered a secret, underground passage to gopherspace
       +%s was taught to run quickly by a secret tribe of C developer that know how to, among other things, run quickly
       +%s discovered triple-caffeinated coffee
       +%s grew an extra leg from DNA code experiments
       +%s was visited by a very pretty nymph and had sex
       +%s found kitty-cat
       +%s learned Perl
       +%s found an exploit in the IdleRPG code
       +%s bought a faster computer
       +%s bribed the local IdleRPG administrator
       +%s stopped using dial-up
       +%s got fiber internet access
       +%s lost wifi connection
       +%s was bitten by a radioactive GNU
       +%s hit it off with a drunk furry chick named Jenny 
       +%s was accepted into Pi Beta Euler Epsilon DarkFi club
 (DIR) diff --git a/modules/idlerpg/idlerpg-channel-service.py b/modules/idlerpg/idlerpg-channel-service.py
       @@ -109,6 +109,7 @@ def main(args):
            shields = readin_dictfile("%s/shields.txt" % (basepath))
            weapons = readin_dictfile("%s/weapons.txt" % (basepath))
            quests = readin_dictfile("%s/quests.txt" % (basepath))
       +    events = readin_dictfile("%s/events.txt" % (basepath))
        
            hackers = readin_dictfile("%s/hackers.txt" % (basepath))
            for hacker in hackers.keys():
       @@ -134,6 +135,7 @@ def main(args):
        
            def calamity(hackers, hacker):
                calamity_type = random.randint(1, 10)
       +        print("calamity_type = %d" % (calamity_type))
                if calamity_type == 1:
                    change_type = random.randint(1, 4)
                    if change_type == 1:
       @@ -143,7 +145,7 @@ def main(args):
                        hackers[hacker][1] = new_class 
                        say(chaninpath, "Due to a bit flip during a solar flare, " \
                            "%s's hacker class changed to %s." \
       -                    % (hacker, hackers[hacker][1])
       +                    % (hacker, hackers[hacker][1]))
                    elif change_type == 2:
                        new_hardware = None
                        while new_hardware != hackers[hacker][2]:
       @@ -151,23 +153,30 @@ def main(args):
                        hackers[hacker][2] = new_hardware 
                        say(chaninpath, "It is %s's birthday. " \
                            "%s's hardware changed to %s." \
       -                    % (hacker, hackers[hacker][2])
       +                    % (hacker, hackers[hacker][2]))
                    elif change_type == 3:
                        new_shield = None
                        while new_shield != hackers[hacker][3]:
                            new_shield = random.choice(list(shields.keys()))
                        hackers[hacker][3] = new_shield 
       -                say(chaninpath, "%s slipped. " \
       +                say(chaninpath, "%s fell over a Windows 95 CD. " \
                            "%s's shield changed to %s." \
       -                    % (hacker, hackers[hacker][3])
       +                    % (hacker, hackers[hacker][3]))
                    elif change_type == 4:
                        new_weapon = None
                        while new_weapon != hackers[hacker][4]:
                            new_weapon = random.choice(list(weapons.keys()))
                        hackers[hacker][4] = new_weapon 
       -                say(chaninpath, "%s slipped. " \
       +                say(chaninpath, "%s had to reinstall his OS. " \
                            "%s's weapon changed to %s." \
       -                    % (hacker, hackers[hacker][4])
       +                    % (hacker, hackers[hacker][4]))
       +        else:
       +            event = random.choice(list(events.keys()))
       +            boost = random.randint(-10, 10) * 100
       +            hackers[hacker][0] += boost
       +            say(chaninpath, "%s! This caused his idle time to " \
       +                "change by %d to %d." \
       +                % (event % (hacker), boost, hackers[hacker][0]))
        
            def hand_of_rms(hackers, hacker):
                win = random.randint(0, 5)
       @@ -280,6 +289,8 @@ def main(args):
                        go_on_quest(hackers, questhackers)
                    elif random.randint(1, 65535) < 5 and len(hackers) > 1:
                        hand_of_rms(random.choice(list(hackers.keys())))
       +            elif random.randint(1, 65535) < 10 and len(hackers) > 1:
       +                calamity(random.choice(list(hackers.keys())))
        
                    writeout_dictfile("%s/hackers.txt" % (basepath), hackers)
                    continue
       @@ -334,6 +345,11 @@ def main(args):
                                    hand_of_rms(hackers, cmdargs[0])
                                else:
                                    hand_of_rms(hackers, random.choice(list(hackers.keys())))
       +                    elif cmd == "!calamity":
       +                        if len(cmdargs) > 0 and cmdargs[0] in hackers:
       +                            calamity(hackers, cmdargs[0])
       +                        else:
       +                            calamity(hackers, random.choice(list(hackers.keys())))
        
                    elif user == "-!-":
                        (hacker, text) = remain.split(" ", 1)