Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <time.h>
- //http://gnuwin32.sourceforge.net/packages/wget.htm
- static int Goldick(const char *Name, char *Link) {
- FILE *HTMLFile = fopen(Name,"rb");
- if(HTMLFile == NULL) {
- fputs("Goldick Couldn't open file",stderr); return 0;
- }
- fseek(HTMLFile, 0, SEEK_END);
- long FileSize = ftell(HTMLFile);
- rewind(HTMLFile);
- char *Buffer = (char*)malloc(sizeof(char)*FileSize);
- if(Buffer == NULL) {
- fclose(HTMLFile);
- fputs("Goldick Memory error",stderr); return 0;
- }
- if(FileSize != fread(Buffer,1,FileSize,HTMLFile)) {
- fclose(HTMLFile);
- fputs("Goldick Reading error",stderr); return 0;
- }
- fclose(HTMLFile);
- int PokedexNum = -1, HP = 0, ATK = 0, DEF = 0, SpATK = 0, SpDEF = 0, SPD = 85;
- char PokeName[64]="???";
- char Type[64]="Gay";
- char Kind[64]="Dick"; // dick
- char URL[200] = "http://novasquirrel.com";
- char *Ptr;
- Ptr = strstr(Buffer, "line-height:2.28;\"><b><a href=\"/wiki/List_of_Pok%C3%A9mon_by_National_Pok%C3%A9dex_number\" title=\"List of Pok\xc3\xa9mon by National Pok\xc3\xa9dex number");
- if(Ptr != NULL) {
- Ptr = strstr(Ptr, "</span>");
- if(Ptr != NULL) {
- while(*Ptr != '#') Ptr--;
- PokedexNum = strtol(Ptr+1, NULL, 10);
- }
- }
- int GetStat(char *Base, char *SeekMe) {
- char *Peek;
- if((Peek = strstr(Base, SeekMe)) == NULL) return 0;
- if((Peek = strstr(Peek, "</th>")) == NULL) return 0;
- if((Peek = strstr(Peek+1, "</th>")) == NULL) return 0;
- while(!isdigit(*Peek)) Peek--;
- while(isdigit(*Peek)) Peek--;
- return strtol(Peek+1, NULL, 10);
- }
- char *BaseStats = strstr(Buffer, "<h4> <span class=\"mw-headline\" id=\"Base_stats\">Base stats</span></h4>");
- if(BaseStats != NULL) {
- HP = GetStat(BaseStats, "/wiki/Stats#Hit_Points");
- ATK = GetStat(BaseStats, "/wiki/Stats#Attack");
- DEF = GetStat(BaseStats, "/wiki/Stats#Defense");
- SpATK = GetStat(BaseStats, "/wiki/Stats#Special_Attack");
- SpDEF = GetStat(BaseStats, "/wiki/Stats#Special_Defense");
- SPD = GetStat(BaseStats, "/wiki/Stats#Speed");
- }
- int NumType = 0;
- void TryType(char *LookFor, char *Name) {
- if(NULL==strstr(Buffer, LookFor)) return;
- if(NumType == 0) {
- strcpy(Type, Name);
- NumType++;
- } else if(NumType == 1) {
- strcat(Type, "/");
- strcat(Type, Name);
- }
- }
- TryType("\"Normal-type Pok\xc3\xa9mon\"","Normal");
- TryType("\"Ghost-type Pok\xc3\xa9mon\"","Ghost");
- TryType("\"Fighting-type Pok\xc3\xa9mon\"","Fighting");
- TryType("\"Electric-type Pok\xc3\xa9mon\"","Electric");
- TryType("\"Grass-type Pok\xc3\xa9mon\"","Grass");
- TryType("\"Psychic-type Pok\xc3\xa9mon\"","Psychic");
- TryType("\"Bug-type Pok\xc3\xa9mon\"","Bug");
- TryType("\"Dragon-type Pok\xc3\xa9mon\"","Dragon");
- TryType("\"Ice-type Pok\xc3\xa9mon\"","Ice");
- TryType("\"Dark-type Pok\xc3\xa9mon\"","Dark");
- TryType("\"Steel-type Pok\xc3\xa9mon\"","Steel");
- TryType("\"Poison-type Pok\xc3\xa9mon\"","Poison");
- TryType("\"Fire-type Pok\xc3\xa9mon\"","Fire");
- TryType("\"Water-type Pok\xc3\xa9mon\"","Water");
- TryType("\"Rock-type Pok\xc3\xa9mon\"","Rock");
- TryType("\"Ground-type Pok\xc3\xa9mon\"","Ground");
- TryType("\"Flying-type Pok\xc3\xa9mon\"","Flying");
- TryType("\"Fairy-type Pok\xc3\xa9mon\"","Fairy");
- Ptr = strstr(Buffer, "<title>");
- if(Ptr != NULL) {
- Ptr += 7;
- char *Poke = PokeName;
- while(*Ptr != '(')
- *(Poke++) = *(Ptr++);
- while(*Poke != ' ')
- Poke--;
- *Poke = 0;
- }
- sprintf(URL, "http://bulbapedia.bulbagarden.net/wiki/%s", PokeName);
- for(Ptr = URL;*Ptr;Ptr++)
- if(*Ptr == ' ')
- *Ptr = '_';
- Ptr = strstr(Buffer, "<td> <b><a href=\"/wiki/Species\" title=\"Species\"><span style=\"color:#000;\">Species</span></a></b>");
- if(Ptr != NULL) {
- Ptr = strstr(Ptr, "</td></tr></table>");
- if(Ptr != NULL) {
- while(*Ptr != '>') Ptr--;
- Ptr+=2;
- char *Poke = Kind;
- while(!(Ptr[1]=='P'&&Ptr[2]=='o'&&Ptr[3]=='k'))
- *(Poke++) = *(Ptr++);
- *Poke = 0;
- if(!strcasecmp(Kind, "Duck"))
- strcpy(Kind, "Dick");
- }
- }
- if(HP != 0)
- printf("#%.3i %s, the %s Pokemon. %s type. Base stats: HP %i, ATK %i, DEF %i, SpATK %i, SpDEF %i, SPD %i, TOTAL %i. %s", PokedexNum, PokeName, Kind, Type, HP, ATK, DEF, SpATK, SpDEF, SPD, HP+ATK+DEF+SpATK+SpDEF+SPD, URL);
- else
- printf("Are you sure that's a Pokemon?");
- free(Buffer);
- return 1;
- }
- int main(int argc, char *argv[]) {
- srand((unsigned)time(NULL));
- if(argc < 2){puts(":("); return -1;}
- remove("pokeymans.html");
- char Buff[768];
- if(!strcasecmp(argv[1],"NovaSquirrel")) {
- printf("#??? NovaSquirrel, the Dickgirl Pokemon. Electric type. Base stats: HP 100, ATK 100, DEF 100, SpATK 100, SpDEF 100, SPD 100, Total 600.");
- } else if(!strcasecmp(argv[1],"penis")) {
- printf("#??? My Penis, the Phallic Pokemon. Normal type. Base stats: HP 1, ATK 1, DEF 1, SpATK 1, SpDEF 1, SPD 100, Total 105.");
- } else if(!strcasecmp(argv[1],"fisher_price")) {
- printf("#??? Fisher Price, the Go Eat Shit Fuckers Pokemon. Nuclear type. Base stats: HP -1, ATK -1, DEF -1, SpATK -1, SpDEF -1, SPD -1, Total -6.");
- } else if(argv[1][0]=='.') {
- char *TypeNames[] = {"Normal","Ghost","Fighting","Electric","Grass","Psychic","Bug","Dragon","Ice","Dark","Steel","Poison","Fire","Water","Rock","Ground","Flying","Nuclear",NULL};
- char *Kinds[] = {"Fake","Cool","Dick","Illegal","President","Drugs","Epic","Rad"};
- char *StuffNames;
- int HP = 1+(rand()&255);
- int ATK = 1+(rand()&255);
- int DEF = 1+(rand()&255);
- int SpATK = 1+(rand()&255);
- int SpDEF = 1+(rand()&255);
- int SPD = 1+(rand()&255);
- char PokeName[100];
- int i;
- for(i=0;i<strlen(argv[1]);i++)
- if(argv[1][1+i]=='_')
- PokeName[i] = ' ';
- else
- PokeName[i] = argv[1][1+i];
- PokeName[i]=0;
- if(rand()&1)
- printf("#??? %s, the %s Pokemon. %s type. Base stats: HP %i, ATK %i, DEF %i, SpATK %i, SpDEF %i, SPD %i, TOTAL %i.", PokeName, Kinds[(rand()>>7)&7], TypeNames[rand()%18], HP, ATK, DEF, SpATK, SpDEF, SPD, HP+ATK+DEF+SpATK+SpDEF+SPD);
- else
- printf("#??? %s, the %s Pokemon. %s/%s type. Base stats: HP %i, ATK %i, DEF %i, SpATK %i, SpDEF %i, SPD %i, TOTAL %i.", PokeName, Kinds[(rand()>>7)&7], TypeNames[rand()%18], TypeNames[rand()%18], HP, ATK, DEF, SpATK, SpDEF, SPD, HP+ATK+DEF+SpATK+SpDEF+SPD);
- } else {
- sprintf(Buff, "wget \"http://bulbapedia.bulbagarden.net/wiki/%s_(Pok%%C3%%A9mon)\" -q -O pokeymans.html", argv[1]);
- system(Buff);
- char Link[1024]="";
- Goldick("pokeymans.html", Link);
- remove("pokeymans.html");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement