#include <sys/types.h>
#include <sys/time.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "tables.h"
#include "olc.h"
#include "lookup.h"
#include "recycle.h"
Include dependency graph for craft.c:

Go to the source code of this file.
Functions | |
| int tailor_roll | args ((CHAR_DATA *ch)) |
| void | do_blacksmith (CHAR_DATA *ch, char *argument) |
| void | do_tailor (CHAR_DATA *ch, char *argument) |
| int | tailor_roll (CHAR_DATA *ch) |
|
|
|
|
||||||||||||
|
Definition at line 496 of file craft.c. 00497 {
00498 return;
00499 }
|
|
||||||||||||
|
Definition at line 26 of file craft.c. References act, check_improve(), create_object(), obj_data::description, dice(), extract_obj(), FALSE, get_eq_char(), get_obj_index(), get_skill(), gsn_tailor, IS_NPC, obj_data::item_type, obj_data::level, MAX_STRING_LENGTH, obj_data::name, number_percent(), obj_to_char(), printf_to_char(), send_to_char(), obj_data::short_descr, skill_type::skill_level, skill_table, str_cmp(), str_dup(), TAILOR_BELT, TAILOR_BOOT, TAILOR_CAP, TAILOR_GAUN, TAILOR_GLOV, TAILOR_JERK, TAILOR_LEAT, TAILOR_LEGG, TAILOR_NECK, tailor_roll(), TAILOR_VEST, TO_ROOM, obj_data::value, WAIT_STATE, WEAR_HOLD, and obj_data::weight. 00027 {
00028 OBJ_DATA *bundle;
00029 OBJ_DATA *armor;
00030 int chance,total;
00031 char buf[MAX_STRING_LENGTH];
00032 chance = 0;
00033 if (!IS_NPC(ch) && ch->level < skill_table[gsn_tailor].skill_level[ch->class])
00034 {
00035 send_to_char("Better leave the tailoring skills to those who know the art.\n\r",ch);
00036 return;
00037 }
00038 if (argument[0] == '\0')
00039 {
00040 send_to_char("You may create one of the following:\n\r{WBoots{x,{W gloves{x,{W bracers{x, {Wnecklace{x, {Wvest{x\n\r",ch);
00041 send_to_char("{Wcap{x, {Wleggings{x, {Wjerkin{x, {Wbelt{x.\n\r",ch);
00042 return;
00043 }
00044 if (!str_cmp(argument, "boots") || !str_cmp(argument, "gloves") || !str_cmp(argument, "bracers")
00045 || !str_cmp(argument, "necklace") || !str_cmp(argument, "vest")
00046 || !str_cmp(argument, "cap") || !str_cmp(argument, "leggings")
00047 || !str_cmp(argument, "leggings") || !str_cmp(argument, "jerkin")
00048 || !str_cmp(argument, "belt"))
00049 {
00050 if (ch->max_hit != ch->hit || ch->max_move != ch->move || ch->max_mana != ch->mana)
00051 {
00052 send_to_char("You are too tired to preform this skill.\n\r",ch);
00053 return;
00054 }
00055 bundle = get_eq_char(ch, WEAR_HOLD);
00056 if (bundle == NULL || bundle->item_type != TAILOR_LEAT)
00057 {
00058 send_to_char("You lack a tailor's most important object!\n\r",ch);
00059 ch->hit = ch->hit /2;
00060 ch->move = ch->move/2;
00061 ch->mana = ch->mana/2;
00062 if (ch->level < 52)
00063 WAIT_STATE(ch, skill_table[gsn_tailor].beats);
00064 return;
00065 }
00066 if (number_percent() > get_skill(ch, gsn_tailor))
00067 {
00068 send_to_char("You failed to create anything of use.\n\r",ch);
00069 check_improve(ch,gsn_tailor, FALSE, 1);
00070 ch->hit = ch->hit / 2;
00071 ch->move = ch->move / 2;
00072 ch->mana = ch->mana / 2;
00073 if (ch->level < 52)
00074 WAIT_STATE(ch, skill_table[gsn_tailor].beats);
00075 return;
00076 }
00077 //armor = create_object (get_obj_index (TAILOR_JERK), 0);
00078 if (!str_cmp(argument, "boots"))
00079 {
00080 /*if ((armor = create_object (get_obj_index (TAILOR_BOOT),0) == NULL))
00081 {
00082 send_to_char("An error has occured in creating your object. Please seek and admin.\n\r",ch);
00083 return;
00084 }*/
00085 if ((armor = create_object(get_obj_index(TAILOR_BOOT),0)) == NULL)
00086 {
00087 send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00088 return;
00089 }
00090 chance = tailor_roll(ch);
00091 if (chance < 1)
00092 chance = 1;
00093 armor->value[0] = dice(2, chance);
00094 armor->value[1] = dice(2, chance);
00095 armor->value[2] = dice(2, chance);
00096 armor->value[3] = dice(2, chance);
00097 armor->level = ch->level;
00098 if ((total = (armor->value[0] + armor->value[1] + armor->value[2] + armor->value[3])))
00099 {
00100 if (total >= 50)
00101 {
00102 armor->short_descr = "A pair of high quality leather boots";
00103 armor->name = "high quality leather boots";
00104 }
00105 if (total <= 49)
00106 {
00107 armor->short_descr = "A pair of medium quality leather boots";
00108 armor->name = "medium quality leather boots";
00109 }
00110 if (total <= 20)
00111 {
00112 armor->short_descr = "A pair of low quality leather boots";
00113 armor->name = "leather boots low quality";
00114 }
00115
00116
00117
00118 }
00119 sprintf(buf, "%s is here", armor->short_descr);
00120 armor->description = str_dup(buf);
00121 armor->level = ch->level;
00122
00123 obj_to_char(armor,ch);
00124 }
00125 if (!str_cmp(argument, "gloves"))
00126 {
00127 if ((armor = create_object(get_obj_index(TAILOR_GLOV),0)) == NULL)
00128 {
00129 send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00130 return;
00131 }
00132 chance = tailor_roll(ch);
00133 if (chance < 1)
00134 chance = 1;
00135 armor->value[0] = dice(2, chance);
00136 armor->value[1] = dice(2, chance);
00137 armor->value[2] = dice(2, chance);
00138 armor->value[3] = dice(2, chance);
00139 if ((total = (armor->value[0] + armor->value[1] + armor->value[2] + armor->value[3])))
00140 {
00141 if (total >= 50)
00142 {
00143 armor->short_descr = "A pair of high quality leather gloves";
00144 armor->name = "high quality leather gloves";
00145 }
00146 if (total <= 49)
00147 {
00148 armor->short_descr = "A pair of medium quality leather gloves";
00149 armor->name = "medium quality leather gloves";
00150 }
00151 if (total <= 20)
00152 {
00153 armor->short_descr = "A pair of low quality leather gloves";
00154 armor->name = "leather gloves low quality";
00155 }
00156 }
00157 sprintf(buf, "%s is here", armor->short_descr);
00158 armor->description = str_dup(buf);
00159 armor->level = ch->level;
00160
00161 obj_to_char(armor,ch);
00162
00163 }
00164 if (!str_cmp(argument, "bracers"))
00165 {
00166 if ((armor = create_object (get_obj_index(TAILOR_GAUN),0)) == NULL)
00167 {
00168 send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00169 return;
00170 }
00171
00172 chance = tailor_roll(ch);
00173 if (chance < 1)
00174 chance = 1;
00175 armor->value[0] = dice(2, chance);
00176 armor->value[1] = dice(2, chance);
00177 armor->value[2] = dice(2, chance);
00178 armor->value[3] = dice(2, chance);
00179 if ((total = (armor->value[0] + armor->value[1] + armor->value[2] + armor->value[3])))
00180 {
00181 if (total >=50)
00182 {
00183 armor->short_descr = "A pair of high quality leather bracers";
00184 armor->name = "high quality leather bracers";
00185 }
00186 if (total <= 49)
00187 {
00188 armor->short_descr = "A pair of medium quality leather bracers";
00189 armor->name = "medium quality leather bracers";
00190 }
00191 if (total <= 20)
00192 {
00193 armor->short_descr = "A pair of low quality leather bracers";
00194 armor->name = "low quality leather bracers";
00195 }
00196 }
00197 sprintf(buf, "%s is here",armor->short_descr);
00198 armor->description = str_dup(buf);
00199 armor->level = ch->level;
00200 obj_to_char(armor, ch);
00201
00202 }
00203 if (!str_cmp(argument, "necklace"))
00204 {
00205 if ((armor = create_object(get_obj_index(TAILOR_NECK),0)) == NULL)
00206 {
00207 send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00208 return;
00209 }
00210
00211 chance = tailor_roll(ch);
00212 if (chance < 1)
00213 chance = 1;
00214 armor->value[0] = dice(2, chance);
00215 armor->value[1] = dice(2, chance);
00216 armor->value[2] = dice(2, chance);
00217 armor->value[3] = dice(2, chance);
00218 if ((total = (armor->value[0] + armor->value[1] + armor->value[2] + armor->value[3])))
00219 {
00220 if (total >=50)
00221 {
00222 armor->short_descr = "A high quality leather necklace";
00223 armor->name = "high quality leather necklace";
00224 }
00225 if (total <= 49)
00226 {
00227 armor->short_descr = "A medium quality leather necklace";
00228 armor->name = "medium quality leather necklace";
00229 }
00230 if (total <= 20)
00231 {
00232 armor->short_descr = "A low quality leather necklace";
00233 armor->name = "low quality leather necklace";
00234 }
00235 }
00236 sprintf(buf, "%s is here", armor->short_descr);
00237 armor->description = str_dup(buf);
00238 armor->level = ch->level;
00239 obj_to_char(armor, ch);
00240
00241 }
00242 if (!str_cmp(argument, "vest"))
00243 {
00244 if ((armor = create_object(get_obj_index(TAILOR_VEST),0)) == NULL)
00245 {
00246 send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00247 return;
00248 }
00249
00250 chance = tailor_roll(ch);
00251 if (chance < 1 )
00252 chance = 1;
00253 armor->value[0] = dice(2, chance);
00254 armor->value[1] = dice(2, chance);
00255 armor->value[2] = dice(2, chance);
00256 armor->value[3] = dice(2, chance);
00257
00258 if ((total = (armor->value[0] + armor->value[1] + armor->value[2] + armor->value[3])))
00259 {
00260 if (total >= 50)
00261 {
00262 armor->short_descr = "A high quality leather vest";
00263 armor->name = "high quality leather vest";
00264 }
00265 if (total <= 49)
00266 {
00267 armor->short_descr = "A medium quality leather vest";
00268 armor->name = "medium quality leather vest";
00269 }
00270 if (total <= 20)
00271 {
00272 armor->short_descr = "A low quality leather vest";
00273 armor->name = "low quality leather vest";
00274 }
00275 sprintf(buf, "%s is here", armor->short_descr);
00276 armor->description = str_dup(buf);
00277 armor->level = ch->level;
00278 obj_to_char(armor,ch);
00279
00280 }
00281 }
00282 if (!str_cmp(argument, "cap"))
00283 {
00284 if ((armor = create_object(get_obj_index(TAILOR_CAP), 0)) == NULL)
00285 {
00286 send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00287 return;
00288 }
00289
00290 chance = tailor_roll(ch);
00291 if (chance < 1)
00292 chance = 1;
00293 armor->value[0] = dice(2, chance);
00294 armor->value[1] = dice(2, chance);
00295 armor->value[2] = dice(2, chance);
00296 armor->value[3] = dice(2, chance);
00297
00298 if ((total = (armor->value[0] + armor->value[1] + armor->value[2] + armor->value[3])))
00299 {
00300 if (total >= 50)
00301 {
00302 armor->short_descr = "A high quality leather cap";
00303 armor->name = "high quality leather cap";
00304 }
00305 if (total <=49)
00306 {
00307 armor->short_descr = "A medium quality leather cap";
00308 armor->name = "medium quality leather cap";
00309 }
00310 if (total <=20)
00311 {
00312 armor->short_descr = "A low quality leather cap";
00313 armor->name = "low quality leather cap";
00314 }
00315 sprintf(buf, "%s is here", armor->short_descr);
00316 armor->description = str_dup(buf);
00317 armor->level = ch->level;
00318 obj_to_char(armor, ch);
00319
00320 }
00321 }
00322 if (!str_cmp(argument, "leggings"))
00323 {
00324 if ((armor = create_object(get_obj_index(TAILOR_LEGG),0)) == NULL)
00325 {
00326 send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00327 return;
00328 }
00329
00330 chance = tailor_roll(ch);
00331 if (chance < 1)
00332 chance = 1;
00333 armor->value[0] = dice(2, chance);
00334 armor->value[1] = dice(2, chance);
00335 armor->value[2] = dice(2, chance);
00336 armor->value[3] = dice(2, chance);
00337
00338 if ((total = (armor->value[0] + armor->value[1] + armor->value[2] + armor->value[3])))
00339 {
00340 if (total >=50)
00341 {
00342 armor->short_descr = "A pair of high quality leather leggings";
00343 armor->name = "high quality leather leggings";
00344 }
00345 if (total <=49)
00346 {
00347 armor->short_descr = "A pair of medium quality leather leggings";
00348 armor->name = "medium quality leather leggings";
00349 }
00350 if (total <=20)
00351 {
00352 armor->short_descr = "A pair of low quality leather leggings";
00353 armor->name = "low quality leather leggings";
00354 }
00355 sprintf(buf, "%s is here", armor->short_descr);
00356 armor->description = str_dup(buf);
00357 armor->level = ch->level;
00358 obj_to_char(armor,ch);
00359
00360 }
00361 }
00362 if (!str_cmp(argument, "jerkin"))
00363 {
00364 if ((armor = create_object(get_obj_index(TAILOR_JERK), 0)) == NULL)
00365 {
00366 send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00367 return;
00368 }
00369
00370 chance = tailor_roll(ch);
00371 armor->value[0] = dice(2, chance);
00372 armor->value[1] = dice(2, chance);
00373 armor->value[2] = dice(2, chance);
00374 armor->value[3] = dice(2, chance);
00375 if ((total = (armor->value[0] + armor->value[1] + armor->value[2] + armor->value[3])))
00376 {
00377 if (total >=50)
00378 {
00379 armor->short_descr = "A high quality leather jerkin";
00380 armor->name = "high quality leather jerkin";
00381 }
00382 if (total <=49)
00383 {
00384 armor->short_descr = "A medium quality leather jerkin";
00385 armor->name = "medium quality leather jerkin";
00386 }
00387 if (total <=20)
00388 {
00389 armor->short_descr = "A low quality leather jerkin";
00390 armor->name = "low quality leather jerkin";
00391 }
00392 sprintf(buf, "%s is here", armor->short_descr);
00393 armor->description = str_dup(buf);
00394 armor->level = ch->level;
00395 obj_to_char(armor,ch);
00396
00397 }
00398 }
00399 if (!str_cmp(argument, "belt"))
00400 {
00401 if ((armor = create_object(get_obj_index(TAILOR_BELT), 0)) == NULL)
00402 {
00403 send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00404 return;
00405 }
00406
00407 chance = tailor_roll(ch);
00408 armor->value[0] = dice(2, chance);
00409 armor->value[1] = dice(2, chance);
00410 armor->value[2] = dice(2, chance);
00411 armor->value[3] = dice(2, chance);
00412
00413 if ((total = (armor->value[0] + armor->value[1] + armor->value[2] + armor->value[3])))
00414 {
00415 if (total >= 50)
00416 {
00417 armor->short_descr = "A high quality leather belt";
00418 armor->name = "high quality leather belt";
00419 }
00420 if (total <=49)
00421 {
00422 armor->short_descr = "A medium quality leather belt";
00423 armor->name = "medium quality leather belt";
00424 }
00425 if (total <=20)
00426 {
00427 armor->short_descr = "A low quality leather belt";
00428 armor->name = "low quality leather belt";
00429 }
00430 sprintf(buf, "%s is here", armor->short_descr);
00431 armor->description = str_dup(buf);
00432 armor->level = ch->level;
00433 obj_to_char(armor,ch);
00434
00435 }
00436 }
00437 check_improve(ch,gsn_tailor, FALSE, 1);
00438 ch->hit = ch->hit / 2;
00439 ch->move = ch->move / 2;
00440 ch->mana = ch->mana / 2;
00441 act ("$n begins working on some leather.\n\r", ch, NULL, NULL, TO_ROOM);
00442 printf_to_char(ch, "You have created %s\n\r", armor->short_descr);
00443 act ("$n has created $p.", ch, armor, NULL, TO_ROOM);
00444 if ((bundle->weight / 10) - 10 == 0)
00445 {
00446 send_to_char("In the process, you have used up all your leather.\n\r",ch);
00447 extract_obj(bundle);
00448 }
00449 else
00450 {
00451 bundle->weight -= 100;
00452 }
00453 //f (ch->level < 52)
00454 WAIT_STATE(ch, skill_table[gsn_tailor].beats);
00455 return;
00456 }
00457 else
00458 {
00459 send_to_char("You may create one of the following:\n\rBoots, gloves, bracers, necklace, vest\n\r",ch);
00460 send_to_char("cap, leggings, jerkin, belt.\n\r",ch);
00461 return;
00462 }
00463
00464
00465 }
|
Here is the call graph for this function:

|
|
Definition at line 466 of file craft.c. References get_curr_stat(), get_skill(), gsn_tailor, obj_data::level, number_percent(), and STAT_WIS. Referenced by do_tailor(). 00467 {
00468 int /*ac0=0,ac1=0,ac2=0,ac3=0,*/ roll=0,chance=0;
00469 chance = (.05 * get_curr_stat(ch, STAT_WIS));
00470 chance += (ch->level) / 6;
00471 chance -= number_percent() / ch->level;
00472 roll = get_skill(ch, gsn_tailor);
00473 if (chance < 1)
00474 chance = 1;
00475 chance += (.05 * roll);
00476 if (chance >=5)
00477 chance /= 2;
00478
00479 if (roll < 40 && chance >= 2)
00480 chance /= 2;
00481 if (chance < 1)
00482 chance = 1;
00483 if (roll > 80)
00484 chance += 1;
00485 return chance;
00486 }
|
Here is the call graph for this function:

1.4.0