100 int num_found = 0, i;
107 for (spell = op->
inv; spell != NULL; spell = spell->
below) {
112 && (!params || !strncmp(params, spell->
name, strlen(params)))) {
114 snprintf(spell_sort[num_found++],
sizeof(spell_sort[0]),
115 "%s:%-22s %3s %3s", spell->
skill ? spell->
skill :
"generic",
116 spell->
name,
"den",
"den");
118 snprintf(spell_sort[num_found++],
sizeof(spell_sort[0]),
119 "%s:%-22s %3d %3d", spell->
skill ? spell->
skill :
"generic",
135 "You know no spells", NULL);
142 qsort(spell_sort, num_found,
MAX_BUF, (
int (*)(
const void *,
const void *))strcmp);
143 strcpy(tmp,
"asdfg");
144 for (i = 0; i < num_found; i++) {
146 if (strncmp(tmp, spell_sort[i], strlen(tmp))) {
147 strcpy(tmp, spell_sort[i]);
148 cp = strchr(tmp,
':');
152 "\n[fixed]%s spells %.*s <lvl> <sp>",
153 "\n%s spells %.*s <lvl> <sp>",
154 tmp, 12-strlen(tmp),
" ");
159 strchr(spell_sort[i],
':')+1);
186 if (params != NULL) {
187 tag_t spellnumber = 0;
188 if ((spellnumber = atoi(params)) != 0)
189 for (spob = op->
inv; spob && spob->
count != spellnumber; spob = spob->
below)
200 cp = strchr(params,
' ');
203 if (!strncmp(cp,
"of ", 3))
206 }
else if (strlen(params) > strlen(spob->
name)) {
207 cp = params+strlen(spob->
name);
210 if (!strncmp(cp,
"of ", 3))
217 "You need the skill %s to cast %s!",
218 "You need the skill %s to cast %s!",
246 "You ready the spell %s",
247 "You ready the spell %s",
258 "Cast what spell? Choose one of:", NULL);
340 "No ranged attack chosen.", NULL);
345 "You regain control of your golem.", NULL);
351 "Switched to %s and %s.",
352 "Switched to %s and %s.",
359 "Switched to spells (%s).",
360 "Switched to spells (%s).",
374 "Switched to skill: %s",
375 "Switched to skill: %s",
#define MSG_TYPE_SKILL_MISSING
object * lookup_spell_by_name(object *op, const char *spname)
#define MSG_TYPE_COMMAND_SUCCESS
void query_base_name(const object *op, int plural, char *buf, size_t size)
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
object * ranges[range_size]
int legal_range(object *op, int r)
void remove_friendly_object(object *op)
static void show_matching_spells(object *op, char *params)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
int command_prepare(object *op, char *params)
struct obj * chosen_skill
void remove_ob(object *op)
int command_cast(object *op, char *params)
int command_invoke(object *op, char *params)
int command_cast_spell(object *op, char *params, char command)
void change_spell(object *op, char k)
int snprintf(char *dest, int max, const char *format,...)
sint16 SP_level_spellpoint_cost(object *caster, object *spell, int flags)
void query_name(const object *op, char *buf, size_t size)
void free_object(object *ob)
int command_rotateshoottype(object *op, char *params)
#define MSG_TYPE_COMMAND_ERROR
object * find_skill_by_name(object *who, const char *name)
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)