public static bool MeetsCondition( HasFreeInventorySlots condition, Player player, Event eventInstance, QuestBase questBase ) { var quantity = condition.Quantity; if (condition.UseVariable) { switch (condition.VariableType) { case VariableTypes.PlayerVariable: quantity = (int)player.GetVariableValue(condition.VariableId).Integer; break; case VariableTypes.ServerVariable: quantity = (int)ServerVariableBase.Get(condition.VariableId)?.Value.Integer; break; } } // Check if the user has (or does not have when negated) the desired amount of inventory slots. var slots = player.FindOpenInventorySlots().Count; if ((!condition.Negated && slots >= quantity) || (condition.Negated && slots < quantity)) { return(true); } return(false); }
private void SaveFormValues(HasFreeInventorySlots condition) { condition.Quantity = (int)nudItemAmount.Value; condition.VariableType = rdoInvPlayerVariable.Checked ? VariableTypes.PlayerVariable : VariableTypes.ServerVariable; condition.UseVariable = !rdoManual.Checked; condition.VariableId = rdoInvPlayerVariable.Checked ? PlayerVariableBase.IdFromList(cmbInvVariable.SelectedIndex) : ServerVariableBase.IdFromList(cmbInvVariable.SelectedIndex); }
private void SetupFormValues(HasFreeInventorySlots condition) { nudItemAmount.Value = condition.Quantity; rdoVariable.Checked = condition.UseVariable; rdoInvGlobalVariable.Checked = condition.VariableType == VariableTypes.ServerVariable; SetupAmountInput(); }
public static bool MeetsCondition( HasFreeInventorySlots condition, Player player, Event eventInstance, QuestBase questBase ) { // Check if the user has (or does not have when negated) the desired amount of inventory slots. var slots = player.FindOpenInventorySlots().Count; if ((!condition.Negated && slots >= condition.Quantity) || (condition.Negated && slots < condition.Quantity)) { return(true); } return(false); }
private void SaveFormValues(HasFreeInventorySlots condition) { condition.Quantity = (int)nudFreeInventorySlots.Value; }
private void SetupFormValues(HasFreeInventorySlots condition) { nudFreeInventorySlots.Value = condition.Quantity; }