mirror of
https://github.com/milimoe/FunGame-Testing.git
synced 2025-12-05 00:06:05 +00:00
添加商店测试
This commit is contained in:
parent
884fc63ad6
commit
ae170b3339
@ -28,6 +28,8 @@ FunGameService.InitFunGame();
|
|||||||
FunGameSimulation.InitFunGameSimulation();
|
FunGameSimulation.InitFunGameSimulation();
|
||||||
FunGameController controller = new(new Logger<FunGameController>(new LoggerFactory()));
|
FunGameController controller = new(new Logger<FunGameController>(new LoggerFactory()));
|
||||||
|
|
||||||
|
StoreTest.StoreTest1();
|
||||||
|
|
||||||
await CharacterTest.CharacterTest2();
|
await CharacterTest.CharacterTest2();
|
||||||
|
|
||||||
//ActivityTest.Test2();
|
//ActivityTest.Test2();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
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.Interface.Entity;
|
||||||
using Milimoe.FunGame.Core.Library.Constant;
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using Milimoe.FunGame.Core.Model;
|
using Milimoe.FunGame.Core.Model;
|
||||||
using Oshima.Core.Constant;
|
using Oshima.Core.Constant;
|
||||||
@ -77,21 +78,21 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
Character character1 = new CustomCharacter(1, "测试1-Carry", primaryAttribute: PrimaryAttribute.AGI)
|
Character character1 = new CustomCharacter(1, "测试1-Carry", primaryAttribute: PrimaryAttribute.AGI)
|
||||||
{
|
{
|
||||||
Id = 2,
|
Id = 2,
|
||||||
Level = 60,
|
Level = 50,
|
||||||
FirstRoleType = RoleType.Core,
|
FirstRoleType = RoleType.Core,
|
||||||
InitialHP = 65,
|
InitialHP = 65,
|
||||||
};
|
};
|
||||||
Character character2 = new CustomCharacter(1, "测试A-Tank", primaryAttribute: PrimaryAttribute.STR)
|
Character character2 = new CustomCharacter(1, "测试A-Tank", primaryAttribute: PrimaryAttribute.STR)
|
||||||
{
|
{
|
||||||
Id = 3,
|
Id = 3,
|
||||||
Level = 60,
|
Level = 50,
|
||||||
FirstRoleType = RoleType.Guardian,
|
FirstRoleType = RoleType.Guardian,
|
||||||
InitialHP = 85,
|
InitialHP = 85,
|
||||||
};
|
};
|
||||||
Character character3 = new CustomCharacter(1, "测试α-Support", primaryAttribute: PrimaryAttribute.INT)
|
Character character3 = new CustomCharacter(1, "测试α-Support", primaryAttribute: PrimaryAttribute.INT)
|
||||||
{
|
{
|
||||||
Id = 10,
|
Id = 10,
|
||||||
Level = 60,
|
Level = 50,
|
||||||
FirstRoleType = RoleType.Support,
|
FirstRoleType = RoleType.Support,
|
||||||
SecondRoleType = RoleType.Vanguard,
|
SecondRoleType = RoleType.Vanguard,
|
||||||
InitialHP = 65,
|
InitialHP = 65,
|
||||||
@ -99,7 +100,7 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
Character character4 = new CustomCharacter(1, "测试Ⅰ-Medic", primaryAttribute: PrimaryAttribute.INT)
|
Character character4 = new CustomCharacter(1, "测试Ⅰ-Medic", primaryAttribute: PrimaryAttribute.INT)
|
||||||
{
|
{
|
||||||
Id = 4,
|
Id = 4,
|
||||||
Level = 60,
|
Level = 50,
|
||||||
FirstRoleType = RoleType.Medic,
|
FirstRoleType = RoleType.Medic,
|
||||||
InitialHP = 65,
|
InitialHP = 65,
|
||||||
};
|
};
|
||||||
@ -164,10 +165,10 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
character2.Recovery();
|
character2.Recovery();
|
||||||
character3.Recovery();
|
character3.Recovery();
|
||||||
character4.Recovery();
|
character4.Recovery();
|
||||||
character1.Effects.Clear();
|
RemoveEffect(character1);
|
||||||
character2.Effects.Clear();
|
RemoveEffect(character2);
|
||||||
character3.Effects.Clear();
|
RemoveEffect(character3);
|
||||||
character4.Effects.Clear();
|
RemoveEffect(character4);
|
||||||
times++;
|
times++;
|
||||||
Console.WriteLine($"账户金币:{user.Inventory.Credits},材料:{user.Inventory.Materials}.");
|
Console.WriteLine($"账户金币:{user.Inventory.Credits},材料:{user.Inventory.Materials}.");
|
||||||
if (instanceType == InstanceType.Explore)
|
if (instanceType == InstanceType.Explore)
|
||||||
@ -318,6 +319,19 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RemoveEffect(Character character)
|
||||||
|
{
|
||||||
|
Effect[] effects = [.. character.Effects];
|
||||||
|
foreach (Effect effect in effects)
|
||||||
|
{
|
||||||
|
if (effect.IsInEffect && effect.DurativeWithoutDuration || (effect.Durative && effect.Duration > 0) || effect.DurationTurn > 0)
|
||||||
|
{
|
||||||
|
character.Effects.Remove(effect);
|
||||||
|
effect.OnEffectLost(character);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void DropItemByCharacterRoleType(Character character)
|
public static void DropItemByCharacterRoleType(Character character)
|
||||||
{
|
{
|
||||||
long[] magicIds;
|
long[] magicIds;
|
||||||
|
|||||||
120
Library/Tests/StoreTest.cs
Normal file
120
Library/Tests/StoreTest.cs
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
using Milimoe.FunGame.Core.Api.Utility;
|
||||||
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
using Oshima.FunGame.OshimaModules.Items;
|
||||||
|
using Oshima.FunGame.OshimaServers.Service;
|
||||||
|
|
||||||
|
namespace Milimoe.FunGame.Testing.Tests
|
||||||
|
{
|
||||||
|
public class StoreTest
|
||||||
|
{
|
||||||
|
public static void StoreTest1()
|
||||||
|
{
|
||||||
|
Store store1 = new("探索者协会后勤部")
|
||||||
|
{
|
||||||
|
AutoRefresh = true,
|
||||||
|
RefreshInterval = 1,
|
||||||
|
NextRefreshDate = DateTime.Today.AddHours(4),
|
||||||
|
};
|
||||||
|
Item item = new 探索许可();
|
||||||
|
store1.AddItem(item, 420);
|
||||||
|
store1.SetPrice(1, General.GameplayEquilibriumConstant.InGameMaterial, 10);
|
||||||
|
item = new 魔法卡礼包(QualityType.White, 4)
|
||||||
|
{
|
||||||
|
Price = 1200
|
||||||
|
};
|
||||||
|
store1.AddItem(item, -1, ItemSet.GetQualityTypeName(item.QualityType) + item.Name);
|
||||||
|
item = new 魔法卡礼包(QualityType.Green, 4)
|
||||||
|
{
|
||||||
|
Price = 8000
|
||||||
|
};
|
||||||
|
store1.AddItem(item, -1, ItemSet.GetQualityTypeName(item.QualityType) + item.Name);
|
||||||
|
item = new 魔法卡礼包(QualityType.Blue, 4)
|
||||||
|
{
|
||||||
|
Price = 20000
|
||||||
|
};
|
||||||
|
store1.AddItem(item, -1, ItemSet.GetQualityTypeName(item.QualityType) + item.Name);
|
||||||
|
item = new 魔法卡礼包(QualityType.Purple, 4)
|
||||||
|
{
|
||||||
|
Price = 70000
|
||||||
|
};
|
||||||
|
store1.AddItem(item, -1, ItemSet.GetQualityTypeName(item.QualityType) + item.Name);
|
||||||
|
item = new 魔法卡礼包(QualityType.Orange, 4)
|
||||||
|
{
|
||||||
|
Price = 160000
|
||||||
|
};
|
||||||
|
store1.AddItem(item, -1, ItemSet.GetQualityTypeName(item.QualityType) + item.Name);
|
||||||
|
item = new 魔法卡礼包(QualityType.Red, 4)
|
||||||
|
{
|
||||||
|
Price = 310000
|
||||||
|
};
|
||||||
|
store1.AddItem(item, -1, ItemSet.GetQualityTypeName(item.QualityType) + item.Name);
|
||||||
|
item = new 魔法卡礼包(QualityType.Gold, 4)
|
||||||
|
{
|
||||||
|
Price = 600000
|
||||||
|
};
|
||||||
|
store1.AddItem(item, -1, ItemSet.GetQualityTypeName(item.QualityType) + item.Name);
|
||||||
|
Store store2 = new("铎京武器商会")
|
||||||
|
{
|
||||||
|
AutoRefresh = true,
|
||||||
|
RefreshInterval = 3,
|
||||||
|
NextRefreshDate = DateTime.Today.AddHours(4),
|
||||||
|
};
|
||||||
|
item = FunGameConstant.Equipment.First(i => i.Id == 11574).Copy();
|
||||||
|
item.Price = 120000;
|
||||||
|
store2.AddItem(item, 4);
|
||||||
|
item = FunGameConstant.Equipment.First(i => i.Id == 11572).Copy();
|
||||||
|
item.Price = 60000;
|
||||||
|
store2.AddItem(item, 4);
|
||||||
|
item = new 攻击之爪85()
|
||||||
|
{
|
||||||
|
Price = 100000
|
||||||
|
};
|
||||||
|
store2.AddItem(item, 4);
|
||||||
|
item = new 攻击之爪70()
|
||||||
|
{
|
||||||
|
Price = 55000
|
||||||
|
};
|
||||||
|
store2.AddItem(item, 4);
|
||||||
|
Store store3 = new("小雪杂货铺")
|
||||||
|
{
|
||||||
|
AutoRefresh = true,
|
||||||
|
RefreshInterval = 3,
|
||||||
|
StartTime = new DateTime(2025, 7, 21, 8, 0, 0),
|
||||||
|
EndTime = new DateTime(2025, 7, 28, 03, 59, 59),
|
||||||
|
NextRefreshDate = DateTime.Today.AddHours(4),
|
||||||
|
};
|
||||||
|
item = FunGameConstant.Equipment.First(i => i.Id == 14510).Copy();
|
||||||
|
item.Price = 28000;
|
||||||
|
store3.AddItem(item, 20);
|
||||||
|
item = FunGameConstant.Equipment.First(i => i.Id == 14511).Copy();
|
||||||
|
item.Price = 28000;
|
||||||
|
store3.AddItem(item, 20);
|
||||||
|
item = FunGameConstant.Equipment.First(i => i.Id == 14512).Copy();
|
||||||
|
item.Price = 28000;
|
||||||
|
store3.AddItem(item, 20);
|
||||||
|
item = FunGameConstant.Equipment.First(i => i.Id == 14513).Copy();
|
||||||
|
item.Price = 28000;
|
||||||
|
store3.AddItem(item, 20);
|
||||||
|
item = FunGameConstant.Equipment.First(i => i.Id == 14514).Copy();
|
||||||
|
item.Price = 28000;
|
||||||
|
store3.AddItem(item, 20);
|
||||||
|
EntityModuleConfig<Store> dokyoStores = new("stores", "dokyo")
|
||||||
|
{
|
||||||
|
{ "dokyo_logistics", store1 },
|
||||||
|
{ "dokyo_weapons", store2 },
|
||||||
|
{ "dokyo_yuki", store3 },
|
||||||
|
};
|
||||||
|
dokyoStores.SaveConfig();
|
||||||
|
Console.WriteLine("读取中……");
|
||||||
|
dokyoStores.LoadConfig();
|
||||||
|
Store? test1 = dokyoStores.Get("dokyo_logistics");
|
||||||
|
Store? test2 = dokyoStores.Get("dokyo_weapons");
|
||||||
|
Store? test3 = dokyoStores.Get("dokyo_yuki");
|
||||||
|
Console.WriteLine(test1);
|
||||||
|
Console.WriteLine(test2);
|
||||||
|
Console.WriteLine(test3);
|
||||||
|
Console.ReadKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user