Unlock all items by default

This commit is contained in:
xeon 2024-02-22 22:32:57 +03:00
parent 6fc374af32
commit aa2bab9645
12 changed files with 23095 additions and 157 deletions

View file

@ -5,5 +5,6 @@ public enum ConfigType
Weapon,
BaseProperty,
LevelEntity,
Blueprint
Blueprint,
ItemInfo
}

View file

@ -0,0 +1,38 @@
using Core.Config.Attributes;
namespace Core.Config;
[ConfigCollection("item/iteminfo.json")]
public class ItemInfoConfig : IConfig
{
public ConfigType Type => ConfigType.ItemInfo;
public int Identifier => Id;
public int Id { get; set; }
public int ItemType { get; set; }
public string Name { get; set; } = string.Empty;
public List<int> ShowTypes { get; set; } = [];
public string AttributesDescription { get; set; } = string.Empty;
public string BgDescription { get; set; } = string.Empty;
public string Mesh { get; set; } = string.Empty;
public int QualityId { get; set; }
public int MainTypeId { get; set; }
public int RedDotDisableRule { get; set; }
public int UseCountLimit { get; set; }
public int SortIndex { get; set; }
public int MaxCapcity { get; set; }
public int MaxStackableNum { get; set; }
public int UseLevel { get; set; }
public int BeginTimeStamp { get; set; }
public int DurationStamp { get; set; }
public bool ShowUseButton { get; set; }
public int ObtainedShow { get; set; }
public string ObtainedShowDescription { get; set; } = string.Empty;
public int EntityConfig { get; set; }
public int NumLimit { get; set; }
public bool ShowInBag { get; set; }
public bool Destructible { get; set; }
public int ItemBuffType { get; set; }
public bool SpecialItem { get; set; }
public bool UiPlayItem { get; set; }
}

View file

@ -14,6 +14,7 @@
<ItemGroup>
<None Remove="data\config\blueprint\blueprintconfig.json" />
<None Remove="data\config\item\iteminfo.json" />
<None Remove="data\config\property\baseproperty.json" />
<None Remove="data\config\weapon\weaponconf.json" />
</ItemGroup>

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,10 @@ internal class InventoryController : Controller
}
[NetEvent(MessageId.NormalItemRequest)]
public RpcResult OnNormalItemRequest() => Response(MessageId.NormalItemResponse, new NormalItemResponse());
public RpcResult OnNormalItemRequest(ModelManager modelManager) => Response(MessageId.NormalItemResponse, new NormalItemResponse
{
NormalItemList = { modelManager.Inventory.ItemList }
});
[NetEvent(MessageId.WeaponItemRequest)]
public RpcResult OnWeaponItemRequest(ModelManager modelManager) => Response(MessageId.WeaponItemResponse, new WeaponItemResponse
@ -125,12 +128,17 @@ internal class InventoryController : Controller
});
}
[GameEvent(GameEventType.DebugUnlockAllWeapons)]
[GameEvent(GameEventType.DebugUnlockAllItems)]
public void DebugUnlockAllWeapons(ConfigManager configManager, ModelManager modelManager)
{
foreach (WeaponConfig weaponConf in configManager.Enumerate<WeaponConfig>())
{
modelManager.Inventory.AddNewWeapon(weaponConf.ItemId);
}
foreach (ItemInfoConfig itemInfo in configManager.Enumerate<ItemInfoConfig>())
{
modelManager.Inventory.AddItem(itemInfo.Id, itemInfo.MaxStackableNum);
}
}
}

View file

