Item drops: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Heeheehee
Created page with '{{#vardefine:name|item_drops}} {{#vardefine:return_type|int[item]}} {{#vardefine:aggregate|yes}} {{FunctionPage| name={{#var:name}}| function_category=Your Character| function1=…'
 
imported>StDoodle
m wrong category
Line 5: Line 5:
{{FunctionPage|
{{FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Your Character|
function_category=Item Management|
function1={{Function|
function1={{Function|
name={{#var:name}}|
name={{#var:name}}|

Revision as of 23:29, 6 March 2010



Function Syntax

int[item] item_drops(monster m )

Returns a map of the monster's drop rates, indexed by item names.

Code Samples

Prints the drops of a certain monster.

void drops(monster mob){
   int[item] drops = item_drops(mob);
   print("Monster: " + mob);
   foreach i in drops {
      print("Drop rate of " + i + " is " + drops[i]*(1+item_drop_modifier()/100) + "%");
   }
}

See Also

meat_drop() | item_drop_modifier()()

Special

This function has a known bug: if a monster drops the same item more than once, the map only returns the last rate in that monster's entry in monsters.txt.