pastebin - collaborative debugging tool
rathena.kpaste.net RSS


Agit Points - http://rathena.org/board/topic/78562-agit-points/
Posted by Anonymous on Sat 16th Feb 2013 04:40
raw | new post

  1. /*
  2. ALTER TABLE `guild` ADD `agit_points` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0';
  3. */
  4.  
  5. prontera,155,188,0      script  Agit Points     837,{
  6.         mes "[Guild Ranking]";
  7.         if (query_sql("SELECT `name`,agit_points FROM guild WHERE agit_points ORDER BY agit_points DESC LIMIT 128", .@guild_name$,.@agit_points) == 0) {
  8.                 mes "The list is empty.";
  9.         } else {
  10.                 for (set .@i,0; .@i<getarraysize(.@guild_name$); set .@i,.@i+1)
  11.                         mes (.@i+1)+". "+.@guild_name$[.@i]+" ("+.@agit_points[.@i]+" "+( (.@agit_points[.@i]==1) ? "point" : "points" )+")";
  12.         }
  13.         close;
  14.  
  15. OnAgitEnd:
  16.         sleep 500; // make sure WoE-ending scripts finished triggering
  17.         query_sql "SELECT castle_id,guild_id FROM guild_castle WHERE guild_id>0 AND castle_id BETWEEN 0 AND 23", .@castle_id,.@guild_id;
  18.         for (set .@i,0; .@i<getarraysize(.@guild_id); set .@i,.@i+1)
  19.                 query_sql "UPDATE guild SET agit_points = agit_points+"+.castle_points[.@castle_id[.@i]]+" WHERE guild_id="+.@guild_id[.@i];
  20.         end;
  21. OnAgitEnd2:
  22.         sleep 500; // make sure WoE-ending scripts finished triggering
  23.         query_sql "SELECT castle_id,guild_id FROM guild_castle WHERE guild_id>0 AND castle_id BETWEEN 24 AND 33", .@castle_id,.@guild_id;
  24.         for (set .@i,0; .@i<getarraysize(.@guild_id); set .@i,.@i+1)
  25.                 query_sql "UPDATE guild SET agit_points = agit_points+"+.castle_points[.@castle_id[.@i]]+" WHERE guild_id="+.@guild_id[.@i];
  26.         end;
  27.  
  28. OnInit:
  29.         setarray .castle_points[0],
  30.         // Aldebaran
  31.                 1, // 0-aldeg_cas01, Neuschwanstein
  32.                 1, // 1-aldeg_cas02, Hohenschwangau
  33.                 1, // 2-aldeg_cas03, Nuernberg
  34.                 1, // 3-aldeg_cas04, Wuerzburg
  35.                 1, // 4-aldeg_cas05, Rothenburg
  36.         // Geffen
  37.                 1, // 5-gefg_cas01,  Repherion
  38.                 1, // 6-gefg_cas02,  Eeyolbriggar
  39.                 1, // 7-gefg_cas03,  Yesnelph
  40.                 1, // 8-gefg_cas04,  Bergel
  41.                 1, // 9-gefg_cas05,  Mersetzdeitz
  42.         // Payon
  43.                 1, //10-payg_cas01,  Bright Arbor
  44.                 1, //11-payg_cas02,  Scarlet Palace
  45.                 1, //12-payg_cas03,  Holy Shadow
  46.                 1, //13-payg_cas04,  Sacred Altar
  47.                 1, //14-payg_cas05,  Bamboo Grove Hill
  48.         // Prontera
  49.                 3, //15-prtg_cas01,  Kriemhild
  50.                 2, //16-prtg_cas02,  Swanhild
  51.                 1, //17-prtg_cas03,  Fadhgridh
  52.                 1, //18-prtg_cas04,  Skoegul
  53.                 1, //19-prtg_cas05,  Gondul
  54.         // Novice Castles
  55.                 1, //20-nguild_alde, Earth
  56.                 1, //21-nguild_gef,  Air
  57.                 1, //22-nguild_pay,  Water
  58.                 1, //23-nguild_prt,  Fire
  59.         // Yuno
  60.                 1, //24-schg_cas01,  Himinn
  61.                 1, //25-schg_cas02,  Andlangr
  62.                 1, //26-schg_cas03,  Viblainn
  63.                 1, //27-schg_cas04,  Hljod
  64.                 1, //28-schg_cas05,  Skidbladnir
  65.         // Rachel
  66.                 1, //29-arug_cas01,  Mardol
  67.                 1, //30-arug_cas02,  Cyr
  68.                 1, //31-arug_cas03,  Horn
  69.                 1, //32-arug_cas04,  Gefn
  70.                 1; //33-arug_cas05,  Bandis
  71.        
  72.         if (query_sql("SELECT ORDINAL_POSITION FROM information_schema.`COLUMNS` WHERE TABLE_SCHEMA=(SELECT DATABASE()) AND TABLE_NAME='guild' AND COLUMN_NAME='agit_points'", .@i) == 0) {
  73.                 debugmes "[Agit Points] adding column to `guild` table ...";
  74.                 query_sql "ALTER TABLE `guild` ADD `agit_points` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0'";
  75.         }
  76.         end;
  77. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at