Crossfire Server, Trunk
|
#include "global.h"
#include <stdlib.h>
#include <string.h>
#include "newserver.h"
#include "object.h"
#include "shared/newclient.h"
#include "sproto.h"
Go to the source code of this file.
Macros | |
#define | MAXITEMLEN 300 |
Functions | |
static void | add_object_to_socklist (socket_struct *ns, SockList *sl, object *head) |
void | apply_cmd (char *buf, int len, player *pl) |
void | esrv_del_item (player *pl, object *ob) |
void | esrv_draw_look (object *pl) |
static object * | esrv_get_ob_from_count (object *pl, tag_t count) |
void | esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof) |
void | esrv_send_inventory (object *pl, object *op) |
void | esrv_send_item (object *pl, object *op) |
void | esrv_update_item (int flags, object *pl, object *op) |
void | examine_cmd (char *buf, int len, player *pl) |
void | inscribe_scroll_cmd (char *buf, int len, player *pl) |
void | lock_item_cmd (uint8_t *data, int len, player *pl) |
void | look_at (object *op, int dx, int dy) |
void | look_at_cmd (char *buf, int len, player *pl) |
void | mark_item_cmd (uint8_t *data, int len, player *pl) |
static object * | ob_if_can_find (object *op, object *ob) |
bool | player_can_find (object *op, object *ob) |
static bool | player_can_see (player *pl, int dx, int dy) |
static unsigned int | query_flags (const object *op) |
Client/server logic.
This containes item logic for client/server. It doesn't contain the actual commands that send the data, but does contain the logic for what items should be sent.
Definition in file item.cpp.
#define MAXITEMLEN 300 |
|
static |
Used in the send_look to put object head into SockList sl for socket ns. Need socket to know if we need to send animation of face to the client.
Definition at line 122 of file item.cpp.
References object::anim_speed, object::animation, socket_struct::anims_sent, CLEAR_FLAG, object::client_type, object::count, CUSTOM_NAME_FIELD, object::env, esrv_send_animation(), esrv_send_face(), F_NOPICK, FABS, object::face, socket_struct::faces_sent, FLAG_ANIMATE, FLAG_CLIENT_SENT, FLAG_NO_PICK, flags, make_face_from_files::int, llevError, LOG(), object::map, MAX_BUF, object::name, object::nrof, NS_FACESENT_FACE, Animations::num, Face::number, object_get_value(), mapstruct::path, query_base_name(), QUERY_FLAG, query_flags(), safe_strncpy, SET_FLAG, SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddShort(), object::speed, sstring, WEIGHT, object::x, and object::y.
Referenced by esrv_draw_look(), esrv_send_inventory(), and esrv_send_item().
void apply_cmd | ( | char * | buf, |
int | len, | ||
player * | pl | ||
) |
Client wants to apply some object. Lets do so.
Definition at line 668 of file item.cpp.
References apply_by_living(), buf, esrv_get_ob_from_count(), esrv_send_inventory(), FLAG_REMOVED, llevDebug, LOG(), give::op, altar_valkyrie::pl, QUERY_FLAG, and CFweardisguise::tag.
Tells the client to delete an item. Uses the item command with a -1 location.
Definition at line 562 of file item.cpp.
References FLAG_CLIENT_SENT, guildjoin::ob, altar_valkyrie::pl, QUERY_FLAG, Send_With_Handling(), SockList_AddInt(), SockList_AddString(), SockList_Init(), and SockList_Term().
void esrv_draw_look | ( | object * | pl | ) |
Send the look window. Don't need to do animations here This sends all the faces to the client, not just updates. This is because object ordering would otherwise be inconsistent
Definition at line 193 of file item.cpp.
References add_object_to_socklist(), object::below, buf, empty_face, esrv_send_face(), FLAG_IS_FLOOR, FLAG_REMOVED, FLAG_WIZ, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, GET_MAP_OB, HEAD, llevDebug, LOG(), LOOK_OBJ, MAP_IN_MEMORY, MAX, MAX_BUF, MAXITEMLEN, MIN, NS_FACESENT_FACE, Face::number, out_of_map(), altar_valkyrie::pl, QUERY_FLAG, Send_With_Handling(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), SockList_Term(), and Ice::tmp.
Referenced by send_updates(), and set_up_cmd().
Takes a player and object count (tag) and returns the actual object pointer, or null if it can't be found.
Definition at line 610 of file item.cpp.
References CONTAINER, disinfect::count, FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, HEAD, ob_if_can_find(), give::op, altar_valkyrie::pl, and Ice::tmp.
Referenced by apply_cmd(), esrv_move_object(), examine_cmd(), inscribe_scroll_cmd(), lock_item_cmd(), and mark_item_cmd().
Move an object to a new location
Definition at line 899 of file item.cpp.
References CONTAINER, replace::current, drop_object(), env, esrv_get_ob_from_count(), esrv_update_item(), FLAG_APPLIED, FOR_INV_FINISH, FOR_INV_PREPARE, llevDebug, LOG(), object_can_pick(), give::op, pick_up(), altar_valkyrie::pl, put_object_in_sack(), QUERY_FLAG, sack_can_hold(), CFweardisguise::tag, transport_can_hold(), and UPD_WEIGHT.
Referenced by move_cmd().
Sends inventory of a container. If pl == op, then the whole contents are sent, else the contents is sent with "next group" and "prev group" arrows if required.
pl | who to send to. |
op | what item's contents to send. |
Definition at line 316 of file item.cpp.
References add_object_to_socklist(), buf, empty_face, FOR_INV_FINISH, FOR_INV_PREPARE, HEAD, LOOK_OBJ, MAX, MAX_BUF, MAXITEMLEN, MIN, Face::number, give::op, altar_valkyrie::pl, Send_With_Handling(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), SockList_Term(), and Ice::tmp.
Referenced by apply_cmd(), apply_container(), apply_race_and_class(), check_login(), command_possess(), key_change_class(), player_changer_type_process(), save_player(), send_updates(), and use_alchemy().
Sends item's info to player.
Definition at line 522 of file item.cpp.
References add_object_to_socklist(), FLAG_CLIENT_SENT, HEAD, LOOK_OBJ, give::op, altar_valkyrie::pl, Send_With_Handling(), SET_FLAG, SockList_AddInt(), SockList_AddString(), SockList_Init(), and SockList_Term().
Updates object *op for player *pl.
flags is a list of values to update to the client (as defined in newclient.h - might as well use the same value both places.
Definition at line 414 of file item.cpp.
References CUSTOM_NAME_FIELD, esrv_send_face(), FABS, FLAG_ANIMATE, FLAG_CLIENT_SENT, FLAG_NO_PICK, flags, HEAD, make_face_from_files::int, LOOK_OBJ, MAX_BUF, NS_FACESENT_FACE, object_get_value(), give::op, altar_valkyrie::pl, query_base_name(), QUERY_FLAG, query_flags(), Send_With_Handling(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), sstring, strlcpy(), UPD_ANIM, UPD_ANIMSPEED, UPD_FACE, UPD_FLAGS, UPD_LOCATION, UPD_NAME, UPD_NROF, UPD_WEIGHT, and WEIGHT.
Referenced by esrv_move_object(), identify(), and lock_item_cmd().
void examine_cmd | ( | char * | buf, |
int | len, | ||
player * | pl | ||
) |
Client wants to examine some object. So lets do so.
Definition at line 646 of file item.cpp.
References buf, do_dump(), esrv_get_ob_from_count(), examine(), FLAG_WIZ, llevDebug, LOG(), give::op, altar_valkyrie::pl, QUERY_FLAG, and CFweardisguise::tag.
void inscribe_scroll_cmd | ( | char * | buf, |
int | len, | ||
player * | pl | ||
) |
Definition at line 964 of file item.cpp.
References buf, draw_ext_info(), esrv_get_ob_from_count(), find_skill_by_name(), GetInt_String(), llevDebug, LOG(), positioning_system::marked, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, NDI_UNIQUE, altar_valkyrie::pl, range_magic, is_valid_types_gen::type, and write_on_item().
void lock_item_cmd | ( | uint8_t * | data, |
int | len, | ||
player * | pl | ||
) |
Client wants to apply some object. Lets do so.
Definition at line 708 of file item.cpp.
References CLEAR_FLAG, navar-midane_time::data, draw_ext_info(), draw_ext_info_format(), esrv_get_ob_from_count(), esrv_update_item(), FLAG_INV_LOCKED, GetInt_String(), HUGE_BUF, llevDebug, LOG(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, give::name, NDI_UNIQUE, object_merge(), give::op, altar_valkyrie::pl, query_short_name(), SET_FLAG, CFweardisguise::tag, Ice::tmp, and UPD_FLAGS.
void look_at | ( | object * | op, |
int | dx, | ||
int | dy | ||
) |
Prints items on the specified square.
[ removed EARTHWALL check and added check for containers inventory. Tero. ] Haat anen@ lut. fi
Definition at line 798 of file item.cpp.
References CONTAINER, draw_ext_info(), draw_ext_info_format(), FLAG_IS_FLOOR, FLAG_WIZ, FLESH, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, get_map_from_coord(), GET_MAP_OB, HEAD, commongive::inv, inventory(), m, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, MSG_TYPE_COMMAND_SUCCESS, give::name, NDI_UNIQUE, give::op, out_of_map(), QUERY_FLAG, query_name(), Ice::tmp, diamondslots::x, and diamondslots::y.
Referenced by look_at_cmd().
void look_at_cmd | ( | char * | buf, |
int | len, | ||
player * | pl | ||
) |
Client wants to look at some object. Lets do so.
Definition at line 869 of file item.cpp.
References buf, draw_ext_info(), FABS, llevDebug, LOG(), look_at(), MAP_CLIENT_X, MAP_CLIENT_Y, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, NDI_UNIQUE, altar_valkyrie::pl, and player_can_see().
void mark_item_cmd | ( | uint8_t * | data, |
int | len, | ||
player * | pl | ||
) |
Client wants to mark some object. Lets do so.
data | object tag (4 chars). |
len | data size. |
pl | player. |
Definition at line 767 of file item.cpp.
References navar-midane_time::data, draw_ext_info(), draw_ext_info_format(), esrv_get_ob_from_count(), GetInt_String(), llevDebug, LOG(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, give::name, NDI_UNIQUE, give::op, altar_valkyrie::pl, query_name(), and CFweardisguise::tag.
Return object 'ob' if player 'op' can find it, otherwise return NULL.
Definition at line 597 of file item.cpp.
References guildjoin::ob, give::op, and player_can_find().
Referenced by esrv_get_ob_from_count().
Return true if player 'op' can see object 'op' for purpose of locating items for partial item matching or searching by tag.
Definition at line 590 of file item.cpp.
References FLAG_WIZ, guildjoin::ob, give::op, and QUERY_FLAG.
Referenced by find_best_apply_object_match(), and ob_if_can_find().
|
static |
Definition at line 862 of file item.cpp.
References MAX_LIGHT_RADII, and altar_valkyrie::pl.
Referenced by look_at_cmd().
|
static |
This is a similar to query_name, but returns flags to be sended to client.
Definition at line 49 of file item.cpp.
References a_active, a_applied, a_readied, a_wielded, a_worn, AMULET, ARMOUR, BOOK, BOOTS, BOW, BRACERS, CLOAK, CONTAINER, F_BLESSED, F_CURSED, F_DAMNED, F_LOCKED, F_MAGIC, F_OPEN, F_READ, F_UNIDENTIFIED, F_UNPAID, FLAG_APPLIED, FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_INV_LOCKED, FLAG_KNOWN_BLESSED, FLAG_KNOWN_CURSED, FLAG_KNOWN_MAGICAL, FLAG_NO_SKILL_IDENT, FLAG_UNPAID, flags, GIRDLE, GLOVES, HELMET, is_identified(), give::op, QUERY_FLAG, RING, ROD, SHIELD, SKILL, WAND, and WEAPON.
Referenced by add_object_to_socklist(), and esrv_update_item().