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

Comparing deliantra/server/common/treasure.C (file contents):
Revision 1.83 by root, Sun Oct 5 14:16:13 2008 UTC vs.
Revision 1.87 by sf-marcmagus, Thu Oct 15 16:00:37 2009 UTC

3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
20 * 21 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 23 */
23 24
24/* TREASURE_DEBUG does some checking on the treasurelists after loading. 25/* TREASURE_DEBUG does some checking on the treasurelists after loading.
996 op->value *= 5; 997 op->value *= 5;
997 set_ring_bonus (op, d); 998 set_ring_bonus (op, d);
998 } 999 }
999 } 1000 }
1000 1001
1001 if (GET_ANIM_ID (op)) 1002 if (op->animation_id)
1002 SET_ANIMATION (op, rndm (NUM_ANIMATIONS (op))); 1003 op->set_anim_frame (rndm (op->anim_frames ()));
1003 1004
1004 break; 1005 break;
1005 1006
1006 case BOOK: 1007 case BOOK:
1007 /* Is it an empty book?, if yes lets make a special· 1008 /* Is it an empty book?, if yes lets make a special·
1022 op->level = rndm (creator->level); 1023 op->level = rndm (creator->level);
1023 1024
1024 tailor_readable_ob (op, (creator && creator->stats.sp) ? creator->stats.sp : -1); 1025 tailor_readable_ob (op, (creator && creator->stats.sp) ? creator->stats.sp : -1);
1025 /* books w/ info are worth more! */ 1026 /* books w/ info are worth more! */
1026 op->value *= ((op->level > 10 ? op->level : (op->level + 1) / 2) * ((strlen (op->msg) / 250) + 1)); 1027 op->value *= ((op->level > 10 ? op->level : (op->level + 1) / 2) * ((strlen (op->msg) / 250) + 1));
1027 /* creator related stuff */
1028
1029 /* for library, chained books. Note that some monsters have no_pick
1030 * set - we don't want to set no pick in that case.
1031 */
1032 if (QUERY_FLAG (creator, FLAG_NO_PICK) && !QUERY_FLAG (creator, FLAG_MONSTER))
1033 SET_FLAG (op, FLAG_NO_PICK);
1034 if (creator->slaying && !op->slaying) /* for check_inv floors */
1035 op->slaying = creator->slaying;
1036 1028
1037 /* add exp so reading it gives xp (once) */ 1029 /* add exp so reading it gives xp (once) */
1038 op->stats.exp = op->value > 10000 ? op->value / 5 : op->value / 10; 1030 op->stats.exp = op->value > 10000 ? op->value / 5 : op->value / 10;
1039 } 1031 }
1032
1033 /* creator related stuff */
1034
1035 /* for library, chained books. Note that some monsters have no_pick
1036 * set - we don't want to set no pick in that case.
1037 */
1038 if (QUERY_FLAG (creator, FLAG_NO_PICK) && !QUERY_FLAG (creator, FLAG_MONSTER))
1039 SET_FLAG (op, FLAG_NO_PICK);
1040 if (creator->slaying && !op->slaying) /* for check_inv floors */
1041 op->slaying = creator->slaying;
1040 break; 1042 break;
1041 1043
1042 case SPELLBOOK: 1044 case SPELLBOOK:
1043 op->value = op->value * op->inv->value; 1045 op->value = op->value * op->inv->value;
1044 /* add exp so learning gives xp */ 1046 /* add exp so learning gives xp */
1566#if 1 1568#if 1
1567 LOG (llevError, "Got null entry and non zero roll in generate_artifact, type %d\n", op->type); 1569 LOG (llevError, "Got null entry and non zero roll in generate_artifact, type %d\n", op->type);
1568#endif 1570#endif
1569 return; 1571 return;
1570 } 1572 }
1571 if (!strcmp (art->item->name, "NONE")) 1573
1574 if (art->item->name == shstr_NONE)
1572 return; 1575 return;
1576
1573 if (FABS (op->magic) < art->item->magic) 1577 if (fabs (op->magic) < art->item->magic)
1574 continue; /* Not magic enough to be this item */ 1578 continue; /* Not magic enough to be this item */
1575 1579
1576 /* Map difficulty not high enough */ 1580 /* Map difficulty not high enough */
1577 if (difficulty < art->difficulty) 1581 if (difficulty < art->difficulty)
1578 continue; 1582 continue;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines