[CODE] Oedit menu enhancement

From: Richard Glover (magik@PYRAMID.NET)
Date: 07/05/98


Oedit menu enhancement:
This will display the "Values" of objects in OasisOLC in a more humanly
readable manner.  This will not affect your object files at all.

oedit.c (oedit_disp_menu):
-   "%sB%s) Timer       : %s%d\r\n"
-   "%sC%s) Values      : %s%d %d %d %d\r\n"
-   "%sD%s) Applies menu\r\n"
-   "%sE%s) Extra descriptions menu\r\n"
-   "%sQ%s) Quit\r\n"
-   "Enter choice : ",
+   "%sB%s) Timer       : %s%d\r\n",
   grn, nrm, cyn, buf1,
   grn, nrm, cyn, GET_OBJ_WEIGHT(obj),
   grn, nrm, cyn, GET_OBJ_COST(obj),
   grn, nrm, cyn, GET_OBJ_RENT(obj),
-   grn, nrm, cyn, GET_OBJ_TIMER(obj),
+   grn, nrm, cyn, GET_OBJ_TIMER(obj)
-   grn, nrm, cyn, GET_OBJ_VAL(obj, 0),
-   GET_OBJ_VAL(obj, 1),
-   GET_OBJ_VAL(obj, 2),
-   GET_OBJ_VAL(obj, 3),
-   grn, nrm, grn, nrm, grn, nrm
   );
  send_to_char(buf, d->character);

+  switch(GET_OBJ_TYPE(obj)) {
+  case ITEM_LIGHT:
+    if (GET_OBJ_VAL(obj, 2) == -1)
+      strcpy(buf1, "Infinite");
+    else if (GET_OBJ_VAL(obj, 2) == 0)
+      strcpy(buf1, "Burnt Out");
+    else
+      sprintf(buf1, "%d", GET_OBJ_VAL(obj, 2));
+    sprintf(buf,
+        "%sS%s) Values      : Capacity: %s%s\r\n",
+        grn, nrm, cyn, buf1);
+    break;
+  case ITEM_SCROLL:
+  case ITEM_POTION:
+    sprintf(buf,
+        "%sS%s) Values      : Level Cast At: %s%d%s\r\n"
+        "                 Spell 1: %s%s %s(%s%d%s)\r\n"
+        "                 Spell 2: %s%s %s(%s%d%s)\r\n"
+        "                 Spell 3: %s%s %s(%s%d%s)\r\n",
+        grn, nrm, cyn, GET_OBJ_VAL(obj, 0), nrm,
+        cyn, GET_OBJ_VAL(obj, 1) > 0 ? spells[GET_OBJ_VAL(obj, 1)] :
"None",
+  nrm, yel, GET_OBJ_VAL(obj, 1), nrm,
+        cyn, GET_OBJ_VAL(obj, 2) > 0 ? spells[GET_OBJ_VAL(obj, 2)] :
"None",
+  nrm, yel, GET_OBJ_VAL(obj, 2), nrm,
+        cyn, GET_OBJ_VAL(obj, 3) > 0 ? spells[GET_OBJ_VAL(obj, 3)] :
"None",
+  nrm, yel, GET_OBJ_VAL(obj, 3), nrm);
+    break;
+  case ITEM_WAND:
+  case ITEM_STAFF:
+    sprintf(buf,
+        "%sS%s) Values      : Level Cast At: %s%d%s\r\n"
+        "                 Charge Capacity: %s%d%s\r\n"
+        "                 Charges Remaining: %s%d%s\r\n"
+        "                 Spell: %s%s %s(%s%d%s)\r\n",
+        grn, nrm, cyn, GET_OBJ_VAL(obj, 0), nrm,
+        cyn, GET_OBJ_VAL(obj, 1), nrm,
+        cyn, GET_OBJ_VAL(obj, 2), nrm,
+        cyn, GET_OBJ_VAL(obj, 3) > 0 ? spells[GET_OBJ_VAL(obj, 3)] :
"None",
+  nrm, yel, GET_OBJ_VAL(obj, 3), nrm);
+    break;
+  case ITEM_WEAPON:
+    sprintf(buf,
+        "%sS%s) Values      : Damage Dice: %s%dd%d%s\r\n"
+        "                 Damage message: %s%s\r\n",
+        grn, nrm, cyn, GET_OBJ_VAL(obj, 1), GET_OBJ_VAL(obj, 2), nrm,
+        cyn, attack_hit_text[GET_OBJ_VAL(obj, 3)].singular);
+    break;
+  case ITEM_ARMOR:
+    sprintf(buf,
+        "%sS%s) Values      : AC-Apply: %s%d%s\r\n",
+        grn, nrm, cyn, GET_OBJ_VAL(obj, 0), nrm);
+    break;
+  case ITEM_CONTAINER:
+    sprintbit(GET_OBJ_VAL(obj, 1), container_bits, buf1);
+    sprintf(buf,
+        "%sS%s) Values      : Container Capacity: %s%d%s\r\n"
+        "                 Close flags: %s%s%s\r\n"
+        "                 Key Vnum: %s%d%s\r\n"
+        "                 Reserved: %s%d%s\r\n",
+        grn, nrm, cyn, GET_OBJ_VAL(obj, 0), nrm,
+        cyn, buf1, nrm,
+        cyn, GET_OBJ_VAL(obj, 2), nrm,
+        cyn, GET_OBJ_VAL(obj, 3), nrm);
+    break;
+  case ITEM_NOTE:
+    sprintf(buf,
+        "%sS%s) Values      : Language: %s%d%s\r\n",
+        grn, nrm, cyn, GET_OBJ_VAL(obj, 0), nrm);
+    break;
+  case ITEM_FOOD:
+    if (GET_OBJ_VAL(obj, 3))
+      sprintf(buf1, "%d", GET_OBJ_VAL(obj, 3));
+    else
+      strcpy(buf1, "None");
+    sprintf(buf,
+        "%sS%s) Values      : Hunger Satisfaction: %s%d%s\r\n"
+        "                 Poison Level: %s%s%s\r\n",
+        grn, nrm, cyn, GET_OBJ_VAL(obj, 0), nrm,
+        cyn, buf1, nrm);
+    break;
+  case ITEM_MONEY:
+    sprintf(buf,
+        "%sS%s) Values      : Gold: %s%d%s\r\n",
+        grn, nrm, cyn, GET_OBJ_VAL(obj, 0), nrm);
+    break;
+  case ITEM_DRINKCON:
+  case ITEM_FOUNTAIN:
+    sprinttype(GET_OBJ_VAL(obj, 2), drinks, buf1);
+    if (GET_OBJ_VAL(obj, 3))
+      sprintf(buf2, "%d", GET_OBJ_VAL(obj, 3));
+    else
+      strcpy(buf2, "None");
+    sprintf(buf,
+        "%sS%s) Values      : Capacity: %s%d%s\r\n"
+        "                 Current Quantity: %s%d%s\r\n"
+        "                 Liquid Type: %s%s%s\r\n"
+        "                 Poison Level: %s%s%s\r\n",
+        grn, nrm, cyn, GET_OBJ_VAL(obj, 0), nrm,
+        cyn, GET_OBJ_VAL(obj, 1), nrm,
+        cyn, buf1, nrm,
+        cyn, buf2, nrm);
+    break;
+  default:
+    sprintf(buf,
+        "%sS%s) Values      : %s%d %d %d %d%s\r\n",
+        grn, nrm, cyn, GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1),
+        GET_OBJ_VAL(obj, 2), GET_OBJ_VAL(obj, 3), GET_OBJ_VAL(obj, 4),
+        GET_OBJ_VAL(obj, 5), GET_OBJ_VAL(obj, 6), GET_OBJ_VAL(obj, 7),
+        GET_OBJ_VAL(obj, 8), nrm);
+    break;
+  }
+  send_to_char(buf, d->character);
+
+  sprintf(buf,
+   "%sD%s) Applies menu\r\n"
+   "%sE%s) Extra descriptions menu\r\n"
+   "%sQ%s) Quit\r\n"
+   "Enter choice : ",
+   grn, nrm,
+   grn, nrm,
+   grn, nrm
+   );
+  send_to_char(buf, d->character);

Rick


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST