Bug - Fixed Mafia tracking errors when funkslinging

Aenimus

Member
Hello,

I apologise if this isn't a bug, and is actually because my function is poorly written.

I wrote a function to funksling copying items:

Code:
void copier_combat_item_run(monster mob, int rnd, int hp_threshold) {
	item [int] funks;
	foreach i, c in copier_combat_items(mob) {
		if (monster_hp() < hp_threshold) return;
		if ($skill[Ambidextrous Funkslinging].have()) {
			funks[funks.count()] = c;
			if (funks.count() == 2) {
				print("Throwing a " + funks[0].to_string() + " and a " + funks[1].to_string() + ".", "purple");
				throw_items(funks[0], funks[1]);
				funks.clear();
				rnd++;
			}
		} else {
			funks[funks.count()] = c;
			print("Throwing a " + funks[0].to_string() + ".", "purple");
			throw_item(funks[0]);
			rnd++;
		}
	}
	if (funks.count() == 1) {
		print("Throwing a " + funks[0].to_string() + ".", "purple");
		throw_item(funks[0]);
		rnd++;
	}
}

But it created some tracking errors:

Code:
> Throwing a 4-d camera and a LOV Enamorang.
Round 1: Aenimus uses the 4-d camera and uses the LOV Enamorang!
You acquire an item: shaking 4-d camera
Preference cameraMonster changed from  to Witchess Knight
Preference camerasUsed changed from 0 to 1
Preference camerasUsed changed from 1 to 2
Adjusted combat item count: 4-d camera
> Throwing a print screen button and a Spooky Putty sheet.
Round 2: Aenimus uses the print screen button and uses the Spooky Putty sheet!
You acquire an item: screencapped monster
You acquire an item: Spooky Putty monster
Round 3: Type: Null claws 18 damage worth of Meat off of your opponent, and hands it to you. This is kind of gross but, well, you've got bills to pay, after all.
Round 3: Witchess Knight takes 18 damage.
You gain 9 Meat.
Round 3: Rayquaza sways hypnotically in front of your opponent. Dazed, your opponent slips you some Meat.
You gain 3,257 Meat.
Round 3: Rayquaza coils around him, binding him up like a tiny feathery straitjacket.
Round 3: Witchess Knight takes 555 damage.
Round 3: You lose 56 hit points
Preference screencappedMonster changed from  to Witchess Knight
Adjusted combat item count: print screen button
> Throwing a Rain-Doh black box and a unfinished ice sculpture.
Round 3: Aenimus uses the Rain-Doh black box and uses the unfinished ice sculpture!
You acquire an item: Rain-Doh box full of monster
You acquire an item: ice sculpture
Round 4: Type: Null claws 13 damage worth of Meat off of your opponent, and hands it to you. This is kind of gross but, well, you've got bills to pay, after all.
Round 4: Witchess Knight takes 13 damage.
You gain 13 Meat.
Round 4: Rayquaza sways hypnotically in front of your opponent. Dazed, your opponent slips you some Meat.
You gain 2,487 Meat.
Round 4: Rayquaza coils around him, binding him up like a tiny feathery straitjacket.
Round 4: Witchess Knight takes 547 damage.
Round 4: You lose 55 hit points
Preference _raindohCopiesMade changed from 0 to 1
Preference rainDohMonster changed from  to Witchess Knight
Preference _raindohCopiesMade changed from 1 to 2

Note that it records my using of two discrete items. But also note that the preference changes reflect that I used two of the first item I threw, and none of the second item.

Also, in other news: I have been given fairly well-equipped account for spading purposes. Assuming you're going to read this, Veracity, I'd be happy to share the account with you to for any/all mafia testing/general spading purposes.

Thanks.
 
Last edited:

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Started looking into this and

Code:
			int id1 = StringUtilities.parseInt( item1 );
			int id2 = StringUtilities.parseInt( item2 );
			FightRequest.payItemCost( id1, -1, responseText );

			if ( item2 != null )
			{
				FightRequest.payItemCost( id1, id2, responseText );
			}

			return;

in FightRequest.java looks extremely suspiciously like paying double the item cost on the first item if you funksling. This almost seems too major to not have been caught already which makes me nervous to "fix" it? Like perhaps I'm misunderstanding.
 

adeyke

Member
I've been noticing that, from March 11 onward, when funkslinging spooky putty, the spookyPuttyCopiesMade and spookyPuttyMonster weren't getting updated.
 

lostcalpolydude

Developer
Staff member
Started looking into this and

Code:
			int id1 = StringUtilities.parseInt( item1 );
			int id2 = StringUtilities.parseInt( item2 );
			FightRequest.payItemCost( id1, -1, responseText );

			if ( item2 != null )
			{
				FightRequest.payItemCost( id1, id2, responseText );
			}

			return;

in FightRequest.java looks extremely suspiciously like paying double the item cost on the first item if you funksling. This almost seems too major to not have been caught already which makes me nervous to "fix" it? Like perhaps I'm misunderstanding.

That was changed in 19835, previously the items were sent in the opposite order. I assume Veracity had a reason for swapping that.
 

Aenimus

Member
Tracking seems to be working perfectly again. Thanks! I'm curious, however; what was the intended change?
 
Top