Home

[Package Index | Mudlib Index | Effect Index]

File /std/shops/controllers/craft_shop_controller.c

This is to handle a place where players can sell a number of neato craft items they have made up. It will be extended to deal with books as well.

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

Includes

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

Class Index

Method index

  • add_category_accepted(string)
    This method adds a category and sets it as already being accepted.
  • add_category_request(string, object, int)
    Add a request for a new category.
  • add_list_object(object, string, int, string, string, int)
    This will allow us to add an object into the inventory of the craft shop.
  • add_to_sellables(string, string, class craft_object *)
    This method adds a selable into the current sellable array.
  • adjust_royalty(string, int)
    This method adjusts the current royalties for the player.
  • buy_objects(object *, string, int, string, string, int)
    This method will buy the specified objects and place them into our current potential sell list.
  • change_category_of_shop_object(object, string)
    This method changes the category of the shop object.
  • change_name_of_shop_object(object, string, int)
    This method changes the name of the shop object.
  • change_value_of_shop_object(object, int)
    This method changes the value of the shop object.
  • create_all_real_objects(object, object *)
    This method creates real objects for all the passed in dummy objects.
  • create_auto_load_file(mixed, int)
    This method creates a save file for the specified objects autoloading capability.
  • create_craft_object(object, string, int, string)
    This method creates a craft object from the input actual object.
  • create_craft_sellable()
    This method creates a sellable class.
  • create_dummy_object(string, string, int, class craft_object)
    This method creates a dummy object for use when selling items.
  • create_real_auto_load_object(int, object)
    This method creates a real object from the save file number.
  • create_real_object(object, class craft_object)
    This method turns a craft_object class into an actual object.
  • delete_objects(string)
    This method deletes the specified list entry.
  • find_matching_objects(string)
    This method finds the objects which matched the passed in pattern.
  • find_shop_object(class craft_object)
    This method figured out what the real object is for the class.
  • has_voted_for_category(string, object)
    This method checks to see if the player has voted (or nominated) for a specified category already.
  • is_valid_category(string)
    This method checks to make sure that the category is valid.
  • load_it()
    This method loads the current state of the system.
  • pay_out_royalty(string, string, int)
    This method pays out the royalties owed to the specified player.
  • query_all_royalties()
    This method returns the royalty mapping on the object.
  • query_categories()
    This method returns the list of categories for the current shop.
  • query_category_description(string)
    This method returns the category description.
  • query_category_information(string)
    This method returns the category information.
  • query_category_of(string, string)
    This method returns the category associated with this name/category set.
  • query_category_of_shop_object(object)
    This method returns the category of the speficied shop object.
  • query_category_timeout(string)
    This method returns the time the current category has left before it times out.
  • query_class_of_shop_object(object)
    This method searches the current sell list to see if the object passed corresponds to any of the existing things in our sell list.
  • 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.
  • query_id_of_shop_object(object)
    This method returns the id associated with the shop object.
  • query_items_with_shop_id(string)
    This method returns all the objects which match the specified id of the shop object.
  • query_list_object_cost(string, string)
    This method returns the cost of the specified type of object.
  • query_name_of_shop_object(object)
    This method returns the list name associated with the shop object.
  • query_next_shop_id()
    This method attempts to figure out what the next id would be for the object.
  • query_owner_of_shop_object(object)
    This method returns the owner associated with the shop object.
  • query_owner_sellables(string)
    This method returns the list of sellables that the owner currently has in the shop.
  • query_royalty(string)
    This method returns the current royalties for the specified person.
  • query_sell_list()
    This method returns the container associated with the sell list.
  • query_sell_list_obs()
    This method returns all the current objects in the sell list.
  • query_short_of_shop_object(object)
    This method returns the possible short descriptions of the shop objects.
  • remove_auto_load_file(int)
    This method removes the auto load stuff after it is no longer needed.
  • remove_category_accepted(string)
    This method removes a category immediately.
  • remove_list_object(string, string, class craft_object)
    This method removes a single object from the current object list.
  • remove_shop_id(string)
    This method removes an id when that book has been taken from the shop.
  • remove_shop_object(object)
    This method removes the real data behind the specified shop object.
  • save_it()
    This method saves the current state of the system.
  • sell_objects(object *, string, object, int, int, int ref)
    This method sells the specified shop objects to the player.
  • set_category_description(string, string)
    This method sets the description of the category.
  • set_category_function(function)
    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.
  • set_category_information(string, string)
    This method sets the information of the category.
  • set_dont_use_name(int)
    This method is called by the controled object onto here to control if the owners name is added to shop objects.
  • set_id_of_shop_objects(object *, string)
    This method sets the current id of the shop objects.
  • set_load_function(function)
    This method sets the load function on the class.
  • set_save_function(function)
    This method sets the save function on the class.
  • update_craft_object(object, object)
    This method updates the internal representation of the specified craft object.
  • value_of_objects(object *)
    This method determines the price of all the shop objects in the array.
  • vote_for_category(string, object, int)
    This method allows the player to vote for the specified category.

Public Functions

These are functions that everyone can access.

.

    add_category_accepted
    int add_category_accepted(string name)
    

    This method adds a category and sets it as already being accepted.
    • Parameters:
      name - the name of the category to add
    add_category_request
    int add_category_request(string name,
                             object player,
                             int timeout)
    

    Add a request for a new category.
    • Parameters:
      name - the name of the category
      player - the person who suggested it
      timeout - the initial timeout for the nomination period
    • Returns:
      1 if successful added, 0 if not
        add_list_object
        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.
        • Parameters:
          ob - the object to add
          name - the tag to use for it
          num - the number to add
          category - the category to add the item to
          dont_update_cost - allows the same name to have multiple prices
        • See also:
          remove_list_object() and add_sell_list_name()
            adjust_royalty
            void adjust_royalty(string player,
                                int amt)
            

            This method adjusts the current royalties for the player.
            • Parameters:
              player - the name of the player to pay the royalties to
              amt - the amount to adjust the value by
            • See also:
              query_royalties() and pay_out_royalties()
                buy_objects
                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.
                • Parameters:
                  obs - the object to sell
                  name - the name of the object to sell
                  cost - the cost of the object being sold
                  owner - the person to who the object belongs
                  category - the category of the object
                  dont_update_costs - allows the system to handle objects with the same name and different costs
                • See also:
                  sell_objects()
                    change_category_of_shop_object
                    int change_category_of_shop_object(object ob,
                                                       string new_category)
                    

                    This method changes the category of the shop object.
                    • Parameters:
                      ob - the shop object to change
                      new_category - the new category of the shop object
                        change_name_of_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.
                        • Parameters:
                          ob - the shop object to change
                          new_name - the new name of the shop object
                          dont_update_cost - allows the names to merge and not update costs
                        • Returns:
                          1 on success, 0 on failure
                            change_value_of_shop_object
                            void change_value_of_shop_object(object ob,
                                                             int value)
                            

                            This method changes the value of the shop object.
                            • Parameters:
                              ob - the shop object
                              value - the new value
                                create_all_real_objects
                                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.
                                • Parameters:
                                  obs - the dummy objects to find real ones of
                                • Returns:
                                  the real object values
                                • See also:
                                  create_real_object()
                                • Example:
                                  real_obs = create_real_objects(this_player(), obs);
                                  foreach (ob in real_obs) {
                                     ret += ob->the_short + ":\n" + ob->long() + "\n";
                                  }
                                  
                                    create_craft_object
                                    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.
                                    • Parameters:
                                      ob - the real input object
                                      owner - the owner of the object
                                      cost - the cost of the object
                                      category - the category of the object
                                    • Returns:
                                      a nice craft object
                                        create_craft_sellable
                                        class craft_sellable create_craft_sellable()
                                        

                                        This method creates a sellable class.
                                        • Returns:
                                          a new sellable class
                                            create_real_object
                                            object create_real_object(object player,
                                                                      class craft_object craft)
                                            

                                            This method turns a craft_object class into an actual object.
                                            • Parameters:
                                              craft - the craft object to create
                                            • Returns:
                                              the newly formed craft object
                                            • See also:
                                              create_all_real_objects()
                                                delete_objects
                                                void delete_objects(string id)
                                                

                                                This method deletes the specified list entry. The player owner will not be payed.
                                                • Parameters:
                                                  id - The list entry to delete
                                                    find_matching_objects
                                                    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.
                                                    • Parameters:
                                                      str - the pattern to match the objects on
                                                    • Returns:
                                                      the matching objects
                                                    • See also:
                                                      query_class_of_shop_object(), value_of_objects() and sell_objects()
                                                        find_shop_object
                                                        object find_shop_object(class craft_object frog)
                                                        

                                                        This method figured out what the real object is for the class.
                                                        • Parameters:
                                                          frog - the class to find the object for
                                                        • Returns:
                                                          the dummy object for the class
                                                            has_voted_for_category
                                                            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.
                                                            • Parameters:
                                                              name - the name of the category
                                                              player - the player being checked
                                                            • Returns:
                                                              1 if they have voted/nominated 0 if they have not
                                                                is_valid_category
                                                                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.
                                                                • Parameters:
                                                                  category - the category to check
                                                                    load_it
                                                                    void load_it()
                                                                    

                                                                    This method loads the current state of the system.
                                                                    • See also:
                                                                      set_load_function()
                                                                        pay_out_royalty
                                                                        void pay_out_royalty(string player,
                                                                                             string place,
                                                                                             int amount)
                                                                        

                                                                        This method pays out the royalties owed to the specified player.
                                                                        • Parameters:
                                                                          player - the player to pay out
                                                                          place - the place in which the royalties are to occur
                                                                          amount - the amount to pay out, 0 for everything
                                                                        • See also:
                                                                          query_royalties() and adjust_royalties()
                                                                            query_all_royalties
                                                                            mapping query_all_royalties()
                                                                            

                                                                            This method returns the royalty mapping on the object. This is only use for debug information.
                                                                            • Returns:
                                                                              the royalties mapping
                                                                                query_categories
                                                                                string * query_categories()
                                                                                

                                                                                This method returns the list of categories for the current shop.
                                                                                • Returns:
                                                                                  the list of categories
                                                                                    query_category_description
                                                                                    string query_category_description(string cat)
                                                                                    

                                                                                    This method returns the category description.
                                                                                    • Parameters:
                                                                                      cat - the cateogryt to find the description for
                                                                                    • Returns:
                                                                                      0 for no description, the main description otherwise
                                                                                        query_category_information
                                                                                        string query_category_information(string cat)
                                                                                        

                                                                                        This method returns the category information.
                                                                                        • Parameters:
                                                                                          cat - the cateogryt to find the information for
                                                                                        • Returns:
                                                                                          0 for no information, the main information otherwise
                                                                                            query_category_of
                                                                                            string query_category_of(string name,
                                                                                                                     string owner)
                                                                                            

                                                                                            This method returns the category associated with this name/category set.
                                                                                              query_category_of_shop_object
                                                                                              string query_category_of_shop_object(object ob)
                                                                                              

                                                                                              This method returns the category of the speficied shop object.
                                                                                              • Parameters:
                                                                                                ob - the object to find the category of
                                                                                              • Returns:
                                                                                                the category of the object
                                                                                                  query_category_timeout
                                                                                                  int query_category_timeout(string name)
                                                                                                  

                                                                                                  This method returns the time the current category has left before it times out.
                                                                                                  • Parameters:
                                                                                                    name - the name of the cateogyr
                                                                                                  • Returns:
                                                                                                    the time it timesout
                                                                                                      query_class_of_shop_object
                                                                                                      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.
                                                                                                      • Parameters:
                                                                                                        ob - the object to check
                                                                                                      • Returns:
                                                                                                        the craft_object class pointed to by the object
                                                                                                      • See also:
                                                                                                        add_object(), remove_object() and create_real_object()
                                                                                                          query_dont_use_name
                                                                                                          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.
                                                                                                          • Returns:
                                                                                                            1 if the object owners name is not used, 0 if it is
                                                                                                              query_id_of_shop_object
                                                                                                              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.
                                                                                                              • Parameters:
                                                                                                                ob - the shop object to query the id of
                                                                                                              • Returns:
                                                                                                                the id of the shop object
                                                                                                                  query_items_with_shop_id
                                                                                                                  object * query_items_with_shop_id(string id)
                                                                                                                  

                                                                                                                  This method returns all the objects which match the specified id of the shop object.
                                                                                                                  • Parameters:
                                                                                                                    id - the shop id to match on
                                                                                                                  • Returns:
                                                                                                                    the objects which match it
                                                                                                                      query_list_object_cost
                                                                                                                      int query_list_object_cost(string name,
                                                                                                                                                 string owner)
                                                                                                                      

                                                                                                                      This method returns the cost of the specified type of object.
                                                                                                                      • Parameters:
                                                                                                                        name - the name of the object
                                                                                                                        owner - the owner of the object
                                                                                                                      • Returns:
                                                                                                                        the cost of the object, 0 if it is not known
                                                                                                                      • See also:
                                                                                                                        query_owner_sellables()
                                                                                                                          query_name_of_shop_object
                                                                                                                          string query_name_of_shop_object(object ob)
                                                                                                                          

                                                                                                                          This method returns the list name associated with the shop object.
                                                                                                                          • Parameters:
                                                                                                                            ob - the shop object to query the list name of
                                                                                                                          • Returns:
                                                                                                                            the owner of the shop object
                                                                                                                              query_next_shop_id
                                                                                                                              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.
                                                                                                                              • Returns:
                                                                                                                                the next id for the shop
                                                                                                                              • See also:
                                                                                                                                remove_shop_id() and update_sellables()
                                                                                                                                  query_owner_of_shop_object
                                                                                                                                  string query_owner_of_shop_object(object ob)
                                                                                                                                  

                                                                                                                                  This method returns the owner associated with the shop object.
                                                                                                                                  • Parameters:
                                                                                                                                    ob - the shop object to query the owner of
                                                                                                                                  • Returns:
                                                                                                                                    the owner of the shop object
                                                                                                                                      query_owner_sellables
                                                                                                                                      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.
                                                                                                                                      • Parameters:
                                                                                                                                        owner - the owner to check
                                                                                                                                      • Returns:
                                                                                                                                        the array of all the possible sellables
                                                                                                                                      • See also:
                                                                                                                                        query_list_object_cost()
                                                                                                                                          query_royalty
                                                                                                                                          int query_royalty(string player)
                                                                                                                                          

                                                                                                                                          This method returns the current royalties for the specified person.
                                                                                                                                          • Parameters:
                                                                                                                                            player - the player to get the royalties for
                                                                                                                                          • Returns:
                                                                                                                                            the current royalties
                                                                                                                                          • See also:
                                                                                                                                            adjust_royalties() and pay_out_royalties()
                                                                                                                                              query_sell_list
                                                                                                                                              object query_sell_list()
                                                                                                                                              

                                                                                                                                              This method returns the container associated with the sell list.
                                                                                                                                              • Returns:
                                                                                                                                                the container for the sell list
                                                                                                                                                  query_sell_list_obs
                                                                                                                                                  object * query_sell_list_obs()
                                                                                                                                                  

                                                                                                                                                  This method returns all the current objects in the sell list.
                                                                                                                                                  • Returns:
                                                                                                                                                    all the current objects in the sell list
                                                                                                                                                      query_short_of_shop_object
                                                                                                                                                      string query_short_of_shop_object(object ob)
                                                                                                                                                      

                                                                                                                                                      This method returns the possible short descriptions of the shop objects.
                                                                                                                                                      • Parameters:
                                                                                                                                                        ob - the object to find the shorts of
                                                                                                                                                      • Returns:
                                                                                                                                                        the short descriptions
                                                                                                                                                          remove_category_accepted
                                                                                                                                                          int remove_category_accepted(string category)
                                                                                                                                                          

                                                                                                                                                          This method removes a category immediately.
                                                                                                                                                          • Parameters:
                                                                                                                                                            name - the name of the category
                                                                                                                                                              remove_list_object
                                                                                                                                                              int remove_list_object(string name,
                                                                                                                                                                                     string owner,
                                                                                                                                                                                     class craft_object ob)
                                                                                                                                                              

                                                                                                                                                              This method removes a single object from the current object list.
                                                                                                                                                              • Parameters:
                                                                                                                                                                name - the name of object to remove
                                                                                                                                                                owner - the owner of the object to remove
                                                                                                                                                                ob - the craft object pointer itself we want removed
                                                                                                                                                              • Returns:
                                                                                                                                                                1 if it worked, 0 if not
                                                                                                                                                              • See also:
                                                                                                                                                                add_list_object()
                                                                                                                                                                  remove_shop_id
                                                                                                                                                                  void remove_shop_id(string id)
                                                                                                                                                                  

                                                                                                                                                                  This method removes an id when that book has been taken from the shop.
                                                                                                                                                                  • Parameters:
                                                                                                                                                                    id - the id to remove
                                                                                                                                                                  • See also:
                                                                                                                                                                    query_next_shop_id()
                                                                                                                                                                      remove_shop_object
                                                                                                                                                                      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.
                                                                                                                                                                      • Parameters:
                                                                                                                                                                        ob - the object to remove
                                                                                                                                                                      • Returns:
                                                                                                                                                                        1 if the object was successfully removed
                                                                                                                                                                      • See also:
                                                                                                                                                                        sell_objects() and query_class_of_shop_object()
                                                                                                                                                                          save_it
                                                                                                                                                                          void save_it()
                                                                                                                                                                          

                                                                                                                                                                          This method saves the current state of the system.
                                                                                                                                                                          • See also:
                                                                                                                                                                            set_save_function() and load_it()
                                                                                                                                                                              sell_objects
                                                                                                                                                                              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.

                                                                                                                                                                              • Parameters:
                                                                                                                                                                                obs - the objects to sell
                                                                                                                                                                                place - the place to sell the objects in
                                                                                                                                                                                player - the player to sell the objects too
                                                                                                                                                                                cut - the cut the manager takes from the sale (percentage)
                                                                                                                                                                                force - forces the object to be bought even if it is broken
                                                                                                                                                                              • Returns:
                                                                                                                                                                                the array of sold objects
                                                                                                                                                                              • See also:
                                                                                                                                                                                value_of_objects(), find_matching_objects() and adjust_royalty()
                                                                                                                                                                                  set_category_description
                                                                                                                                                                                  void set_category_description(string cat,
                                                                                                                                                                                                                string desc)
                                                                                                                                                                                  

                                                                                                                                                                                  This method sets the description of the category.
                                                                                                                                                                                  • Parameters:
                                                                                                                                                                                    cat - the category to set the description of
                                                                                                                                                                                    desc - the description of the category
                                                                                                                                                                                      set_category_function
                                                                                                                                                                                      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.
                                                                                                                                                                                      • Parameters:
                                                                                                                                                                                        func - the new category function
                                                                                                                                                                                          set_category_information
                                                                                                                                                                                          void set_category_information(string cat,
                                                                                                                                                                                                                        string info)
                                                                                                                                                                                          

                                                                                                                                                                                          This method sets the information of the category.
                                                                                                                                                                                          • Parameters:
                                                                                                                                                                                            cat - the category to set the information of
                                                                                                                                                                                            info - the information of the category
                                                                                                                                                                                              set_dont_use_name
                                                                                                                                                                                              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.
                                                                                                                                                                                              • Parameters:
                                                                                                                                                                                                flag - the flag to set
                                                                                                                                                                                                  set_id_of_shop_objects
                                                                                                                                                                                                  void set_id_of_shop_objects(object * obs,
                                                                                                                                                                                                                              string id)
                                                                                                                                                                                                  

                                                                                                                                                                                                  This method sets the current id of the shop objects.
                                                                                                                                                                                                  • Parameters:
                                                                                                                                                                                                    obs - the objects to set the id for
                                                                                                                                                                                                    id - the new id for them all
                                                                                                                                                                                                      set_load_function
                                                                                                                                                                                                      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.
                                                                                                                                                                                                      • Parameters:
                                                                                                                                                                                                        func - the new load function
                                                                                                                                                                                                          set_save_function
                                                                                                                                                                                                          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.
                                                                                                                                                                                                          • Parameters:
                                                                                                                                                                                                            func - the new save function
                                                                                                                                                                                                              update_craft_object
                                                                                                                                                                                                              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.
                                                                                                                                                                                                              • Parameters:
                                                                                                                                                                                                                craft - the craft object containing the info to replace
                                                                                                                                                                                                                replacement_ob - the new object
                                                                                                                                                                                                                  value_of_objects
                                                                                                                                                                                                                  int value_of_objects(object * obs)
                                                                                                                                                                                                                  

                                                                                                                                                                                                                  This method determines the price of all the shop objects in the array.
                                                                                                                                                                                                                  • Parameters:
                                                                                                                                                                                                                    obs - the objects to price
                                                                                                                                                                                                                  • Returns:
                                                                                                                                                                                                                    the price of the shop objects
                                                                                                                                                                                                                  • See also:
                                                                                                                                                                                                                    find_matching_objects(), query_class_of_shop_object() and sell_objects()
                                                                                                                                                                                                                      vote_for_category
                                                                                                                                                                                                                      int vote_for_category(string name,
                                                                                                                                                                                                                                            object player,
                                                                                                                                                                                                                                            int choice)
                                                                                                                                                                                                                      

                                                                                                                                                                                                                      This method allows the player to vote for the specified category.
                                                                                                                                                                                                                      • Parameters:
                                                                                                                                                                                                                        name - the name of the category
                                                                                                                                                                                                                        player - the player voting
                                                                                                                                                                                                                        choice - their choice
                                                                                                                                                                                                                      • Returns:
                                                                                                                                                                                                                        1 if the vote was successful, 0 if not

                                                                                                                                                                                                                        Protected Functions

                                                                                                                                                                                                                        These are functions that only objects inheriting the class can access.

                                                                                                                                                                                                                          add_to_sellables
                                                                                                                                                                                                                          void add_to_sellables(string name,
                                                                                                                                                                                                                                                string owner,
                                                                                                                                                                                                                                                class craft_object * ob)
                                                                                                                                                                                                                          

                                                                                                                                                                                                                          This method adds a selable into the current sellable array.
                                                                                                                                                                                                                          • Parameters:
                                                                                                                                                                                                                            name - the name the object willb elisted under
                                                                                                                                                                                                                            owner - the owner of the object being sold
                                                                                                                                                                                                                            ob - the objects being sold
                                                                                                                                                                                                                          • See also:
                                                                                                                                                                                                                            add_sell_list_object() and change_name_of_object()
                                                                                                                                                                                                                              create_auto_load_file
                                                                                                                                                                                                                              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.
                                                                                                                                                                                                                              • Parameters:
                                                                                                                                                                                                                                ob - the object to get an autoload number for
                                                                                                                                                                                                                                fixed_num - the file number to write to
                                                                                                                                                                                                                              • Returns:
                                                                                                                                                                                                                                the auto load number
                                                                                                                                                                                                                              • See also:
                                                                                                                                                                                                                                save_it()
                                                                                                                                                                                                                                  create_dummy_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.
                                                                                                                                                                                                                                  • Parameters:
                                                                                                                                                                                                                                    owner - the owner of the object
                                                                                                                                                                                                                                    name - the sell list name of the object
                                                                                                                                                                                                                                  • Returns:
                                                                                                                                                                                                                                    a dummy object to place into the sell list
                                                                                                                                                                                                                                      create_real_auto_load_object
                                                                                                                                                                                                                                      object create_real_auto_load_object(int num,
                                                                                                                                                                                                                                                                          object player)
                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                      This method creates a real object from the save file number.
                                                                                                                                                                                                                                      • Parameters:
                                                                                                                                                                                                                                        num - the save file number
                                                                                                                                                                                                                                      • Returns:
                                                                                                                                                                                                                                        the nice shiny new object
                                                                                                                                                                                                                                      • See also:
                                                                                                                                                                                                                                        create_auto_load_file()
                                                                                                                                                                                                                                          remove_auto_load_file
                                                                                                                                                                                                                                          void remove_auto_load_file(int num)
                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                          This method removes the auto load stuff after it is no longer needed.
                                                                                                                                                                                                                                          • Parameters:
                                                                                                                                                                                                                                            num - the file number to remove
                                                                                                                                                                                                                                          • See also:
                                                                                                                                                                                                                                            create_object_from_auto_load()

                                                                                                                                                                                                                                            Classes

                                                                                                                                                                                                                                            These are nice data types for dealing with... Data!

                                                                                                                                                                                                                                            • craft_category
                                                                                                                                                                                                                                              class craft_category {
                                                                                                                                                                                                                                                                     int state;
                                                                                                                                                                                                                                                                     string description;
                                                                                                                                                                                                                                                                     string information;
                                                                                                                                                                                                                                                                     string * voted;
                                                                                                                                                                                                                                                                     int yes;
                                                                                                                                                                                                                                                                     int no;
                                                                                                                                                                                                                                                                     int abstain;
                                                                                                                                                                                                                                                                     int timeout;
                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                              

                                                                                                                                                                                                                                              This is the class with information about the category in it.

                                                                                                                                                                                                                                            • craft_object
                                                                                                                                                                                                                                              class craft_object {
                                                                                                                                                                                                                                                                   int cost;
                                                                                                                                                                                                                                                                   string cap_owner;
                                                                                                                                                                                                                                                                   int ob_num;
                                                                                                                                                                                                                                                                   string category;
                                                                                                                                                                                                                                                                   string short;
                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                              

                                                                                                                                                                                                                                              This keeps track of the object information itself.

                                                                                                                                                                                                                                            • craft_sellable
                                                                                                                                                                                                                                              class craft_sellable {
                                                                                                                                                                                                                                                                     mapping objects;
                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                              

                                                                                                                                                                                                                                              This class is the main sellable list.

Valid HTML 4.01 Transitional
Valid CSS!
Read More