Bug - Fixed set_location() failing to update pressure modifiers

When I click sea locations in mafia's GUI, it alters the droprate based on the pressure modifier for that location.

I'd assume that setting my location with set_location() should provide the same functionality, but it only selects the general zone in the GUI, not the specific location. The item drop modifiers and meat drop modifiers aren't affected.

> ash set_location($location[the dive bar])

Returned: void

> ash my_location()

Returned: The Dive Bar
nocombats => false
zone => The Sea
parent => The Sea
parentdesc => The Sea
bounty => none

> ash item_drop_modifier()

Returned: 50.0

> ash numeric_modifier("Item Drop Penalty")

Returned: 0.0

If you then manually click the Dive Bar location in the GUI you get the following:
> ash item_drop_modifier()

Returned: -150.0

> ash numeric_modifier("Item Drop Penalty")

Returned: -200.0
 
Last edited:

lostcalpolydude

Developer
Staff member
Additionally, when adventuring through the Relay Browser, if you switch locations, the first time it only switches to the right zone (Plains, Woods, etc.), the second time is when the specific location is highlighted (and also when it is considered when calculating +item and so on).
 

Bale

Minion
lost's comment made me think. The following log took place without me doing anything in the GUI. It seems that using set_location() a second time to a different place in the same zone will actually set the location properly!

Note that I am using my Eggman for +50% item drops. No other modifiers are active.


> ash set_location($location[dive bar]); item_drop_modifier()

Returned: 50.0

> ash set_location($location[dive bar]); item_drop_modifier()

Returned: 50.0

> ash set_location($location[ skate park]); item_drop_modifier()

Returned: -50.0

> ash set_location($location[dive bar]); item_drop_modifier()

Returned: -150.0
 
Last edited:

lostcalpolydude

Developer
Staff member
I see that set_location( location ) updates lastLocation (why?), and by design it does nothing if you try to set your location to what it should already be set to, so repeated calls with the same location parameter are expected to do nothing. Since that function does something, AdventureSelectPanel.UpdateSelectedAdventure() is running.

It looks like the issue is that when
Code:
this.locationSelect.setSelectedValue( location, true );
runs, locationSelect can have the locations for the previous zone rather than the one that should be switched to. This would happen if
Code:
( (JComboBox) this.zoneSelect ).setSelectedItem( location.getParentZoneDescription() );
is not reached (I think), which would mean that
Code:
this.zoneSelect instanceof AutoFilterTextField
is true.

If "useZoneComboBox" (Preferences -> General -> Use zone selection instead of adventure name filter) is enabled, then everything works properly because zoneSelect is never an AutoFilterTextField.
 

roippi

Developer
In my opinion the graphical widget should reflect the state of some internal variable, rather than the other way around. Sounds like some refactoring is in order.
 
If "useZoneComboBox" (Preferences -> General -> Use zone selection instead of adventure name filter) is enabled, then everything works properly because zoneSelect is never an AutoFilterTextField.

That's a handy workaround. I'd actually tried toggling it, but didn't realise I'd also need to restart the client.
 
Just thought I'd bump this report with another aspect of the strange behaviour that I just ran into. This is while using the option "Preferences -> General -> Use zone selection".

Using set_location() and checking item_drop_modifier() I'm getting different results inside a foreach loop than when I simply execute the commands.

In the first example I set my location to the Briniest Deepests, then report the drop modifier. Then I set location to the Icy Peak and report drop modifier. It works correctly.
Code:
> ashq set_location($location[The Briniest Deepests]);print(my_location()+" "+item_drop_modifier());set_location($location[the icy peak]);print(my_location()+" "+item_drop_modifier());

The Briniest Deepests 152.87482193696061
The Icy Peak 227.87482193696061

Then in the second example I do a foreach loop of locations. If the location is the Deepests or the Peak then I report the item drop modifier.
Code:
> ash foreach loc in $locations[] {if (loc == $location[The Briniest Deepests] || loc == $location[The Icy Peak]) {set_location(loc);print(my_location()+ " " + item_drop_modifier());}}

The Briniest Deepests 227.87482193696061
The Icy Peak 227.87482193696061
 
Top