Crossfire Server, Trunk
skills.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IS_COMBAT_SKILL(num)
 
#define IS_GRACE_SKILL(num)   (num == SK_PRAYING)
 
#define IS_MANA_SKILL(num)
 
#define MAX_SKILLS   50
 
#define SK_EXP_ADD_SKILL   0
 
#define SK_EXP_NONE   2
 
#define SK_EXP_TOTAL   1
 
#define SK_SUBTRACT_SKILL_EXP   3
 
#define USING_SKILL(op, skill)   ((op)->chosen_skill && (op)->chosen_skill->subtype == skill)
 

Enumerations

enum  SK {
  SK_LOCKPICKING = 1, SK_HIDING = 2, SK_SMITHERY = 3, SK_BOWYER = 4,
  SK_JEWELER = 5, SK_ALCHEMY = 6, SK_STEALING = 7, SK_LITERACY = 8,
  SK_BARGAINING = 9, SK_JUMPING = 10, SK_DET_MAGIC = 11, SK_ORATORY = 12,
  SK_SINGING = 13, SK_DET_CURSE = 14, SK_FIND_TRAPS = 15, SK_MEDITATION = 16,
  SK_PUNCHING = 17, SK_FLAME_TOUCH = 18, SK_KARATE = 19, SK_CLIMBING = 20,
  SK_WOODSMAN = 21, SK_INSCRIPTION = 22, SK_ONE_HANDED_WEAPON = 23, SK_MISSILE_WEAPON = 24,
  SK_THROWING = 25, SK_USE_MAGIC_ITEM = 26, SK_DISARM_TRAPS = 27, SK_SET_TRAP = 28,
  SK_THAUMATURGY = 29, SK_PRAYING = 30, SK_CLAWING = 31, SK_LEVITATION = 32,
  SK_SUMMONING = 33, SK_PYROMANCY = 34, SK_EVOCATION = 35, SK_SORCERY = 36,
  SK_TWO_HANDED_WEAPON = 37, SK_WRAITH_FEED = 38, SK_HARVESTING = 39, SK_AIR_MAGIC = 40,
  SK_EARTH_MAGIC = 41, SK_WATER_MAGIC = 42, SK_FIRE_MAGIC = 43
}
 

Functions

int get_skill_client_code (const char *skill_name)
 

Variables

const Faceskill_faces [MAX_SKILLS]
 
sstring skill_messages [MAX_SKILLS]
 
const char * skill_names [MAX_SKILLS]
 

Detailed Description

Skill-related defines, including subtypes.

Definition in file skills.h.

Macro Definition Documentation

◆ IS_COMBAT_SKILL

#define IS_COMBAT_SKILL (   num)
Value:
((num == SK_PUNCHING) \
|| (num == SK_FLAME_TOUCH) \
|| (num == SK_KARATE) \
|| (num == SK_ONE_HANDED_WEAPON) \
|| (num == SK_MISSILE_WEAPON) \
|| (num == SK_THROWING) \
|| (num == SK_CLAWING) \
|| (num == SK_TWO_HANDED_WEAPON) \
|| (num == SK_WRAITH_FEED))

This macro is used in fix_object() to define if this is a sill that should be used to calculate wc's and the like.

Definition at line 91 of file skills.h.

◆ IS_GRACE_SKILL

#define IS_GRACE_SKILL (   num)    (num == SK_PRAYING)

Currently only one of these, but put the define here to make it easier to expand it in the future

Definition at line 120 of file skills.h.

◆ IS_MANA_SKILL

#define IS_MANA_SKILL (   num)
Value:
((num == SK_SORCERY) \
|| (num == SK_EVOCATION) \
|| (num == SK_PYROMANCY) \
|| (num == SK_SUMMONING) \
|| (num==SK_AIR_MAGIC) \
|| (num==SK_EARTH_MAGIC) \
|| (num==SK_FIRE_MAGIC) \
|| (num==SK_WATER_MAGIC))

Like IS_COMBAT_SKILL above, but instead this is used to determine how many mana points the player has.

Definition at line 106 of file skills.h.

◆ MAX_SKILLS

#define MAX_SKILLS   50

This is the maximum number of skills the game may handle. There is no direct mapping to the subtype, as multiple skills may share the same subtype with a different name.

Definition at line 70 of file skills.h.

◆ SK_EXP_ADD_SKILL

#define SK_EXP_ADD_SKILL   0

Give the player the skill.

Definition at line 78 of file skills.h.

◆ SK_EXP_NONE

#define SK_EXP_NONE   2

Player gets nothing.

Definition at line 80 of file skills.h.

◆ SK_EXP_TOTAL

#define SK_EXP_TOTAL   1

Give player exp to total, no skill.

Definition at line 79 of file skills.h.

◆ SK_SUBTRACT_SKILL_EXP

#define SK_SUBTRACT_SKILL_EXP   3

Used when removing exp.

Definition at line 81 of file skills.h.

◆ USING_SKILL

#define USING_SKILL (   op,
  skill 
)    ((op)->chosen_skill && (op)->chosen_skill->subtype == skill)

True if op is using skill, false else.

Definition at line 85 of file skills.h.

Enumeration Type Documentation

◆ SK

enum SK

Skill subtypes

This list is just a subtype <-> skill (code wise) in the server translation. In theory, the processing of the different skills could be done via strncmp This list doesn't really try to identify what the skills do. The order of this list has no special meaning. 0 is not used to denote improperly set objects.

Enumerator
SK_LOCKPICKING 

Lockpicking.

SK_HIDING 

Hiding.

SK_SMITHERY 

Smithery.

SK_BOWYER 

Bowyer.

SK_JEWELER 

Jeweler.

SK_ALCHEMY 

Alchemy.

SK_STEALING 

Stealing.

SK_LITERACY 

Literacy.

SK_BARGAINING 

Bargaining.

SK_JUMPING 

Jumping.

SK_DET_MAGIC 

Detect magic.

SK_ORATORY 

Oratory.

SK_SINGING 

Singing.

SK_DET_CURSE 

Detect curse.

SK_FIND_TRAPS 

Find traps.

SK_MEDITATION 

Meditation.

SK_PUNCHING 

Punching.

SK_FLAME_TOUCH 

Flame-touch.

SK_KARATE 

Karate.

SK_CLIMBING 

Climbing.

SK_WOODSMAN 

Woodsman.

SK_INSCRIPTION 

Inscription.

SK_ONE_HANDED_WEAPON 

One handed weapon.

SK_MISSILE_WEAPON 

Missile weapon.

SK_THROWING 

Throwing.

SK_USE_MAGIC_ITEM 

Use magic item.

SK_DISARM_TRAPS 

Disarm traps.

SK_SET_TRAP 

Set traps, unused.

SK_THAUMATURGY 

Thaumaturgy.

SK_PRAYING 

Praying.

SK_CLAWING 

Clawing.

SK_LEVITATION 

Levitation.

SK_SUMMONING 

Summoning.

SK_PYROMANCY 

Pyromancy.

SK_EVOCATION 

Evocation.

SK_SORCERY 

Sorcery.

SK_TWO_HANDED_WEAPON 

Two handed weapons.

SK_WRAITH_FEED 

Wraith feed.

SK_HARVESTING 

Harvesting.

SK_AIR_MAGIC 

Air magic, unused.

SK_EARTH_MAGIC 

Earth magic, unused.

SK_WATER_MAGIC 

Water magic, unused.

SK_FIRE_MAGIC 

Fire magic, unused.

Definition at line 19 of file skills.h.

Function Documentation

◆ get_skill_client_code()

int get_skill_client_code ( const char *  skill_name)

Return the code of the skill for a client, the index in the skill_names array.

Parameters
skill_nameskill name.
Returns
code, 0 if invalid and asserts.

Definition at line 116 of file skill_util.cpp.

References npc_dialog::index, MAX_SKILLS, and skill_names.

Referenced by esrv_update_stats(), hiscore_check(), and hiscore_init().

+ Here is the caller graph for this function:

Variable Documentation

◆ skill_faces

const Face* skill_faces[MAX_SKILLS]

Will contain the face numbers for the skills, initialized by init_skill().

Definition at line 63 of file skill_util.cpp.

Referenced by do_each_skill(), free_skill_index(), init_skills(), and send_skill_info().

◆ skill_messages

sstring skill_messages[MAX_SKILLS]

Will contain the message for the skills, initialized by init_skill().

Todo:
added through add_string, so should be cleared at some point.

Definition at line 69 of file skill_util.cpp.

Referenced by do_each_skill(), init_skills(), and send_skill_extra().

◆ skill_names

const char* skill_names[MAX_SKILLS]

Will contain a number-name mapping for skills, initialized by init_skills().

Definition at line 59 of file skill_util.cpp.

Referenced by append_spell(), do_each_skill(), find_skill_by_name(), free_skill_index(), get_skill_client_code(), hiscore_init(), init_skills(), send_skill_extra(), and send_skill_info().

SK_FIRE_MAGIC
@ SK_FIRE_MAGIC
Definition: skills.h:62
SK_CLAWING
@ SK_CLAWING
Definition: skills.h:50
SK_KARATE
@ SK_KARATE
Definition: skills.h:38
SK_SORCERY
@ SK_SORCERY
Definition: skills.h:55
SK_EARTH_MAGIC
@ SK_EARTH_MAGIC
Definition: skills.h:60
SK_TWO_HANDED_WEAPON
@ SK_TWO_HANDED_WEAPON
Definition: skills.h:56
SK_EVOCATION
@ SK_EVOCATION
Definition: skills.h:54
SK_SUMMONING
@ SK_SUMMONING
Definition: skills.h:52
SK_AIR_MAGIC
@ SK_AIR_MAGIC
Definition: skills.h:59
SK_FLAME_TOUCH
@ SK_FLAME_TOUCH
Definition: skills.h:37
SK_PUNCHING
@ SK_PUNCHING
Definition: skills.h:36
SK_WRAITH_FEED
@ SK_WRAITH_FEED
Definition: skills.h:57
SK_MISSILE_WEAPON
@ SK_MISSILE_WEAPON
Definition: skills.h:43
SK_ONE_HANDED_WEAPON
@ SK_ONE_HANDED_WEAPON
Definition: skills.h:42
SK_PYROMANCY
@ SK_PYROMANCY
Definition: skills.h:53
SK_THROWING
@ SK_THROWING
Definition: skills.h:44
SK_WATER_MAGIC
@ SK_WATER_MAGIC
Definition: skills.h:61