Skip to content

Instantly share code, notes, and snippets.

@AwwCookies
Last active August 29, 2015 14:10
Show Gist options
  • Save AwwCookies/2b46be2baee7bee9afd9 to your computer and use it in GitHub Desktop.
Save AwwCookies/2b46be2baee7bee9afd9 to your computer and use it in GitHub Desktop.
Hunting is a clone of Flashy's bloodsports (http://digdilem.org/) hunting.pl
#!/usr/bin/env python
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# *This is a Peppermint plugin.* #
# Author: Emma Jones (AwwCookies) #
# Last Update: Nov 29th 2014 #
# Version: 1.1 #
# Desc: hunting.py: Hunting is a clone of Flashy's bloodsports #
# (http://digdilem.org/) hunting.pl # # #
# Commands: ~hunt, ~fish, ~trophies # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
import sys
import random
import peppermint
data, config = peppermint.get_dc(sys.argv)
variables = peppermint.load("hunting")
if not variables: # If variables is an empty dict
variables = {
"last hunter": None,
"last fisher": None,
"fishman": None,
"huntman": None,
"bigfish": None,
"bighunt": None,
"hunt record": 0,
"fish record": 0,
"catch percent": 90, # How often you catch or shoot something
"scale": "lb" # Say here whether you want to measure weights in lb or kg
}
fish = ["Salmon","Herring","Yellowfin Tuna","Pink Salmon","Chub","Barbel",
"Perch","Northern Pike","Brown Trout","Arctic Char","Roach","Brayling",
"Bleak","Cat Fish","Sun Fish","Old Tire","Rusty Tin Can","Genie Lamp",
"Love Message In A Bottle","Old Log","Rubber Boot","Dead Body",
"Loch Ness Monster","Old Fishing Lure","Piece of the Titanic",
"Chunk of Atlantis","Squid","Whale","Dolphin","Porpoise","Stingray",
"Submarine","Seal","Seahorse","Jellyfish","Starfish","Electric Eel",
"Great White Shark","Scuba Diver","X","Lag Monster","Virus",
"Soggy Pack of Smokes", "Pile of Weed","Boat Anchor","Pair Of Floaties",
"Mermaid","Merman","Halibut","Tiddler","Sock","Trout"]
hunts = ["bear","gopher","rabbit","hunter","deer","fox","duck","moose",
"pokemon named Pikachu","park ranger","Yogi Bear","Boo Boo Bear",
"dog named Benji","cow","raccoon","koala bear","camper","channel lamer",
"Aww"]
hunt_places = ["in some bushes","in a hunting blind","in a hole","up in a tree",
"in a hiding place","out in the open","in the middle of a field","downtown",
"on a street corner","at the local mall"]
fish_places = ["Stream","Lake","River","Pond","Ocean","Bathtub",
"Kiddie's Swimming Pool","Toilet","Pile of Vomit","Pool of Urine",
"Kitchen Sink","Bathroom Sink","Mud Puddle","Pail of Water",
"Bowl of Jell-O (tm)","Wash Basin","Rain Barrel","Aquarium","SnowBank",
"WaterFall","Cup of Coffee","Glass of Milk", "Bottle Of Whiskey"]
def hunting(channel, hunter):
if hunter == variables["last hunter"]:
peppermint.message(channel, "Stop hogging all the best pitches %s, let\
someone else try first!" % hunter)
else:
variables["last hunter"] = hunter
hunt_place = random.choice(hunt_places)
hunt = random.choice(hunts)
weight = random.randint(1, 100)
peppermint.message_override(hunter, "You hide %s and wait for something\
to wander by..." % hunt_place)
peppermint.message_override(hunter, ".")
peppermint.message_override(hunter, "..")
peppermint.message_override(hunter, "...")
peppermint.message_override(hunter, "You think you hear something and\
fire wildly in that direction!")
if random.randint(1, 100) < variables["catch percent"]:
peppermint.message_override(hunter, "Congratulations, %s! You just\
bagged yourself a %s%s %s" % (hunter, weight, variables["scale"],
hunt))
peppermint.message(channel, "%s just bagged a %s%s %s" %
(hunter, weight, variables["scale"], hunt))
if weight > variables["hunt record"]:
if variables["huntman"]:
peppermint.message(hunter, "Wow!!! That's a new record! Way\
to go, %s! Type !trophy to see it!" % hunter);
peppermint.message(
channel, "Brilliant! That breaks the old record of a\
%s%s %s %s is the world's best!" % \
(variables["hunt record"], variables["scale"],
variables["bighunt"], hunter));
variables["huntman"] = hunter
variables["hunt record"] = weight
variables["bighunt"] = hunt
else:
peppermint.message_override(hunter, "Rats...you missed it, %s\
Better luck next time!" % hunter)
peppermint.message(channel, "%s is useless, they missed by a mile!"
% hunter)
def fishing(channel, hunter):
if hunter == variables["last fisher"]:
peppermint.message(channel, "Stop hogging all the best pitches %s, let\
someone else try first!" % hunter)
else:
variables["last fisher"] = hunter
fish_place = random.choice(fish_places)
fishy = random.choice(fish)
weight = random.randint(1, 100)
peppermint.message_override(hunter, "You cast your line into a %s and\
wait for a bite..." % fish_place);
peppermint.message_override(hunter, ".");
peppermint.message_override(hunter, "..");
peppermint.message_override(hunter, "...");
peppermint.message_override(hunter, "You feel a tug on your line and\
reel it in...");
if random.randint(1, 100) < variables["catch percent"]:
peppermint.message_override(hunter, "Congratulations, %s! You just\
caught yourself a %s%s %s" % (hunter, weight, variables["scale"],
fishy))
peppermint.message(channel, "%s just caught a %s%s %s" %
(hunter, weight, variables["scale"], fishy))
if weight > variables["fish record"]:
if variables["fishman"]:
peppermint.message(hunter, "Wow!!! That's a new record! Way\
to go, %s! Type !trophy to see it!" % hunter);
peppermint.message(
channel, "Brilliant! That breaks the old record of a\
%s%s %s %s is the world's best!" % \
(variables["fish record"], variables["scale"],
variables["bigfish"], hunter));
variables["fishman"] = hunter
variables["fish record"] = weight
variables["bigfish"] = fishy
else:
peppermint.message_override(hunter, "Rats...you missed it, %s\
Better luck next time!" % hunter)
peppermint.message(
channel, "%s is useless, they failed to catch anything" % hunter)
def set_var(channel, var, value):
if var == "catch_percent":
variables["catch percent"] = int(value)
peppermint.message(channel, "catch_percent = %i" %
variables["catch percent"])
elif var == "scale":
variables["scale"] = str(value)
peppermint.message(channel, "scale = %s" %
variables["scale"])
if data["Type"] == "PRIVMSG":
args = data["Message"].split()
if args[0] == "~hunt":
hunting(data["Channel"], data["Nick"])
elif args[0] == "~fish":
fishing(data["Channel"], data["Nick"])
if data["Host"] in config["Owner"]:
if args[0] == "~hunting.py":
args = data["Message"].split()
if args[1] == "set":
set_var(data["Channel"], args[2], args[3])
elif args[1] == "reset":
peppermint.remove("hunting")
peppermint.message(data["Channel"], "hunting.py was reset.")
quit()
if args[0] == "~hunting.py":
if args[1] == "about":
peppermint.message(
data["Channel"], "Author: Emma Jones (AwwCookies)")
peppermint.message(data["Channel"], "Desc: hunting.py: Hunting is a\
clone of Flashy's bloodsports (http://digdilem.org/) hunting.pl")
peppermint.message(
data["Channel"], "Commands: ~hunt, ~fish, ~trophies")
if args[0] == "~trophies":
hunter = variables["huntman"]
weight = variables["hunt record"]
hunt = variables["bighunt"]
if variables["huntman"] or variables["fishman"]:
if hunter:
peppermint.message(data["Channel"], "%s holds the hunting\
record when they bagged a %s%s %s"
% (hunter, weight, variables["scale"], hunt))
hunter = variables["fishman"]
weight = variables["fish record"]
fishy = variables["bigfish"]
if hunter:
peppermint.message(data["Channel"], "%s holds the fishing\
record when they caught a %s%s %s"
% (hunter, weight, variables["scale"], fishy))
else:
peppermint.message(data["Channel"], "No trophies!? Someone get to\
hunting and fishing!")
peppermint.save("hunting", variables)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment