 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
40 const object *book,
const object *observer,
41 const int use_media_tags,
char *
buf,
const size_t size);
69 }
else if (
spell->stats.grace) {
79 if (
spell->path_attuned) {
104 const object *book,
const object *observer,
105 const int use_media_tags,
char *
buf,
size_t size) {
125 snprintf(
buf+len, size-len,
" (blank)");
157 object *skapplier, *
spell, *spell_skill;
164 "You are unable to read while blind.");
170 LOG(
llevError,
"apply_spellbook: Book %s has no spell in it!\n", book->
name);
172 "The spellbook symbols make no sense.");
182 failure = -
rndm(35, 100);
218 "You already know the spell %s.\n",
spell->name);
227 "You lack the skill %s to use this spell",
232 int skill_lev_diff =
spell->level - spell_skill->
level;
233 if (skill_lev_diff > 0) {
234 if (skill_lev_diff < 2)
236 "The spell described in this book is just beyond your skill in %s.",
spell->skill);
237 else if (skill_lev_diff < 3)
239 "The spell described in this book is slightly beyond your skill in %s.",
spell->skill);
240 else if (skill_lev_diff < 5)
242 "The spell described in this book is beyond your skill in %s.",
spell->skill);
243 else if (skill_lev_diff < 8)
245 "The spell described in this book is quite a bit beyond your skill in %s.",
spell->skill);
246 else if (skill_lev_diff < 15)
248 "The spell described in this book is way beyond your skill in %s.",
spell->skill);
251 "The spell described in this book is totally beyond your skill in %s.",
spell->skill);
261 "You can't read! You will need this skill before you can comprehend the ideas written within.");
267 read_level = skapplier->
level;
275 lev_diff =
spell->level - (read_level+10);
279 "You recognise most of the words but this book is just beyond your comprehension.");
280 else if (lev_diff < 3)
282 "You recognise many of the words but this book is slightly beyond your comprehension.");
283 else if (lev_diff < 5)
285 "You recognise some of the words but this book is slightly beyond your comprehension.");
286 else if (lev_diff < 8)
288 "You recognise some of the words but this book is beyond your comprehension.");
289 else if (lev_diff < 15)
291 "You recognise a few of the words but this book is beyond your comprehension.");
294 "You recognise a few of the words but this book is totally beyond your comprehension.");
313 "The spellbook contains %s %s.",
spell->name, desc);
334 "In your confused state you flub the wording of the text!");
341 "You open the %s and start reading.", desc);
342 if (
spell->msg != NULL) {
351 "You succeed in learning the spell!");
360 "You fail to learn the spell.\n");
uint8_t message_type
Message type to be sent to the client.
struct Settings settings
Server settings.
#define FLAG_CONFUSED
Will also be unable to cast spells.
@ llevError
Error, serious thing.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
object * inv
Pointer to the first object in the inventory.
void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen)
Simple function we use below to keep adding to the same string but also make sure we don't overwrite ...
#define FLAG_STARTEQUIP
Object was given to player at start.
#define QUERY_FLAG(xyz, p)
void do_learn_spell(object *op, object *spell, int special_prayer)
Actually makes op learn spell.
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
void register_apply(int ob_type, apply_func method)
Registers the apply method for the given type.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound for specified player only.
#define FLAG_BLESSED
Item has a blessing, opposite of cursed/damned.
void scroll_failure(object *op, int failure, int power)
op made some mistake with a scroll, this takes care of punishment.
int rndm(int min, int max)
Returns a number between min and max.
#define MSG_TYPE_SPELL_INFO
random info about spell, not related to failure/success
static void spellbook_type_describe(const object *book, const object *observer, const int use_media_tags, char *buf, const size_t size)
Describe a spellbook.
#define NDI_BLUE
Actually, it is Dodger Blue.
int16_t level
Level of creature or object.
void common_ob_describe(const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
Describes an object, seen by a given observer.
Plugin animator file specs[Config] name
uint32_t update_look
If true, we need to send the look window.
void init_type_spellbook(void)
Initializer for the SPELLBOOK object type.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
struct player * contr
Pointer to the player which control this object.
#define object_decrease_nrof_by_one(xyz)
#define MSG_TYPE_APPLY_SUCCESS
Was able to apply object.
void query_name(const object *op, char *buf, size_t size)
Describes an item.
int64_t calc_skill_exp(const object *who, const object *op, const object *skill)
Calculates amount of experience can be gained for successful use of a skill.
StringBuffer * describe_spellpath_attenuation(const char *attenuation, int value, StringBuffer *buf)
Describe the specified path attenuation.
void query_short_name(const object *op, char *buf, size_t size)
query_short_name(object) is similar to query_name(), but doesn't contain any information about object...
#define FLAG_BLIND
If set, object cannot see (visually)
int is_identified(const object *op)
Return true if the item is identified, either because it is of a type that doesn't ever need identifi...
static void stringbuffer_append_spelldesc(StringBuffer *sb, const object *spell)
Append a terse description of the spell's name, level, discipline, and paths to a stringbuffer.
uint8_t type
PLAYER, BULLET, etc.
#define FLAG_DAMNED
The object is very cursed.
with a maximum of six This is not so if you are wearing plate you receive no benefit Armour is additive with all the supplementry forms of which means that it lasts until the next semi permanent spell effect is cast upon the character spell
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
void stringbuffer_append_string(StringBuffer *sb, const char *str)
Append a string to a string buffer instance.
uint8_t message_subtype
Message subtype to be sent to the client.
#define MSG_TYPE_SPELL
Spell related info.
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
object * find_skill_by_name(object *who, const char *name)
This returns the skill pointer of the given name (the one that accumulates exp, has the level,...
#define MAX_BUF
Used for all kinds of things.
A buffer that will be expanded as content is added to it.
uint8_t spell_failure_effects
Nasty backlash to spell failures.
char method_ret
Define some standard return values for callbacks which don't need to return any other results.
#define FLAG_WIZ
Object has special privilegies.
#define NDI_UNIQUE
Print immediately, don't buffer.
sstring name
The name of the object, obviously...
int get_learn_spell(int stat)
void stringbuffer_trim_whitespace(StringBuffer *sb)
Trim trailing whitespace from a stringbuffer.
object * env
Pointer to the object which is the environment.
object * check_spell_known(object *op, const char *name)
Checks to see if player knows the spell.
sstring skill
Name of the skill this object uses/grants.
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
static method_ret spellbook_type_apply(object *book, object *applier, int aflags)
Applies a spellbook.
int die_roll(int num, int size, const object *op, int goodbad)
Roll a number of dice (2d3, 4d6).
Struct to store the message_type and message_subtype for signs and books used by the player.
#define MSG_TYPE_APPLY_FAILURE
Apply OK, but no/bad result.
const readable_message_type * get_readable_message_type(object *readable)
Get the readable type for an object (hopefully book).
void do_forget_spell(object *op, const char *spell)
Erases spell from player's inventory.
socket_struct * socket
Socket information for this player.
living stats
Str, Con, Dex, etc.
#define MSG_TYPE_APPLY
Applying objects.
#define FLAG_CURSED
The object is cursed.
#define MSG_TYPE_APPLY_ERROR
void register_describe(int ob_type, describe_func method)
Registers the describe method for the given type.
#define FLAG_IDENTIFIED
Player knows full info about item.
object * identify(object *op)
Identifies an item.