示例#1
0
def TalkToReceptionist(guildname,introtext):
    text=introtext
    import campaign_lib
    if campaign_lib.doTalkingHeads():
        campaign_lib.AddConversationStoppingSprite("Receptionist","bases/heads/"+guildname.lower()+".spr",(.582,-.2716),(3.104,2.4832),"Return_To_Guild").__call__(Base.GetCurRoom(),None)
    print('start ('+str(guildname)+','+str(introtext)+')')
    if guildname in guilds:
        guild=guilds[guildname]
        if not guild.HasJoined():
            text+='  Membership is '+str(guild.membership)+' credits.  Please consider joining our guild'
            if not guild.CanPay():
                text+=' when you have more money'
            text+='.'
        Base.Message (text)
        if not guild.HasJoined():
            VS.StopAllSounds()
            if guild.CanPay():
                fixers.CreateChoiceButtons(Base.GetCurRoom(),[
                        fixers.Choice("bases/fixers/yes.spr","#G#\nimport guilds\nguilds.JoinGuild('"+guildname+"')","Accept This Agreement"),
                        fixers.Choice("bases/fixers/no.spr","bases/fixers/no.py","Decline This Agreement")])

                VS.playSound("guilds/"+str(guild.name).lower()+"invite.wav",(0,0,0),(0,0,0))
            else:
                VS.playSound("guilds/"+str(guild.name).lower()+"notenoughmoney.wav",(0,0,0),(0,0,0))
        return
示例#2
0
 def TooManyMissions(self):
     Base.SetTextBoxText(Base.GetCurRoom(),self.textbox,self.tooManyMissionsText)
     self.acceptbutton.removeobjs()
     if 'next' in self.buttons:
         self.buttons['next'].removeobjs()
     if 'last' in self.buttons:
         self.buttons['last'].removeobjs()
示例#3
0
def AssignMission():
    fixers.DestroyActiveButtons()
    fixers.CreateChoiceButtons(Base.GetCurRoom(), [
        fixers.Choice("bases/fixers/yes.spr", "bases/fixers/iso_mission.py",
                      "Accept This Agreement"),
        fixers.Choice("bases/fixers/no.spr", "bases/fixers/iso_decline.py",
                      "Decline This Agreement")
    ])
示例#4
0
def BriefLastMission(which, first, textbox=None):
    import Base
    which = str(which)
    if first < 0 or first >= len(last_briefing):
        return
    if (which in last_briefing[first]):
        if textbox:
            Base.SetTextBoxText(Base.GetCurRoom(), textbox,
                                last_briefing[first][which])
        else:
            Base.Message(last_briefing[first][which])
示例#5
0
def custom_run_dialog(local, cmd, args, id):
    if VS.isserver():
        return

    def myCallback(db, data):
        def serverCallback(data):
            if data[0] == 'close':
                db.undraw()

        custom.respond(data, serverCallback, id)

    dialog(args, myCallback, Base.GetCurRoom())
示例#6
0
def ShipPurchase(shipname):
    """ Allow the player to purchase a ship.

        If the player has enough funds, present a choice and play a dialogue.
        Otherwise, inform the player that he hasn't got enough funds.

    """
    import fixers
    import campaign_lib
    campaign_lib.AddConversationStoppingSprite(
        "Ship_Dealer", "bases/heads/shipdealer.spr", (0, 0), (3.2, 2.0),
        "Return_To_Showroom").__call__(Base.GetCurRoom(), None)
    VS.StopAllSounds()
    if (VS.getPlayer().getName() == shipname
            or VS.getPlayer().getName() == shipname + ".blank"
            or VS.getPlayer().getName() + ".blank" == shipname):
        VS.playSound("sales/pitch" + shipname + "duplicate.wav", (0, 0, 0),
                     (0, 0, 0))
    elif CanBuyShip(shipname + ".blank"):
        fixers.CreateChoiceButtons(Base.GetCurRoom(), [
            fixers.Choice(
                "bases/fixers/yes.spr",
                "#\nimport fixers\nfixers.DestroyActiveButtons ()\nimport weapons_lib\nimport VS\nVS.StopAllSounds()\nweapons_lib.BuyShip('"
                + shipname + ".blank')\n",
                "Purchase " + shipname.capitalize()),
            fixers.Choice(
                "bases/fixers/no.spr",
                "#\nimport fixers\nfixers.DestroyActiveButtons ()\nimport VS\nVS.StopAllSounds()\nVS.playSound('sales/pitch"
                + shipname + "reject.wav',(0,0,0),(0,0,0))\n",
                "Decline Purchasing")
        ])
        VS.playSound("sales/pitch" + shipname + ".wav", (0, 0, 0), (0, 0, 0))
    else:
        VS.playSound("sales/pitchnotenoughmoney.wav", (0, 0, 0), (0, 0, 0))
        Base.Message(
            "I hate to break it to you, but we've checked your account, and you don't have enough credits to buy this ship. She sure is a fine ship though, isn't she? Listen, I want to make a sale, you want to make a purchase, lets look at the facts. You know the retail of this ship--we can use your ship for tradeins, plus extras--including your cash on hand, that still leaves you short.  Go get some more cash, and come back when you have more cash, and don't feel embarrassed: these things happen!"
        )
示例#7
0
def dialog(args, callback, room=None):
    global _gui_has_initted

    db = DialogBox(parse_dialog_box(args), callback)
    if VS.isserver():
        db.id = custom.run("dialog_box", args, lambda data: callback(db, data))
        return db.id
    if not room:
        room = Base.GetCurRoom()
    if not _gui_has_initted:
        GUI.GUIInit(320, 200)
        _gui_has_initted = True
    db.create(room)
    db.draw()
    GUI.GUIRootSingleton.broadcastMessage('draw', None)
示例#8
0
 def iterate(self, nam=str()):
     """Will execute the next stage of the conversation, ie create the relevant
     textual message and response buttons, given the conversation string, and
     the reference to the next possible nodes."""
     name = str(nam)
     if name == str():
         name = self.ROOT_KEY
     DestroyActiveButtons()
     text, choices = self.getNewInfo(name)
     if choices:
         choices = list(choices)
         for i in range(len(choices)):
             choices[i] = choices[i].split('|')
             choices[i] = Choice(choices[i][0], choices[i][1], choices[i][2])
         CreateChoiceButtons(Base.GetCurRoom(),choices)
     if text:
         Base.Message(text)
示例#9
0
def exploremission(part, filename, sysfile, creditnum):
    fixers.DestroyActiveButtons()
    if part == 1:
        plyr = VS.getPlayer().isPlayerStarship()
        if quest.findQuest(plyr, (sysfile + "_nav"), 1) or quest.findQuest(
                plyr, (sysfile + "_nav"), 2):
            part = 3
    if part == 1:
        fixers.CreateChoiceButtons(Base.GetCurRoom(), [
            fixers.Choice("bases/fixers/yes.spr", filename,
                          "Accept This Mission"),
            fixers.Choice("bases/fixers/no.spr", "bases/fixers/no.py",
                          "Decline This Mission")
        ])
        Base.Message(
            """Hi. Our researchers have found a new signal similar to that of a jump point coming from an area in the
#55ffff%s#000000 system. This mission will require that you own a jump drive.
We hope that you will accept this mission. You will earn %.2f credits when you explore the area."""
            % (sysfile.split('/')[-1], creditnum))
    elif part == 2:
        Base.Message(
            """Excellent! Go to the unknown energy source that we have uploaded to your ship computer
as a navpoint in #55ffff%s#000000. Once next to the energy source, jump
into the energy source and get close to all of the planets in the connecting system."""
            % sysfile.split('/')[-1])
        Base.EnqueueMessage(
            """You will earn %.2f credits when this is completed""" %
            creditnum)
        plyr = VS.getPlayer().isPlayerStarship()
        if Director.getSaveDataLength(plyr, (sysfile + "_nav")) == 0:
            Director.pushSaveData(plyr, (sysfile + "_nav"), 1)
        else:
            Director.putSaveData(plyr, (sysfile + "_nav"), 0, 1)
    else:
        Base.Message(
            """Go to the unknown energy source that we have uploaded to your ship computer
as a navpoint in #55ffff%s#000000. Once next to the energy source, jump
into the energy source and get close to all of the planets in the connecting system."""
            % sysfile.split('/')[-1])
