#define title(str) SetConsoleTitle(str); #define do_login_long true int random(int); #include #include "consolemethods.cpp" #include "valcrypt.cpp" //#include "outmanip.cpp" #define coutt cout #define endll endl #include #include int timestamp(); using namespace std; #define SNPOS string::npos #define MINUTE_MS 60000 #include COORD statloc[50]; int NEGmargin=19; void writestats_new(strlist titles){ COORD xy,a; xy.X=0; xy.Y=1; gotoxy(xy); statloc[0]=xy; string to; int i = 1; SLIP ii; titles.i_i(ii); while((to=titles.getnext(ii))!=""){ trace(); xy.Y+=3; gotoxy(xy); trace(); coutt << to; a=getxy(); a.Y++; a.X=5; trace(); statloc[i]=a; i++; } } void write_stats(strlist a,string stats,int dif){ COORD oo; oo.X=0; oo.Y=0; gotoxy(oo); cout << "Dificulty: " << dif; trace(); gotoxy(statloc[0]); cout << stats<<" "; string val; int i = 1; SLIP ii; a.i_i(ii); trace(); while((val=a.getnext(ii))!=""){ gotoxy(statloc[i]); i++; cout << val; for(int i = val.length(); i 1)ret += st[1]; for(int i =2;i0)ret+="*"; else ret+=st[i]; } return ret; } void randseed(){ time_t seconds; time(&seconds); srand((unsigned int) seconds); } //bool file_exists(string fn){ // FILE *f = fopen(fn.c_str(),"r"); // bool ret = (f!=NULL); // if(ret) fclose(f); // return ret; //} //bool file_exists(string filename) // { // return access(ctocp(filename), F_OK) == 0; // } #include int file_exists (string fileName) { struct stat buf; int i = stat ( ctocp(fileName), &buf ); /* File found */ if ( i == 0 ) { return 1; } return 0; } void randseed(int i){ srand((unsigned int) i); } static int DOTCOUNT=0; string dotting(){ DOTCOUNT++; if(DOTCOUNT>3)DOTCOUNT=0; string ret = ""; for(int i =0;i"; } string temp; getline(cin,temp); return temp; } int readint(string p){ if(p!=""){ cout << p << "==>"; } string temp; getline(cin,temp); int t = ctoint(temp); if(t < 0){ cout << "cannot convert " << t << " to an integer"<")) inet.get("/bank.phtml"); string temp = getbetween(inet.cursource,""," NP"); return ctoint(temp); } int remove_commas(string &t){ string ret; for(int i = 0; i < t.length(); i++){ if(t[i]!=',')ret+=t[i]; } return ctoint(ret); } int Neopets::np_onhand(){ if(!instr(inet.cursource," NP: ")) inet.get("/"); string t=getbetween(inet.cursource," NP: ","<"); t= remove_commas(t); return ctoint(t); } void random_friend(string &s){ int ind = findnext(s,"l?user=",0)+50; string name; while(ind > 0){ ind = findnext(s,"l?user=",ind+2); name = getbetween(s,"l?user=","\"",ind); // usernamelist.set(name); } } void Neopets::auction_data(varlist& vl){ inet.get("/auctions.phtml?auction_counter=0"); strlist names; string cs=inet.cursource,num,id,owner,nfo,cost,acost,bidd,csl; int ind = findnext(cs,"has [NF]",0); string nm; while(ind>0){ ind = findnext(cs,"\">",ind+1); if(ind==-1){ break;} num=getbetween(cs,"\">","<",ind-20); ind = findnext(cs,"auction_id=",ind+1); if(ind==-1){ cout <<2<",ind-3); ind+=5; nm=getbetween(cs,">","<",ind); owner=getbetweeni(cs,"randomfriend.phtml?user=","\"",ind); if(ind==-1){ cout <<55<",ind+1); if(ind==-1){ cout <<5<",ind+1);// 2nd ">" ind=findnext(cs,">",ind); if(ind==-1){ cout <<6<"," NP",ind-5); cost = ctostr(cctoint(cost)); ind=findnext(cs,">",ind+7); if(ind==-1){ cout <<7<"," NP",ind); bidd = getbetween(cs,"=center><"," ",ind); bidd = booltostr(instr(bidd,"A")); //bid=true if item was bid on cost = ctostr(cctoint(acost)); names.set(id); csl= nm+","+acost+","+num+","+owner+","+cost+","+nfo+","+bidd+","; // cout << csl << endl; // pause(); vl.set(id,csl); } random_friend(cs); // pause(); // vlog("auction_data returned"); vl.set("auction_ids",names.tocsl()); } /* auction sniper fundamentals: *not all the info gathered needs to be saved. *keep a watch list of indexes *if number of current auction is < x , bid *if next bid cost is MORE than allowable amount, remove from watch list */ varlist database("database"),aucdat("aucdat"),updated_ids("updated_ids"),id_vals("id_vals"); strlist aucwatch,auc_pri; bool Neopets::do_priority(varlist &inf,varlist &auclst){ string csl=auc_pri.tocsl(); string id,ic,n,cst,num; bool retval=false; int ind=0; while((id=csl_pop(csl))!=""){ ic=inf.valueof(id); if(ic==""){ auc_pri.remove(id); continue; } n=csl_pop(ic); cst=csl_pop(ic); num=csl_pop(ic); ind = 13000; if(ctoint(cst) <((auclst.ivalueof(n)/3)*2) && ctoint(num) < 4){ inet.get("/auctions.phtml?type=bids&auction_id="+id,"http://www.neopets.com/auctions.phtml"); string ref = getbetweeni(inet.cursource,"_ref_ck\" value=\"","\">",ind); string amt = getbetween(inet.cursource,"\"amount\" value=\"","\" ",ind); if(ctoint(amt) <((auclst.ivalueof(n)/3)*2)){ inet.post("/auctions.phtml?type=placebid","auction_id="+id+"&_ref_ck="+ref+"&amount="+amt,"http://www.neopets.com/auctions.phtml?type=bids&auction_id="+id); if(instr(inet.cursource,"You don't have enough")){ vlog("Could not place a bid of "+amt+" on "+n+": NOT ENOUGH NP\n"); }else if(instr(inet.cursource,"BID SUCCESSFUL")){ vlog("Placed a bid of "+amt+" on "+n+"\n"); retval= true; }else if(instr(inet.cursource,"auction is closed")){ vlog("Failed to Place a bid of "+amt+" on "+n+": auction closed\n"); } auc_pri.remove(id); } } auc_pri.remove(id); } return retval; } bool Neopets::do_watches(varlist &inf,varlist &auclst){ string csl=aucwatch.tocsl(); string id,ic,n,cst,num; bool retval=false; while((id=csl_pop(csl))!=""){ ic=inf.valueof(id); if(ic==""){ aucwatch.remove(id); continue; } n=csl_pop(ic); cst=csl_pop(ic); num=csl_pop(ic); if(ctoint(cst) <((auclst.ivalueof(n)/3)*2) && ctoint(num)<4 ){ cout << "(DW)set priority for "< (ctoint(base)*2) && base != "0" && mult!="0"){ cout << "premature Update_database return, Possible bad price: "<10 && iacst < ((tt/3)*2)){ vlog("Set priority for "+n+"\n"); retval=1; auc_pri.set(id); } } // cout << "back6"<0){ string pname=getbetween(cs,"pet_name' value='","'>",b); vlog("Finished course for "+pname+"\n"); inet.post("/island/process_training.phtml","type=complete&pet_name="+pname,"http://www.neopets.com/island/training.phtml"); getpets(var); return; } var.clear(); strlist names; int ind = cs.find("Current Course Status"); string data[11],csl; while(ind>0){ ind = findnext(cs,"width=250 colspan=2>",ind+3); if(ind==-1)break; data[0]=getbetween(cs,"width=250 colspan=2>"," (",ind); // pet name data[1]=getbetween(cs,"=2>","",ind); // if instr not ready for course; if(instr(data[1],"not")){ data[1]="true"; // true or false data[8]="-"; }else{ data[1]="false"; data[8]=getbetween(data[1],"studying ","","",ind); // level data[3]=getbetween(cs,"r>Str : ","",ind); // strength data[4]=getbetween(cs,"br>Def : ","",ind); //def data[5]=getbetween(cs,"r>Mov : ","",ind); // speed data[6]=getbetween(cs,"br>Hp : "," / ",ind); // hp top data[7]=getbetween(cs," / ","",ind+50); // hp bottom if(instr(cs,"?type=pay&pet_name="+data[0])){ int ii=findnext(cs,"?type=pay&pet_name="+data[0],ind); data[9]="true"; data[10]=getbetween(cs,"pay)

","",ii); }else{ data[9]="false"; data[10]="-"; } names.set(data[0]); csl = data[1]+","+data[2]+","+data[3]+","+data[4]+","+data[5]+","+data[6]+","+data[7]+","+data[8]+","+data[9]+","+data[10]+","; var.set(data[0],csl); ind = findnext(cs," / ",ind); } var.set("pets_csl",names.tocsl()); //vlog(" found "+ctostr(names.length())+" pets info"); } //data codes: 0-name,1-bool ready for course, 2-level,3-str,4-def,5-speed,6-hp top,7-hp bottom, 8- current course,9-bool needs pay,10-what kind of pay int Neopets::autotrain(varlist &var,int TopPay=10000){ int Wait_sec=var.ivalueof("AT_wait"); varlist pets("pets"); getpets(pets); string pets_csl=pets.valueof("pets_csl"); string pcsl,name,course,stone; int lvl,str,def,spd,hpt,hpb; bool ready,needspay; strlist touse; csltoslist(var.valueof("AT_pets"),touse); while((name=csl_pop(pets_csl))!=""){ if(!touse.find(name)) continue; pcsl= pets.valueof(name); if(pcsl==""){ vlog("pet's information not found\n"); continue; } //cout << "building information table for "<low || str>low || def>low || hpb>low){ pdat+="&course_type=Level"; crs="Level"; } else{ low=str; crs="Strength"; if(def void Neopets::getshopitems(varlist &v){ inet.get("/market.phtml?type=your"); string cs = inet.cursource,csl; strlist st; int ind = 0,lastsind=0; string data[5]; while(1){ ind = findnext(cs,"0 bgcolor='#ffffcc'>",lastsind); if(ind == -1) break; lastsind = ind+50; data[0] = getbetween(cs,"0 bgcolor='#ffffcc'>","<",ind-10); ind = findnext(cs,"c' align=center>",ind); data[1] = getbetween(cs,"c' align=center>","<",ind-10); ind = findnext(cs,"obj_id",ind); data[2] = getbetween(cs,"_id_","'",ind-10); data[3] = getbetween(cs,"value='","'>",ind); ind = findnext(cs,"oldcost_",ind-10); data[4] = getbetween(cs,"value='","'>",ind); st.set(data[3]); csl = data[1]+","+data[2]+","+data[0]+","+data[4]+","; v.set(data[3],csl); } v.set("names_csl",st.tocsl()); } //http://www.neopets.com/browseshop.phtml?owner=sc00bysn4cks int Neopets::wizprice(string item,int av=2){ inet.post("/market.phtml","type=process_wizard&feedset=0&shopwizard="+ctoposthex(item)+"&table=shop&criteria=exact&min_price=&max_price=","http://www.neopets.com/market.phtml"); int ind = 5000; if(instr(inet.cursource,"Whoa there"))WIZBANNED=true; if(ind < 0)return -1; int temp,chks=0,tot=0; // cout << "searching item: "<",ind+5); if(ind == -1)break; temp= cctoint(getbetween(inet.cursource,"F\">"," NP",ind-5)); // cout << "price:"; // cout << temp<< endl; tot+=temp; chks=i; } chks++; //cout << "chks: "<1){ ret+= "&obj_id_"+ind+"="+id+"&oldcost_"+ind+"="+cost+"&cost_"+ind+"="+cost; vlog(name+" was already priced at " + cost +"\n"); tot+=ctoint(cost)*ctoint(stk); continue; } low=100100; for(int i = 0; i < Searches; i++){// get wiz prices temp=wizprice(name,AvNum); if(WIZBANNED)break; low = (low > (temp) && temp>Ret_cost?temp:low); Sleep(Wait); } if(WIZBANNED){ vlog("wizban reported, thread exiting\n"); break; } if((Return_inv && (low99999))){ ret +="&obj_id_"+ind+"="+id+"&oldcost_"+ind+"="+cost+"&cost_"+ind+"="+cost+"&back_to_inv["+id+"]="+stk; vlog("moved "+stk+" "+name+"(s) back to your inventory"+"\n"); continue; } if(low < Ret_cost||low>99999)low=0; low -= (low/100) * Rem_perc; low -= Rem_np; if(low<0)low=0; vlog(name+" was priced at "+ctostr(low)+"\n"); ret+= "&obj_id_"+ind+"="+id+"&oldcost_"+ind+"="+cost+"&cost_"+ind+"="+ctostr(low); tot+=low*(ctoint(stk)); } vlog("Main Loop Complete\n"); vlog("Total value of items in "+vl.valueof("username")+"'s shop is "+ctostr(tot)+" NP\n"); inet.post("/process_market.phtml",ret,"http://www.neopets.com/market.phtml?type=your"); } void Neopets::tradesUgather(){ inet.get("/island/tradingpost.phtml?type=browse&criteria=20"); int ind = 0; string c = inet.cursource,n; while(1){ ind = findnext(c,"Owned by <",ind+1); if(ind==-1)return; n= getbetween(c,"user=","'",ind); usernamelist.set(n); } } void Neopets::checkbank(){// make sure the user has a bank account,if not create, if possible, collect interest, return balance inet.get("/bank.phtml"); if(instr(inet.cursource,"don't currently have")){ inet.post("/process_bank.phtml","type=new_account&name="+randstring(4)+"&add1="+randstring(13)+"&add2=&add3=&employment=Chia+Custodian&salary=10%2C000+NP+and+below&account_type=0&initial_deposit=1","http://www.neopets.com/bank.phtml"); cout << "creating bank account, please wait\n"; Sleep(5000); checkbank(); return; } if(!instr(inet.cursource,"interest at the start of every day")){// intrest is collectable //collect interest string amt = getbetween(inet.cursource,"value='Collect "," NP"); if(amt!=""){ inet.post("/process_bank.phtml","type=interest","http://www.neopets.com/bank.phtml"); string amt = getbetween(inet.cursource,"value='Collect "," NP"); coutt << "collected " << amt << "NP in bank interest"<
",ind+1); if(ind == -1){ // title("attempted breaking"); //if(false && instr(c,"l?lower="+ctostr(lower))){ // coutt << "grabbing page 2"<
","
",ind-3); // cost = getbetween(c,"Cost : ","<",ind); // coutt << "found item: "<1){ n = towizlist.pop(); if(n=="")return; tempc=wizprice(n,2); TOTAL_PAGES++; if(ctoint(tempc)>0){ itemlist.set(n,tempc); // wizedlist.set(n); } vars.set("wiz time",timestamp()+vars.ivalueof("wiz delay")); } coutt << "returned"<
",ind+1); if(ind == -1){ makesure=0; if(instr(c,"l?lower="+ctostr(lower))){ coutt << "grabbing page 2"<
","
",ind-3); cost = getbetween(c,"Cost : ","<",ind); // coutt << "found item: "<0 ){ itemlist.set(n,it); u++; } i++; } // coutt << "Updating status"<0){ itemlist.set(n,tempc); // wizedlist.set(n); } vars.set("wiz time",timestamp()+vars.ivalueof("wiz delay")); } coutt << "returned"<","<",ind); ind=findnextl(cs,"align",ind)+50; name = getbetween(cs,"","<",ind); if(sentmail.find(name)){ sentmail.set(name); neomail(name,"HEY",MESSAGELIST.randm()); nlog("sent a neomail to " + name+ " regarding shop purchases\n"); Sleep(500); } ind+=130; } sentmail.save("system\\mails.di"); } void Neopets::emptytill(int value=0){ string v=ctostr(value); if(value!=0){ inet.get("/market.phtml?type=till"); v = getbetween(inet.cursource,"

You currently have "," NP",0); } int vv = ctoint(v); if(vv-value < 0){ nlog("could not withdraw "+ctostr(value)); return; } inet.post("/process_market.phtml","type=withdraw&amount="+ctostr(ctoint(v))); nlog("withdrew " + v +" np from your till\n"); } void Neopets::depositall(){ inet.get("/bank.phtml"); writefile("bank.html",inet.cursource); string amt = getbetween(inet.cursource,"inventory\">","<"); int a = cctoint(amt); a--; if(a < 0)return; amt = ctostr(a); Sleep(5000); inet.post("/process_bank.phtml","type=deposit&amount="+amt,"http://www.neopets.com/bank.phtml"); writefile("depositall.html",inet.cursource); inet.get("/bank.phtml"); writefile("bank2.html",inet.cursource); nlog("moved " +amt + " NP into bank \n"); } void Neopets::parsemtgnames(string t){ if(!USE_NAMES)return; int ind = 0; string name; while(ind != -1){ ind = findnext(t,"donated by ",ind+1); if(ind==-1)break; name += getbetween(t," by ",")<",ind-20); name += "\n"; } appendfile("allnames.txt",name); } void Neopets::MTGgather(){ // title("g1"); ofstream ofile("allnames.txt",ios::app); inet.get("/donations.phtml"); // title("g2"); string t = inet.cursource; int ind = 0; string name=""; // title("g3"); while(ind != -1){ // title("g4"); ind = findnext(t,"donated by ",ind+1); if(ind==-1)break; // title("g5"); name = getbetween(t," by ",")<",ind-20); // coutt << "found "<9){ coutt <<"MTG DONE"<
",ind+1); if(ind == -1) break; //coutt << "firstsearch: "<
","<",ind-3); if(grab.find(name) || (instr(name," NP") && ctoint(name)>GrabAmount)){ ATTEMPTED++; coutt << "\rgrabbing " <<",b-3); inet.get("/takedonation_new.phtml?"+url,"http://www.neopets.com/donations.phtml"); if(instr(inet.cursource,"ou got it")){ GRABBED_NP=instr(name," NP"); GRABNUM++; coutt << "success, "<failed"<10){ coutt <<"MTG DONE"<
",ind+1); if(ind == -1)break; name = getbetween(t,"

"," ",ind-15); if(top < 0 || ctoint(name)>top){ i=ind; top = ctoint(name); } } if(i!=-1){ ATTEMPTED++; coutt << "grabbing "<<",b-3); inet.get("/takedonation_new.phtml?"+url,"http://www.neopets.com/donations.phtml"); if(instr(inet.cursource,"ou got it")){ GRABNUM++; GRABBED_NP=true; GRABBED_NP_TOT+=top; coutt << "sucess, "<i?s-i:i-s) bool testpyramid(int o, int t){ if(o == 14 && t == 2) return true; if(t == 14 && o == 2) return true; if(abdiff(o,t)==1)return true; return false; } void Neopets::playpyramid(){ inet.get("/games/pyramids/pyramids.phtml","http://www.neopets.com/games/pyramids/index.phtml"); string t = inet.cursource; string clicks[30][2]; for(int i = 0; i < 7; i++){ clicks[i][0]=""; clicks[i][1]=""; } int x = 0,s,tcs=0,save,ind = 0,cleft=28; while(1){ tcs = 0; x = 0; ind = findnext(t,"nbsp; <",0); int ccard = ctoint(getbetween(t,"games/mcards/","_",ind)); ind = findnext(t,"position=",ind); int p = findnext(t,"",0); p = findnext(t,"width='125'>",p); p = findnext(t,"width='125'>",p+1); string h = getbetween(t,"width='125'>","<",p-3); coutt << "cards left: "<",ind); tcs++; x++; ind+=13; } if(tcs < 1 || instr(t,"here are no more available moves")){ inet.get("/games/pyramids/pyramids.phtml?action=collect","http://www.neopets.com/games/pyramids/pyramids.phtml"); nlog("collecting NP"); return; } bool fn = false; for(int i =0; i< tcs;i++){ if(testpyramid(ccard,ctoint(clicks[i][0]))){ coutt << "Difference found in"<",0); p = findnext(t,"width='125'>",p); p = findnext(t,"width='125'>",p+1); coutt << "cards left: "<< getbetween(t,"width='125'>","<",p-3)<"; string ret; getline(cin ,ret); if(ret[0] != 'y' && ret[0] != 'n'){ cout << "\n input must be n or y\n"; return ynques(p); } return ret[0] == 'y'; } int random(int t){ int r = rand()%t; // LOGSTR+= ctostr(r) + "\n"; return r; } bool strtobool(string s){ return s=="true"; } string timeformat(int t){ int a = t%60;//seconds int b = (t/60)%60;//minutes t = t/3600;//hours string ret = ""; if(t > 0) ret += ctostr(t)+":"; if(b > 0 || t > 0) ret+= ctostr(b)+":"; if(a<10)ret+="0"; ret +=ctostr(a); return ret; } //coutt << " 0 1 2 3 4 5 6 7 8 9 10 11 12 13\n"; // for(int i = 0; i < GRDSIZE; i++){ // coutt << i << (i < 10?" ":" "); // for(int n = 0; n < GRDSIZE; n++){ // // tt = ctostr(i)+"-"+ctostr(n); // ttp= negboard[n][i]; // coutt << " "; // if(ttp == ""){ // coutt << " "; // continue; // } // if(ttp =="m")setcolors("black","white"); // if(ttp =="1")setcolors("light blue","grey"); // if(ttp =="2")setcolors("blue","grey"); // if(ttp =="3")setcolors("dark blue","grey"); // if(ttp =="4")setcolors("green","grey"); // if(ttp =="5")setcolors("red","grey"); // if(ttp =="6")setcolors("dark red","grey"); // if(ttp =="7")setcolors("pink","grey"); // coutt <9)coutt<<"9 10 11"; if(GRDSIZE>12)coutt<<" 12 13"; j.Y++; j.X=NEGmargin; gotoxy(j); for(int i = 0; i < GRDSIZE; i++){ o+=ctostr(i); o+= (i < 10?" ":" "); //o+="\n"; cout << o; o=""; j.Y+=2; gotoxy(j); } j.Y=1; j.X+=5; for(int i = 0; i < GRDSIZE; i++){ gotoxy(j); for(int n = 0; n < GRDSIZE; n++){ cout << "x "; negback[i][n]="x"; } j.Y+=2; } } void update_negboard(string negboard[15][15],int GRDSIZE){ trace(); for(int i = 0; i < GRDSIZE; i++){ for(int n = 0; n < GRDSIZE; n++){ trace(); if(negback[i][n] != negboard[i][n]){ trace(); COORD xy; xy.X=i; xy.Y=n; trace(); draw_negg(xy,negboard[i][n]); } } } trace(); } void Neopets::playnegg(){ // easy 9, mid 12, hard 14 bool rns[4]={0,0,0,0}; strlist sta; int startstamp = timestamp(); int SLPVAL = ctoint(vars.valueof("SLEEP")); if(SLPVAL < 0)SLPVAL =500; int DIFFCLT = ctoint(vars.valueof("DIFFCLT")); int GRDSIZE = (DIFFCLT == 3?14:(DIFFCLT==2?12:9)); bool CLRDED=strtobool(vars.valueof("CLRDED")); bool OUTPUT=strtobool(vars.valueof("OUTPUT")); int BIGGEST = 0; int TOTWON = 0; int LOW_TIME=10000; int LAST_x,LAST_y; strlist stat_titles; bool DO_CLR=false; COORD loca; loca.X=25; loca.Y=28; TNP++; bool autos = false,FLAGN=strtobool(vars.valueof("FLAGN")); restart: LAST_x=-1; LAST_y=-1; start_timing("negg_game"); rns[0]=0;rns[1]=0;rns[2]=0;rns[3]=0; GRDSIZE = (DIFFCLT == 3?14:(DIFFCLT==2?12:9)); trace(); cout << endl; clrscr(); reg_vl_file(".txt"); trace(); draw_neggboard_new(GRDSIZE); trace(); fill_stat_titles(stat_titles); trace(); writestats_new(stat_titles); trace(); gotoxy(loca); inet.post("/games/neggsweeper/neggsweeper.phtml","","http://www.neopets.com/games/neggsweeper/index.phtml"); if(autos ||(!instr(inet.cursource,ctostr(GRDSIZE-1)+"-") && !instr(inet.cursource,"-"+ctostr(GRDSIZE-1)+"'"))||instr(inet.cursource,"-"+ctostr(GRDSIZE-1))){ autos = false; TNP++; inet.post("/games/neggsweeper/index.phtml","action=cancel","http://www.neopets.com/games/neggsweeper/index.phtml"); // coutt << "Had to cancel old game. beginning new game"<","",0); stind = findnext(inet.cursource,"",stind+2); int jackpot = ctoint( getbetween(inet.cursource,"","",stind-3)); // nlog("start"); trace(); string negboard[15][15]; int dangergrid[15][15]; for(int i = 0; i < GRDSIZE; i++){ for(int n = 0; n < GRDSIZE; n++){ negboard[i][n]=""; dangergrid[i][n] = 0; } } string t = inet.cursource,ttp,ttm; startmil(); int ind=0; string temp,tt,d,ttb; trace(); for(int i = 0; i < GRDSIZE; i++){ // read page and create table for(int n = 0; n < GRDSIZE; n++){ ind = findnext(t,"",ind); if(ind == -1){ if(instr(inet.cursource,"You have won ")){ int ttime = stop_timing("negg_game"); if(ttime < LOW_TIME && GRDSIZE==14){ LOW_TIME=ttime; } coutt << "Game WON earning: " << getbetween(inet.cursource,"You have won ","",0)<","",ind); if(instr(temp,"nbsp")){// no negg d = ""; }else if(instr(temp,"t c")){// number d = getbetween(t,"","",ind); }else if(instr(temp,"flagnegg")){//flagged negg d= "m"; }else if(instr(temp,"g s")){// open negg d = "x"; }else{ coutt << "some error occured when parsing grid"<0){ // grab=false; // for(int c = -1; c < 2; c++){ // for(int d = -1; d < 2;d++){ // find marks or numbers not next to neggs // if(i+c < 0 || n+d < 0 ||i+c >GRDSIZE-1 || n+d >GRDSIZE-1)continue; // ttm = negboard[i+c][n+d]; // if(ttm == "x"){ // grab=true; // c=2; // d=2; // } // // } // } // if(!grab){ // // negboard[i][n]=" "; // } // } // } // } // } // clrscr(); trace(); sta.clear(); sta.queue(ctostr(TNW)); sta.queue(ctostr(TNP)); sta.queue(ctostr(jackpot)); sta.queue(ctostr(TOTWON)); sta.queue(timeformat(timestamp()-startstamp)); sta.queue(ctostr(BIGGEST)); sta.queue(ctostr((LOW_TIME ==10000?0:LOW_TIME))); trace(); write_stats(sta,stats,DIFFCLT); if(!OUTPUT){ if(DO_CLR){ DO_CLR=false; //draw_neggboard_new(GRDSIZE); trace(); //reset_negback(); trace(); //fill_stat_titles(stat_titles); trace(); //writestats_new(stat_titles); } trace(); update_negboard(negboard,GRDSIZE); trace(); } gotoxy(loca); trace(); // coutt <<"parsing grid off page took "<< endmil()<0){ //coutt << "m is " << m << " inside loop at"<GRDSIZE-1 || n+d >GRDSIZE-1)continue; ttm = negboard[i+c][n+d]; if(ttm == "x" || ttm == "m"){ b++; //coutt << "found #"<GRDSIZE-1 || n+d >GRDSIZE-1)continue; ttb =ctostr(i+c)+"-"+ctostr(n+d); ttm = negboard[i+c][n+d]; // b+=(ttm=="x" ? 1:0); // marked.set(ctostr(i+c)+"-"+ctostr(n+d)); // negboard.set(ctostr(i+c)+"-"+ctostr(n+d),"m"); if(ttm == "x"){ didflag=true; //if(ynques("flag")){ if(FLAGN){ coutt << "flagging negg at"<GRDSIZE-1 || n+d >GRDSIZE-1)continue; ttm = negboard[i+c][n+d]; ttmi=ctoint(ttm); if(ttmi > 0){// found number //coutt << "found number next to negg"<< i << "-"<GRDSIZE-1 || n+f+d >GRDSIZE-1|| (e == 0 && f == 0))continue; b+=(negboard[i+c+e][n+d+f]=="m" ? 1:0); } } //coutt << "found "<","",0)<1?0:1); //for(int i =0;i<4;i++)rns[i]=false; //rns[random(4)]= true; int rnd_1,rnd_2; rnd_1=random(2); rnd_2=random(2); if(left > 130 && negboard[GRDSIZE-2][GRDSIZE-2]== "x" &&!rns[0] && random(4)==1){ rns[0]=1; while(1){ if(negboard[GRDSIZE-(2+rnd_1)][GRDSIZE-(2+rnd_2)] == "x")break; rnd_1=random(3); rnd_2=random(3); } ttx = ctostr((GRDSIZE-2)-rnd_1)+"-"+ctostr((GRDSIZE-2)-rnd_2); coutt << "rclicking " << ttx<<" "; //coutt <<"finding clickable negg took "<< endmil()< 130 && negboard[GRDSIZE/2][GRDSIZE/2]== "x"&&!rns[1]&& random(4)==1){ rns[1]=1; rnd_1=random(6)-3; rnd_2+=random(6)-3; while(1){ if(negboard[(GRDSIZE/2)+rnd_1][(GRDSIZE/2)+rnd_2] == "x")break; rnd_1=random(6)-3; rnd_2=random(6)-3; } ttx = ctostr((GRDSIZE-2)-rnd_1)+"-"+ctostr((GRDSIZE-2)-rnd_2); coutt << "rclicking " << ttx<<" "; //coutt <<"finding clickable negg took "<< endmil()< 130 && negboard[GRDSIZE-2][2]== "x"&&!rns[2]&& random(4)==1){ rns[2]=1; while(1){ if(negboard[(GRDSIZE/2)+rnd_1][(GRDSIZE/2)+rnd_2] == "x")break; rnd_1+=random(3)-1; rnd_2+=random(3)-1; } ttx = ctostr((GRDSIZE-2)-rnd_1)+"-"+ctostr((2+rnd_2)); coutt << "rclicking " << ttx<<" "; //coutt <<"finding clickable negg took "<< endmil()< 130 && negboard[2][GRDSIZE-2]== "x"&&!rns[3]&& random(4)==1){ rns[3]=1; while(1){ if(negboard[(GRDSIZE/2)+rnd_1][(GRDSIZE/2)+rnd_2] == "x")break; rnd_1+=random(3)-1; rnd_2+=random(3)-1; } ttx = ctostr((2+rnd_2))+"-"+ctostr((GRDSIZE-2)-rnd_1); coutt << "rclicking " << ttx<<" "; //coutt <<"finding clickable negg took "<< endmil()< 0){// found a number at i-n for(int e = -1; e < 2; e++){ for(int f = -1; f < 2; f++){ if(i+e < 0 || f+n< 0 ||e+i >GRDSIZE-1 || f+n >GRDSIZE-1 || (e == 0 && f == 0))continue; points-=(negboard[i+e][n+f]=="m" ? 1:0);// determine point value for this space } } if(points != 0){// if there's still a value to the number this should never fail for(int e = -1; e < 2; e++){ for(int f = -1; f < 2; f++){ if(i+e < 0 || f+n< 0 ||e+i >GRDSIZE-1 || f+n >GRDSIZE-1 || (e == 0 && f == 0))continue; if(negboard[i+e][n+f]=="x"){ if(dangergrid[i+e][n+f]==-100)dangergrid[i+e][n+f]=0; // seperate unset grid points from low dangergrid[i+e][n+f]+= points;// fill danger board } } } } } } } // coutt << "finished filing danger grid"< -1 && dangergrid[i][n] <= points){ points = dangergrid[i][n]; savei=i; saven=n; } } } if(dangergrid[savei][saven]==-100){ for(int i = 0; i < GRDSIZE; i++){ for(int n = 0; n < GRDSIZE; n++){ if(negboard[i][n] == "x"){ savei =i; saven=n; } } } } string sv = ctostr(savei)+"-"+ctostr(saven); if(savei==LAST_x && saven==LAST_y){ cout << "Neopets failed... starting new grid"<","",0)<")){ coutt << "Game WON earning: " << getbetween(inet.cursource,"You have won ","",0)<",ind))break; coutt <<(data[i][0] = getbetween(inet.cursource,">","<",ind-10))<","<",ind + 30); data[i][2] = getbetween(inet.cursource,"back_to_inv[","]",ind+40); ind = findnextl(inet.cursource,"images.neopets.com/items",ind); i++; } allmov = 0; string ret ="obj_name=&category=0&offset=0"; int x = 0; while(x<50){ ret += "&back_to_inv["+data[x][2]+"]="+data[x][1]; if(data[x+1][0]== "")break; coutt << data[x][0] << " : " << data[x][1]<get("market.phtml?type=your"); int runs = 1; int space = ctoint(getbetween(mynet->cursource,"Free Space : ","<")); if(!instr(mynet->cursource,"Free Space")){ space=3; runs=2;} while(runs>0){ runs--; mynet->get("/quickstock.phtml"); int ind = findnextl(mynet->cursource,"",0); if(ind == -1){ vallog("no items to stock, returning"); return; } string ret = "pin="+pin+"&buyitem=0"; int x = 0; vallog("moving items from inventory to shop:\n"); while(x < space){ test(ind = findnext(mynet->cursource,"t\">",ind))break; vallog(getbetween(mynet->cursource,"t\">","<",ind-5)+"\n"); string id = getbetween(mynet->cursource,"id_arr[","]",ind); ret += "&id_arr["+id + "]="+getbetween(mynet->cursource,"value=\"","\">",ind+20)+"&radio_arr["+id+"]=stock"; x++; ind = findnextl(mynet->cursource,"",ind); } //coutt << ret << endll; vallog("finished moving items from inventory\n"); mynet->post("process_quickstock.phtml",ret,"http://www.neopets.com/quickstock.phtml"); } // if(dorep)invtoshop(pin); // coutt << mynet->headers << mynet->cursource << endll; } */