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

Comparing deliantra/server/server/alchemy.C (file contents):
Revision 1.5 by root, Sun Sep 3 00:18:42 2006 UTC vs.
Revision 1.6 by elmex, Sun Sep 3 14:33:45 2006 UTC

1/* 1/*
2 * static char *rcsid_alchemy_c = 2 * static char *rcsid_alchemy_c =
3 * "$Id: alchemy.C,v 1.5 2006/09/03 00:18:42 root Exp $"; 3 * "$Id: alchemy.C,v 1.6 2006/09/03 14:33:45 elmex Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
141 return; 141 return;
142 } /* End of WIZ alchemy */ 142 } /* End of WIZ alchemy */
143 143
144 /* find the recipe */ 144 /* find the recipe */
145 rp = find_recipe(fl, formula, cauldron->inv); 145 rp = find_recipe(fl, formula, cauldron->inv);
146 if (rp != NULL) { 146 if (rp) {
147 uint64 value_ingredients; 147 uint64 value_ingredients;
148 uint64 value_item; 148 uint64 value_item;
149 object *tmp; 149 object *tmp;
150 int attempt_shadow_alchemy; 150 int attempt_shadow_alchemy;
151 151
152 ave_chance = fl->total_chance/(float)fl->number; 152 ave_chance = fl->total_chance/(float)fl->number;
153 /* the caster gets an increase in ability based on thier skill lvl */ 153 /* the caster gets an increase in ability based on thier skill lvl */
154 if (rp->skill != NULL) { 154 if (rp->skill) {
155 skop = find_skill_by_name(caster, rp->skill); 155 skop = find_skill_by_name(caster, rp->skill);
156 if (!skop) { 156 if (!skop) {
157 new_draw_info(NDI_UNIQUE, 0, caster, "You do not have the proper skill for this recipe"); 157 new_draw_info(NDI_UNIQUE, 0, caster, "You do not have the proper skill for this recipe");
158 } else { 158 } else {
159 ability+= (int) (skop->level*((4.0 + cauldron->magic)/4.0)); 159 ability+= (int) (skop->level*((4.0 + cauldron->magic)/4.0));
160 } 160 }
161 } else { 161 } else {
162 LOG(llevDebug, "Recipe %s has NULL skill!\n", rp->title); 162 LOG(llevDebug, "Recipe %s has NULL skill!\n", &rp->title);
163 return; 163 return;
164 } 164 }
165 165
166 if (rp->cauldron == NULL) { 166 if (rp->cauldron) {
167 LOG(llevDebug, "Recipe %s has NULL cauldron!\n", rp->title); 167 LOG(llevDebug, "Recipe %s has NULL cauldron!\n", &rp->title);
168 return; 168 return;
169 } 169 }
170 170
171 /* determine value of ingredients */ 171 /* determine value of ingredients */
172 value_ingredients = 0; 172 value_ingredients = 0;
259 LOG(llevDebug,"numb_ob_inside(%s): found %d ingredients\n",op->name,o_number); 259 LOG(llevDebug,"numb_ob_inside(%s): found %d ingredients\n",op->name,o_number);
260#endif 260#endif
261 return o_number; 261 return o_number;
262} 262}
263 263
264/** 264/**
265 * Essentially a wrapper for make_item_from_recipe() and 265 * Essentially a wrapper for make_item_from_recipe() and
266 * insert_ob_in_ob. If the caster has some alchemy skill, then they might 266 * insert_ob_in_ob. If the caster has some alchemy skill, then they might
267 * gain some exp from (successfull) fabrication of the product. 267 * gain some exp from (successfull) fabrication of the product.
268 * If nbatches==-1, don't give exp for this creation (random generation/ 268 * If nbatches==-1, don't give exp for this creation (random generation/
269 * failed recipe) 269 * failed recipe)
273 273
274 object *item=NULL, *skop; 274 object *item=NULL, *skop;
275 /* this should be passed to this fctn, not effiecent cpu use this way */ 275 /* this should be passed to this fctn, not effiecent cpu use this way */
276 int batches=abs(nbatches); 276 int batches=abs(nbatches);
277 277
278
279 LOG(llevDebug,"A %s <=> %s\n", &(rp->cauldron), &(cauldron->arch->name));
278 /* is the cauldron the right type? */ 280 /* is the cauldron the right type? */
279 if (strcmp(rp->cauldron, cauldron->arch->name) != 0) { 281 if (strcmp(rp->cauldron, cauldron->arch->name) != 0) {
280 new_draw_info(NDI_UNIQUE, 0, caster, "You are not using the proper" 282 new_draw_info(NDI_UNIQUE, 0, caster, "You are not using the proper"
281 " facilities for this formula."); 283 " facilities for this formula.");
282 return 0; 284 return 0;
378 380
379 /* Find the appropriate artifact template...*/ 381 /* Find the appropriate artifact template...*/
380 if(strcmp(rp->title,"NONE")) { 382 if(strcmp(rp->title,"NONE")) {
381 if((art=locate_recipe_artifact(rp, rp_arch_index))==NULL) { 383 if((art=locate_recipe_artifact(rp, rp_arch_index))==NULL) {
382 LOG(llevError,"make_alchemy_item(): failed to locate recipe artifact.\n"); 384 LOG(llevError,"make_alchemy_item(): failed to locate recipe artifact.\n");
383 LOG(llevDebug," --requested recipe: %s of %s.\n",rp->arch_name[0],rp->title); 385 LOG(llevDebug," --requested recipe: %s of %s.\n",rp->arch_name[0],&rp->title);
384 return (object *) NULL; 386 return (object *) NULL;
385 } 387 }
386 transmute_materialname(item, art->item); 388 transmute_materialname(item, art->item);
387 give_artifact_abilities(item, art->item); 389 give_artifact_abilities(item, art->item);
388 } 390 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines