… | |
… | |
299 | if (op->type == WEAPON) |
299 | if (op->type == WEAPON) |
300 | { |
300 | { |
301 | for (i = 1; i < NROFATTACKS; i++) |
301 | for (i = 1; i < NROFATTACKS; i++) |
302 | if (op->attacktype & (1 << i)) |
302 | if (op->attacktype & (1 << i)) |
303 | enc++; |
303 | enc++; |
|
|
304 | |
304 | if (op->slaying) |
305 | if (op->slaying) |
305 | enc += 2; /* What it slays is probably more relevent */ |
306 | enc += 2; /* What it slays is probably more relevent */ |
306 | } |
307 | } |
|
|
308 | |
307 | /* Items the player can equip */ |
309 | /* Items the player can equip */ |
308 | if ((op->type == WEAPON) || (op->type == ARMOUR) || (op->type == HELMET) || |
310 | if ((op->type == WEAPON) || (op->type == ARMOUR) || (op->type == HELMET) || |
309 | (op->type == SHIELD) || (op->type == RING) || |
311 | (op->type == SHIELD) || (op->type == RING) || |
310 | (op->type == BOOTS) || (op->type == GLOVES) || |
312 | (op->type == BOOTS) || (op->type == GLOVES) || |
311 | (op->type == AMULET) || (op->type == GIRDLE) || (op->type == BRACERS) || (op->type == CLOAK)) |
313 | (op->type == AMULET) || (op->type == GIRDLE) || (op->type == BRACERS) || (op->type == CLOAK)) |
… | |
… | |
314 | enc += op->stats.hp; /* hp regen */ |
316 | enc += op->stats.hp; /* hp regen */ |
315 | enc += op->stats.sp; /* mana regen */ |
317 | enc += op->stats.sp; /* mana regen */ |
316 | enc += op->stats.grace; /* grace regen */ |
318 | enc += op->stats.grace; /* grace regen */ |
317 | enc += op->stats.exp; /* speed bonus */ |
319 | enc += op->stats.exp; /* speed bonus */ |
318 | } |
320 | } |
|
|
321 | |
319 | enc += op->stats.luck; |
322 | enc += op->stats.luck; |
320 | |
323 | |
321 | /* Do spell paths now */ |
324 | /* Do spell paths now */ |
322 | for (i = 1; i < NRSPELLPATHS; i++) |
325 | for (i = 1; i < NRSPELLPATHS; i++) |
323 | { |
326 | { |
… | |
… | |
355 | int i; |
358 | int i; |
356 | |
359 | |
357 | for (i = 0; i < item_types_size; i++) |
360 | for (i = 0; i < item_types_size; i++) |
358 | if (item_types[i].number == itemtype) |
361 | if (item_types[i].number == itemtype) |
359 | return &item_types[i]; |
362 | return &item_types[i]; |
|
|
363 | |
360 | return NULL; |
364 | return NULL; |
361 | } |
365 | } |
362 | |
366 | |
363 | /* returns the typedata that has a name equal to itemtype, if there |
367 | /* returns the typedata that has a name equal to itemtype, if there |
364 | * isn't one, return the plural name that matches, if there still isn't |
368 | * isn't one, return the plural name that matches, if there still isn't |
… | |
… | |
369 | int i; |
373 | int i; |
370 | |
374 | |
371 | for (i = 0; i < item_types_size; i++) |
375 | for (i = 0; i < item_types_size; i++) |
372 | if (!strcmp (item_types[i].name, name)) |
376 | if (!strcmp (item_types[i].name, name)) |
373 | return &item_types[i]; |
377 | return &item_types[i]; |
|
|
378 | |
374 | for (i = 0; i < item_types_size; i++) |
379 | for (i = 0; i < item_types_size; i++) |
375 | if (!strcmp (item_types[i].name_pl, name)) |
380 | if (!strcmp (item_types[i].name_pl, name)) |
376 | { |
381 | { |
377 | LOG (llevInfo, |
382 | LOG (llevInfo, |
378 | "get_typedata_by_name: I have been sent the plural %s, the singular form %s is preffered\n", name, item_types[i].name); |
383 | "get_typedata_by_name: I have been sent the plural %s, the singular form %s is prefered\n", name, item_types[i].name); |
379 | return &item_types[i]; |
384 | return &item_types[i]; |
380 | } |
385 | } |
|
|
386 | |
381 | return NULL; |
387 | return NULL; |
382 | } |
388 | } |
383 | |
389 | |
384 | /* describe_resistance generates the visible naming for resistances. |
390 | /* describe_resistance generates the visible naming for resistances. |
385 | * returns a static array of the description. This can return |
391 | * returns a static array of the description. This can return |
… | |
… | |
1356 | * Supposed to fix face-values as well here, but later. |
1362 | * Supposed to fix face-values as well here, but later. |
1357 | */ |
1363 | */ |
1358 | void |
1364 | void |
1359 | identify (object *op) |
1365 | identify (object *op) |
1360 | { |
1366 | { |
1361 | object *pl; |
|
|
1362 | |
|
|
1363 | SET_FLAG (op, FLAG_IDENTIFIED); |
1367 | SET_FLAG (op, FLAG_IDENTIFIED); |
1364 | CLEAR_FLAG (op, FLAG_KNOWN_MAGICAL); |
1368 | CLEAR_FLAG (op, FLAG_KNOWN_MAGICAL); |
1365 | CLEAR_FLAG (op, FLAG_NO_SKILL_IDENT); |
1369 | CLEAR_FLAG (op, FLAG_NO_SKILL_IDENT); |
1366 | |
1370 | |
1367 | /* |
1371 | /* |
… | |
… | |
1374 | { |
1378 | { |
1375 | if (op->inv && op->randomitems) |
1379 | if (op->inv && op->randomitems) |
1376 | op->title = op->inv->name; |
1380 | op->title = op->inv->name; |
1377 | else if (op->arch) |
1381 | else if (op->arch) |
1378 | { |
1382 | { |
1379 | op->name = op->arch->object::name; |
1383 | op->name = op->arch->object::name; |
1380 | op->name_pl = op->arch->object::name_pl; |
1384 | op->name_pl = op->arch->object::name_pl; |
1381 | } |
1385 | } |
1382 | } |
1386 | } |
1383 | |
1387 | |
1384 | /* If the object is on a map, make sure we update its face */ |
1388 | /* If the object is on a map, make sure we update its face */ |
1385 | if (op->map) |
1389 | if (op->map) |
1386 | update_object (op, UP_OBJ_CHANGE); |
1390 | update_object (op, UP_OBJ_CHANGE); |
1387 | else |
1391 | else if (object *pl = op->visible_to ()) |
1388 | { |
|
|
1389 | pl = op->in_player (); |
|
|
1390 | if (pl) |
|
|
1391 | /* A lot of the values can change from an update - might as well send |
1392 | /* A lot of the values can change from an update - might as well send |
1392 | * it all. |
1393 | * it all. |
1393 | */ |
1394 | */ |
1394 | esrv_send_item (pl, op); |
1395 | esrv_send_item (pl, op); |
1395 | } |
|
|
1396 | } |
1396 | } |
1397 | |
1397 | |