Fun with Equipment

Metraxis

Member
Attached to this post is a mostly incomplete Equipment map that I've been working on as I go. I think it's fairly obvious what this map is intended to do. My question is this: Does KolMafia expose this information anywhere that ASH can get to it? Obviously, if it's available, I'd rather not reinvent the wheel.
 

Attachments

  • Lib.Equipment.ash
    10.3 KB · Views: 80

holatuwol

Developer
If you instantiate a string [item,int] map called "data" and pass it to file_to_map like so:

Code:
file_to_map( "equipment.dat", data )

You get a map containing all of the equipment pre-requisites as a string, where strings starting with "Mus", "Mys", and "Mox" indicate prerequsites and "none" indicates no pre-requisite, indexed by item followed by power.  With clever use of this and a for-each statement, you can use it to initialize your data structure.[br]Posted on: December 05, 2006, 02:18:26 PM
Alternatively, there are also ASH functions that will give you the power of an item and whether or not they can be equipped, and since that's often the only data that's relevant (you don't really need the exact requirements, usually, just whether or not the items can be equipped), those functions may also serve whatever evil schemes you are plotting. :wink:[br]Posted on: December 05, 2006, 02:20:48 PM
Also, since I don't triple post very often, and triple posting is kinda fun when you know you aren't going to get punished for it since it's so much easier than editing old posts, I believe Nightmist wrote a giant library script which adds some extra information (potentially outdated) which may or may not be of interest to you.

http://kolmafia.us/index.php/topic,242.0.html
 

Metraxis

Member
I'd looked at equipment.dat, hoping that it would provide what I was looking for, but alas, it only provides requirement data, which, as you indicated, is more than adequately handled by can_equip(). The purpose of the Equipment map I am working on is to document the side-effects of equipment rather than requirements, to allow statements in my scripts like:
Code:
foreach Slot in Body {
   equip_slot(Slot,optimum_slot(Slot,"Melee Damage"));
}

The Equipment section of the ASH reference in the wiki does not mention a function that returns the power of a piece of equipment. Where is it documented/what is the syntax? Admittedly, though, the power attbritutes in the map I posted are mainly for checking whether an $item is in the map or not (This is why all the accessories have power = -1)

I was unaware of Nightmist's library, but on review it is too segmented for my needs. The particular functions I envision would pass strings over a single map rather than indexing into a dozen different maps.

In any case, it appears the answer to my original question is 'no', so I'll continue adding to the map and, if ever it is complete, post it, since the actual doing of evil things with it is non-trivial :)
 
Top