Fork²~ UberPvPOptimizer - an updated PVPBestGear

digitrev

Member
Chefstaff fix was surprisingly simple. The real trick was realizing that you'll only equip an offhand if
  • You can't dual wield, or
  • Equipping an off-hand is the worse option
Oops. That's been fixed.
 

Bale

Minion
Great work. Just one more thing because I'm hoping to drive you completely insane. ;) The familiar slot matters for things like letter of the moment. This script doesn't handle that. Fortunately I think it can be fixed by adding it in only three lines like this...

Code:
Index: UberPvPOptimizer.ash
===================================================================
--- UberPvPOptimizer.ash	(revision 55)
+++ UberPvPOptimizer.ash	(working copy)
@@ -759,7 +759,7 @@
 	print_html("</ul>");
 	
 /*** unequip all slots ***/
-	foreach i in $slots[hat, back, shirt, weapon, off-hand, pants, acc1, acc2, acc3] 
+	foreach i in $slots[hat, back, shirt, weapon, off-hand, pants, acc1, acc2, acc3, familiar] 
 		equip(i,$item[none]);
 	print_html("<br/>");	
 /*******
@@ -792,7 +792,7 @@
 	}
 
 /*** Top Gear display lists ***/
-	foreach i in $slots[hat, back, shirt, weapon, off-hand, pants, acc1] {
+	foreach i in $slots[hat, back, shirt, weapon, off-hand, pants, acc1, familiar] {
 		int itemCount = count(gear[to_string(i)]); 
 		print_html("<b>Slot <i>" + i + "</i> items considered: " + itemCount + " printing top items in slot:</b>");
 
@@ -894,6 +894,7 @@
 	bestGear("acc1", $slot[acc1]);
 	bestGear("acc1", $slot[acc2]);
 	bestGear("acc1", $slot[acc3]);
+	bestGear("familiar", $slot[familiar]);
 	
 /*******
 	Snipped familiars
 

digitrev

Member
Familiars are a little more complicated if you want it to consider equipment for every familiar you own. Your fix, while useful, will only consider items that can be equipped to your current familiar.
 

digitrev

Member
I've added full familiar support. It takes a little while longer to run, as a result. I'm debating putting the list-preparation in a static block to save time if you have to run it multiple times in a day.
 

Bale

Minion
I started this, so I regret not liking your implementation, but I noticed the "full familiar support" requires equipping every single familiar I own, one after another. Why is that necessary? Couldn't you just check all generic familiar equipment and familiar_equipment(() for each familiar without needing to equip every single familiar?

Code:
boolean [item] familiar_gear;
foreach it in $items[]
	if(it.item_type() == "familiar equipment" && string_modifier(it, "Modifiers").contains_text("Generic"))
		familiar_gear[it] = true;
foreach f in $familiars
	if(have_familiar(f) && be_good(f))
		familiar_gear[ familiar_equipment(f) ] = true;

Your actual process might be a bit different, but adaptating would be an enormous time-saver.
 
Last edited:
Also, currently it seems to go through the full familiar list twice, once before it prints out the top 10 per slot, and then once more after.
Oh, and my top 10 for familiar equipment for today [d], was simply 10 listings of the toddler sized dragon costume, which wasn't particularly helpful, even if it then (after going through the list for a second time), ended up going with my spelunker's stenbridge sidearm (which I think is correct in that I don't have any 3 or 4 'd' familiar equips available).
 

mapledyne

Member
Or you could use:

Code:
		if (char_at(output,i)≈letter) lettersCounted+=1;
Although I'm probably the only one who thinks that is cool.

Code:
[color=green]> ash ( "a" == "A" )[/color]

Returned: false

[color=green]> ash ( "a" ≈ "A" )[/color]

Returned: true
On my Mac, ≈ is option-x.


This is really, really cool.
 

Bale

Minion
Being a little tired of the endless familiar switching in the current version of the script I decided to fix it. The following patch takes care of the problem.

Code:
Index: UberPvPOptimizer.ash
===================================================================
--- UberPvPOptimizer.ash	(revision 57)
+++ UberPvPOptimizer.ash	(working copy)
@@ -545,7 +545,7 @@
 			break;			
 		}
 		//this simultaneously checks if a piece can be equipped and tries to do so
-		if ((canEquip(g) && gearup(s, g)) || (s == $slot[familiar] && fams[j].use_familiar() && canEquip(g) && gearup(s, g))) {	
+		if ((canEquip(g) && gearup(s, g)) || (s == $slot[familiar] && canAcquire(g) && fams[j].use_familiar() && canEquip(g) && gearup(s, g))) {	
 			print_html("<b>Best Available " + s + ":</b> " + gearString(g));
 			print_html(string_modifier(g,"Modifiers"));
 			break;		
@@ -793,22 +793,23 @@
 		}
 	}
 
-	familiar CurrentFam = my_familiar();
-	foreach f in $familiars[] {
-		string s = $slot[familiar].to_string();
-		if (f.have_familiar() && f.use_familiar()){
-			foreach it in $items[] {
-				int price = npc_price(it);
-				if (price == 0) 
-					price = historical_price(it);
-				if ((it.to_slot().to_string() == s && can_equip(it)) && (showAllItems || canAcquire(it))) {
-					gear[s][count(gear[s])] = it;
-					fams[count(fams)] = f;
-				}
-			}
+	familiar [item] famItems;
+	foreach f in $familiars[]
+		if(f.have_familiar())
+			famItems[familiar_equipment(f)] = f;
+	string s = $slot[familiar].to_string();
+	foreach it in $items[] {
+		int price = npc_price(it);
+		if (price == 0)
+			price = historical_price(it);
+		if (famItems contains it || (it.to_slot().to_string() == s && string_modifier(it, "Modifiers").contains_text("Generic"))&& (showAllItems || canAcquire(it))) {
+			gear[s][count(gear[s])] = it;
+			if(famItems contains it)
+				fams[count(fams)] = famItems[it];
+			else
+				fams[count(fams)] = my_familiar();
 		}
 	}
-	CurrentFam.use_familiar();
 
 /*** Top Gear display lists ***/
 	sort fams by -valuation(gear["familiar"][index]);
 

Bale

Minion
For people who have trouble with patch files and want to edit it themselves, here's an explanation of my previous post. If you understood that, then feel free to ignore this.

Find the following code at line 796:
Code:
	familiar CurrentFam = my_familiar();
	foreach f in $familiars[] {
		string s = $slot[familiar].to_string();
		if (f.have_familiar() && f.use_familiar()){
			foreach it in $items[] {
				int price = npc_price(it);
				if (price == 0) 
					price = historical_price(it);
				if ((it.to_slot().to_string() == s && can_equip(it)) && (showAllItems || canAcquire(it))) {
					gear[s][count(gear[s])] = it;
					fams[count(fams)] = f;
				}
			}
		}
	}
	CurrentFam.use_familiar();

Replace that with
Code:
	familiar [item] famItems;
	foreach f in $familiars[]
		if(f.have_familiar())
			famItems[familiar_equipment(f)] = f;
	string s = $slot[familiar].to_string();
	foreach it in $items[] {
		int price = npc_price(it);
		if (price == 0)
			price = historical_price(it);
		if (famItems contains it || (it.to_slot().to_string() == s && string_modifier(it, "Modifiers").contains_text("Generic"))&& (showAllItems || canAcquire(it))) {
			gear[s][count(gear[s])] = it;
			if(famItems contains it)
				fams[count(fams)] = famItems[it];
			else
				fams[count(fams)] = my_familiar();
		}
	}

Now find the following code at line 548:
Code:
		if ((canEquip(g) && gearup(s, g)) || (s == $slot[familiar] && fams[j].use_familiar() && canEquip(g) && gearup(s, g))) {
and replace it with:
Code:
		if ((canEquip(g) && gearup(s, g)) || (s == $slot[familiar] && canAcquire(g) && fams[j].use_familiar() && canEquip(g) && gearup(s, g))) {
 

Crowther

Active member
I did get the patch to work, but I had to convert it to DOS style and patch with --binary.

/me grumbles about it being the 21st century and how people are still using two characters for line breaks.
 
It still isn't working right, it seems. Specifically: I keep all my familiars equipped with their specific equip (and the only copy of it that I own, the others are in my display case), and as a result of that, it's now switching familiars around trying to equip them with their equip (after concluding that I own the item), but failing to do so, until finally giving up and using one of the generic equips that isn't on any familiar (usually the astral pet sweater or annoying pitchfork, probably because they start with 'a')

Oh, and when stripping naked at the start, it also removes the equipment from your current familiar, any chance that can be changed as well?

Its still a big improvement over the previous iteration though, since the script doesn't take over a minute to run any more, now that it isn't swapping around familiars, so I can just easily find in the table which would have been the best familiar to use and switch to that after it's done.
 
Last edited:

digitrev

Member
Sorry I never got to your issue, the dictator. If changing familiars becomes beneficial in another season, let me know if it's still an issue.

For now though, I've made it so that it won't equip 0-value items. This should prevent it from switching to a leprechaun with a meat detector every time you run it this season.
 
Yeah, it was doing so right until the end, so it would probably still be an issue. O well, that's easy enough to deal with manually.

New bug report: the script isn't recognizing the folder holder setup. I have no idea if it could, or should, but I thought is was worth mentioning, since it's pretty decent this season with -5 combat and 4 all res, even if it comes with 3 L's in the name.
 

Bale

Minion
Dang~ You're right on the ball with it this time. Kudos.

It's a shame that as a Gelnoob the script is completely useless this season. Stupid anti-PvP challenge path.
 
Even in its default configuration, this script does a pretty great job at getting me ready for PvP. Thanks to everyone who's worked on it!

That being said, I think the various weightings could use some tweaking, for my case. Am I correct in thinking that I want to use "zlib [variable_name] = [value]" to set those weights, where [variable_name] is one of the PvP_* zlib variables?

I'm having trouble wrapping my head around how some of the weighting works. For instance, how do I increase the weighted penalty for letters in my outfit? (ie. how do I get the script to dress me in an outfit with fewer letters?) I thought that was probably PvP_hexLetterWeight, but even tripling or quadrupling that value didn't affect how many letters I ended up wearing.
 
Top