Exemple #1
0
 public bool CanCraft(IPlayerCharacterData character, out GameMessage.Type gameMessageType)
 {
     gameMessageType = GameMessage.Type.None;
     if (craftingItem == null)
     {
         gameMessageType = GameMessage.Type.InvalidItemData;
         return(false);
     }
     if (character.Gold < requireGold)
     {
         gameMessageType = GameMessage.Type.NotEnoughGold;
         return(false);
     }
     if (craftRequirements == null || craftRequirements.Length == 0)
     {
         return(true);
     }
     foreach (var craftRequirement in craftRequirements)
     {
         if (craftRequirement.item != null && character.CountNonEquipItems(craftRequirement.item.DataId) < craftRequirement.amount)
         {
             gameMessageType = GameMessage.Type.NotEnoughItems;
             return(false);
         }
     }
     return(true);
 }
Exemple #2
0
 public bool CanCraft(IPlayerCharacterData character, out GameMessage.Type gameMessageType)
 {
     gameMessageType = GameMessage.Type.None;
     if (craftingItem == null)
     {
         gameMessageType = GameMessage.Type.InvalidItemData;
         return(false);
     }
     if (!GameInstance.Singleton.GameplayRule.CurrenciesEnoughToCraftItem(character, this))
     {
         gameMessageType = GameMessage.Type.NotEnoughGold;
         return(false);
     }
     if (craftRequirements == null || craftRequirements.Length == 0)
     {
         // No required items
         return(true);
     }
     foreach (ItemAmount craftRequirement in craftRequirements)
     {
         if (craftRequirement.item != null && character.CountNonEquipItems(craftRequirement.item.DataId) < craftRequirement.amount)
         {
             gameMessageType = GameMessage.Type.NotEnoughItems;
             return(false);
         }
     }
     return(true);
 }
Exemple #3
0
 public bool CanRefine(IPlayerCharacterData character, out GameMessage.Type gameMessageType)
 {
     gameMessageType = GameMessage.Type.None;
     if (character.Gold < requireGold)
     {
         gameMessageType = GameMessage.Type.NotEnoughGold;
         return(false);
     }
     if (requireItems == null || requireItems.Length == 0)
     {
         return(true);
     }
     foreach (var requireItem in requireItems)
     {
         if (requireItem.item != null && character.CountNonEquipItems(requireItem.item.DataId) < requireItem.amount)
         {
             gameMessageType = GameMessage.Type.NotEnoughItems;
             return(false);
         }
     }
     return(true);
 }
Exemple #4
0
 public bool CanRefine(IPlayerCharacterData character, out GameMessage.Type gameMessageType)
 {
     gameMessageType = GameMessage.Type.None;
     if (!GameInstance.Singleton.GameplayRule.CurrenciesEnoughToRefineItem(character, this))
     {
         gameMessageType = GameMessage.Type.NotEnoughGold;
         return(false);
     }
     if (requireItems == null || requireItems.Length == 0)
     {
         return(true);
     }
     // Count required items
     foreach (ItemAmount requireItem in requireItems)
     {
         if (requireItem.item != null && character.CountNonEquipItems(requireItem.item.DataId) < requireItem.amount)
         {
             gameMessageType = GameMessage.Type.NotEnoughItems;
             return(false);
         }
     }
     return(true);
 }