Wolfpack Library Reference

MODULE DESCRIPTION

Functions:

booleantogglecountGoldhex2decisdirtissandiswoodgemtobackpack
checkLoScreatekeysecretisMapAvailableToishatisshielditemsincontainertobankbox
checkresourcescreatelockandkeyisValidPositionisinstrumentisspellbookitemsmatchtocontainer
consumeGoldenergydamageisarmorisminingtoolistreerolldice 
consumeresourcesevenoroddisclothingismountainorcaveiswaterstaffmessage 
cont2conthasHandFreeiscrystalisoregemisweaponthrowobject 

MODULE FUNCTIONS

wolfpack.utilities.booleantoggle(boolean)

- boolean

Return Value:
Boolean

Description:
Takes a boolean property and toggles it.

Back to top


wolfpack.utilities.checkLoS(object1, object2, rangecheck)

- object1
First object, char/item

- object2
Second object, char/item

- rangecheck
Default 10.

Return Value:
boolean

Description:
Checks the line of sight between two objects and returns true or false if in sight.

Back to top
wolfpack.utilities.checkresources(container, baseid, amount)

- container
The container you want to search in.

- baseid
The baseid of the resource you are looking for.

- amount
The amount that is required of the given resource.

Return Value:
False if all the required resources have been found. Otherwise the remaining amount of
the resource that has not been found.

Description:
Recursively searches for items with a given baseid in a container and checks if a
given amount can be found.

Back to top
wolfpack.utilities.consumeGold(char, amount)

- char
The character whose gold shall be consumed.

- amount
The amount of gold that shall be consumed.

Return Value:
True if the gold could be consumed, false otherwise.

Description:
Consumes a specified amount of gold from character. If 'Pay From Pack Only' option is enabled gold in characters bankbox is ignored.
Always succeeds for GMs.

Back to top
wolfpack.utilities.consumeresources(container, baseid, amount)

- container
The container you want to remove from.

- baseid
The baseid of the items you want to remove.

- amount
The amount of items you want to remove.

Return Value:
True if the resource could be consumed, false otherwise.

Description:
Removes a given amount of items with a given baseid recursively from a given container.

Back to top
wolfpack.utilities.cont2cont(container1, container2)

- container1
The source container.

- container2
The target container.

Description:
Moves all objects from container1 to container2.

Back to top
wolfpack.utilities.countGold(char)

- char
The character whose gold shall be count.

Return Value:
The amount of gold as an integer.

Description:
Counts the amount of gold the character possess. If 'Pay From Pack Only' option is enabled gold in characters bankbox is ignored.

Back to top
wolfpack.utilities.createkeysecret()

Description:
Returns a random key secret used to create locks, or change lock secrets

Back to top
wolfpack.utilities.createlockandkey(container)

- container
The container you want to make lockable.

Description:
Makes a current container lockable and creates a key in it.

Back to top
wolfpack.utilities.energydamage(target, source, amount, physical, fire, cold, poison, energy, noreflect, ignorephysical, damagetype)

- target
The target that is taking damage. Only characters are allowed.

- source
The source of the damage. May be None.

- amount
The amount of damage dealt.

- physical
Defaults to 0.
The physical fraction of the damage. This is an integer value ranging from 0 to 100.

- fire
Defaults to 0.
The fire fraction of the damage. This is an integer value ranging from 0 to 100.

- cold
Defaults to 0.
The cold fraction of the damage. This is an integer value ranging from 0 to 100.

- poison
Defaults to 0.
The poison fraction of the damage. This is an integer value ranging from 0 to 100.

- energy
Defaults to 0.
The energy fraction of the damage. This is an integer value ranging from 0 to 100.

- noreflect
Defaults to 0. If this parameter is 1, no physical damage will be reflected back to
the source.

- ignorephysical
Defaults to False. If this parameter is true, the physical resistance of the target
will be ignored.

- damagetype
Defaults to DAMAGE_MAGICAL. This is the damagetype passed on to the internal damage function.
You can ignore this most of the time.

Description:
Deal damage to a target and take the targets energy resistances into account.

Back to top
wolfpack.utilities.evenorodd(value)

- value
The integer value that should be checked.

Return Value:
A string which is either "even" or "odd".

Description:
Takes a given int value and determines if it is even or odd and returns a string with the result.

Back to top
wolfpack.utilities.hasHandFree(char, item)

- char
The char you want to check to have a free hand.

- item
May be None. Not used so far.

Description:
Checks if a char has a free hand.

Back to top
wolfpack.utilities.hex2dec(value, default)

- value
The string you want to convert.

- default
Defaults to 0.
The default value that will be returned if there is an error converting the given string.

Return Value:
The string converted to an integer value.

Description:
Converts a string to an integer value and accepts either a normal decimal number (64) or the
standard hexadecimal notation (0x40).

Back to top
wolfpack.utilities.isMapAvailableTo(player, mapid)

- player
The player that this should be checked for.

- mapid
The mapid that is being checked.

Return Value:
Returns a boolean value if the map is available.

Description:
Checks to see if a given map id is available to the connected client.

Back to top
wolfpack.utilities.isValidPosition(pos)

- pos
The wolfpack coord object to check.

Return Value:
Returns a boolean value if the position is valid.

Description:
Checks to see if a given coord object is a valid map position.

Back to top
wolfpack.utilities.isarmor(item)

- item

Return Value:
Boolean

Description:
Returns if the item is a known armor.

Back to top
wolfpack.utilities.isclothing(item)

- item

Return Value:
Boolean

Description:
Returns if the item is a known clothing.

Back to top
wolfpack.utilities.iscrystal(tile)

- tile

Return Value:
Boolean

Description:
Returns if the tile is a crystal tile, AoS artwork.

Back to top
wolfpack.utilities.isdirt(item)

- item

Return Value:
Boolean

Description:
Returns if the tile is a dirt tile..

Back to top
wolfpack.utilities.ishat(item)

- item

Return Value:
Boolean

Description:
Returns if the item is a known hat.

Back to top
wolfpack.utilities.isinstrument(item)

- item

Return Value:
Boolean

Description:
Returns if the item is a known instrument.

Back to top
wolfpack.utilities.isminingtool(item)

- item

Return Value:
Boolean

Description:
Returns if the item is a known mining tool.

Back to top
wolfpack.utilities.ismountainorcave(tile)

- tile

Return Value:
Boolean

Description:
Returns if the tile is a mountain or cave tile.

Back to top
wolfpack.utilities.isoregem(item)

- item

Return Value:
Boolean

Description:
Returns if the item is a known ore gem.

Back to top
wolfpack.utilities.issand(tile)

- tile

Return Value:
Boolean

Description:
Returns if the tile is a sand tile.

Back to top
wolfpack.utilities.isshield(item)

- item

Return Value:
Boolean

Description:
Returns if the item is a known shield.

Back to top
wolfpack.utilities.isspellbook(item)

- item

Return Value:
Boolean

Description:
Returns if the item is a known spell book.

Back to top
wolfpack.utilities.istree(tile)

- tile

Return Value:
Boolean

Description:
Returns if the tile is a tree object..

Back to top
wolfpack.utilities.iswater(tile)

- tile

Return Value:
Boolean

Description:
Returns if the tile is a water tile.

Back to top
wolfpack.utilities.isweapon(item)

- item

Return Value:
Boolean

Description:
Returns if the item is a known weapon.

Back to top
wolfpack.utilities.iswoodgem(item)

- item

Return Value:
Boolean

Description:
Returns if the item is a known wood gem.

Back to top
wolfpack.utilities.itemsincontainer(serial)

- serial

Return Value:
list

Description:
Returns a list of item serials inside the container.

Back to top
wolfpack.utilities.itemsmatch(item1, item2)

- item1
The first item.

- item2
The second item.

Return Value:
True if the items could stack, false otherwise.

Description:
Determines if the items match for stacking. This function does not check
if the stacked amount is larger than the maximum.

Back to top
wolfpack.utilities.rolldice(dice, sides, bonus)

- dice
This is either the number of dice you want to roll or a string representation of the number of dice, the sides
and the bonus. One of the following would be valid: "2d8+4", "2d8", "1d4-1", "20d10".

- sides
Defaults to 6.
The number of sides each dice should have.

- bonus
Defaults to 0.
The bonus that should be added to the result after the dice have been rolled.

Return Value:
The result of the roll as an integer.

Description:
Rolls some dice and returns a result.

Back to top
wolfpack.utilities.staffmessage(char, text)

- char
The char causing the message.

- text
Text which should be sended.

Description:
Sends a message to every connected staff char depending on the mtype.

Back to top
wolfpack.utilities.throwobject(char, object, pos, sendobject, movable, speed, fixeddir, explodes, hue, rendermode)

- char

- object

- pos
The target position.

- sendobject

- movable
To change the item.movable value

- speed

- fixeddir

- explodes

- hue

- rendermode

Return Value:
none

Description:
Animates a character's throwing of an object at a given target.

Back to top
wolfpack.utilities.tobackpack(item, char)

- item
The item you want to move to the backpack of the character.

- char
The character in whose backpack you want to place the item.

Return Value:
True if the item was stacked inside the characters backpack and is now invalid.
False if the item has been put into the characters backpack and needs to be updated.

Description:
Moves an object into a characters backpack and stacks it if possible.

Back to top
wolfpack.utilities.tobankbox(item, char)

- item
The item you want to move to the bank deposit box of the character.

- char
The character in whose bank box you want to place the item.

Return Value:
True if the item was stacked inside the characters bank box and is now invalid.
False if the item has been put into the characters backpack and needs to be updated.

Description:
Moves an object into a characters backpack and stacks it if possible.

Back to top
wolfpack.utilities.tocontainer(item, container)

- item
The item you want to move to the given container.

- container
The container you want to move the item into.

Return Value:
True if the item was stacked inside the container and has been deleted.
False if the item has not been stacked and needs to be updated in order to be seen.

Description:
Moves an object into a container and stacks it if possible.

Back to top

Back to the Module Overview
Back to the Wolfpack Reference

Generated: 23.10.2013 20:15 | Version: Wolfpack Unknown
© 2004-2006 Wolfpack Team | http://www.wpdev.org