[Package Index | Mudlib Index | Effect Index]
It keeps track of who sold each item and how much they will receive when they pay for it. Then tracks the royalties so they can come back and collect them.
This will be run as a handler object so that npcs and rooms can both run as this sort of shop.
NB: This object is not saved using save_object. You need to set the save and load functions for this system to work.
Written by Pinkfish
Started Thu Feb 5 15:39:57 CST 1998
.
int add_category_accepted(string name)This method adds a category and sets it as already being accepted.
int add_category_request(string name, object player, int timeout)Add a request for a new category.
int add_list_object(object ob, string name, int cost, string owner, string category, int dont_update_cost)This will allow us to add an object into the inventory of the craft shop. If the name already exists in the inventory we just increment the number left by the number passed in here. If the number left goes below 0 then the item is remove from the inventory.
void adjust_royalty(string player, int amt)This method adjusts the current royalties for the player.
object * buy_objects(object * obs, string name, int cost, string owner, string category, int dont_update_costs)This method will buy the specified objects and place them into our current potential sell list. This will destroy the objects after it has been added into the sell list correctly.
int change_category_of_shop_object(object ob, string new_category)This method changes the category of the shop object.
int change_name_of_shop_object(object ob, string new_name, int dont_update_cost)This method changes the name of the shop object.
void change_value_of_shop_object(object ob, int value)This method changes the value of the shop object.
object * create_all_real_objects(object player, object * obs)This method creates real objects for all the passed in dummy objects. Remember to dest the objects after you are finished with them.
real_obs = create_real_objects(this_player(), obs); foreach (ob in real_obs) { ret += ob->the_short + ":\n" + ob->long() + "\n"; }
class craft_object create_craft_object(object ob, string owner, int cost, string category)This method creates a craft object from the input actual object.
class craft_sellable create_craft_sellable()This method creates a sellable class.
object create_real_object(object player, class craft_object craft)This method turns a craft_object class into an actual object.
void delete_objects(string id)This method deletes the specified list entry. The player owner will not be payed.
class obj_match find_matching_objects(string str)This method finds the objects which matched the passed in pattern. Note, this returns the dummy pointer objects not the actual objects, they need to be changed into real objects before they are really sold.
object find_shop_object(class craft_object frog)This method figured out what the real object is for the class.
int has_voted_for_category(string name, object player)This method checks to see if the player has voted (or nominated) for a specified category already.
int is_valid_category(string category)This method checks to make sure that the category is valid. This means a category that has been properly accepted.
void load_it()This method loads the current state of the system.
void pay_out_royalty(string player, string place, int amount)This method pays out the royalties owed to the specified player.
mapping query_all_royalties()This method returns the royalty mapping on the object. This is only use for debug information.
string * query_categories()This method returns the list of categories for the current shop.
string query_category_description(string cat)This method returns the category description.
string query_category_information(string cat)This method returns the category information.
string query_category_of(string name, string owner)This method returns the category associated with this name/category set.
string query_category_of_shop_object(object ob)This method returns the category of the speficied shop object.
int query_category_timeout(string name)This method returns the time the current category has left before it times out.
class craft_object query_class_of_shop_object(object ob)This method searches the current sell list to see if the object passed corresponds to any of the existing things in our sell list.
int query_dont_use_name()This method is used to determine the status of the flag which controls adding the owners name to shop objects by default. If this is set to 1 then the owners name will not be added by default.
string query_id_of_shop_object(object ob)This method returns the id associated with the shop object. This is the one letter id used for buying selling etc.
object * query_items_with_shop_id(string id)This method returns all the objects which match the specified id of the shop object.
int query_list_object_cost(string name, string owner)This method returns the cost of the specified type of object.
string query_name_of_shop_object(object ob)This method returns the list name associated with the shop object.
string query_next_shop_id()This method attempts to figure out what the next id would be for the object. It will allocate this id as well as returning.
string query_owner_of_shop_object(object ob)This method returns the owner associated with the shop object.
string * query_owner_sellables(string owner)This method returns the list of sellables that the owner currently has in the shop. This will potentially return more than one of the same name if the owner has more than one of the same sort of object being sold.
int query_royalty(string player)This method returns the current royalties for the specified person.
object query_sell_list()This method returns the container associated with the sell list.
object * query_sell_list_obs()This method returns all the current objects in the sell list.
string query_short_of_shop_object(object ob)This method returns the possible short descriptions of the shop objects.
int remove_category_accepted(string category)This method removes a category immediately.
int remove_list_object(string name, string owner, class craft_object ob)This method removes a single object from the current object list.
void remove_shop_id(string id)This method removes an id when that book has been taken from the shop.
int remove_shop_object(object ob)This method removes the real data behind the specified shop object. The object passed in must be one of the dummy objects used for listing the shops inventory.
void save_it()This method saves the current state of the system.
object * sell_objects(object * obs, string place, object player, int cut, int force, int ref total_value)This method sells the specified shop objects to the player. This will make the payments to the player. The objects will all attempt to be moved into the player. The cut must be between 0 and 100.
The royalties from selling the object will be placed into the
correct place by the function, so they can be picked up at a
later date. The 'cut' will be taken out of the sale.
void set_category_description(string cat, string desc)This method sets the description of the category.
void set_category_function(function func)This method is called when categories complete each of their phases to see if the idea was passed by enough majority or whatever to go onto the next one.
void set_category_information(string cat, string info)This method sets the information of the category.
void set_dont_use_name(int flag)This method is called by the controled object onto here to control if the owners name is added to shop objects. If this is set to 1 then the owners name will not be added by default.
void set_id_of_shop_objects(object * obs, string id)This method sets the current id of the shop objects.
void set_load_function(function func)This method sets the load function on the class. The restore function will be called with one parameter and is expected to return a string. The parameter is the file name to load.
void set_save_function(function func)This method sets the save function on the class. The save function will be called with two parameters, one is the file name to be saved and the other is the text to be saved to it.
void update_craft_object(object craft_ob, object replacement_ob)This method updates the internal representation of the specified craft object. It replaces the saved auto load info with the new stuff.
int value_of_objects(object * obs)This method determines the price of all the shop objects in the array.
int vote_for_category(string name, object player, int choice)This method allows the player to vote for the specified category.
void add_to_sellables(string name, string owner, class craft_object * ob)This method adds a selable into the current sellable array.
int create_auto_load_file(mixed ob, int fixed_num)This method creates a save file for the specified objects autoloading capability. If the number to write to is non-null then it will write to that object.
object create_dummy_object(string owner, string name, int cost, class craft_object craft)This method creates a dummy object for use when selling items. This allows use to use alias names for the potions when buying/selling and not the real name of the container. When bought these names will be added to the thingy as aliases.
object create_real_auto_load_object(int num, object player)This method creates a real object from the save file number.
void remove_auto_load_file(int num)This method removes the auto load stuff after it is no longer needed.
class craft_category { int state; string description; string information; string * voted; int yes; int no; int abstain; int timeout; }
class craft_object { int cost; string cap_owner; int ob_num; string category; string short; }
class craft_sellable { mapping objects; }