home *** CD-ROM | disk | FTP | other *** search
/ The Arcade BBS / arcadebbs.zip / arcadebbs / bbstools / MODS / FMD-04B.ZIP / FMD-04B.MOD < prev    next >
Encoding:
Text File  |  1995-07-03  |  6.6 KB  |  233 lines

  1. Nicolas Leblanc #2 @20302
  2. Fri Jun 30 02:53:07 1995
  3.    ┌┬─── ──  ─   ─  ── ───────────────────────────────────────────────────┬─ ∙∙
  4.    ││                    Alternative Worlds Presents                      │
  5.    └┼─────────────────────────────────────────────────────────────────────┐
  6.    ││ Mod Name       » FMD-04b.MOD                                        │∙
  7.    ││ Difficulty     » █▒▒▒▒▒▒▒▒▒▒ (1/10)                                 │:
  8.    ││ WWIV Version   » 4.24                                               ││
  9.    ││ Date Affected  » 06/01/95                                           ││
  10.    :│ Files Affected » MISCCMD.C / MMENU.C / NEWUSER.C / COM.C            ││
  11.    ∙│ Description    » Top 5 Upload/Download While Entering Xfer Section  ││
  12.     └─────────────────────────────────────────────────────────────────────┼┐
  13.     │       A French Mod Division Release - (C) 1995 FMD Software         ││
  14. ∙∙ ─┴─────────────────────────────────────────────────── ──  ─   ─  ── ───└┘
  15.  
  16.  
  17.  ┌┬══════════════════┐
  18.  ││ Long Description ││
  19.   └══════════════════┴┘
  20.  
  21.         This mod will show a top 5 upload/download when entering the file
  22.         section, it's Vision-X look-alike, converting some colors too.
  23.         Installation is easy.
  24.  
  25. Revision A:
  26.  
  27.  - Updated for WWIV v4.24
  28.  
  29. Revision B:
  30.  
  31.  - Now showing the top 5 only once, then prompt user if he wants to see it
  32.    again (original idea from Zu Digital)
  33.  - Added a "Please Wait" message, because when you have a large user list,
  34.    it's long to compile the statistics.
  35.  
  36.  ┌┬═══════┐
  37.  ││ Tests ││
  38.   └═══════┴┘
  39.  
  40.   This modification has been tested on a virgin WWIV v4.24 source using
  41.   Borland C++ v4.5
  42.  
  43.  
  44. ──────────────────────────────────────────────────────────────────────────────
  45.                                    Legend
  46.                           ╔═══╤══════════════════┐
  47.                           │ + │ Add This Line    │
  48.                           │ - │ Delete This Line │
  49.                           │ * │ Modify This Line │
  50.                           │ = │ Existing Line    │
  51.                           └═══╧══════════════════╝
  52. ───[Step 1]────────────────────────────────────────────────────────────────────
  53.  
  54. Load COM.C and add the following function to the end of the file:
  55. (You might already have this function if you installed other FMD mods)
  56.  
  57. void litebar(char *fmt, ...)
  58. {
  59.   va_list ap;
  60.   char s[512], s2[250];
  61.   
  62.   va_start(ap, fmt);
  63.   vsprintf(s, fmt, ap);
  64.   va_end(ap);
  65.   
  66.   if (okansi()) 
  67.   {
  68.     npr("\x1B[0;1m%s\r\n", charstr(strlen(s)+6, '▄'));
  69.     sprintf(s2, "\x1B[0;34;47m ∙ %s ∙ \x1B[40m", stripcolors(s));
  70.     pl(s2);
  71.     npr("\x1B[0;1;30m%s\r\n", charstr(strlen(s)+6, '▀'));
  72.   } else
  73.     pl(s);
  74.   ansic(0);
  75. }
  76.  
  77. ───[Step 2]────────────────────────────────────────────────────────────────────
  78.  
  79. Load MISCCMD.C and copy the following function at the end of the file:
  80.  
  81. void top_ul_dl(void)
  82. {
  83.   userrec u;
  84.   int i, i1, j, c1;
  85.   unsigned long ukpu[10], dkpu[10], sl;
  86.   float tpu[10];
  87.   char s[2][10][40], sc[40];
  88.   
  89.   
  90.   c1= thisuser.colors[8];
  91.   thisuser.colors[8]= 13;
  92.   
  93.   if (g_flags & g_flag_files_top_5)
  94.   {
  95.     nl();
  96.     prt(5,"See top five again? ");
  97.     if (!yn())
  98.       return;
  99.   } else
  100.     g_flags |= g_flag_files_top_5;
  101.   prt(3,"Please wait...");
  102.   for (i= 0; i<5; i++)
  103.   {
  104.     ukpu[i]= 0;
  105.     dkpu[i]= 0;
  106.     tpu[i]= 0;
  107.   }
  108.   for (i= 0; i<2; i++)
  109.     for (i1= 0; i1<5; i1++) strcpy(s[i][i1], "■ Empty ■");
  110.   
  111.   for (i= 0; i<status.users; i++)
  112.   {
  113.     read_user(smallist[i].number, &u);
  114.     if (u.sl<255) 
  115.     {
  116.       sl= ukpu[0];
  117.       j= 0;
  118.       for (i1= 1; i1<5; i1++)
  119.         if (ukpu[i1]<sl)
  120.         {
  121.           j= i1;
  122.           sl= ukpu[i1];
  123.         }
  124.       if (u.uk>sl) 
  125.       {
  126.         ukpu[j]= u.uk;
  127.         strcpy(s[0][j], u.name);
  128.         properize(s[0][j]);
  129.       }
  130.       sl= dkpu[0];
  131.       j= 0;
  132.       for (i1= 1; i1<5; i1++)
  133.         if (dkpu[i1]<sl) 
  134.         {
  135.           j= i1; sl= dkpu[i1];
  136.         }
  137.       if (u.dk>sl) 
  138.       {
  139.         dkpu[j]= u.dk;
  140.         strcpy(s[1][j], u.name);
  141.         properize(s[1][j]);
  142.       }
  143.     }
  144.   }
  145.   for (i= 0; i<5; i++)
  146.     tpu[i]= (tpu[i]/60);
  147.   for (j= 0; j<5; j++)
  148.     for (i= j+1; i<5; i++)
  149.     {
  150.       if (ukpu[i]>ukpu[j])
  151.       {
  152.         sl= ukpu[i];
  153.         ukpu[i]= ukpu[j];
  154.         ukpu[j]= sl;
  155.         strcpy(sc, s[0][i]);
  156.         strcpy(s[0][i], s[0][j]);
  157.         strcpy(s[0][j], sc);
  158.       }
  159.       if (dkpu[i]>dkpu[j])
  160.       {
  161.         sl= dkpu[i]; dkpu[i]= dkpu[j]; dkpu[j]= sl;
  162.         strcpy(sc, s[1][i]);
  163.         strcpy(s[1][i], s[1][j]);
  164.         strcpy(s[1][j], sc);
  165.       }
  166.     }
  167.   outchr(12);
  168.   litebar("Highest Uploads/Downloads");
  169.   nl();
  170.   pl("1Top 5 Uploaders");
  171.   nl();
  172.   
  173.   for (i= 0; i<5; i++) 
  174.   {
  175.     npr("9%d3.  8%s3%s 7%6.3f Megs Uploaded\r\n", i+1, s[0][i], charstr(30-strlen(s[0][i]), '.'), (float)ukpu[i]/1024);
  176.   }
  177.   nl();
  178.   pl("1Top 5 Downloders");
  179.   nl();
  180.   for (i= 0; i<5; i++) 
  181.   {
  182.     npr("9%d3.  8%s3%s 7%6.3f Megs Downloaded\r\n", i+1, s[1][i], charstr(30-strlen(s[1][i]), '.'), (float)dkpu[i]/1024);
  183.   }
  184.   nl();
  185.   thisuser.colors[8]= c1;
  186.   if ((sysstatus_expert & thisuser.sysstatus)==0)
  187.     pausescr();
  188. }
  189.  
  190.  
  191. ───[Step 3]────────────────────────────────────────────────────────────────────
  192.  
  193. Load VARDEC.H and add the following line:
  194.  
  195. = #define g_flag_allow_extended 0x00000020
  196. = #define g_flag_disable_mci    0x00000040
  197. + #define g_flag_files_top_5    0x00000080
  198. =
  199. = #define PREV 1
  200.  
  201. ───[Step 4]────────────────────────────────────────────────────────────────────
  202.  
  203. Load MMENU.C and do the following change in void mainmenu:
  204.  
  205. =          write_inst(INST_LOC_XFER,udir[curdir].subnum,INST_FLAGS_ONLINE);
  206. =          curdloads=1;
  207. *          if (existprint(get_string(1037)))
  208. +            pausescr();
  209. +          top_ul_dl();
  210.  
  211. ───[Step 4]────────────────────────────────────────────────────────────────────
  212.  
  213. You will need to do MAKE FCNS right now, and recompile the entire BBS, We hope
  214. you will enjoy the modification
  215.  
  216. French Proverb: Ne donnez pas de perles à un cochon.
  217.  
  218. For comments, bug report and suggestion, e-mail at the following address:
  219.  
  220. Nicolas LeBlanc  2@20302.WWIVnet (aka Spotnick)
  221.                  -> spotnick@gamemaster.qc.ca
  222. Martin Bourdages 242@20306 / 3@20302.WWIVnet (aka Dark Shadow)
  223.                  -> martin.bourdages@radio.magicnet.com
  224.  
  225.                  =>   French Mod Division Support Sub   <=
  226.                                 SubType: FMD
  227.                            Host: @20302 (WWIVnet)
  228.                       Scan sublist for other networks
  229.  
  230.         Read PRODUCTS.FMD for the full list of our support systems.
  231.  
  232. ───[EOF]──────────────────────────────────────────────────────────────────────
  233.