示例#10
0
import fixers
import Base
# Don't like relying on a string value that was not passed, but for now, that is the only way
Base.EraseObj(Base.GetCurRoom(), "BartenderText")
fixers.DestroyActiveButtons()
示例#11
0
import fixers
import mission_lib
import Base
import VS

fixers.DestroyActiveButtons()
if VS.numActiveMissions() > 1:
    Base.Message('You are already doing a mission. Finish that instead.')
else:
    fixers.CreateChoiceButtons(Base.GetCurRoom(), [
        fixers.Choice("bases/fixers/yes.spr", "bases/fixers/generic1b.py",
                      "Accept This Agreement"),
        fixers.Choice("bases/fixers/no.spr", "bases/fixers/no.py",
                      "Decline This Agreement")
    ])
    mission_lib.BriefLastMission(1, 0)
示例#12
0
def BriefLastMission(whichid, first, textbox=None, template='#DESCRIPTION#'):
    """ Outputs the briefing from fixer missions on the base screen. """
    plr = getMissionPlayer()
    last_briefing = players[plr].last_briefing
    last_briefing_vars = players[plr].last_briefing_vars

    # Compare the given mission id with the id stored in the briefing vars
    # If match is found, retrieve the mission name, which is also the mission key
    which = None
    for name in last_briefing_vars[0]:
        if last_briefing_vars[0][name]['MISSION_ID'] == str(whichid):
            which = name
    # Should not happen anymore, but sometimes missions have all the same id,
    # e.g. 1, and then no missions for id 0 will e found.
    if which == None:
        which = list(last_briefing_vars[0].keys())[0]
        debug.warn("mission_lib.BriefLastMission couldn't find mission id" +
                   str(whichid))

    if first < 0 or first >= len(last_briefing):
        return
    if (which in last_briefing[first]):
        # compute variables
        s_which = str(which).split('/')
        w_prefix = ''
        curmission = s_which[len(s_which) - 1]
        if curmission.isdigit():
            # But for numeric identifiers, convert base-0 to base-1 indices
            curmission = str(int(curmission) + 1)
        else:
            # allow non-numeric mission identifiers ( 'Disc_1', anyone? )
            currmission = str(whichid)
        for i in s_which[:len(s_which) - 1]:
            w_prefix += str(i) + '/'
        nummissions = CountMissions(first, w_prefix)

        # replace variables in template
        template = template.replace('#MISSION_NUMBER#', str(curmission))
        template = template.replace('#MISSION_ID#', str(whichid))
        template = template.replace('#GUILD_NAME#', s_which[0])
        template = template.replace('#NUM_MISSIONS#', str(nummissions))
        template = template.replace('#DESCRIPTION#',
                                    str(last_briefing[first][which]))
        template = template.replace(
            '#SHORT_DESCRIPTION#',
            str(last_briefing_vars[first][which]['MISSION_SHORTDESC']))
        try:
            template = template.replace(
                '#MISSION_TYPE#',
                last_briefing_vars[first][which]['MISSION_TYPE'])
        except:
            template = template.replace('#MISSION_TYPE#', '')

        # set text
        import Base
        if textbox:
            Base.SetTextBoxText(Base.GetCurRoom(), textbox, template)
        else:
            Base.Message(template)
        # Remember this mission as the last one being processed.
        SetLastMission(which)