mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-04-22 03:49:35 +08:00
修复商品的物品列表无限叠加问题
This commit is contained in:
parent
7dfa6e7beb
commit
739842b55b
@ -2,6 +2,7 @@ using System.Text;
|
|||||||
using Milimoe.FunGame.Core.Api.Utility;
|
using Milimoe.FunGame.Core.Api.Utility;
|
||||||
using Milimoe.FunGame.Core.Entity;
|
using Milimoe.FunGame.Core.Entity;
|
||||||
using Milimoe.FunGame.Core.Library.Constant;
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
using Oshima.Core.Configs;
|
||||||
using Oshima.Core.Constant;
|
using Oshima.Core.Constant;
|
||||||
using Oshima.FunGame.OshimaModules.Characters;
|
using Oshima.FunGame.OshimaModules.Characters;
|
||||||
using Oshima.FunGame.OshimaModules.Effects.OpenEffects;
|
using Oshima.FunGame.OshimaModules.Effects.OpenEffects;
|
||||||
@ -2035,18 +2036,18 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
{
|
{
|
||||||
int index = Random.Shared.Next(AllItems.Count);
|
int index = Random.Shared.Next(AllItems.Count);
|
||||||
Item item = AllItems[index].Copy();
|
Item item = AllItems[index].Copy();
|
||||||
double price = Random.Shared.NextDouble() * 10000 * (int)item.QualityType * 20;
|
double price = Random.Shared.NextDouble() * 10000 * (int)item.QualityType * Random.Shared.Next(5,20);
|
||||||
item.Price = price;
|
item.Price = Calculation.Round2Digits(price);
|
||||||
daily.AddItem(item, Random.Shared.Next(3));
|
daily.AddItem(item, Random.Shared.Next(1, 3));
|
||||||
}
|
}
|
||||||
store.Add("daily", daily);
|
store.Add("daily", daily);
|
||||||
return store.ToString() + "\r\n温馨提示:使用【商店查看+序号】查看物品详细信息,使用【商店购买+序号】购买物品!每天 4:00 刷新每日商店。";
|
return daily.ToString() + "\r\n温馨提示:使用【商店查看+序号】查看物品详细信息,使用【商店购买+序号】购买物品!每天 4:00 刷新每日商店。";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (store.Count > 0)
|
if (store.Count > 0 && store.Where(kv => kv.Key == "daily").Select(kv => kv.Value).FirstOrDefault() is Store daily)
|
||||||
{
|
{
|
||||||
return store.ToString() + "\r\n温馨提示:使用【商店查看+序号】查看物品详细信息,使用【商店购买+序号】购买物品!每天 4:00 刷新每日商店。";
|
return daily.ToString() + "\r\n温馨提示:使用【商店查看+序号】查看物品详细信息,使用【商店购买+序号】购买物品!每天 4:00 刷新每日商店。";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4595,8 +4595,6 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
|||||||
|
|
||||||
EntityModuleConfig<Store> store = new("stores", userid.ToString());
|
EntityModuleConfig<Store> store = new("stores", userid.ToString());
|
||||||
store.LoadConfig();
|
store.LoadConfig();
|
||||||
FunGameService.CheckDailyStore(store);
|
|
||||||
store.SaveConfig();
|
|
||||||
|
|
||||||
string msg = "";
|
string msg = "";
|
||||||
Store? daily = store.Get("daily");
|
Store? daily = store.Get("daily");
|
||||||
@ -4663,7 +4661,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return NetworkUtility.JsonSerialize($"商品列表不存在,请刷新!");
|
return NetworkUtility.JsonSerialize($"商品列表为空,请使用【每日商店】指令来获取商品列表!");
|
||||||
}
|
}
|
||||||
|
|
||||||
store.Add("daily", daily);
|
store.Add("daily", daily);
|
||||||
@ -4694,8 +4692,6 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
|||||||
|
|
||||||
EntityModuleConfig<Store> store = new("stores", userid.ToString());
|
EntityModuleConfig<Store> store = new("stores", userid.ToString());
|
||||||
store.LoadConfig();
|
store.LoadConfig();
|
||||||
FunGameService.CheckDailyStore(store);
|
|
||||||
store.SaveConfig();
|
|
||||||
|
|
||||||
string msg = "";
|
string msg = "";
|
||||||
Store? daily = store.Get("daily");
|
Store? daily = store.Get("daily");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user