Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================
- //== Script By: ====
- //== (Dastgir Pojee)
- //== Version 1.1a ====
- //=============================================
- //---------------------------------------------
- - script UltimateRanker#00 -1,{
- OnClock0001:
- if (gettime(5)==1){
- query_sql "INSERT INTO `ugr_guild_infov` (`date`,`AgitCount`) VALUES ("+ ((gettime(7)*100)+gettime(6)) +","+$AgitCount+")";
- $AgitCount = 1;
- if (gettime(6)==1){ @date = ((gettime(7)-1)*100)+12; }else{ @date = ((gettime(7)*100)+gettime(6)-1); }
- callfunc("Update_HEB",@date);
- query_sql "UPDATE `ugr_guild_info` SET `claim`=0 ORDER BY `percent` DESC LIMIT 1";
- }
- end;
- OnPCLoginEvent:
- if (getcharid(2) && gettimetick(2) >= UGR_Time){
- 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 ";
- UGR_Time = gettimetick(2)+(60*60*24); //One Day = 86400 Seconds
- }
- end;
- OnPCDieEvent: //Set Guild Deaths
- if (!getcharid(2) || killedrid==getcharid(0)) end;
- 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 ";
- end;
- OnPCKillEvent: //Set Guild Kills
- if (!getcharid(2) || killedrid==getcharid(0)) end;
- 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 ";
- end;
- OnEmpBreak:
- if (!getcharid(2)) {debugmes "Emperium Broke without a Guild Attached."; end;} //Check in case some emulator bug causing no_guild_member to break emperium.
- 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 ";
- callfunc("Update_HEB",gettimestr("%Y%m",7));
- end;
- OnInit:
- if($AgitCount==0){$AgitCount=1;}
- .Config_UGR[0] = 20; //Castle Opened till date.
- .Config_UGR[1] = 10; //KDR Percentage
- .Config_UGR[2] = 50; //EmpBreak Percentage
- .Config_UGR[3] = 20; //Active Participation
- .Config_UGR[4] = (60*60); //IF WoE Starts within x seconds, AgitCount will not increase.
- .Config_UGR[5] = 40; //GM Level to See Active Participants Column.
- setarray .Prize,502,10; //Prize(Format: ID1,Quantity1,ID2,Q2,ID3,Q3,.....,IDn,Qn)
- end;
- OnAgitStart:
- if (gettimetick(2) >= $ugr_last_tick ){ //Don't Update AgitCount if WoE has been started in less than Config[4] seconds.
- set $AgitCount,$AgitCount+1;
- $ugr_last_tick = gettimetick(2)+(.Config_UGR[4]);
- }
- end;
- }
- function script Update_HEB {
- query_sql "DELETE FROM `ugr_guild_info` WHERE (SELECT count(1) FROM `guild` WHERE `guild_id` = `ugr_guild_info`.`guild_id`) < 1";
- //Select HEB
- set .@time,atoi(getarg(0));
- query_sql "SELECT `breaks` FROM `ugr_guild_info` WHERE `date`="+ .@time +" ORDER BY `breaks` DESC LIMIT 1",.@UGR_breaks;
- if (.@UGR_breaks==0){.@UGR_breaks=1;}
- query_sql "INSERT INTO `ugr_guild_infov` (`date`,`HighEmpBreak`) VALUES ("+ .@time +","+.@UGR_breaks+") ON DUPLICATE KEY UPDATE `HighEmpBreak`="+.@UGR_breaks;
- //Update Formula
- 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
- /* --------------------- AGIT COUNT CALCULATION --------------------------------------------------- ----------------------------- KILL/DEATH RATIO CALCULATION ----------------------------- -------------- ----------------------------------------- EMP_BREAK CALCULATION ---------------------------------------- -------- ACTIVE PARTICIPATION CALCULATION WITH AUTO COUNTING OF MAX_GUILD MEMBERS -------------------------------------------------------------------------------------*/
- return;
- }
- veil.gat,105,106,5 script UltimateGuildRanker 635,{
- mes "[Guild Ranker]";
- mes "Welcome to Ultimate Guild Ranking";
- next;
- mes "[Guild Ranker]";
- mes "We are One of the kind in this World, We not only give you rank accordance to your Emperium Breaks,";
- mes "But we also check other criteria like your kills,deaths,Guild Participants";
- next;
- 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;
- callfunc("Update_HEB",gettimestr("%Y%m",7));
- mes "[Guild Ranker]";
- switch(select("~ Show My Guild Statistics:~ Top 10 Guilds:~ Most Active Guild:~ Previous Month Top 10 Guilds:~ Claim Previous Month Price")){
- case 1:
- if (getcharid(2)==0){mes "You are not in Any Guild."; close;}
- 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;
- if (!getarraysize(.percent)){mes "No Records of your guild"; close;}
- mes "Format:(Data Based on "+gettime(5)+"Days/"+$AgitCount+" Castles)";
- mes "x.) [GuildName]-Breaks-Kills-Death-GuildPoints ";
- if ( getguildname( getcharid(2) ) == "null" ) requestguildinfo getcharid(2);
- mes (.i+1) +".) [^4B29D5"+getguildname(getcharid(2))+"^000000] - ^49D529"+.breaks+"^000000 - ^66D729"+.kills+"^000000 - ^88D729"+.deaths+"^000000 - ^D52929"+.percent+"^000000 ";
- close;
- case 2:
- mes "Top 10 Guilds:";
- 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;
- if (!getarraysize(.guild_id) || .guild_id==0){mes "No Top Guilds"; close;}
- mes "Format:(Data Based on "+gettime(5)+"Days/"+$AgitCount+" Castles)";
- mes "x.) [GuildName]-Breaks-Kills-Death-GuildPoints"+((getgmlevel()>=getvariableofnpc(.Config_UGR[5],"UltimateRanker#00"))?"-APart":"")+" ";
- for (.i=0; .i<getarraysize(.guild_id); .i++){
- if ( getguildname( .guild_id[.i] ) == "null" ) requestguildinfo .guild_id[.i];
- 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":"")+"";
- }
- close;
- case 3:
- mes "Top 10 Active Guilds:";
- 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;
- if (!getarraysize(.guild_id) || .guild_id==0){mes "No Active Guilds"; close;}
- mes "Format:(Data Based on "+gettime(5)+"Days/"+$AgitCount+" Castles)";
- mes "x.) [GuildName]"+((getgmlevel()>=getvariableofnpc(.Config_UGR[5],"UltimateRanker#00"))?"-ActiveParticipants":"")+" ";
- for (.i=0; .i<getarraysize(.guild_id); .i++){
- if ( getguildname( .guild_id[.i] ) == "null" ) {requestguildinfo .guild_id[.i];}
- mes (.i+1) +".) [^4B29D5"+getguildname(.guild_id[.i])+"^000000] "+((getgmlevel()>=getvariableofnpc(.Config_UGR[5],"UltimateRanker#00"))?"- ^D52929"+.apart[.i]+"^000000":"")+" ";
- }
- close;
- case 4:
- mes "Top 10 Guilds(Previous Month):";
- if (gettime(6)==1){ .date = ((gettime(7)-1)*100)+12; }else{ .date = ((gettime(7)*100)+gettime(6)-1); }
- callfunc("Update_HEB",.date);
- 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;
- query_sql "SELECT `AgitCount` from `ugr_guild_infov` WHERE `date`="+ .date +"",$AgitCount;
- if (!getarraysize(.guild_id) || .guild_id==0){mes "No Previous Guild Records."; close;}
- if($AgitCount==0){$AgitCount=1;} //Set it to 1.
- mes "Month: "+ (.date);
- mes "Format:(Data based on "+ $AgitCount +" Castles)";
- mes "x.) [GuildName]-Breaks-Kills-Death-GuildPoints"+((getgmlevel()>=getvariableofnpc(.Config_UGR[5],"UltimateRanker#00"))?"-ActiveParticipants":"")+" ";
- for (.i=0; .i<getarraysize(.guild_id); .i++){
- if ( getguildname( .guild_id[.i] ) == "null" ) {requestguildinfo .guild_id[.i];}
- 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":"")+"";
- }
- close;
- case 5:
- mes "Previous Month Prize Claim:";
- if (!getcharid(2)){mes "You don't belong to Any Guild"; close;}
- if (!getguildmasterid(getcharid(2))){mes "You are not GuildMaster"; close;}
- next;
- mes "[Guild Ranker]";
- @percent = 0;
- if (gettime(6)==1){ .date = ((gettime(7)-1)*100)+12; }else{ .date = ((gettime(7)*100)+gettime(6)-1); }
- query_sql "SELECT `percent` FROM `ugr_guild_info` where `guild_id`="+getcharid(2)+" AND `claim`=0 AND date="+.date+" ",@percent;
- if (!@percent) {mes "You don't have Any Prize(Your Last Month Points:"+@percent; close;}
- query_sql "UPDATE `ugr_guild_info` SET `claim`=1 where `guild_id`="+getcharid(2)+" AND `claim`=0 AND date="+.date+" AND `percent`="+@percent+" ";
- .i = 0;
- while (.i < getarraysize(getvariableofnpc(.Prize,"UltimateRanker#00"))){
- if (getvariableofnpc(.Prize[i+1],"UltimateRanker#00")==0) break;
- getitem getvariableofnpc(.Prize[.i],"UltimateRanker#00"),getvariableofnpc(.Prize[.i+1],"UltimateRanker#00");
- .i = .i+2;
- }
- mes "You Got your Prize";
- close;
- default:
- close;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement