New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added few extension functions (Unit, Widget, Int, Real) #50

Merged
merged 3 commits into from Feb 14, 2018

Conversation

Projects
None yet
2 participants
@Kithio
Copy link
Contributor

Kithio commented Feb 10, 2018

Added in a few extension functions I feel are useful to have, Most of which has a direct Native equivalent that it's making use of.

SetHeroLevel(this, level, showEyeCandy)

public function unit.addLevels(int toAdd, boolean showEyeCandy)
SetHeroLevel(this, GetUnitLevel(this) + toAdd, showEyeCandy)

This comment has been minimized.

@Frotty

Frotty Feb 14, 2018

Member

should use .getLevel()

public function unit.hasItemById(int itemId) returns boolean
var hasItem = false
for i = 0 to this.inventorySize() - 1
if GetItemTypeId(this.itemInSlot(i)) == itemId

This comment has been minimized.

@Frotty

Frotty Feb 14, 2018

Member

.getTypeId()


/** Checks if this int is between low and high value */
public function int.valueBetween(int low, int high) returns bool

This comment has been minimized.

@Frotty

Frotty Feb 14, 2018

Member

I don't particularly like this naming "valueBetween". Imo it refers more to generating a value between those numbers.
A check should probably be worded "isBetween" or "isInBounds" or something.

@Frotty

This comment has been minimized.

Copy link
Member

Frotty commented on wurst/_handles/primitives/Integer.wurst in 5c744eb Feb 14, 2018

you forgot real.valueBetween

@Frotty

This comment has been minimized.

Copy link
Member

Frotty commented Feb 14, 2018

Nice thanks 🍭

@Frotty Frotty merged commit 780efde into wurstscript:master Feb 14, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment