Re: GUILD Related Layout

From: Web Remedies Network (webremedies@home.com)
Date: 03/29/01


Tony Robbins wrote some interesting code, that of which does
help me out alot.  I've spoken briefly with Patrick Dughi, to whom
has also assisted me in some areas that we're once shady.  You
have almost completed my answers pertaining to boot/save processes of
the such, here is what I am planning on doing:
- Let me know if everything seems dandy.

db.c:

CASE("Trains") {
   int numbers[4];
   sscanf(value, "%d %d %d %d", numbers, numbers+1, numbers+2, numbers+3) != 4
   CREATE(new_train, struct trainer_data, 1);
   new_train->next = mob_proto[i].mob_specials.trainer;
   mob_proto[i].mob_specials.trainer->prev = new_train;
   new_train->prev = NULL;
   mob_proto[i].mob_specials.trainer = new_train;
   if(numbers[0] >= 1 && numbers[0] <= (MAX_SKILLS))
   new_train->spell_number = numbers[0];
   else
   log("Error in processing trainer spell number.");
   if(numbers[1] >= 1 && numbers[1] <= 100)
   new_train->percent = numbers[1];
   else
   log("Error in processing trainer percent value.");
   if(numbers[2] >= 0)
   new_train->cost = numbers[2];
   else
   log("Negative value found in cost of trainer spell/skill!");
   if(numbers[3] >= 0)
   new_train->qp_cost = numbers[3];
   else
   log("Negative value found in quest point cost of trainer skills.");
  }

-------------------

structs.h:

struct trainer_data {
 int spell_number;
 int percent;
 int cost;
 int qp_cost;
 struct trainer_data *next;
 struct trainer_data *prev;
};

--------------------
mob_special_data:

struct mob_special_data {
....
struct trainer_data *trainer;
struct trainer_data train_skills;
};
--------------------
genmob.c:

Tony Robbins wrote:

#define TRAINER(mob)   (mob)->mob_specials.train_skills

int write_mobile_espec(mob_vnum mvnum,
  struct char_data *mob, FILE *fd)
{
  if (GET_ATTACK(mob) != 0)
    fprintf(fd,"BareHandAttack: %d\n",GET_ATTACK(mob));
  if (GET_NUM_ATTACKS(mob) != 0)
    fprintf(fd,"NumAttacks: %d\n",GET_NUM_ATTACKS(mob));
  if (GET_STR(mob) != 11)
    fprintf(fd, "Str: %d\n", GET_STR(mob));
+ /* and so on... */
+ /* saving is complicated by the fact that you have to
+  * loop through the character's list of skills. */
+ if (TRAINER(mob) != NULL) { /* mob teaches */
+   for (me = TRAINER(mob); me != NULL; me = me->next) {
+     fprintf(fd, "TrainSkill: %d %d %d %d\n",
+                         TRAINER(mob)->spell_number,
+                         TRAINER(mob)->percent,
+                         TRAINER(mob)->cost,
+                         TRAINER(mob)->qp);
+   /* ... */
+   }
+ }
------------------------------

  Basically that's what I have so far, if anyone notices any problems
with the above let me know, suggestions, criticism or even a note
to let me know I'm venturing down the right path..

  Many thanks to both Thomas Arp, Patrick Dughi, and Tony Robbins for
their assistance on the topic.  Aswell this is still incomplete when
it comes to OLC related input/removal from designated menus...
  But I just want to make sure everything looks fine, and connected thus
far.

Let me know,
Thanks in advance,
Bill
webremedies@home.com

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST