Crossfire Server, Trunk  R20513
Macros | Enumerations | Functions | Variables
c_wiz.c File Reference

Those functions are used by DMs. More...

#include "global.h"
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "sproto.h"
#include "spells.h"
#include "treasure.h"
#include "skills.h"
Include dependency graph for c_wiz.c:

Go to the source code of this file.

Macros

#define STACK_SIZE   50
 Stack size, static. More...
 

Enumerations

enum  { STACK_FROM_NONE = 0, STACK_FROM_TOP = 1, STACK_FROM_STACK = 2, STACK_FROM_NUMBER = 3 }
 Values for 'from' field of get_dm_object() More...
 

Functions

static int checkdm (object *op, const char *pl_name, const char *pl_passwd, const char *pl_host)
 object *op is trying to become dm. More...
 
void command_abil (object *op, const char *params)
 Changes an object's statistics. More...
 
void command_addexp (object *op, const char *params)
 This adds exp to a player. More...
 
void command_arrest (object *op, const char *params)
 Wizard jails player. More...
 
void command_banish (object *op, const char *params)
 Add player's IP to ban_file and kick them off the server. More...
 
void command_create (object *op, const char *params)
 Wizard wants to create an object. More...
 
void command_diff (object *op, const char *params)
 Get a diff of specified items. More...
 
void command_dm (object *op, const char *params)
 Actual command to perhaps become dm. More...
 
void command_dmhide (object *op, const char *params)
 A players wants to become DM and hide. More...
 
void command_dump (object *op, const char *params)
 Dumps the difference between an object and its archetype. More...
 
void command_dumpbelow (object *op, const char *params)
 Player wants to dump object below her. More...
 
void command_follow (object *op, const char *params)
 DM wants to follow a player, or stop following a player. More...
 
void command_forget_spell (object *op, const char *params)
 Command for players to forget a spell. More...
 
void command_free (object *op, const char *params)
 Totally free an object. More...
 
void command_freeze (object *op, const char *params)
 Freezes a player for a specified tick count, 100 by default. More...
 
void command_goto (object *op, const char *params)
 Wizard teleports to a map. More...
 
void command_hide (object *op, const char *params)
 Wizard 'hide' command. More...
 
void command_insert_into (object *op, const char *params)
 Puts an object into another. More...
 
void command_inventory (object *op, const char *params)
 Shows the inventory or some item. More...
 
void command_invisible (object *op, const char *params)
 Wizard wants to become invisible. More...
 
void command_kick (object *op, const char *params)
 Kicks a player from the server. More...
 
static void command_kick2 (object *op, const char *params)
 Kicks a player from the server. More...
 
void command_learn_special_prayer (object *op, const char *params)
 Wizard wants to learn a god-given spell. More...
 
void command_learn_spell (object *op, const char *params)
 Wizard wants to learn a regular spell. More...
 
static void command_learn_spell_or_prayer (object *op, const char *params, int special_prayer)
 Wizards wants to learn a spell. More...
 
void command_listplugins (object *op, const char *params)
 Lists all plugins currently loaded with their IDs and full names. More...
 
void command_loadplugin (object *op, const char *params)
 Loads the given plugin. More...
 
void command_loadtest (object *op, const char *params)
 This command will stress server. More...
 
void command_mon_aggr (object *op, const char *params)
 When DM is possessing a monster, flip aggression on and off, to allow better motion. More...
 
void command_nowiz (object *op, const char *params)
 Steps down from wizard mode. More...
 
void command_overlay_reset (object *op, const char *params)
 Removes the overlay for op's current map. More...
 
void command_overlay_save (object *op, const char *params)
 Saves the op's map as an overlay - objects are persisted. More...
 
void command_patch (object *op, const char *params)
 Wizard wants to altar an object. More...
 
void command_possess (object *op, const char *params)
 DM can possess a monster. More...
 
void command_purge_quest (object *op, const char *param)
 
void command_purge_quest_definitions (object *op, const char *param)
 
void command_remove (object *op, const char *params)
 Remove an object from its position. More...
 
void command_reset (object *op, const char *params)
 Resets a map. More...
 
void command_setgod (object *op, const char *params)
 Sets the god for some objects. More...
 
void command_settings (object *op, const char *ignored)
 Wizard wants to know some server settings, so display. More...
 
void command_shutdown (object *op, const char *params)
 Totally shutdowns the server. More...
 
void command_skills (object *op, const char *params)
 Player is asking for her skills. More...
 
void command_speed (object *op, const char *params)
 Changes the server speed. More...
 
void command_stack_clear (object *op, const char *params)
 Empty DM item stack. More...
 
void command_stack_list (object *op, const char *params)
 Displays stack contents. More...
 
void command_stack_pop (object *op, const char *params)
 Pop the stack top. More...
 
void command_stack_push (object *op, const char *params)
 Push specified item on stack. More...
 
void command_stats (object *op, const char *params)
 Displays the statistics of a player. More...
 
void command_style_map_info (object *op, const char *params)
 Displays information about styles loaded for random maps. More...
 
void command_summon (object *op, const char *params)
 Summons player near DM. More...
 
void command_teleport (object *op, const char *params)
 Teleport next to target player. More...
 
void command_toggle_shout (object *op, const char *params)
 A simple toggle for the no_shout field. More...
 
void command_unloadplugin (object *op, const char *params)
 Unloads the given plugin. More...
 
static objectdm_stack_peek (player *pl)
 Get current stack top item for player. More...
 
static void dm_stack_pop (player *pl)
 Remove an item from the wizard's item stack. More...
 
static void dm_stack_push (player *pl, tag_t item)
 Push specified item on player stack. More...
 
static int do_wizard_dm (object *op, const char *params, int silent)
 Actually changes a player to wizard. More...
 
static void do_wizard_hide (object *op, int silent_dm)
 Actually hides or unhides specified player (obviously a DM). More...
 
static objectfind_object_both (const char *params)
 This finds and returns the object which matches the name or object number (specified via num #whatever). More...
 
static objectget_dm_object (player *pl, const char **params, int *from)
 Checks 'params' for object code. More...
 
static playerget_other_player_from_name (object *op, const char *name)
 Enough of the DM functions seem to need this that I broke it out to a seperate function. More...
 
static objectget_spell_by_name (object *op, const char *spell_name)
 Returns spell object (from archetypes) by name. More...
 
int player_arrest (object *who)
 Put a player into jail, taking into account cursed exits and player's region. More...
 

Variables

int cmd_shutdown_time = 0
 Time, in seconds from epoch, of server shutdown. More...
 

Detailed Description

Those functions are used by DMs.

Todo:
explain item stack, item specifier for commands.

Definition in file c_wiz.c.

Macro Definition Documentation

#define STACK_SIZE   50

Stack size, static.

Definition at line 33 of file c_wiz.c.

Referenced by dm_stack_push().

Enumeration Type Documentation

anonymous enum

Values for 'from' field of get_dm_object()

Enumerator
STACK_FROM_NONE 

Item was not found.

STACK_FROM_TOP 

Item is stack top.

STACK_FROM_STACK 

Item is somewhere in stack.

STACK_FROM_NUMBER 

Item is a number (may be top)

Definition at line 35 of file c_wiz.c.

Function Documentation

static int checkdm ( object op,
const char *  pl_name,
const char *  pl_passwd,
const char *  pl_host 
)
static

object *op is trying to become dm.

pl_name is name supplied by player. Restrictive DM will make it harder for socket users to become DM - in that case, it will check for the players character name.

Parameters
opplayer wishing to become DM.
pl_nameplayer's name.
pl_passwdentered password.
pl_hostplayer's host.
Return values
0invalid credentials.
1op can become DM.
Todo:
can't name/host be found from op? What is RESTRICTIVE_DM?

Definition at line 2040 of file c_wiz.c.

References Settings::confdir, DMFILE, llevDebug, llevError, LOG(), MAX_BUF, obj::name, settings, and snprintf.

Referenced by do_wizard_dm().

Here is the call graph for this function:

Here is the caller graph for this function:

void command_abil ( object op,
const char *  params 
)

Changes an object's statistics.

Parameters
opwizard.
paramsparameters, should be "player statistic new_value".
Todo:
use get_other_player_from_name(). Isn't this useless with the command_patch()?

Definition at line 1756 of file c_wiz.c.

References liv::Cha, liv::Con, liv::Dex, draw_ext_info(), draw_ext_info_format(), FALSE, first_player, fix_object(), FLAG_WAS_WIZ, liv::Int, Settings::max_stat, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, pl::next, pl::ob, pl::orig_stats, liv::Pow, Settings::real_wiz, SET_FLAG, settings, obj::stats, liv::Str, and liv::Wis.

Here is the call graph for this function:

void command_addexp ( object op,
const char *  params 
)

This adds exp to a player.

We now allow adding to a specific skill.

Parameters
opwizard.
paramsshould be "player quantity [skill]".

Definition at line 1613 of file c_wiz.c.

References calc_perm_exp(), check_exp_adjust(), draw_ext_info(), draw_ext_info_format(), liv::exp, FALSE, find_skill_by_name(), first_player, FLAG_WAS_WIZ, MAX_BUF, MAX_NAME, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, pl::next, pl::ob, player_lvl_adj(), Settings::real_wiz, SET_FLAG, settings, and obj::stats.

Here is the call graph for this function:

void command_arrest ( object op,
const char *  params 
)

Wizard jails player.

Parameters
opwizard.
paramsplayer to jail.

Definition at line 838 of file c_wiz.c.

References draw_ext_info(), draw_ext_info_format(), get_other_player_from_name(), llevInfo, LOG(), MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_DM, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, pl::ob, and player_arrest().

Here is the call graph for this function:

void command_banish ( object op,
const char *  params 
)

Add player's IP to ban_file and kick them off the server.

I know most people have dynamic IPs but this is more of a short term solution if they have to get a new IP to play maybe they'll calm down. This uses the banish_file in the local directory *not *the ban_file The action is logged with a ! for easy searching. -tm

Parameters
opDM banishing.
paramsplayer to banish. Must be a complete name match.
Returns
1.

Definition at line 519 of file c_wiz.c.

References BANISHFILE, command_kick2(), draw_ext_info(), draw_ext_info_format(), get_other_player_from_name(), socket_struct::host, llevDebug, Settings::localdir, LOG(), MAX_BUF, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_DM, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_ALL, NDI_RED, NDI_UNIQUE, pl::ob, settings, snprintf, and pl::socket.

Here is the call graph for this function:

void command_create ( object op,
const char *  params 
)

Wizard wants to create an object.

This function is a real mess, because we're stucking getting the entire item description in one block of text, so we just can't simply parse it - we need to look for double quotes for example. This could actually get much simpler with just a little help from the client - if we could get line breaks, it makes parsing much easier, eg, something like:

  • arch dragon
  • name big nasty creature
  • hp 5
  • sp 30

which is much easier to parse than dragon name "big nasty creature" hp 5 sp 30 for example.

Parameters
opwizard.
paramsobject description.
Todo:
enable line breaks in command.

Definition at line 996 of file c_wiz.c.

References obj::arch, arch_to_object(), CLEAR_FLAG, archt::clone, obj::contr, pl::count, obj::count, create_treasure(), mapdef::difficulty, dm_stack_pop(), dm_stack_push(), draw_ext_info(), draw_ext_info_format(), FALSE, find_archetype_by_object_name(), find_artifactlist(), FLAG_ALIVE, FLAG_IDENTIFIED, FLAG_KNOWN_MAGICAL, FLAG_MONSTER, FLAG_WAS_WIZ, FREE_OBJ_NO_DESTROY_CALLBACK, give_artifact_abilities(), artifactstruct::item, artifactliststruct::items, legal_artifact_combination(), llevDebug, LOG(), obj::map, MAX, MAX_BUF, monster_check_apply_all(), obj::more, archt::more, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, need_identify(), artifactstruct::next, obj::nrof, object_copy(), object_create_arch(), object_free2(), object_give_identified_properties(), object_insert_in_map_at(), object_insert_in_ob(), obj::other_arch, out_of_map(), POTION, QUERY_FLAG, obj::randomitems, Settings::real_wiz, ROD, safe_strncpy, SCROLL, set_abs_magic(), SET_FLAG, set_magic(), set_variable(), settings, SPELL, SPELLBOOK, try_find_archetype(), obj::type, WAND, obj::x, and obj::y.

Here is the call graph for this function:

void command_diff ( object op,
const char *  params 
)

Get a diff of specified items.

Second item is compared to first, and differences displayed.

Note
get_ob_diff() works the opposite way (first compared to 2nd), but it's easier with stack functions to do it this way, so you can do:
  • stack_push <base>
  • stack_push <object to be compared>
  • diff
  • patch xxx <-— applies to object compared to base, easier :)

Ryo, august 2004

Parameters
opwizard.
paramsobject specifier.

Definition at line 2540 of file c_wiz.c.

References obj::contr, dm_stack_pop(), draw_ext_info(), get_dm_object(), get_ob_diff(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, object_find_by_tag_global(), STACK_FROM_NUMBER, STACK_FROM_TOP, pl::stack_items, pl::stack_position, stringbuffer_finish(), and stringbuffer_new().

Here is the call graph for this function:

void command_dm ( object op,
const char *  params 
)

Actual command to perhaps become dm.

Changed around a bit in version 0.92.2 to allow people on sockets to become dm, and allow better dm file

Parameters
opplayer wishing to become wizard.
paramspassword.
Returns
0 unless op isn't a player.

Definition at line 2136 of file c_wiz.c.

References do_wizard_dm().

Here is the call graph for this function:

void command_dmhide ( object op,
const char *  params 
)

A players wants to become DM and hide.

Let's see if that's authorized. Make sure to not tell anything to anyone.

Parameters
opwizard.
paramspassword.

Definition at line 2440 of file c_wiz.c.

References do_wizard_dm(), and do_wizard_hide().

Here is the call graph for this function:

void command_dump ( object op,
const char *  params 
)

Dumps the difference between an object and its archetype.

Parameters
opwiard.
paramsobject to dump.

Definition at line 1377 of file c_wiz.c.

References obj::contr, draw_ext_info(), FLAG_OBJ_ORIGINAL, get_dm_object(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, NDI_UNIQUE, object_dump(), QUERY_FLAG, stringbuffer_finish(), and stringbuffer_new().

Here is the call graph for this function:

void command_dumpbelow ( object op,
const char *  params 
)

Player wants to dump object below her.

Parameters
opplayer asking for information.
paramsunused.

Definition at line 2767 of file c_wiz.c.

References obj::below, obj::contr, obj::count, dm_stack_push(), draw_ext_info(), MSG_SUBTYPE_NONE, MSG_TYPE_COMMAND, NDI_UNIQUE, object_dump(), stringbuffer_finish(), and stringbuffer_new().

Here is the call graph for this function:

void command_follow ( object op,
const char *  params 
)

DM wants to follow a player, or stop following a player.

Parameters
opwizard.
paramsplayer to follow. If NULL, stop following player.

Definition at line 2721 of file c_wiz.c.

References add_string(), obj::contr, draw_ext_info(), draw_ext_info_format(), find_player_partial_name(), pl::followed_player, FREE_AND_CLEAR_STR, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_DM, obj::name, NDI_UNIQUE, and pl::ob.

Here is the call graph for this function:

void command_forget_spell ( object op,
const char *  params 
)

Command for players to forget a spell.

This command used to be available only to DMs.

Parameters
opplayer
paramsspell name to forget.

Definition at line 2336 of file c_wiz.c.

References obj::contr, do_forget_spell(), draw_ext_info(), draw_ext_info_format(), lookup_spell_by_name(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, obj::name, and NDI_UNIQUE.

Here is the call graph for this function:

void command_free ( object op,
const char *  params 
)

Totally free an object.

Parameters
opwizard.
paramsobject to free.

Definition at line 1579 of file c_wiz.c.

References obj::contr, dm_stack_pop(), draw_ext_info(), FLAG_REMOVED, get_dm_object(), HEAD, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, object_free_drop_inventory(), object_remove(), QUERY_FLAG, and STACK_FROM_STACK.

Here is the call graph for this function:

void command_freeze ( object op,
const char *  params 
)

Freezes a player for a specified tick count, 100 by default.

Parameters
opwizard freezing the player.
paramsoptional tick count, followed by player name.

Definition at line 762 of file c_wiz.c.

References draw_ext_info(), draw_ext_info_format(), get_other_player_from_name(), MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_DM, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_RED, NDI_UNIQUE, pl::ob, obj::speed, and obj::speed_left.

Here is the call graph for this function:

void command_goto ( object op,
const char *  params 
)

Wizard teleports to a map.

Parameters
opwizard teleporting.
paramsmap to teleport to. Can be absolute or relative path.

Definition at line 726 of file c_wiz.c.

References add_string(), mapdef::difficulty, draw_ext_info(), draw_ext_info_format(), enter_exit(), EXIT_PATH, EXIT_X, EXIT_Y, FREE_OBJ_NO_DESTROY_CALLBACK, obj::map, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, object_free2(), and object_new().

Referenced by command_loadtest().

Here is the call graph for this function:

Here is the caller graph for this function:

void command_hide ( object op,
const char *  params 
)

Wizard 'hide' command.

Parameters
opDM wanting to hide.
paramsignored.

Definition at line 385 of file c_wiz.c.

References do_wizard_hide().

Here is the call graph for this function:

void command_insert_into ( object op,
const char *  params 
)
void command_inventory ( object op,
const char *  params 
)

Shows the inventory or some item.

Parameters
opplayer.
paramsobject count to get the inventory of. If NULL then defaults to op.

Definition at line 1335 of file c_wiz.c.

References draw_ext_info(), inventory(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, and object_find_by_tag_global().

Here is the call graph for this function:

void command_invisible ( object op,
const char *  params 
)

Wizard wants to become invisible.

Parameters
opwizard.
paramsignored.

Definition at line 2148 of file c_wiz.c.

References draw_ext_info(), obj::invisible, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, NDI_UNIQUE, object_update(), and UP_OBJ_FACE.

Here is the call graph for this function:

void command_kick ( object op,
const char *  params 
)

Kicks a player from the server.

Parameters
opDM kicking.
paramsplayer to kick. Must be a full name match.

Definition at line 573 of file c_wiz.c.

References command_kick2().

Here is the call graph for this function:

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

Kicks a player from the server.

Parameters
opDM kicking.
paramsplayer to kick. Must be a full name match.

Definition at line 463 of file c_wiz.c.

References obj::contr, obj::direction, draw_ext_info_format(), EVENT_KICK, execute_global_event(), first_player, FLAG_FREED, FLAG_REMOVED, hiscore_check(), pl::killer, obj::map, MAP_TIMEOUT, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_DM, obj::name, NDI_ALL, NDI_RED, NDI_UNIQUE, pl::next, Ns_Dead, pl::ob, object_remove(), mapdef::players, QUERY_FLAG, save_player(), pl::socket, socket_struct::status, and mapdef::timeout.

Referenced by command_banish(), and command_kick().

Here is the call graph for this function:

Here is the caller graph for this function:

void command_learn_special_prayer ( object op,
const char *  params 
)

Wizard wants to learn a god-given spell.

Parameters
opwizard.
paramsspell name.

Definition at line 2323 of file c_wiz.c.

References command_learn_spell_or_prayer().

Here is the call graph for this function:

void command_learn_spell ( object op,
const char *  params 
)

Wizard wants to learn a regular spell.

Parameters
opwizard.
paramsspell name.

Definition at line 2311 of file c_wiz.c.

References command_learn_spell_or_prayer().

Here is the call graph for this function:

static void command_learn_spell_or_prayer ( object op,
const char *  params,
int  special_prayer 
)
static

Wizards wants to learn a spell.

Parameters
opwizard.
paramsspell name to learn.
special_prayerif set, special (god-given) prayer.

Definition at line 2278 of file c_wiz.c.

References check_spell_known(), obj::contr, do_learn_spell(), draw_ext_info(), draw_ext_info_format(), FREE_OBJ_NO_DESTROY_CALLBACK, get_spell_by_name(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, and object_free2().

Referenced by command_learn_special_prayer(), and command_learn_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

void command_listplugins ( object op,
const char *  params 
)

Lists all plugins currently loaded with their IDs and full names.

Parameters
opwizard.
paramsignored.

Definition at line 2364 of file c_wiz.c.

References plugins_display_list().

Here is the call graph for this function:

void command_loadplugin ( object op,
const char *  params 
)

Loads the given plugin.

The DM specifies the name of the library to load (no pathname is needed). Do not ever attempt to load the same plugin more than once at a time, or bad things could happen.

Parameters
opDM loading a plugin.
paramsshould be the plugin's name, eg cfpython.so

Definition at line 2378 of file c_wiz.c.

References draw_ext_info(), draw_ext_info_format(), LIBDIR, llevDebug, llevInfo, LOG(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, and plugins_init_plugin().

Here is the call graph for this function:

void command_loadtest ( object op,
const char *  params 
)

This command will stress server.

It will basically load all world maps (so 900 maps).

Parameters
opDM wanting to test the server.
paramsoption, must be "TRUE" for the test to happen.

Definition at line 305 of file c_wiz.c.

References command_goto(), draw_ext_info(), draw_ext_info_format(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DEBUG, NDI_UNIQUE, settings, snprintf, Settings::worldmapstartx, Settings::worldmapstarty, Settings::worldmaptilesx, and Settings::worldmaptilesy.

Here is the call graph for this function:

void command_mon_aggr ( object op,
const char *  params 
)

When DM is possessing a monster, flip aggression on and off, to allow better motion.

Parameters
opwiard.
paramsignored.

Definition at line 1405 of file c_wiz.c.

References CLEAR_FLAG, draw_ext_info(), obj::enemy, FLAG_FRIENDLY, FLAG_UNAGGRESSIVE, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, NDI_UNIQUE, object_set_enemy(), QUERY_FLAG, and SET_FLAG.

Here is the call graph for this function:

void command_nowiz ( object op,
const char *  params 
)
void command_overlay_reset ( object op,
const char *  params 
)

Removes the overlay for op's current map.

Parameters
opDM acting.
paramsignored.

Definition at line 605 of file c_wiz.c.

References create_overlay_pathname(), draw_ext_info(), obj::map, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, NDI_UNIQUE, mapdef::path, and unlink.

Here is the call graph for this function:

void command_overlay_save ( object op,
const char *  params 
)

Saves the op's map as an overlay - objects are persisted.

Parameters
opDM wanting to save.
paramsignored.

Definition at line 585 of file c_wiz.c.

References draw_ext_info(), obj::map, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, save_map(), and SAVE_MODE_OVERLAY.

Here is the call graph for this function:

void command_patch ( object op,
const char *  params 
)

Wizard wants to altar an object.

Parameters
opwizard.
paramsobject and what to patch.

Definition at line 1492 of file c_wiz.c.

References obj::contr, obj::count, draw_ext_info(), draw_ext_info_format(), FALSE, FLAG_WAS_WIZ, get_dm_object(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, Settings::real_wiz, SET_FLAG, set_variable(), and settings.

Here is the call graph for this function:

void command_possess ( object op,
const char *  params 
)

DM can possess a monster.

Basically, this tricks the client into thinking a given monster, is actually the player it controls. This allows a DM to inhabit a monster's body, and run around the game with it. This function is severely broken - it has tons of hardcoded values,

Parameters
opwizard wanting to possess something.
paramsmonster to possess.
Todo:
fix and reactivate the function, or totally trash.

Definition at line 1431 of file c_wiz.c.

References obj::body_info, obj::contr, do_some_living(), draw_ext_info(), esrv_new_player(), esrv_send_inventory(), fix_object(), FLAG_WIZ, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, NUM_BODY_LOCATIONS, pl::ob, object_find_by_name_global(), object_find_by_tag_global(), PLAYER, SET_FLAG, and obj::type.

Here is the call graph for this function:

void command_purge_quest ( object op,
const char *  param 
)

Definition at line 2749 of file c_wiz.c.

References draw_ext_info(), free_quest(), MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_DM, and NDI_UNIQUE.

Here is the call graph for this function:

void command_purge_quest_definitions ( object op,
const char *  param 
)

Definition at line 2754 of file c_wiz.c.

References draw_ext_info(), free_quest_definitions(), MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_DM, and NDI_UNIQUE.

Here is the call graph for this function:

void command_remove ( object op,
const char *  params 
)

Remove an object from its position.

Parameters
opwizard.
paramsobject to remove.

Definition at line 1532 of file c_wiz.c.

References obj::contr, dm_stack_pop(), draw_ext_info(), draw_ext_info_format(), FLAG_REMOVED, get_dm_object(), HEAD, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, object_remove(), object_update_speed(), PLAYER, QUERY_FLAG, query_name(), obj::speed, STACK_FROM_STACK, and obj::type.

Here is the call graph for this function:

void command_reset ( object op,
const char *  params 
)
void command_setgod ( object op,
const char *  params 
)

Sets the god for some objects.

Parameters
opDM wanting to change an object.
paramscommand options. Should contain two values, first the object to change, followed by the god to change it to.

Definition at line 413 of file c_wiz.c.

References become_follower(), draw_ext_info(), draw_ext_info_format(), find_god(), find_object_both(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, PLAYER, and obj::type.

Here is the call graph for this function:

void command_settings ( object op,
const char *  ignored 
)
void command_shutdown ( object op,
const char *  params 
)

Totally shutdowns the server.

Parameters
opwizard shutting down the server.
paramsWhen to shut down the server.

Definition at line 674 of file c_wiz.c.

References cmd_shutdown_time, command_help(), draw_ext_info(), draw_ext_info_format(), llevInfo, LOG(), MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_DM, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, obj::name, NDI_ALL, and NDI_UNIQUE.

Here is the call graph for this function:

void command_skills ( object op,
const char *  params 
)

Player is asking for her skills.

Just show player's their skills for now. Dm's can already see skills w/ inventory command - b.t.

Parameters
opplayer.
paramsoptional skill restriction.
Todo:
move out of this file as it is used by all players.

Definition at line 1365 of file c_wiz.c.

References show_skills().

Here is the call graph for this function:

void command_speed ( object op,
const char *  params 
)

Changes the server speed.

Parameters
opwizard.
paramsnew speed, or NULL to see the speed.

Definition at line 1669 of file c_wiz.c.

References draw_ext_info_format(), max_time, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, NDI_UNIQUE, reset_sleep(), and set_max_time().

Here is the call graph for this function:

void command_stack_clear ( object op,
const char *  params 
)

Empty DM item stack.

Parameters
opwizard.
paramsignored.

Definition at line 2515 of file c_wiz.c.

References obj::contr, draw_ext_info(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, NDI_UNIQUE, and pl::stack_position.

Here is the call graph for this function:

void command_stack_list ( object op,
const char *  params 
)

Displays stack contents.

Parameters
opwizard.
paramsignored.

Definition at line 2485 of file c_wiz.c.

References obj::contr, obj::count, draw_ext_info(), draw_ext_info_format(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, obj::name, NDI_UNIQUE, object_find_by_tag_global(), pl::stack_items, and pl::stack_position.

Here is the call graph for this function:

void command_stack_pop ( object op,
const char *  params 
)

Pop the stack top.

Parameters
opwizard.
paramsignored.

Definition at line 2455 of file c_wiz.c.

References obj::contr, and dm_stack_pop().

Here is the call graph for this function:

void command_stack_push ( object op,
const char *  params 
)

Push specified item on stack.

Parameters
opwizard.
paramsobject specifier.

Definition at line 2467 of file c_wiz.c.

References obj::contr, obj::count, dm_stack_push(), get_dm_object(), and STACK_FROM_NUMBER.

Here is the call graph for this function:

void command_stats ( object op,
const char *  params 
)

Displays the statistics of a player.

Parameters
opwizard.
paramsplayer's name.

Definition at line 1699 of file c_wiz.c.

References liv::ac, liv::Cha, liv::Con, liv::dam, liv::Dex, draw_ext_info(), draw_ext_info_format(), liv::exp, find_player_partial_name(), FMT64, liv::food, liv::grace, liv::hp, liv::Int, liv::maxhp, liv::maxsp, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, pl::ob, liv::Pow, liv::sp, obj::stats, liv::Str, liv::wc, and liv::Wis.

Here is the call graph for this function:

void command_style_map_info ( object op,
const char *  params 
)

Displays information about styles loaded for random maps.

Parameters
opwizard.
paramsignored.

Definition at line 2681 of file c_wiz.c.

References draw_ext_info(), draw_ext_info_format(), FOR_MAP_FINISH, FOR_MAP_PREPARE, MAP_HEIGHT, map_size(), MAP_WIDTH, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_MAPS, NDI_UNIQUE, mapdef::next, and styles.

Here is the call graph for this function:

void command_summon ( object op,
const char *  params 
)
void command_teleport ( object op,
const char *  params 
)
void command_toggle_shout ( object op,
const char *  params 
)

A simple toggle for the no_shout field.

AKA the MUZZLE command.

Parameters
opwizard toggling.
paramsplayer to mute/unmute.

Definition at line 630 of file c_wiz.c.

References obj::contr, draw_ext_info(), draw_ext_info_format(), EVENT_MUZZLE, execute_global_event(), get_other_player_from_name(), MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_DM, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_ORANGE, NDI_RED, NDI_UNIQUE, pl::no_shout, and pl::ob.

Here is the call graph for this function:

void command_unloadplugin ( object op,
const char *  params 
)

Unloads the given plugin.

The DM specified the ID of the library to unload. Note that some things may behave strangely if the correct plugins are not loaded.

Parameters
opDM unloading a plugin.
paramsshould be the plugin's internal name, eg Python

Definition at line 2412 of file c_wiz.c.

References draw_ext_info(), draw_ext_info_format(), llevInfo, LOG(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, and plugins_remove_plugin().

Here is the call graph for this function:

static object* dm_stack_peek ( player pl)
static

Get current stack top item for player.

Returns NULL if no stacked item. If stacked item disappeared (freed), remove it.

Ryo, august 2004

Parameters
plwizard.
Returns
item on top of stack, or NULL if deleted/stack empty.

Definition at line 119 of file c_wiz.c.

References dm_stack_pop(), draw_ext_info(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, pl::ob, object_find_by_tag_global(), pl::stack_items, and pl::stack_position.

Referenced by get_dm_object().

Here is the call graph for this function:

Here is the caller graph for this function:

static void dm_stack_pop ( player pl)
static

Remove an item from the wizard's item stack.

Parameters
plwizard.

Definition at line 94 of file c_wiz.c.

References draw_ext_info(), draw_ext_info_format(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, pl::ob, pl::stack_items, and pl::stack_position.

Referenced by command_create(), command_diff(), command_free(), command_insert_into(), command_remove(), command_stack_pop(), and dm_stack_peek().

Here is the call graph for this function:

Here is the caller graph for this function:

static void dm_stack_push ( player pl,
tag_t  item 
)
static

Push specified item on player stack.

Inform player of position. Initializes variables if needed.

Parameters
plwizard.
itemitem to put on stack.

Definition at line 149 of file c_wiz.c.

References draw_ext_info(), draw_ext_info_format(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, pl::ob, pl::stack_items, pl::stack_position, and STACK_SIZE.

Referenced by command_create(), command_dumpbelow(), command_stack_push(), and get_dm_object().

Here is the call graph for this function:

Here is the caller graph for this function:

static int do_wizard_dm ( object op,
const char *  params,
int  silent 
)
static

Actually changes a player to wizard.

Parameters
opplayer.
paramspassword.
silentif zero, don't inform players of the mode change.
Return values
0no mode change.
1op is now a wizard.

Definition at line 2085 of file c_wiz.c.

References checkdm(), clear_los(), obj::contr, draw_ext_info(), FLAG_WAS_WIZ, FLAG_WIZ, FLAG_WIZCAST, FLAG_WIZPASS, socket_struct::host, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_DM, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_ALL, NDI_LT_GREEN, NDI_UNIQUE, QUERY_FLAG, SET_FLAG, pl::socket, and pl::write_buf.

Referenced by command_dm(), and command_dmhide().

Here is the call graph for this function:

Here is the caller graph for this function:

static void do_wizard_hide ( object op,
int  silent_dm 
)
static

Actually hides or unhides specified player (obviously a DM).

Parameters
opDM hiding.
silent_dmif non zero, other players are informed of DM entering/leaving, else they just think someone left/entered.

Definition at line 340 of file c_wiz.c.

References obj::contr, draw_ext_info(), draw_ext_info_format(), pl::hidden, obj::invisible, obj::map, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_DM, MSG_TYPE_ADMIN_PLAYER, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, obj::name, NDI_ALL, NDI_DK_ORANGE, NDI_LT_GREEN, NDI_UNIQUE, and mapdef::players.

Referenced by command_dmhide(), and command_hide().

Here is the call graph for this function:

Here is the caller graph for this function:

static object* find_object_both ( const char *  params)
static

This finds and returns the object which matches the name or object number (specified via num #whatever).

Parameters
paramsobject to find.
Returns
suitable object, or NULL if none found.

Definition at line 398 of file c_wiz.c.

References object_find_by_name_global(), and object_find_by_tag_global().

Referenced by command_setgod().

Here is the call graph for this function:

Here is the caller graph for this function:

static object* get_dm_object ( player pl,
const char **  params,
int *  from 
)
static

Checks 'params' for object code.

Can be:

  • empty => get current object stack top for player
  • number => get item with that tag, stack it for future use
  • $number => get specified stack item
  • "me" => player himself

At function exit, params points to first non-object char

'from', if not NULL, contains at exit:

Ryo, august 2004

Parameters
plwizard.
paramsobject specified.
from
Returns
pointed object, or NULL if nothing suitable was found.

Definition at line 195 of file c_wiz.c.

References obj::count, dm_stack_peek(), dm_stack_push(), draw_ext_info_format(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DM, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, pl::ob, object_find_by_tag_global(), STACK_FROM_NONE, STACK_FROM_NUMBER, STACK_FROM_STACK, STACK_FROM_TOP, pl::stack_items, and pl::stack_position.

Referenced by command_diff(), command_dump(), command_free(), command_insert_into(), command_patch(), command_remove(), and command_stack_push().

Here is the call graph for this function:

Here is the caller graph for this function:

static player* get_other_player_from_name ( object op,
const char *  name 
)
static

Enough of the DM functions seem to need this that I broke it out to a seperate function.

name is the person being saught, op is who is looking for them. This prints diagnostics messages, and returns the other player, or NULL otherwise.

Parameters
opplayer searching someone.
namename to search for.
Returns
player, or NULL if player can't be found.

Definition at line 59 of file c_wiz.c.

References draw_ext_info(), first_player, MAX_NAME, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, pl::next, pl::ob, ST_PLAYING, and pl::state.

Referenced by command_arrest(), command_banish(), command_freeze(), command_summon(), and command_toggle_shout().

Here is the call graph for this function:

Here is the caller graph for this function:

static object* get_spell_by_name ( object op,
const char *  spell_name 
)
static

Returns spell object (from archetypes) by name.

Used for wizard's learn spell/prayer.

Ignores archetypes "spelldirect_xxx" since these archetypes are not used anymore (but may still be present in some player's inventories and thus cannot be removed). We have to ignore them here since they have the same name than other "spell_xxx" archetypes and would always conflict.

Parameters
opplayer issuing the command.
spell_namespell to find.
Returns
NULL if 0 or more than one spell matches, spell object else.
Todo:
remove the spelldirect_xxx test?

Definition at line 2174 of file c_wiz.c.

References arch_to_object(), archt::clone, draw_ext_info_format(), first_archetype, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, obj::name, archt::name, NDI_UNIQUE, archt::next, SPELL, and obj::type.

Referenced by command_learn_spell_or_prayer().

Here is the call graph for this function:

Here is the caller graph for this function:

int player_arrest ( object who)

Put a player into jail, taking into account cursed exits and player's region.

Parameters
whoplayer to put in jail
Return values
0player was moved to jail.
-1no jail found.
-2couldn't move to jail (map loading error, or already at jail's position).
-3op isn't a player.

Definition at line 806 of file c_wiz.c.

References enter_exit(), FREE_OBJ_NO_DESTROY_CALLBACK, get_jail_exit(), obj::map, object_free2(), PLAYER, obj::type, obj::x, and obj::y.

Referenced by cfapi_object_move(), and command_arrest().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int cmd_shutdown_time = 0

Time, in seconds from epoch, of server shutdown.

Definition at line 43 of file c_wiz.c.

Referenced by command_shutdown(), do_server(), and server_check_shutdown().