[Package Index | Mudlib Index | Effect Index]

File /std/living/skills.c

This skills modules for living creates. This deals will all the skill interactions needed for the living objects.

Written by Pinkfish

Includes

This class includes the following files /include/tune.h, /include/skills.h and /include/tasks.h

Method index

Public Functions

These are functions that everyone can access.

add_skill_level
varargs int add_skill_level(string skill,
                            int lvl,
                            mixed exp)

This method adds a skill level to the specified skill to the system.

Parameters:
skill - the skill to add a level to
lvl - the number of levels to add
exp - the amount of exp spent on the skill

Returns:
1 if the skill level was changed

See also:
query_skill() and query_skill_bonus()


add_teach_offer
void add_teach_offer(object ob,
                     string skill,
                     int num,
                     int lvl,
                     int xp)

This method adds a teaching offer to the living object.

Parameters:
ob - the object teaching us
skill - the skill they are teaching
num - the number of levels they are teaching
lvl - the level they are teaching us from
xp - the cost of the level increase in xp


calc_bonus
varargs int calc_bonus(int lvl,
                       string skill,
                       int use_base_stats)

This method calculates the bonus for the skill. It takes the raw level and turns that into a bonus and then adds on the stats modifications.

Parameters:
lvl - the level to turn into bonus
skill - the skill to modify the bonus of
use_base_stats - use the real unmodified stats

Returns:
the bonus associated with the skill


not_there
int not_there(string skill)

This method checks to see if the skill exists in the skill array or not.

Parameters:
skill - the skill to check for non-existance

Returns:
0 if it does not exist, 1 if it does


query_bonus_cache
mapping query_bonus_cache()

This method returns the current bonus cache for the living thing. The bonus cache is where the calculated bonuses for the skills are kept.

Returns:
the bonus cache mapping


query_complete_skill_branch
mapping query_complete_skill_branch(string branch)

This method fills out a complete skill branch, complete with ALL child skill s. It saves using many call_others to check skills.
query_complete_skill_tree
mapping query_complete_skill_tree()

This method fills out a complete skill tree, complete with ALL child skills. It saves using many call_others to check skills. This also flushes the tree and updates everything.
query_skill
int query_skill(string skill)

This returns jus the skill level. Used a lot to determine if you can use/teach/whatever a skill. This also uses a cache.

Parameters:
skill - the skill to return the level of

Returns:
the skill level


query_skill_bonus
varargs int query_skill_bonus(string skill,
                              int use_base_stats)

This method returns the skill bonus for the specified skill. It returns the skill + all its bonsues for stats/whatever. It first checks to see if the skill is in it's cache. THe real stat values are ones not modified by bonuses or temporary values.

Parameters:
skill - the skill to get the bonus for
use_base_stats - tells the system not to use the real stat values

Returns:
the skill bonus


query_skill_successful
int query_skill_successful(string str,
                           int mod)

This method does a skill successful check. Does this check:
(bonus + mos) >= random(200)

Parameters:
str - the skill to check
mod - the modification value

Returns:
1 if the skill check is successful


query_skills
mapping query_skills()
query_stat_cache
mapping query_stat_cache()

This method returns the cached values for the stats.

Returns:
the caches stat values


query_teach_offer
mapping query_teach_offer()

This method returns the current list of teach offerings on the living object.

Returns:
the mapping containing the teach offerings


set_skills
void set_skills(mapping map)
stat_modify
varargs int stat_modify(int lvl,
                        string skill,
                        int use_base_stats)

This method returns the skill as it should be modified by the stats associated with it.

Parameters:
lvl - the level to modify
skill - the skill the modify the bonus of
use_base_stats - use the real unmodified stat values

Returns:
the stat modification

See also:
query_skill_bonus()


stop_teaching_skills
void stop_teaching_skills(int left,
                          mixed bing)

The method to call when we stop teaching skills. THis will stop the stuff being taught if the stop is successful, and only teach partial amounts if we are not finished yet.

Parameters:
left - the amount of time left
bing - the data associated with the command


tm_check_ok
int tm_check_ok(string skill,
                object exp)
totaly_zap_bonus_cache
void totaly_zap_bonus_cache()

This method zaps the bonus cache.
zap_stat_cache
void zap_stat_cache()

This method zaps the stat cache when a certain stat changes. It calls the function stats_to_zap() on the living object to figure out which stats have changed.

See also:
/std/living/stats->stats_to_zap()


Protected Functions

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

flatten_it
void flatten_it(string skill)

This is used to convert a previously not only_leaf tree into an only_leaf tree.
totaly_zap_stat_cache
void totaly_zap_stat_cache()

This method zaps the stat cache.