Esempio n. 1
0
def TriggerBankrupt():
    global LowerMoneyWarning
    global Current_MoneyMinimun
    global BankruptWarning

    # -- Bankrupt Warning -- #
    if Current_Money <= Current_MoneyMinimun and not BankruptWarning:
        BankruptWarning = True
        LowerMoneyWarning = False
        OverlayDialog.subscreen1.SetMessage(
            gameMain.DefaultCnt.Get_RegKey("/strings/game/bankrupt_1_title"),
            gameMain.DefaultCnt.Get_RegKey(
                "/strings/game/bankrupt_1_text").format(
                    utils.FormatNumber(Current_Money)),
            typeDelay=0)

    # -- Lower Money Warning -- #
    elif not LowerMoneyWarning and Current_Money <= -10.00 and not BankruptWarning:
        LowerMoneyWarning = True
        OverlayDialog.subscreen1.SetMessage(
            gameMain.DefaultCnt.Get_RegKey("/strings/game/bankrupt_0_title"),
            gameMain.DefaultCnt.Get_RegKey(
                "/strings/game/bankrupt_0_text").format(
                    utils.FormatNumber(Current_MoneyMinimun)),
            typeDelay=0)

    if LowerMoneyWarning:
        if Current_Money >= 0.1:
            LowerMoneyWarning = False

    # -- Go Bankrupt -- #
    if BankruptWarning:
        BankruptWarning = False
        RestartSaveGame()
Esempio n. 2
0
def Update():
    global Current_Money
    global Current_MoneyValuePerClick
    global Current_MoneyPerSecond
    global Current_MoneyFormated
    global Current_MoneyPerSecondFormatted
    global MoneyPerSecond_Delta
    global MoneyPerSecond_Last
    global Current_ExperienceFormated
    global Current_MoneyPerClickBest
    global SaveDataLoaded
    global WelcomeMessageTriggered

    if SaveDataLoaded:
        # -- Update the Clock -- #
        UpdateClock()

        # -- Say the Initial Message -- #
        if not WelcomeMessageTriggered:
            WelcomeMessageTriggered = True
            TutorialTrigger("new_savegame")

        # -- Updated Formated Strings -- #
        if gameMain.DefaultCnt.Get_RegKey("/OPTIONS/format_numbers"):
            Current_MoneyFormated = utils.FormatNumber(Current_Money, 2)
            Current_MoneyPerSecondFormatted = utils.FormatNumber(
                Current_MoneyPerSecond, 2)
            Current_ExperienceFormated = utils.FormatNumber(
                Current_Experience, 2)
        else:
            Current_MoneyFormated = str(Current_Money)
            Current_MoneyPerSecondFormatted = str(Current_MoneyPerSecond)
            Current_ExperienceFormated = str(Current_Experience)

        # -- Update Money Per Second -- #
        MoneyPerSecond_Delta += 1
        if MoneyPerSecond_Delta == 1000:
            Current_MoneyPerSecond = Current_Money - MoneyPerSecond_Last
            MoneyPerSecond_Last = Current_Money
            MoneyPerSecond_Delta = 0

            # -- Set Best Click -- #
            if Current_MoneyPerClickBest < Current_MoneyPerSecond:
                Current_MoneyPerClickBest = Current_MoneyPerSecond

        # -- Update All Loaded Items -- #
        gameItems.UpdateItems()

        # -- Triggers Bankrupt -- #
        TriggerBankrupt()
Esempio n. 3
0
def BuyItem_ByID(ItemID):
    ItemID = int(ItemID)
    ItemPrice = gameItems.GetItemPrice_ByID(ItemID)
    ItemCount = gameItems.GetItemCount_ByID(ItemID)
    ItemIsUnlocker = gameItems.GetItemIsUnlocker_ByID(ItemID)
    BuySucefully = False

    if ItemIsUnlocker:  # -- Buy Unlocker Items
        if not ItemCount >= 1:
            # -- Increase Item Count -- #
            gameItems.IncreaseItemCount_ByID(ItemID)

            # -- Create Item Object -- #
            gameItems.CreateItemObject(ItemID)

            BuySucefully = True

    else:  # -- Buy Common Items -- #
        gameItems.IncreaseItemCount_ByID(ItemID)

        # -- Create Item Object -- #
        gameItems.CreateItemObject(ItemID)

        BuySucefully = True

    if BuySucefully:
        # -- Subtract the Money -- #
        IncomingLog.AddMessageText(utils.FormatNumber(-ItemPrice, 2), True, (250, 150, 150), -ItemPrice)

        # -- Add Item to the Item View on Game Screen -- #
        GameScreen.ItemsView.AddItem(str(ItemID))
    else:
        # -- Subtract the Money -- #
        IncomingLog.AddMessageText(gameMain.DefaultCnt.Get_RegKey("/strings/window/store/cant_buy_item"), False, (250, 150, 150))
        sound.PlaySound("/hit_2.wav", 0.5)
Esempio n. 4
0
def RestartSaveGame():
    Unload()
    print("RestartSaveGame : Deleting Save Folder...")
    utils.Directory_Remove(tge.TaiyouPath_AppDataFolder)
    print(tge.TaiyouPath_AppDataFolder)

    print("RestartSaveGame : Loading Null Data...")
    LoadSaveData()

    print("RestartSaveGame : Saving Null Data")
    SaveData()

    print("RestartSaveGame : Done!")
Esempio n. 5
0
def Update():
    global ItemsMaintenance
    global BaseMaintenance
    global LastMaintenancePrice
    global DayTrigger
    global NextMaintenanceDay

    if save.CurrentDate_Day == DayTrigger:
        # -- Dont let the Maintenance Day to the Day Limit -- #
        if save.CurrentDate_Day + 1 >= save.CurrentDate_MonthLimiter:
            DayTrigger = 0

        else:
            DayTrigger = save.CurrentDate_Day + PerDayValue

        # -- Calculate Maintenance of All Items -- #
        TotalItems = 0

        for item in gameItems.ItemsList:
            TotalItems += 1
            ItemsMaintenance = ItemsMaintenance + item.maintenance_cost + randint(
                1, TotalItems)

        # -- Add Maintenance of Auto Clicker -- #
        if gameItems.GetItemCount_ByID(0) > 1:
            ItemsMaintenance += (gameItems.GetItem_MaintenancePrice(0) *
                                 gameItems.GetItemCount_ByID(0))

        # -- Calculate the Maintenance -- #
        MaintenancePrice = BaseMaintenance + ItemsMaintenance

        # -- Decrease Money -- #
        IncomingLog.AddMessageText(utils.FormatNumber(-MaintenancePrice, 2),
                                   True, (
                                       250,
                                       150,
                                       150,
                                   ), -MaintenancePrice)

        # -- Set Variables -- #
        LastMaintenancePrice = MaintenancePrice
Esempio n. 6
0
def Render(DISPLAY):
    global WindowObject
    global DrawnSurface
    global BuyButton
    global ListItems
    global DownBar_BuyPanelAnimEnabled
    global DownBar_BuyPanelYOffset
    global LastClickedItem
    global SelectedItemID
    global StoreLocked
    global SelectedItemPrice

    if not StoreLocked:
        # -- Update the Surface -- #
        DrawnSurface = pygame.Surface((WindowObject.WindowSurface_Rect[2], WindowObject.WindowSurface_Rect[3]), pygame.SRCALPHA)

        # -- Draw the List -- #
        ListItems.Render(DrawnSurface)

        # -- Render the Selected Item Text -- #
        if ListItems.LastItemClicked != "null":
            # -- Down Panel Background -- #
            gameMain.shape.Shape_Rectangle(DrawnSurface, (0, 0, 0, 100), (0, DrawnSurface.get_height() - DownBar_BuyPanelYOffset, DrawnSurface.get_width(), DownBar_BuyPanelYOffset))
            gameMain.shape.Shape_Rectangle(DrawnSurface, (16, 166, 152), (0, DrawnSurface.get_height() - DownBar_BuyPanelYOffset - 1, DrawnSurface.get_width(), 1))

            # -- Draw the Buy Button -- #
            BuyButton.Render(DrawnSurface)

            # -- Draw the Item Title -- #
            gameMain.DefaultCnt.FontRender(DrawnSurface, "/PressStart2P.ttf", 15, ListItems.LastItemClicked, (250, 250, 250), 10, DrawnSurface.get_height() - DownBar_BuyPanelYOffset + 5, gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa", bool))

            # -- Draw the Item Price -- #
            PriceTextOpacity = 255
            if save.Current_Money < SelectedItemPrice:
                PriceTextOpacity = 100 - abs(save.Current_Money - SelectedItemPrice)

                if PriceTextOpacity <= 100:
                    PriceTextOpacity = 100

            gameMain.DefaultCnt.FontRender(DrawnSurface, "/PressStart2P.ttf", 8, "${0}".format(utils.FormatNumber(SelectedItemPrice)), (PriceTextOpacity, PriceTextOpacity, PriceTextOpacity), 10, DrawnSurface.get_height() - DownBar_BuyPanelYOffset + 20, gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa", bool), Opacity=PriceTextOpacity)

    WindowObject.Render(DISPLAY)
    DISPLAY.blit(DrawnSurface, (WindowObject.WindowSurface_Rect[0], WindowObject.WindowSurface_Rect[1]))
Esempio n. 7
0
def Render(DISPLAY):
    global WindowObject
    global DrawnSurface
    global BuyButton
    global ListItems
    global DownBar_BuyPanelAnimEnabled
    global DownBar_BuyPanelYOffset
    global LastClickedItem
    global SelectedItemID
    global SelectedItemPrice
    global SelectedItemLevel
    global StoreLocked
    # -- Update the Surface -- #
    DrawnSurface = pygame.Surface((WindowObject.WindowSurface_Rect[2],
                                   WindowObject.WindowSurface_Rect[3]),
                                  pygame.SRCALPHA)

    if not StoreLocked:
        # -- Draw the List -- #
        ListItems.Render(DrawnSurface)

        # -- Render the Selected Item Text -- #
        if ListItems.LastItemClicked != "null":
            if LastClickedItem != ListItems.LastItemClicked:
                DownBar_BuyPanelAnimEnabled = True
                DownBar_BuyPanelYOffset = 0
            LastClickedItem = ListItems.LastItemClicked

            # -- Set Item Price and ID -- #
            SelectedItemID = ListItems.LastItemOrderID - 1
            SelectedItemLevel = gameItems.GetItemLevel_ByID(SelectedItemID) + 1
            SelectedItemPrice = gameItems.GetItemUpgradePrice_ByID(
                SelectedItemID)

            # -- Down Panel Background -- #
            CONTENT_MANAGER.Shape_Rectangle(
                DrawnSurface, (0, 0, 0, 100),
                (0, DrawnSurface.get_height() - DownBar_BuyPanelYOffset,
                 DrawnSurface.get_width(), DownBar_BuyPanelYOffset))
            CONTENT_MANAGER.Shape_Rectangle(
                DrawnSurface, (16, 166, 152),
                (0, DrawnSurface.get_height() - DownBar_BuyPanelYOffset - 1,
                 DrawnSurface.get_width(), 1))

            # -- Draw the Buy Button -- #
            BuyButton.Render(DrawnSurface)

            # -- Draw the Item Title -- #
            CONTENT_MANAGER.FontRender(
                DrawnSurface, "/PressStart2P.ttf", 15,
                ListItems.LastItemClicked, (250, 250, 250), 10,
                DrawnSurface.get_height() - DownBar_BuyPanelYOffset + 5,
                gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa"))

            # -- Draw the Item Price -- #
            PriceTextOpacity = 255
            if save.Current_Experience < SelectedItemPrice:
                PriceTextOpacity = 100 - abs(save.Current_Experience -
                                             SelectedItemPrice)

                if PriceTextOpacity <= 100:
                    PriceTextOpacity = 100

            CONTENT_MANAGER.FontRender(
                DrawnSurface,
                "/PressStart2P.ttf",
                8,
                "€xp" + str(utils.FormatNumber(SelectedItemPrice)),
                (PriceTextOpacity, PriceTextOpacity, PriceTextOpacity),
                10,
                DrawnSurface.get_height() - DownBar_BuyPanelYOffset + 20,
                gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa"),
                Opacity=PriceTextOpacity)

    WindowObject.Render(DISPLAY)  # -- Render Window Border
    DISPLAY.blit(
        DrawnSurface,
        (WindowObject.WindowSurface_Rect[0],
         WindowObject.WindowSurface_Rect[1]))  # -- Render Window Objects