Exemple #1
0
void clubmaster_driver(int cn,int ret,int lastact)
{
	struct clubmaster_driver_data *dat;
        int co,in,n,rank,cc,val;
        struct msg *msg,*next;
	char *ptr,tmp[80],name[80];

        dat=set_data(cn,DRD_CLUBMASTERDRIVER,sizeof(struct clubmaster_driver_data));
	if (!dat) return;	// oops...

        if (ch[cn].arg) {
                clubmaster_driver_parse(cn,dat);
		ch[cn].arg=NULL;
	}

        // loop through our messages
	for (msg=ch[cn].msg; msg; msg=next) {
		next=msg->next;

		// did we see someone?
		if (msg->type==NT_CHAR) {
			
                        co=msg->dat1;

			// dont talk to someone we cant see, and dont talk to ourself
			if (!char_see_char(cn,co) || cn==co) { remove_message(cn,msg); continue; }

			// dont talk to someone far away
			if (char_dist(cn,co)>10) { remove_message(cn,msg); continue; }

			// dont talk to the same person twice
			if (mem_check_driver(cn,co,7)) { remove_message(cn,msg); continue; }

			if (!get_char_club(cn) && !get_char_clan(cn)) quiet_say(cn,"Hello %s! Would you like to found a °c4club°c0?",ch[co].name);
			mem_add_driver(cn,co,7);
		}

                // talk back
		if (msg->type==NT_TEXT) {
			analyse_text_driver(cn,msg->dat1,(char*)msg->dat2,msg->dat3);

                        if ((msg->dat1==1 || msg->dat1==2) && (co=msg->dat3)!=cn) {	// talk, and not our talk				
                                if ((ptr=strcasestr((char*)msg->dat2,"found:"))) {
					if (!(ch[co].flags&CF_PAID)) {
						quiet_say(cn,"I'm sorry, %s, but only paying players may found clubs.",ch[co].name);
					} else if (!get_char_clan(co) && !get_char_club(co)) {
						if (ch[co].gold>=10000*100) {
							ptr+=6;
							while (isspace(*ptr)) ptr++;
							for (n=0; n<79; n++) {
								if (!(isalpha(*ptr) || *ptr==' ')) break;
								name[n]=*ptr++;
							}
							name[n]=0;
							
							if ((n=create_club(name))) {
								take_money(co,10000*100);
								ch[co].clan=n+CLUBOFFSET;
								ch[co].clan_serial=club[n].serial;
								ch[co].clan_rank=2;
								quiet_say(cn,"Congratulations, %s, you are now the leader of the club %s.",ch[co].name,club[n].name);
								dlog(co,0,"created club %d %s",n,club[n].name);
							} else quiet_say(cn,"Something's wrong with the name.");
						} else quiet_say(cn,"You cannot pay the fee of 10,000 gold.");
					} else quiet_say(cn,"You are already a member of a clan or club. You cannot found a new one.");
				}
				if ((ptr=strcasestr((char*)msg->dat2,"accept:"))) {
					if (!get_char_club(co) || ch[co].clan_rank<1) {
                                                quiet_say(cn,"You are not a club leader, %s.",ch[co].name);
					} else {
						ptr+=7;
						while (isspace(*ptr)) ptr++;
						for (n=0; n<79; n++) {
							if (!*ptr || *ptr=='"') break;
							dat->accept[n]=*ptr++;
						}
						dat->accept[n]=0;
						strcpy(dat->join,ch[co].name);
						dat->accept_clan=get_char_club(co);
						dat->accept_cn=co;

						quiet_say(cn,"To join %s's club %s, say: 'join: %s'",dat->join,dat->accept,dat->join);
					}
				}
				if ((ptr=strcasestr((char*)msg->dat2,"join:"))) {
					if (get_char_clan(co) || get_char_club(co)) {
                                                quiet_say(cn,"You are already a clan or club member, %s.",ch[co].name);
					} else {
						ptr+=5;
						while (isspace(*ptr)) ptr++;
						for (n=0; n<79; n++) {
							if (!*ptr || *ptr=='"') break;
							tmp[n]=*ptr++;
						}
						tmp[n]=0;
                                                if (strcasecmp(dat->accept,ch[co].name)) {
							quiet_say(cn,"You have not been invited, %s.",ch[co].name);
						} else if (strcasecmp(dat->join,tmp)) {
							quiet_say(cn,"%s has not invited you, %s.",tmp,ch[co].name);
						} else {
                                                        //add_member(co,dat->accept_clan,dat->join);
							ch[co].clan=dat->accept_clan+CLUBOFFSET;
							ch[co].clan_serial=club[dat->accept_clan].serial;
							ch[co].clan_rank=0;
							quiet_say(cn,"%s, you are now a member of %s's club.",ch[co].name,dat->join);
							dat->accept[0]=0;
							dat->accept_clan=0;
							dat->join[0]=0;
						}
						
					}
				}
				if ((ptr=strcasestr((char*)msg->dat2,"leave!"))) {
					if (!get_char_club(co)) {
                                                quiet_say(cn,"You are not a club member, %s.",ch[co].name);
					} else {
						remove_member(co,co);
						quiet_say(cn,"You are no longer a member of any club, %s",ch[co].name);
					}
				}
				if ((ptr=strcasestr((char*)msg->dat2,"rank:"))) {
					if (!get_char_club(co) || ch[co].clan_rank<2) {
                                                quiet_say(cn,"You are not a club founder, %s.",ch[co].name);
					} else {
						ptr+=6;
						while (isspace(*ptr)) ptr++;
						for (n=0; n<79; n++) {
							if (!*ptr || *ptr=='"' || isspace(*ptr)) break;
							tmp[n]=*ptr++;
						}
						tmp[n]=0;
						
						rank=atoi(ptr);

						if (rank<0 || rank>1) {
							quiet_say(cn,"You must use a rank between 0 and 1.");
							remove_message(cn,msg);
							continue;
						}

						for (cc=getfirst_char(); cc; cc=getnext_char(cc)) {
							if (!strcasecmp(tmp,ch[cc].name) && (ch[cc].flags&CF_PLAYER)) break;
						}
						if (cc) {
							if (!(ch[cc].flags&CF_PAID) && rank>0) {
                                                                quiet_say(cn,"%s is not a paying player, you cannot set the rank higher than 0.",ch[cc].name);
							} else if (ch[cc].clan_rank==2) {
								quiet_say(cn,"%s is the club's founder, cannot change rank.",ch[cc].name);
							} else if (get_char_club(cc)==get_char_club(co)) {
								ch[cc].clan_rank=rank;
								quiet_say(cn,"Set %s's rank to %d.",ch[cc].name,rank);
							} else quiet_say(cn,"You cannot change the rank of those not belonging to your club.");
						} else {
							int uID;

							uID=lookup_name(tmp,NULL);
							if (uID==0) continue;
							if (uID==-1) {
								quiet_say(cn,"Sorry, no player by the name %s found.",tmp);
							} else {
								task_set_clan_rank(uID,ch[co].ID,get_char_club(co)+CLUBOFFSET,rank,ch[co].name);
								quiet_say(cn,"Update scheduled (%s,%d).",tmp,rank);
							}
						}
					}
				}
				if ((ptr=strcasestr((char*)msg->dat2,"fire:"))) {
					if (!get_char_club(co) || ch[co].clan_rank<1) {
                                                quiet_say(cn,"You are not a club leader, %s.",ch[co].name);
					} else {
						ptr+=6;
						while (isspace(*ptr)) ptr++;
						for (n=0; n<79; n++) {
							if (!*ptr || *ptr=='"' || isspace(*ptr)) break;
							tmp[n]=*ptr++;
						}
						tmp[n]=0;
						
                                                for (cc=getfirst_char(); cc; cc=getnext_char(cc)) {
							if (!strcasecmp(tmp,ch[cc].name) && (ch[cc].flags&CF_PLAYER)) break;
						}
						if (cc) {
							if (get_char_club(cc)==get_char_club(co)) {
								if (ch[cc].clan_rank<2) {
									remove_member(cc,co);
									quiet_say(cn,"Fired: %s.",ch[cc].name);
								} else quiet_say(cn,"You cannot fire the founder of the club.");
							} else quiet_say(cn,"You cannot fire those not belonging to your club.");
						} else {
							int uID;

							uID=lookup_name(tmp,NULL);
							if (uID==0) continue;
							if (uID==-1) {
								quiet_say(cn,"Sorry, no player by the name %s found.",tmp);
							} else {
								task_fire_from_clan(uID,ch[co].ID,get_char_club(co)+CLUBOFFSET,ch[co].name);
								quiet_say(cn,"Update scheduled (%s).",tmp);
							}
						}
					}
				}

				if ((ptr=strcasestr((char*)msg->dat2,"deposit:"))) {
					if (!(n=get_char_club(co))) {
                                                quiet_say(cn,"You are not a club member, %s.",ch[co].name);
					} else {
						val=atoi(ptr+8)*100;

						if (val>0 && ch[co].gold>=val) {
							club[n].money+=val;
							take_money(co,val);
							quiet_say(cn,"You have deposited %dG, for a total of %dG, %s.",val/100,club[n].money/100,ch[co].name);
							dlog(co,0,"Deposited %dG into club %d, for a new total of %dG",val/100,n,club[n].money/100);
							db_update_club(n);
						} else quiet_say(cn,"You do not have that much gold, %s.",ch[co].name);
					}
				}
				if ((ptr=strcasestr((char*)msg->dat2,"withdraw:"))) {
					if (!(n=get_char_club(co)) || ch[co].clan_rank<2) {
                                                quiet_say(cn,"You are not a club founder, %s.",ch[co].name);
					} else {
						val=atoi(ptr+9)*100;

						if (val>0 && club[n].money>=val) {
							club[n].money-=val;
							give_money(co,val,"club withdrawal");
							quiet_say(cn,"You have withdrawn %dG, money left in club %dG, %s.",val/100,club[n].money/100,ch[co].name);
							dlog(co,0,"Withdrew %dG from club %d, for a new total of %dG",val/100,n,club[n].money/100);
							db_update_club(n);
						} else quiet_say(cn,"The club does not have that much gold, %s.",ch[co].name);
					}
				}
			}			
		}

		// got an item?
		if (msg->type==NT_GIVE) {
			co=msg->dat1;

                        if ((in=ch[cn].citem)) {	// we still have it
				// try to give it back
                                if (give_char_item(cn,co)) return;
				
				// didnt work, let it vanish, then
				destroy_item(ch[cn].citem);
				ch[cn].citem=0;
			}
		}
                remove_message(cn,msg);
	}

        // do something. whenever possible, call do_idle with as high a tick count
	// as reasonable when doing nothing.

	if (secure_move_driver(cn,ch[cn].tmpx,ch[cn].tmpy,dat->dir,ret,lastact)) return;

        if (ticker>dat->last_talk+TICKS*60 && !RANDOM(25)) {
		switch(RANDOM(8)) {
			case 0:		murmur(cn,"My back itches."); break;
			case 1:		whisper(cn,"There's something stuck between your teeth."); break;
			case 2:		murmur(cn,"Oh yeah, those were the days."); break;
			case 3:		murmur(cn,"Now where did I put it?"); break;
			case 4:		murmur(cn,"Oh my, life is hard but unfair."); break;
                        case 5:		murmur(cn,"Beware of the fire snails!"); break;
			case 6:         murmur(cn,"I love the clicking of coins."); break;
			case 7:		murmur(cn,"Gold and Silver, Silver and Gold."); break;
			default:	break;
		}
		
		dat->last_talk=ticker;
	}

	if (ticker>dat->memcleartimer) {
		mem_erase_driver(cn,7);
		dat->memcleartimer=ticker+TICKS*60*60*12;
	}

        do_idle(cn,TICKS*2);
}
Exemple #2
0
void merchant_driver(int cn,int ret,int lastact)
{
	struct merchant_driver_data *dat;
        int co,in,n;
	struct msg *msg,*next;

        dat=set_data(cn,DRD_MERCHANTDRIVER,sizeof(struct merchant_driver_data));
	if (!dat) return;	// oops...

        if (ch[cn].arg) {
		dat->open=6; dat->close=23;
		merchant_driver_parse(cn,dat);
		ch[cn].arg=NULL;
	}
	if (!ch[cn].store) {
		if (dat->pricemulti) create_store(cn,dat->ignore,dat->pricemulti);
		else create_store(cn,dat->ignore,400);
		if (dat->special) {
			for (n=0; n<5; n++) add_special_store(cn);
		}
	}
	
	// loop through our messages
	for (msg=ch[cn].msg; msg; msg=next) {
		next=msg->next;

                // did we see someone?
		if (msg->type==NT_CHAR) {
			
                        co=msg->dat1;

			// dont talk to someone we cant see, and dont talk to ourself
			if (!char_see_char(cn,co) || cn==co) { remove_message(cn,msg); continue; }

			// dont talk to someone far away
			if (char_dist(cn,co)>10) { remove_message(cn,msg); continue; }

			// dont talk to the same person twice
			if (mem_check_driver(cn,co,7)) { remove_message(cn,msg); continue; }

			quiet_say(cn,"Hello %s! If you'd like to trade, say: '°c4%s, trade°c0!",ch[co].name,ch[cn].name);
			mem_add_driver(cn,co,7);
		}

                // talk back
		if (msg->type==NT_TEXT) {
			analyse_text_driver(cn,msg->dat1,(char*)msg->dat2,msg->dat3);

			if ((msg->dat1==1 || msg->dat1==2) && (co=msg->dat3)!=cn) {	// talk, and not our talk
				if (strcasestr((char*)msg->dat2,ch[cn].name) &&
				    strcasestr((char*)msg->dat2,"trade")) {
					/*if (abuser(ch[co].ID)) {
						switch(RANDOM(3)) {
                                                        case 0:		murmur(cn,"I hate cheaters."); break;
							case 1:		emote(cn,"clenches his fists and stares at %s.",ch[co].name); break;
							case 2:		murmur(cn,"I wish the cheaters would leave me alone."); break;
						}
					}*/
					ch[co].merchant=cn;
				}
			}			
		}

		// got an item?
		if (msg->type==NT_GIVE) {
			co=msg->dat1;

                        if ((in=ch[cn].citem)) {	// we still have it
				// let it vanish
				destroy_item(ch[cn].citem);
				ch[cn].citem=0;
			}
		}

                remove_message(cn,msg);
	}

        // do something. whenever possible, call do_idle with as high a tick count
	// as reasonable when doing nothing.

	if (dat->dayx) {	// we have day / night positions
		if (!opening_time(dat->open,dat->close)) {	// we're closed
                        if (dat->doorx && !is_closed(dat->doorx,dat->doory)) {	// door is still open
				if (!is_room_empty(dat->storefx,dat->storefy,dat->storetx,dat->storety)) {	// store is not empty
					quiet_say(cn,"We're closing, please leave now!");
					do_idle(cn,TICKS);
					return;
				} else {
					if (use_item_at(cn,dat->doorx,dat->doory,0)) return;
					do_idle(cn,TICKS);
					return;
				}
			}
			if (secure_move_driver(cn,dat->nightx,dat->nighty,dat->nightdir,ret,lastact)) return;
		} else {	// we're open
                        if (dat->doorx && is_closed(dat->doorx,dat->doory)) {	// door is still closed
                                if (use_item_at(cn,dat->doorx,dat->doory,0)) return;
				do_idle(cn,TICKS);
				return;			
			}

			if (secure_move_driver(cn,dat->dayx,dat->dayy,dat->daydir,ret,lastact)) return;			
		}
	} else {		// just one position
		if (secure_move_driver(cn,ch[cn].tmpx,ch[cn].tmpy,dat->dir,ret,lastact)) return;		
	}

        if (ticker>dat->last_talk+TICKS*60 && !RANDOM(25)) {
		switch(RANDOM(11)) {
			case 0:		murmur(cn,"My back itches."); break;
			case 1:		whisper(cn,"There's something stuck between your teeth."); break;
			case 2:		murmur(cn,"Oh yeah, those were the days."); break;
			case 3:		murmur(cn,"Now where did I put it?"); break;
			case 4:		murmur(cn,"Oh my, life is hard but unfair."); break;
			case 5:		murmur(cn,"Beware of the fire snails!"); break;	
			case 6:		murmur(cn,"Ishtar! Oh, what has become of us!"); break;
			case 7:		murmur(cn,"The demons will get you."); break;
			case 8:		emote(cn,"scratches %s back",hisname(cn)); break;
			case 9:		if (map[ch[cn].x+ch[cn].y*MAXMAP].flags&MF_INDOORS) emote(cn,"stares at the ceiling");
					else emote(cn,"stares at the sky");
					break;
			case 10:	emote(cn,"twiddles %s thumbs",hisname(cn)); break;

			default:	break;
		}
		
		dat->last_talk=ticker;
	}
	if (dat->special && ticker>dat->lastadd+TICKS*60*60*12) {
		add_special_store(cn);
		dat->lastadd=ticker;
	}

	if (ticker>dat->memcleartimer) {
		mem_erase_driver(cn,7);
		dat->memcleartimer=ticker+TICKS*60*60*12;
	}

        do_idle(cn,TICKS*2);
}
void professor_driver(int cn,int ret,int lastact)
{
	struct professor_driver_data *dat;
        int co,in;
	struct msg *msg,*next;

        dat=set_data(cn,DRD_PROFDRIVER,sizeof(struct professor_driver_data));
	if (!dat) return;	// oops...

        if (ch[cn].arg) {
                professor_driver_parse(cn,dat);
		ch[cn].arg=NULL;
	}

	// loop through our messages
	for (msg=ch[cn].msg; msg; msg=next) {
		next=msg->next;

                // did we see someone?
		if (msg->type==NT_CHAR) {
			
                        co=msg->dat1;

			// dont talk to someone we cant see, and dont talk to ourself
			if (!char_see_char(cn,co) || cn==co) { remove_message(cn,msg); continue; }

			// dont offer to teach anyone not having the profession skill
			if (!ch[co].value[1][V_PROFESSION]) { remove_message(cn,msg); continue; }

			// dont talk to someone far away
			if (char_dist(cn,co)>10) { remove_message(cn,msg); continue; }

			// dont talk to the same person twice
			if (mem_check_driver(cn,co,7)) { remove_message(cn,msg); continue; }

			say(cn,"Hello %s! I am a professor at Aston University, and I °c4teach°c0 °c4%s°c0.",ch[co].name,prof[dat->nr].name);
			mem_add_driver(cn,co,7);
		}

                // talk back
		if (msg->type==NT_TEXT) {
			co=msg->dat3;
                        ret=analyse_text_driver(cn,msg->dat1,(char*)msg->dat2,co);
			switch(ret) {
				case 2:		switch(dat->quest) {
							case 0:		say(cn,"If thou wishest to learn the art of the %s, thou must pay %d gold coins and %d profession points. Say °c4learn°c0 if this is thy wish. Thou canst also °c4improve°c0 thy knowledge of this art for the fee of %d gold coins and %d profession points.",prof[dat->nr].name,dat->quest_option,prof[dat->nr].base,dat->improve_cost*prof[dat->nr].step,prof[dat->nr].step); break;
							default:	say(cn,"You've found bug #418a"); break;
						}
						break;
				case 3:		switch(dat->nr) {
							case P_ATHLETE:		say(cn,"The art of the athlete are fast, precise movements. Skilled athletes make better use of their endurance and move faster than untrained humans."); break;
							case P_ALCHEMIST:	say(cn,"The alchemist can create better potions, calling on the powers of the moons and the seasons at any time."); break;
							case P_MINER:		say(cn,"A skilled miner will make better use of every vein of precious metal he finds. He will also not exhaust as fast as an unskilled miner."); break;
							case P_ASSASSIN:	say(cn,"The assassin is especially skilled at attacking an enemy from the side or behind, and he can backstab an unware opponent from behind."); break;
							case P_THIEF:		say(cn,"A skilled thief can remain unseen even when next to another person. But when he uses this skill of stealth he cannot do anything but wait or walk, and the effort of remaining unseen will drain his endurance."); break;
							case P_LIGHT:		say(cn,"A master of light will receive a bonus to his basic abilities during the day. If he masters this skill he will also be able to see all undead creatures in the dark."); break;
							case P_DARK:		say(cn,"A master of dark will receive a bonus to his basic abilities during the night. If he masters this skill he will also be able to see all living creatures in the dark."); break;
							case P_TRADER:		say(cn,"A skilled trader will get better prices when dealing with merchants."); break;
							case P_MERCENARY:	say(cn,"Those skilled in the art of the mercenary will advance in military rank faster. They will also collect pay for their missions."); break;
							case P_CLAN:		say(cn,"A clan master has received special training in the art of clan warfare. He will be at an advantage in any fight in the clan catacombs."); break;
							case P_HERBALIST:	say(cn,"A herbalist knows the art of making plants ripe faster. Any flower, berry or mushroom he picks will grow back in less time."); break;

							default: 		say(cn,"You've found bug #418b"); break;
						}
						break;
				case 4:		switch(dat->quest) {
							case 0:		if (ch[co].gold<dat->quest_option*100) { say(cn,"But thou cannot afford my fee of %dG.",dat->quest_option); break; }
									if (!learn_prof(cn,co,dat->nr)) break;
									ch[co].gold-=dat->quest_option*100;
									ch[co].flags|=CF_ITEMS;
									break;
							default:	say(cn,"You've found bug #418a"); break;
						}
						break;
				case 5:		if (ch[co].gold<dat->improve_cost*prof[dat->nr].step*100) { say(cn,"But thou cannot afford my fee of %dG.",dat->improve_cost*prof[dat->nr].step); break; }
						if (!improve_prof(cn,co,dat->nr)) break;
						ch[co].gold-=dat->improve_cost*prof[dat->nr].step*100;
						ch[co].flags|=CF_ITEMS;
                                                break;
			}

		}

		// got an item?
		if (msg->type==NT_GIVE) {
			co=msg->dat1;

                        if ((in=ch[cn].citem)) {	// we still have it
				// let it vanish
				destroy_item(ch[cn].citem);
				ch[cn].citem=0;
			}
		}

                remove_message(cn,msg);
	}

        // do something. whenever possible, call do_idle with as high a tick count
	// as reasonable when doing nothing.

        if (secure_move_driver(cn,ch[cn].tmpx,ch[cn].tmpy,dat->dir,ret,lastact)) return;		

        do_idle(cn,TICKS);
}
Exemple #4
0
void warpmaster(int cn,int ret,int lastact)
{
    int co,in,type,in2,flag=0,code,n;
    struct msg *msg,*next;
    struct warped_ppd *ppd;

    // loop through our messages
    for (msg=ch[cn].msg; msg; msg=next) {
        next=msg->next;

        // did we see someone?
        if (msg->type==NT_CHAR) {
            co=msg->dat1;

            // dont talk to someone we cant see, and dont talk to ourself
            if (!char_see_char(cn,co) || cn==co) {
                remove_message(cn,msg);
                continue;
            }

            // dont talk to someone far away
            if (char_dist(cn,co)>10) {
                remove_message(cn,msg);
                continue;
            }

            // dont talk to the same person twice
            if (mem_check_driver(cn,co,7)) {
                remove_message(cn,msg);
                continue;
            }

            if (ch[co].level<30) say(cn,"Hello %s! You'd better leave this area - it is too dangerous for you.",ch[co].name);
            else say(cn,"Hello %s! Welcome to Rodney's °c4Warped World°c0! Would you like to buy some °c4keys°c0?",ch[co].name);
            mem_add_driver(cn,co,7);
        }

        // talk back
        if (msg->type==NT_TEXT) {
            co=msg->dat3;

            if (!(ch[co].flags&CF_PLAYER)) {
                remove_message(cn,msg);
                continue;
            }

            code=analyse_text_driver(cn,msg->dat1,(char*)msg->dat2,co);
            if (code==2 && (ppd=set_data(co,DRD_WARP_PPD,sizeof(struct warped_ppd)))) {	// reset
                ppd->points=0;
                for (n=0; n<MAXWARPBONUS; n++) ppd->bonuslast_used[n]=0;
                ppd->nostepexp=1;
                say(cn,"Done.");
            }
        }

        // got an item?
        if (msg->type==NT_GIVE) {
            co=msg->dat1;

            if ((in=ch[cn].citem)) {

                type=it[in].drdata[0];
                if (it[in].ID==IID_ALCHEMY_INGREDIENT) {
                    if (type==23) {
                        in2=create_item("warped_door_key");
                        if (give_char_item(co,in2)) flag=1;
                        else destroy_item(in2);
                        say(cn,"Here you go, one key.");
                    }
                    if (type==21) {
                        in2=create_item("warped_door_key");
                        if (give_char_item(co,in2)) flag=1;
                        else destroy_item(in2);
                        in2=create_item("warped_door_key");
                        if (give_char_item(co,in2)) flag=1;
                        else destroy_item(in2);
                        say(cn,"Here you go, two keys.");

                    }
                    if (type==22) {
                        in2=create_item("warped_door_key");
                        if (give_char_item(co,in2)) flag=1;
                        else destroy_item(in2);
                        in2=create_item("warped_door_key");
                        if (give_char_item(co,in2)) flag=1;
                        else destroy_item(in2);
                        in2=create_item("warped_door_key");
                        if (give_char_item(co,in2)) flag=1;
                        else destroy_item(in2);
                        say(cn,"Here you go, three keys.");
                    }
                    if (type==24) {
                        in2=create_item("warped_door_key");
                        if (give_char_item(co,in2)) flag=1;
                        else destroy_item(in2);
                        in2=create_item("warped_door_key");
                        if (give_char_item(co,in2)) flag=1;
                        else destroy_item(in2);
                        in2=create_item("warped_door_key");
                        if (give_char_item(co,in2)) flag=1;
                        else destroy_item(in2);
                        in2=create_item("warped_door_key");
                        if (give_char_item(co,in2)) flag=1;
                        else destroy_item(in2);
                        say(cn,"Here you go, four keys.");
                    }
                }
                if (flag || !give_char_item(co,in)) {
                    destroy_item(ch[cn].citem);
                }
                ch[cn].citem=0;
            }
        }

        remove_message(cn,msg);
    }
    // do something. whenever possible, call do_idle with as high a tick count
    // as reasonable when doing nothing.

    if (spell_self_driver(cn)) return;

    if (secure_move_driver(cn,ch[cn].tmpx,ch[cn].tmpy,DX_RIGHT,ret,lastact)) return;

    if (ticker%345600==0) {
        mem_erase_driver(cn,7);
    }

    do_idle(cn,TICKS);
}