#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 olc_class.c:

Go to the source code of this file.
Defines | |
| #define | CEDIT(fun) bool fun(CHAR_DATA *ch, char*argument) |
Functions | |
| void | cedit (CHAR_DATA *ch, char *argument) |
| CEDIT (cedit_save) | |
| CEDIT (cedit_show) | |
| CEDIT (cedit_name) | |
| CEDIT (cedit_default) | |
| CEDIT (cedit_base) | |
| CEDIT (cedit_max_hp) | |
| CEDIT (cedit_min_hp) | |
| CEDIT (cedit_skill) | |
| CEDIT (cedit_primary) | |
| CEDIT (cedit_thac_32) | |
| CEDIT (cedit_thac_0) | |
| CEDIT (cedit_wname) | |
| CEDIT (cedit_create) | |
| void | do_cedit (CHAR_DATA *ch, char *argument) |
Variables | |
| const struct olc_cmd_type | cedit_table [] |
| OCLASS_DATA * | class_last |
|
|
Definition at line 30 of file olc_class.c. |
|
||||||||||||
|
Definition at line 561 of file olc_class.c. References cedit_table, edit_done(), interpret(), MAX_INPUT_LENGTH, one_argument(), send_to_char(), smash_tilde(), str_cmp(), and str_prefix(). Referenced by run_olc_editor(). 00562 {
00563 char arg[MAX_INPUT_LENGTH];
00564 char command[MAX_INPUT_LENGTH];
00565 smash_tilde (argument);
00566 strcpy(arg, argument);
00567 argument = one_argument(argument, command);
00568 if (ch->level < 55)
00569 {
00570 send_to_char ("CEdit: You're not high enough level to do this.\n\r",ch);
00571 edit_done(ch);
00572 return;
00573 }
00574 if (!str_cmp(command, "done"))
00575 {
00576 edit_done (ch);
00577 return;
00578 }
00579
00580
00581 if (command[0] == '\0')
00582 {
00583 return;
00584 }
00585 int cmd;
00586 for (cmd = 0; cedit_table[cmd].name != NULL; cmd++)
00587 {
00588 if (!str_prefix(command, cedit_table[cmd].name))
00589 {
00590 if ((*cedit_table[cmd].olc_fun) (ch, argument))
00591 {
00592 return;
00593 }
00594 else
00595 return;
00596 }
00597 }
00598 interpret (ch, arg);
00599 return;
00600 }
|
Here is the call graph for this function:

|
|
Definition at line 469 of file olc_class.c. References oclass_data::base, oclass_data::c_default, EDIT_CLASS, FALSE, oclass_data::guild1, oclass_data::guild2, MAX_STRING_LENGTH, oclass_data::maxhp, oclass_data::minhp, oclass_data::name, oclass_data::primary, send_to_char(), oclass_data::skill, str_cmp(), oclass_data::thac_0, oclass_data::thac_32, TRUE, oclass_data::weapon, and oclass_data::who_name. 00470 {
00471 OCLASS_DATA *pClass;
00472 EDIT_CLASS(ch,pClass);
00473 char buf[MAX_STRING_LENGTH];
00474 FILE *fp;
00475 if (pClass->name[0] == '\0' || pClass->name == NULL || !str_cmp(pClass->name, "New Class"))
00476 {
00477 send_to_char("Please supply a name.\n\r",ch);
00478 return TRUE;
00479 }
00480 if (pClass->who_name[0] == '\0' || pClass->who_name == NULL || !str_cmp(pClass->who_name, "NWC"))
00481 {
00482 send_to_char("Please supply a who name (wname)\n\r",ch);
00483 return TRUE;
00484 }
00485
00486 /* if (pClass->weapon == 0)
00487 {
00488 send_to_char("Weapon vnum needs to be set.\n\r",ch);
00489 return TRUE;
00490 }
00491 if (pClass->guild1 == 0)
00492 {
00493 send_to_char("Guild1 vnum needs to be set.\n\r",ch);
00494 return TRUE;
00495 }
00496 if (pClass->guild2 == 0)
00497 {
00498 send_to_char("Guild2 vnum needs to be set.\n\r",ch);
00499 return TRUE;
00500 }*/
00501 if (pClass->maxhp == 0)
00502 {
00503 send_to_char("Maxhp needs to be set.\n\r",ch);
00504 return TRUE;
00505 }
00506 if (pClass->minhp == 0)
00507 {
00508 send_to_char("Minhp needs to be set.\n\r",ch);
00509 return TRUE;
00510 }
00511 if (pClass->base[0] == '\0' || pClass->base == NULL || !str_cmp(pClass->base, "New Class Basics"))
00512 {
00513 send_to_char("Base needs to be set.\n\r",ch);
00514 return TRUE;
00515 }
00516 if (pClass->c_default[0] == '\0' || pClass->c_default == NULL || !str_cmp(pClass->c_default, "New Class Default"))
00517 {
00518 send_to_char("Default needs to be set.\n\r",ch);
00519 return TRUE;
00520 }
00521 if (pClass->skill == 0)
00522 {
00523 send_to_char("Skill level needs to be set. (This is how far they can practice a skill to.)\n\r",ch);
00524 return TRUE;
00525 }
00526 send_to_char("Saving ... ",ch);
00527 sprintf(buf, "class/%s.class", pClass->name);
00528 fp = fopen (buf, "w");
00529 if (!fp)
00530 {
00531 send_to_char("Failed! -- Contact the head coder for details.\n\r",ch);
00532 return FALSE;
00533 }
00534 fprintf(fp, "#CLASS\n");
00535 fprintf(fp, "Name %s~\n", pClass->name);
00536 fprintf(fp, "WhoN %s~\n", pClass->who_name);
00537 fprintf(fp, "Prime %d\n", pClass->primary);
00538 fprintf(fp, "Weapon %d\n", pClass->weapon);
00539 fprintf(fp, "Guild1 %d\n",pClass->guild1);
00540 fprintf(fp, "Guild2 %d\n", pClass->guild2);
00541 fprintf(fp, "Skill %d\n", pClass->skill);
00542 fprintf(fp, "Thac00 %d\n", pClass->thac_0);
00543 fprintf(fp, "Thac32 %d\n", pClass->thac_32);
00544 fprintf(fp, "HPMIN %d\n", pClass->minhp);
00545 fprintf(fp, "HPMAX %d\n", pClass->maxhp);
00546 fprintf(fp, "FMana 0\n");
00547 fprintf(fp, "Pick 0\n");
00548 fprintf(fp, "Base %s~\n", pClass->base);
00549 fprintf(fp, "Default %s~\n", pClass->c_default);
00550 fprintf(fp, "End\n");
00551 send_to_char(" Done!\n\r",ch);
00552 send_to_char("This does not mean it will be loaded now. Submit note to Tribul, and tell him the name of the class.\n\r",ch);
00553 send_to_char("He will review it, and see if it is worthy, or not.\n\r",ch);
00554 send_to_char("Type done, and you may be on your way.\n\r",ch);
00555 fclose(fp);
00556 return TRUE;
00557
00558 }
|
Here is the call graph for this function:

|
|
Definition at line 435 of file olc_class.c. References oclass_data::base, oclass_data::c_default, EDIT_CLASS, oclass_data::guild1, oclass_data::guild2, MAX_STRING_LENGTH, oclass_data::maxhp, oclass_data::minhp, oclass_data::name, oclass_data::primary, send_to_char(), oclass_data::skill, str_dup(), oclass_data::thac_0, oclass_data::thac_32, TRUE, oclass_data::weapon, and oclass_data::who_name. 00436 {
00437 OCLASS_DATA *pClass;
00438 EDIT_CLASS(ch, pClass);
00439 char buf[MAX_STRING_LENGTH];
00440
00441 sprintf(buf, "Name - [%s]\n\r", str_dup(pClass->name));
00442 send_to_char(buf,ch);
00443 sprintf(buf, "Wname - [%s]\n\r", str_dup(pClass->who_name));
00444 send_to_char(buf,ch);
00445 sprintf(buf, "Thac0 - [%d]\n\r", pClass->thac_0);
00446 send_to_char(buf,ch);
00447 sprintf(buf, "Thac32 - [%d]\n\r",pClass->thac_32);
00448 send_to_char(buf,ch);
00449 sprintf(buf, "Primary - [%d]\n\r",pClass->primary);
00450 send_to_char(buf,ch);
00451 sprintf(buf, "Weapon - [%d]\n\r",pClass->weapon);
00452 send_to_char(buf,ch);
00453 sprintf(buf, "Guild1 - [%d]\n\r", pClass->guild1);
00454 send_to_char(buf,ch);
00455 sprintf(buf, "Guild2 - [%d]\n\r", pClass->guild2);
00456 send_to_char(buf,ch);
00457 sprintf(buf, "Skill - [%d]\n\r", pClass->skill);
00458 send_to_char(buf,ch);
00459 sprintf(buf, "Maxhp - [%d]\n\r", pClass->maxhp);
00460 send_to_char(buf,ch);
00461 sprintf(buf, "Minhp - [%d]\n\r",pClass->minhp);
00462 send_to_char(buf,ch);
00463 sprintf(buf, "Base skills - [%s]\n\r", pClass->base);
00464 send_to_char(buf,ch);
00465 sprintf(buf, "Default skills - [%s]\n\r", pClass->c_default);
00466 send_to_char(buf,ch);
00467 return TRUE;
00468 }
|
Here is the call graph for this function:

|
|
Definition at line 398 of file olc_class.c. References EDIT_CLASS, oclass_data::name, send_to_char(), str_dup(), and TRUE. 00399 {
00400 OCLASS_DATA *pClass;
00401 EDIT_CLASS(ch, pClass);
00402 if (argument[0] == '\0')
00403 {
00404 send_to_char("name <name>\n\r",ch);
00405 return TRUE;
00406 }
00407 pClass->name = str_dup(argument);
00408 // do_function(ch, cedit_show, "");
00409 return TRUE;
00410 }
|
Here is the call graph for this function:

|
|
Definition at line 378 of file olc_class.c. References oclass_data::c_default, EDIT_CLASS, free_string(), is_number(), send_to_char(), str_dup(), and TRUE. 00379 {
00380 OCLASS_DATA *pClass;
00381 EDIT_CLASS(ch,pClass);
00382 if (argument[0] == '\0')
00383 {
00384 send_to_char("default <default group>\n\r",ch);
00385 return TRUE;
00386 }
00387 if (is_number(argument))
00388 {
00389 send_to_char("Non-numeric value, please.\n\r",ch);
00390 return TRUE;
00391 }
00392 pClass->c_default = str_dup(argument);
00393 free_string(argument);
00394 // do_function(ch,cedit_show,"");
00395 return TRUE;
00396 }
|
Here is the call graph for this function:

|
|
Definition at line 359 of file olc_class.c. References oclass_data::base, EDIT_CLASS, free_string(), is_number(), send_to_char(), str_dup(), and TRUE. 00360 {
00361 OCLASS_DATA *pClass;
00362 EDIT_CLASS(ch, pClass);
00363 if (argument[0] == '\0')
00364 {
00365 send_to_char("base <base skill>\n\r",ch);
00366 return TRUE;
00367 }
00368 if (is_number(argument))
00369 {
00370 send_to_char("Non-numeric value, please.\n\r",ch);
00371 return TRUE;
00372 }
00373 pClass->base = str_dup(argument);
00374 free_string(argument);
00375 // do_function(ch,cedit_show,"");
00376 return TRUE;
00377 }
|
Here is the call graph for this function:

|
|
Definition at line 335 of file olc_class.c. References EDIT_CLASS, free_string(), is_number(), oclass_data::maxhp, send_to_char(), and TRUE. 00336 {
00337 OCLASS_DATA *pClass;
00338 EDIT_CLASS(ch,pClass);
00339 if (argument[0] == '\0')
00340 {
00341 send_to_char("maxhp <number>\n\r",ch);
00342 return TRUE;
00343 }
00344 if (!is_number(argument))
00345 {
00346 send_to_char("Value must be numeric\n\r",ch);
00347 return TRUE;
00348 }
00349 if (atoi (argument) < 16 || atoi (argument) > 40)
00350 {
00351 send_to_char("Between 16 and 40 only!\n\r",ch);
00352 return TRUE;
00353 }
00354 pClass->maxhp = atoi (argument);
00355 free_string(argument);
00356 // do_function(ch,cedit_show,"");
00357 return TRUE;
00358 }
|
Here is the call graph for this function:

|
|
Definition at line 311 of file olc_class.c. References EDIT_CLASS, free_string(), is_number(), oclass_data::minhp, send_to_char(), and TRUE. 00312 {
00313 OCLASS_DATA *pClass;
00314 EDIT_CLASS(ch, pClass);
00315 if (argument[0] == '\0')
00316 {
00317 send_to_char("minhp <number>\n\r",ch);
00318 return TRUE;
00319 }
00320 if (!is_number(argument))
00321 {
00322 send_to_char("Value must be numeric\n\r",ch);
00323 return TRUE;
00324 }
00325 if (atoi (argument) < 5 || atoi (argument) > 15)
00326 {
00327 send_to_char("Between 5 and 15 only!\n\r",ch);
00328 return TRUE;
00329 }
00330 pClass->minhp = atoi (argument);
00331 free_string(argument);
00332 // do_function(ch, cedit_show,"");
00333 return TRUE;
00334 }
|
Here is the call graph for this function:

|
|
Definition at line 287 of file olc_class.c. References EDIT_CLASS, free_string(), is_number(), send_to_char(), oclass_data::skill, and TRUE. 00288 {
00289 OCLASS_DATA *pClass;
00290 EDIT_CLASS(ch, pClass);
00291 if (argument[0] == '\0')
00292 {
00293 send_to_char("skill <number>\n\r",ch);
00294 return TRUE;
00295 }
00296 if (!is_number(argument))
00297 {
00298 send_to_char("Value must be numeric\n\r",ch);
00299 return TRUE;
00300 }
00301 if (atoi (argument) < 10 || atoi (argument) > 80)
00302 {
00303 send_to_char("Must be between 10 and 80\n\r",ch);
00304 return TRUE;
00305 }
00306 pClass->skill = atoi (argument);
00307 free_string(argument);
00308 // do_function(ch,cedit_show,"");
00309 return TRUE;
00310 }
|
Here is the call graph for this function:

|
|
Definition at line 207 of file olc_class.c. References EDIT_CLASS, free_string(), is_number(), oclass_data::primary, send_to_char(), str_cmp(), and TRUE. 00208 {
00209 OCLASS_DATA *pClass;
00210 EDIT_CLASS (ch, pClass);
00211 if (argument[0] == '\0')
00212 {
00213 send_to_char("primary <number> (0 through 4)",ch);
00214 return TRUE;
00215 }
00216 if (!str_cmp(argument, "?"))
00217 {
00218 send_to_char("\n\r0 = strength\n\r1 = intelligence\n\r2 = Wisdom\n\r3 = Dexterity\n\r4 = Con\n\r",ch);
00219 return TRUE;
00220 }
00221
00222 if (!is_number(argument))
00223 {
00224 send_to_char("Value must be numeric.\n\r",ch);
00225 return TRUE;
00226 }
00227 if (atoi (argument) < 0 || atoi (argument) > 4)
00228 {
00229 send_to_char("Only 0 - 4\n\r",ch);
00230 return TRUE;
00231 }
00232 pClass->primary = atoi (argument);
00233 free_string(argument);
00234 // do_function(ch,cedit_show,"");
00235 return TRUE;
00236 }
|
Here is the call graph for this function:

|
|
Definition at line 180 of file olc_class.c. References EDIT_CLASS, free_string(), is_number(), send_to_char(), oclass_data::thac_32, and TRUE. 00181 {
00182 OCLASS_DATA *pClass;
00183 EDIT_CLASS(ch,pClass);
00184 if (argument[0] == '\0')
00185 {
00186 send_to_char("thac_32 <number>",ch);
00187 return TRUE;
00188 }
00189 if (!is_number(argument))
00190 {
00191 send_to_char("Value must be numberic\n\r",ch);
00192 return TRUE;
00193 }
00194 if (atoi (argument) > 0 || atoi (argument) < -50)
00195 {
00196 send_to_char("Be real...\n\r",ch);
00197 return TRUE;
00198 }
00199 pClass->thac_32 =atoi (argument);
00200 free_string(argument);
00201 // do_function(ch, cedit_show, "");
00202
00203
00204
00205 return TRUE;
00206 }
|
Here is the call graph for this function:

|
|
Definition at line 154 of file olc_class.c. References EDIT_CLASS, free_string(), is_number(), send_to_char(), oclass_data::thac_0, and TRUE. 00155 {
00156 OCLASS_DATA *pClass;
00157 EDIT_CLASS(ch,pClass);
00158
00159 if (argument[0] == '\0')
00160 {
00161 send_to_char("thac_0 <number>",ch);
00162 return TRUE;
00163 }
00164 if (!is_number(argument))
00165 {
00166 send_to_char("Value must be numberic\n\r",ch);
00167 return TRUE;
00168 }
00169 if (atoi (argument) > 50 || atoi (argument) < 5)
00170 {
00171 send_to_char("Be real...\n\r",ch);
00172 return TRUE;
00173 }
00174 pClass->thac_0 =atoi (argument);
00175 free_string(argument);
00176 // do_function(ch, cedit_show, "");
00177
00178 return TRUE;
00179 }
|
Here is the call graph for this function:

|
|
Definition at line 126 of file olc_class.c. References EDIT_CLASS, free_string(), is_number(), send_to_char(), str_dup(), TRUE, and oclass_data::who_name. 00127 {
00128 OCLASS_DATA *pClass;
00129 EDIT_CLASS(ch, pClass);
00130
00131 if (is_number(argument))
00132 {
00133 send_to_char("Value cannot be a number.\n\r",ch);
00134 return TRUE;
00135 }
00136 if (argument[0] == '\0')
00137 {
00138 send_to_char("wname <name> (Three leters)",ch);
00139 return TRUE;
00140 }
00141 if (strlen(argument) > 3)
00142 {
00143 send_to_char("Only THREE characters\n\r",ch);
00144 return TRUE;
00145 }
00146
00147 pClass->who_name = str_dup(argument);
00148 free_string(argument); /* ...had some strange things happening. Just to be safe ^_^*/
00149 //do_function(ch, cedit_show, "");
00150
00151
00152 return TRUE;
00153 }
|
Here is the call graph for this function:

|
|
Definition at line 93 of file olc_class.c. References oclass_data::base, oclass_data::c_default, class_first, class_last, ED_CLASS, FALSE, oclass_data::guild1, oclass_data::guild2, oclass_data::maxhp, oclass_data::minhp, oclass_data::name, new_class(), oclass_data::next, oclass_data::primary, send_to_char(), oclass_data::skill, str_dup(), oclass_data::thac_0, oclass_data::thac_32, oclass_data::weapon, and oclass_data::who_name. 00094 {
00095 OCLASS_DATA *pClass;
00096 extern OCLASS_DATA *class_first;
00097 pClass = new_class();
00098 pClass->name = str_dup("New Class");
00099 pClass->who_name = str_dup("NWC");
00100 pClass->thac_0 = 0;
00101 pClass->thac_32 = 0;
00102 pClass->primary = 0;
00103 pClass->weapon = 0;
00104 pClass->guild1 = 0;
00105 pClass->guild2 = 0;
00106 pClass->skill = 0;
00107 pClass->minhp = 0;
00108 pClass->maxhp = 0;
00109 pClass->base = str_dup("New Class Basics");
00110 pClass->c_default = str_dup("New Class Default");
00111 //if (class_last)
00112 // class_last->next = pClass;
00113 if (class_first)
00114 class_first = pClass;
00115 class_last= pClass;
00116 pClass->next = NULL;
00117 ch->desc->pEdit = (OCLASS_DATA*) pClass;
00118 ch->desc->editor = ED_CLASS;
00119 send_to_char("Class created\n\r",ch);
00120 send_to_char("Warning. This will not save when you do done. And you cannot do asave changed.\n\r You must type 'csave' to save it for review.\n\r",ch);
00121 return FALSE;
00122
00123
00124
00125 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 53 of file olc_class.c. References ED_CLASS, IS_NPC, is_number(), MAX_STRING_LENGTH, one_argument(), send_to_char(), and str_cmp(). 00054 {
00055 char arg[MAX_STRING_LENGTH];
00056 OCLASS_DATA *pClass;
00057 OCLASS_DATA *cClass;
00058 pClass = cClass;
00059 //cClass = cClass->next;
00060
00061 if (IS_NPC(ch))
00062 return;
00063 argument = one_argument(argument, arg);
00064 if (is_number(arg))
00065 {
00066 send_to_char("Syntax - cedit [create] class\n\r",ch);
00067 return;
00068 }
00069 else if (!str_cmp(arg, "create"))
00070 {
00071 if (ch->pcdata->security < 5)
00072 {
00073 send_to_char("CEdit: Not enough security.\n\r",ch);
00074 return;
00075 }
00076
00077 cedit_create (ch, "");
00078 ch->desc->editor = ED_CLASS;
00079 return;
00080 }
00081 else
00082 {
00083 send_to_char("no.\n\r",ch);
00084 return;
00085 }
00086 ch->desc->pEdit=(void *) pClass;
00087 ch->desc->editor = ED_CLASS;
00088 return;
00089 }
|
Here is the call graph for this function:

|
|
Initial value: {
{"show", cedit_show},
{"name", cedit_name},
{"wname", cedit_wname},
{"thac0", cedit_thac_0},
{"thac32", cedit_thac_32},
{"primary", cedit_primary},
{"skill", cedit_skill},
{"minhp", cedit_min_hp},
{"maxhp", cedit_max_hp},
{"base" , cedit_base},
{"default", cedit_default},
{"commands", show_commands},
{"csave", cedit_save},
{"?", show_help},
{NULL,0}
}
Definition at line 32 of file olc_class.c. Referenced by cedit(), and show_commands(). |
|
|
Definition at line 51 of file mem.c. Referenced by CEDIT(). |
1.4.0