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:
TerminalAide0017
2023-06-06 16:47:08 -07:00
committed by GitHub
parent d479abd58c
commit f95f370a48
8 changed files with 206 additions and 44 deletions

View File

@@ -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 };
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
}
}