Example #1
0
def check_for_banana():
    if not c.user_is_loggedin or not is_eligible_request():
        return False

    all_effects = effects.get_all_effects([c.user._fullname])
    user_effects = all_effects.get(c.user._fullname, [])
    return "banana" in user_effects
Example #2
0
def check_for_banana():
    if not c.user_is_loggedin or not is_eligible_request():
        return False

    all_effects = effects.get_all_effects([c.user._fullname])
    user_effects = all_effects.get(c.user._fullname, [])
    return 'banana' in user_effects
Example #3
0
    def on_use(self, user, target):
        all_effects = effects.get_all_effects([user._fullname])
        user_effects = all_effects.get(user._fullname, [])

        ITEM_NAME = "python_rabbit_hat"
        if ITEM_NAME not in user_effects:
            effects.add_effect(effector=user, thing=user, effect=ITEM_NAME)

        super(Handgrenade, self).on_use(user, target)
Example #4
0
    def on_use(self, user, target):
        all_effects = effects.get_all_effects([user._fullname])
        user_effects = all_effects.get(user._fullname, [])

        ITEM_NAME = "python_rabbit_hat"
        if ITEM_NAME not in user_effects:
            effects.add_effect(effector=user, thing=user, effect=ITEM_NAME)

        super(Handgrenade, self).on_use(user, target)
Example #5
0
def award_gold_tophat():
    if not c.user.gold:
        return

    all_effects = effects.get_all_effects([c.user._fullname])
    user_effects = all_effects.get(c.user._fullname, [])

    ITEM_NAME = "gold_top_hat"
    if ITEM_NAME not in user_effects:
        effects.add_effect(effector=c.user, thing=c.user, effect=ITEM_NAME)
Example #6
0
def comment_reply_effect(comment):
    if comment.parent_id is not None:
        parent = Comment._byID(comment.parent_id, data=True)
    else:
        parent = Link._byID(comment.link_id, data=True)
    all_effects = effects.get_all_effects([parent._fullname])
    parent_effects = all_effects.get(parent._fullname, [])
    for item_name in parent_effects:
        item = items.get_item(item_name)
        item.on_reply(c.user, parent)
Example #7
0
def award_gold_tophat():
    if not c.user.gold:
        return

    all_effects = effects.get_all_effects([c.user._fullname])
    user_effects = all_effects.get(c.user._fullname, [])

    ITEM_NAME = "gold_top_hat"
    if ITEM_NAME not in user_effects:
        effects.add_effect(effector=c.user, thing=c.user, effect=ITEM_NAME)
Example #8
0
def comment_reply_effect(comment):
    if comment.parent_id is not None:
        parent = Comment._byID(comment.parent_id, data=True)
    else:
        parent = Link._byID(comment.link_id, data=True)
    all_effects = effects.get_all_effects([parent._fullname])
    parent_effects = all_effects.get(parent._fullname, [])
    for item_name in parent_effects:
        item = items.get_item(item_name)
        item.on_reply(c.user, parent)
Example #9
0
    def on_use(self, user, target):
        all_effects = effects.get_all_effects([target._fullname])
        target_effects = all_effects.get(target._fullname, [])
        target_afflictions = [e for e in target_effects
                              if not e.endswith("_hat")]

        if target_afflictions:
            to_heal = random.choice(target_afflictions)
            effects.remove_effect(target, to_heal)
            to_heal_title = g.f2pitems[to_heal]['title']
            item_title = self.item['title']
            msg = '%s used %s to heal of %s' % (user.name, item_title,
                                                to_heal_title)
        else:
            item_title = self.item['title']
            msg = ('%s used %s to heal you but you were '
                   'fully healthy. what a waste' % (user.name, item_title))
        subject = 'you have been healed!'

        if isinstance(target, Account):
            send_system_message(target, subject, msg)

        self.apply_damage_and_log(user, target, [target])
Example #10
0
    def on_use(self, user, target):
        all_effects = effects.get_all_effects([target._fullname])
        target_effects = all_effects.get(target._fullname, [])
        target_afflictions = [
            e for e in target_effects if not e.endswith("_hat")
        ]

        if target_afflictions:
            to_heal = random.choice(target_afflictions)
            effects.remove_effect(target, to_heal)
            to_heal_title = g.f2pitems[to_heal]['title']
            item_title = self.item['title']
            msg = '%s used %s to heal of %s' % (user.name, item_title,
                                                to_heal_title)
        else:
            item_title = self.item['title']
            msg = ('%s used %s to heal you but you were '
                   'fully healthy. what a waste' % (user.name, item_title))
        subject = 'you have been healed!'

        if isinstance(target, Account):
            send_system_message(target, subject, msg)

        self.apply_damage_and_log(user, target, [target])