private string GetPropertyDisplayValue(int languageNumber, InvItem invItem) { if (invItem != null) { InvVar invVar = invItem.GetProperty(itemPropertyID); if (invVar != null) { if (multiplyByItemCount) { return(invVar.GetDisplayValue(languageNumber, invItem.count)); } return(invVar.GetDisplayValue(languageNumber)); } } return(string.Empty); }
private string GetPropertyDisplayValue(int languageNumber, InvInstance invInstance) { if (InvInstance.IsValid(invInstance)) { InvVar invVar = invInstance.GetProperty(itemPropertyID); if (invVar != null) { if (multiplyByItemCount) { return(invVar.GetDisplayValue(languageNumber, invInstance.Count)); } return(invVar.GetDisplayValue(languageNumber)); } } return(string.Empty); }
private string GetPropertyDisplayValue(int languageNumber, InvItem invItem) { if (invItem != null) { InvVar invVar = invItem.GetProperty(itemPropertyID); if (invVar != null) { return(invVar.GetDisplayValue(languageNumber)); } } return(""); }
override public float Run() { InvItem invItem = (setVarAsPropertyMethod == SetVarAsPropertyMethod.SelectedItem) ? KickStarter.runtimeInventory.LastSelectedItem : KickStarter.inventoryManager.GetItem(invID); if (invItem != null && runtimeVariable != null) { InvVar invVar = invItem.GetProperty(propertyID); if (invVar == null) { LogWarning("Cannot find property with ID " + propertyID + " on Inventory item " + invItem.GetLabel(0)); return(0f); } if (runtimeVariable.type == VariableType.String) { runtimeVariable.textVal = invVar.GetDisplayValue(Options.GetLanguage()); } else if (runtimeVariable.type == invVar.type) { if (invVar.type == VariableType.Float) { runtimeVariable.FloatValue = invVar.FloatValue; } else if (invVar.type == VariableType.Vector3) { runtimeVariable.Vector3Value = invVar.Vector3Value; } else { runtimeVariable.IntegerValue = invVar.IntegerValue; } } else { LogWarning("Cannot assign " + varLocation.ToString() + " Variable " + runtimeVariable.label + "'s value from '" + invVar.label + "' property because their types do not match."); } } return(0); }
override public float Run() { GVar myVar = (varLocation == VariableLocation.Global) ? GlobalVariables.GetVariable(variableID) : LocalVariables.GetVariable(variableID, localVariables); InvItem invItem = (setVarAsPropertyMethod == SetVarAsPropertyMethod.SelectedItem) ? KickStarter.runtimeInventory.LastSelectedItem : KickStarter.inventoryManager.GetItem(invID); if (invItem != null && myVar != null) { InvVar invVar = invItem.GetProperty(propertyID); if (myVar.type == VariableType.String) { myVar.textVal = invVar.GetDisplayValue(Options.GetLanguage()); } else if (myVar.type == invVar.type) { if (invVar.type == VariableType.Float) { myVar.FloatValue = invVar.FloatValue; } else if (invVar.type == VariableType.Vector3) { myVar.Vector3Value = invVar.Vector3Value; } else { myVar.IntegerValue = invVar.IntegerValue; } } else { ACDebug.LogWarning("Cannot assign " + varLocation.ToString() + " Variable " + myVar.label + "'s value from '" + invVar.label + "' property because their types do not match."); } } return(0); }
public override float Run() { int runtimeInvID = -1; if (setVarAsPropertyMethod == SetVarAsPropertyMethod.SelectedItem) { if (InvInstance.IsValid(KickStarter.runtimeInventory.SelectedInstance)) { runtimeInvID = KickStarter.runtimeInventory.SelectedInstance.ItemID; } } else { runtimeInvID = invID; } InvVar invVar = null; if (runtimeInvID >= 0) { InvInstance invInstance = (useLiveValues) ? KickStarter.runtimeInventory.GetInstance(runtimeInvID) : new InvInstance(KickStarter.inventoryManager.GetItem(runtimeInvID)); if (!InvInstance.IsValid(invInstance)) { if (useLiveValues) { LogWarning("Cannot find Inventory item with ID " + runtimeInvID + " in the Player's inventory"); } else { LogWarning("Cannot find Inventory item with ID " + runtimeInvID); } return(0f); } invVar = invInstance.GetProperty(propertyID); } if (invVar == null) { LogWarning("Cannot find property with ID " + propertyID + " on Inventory item ID " + runtimeInvID); return(0f); } if (runtimeVariable.type == VariableType.String) { runtimeVariable.TextValue = invVar.GetDisplayValue(Options.GetLanguage()); } else if (runtimeVariable.type == invVar.type) { int itemCount = (useLiveValues && multiplyByItemCount) ? KickStarter.runtimeInventory.GetCount(runtimeInvID) : 1; switch (invVar.type) { case VariableType.Float: runtimeVariable.FloatValue = invVar.FloatValue * (float)itemCount; break; case VariableType.Integer: runtimeVariable.IntegerValue = invVar.IntegerValue * itemCount; break; case VariableType.Vector3: runtimeVariable.Vector3Value = invVar.Vector3Value; break; default: runtimeVariable.IntegerValue = invVar.IntegerValue; break; } } else { LogWarning("Cannot assign " + varLocation.ToString() + " Variable " + runtimeVariable.label + "'s value from '" + invVar.label + "' property because their types do not match."); } return(0); }
public override float Run() { int runtimeInvID = -1; if (setVarAsPropertyMethod == SetVarAsPropertyMethod.SelectedItem) { if (KickStarter.runtimeInventory.SelectedItem != null) { runtimeInvID = KickStarter.runtimeInventory.SelectedItem.id; } } else { runtimeInvID = invID; } InvVar invVar = null; if (runtimeInvID >= 0) { if (multiplyByItemCount) { invVar = KickStarter.runtimeInventory.GetPropertyTotals(propertyID, runtimeInvID); } else { InvItem invItem = KickStarter.inventoryManager.GetItem(runtimeInvID); if (invItem != null) { invVar = invItem.GetProperty(propertyID); } } } if (invVar == null) { LogWarning("Cannot find property with ID " + propertyID + " on Inventory item ID " + runtimeInvID); return(0f); } if (runtimeVariable.type == VariableType.String) { runtimeVariable.textVal = invVar.GetDisplayValue(Options.GetLanguage()); } else if (runtimeVariable.type == invVar.type) { if (invVar.type == VariableType.Float) { runtimeVariable.FloatValue = invVar.FloatValue; } else if (invVar.type == VariableType.Vector3) { runtimeVariable.Vector3Value = invVar.Vector3Value; } else { runtimeVariable.IntegerValue = invVar.IntegerValue; } } else { LogWarning("Cannot assign " + varLocation.ToString() + " Variable " + runtimeVariable.label + "'s value from '" + invVar.label + "' property because their types do not match."); } return(0); }