NAME

WWW::BackpackTF::Currency - Class representing currency information

SYNOPSIS

  my @currencies = $bp->get_currencies;
  my $currency = $currencies[0];
  say 'Name: ',                               $currency->name;
  say 'Quality (number): ',                   $currency->quality;
  say 'Quality (human-readable): ',           $currency->quality_name;
  say 'Priceindex: ',                         $currency->priceindex;
  say 'Craftable: ',                         ($currency->craftable ? 'YES' : 'NO');
  say 'Tradable: ',                          ($currency->tradable ? 'YES' : 'NO');
  say 'Singular form: ',                      $currency->single;
  say 'Plural form: ',                        $currency->plural;
  say 'Round to this many decimal places: ',  $currency->round;
  say 'Defindex: ',                           $currency->defindex;
  say '3.15271 units of this currency is: ',  $currency->stringify(3.15271); # example return values: "3.15 keys", "3.15 ref", "3.15 buds"

DESCRIPTION

WWW::BackpackTF::Currency is a class representing information about a currency.

METHODS

name

The name of the currency.

quality

The quality integer of the currency. Usually 6 (corresponding to the Unique quality).

quality_name

The quality of the currency as a human-readable string. Usually 'Unique'.

priceindex

The priceindex of a currency. Indicates a crate series or unusual effect. Usually 0.

craftable

True if the currency is craftable, false otherwise. Usually true.

tradable

True if the currency is tradable, false otherwise. Usually true.

single

The singular form of the currency.

plural

The plural form of the currency.

round

The number of decimal places this currency should be rounded to.

defindex

The definition index of the currency.

stringify($count)

Rounds $count to the number of decimal places returned by round, then appends a space and the correct singular/plural form of the currency.

SEE ALSO

http://backpack.tf/api/currencies

AUTHOR

Marius Gavrilescu, <marius@ieval.ro>

COPYRIGHT AND LICENSE

Copyright (C) 2014-2017 by Marius Gavrilescu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.2 or, at your option, any later version of Perl 5 you may have available.