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 transport_driver(int in,int cn) { int x,y,a,oldx,oldy,nr,mirror,oldmirror; unsigned long long bit; struct transport_ppd *dat; unsigned char buf[16]; if (!cn) return; // always make sure its not an automatic call if you don't handle it dat=set_data(cn,DRD_TRANSPORT_PPD,sizeof(struct transport_ppd)); if (!dat) return; // oops... // mark new transports as seen nr=it[in].drdata[0]; if (nr!=255) { // not clan exit if (nr<0 || nr>=ARRAYSIZE(trans)) { elog("illegal transport nr %d from item %d (%s) #1",nr,in,it[in].name); log_char(cn,LOG_SYSTEM,0,"Nothing happens - BUG (%d,#1).",nr); return; } bit=1<<nr; if (!(dat->seen&bit)) { log_char(cn,LOG_SYSTEM,0,"You have reached a new transportation point."); dat->seen|=bit; } } if (ch[cn].act2==0) { buf[0]=SV_TELEPORT; *(unsigned long long*)(buf+1)=dat->seen; psend(ch[cn].player,buf,9); return; } nr=(ch[cn].act2&255)-1; mirror=(ch[cn].act2/256); if (mirror<1 || mirror>26) mirror=RANDOM(26)+1; // clan hall is target if (nr>63 && nr<64+60) { if (may_enter_clan(cn,nr-63)) { x=17+((nr-64)/12)*49; y=16+((nr-64)%12)*20; a=13; } else { x=43+((nr-64)/12)*49; y=15+((nr-64)%12)*20; a=13; } } else if (nr<64) { bit=1<<nr; if (!(dat->seen&bit)) { log_char(cn,LOG_SYSTEM,0,"You've never been to %s before. You cannot go there.",trans[nr].name); return; } if (nr==22 && !(ch[cn].flags&CF_ARCH)) { log_char(cn,LOG_SYSTEM,0,"Sorry, Arches only!"); return; } if (nr<0 || nr>=ARRAYSIZE(trans)) { //elog("illegal transport nr %d #2",nr); log_char(cn,LOG_SYSTEM,0,"Nothing happens - BUG (%d,#2).",nr); return; } x=trans[nr].x; y=trans[nr].y; a=trans[nr].a; } else { log_char(cn,LOG_SYSTEM,0,"You've confused me. (BUG #1123)"); return; } if (x<1 || x>MAXMAP-2 || y<1 || y>MAXMAP-2) { log_char(cn,LOG_SYSTEM,0,"Nothing happens - BUG (%d,%d,%d).",x,y,a); return; } oldmirror=ch[cn].mirror; ch[cn].mirror=mirror; if ((ch[cn].flags&CF_PLAYER) && a && (a!=areaID || get_mirror(a,ch[cn].mirror)!=areaM)) { if (!change_area(cn,a,x,y)) { log_char(cn,LOG_SYSTEM,0,"Nothing happens - target area server is down."); ch[cn].mirror=oldmirror; } return; } buf[0]=SV_MIRROR; *(unsigned int*)(buf+1)=ch[cn].mirror; psend(ch[cn].player,buf,5); oldx=ch[cn].x; oldy=ch[cn].y; remove_char(cn); if (!drop_char(cn,x,y,0)) { log_char(cn,LOG_SYSTEM,0,"Please try again soon. Target is busy"); drop_char(cn,oldx,oldy,0); } }