Item drops array

From Kolmafia
Revision as of 07:16, 5 April 2010 by imported>Heeheehee (New function, new page!)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

int [item] item_drops_array(monster m )

Returns an array of records with three fields:

record {
   item drop;
   int rate;
   string type;
}

Since this is the first function to return a record, it cannot be stored to a variable, and thus the only way to access the data is by iterating over the elements in the record.

Code Samples

Prints all information Mafia has regarding the item drops of a certain monster.

void drops(monster mob){
   print("Monster: " + mob);
   foreach index, rec in item_drops_array(mob) 
      print("item: "+rec.drop+", drop rate: "+rec.rate+", type: "+rec.type);
}

See Also

meat_drop() | item_drops()

Special

The zero-parameter form returns the last monster encountered (the current one, if used in combat).