From 4571e178a957e0d8f5fa3e81677bffa7047b2eca Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期五, 17 五月 2019 16:57:57 +0800
Subject: [PATCH] 6830 子 【2.0】【开发】初次获得未学习的丹方物品提示使用 / 【2.0】【前端】初次获得未学习的丹方物品提示使用

---
 System/Alchemy/AlchemyModel.cs |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/System/Alchemy/AlchemyModel.cs b/System/Alchemy/AlchemyModel.cs
index 3ddf74b..418b5b6 100644
--- a/System/Alchemy/AlchemyModel.cs
+++ b/System/Alchemy/AlchemyModel.cs
@@ -288,6 +288,44 @@
             return m_AlchemyDrugUseLimits.TryGetValue(id, out drugUseLimit);
         }
 
+        public bool TryLearn(int alchmeyId, out int error)
+        {
+            error = 0;
+            var config = AlchemyConfig.Get(alchmeyId);
+            if (stoveLevel < config.LearnNeedAlchemLV)
+            {
+                error = 2;
+                return false;
+            }
+            if (PlayerDatas.Instance.extersion.luckValue < config.LearnNeedLuck)
+            {
+                error = 3;
+                return false;
+            }
+            var count = packModel.GetItemCountByID(PackType.Item, config.LearnNeedItemID);
+            if (count <= 0)
+            {
+                error = 1;
+                return false;
+            }
+            return true;
+        }
+
+        public bool TryGetAlchemyByStudyMaterial(int id, out int alchemyId)
+        {
+            alchemyId = 0;
+            var configs = AlchemyConfig.GetValues();
+            foreach (var config in configs)
+            {
+                if (config.LearnNeedItemID == id)
+                {
+                    alchemyId = config.ID;
+                    return true;
+                }
+            }
+            return false;
+        }
+
         public int GetAlchemyRedpointId(int id)
         {
             return alchemyRedpoints.ContainsKey(id) ? alchemyRedpoints[id].redpoint.id : 0;

--
Gitblit v1.8.0