rendered paste body#define title(str) SetConsoleTitle(str);
#define do_login_long true
int random(int);
#include <valwrapper.h>
#include "consolemethods.cpp"
#include "valcrypt.cpp"
//#include "outmanip.cpp"
#define coutt cout
#define endll endl
#include <strlist.h>
#include <sys/timeb.h>
int timestamp();
using namespace std;
#define SNPOS string::npos
#define MINUTE_MS 60000
#include <sys/timeb.h>
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 <NEGmargin-6; i++)cout << " ";
}
trace();
a.clear();
}
void fill_stat_titles(strlist &stat_titles){
stat_titles.clear();
stat_titles.queue(" Won: ");stat_titles.queue(" Played: ");stat_titles.queue(" Jackpot: ");
stat_titles.queue(" total won: ");stat_titles.queue(" time running: ");stat_titles.queue(" biggest win: ");
stat_titles.queue(" fastest: ");
}
varlist timesheet("timesheet");
void start_timing(string name){
timesheet.set(name,timestamp());
}
int stop_timing(string name){
int t= timesheet.ivalueof(name);
int b = timestamp()-t;
return b;
}
string file_contents(string fname){
ifstream ifile(fname.c_str());
if(!ifile){
cout << "failed opening "<<fname<<endll;
return "";
}
string r = "";
while(!ifile.eof()){
getline(ifile,fname);
r+=fname+"\n";
}
return r;
}
#define Vc ValCrypt
void Vlist_load_enc(valcrypt &crypt, varlist &vls,string fn){
ifstream ifile(fn.c_str());
if(!ifile){
cout << "failed opening"<<fn<<endll;
return ;
}
string t,tt;
while(!ifile.eof()){
getline(ifile,t);
tt=crypt.decrypt(t);
vls.set(tt);
}
ifile.close();
}
void Vlist_save_enc(valcrypt &crypt, varlist &vls,string fn){
ofstream ofile(fn.c_str());
string t,tt;
int i = 0;
for(int i =0;i<vls.length();i++){
t=vls.get(i);
tt=crypt.encrypt(t);
ofile << tt << endll;
}
ofile.close();
}
string hidestr(string st){
if(st == "")return "";
string ret = "";
ret += st[0];
if(st.length()>1)ret += st[1];
for(int i =2;i<st.length();i++){
if(random(3)>0)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<sys/stat.h>
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<DOTCOUNT;i++){
ret +=".";
}
return ret;
}
string randstring(int l){
string t = "";
int b;
for(int i =0; i < l;i++){
b = (rand()% 76) + 48;
if(b == 61){
i--;
continue;
}
t+= (char)b;
}
return t;
}
int rnd(int i){
return (rand()%i)+1;
}
string readstr(string p){
if(p!=""){
cout << p << "==>";
}
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"<<endll;
return readint(p);
}
return t;
}
string booltostr(bool a){
return (a?"true":"false");
}
void createneoaccount(string name, string pass){
valwrapper cnanet("www.neopets.com");
cnanet.get("/reg/index.phtml");
}
int milmil,milsec;
int timestamp(){
time_t seconds;
time(&seconds);
return seconds;
}
int millitime()
{
struct _timeb timebuffer;
_ftime( &timebuffer );
return timebuffer.millitm;
}
void startmil(){
milsec = timestamp();
milmil = millitime();
}
int endmil(){
int i=millitime();
int a=(timestamp() - milsec)*1000;
int b=(i<milmil?((-1000)+(milmil-i)):(i-milmil));
return (a+b);
}
varlist mil_thrd("mil_thrd");
void start_th_time(int plc=0){
string s = ctostr(timestamp())+","+ctostr(millitime())+",";
mil_thrd.set(ctostr(plc),s);
}
int end_th_time(int plc=0){
string csl = mil_thrd.valueof(ctostr(plc));
int i=millitime();
int sec=ctoint(csl_pop(csl));
int a=(timestamp()-sec)*1000;
int mil=ctoint(csl_pop(csl));
int b=(i<mil?((-1000)+(mil-i)):(i-mil));
return (a+b);
}
void checkname(string n){
valwrapper cnet("www.neopets.com");
cnet.get("/process_index.phtml","dowhat=check_availability&username="+n+"&destination=index.phtml");
cout << cnet.cursource<<endll;
}
void nlog(string h){
// cout << h ;//<< endll;
// appendfile("log.txt",h+"\n");
}
void vlog(string h){
nlog(h);
}
strlist usernamelist,towizlist,visitedlist;
varlist itemlist("itemlist"),wizdlist("wizdlist");
class Neopets{
private:
string pass;
string status;
int NP,TNW,TNP;
public:
// outmanip coutt;
varlist vars;
bool islogged,WIZBANNED,GRABBED_NP,USE_NAMES,GRABBED_NP_TOT;
double long TOTAL_UPDATED,TOTAL_FOUND,TOTAL_PAGES;
int GRABNUM,ATTEMPTED;
//strlist unames;
Neopets();
Neopets(string n, string p);
string name;
valwrapper inet;
void set_login(string n, string p){name=n;pass=p;};
int login(string,string);
int DoMtg(strlist&, int);
int DoNPMtg(int);
void parsemtgnames(string t);
// void autoprice(
void mailcusties();
void emptytill(int);
void depositall();
int bank_balance();
int np_onhand();
string searchwiz(string item,int price);
int wizbuy(string,int);
void playpyramid();
void neomail(string,string,string);
void playnegg();
void pricegather();
void MTGgather();
void tradesUgather();
void checkbank();
void gallerygather();
int wizprice(string,int);
void getshopitems(varlist&);
void priceshop(varlist& vls);
void getpets(varlist&);
int autotrain(varlist&,int);
void auction_data(varlist&);
bool do_priority(varlist&,varlist&);
bool do_watches(varlist&,varlist&);
int doauction(varlist&,varlist&);
};
int Neopets::bank_balance(){
// if(inet.get_lastfile()!="/bank.phtml" || !instr(inet.cursource,"<td bgcolor='#ffffff'><b>"))
inet.get("/bank.phtml");
string temp = getbetween(inet.cursource,"<td bgcolor='#ffffff'><b>"," 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: <a href=\"/objects.phtml?type=inventory\">")) inet.get("/");
string t=getbetween(inet.cursource," NP: <a href=\"/objects.phtml?type=inventory\">","<");
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 <B>[NF]</B>",0);
string nm;
while(ind>0){
ind = findnext(cs,"\"><TD align=\"center\">",ind+1);
if(ind==-1){ break;}
num=getbetween(cs,"\"><TD align=\"center\">","<",ind-20);
ind = findnext(cs,"auction_id=",ind+1);
if(ind==-1){ cout <<2<<endl;break;}
ind = findnext(cs,"auction_id=",ind+1);
if(ind==-1){ cout <<3<<endl;break;}
id=getbetween(cs,"auction_id=","\">",ind-3);
ind+=5;
nm=getbetween(cs,">","<",ind);
owner=getbetweeni(cs,"randomfriend.phtml?user=","\"",ind);
if(ind==-1){ cout <<55<<endl;break;}
ind = findnext(cs,owner,ind+5);
if(ind==-1){ cout <<4<<endl;break;}
nfo = cs.substr(ind+3,20);
if(instr(nfo,"NF"))nfo="true";
else nfo="false";
ind=findnext(cs,"><B>",ind+1);
if(ind==-1){ cout <<5<<endl;break;}
// ind=findnext(cs,"><B>",ind+1);// 2nd "><B>"
ind=findnext(cs,"><B>",ind);
if(ind==-1){ cout <<6<<endl;break;}
cost = getbetween(cs,"><B>","</B> NP",ind-5);
cost = ctostr(cctoint(cost));
ind=findnext(cs,"><B>",ind+7);
if(ind==-1){ cout <<7<<endl;break;}
acost =getbetween(cs,"><B>","</B> 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 "<<n<<endl;
aucwatch.remove(id);
auc_pri.set(id);
retval=true;
}
}
return retval;
}
void update_database(string n, string cs){
string csl= database.valueof(n);
string base=csl_pop(csl);
int cost = ctoint(cs);
if(base=="")base="0";
string mult=csl_pop(csl);
if(mult=="")mult="0";
if(ctoint(mult)<2 && cost > (ctoint(base)*2) && base != "0" && mult!="0"){
cout << "premature Update_database return, Possible bad price: "<<n<<":"<<cs<<endl;
return;
}
int ext = ctoint(base)*ctoint(mult);
int nmul = ctoint(mult)+1;
ext+=cost;
base = ctostr(ext/nmul);
csl=base+","+ctostr(nmul)+",";
database.set(n,csl);
appendfile("database_back.di",n+"="+csl+"\n");
}
void do_update_database(varlist &v){
// cout << "back1"<<endl;
string csl = updated_ids.names_csl();
// cout << "updated_ids csl: "<<csl<<endl;
string tm,n;
// cout << "back2"<<endl;
while((tm=csl_pop(csl))!=""){
// cout << "back3"<<endl;
if(v.isin(tm))continue;
// cout << "back4"<<endl;
if(tm=="npid"){
appendfile("npid.txt",v.valueof(tm));
continue;
}
// cout << "back5"<<endl;
n = id_vals.valueof(tm);
vlog("Updating "+n+" at id "+tm+"\n");
// cout << "back6"<<endl;
update_database(id_vals.valueof(tm),updated_ids.valueof(tm));
// cout << "back7"<<endl;
id_vals.remove(tm);
updated_ids.remove(tm);
// cout << "back8"<<endl;
}
}
int Neopets::doauction(varlist &vl,varlist &auclst){
int threshhold = vl.ivalueof("AS_upd_thresh");
bool DOBUY=vl.bvalueof("AS_buy");
// if(DOBUY)cout << "\nBUYING"<<endl;
// else cout << "\nNOT BUYING"<<endl;
varlist ainf("ainf");
// cout << "back1"<<endl;
auction_data(ainf);
if(do_priority(ainf,auclst))return 1;
if(do_watches(ainf,auclst))return 1;
/// cout << "back2"<<endl;
string csl = ainf.valueof("auction_ids");
string infcsl,n,nf,id,own,cst,acst,num,bidd;
int iacst,retval=0;
// cout << "back3"<<endl;
while((id=csl_pop(csl))!=""){
// cout << "back4"<<endl;
infcsl=ainf.valueof(id);
n=csl_pop(infcsl);
//cout << "extracted: "<<n<<endl;
acst=csl_pop(infcsl);
num=csl_pop(infcsl);
own=csl_pop(infcsl);
cst=csl_pop(infcsl);
nf=csl_pop(infcsl);
bidd=csl_pop(infcsl);
// cout << "back5"<<endl;
if(strtobool(nf)){
//cout << "nf only auction found"<<endl;
continue; // if auction is neofriends only
}
if(((iacst=ctoint(acst))< auclst.ivalueof(n)) && DOBUY){
//if(DOBUY)cout << "\nBUYING"<<endl;
//else cout << "\nNOT BUYING"<<endl;
aucwatch.set(id);
aucdat.set(id,n+","+acst+","+num+",");
int tt = auclst.ivalueof(n);
if(tt>10 && iacst < ((tt/3)*2)){
vlog("Set priority for "+n+"\n");
retval=1;
auc_pri.set(id);
}
}
// cout << "back6"<<endl;
if(ctoint(num)<threshhold &&strtobool(bidd) && updated_ids.ivalueof(id)<ctoint(cst)){
updated_ids.set(id,cst);
id_vals.set(id,n);
//cout << "updating "<<n<< "at id: "<<id<<endl;
//update_database(n,cst);
}
}
// cout << "back7"<<endl;
do_update_database(ainf);
// cout << "back8"<<endl;
return retval;
}
void Neopets::getpets(varlist &var){
inet.get("/island/training.phtml?type=status");
string cs = inet.cursource;
int b = findnext(cs,"Course Finished!",0);
if(b>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><b>",ind+3);
if(ind==-1)break;
data[0]=getbetween(cs,"width=250 colspan=2><b>"," (",ind); // pet name
data[1]=getbetween(cs,"=2><b>","</b>",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 ","</",0);
}
data[2]=getbetween(cs,"Lvl : <font color=green><b>","</b>",ind); // level
data[3]=getbetween(cs,"r>Str : <b>","</b>",ind); // strength
data[4]=getbetween(cs,"br>Def : <b>","</b>",ind); //def
data[5]=getbetween(cs,"r>Mov : <b>","</b>",ind); // speed
data[6]=getbetween(cs,"br>Hp : <b>"," / ",ind); // hp top
data[7]=getbetween(cs," / ","</b>",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)<p><b>","</b>",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("<v> 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 "<<name<<endl;
ready=strtobool(csl_pop(pcsl));
lvl=ctoint(csl_pop(pcsl));
str=ctoint(csl_pop(pcsl));;
def=ctoint(csl_pop(pcsl));
spd=ctoint(csl_pop(pcsl));
hpt=ctoint(csl_pop(pcsl));
hpb=ctoint(csl_pop(pcsl));
course=csl_pop(pcsl);
needspay=strtobool(csl_pop(pcsl));
stone=csl_pop(pcsl);
int low =lvl*2;
string pdat="type=start&pet_name="+name;
string crs="";
if(ready){
cout << name << " is ready to begin: ";
if(spd>low || str>low || def>low || hpb>low){
pdat+="&course_type=Level";
crs="Level";
}
else{
low=str;
crs="Strength";
if(def<low){
low=def;
crs="Defence";
}
if(hpb<low){
low=hpb;
crs="Endurance";
}
pdat+="&course_type="+crs;
}
cout << crs << " was chosen"<<endl;
inet.post("/island/process_training.phtml",pdat,"www.neopets.com/island/training.phtml?type=status");
return 1;
}
if(needspay){
while(1){
cout << "attempting to pay "<<stone<<" for "+name+"'s training"<<endl;
cout << "attempting to pay\r";
inet.get("/island/process_training.phtml?type=pay&pet_name="+name,"http://www.neopets.com/island/training.phtml?type=status");
cout << "checking payment \r";
inet.get("/island/training.phtml?type=status");
if(instr(inet.cursource,"process_training.phtml?type=pay&pet_name="+name)){
cout << "item must be bought \n"<<endl;
int fnum=0,payd;
while((payd=wizbuy(stone,TopPay))<1){
cout << "\rbuy failure: "<<fnum;
Sleep(Wait_sec*1000);
fnum++;
}
cout << "payed "<<payd<<" for "<< stone<<endl;
}else break;
}
return 1;
}
}
return 0;
}
string Neopets::searchwiz(string item,int price=0){
string prc="";
if(price != 0)prc = ctostr(price);
inet.post("/market.phtml","type=process_wizard&feedset=0&shopwizard="+ctoposthex(item)+"&table=shop&criteria=exact&min_price=0&max_price="+prc,"http://www.neopets.com/market.phtml");
//writefile("wizsearch.html",inet.cursource);
int ind = findnext(inet.cursource,"browseshop.phtml?owner=",findnext(inet.cursource,"Searching for",0));
string link = getbetween (inet.cursource,"browseshop.phtml?owner=","\"",ind-1);
return link; // buy link
}
int Neopets::wizbuy(string item,int price=0){
string link = searchwiz(item,price);
// cout << "Link: "<<link<<endl;
if(link == "")return 0;
string tlink=link;
string np = getafter(link,"neopoints=");
if(np == "") return 0;
inet.get("/browseshop.phtml?owner="+link,"http://www.neopets.com/market.phtml");
// writefile("browseshop.html",inet.cursource);
int a = findnext(inet.cursource,item,0);
a = findlastl(inet.cursource,"href=",a);
if(a < 0) return 0;
link = getbetween(inet.cursource,"buy_item.phtml?","'",a);
inet.get("/buy_item.phtml?"+link,"http://www.neopets.com/browseshop.phtml?owner="+tlink);
//writefile("buyitem.html",inet.cursource);
return ctoint(np);
}
//F"><b>
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'><b>",lastsind);
if(ind == -1) break;
lastsind = ind+50;
data[0] = getbetween(cs,"0 bgcolor='#ffffcc'><b>","<",ind-10);
ind = findnext(cs,"c' align=center><b>",ind);
data[1] = getbetween(cs,"c' align=center><b>","<",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: "<<item<<endl;
for(int i = 0; i < av; i++){
ind = findnext(inet.cursource,"F\"><b>",ind+5);
if(ind == -1)break;
temp= cctoint(getbetween(inet.cursource,"F\"><b>"," NP",ind-5));
// cout << "price:";
// cout << temp<< endl;
tot+=temp;
chks=i;
}
chks++;
//cout << "chks: "<<chks << " tot: "<<tot<<" retot:"<<tot/chks<<endl;
tot/=chks;
return tot;
}
#define s_b(s) booltostr(s)
void Neopets::priceshop(varlist &vl){
bool Reprice=vl.bvalueof("AP_reprice");
bool Newb = vl.bvalueof("AP_noob");
int AvNum=2;
if(Newb)AvNum=4;
int Searches = vl.ivalueof("AP_searches");
int Wait = vl.ivalueof("AP_wait");
int Rem_perc = vl.ivalueof("AP_percent");
int Rem_np = vl.ivalueof("AP_rem_np");
bool Return_inv = vl.bvalueof("AP_ret_inv");
int Ret_cost = vl.ivalueof("AP_ret_cost");
varlist items("items");
getshopitems(items);
string csl = items.valueof("names_csl");
string name,id,ind,stk,cost;
string csli;
int tot=0,temp,low;
string ret="pin="+vl.valueof("PIN")+"&type=update_prices&orderby=&view=";
while((id=csl_pop(csl))!=""){
csli=items.valueof(id);
stk=csl_pop(csli);
ind=csl_pop(csli);
name=csl_pop(csli);
cost=csl_pop(csli);
if(Reprice && ctoint(cost)>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 && (low<Ret_cost ||low>99999))){
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"<<endl;
}
}
coutt << "bank has " << bank_balance() << " NP"<<endll;
}
void Neopets::gallerygather(){
title("begin");
string h = usernamelist.pop();
title("middle");
if(instr(h," ") || visitedlist.find(h) ){
return;
}
title("second");
visitedlist.set(h);
coutt<<"visiting "<<h;
title("before get");
inet.get("/gallery/index.phtml?gu="+h+"&user_cat=0");
title("after get");
coutt<<"\rvisited "<<h<<" "<<endll;
TOTAL_PAGES++;
string c = inet.cursource,n,cost,tempc;
int ind = 0,lower=80,i=0,u=0,it,itt;
// coutt << "starting loop"<<endll;
while(1){
// title("begin loop");
ind = findnext(c,"><br><b class=textcolor>",ind+1);
if(ind == -1){
// title("attempted breaking");
//if(false && instr(c,"l?lower="+ctostr(lower))){
// coutt << "grabbing page 2"<<endll;
// lower+=80;
// inet.get("/brosweshop.phtml?owner="+h+"&lower="+ctostr(lower));
// TOTAL_PAGES++;
// c= inet.cursource;
// ind=0;
// i=0;
// continue;
// }
break;
}
// title("getting");
n = getbetween(c,"><br><b class=textcolor>","</b><br></td>",ind-3);
// cost = getbetween(c,"Cost : ","<",ind);
// coutt << "found item: "<<n << " for "<<cost<<endll;
// title("list.valueof(n)");
tempc=itemlist.valueof(n);
// if(tempc==""){
// towizlist.set(n);
// }
it=100000;
itt=ctoint(tempc);
// title("before if");
if((it<itt || itt<1)){
itemlist.set(n,it);
u++;
}
i++;
// title("end");
}
coutt << "Updating status"<<endll;
TOTAL_UPDATED+=u;
TOTAL_FOUND+=i;
clrscr();
coutt << "Updated: "<<u <<endll;
coutt << "found: "<<i<<endll;
coutt << "total updated:"<< TOTAL_UPDATED<<endll;
coutt << "total Found: "<<TOTAL_FOUND<<endll;
coutt << "Pages visited:"<<TOTAL_PAGES<<endll;
coutt << "items in database: "<<itemlist.length()<<endll;
coutt << "names in list: "<<usernamelist.length()<<endll;
if(vars.ivalueof("wiz time") < timestamp() && towizlist.length()>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"<<endll;
}
void Neopets::pricegather(){
string h = usernamelist.pop();
if(instr(h," ") || visitedlist.find(h) ){
return;
}
visitedlist.set(h);
coutt<<"visiting "<<h<<endll;
inet.get("/browseshop.phtml?owner="+h);
TOTAL_PAGES++;
string c = inet.cursource,n,cost,tempc;
int ind = 0,lower=80,i=0,u=0,it,itt,makesure=0;
// coutt << "starting loop"<<endll;
while(makesure<100){
ind = findnext(c,"</a> <br> <b>",ind+1);
if(ind == -1){
makesure=0;
if(instr(c,"l?lower="+ctostr(lower))){
coutt << "grabbing page 2"<<endll;
lower+=80;
inet.get("/brosweshop.phtml?owner="+h+"&lower="+ctostr(lower));
TOTAL_PAGES++;
c= inet.cursource;
ind=0;
i=0;
continue;
}else break;
}
makesure++;
n = getbetween(c,"</a> <br> <b>","</b><br>",ind-3);
cost = getbetween(c,"Cost : ","<",ind);
// coutt << "found item: "<<n << " for "<<cost<<endll;
tempc=itemlist.valueof(n);
if(tempc==""){
towizlist.set(n);
}
it=cctoint(cost);
itt=ctoint(tempc);
if((it<itt || itt<1) && it>0 ){
itemlist.set(n,it);
u++;
}
i++;
}
// coutt << "Updating status"<<endll;
TOTAL_UPDATED+=u;
TOTAL_FOUND+=i;
// infinite loop happens before this
clrscr();
coutt << "Updated: "<<u <<endll;
coutt << "found: "<<i<<endll;
coutt << "total updated:"<< TOTAL_UPDATED<<endll;
coutt << "total Found: "<<TOTAL_FOUND<<endll;
coutt << "Pages visited:"<<TOTAL_PAGES<<endll;
coutt << "items in database: "<<itemlist.length()<<endll;
coutt << "names in list: "<<usernamelist.length()<<endll;
if(false && vars.ivalueof("wiz time") < timestamp()){
n = towizlist.pop();
if(n=="")return;
tempc=wizprice(n);
TOTAL_PAGES++;
if(ctoint(tempc)>0){
itemlist.set(n,tempc);
// wizedlist.set(n);
}
vars.set("wiz time",timestamp()+vars.ivalueof("wiz delay"));
}
coutt << "returned"<<endll;
}
//MESSAGELIST.fillfromfile(vvar("(ap)(sch)body list file"));
strlist MESSAGELIST,sentmail;
void Neopets::neomail(string uname="",string title="",string body=""){
if(uname == "" || title == "" || body == "")return;
inet.post("/process_neomessages.phtml","recipient="+uname+"&subject="+title+"&message_body="+body,"http://www.neopets.com/neomessages.phtml?type=send");
}
void Neopets::mailcusties(){
inet.get("/market.phtml?type=sales");
int ind = findnextl(inet.cursource,"</td></tr><tr><td bg",0)+50;
string cs = inet.cursource;
if(MESSAGELIST.length()<1){
MESSAGELIST.load("mailmessages.txt");
nlog("body list file contains " + ctostr(MESSAGELIST.length())+" entries\n");
}
string item,name;
while(1){
item = getbetween(cs,"align=center>","<",ind);
ind=findnextl(cs,"align",ind)+50;
name = getbetween(cs,"<b>","<",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,"<p>You currently have <b>"," 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 "<<name<<endll;
ofile << name<<endll;
// title("g6");
usernamelist.set(name);
// title("g7");
}
}
int Neopets::DoMtg(strlist &grab,int GrabAmount=1000){
if(GRABNUM>9){
coutt <<"MTG DONE"<<endll;
pause();
return -1;
}
inet.get("/donations.phtml");
string t = inet.cursource,name,url;
int ind = 1000,i=0;
while(ind != -1){
ind = findnext(t,"</A><BR><B>",ind+1);
if(ind == -1) break;
//coutt << "firstsearch: "<<ind << endll;
name = getbetween(t,"</A><BR><B>","</B><",ind-3);
if(grab.find(name) || (instr(name," NP") && ctoint(name)>GrabAmount)){
ATTEMPTED++;
coutt << "\rgrabbing " <<name<<": ";
int b = findlast(t,"takedonation_new.phtml?",ind);
url = getbetween(t,"takedonation_new.phtml?","\"><",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 << "<s>success, "<<GRABNUM<<" grabbed"<<endll<<endll;
parsemtgnames(t);
return 1;
}else{
coutt << "<f>failed"<<endll<<endll;
parsemtgnames(t);
return -2;
}
//pause();
break;
}
i++;
}
coutt <<i << "items found "<<dotting()<<" \r";
// if(i<10)coutt<<" ";
// coutt<<dotting()<<" ";
parsemtgnames(t);
return 0;
}
int Neopets::DoNPMtg(int GrabAmount=1000){
if(GRABNUM>10){
coutt <<"MTG DONE"<<endll;
pause();
return -1;
}
inet.get("/donations.phtml");
string t = inet.cursource,name,url;
int ind = 1000,i=-1,top=GrabAmount;
while(1){
ind = findnext(t," NP</B><br>",ind+1);
if(ind == -1)break;
name = getbetween(t,"</A><BR><B>"," ",ind-15);
if(top < 0 || ctoint(name)>top){
i=ind;
top = ctoint(name);
}
}
if(i!=-1){
ATTEMPTED++;
coutt << "grabbing "<<top<<" NP:";
int b = findlast(t,"takedonation_new.phtml?",ind);
url = getbetween(t,"takedonation_new.phtml?","\"><",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, "<<GRABNUM<<" grabbed"<<endll;
parsemtgnames(t);
return 1;
// depositall();
}else{
coutt << "failed"<<endll;
parsemtgnames(t);
return -2;
}
}
cout << "searching"<<dotting()<<" \r";
// coutt << "\r \r"<<i;
// if(i<10)coutt<<" ";
// coutt<<dotting()<<" \r";
parsemtgnames(t);
return 0;
}
//
//void writefile(string n,string c){
// ofstream ofile(n.c_str());
// ofile << c;
// ofile.close();
//}
int Neopets::login(string n = "", string p = ""){
if(n =="")n = name;
if(p=="")p=pass;
int xynum = 0;
if(do_login_long){
inet.get("/index.phtml");
inet.get("/loginpage.phtml");
inet.post("/hi.phtml","destination=%2Findex.phtml&username="+n+"&x=0&y=0");
inet.post("/login.phtml","destination=%2Findex.phtml&username="+n+"&password="+p+"&x=0&y=0");
}
else{
inet.get("/login.phtml?username="+n+"&password="+p+"&destination=index.phtml&x=");
}
inet.get("/");
if(!instr(inet.cursource,n)){
coutt << "possible login failure"<<endll;
coutt << "name: "<<n << " pass:"<<p<<endll;
ofstream ofile("fail_log.html");
ofile << inet.cursource;
ofile.close();
return -1;
}
return 0;
}
Neopets::Neopets(string n, string p){
vars.name("vars");
GRABBED_NP_TOT=0;
islogged = false;
name = n;
pass = p;
TNW=0;
TNP=0;
TOTAL_UPDATED=0;
TOTAL_FOUND=0;
TOTAL_PAGES=0;
GRABNUM=0;
USE_NAMES=true;
GRABBED_NP=false;
ATTEMPTED=0;
inet.init("www.neopets.com");
}
Neopets::Neopets(){
GRABBED_NP_TOT=0;
islogged = false;
name = "";
pass = "";
TNW=0;
TNP=0;
TOTAL_UPDATED=0;
TOTAL_FOUND=0;
TOTAL_PAGES=0;
GRABNUM=0;
USE_NAMES=true;
GRABBED_NP=false;
ATTEMPTED=0;
inet.init("www.neopets.com");
}
#define abdiff(s,i) (s>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,"<tr bgcolor='white'>",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: "<<h<<endll;
coutt << "cards in pyramid: "<<cleft<<endll;
while(1){
ind = findnext(t,"position=",ind)-10;
if(ind < 0) break;
clicks[x][0]=getbetween(t,"games/mcards/","_",ind);
clicks[x][1]=getbetween(t,"position=","'>",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"<<ccard<< " "<<clicks[i][0]<<endll;
ind = 0;
inet.get("/games/pyramids/pyramids.phtml?action=play&position="+clicks[i][1],"http://www.neopets.com/games/pyramids/pyramids.phtml");
nlog("clicked on position: "+clicks[i][1]+" card: "+clicks[i][0]);
t=inet.cursource;
fn = true;
cleft--;
break;
}
}
if(!fn){
inet.get("/games/pyramids/pyramids.phtml?action=draw","http://www.neopets.com/games/pyramids/pyramids.phtml");
t = inet.cursource;
p = findnext(t,"<tr bgcolor='white'>",0);
p = findnext(t,"width='125'>",p);
p = findnext(t,"width='125'>",p+1);
coutt << "cards left: "<< getbetween(t,"width='125'>","<",p-3)<<endll;;
coutt << "drew a card" << endll;
}
clrscr();
}
}
static string LOGSTR="";
bool ynques(string p){
cout << p << "(y/n)==>";
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 <<ttp;
// setcolors("white","black");
// coutt <<" ";
//
// }
// coutt <<endll;
// }
void draw_at(int x,int y, string what){
COORD a,b;
a=getxy();
b.X=x;
b.Y=y;
gotoxy(b);
coutt << what;
gotoxy(a);
}
string negback[15][15];
void reset_negback(){
for(int i = 0; i < 15; i++){
for(int n = 0; n < 15; n++){
negback[i][n]="x";
}
}
}
void draw_negg(COORD negspace,string ttp){
trace();
COORD l = getxy();
trace();
negback[negspace.X][negspace.Y]=ttp;
negspace.X=((NEGmargin)+negspace.X*4)+5;
negspace.Y*=2;
negspace.Y++;
trace();
gotoxy(negspace);
if(ttp =="")cout << " ";
trace();
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 << ttp;
trace();
setcolors("white","black");
trace();
gotoxy(l);
}
void color_negg(int i, int n, string ttp){
COORD negspace;
COORD l = getxy();
//negback[negspace.X][negspace.Y]=ttp;
negspace.X=((NEGmargin)+i*4)+5;
negspace.Y=(n*2)+1;
gotoxy(negspace);
if(ttp=="c"){// clicking target neg
setcolors("purple","white");
coutt << "C";
}
if(ttp=="!"){// clicking negg NOT SAFE
setcolors("black","red");
coutt << "!";
}
if(ttp=="r"){
setcolors("black","red");
coutt << "R";
}
if(ttp=="f"){
setcolors("dark red","light green");
coutt << "f";
}
setcolors("white","black");
gotoxy(l);
}
void color_negg(string a, string b){
string t="",tt="";
bool d=0;
for(int i = 0; i < a.length(); i++){
if(a[i]=='-'){
d=1;
continue;
}
if(d){
tt+=a[i];
}
else
t+=a[i];
}
color_negg(ctoint(t),ctoint(tt),b);
}
void draw_neggboard_new( int GRDSIZE){
string o,t;
COORD j,jt;
j.X=NEGmargin;
j.Y=0;
gotoxy(j);
coutt << " 0 1 2 3 4 5 6 7 8 ";
if(GRDSIZE>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"<<endll;
inet.post("/games/neggsweeper/neggsweeper.phtml","game_level="+ctostr(DIFFCLT),"http://www.neopets.com/games/neggsweeper/index.phtml");
//writefile("out.html",inet.cursource);
inet.get("/games/neggsweeper/neggsweeper.phtml?flag_negg=&position="+ctostr(random(2))+"-"+ctostr(random(2)),"http://www.neopets.com/games/neggsweeper/neggsweeper.phtml");
//writefile("coutt.html",inet.cursource);
// pause();
}
// pause();
//inet.get("/games/neggsweeper/neggsweeper.phtml?flag_negg=&position=13-13","http://www.neopets.com/games/neggsweeper/neggsweeper.phtml");
//above starts a new game and tries to clear a few spaces
redo:
trace();
gotoxy(loca);
// inet.post("/games/neggsweeper/neggsweeper.phtml","","http://www.neopets.com/games/neggsweeper/index.phtml");
int stind = findnext(inet.cursource,"Remaining",0);
int left = ctoint(getbetween(inet.cursource,"'><td align='center' width='50%'><b>","</b></",stind));
string stats= "Left: " + ctostr(left);
if(left == 0){
coutt << "found 0 left in page"<<endll;
if(instr(inet.cursource,"You Won!!!")){
coutt << "WON THIS GAME"<<endll;
Sleep(3000);
autos = true;
goto restart;
}
writefile("zeroleft.html",inet.cursource);
}
stind = findnext(inet.cursource,"</b></td><td align='center' width='50%'><b>",0);
stind = findnext(inet.cursource,"</b></td><td align='center' width='50%'><b>",stind+2);
int jackpot = ctoint( getbetween(inet.cursource,"</b></td><td align='center' width='50%'><b>","</b></td></tr>",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,"<td align=center width=30 height=30>",ind);
if(ind == -1){
if(instr(inet.cursource,"You have won <b>")){
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 <b>","</b>",0)<<endll;
coutt << "Game took "<<ttime << "seconds\n";
TNW++;
TOTWON+=jackpot;
autos=true;
goto restart;
}
coutt << "some issue parsing grid occurred" << endll;
coutt << "i:"<<i<<" n:"<<n<<" grdsize="<<GRDSIZE<<endll;
//coutt << "inet.lastfile="<<inet.get_lastfile()<<endll;
coutt << stats << endl;
writefile("error.html",t);
//pause();
// inet.get("/games/neggsweeper/neggsweeper.phtml","/games/neggsweeper/neggsweeper.phtml");
if(GRDSIZE==14){
GRDSIZE=9;
cout << "altered grid size to 9";
Sleep(5000);
clrscr();
draw_neggboard_new(GRDSIZE);
reset_negback();
writestats_new(stat_titles);
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)));
write_stats(sta,stats,DIFFCLT);
goto redo;
}
else{
trace();
autos = true;
goto restart;
}
}
temp = getbetween(t,"<td align=center width=30 height=30>","</td>",ind);
if(instr(temp,"nbsp")){// no negg
d = "";
}else
if(instr(temp,"t c")){// number
d = getbetween(t,"<b>","</b>",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"<<endll;
autos = true;
goto restart;
}
tt = ctostr(n)+"-"+ctostr(i);
negboard[n][i]=d;
ind++;
}
}
trace();
bool grab = false;
// if(CLRDED){
// for(int i = 0; i < GRDSIZE; i++){
// for(int n = 0; n < GRDSIZE; n++){
// tt = negboard[i][n];
// if(tt == "m" || ctoint(tt) >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()<<endll;
// pause();
int b = 0,m,ttmi;
string ttx;
// coutt <<"Reached mark "<< endmil()<<endll;
startmil();
bool didflag=true;
while(didflag){
didflag=false;
for(int i = 0; i < GRDSIZE; i++){ // mark all possible neggs
for(int n = 0; n < GRDSIZE; n++){
b=0;
//tt = ctostr(i)+"-"+ctostr(n);
m =ctoint(negboard[i][n]) ;
if(m>0){
//coutt << "m is " << m << " inside loop at"<<i << "-"<<n<<endll;
for(int c = -1; c < 2; c++){
for(int d = -1; d < 2;d++){
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" || ttm == "m"){
b++;
//coutt << "found #"<<b<<" at "<< i+c << "-"<<n+d <<endll;
}
//b+=(ttm=="x" ?1:0);
//b+=(ttm=="m" ?1:0);
}
}
//coutt << "b is " << b <<" after loop"<<endll;
if(b == m){
for(int c = -1; c < 2; c++){
for(int d = -1; d < 2;d++){
if(i+c < 0 || n+d < 0 ||i+c >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"<<ttb<<" ";
color_negg(ttb,"f");
inet.get("/games/neggsweeper/neggsweeper.phtml?flag_negg=1&position="+ttb,"http://www.neopets.com//games/neggsweeper/neggsweeper.phtml");
Sleep(SLPVAL/4);
gotoxy(loca);
}
negboard[i+c][n+d]="m";
//writefile("flagout.html",inet.cursource);
//}
}
}
}
}
}
}
}
}
// coutt << stats << endll;
// coutt << "Won: " << TNW <<endll;
// coutt << "Played: "<< TNP <<endll;
// coutt << " 0 1 2 3 4 5 6 7 8 9 10 11 12 13\n";
// for(int i = 0; i < 14; i++){
// coutt << i << (i < 10?" ":" ");
// for(int n = 0; n < 14; n++){
// tt = ctostr(i)+"-"+ctostr(n);
// ttp= negboard[n][i];
// coutt << " "<<ttp<<" ";
// if(ttp == "")coutt << " ";
// }
// coutt <<endll;
// }
//coutt << "finished marks in" << endmil()<<endll;
for(int i = 0; i < GRDSIZE; i++){ // find clickable neggs
for(int n = 0; n < GRDSIZE; n++){
//tt = ctostr(i)+"-"+ctostr(n);
ttx = negboard[i][n];
if(ttx == "x"){// found negg
for(int c = -1; c < 2; c++){
for(int d = -1; d < 2;d++){
if(i+c < 0 || n+d < 0 ||i+c >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 << "-"<<n << " "<<i+c<<"-"<<n+d<<endll;
b = 0;
for(int e = -1; e < 2; e++){
for(int f = -1; f < 2; f++){
if(i+c+e < 0 || n+f+d < 0 ||i+e+c >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 "<<b<<" marked"<<endll;
if(b==ttmi){
ttx = ctostr(i)+"-"+ctostr(n);
if(i==LAST_x && n==LAST_y){
cout << "Neopets failed... starting new grid"<<endl;
Sleep(1000);
autos=true;
goto restart;
}
LAST_x=i;
LAST_y=n;
coutt << "clicking " << ttx<<" ";
color_negg(i,n,"c");
//coutt <<"finding clickable negg took "<< endmil()<<endll;
inet.get("/games/neggsweeper/neggsweeper.phtml?flag_negg=&position="+ttx,"http://www.neopets.com/games/neggsweeper/neggsweeper.phtml");
Sleep(SLPVAL);
//writefile("click.html",inet.cursource);
if(instr(inet.cursource,"You Won!!!")){
coutt << "Game WON earning: " << getbetween(inet.cursource,"You have won <b>","</b>",0)<<endll;
//writefile("won.html",inet.cursource);
TOTWON+=jackpot;
if(BIGGEST<jackpot)BIGGEST=jackpot;
//appendfile("log.html","last click" + ttx + "\n");
TNW++;
goto restart;
}
goto redo;
}
}
}
}
}
}
}
bool do_r_click=false;
// gotten to AFTER any logical decision
trace();
//for(int i =0;i<4;i++)rns[i]=(random(3)>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()<<endll;
do_r_click = true;
}
else
if( left > 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()<<endll;
do_r_click = true;
}else
if( left > 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()<<endll;
do_r_click = true;
}else
if( left > 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()<<endll;
do_r_click = true;
}
trace();
if(do_r_click){
Sleep(1000);
color_negg(ttx,"r");
do_r_click=false;
inet.get("/games/neggsweeper/neggsweeper.phtml?flag_negg=&position="+ttx,"http://www.neopets.com/games/neggsweeper/neggsweeper.phtml");
//rename("rclick2.html","rclick3.html");
//rename("rclick.html","rclick2.html");
//writefile("rclick.html",inet.cursource);
// inet.history.save("history.txt");
Sleep(SLPVAL);
goto redo;
}
for(int i = 0; i < GRDSIZE; i++){
for(int n = 0; n < GRDSIZE; n++){ // reset danger grid for setting.
dangergrid[i][n] = -100;
}
}
int points = 0; // points represents the current number on the board
for(int i = 0; i < GRDSIZE; i++){
for(int n = 0; n < GRDSIZE; n++){
if((points = ctoint(negboard[i][n])) > 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"<<endll;
points = 1000;
int savei=0, saven=0;
for(int i = 0; i < GRDSIZE; i++){
for(int n = 0; n < GRDSIZE; n++){
if(negboard[i][n] == "x" && dangergrid[i][n] > -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"<<endl;
Sleep(1000);
autos=true;
goto restart;
}
LAST_x=savei;
LAST_y=saven;
coutt << sv << " has lowest risk with score " << dangergrid[savei][saven]<<" ";
color_negg(savei,saven,"!");
DO_CLR=true;
// pause();
inet.get("/games/neggsweeper/neggsweeper.phtml?flag_negg=&position="+sv,"http://www.neopets.com/games/neggsweeper/neggsweeper.phtml");
// writefile("click.html",inet.cursource);
Sleep(SLPVAL);
if(instr(inet.cursource,"You Won!!!")){
coutt << "\nGame WON earning: " << getbetween(inet.cursource,"You have won <b>","</b>",0)<<endll;
//writefile("won.html",inet.cursource);
//pause();
Sleep(5000);
TOTWON+=jackpot;
if(BIGGEST<jackpot)BIGGEST=jackpot;
TNW++;
goto restart;
}
if(instr(inet.cursource,"You Lose!!!")){
TNP++;
coutt << "\nlost game... starting new game"<<endll;
autos=true;
Sleep(5000);
goto restart;
//inet.post("/games/neggsweeper/index.phtml","action=cancel","http://www.neopets.com/games/neggsweeper/index.phtml");
// inet.post("/games/neggsweeper/neggsweeper.phtml","game_level="+ctostr(DIFFCLT),"http://www.neopets.com/games/neggsweeper/index.phtml");
// // writefile("out.html",inet.cursource);
// inet.get("/games/neggsweeper/neggsweeper.phtml?flag_negg=&position=0-0","http://www.neopets.com/games/neggsweeper/neggsweeper.phtml");
//// writefile("coutt.html",inet.cursource);
}
goto redo;
// if we've gotten here, there is NO correct choice.
/* OLD random loop
int cnt = 0;
while(1){
for(int i = random(13); i < 14; i++){
for(int n = random(13); n < 14; n++){
ttm = ctostr(n)+"-"+ctostr(i);
ttb = negboard[n][i];
if(ttb == "x"){
coutt << "rclicking " << n << "-"<<i<< endll;
inet.get("/games/neggsweeper/neggsweeper.phtml?flag_negg=&position="+ttm,"http://www.neopets.com/games/neggsweeper/neggsweeper.phtml");
writefile("rclick.html",inet.cursource);
if(instr(inet.cursource,"You have won <b>")){
coutt << "Game WON earning: " << getbetween(inet.cursource,"You have won <b>","</b>",0)<<endll;
goto restart;
}
if(instr(inet.cursource,"You Lose!!!")){
coutt << "lost game... starting new game"<<endll;
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"<<endll;
inet.post("/games/neggsweeper/neggsweeper.phtml","game_level=3","http://www.neopets.com/games/neggsweeper/index.phtml");
writefile("out.html",inet.cursource);
inet.get("/games/neggsweeper/neggsweeper.phtml?flag_negg=&position=2-2","http://www.neopets.com/games/neggsweeper/neggsweeper.phtml");
writefile("coutt.html",inet.cursource);
}
goto redo;
}
}
}
}*/
}
//There are no more available moves
/*
ind = findnext(mynet.cursource,"ou got it",0);
if(ind != -1){
void sdbtoinv(){
inet.get("/safetydeposit.phtml");
coutt << inet.headers<<endll;
int ind = findnextl(inet.cursource,"images.neopets.com/items",1000);
string data[50][3];
for(int b=0; b < 50; b++){
data[b][0] = "";
data[b][1] = "";
data[b][2] = "";
}
int i = 0,allmov=0;
coutt << "moving items from sdb to inventory:"<<endll;
while(i<51){
if(ind == -1)break;
test(ind = findnextl(inet.cursource,"><b>",ind))break;
coutt <<(data[i][0] = getbetween(inet.cursource,"><b>","<",ind-10))<<endll;
data[i][1] = getbetween(inet.cursource,"r\"><b>","<",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]<<endll;
data[x][0]="";
data[x][1]="";
data[x][2]="";
x++;
}
inet.post("/process_safetydeposit.phtml?checksub=scan",ret,"http://www.neopets.com/safetydeposit.phtml");
}
void invtoshop(string pin,valwrapper *mynet=&inet){
mynet->get("market.phtml?type=your");
int runs = 1;
int space = ctoint(getbetween(mynet->cursource,"Free Space : <b>","<"));
if(!instr(mynet->cursource,"Free Space")){ space=3; runs=2;}
while(runs>0){
runs--;
mynet->get("/quickstock.phtml");
int ind = findnextl(mynet->cursource,"<TR bgcolor=\"#FFFFFF\">",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,"<TR bgcolor=\"#FFFFFF\">",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;
}
*/