Created
January 12, 2021 17:42
-
-
Save cgillis-aras/3a2254990ad36109bad0ab779fda3d7a to your computer and use it in GitHub Desktop.
Sample code for a generic version of an action that will get the name of the User who has claimed any ItemType
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Innovator inn = this.getInnovator(); | |
// Check to see if this item is claimed at all | |
if (this.isLocked() == 0) | |
{ | |
return inn.newResult("No one"); | |
} | |
// Query to make sure that we have the locked_by_id property | |
string selectedType = this.getType(); | |
Item selectedItem = inn.newItem(selectedType, "get"); | |
selectedItem.setID(this.getID()); | |
selectedItem.setAttribute("select", "locked_by_id(keyed_name)"); | |
selectedItem = selectedItem.apply(); | |
// Get the name of the user who locked this part | |
Item claimer = selectedItem.getPropertyItem("locked_by_id"); | |
string claimerName = claimer.getProperty("keyed_name"); | |
return inn.newResult(claimerName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment