SHOW:
|
|
- or go back to the newest paste.
| 1 | //============================================= | |
| 2 | //== Script By: ==== | |
| 3 | //== (Dastgir Pojee) | |
| 4 | //== Version 1.1a ==== | |
| 5 | //============================================= | |
| 6 | //--------------------------------------------- | |
| 7 | - script UltimateRanker#00 -1,{
| |
| 8 | ||
| 9 | OnClock0001: | |
| 10 | if (gettime(5)==1){
| |
| 11 | query_sql "INSERT INTO `ugr_guild_infov` (`date`,`AgitCount`) VALUES ("+ ((gettime(7)*100)+gettime(6)) +","+$AgitCount+")";
| |
| 12 | - | $AgitCount = 1; |
| 12 | + | set $AgitCount,1; |
| 13 | - | if (gettime(6)==1){ @date = ((gettime(7)-1)*100)+12; }else{ @date = ((gettime(7)*100)+gettime(6)-1); }
|
| 13 | + | if (gettime(6)==1){ set @date,((gettime(7)-1)*100)+12; }else{ set @date,((gettime(7)*100)+gettime(6)-1); }
|
| 14 | callfunc("Update_HEB",@date);
| |
| 15 | query_sql "UPDATE `ugr_guild_info` SET `claim`=0 ORDER BY `percent` DESC LIMIT 1"; | |
| 16 | } | |
| 17 | end; | |
| 18 | ||
| 19 | OnPCLoginEvent: | |
| 20 | if (getcharid(2) && gettimetick(2) >= UGR_Time){
| |
| 21 | query_sql "INSERT INTO `ugr_guild_info` (`guild_id`,`APart`,`date`) VALUES ("+getcharid(2)+",1,"+gettimestr("%Y%m",7)+") ON DUPLICATE KEY UPDATE `APart`=`APart`+1 ";
| |
| 22 | - | UGR_Time = gettimetick(2)+(60*60*24); //One Day = 86400 Seconds |
| 22 | + | set UGR_Time,gettimetick(2)+(60*60*24); //One Day = 86400 Seconds |
| 23 | } | |
| 24 | end; | |
| 25 | ||
| 26 | OnPCDieEvent: //Set Guild Deaths | |
| 27 | if (!getcharid(2) || killedrid==getcharid(0)) end; | |
| 28 | query_sql "INSERT INTO `ugr_guild_info` (`guild_id`,`deaths`,`date`) VALUES ("+getcharid(2)+",1,"+gettimestr("%Y%m",7)+") ON DUPLICATE KEY UPDATE `deaths`=`deaths`+1 ";
| |
| 29 | end; | |
| 30 | ||
| 31 | OnPCKillEvent: //Set Guild Kills | |
| 32 | if (!getcharid(2) || killedrid==getcharid(0)) end; | |
| 33 | query_sql "INSERT INTO `ugr_guild_info` (`guild_id`,`kills`,`date`) VALUES ("+getcharid(2)+",1,"+gettimestr("%Y%m",7)+") ON DUPLICATE KEY UPDATE `kills`=`kills`+1 ";
| |
| 34 | end; | |
| 35 | ||
| 36 | ||
| 37 | OnEmpBreak: | |
| 38 | if (!getcharid(2)) {debugmes "Emperium Broke without a Guild Attached."; end;} //Check in case some emulator bug causing no_guild_member to break emperium.
| |
| 39 | query_sql "INSERT INTO `ugr_guild_info` (`guild_id`,`breaks`,`date`) VALUES ("+getcharid(2)+",1,"+gettimestr("%Y%m",7)+") ON DUPLICATE KEY UPDATE `breaks`=`breaks`+1 ";
| |
| 40 | callfunc("Update_HEB",gettimestr("%Y%m",7));
| |
| 41 | end; | |
| 42 | ||
| 43 | OnInit: | |
| 44 | - | if($AgitCount==0){$AgitCount=1;}
|
| 44 | + | if($AgitCount==0){set $AgitCount,1;}
|
| 45 | - | .Config_UGR[0] = 20; //Castle Opened till date. |
| 45 | + | set .Config_UGR[0],20; //Castle Opened till date. |
| 46 | - | .Config_UGR[1] = 10; //KDR Percentage |
| 46 | + | set .Config_UGR[1],10; //KDR Percentage |
| 47 | - | .Config_UGR[2] = 50; //EmpBreak Percentage |
| 47 | + | set .Config_UGR[2],50; //EmpBreak Percentage |
| 48 | - | .Config_UGR[3] = 20; //Active Participation |
| 48 | + | set .Config_UGR[3],20; //Active Participation |
| 49 | - | .Config_UGR[4] = (60*60); //IF WoE Starts within x seconds, AgitCount will not increase. |
| 49 | + | set .Config_UGR[4],(60*60); //IF WoE Starts within x seconds, AgitCount will not increase. |
| 50 | - | .Config_UGR[5] = 40; //GM Level to See Active Participants Column. |
| 50 | + | set .Config_UGR[5],40; //GM Level to See Active Participants Column. |
| 51 | setarray .Prize,502,10; //Prize(Format: ID1,Quantity1,ID2,Q2,ID3,Q3,.....,IDn,Qn) | |
| 52 | end; | |
| 53 | ||
| 54 | OnAgitStart: | |
| 55 | if (gettimetick(2) >= $ugr_last_tick ){ //Don't Update AgitCount if WoE has been started in less than Config[4] seconds.
| |
| 56 | set $AgitCount,$AgitCount+1; | |
| 57 | - | $ugr_last_tick = gettimetick(2)+(.Config_UGR[4]); |
| 57 | + | set $ugr_last_tick,gettimetick(2)+(.Config_UGR[4]); |
| 58 | } | |
| 59 | end; | |
| 60 | ||
| 61 | } | |
| 62 | ||
| 63 | function script Update_HEB {
| |
| 64 | query_sql "DELETE FROM `ugr_guild_info` WHERE (SELECT count(1) FROM `guild` WHERE `guild_id` = `ugr_guild_info`.`guild_id`) < 1"; | |
| 65 | //Select HEB | |
| 66 | set .@time,atoi(getarg(0)); | |
| 67 | query_sql "SELECT `breaks` FROM `ugr_guild_info` WHERE `date`="+ .@time +" ORDER BY `breaks` DESC LIMIT 1",.@UGR_breaks; | |
| 68 | - | if (.@UGR_breaks==0){.@UGR_breaks=1;}
|
| 68 | + | if (.@UGR_breaks==0){set .@UGR_breaks,1;}
|
| 69 | query_sql "INSERT INTO `ugr_guild_infov` (`date`,`HighEmpBreak`) VALUES ("+ .@time +","+.@UGR_breaks+") ON DUPLICATE KEY UPDATE `HighEmpBreak`="+.@UGR_breaks;
| |
| 70 | //Update Formula | |
| 71 | query_sql "UPDATE `ugr_guild_info` SET `percent`=( (("+$AgitCount+"/"+gettime(5)+"*100)*"+getvariableofnpc(.Config_UGR[0],"UltimateRanker#00")+"/100) + ( (`kills`/(IF(`deaths`=0, 1,`deaths`))*100)*"+getvariableofnpc(.Config_UGR[1],"UltimateRanker#00")+"/100)+((`breaks`/"+.@UGR_breaks+"*100)*"+getvariableofnpc(.Config_UGR[2],"UltimateRanker#00")+"/100)+((`APart`/(select count(*) FROM `guild_member` WHERE `guild_member`.`guild_id`=`ugr_guild_info`.`guild_id`)*100)*"+getvariableofnpc(.Config_UGR[3],"UltimateRanker#00")+"/100)) WHERE `date`="+.@time+" "; //.@time to avoid previous months Re-Calculation
| |
| 72 | /* --------------------- AGIT COUNT CALCULATION --------------------------------------------------- ----------------------------- KILL/DEATH RATIO CALCULATION ----------------------------- -------------- ----------------------------------------- EMP_BREAK CALCULATION ---------------------------------------- -------- ACTIVE PARTICIPATION CALCULATION WITH AUTO COUNTING OF MAX_GUILD MEMBERS -------------------------------------------------------------------------------------*/ | |
| 73 | return; | |
| 74 | } | |
| 75 | ||
| 76 | veil.gat,105,106,5 script UltimateGuildRanker 635,{
| |
| 77 | mes "[Guild Ranker]"; | |
| 78 | mes "Welcome to Ultimate Guild Ranking"; | |
| 79 | next; | |
| 80 | mes "[Guild Ranker]"; | |
| 81 | mes "We are One of the kind in this World, We not only give you rank accordance to your Emperium Breaks,"; | |
| 82 | mes "But we also check other criteria like your kills,deaths,Guild Participants"; | |
| 83 | next; | |
| 84 | deletearray .guild_id[0],10; deletearray .breaks[0],10; deletearray .kills[0],10; deletearray .deaths[0],10; deletearray .apart[0],10; deletearray .percent[0],10; | |
| 85 | callfunc("Update_HEB",gettimestr("%Y%m",7));
| |
| 86 | mes "[Guild Ranker]"; | |
| 87 | switch(select("~ Show My Guild Statistics:~ Top 10 Guilds:~ Most Active Guild:~ Previous Month Top 10 Guilds:~ Claim Previous Month Price")){
| |
| 88 | case 1: | |
| 89 | if (getcharid(2)==0){mes "You are not in Any Guild."; close;}
| |
| 90 | query_sql "SELECT `breaks`,`kills`,`deaths`,`APart`,`percent` FROM `ugr_guild_info` WHERE `date`="+gettimestr("%Y%m",7)+" AND `guild_id`="+getcharid(2)+" ORDER BY `percent` DESC LIMIT 10",.breaks,.kills,.deaths,.apart,.percent;
| |
| 91 | if (!getarraysize(.percent)){mes "No Records of your guild"; close;}
| |
| 92 | mes "Format:(Data Based on "+gettime(5)+"Days/"+$AgitCount+" Castles)"; | |
| 93 | mes "x.) [GuildName]-Breaks-Kills-Death-GuildPoints "; | |
| 94 | if ( getguildname( getcharid(2) ) == "null" ) requestguildinfo getcharid(2); | |
| 95 | mes (.i+1) +".) [^4B29D5"+getguildname(getcharid(2))+"^000000] - ^49D529"+.breaks+"^000000 - ^66D729"+.kills+"^000000 - ^88D729"+.deaths+"^000000 - ^D52929"+.percent+"^000000 "; | |
| 96 | close; | |
| 97 | case 2: | |
| 98 | mes "Top 10 Guilds:"; | |
| 99 | query_sql "SELECT `breaks`,`kills`,`deaths`,`APart`,`guild_id`,`percent` FROM `ugr_guild_info` WHERE `date`="+gettimestr("%Y%m",7)+" ORDER BY `percent` DESC LIMIT 10",.breaks,.kills,.deaths,.apart,.guild_id,.percent;
| |
| 100 | if (!getarraysize(.guild_id) || .guild_id==0){mes "No Top Guilds"; close;}
| |
| 101 | mes "Format:(Data Based on "+gettime(5)+"Days/"+$AgitCount+" Castles)"; | |
| 102 | mes "x.) [GuildName]-Breaks-Kills-Death-GuildPoints"+((getgmlevel()>=getvariableofnpc(.Config_UGR[5],"UltimateRanker#00"))?"-APart":"")+" "; | |
| 103 | - | for (.i=0; .i<getarraysize(.guild_id); .i++){
|
| 103 | + | for (set .i,0; .i<getarraysize(.guild_id); set .i,.i+1){
|
| 104 | if ( getguildname( .guild_id[.i] ) == "null" ) requestguildinfo .guild_id[.i]; | |
| 105 | mes (.i+1) +".) [^4B29D5"+getguildname(.guild_id[.i])+"^000000] - ^49D529"+.breaks[.i]+"^000000 - ^66D729"+.kills[.i]+"^000000 - ^88D729"+.deaths[.i]+"^000000 - ^D52929"+.percent[.i]+"^000000 "+((getgmlevel()>=getvariableofnpc(.Config_UGR[5],"UltimateRanker#00"))?"- ^D52929"+.apart[.i]+"^000000":"")+""; | |
| 106 | } | |
| 107 | close; | |
| 108 | case 3: | |
| 109 | mes "Top 10 Active Guilds:"; | |
| 110 | query_sql "SELECT `guild_id`,`APart` FROM `ugr_guild_info` WHERE `date`="+gettimestr("%Y%m",7)+" ORDER BY `APart` DESC LIMIT 10",.guild_id,.apart;
| |
| 111 | if (!getarraysize(.guild_id) || .guild_id==0){mes "No Active Guilds"; close;}
| |
| 112 | mes "Format:(Data Based on "+gettime(5)+"Days/"+$AgitCount+" Castles)"; | |
| 113 | mes "x.) [GuildName]"+((getgmlevel()>=getvariableofnpc(.Config_UGR[5],"UltimateRanker#00"))?"-ActiveParticipants":"")+" "; | |
| 114 | - | for (.i=0; .i<getarraysize(.guild_id); .i++){
|
| 114 | + | for (set .i,0; .i<getarraysize(.guild_id); set .i,.i+1){
|
| 115 | if ( getguildname( .guild_id[.i] ) == "null" ) {requestguildinfo .guild_id[.i];}
| |
| 116 | mes (.i+1) +".) [^4B29D5"+getguildname(.guild_id[.i])+"^000000] "+((getgmlevel()>=getvariableofnpc(.Config_UGR[5],"UltimateRanker#00"))?"- ^D52929"+.apart[.i]+"^000000":"")+" "; | |
| 117 | } | |
| 118 | close; | |
| 119 | case 4: | |
| 120 | mes "Top 10 Guilds(Previous Month):"; | |
| 121 | - | if (gettime(6)==1){ .date = ((gettime(7)-1)*100)+12; }else{ .date = ((gettime(7)*100)+gettime(6)-1); }
|
| 121 | + | if (gettime(6)==1){ set .date,((gettime(7)-1)*100)+12; }else{ set .date,((gettime(7)*100)+gettime(6)-1); }
|
| 122 | callfunc("Update_HEB",.date);
| |
| 123 | query_sql "SELECT `breaks`,`kills`,`deaths`,`APart`,`guild_id`,`percent` FROM `ugr_guild_info` WHERE `date`="+ .date +" ORDER BY `percent` DESC LIMIT 10",.breaks,.kills,.deaths,.apart,.guild_id,.percent; | |
| 124 | query_sql "SELECT `AgitCount` from `ugr_guild_infov` WHERE `date`="+ .date +"",$AgitCount; | |
| 125 | if (!getarraysize(.guild_id) || .guild_id==0){mes "No Previous Guild Records."; close;}
| |
| 126 | - | if($AgitCount==0){$AgitCount=1;} //Set it to 1.
|
| 126 | + | if($AgitCount==0){set $AgitCount,1;} //Set it to 1.
|
| 127 | mes "Month: "+ (.date); | |
| 128 | mes "Format:(Data based on "+ $AgitCount +" Castles)"; | |
| 129 | mes "x.) [GuildName]-Breaks-Kills-Death-GuildPoints"+((getgmlevel()>=getvariableofnpc(.Config_UGR[5],"UltimateRanker#00"))?"-ActiveParticipants":"")+" "; | |
| 130 | - | for (.i=0; .i<getarraysize(.guild_id); .i++){
|
| 130 | + | for (set .i,0; .i<getarraysize(.guild_id); set .i,.i+1){
|
| 131 | if ( getguildname( .guild_id[.i] ) == "null" ) {requestguildinfo .guild_id[.i];}
| |
| 132 | mes (.i+1) +".) [^4B29D5"+getguildname(.guild_id[.i])+"^000000] - ^49D529"+.breaks[.i]+"^000000 - ^66D729"+.kills[.i]+"^000000 - ^88D729"+.deaths[.i]+"^000000 - ^D52929"+.percent[.i]+"^000000 "+((getgmlevel()>=getvariableofnpc(.Config_UGR[5],"UltimateRanker#00"))?"- ^D52929"+.apart[.i]+"^000000":"")+""; | |
| 133 | } | |
| 134 | close; | |
| 135 | ||
| 136 | case 5: | |
| 137 | mes "Previous Month Prize Claim:"; | |
| 138 | if (!getcharid(2)){mes "You don't belong to Any Guild"; close;}
| |
| 139 | if (!getguildmasterid(getcharid(2))){mes "You are not GuildMaster"; close;}
| |
| 140 | next; | |
| 141 | mes "[Guild Ranker]"; | |
| 142 | - | @percent = 0; |
| 142 | + | set @percent,0; |
| 143 | - | if (gettime(6)==1){ .date = ((gettime(7)-1)*100)+12; }else{ .date = ((gettime(7)*100)+gettime(6)-1); }
|
| 143 | + | if (gettime(6)==1){set .date,((gettime(7)-1)*100)+12; }else{ set .date,((gettime(7)*100)+gettime(6)-1); }
|
| 144 | query_sql "SELECT `percent` FROM `ugr_guild_info` where `guild_id`="+getcharid(2)+" AND `claim`=0 AND date="+.date+" ",@percent; | |
| 145 | if (!@percent) {mes "You don't have Any Prize(Your Last Month Points:"+@percent; close;}
| |
| 146 | query_sql "UPDATE `ugr_guild_info` SET `claim`=1 where `guild_id`="+getcharid(2)+" AND `claim`=0 AND date="+.date+" AND `percent`="+@percent+" "; | |
| 147 | - | .i = 0; |
| 147 | + | set .i,0; |
| 148 | while (.i < getarraysize(getvariableofnpc(.Prize,"UltimateRanker#00"))){
| |
| 149 | if (getvariableofnpc(.Prize[i+1],"UltimateRanker#00")==0) break; | |
| 150 | getitem getvariableofnpc(.Prize[.i],"UltimateRanker#00"),getvariableofnpc(.Prize[.i+1],"UltimateRanker#00"); | |
| 151 | - | .i = .i+2; |
| 151 | + | set .i,.i+2; |
| 152 | } | |
| 153 | mes "You Got your Prize"; | |
| 154 | close; | |
| 155 | default: | |
| 156 | close; | |
| 157 | } | |
| 158 | } |