Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;----------------------------------
- ; Enter Nearest Portal by maat70432/11/2014
- ;----------------------------------
- ; NAMES TO UPDATE
- ;
- #set fullfunctionname "com.company.assembleegameclient.objects:Player/ClosestPortal_" ; the full function name
- #set functionname "ClosestPortal_" ; the function name
- ;----------------------------------
- ; CODE
- ;----------------------------------
- trait method QName(PackageNamespace(""), $"functionname");
- method
- refid $"fullfunctionname"
- returns QName(PackageNamespace(""), "void")
- body
- maxstack 16
- localcount 16
- initscopedepth 16
- maxscopedepth 18
- code
- getlocal0
- pushscope
- ; Set current object to null
- pushnull
- coerce QName(PackageNamespace("com.company.assembleegameclient.objects"), "GameObject")
- setlocal 4
- ; Set considered object to null
- pushnull
- coerce QName(PackageNamespace("com.company.assembleegameclient.objects"), "GameObject")
- setlocal 7
- ; Set current target distance to 0
- pushbyte 0
- setlocal 8
- ; Set Considered Taget distance to 0
- pushbyte 0
- setlocal 9
- ; used for hasnext2 function
- pushbyte 0
- setlocal 5
- ; Get Array of all object within range
- getlex QName(PackageNamespace(""), "map_")
- getproperty QName(PackageNamespace(""), "goDict_")
- coerce_a
- setlocal 6
- jump NEXTOBJ
- L34:
- ; Get current gameobject.property from the Array
- label
- getlocal 6
- getlocal 5
- nextvalue
- coerce QName(PackageNamespace("com.company.assembleegameclient.objects"), "GameObject")
- dup
- setlocal 4
- ; Use the first instance of loc4 to check to see if object is a portal
- getlex QName(PackageNamespace("com.company.assembleegameclient.objects"), "Portal")
- istypelate
- iffalse NEXTOBJ
- ; Set XML ID of the Portal
- getlocal 4
- getproperty QName(PackageNamespace(""), "props_")
- getproperty QName(PackageNamespace(""), "id_")
- setlocal 14
- ; Dungeons to avoid
- getlocal 14
- pushstring "Pirate Cave Portal"
- ifeq NEXTOBJ
- ; Priority Dungeons
- getlocal 14
- pushstring "Ocean Trench Portal"
- ifeq ENTER
- getlocal 14
- pushstring "Tomb of the Ancients Portal"
- ifeq ENTER
- getlocal 14
- pushstring "Wine Cellar Portal"
- ifeq ENTER
- ; Distance from player to portal
- getlex QName(PackageNamespace(""), "Math")
- getlocal 4
- getproperty QName(PackageNamespace(""), "y_")
- getlex QName(PackageNamespace(""), "y_")
- subtract
- dup
- multiply
- getlocal 4
- getproperty QName(PackageNamespace(""), "x_")
- getlex QName(PackageNamespace(""), "x_")
- subtract
- dup
- multiply
- add
- callproperty QName(PackageNamespace(""), "sqrt"), 1
- dup
- setlocal 9
- ; Check to see if Current portal is null
- getlocal 8
- pushbyte 0
- ifeq REPLACE
- ; Check to see if new distance is lower that
- getlocal 8
- getlocal 9
- iflt REPLACE
- jump NEXTOBJ
- REPLACE:
- getlocal 9
- setlocal 8
- setlocal 4
- setlocal 7
- NEXTOBJ:
- ; Check to see if there is more objects within range
- hasnext2 6, 5 ; loc6 is your object you are check against and loc5 is your enumerator variable
- iftrue L34
- kill 6
- kill 5
- ENTER:
- ; Check to see if Portal is Locked
- ; getlocal 7
- ; getproperty QName(PackageNamespace("", "#0"), "_-0Ks")
- ; pushtrue
- ; ifeq END
- ; Enter Portal
- getlocal0
- getlocal 7
- callpropvoid QName(PackageNamespace("", "#0"), "usePortal"), 1
- END:
- returnvoid
- end ; code
- end ; body
- end ; method
- end ; trait
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement