Beispiel #1
0
 def f():
     print('opening dialogue: ' + dialogueId)
     d: Dialogue = s.Data.dialogues[dialogueId]
     # check if this dialogue has an onstart script associated
     onStart = func.addCustomScript(engine.scripts.dialogues,
                                    'onstart_' + dialogueId)
     if onStart:
         print('found script')
         example.play(onStart)
     d.reset()
     if d.onStart:
         d.onStart()
     lines = d.getLines()
     if lines:
         main: example.Wrap1 = example.get('main')
         ui: example.Wrap1 = example.get('ui')
         if ui.valid:
             ui.setActive(False)
         dial: example.Wrap1 = example.get('dialogue')
         dial.setActive(True)
         main.enableControls(False)
         # get the dialogue
         for line in lines:
             dial.appendText(line)
     else:
         # no lines, just exit dialogue
         return EndDialogue.pippo(dialogueId)()
Beispiel #2
0
def toggle_cursor(x, y):
    status.current_action += 1
    if status.current_action >= len(status.actions):
        status.current_action = 0
    if status.actions[status.current_action] == -1:
        status.current_action = 0
    example.get('cursor').setAnim(status.actions[status.current_action])
Beispiel #3
0
def setup_bar():
    ra = mopy.monkey.engine.room_args
    gl = mopy.monkey.engine.data.globals
    bonus_left = Entity()
    bonus_left.model = gl.bonus_list[ra[0]]['gfx']
    bonus_left.pos = (2.5*16, 10.2*16, 0.11)
    example.get('main').add(bonus_left)
    bonus_right = Entity()
    bonus_right.model = gl.bonus_list[ra[2]]['gfx']
    bonus_right.pos = (9.5*16, 10.2*16, 0.11)
    example.get('main').add(bonus_right)




    from wbml.data.actions import WBM

    # check if player has enough gold to buy items
    min_cost = min(int(ra[1]), int(ra[3]))
    if gl.gold < min_cost:
        s = Script()
        s.seq([WBM('$msg/8'), act.ChangeRoom('citywl')])
        example.play(s)
    else:
        mopy.monkey.engine.data.globals.pos = [(2, 7.625, 0.1), (5.25, 7.625, 0.1), (9.5, 7.625, 0.1)]
        mopy.monkey.engine.data.globals.cpos = 1
        s = Script()
        s.seq([WBM('$msg/5')])
        example.play(s)
Beispiel #4
0
def cippo():
    print('ciappo')
    example.get('w1').setActive(False)
    s = Script()
    s.addAction(SetState(tag='player', state='pipe'))
    s.addAction(Move(tag='player', speed=50, by=[0, 64]))
    s.addAction(SetState(tag='player', state='walk'))
    example.play(s)
Beispiel #5
0
def toggle_cursor(x, y):

    gl = mopy.monkey.engine.data.globals
    gl.current_action += 1
    if gl.current_action >= len(gl.actions):
        gl.current_action = 0
    if gl.actions[gl.current_action] == -1:
        gl.current_action = 0
    example.get('cursor').setAnim(gl.actions[gl.current_action])
Beispiel #6
0
def walkto_scummbar_kitchen_door(aa, ba):
    if example.get('scummbar_kitchen_door').anim == 'closed':
        a.Actions.walkto()(aa, ba)
    else:
        cook: example.Wrap1 = example.get('cook')
        if cook.valid and cook.x > 320:
            cook_upset(aa, ba, False)
        else:
            a.Actions.walk_door('kitchen', vars.pos.kitchen_door, 'e')(aa, ba)
Beispiel #7
0
def onSpawn(player: example.Wrap1, spawn: example.Wrap1, x, y):
    # get the detail
    info = spawn.getInfo()
    fct = info['factory']
    func = data['factories']['items'][fct]
    props = info['info']
    delta = info['delta']
    foe = func ([None, props])([spawn.x/vars.tileSize + delta[0], spawn.y/vars.tileSize +delta[1]])
    example.get('main').add(foe)    
    example.remove(spawn.id)
Beispiel #8
0
def ciappo(e):
    gl = mopy.monkey.engine.data.globals
    gl.invincible = True
    example.get('player').setState('walk', {})
    s = Script()
    s.seq([
        Blink(duration=gl.invincible_time, blink_duration=0.1, tag='player'),
        SetVariable(name='globals.invincible', value=False)
    ])
    example.play(s)
Beispiel #9
0
 def f():
     d : Dialogue = s.State.getDialogue(dialogueId)
     if d.onEnd:
         d.onEnd()            
     main : example.Wrap1 = example.get('main')
     ui : example.Wrap1 = example.get('ui')
     dial : example.Wrap1 = example.get('dialogue')
     ui.setActive(True)
     dial.setActive(False)
     main.enableControls(True)
Beispiel #10
0
def cippo():
    print('UEPA')
    #example.get('w1').setActive(False)
    if vars.start_pos in vars.disable_update_on_start:
        for i in vars.disable_update_on_start[vars.start_pos]:
            example.get(i).enableUpdate(False)
    s = Script()
    s.add_action(act.SetState(tag='player', state='pipe'))
    s.add_action(act.Move(tag='player', speed=50, by=[0, 64]))
    s.add_action(act.SetState(tag='player', state='walk'))
    example.play(s)
Beispiel #11
0
 def f():
     dic = vars.items[item_id].copy()
     dic.update(args)
     tp = dic.get('type', None)
     if tp is None:
         print('item ' + item_id + ' does not have type!')
         exit(1)
     factory = getattr(factories.items, tp)
     e = factory()(item_id, dic)
     if e is not None:
         parent = dic.get('parent', 'main')
         example.get(parent).add(e)
Beispiel #12
0
def on_spawn(player: example.Wrap1, spawn: example.Wrap1, x, y):
    # get the detail
    info = spawn.getInfo()
    fct = info['factory']
    func = monkey.engine.get_item_factory(fct)
    props = info['info']
    delta = info['delta']
    px = spawn.x / vars.tile_size + delta[0]
    py = spawn.y / vars.tile_size + delta[1]
    spawned = func(props)(px, py)
    example.get('main').add(spawned)
    example.remove(spawn.id)
Beispiel #13
0
def init_circus():
    example.get('player').follow(False)
    s = Script(uid='_fettuccini')
    s.on_kill =cane
    rv = monkey.engine.read
    s.add_action(actions.Scroll(pos=(0, 72), cam='maincam', speed=0, relative=False))
    s.add_action(id=1, action=actions.CallFunc(f=a.Callbacks.enable_controls(False)))
    s.add_action(scumm.actions.Walk(tag='player', pos=(178, 9)), after=[1])
    # TODO add after debug
    # if data.circus_data == 0:
    #     s.add_action(asay(1), after=[1])
    #     s.add_action(bsay(2))
    #     s.add_action(asay(3))
    #     s.add_action(bsay(4))
    #     s.add_action(asay(5))
    #     s.add_action(bsay(5))
    #     s.add_action(asay(6))
    #     s.add_action(bsay(7))
    #     s.add_action(asay(8))
    #     s.add_action(bsay(9))
    s.add_action(action=actions.CallFunc(f=a.Callbacks.enable_controls(True)))
    s.add_action(scumm.actions.StartDialogue(dialogue_id='fettuccini'))
    append_script(s)
    s.set_loop(100)
    # --            action.disable_controls
    # {id = 1},
    # --            action.walkto
    # {id = 2, actor = "guybrush", pos = {178, 9}},
    # --            action.say
    # {id = 3, after = {1}, actor = "circus.purpleclown", lines = {d[1]}},
    # --            action.say
    # {id = 4, actor = "circus.greenclown", lines = {d[2]}},
    # --            action.say
    # {id = 5, actor = "circus.purpleclown", lines = {d[3]}},
    # --            action.say
    # {id = 6, actor = "circus.greenclown", lines = {d[4]}},
    # --            action.say
    # {id = 7, actor = "circus.purpleclown", lines = {d[5]}},
    # --            action.say
    # {id = 8, actor = "circus.greenclown", lines = {d[5]}},
    # --            action.say
    # {id = 9, actor = "circus.purpleclown", lines = {d[6]}},
    # --            action.say
    # {id = 10, actor = "circus.greenclown", lines = {d[7]}},
    # --            action.say
    # {id = 11, actor = "circus.purpleclown", lines = {d[8]}},
    # --            action.say
    # {id = 12, actor = "circus.greenclown", lines = {d[9]}},
    # --            action.start_dialogue
    # {id = 13, dialogue = "fettuccini"},
    example.play(s)
