From 3a3d2297068809d25ca43e19fd2977f97b2728f5 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Wed, 6 Nov 2013 21:18:12 -0200 Subject: Follow up eaf04b9a2f0b399027df251c5d19d58d74e24e6a Adjustments to the team-splitting algorithm Thanks to Haruna! Signed-off-by: shennetsind --- npc/custom/bgqueue/flavius.txt | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'npc/custom') diff --git a/npc/custom/bgqueue/flavius.txt b/npc/custom/bgqueue/flavius.txt index 45b261175..778feb55d 100644 --- a/npc/custom/bgqueue/flavius.txt +++ b/npc/custom/bgqueue/flavius.txt @@ -3,19 +3,20 @@ //===== By: ================================================== //= L0ne_W0lf //===== Current Version: ===================================== -//= 1.5 +//= 1.5b //===== Description: ========================================= //= [AEGIS Conversion] //= Flavius Battleground. //= - Winning Team: 9 badges //= - Losing Team: 3 badge //===== Additional Comments: ================================= -//= 1.0 First Version. -//= 1.1 Fixed pink crystal spawning as blue. [L0ne_W0lf] -//= 1.2 Updated 'waitingroom' to support required zeny/lvl. [Kisuka] -//= 1.3 Removed MaxLvl check in waitingrooms. Replaced setwall with setcell. -//= 1.4 Attempt at implementing BG Queue [Ind/Hercules] -//= 1.5 Attempt at implementing BG Queue team-algorithm [jaBote] +//= 1.0 First Version. +//= 1.1 Fixed pink crystal spawning as blue. [L0ne_W0lf] +//= 1.2 Updated 'waitingroom' to support required zeny/lvl. [Kisuka] +//= 1.3 Removed MaxLvl check in waitingrooms. Replaced setwall with setcell. +//= 1.4 Attempt at implementing BG Queue [Ind/Hercules] +//= 1.5 Attempt at implementing BG Queue team-algorithm [jaBote] +//= 1.5b Adjustments to the team-splitting algorithm [Haruna] //============================================================ @@ -47,24 +48,23 @@ OnPlayerListReady: // Counting all participants and determining sizes, condensing .@bg_member_group set .@nogroupcount, 0; for (set .@i, 0; .@i < getarraysize(.@bg_member); set .@i, .@i + 1) { + if (.@bg_member_group[.@i] == 0) { // Just count them + set .@nogroupcount, .@nogroupcount + 1; + continue; + } // check if .@bg_member_group and .@bg_member_type already exists on these groups. - for (set .@j, 0; .@j <= getarraysize(.@bg_groups); set .@j, .@j + 1) { // <= since it has to start working even if the array is still blank - if (.@bg_member_group[.@i] == 0) { // Just count them - set .@nogroupcount, .@nogroupcount + 1; - break; - } - else if ( (.@bg_member_group[.@i] == .@bg_groups[.@j]) && (.@bg_member_type[.@i] == .@bg_types[.@j]) ) { + for (set .@j, 0; .@j < getarraysize(.@bg_groups); set .@j, .@j + 1) { // <= since it has to start working even if the array is still blank + if ( (.@bg_member_group[.@i] == .@bg_groups[.@j]) && (.@bg_member_type[.@i] == .@bg_types[.@j]) ) { set .@bg_count[.@j], .@bg_count[.@j] + 1; break; } - else if (.@j == (getarraysize(.@bg_groups)) ) { // It isn't there, insert a new entry at j+1 since j is the last known member - set .@bg_groups[.@j], .@bg_member_group[.@i]; - set .@bg_types[.@j], .@bg_member_type[.@i]; - set .@bg_count[.@j], 1; - break; - } // Else keep running the loop until we find there's a group already made or make a new one } + if (.@j == (getarraysize(.@bg_groups)) ) { // It isn't there, insert a new entry at j + set .@bg_groups[.@j], .@bg_member_group[.@i]; + set .@bg_types[.@j], .@bg_member_type[.@i]; + set .@bg_count[.@j], 1; + } } // Now, sorting the group arrays from amount of population descending! Bubble sort powers, I call upon thee! -- cgit v1.2.3-60-g2f50