コード例 #1
0
def before_listen_rpg_channel(listener, speaker, target, phrase, ask, exclaim, behavioured):
    # Con una probabilità dell'10%
    if random.randint(1, 10) != 1:
        return

    # Continua solo se sta per parlare l'unicorno rosa
    if speaker.prototype.code != "mfdonald_mob_unicorno-rosa":
        return

    # Spezza la frase detta in più parole (o gruppi di parole tra virgolette)
    words = multiple_arguments(phrase)

    # Controlla se vi sia almeno una parola che inizi nella maniera voluta
    # tra quelle dette (occhio che lo script si attiva anche se l'unicorno dice
    # parole come 'ringhia', per evitare questo bisognerebbe utilizzare la
    # funzione is_same sempre dal modulo utility)
    if not is_prefix(("drin", "ring"), words):
        return

    # Aggiungendo casualmente qualche punto esclamativo a quello che viene detto
    to_say = "Ring!%s Ring!%s" % (random_marks(0, 3), random_marks(0, 3))
    command_say(listener, to_say)

    # Avendo anticipato l'unicorno rosa blocca quello che stava per dire
    return True
def no_more_secrets(apprendista, speaker):
    # Normale che capiti visto che la funzione viene deferrata
    if not apprendista or not speaker:
        return

    to_say = "a %s Questo è tutto ciò che avevo da dirti, non c'è altro." % speaker.code
    command_say(apprendista, to_say)
コード例 #3
0
def before_listen_rpg_channel(listener, speaker, target, phrase, ask, exclaim,
                              behavioured):
    # Con una probabilità dell'10%
    if random.randint(1, 10) != 1:
        return

    # Continua solo se sta per parlare l'unicorno rosa
    if speaker.prototype.code != "mfdonald_mob_unicorno-rosa":
        return

    # Spezza la frase detta in più parole (o gruppi di parole tra virgolette)
    words = multiple_arguments(phrase)

    # Controlla se vi sia almeno una parola che inizi nella maniera voluta
    # tra quelle dette (occhio che lo script si attiva anche se l'unicorno dice
    # parole come 'ringhia', per evitare questo bisognerebbe utilizzare la
    # funzione is_same sempre dal modulo utility)
    if not is_prefix(("drin", "ring"), words):
        return

    # Aggiungendo casualmente qualche punto esclamativo a quello che viene detto
    to_say = "Ring!%s Ring!%s" % (random_marks(0, 3), random_marks(0, 3))
    command_say(listener, to_say)

    # Avendo anticipato l'unicorno rosa blocca quello che stava per dire
    return True
コード例 #4
0
def quest_reward(player, item, tessi):
    if tessi.location != player.location:
        to_say = "a %s %s, ma dove scappi? Non vuoi la ricompensa dopo tanto affanno? Vabbè!" % (player.code, player.name)
        command_say(tessi, to_say)
        return

    # (GATTO) il valore forse è da tarare
    experience = 100 * max(1, player.level / 2)
    player.experience += experience
    player.send_output("Guadagni [white]%d[close] di esperienza!" % experience)

    tessi.specials["player_on_quest"] = ""
    #to_say = "Quest False"
    #command_say(tessi, to_say)

    to_say_1 = "a %s È proprio il mio fermacapelli! Dopo tanto affanno ecco a te un piccolo presente come ringraziamento." % player.code
    defer_if_possible(1, 1, tessi, player, command_say, tessi, to_say_1)

    # Poiché un'iniezione silenziosa di un oggetto ad un giocatore non è molto
    # friendly allora dà il medaglione alla tessitrice e quest'ultima lo dà
    # al giocatore tramite un give
    medaglione = Item(MEDAGLIONE_PROTO_CODE)
    unguento   = Item(UNGUENTO_PROTO_CODE)
    medaglione.inject(tessi)
    unguento.inject(medaglione)
    defer_if_possible(2, 2, tessi, player, give_reward, tessi, medaglione, player)

    to_say_2 = "a %s Adoperalo con saggezza, solo quando saprai che farne perché potrai utilizzarlo una sola volta." % player.code
    defer_if_possible(3, 3, tessi, player, command_say, tessi, to_say_2)

    defer(4, reset_quest, tessi)
def before_listen_rpg_channel(locandiera, player, target, phrase, ask, exclaim,
                              behavioured):
    # Mi assicuro che si stia parlando rivolgendosi alla locandiera
    if target != locandiera:
        return

    if is_infix("menù", phrase):
        to_say = "a %s Il nostro menù di oggi lo potete leggere anche da qui, è lì sul bancone." % player.code
        defer_if_possible(1, 2, locandiera, player, command_say, locandiera,
                          to_say)
        return

    proto_cibi = []
    for proto_code in PROTO_FOODS_CODES:
        table_name = "proto_" + proto_code.split("_")[1] + "s"
        proto_entity = database[table_name][proto_code]
        for keyword in multiple_arguments(
                proto_entity.get_keywords_attr(looker=locandiera)):
            if is_infix(keyword, phrase):
                proto_cibi.append(proto_entity)

    player_code = player.get_numbered_keyword(looker=locandiera)

    if not proto_cibi:
        to_say = "a %s Non abbiam nessun cibo di quel tipo..." % player_code
        command_say(locandiera, to_say)
        return

    proto_pietanza = random.choice(proto_cibi)
    pietanza = proto_pietanza.CONSTRUCTOR(proto_pietanza.code)

    to_say = "a %s Ottimo! %s in arrivo." % (
        player_code, first_color_upper(pietanza.get_name(looker=locandiera)))
    defer_random_time(1, 2, command_say, locandiera, to_say)
    defer_random_time(5, 7, locandiera_act, locandiera, player, pietanza)
コード例 #6
0
def after_look(player, spiritello, descr, detail, use_examine, behavioured):
    if random.randint(0, 1):
        to_say = "a %s *piagnucoloso* Il luccichino! Il mio luccichino, malvagio ragno avido e scontroso!" % player.code
    else:
        to_say = "a self *piagnucoloso* Il luccichino! Il mio luccichino, malvagio ragno... malvagio..."

    command_say(spiritello, to_say)
コード例 #7
0
def look_for_caterpillar(dust, show_act=True):
    if not dust:
        log.bug("dust non è un parametro valido: %r" % dust)
        return

    caterpillar = dust.find_entity("bruco", dust.location, ["mobs"])
    if not caterpillar:
        if show_act:
            dust.act("My name is $n: niente bruchi" % dust, TO.OTHERS)
            dust.act("My name is $n: niente bruchi" % dust, TO.ENTITY)

        defer(60, look_for_caterpillar, dust)
        return

    if show_act:
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar, TO.OTHERS)
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar, TO.ENTITY)
        command_say(caterpillar, "sa la vist cus'è?")

    #defer(60, look_for_caterpillar, dust)
    # il bruco potrebbe essere soggetto a script che lo potrebbero mutare senza
    # avvisaglie quindi tolgo di mezzo il bruco per sostituirlo con un altro
    # che so non essere afflitto da script
    location = caterpillar.location
    caterpillar.extract(1)
    new_caterpillar = Mob(PROTO_CATERPILLAR_CODE)
    new_caterpillar.inject(location)
    new_caterpillar.act("$n cambia aspetto in modo repentino.", TO.OTHERS)

    dust_eating(dust, new_caterpillar)
コード例 #8
0
def ask_for_answer(idrusa, player):
    # Controlla se la quest non sia già stata resettata oppure avanzata
    if "quest_status" not in idrusa.specials or idrusa.specials["quest_status"] != "domanda":
        return

    to_say = "a %s *supponente* L'incoscienza non ti manca di certo! Lo vuoi davvero?" % player.code
    command_say(idrusa, to_say)
def before_listen_rpg_channel(caldarrostaio, player, target, phrase, ask, exclaim, behavioured):
    if not player.IS_PLAYER:
        return

    # Mi assicuro che si stia parlando rivolgendosi al caldarrostaio
    if target != caldarrostaio:
        return

    if is_infix("menù", phrase):
        to_say = "a %s Car$o, io vendo solo caldarroste." % player.code
        defer_random_time(1, 2, command_say, caldarrostaio, to_say)
        return

    proto_cibi = []
    for proto_code in PROTO_FOODS_CODES:
        table_name = "proto_" + proto_code.split("_")[1] + "s"  # E con questo hai scoperto come mai i codici prototipo delle entità devono avere l'identificativo della tipologia tra due underscore
        proto_entity = database[table_name][proto_code]
        for keyword in multiple_arguments(proto_entity.get_keywords_attr()):
            #print ">>> Keyword <<<", proto_entity.code, keyword
            if is_infix(keyword, phrase):
                proto_cibi.append(proto_entity)

    if not proto_cibi:
        to_say = "a %s Ma io vendo solo castagne!" % player.code
        command_say(caldarrostaio, to_say)
        return

    to_say = "a %s Castagne in arrivo!" % player.code
    defer_random_time(1, 2, command_say, caldarrostaio, to_say)

    proto_pietanza = random.choice(proto_cibi)
    castagne = proto_pietanza.CONSTRUCTOR(proto_pietanza.code)
    defer_random_time(5, 7, caldarrostaio_act, caldarrostaio, player, castagne)
コード例 #10
0
def change_mob(bimba, num):
    # Normale che possa capitare visto che la funzione è deferrata
    if not bimba:
        return

    bimba.long = "$N " + bimba_long_db[num]
    bimba.descr = bimba_descr_db[num]

    if num != 3:
        bimba.act(bimba_act_entity[num], TO.ENTITY)
        bimba.act(bimba_act_other[num], TO.OTHERS)
        return

    locandiera = find_mob(LOCANDIERA_PROTO_CODE)
    if not locandiera:
        return

    num_rand = random.randint(1, 100)
    if num_rand < 25: 
        pietanza_label = pietanze_db[1]
    elif num_rand < 65:
        pietanza_label = pietanze_db[2]
    elif num_rand < 88:
        pietanza_label = pietanze_db[3]
    else:
        pietanza_label = pietanze_db[4]

    locandiera_keyword = locandiera.get_numbered_keyword(looker=bimba)
    to_say = "a %s Zietta, ho fame! %s" % (locandiera_keyword, pietanza_label)
    command_say(bimba, to_say)
コード例 #11
0
def look_for_caterpillar(dust, show_act=True):
    if not dust:
        log.bug("dust non è un parametro valido: %r" % dust)
        return

    caterpillar = dust.find_entity("bruco", dust.location, ["mobs"])
    if not caterpillar:
        if show_act:
            dust.act("My name is $n: niente bruchi" % dust, TO.OTHERS)
            dust.act("My name is $n: niente bruchi" % dust, TO.ENTITY)

        defer(60, look_for_caterpillar, dust)
        return

    if show_act:
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar,
                 TO.OTHERS)
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar,
                 TO.ENTITY)
        command_say(caterpillar, "sa la vist cus'è?")

    #defer(60, look_for_caterpillar, dust)
    # il bruco potrebbe essere soggetto a script che lo potrebbero mutare senza
    # avvisaglie quindi tolgo di mezzo il bruco per sostituirlo con un altro
    # che so non essere afflitto da script
    location = caterpillar.location
    caterpillar.extract(1)
    new_caterpillar = Mob(PROTO_CATERPILLAR_CODE)
    new_caterpillar.inject(location)
    new_caterpillar.act("$n cambia aspetto in modo repentino.", TO.OTHERS)

    dust_eating(dust, new_caterpillar)
def no_secret(apprendista, speaker):
    # Normale che capiti visto che la funzione viene deferrata
    if not apprendista or not speaker:
        return

    to_say = "a %s Oh beh... Peggio per te!" % speaker.code
    command_say(apprendista, to_say)
def no_more_secrets(apprendista, speaker):
    # Normale che capiti visto che la funzione viene deferrata
    if not apprendista or not speaker:
        return

    to_say = "a %s Questo è tutto ciò che avevo da dirti, non c'è altro." % speaker.code
    command_say(apprendista, to_say)
def no_secret(apprendista, speaker):
    # Normale che capiti visto che la funzione viene deferrata
    if not apprendista or not speaker:
        return

    to_say = "a %s Oh beh... Peggio per te!" % speaker.code
    command_say(apprendista, to_say)
def before_listen_rpg_channel(locandiera, player, target, phrase, ask, exclaim, behavioured):
    # Mi assicuro che si stia parlando rivolgendosi alla locandiera
    if target != locandiera:
        return

    if is_infix("menù", phrase):
        to_say = "a %s Il nostro menù di oggi lo potete leggere anche da qui, è lì sul bancone." % player.code
        defer_if_possible(1, 2, locandiera, player, command_say, locandiera, to_say)
        return

    proto_cibi = []
    for proto_code in PROTO_FOODS_CODES:
        table_name = "proto_" + proto_code.split("_")[1] + "s"
        proto_entity = database[table_name][proto_code]
        for keyword in multiple_arguments(proto_entity.get_keywords_attr(looker=locandiera)):
            if is_infix(keyword, phrase):
                proto_cibi.append(proto_entity)

    player_code = player.get_numbered_keyword(looker=locandiera)

    if not proto_cibi:
        to_say = "a %s Non abbiam nessun cibo di quel tipo..." % player_code
        command_say(locandiera, to_say)
        return

    proto_pietanza = random.choice(proto_cibi)
    pietanza = proto_pietanza.CONSTRUCTOR(proto_pietanza.code)

    to_say = "a %s Ottimo! %s in arrivo." % (player_code, first_color_upper(pietanza.get_name(looker=locandiera)))
    defer_random_time(1, 2, command_say, locandiera, to_say)
    defer_random_time(5, 7, locandiera_act, locandiera, player, pietanza)
コード例 #16
0
def ask_for_answer(idrusa, player):
    # Controlla se la quest non sia già stata resettata oppure avanzata
    if "quest_status" not in idrusa.specials or idrusa.specials[
            "quest_status"] != "domanda":
        return

    to_say = "a %s *supponente* L'incoscienza non ti manca di certo! Lo vuoi davvero?" % player.code
    command_say(idrusa, to_say)
コード例 #17
0
def before_giving(player, cibo, bimba, direction, behavioured):
    if player.IS_PLAYER or not player.race == RACE.TUAREG:
        to_say = "a %s La mia zietta mi ha detto di non accettare cibo dagli sconosciuti!" % player.code
        command_say(bimba, to_say)
        return True
    else:
        #print "pappa in arrivo"
        defer_random_time(1, 3, cibo_eat, cibo, bimba)
def ask_again(apprendista, speaker):
    # Normale che capiti visto che la funzione viene deferrata
    if not apprendista or not speaker:
        return

    to_say = "a %s *deluso* Ok, forse non si siamo capiti, è un segreto che nessun'altro sarebbe disposto a svelarti." % speaker.code
    command_say(apprendista, to_say)
    to_say = "a %s Te lo richiedo: vuoi conoscere un segreto riguardo a questo villaggio?" % speaker.code
    defer_if_possible(1, apprendista, speaker, command_say, apprendista, to_say)

    apprendista.specials["apprendista_situation"] = "domanda"
コード例 #19
0
def cibo_eat(cibo, bimba):
    # Può accadere visto che tale funzione è deferrata
    if not bimba:
        return

    if not cibo:
        to_say = "Non riesco a mangiare..."
        command_say(bimba, to_say)
        return

    numbered_keyword = cibo.get_numbered_keyword(looker=bimba)
    command_eat(bimba, numbered_keyword)
def ask_again(apprendista, speaker):
    # Normale che capiti visto che la funzione viene deferrata
    if not apprendista or not speaker:
        return

    to_say = "a %s *deluso* Ok, forse non si siamo capiti, è un segreto che nessun'altro sarebbe disposto a svelarti." % speaker.code
    command_say(apprendista, to_say)
    to_say = "a %s Te lo richiedo: vuoi conoscere un segreto riguardo a questo villaggio?" % speaker.code
    defer_if_possible(1, apprendista, speaker, command_say, apprendista,
                      to_say)

    apprendista.specials["apprendista_situation"] = "domanda"
コード例 #21
0
def after_listen_say(charlie, speaker, target, phrase, ask, exclaimi, behavioured):
    if not speaker.IS_PLAYER:
        return

    # Controlla se la quest non sia già stata resettata oppure avanzata
    if ("charlie_banana_quest:status" not in charlie.specials
    or charlie.specials["charlie_banana_quest:status"] != "domanda"):
        return

    # Ricava la frase ripulita dalla punteggiatura e non continua la quest fino
    # a che il giocatore non dice: sì
    phrase = ALFA_ONLY_PATTERN.sub("", phrase)
    if not is_same(phrase, "si"):
        return

    # Guarda il giocatore che ha risposto, brrrr, fa sempre senso vedere i mob
    # così "intelligenti"
    command_look(charlie, speaker.code)

    # Ignora coloro che hanno risposto ma che non sono stati scelti per la quest
    quest_player_code = charlie.specials["charlie_banana_quest:player"]
    if speaker.code != quest_player_code:
        quest_player = database["players"][quest_player_code]
        # Ricava il nome o la short per come lo vede charlie
        to_say = "a %s *concentrato* Grazie, ma no, grazie! Sto aspettando la risposta da %s." % (
            speaker.code, quest_player.get_name(charlie))
        command_say(charlie, to_say)
        return

    # Visto che il secondo stadio della missione si sta attivando cancella il
    # precedente reset che è meglio che sia reimpostato a fine funzione
    delete_charlie_reset_call(charlie)

    # Ecco un nuovo pollo da spennare! Finalmente il giocatore si è deciso a
    # rispondere!
    # Facciamo avanzare lo stato della quest e descriviamo quello che vogliamo
    charlie.specials["charlie_banana_quest:status"] = "cerca"

    to_say = "a %s *esasperato* Non ce la faccio più! Questi due unicorni mi stanno facendo impazzire!" % quest_player_code
    reactor.callLater(random.randint(1, 2), command_say, charlie, to_say)

    to_say = "a %s Portami due banane, cosicché io possa sopportarli almeno per un po'.." % quest_player_code
    reactor.callLater(random.randint(4, 6), command_say, charlie, to_say)

    # (TT) questo è da snoopare.. forse non funziona il self say con parole chiave del nome
    to_murmur = "a self *pensieroso* Già! Con due banane potrei..."
    reactor.callLater(random.randint(20, 40), command_murmur, charlie, to_murmur)

    # Ecco qui, qui viene impostata la durata media della quest, ovvero quanto
    # charlie attenderà che il giocatore gli porti due banane
    reset_call = reactor.callLater(random.randint(200, 300), reset_banana_quest, charlie)
    charlie.specials["charlie_banana_quest:reset_call"] = reset_call
コード例 #22
0
def stop_waiting_for_reply(tessi, player):
    if not tessi or not player:
        return

    tessi.specials["player_for_reply"] = ""
    if "player_on_quest" in tessi.specials and tessi.specials["player_on_quest"]:
        return

    if player.location == tessi.location:
        to_say = "a %s Mi par di capire che quindi non sei interessat$o." % player.code
    else:
        to_say = "Mi par di capire che nessuno sia interessat$o."
    command_say(tessi, to_say)
コード例 #23
0
def give_reward(tessi, medaglione, player):
    if not tessi or not medaglione or not player:
        return

    execution_result = command_give(tessi, "%s %s" % (medaglione.get_numbered_keyword(tessi), player.get_numbered_keyword(tessi)))
    if not execution_result:
        # La causa più tipica (non bacosa) per cui il give non vada a buon fine
        # è perché il giocatore ha un peso trasportato troppo grande
        command_say(tessi, "a %s Non riesco a dartel$o, te lo lascio per terra." % player.code)
        execution_result = command_drop(tessi, medaglione.get_numbered_keyword(tessi))
        if not execution_result:
            command_say(tessi, "a %s *sospirando* Arrivati a questo punto a mali estremi, estremi rimedi... Ecco! Dovresti averlo in inventario." % player.code)
            medaglione = medaglione.from_location(1)
            medaglione.to_location(player)
コード例 #24
0
def reset_timer(mob, message=""):
    # E' normale visto che tale funzione viene deferrata
    if not mob:
        return

    if "wait_for_reply" in mob.specials:
        del (mob.specials["wait_for_reply"])
    if "player" in mob.specials:
        del (mob.specials["player"])
    if "riddle" in mob.specials:
        del (mob.specials["riddle"])

    if message:
        command_say(mob, message)
コード例 #25
0
def after_listen_say(listener, speaker, target, phrase, ask, exclaim, behavioured):
    if not target:
        return
    if target.can_see(speaker):
        to_say = "a %s *adirato* è [red]tardi[close] mi hai indisposto!" % speaker.code
    else:
        to_say = "*spaventato* Chi sei? Cosa vuoi da me? Lasciami in pace, vai via [red]ora[close] che mi hai adirato!"
    command_say(target, to_say)

    if "vagytur" in target.specials:
        to_say = "Vagytur nelle special!"
    else:
        to_say = "Vagytur non è nelle special"
    defer(2, command_say, target, to_say)
コード例 #26
0
def before_giving(player, arma, fabbro, direction, behavioured):
    # Solo per i giocatori
    if not player.IS_PLAYER:
        player.act("$N non accetta che tu gli dia alcunché.", TO.ENTITY,
                   fabbro)
        player.act("$n cerca inutilmente di dare qualcosa a $n.", TO.OTHERS,
                   fabbro)
        player.act("$n cerca di darti robaccia ma tu non accetti.", TO.TARGET,
                   fabbro)
        return True

    arma_name = arma.get_name(looker=fabbro)

    # Solo se l'oggetto è un'arma
    if not arma.weapon_type:
        to_say = "a %s Non mi pare proprio che %s sia un'arma." % (player.code,
                                                                   arma_name)
        command_say(fabbro, to_say)
        return True

    if arma.life >= arma.max_life:
        to_say = "a %s Si vede ad occhio che %s non ha bisogno di riparazioni!" % (
            player.code, arma_name)
        command_say(fabbro, to_say)
        return True

    to_say = "a %s %s ha proprio bisogno di una sistemata." % (
        player.code, color_first_upper(arma_name))
    command_say(fabbro, to_say)

    # (TD) farei una defer con messaggio di act con il lavorio sull'arma
    arma.life = arma.max_life
    to_say = "a %s Ecco fatto, ora %s è a posto!" % (player.code, arma_name)
    command_say(fabbro, to_say)
    return True
コード例 #27
0
def reset_timer(mob, message=""):
    # E' normale visto che tale funzione viene deferrata
    if not mob:
        return

    if "wait_for_reply" in mob.specials:
        del(mob.specials["wait_for_reply"])
    if "player" in mob.specials:
        del(mob.specials["player"])
    if "riddle" in mob.specials:
        del(mob.specials["riddle"])

    if message:
        command_say(mob, message)
コード例 #28
0
def before_giving(player, arma, fabbro, direction, behavioured):
    # Solo per i giocatori
    if not player.IS_PLAYER:
        player.act("$N non accetta che tu gli dia alcunché.", TO.ENTITY, fabbro)
        player.act("$n cerca inutilmente di dare qualcosa a $n.", TO.OTHERS, fabbro)
        player.act("$n cerca di darti robaccia ma tu non accetti.", TO.TARGET, fabbro)
        return True

    arma_name = arma.get_name(looker=fabbro)

    # Solo se l'oggetto è un'arma
    if not arma.weapon_type:
        to_say = "a %s Non mi pare proprio che %s sia un'arma." % (player.code, arma_name)
        command_say(fabbro, to_say)
        return True

    if arma.life >= arma.max_life:
        to_say = "a %s Si vede ad occhio che %s non ha bisogno di riparazioni!" % (player.code, arma_name)
        command_say(fabbro, to_say)
        return True

    to_say = "a %s %s ha proprio bisogno di una sistemata." % (player.code, color_first_upper(arma_name))
    command_say(fabbro, to_say)

    # (TD) farei una defer con messaggio di act con il lavorio sull'arma
    arma.life = arma.max_life
    to_say = "a %s Ecco fatto, ora %s è a posto!" % (player.code, arma_name)
    command_say(fabbro, to_say)
    return True
コード例 #29
0
def spiegazioni(apprendista, player):
    # Normale che possa accadere visto che la funzione viene deferrata
    if not apprendista or not player:
        return

    if not player.IS_PLAYER:
        return

    to_say = "a %s *apprensivo* Io ti posso creare un golem per esercitarti a combattere ma mi devi dire di che materiale lo vuoi." % player.code
    command_say(apprendista, to_say)

    example = random.choice(ITEM_PROTO_CODE.keys())
    to_say = "a %s Per esempio potresti volerlo di %s." % (player.code, example)
    defer_if_possible(1, 2, apprendista, player, command_say, apprendista, to_say)
コード例 #30
0
def after_listen_say(listener, speaker, target, phrase, behavioured):
    if not speaker.IS_PLAYER:
        return

    if not target:
        return

    if not target.IS_ROOM:
        return

    if target.can_see(speaker):
        to_say = "a %s *adirato* Odioso malnato sputaveleno! Fuggito in quell'impossibile intrico di gallerie" % speaker.code
    else:
        to_say = "*spaventato* Chi sei? Cosa vuoi da me? Lasciami in pace, vai via!"
    command_say(target, to_say)
コード例 #31
0
def spiegazioni(apprendista, player):
    # Normale che possa accadere visto che la funzione viene deferrata
    if not apprendista or not player:
        return

    if not player.IS_PLAYER:
        return

    to_say = "a %s *apprensivo* Io ti posso creare un golem per esercitarti a combattere ma mi devi dire di che materiale lo vuoi." % player.code
    command_say(apprendista, to_say)

    example = random.choice(ITEM_PROTO_CODE.keys())
    to_say = "a %s Per esempio potresti volerlo di %s." % (player.code,
                                                           example)
    defer_if_possible(1, 2, apprendista, player, command_say, apprendista,
                      to_say)
コード例 #32
0
def before_west(entity, from_room, direction, to_room, running, behavioured):
    num_players = 0
    serpide_nero = None
    for contenuto in from_room.iter_contains():
        if contenuto.IS_MOB:
            if contenuto.code.split("#")[0] == SERPIDE_NERO_PROTO_CODE:
                serpide_nero = contenuto.split_entity(1)
        elif contenuto.IS_PLAYER:
            num_players += 1

    if serpide_nero:
        if num_players == 1:
            to_say = "Ehi! Non ti è concesso passare da qui!"
        else:
            to_say = "Per andare verso questa direzione ci vuole un permesso speciale che non avrai mai!!!"
        command_say(serpide_nero, to_say)
        return True
コード例 #33
0
def before_west(entity, from_room, direction, to_room, running, behavioured):
    num_players = 0
    serpide_nero = None
    for contenuto in from_room.iter_contains():
        if contenuto.IS_MOB:
            if contenuto.code.split("#")[0] == SERPIDE_NERO_PROTO_CODE:
                serpide_nero = contenuto.split_entity(1)
        elif contenuto.IS_PLAYER:
            num_players += 1

    if serpide_nero:
        if num_players == 1:
            to_say = "Ehi! Non ti è concesso passare da qui!"
        else:
            to_say = "Per andare verso questa direzione ci vuole un permesso speciale che non avrai mai!!!"
        command_say(serpide_nero, to_say)
        return True
コード例 #34
0
def generate_item(apprendista, player, choosed_material, room):
    # Normale che possa accadere visto che la funzione viene deferrata
    if not apprendista or not player or not room:
        return

    to_say = "Uhm... un golem di %s... Cominciamo un po'..." % choosed_material
    command_say(apprendista, to_say)

    proto_item_code = ITEM_PROTO_CODE[choosed_material]
    item = Item(proto_item_code)
    item.flags += FLAG.NO_GET
    item.inject(room)

    # (bb) perché funzioni al meglio il sistema di persistent act qui bisogna
    # che esista anche il messaggio a TO.ENTITY, da aggiungere quindi
    apprendista.act(PHRASES[choosed_material], TO.OTHERS, item)
    defer_random_time(12, 20, generate_golem, apprendista, player, choosed_material, room, item)
コード例 #35
0
def reset_farfalla_quest(idrusa):
    # E' normale poiché questa funzione viene anche deferrata
    if not idrusa:
        return

    player_is_here = False
    quest_player_code = ""
    idrusa.specials["before_lookeding_me"] = True
    if "player_code" in idrusa.specials:
        quest_player_code = idrusa.specials["player_code"]
        quest_player = database["players"][quest_player_code]
        for player in idrusa.location.players:
            if player.code == quest_player_code:
                player_is_here = True
                break

    if "quest_status" in idrusa.specials:
        quest_status = idrusa.specials["quest_status"]
        if quest_status == "domanda":
            if player_is_here:
                to_say = "a %s *tranquilla* Oh beh.. qualchedun altro si farà avanti." % quest_player_code
            else:
                to_say = "a %s *tranquilla* Oh beh.. qualchedun altro si farà avanti.." % idrusa.get_numbered_keyword(
                )
            command_say(idrusa, to_say)
        elif quest_status == "cerca":
            if player_is_here:
                to_say = "a %s *impaziente* Ci hai messo troppo tempo!" % quest_player_code
            elif quest_player_code:
                to_say = "a %s *impaziente* %s ci ha messo troppo tempo, lasciamo stare.." % (
                    idrusa.get_numbered_keyword(),
                    quest_player.get_name(idrusa))
            else:
                to_say = "a %s *impaziente* chi si era proposto ha evidentemente desistito..." % idrusa.get_numbered_keyword(
                )
            command_say(idrusa, to_say)

    extract_farfalle(idrusa)

    # Cancelliamo anche le variabili speciali della quest
    if "quest_status" in idrusa.specials:
        del (idrusa.specials["quest_status"])
    if "player_code" in idrusa.specials:
        del (idrusa.specials["player_code"])
    delete_deferred_reset(idrusa)
コード例 #36
0
def ask_for_answer(charlie, player):
    # Controlla se la quest non sia già stata resettata oppure avanzata
    if ("charlie_banana_quest:status" not in charlie.specials
    or charlie.specials["charlie_banana_quest:status"] != "domanda"):
        return

    if charlie.location != player.location:
        return

    suffix = ""
    if random.randint(1, 4) == 1:
        suffix = " Ti prego!"

    to_say = "a %s *disperato* Dimmi di sì!%s" % (player.code, suffix)
    command_say(charlie, to_say)

    # Glielo richiede a ruota fino a che il giocatore risponde sì! Fastidioso? :P
    reactor.callLater(random.randint(15, 30), ask_for_answer, charlie, player)
コード例 #37
0
def beg_the_player(idrusa, player):
    idrusa.specials["before_lookeding_me"] = False
    idrusa.specials["quest_status"] = "domanda"
    idrusa.specials["player_code"] = player.code

    to_say = "a %s *supponente* sei qui forse per accedere al regno di Klirbe?" % player.code
    command_say(idrusa, to_say)
    
    # Dopo un po' chiede nuovamente al giocatore di rispondere alla sua
    # richiesta di aiuto nel qual caso che il giocatore non abbia afferrato
    # l'indizio di quello che deve fare
    defer_if_possible(15, 30, idrusa, player, ask_for_answer, idrusa, player)

    # L'idrusa non starà ad aspettare in eterno che il giocatore si decida a
    # iniziare la quest, se dopo un po' di tempo lo status della quest non
    # è cambiato allora gli specials vengono azzerati
    deferred_reset = defer_random_time(60, 90, reset_farfalla_quest, idrusa)
    idrusa.specials["deferred_reset"] = deferred_reset
コード例 #38
0
def beg_the_player(idrusa, player):
    idrusa.specials["before_lookeding_me"] = False
    idrusa.specials["quest_status"] = "domanda"
    idrusa.specials["player_code"] = player.code

    to_say = "a %s *supponente* sei qui forse per accedere al regno di Klirbe?" % player.code
    command_say(idrusa, to_say)

    # Dopo un po' chiede nuovamente al giocatore di rispondere alla sua
    # richiesta di aiuto nel qual caso che il giocatore non abbia afferrato
    # l'indizio di quello che deve fare
    defer_if_possible(15, 30, idrusa, player, ask_for_answer, idrusa, player)

    # L'idrusa non starà ad aspettare in eterno che il giocatore si decida a
    # iniziare la quest, se dopo un po' di tempo lo status della quest non
    # è cambiato allora gli specials vengono azzerati
    deferred_reset = defer_random_time(60, 90, reset_farfalla_quest, idrusa)
    idrusa.specials["deferred_reset"] = deferred_reset
コード例 #39
0
def generate_item(apprendista, player, choosed_material, room):
    # Normale che possa accadere visto che la funzione viene deferrata
    if not apprendista or not player or not room:
        return

    to_say = "Uhm... un golem di %s... Cominciamo un po'..." % choosed_material
    command_say(apprendista, to_say)

    proto_item_code = ITEM_PROTO_CODE[choosed_material]
    item = Item(proto_item_code)
    item.flags += FLAG.NO_GET
    item.inject(room)

    # (bb) perché funzioni al meglio il sistema di persistent act qui bisogna
    # che esista anche il messaggio a TO.ENTITY, da aggiungere quindi
    apprendista.act(PHRASES[choosed_material], TO.OTHERS, item)
    defer_random_time(12, 20, generate_golem, apprendista, player,
                      choosed_material, room, item)
def before_listen_say(listener, speaker, apprendista, phrase, ask, exclaim,
                      behavioured):
    if not speaker.IS_PLAYER:
        return

    if not apprendista.specials or not "apprendista:player_code" in apprendista.specials or not "apprendista_situation" in apprendista.specials:
        return

    player_code = apprendista.specials["apprendista:player_code"]
    situation = apprendista.specials["apprendista_situation"]

    if situation == "look":
        if speaker.code != player_code:
            to_say = "a %s *allegro* Benvenuto nella bottega del tagliapietre! Eseguiamo lavorazioni per tutti i gusti e tutte le voglie!" % speaker.code
            command_say(apprendista, to_say)
            return

        if is_same(phrase, "no"):
            defer(1, reveal_secret, apprendista, speaker)
            defer(60, del_specials, apprendista)
            return

        defer(1, ask_again, apprendista, speaker)
        defer(60, del_specials_status, apprendista, "domanda")
        return

    if situation == "domanda":
        if speaker.code != player_code:
            to_say = "a %s *allegro* Benvenuto nella bottega del tagliapietre! Eseguiamo lavorazioni per tutti i gusti e tutte le voglie!" % speaker.code
            command_say(apprendista, to_say)
            return

        phrase = ALFA_ONLY_PATTERN.sub("", phrase)
        if is_same(phrase, "si"):
            defer(1, reveal_secret, apprendista, speaker)
            defer(60, del_specials, apprendista)
            return
        defer(1, no_secret, apprendista, speaker)
        del_specials(apprendista)
        return

    if situation == "segreto_svelato":
        defer(1, no_more_secrets, apprendista, speaker)
        del_specials(apprendista)
コード例 #41
0
def before_giving(player, item, tessi, direction, behavioured):
    if tessi.race == RACE.BIRD:
        to_say = "a %s skreee skreee!" % player.get_numbered_keyword(tessi)
        command_say(tessi, to_say)
        return True

    if not player.IS_PLAYER:
        to_say = "a %s Sei gentile, ma non posso accettare." % player.get_numbered_keyword(tessi)
        defer_if_possible(1, 2, tessi, player, command_say, tessi, to_say)
        return True

    for proto_fermaglio in database["proto_items"].itervalues():
        if proto_fermaglio.code == FERMAGLIO_PROTO_CODE:
            proto_fermaglio.split_entity(1)
            break
    else:
        print ">>> niente fermaglio nel database <<<"
        to_say = "a %s *imbarazzata* C'è stato un problema, mi spiace ma non c'è più il mio fermaglio! La ricerca va abbandonata." % player.code
        defer_if_possible(1, 2, tessi, player, command_say, tessi, to_say)
        tessi.specials["player_on_quest"] = ""
        return True

    if proto_fermaglio.code != item.prototype.code:
        to_say = "a %s *rabbuiata* Non è questo quello che ho smarrito, mi dispiace." % player.code
        defer_if_possible(1, 2, tessi, player, command_say, tessi, to_say)
        return True

    if "player_on_quest" not in tessi.specials:
        return True

    if not tessi.specials["player_on_quest"]:
        print ">>> di qui non si dovrebbe passare a meno che qualche admin abbia creato item <<<"
        return True

    # Se il giocatore che porta il fermaglio non è quello della quest la
    # tessitrice lo accetta lo stesso ma non viene dato nessun reward
    if player.code != tessi.specials["player_on_quest"]:
        original_player = database["players"][tessi.specials["player_on_quest"]]
        to_say = "a %s *sorpresa* Ma tu non sei %s..." % (player.code, original_player.get_name(player))
        defer_if_possible(1, 1, tessi, player, command_say, tessi, to_say)
        #return False

    quest_reward(player, item, tessi)
    return False
コード例 #42
0
def ask_help(tessi, player):
    if not tessi or not player:
        return

    print "villaggio-zingaro_mob_test-tessi - >>>  ask_help <<<"
    # (TD) calcolo del tempo rimanente per la quest già in corso

    if "player_on_quest" in tessi.specials and tessi.specials["player_on_quest"]:
        if player.code == tessi.specials["player_on_quest"]:
            to_say = "a %s *speranzosa* Hai novità riguardo al mio fermaglio scomparso?" % player.code
        else:
            to_say = "a %s *misteriosa* Gentile viandante che mi osservi, dai anche tu manforte agli avventurieri che si son offerti e stanno cercando il mio fermaglio. L'ho perduto mentre mi recavo al pozzo." % player.code
        command_say(tessi, to_say)
        return

    to_say = "a %s *misteriosa* Viandante, tu che poggi l'occhio su di me; sei dispost$o ad aiutarmi a recuperare il fermaglio che ho smarrito oggi?" % player.code
    command_say(tessi, to_say)
    tessi.specials["player_for_reply"] = player.code
    defer_random_time(30, 40, stop_waiting_for_reply, tessi, player)
コード例 #43
0
def after_listen_say(idrusa, speaker, target, phrase, behavioured):
    if not speaker.IS_PLAYER:
        return

    # Controlla se la quest non sia già stata resettata oppure avanzata
    if "quest_status" not in idrusa.specials or idrusa.specials[
            "quest_status"] != "domanda":
        return

    # Ricava la frase ripulita dalla punteggiatura e non continua la quest fino
    # a che il giocatore non dice: sì
    phrase = ALFA_ONLY_PATTERN.sub("", phrase)
    if not is_same(phrase, "si"):
        return

    # Guarda il giocatore che ha risposto
    command_look(idrusa, speaker.code)

    # Ignora coloro che hanno risposto ma che non hanno avviato la quest
    quest_player_code = idrusa.specials["player_code"]
    if speaker.code != quest_player_code:
        quest_player = database["players"][quest_player_code]
        # Ricava il nome o la short per come lo vede idrusa
        to_say = "a %s No, non la tua risposta attendo ma di %s." % (
            speaker.code, quest_player.get_name(looker=idrusa))
        command_say(idrusa, to_say)
        return

    # Visto che il secondo stadio della missione si sta attivando cancella il
    # precedente reset che è meglio che sia reimpostato a fine funzione
    delete_deferred_reset(idrusa)

    # Facciamo avanzare lo stato della quest
    idrusa.specials["quest_status"] = "cerca"

    # Descriviamo quello che vogliamo
    to_say = "a %s *in tono grave* L'accesso ti verrà indicato solo se porterai una farfalla!" % speaker.code
    defer_if_possible(1, 2, idrusa, speaker, command_say, idrusa, to_say)

    # Ecco qui, qui viene impostata la durata media della quest, ovvero quanto
    # idrusa attenderà che il giocatore gli porti la farfalla
    deferred_reset = defer_random_time(200, 300, reset_farfalla_quest, idrusa)
    idrusa.specials["deferred_reset"] = deferred_reset
コード例 #44
0
def teleport(player, astronoma):
    player_code = player.get_numbered_keyword(looker=astronoma)

    if player.race in HATED_RACES:
        to_say = "a %s Gesto sconsiderato straniero. Troppo per rimanere in questo luogo..." % player_code
        command_say(astronoma, to_say)
        return False

    # Ricava la destinazione per il teletrasporto
    destination_room = Destination(3, 4, 0, "citta-raminghe").get_room()
    if not destination_room:
        return False

    player.act("Una [gold]nube [white]bianca[close] ti avvolge non appena $N fa un gesto.\nQuando la nebbia sparisce ti ritrovi altrove.", TO.ENTITY, astronoma)
    player.act("$n sparisce nel nulla quando $N fa un gesto.", TO.OTHERS, astronoma)
    player = player.from_location(1)
    player.to_location(destination_room, use_look=False)
    player.act("$n compare dal nulla.", TO.OTHERS)
    return True
def before_listen_say(listener, speaker, apprendista, phrase, ask, exclaim, behavioured):
    if not speaker.IS_PLAYER:
        return
   
    if not apprendista.specials or not "apprendista:player_code" in apprendista.specials or not "apprendista_situation" in apprendista.specials:
        return

    player_code = apprendista.specials["apprendista:player_code"]
    situation = apprendista.specials["apprendista_situation"]

    if situation == "look":
        if speaker.code != player_code:
            to_say = "a %s *allegro* Benvenuto nella bottega del tagliapietre! Eseguiamo lavorazioni per tutti i gusti e tutte le voglie!" % speaker.code
            command_say(apprendista, to_say)
            return

        if is_same(phrase, "no"):
            defer(1, reveal_secret, apprendista, speaker)
            defer(60, del_specials, apprendista)
            return
            
        defer(1, ask_again, apprendista, speaker)
        defer(60, del_specials_status, apprendista, "domanda")    
        return

    if situation == "domanda": 
        if speaker.code != player_code:
            to_say = "a %s *allegro* Benvenuto nella bottega del tagliapietre! Eseguiamo lavorazioni per tutti i gusti e tutte le voglie!" % speaker.code
            command_say(apprendista, to_say)
            return

        phrase = ALFA_ONLY_PATTERN.sub("", phrase)
        if is_same(phrase, "si"):
            defer(1, reveal_secret, apprendista, speaker)
            defer(60, del_specials, apprendista)
            return
        defer(1, no_secret, apprendista, speaker)
        del_specials(apprendista)
        return

    if situation == "segreto_svelato":
        defer(1, no_more_secrets, apprendista, speaker)
        del_specials(apprendista)
コード例 #46
0
def reset_banana_quest(charlie):
    player_is_here = False
    quest_player_code = ""
    if "charlie_banana_quest:player" in charlie.specials:
        quest_player_code = charlie.specials["charlie_banana_quest:player"]
        quest_player = database["players"][quest_player_code]
        for player in charlie.location.players:
            if player.code == quest_player_code:
                player_is_here = True
                break

    if "charlie_banana_quest:status" in charlie.specials:
        quest_status = charlie.specials["charlie_banana_quest:status"]
        if quest_status == "domanda":
            if player_is_here:
                to_say = "a %s *sconsolato* O beh, chiederò a qualchedun altro." % quest_player_code
            else:
                to_say = "a self *sconsolato* O beh, chiederò a qualchedun altro."
            command_say(charlie, to_say)
        elif quest_status == "cerca":
            if player_is_here:
                to_say = "a %s *impaziente* Ci stai mettendo troppo tempo, lasciamo perdere le banane.." % quest_player_code
            elif quest_player_code:
                to_say = "a self *impaziente* %s ci sta mettendo troppo tempo, lasciamo perdere le banane.." % quest_player.get_name(charlie)
            else:
                to_say = "a self *impaziente* La persona che mi doveva aiutare ci sta mettendo troppo tempo, lasciamo perdere le banane.."
            command_say(charlie, to_say)
            banana = charlie.find_entity("banan", charlie, ["items"])
            if banana:
                choice = random.randint(1, 6)
                if choice == 1:
                    reactor.callLater(random.randint(2, 4), command_drop, charlie, "banan")
                elif choice <= 3:
                    reactor.callLater(random.randint(2, 4), command_eat, charlie, "banan")

    # Cancelliamo anche le variabili speciali della quest
    if "charlie_banana_quest:status" in charlie.specials:
        del(charlie.specials["charlie_banana_quest:status"])
    if "charlie_banana_quest:player" in charlie.specials:
        del(charlie.specials["charlie_banana_quest:player"])
    if "charlie_banana_quest:reset_call" in charlie.specials:
        del(charlie.specials["charlie_banana_quest:reset_call"])
コード例 #47
0
def incites_to_follow(player, astronoma):
    # Possibile visto che questa funzione è deferrata
    if not player or not astronoma:
        return

    player_code = player.get_numbered_keyword(looker=astronoma)

    if calendar.is_day():
        to_say = "a %s *sorridendo* Allora torna da me quando è notte." % player_code
        command_say(astronoma, to_say)
        return

    to_say = "a %s *sorridendo* Seguimi allora stranier$o curios$o!" % player_code
    command_say(astronoma, to_say)
    defer_random_time(1, 2, command_up, astronoma)

    # Invia tra quasi due minuti un messaggio al pg se è ancora lì e poi poco dopo torna giù
    to_say = "a %s *sorridendo* Torno giù a seguire le mie occupazioni..." % player_code
    defer_if_possible(115, 118, astronoma, player, command_say, astronoma, to_say)
    defer(120, command_down, astronoma)
def after_looked(player, apprendista, descr, detail, use_examine, behavioured):
    print " >>> SPECIALS <<<", apprendista.specials
    if not player.IS_PLAYER:
        return

    if apprendista.specials:
        to_say = "a %s *allegro* Benvenuto nella bottega del tagliapietre! Eseguiamo lavorazioni per tutti i gusti e tutte le voglie!" % player.code
        command_say(apprendista, to_say)
        return

    if random.randint(1, 2) != 1:
        return

    apprendista.specials["apprendista:player_code"] = player.code
    apprendista.specials["apprendista_situation"] = "look"

    to_say = "a %s Il tuo sguardo indagatore mi dice che ti piacerebbe conoscere qualche segreto riguardo a questo villaggio, mi sbaglio?" % player.code
    command_say(apprendista, to_say)

    defer(60, del_specials_status, apprendista, "look")
def after_looked(player, apprendista, descr, detail, use_examine, behavioured):
    print " >>> SPECIALS <<<", apprendista.specials      
    if not player.IS_PLAYER:
        return

    if apprendista.specials:
        to_say = "a %s *allegro* Benvenuto nella bottega del tagliapietre! Eseguiamo lavorazioni per tutti i gusti e tutte le voglie!" % player.code
        command_say(apprendista, to_say)
        return
 
    if random.randint(1, 2) != 1:
        return

    apprendista.specials["apprendista:player_code"] = player.code
    apprendista.specials["apprendista_situation"] = "look"

    to_say = "a %s Il tuo sguardo indagatore mi dice che ti piacerebbe conoscere qualche segreto riguardo a questo villaggio, mi sbaglio?" % player.code
    command_say(apprendista, to_say)

    defer(60, del_specials_status, apprendista, "look")    
コード例 #50
0
def after_listen_say(idrusa, speaker, target, phrase, behavioured):
    if not speaker.IS_PLAYER:
        return

    # Controlla se la quest non sia già stata resettata oppure avanzata
    if "quest_status" not in idrusa.specials or idrusa.specials["quest_status"] != "domanda":
        return

    # Ricava la frase ripulita dalla punteggiatura e non continua la quest fino
    # a che il giocatore non dice: sì
    phrase = ALFA_ONLY_PATTERN.sub("", phrase)
    if not is_same(phrase, "si"):
        return

    # Guarda il giocatore che ha risposto
    command_look(idrusa, speaker.code)

    # Ignora coloro che hanno risposto ma che non hanno avviato la quest
    quest_player_code = idrusa.specials["player_code"]
    if speaker.code != quest_player_code:
        quest_player = database["players"][quest_player_code]
        # Ricava il nome o la short per come lo vede idrusa
        to_say = "a %s No, non la tua risposta attendo ma di %s." % (speaker.code, quest_player.get_name(looker=idrusa))
        command_say(idrusa, to_say)
        return

    # Visto che il secondo stadio della missione si sta attivando cancella il
    # precedente reset che è meglio che sia reimpostato a fine funzione
    delete_deferred_reset(idrusa)

    # Facciamo avanzare lo stato della quest
    idrusa.specials["quest_status"] = "cerca"

    # Descriviamo quello che vogliamo
    to_say = "a %s *in tono grave* L'accesso ti verrà indicato solo se porterai una farfalla!" % speaker.code
    defer_if_possible(1, 2, idrusa, speaker, command_say, idrusa, to_say)

    # Ecco qui, qui viene impostata la durata media della quest, ovvero quanto
    # idrusa attenderà che il giocatore gli porti la farfalla
    deferred_reset = defer_random_time(200, 300, reset_farfalla_quest, idrusa)
    idrusa.specials["deferred_reset"] = deferred_reset
コード例 #51
0
def reset_farfalla_quest(idrusa):
    # E' normale poiché questa funzione viene anche deferrata
    if not idrusa:
        return

    player_is_here = False
    quest_player_code = ""
    idrusa.specials["before_lookeding_me"] = True
    if "player_code" in idrusa.specials:
        quest_player_code = idrusa.specials["player_code"]
        quest_player = database["players"][quest_player_code]
        for player in idrusa.location.players:
            if player.code == quest_player_code:
                player_is_here = True
                break

    if "quest_status" in idrusa.specials:
        quest_status = idrusa.specials["quest_status"]
        if quest_status == "domanda":
            if player_is_here:
                to_say = "a %s *tranquilla* Oh beh.. qualchedun altro si farà avanti." % quest_player_code
            else:
                to_say = "a %s *tranquilla* Oh beh.. qualchedun altro si farà avanti.." % idrusa.get_numbered_keyword()
            command_say(idrusa, to_say)
        elif quest_status == "cerca":
            if player_is_here:
                to_say = "a %s *impaziente* Ci hai messo troppo tempo!" % quest_player_code
            elif quest_player_code:
                to_say = "a %s *impaziente* %s ci ha messo troppo tempo, lasciamo stare.." % (idrusa.get_numbered_keyword(), quest_player.get_name(idrusa))
            else:
                to_say = "a %s *impaziente* chi si era proposto ha evidentemente desistito..." % idrusa.get_numbered_keyword()
            command_say(idrusa, to_say)

    extract_farfalle(idrusa)

    # Cancelliamo anche le variabili speciali della quest
    if "quest_status" in idrusa.specials:
        del(idrusa.specials["quest_status"])
    if "player_code" in idrusa.specials:
        del(idrusa.specials["player_code"])
    delete_deferred_reset(idrusa)
コード例 #52
0
def incites_to_follow(player, astronoma):
    # Possibile visto che questa funzione è deferrata
    if not player or not astronoma:
        return

    player_code = player.get_numbered_keyword(looker=astronoma)

    if calendar.is_day():
        to_say = "a %s *sorridendo* Allora torna da me quando è notte." % player_code
        command_say(astronoma, to_say)
        return

    to_say = "a %s *sorridendo* Seguimi allora stranier$o curios$o!" % player_code
    command_say(astronoma, to_say)
    defer_random_time(1, 2, command_up, astronoma)

    # Invia tra quasi due minuti un messaggio al pg se è ancora lì e poi poco dopo torna giù
    to_say = "a %s *sorridendo* Torno giù a seguire le mie occupazioni..." % player_code
    defer_if_possible(115, 118, astronoma, player, command_say, astronoma,
                      to_say)
    defer(120, command_down, astronoma)
def before_giving(player, gemma_grezza, tagliapietre, direction, behavioured):
    if not player.IS_PLAYER:
        tagliapietre.act("$N cerca di darti robaccia ma tu non accetti.", TO.ENTITY, player)
        tagliapietre.act("$n non accetta che tu gli dia alcunché.", TO.TARGET, player)
        tagliapietre.act("$N cerca inutilmente di dare qualcosa a $n.", TO.OTHERS, player)
        return True

    if not tagliapietre.specials:
        tagliapietre.specials["work_with"] = None
    if not tagliapietre.specials["work_with"] == player.code:
        if tagliapietre.specials["work_with"]:
#    if "work_with" in tagliapietre.specials and player.code != tagliapietre.specials["work_with"] and not tagliapietre.specials["work_with"] :
            to_say = "a %s ... dammi tempo che son già occupato con, %s" % (player.code, tagliapietre.specials["work_with"])
            command_say(tagliapietre, to_say)
            return True
       
    id_generico = gemma_grezza.prototype.code.split("_")[2][:12]
    if id_generico != 'gemma-grezza':
        to_say = "a %s ... e cosa vuoi che ne faccia?" % player.code
        command_say(tagliapietre, to_say)
        return True
    else:
        id_gemma = gemma_grezza.prototype.code.split("_")[2][13:]
        to_say = "a %s è un buon inizio: %s." % (player.code, id_gemma)
        command_say(tagliapietre, to_say)
        room = tagliapietre.location
        crea_gemma(id_gemma, player, tagliapietre, gemma_grezza, room)
        return False
コード例 #54
0
def teleport(player, astronoma):
    player_code = player.get_numbered_keyword(looker=astronoma)

    if player.race in HATED_RACES:
        to_say = "a %s Gesto sconsiderato straniero. Troppo per rimanere in questo luogo..." % player_code
        command_say(astronoma, to_say)
        return False

    # Ricava la destinazione per il teletrasporto
    destination_room = Destination(3, 4, 0, "citta-raminghe").get_room()
    if not destination_room:
        return False

    player.act(
        "Una [gold]nube [white]bianca[close] ti avvolge non appena $N fa un gesto.\nQuando la nebbia sparisce ti ritrovi altrove.",
        TO.ENTITY, astronoma)
    player.act("$n sparisce nel nulla quando $N fa un gesto.", TO.OTHERS,
               astronoma)
    player = player.from_location(1)
    player.to_location(destination_room, use_look=False)
    player.act("$n compare dal nulla.", TO.OTHERS)
    return True
コード例 #55
0
def look_for_caterpillar(dust, show_act=True):
    if not dust:
        log.bug("dust non è un parametro valido: %r" % dust)
        return

    location = dust.location
    caterpillar = dust.find_entity("bruco", location, ["mobs"])
    if not caterpillar:
        if show_act:
            dust.act("My name is $n: niente bruchi %r" % dust, TO.OTHERS)
            dust.act("My name is $n: niente bruchi %r" % dust, TO.ENTITY)

        defer(60, look_for_caterpillar, dust)
        return

    if show_act:
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar,
                 TO.OTHERS)
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar,
                 TO.ENTITY)
        command_say(caterpillar, "sa la vist cus'è?")

    #defer( 60, look_for_caterpillar, dust)
    # il bruco potrebbe essere soggetto a script che lo potrebbero mutare senza avvisaglie quindi
    # tolgo di mezzo il bruco per sostituirlo con un altro che so non essere afflitto da script
    location = caterpillar.location
    caterpillar.extract(1)
    new_caterpillar = Mob(PROTO_CATERPILLAR_CODE)
    if not caterpillar:
        log.bug("impossibile crare un nuovo bruco: %r" % new_caterpillar)

    new_caterpillar.inject(location)
    new_caterpillar.act("$n cambia aspetto in modo repentino.", TO.OTHERS)
    new_caterpillar.act("$n cambia aspetto in modo repentino.", TO.ENTITY)

    dust_eating(dust, new_caterpillar)
    #ora resta solo da far mangiare la polvere che è bene rimuovere e rimpiazzare con con qualcosaltro
    return