/** * @@ Copyright (Wheel of Time Project) * * Wheel of Time (WoT) Mud System v0.1a * Copyright (c) 1998, by Gary McNickle <gary@tarmongaidon.org> * Based on ROM Mud, v2.4b4 by Russ Taylor * * By using any of the WoT source code, you agree to follow the terms of * usage and liscensing detailed in the file "liscense.txt" as well as any * and all liscensing required for the ROM system. */ /* The following code is based on ILAB OLC by Jason Dinkel & Ivan */ #include <sys/types.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "merc.h" #include "olc.h" #include "recycle.h" #include "tables.h" #include "olc_guild.h" #define GEDIT( fun ) bool fun( CHAR_DATA *ch, char *argument ) GEDIT( gedit_flags ) { CLAN_DATA *pClan; long value = 0; if ( argument[0] != '\0' ) { EDIT_GUILD( ch, pClan ); if ( ( value = flag_value( guild_flags, argument ) ) != NO_FLAG ) { pClan->flags ^= value; send_to_char( "Guild flag(s) toggled.\n\r", ch); return TRUE; } } send_to_char( "Syntax: flag [flag ID]\n\r" "Type '? guild' for a list of valid flags.\n\r", ch ); return FALSE; } GEDIT( gedit_rank ) { CLAN_DATA *pClan; char arg1[4]; EDIT_GUILD(ch, pClan); argument = one_argument(argument, arg1); if (is_number(arg1) && atoi(arg1) <= MAX_RANK) { int value; value = atoi(arg1) -1; if (argument[0] != '\0') { free_string(pClan->rank[value].rankname); pClan->rank[value].rankname = str_dup( argument ); send_to_char("Rank name changed.\n\r", ch); return TRUE; } } send_to_char("Syntax: rank rank# newname\n\r", ch); return FALSE; } GEDIT( gedit_skill ) { CLAN_DATA *pClan; char arg1[4]; EDIT_GUILD(ch, pClan); argument = one_argument(argument, arg1); if (is_number(arg1) && atoi(arg1) <= MAX_RANK) { int value; value = atoi(arg1) -1; if (argument[0] != '\0') { free_string(pClan->rank[value].skillname); pClan->rank[value].skillname = str_dup( argument ); if (skill_lookup(argument) == -1) send_to_char("Notice: That skill does not exist.\n\r", ch); send_to_char("Skill changed.\n\r", ch); return TRUE; } } send_to_char("Syntax: skill rank# newskill\n\r", ch); return FALSE; } GEDIT( gedit_create ) { int i = 0; for (i=1; i < MAX_CLAN; i++) { if (clan_lookup(clan_table[i].name) == 0) break; } if (i <= MAX_CLAN) { CLAN_DATA *pClan; int x; clan_table[i].name = str_dup("New Guild"); clan_table[i].who_name = str_dup("New Guild"); for (x = 0; x < MAX_RANK; x++) { clan_table[i].rank[x].rankname = str_dup("Empty"); clan_table[i].rank[x].skillname = str_dup(""); } pClan = &clan_table[i]; ch->desc->pEdit = pClan; send_to_char("Guild created.\n\r", ch); return TRUE; } send_to_char("No room to create a new guild. Increase MAX_CLAN\n\r", ch); return FALSE; } GEDIT( gedit_list ) { char buf[MIL]; BUFFER *buffer; int i; buffer = new_buf(); sprintf(buf, "Num Guild Name Flags\n\r-----------------------------------------------\n\r"); add_buf(buffer, buf); for (i=1; i <= MAX_CLAN; i++) { if (clan_table[i].name != NULL && clan_table[i].name[0] != '\0') { sprintf(buf,"[%2d] %s\t Flags:\t[%s]\n\r", i, clan_table[i].name, flag_string( guild_flags, clan_table[i].flags ) ); add_buf(buffer, buf); } } page_to_char( buf_string(buffer), ch ); free_buf(buffer); return FALSE; } GEDIT( gedit_show ) { CLAN_DATA *pClan; char buf[MIL]; BUFFER *buffer; int i; EDIT_GUILD(ch, pClan); buffer = new_buf(); sprintf(buf, "Name : %s %s %s\n\rWho Name : %-10s\n\r", pClan->name, IS_SET(pClan->flags, GUILD_CHANGED) ? "`c[`B*`c]`w" : "", IS_SET(pClan->flags, GUILD_DELETED) ? "`RMarked for Deletion!`w" : "", pClan->who_name); add_buf(buffer, buf); sprintf(buf, "Recall Room [%-6d] Morgue Room [%-6d] Clan Temple [%-6d]\n\r\n\r", pClan->room[0], pClan->room[1], pClan->room[2]); add_buf(buffer, buf); sprintf(buf, "Flags: [%s]\n\r\n\r", flag_string( guild_flags, pClan->flags ) ); add_buf(buffer, buf); sprintf(buf, "# Rank Skill Associated with this Rank\n\r--------------------------------------------------------------\n\r"); add_buf(buffer, buf); for (i=0; i < MAX_RANK; i++) { sprintf(buf,"[%2d] %-25s %s\n\r", i+1, (pClan->rank[i].rankname != '\0') ? pClan->rank[i].rankname : "None", (pClan->rank[i].skillname != '\0') ? pClan->rank[i].skillname : ""); add_buf(buffer, buf); } add_buf(buffer,"\n\r"); sprintf(buf, "Mortal Leader Rights\n\r--------------------\n\r"); add_buf(buffer, buf); sprintf(buf,"Can Guild : %s\n\rCan Deguild : %s\n\rCan Promote : %s\n\rCan Demote : %s\n\r", (pClan->ml[0]==1) ? "True" : "False", (pClan->ml[1]==1) ? "True" : "False", (pClan->ml[2]==1) ? "True" : "False", (pClan->ml[3]==1) ? "True" : "False"); add_buf(buffer, buf); page_to_char( buf_string(buffer), ch ); free_buf(buffer); return FALSE; } GEDIT( gedit_name ) { CLAN_DATA *pClan; EDIT_GUILD(ch, pClan); if ( argument[0] == '\0' ) { send_to_char( "Syntax: name [name]\n\r", ch ); return FALSE; } if (clan_lookup(argument) != 0) { send_to_char("That guild allready exists.\n\r", ch); return FALSE; } if (pClan->name[0] != '\0') free_string( pClan->name ); pClan->name = str_dup( argument ); send_to_char( "Name set.\n\r", ch ); return TRUE; } GEDIT( gedit_whoname ) { CLAN_DATA *pClan; EDIT_GUILD(ch, pClan); if ( argument[0] == '\0' ) { send_to_char( "Syntax: whoname [name]\n\r", ch ); return FALSE; } if (pClan->who_name[0] != '\0') free_string( pClan->who_name ); pClan->who_name = str_dup( argument ); send_to_char( "Who Name set.\n\r", ch ); return TRUE; } GEDIT( gedit_rooms ) { CLAN_DATA *pClan; char arg1[10], arg2[10], arg3[10], arg4[10], arg5[10], arg6[10]; bool set = FALSE; EDIT_GUILD(ch, pClan); if ( argument[0] == '\0' ) { send_to_char( "Syntax: rooms [hall #|morgue #|temple #]\n\r", ch ); return FALSE; } argument = one_argument(argument, arg1); argument = one_argument(argument, arg2); argument = one_argument(argument, arg3); argument = one_argument(argument, arg4); argument = one_argument(argument, arg5); argument = one_argument(argument, arg6); if (!str_cmp(arg1,"hall") && is_number(arg2) ) { pClan->room[0] = atoi(arg2); set = TRUE; } else if (!str_cmp(arg1,"morgue") && is_number(arg2) ) { pClan->room[1] = atoi(arg2); set = TRUE; } else if (!str_cmp(arg1,"temple") && is_number(arg2) ) { pClan->room[2] = atoi(arg2); set = TRUE; } if (!str_cmp(arg3,"hall") && is_number(arg4) ) { pClan->room[0] = atoi(arg4); set = TRUE; } else if (!str_cmp(arg3,"morgue") && is_number(arg4) ) { pClan->room[1] = atoi(arg4); set = TRUE; } else if (!str_cmp(arg3,"temple") && is_number(arg4) ) { pClan->room[2] = atoi(arg4); set = TRUE; } if (!str_cmp(arg5,"hall") && is_number(arg6) ) { pClan->room[0] = atoi(arg6); set = TRUE; } else if (!str_cmp(arg5,"morgue") && is_number(arg6) ) { pClan->room[1] = atoi(arg6); set = TRUE; } else if (!str_cmp(arg5,"temple") && is_number(arg6) ) { pClan->room[2] = atoi(arg6); set = TRUE; } if (set) { send_to_char("Room(s) set.\n\r", ch); return TRUE; } return FALSE; } GEDIT( gedit_ml ) { CLAN_DATA *pClan; char arg1[6], arg2[6], arg3[6], arg4[6]; bool set = FALSE; EDIT_GUILD(ch, pClan); if ( argument[0] == '\0' ) { send_to_char( "Syntax: ml TRUE|FALSE TRUE|FALSE TRUE|FALSE TRUE|FALSE\n\r", ch ); return FALSE; } argument = one_argument(argument, arg1); argument = one_argument(argument, arg2); argument = one_argument(argument, arg3); argument = one_argument(argument, arg4); if (!str_prefix(arg1,"true") ) { pClan->ml[0] = TRUE; set = TRUE; } else if (!str_prefix(arg1, "false") ) { pClan->ml[0] = FALSE; set = TRUE; } if (!str_prefix(arg2,"true") ) { pClan->ml[1] = TRUE; set = TRUE; } else if (!str_prefix(arg2, "false") ) { pClan->ml[1] = FALSE; set = TRUE; } if (!str_prefix(arg3,"true") ) { pClan->ml[2] = TRUE; set = TRUE; } else if (!str_prefix(arg3, "false") ) { pClan->ml[2] = FALSE; set = TRUE; } if (!str_prefix(arg4,"true") ) { pClan->ml[3] = TRUE; set = TRUE; } else if (!str_prefix(arg4, "false") ) { pClan->ml[3] = FALSE; set = TRUE; } if (set) { send_to_char("Mortal Leader traits set.\n\r", ch); return TRUE; } return FALSE; }