Beispiel #14
0
def spawn(p, k, x, y):
    info = k.getInfo()
    detail = info['info']
    factory = detail['factory']
    args = detail['args']
    print(args)
    func = monkey.engine.get_item_factory(factory)(**args)
    positions = info['args'][4:]
    example.remove(k.id)
    for i in range(0, len(positions) // 2):
        ix = positions[i * 2]
        iy = positions[i * 2 + 1]
        foe = func(ix, iy)
        example.get('main').add(foe)
Beispiel #15
0
 def f():
     aa = mopy.monkey.engine.read(msg_id)
     id = example.get('main').add(
         Text(font='sprites.mario_font',
              size=8,
              text=aa,
              color=[0, 0, 0, 0],
              maxwidth=160,
              align=TextAlignment.center,
              pos=[96, 132, 1.01]))
     text_size = example.getById(id).getTextSize()
     tw = (text_size[2] - text_size[0])
     th = (text_size[3] - text_size[1])
     width = math.ceil(tw / 8.0)
     height = math.ceil(th / 8.0)
     data = [22, 8]
     data.extend([23, 8] * width)
     data.extend([24, 8])
     md = [22, 7]
     md.extend([23, 7] * width)
     md.extend([24, 7])
     data.extend(md * height)
     data.extend([22, 6])
     data.extend([23, 6] * width)
     data.extend([24, 6])
     e = Entity(tag='msg_wrap')
     e.model = {
         'type': 'model.tiled',
         'tex': 'gfx/wbml.png',
         'img_tile_size': [8, 8],
         'tile_size': [8, 8],
         'size': [width + 2, height + 2],
         'data': data
     }
     e.pos = [96 - 0.5 * tw - 8, 132 - 0.5 * th - 8, 1]
     example.get('main').add(e)
     #s = Script()
     #acts=[]
     #print('positioned ' + str(text_size))
     id1 = example.get('main').add(
         Text(tag='ciaone',
              font='sprites.mario_font',
              size=8,
              text='',
              mode=1,
              color=[255, 255, 255, 255],
              shade_color=(255, 0, 0, 255),
              maxwidth=160,
              align=TextAlignment.top_left,
              pos=[96 - 0.5 * tw, 132 + 0.5 * th, 1.02]))
Beispiel #16
0
def rise():
    player = example.get('player')
    player.setState('warp', {})
    s = Script()
    s.add_action(act.Move(speed=50, by=(0, 64), tag='player'))
    s.add_action(act.SetState(tag='player', state='walk'))
    example.play(s)
Beispiel #17
0
def _select_open_door_scummbar_kitchen(args):
    cook = example.get('cook')
    if cook.valid:
        if cook.x > 320:
            return 0
        return 1
    return 2
Beispiel #18
0
def upgradePlayer():
    vars.state += 1
    if vars.state >= len(vars.stateInfo):
        vars.state = 0
    # update model
    pl = example.get('player')
    pl.setModel(vars.stateInfo[vars.state], 'idle')
Beispiel #19
0
def refresh_inventory():
    p = example.get('inventory')
    g = mopy.monkey.engine.data.globals
    if p.valid:
        p.clearText()
        for k, v in g.inventory.items():
            p.appendText(k)
Beispiel #20
0
def refresh_inventory():
    p = example.get('inventory')
    if p.valid:
        inv = State.getCurrentInventory()
        p.clearText()
        for key, value in inv.items():
            p.appendText ((key, value))
Beispiel #21
0
    def f(x, y, obj = None):
        dial = example.get('dialogue')
        dial.clearText()
        # check if there's any script to run
        a = Script()
        node = s
        node.said = True
        for cn in node.closeNodes:
            s.dialogue.nodes[cn].status = 2
        for an in node.activateNodes:
            n = s.dialogue.nodes[an]
            if n.status != 2:
                n.status = 1
        #for id, d in s.dialogue.nodes.items():
        #    print (str(d.id) + ' ' + str(d.active))

        #if s.node.nextStatus != NodeStatus.SAME:
        #   s.node.status = s.node.nextStatus
        #s.node.dialogue.openNode(s.node)
        # check if I have a script associated to this line
        func = s.dialogue.id + '_'+node.id
        print ('check if ' + func)
        addCustomScript (engine.scripts.dialogues, func, a)
        #ds = s.script()
        #if ds:
        #    a.addAction(act.RunScript(s = ds))
        if s.nextId == None:
            print ('ending')
            a.addAction(scact.EndDialogue(s.dialogue.id))
        else:
            print ('next is ' + s.nextId)
            s.dialogue.current = s.nextId
            a.addAction(scact.ResumeDialogue(s.dialogue.id))
        example.play(a)
Beispiel #22
0
def spawn(player, item, x, y):
    a = item.getInfo()['enemies']
    example.remove(item.id)
    main = example.get('main')
    for b in a:
        print('creating ' + str(b))
        main.add(fi.npc()(*b))
Beispiel #23
0
 def f():
     main : example.Wrap1 = example.get('main')
     ui : example.Wrap1 = example.get('ui')
     dial : example.Wrap1 = example.get('dialogue')
     ui.setActive(False)
     dial.setActive(True)
     main.enableControls(False)
     # get the dialogue
     print ('opening dialogue: ' + dialogueId)
     d : Dialogue = s.State.getDialogue(dialogueId)
     if d.onStart:
         d.onStart()
     d.reset()
     lines = d.getLines()
     for line in lines:
         dial.appendText(line)
Beispiel #24
0
def on_load_swordmaster():
    if example.get('storekeeper').valid:
        s = Script()
        s.add_action(a.custom_actions.disable_controls)
        s.add_action(a.custom_actions.set_follow(False), id=1)
        s.add_action(scumm.actions.Walk(tag='storekeeper', pos=(375, 68)),
                     id=2)
        s.add_action(actions.Scroll(pos=(304, 72),
                                    cam='maincam',
                                    speed=50,
                                    relative=False),
                     after=[1])
        s.add_action(scumm.actions.Walk(tag='player', pos=(210, 14)),
                     id=3,
                     after=[1])
        s.add_action(scumm.actions.Turn(tag='storekeeper', dir='e'), after=[2])
        s.add_action(scumm.actions.Turn(tag='player', dir='s'), after=[3])
        s.add_action(
            scumm.actions.Say(tag='player',
                              font='monkey',
                              lines=a.make_lines(['$lines/50'])))
        s.add_action(scumm.actions.Turn(tag='player', dir='n'))
        s.add_action(actions.Delay(sec=1.0), after=[2])
        # TODO change room to sword master house here
        s.add_action(a.custom_actions.enable_controls)
        example.play(s)
Beispiel #25
0
def set_player_mode(n):
    player = example.get('player')
    tile_size = data.globals.tile_size
    data.globals.player_mode = n
    mode = data.globals.player_modes[n]
    player.setModel(mode['model'])
    size = mode['size']
    player.setColliderBounds(size[0] * tile_size[0], size[1] * tile_size[1], 0, 0, 0.5*size[1] * tile_size[1], 0)
Beispiel #26
0
def on_key():
    global current
    current += 1
    if current >= len(anims):
        current = 0
    print('current anim: ' + anims[current])
    pippo = example.get('sprite')
    pippo.setAnim(anims[current])
Beispiel #27
0
def m1(x: float, y: float):
    a = mushroom(x, y)
    main = example.get('main')
    id = main.add(a)
    s = Script()
    s.addAction(Move(id=id, speed=10, by=[0, 16]))
    s.addAction(SetState(id=id, state='walk'))
    example.play(s)
Beispiel #28
0
def update_current_action():
    a: example.Wrap1 = example.get('current_verb')
    verb = Config.getVerb(Config.verb)
    text = verb.text
    if Config.item1:
        item = State.items[Config.item1]
        text += ' ' + item.text
    a.setText(text)
Beispiel #29
0
def m3(x: float, y: float):
    a = Sprite('score100', pos=[x * vars.tileSize, (y + 1) * vars.tileSize, 0])
    main = example.get('main')
    id = main.add(a)
    s = Script()
    s.addAction(Move(speed=100, by=[0, 64], id=id))
    s.addAction(RemoveEntity(id=id))
    example.play(s)
Beispiel #30
0
def refresh_inventory():
    p = example.get('inventory')
    if p.valid:
        p.clearText()
        for k, v in vars.inventory.items():
            print (k + ' --- ' +str(v))
            p.appendText((k, v))
            print ('fmerda')