CTweakMetadataCVAR::CTweakMetadataCVAR(IScriptTable *pTable) : CTweakMetadata(pTable)
{
	// Already fetched by base classes: DELTA, NAME

	// Look for the essential elements of a Tweak
	m_bValid = true;

	// Fetch the variable name (we know this exists)
	m_sVariable = FetchStringValue(pTable, "CVAR");
		
	// There's probably other checks that should be done, including looking for unrecognised elements
	
	// What type is the CVAR?
	m_CVarType = 0;
	if (GetCVar()) m_CVarType  = GetCVar()->GetType();
}
Example #2
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 #3
0
NamedScript MenuEntry void SaveCharacter()
{
    char const *SaveString;
    char *EncodedSaveString;
    //CharSaveInfo Info;
    
    // You need to be in the Outpost to do this
    if (!CurrentLevel->UACBase && !GetCVar("drpg_debug"))
    {
        PrintError("\CgERROR: \CjYou must be in the Outpost to save and deposit your equipment");
        ActivatorSound("menu/error", 127);
        return;
    }
Example #4
0
// Keeps current level and XP updated
void CheckLevel()
{
    if (Player.Level < MAX_LEVEL)
        Player.XPNext = XPTable[Player.Level];
    
    if (Player.Level >= MAX_LEVEL)
    {
        Player.XP = XPTable[MAX_LEVEL - 1];
        Player.XPNext = XPTable[MAX_LEVEL - 1];
    }
    
    // Now check for a level up
    if (Player.XP >= XPTable[Player.Level] && Player.Level < MAX_LEVEL)
    {
        int Modules = (int)((((fixed)Player.Level + 1) * 100.0) * GetCVarFixed("drpg_module_levelfactor"));
        
        // Level Up
        Player.Level++;
        Player.Payout.Levels++;
        GiveInventory("DRPGModule", Modules);
        
        if (GetCVar("drpg_levelup_heal"))
        {
            HealThing(SHIELD_HEALTH);
            
            if (Player.EP < 0)
                Player.EP = 0;
            else
                Player.EP = Player.EPMax;
        }
        
        FadeRange(255, 255, 255, 0.5, 255, 255, 255, 0, 2.0);
        PrintMessage(StrParam("You have reached level %d", Player.Level), LEVELUP_ID, -32);
        
        ActivatorSound("misc/levelup", 96);
        SpawnForced("DRPGLevelUpArrow", GetActorX(0), GetActorY(0), GetActorZ(0) + GetActorPropertyFixed(Player.TID, APROP_Height), 0, 0);
    }
}
bool CTweakMetadataCVAR::ChangeValue(bool bIncrement) {
	// Get delta
	double fDelta = m_fDelta;
	if (!bIncrement) fDelta *= -1.0;

	// Get and check CVAR
	ICVar *cVar = GetCVar();
	if (!cVar) return false;
	
	// Deal with appropriate type
	switch (cVar->GetType()) {
		case CVAR_INT:
			cVar->Set( (int) (cVar->GetIVal() + fDelta)	);
			break;
		case CVAR_FLOAT:
			cVar->Set( (float) (cVar->GetFVal() + fDelta) );
			break;
		default:;
			// Strings are non-obvious
			// Might also be a non-exisitent variable			
	}
	return true;
}
Example #6
0
script SAMSARA_DECORATE (int choice, int arg1, int arg2)
{
    int clipcount;
    int result;
    int i, j, k;
    int x, y, z;
    int armorIndex, armorToSet;
    int pln = PlayerNumber();
    
    switch (choice)
    {
      case 1:
        result = GetActorProperty(0, APROP_Dropped);
        break;
        
      case 2:
        if (CheckInventory("WolfenMovement") == 1) { SetActorState(0, "Spawn"); }
        break;
        
      case 3:
        result = !(GetCVar("sv_itemrespawn") || GetCVar("sv_weaponstay"));
        break;
        
      case 4:
        result = isInvasion() || !(isCoop() || isSinglePlayer());
        break;

      case 5:
        SetActivatorToTarget(0);
        result = CheckInventory("Cell");
        if (arg1) { TakeInventory("Cell", result); }
        break;

      case 6:
        result = GetCVar("skulltag");
        break;
      
      case 7:
        if (arg2 != 1)
        {
            GiveQuad(arg1);
        }
        else
        {
            if (isLMS())
            {
                if (GetCvar("samsara_permaquad") == 1)
                { GiveInventory("QuadDamageItem", 1); }
                break;
            }

            GiveQuad(arg1);

            if (GetCvar("samsara_permaquad") == 1)//if (isCoop() || isSinglePlayer())
            { GiveInventory("QuadDamageItem", 1); }
        }
        break;

      case 8:
        result = defaultCVar("samsara_cl_expparticles", 0);
        if (!result) { result = 100; }

        result = max(0, result);

        result *= max(arg1, 1);
        result /= max(arg2, 1);

        GiveInventory("QuakeExplosionCounter", result);
        break;

      case 9:
        clipcount = CheckInventory("Clip");

        if (clipcount < 50)
        {
            GiveInventory("Clip", 50 - clipcount);
            TakeInventory("Clip", CheckInventory("Clip") - 50);
            result = 1;
        }
        break;

      case 10:
        TakeInventory("QuakeExplosionCounter", arg1);
        result = CheckInventory("QuakeExplosionCounter");
        break;

      case 15:
        SetActorProperty(0, APROP_Speed, percFloat(arg1, arg2));
        break;
        
      case 16:
        if (GameType () != GAME_SINGLE_PLAYER)
        {
            SetHudSize(400, 300, 0);
            Hudmessage(s:"Press any button to respawn.";
            HUDMSG_PLAIN,1,CR_LIGHTBLUE,200.4,9.1,1.75);
            delay(15);

            if (!CheckInventory("DukeBallgag"))
            {
                LocalAmbientSound("duke/mpdeath",127);
                GiveInventory("DukeTauntCooldown",5);
                ACS_ExecuteAlways(205,0,0);
            }
        }
        break;

      case 17:
        if (arg1) { result = GetCVar("samsara_permault"); }
        else { result = GetCVar("sv_weaponstay"); }
        break;

      case 18:
        if (MapArmors[0] == -1) { CheckMapArmors(); }
        SetArmorMode();

        i = Timer() != 0;

        if (MapArmors[ARMOR_YELLOW] == 1) { i += 2; }

        SetActorState(0, ArmorModeStates[ArmorMode][i]);
        break;

      case 19:
        result = isLMS();
        break;

      case 20:
        SetArmorMode();

        armorIndex = -1;
        armorToSet = arg1;

        for (i = 0; i < ARMORCOUNT; i++)
        {
            if (GetArmorType(ArmorItems[ArmorMode][i][0], pln))
            {
                armorIndex = i;
                break;
            }
        }

        arg1 = middle(0, arg1, ARMORCOUNT-1);
        i = CheckInventory("Armor");
        j = ArmorItems[ArmorMode][arg1][1];

        if (j == 0) { result = 0; break; }


        /* If we're adding armor, always follow through
           Else, if the ending armor count is lower than the current armor count
           and we're not upgrading our armor, give up now */

        if (arg2 > 0)
        {
            if (arg1 <= armorIndex) { armorToSet = armorIndex; }
        }
        else if (((arg2 == 0 && i > j) || (arg2 < 0 && i > -arg2)) && (arg1 <= armorIndex))
        {
            result = 0;
            break;
        }

        if (arg2 <= 0)
        {
            TakeInventory("BasicArmor", i);
            GiveInventory(ArmorItems[ArmorMode][armorToSet][0], 1);

            k = CheckInventory("Armor");

            if (arg2 == 0) { break; }

            TakeInventory("BasicArmor", k-1);
            GiveInventory("InfiniteArmorBonus", -arg2 - 1);
        }
        else
        {
            TakeInventory("BasicArmor", i);
            GiveInventory(ArmorItems[ArmorMode][armorToSet][0], 1);

            k = CheckInventory("Armor");
            TakeInventory("BasicArmor", k-1);

            GiveInventory("InfiniteArmorBonus", (i + arg2) - 1);
        }

        result = 1;
        break;

      case 21:
        i = CheckInventory("Armor");
        if (i < arg1) { result = 0; break; }

        TakeInventory("BasicArmor", i-arg1);
        result = 1;
        break;

      case 22:
        result = GetCVar("samsara_nohealthcap");
        break;

      case 23:
        GiveInventory("TimeBombPause", 1);
        Delay(arg1);
        TakeInventory("TimeBombPause", 1);
        break;

      case 24:
        result = GetCVar("samsara_noult");
        break;

      case 25:
        if (GameType() == GAME_NET_COOPERATIVE)
		{ AmbientSound("quake/invisannouncer",127); }
		else
		{ LocalAmbientSound("quake/invisannouncer",127); }
        break;
		
	  case 26:
	    if (CheckInventory("PowerInvisibility") == 0)
		{ GiveInventory("PowerInvisibility",1); }
		else
		{ TakeInventory("PowerInvisibility",1); 
		delay(1);
		GiveInventory("PowerShadow",1);
		delay(1);
		GiveInventory("PowerShadow",1); }
	    break;

      case 27:
        result = GetCVar("samsara_nounique");
        break;

      case 28:
        result = GetCVar("samsara_noinvuln");
        break;

      case 29:
        result = GetCVar("instagib");
        break;

      case 30:
        result = GetCVar("samsara_cl_bloodyhell");
        break;

      case 31:
        result = GetCVar("samsara_cl_bloodypersistent");
        break;

      case 32:
        result = GetCVar("samsara_nohealth");
        break;

      case 33:
        result = GetCVar("samsara_vanillaquake");
        break;
    }
string CTweakMetadataCVAR::GetValue(void) {
	string result = "Not found";
	ICVar *cVar = GetCVar();
	if (cVar) result = cVar->GetString();
	return result;
}