void editObjApplyType(dikuObject *obj, uchar applyField) { struct rccoord coords; char strn[128]; coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); while (TRUE) { sprintf(strn, "&+CNew type for object apply #%u (? for list): &n", applyField + 1); displayColorString(strn); itoa(obj->objApply[applyField].applyWhere, strn, 10); getStrn(strn, 3, 1, 7, '°', strn, FALSE, FALSE); if (!strcmp(strn, "?")) displayObjApplyTypeList(); else break; // later add some sorta range checking or sump'n } obj->objApply[applyField].applyWhere = atoi(strn); }
void deleteQuestUserPrompt(void) { char numbStrn[32] = "\0"; while (TRUE) { displayColorString("\n" "&+cEnter number of mob type to delete quest info from (&+C? for list&n&+c): "); getStrn(numbStrn, 8, 1, 7, '°', numbStrn, FALSE, FALSE); if (!strcmp(numbStrn, "?")) { displayQuestList(); strcpy(numbStrn, "\0"); } else break; } _setbkcolor(0); if (strlen(numbStrn)) { deleteQuestUser(numbStrn); } else _outtext("\n\n"); }
void editQuestPrompt(void) { char numbStrn[256] = "\0"; _outtext("\n"); while (TRUE) { displayColorString("\n&+cEdit which mob's quest info (&+C? for list&n&+c): "); getStrn(numbStrn, 8, 1, 7, '°', numbStrn, FALSE, FALSE); if (!strcmp(numbStrn, "?")) { displayQuestList(); strcpy(numbStrn, "\0"); } else break; } _setbkcolor(0); if (strlen(numbStrn)) { editQuestStrn(numbStrn); } else _outtext("\n\n"); }
void editObjApplyValue(dikuObject *obj, uchar applyField) { struct rccoord coords; char strn[128]; coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); while (TRUE) { sprintf(strn, "&+CNew value for object apply #%u: &n", applyField + 1); displayColorString(strn); itoa(obj->objApply[applyField].applyModifier, strn, 10); getStrn(strn, 5, 1, 7, '°', strn, FALSE, FALSE); break; // later add some sorta range checking or sump'n } obj->objApply[applyField].applyModifier = atoi(strn); }
static void askQ(const char*msg,char*buf,int n){ //Clear areas from old question. struct display_fill fill; fill.x1=0; fill.x2=383; fill.y1=144; fill.y2=168; fill.mode=0; Bdisp_AreaClr(&fill,1,0); PrintXY(1,6,msg,0,0); getStrn(1,7,n,buf); }
char interpEditObjMiscMenu(usint ch, dikuObject *obj) { char strn[256] = "\0"; struct rccoord coords; // edit object type if (ch == 'A') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); while (TRUE) { if (checkForObjHeresWithLoadedContainer(obj->objNumber)) { displayColorString( "&+MCannot change type - objects exist of this type with items inside - press a key&n"); getkey(); displayEditObjMiscMenu(obj); return FALSE; } displayColorString("&+CNew object type (? for list): &n"); itoa(obj->objType, strn, 10); getStrn(strn, 3, 1, 7, '°', strn, FALSE, FALSE); if (!strcmp(strn, "?")) displayObjTypeList(); else break; } obj->objType = atoi(strn); displayEditObjMiscMenu(obj); } else // edit object value 0 if (ch == 'B') { editObjValueField(obj, 0); displayEditObjMiscMenu(obj); } else // edit object value 1 if (ch == 'C') { editObjValueField(obj, 1); displayEditObjMiscMenu(obj); } else // edit object value 2 if (ch == 'D') { editObjValueField(obj, 2); displayEditObjMiscMenu(obj); } else // edit object value 3 if (ch == 'E') { editObjValueField(obj, 3); displayEditObjMiscMenu(obj); } else // edit object value 4 if (ch == 'F') { editObjValueField(obj, 4); displayEditObjMiscMenu(obj); } else // edit object value 5 if (ch == 'G') { editObjValueField(obj, 5); displayEditObjMiscMenu(obj); } else // edit object value 6 if (ch == 'H') { editObjValueField(obj, 6); displayEditObjMiscMenu(obj); } else // edit object value 7 if (ch == 'I') { editObjValueField(obj, 7); displayEditObjMiscMenu(obj); } else // edit apply "type" 0 if (ch == 'J') { editObjApplyType(obj, 0); displayEditObjMiscMenu(obj); } else // edit apply modifier 0 if (ch == 'K') { editObjApplyValue(obj, 0); displayEditObjMiscMenu(obj); } else // edit apply "type" 1 if (ch == 'L') { editObjApplyType(obj, 1); displayEditObjMiscMenu(obj); } else // edit apply modifier 1 if (ch == 'M') { editObjApplyValue(obj, 1); displayEditObjMiscMenu(obj); } else if (checkMenuKey(ch, FALSE) == MENUKEY_SAVE) return TRUE; return FALSE; }
void editObjValueField(dikuObject *obj, uchar valueField) { struct rccoord coords; char strn[256], helpAvail = checkForValueList(obj->objType, valueField), verboseAvail = checkForVerboseAvail(obj->objType, valueField), searchAvail = (checkForSearchAvail(obj->objType, valueField) ? TRUE : FALSE); coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); if (!specialObjValEdit(obj, valueField, FALSE)) { while (TRUE) { if (!(verboseAvail && searchAvail)) sprintf(strn, "&+CNew value for object field #%u", valueField + 1); else sprintf(strn, "&+CNew val for obj field #%u", valueField + 1); // assume verbose/search are only available if help is available if (helpAvail) { strcat(strn, " (? for list"); // if (verboseAvail) strcat(strn, ", ?? for full list"); if (searchAvail) strcat(strn, ", $ to search"); strcat(strn, "): &n"); } else strcat(strn, ": &n"); displayColorString(strn); itoa(obj->objValues[valueField], strn, 10); getStrn(strn, 8, 1, 7, '°', strn, FALSE, FALSE); if (!strcmp(strn, "?") && helpAvail) { displayObjValueHelp(obj->objType, valueField, FALSE); } else // below assumes that verbose is only available when help is available if (!strcmp(strn, "??") && verboseAvail) { displayObjValueHelp(obj->objType, valueField, TRUE); } else // ditto for search if (!strcmp(strn, "$") && searchAvail) { searchObjValue(obj->objType, valueField); } else break; // later add some sorta range checking or sump'n } obj->objValues[valueField] = atoi(strn); } else specialObjValEdit(obj, valueField, TRUE); }
char jumpObj(const dikuObject *obj, ulong *numb) { struct rccoord coords; char strn[128], numbStrn[64]; ulong numb2; coords = _gettextposition(); // coords.row -= 2; _settextposition(coords.row, 1); clrline(coords.row); while (TRUE) { sprintf(strn, "&+CJump to which object (%u-%u, ? for list, $ to search): &n", getLowestObjNumber(), getHighestObjNumber()); displayColorString(strn); itoa(obj->objNumber, numbStrn, 10); getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE); // check user input if (!strcmp(strn, "?")) { displayObjectTypeList(); } else if (!strcmp(strn, "$")) { strn[0] = 0; _setbkcolor(0); displayColorString("\n&+CEnter substring to search object list for: &n"); getStrn(strn, 25, 1, 7, '°', strn, FALSE, FALSE); upstrn(strn); displayObjectTypeList(strn, FALSE); } else { numb2 = strtoul(strn, NULL, 10); if ((!strnumer(strn)) || (numb2 >= numbLookupEntries) || (!findObj(numb2))) { clrline(coords.row, 7, 0); _settextposition(coords.row, 1); _setbkcolor(0); displayColorString(getMenuPromptName()); return MENU_JUMP_ERROR; } else { *numb = numb2; return MENU_JUMP_VALID; } } } }
char interpEditObjTypeMenu(usint ch, dikuObject *obj, dikuObject *origObj, char *addedIdentKeyword) { struct rccoord coords; char strn[256], numbStrn[32], newName[256]; stringNode *strnN; ulong i; // edit obj short name if (ch == 'A') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); displayColorString("&+CNew object short name: &n"); // length - 1 - 1 because we gotta allow space for the tilde at the end getStrn(obj->objShortName, MAX_OBJSNAME_LEN - 1 - 1 - 1, 1, 7, '°', obj->objShortName, FALSE, FALSE); remTrailingSpaces(obj->objShortName); remLeadingSpaces(obj->objShortName); displayEditObjTypeMenu(obj); } else // edit obj long name if (ch == 'B') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); displayColorString("&+CNew object long name: &n"); // length - 1 - 1 because we gotta allow space for the tilde at the end getStrn(obj->objLongName, MAX_OBJLNAME_LEN - 1 - 1 - 1, 1, 7, '°', obj->objLongName, FALSE, FALSE); remTrailingSpaces(obj->objLongName); remLeadingSpaces(obj->objLongName); displayEditObjTypeMenu(obj); } else // edit obj keywords if (ch == 'C') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); displayColorString("&+CNew object keywords: &n"); createKeywordString(obj->keywordListHead, strn); strn[strlen(strn) - 1] = '\0'; // get rid of tilde getStrn(strn, MAX_OBJKEY_LEN - 1, 1, 7, '°', strn, FALSE, FALSE); remTrailingSpaces(strn); remLeadingSpaces(strn); strcat(strn, "~"); deleteStringNodes(obj->keywordListHead); obj->keywordListHead = createKeywordList(strn); displayEditObjTypeMenu(obj); } else // edit obj extra flags if (ch == 'D') { editObjExtraFlags(obj, origObj); displayEditObjTypeMenu(obj); } else // edit obj extra2 flags if (ch == 'E') { editObjExtra2Flags(obj, origObj); displayEditObjTypeMenu(obj); } else // edit obj wear flags if (ch == 'F') { editObjWearFlags(obj, origObj); displayEditObjTypeMenu(obj); } else // edit obj anti flags if (ch == 'G') { editObjAntiFlags(obj, origObj); displayEditObjTypeMenu(obj); } else // edit obj anti2 flags if (ch == 'H') { editObjAnti2Flags(obj, origObj); displayEditObjTypeMenu(obj); } else // edit obj type, applies, values if (ch == 'I') { editObjMisc(obj); displayEditObjTypeMenu(obj); } else // edit obj weight, dam bonus, etc if (ch == 'J') { editObjMisc2(obj); displayEditObjTypeMenu(obj); } else // edit obj extra descs if (ch == 'K') { if (editObjExtraDesc(obj, addedIdentKeyword)) { // user aborted, check for _id_ keyword and remove it if (*addedIdentKeyword) { strnN = obj->keywordListHead; while (strnN) { if (!strcmp(strnN->string, "_ID_")) { if (!strnN->Last) // head of list { obj->keywordListHead = obj->keywordListHead->Next; obj->keywordListHead->Last = NULL; delete strnN; } else { strnN->Last->Next = strnN->Next; strnN->Next->Last = strnN->Last; delete strnN; } } strnN = strnN->Next; } } } displayEditObjTypeMenu(obj); } else // edit obj trap info if (ch == 'M') { editObjTrapInfo(obj); displayEditObjTypeMenu(obj); } else // if allowed, edit aff1 flag if (getObjAffectVal() && (ch == 'N')) { editObjAffect1Flags(obj); displayEditObjTypeMenu(obj); } else // ditto for aff2 flag if (getObjAffectVal() && (ch == 'O')) { editObjAffect2Flags(obj); displayEditObjTypeMenu(obj); } else // ditto for aff3 flag if (getObjAffectVal() && (ch == 'P')) { editObjAffect3Flags(obj); displayEditObjTypeMenu(obj); } else // ditto for aff4 flag if (getObjAffectVal() && (ch == 'Q')) { editObjAffect4Flags(obj); displayEditObjTypeMenu(obj); } else // change limit if (ch == 'L') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); displayColorString( "&+CNew limit on loads for this object type (0 = no limit): &n"); itoa(getNumbEntities(ENTITY_OBJECT, obj->objNumber, TRUE), numbStrn, 10); // strn[0] = '\0'; getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE); // check user input if (!strnumer(strn)) { clrline(coords.row, 7, 0); _settextposition(coords.row, 1); _setbkcolor(0); displayColorString(getMenuPromptName()); return FALSE; } i = atoi(strn); if ((i <= getNumbEntities(ENTITY_OBJECT, obj->objNumber, FALSE)) && (i != 0)) { _settextposition(coords.row, 1); clrline(coords.row, 7, 0); _setbkcolor(0); displayColorString( "&+CError: Limit being set lower than or equal to the number loaded - press any key&n"); getkey(); clrline(coords.row, 7, 0); _settextposition(coords.row, 1); _setbkcolor(0); displayColorString(getMenuPromptName()); return FALSE; } setEntityOverride(ENTITY_OBJECT, obj->objNumber, i, obj->globalmaxload); obj->maxload = i; madeChanges = TRUE; displayEditObjTypeMenu(obj); } else if (ch == 'R') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); displayColorString( "&+CNew MUD-wide limit on loads for this object type (0 = no limit): &n"); itoa(getNumbEntities(ENTITY_OBJECT, obj->objNumber, TRUE), numbStrn, 10); // strn[0] = '\0'; getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE); // check user input if (!strnumer(strn)) { clrline(coords.row, 7, 0); _settextposition(coords.row, 1); _setbkcolor(0); displayColorString(getMenuPromptName()); return FALSE; } i = atoi(strn); if ((i <= getNumbEntities(ENTITY_OBJECT, obj->objNumber, FALSE)) && (i != 0)) { _settextposition(coords.row, 1); clrline(coords.row, 7, 0); _setbkcolor(0); displayColorString( "&+CError: Limit being set lower than or equal to the number loaded - press any key&n"); getkey(); clrline(coords.row, 7, 0); _settextposition(coords.row, 1); _setbkcolor(0); displayColorString(getMenuPromptName()); return FALSE; } setEntityOverride(ENTITY_OBJECT, obj->objNumber, obj->maxload, i); obj->globalmaxload = i; madeChanges = TRUE; displayEditObjTypeMenu(obj); } else // change vnum if ((ch == 'V') && !obj->defaultObj) { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); sprintf(strn, "&+YNew object vnum (highest allowed %u): &n", numbLookupEntries - 1); displayColorString(strn); itoa(obj->objNumber, numbStrn, 10); getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE); // check user input if ((!strnumer(strn)) || (atoi(strn) >= numbLookupEntries) || (findObj(atoi(strn)))) { clrline(coords.row, 7, 0); _settextposition(coords.row, 1); _setbkcolor(0); displayColorString(getMenuPromptName()); return FALSE; } i = atoi(strn); resetAllObjHere(obj->objNumber, i, roomHead); resetNumbLoaded(ENTITY_OBJECT, obj->objNumber, i); checkAndFixRefstoObj(obj->objNumber, i); objLookup[i] = origObj; objLookup[obj->objNumber] = NULL; obj->objNumber = i; resetEntityPointersByNumb(TRUE, FALSE); _settextposition(1, 1); clrline(1, 0, 0); fixObjName(obj->objShortName, newName); _setbkcolor(0); sprintf(strn, "&n&+gEditing object type #&+c%u&+w, &+L\"&n%s&+L\"&n\n\n", obj->objNumber, newName); displayColorString(strn); clrline(coords.row, 7, 0); _settextposition(coords.row, 1); displayColorString(getMenuPromptName()); } else // quit if (checkMenuKey(ch, FALSE) == MENUKEY_SAVE) return TRUE; return FALSE; }
char interpEditObjTrapInfoMenu(usint ch, dikuObject *obj) { char strn[256] = "\0", newName[256]; struct rccoord coords; // edit trap affect flag if (ch == 'A') { fixObjName(obj->objShortName, newName); sprintf(strn, "&+gEditing trap effect flags for obj #&+c%u&+w, &+L\"&n%s&+L\"&n\n\n", obj->objNumber, newName); editFlags(trapEffFlagDef, &(obj->trapAff), strn, "object trap effect flags", NULL, 1); displayEditObjTrapInfoMenu(obj); } else // edit trap damage type if (ch == 'B') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); while (TRUE) { displayColorString("&+CNew trap damage type (? for list):&n "); itoa(obj->trapDam, strn, 10); getStrn(strn, 10, 1, 7, '°', strn, FALSE, FALSE); if (!strcmp(strn, "?")) displayObjTrapDamList(); else break; // later add some sorta range checking or sump'n } obj->trapDam = atoi(strn); displayEditObjTrapInfoMenu(obj); } else // edit number of trap uses if (ch == 'C') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); while (TRUE) { displayColorString("&+CNew number of trap uses:&n "); itoa(obj->trapCharge, strn, 10); getStrn(strn, 10, 1, 7, '°', strn, FALSE, FALSE); break; } obj->trapCharge = atoi(strn); displayEditObjTrapInfoMenu(obj); } else // edit trap level if (ch == 'D') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); while (TRUE) { displayColorString("&+CNew trap level (1-100):&n "); itoa(obj->trapLevel, strn, 10); getStrn(strn, 10, 1, 7, '°', strn, FALSE, FALSE); break; } obj->trapLevel = atoi(strn); displayEditObjTrapInfoMenu(obj); } else if (ch == 'E') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); while (TRUE) { displayColorString("&+CNew trap percent (1-100):&n "); itoa(obj->trapPercent, strn, 10); getStrn(strn, 10, 1, 7, '°', strn, FALSE, FALSE); break; } obj->trapPercent = atoi(strn); displayEditObjTrapInfoMenu(obj); } else if (checkMenuKey(ch, FALSE) == MENUKEY_SAVE) return TRUE; return FALSE; }
char interpEditConfigMenu(const usint ch) { struct rccoord coords; char tempStrn[256], strn[256]; // toggle vnum checking if (ch == 'A') { setVarBoolVal(&varHead, VAR_VNUMCHECK_NAME, !getVnumCheckVal(), FALSE); displayEditConfigMenu(); } else // toggle zone flag checking if (ch == 'B') { setVarBoolVal(&varHead, VAR_CHECKZONEFLAGS_NAME, !getCheckZoneFlagsVal(), FALSE); displayEditConfigMenu(); } else // toggle stopping at zone 'S' line setting /* if (ch == 'C') { setVarBoolVal(&varHead, VAR_IGNOREZONES_NAME, !getIgnoreZoneSVal(), FALSE); displayEditConfigMenu(); } else */ // toggle the showing of info on menus if (ch == 'C') { setVarBoolVal(&varHead, VAR_SHOWMENUINFO_NAME, !getShowMenuInfoVal(), FALSE); displayEditConfigMenu(); } else // toggle walk creation mode if (ch == 'D') { setVarBoolVal(&varHead, VAR_WALKCREATE_NAME, !getWalkCreateVal(), FALSE); displayEditConfigMenu(); } else // toggle saving of currentRoom vnum if (ch == 'E') { setVarBoolVal(&varHead, VAR_SROOMACTIVE_NAME, !getStartRoomActiveVal(), FALSE); displayEditConfigMenu(); } else // toggle object edesc thingy /* if (ch == 'F') { setVarBoolVal(&varHead, VAR_FIRSTOBJEDESCKEY_NAME, !getFirstObjEdescKeyVal(), FALSE); displayEditConfigMenu(); } else */ // toggle 'consider exit dest of -1 as out-of-zone' var if (ch == 'F') { setVarBoolVal(&varHead, VAR_NEGDESTOUTOFZONE_NAME, !getNegDestOutofZoneVal(), FALSE); displayEditConfigMenu(); } else // toggle 'show shop prices adjusted' var if (ch == 'G') { setVarBoolVal(&varHead, VAR_SHOWPRICESADJUSTED_NAME, !getShowPricesAdjustedVal(), FALSE); displayEditConfigMenu(); } else // toggle 'autosave every X commands' var if (ch == 'H') { setVarBoolVal(&varHead, VAR_SAVEEVERYXCOMMANDS_NAME, !getSaveEveryXCommandsVal(), FALSE); displayEditConfigMenu(); } else // edit 'when to autosave' variable if (ch == 'I') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); displayColorString("&+CNew number of commands between autosaving: &n"); itoa(getSaveHowOftenVal(), strn, 10); getStrn(tempStrn, 4, 1, 7, '°', strn, FALSE, FALSE); if (strnumer(tempStrn)) { addVar(&varHead, VAR_SAVEHOWOFTEN_NAME, tempStrn); } displayEditConfigMenu(); } else // edit screen height if (ch == 'J') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); displayColorString("&+CNew screen height: &n"); itoa(getScreenHeight(), strn, 10); getStrn(tempStrn, 4, 1, 7, '°', strn, FALSE, FALSE); // allowing a height of 0 would be bad if (strnumer(tempStrn) && atoi(tempStrn)) { addVar(&varHead, VAR_SCREENHEIGHT_NAME, tempStrn); } displayEditConfigMenu(); } else // edit screen width if (ch == 'K') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); displayColorString("&+CNew screen width: &n"); itoa(getScreenWidth(), strn, 10); getStrn(tempStrn, 4, 1, 7, '°', strn, FALSE, FALSE); // allowing a width of 0 would be very bad if (strnumer(tempStrn) && atoi(tempStrn)) { addVar(&varHead, VAR_SCREENWIDTH_NAME, tempStrn); } displayEditConfigMenu(); } else // edit name of external editor if (ch == 'L') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); displayColorString("&+CNew external editor (full path, if necessary): &n"); getStrn(tempStrn, MAX_VARVAL_LEN - 1, 1, 7, '°', getEditorName(), FALSE, FALSE); addVar(&varHead, VAR_TEXTEDIT_NAME, tempStrn); displayEditConfigMenu(); } else // edit name of menu edit prompt if (ch == 'M') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); displayColorString("&+CNew prompt for menus: &n"); getStrn(tempStrn, MAX_VARVAL_LEN - 1, 1, 7, '°', getMenuPromptName(), FALSE, FALSE); if ((strlen(tempStrn) < (MAX_VARVAL_LEN - 1 - 2)) && !strright(tempStrn, "&n") && !strright(tempStrn, "&N")) strcat(tempStrn, "&n"); addVar(&varHead, VAR_MENUPROMPT_NAME, tempStrn); displayEditConfigMenu(); } else // edit name of main prompt if (ch == 'N') { coords = _gettextposition(); _settextposition(coords.row, 1); clrline(coords.row); displayColorString("&+CNew main prompt: &n"); getStrn(tempStrn, MAX_VARVAL_LEN - 1, 1, 7, '°', getMainPromptStrn(), FALSE, FALSE); if ((strlen(tempStrn) < (MAX_VARVAL_LEN - 1 - 2)) && !strright(tempStrn, "&n") && !strright(tempStrn, "&N") && strcmp(tempStrn, "default")) strcat(tempStrn, "&n"); addVar(&varHead, VAR_MAINPROMPT_NAME, tempStrn); createPrompt(); displayEditConfigMenu(); } else // quit if (checkMenuKey(ch, FALSE) == MENUKEY_SAVE) return TRUE; return FALSE; }