Example #1
0
void ShopLoop()
{
    ItemInfoPtr ItemPtr = &ItemData[Player.ShopPage][Player.ShopIndex];
    int Cost = ItemPtr->Price - ItemPtr->Price * Player.ShopDiscount / 100;
    int Rank = ItemPtr->Rank;
    int SellPrice;
    int Color;

    // Freeze the Player
    SetPlayerProperty(0, 1, PROP_TOTALLYFROZEN);

    // Get the sell price
    SellPrice = GetSellPrice(NULL, 1);

    // Set the HUD Size
    SetHudSize(GetActivatorCVar("drpg_menu_width"), GetActivatorCVar("drpg_menu_height"), true);

    // Draw Border
    // These are pushed back a bit so the border doesn't overlap anything
    if (GetActivatorCVar("drpg_menu_background_border"))
        DrawBorder("Bor", -1, 8, -5.0, 0.0, 470, 470);

    // Force Locker mode if the Shop Anywhere CVAR is off
    if (!GetCVar("drpg_shoptype") && !CurrentLevel->UACBase)
        Player.LockerMode = true;

    // Setup dynamic Medikit refill pricing
    ItemData[2][0].Price = Player.MedkitMax * 3;

    SetFont("BIGFONT");
    if (Player.LockerMode)
    {
        // Title and Page
        HudMessage("\ChLocker \C-- %S\C- \Cd(%d/%d)", ItemCategoryNames[Player.ShopPage], Player.ShopPage + 1, ItemCategories);
        EndHudMessage(HUDMSG_PLAIN, 0, "White", 24.1, 24.0, 0.05);

        // EP Cost/Inventory Count
        if (GetCVar("drpg_inv_capacity"))
        {
            HudMessage("%S%d EP \C-(Inventory: %d/%d)", (CurrentLevel->UACBase ? "\Cc" : "\Cn"), LOCKER_EPRATE, Player.InvItems, CheckInventoryMax());
            EndHudMessage(HUDMSG_PLAIN, 0, "White", 24.1, 38.0, 0.05);
        }
Example #2
0
// Arena Script
NamedScript MapSpecial void ArenaLoop()
{
    int BonusRandomizer, Buttons, OldButtons;
    bool Ready;
    ArenaSetEnvironment(AEVENT_NONE);
    
    // Arena Loop
    while (true)
    {
        // Stop the script if the Arena is stopped or the Arena activator dies
        if (!ArenaActive || ClassifyActor(Players(ArenaPlayerNumber).TID) & ACTOR_DEAD)
        {
            ArenaStop();
            return;
        }
        
        // Arena HUD
        ArenaDrawHUD();
        
        // Arena Status Handling
        if (ArenaState == ARENA_INTERMISSION)
        {
            BonusRandomizer = Random(-10, ABONUS_MAX - 1);

            ArenaMod = -1;
            ArenaGetBonus(BonusRandomizer);
            ArenaSetEnvironment(AEVENT_NONE);
            ArenaState = ARENA_WAITING;
        }
        else if (ArenaState == ARENA_WAITING)
        {
            Buttons = GetPlayerInput(ArenaPlayerNumber, INPUT_BUTTONS);
            OldButtons = GetPlayerInput(ArenaPlayerNumber, INPUT_OLDBUTTONS);
            Ready = true;
            
            SetHudSize(0, 0, false);
            SetFont("BIGFONT");
            
            if (ArenaPlayerNumber == PlayerNumber())
            {
                if (!Player.InMenu && !Player.InShop && !Player.OutpostMenu)
                {
                    HudMessage("Press \Cd%jS\C- to start the next wave\nPress \Cd%jS\C- to exit the Arena", "+use" , "+speed");
                    EndHudMessage(HUDMSG_PLAIN, 0, "White", 1.5, 0.75, 0.05);
                }
                
                if (Buttons & BT_USE && (!Player.InMenu && !Player.InShop && !Player.OutpostMenu && !Player.CrateOpen) && !Player.MenuBlock)
                {
                    // Check to see if others are still in the menu
                    for (int i = 0; i < MAX_PLAYERS; i++)
                        if (Players(i).InMenu || Players(i).InShop)
                            Ready = false;
                    
                    if (Ready)
                    {
                        ArenaKeyTimer++;
                        ArenaKeyTimerType = AKTIMER_CONTINUE;
                        if (ArenaKeyTimer > ARENA_HOLDTIME)
                        {
                            // Multiplayer Countdown
                            if (InMultiplayer)
                            {
                                SetFont("BIGFONT");
                                for (int i = 3; i > 0; i--)
                                {
                                    HudMessage("%d", i);
                                    EndHudMessageBold(HUDMSG_FADEOUT, 0, "Green", 0.5, 0.5, 0.25, 0.75);
                                    Delay(35);
                                }
                            }
                            
                            ArenaWave++;
                            ArenaState = ARENA_READY;
                        }
                    }
                    else
                    {
                        PrintError("Someone is currently in a menu");
                        ActivatorSound("menu/error", 127);
                    }
                }
                else if (Buttons & BT_SPEED && (!Player.InMenu && !Player.InShop && !Player.OutpostMenu && !Player.CrateOpen))
                {
                    ArenaKeyTimer++;
                    ArenaKeyTimerType = AKTIMER_STOP;
                    if (ArenaKeyTimer > ARENA_HOLDTIME)
                    {
                        ArenaStop();
                        return;
                    }
                }
                else
                    ArenaKeyTimer = 0;
                
                // Reset menu block
                if (Buttons == 0 && OldButtons == 0)
                    Player.MenuBlock = false;
            }
        }