@ -18,7 +18,7 @@ internal class LoginController : Controller
// Debug
await eventSystem.Emit(GameEventType.DebugUnlockAllRoles);
await eventSystem.Emit(GameEventType.DebugUnlockAllWeapons);
await eventSystem.Emit(GameEventType.DebugUnlockAllItems);
return Response(MessageId.LoginResponse, new LoginResponse
{

View file

@ -1,21 +1,42 @@
using Core.Config;
using Protocol;
using Protocol;
namespace GameServer.Models;
internal class InventoryModel
{
private int _itemIncrId;
public List<NormalItem> ItemList { get; } = [];
public List<WeaponItem> WeaponList { get; } = [];
public WeaponItem? GetEquippedWeapon(int roleId)
public WeaponItem? GetEquippedWeapon(int roleId) => WeaponList.SingleOrDefault(weapon => weapon.RoleId == roleId);
public WeaponItem? GetWeaponById(int incrId) => WeaponList.SingleOrDefault(weapon => weapon.IncrId == incrId);
public int GetItemCount(int itemId) => ItemList.SingleOrDefault(item => item.Id == itemId)?.Count ?? 0;
public bool TryUseItem(int itemId, int amount)
{
return WeaponList.SingleOrDefault(weapon => weapon.RoleId == roleId);
int currentAmount = GetItemCount(itemId);
if (amount > currentAmount) return false;
AddItem(itemId, -amount);
return true;
}
public WeaponItem? GetWeaponById(int incrId)
public void AddItem(int itemId, int amount)
{
return WeaponList.SingleOrDefault(weapon => weapon.IncrId == incrId);
NormalItem? item = ItemList.SingleOrDefault(item => item.Id == itemId);
if (item != null)
{
item.Count += amount;
return;
}
ItemList.Add(new NormalItem
{
Id = itemId,
Count = amount
});
}
public WeaponItem AddNewWeapon(int weaponId)

View file

@ -4,8 +4,11 @@ using GameServer.Settings;
namespace GameServer.Models;
internal class PlayerModel
{
private const int MaxPlayerLevel = 80;
public int Id { get; private set; }
public string Name { get; private set; }
public string Name { get; set; }
public int Level { get; private set; }
public int[] Characters { get; private set; }
public Vector Position { get; private set; }
@ -16,12 +19,19 @@ internal class PlayerModel
Position = new Vector();
}
public void LevelUp()
{
if (Level == MaxPlayerLevel) return;
Level++;
}
public static PlayerModel CreateDefaultPlayer(PlayerStartingValues startingValues)
{
return new PlayerModel
{
Id = 1337,
Name = startingValues.Name,
Level = startingValues.PlayerLevel,
Characters = startingValues.Characters,
Position = startingValues.Position.Clone()
};

View file

@ -22,149 +22,4 @@ internal class RoleModel
{
return Roles.SingleOrDefault(role => role.RoleId == roleId);
}
private static List<ArrayIntInt> CreateBasePropList(BasePropertyConfig? config)
{
List<ArrayIntInt> baseProp = [];
if (config == null) return baseProp;
baseProp.Add(new() { Key = (int)EAttributeType.Lv, Value = config.Lv });
baseProp.Add(new() { Key = (int)EAttributeType.LifeMax, Value = config.LifeMax });
baseProp.Add(new() { Key = (int)EAttributeType.Life, Value = config.Life });
baseProp.Add(new() { Key = (int)EAttributeType.Sheild, Value = config.Sheild });
baseProp.Add(new() { Key = (int)EAttributeType.SheildDamageChange, Value = config.SheildDamageChange });
baseProp.Add(new() { Key = (int)EAttributeType.SheildDamageReduce, Value = config.SheildDamageReduce });
baseProp.Add(new() { Key = (int)EAttributeType.Atk, Value = config.Atk });
baseProp.Add(new() { Key = (int)EAttributeType.Crit, Value = config.Crit });
baseProp.Add(new() { Key = (int)EAttributeType.CritDamage, Value = config.CritDamage });
baseProp.Add(new() { Key = (int)EAttributeType.Def, Value = config.Def });
baseProp.Add(new() { Key = (int)EAttributeType.EnergyEfficiency, Value = config.EnergyEfficiency });
baseProp.Add(new() { Key = (int)EAttributeType.CdReduse, Value = config.CdReduse });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionEfficiency, Value = config.ReactionEfficiency });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeNormalSkill, Value = config.DamageChangeNormalSkill });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChange, Value = config.DamageChange });
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduce, Value = config.DamageReduce });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeAuto, Value = config.DamageChangeAuto });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeCast, Value = config.DamageChangeCast });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeUltra, Value = config.DamageChangeUltra });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeQte, Value = config.DamageChangeQte });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangePhys, Value = config.DamageChangePhys });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement1, Value = config.DamageChangeElement1 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement2, Value = config.DamageChangeElement2 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement3, Value = config.DamageChangeElement3 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement4, Value = config.DamageChangeElement4 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement5, Value = config.DamageChangeElement5 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement6, Value = config.DamageChangeElement6 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistancePhys, Value = config.DamageResistancePhys });
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement1, Value = config.DamageResistanceElement1 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement2, Value = config.DamageResistanceElement2 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement3, Value = config.DamageResistanceElement3 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement4, Value = config.DamageResistanceElement4 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement5, Value = config.DamageResistanceElement5 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement6, Value = config.DamageResistanceElement6 });
baseProp.Add(new() { Key = (int)EAttributeType.HealChange, Value = config.HealChange });
baseProp.Add(new() { Key = (int)EAttributeType.HealedChange, Value = config.HealedChange });
baseProp.Add(new() { Key = (int)EAttributeType.DamageReducePhys, Value = config.DamageReducePhys });
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement1, Value = config.DamageReduceElement1 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement2, Value = config.DamageReduceElement2 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement3, Value = config.DamageReduceElement3 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement4, Value = config.DamageReduceElement4 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement5, Value = config.DamageReduceElement5 });
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement6, Value = config.DamageReduceElement6 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange1, Value = config.ReactionChange1 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange2, Value = config.ReactionChange2 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange3, Value = config.ReactionChange3 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange4, Value = config.ReactionChange4 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange5, Value = config.ReactionChange5 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange6, Value = config.ReactionChange6 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange7, Value = config.ReactionChange7 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange8, Value = config.ReactionChange8 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange9, Value = config.ReactionChange9 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange10, Value = config.ReactionChange10 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange11, Value = config.ReactionChange11 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange12, Value = config.ReactionChange12 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange13, Value = config.ReactionChange13 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange14, Value = config.ReactionChange14 });
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange15, Value = config.ReactionChange15 });
baseProp.Add(new() { Key = (int)EAttributeType.EnergyMax, Value = config.EnergyMax });
baseProp.Add(new() { Key = (int)EAttributeType.Energy, Value = config.Energy });
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy1Max, Value = config.SpecialEnergy1Max });
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy1, Value = config.SpecialEnergy1 });
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy2Max, Value = config.SpecialEnergy2Max });
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy2, Value = config.SpecialEnergy2 });
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy3Max, Value = config.SpecialEnergy3Max });
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy3, Value = config.SpecialEnergy3 });
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy4Max, Value = config.SpecialEnergy4Max });
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy4, Value = config.SpecialEnergy4 });
baseProp.Add(new() { Key = (int)EAttributeType.StrengthMax, Value = config.StrengthMax });
baseProp.Add(new() { Key = (int)EAttributeType.Strength, Value = config.Strength });
baseProp.Add(new() { Key = (int)EAttributeType.StrengthRecover, Value = config.StrengthRecover });
baseProp.Add(new() { Key = (int)EAttributeType.StrengthPunishTime, Value = config.StrengthPunishTime });
baseProp.Add(new() { Key = (int)EAttributeType.StrengthRun, Value = config.StrengthRun });
baseProp.Add(new() { Key = (int)EAttributeType.StrengthSwim, Value = config.StrengthSwim });
baseProp.Add(new() { Key = (int)EAttributeType.StrengthFastSwim, Value = config.StrengthFastSwim });
baseProp.Add(new() { Key = (int)EAttributeType.StrengthClimb, Value = config.StrengthClimb });
baseProp.Add(new() { Key = (int)EAttributeType.StrengthFastClimb, Value = config.StrengthFastClimb });
baseProp.Add(new() { Key = (int)EAttributeType.HardnessMax, Value = config.HardnessMax });
baseProp.Add(new() { Key = (int)EAttributeType.Hardness, Value = config.Hardness });
baseProp.Add(new() { Key = (int)EAttributeType.HardnessRecover, Value = config.HardnessRecover });
baseProp.Add(new() { Key = (int)EAttributeType.HardnessPunishTime, Value = config.HardnessPunishTime });
baseProp.Add(new() { Key = (int)EAttributeType.HardnessChange, Value = config.HardnessChange });
baseProp.Add(new() { Key = (int)EAttributeType.HardnessReduce, Value = config.HardnessReduce });
baseProp.Add(new() { Key = (int)EAttributeType.RageMax, Value = config.RageMax });
baseProp.Add(new() { Key = (int)EAttributeType.Rage, Value = config.Rage });
baseProp.Add(new() { Key = (int)EAttributeType.RageRecover, Value = config.RageRecover });
baseProp.Add(new() { Key = (int)EAttributeType.RagePunishTime, Value = config.RagePunishTime });
baseProp.Add(new() { Key = (int)EAttributeType.RageChange, Value = config.RageChange });
baseProp.Add(new() { Key = (int)EAttributeType.RageReduce, Value = config.RageReduce });
baseProp.Add(new() { Key = (int)EAttributeType.ToughMax, Value = config.ToughMax });
baseProp.Add(new() { Key = (int)EAttributeType.Tough, Value = config.Tough });
baseProp.Add(new() { Key = (int)EAttributeType.ToughRecover, Value = config.ToughRecover });
baseProp.Add(new() { Key = (int)EAttributeType.ToughChange, Value = config.ToughChange });
baseProp.Add(new() { Key = (int)EAttributeType.ToughReduce, Value = config.ToughReduce });
baseProp.Add(new() { Key = (int)EAttributeType.ToughRecoverDelayTime, Value = config.ToughRecoverDelayTime });
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower1, Value = config.ElementPower1 });
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower2, Value = config.ElementPower2 });
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower3, Value = config.ElementPower3 });
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower4, Value = config.ElementPower4 });
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower5, Value = config.ElementPower5 });
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower6, Value = config.ElementPower6 });
baseProp.Add(new() { Key = (int)EAttributeType.SpecialDamageChange, Value = config.SpecialDamageChange });
baseProp.Add(new() { Key = (int)EAttributeType.StrengthFastClimbCost, Value = config.StrengthFastClimbCost });
baseProp.Add(new() { Key = (int)EAttributeType.ElementPropertyType, Value = config.ElementPropertyType });
baseProp.Add(new() { Key = (int)EAttributeType.WeakTime, Value = config.WeakTime });
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDefRate, Value = config.IgnoreDefRate });
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistancePhys, Value = config.IgnoreDamageResistancePhys });
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement1, Value = config.IgnoreDamageResistanceElement1 });
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement2, Value = config.IgnoreDamageResistanceElement2 });
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement3, Value = config.IgnoreDamageResistanceElement3 });
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement4, Value = config.IgnoreDamageResistanceElement4 });
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement5, Value = config.IgnoreDamageResistanceElement5 });
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement6, Value = config.IgnoreDamageResistanceElement6 });
baseProp.Add(new() { Key = (int)EAttributeType.SkillToughRatio, Value = config.SkillToughRatio });
baseProp.Add(new() { Key = (int)EAttributeType.StrengthClimbJump, Value = config.StrengthClimbJump });
baseProp.Add(new() { Key = (int)EAttributeType.StrengthGliding, Value = config.StrengthGliding });
baseProp.Add(new() { Key = (int)EAttributeType.Mass, Value = config.Mass });
baseProp.Add(new() { Key = (int)EAttributeType.BrakingFrictionFactor, Value = config.BrakingFrictionFactor });
baseProp.Add(new() { Key = (int)EAttributeType.GravityScale, Value = config.GravityScale });
baseProp.Add(new() { Key = (int)EAttributeType.SpeedRatio, Value = config.SpeedRatio });
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangePhantom, Value = config.DamageChangePhantom });
baseProp.Add(new() { Key = (int)EAttributeType.AutoAttackSpeed, Value = config.AutoAttackSpeed });
baseProp.Add(new() { Key = (int)EAttributeType.CastAttackSpeed, Value = config.CastAttackSpeed });
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp1Max, Value = config.StatusBuildUp1Max });
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp1, Value = config.StatusBuildUp1 });
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp2Max, Value = config.StatusBuildUp2Max });
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp2, Value = config.StatusBuildUp2 });
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp3Max, Value = config.StatusBuildUp3Max });
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp3, Value = config.StatusBuildUp3 });
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp4Max, Value = config.StatusBuildUp4Max });
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp4, Value = config.StatusBuildUp4 });
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp5Max, Value = config.StatusBuildUp5Max });
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp5, Value = config.StatusBuildUp5 });
baseProp.Add(new() { Key = (int)EAttributeType.ParalysisTimeMax, Value = config.ParalysisTimeMax });
baseProp.Add(new() { Key = (int)EAttributeType.ParalysisTime, Value = config.ParalysisTime });
baseProp.Add(new() { Key = (int)EAttributeType.ParalysisTimeRecover, Value = config.ParalysisTimeRecover });
return baseProp;
}
}

View file

@ -4,6 +4,7 @@ namespace GameServer.Settings;
internal class PlayerStartingValues
{
public required string Name { get; set; }
public required int PlayerLevel { get; set; }
public required int[] Characters { get; set; }
public required Vector Position { get; set; }
}

View file

@ -11,5 +11,5 @@ internal enum GameEventType
// Debug
DebugUnlockAllRoles,
DebugUnlockAllWeapons
DebugUnlockAllItems
}

View file

@ -1,6 +1,7 @@
{
"StartingValues": {
"Name": "ReversedRooms",
"Level": 8,
"Characters": [ 1402, 1302, 1203 ],
"Position": {
"X": -35823,