void pickerGear(slot s) {
buffer picker;
picker.pickerStart("gear" + s, "Change " + s);
picker.addLoader("Changing " + s + "...");
boolean any_options = false;
void add_gear_option(item it, string prefix)
{
any_options = true;
picker.append('<tr class="pickitem"><td class="icon"><img src="/images/itemimages/');
picker.append(it != $item[none] ? it.image : equipped_item(s).image);
picker.append('" class="hand" onclick="descitem(');
picker.append(it != $item[none] ? it.descid : equipped_item(s).descid);
picker.append(',0,event)" /></td><td><a href="');
picker.append(it != $item[none] ? sideCommand("equip " + s + " " + it) : sideCommand("unequip " + s));
picker.append('">');
picker.append(prefix);
picker.append(it != $item[none] ? it : equipped_item(s));
picker.append('</a></td></tr>');
}
void add_gear_option(item it)
{
add_gear_option(it, "");
}
if(equipped_item(s) != $item[none])
add_gear_option($item[none], "Unequip ");
item real_item(string name)
{
switch(name)
{
case "smiths": switch(my_class())
{
case $class[seal clubber]: return $item[meat tenderizer is murder];
case $class[turtle tamer]: return $item[ouija board, ouija board];
case $class[pastamancer]: return $item[hand that rocks the ladle];
case $class[sauceror]: return $item[saucepanic];
case $class[disco bandit]: return $item[frankly mr. shank];
case $class[accordion thief]: return $item[Shakespeare's Sister's Accordion];
default: return $item[none];
}
}
return to_item(name);
}
foreach i,fav in split_string(vars["chit.favgear"], ",")
{
item it = real_item(fav);
if(it != $item[none] && (it.to_slot() == s || (s == $slot[off-hand] && have_skill($skill[double-fisted skull smashing]))) && equipped_item(s) != it)
{
if(available_amount(it) > 0)
{
add_gear_option(it);
}
else if(creatable_amount(it) > 0)
{
add_gear_option(it, "CREATE ");
}
}
}
if(!any_options)
{
picker.addSadFace("You have no favorited gear available for this slot. Poor you :(");
}
picker.append('</table></div>');
chitPickers["gear" + s] = picker;
}
void bakeGear() {
buffer result;
result.append('<table id="chit_gear" class="chit_brick nospace"><tbody>');
result.append('<tr><th class="label" colspan="9"><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('<td><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></td>');
pickerGear(s);
}
result.append('<tr>');
foreach s in $slots[ hat, back, shirt, weapon, off-hand ]
addSlot(s);
if(!to_boolean(vars["chit.gear.wide"]))
result.append('</tr><tr>');
foreach s in $slots[ pants, acc1, acc2, acc3 ]
addSlot(s);
result.append('</tr>');
result.append('</tbody></table>');
chitBricks["gear"] = result.to_string();
}