Home

[Package Index | Mudlib Index | Effect Index]

File /std/basic/misc.c

This class contains information relating to the value and the weight of the object.

Written by Pinkfish

Inherits

This class inherits the following classes /std/basic/consecrate.c, /std/basic/light.c and /std/basic/move.c

Includes

This class includes the following files /include/move_failures.h, /include/shops/bank.h and /include/money.h

Method index

  • adjust_money(mixed, string)
    This method changes the value of the object by a certain number of coins.
  • adjust_value(int)
    This method changes the current value of the object.
  • adjust_weight(int)
    This method adjusts the weight by the given amount.
  • query_base_value()
    This method returns the vase value of the object.
  • query_complete_weight()
    This method returns the current weight of the object.
  • query_length()
    This method queries the length of an object.
  • query_money(string)
    This method returns the number of coins of a certain type that are in the value of the object.
  • query_money_array()
    This method returns the value of the object as a money array.
  • query_value()
    This method returns the current value of the object.
  • query_value_at(object)
    This method figures out how much an object will cost in a certain place.
  • query_value_info()
    This method returns the information associated for all the special bits of the object.
  • query_value_real(string)
    This method always returns the most expensive value of an item.
  • query_weight()
    This method returns the current weight of the object.
  • query_width()
    This method queries the width of an object.
  • remove_value_info(string)
    This method removes the value information for a type of special object.
  • set_length(int)
    This method sets the length to the given amount.
  • set_value(int)
    This method sets the value of the object.
  • set_value_info(string, int)
    This method sets the value information for a type of special object.
  • set_weight(int)
    This method sets the weight of the object.
  • set_width(int)
    This method sets the width to the given amount.

Public Functions

These are functions that everyone can access.

adjust_money
varargs int adjust_money(mixed amt,
                         string coin)

This method changes the value of the object by a certain number of coins. The coins can be any type.

Returns:
the new value

See also:
/obj/handlers/money_handler->query_total_value(), adjust_value(), query_money_array() and set_value()


adjust_value
int adjust_value(int i)

This method changes the current value of the object.

Parameters:
i - the amount to change the value by

Returns:
the new value of the object


adjust_weight
void adjust_weight(int w)

This method adjusts the weight by the given amount.

Parameters:
w - the amount to change the weight by

See also:
set_weight() and query_weight()


query_base_value
int query_base_value()

This method returns the vase value of the object. This is before any scaling from things like condition occurs.

Returns:
the base value


query_complete_weight
int query_complete_weight()

This method returns the current weight of the object. It does basicly the same thing as the previous call. NB: this_object()->query_weight() is pretty much the same as query_weight(), except it takes shadows into account.

Returns:
the current weight of the object

See also:
set_weight(), adjust_weight() and query_weight()


query_length
int query_length()

This method queries the length of an object.

See also:
set_length()


query_money
int query_money(string type)

This method returns the number of coins of a certain type that are in the value of the object. This is not a good estimate of value or anything, no idea why it is here really. I am sure I had a good reason at the time :)

Parameters:
type - the type of coin to look for

Returns:
the number of coins of that type

See also:
/obj/handlers/money_handlers->create_money_array(), set_value(), adjust_value(), adjust money(), query_money_array() and query_value()


query_money_array
mixed * query_money_array()

This method returns the value of the object as a money array. The money array is a list oif coinages followed by a number of coins. Eg: ({ "copper", 10, "silver", 12 }).

See also:
/obj/handlers/money_handlers->create_money_array(), set_value(), adjust_value(), adjust_money() and query_value()


query_value
int query_value()

This method returns the current value of the object.

Returns:
the current value of the object


query_value_at
int query_value_at(object place)

This method figures out how much an object will cost in a certain place. For instance at a shop that does not handle artifcacts an artifact will be bought and sold cheaply. The current types of "artifact", "enchantment" and "material" are recognised. A property in the shop of the type "artifact valued" will cause the values of that type to be taken into account.

Parameters:
place - the object to find the value at

Returns:
the value in the shop

See also:
query_value(), set_value_info() and adjust_value()


query_value_info
mapping query_value_info()

This method returns the information associated for all the special bits of the object. The value infor maping ihas keys which are the type of value info and the value is the value of it.

Returns:
the value info mapping

See also:
set_value_info(), query_value_at() and remove_value_info()


query_value_real
int query_value_real(string place)

This method always returns the most expensive value of an item. This should be used for things like theif quotas and anything which requires the real actual value of an item.

Parameters:
place - the place to find the values in


query_weight
int query_weight()

This method returns the current weight of the object.

Returns:
the current weight of the object

See also:
set_weight() and adjust_weight()


query_width
int query_width()

This method queries the width of an object. The width should be the shorter side of an object and the length its longer one. Sadly someone chose inches as the size units. :(

Parameters:
w - the amount to set the width to

See also:
set_width()


remove_value_info
void remove_value_info(string word)

This method removes the value information for a type of special object. This is the extra value information associated with the "artifact", "enchantment" or "material" of the object.

Parameters:
word - the type of value information to remove

See also:
query_value_at(), set_value_info() and set_value()


set_length
void set_length(int l)

This method sets the length to the given amount. The length should be the long side of an object, the width its shorter one. Sadly someone chose inches as the size units. :(

Parameters:
w - the amount to set the length to.

See also:
query_length()


set_value
void set_value(int number)

This method sets the value of the object. The actual value in coins and so forth is worked out by the money handler based on the value.

Parameters:
number - the new value of the object

See also:
query_value(), adjust_value() and query_money_array()


set_value_info
void set_value_info(string word,
                    int number)

This method sets the value information for a type of special object. This is the extra value information associated with the "artifact", "enchantment" or "material" of the object.

Parameters:
word - the type of value information
number - the amount to set it to

See also:
query_value_at(), remove_value_info() and set_value()


set_weight
void set_weight(int w)

This method sets the weight of the object. One weight unit is 50 grams.

When setting the weights of weapons use the following guide:

o===================o=====================o================o
| Weapon            | Approx. Weight (kg) |  Weight Units  |
o===================o=====================o================o
| Dagger            |        0.5          |       10       |
| War Hammer        |        1.1          |       22       |
| Mace              |        1.3          |       26       |
| Flail             |        1.5          |       30       |
| Pole Axe          |        2.3          |       46       |
| Short Sword       |        0.8          |       16       |
| Broad Sword       |        1.1          |       22       |
| Long Sword        |        1.4          |       28       |
| Bastard Sword     |        1.9          |       38       |
| Two-handed Sword  |        2.7          |       42       |
o===================o=====================o================o


Parameters:
w - the amount to change the weight by

See also:
adjust_weight() and query_weight()


set_width
void set_width(int w)

This method sets the width to the given amount.

Parameters:
w - the amount to set the width to

See also:
query_width()


Valid HTML 4.01 Transitional
Valid CSS!
Read More