mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-12 17:34:33 +01:00
Affixes and Equipment (#2)
* Update Equipment.cs Added LVL and EXP params while adding some equipment * Update Equipment.cs changed params to the appropriate type and removed casting * Update Equipment.cs Removed unnecessary changes. * Update RefineStigmataRuneReqHandler.cs Simplified rolling * Update GiveCommand.cs Changed Default behavior of Equipment commands to grant only the max star level versions. Default's to max level as well. * Update GiveCommand.cs Added more command aliases, > valks, valkyries, weap, wep, > weapons-all, weap-all, wep-all, stigmata-all, stigs-all added Avatar ID `316` to the blocked IDs list to prevent buggy behavior. (might add `avatars-all` to get them back) give weap/stigs 0 grants max level items without the `-all` equipment only gives the highest rarity of each weapon. * Update RefineStigmataRuneReqHandler.cs Affixes are now 90% functional * Update SelectNewStigmataRuneReqHandler.cs Should work for any further affix handling changes without needing modifications (might break on 10x but shouldn't) * Update AvatarCommand.cs Blocked Sus-Nya * Update AvatarCommand.cs bitwise -> logical OR * Update GiveCommand.cs bitwise -> logical OR * Update RefineStigmataRuneReqHandler.cs bitwise -> logical AND * Created Personal Abyss Command * Created abyss command * Update User.cs Stores personal Abyss Temperature * Update UltraEndlessGetMainDataReqHandler.cs Uses personal Abyss Temp
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Common.Resources.Proto;
|
||||
using Common.Resources.Proto;
|
||||
using Common.Utils.ExcelReader;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
@@ -111,7 +111,7 @@ namespace Common.Database
|
||||
|
||||
PlayerLevelData.LevelData levelData = EquipmentLevelData.GetInstance().CalculateLevel((int)WeaponList[weaponIndex].Level, (int)WeaponList[weaponIndex].Exp + exp, weaponData.ExpType);
|
||||
|
||||
if(levelData.Level > weaponData.MaxLv)
|
||||
if (levelData.Level > weaponData.MaxLv)
|
||||
{
|
||||
levelData.Level = weaponData.MaxLv;
|
||||
EquipmentLevelDataExcel? LevelData = EquipmentLevelData.GetInstance().FromLevel(levelData.Level);
|
||||
@@ -168,7 +168,7 @@ namespace Common.Database
|
||||
{
|
||||
int MaterialIndex = Array.FindIndex(MaterialList, material => material.Id == materialId);
|
||||
|
||||
if(MaterialIndex == -1)
|
||||
if (MaterialIndex == -1)
|
||||
{
|
||||
MaterialList = MaterialList.Append(new() { Id = (uint)materialId, Num = num < 0 ? 0 : (uint)num }).ToArray();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson;
|
||||
using Common.Resources.Proto;
|
||||
using MongoDB.Driver;
|
||||
using Common.Utils.ExcelReader;
|
||||
@@ -33,6 +33,7 @@ namespace Common.Database
|
||||
},
|
||||
AssistantAvatarId = 101,
|
||||
BirthDate = 0,
|
||||
AbyssDynamicHard = 100,
|
||||
AvatarTeamList = new List<AvatarTeam> { new AvatarTeam { AvatarIdLists = new uint[] { 101 }, StageType = ((uint)StageType.StageStory) } },
|
||||
CustomAvatarTeamList = new List<CustomAvatarTeam> { }
|
||||
};
|
||||
@@ -73,6 +74,7 @@ namespace Common.Database
|
||||
public WarshipAvatarData WarshipAvatar { get; set; }
|
||||
public int AssistantAvatarId { get; set; }
|
||||
public int BirthDate { get; set; }
|
||||
public uint AbyssDynamicHard { get; set; }
|
||||
public List<AvatarTeam> AvatarTeamList { get; set; }
|
||||
public List<CustomAvatarTeam> CustomAvatarTeamList { get; set; }
|
||||
|
||||
|
||||
34
GameServer/Commands/AbyssCommand.cs
Normal file
34
GameServer/Commands/AbyssCommand.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Common.Database;
|
||||
using Common.Resources.Proto;
|
||||
using Common.Utils.ExcelReader;
|
||||
using PemukulPaku.GameServer.Game;
|
||||
|
||||
namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
[CommandHandler("abyss", "", CommandType.Player)]
|
||||
internal class AbyssCommand : Command
|
||||
{
|
||||
public override void Run(Session session, string[] args)
|
||||
{
|
||||
Run(session.Player, args);
|
||||
|
||||
//session.ProcessPacket(Packet.FromProto(new UltraEndlessGetMainDataReq() { }, CmdId.UltraEndlessGetMainDataReq));
|
||||
}
|
||||
public override void Run(Player player, string[] args)
|
||||
{
|
||||
string action = args[0];
|
||||
uint value = args[1] is not null ? uint.Parse(args[1]) : 0;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case "temp":
|
||||
player.User.AbyssDynamicHard = value;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Unrecognized action");
|
||||
}
|
||||
|
||||
player.User.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
foreach (AvatarDataExcel avatarData in AvatarData.GetInstance().All)
|
||||
{
|
||||
if (avatarData.AvatarId >= 9000) continue; // Avoid APHO avatars
|
||||
if (avatarData.AvatarId >= 9000 || avatarData.AvatarId == 316 ) continue; // Avoid APHO avatars
|
||||
|
||||
avatar = Common.Database.Avatar.Create(avatarData.AvatarId, player.User.Uid, player.Equipment);
|
||||
player.AvatarList = player.AvatarList.Append(avatar).ToArray();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Common.Database;
|
||||
using Common.Database;
|
||||
using Common.Resources.Proto;
|
||||
using Common.Utils.ExcelReader;
|
||||
using PemukulPaku.GameServer.Game;
|
||||
@@ -19,37 +19,61 @@ namespace PemukulPaku.GameServer.Commands
|
||||
public override void Run(Player player, string[] args)
|
||||
{
|
||||
string action = args[0];
|
||||
uint value = uint.Parse(args[1]);
|
||||
|
||||
if (value == 0)
|
||||
value = 1;
|
||||
uint value = args[1] is not null ? uint.Parse(args[1]):0;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case "avatars":
|
||||
case "characters":
|
||||
case "chars":
|
||||
case "valks":
|
||||
case "valkyries":
|
||||
foreach (AvatarDataExcel avatarData in AvatarData.GetInstance().All)
|
||||
{
|
||||
if (avatarData.AvatarId >= 9000) continue; // Avoid APHO avatars
|
||||
if (avatarData.AvatarId >= 9000 || avatarData.AvatarId == 316) continue; // Avoid APHO avatars
|
||||
|
||||
AvatarScheme avatar = Common.Database.Avatar.Create(avatarData.AvatarId, player.User.Uid, player.Equipment);
|
||||
player.AvatarList = player.AvatarList.Append(avatar).ToArray();
|
||||
}
|
||||
break;
|
||||
case "weapons":
|
||||
case "weap":
|
||||
case "wep":
|
||||
foreach (WeaponDataExcel weaponData in WeaponData.GetInstance().All)
|
||||
{
|
||||
if (weaponData.EvoId == 0)
|
||||
{
|
||||
Weapon weapon = player.Equipment.AddWeapon(weaponData.Id);
|
||||
weapon.Level = value == 0 ? (uint)weaponData.MaxLv : value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "weapons-all":
|
||||
case "weap-all":
|
||||
case "wep-all":
|
||||
foreach (WeaponDataExcel weaponData in WeaponData.GetInstance().All)
|
||||
{
|
||||
Weapon weapon = player.Equipment.AddWeapon(weaponData.Id);
|
||||
weapon.Level = value;
|
||||
weapon.Level = value == 0 ? (uint)weaponData.MaxLv : value;
|
||||
}
|
||||
break;
|
||||
case "stigmata":
|
||||
case "stigs":
|
||||
foreach (StigmataDataExcel stigmataData in StigmataData.GetInstance().All)
|
||||
{
|
||||
if (stigmataData.EvoId == 0)
|
||||
{
|
||||
Stigmata stigmata = player.Equipment.AddStigmata(stigmataData.Id);
|
||||
stigmata.Level = value == 0 ? (uint)stigmataData.MaxLv : value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "stigmata-all":
|
||||
case "stigs-all":
|
||||
foreach (StigmataDataExcel stigmataData in StigmataData.GetInstance().All)
|
||||
{
|
||||
Stigmata stigmata = player.Equipment.AddStigmata(stigmataData.Id);
|
||||
stigmata.Level = value;
|
||||
stigmata.Level = value == 0 ? (uint)stigmataData.MaxLv : value;
|
||||
}
|
||||
break;
|
||||
case "materials":
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
using Common.Resources.Proto;
|
||||
using Common.Resources.Proto;
|
||||
using MongoDB.Bson;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
[PacketCmdId(CmdId.RefineStigmataRuneReq)]
|
||||
internal class RefineStigmataRuneReqHandler : IPacketHandler
|
||||
{
|
||||
static readonly uint[] AffixIds = { 30011, 30012, 30013, 30021, 30022, 30023, 30031, 30032, 30033, 30041, 30042, 30043, 30051, 30052, 30053, 30061, 30062, 30063, 30071, 30072, 30073, 30081, 30082, 30083, 30091, 30092, 30093, 30101, 30102, 30103, 30111, 30112, 30113, 30121, 30122, 30123, 30131, 30132, 30133, 30141, 30142, 30143, 30151, 30152, 30153, 30161, 30162, 30163, 30171, 30172, 30173, 30181, 30182, 30183, 30191, 30192, 30193, 30201, 30202, 30203, 30211, 30212, 30213, 40011, 40012, 40013, 40021, 40022, 40023, 40031, 40032, 40033, 40041, 40042, 40043, 50011, 50012, 50013, 50021, 50022, 50023, 50031, 50032, 50033, 50041, 50042, 50043 };
|
||||
|
||||
static readonly uint[] AffixIds = { 30010, 30020, 30030, 30040, 30050, 30060, 30070, 30080, 30090, 30100, 30110, 30120, 30130, 30140, 30150, 30160, 30170, 30180, 30190, 30200, 30210, 30220, 40010, 40020, 40030, 40040, 50010, 50020, 50030, 50040 };
|
||||
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
RefineStigmataRuneReq Data = packet.GetDecodedBody<RefineStigmataRuneReq>();
|
||||
RefineStigmataRuneRsp Rsp = new() { retcode = RefineStigmataRuneRsp.Retcode.Succ, TimesType = Data.TimesType };
|
||||
uint uid = Data.UniqueId;
|
||||
Stigmata? stigmata = session.Player.Equipment.StigmataList.FirstOrDefault(stig => stig.UniqueId == uid);
|
||||
|
||||
RefineStigmataRuneReq Data = packet.GetDecodedBody<RefineStigmataRuneReq>();
|
||||
RefineStigmataRuneRsp Rsp = new() { retcode = RefineStigmataRuneRsp.Retcode.Succ, TimesType = StigmataRefineTimesType.StigmataRefineTimesOne };
|
||||
uint uid = Data.UniqueId;
|
||||
//Packet.c.Log($"RefineStigmataRuneReqHandler: {Data.UniqueId} {Data.Type} {Data.SpecialId}");
|
||||
Stigmata? stigmata = session.Player.Equipment.StigmataList.FirstOrDefault(stig => stig.UniqueId == uid);
|
||||
/*
|
||||
foreach (EquipmentItem? consumeItem in Data.ConsumeItemList.ItemLists)
|
||||
{
|
||||
@@ -32,47 +35,123 @@ namespace PemukulPaku.GameServer.Handlers
|
||||
StigmataRune rune2 = GenerateRune();
|
||||
StigmataRuneGroup group = new() { UniqueId = uid };
|
||||
|
||||
Packet.c.Log(message: $"{rune.ToJson()}{rune2.ToJson()}");
|
||||
|
||||
switch (Data.Type)
|
||||
{
|
||||
case StigmataRefineType.StigmataRefineNormal:
|
||||
stigmata.RuneLists.Add(rune);
|
||||
stigmata.RuneLists.Add(rune2);
|
||||
if (Data.IsRetry) stigmata.WaitSelectRuneGroupLists.Clear();
|
||||
if (stigmata.SlotNum < 2 && new Random().Next(0, 10) == 9) stigmata.SlotNum++;
|
||||
group.RuneLists.Add(rune);
|
||||
group.RuneLists.Add(rune2);
|
||||
if (stigmata.SlotNum == 2) group.RuneLists.Add(rune2);
|
||||
stigmata.WaitSelectRuneGroupLists.Add(group);
|
||||
Rsp.RuneGroupLists.Add(group);
|
||||
break;
|
||||
case StigmataRefineType.StigmataRefineAddSlot:
|
||||
stigmata.RuneLists.Clear();
|
||||
stigmata.RuneLists.Add(rune);
|
||||
stigmata.RuneLists.Add(rune2);
|
||||
case StigmataRefineType.StigmataRefineAddSlot: //broken when doing the 2nd slot for some reason
|
||||
//stigmata.RuneLists.Add(rune);
|
||||
stigmata.SlotNum++;
|
||||
group.RuneLists.Add(rune);
|
||||
group.RuneLists.Add(rune2);
|
||||
stigmata.WaitSelectRuneGroupLists.Add(group);
|
||||
Rsp.RuneGroupLists.Add(group);
|
||||
break;
|
||||
case StigmataRefineType.StigmataRefineSpecial:
|
||||
throw new NotImplementedException("RefineStigmataRuneReqHandler StigmataRefineType.StigmataRefineSpecial");
|
||||
rune = GenerateRuneSpecial(1,Data.SpecialId);
|
||||
rune2 = GenerateRuneSpecial(2,Data.SpecialId);
|
||||
group.RuneLists.Add(rune);
|
||||
group.RuneLists.Add(rune2);
|
||||
stigmata.WaitSelectRuneGroupLists.Add(group);
|
||||
Rsp.RuneGroupLists.Add(group);
|
||||
break;
|
||||
case StigmataRefineType.StigmataRefineLock:
|
||||
if (Data.IsRetry)
|
||||
{
|
||||
//need to add retry logic
|
||||
}
|
||||
//break;
|
||||
throw new NotImplementedException("RefineStigmataRuneReqHandler StigmataRefineType.StigmataRefineLock");
|
||||
}
|
||||
|
||||
session.Player.Equipment.Save();
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.RefineStigmataRuneRsp));
|
||||
|
||||
session.ProcessPacket(Packet.FromProto(new GetEquipmentDataReq(), CmdId.GetEquipmentDataReq));
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.RefineStigmataRuneRsp));
|
||||
}
|
||||
}
|
||||
|
||||
StigmataRune GenerateRune()
|
||||
private StigmataRune GenerateRune()
|
||||
=> new()
|
||||
{
|
||||
RuneId = GenerateAffixType(),
|
||||
StrengthPercent = CalculateAffixStrength()
|
||||
RuneId = GenerateAffixId(),
|
||||
StrengthPercent = GenerateAffixStrength()
|
||||
};
|
||||
private StigmataRune GenerateRuneSpecial(uint slot, uint id = 1) => new()
|
||||
{
|
||||
RuneId = GenerateAffixIdSpecial(id, slot),
|
||||
StrengthPercent = GenerateAffixStrengthSpecial(id, slot)
|
||||
};
|
||||
|
||||
uint GenerateAffixType()
|
||||
=> AffixIds[new Random().Next(0, AffixIds.Length - 1)];
|
||||
private uint GenerateAffixId(int min = 1, int max = 4)
|
||||
=> ((uint)AffixIds[new Random().Next(0, AffixIds.Length - 1)] + (uint)new Random().Next(
|
||||
min < max && min > 0 ? min : 1, max > min && max < 5 ? max : 4
|
||||
));
|
||||
//currently ignores Stigmata Rarity
|
||||
|
||||
uint CalculateAffixStrength(float min = 37.5f, float step = 0.625f)
|
||||
=> (uint)(min + ((float)new Random().NextDouble() * step * 100f));
|
||||
private uint GenerateAffixStrength(int min=1, int max = 101)
|
||||
=> (uint)(new Random().Next(
|
||||
min > 0 && min < max ? min : 1, max > min && max < 102 ? max : 101
|
||||
));
|
||||
private uint GenerateAffixIdSpecial(uint id, uint slot)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
//case 3:
|
||||
//case 14:
|
||||
case 14:
|
||||
return 30013; //Max HP for now. :P
|
||||
//Attribute ATK
|
||||
case 4: case 8:
|
||||
return 30063;
|
||||
case 5: case 9:
|
||||
return 30073;
|
||||
case 6: case 10:
|
||||
return 30083;
|
||||
case 7: case 11:
|
||||
return 30193;
|
||||
case 12: case 13:
|
||||
return 30213;
|
||||
//SP
|
||||
case 15:
|
||||
return (uint)(slot == 2 ? 50043 : 50033);
|
||||
default:
|
||||
return 50043; // -SP%
|
||||
}
|
||||
|
||||
}
|
||||
private uint GenerateAffixStrengthSpecial(uint id, uint slot)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 3: case 14:
|
||||
return GenerateAffixStrength();
|
||||
case 8: case 9: case 10: case 11: case 13:
|
||||
return GenerateAffixStrength(7, 66);
|
||||
case 15:
|
||||
return (uint)(slot == 2 ? 59 : 45);//want to double check these with live version
|
||||
default:
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
//Specials (ID, Type, Roll) | (Affix ID, Strength)
|
||||
//3 Offensive Random |
|
||||
//14 Support Random |
|
||||
//15 SP -2.7% .4/sp | (50043, 59) (50033, 45)
|
||||
//4 BIO 23 | 30063, 100
|
||||
//5 MECH 23 | 30073, 100
|
||||
//6 PSY 23 | 30083, 100
|
||||
//7 QUA 23 | 30193, 100
|
||||
//8 BIO 15-20 | 30063, 7,66
|
||||
//9 MECH 15-20 | 30073, 7,66
|
||||
//10 PSY 15-20 | 30083, 7,66
|
||||
//11 QUA 15-20 | 30193, 7,66
|
||||
//12 IMG 23 | 30213, 100
|
||||
//13 IMG 15-20 | 30213, 7,66
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Common.Resources.Proto;
|
||||
using Common.Resources.Proto;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
@@ -8,14 +8,35 @@ namespace PemukulPaku.GameServer.Handlers
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
SelectNewStigmataRuneReq Data = packet.GetDecodedBody<SelectNewStigmataRuneReq>();
|
||||
SelectNewStigmataRuneRsp Rsp = new() { retcode = SelectNewStigmataRuneRsp.Retcode.Succ };
|
||||
SelectNewStigmataRuneRsp Rsp = new() { retcode = SelectNewStigmataRuneRsp.Retcode.Succ, SelectUniqueId = Data.SelectUniqueId, IsSelect = Data.IsSelect };
|
||||
uint uid = Data.UniqueId;
|
||||
Stigmata? stigmata = session.Player.Equipment.StigmataList.FirstOrDefault(stig => stig.UniqueId == uid);
|
||||
//Packet.c.Log($"SelectNewStigmataRuneReqHandler: {Data.UniqueId} {Data.SelectUniqueId} {Data.IsSelect}");
|
||||
|
||||
Packet.c.Log($"SelectNewStigmataRuneReqHandler: {Data.UniqueId} {Data.SelectUniqueId} {Data.IsSelect}");
|
||||
|
||||
if (Data.IsSelect)
|
||||
if (stigmata is not null)
|
||||
{
|
||||
if(Data.IsSelect)
|
||||
{
|
||||
if(stigmata.WaitSelectRuneGroupLists is not null)
|
||||
{
|
||||
stigmata.RuneLists.Clear();
|
||||
foreach(var groups in stigmata.WaitSelectRuneGroupLists)
|
||||
{
|
||||
if(groups.UniqueId == Data.SelectUniqueId)
|
||||
{
|
||||
for (var i = 0; i < groups.RuneLists.Count; i++)
|
||||
{
|
||||
var group = groups.RuneLists[i];
|
||||
if(group is null) continue;
|
||||
stigmata.RuneLists.Add(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stigmata.WaitSelectRuneGroupLists.Clear();
|
||||
}
|
||||
|
||||
session.Player.Equipment.Save();
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.SelectNewStigmataRuneRsp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
using Common;
|
||||
using Common;
|
||||
using Common.Resources.Proto;
|
||||
using Common.Utils.ExcelReader;
|
||||
using Common.Database;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
[PacketCmdId(CmdId.UltraEndlessGetMainDataReq)]
|
||||
internal class UltraEndlessGetMainDataReqHandler : IPacketHandler
|
||||
{
|
||||
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
UltraEndlessGetMainDataRsp Rsp = new()
|
||||
@@ -25,7 +27,7 @@ namespace PemukulPaku.GameServer.Handlers
|
||||
CloseTime = (uint)Global.GetUnixInSeconds() + 3600 * 24 * 7 + 1200,
|
||||
CurSeasonId = 1
|
||||
},
|
||||
DynamicHardLevel = 430,
|
||||
DynamicHardLevel = session.Player.User.AbyssDynamicHard,
|
||||
LastSettleInfo = new() { }
|
||||
};
|
||||
Rsp.MainData.SiteLists.AddRange(Common.Utils.ExcelReader.UltraEndlessSite.GetInstance().All.Where(x => x.SiteId > 1019).Select(siteData =>
|
||||
|
||||
Reference in New Issue
Block a user