Character Info Toolbox

lostcalpolydude

Developer
Staff member
Also, since I want to minimize both the width of the charpane and the height of each component, I added
Code:
  width: 20px;
  height:20px;
to the chit_gearicon section.
 

soolar

Member
Oh yeah, I made that fix with regards to accessories, but then I was dumb and hit a hiccup in learning where to edit the scripts for mafia, and got my work overridden and had to redo about an hour's coding, and must have forgotten that I had only done that check before the overwrite and not after... My bad!

Also it turns out hidding the active picker is pretty dang easy! Here, have some code. It should be pretty straightforward where this goes? Only a couple of the lines are actually new, the rest is just for context.

Code:
var roofOffset = 4;
var floorOffset = 4;

var activePicker = null;

$(document).ready(function () {

	//Picker Launchers
	//use bind for multiple events (KoL uses jQuery 1.3, using multiple events for 'live' was added in jQuery 1.4)
	//$(".chit_launcher").live("click", function(e) {
	$(".chit_launcher").bind("click contextmenu", function(e) {
		var caller = $(this);
		var top = caller.offset().top + caller.height() + 2;
		var picker = $("#" + caller.attr("rel"));
		
		if (picker) {
			if (picker.is(':hidden')) {
				picker.css({
					'position': 'absolute',
					'top': top,
					'max-height': '93%',
					'overflow-y': 'auto'
				});
				if ((top + picker.height() + 30) > $(document).height()) {
					picker.css('top', ($(document).height()-picker.height()-30));
				}
        if(activePicker != null) {
          activePicker.hide();
        }
        picker.show();
        activePicker = picker;
			} else {
				picker.hide();
        activePicker = null;
			}
		}
        return false;
	});

And here's a new condition for inside pickerGear:

Code:
if(it != $item[none] && (it.to_slot() == s || (it.to_slot() == $slot[acc1] && $slots[acc2,acc3] contains s) || (s == $slot[off-hand] && it.to_slot() == $slot[weapon] && have_skill($skill[double-fisted skull smashing]))) && equipped_item(s) != it) {

Btw there is almost definitely a little issue with the double fisted skull smashing conditional, it doesn't check to see if the item is two handed or not (not to mention things like if it's a chefstaff, ranged/melee mix and match, and whatever else). I'll probably fix that at some point.

EDIT: Also, I'm kind of interested in figuring out some nice way to make it so that the gear icons will just automatically fold over on to multiple lines if need be depending on the width of your character pane, rather than needing it to be a toggle. But I dunno much fancy HTML/CSS so idk if that's gonna happen, not to mention it's not exactly a huge problem.

EDIT 2: Welp, that was trivial too. I really need to stop expecting doing something with html to be complicated. Have an updated bakeGear

Code:
// pickerGear and bakeGear were written by soolar
void bakeGear() {
	buffer result;

	result.append('<table id="chit_gear" class="chit_brick nospace"><tbody>');
	result.append('<tr><th class="label"><a class="visit" target="mainpane" href="./inventory.php?which=2">Gear</a></th></tr>');

	void addSlot(slot s) {
		item equipped = equipped_item(s);
		result.append('<span><a class="chit_launcher" rel="chit_pickergear');
		result.append(s);
		result.append('" href="#"><img class="chit_gearicon hand" src="/images/itemimages/');
		if(equipped != $item[none])
			result.append(equipped.image);
		else
			result.append('blank.gif');
		result.append('" title="');
		result.append(s);
		result.append(': ');
		result.append(equipped);
		result.append('"></a></span>');
		pickerGear(s);
	}
	result.append('<tr><td>');
	foreach s in $slots[ hat, back, shirt, weapon, off-hand, pants, acc1, acc2, acc3 ]
		addSlot(s);
	result.append('</td></tr>');
	result.append('</tbody></table>');

	chitBricks["gear"] = result.to_string();
}

And here's an updated css thingie

Code:
table.chit_brick img.chit_gearicon {
  border:1px solid #D0D0D0;
  margin:0.5px;
}

I'm not a fan of how the icons look when shrunk so I haven't included lostcalpolydude's above change.

EDIT 3: I found a little bug in my picker hiding change. If you close a picker with the little x button they have, you won't be able to bring it back without toggling another picker first. Looking in to a fix, shouldn't take long.

EDIT 4: Okay yeah that change took literally five seconds. I have editted it in to the above code for the picker hiding.

EDIT 5: I added an icon to the gear brick, feel free to use it or to not. Tried to mess around with some css stuff to make it so the "Gear" text on the title bar for the brick centered as if the icon wasn't there, but couldn't figure out a way to do that. Not that that's a big deal, and none of the other bricks do that anyway, it just looked a teeny bit odd to me. But w/e. Here's a version with the icon and with the above changes:

Code:
// pickerGear and bakeGear were written by soolar
void bakeGear() {
	buffer result;

	result.append('<table id="chit_gear" class="chit_brick nospace"><tbody>');
	result.append('<tr><th class="label"><a class="visit" target="mainpane" href="./inventory.php?which=2"><img src="');
  result.append(imagePath);
  result.append('equipment.png">Gear</a></th></tr>');

	void addSlot(slot s) {
		item equipped = equipped_item(s);
		result.append('<span><a class="chit_launcher" rel="chit_pickergear');
		result.append(s);
		result.append('" href="#"><img class="chit_gearicon hand" src="/images/itemimages/');
		if(equipped != $item[none])
			result.append(equipped.image);
		else
			result.append('blank.gif');
		result.append('" title="');
		result.append(s);
		result.append(': ');
		result.append(equipped);
		result.append('"></a></span>');
		pickerGear(s);
	}
	result.append('<tr><td>');
	foreach s in $slots[ hat, back, shirt, weapon, off-hand, pants, acc1, acc2, acc3 ]
		addSlot(s);
	result.append('</td></tr>');
	result.append('</tbody></table>');

	chitBricks["gear"] = result.to_string();
}

And the icon is here, add it as mafiachit/images/relayimages/chit/equipment.png
 
Last edited:

Bale

Minion
Added all that and fixed the 1-handed thing about weapons in the off-hand slot. It looks nice! Unfortunately I cannot commit at the moment, so just assume it is working as intended and I'll commit the changes tomorrow.

Oh, I also removed "chit.size.wide" since that is no longer relevant.
 

Bale

Minion
Okay. Added all that stuff and made some improvements of my own...

  • All the gear suggestions in the outfit pane are now in the gear brick also. Just took a little refactoring.

  • I realized the gear brick would offer to put chefstaves in the off-hand if you have double-fisted skull smashing, so I fixed that bug.

  • I recommend deleting chit.favgear from your var file because honestly smiths should be enough to know that you want all the other smiths stuff, not just the weapon. The new setvar(chit.favgear) will handle that if you delete the old value from the vars file.

  • Will offer to create a smith's weapon for your off-hand also. Even if you have one in your main hand. Because sometimes over-kill is just enough.
 

heeheehee

Developer
Staff member
Will offer to create a smith's weapon for your off-hand also. Even if you have one in your main hand. Because sometimes over-kill is just enough.

What about a third one for my disembodied hand? Sometimes I like having a lot of muscle.
 

soolar

Member
Looking very nice, thanks for the touchups! I am interested in continuing to do some polish here and there if you don't mind. Would you be willing to consider adding me to the repository? I am familiar enough with SVN, so I will avoid committing to the main branch, and leave it up to you to merge changes I make in, if you'd like.
 

Bale

Minion
What about a third one for my disembodied hand? Sometimes I like having a lot of muscle.

I thought about that, but decided not to add a familiar slot in the gear brick, since there is one in the familiar brick. Should I add that feature down there or was this a joke? (That's a serious question because I can't tell.)


Looking very nice, thanks for the touchups! I am interested in continuing to do some polish here and there if you don't mind. Would you be willing to consider adding me to the repository? I am familiar enough with SVN, so I will avoid committing to the main branch, and leave it up to you to merge changes I make in, if you'd like.

I was already thinking about adding you so this is an easy decision. What's your SourceForge user name?
 

soolar

Member
Just signed up for SourceForge, username is soolar121

I'm more used to mercurial/git and bitbucket/github than svn/sourceforge, but I have used svn outside of sourceforge, so I am familiar enough with the differences.
 

Magus_Prime

Well-known member
I'm trying the new gear brick and noticed that it isn't recognizing a Xiblaxian holo-wrist-puter as an equippable accessory.

Edit: after more experimenting the picker is filtering the list in some way: other accessories aren't being offered. Haven't looked at the code yet.
 
Last edited:

heeheehee

Developer
Staff member
I thought about that, but decided not to add a familiar slot in the gear brick, since there is one in the familiar brick. Should I add that feature down there or was this a joke? (That's a serious question because I can't tell.)

This was mostly a joke. I only really use a third smiths weapon in aftercore, and I already have a third smiths weapon then.
 

PsyMar

Member
I hate to ask this, but how do I get rid of the gear brick? I was already constrained for space vertically with chit in terms of number of effects shown; now it shows about 3 at a time, when I'm generally running many more (often 3 with AT buffs alone.)
 

Magus_Prime

Well-known member
Edit the vars_<character name>.txt file in the KoLmafia data directory. Look for a line like:

Code:
chit.walls.layout	helpers,thrall,effects,tracker,gear

Remove the word "gear". Save the file and restart the relay browser. You're done.
 

Khari

Member
I also have the gear brick, but it does not appear in the variables. The line currently is "zlib chit.walls.layout = helpers,thrall,effects", but I have the gear brick.

Edit: OK, think I found the problem; "gear" is in the "ceiling" variable, not the "walls".
 
Last edited:

ereinion

Member
I hate to ask this, but how do I get rid of the gear brick? I was already constrained for space vertically with chit in terms of number of effects shown; now it shows about 3 at a time, when I'm generally running many more (often 3 with AT buffs alone.)
In order to gain more space in the charpane, I put most of the stuff I want to monitor in the ceiling, nothing in the walls, and only have the toolbar in the floor:

Code:
zlib chit.floor.layout = toolbar
zlib chit.roof.layout = character,stats,florist,familiar,effects, thrall
zlib chit.walls.layout =

Among other things, this lets me see more effects at a time as I scroll the sidebar:

 
Last edited:

soolar

Member
Just pushed my first commit to chit! Adds support for Puck Man/Ms. Puck Man, and a boatload of improvements to the gear brick. Namely, you can very conveniently add/remove items in the favorites list, and if it recommends an item that isn't a favorite, it'll tell you specifically why.
 

Magus_Prime

Well-known member
Edit: OK, think I found the problem; "gear" is in the "ceiling" variable, not the "walls".

Sorry about that. I, manually, added it to chit.walls.layout to test and then Bale made it the default the next day. I just assumed that when he did so he added it in the same place I did. :rolleyes:
 

soolar

Member
Just committed a really neat change, if I do say so myself! There's a custom version of the familiar picker in chit now, instead of KoL's default. For now it's basically the same, but I'm going to add some neat stuff to it! More importantly, I used this to add support for switching bjorned/enthroned familiars via the gear picker when you have the bjorn/crown equipped!
 

Bale

Minion
That is neat. Then if this feature request is granted you can make it capable of showing more than 15 familiars.

Please keep additional graphical elements and text in the picker to a minimum. I don't want to tamper with it's minimalist appearance too mcuh.
 

Bale

Minion
r255 by soolar said:
The familiar picker will now border a familiar with blue instead of gray if they have drops left, and tell you how many remain if you hover over the icon.

That is perfect. Right now I am so happy I gave you commit access. You even exposed the gelatinous cube drops which have always troubled me.
 
Last edited:
Top