ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/item.C
(Generate patch)

Comparing deliantra/server/common/item.C (file contents):
Revision 1.48 by root, Tue Apr 22 07:01:46 2008 UTC vs.
Revision 1.52 by root, Thu Jan 1 11:41:17 2009 UTC

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
537 * contain any information about object status (worn/cursed/etc.) 543 * contain any information about object status (worn/cursed/etc.)
538 */ 544 */
539const char * 545const char *
540query_short_name (const object *op) 546query_short_name (const object *op)
541{ 547{
542 if (op->name == 0) 548 if (!op->name)
543 return "(null)"; 549 return "(null)";
544 550
545 if (!op->nrof 551 if (!op->nrof
546 && !op->weight 552 && !op->weight
547 && !op->title 553 && !op->title
807 */ 813 */
808 if (op->has_active_speed ()) 814 if (op->has_active_speed ())
809 switch ((int) ((FABS (op->speed)) * 15)) 815 switch ((int) ((FABS (op->speed)) * 15))
810 { 816 {
811 case 0: 817 case 0:
812 buf << "(very slow movement"; 818 buf << "(very slow movement)";
813 break; 819 break;
814 case 1: 820 case 1:
815 buf << "(slow movement)"; 821 buf << "(slow movement)";
816 break; 822 break;
817 case 2: 823 case 2:
1380 } 1386 }
1381 1387
1382 /* 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 */
1383 if (op->map) 1389 if (op->map)
1384 update_object (op, UP_OBJ_CHANGE); 1390 update_object (op, UP_OBJ_CHANGE);
1391
1385 else if (object *pl = op->visible_to ()) 1392 if (object *pl = op->visible_to ())
1386 /* A lot of the values can change from an update - might as well send 1393 /* A lot of the values can change from an update - might as well send
1387 * it all. 1394 * it all.
1388 */ 1395 */
1389 esrv_send_item (pl, op); 1396 esrv_send_item (pl, op);
1390} 1397}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines