void meltingkey(int in,int cn) { int sprite; if (cn) return; if (!it[in].carried) return; // can only use if item is carried it[in].drdata[1]++; if (it[in].drdata[1]>=it[in].drdata[0]) { if (it[in].carried) log_char(it[in].carried,LOG_SYSTEM,0,"Your %s melted away.",it[in].name); if (ch[cn].flags&CF_PLAYER) dlog(cn,in,"dropped because it melted"); remove_item(in); destroy_item(in); return; } sprite=50494+it[in].drdata[1]*5/it[in].drdata[0]; if (it[in].sprite!=sprite) { it[in].sprite=sprite; if (it[in].carried) { ch[it[in].carried].flags|=CF_ITEMS; if (sprite==50495) { log_char(it[in].carried,LOG_SYSTEM,0,"Your %s starts to melt.",it[in].name); } } } call_item(it[in].driver,in,0,ticker+TICKS*10); }
void check_military_silver(int cn,int amount) { struct military_ppd *ppd; int nr; if (!(ch[cn].flags&CF_PLAYER)) return; if (!(ppd=set_data(cn,DRD_MILITARY_PPD,sizeof(struct military_ppd)))) return; if (ppd->took_mission && !ppd->solved_mission) { nr=ppd->took_mission-1; switch(ppd->mis[nr].type) { case 3: if (amount<ppd->mis[nr].opt1) { ppd->mis[nr].opt1-=amount; log_char(cn,LOG_SYSTEM,0,"You fulfilled part of your mission, you still need %d silver.",ppd->mis[nr].opt1); } else { log_char(cn,LOG_SYSTEM,0,"You solved your mission. Talk to the governor to claim you reward."); ppd->solved_mission=1; ppd->mis[nr].opt1=0; } break; } } }
void warpkeyspawn_driver(int in,int cn) { int in2; char buf[80]; if (!cn) return; if (ch[cn].citem) { log_char(cn,LOG_SYSTEM,0,"Please empty your hand (mouse cursor) first."); return; } sprintf(buf,"warped_teleport_key%d",it[in].drdata[0]); in2=create_item(buf); if (!in2) { log_char(cn,LOG_SYSTEM,0,"It won't come off."); return; } ch[cn].citem=in2; it[in2].carried=cn; ch[cn].flags|=CF_ITEMS; log_char(cn,LOG_SYSTEM,0,"You got a glowing half sphere."); }
void join_chat(int cn,int nr) { unsigned int bit; if (nr<1 || nr>32) { log_char(cn,LOG_SYSTEM,0,"Channel number must be between 1 and 32."); return; } bit=1<<(nr-1); if (ch[cn].channel&bit) { log_char(cn,LOG_SYSTEM,0,"You have already joined channel %d (%s).",nr,cname[nr].name); return; } if (nr==31 && !(ch[cn].flags&(CF_STAFF|CF_GOD))) { log_char(cn,LOG_SYSTEM,0,"Permission denied to join channel %d (%s).",nr,cname[nr].name); return; } if (nr==32 && !(ch[cn].flags&CF_GOD)) { log_char(cn,LOG_SYSTEM,0,"Permission denied to join channel %d (%s).",nr,cname[nr].name); return; } ch[cn].channel|=bit; log_char(cn,LOG_SYSTEM,0,"You have joined channel %d (%s).",nr,cname[nr].name); }
int cmd_clanlog(int cn,char *ptr) { int coID=0,clan=0,serial=0,prio=20,start=0,end=0,repeat=0; while (*ptr) { if (isspace(*ptr)) { ptr++; continue; } if (*ptr!='-') { clanlog_help(cn); return 1; } ptr++; switch(*ptr) { case 'p': ptr=clanlog_player(cn,ptr+1,&coID,&repeat); if (!ptr) return 1; if (repeat) return 0; break; case 'c': ptr=clanlog_clan(cn,ptr+1,&clan,&serial); if (!ptr) return 1; break; case 'x': ptr=clanlog_prio(cn,ptr+1,&prio); if (!ptr) return 1; break; case 's': ptr=clanlog_hours(cn,ptr+1,&start); if (!ptr) return 1; break; case 'e': ptr=clanlog_hours(cn,ptr+1,&end); if (!ptr) return 1; break; case 'i': ptr++; prio=50; clan=ch[cn].clan; break; default: case 'h': clanlog_help(cn); return 1; } } if (!start) start=time_now-60*60*24; if (!end) end=time_now; if (start>end) { log_char(cn,LOG_SYSTEM,0,"Start time may not be greater than end time."); return 1; } if (prio>20) { if (!ch[cn].clan) { log_char(cn,LOG_SYSTEM,0,"Only clan members may set a priority greater than 20."); return 1; } if (clan!=ch[cn].clan) { clan=ch[cn].clan; log_char(cn,LOG_SYSTEM,0,"Changed clan to %d.",clan); } } lookup_clanlog(ch[cn].ID,clan,serial,coID,prio,start,end); return 1; }
static void usb_send(int n) { int max_pkt_size, len; int i; unsigned char *p; #ifdef LCD_DEBUG if (endpoints[n].halt[DIR_TX]) log_char('H'); if (!endpoints[n].out_in_progress) log_char('$'); #endif if (endpoints[n].halt[DIR_TX] || !endpoints[n].enabled[DIR_TX] || !endpoints[n].out_in_progress) return; if (endpoints[n].out_ptr < 0) { endpoints[n].out_in_progress = 0; if (endpoints[n].out_done) (*(endpoints[n].out_done))(n, endpoints[n].out_buf, endpoints[n].out_len); return; } if (usb_out_buffer_full(n)) { log_char('F'); return; } usb_select_endpoint(ep_index(n, DIR_TX)); max_pkt_size = endpoints[n].max_pkt_size[DIR_TX]; len = endpoints[n].out_len - endpoints[n].out_ptr; if (len > max_pkt_size) len = max_pkt_size; log_char('0' + (len % 10)); ISP1582_BUFLEN = len; p = endpoints[n].out_buf + endpoints[n].out_ptr; i = 0; while (len - i >= 2) { ISP1582_DATA = p[i] | (p[i + 1] << 8); i += 2; } if (i < len) ISP1582_DATA = p[i]; endpoints[n].out_ptr += len; /* if (endpoints[n].out_ptr == endpoints[n].out_len && len < max_pkt_size) */ if (endpoints[n].out_ptr == endpoints[n].out_len) endpoints[n].out_ptr = -1; }
void itemspawn(int in,int cn) { int in2; if (!cn) return; // always make sure its not an automatic call if you don't handle it if (ch[cn].citem) { log_char(cn,LOG_SYSTEM,0,"Please empty your 'hand' (mouse cursor) first."); return; } // get item to spawn switch(it[in].drdata[0]) { case 0: in2=create_item("melting_key"); break; case 1: in2=create_item("ice_boots1"); break; case 2: in2=create_item("ice_cape1"); break; case 3: in2=create_item("ice_belt1"); break; case 4: in2=create_item("ice_ring1"); break; case 5: in2=create_item("ice_amulet1"); break; case 6: in2=create_item("melting_key2"); break; case 7: in2=create_item("ice_boots2"); break; case 8: in2=create_item("ice_cape2"); break; case 9: in2=create_item("ice_belt2"); break; case 10: in2=create_item("ice_ring2"); break; case 11: in2=create_item("ice_amulet2"); break; case 12: in2=create_item("ice_boots3"); break; case 13: in2=create_item("ice_cape3"); break; case 14: in2=create_item("ice_belt3"); break; case 15: in2=create_item("ice_ring3"); break; case 16: in2=create_item("ice_amulet3"); break; case 17: in2=create_item("palace_bomb"); break; case 18: in2=create_item("palace_cap"); break; default: log_char(cn,LOG_SYSTEM,0,"Congratulations, %s, you have just discovered bug #4244B-%d-%d, please report it to the authorities!",ch[cn].name,it[in].x,it[in].y); return; } if (!in2) { log_char(cn,LOG_SYSTEM,0,"Congratulations, %s, you have just discovered bug #4244C-%d-%d, please report it to the authorities!",ch[cn].name,it[in].x,it[in].y); return; } if (!can_carry(cn,in2,0)) { destroy_item(in2); return; } if (ch[cn].flags&CF_PLAYER) dlog(cn,in2,"took from ice itemspawn"); ch[cn].citem=in2; ch[cn].flags|=CF_ITEMS; it[in2].carried=cn; log_char(cn,LOG_SYSTEM,0,"You got a %s.",it[in2].name); }
void edemonloader_driver(int in,int cn) { int nr,pwr,sprite,in2,ani,m,gsprite; nr=it[in].drdata[0]; // section number pwr=it[in].drdata[1]; // power status ani=it[in].drdata[2]; if (cn) { // player using item if (pwr) { if (ch[cn].citem) log_char(cn,LOG_SYSTEM,0,"There is already a crystal, you cannot add another item."); else log_char(cn,LOG_SYSTEM,0,"The crystal is stuck."); return; } if (!(in2=ch[cn].citem)) { log_char(cn,LOG_SYSTEM,0,"Nothing happens."); return; } if (it[in2].ID!=IID_AREA6_YELLOWCRYSTAL) { log_char(cn,LOG_SYSTEM,0,"That doesn't fit."); return; } pwr=it[in2].drdata[0]; ani=7; if (ch[cn].flags&CF_PLAYER) dlog(cn,in2,"dropped into edemonloader"); ch[cn].citem=0; ch[cn].flags|=CF_ITEMS; destroy_item(in2); sound_area(it[in].x,it[in].y,41); } else { // timer call if (pwr) pwr--; if (ani) ani--; call_item(it[in].driver,in,0,ticker+TICKS); } it[in].drdata[2]=ani; it[in].drdata[1]=pwr; m=it[in].x+it[in].y*MAXMAP; gsprite=map[m].gsprite&0x0000ffff; if (ani) gsprite|=(14247-ani)<<16; else if (pwr) gsprite|=14248<<16; else gsprite|=14240<<16; if (pwr) { sprite=14257+5-(pwr/43); sect[nr]=pwr; } //50467 else { sprite=14234; sect[nr]=0; } // 50466; if (it[in].sprite!=sprite || map[m].gsprite!=gsprite) { it[in].sprite=sprite; map[m].gsprite=gsprite; set_sector(it[in].x,it[in].y); if (sprite==14234) sound_area(it[in].x,it[in].y,43); // power off } }
void warpteleport_driver(int in,int cn) { int in2,target,n,flag=0; if (!cn) return; if (!it[in].drdata[0]) { switch(it[in].drdata[1]) { case 1: flag=teleport_char_driver(cn,242,252); break; case 2: flag=teleport_char_driver(cn,247,66); break; case 3: flag=teleport_char_driver(cn,251,16); break; case 4: flag=teleport_char_driver(cn,152,7); break; case 5: flag=teleport_char_driver(cn,183,250); break; default: log_char(cn,LOG_SYSTEM,0,"You found BUG #31as5."); } if (!flag) log_char(cn,LOG_SYSTEM,0,"Target is busy, please try again soon."); return; } if (!(in2=ch[cn].citem) || it[in2].ID!=IID_AREA25_TELEKEY) { log_char(cn,LOG_SYSTEM,0,"Nothing happened."); return; } target=(it[in].drdata[0]-1)*5+(it[in2].drdata[0]-1); //log_char(cn,LOG_SYSTEM,0,"target=%d",target); if (teleport_char_driver(cn,tl[target].x,tl[target].y)) { ch[cn].citem=0; ch[cn].flags|=CF_ITEMS; destroy_item(in2); flag++; for (n=0; n<INVENTORYSIZE; n++) { if ((in2=ch[cn].item[n]) && it[in2].ID==IID_AREA25_TELEKEY) { remove_item_char(in2); destroy_item(in2); flag++; } } if (flag) log_char(cn,LOG_SYSTEM,0,"Your sphere%s vanished.",flag>0 ? "s" : ""); } }
void clanlog_help(int cn) { log_char(cn,LOG_SYSTEM,0,"Usage: /clanlog [-p player] [-c clan] [-x prio] [-s starttime] [-e endtime]"); log_char(cn,LOG_SYSTEM,0,"-p <player name>: restrict output to entries about that player"); log_char(cn,LOG_SYSTEM,0,"-c <clan number>: restrict output to entries about that clan"); log_char(cn,LOG_SYSTEM,0,"-x <prio number>: restrict output to entries with prio or higher (1=highest prio, 100=lowest prio)"); log_char(cn,LOG_SYSTEM,0,"-s <hours>: restrict output to entries not more then hours old"); log_char(cn,LOG_SYSTEM,0,"-e <hours>: restrict output to entries at least hours old"); log_char(cn,LOG_SYSTEM,0,"-i: show clan internal log (same as -x 50 -c <own clan>)"); log_char(cn,LOG_SYSTEM,0,"Example: /clanlog -p Ishtar -c 4 -x 5 -s 48 -e 24"); log_char(cn,LOG_SYSTEM,0,"If no times are specified, /clanlog will use the last 24 hours. If no priority is given, it will be set to 20."); log_char(cn,LOG_SYSTEM,0,"If you specify a priority higher than 20, output will be restricted to your clan."); }
void pick_berry(int in,int cn) { int ID,n,old_n=0,old_val=0,in2,ripetime; struct flower_ppd *ppd; if (!cn) return; if (ch[cn].citem) { log_char(cn,LOG_SYSTEM,0,"Please empty your hand (mouse cursor) first."); return; } ppd=set_data(cn,DRD_FLOWER_PPD,sizeof(struct flower_ppd)); if (!ppd) return; // oops... ID=(int)it[in].x+((int)(it[in].y)<<8)+(areaID<<16); for (n=0; n<MAXFLOWER; n++) { if (ppd->ID[n]==ID) break; if (realtime-ppd->last_used[n]>old_val) { old_val=realtime-ppd->last_used[n]; old_n=n; } } ripetime=60*60*24; if (n==MAXFLOWER) n=old_n; else if (realtime-ppd->last_used[n]<ripetime) { log_char(cn,LOG_SYSTEM,0,"It's not ripe yet."); return; } ppd->ID[n]=ID; ppd->last_used[n]=realtime; switch(it[in].drdata[0]) { case 1: in2=create_item("lizard_brown_berry"); break; case 2: in2=create_item("picked_flower_h"); break; case 3: in2=create_item("picked_flower_i"); break; case 4: in2=create_item("picked_flower_j"); break; default: log_char(cn,LOG_SYSTEM,0,"Bug # 4111c"); return; } if (ch[cn].flags&CF_PLAYER) dlog(cn,in2,"berry/flower: picked"); ch[cn].citem=in2; ch[cn].flags|=CF_ITEMS; it[in2].carried=cn; }
void keyholder_door(int in,int cn) { int x,y,n,in2,flag,co,nr; char buf[80]; if (!cn) return; nr=it[in].drdata[0]; for (n=0; n<9; n++) { flag=0; for (x=2+(n%3)*8; x<9+(n%3)*8; x++) { for (y=231+(n/3)*8; y<238+(n/3)*8; y++) { if ((in2=map[x+y*MAXMAP].it) && (it[in2].flags&IF_TAKE)) { flag=1; break; } if (map[x+y*MAXMAP].ch) { flag=1; break; } } } if (!flag) break; } if (flag) { log_char(cn,LOG_SYSTEM,0,"You hear fighting noises from behind the door. It won't open while the fight lasts."); return; } if (!(in2=ch[cn].citem) || it[in2].driver!=IDR_ENHANCE || it[in2].drdata[0]!=2 || *(unsigned int*)(it[in2].drdata+1)!=2000) { log_char(cn,LOG_SYSTEM,0,"You'll need to use 2000 gold units as a key to open the door."); return; } if (!teleport_char_driver(cn,2+(n%3)*8+1,231+(n/3)*8+3)) { log_char(cn,LOG_SYSTEM,0,"You hear fighting noises from behind the door. It won't open while the fight lasts."); return; } destroy_item(in2); ch[cn].citem=0; ch[cn].flags|=CF_ITEMS; sprintf(buf,"keyholder_golem%d",nr); co=create_char(buf,0); if (co) { update_char(co); ch[co].hp=ch[co].value[0][V_HP]*POWERSCALE; ch[co].endurance=ch[co].value[0][V_ENDURANCE]*POWERSCALE; ch[co].mana=ch[co].value[0][V_MANA]*POWERSCALE; ch[co].dir=DX_LEFTUP; ch[co].tmpx=2+(n%3)*8+5; ch[co].tmpy=231+(n/3)*8+3; drop_char(co,2+(n%3)*8+5,231+(n/3)*8+3,1); } }
int use_item(int cn,int in) { int ct; if (cn<1 || cn>=MAXCHARS) { error=ERR_ILLEGAL_CHARNO; return 0; } if (in<1 || in>=MAXITEM) { error=ERR_ILLEGAL_ITEMNO; return 0; } if (ch[cn].flags&(CF_DEAD)) { error=ERR_DEAD; return 0; } if ((ct=it[in].content)) { if (ct<1 || ct>=MAXCONTAINER) { elog("item %s (%d) has illegal container %d. resetting.",it[in].name,in,ct); it[in].content=0; error=ERR_CONFUSED; return 0; } if (con[ct].owner && charID(cn)!=con[ct].owner && charID(cn)!=con[ct].killer && charID(cn)!=con[ct].access) { // access denied error=ERR_ACCESS_DENIED; log_char(cn,LOG_SYSTEM,0,"Permission denied."); return 0; } ch[cn].con_in=in; return 1; } if (it[in].flags&IF_DEPOT) { ch[cn].con_in=in; return 1; } return item_driver(it[in].driver,in,cn); }
static char *clanlog_player(int cn,char *ptr,int *pID,int *prepeat) { char name[80]; int len,ID; while (isspace(*ptr)) ptr++; for (len=0; len<75; len++) { if (!*ptr || isspace(*ptr)) break; name[len]=*ptr++; } if (len<1 || len>70) { log_char(cn,LOG_SYSTEM,0,"Invalid name"); return NULL; } name[len]=0; ID=lookup_name(name,NULL); if (!ID) { if (prepeat) *prepeat=1; } else { if (prepeat) *prepeat=0; if (pID) *pID=ID; } return ptr; }
void minegateway(int in,int cn) { int x,y,a; if (!cn) return; // always make sure its not an automatic call if you don't handle it if (!(ch[cn].flags&CF_PLAYER)) return; if (!has_item(cn,IID_MINEGATEWAY)) { log_char(cn,LOG_SYSTEM,0,"The door won't open. You notice an inscription: \"This door leads to the Dwarven town Grimroot. Only those who have proven their abilities as miners and fighters may enter."); return; } x=*(unsigned short*)(it[in].drdata+0); y=*(unsigned short*)(it[in].drdata+2); a=*(unsigned short*)(it[in].drdata+4); if (x<1 || x>MAXMAP-2 || y<1 || y>MAXMAP-2 || !a) { log_area(ch[cn].x,ch[cn].y,LOG_INFO,cn,10,"%s touches a teleport object but nothing happens - BUG (%d,%d,%d).",ch[cn].name,x,y,a); return; } if (!change_area(cn,a,x,y)) { log_area(ch[cn].x,ch[cn].y,LOG_INFO,cn,10,"%s touches a teleport object but nothing happens - target area server is down.",ch[cn].name); } }
void edemonswitch_driver(int in,int cn) { if (!cn) { if (fire) return; if (ticker>pause_till) { remove_item_light(in); fire=1; it[in].sprite--; it[in].mod_value[0]=64; add_item_light(in); } return; } if (!fire) { log_char(cn,LOG_SYSTEM,0,"The lever seems stuck."); return; } remove_item_light(in); fire=0; it[in].sprite++; it[in].mod_value[0]=0; pause_till=ticker+TICKS*60*5; add_item_light(in); call_item(it[in].driver,in,0,pause_till+1); }
static void voice_handle_touchtone_dle(int byte) { switch (byte) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '*': case '#': case 'A': case 'B': case 'C': case 'D': voice_handle_touchtone(byte); break; default: log_line(L_ERROR, "Illeagal \"<DLE>\" shielded code \""); log_char(L_ERROR, byte); log_text(L_ERROR, "\" (ignored)...\n"); break; } }
void edemonblock_driver(int in,int cn) { int m,m2,dx,dy,dir,nr; if (cn) { // player using item m=it[in].x+it[in].y*MAXMAP; dir=ch[cn].dir; dx2offset(dir,&dx,&dy,NULL); m2=(it[in].x+dx)+(it[in].y+dy)*MAXMAP; if ((map[m2].flags&(MF_MOVEBLOCK|MF_TMOVEBLOCK)) || map[m2].it || map[m2].gsprite<12150 || map[m2].gsprite>12158) { log_char(cn,LOG_SYSTEM,0,"It won't move."); return; } map[m].flags&=~MF_TMOVEBLOCK; map[m].it=0; set_sector(it[in].x,it[in].y); map[m2].flags|=MF_TMOVEBLOCK; map[m2].it=in; it[in].x+=dx; it[in].y+=dy; set_sector(it[in].x,it[in].y); // hack to avoid using the chest over and over if ((nr=ch[cn].player)) { player_driver_halt(nr); } *(unsigned int*)(it[in].drdata)=ticker; return; } else { // timer call if (!(*(unsigned int*)(it[in].drdata+4))) { // no coords set, so its first call. remember coords *(unsigned short*)(it[in].drdata+4)=it[in].x; *(unsigned short*)(it[in].drdata+6)=it[in].y; } // if 15 minutes have passed without anyone touching the chest, beam it back. if (ticker-*(unsigned int*)(it[in].drdata)>TICKS*60*15 && (*(unsigned short*)(it[in].drdata+4)!=it[in].x || *(unsigned short*)(it[in].drdata+6)!=it[in].y)) { m=it[in].x+it[in].y*MAXMAP; m2=(*(unsigned short*)(it[in].drdata+4))+(*(unsigned short*)(it[in].drdata+6))*MAXMAP; if (!(map[m2].flags&(MF_MOVEBLOCK|MF_TMOVEBLOCK)) && !map[m2].it) { map[m].flags&=~MF_TMOVEBLOCK; map[m].it=0; set_sector(it[in].x,it[in].y); map[m2].flags|=MF_TMOVEBLOCK; map[m2].it=in; it[in].x=*(unsigned short*)(it[in].drdata+4); it[in].y=*(unsigned short*)(it[in].drdata+6); set_sector(it[in].x,it[in].y); } } call_item(it[in].driver,in,0,ticker+TICKS*5); } }
/* * Put a string to the log line. */ static void log_str(const char *s) { int i; for (i = 0; i < strnlen(s, LOG_LINE_SIZE); i++) log_char(s[i]); }
void robberboss_dead(int cn,int co) { struct staffer_ppd *ppd; if (!co) return; if (!(ch[co].flags&CF_PLAYER)) return; if (!(ppd=set_data(co,DRD_STAFFER_PPD,sizeof(struct staffer_ppd)))) return; if (ppd->broklin_state>=5 && ppd->broklin_state<=10) { ppd->broklin_state=11; log_char(co,LOG_SYSTEM,0,"Well done. You've killed the head robber! Now go see Broklin..."); questlog_done(co,46); destroy_item_byID(co,IID_STAFF_BOSSMASTER); destroy_item_byID(co,IID_STAFF_BOSSLAIR); destroy_item_byID(co,IID_STAFF_ROBBERKEY1); destroy_item_byID(co,IID_STAFF_ROBBERKEY2); destroy_item_byID(co,IID_STAFF_ROBBERKEY3); destroy_item_byID(co,IID_STAFF_ROBBERKEY4); destroy_item_byID(co,IID_STAFF_ROBBERKEY5); destroy_item_byID(co,IID_STAFF_ROBBERKEY6); destroy_item_byID(co,IID_STAFF_ROBBERKEY7); destroy_item_byID(co,IID_STAFF_ROBBERKEY8); } }
int do_give(int cn,int dir) { int m,x,y,co,in; struct misc_ppd *ppd; if (cn<1 || cn>=MAXCHARS) { error=ERR_ILLEGAL_CHARNO; return 0; } if (ch[cn].flags&(CF_DEAD)) { error=ERR_DEAD; return 0; } if (!(in=ch[cn].citem)) { error=ERR_NO_CITEM; return 0; } if (in<1 || in>=MAXITEM) { elog("do_give(): item number %d in citem of %s (%d) is out of bounds.",in,ch[cn].name,cn); ch[cn].citem=0; error=ERR_CONFUSED; return 0; } if (!dx2offset(dir,&x,&y,NULL)) { error=ERR_ILLEGAL_DIR; return 0; } x+=ch[cn].x; y+=ch[cn].y; if (x<1 || x>=MAXMAP || y<1 || y>=MAXMAP) { error=ERR_ILLEGAL_COORDS; return 0; } m=x+y*MAXMAP; if (!(co=map[m].ch)) { error=ERR_NO_CHAR; return 0; } if (ch[co].flags&CF_DEAD) { error=ERR_DEAD; return 0; } if (ch[co].flags&CF_NOGIVE) { error=ERR_QUESTITEM; return 0; } if ((it[in].flags&IF_QUEST) && !(ch[co].flags&(CF_QUESTITEM|CF_GOD)) && !(ch[cn].flags&(CF_QUESTITEM|CF_GOD))) { error=ERR_QUESTITEM; return 0; } if ((it[in].flags&IF_BONDTAKE) && ((ch[cn].flags&CF_GOD) || (ch[co].flags&CF_GOD))) { it[in].ownerID=ch[co].ID; } if (!can_carry(co,in,1)) return 0; if ((ch[co].flags&CF_PLAYER) && ch[co].citem && cnt_free_inv(co)<1) { error=ERR_BLOCKED; return 0; } if (!(ch[co].flags&CF_PLAYER) && ch[co].citem) { error=ERR_BLOCKED; return 0; } if ((ch[cn].flags&CF_PLAYER) && (ch[co].flags&CF_PLAYER) && (ppd=set_data(co,DRD_MISC_PPD,sizeof(struct misc_ppd))) && realtime-ppd->swapped<20) { log_char(cn,LOG_SYSTEM,0,"°c3Give canceled: Your target has swapped recently."); error=ERR_ACCESS_DENIED; return 0; } ch[cn].action=AC_GIVE; ch[cn].act1=co; ch[cn].duration=speed(ch[cn].value[0][V_SPEED],ch[cn].speed_mode,DUR_MISC_ACTION); if (ch[cn].speed_mode==SM_FAST) ch[cn].endurance-=end_cost(cn); ch[cn].dir=dir; return 1; }
void list_chat(int cn) { int n; for (n=0; n<33; n++) { if (cname[n].name) log_char(cn,LOG_SYSTEM,0,"%2d: %-10.10s - %s",n,cname[n].name,cname[n].desc); } }
int warpkeydoor_driver(int in,int cn) { int in2,dx,dy; if (!cn) return 1; dx=it[in].x-ch[cn].x; dy=it[in].y-ch[cn].y; if (!dx && !dy) { log_char(cn,LOG_SYSTEM,0,"Bug #329i, sorry."); return 2; } in2=has_item(cn,IID_AREA25_DOORKEY); if (!in2) { log_char(cn,LOG_SYSTEM,0,"The door is locked and you do not have the right key."); return 2; } if (teleport_char_driver(cn,it[in].x+dx,it[in].y+dy)) { log_char(cn,LOG_SYSTEM,0,"A %s vanished.",it[in2].name); remove_item_char(in2); destroy_item(in2); switch(ch[cn].dir) { case DX_RIGHT: ch[cn].dir=DX_LEFT; break; case DX_LEFT: ch[cn].dir=DX_RIGHT; break; case DX_UP: ch[cn].dir=DX_DOWN; break; case DX_DOWN: ch[cn].dir=DX_UP; break; } return 1; } else { log_char(cn,LOG_SYSTEM,0,"Oops. Please try again."); return 2; } }
void warmfire(int in,int cn) { int in2,fn,n; if (!cn) return; if (ch[cn].citem) { log_char(cn,LOG_SYSTEM,0,"Please empty your 'hand' (mouse cursor) first."); return; } if (!it[in].drdata[0]) { in2=create_item("ice_scroll"); if (in2) { if (ch[cn].flags&CF_PLAYER) dlog(cn,in2,"took from warmfire"); ch[cn].citem=in2; it[in2].carried=cn; ch[cn].flags|=CF_ITEMS; it[in2].drdata[0]=ch[cn].x; it[in2].drdata[1]=ch[cn].y; log_char(cn,LOG_SYSTEM,0,"Next to the fire, you find an ancient scroll. It seems to be a scroll of teleport which will take you back here."); } } for (n=12; n<30; n++) { if ((in2=ch[cn].item[n]) && it[in2].driver==IDR_CURSE) { destroy_item(in2); ch[cn].item[n]=0; break; } } if (n==30) { log_char(cn,LOG_SYSTEM,0,"You warm your hands on the fire."); return; } for (n=0; n<4; n++) { if ((fn=ch[cn].ef[n]) && ef[fn].type==EF_CURSE) { remove_effect_char(fn); free_effect(fn); } } update_char(cn); log_char(cn,LOG_SYSTEM,0,"You move close to the heat of the fire, and you feel the demon's cold leave you."); }
void secure_log(int cc,int co,char *what) { if (!(ch[cc].flags&CF_USED)) return; if (!(ch[cc].flags&CF_PLAYER)) return; if (!(ch[co].flags&CF_USED)) return; if (!(ch[co].flags&CF_PLAYER)) return; log_char(cc,LOG_SYSTEM,0,"You got %s on %s.",what,ch[co].name); }
void clearignore_cmd(int cn) { struct ignore_ppd *ppd; if (!(ppd=set_data(cn,DRD_IGNORE_PPD,sizeof(struct ignore_ppd)))) return; // OOPS bzero(ppd,sizeof(struct ignore_ppd)); log_char(cn,LOG_SYSTEM,0,"Ignore list is now empty."); }
void leave_chat(int cn,int nr) { unsigned int bit; if (nr<1 || nr>32) { log_char(cn,LOG_SYSTEM,0,"Channel number must be between 1 and 32."); return; } bit=1<<(nr-1); if (!(ch[cn].channel&bit)) { log_char(cn,LOG_SYSTEM,0,"You have already left channel %d (%s).",nr,cname[nr].name); return; } ch[cn].channel&=~bit; log_char(cn,LOG_SYSTEM,0,"You have left channel %d (%s).",nr,cname[nr].name); }
void backtofire(int in,int cn) { if (!cn) return; if (!it[in].carried) return; // can only use if item is carried if (teleport_char_driver(cn,it[in].drdata[0],it[in].drdata[1])) { if (ch[cn].flags&CF_PLAYER) dlog(cn,in,"dropped because it was used"); remove_item_char(in); destroy_item(in); log_char(cn,LOG_SYSTEM,0,"The scroll vanished."); } }
static uint32_t process_v1log(void) { char *last_char = log_buf->buff + log_buf->write_pos; char *buff = log_buf->buff + log_pos; while (buff != last_char) { log_char(*(buff++)); /* Wrap around */ if (buff - (char *)log_buf >= log_size) buff = log_buf->buff; } return buff - log_buf->buff; }
void ignore(int cn,int ID) { struct ignore_ppd *ppd; int n,empty=-1; if (!(ppd=set_data(cn,DRD_IGNORE_PPD,sizeof(struct ignore_ppd)))) return; // OOPS for (n=0; n<MAXIGNORE; n++) { if (ppd->ignore[n]==ID) { ppd->ignore[n]=0; log_char(cn,LOG_SYSTEM,0,"Deleted from ignore list."); return; } if (ppd->ignore[n]==0 && empty==-1) empty=n; } if (empty!=-1) { ppd->ignore[empty]=ID; log_char(cn,LOG_SYSTEM,0,"Added to ignore list."); } else log_char(cn,LOG_SYSTEM,0,"Ignore list is full, cannot add."); }