/* House code for deed creation by Tal Strake, revised by Cironian */ #include "uox3.h" #include "debug.h" #define DBGFILE "house.cpp" void mtarget(int s, int a1, int a2, int a3, int a4, char b1, char b2, char *txt) { char multitarcrs[27]="\x99\x01\x40\x01\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00\x00\x00\x00\x00"; targetok[s]=1; multitarcrs[2]=a1; multitarcrs[3]=a2; multitarcrs[4]=a3; multitarcrs[5]=a4; multitarcrs[18]=b1; multitarcrs[19]=b2; sysmessage(s, txt); xsend(s, multitarcrs, 26, 0); } void buildhouse(int s, int i) { //o---------------------------------------------------------------------------o //| Function - void buildhouse(int s, int i) //| Date - UnKnown - Rewrite Date 1/24/99 //| Programmer - UnKnown - Rewrite by Zippy (onlynow@earthlink.net) //o---------------------------------------------------------------------------o //| Purpose - Triggered by double clicking a deed-> the deed's moreX is read //| for the house section in house.scp. Extra items can be added //| using HOUSE ITEM, (this includes all doors!) and locked "LOCK" //| Space around the house with SPACEX/Y and CHAR offset CHARX/Y/Z //o---------------------------------------------------------------------------o int x,y,z,house,key;//where they click, and the house/key items int sx=0,sy=0;//space around the house needed int k,l,tmp;//Temps int hitem[100], icount=0;//extra "house items" (up to 100) char sect[512];//file reading char id1,id2;//house ID static int looptimes=0;//for targeting long int pos;//for files... int cx=0,cy=0,cz=8;//where the char is moved to when they place the house (Inside, on the steps.. etc...)(Offset) hitem[0]=0;//avoid problems if there are no HOUSE_ITEMs by initializing the first one as 0 if (i) { openscript("house.scp"); sprintf(sect, "HOUSE %d", i);//and BTW, .find() adds SECTION on there for you.... if (!(house_script.find(sect))) { closescript(); return; } do { read2(); if (script1[0]!='}') { if (!(strcmp(script1,"ID"))) { tmp=hstr2num(script2); id1=tmp/256; id2=tmp%256; } if (!(strcmp(script1,"SPACEX"))) { sx=str2num(script2)+1; } if (!(strcmp(script1,"SPACEY"))) { sy=str2num(script2)+1; } if (!(strcmp(script1,"CHARX"))) { cx=str2num(script2); } if (!(strcmp(script1,"CHARY"))) { cy=str2num(script2); } if (!(strcmp(script1,"CHARZ"))) { cz=str2num(script2); } if (!(strcmp(script1,"HOUSE_ITEM"))) { hitem[icount]=str2num(script2); icount++; } } } while (strcmp(script1,"}")); closescript(); if (!id1) { printf("ERROR: Bad house script # %i!\n",i); return; } //i=0; } //else if(!looptimes) { if (i) { addid1[s]=0x40;addid2[s]=100;//Used in addtarget mtarget(s, 0, 1, 0, 0, id1-0x40, id2, "Select location for building."); } else { mtarget(s, 0, 1, 0, 0, addid1[s]-0x40, addid2[s], "Select location for building."); } looptimes++;//for when we come back after they target something return; } if(looptimes) { looptimes=0; x=(buffer[s][11]*256)+buffer[s][12];//where they targeted y=(buffer[s][13]*256)+buffer[s][14]; z=buffer[s][16]+tileheight(buffer[s][17]*256+buffer[s][18]); for (k=-sx;k=0x40) { seekmulti((items[a].id1*256+items[a].id2)-0x4000, &mfile, &length); length=length/sizeof(st_multi); if (length == -1) { printf("walking() - Bad length in multi file. Avoiding stall.\n"); length = 0; } for (b=0;b=112&&id2<=115) key=SpawnItem(s, 1, "a tent key", 0, 0x10, 0x10, 0, 0,1,1);//iron key for tents else key=SpawnItem(s, 1, "a house key", 0, 0x10, 0x0F, 0, 0,1,1);//gold key for everything else items[key].more1=items[house].ser1;//use the house's serial for the more on the key to keep it unique items[key].more2=items[house].ser2; items[key].more3=items[house].ser3; items[key].more4=items[house].ser4; items[key].type=7; for (k=0;k /*if ((num==100)||(num==102)||(num==104)||(num==106)||(num==108)||(num==110)) // Small houses w/o special furniture { printf(items[house].name, "small house"); addid1[s]=0x06;addid2[s]=0xE5; // Door x=hx; y=hy+3; z=hz+7; chars[currchar[s]].making=999; addthere(s,x,y,z,12); door=chars[currchar[s]].making; items[door].more1=items[house].ser1; items[door].more2=items[house].ser2; items[door].more3=items[house].ser3; items[door].more4=items[house].ser4; items[door].priv=0; chars[currchar[s]].making=999; // Key key=SpawnItem(s, 1, "a house key", 0, 0x10, 0x0F, 0, 0,1,1); //key=chars[currchar[s]].making; items[key].more1=items[house].ser1; items[key].more2=items[house].ser2; items[key].more3=items[house].ser3; items[key].more4=items[house].ser4; items[key].type=7; addid1[s]=0x0B;addid2[s]=0xD2; // Sign x=hx+2; y=hy+4; z=hz+5; chars[currchar[s]].making=999; addthere(s,x,y,z,0); sign=chars[currchar[s]].making; items[sign].more1=items[house].ser1; items[sign].more2=items[house].ser2; items[sign].more3=items[house].ser3; items[sign].more4=items[house].ser4; items[sign].priv=0; sprintf(items[sign].name, "Home of %s", chars[currchar[s]].name); } else if ((num==112)||(num==114)) // Tents { printf(items[house].name, "tent"); addid1[s]=0x0E;addid2[s]=0x43; // Chest x=hx; y=hy-2; z=hz+1; chars[currchar[s]].making=999; addthere(s,x,y,z,1); door=chars[currchar[s]].making; items[door].more1=items[house].ser1; items[door].more2=items[house].ser2; items[door].more3=items[house].ser3; items[door].more4=items[house].ser4; items[door].priv=0; chars[currchar[s]].making=999; // Key key=SpawnItem(s, 1, "a tent key", 0, 0x10, 0x0F, 0, 0,1,1); //key=chars[currchar[s]].making; items[key].more1=items[house].ser1; items[key].more2=items[house].ser2; items[key].more3=items[house].ser3; items[key].more4=items[house].ser4; items[key].type=7; } else if (num==116) // large brick house { printf(items[house].name, "large brick house"); chars[currchar[s]].making=999; // Key key=SpawnItem(s, 1, "a house key", 0, 0x10, 0x0F, 0, 0,1,1); //key=chars[currchar[s]].making; items[key].more1=items[house].ser1; items[key].more2=items[house].ser2; items[key].more3=items[house].ser3; items[key].more4=items[house].ser4; items[key].type=7; addid1[s]=0x0B;addid2[s]=0xD2; // Sign x=hx+3; y=hy+7; z=hz+5; chars[currchar[s]].making=999; addthere(s,x,y,z,0); sign=chars[currchar[s]].making; items[sign].more1=items[house].ser1; items[sign].more2=items[house].ser2; items[sign].more3=items[house].ser3; items[sign].more4=items[house].ser4; items[sign].priv=0; sprintf(items[sign].name, "Home of %s", chars[currchar[s]].name); addid1[s]=0x06;addid2[s]=0xE5; // Front left door x=hx-1; y=hy+6; z=hz+7; chars[currchar[s]].making=999; addthere(s,x,y,z,12); door=chars[currchar[s]].making; items[door].more1=items[house].ser1; items[door].more2=items[house].ser2; items[door].more3=items[house].ser3; items[door].more4=items[house].ser4; items[door].priv=0; addid1[s]=0x06;addid2[s]=0xE7; // Front right door x=hx; y=hy+6; z=hz+7; chars[currchar[s]].making=999; addthere(s,x,y,z,12); door=chars[currchar[s]].making; items[door].more1=items[house].ser1; items[door].more2=items[house].ser2; items[door].more3=items[house].ser3; items[door].more4=items[house].ser4; items[door].priv=0; addid1[s]=0x06;addid2[s]=0xA5; // Back left door x=hx-3; y=hy-1; z=hz+7; chars[currchar[s]].making=999; addthere(s,x,y,z,12); door=chars[currchar[s]].making; items[door].priv=0; addid1[s]=0x06;addid2[s]=0xA5; // Back right door x=hx+3; y=hy-1; z=hz+7; chars[currchar[s]].making=999; addthere(s,x,y,z,12); door=chars[currchar[s]].making; items[door].priv=0; } chars[currchar[s]].making=999;*/ } void addthere(int s, int xx, int yy, int zz, int t) { int c; unsigned int j; //printf("addthere!x=%d y=%d z=%d\n",xx,yy,zz); tile_st tile; /* c=memitemfree(); inititem(c); sprintf(items[c].name,"#");*/ c=SpawnItem(s,1,"#",0,addid1[s],addid2[s],0,0,0,0); /* items[c].ser1=itemcount2/16777216; items[c].ser2=itemcount2/65536; items[c].ser3=itemcount2/256; items[c].ser4=itemcount2; items[c].id1=addid1[s]; items[c].id2=addid2[s];*/ items[c].x=xx; items[c].y=yy; items[c].z=zz; items[c].amount=1; items[c].doordir=0; items[c].type=t; seektile((items[c].id1*256)+items[c].id2, &tile); if(chars[currchar[s]].making==999) chars[currchar[s]].making=c; // store item # if(tile.flag2&0x08) items[c].pileable=1; for (j=0;j