| | |
| | | [XLua.LuaCallCSharp]
|
| | | public class AlchemyModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
| | | {
|
| | | Dictionary<int, uint> m_AlchemyTimes = new Dictionary<int, uint>();
|
| | | Dictionary<int, AlchemyTime> m_AlchemyTimes = new Dictionary<int, AlchemyTime>();
|
| | | Dictionary<int, Dictionary<int, AlchemyCount>> m_AlchemyCounts = new Dictionary<int, Dictionary<int, AlchemyCount>>();
|
| | | Dictionary<int, int> m_AlchemyQualityLucks = new Dictionary<int, int>();
|
| | | Dictionary<int, List<Item>> m_AlchemyMaterials = new Dictionary<int, List<Item>>();
|
| | |
| | |
|
| | | public bool alchemyNormalNotifySymbol { get; set; }
|
| | | public bool alchemyFairyNotifySymbol { get; set; }
|
| | |
|
| | | public int maxBatchAlchemyCount { get; private set; }
|
| | |
|
| | | public bool isServerPrepare { get; private set; }
|
| | |
|
| | |
| | | {
|
| | | var funcConfig = FuncConfigConfig.Get("AlchemyOverLimit");
|
| | | var itemId = int.Parse(funcConfig.Numerical1);
|
| | | maxBatchAlchemyCount = int.Parse(funcConfig.Numerical2);
|
| | |
|
| | | var configs = AttrFruitConfig.GetValues();
|
| | | foreach (var config in configs)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public bool TryGetAlchemyStartTime(int alchemyId, out uint tick)
|
| | | public bool TryGetAlchemyStartTime(int alchemyId, out AlchemyTime alchemyTime)
|
| | | {
|
| | | return m_AlchemyTimes.TryGetValue(alchemyId, out tick);
|
| | | return m_AlchemyTimes.TryGetValue(alchemyId, out alchemyTime);
|
| | | }
|
| | |
|
| | | public bool TryGetAlchemyCount(int alchemyId, int luckValue, out AlchemyCount alchemyCount)
|
| | |
| | |
|
| | | public int GetStoveState(int alchemyId)
|
| | | {
|
| | | uint tick = 0;
|
| | | if (TryGetAlchemyStartTime(alchemyId, out tick)
|
| | | && tick > 0)
|
| | | AlchemyTime alchemyTime;
|
| | | if (TryGetAlchemyStartTime(alchemyId, out alchemyTime)
|
| | | && alchemyTime.startTick > 0)
|
| | | {
|
| | | var config = AlchemyConfig.Get(alchemyId);
|
| | | var startTime = TimeUtility.GetTime(tick);
|
| | | var seconds = config.NeedTime - (float)(TimeUtility.ServerNow - startTime).TotalSeconds;
|
| | | var startTime = TimeUtility.GetTime(alchemyTime.startTick);
|
| | | var seconds = config.NeedTime * alchemyTime.count
|
| | | - (float)(TimeUtility.ServerNow - startTime).TotalSeconds;
|
| | | return seconds > 0 ? 1 : 2;
|
| | | }
|
| | | return 0;
|
| | |
| | | return drugUseLimit.GetUseLimit();
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | public int GetCanAlchemyCount(int alchemyId)
|
| | | {
|
| | | Item item;
|
| | | var count = 0;
|
| | | if (IsAlchemyEnoughMaterial(alchemyId, out item))
|
| | | {
|
| | | List<Item> materials;
|
| | | if (TryGetAlchemyMaterials(alchemyId, out materials))
|
| | | {
|
| | | for (int i = 0; i < materials.Count; i++)
|
| | | {
|
| | | var mat = materials[i];
|
| | | var itemCount = packModel.GetItemCountByID(PackType.Item, mat.id);
|
| | | var _count = itemCount / mat.count;
|
| | | if (count == 0)
|
| | | {
|
| | | count = _count;
|
| | | }
|
| | | else
|
| | | {
|
| | | count = Mathf.Min(count, _count);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | return count;
|
| | | }
|
| | |
|
| | | public bool IsGraspRecipe(int alchemyId)
|
| | |
| | | for (int i = 0; i < package.StoveCnt; i++)
|
| | | {
|
| | | var data = package.InfoList[i];
|
| | | m_AlchemyTimes[(int)data.AlchemyID] = data.StartTime;
|
| | | m_AlchemyTimes[(int)data.AlchemyID] = new AlchemyTime()
|
| | | {
|
| | | startTick = data.StartTime,
|
| | | count = data.AlchemyTimes,
|
| | | };
|
| | |
|
| | | if (isServerPrepare)
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public struct AlchemyTime
|
| | | {
|
| | | public uint startTick;
|
| | | public int count;
|
| | | }
|
| | |
|
| | | public class AlchemyRedpoint
|
| | | {
|
| | | public readonly Redpoint redpoint;
|