|
Clan Patch [by Chris Powell] |
|
|
|
Posted Thursday, October 1st @ 02:56:28 PM, by George Greer in the ex-snippet-patchified dept.
This is a patch of the clan code from the snippet site.
In addition to the patch below, the
original README
is available.
diff -uprN stk/Makefile src/Makefile
--- stk/Makefile Tue Feb 10 08:08:35 1998
+++ src/Makefile Tue Feb 10 08:16:42 1998
@@ -24,14 +24,14 @@ OBJFILES = comm.o act.comm.o act.informa
castle.o class.o config.o constants.o db.o fight.o graph.o handler.o \
house.o interpreter.o limits.o magic.o mail.o mobact.o modify.o \
objsave.o olc.o random.o shop.o spec_assign.o spec_procs.o \
- spell_parser.o spells.o utils.o weather.o
+ spell_parser.o spells.o utils.o weather.o clan.o
CXREF_FILES = act.comm.c act.informative.c act.item.c act.movement.c \
act.offensive.c act.other.c act.social.c act.wizard.c ban.c boards.c \
castle.c class.c comm.c config.c constants.c db.c fight.c graph.c \
handler.c house.c interpreter.c limits.c magic.c mail.c mobact.c \
modify.c objsave.c olc.c random.c shop.c spec_assign.c spec_procs.c \
- spell_parser.c spells.c utils.c weather.c
+ spell_parser.c spells.c utils.c weather.c clan.c
default: all
@@ -91,10 +91,10 @@ ref:
# gcc -MM)
act.comm.o: act.comm.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h \
- handler.h db.h screen.h
+ handler.h db.h screen.h clan.h
$(CC) -c $(CFLAGS) act.comm.c
act.informative.o: act.informative.c conf.h sysdep.h structs.h utils.h comm.h \
- interpreter.h handler.h db.h spells.h screen.h
+ interpreter.h handler.h db.h spells.h screen.h clan.h
$(CC) -c $(CFLAGS) act.informative.c
act.item.o: act.item.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h \
handler.h db.h spells.h
@@ -132,7 +132,7 @@ config.o: config.c conf.h sysdep.h struc
constants.o: constants.c conf.h sysdep.h structs.h
$(CC) -c $(CFLAGS) constants.c
db.o: db.c conf.h sysdep.h structs.h utils.h db.h comm.h handler.h spells.h mail.h \
- interpreter.h house.h
+ interpreter.h house.h clan.h
$(CC) -c $(CFLAGS) db.c
fight.o: fight.c conf.h sysdep.h structs.h utils.h comm.h handler.h interpreter.h \
db.h spells.h screen.h
@@ -192,3 +192,6 @@ utils.o: utils.c conf.h sysdep.h structs
weather.o: weather.c conf.h sysdep.h structs.h utils.h comm.h handler.h \
interpreter.h db.h
$(CC) -c $(CFLAGS) weather.c
+clan.o: clan.c conf.h sysdep.h structs.h utils.h comm.h spells.h handler.h \
+ db.h clan.h
+ $(CC) -c $(CFLAGS) clan.c
diff -uprN stk/act.comm.c src/act.comm.c
--- stk/act.comm.c Tue Feb 10 07:53:45 1998
+++ src/act.comm.c Tue Feb 10 08:01:26 1998
@@ -19,6 +19,7 @@
#include "handler.h"
#include "db.h"
#include "screen.h"
+#include "clan.h"
/* extern variables */
extern struct room_data *world;
@@ -485,3 +486,79 @@ ACMD(do_qcomm)
act(buf, 0, ch, 0, i->character, TO_VICT | TO_SLEEP);
}
}
+
+/*
+ * I didn't write this command, i just modified it, all credits should
+ * go to original coder
+ */
+ACMD (do_ctell)
+{
+ struct descriptor_data *i;
+ int minlev=1, c=0;
+ char level_string[6]="\0\0\0\0\0\0";
+
+ skip_spaces (&argument);
+
+/*
+ * The syntax of ctell for imms is different then for morts
+ * mort: ctell imms: ctell
+ * Imms cannot actually see ctells but they can send them
+ */
+ if (GET_LEVEL(ch) >= LVL_IMMORT){
+ c = atoi (argument);
+ if ((c <= 0) || (c > num_of_clans)){
+ send_to_char ("There is no clan with that number.\r\n", ch);
+ return;
+ }
+ while ((*argument != ' ') && (*argument != '\0'))
+ argument++;
+ while (*argument == ' ') argument++;
+ }
+ else
+ if((c=GET_CLAN(ch))==0 || GET_CLAN_RANK(ch)==0) {
+ send_to_char ("You're not part of a clan.\r\n", ch);
+ return;
+ }
+
+ skip_spaces (&argument);
+
+ if (!*argument){
+ send_to_char ("What do you want to tell your clan?\r\n", ch);
+ return;
+ }
+
+ if (*argument == '#'){
+ argument++;
+ minlev = atoi (argument);
+ if (minlev > clan[c].ranks){
+ send_to_char ("No one has a clan rank high enough to hear you!\r\n", ch);
+ return;
+ }
+ while (*argument != ' ') argument++;
+ while (*argument == ' ') argument++;
+ sprintf (level_string, "(%d)", minlev);
+ }
+
+ if (PRF_FLAGGED(ch,PRF_NOREPEAT))
+ sprintf (buf1, OK);
+ else
+ sprintf (buf1, "You tell your clan%s, '%s'\r\n",level_string, argument);
+ send_to_char (buf1, ch);
+
+ for (i = descriptor_list; i; i=i->next){
+ if (i->character->player_specials->saved.clan == c){
+ if (i->character->player_specials->saved.clan_rank >= minlev){
+ if (strcmp (i->character->player.name, ch->player.name)){
+ sprintf (buf, "%s tells your clan%s, '%s'\r\n",
+ (((IS_AFFECTED(ch, AFF_INVISIBLE)) &&
+ (!IS_AFFECTED(i->character, AFF_DETECT_INVIS))) ?
+ "Someone" : ch->player.name), level_string, argument);
+ send_to_char (buf, i->character);
+ }
+ }
+ }
+ }
+
+ return;
+}
+
diff -uprN stk/act.informative.c src/act.informative.c
--- stk/act.informative.c Tue Feb 10 07:53:45 1998
+++ src/act.informative.c Tue Feb 10 08:43:47 1998
@@ -19,6 +19,7 @@
#include "db.h"
#include "spells.h"
#include "screen.h"
+#include "clan.h"
/* extern variables */
extern struct room_data *world;
@@ -907,7 +908,7 @@ ACMD(do_who)
size_t i;
int low = 0, high = LVL_IMPL, localwho = 0, questwho = 0;
int showclass = 0, short_list = 0, outlaws = 0, num_can_see = 0;
- int who_room = 0;
+ int who_room = 0, clan_num = 0;
skip_spaces(&argument);
strcpy(buf, argument);
@@ -1006,6 +1007,21 @@ ACMD(do_who)
(GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""),
GET_LEVEL(tch), CLASS_ABBR(tch), GET_NAME(tch),
GET_TITLE(tch));
+
+
+ /*. Add the clan title to the title between []. Think about no allowing
+ brakets in titles to prevent simulating clan titles .*/
+
+if ((clan_num=find_clan_by_id(GET_CLAN(tch))) >=0 && clan_num < num_of_clans)
+ {
+ if(GET_CLAN_RANK(tch) > 0)
+ sprintf(buf, "%s [%s of %s]", buf,
+ clan[clan_num].rank_name[GET_CLAN_RANK(tch) -1],
+ clan[clan_num].name);
+ else
+ sprintf(buf, "%s [Applying to %s]", buf, clan[clan_num].name);
+ }
+
if (GET_INVIS_LEV(tch))
sprintf(buf, "%s (i%d)", buf, GET_INVIS_LEV(tch));
diff -uprN stk/clan.c src/clan.c
--- stk/clan.c Wed Dec 31 19:00:00 1969
+++ src/clan.c Tue Feb 10 08:36:53 1998
@@ -0,0 +1,1171 @@
+/**************************************************************************
+ * File: clan.c Intended to be used with CircleMUD *
+ * Usage: This is the code for clans *
+ * By Mehdi Keddache (Heritsun on Eclipse of Fate eclipse.argy.com 7777) *
+ * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
+ * CircleMUD (C) 1993, 94 by the Trustees of the Johns Hopkins University *
+ **************************************************************************/
+
+#include "conf.h"
+#include "sysdep.h"
+
+#include "structs.h"
+#include "utils.h"
+#include "comm.h"
+#include "db.h"
+#include "interpreter.h"
+#include "spells.h"
+#include "handler.h"
+#include "clan.h"
+
+int num_of_clans;
+struct clan_rec clan[MAX_CLANS];
+
+extern save_char_file_u(struct char_file_u st);
+extern struct descriptor_data *descriptor_list;
+extern struct char_data *is_playing(char *vict_name);
+
+char clan_privileges[NUM_CP+1][20] ={
+"setplan","enroll","expel","promote","demote","setfees","withdraw","setapplev"};
+
+void send_clan_format(struct char_data *ch)
+{
+int c,r;
+
+send_to_char("Clan commands available to you:\n\r"
+ " clan who\r\n"
+ " clan status\r\n"
+ " clan info \r\n",ch);
+if(GET_LEVEL(ch)>=LVL_CLAN_GOD)
+ send_to_char(" clan create \r\n"
+ " clan destroy \r\n"
+ " clan enroll \r\n"
+ " clan expel \r\n"
+ " clan promote \r\n"
+ " clan demote \r\n"
+ " clan withdraw \r\n"
+ " clan deposit \r\n"
+ " clan set ranks \r\n"
+ " clan set appfee \r\n"
+ " clan set dues \r\n"
+ " clan set applev \r\n"
+ " clan set plan \r\n"
+ " clan privilege \r\n"
+ " clan set title \r\n",ch);
+else {
+ c=find_clan_by_id(GET_CLAN(ch));
+ r=GET_CLAN_RANK(ch);
+ if(r<1)
+ send_to_char(" clan apply \r\n",ch);
+ if(c>=0) {
+ send_to_char(" clan deposit \r\n",ch);
+ if(r>=clan[c].privilege[CP_WITHDRAW])
+ send_to_char(" clan withdraw \r\n" ,ch);
+ if(r>=clan[c].privilege[CP_ENROLL])
+ send_to_char(" clan enroll \r\n" ,ch);
+ if(r>=clan[c].privilege[CP_EXPEL])
+ send_to_char(" clan expel \r\n" ,ch);
+ if(r>=clan[c].privilege[CP_PROMOTE])
+ send_to_char(" clan promote \r\n",ch);
+ if(r>=clan[c].privilege[CP_DEMOTE])
+ send_to_char(" clan demote \r\n",ch);
+ if(r>=clan[c].privilege[CP_SET_APPLEV])
+ send_to_char(" clan set applev \r\n",ch);
+ if(r>=clan[c].privilege[CP_SET_FEES])
+ send_to_char(" clan set appfee \r\n"
+ " clan set dues \r\n",ch);
+ if(r>=clan[c].privilege[CP_SET_PLAN])
+ send_to_char(" clan set plan\r\n",ch);
+ if(r==clan[c].ranks)
+ send_to_char(" clan set ranks \r\n"
+ " clan set title \r\n"
+ " clan privilege \r\n",ch);
+ }
+ }
+}
+
+void do_clan_create (struct char_data *ch, char *arg)
+{
+struct char_data *leader = NULL;
+char arg1[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH];
+int new_id=0,i;
+
+if (!*arg) {
+ send_clan_format(ch);
+ return; }
+
+if (GET_LEVEL(ch) < LVL_CLAN_GOD) {
+ send_to_char("You are not mighty enough to create new clans!\r\n", ch);
+ return; }
+
+if(num_of_clans == MAX_CLANS) {
+ send_to_char("Max clans reached. WOW!\r\n",ch);
+ return; }
+
+half_chop(arg, arg1, arg2);
+
+if(!(leader=get_char_vis(ch,arg1))) {
+ send_to_char("The leader of the new clan must be present.\r\n",ch);
+ return; }
+
+if(strlen(arg2)>=32) {
+ send_to_char("Clan name too long! (32 characters max)\r\n",ch);
+ return; }
+
+if(GET_LEVEL(leader)>=LVL_IMMORT) {
+ send_to_char("You cannot set an immortal as the leader of a clan.\r\n",ch);
+ return; }
+
+if(GET_CLAN(leader)!=0 && GET_CLAN_RANK(leader)!=0) {
+ send_to_char("The leader already belongs to a clan!\r\n",ch);
+ return; }
+
+if(find_clan(arg2)!=-1) {
+ send_to_char("That clan name alread exists!\r\n",ch);
+ return; }
+
+strncpy(clan[num_of_clans].name, CAP((char *)arg2), 32);
+for(i=0;iin_room);
+
+return;
+}
+
+
+void do_clan_destroy (struct char_data *ch, char *arg)
+{
+
+int i,j;
+extern int top_of_p_table;
+extern struct player_index_element *player_table;
+struct char_file_u chdata;
+struct char_data *victim=NULL;
+
+if (!*arg) {
+ send_clan_format(ch);
+ return; }
+
+if ((i = find_clan(arg)) < 0) {
+ send_to_char("Unknown clan.\r\n", ch);
+ return; }
+
+if(GET_LEVEL(ch)name))) {
+ if(GET_CLAN(victim)==clan[i].id) {
+ GET_CLAN(victim)=0;
+ GET_CLAN_RANK(victim)=0;
+ save_char(victim, victim->in_room); } }
+ else {
+ load_char((player_table + j)->name, &chdata);
+ if(chdata.player_specials_saved.clan==clan[i].id) {
+ chdata.player_specials_saved.clan=0;
+ chdata.player_specials_saved.clan_rank=0;
+ save_char_file_u(chdata); } } }
+
+memset(&clan[i], sizeof(struct clan_rec), 0);
+
+for (j = i; j < num_of_clans - 1; j++)
+ clan[j] = clan[j + 1];
+
+num_of_clans--;
+
+send_to_char("Clan deleted.\r\n", ch);
+save_clans();
+return;
+}
+
+void do_clan_enroll (struct char_data *ch, char *arg)
+{
+struct char_data *vict=NULL;
+int clan_num,immcom=0;
+char arg1[MAX_INPUT_LENGTH];
+char arg2[MAX_INPUT_LENGTH];
+
+if (!(*arg)) {
+ send_clan_format(ch);
+ return; }
+
+if(GET_LEVEL(ch)0) {
+ send_to_char("They're already in a clan.\r\n",ch);
+ return;
+ }
+ else {
+ send_to_char("They didn't request to join your clan.\r\n",ch);
+ return;
+ }
+ }
+ else
+ if(GET_CLAN_RANK(vict)>0) {
+ send_to_char("They're already in your clan.\r\n",ch);
+ return;
+ }
+ if(GET_LEVEL(vict)>=LVL_IMMORT) {
+ send_to_char("You cannot enroll immortals in clans.\r\n",ch);
+ return; }
+}
+
+GET_CLAN_RANK(vict)++;
+save_char(vict, vict->in_room);
+clan[clan_num].power += GET_LEVEL(vict);
+clan[clan_num].members++;
+send_to_char("You've been enrolled in the clan you chose!\r\n",vict);
+send_to_char("Done.\r\n",ch);
+
+return;
+}
+
+void do_clan_expel (struct char_data *ch, char *arg)
+{
+struct char_data *vict=NULL;
+int clan_num,immcom=0;
+char arg1[MAX_INPUT_LENGTH];
+char arg2[MAX_INPUT_LENGTH];
+
+if (!(*arg)) {
+ send_clan_format(ch);
+ return; }
+
+if(GET_LEVEL(ch)=GET_CLAN_RANK(ch) && !immcom) {
+ send_to_char("You cannot kick out that person.\r\n",ch);
+ return; } } }
+
+GET_CLAN(vict)=0;
+GET_CLAN_RANK(vict)=0;
+save_char(vict, vict->in_room);
+clan[clan_num].members--;
+clan[clan_num].power-=GET_LEVEL(vict);
+send_to_char("You've been kicked out of your clan!\r\n",vict);
+send_to_char("Done.\r\n",ch);
+
+return;
+}
+
+void do_clan_demote (struct char_data *ch, char *arg)
+{
+struct char_data *vict=NULL;
+int clan_num,immcom=0;
+char arg1[MAX_INPUT_LENGTH];
+char arg2[MAX_INPUT_LENGTH];
+
+if (!(*arg)) {
+ send_clan_format(ch);
+ return; }
+
+if(GET_LEVEL(ch)=GET_CLAN_RANK(ch) && !immcom) {
+ send_to_char("You cannot demote a person of this rank!\r\n",ch);
+ return; } } }
+
+GET_CLAN_RANK(vict)--;
+save_char(vict, vict->in_room);
+send_to_char("You've demoted within your clan!\r\n",vict);
+send_to_char("Done.\r\n",ch);
+return;
+}
+
+void do_clan_promote (struct char_data *ch, char *arg)
+{
+struct char_data *vict=NULL;
+int clan_num,immcom=0;
+char arg1[MAX_INPUT_LENGTH];
+char arg2[MAX_INPUT_LENGTH];
+
+if (!(*arg)) {
+ send_clan_format(ch);
+ return; }
+
+if(GET_LEVEL(ch)GET_CLAN_RANK(ch) && !immcom) {
+ send_to_char("You cannot promote that person over your rank!\r\n",ch);
+ return; }
+ if(GET_CLAN_RANK(vict)==clan[clan_num].ranks) {
+ send_to_char("You cannot promote someone over the top rank!\r\n",ch);
+ return; } } }
+
+GET_CLAN_RANK(vict)++;
+save_char(vict, vict->in_room);
+send_to_char("You've been promoted within your clan!\r\n",vict);
+send_to_char("Done.\r\n",ch);
+return;
+}
+
+void do_clan_who (struct char_data *ch)
+{
+struct descriptor_data *d;
+struct char_data *tch;
+char line_disp[90];
+
+if(GET_CLAN_RANK(ch)==0) {
+ send_to_char("You do not belong to a clan!\r\n",ch);
+ return; }
+
+send_to_char("\r\nList of your clan members\r\n",ch);
+send_to_char("-------------------------\r\n",ch);
+ for (d=descriptor_list; d; d=d->next){
+ if(d->connected)
+ continue;
+ if((tch=d->character))
+ if(GET_CLAN(tch)==GET_CLAN(ch) && GET_CLAN_RANK(tch)>0) {
+ sprintf(line_disp,"%s\r\n",GET_NAME(tch));
+ send_to_char(line_disp,ch); }
+ }
+return;
+}
+
+void do_clan_status (struct char_data *ch)
+{
+char line_disp[90];
+int clan_num;
+
+if(GET_LEVEL(ch)>=LVL_IMMORT) {
+ send_to_char("You are immortal and cannot join any clan!\r\n",ch);
+ return; }
+
+clan_num=find_clan_by_id(GET_CLAN(ch));
+
+if(GET_CLAN_RANK(ch)==0)
+ if(clan_num>=0) {
+ sprintf(line_disp,"You applied to %s\r\n",clan[clan_num].name);
+ send_to_char(line_disp,ch);
+ return; }
+ else {
+ send_to_char("You do not belong to a clan!\r\n",ch);
+ return; }
+
+ sprintf(line_disp,"You are %s (Rank %d) of %s (ID %d)\r\n",
+ clan[clan_num].rank_name[GET_CLAN_RANK(ch)-1],GET_CLAN_RANK(ch),
+ clan[clan_num].name,clan[clan_num].id);
+ send_to_char(line_disp,ch);
+
+return;
+}
+
+void do_clan_apply (struct char_data *ch, char *arg)
+{
+int clan_num;
+
+if (!(*arg)) {
+ send_clan_format(ch);
+ return; }
+
+if(GET_LEVEL(ch)>=LVL_IMMORT) {
+ send_to_char("Gods cannot apply for any clan.\r\n",ch);
+ return; }
+
+if(GET_CLAN_RANK(ch)>0) {
+ send_to_char("You already belong to a clan!\r\n",ch);
+ return; }
+else {
+ if ((clan_num = find_clan(arg)) < 0) {
+ send_to_char("Unknown clan.\r\n", ch);
+ return; } }
+
+if(GET_LEVEL(ch) < clan[clan_num].app_level) {
+ send_to_char("You are not mighty enough to apply to this clan.\r\n",ch);
+ return; }
+
+if(GET_GOLD(ch) < clan[clan_num].app_fee) {
+ send_to_char("You cannot afford the application fee!\r\n", ch);
+ return; }
+
+GET_GOLD(ch) -= clan[clan_num].app_fee;
+clan[clan_num].treasure += clan[clan_num].app_fee;
+save_clans();
+GET_CLAN(ch)=clan[clan_num].id;
+save_char(ch, ch->in_room);
+send_to_char("You've applied to the clan!\r\n",ch);
+
+return;
+}
+
+void do_clan_info (struct char_data *ch, char *arg)
+{
+int i=0,j;
+
+if(num_of_clans == 0) {
+ send_to_char("No clans have formed yet.\r\n",ch);
+ return; }
+
+if(!(*arg)) {
+ sprintf(buf, "\r");
+ for(i=0; i < num_of_clans; i++)
+ sprintf(buf, "%s[%-3d] %-20s Members: %3d Power: %5d Appfee: %d\r\n",buf,
+ i, clan[i].name,clan[i].members,clan[i].power,clan[i].app_fee);
+ page_string(ch->desc,buf, 1);
+ return; }
+else
+ if ((i = find_clan(arg)) < 0) {
+ send_to_char("Unknown clan.\r\n", ch);
+ return; }
+
+sprintf(buf, "Info for clan <<%s>>:\r\n",clan[i].name);
+send_to_char(buf, ch);
+sprintf(buf, "Ranks : %d\r\nTitles : ",clan[i].ranks);
+for(j=0;jname, &chdata);
+ if((i=find_clan_by_id(chdata.player_specials_saved.clan))>=0) {
+ clan[i].power+=chdata.level;
+ clan[i].members++;
+ }
+}
+
+return;
+}
+
+void do_clan_bank(struct char_data *ch, char *arg, int action)
+{
+int clan_num,immcom=0;
+long amount=0;
+char arg1[MAX_INPUT_LENGTH];
+char arg2[MAX_INPUT_LENGTH];
+
+if (!(*arg)) {
+ send_clan_format(ch);
+ return; }
+
+if(GET_LEVEL(ch)in_room);
+save_clans();
+return;
+}
+
+void do_clan_money(struct char_data *ch, char *arg, int action)
+{
+int clan_num,immcom=0;
+long amount=0;
+char arg1[MAX_INPUT_LENGTH];
+char arg2[MAX_INPUT_LENGTH];
+
+if (!(*arg)) {
+ send_clan_format(ch);
+ return; }
+
+if(GET_LEVEL(ch)20) {
+ send_to_char("Clans must have from 2 to 20 ranks.\r\n",ch);
+ return;
+ }
+
+if(GET_GOLD(ch)<750000 && !immcom) {
+ send_to_char("Changing the clan hierarchy requires 750,000 coins!\r\n",ch);
+ return;
+ }
+
+if(!immcom)
+ GET_GOLD(ch)-=750000;
+
+for (j = 0; j <= top_of_p_table; j++) {
+ if((victim=is_playing((player_table +j)->name))) {
+ if(GET_CLAN(victim)==clan[clan_num].id) {
+ if(GET_CLAN_RANK(victim)0)
+ GET_CLAN_RANK(victim)=1;
+ if(GET_CLAN_RANK(victim)==clan[clan_num].ranks)
+ GET_CLAN_RANK(victim)=new_ranks;
+ save_char(victim, victim->in_room);
+ }
+ }
+ else {
+ load_char((player_table + j)->name, &chdata);
+ if(chdata.player_specials_saved.clan==clan[clan_num].id) {
+ if(chdata.player_specials_saved.clan_rank0)
+ chdata.player_specials_saved.clan_rank=1;
+ if(chdata.player_specials_saved.clan_rank==clan[clan_num].ranks)
+ chdata.player_specials_saved.clan_rank=new_ranks;
+ save_char_file_u(chdata);
+ }
+ }
+}
+
+clan[clan_num].ranks=new_ranks;
+for(i=0;i=num_of_clans) {
+ send_to_char("There is no clan with that number.\r\n",ch);
+ return;
+ }
+}
+
+half_chop(arg,arg1,arg2);
+
+if(!is_number(arg1)) {
+ send_to_char("You need to specify a rank number.\r\n",ch);
+ return; }
+
+rank=atoi(arg1);
+
+if(rank<1 || rank>clan[clan_num].ranks) {
+ send_to_char("This clan has no such rank number.\r\n",ch);
+ return; }
+
+if(strlen(arg2)<1 || strlen(arg2)>19) {
+ send_to_char("You need a clan title of under 20 characters.\r\n",ch);
+ return; }
+
+strcpy(clan[clan_num].rank_name[rank-1],arg2);
+save_clans();
+send_to_char("Done.\r\n",ch);
+return;
+}
+
+void do_clan_application( struct char_data *ch, char *arg)
+{
+int clan_num,immcom=0;
+int applevel;
+char arg1[MAX_INPUT_LENGTH];
+char arg2[MAX_INPUT_LENGTH];
+
+if (!(*arg)) {
+ send_clan_format(ch);
+ return; }
+
+if(GET_LEVEL(ch)999) {
+ send_to_char("The application level can go from 1 to 999.\r\n",ch);
+ return;
+ }
+
+clan[clan_num].app_level=applevel;
+save_clans();
+
+return;
+}
+
+void do_clan_sp(struct char_data *ch, char *arg, int priv)
+{
+int clan_num,immcom=0;
+int rank;
+char arg1[MAX_INPUT_LENGTH];
+char arg2[MAX_INPUT_LENGTH];
+
+if (!(*arg)) {
+ send_clan_format(ch);
+ return; }
+
+
+if(GET_LEVEL(ch)clan[clan_num].ranks) {
+ send_to_char("There is no such rank in the clan.\r\n",ch);
+ return;
+ }
+
+clan[clan_num].privilege[priv]=rank;
+save_clans();
+
+return;
+}
+
+void do_clan_plan(struct char_data *ch, char *arg)
+{
+int clan_num;
+
+send_to_char("Command not ready yet\r\n",ch);
+return;
+
+if(GET_LEVEL(ch)>.\r\n",clan[clan_num].name);
+ send_to_char(buf, ch);
+}
+else {
+ sprintf(buf, "Old plan for clan <<%s>>:\r\n", clan[clan_num].name);
+ send_to_char(buf, ch);
+ send_to_char(clan[clan_num].description, ch);
+ send_to_char("Enter new plan:\r\n", ch);
+}
+send_to_char("End with @ on a line by itself.\r\n", ch);
+/*ch->desc->str = clan[clan_num].description;*/
+ch->desc->max_str = CLAN_PLAN_LENGTH;
+save_clans();
+return;
+}
+
+void do_clan_privilege( struct char_data *ch, char *arg)
+{
+char arg1[MAX_INPUT_LENGTH] ,arg2[MAX_INPUT_LENGTH];
+int i;
+
+half_chop(arg,arg1,arg2);
+
+if (is_abbrev(arg1,"setplan" )) { do_clan_sp(ch,arg2,CP_SET_PLAN); return ;}
+if (is_abbrev(arg1,"enroll" )) { do_clan_sp(ch,arg2,CP_ENROLL); return ;}
+if (is_abbrev(arg1,"expel" )) { do_clan_sp(ch,arg2,CP_EXPEL); return ;}
+if (is_abbrev(arg1,"promote" )) { do_clan_sp(ch,arg2,CP_PROMOTE); return ;}
+if (is_abbrev(arg1,"demote" )) { do_clan_sp(ch,arg2,CP_DEMOTE); return ;}
+if (is_abbrev(arg1,"withdraw" )) { do_clan_sp(ch,arg2,CP_WITHDRAW); return ;}
+if (is_abbrev(arg1,"setfees" )) { do_clan_sp(ch,arg2,CP_SET_FEES); return ;}
+if (is_abbrev(arg1,"setapplev")) { do_clan_sp(ch,arg2,CP_SET_APPLEV); return ;}
+send_to_char("\r\nClan privileges:\r\n", ch);
+for(i=0;iplayer_specials->saved.clan)
+#define GET_CLAN_RANK(ch) ((ch)->player_specials->saved.clan_rank)
+
+#define CP_SET_PLAN 0
+#define CP_ENROLL 1
+#define CP_EXPEL 2
+#define CP_PROMOTE 3
+#define CP_DEMOTE 4
+#define CP_SET_FEES 5
+#define CP_WITHDRAW 6
+#define CP_SET_APPLEV 7
+#define NUM_CP 8 /* Number of clan privileges */
+
+#define CM_DUES 1
+#define CM_APPFEE 2
+
+#define CB_DEPOSIT 1
+#define CB_WITHDRAW 2
+
+void save_clans(void);
+void init_clans(void);
+sh_int find_clan_by_id(int clan_id);
+sh_int find_clan(char *name);
+
+extern struct clan_rec clan[MAX_CLANS];
+extern int num_of_clans;
+
+struct clan_rec {
+ int id;
+ char name[32];
+ ubyte ranks;
+ char rank_name[20][20];
+ long treasure;
+ int members;
+ int power;
+ int app_fee;
+ int dues;
+ int spells[5];
+ int app_level;
+ ubyte privilege[20];
+ int at_war[4];
+ char description[CLAN_PLAN_LENGTH];
+};
+
diff -uprN stk/db.c src/db.c
--- stk/db.c Tue Feb 10 07:53:45 1998
+++ src/db.c Tue Feb 10 08:36:56 1998
@@ -121,6 +121,7 @@ void load_banned(void);
void Read_Invalid_List(void);
void boot_the_shops(FILE * shop_f, char *filename, int rec_count);
int hsort(const void *a, const void *b);
+void init_clans(void);
/* external vars */
extern int no_specials;
@@ -291,6 +292,9 @@ void boot_db(void)
sort_commands();
sort_spells();
+ log("Booting Clans.");
+ init_clans();
+
log("Booting mail system.");
if (!scan_file()) {
log(" Mail boot failed -- Mail system disabled");
@@ -2421,5 +2425,17 @@ int real_object(int virtual)
top = mid - 1;
else
bot = mid + 1;
+ }
+}
+
+void save_char_file_u(struct char_file_u st)
+{
+int player_i;
+int find_name(char *name);
+
+if((player_i = find_name(st.name)) >=0 )
+ {
+ fseek(player_fl, player_i * sizeof(struct char_file_u), SEEK_SET);
+ fwrite(&st, sizeof(struct char_file_u), 1, player_fl);
}
}
diff -uprN stk/db.h src/db.h
--- stk/db.h Tue Feb 10 07:53:45 1998
+++ src/db.h Tue Feb 10 07:55:38 1998
@@ -49,6 +49,7 @@
#define MAIL_FILE "etc/plrmail" /* for the mudmail system */
#define BAN_FILE "etc/badsites" /* for the siteban system */
#define HCONTROL_FILE "etc/hcontrol" /* for the house system */
+#define CLAN_FILE "etc/clans" /* for the clan system */
#ifdef CIRCLE_AMIGA
#define FASTBOOT_FILE "/.fastboot" /* autorun: boot without sleep */
diff -uprN stk/interpreter.c src/interpreter.c
--- stk/interpreter.c Tue Feb 10 07:53:45 1998
+++ src/interpreter.c Tue Feb 10 07:58:28 1998
@@ -61,10 +61,12 @@ ACMD(do_backstab);
ACMD(do_ban);
ACMD(do_bash);
ACMD(do_cast);
+ACMD(do_clan);
ACMD(do_color);
ACMD(do_commands);
ACMD(do_consider);
ACMD(do_credits);
+ACMD(do_ctell);
ACMD(do_date);
ACMD(do_dc);
ACMD(do_diagnose);
@@ -233,6 +235,7 @@ const struct command_info cmd_info[] = {
{ "cackle" , POS_RESTING , do_action , 0, 0 },
{ "check" , POS_STANDING, do_not_here , 1, 0 },
{ "chuckle" , POS_RESTING , do_action , 0, 0 },
+ { "clan" , POS_SLEEPING, do_clan , 1, 0 },
{ "clap" , POS_RESTING , do_action , 0, 0 },
{ "clear" , POS_DEAD , do_gen_ps , 0, SCMD_CLEAR },
{ "close" , POS_SITTING , do_gen_door , 0, SCMD_CLOSE },
@@ -247,6 +250,7 @@ const struct command_info cmd_info[] = {
{ "credits" , POS_DEAD , do_gen_ps , 0, SCMD_CREDITS },
{ "cringe" , POS_RESTING , do_action , 0, 0 },
{ "cry" , POS_RESTING , do_action , 0, 0 },
+ { "ctell" , POS_SLEEPING, do_ctell , 0, 0 },
{ "cuddle" , POS_RESTING , do_action , 0, 0 },
{ "curse" , POS_RESTING , do_action , 0, 0 },
{ "curtsey" , POS_STANDING, do_action , 0, 0 },
diff -uprN stk/structs.h src/structs.h
--- stk/structs.h Tue Feb 10 07:53:45 1998
+++ src/structs.h Tue Feb 10 08:07:37 1998
@@ -735,8 +735,8 @@ struct player_special_data_saved {
/* spares below for future expansion. You can change the names from
'sparen' to something meaningful, but don't change the order. */
- ubyte spare0;
- ubyte spare1;
+ ubyte clan;
+ ubyte clan_rank;
ubyte spare2;
ubyte spare3;
ubyte spare4;
diff -uprN stk/utils.c src/utils.c
--- stk/utils.c Tue Feb 10 07:53:45 1998
+++ src/utils.c Tue Feb 10 08:12:42 1998
@@ -475,3 +475,15 @@ int num_pc_in_room(struct room_data *roo
+struct char_data *is_playing(char *vict_name)
+{
+ extern struct descriptor_data *descriptor_list;
+ struct descriptor_data *i, *next_i;
+
+ for (i = descriptor_list; i; i = next_i) {
+ next_i = i->next;
+ if(i->connected == CON_PLAYING && !strcmp(i->character->player.name,CAP(vict_name)))
+ return i->character;
+ }
+ return NULL;
+}
<< 128-bit Patch [by Chris Powell] | Reply | View as text | Threaded | Buffer Allocation System 2.0 (Preview) >> |
|
Related Links |
|
|
|