Mafia's Code: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bumcheekcity
m Created page with '==Character== ===Under Hardcore or Ronin=== <p><pre> KoLCharacter.canInteract(); </pre></p> This function returns true if the character is out of Hardcore or Ronin, false otherwi…'
 
imported>Bumcheekcity
Line 10: Line 10:
We can either use:
We can either use:
<p><pre>
<p><pre>
public static final boolean hasItem( final int itemId )
InventoryManager.hasItem( final int itemId )
public static final boolean hasItem( final int itemId, boolean shouldCreate )
InventoryManager.hasItem( final int itemId, boolean shouldCreate )
public static final boolean hasItem( final AdventureResult item )
InventoryManager.hasItem( final AdventureResult item )
public static final boolean hasItem( final AdventureResult item, final boolean shouldCreate )
InventoryManager.hasItem( final AdventureResult item, final boolean shouldCreate )
</pre></p>
</pre></p>
Essentially the top three overloaded functions call the bottom function, telling it NOT to create the item.  
Essentially the top three overloaded functions call the bottom function, telling it NOT to create the item.  
Line 19: Line 19:
Setting "shouldCreate" to true will NOT create the item, instead it will find out if you COULD create the item.  
Setting "shouldCreate" to true will NOT create the item, instead it will find out if you COULD create the item.  


hasItem() will return true if you have the item, or could create it and specify shouldCreate to be true.  
hasItem() will return true if you have the item, or could create it and specify shouldCreate to be true.


==Effects==
==Effects==

Revision as of 15:04, 1 February 2010

Character

Under Hardcore or Ronin

KoLCharacter.canInteract();

This function returns true if the character is out of Hardcore or Ronin, false otherwise. It is essentially used to check mall access.

Items

Check if we have a certain Item

We can either use:

InventoryManager.hasItem( final int itemId )	
InventoryManager.hasItem( final int itemId, boolean shouldCreate )
InventoryManager.hasItem( final AdventureResult item )
InventoryManager.hasItem( final AdventureResult item, final boolean shouldCreate )

Essentially the top three overloaded functions call the bottom function, telling it NOT to create the item.

Setting "shouldCreate" to true will NOT create the item, instead it will find out if you COULD create the item.

hasItem() will return true if you have the item, or could create it and specify shouldCreate to be true.

Effects

See if we are under the effects of Ode or Got Milk

KoLConstants.activeEffects.contains( ItemDatabase.ODE );
KoLConstants.activeEffects.contains( ItemDatabase.MILK );

Both of these are boolean variables.