CsSceneRest

This commit is contained in:
AlessandroCH
2025-08-08 19:06:50 +02:00
parent 4abb9d0bb5
commit 388a71df7f
4 changed files with 50 additions and 16 deletions

View File

@@ -10,21 +10,8 @@ namespace Campofinale.Commands.Handlers
[Server.Command("heal", "Revives/Heals your team characters", true)]
public static void Handle(Player sender, string cmd, string[] args, Player target)
{
target.GetCurTeam().ForEach(chara =>
{
chara.curHp = chara.CalcAttributes()[AttributeType.MaxHp].val;
ScCharSyncStatus state = new ScCharSyncStatus()
{
Objid=chara.guid,
IsDead=chara.curHp < 1,
BattleInfo = new()
{
Hp=chara.curHp,
Ultimatesp=chara.ultimateSp
}
};
target.Send(ScMsgId.ScCharSyncStatus, state);
});
target.RestTeam();
target.Send(ScMsgId.ScSceneRevival, new ScSceneRevival()
{

View File

@@ -80,7 +80,7 @@ namespace Campofinale.Game.Factory.BuildingsBehaviour
producer.lastFormulaId = recipe;
producer.progress += craftingRecipe.totalProgress/craftingRecipe.progressRound;
currentProgress++;
currentProgress++;
if (currentProgress >= craftingRecipe.progressRound)
{
currentProgress = 0;

View File

@@ -0,0 +1,28 @@
using Campofinale.Network;
using Campofinale.Packets.Sc;
using Campofinale.Protocol;
using Campofinale.Resource;
namespace Campofinale.Packets.Cs
{
public class HandleCsSceneRest
{
[Server.Handler(CsMsgId.CsSceneRest)]
public static void Handle(Player session, CsMsgId cmdId, Packet packet)
{
CsSceneRest req = packet.DecodeBody<CsSceneRest>();
ScSceneRevival revival = new()
{
};
session.RestTeam();
session.sceneManager.LoadCurrentTeamEntities();
session.Send(ScMsgId.ScSceneRevival, revival, packet.csHead.UpSeqid);
session.Send(new PacketScSelfSceneInfo(session, SelfInfoReasonType.SlrReviveRest));
}
}
}

View File

@@ -759,5 +759,24 @@ namespace Campofinale
}
}
public void RestTeam()
{
GetCurTeam().ForEach(chara =>
{
chara.curHp = chara.CalcAttributes()[AttributeType.MaxHp].val;
ScCharSyncStatus state = new ScCharSyncStatus()
{
Objid = chara.guid,
IsDead = chara.curHp < 1,
BattleInfo = new()
{
Hp = chara.curHp,
Ultimatesp = chara.ultimateSp
}
};
Send(ScMsgId.ScCharSyncStatus, state);
});
}
}
}