Crossfire Server, Trunk  R20513
Functions
c_range.c File Reference

Range related commands (casting, shooting, throwing, etc.). More...

#include "global.h"
#include <stdlib.h>
#include <string.h>
#include "commands.h"
#include "shared/newclient.h"
#include "skills.h"
#include "spells.h"
#include "sproto.h"
Include dependency graph for c_range.c:

Go to the source code of this file.

Functions

static void change_spell (object *op, char k)
 Rotate the selected range attack. More...
 
void command_cast (object *op, const char *params)
 'cast' command, prepares a spell for laster casting. More...
 
void command_cast_spell (object *op, const char *params, char command)
 Sets up to cast a spell. More...
 
void command_invoke (object *op, const char *params)
 'invoke' command, fires a spell immediately. More...
 
void command_prepare (object *op, const char *params)
 Equivalent to command_cast(). More...
 
void command_rotateshoottype (object *op, const char *params)
 'rotateshoottype' command, switch range attack. More...
 
int legal_range (object *op, int r)
 Check for the validity of a player range. More...
 
static void show_matching_spells (object *op, const char *params)
 Shows all spells that op knows. More...
 

Detailed Description

Range related commands (casting, shooting, throwing, etc.).

Definition in file c_range.c.

Function Documentation

static void change_spell ( object op,
char  k 
)
static

Rotate the selected range attack.

Parameters
opplayer.
k'+' selects next range, other values previous range.

Definition at line 302 of file c_range.c.

References obj::chosen_skill, obj::contr, draw_ext_info(), draw_ext_info_format(), legal_range(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, obj::name, NDI_UNIQUE, query_base_name(), query_name(), obj::race, range_bottom, range_bow, range_golem, range_magic, range_misc, range_none, range_size, range_skill, pl::ranges, and pl::shoottype.

Referenced by command_rotateshoottype().

Here is the call graph for this function:

Here is the caller graph for this function:

void command_cast ( object op,
const char *  params 
)

'cast' command, prepares a spell for laster casting.

Parameters
opplayer.
paramsspell.

Definition at line 50 of file c_range.c.

References command_cast_spell().

Here is the call graph for this function:

void command_cast_spell ( object op,
const char *  params,
char  command 
)

Sets up to cast a spell.

Invoke casts a spell immediately, whereas cast just set up the range type.

Parameters
opcaster.
paramsspell name.
commandfirst letter of the spell type (c=cast, i=invoke, p=prepare).
Todo:
present the list nicely instead of comma-separated simply

Definition at line 159 of file c_range.c.

References cast_spell(), obj::contr, obj::count, draw_ext_info_format(), obj::facing, find_skill_by_name(), pl::golem_count, lookup_spell_by_name(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, MSG_TYPE_SKILL, MSG_TYPE_SKILL_MISSING, obj::name, NDI_UNIQUE, object_find_by_tag(), object_free_drop_inventory(), object_get_value(), object_remove(), range_golem, range_magic, pl::ranges, remove_friendly_object(), safe_strncpy, pl::shoottype, show_matching_spells(), obj::skill, SPELL, obj::spell, pl::spellparam, and obj::type.

Referenced by command_cast(), command_invoke(), and command_prepare().

Here is the call graph for this function:

Here is the caller graph for this function:

void command_invoke ( object op,
const char *  params 
)

'invoke' command, fires a spell immediately.

Parameters
opplayer.
paramsspell.

Definition at line 38 of file c_range.c.

References command_cast_spell().

Here is the call graph for this function:

void command_prepare ( object op,
const char *  params 
)

Equivalent to command_cast().

Parameters
opplayer.
paramsspell.
Todo:
remove.

Definition at line 63 of file c_range.c.

References command_cast_spell().

Here is the call graph for this function:

void command_rotateshoottype ( object op,
const char *  params 
)

'rotateshoottype' command, switch range attack.

Parameters
opplayer.
paramsarguments to the command.

Definition at line 368 of file c_range.c.

References change_spell().

Here is the call graph for this function:

int legal_range ( object op,
int  r 
)

Check for the validity of a player range.

This function could probably be simplified, eg, everything should index into the ranges[] array.

Parameters
opplayer to check.
rrange to check.
Return values
1range specified is legal - that is, the character has an item that is equipped for that range type.
0no item of that range type that is usable.

Definition at line 264 of file c_range.c.

References obj::chosen_skill, obj::contr, obj::count, pl::golem_count, range_bow, range_golem, range_magic, range_misc, range_none, range_skill, and pl::ranges.

Referenced by change_spell(), and check_login().

Here is the caller graph for this function:

static void show_matching_spells ( object op,
const char *  params 
)
static

Shows all spells that op knows.

Given there is more than one skill, we can't supply break them down to cleric/wizardry.

Parameters
opplayer wanting to knows her spells.
paramsif supplied, the spell name must match that.

Definition at line 78 of file c_range.c.

References draw_ext_info(), draw_ext_info_format(), FOR_INV_FINISH, FOR_INV_PREPARE, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, NROFREALSPELLS, obj::path_denied, snprintf, SP_level_spellpoint_cost(), SPELL, and SPELL_HIGHEST.

Referenced by command_cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function: