-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #665 from starfi5h/pr-fix22010
Bugfixes (Game version 0.10.29.22010)
- Loading branch information
Showing
15 changed files
with
299 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace NebulaModel.Packets.Combat; | ||
|
||
public class CombatStatFullHpPacket | ||
{ | ||
public CombatStatFullHpPacket() { } | ||
|
||
public CombatStatFullHpPacket(int originAstroId, int objectType, int objectId) | ||
{ | ||
OriginAstroId = originAstroId; | ||
ObjectType = objectType; | ||
ObjectId = objectId; | ||
} | ||
|
||
public int OriginAstroId { get; set; } | ||
public int ObjectType { get; set; } | ||
public int ObjectId { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
NebulaModel/Packets/Combat/DFRelay/DFRelayRealizePlanetBasePacket.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using NebulaAPI.DataStructures; | ||
|
||
namespace NebulaModel.Packets.Combat.DFRelay; | ||
|
||
public class DFRelayRealizePlanetBasePacket | ||
{ | ||
public DFRelayRealizePlanetBasePacket() { } | ||
|
||
public DFRelayRealizePlanetBasePacket(in DFRelayComponent dFRelay) | ||
{ | ||
HiveAstroId = dFRelay.hiveAstroId; | ||
RelayId = dFRelay.id; | ||
RelayNeutralizedCounter = dFRelay.hive.relayNeutralizedCounter; | ||
HiveSeed = dFRelay.hive.seed; | ||
HiveRtseed = dFRelay.hive.rtseed; | ||
TargetAstroId = dFRelay.targetAstroId; | ||
TargetLPos = dFRelay.targetLPos.ToFloat3(); | ||
TargetYaw = dFRelay.targetYaw; | ||
BaseTicks = dFRelay.baseTicks; | ||
|
||
var factory = dFRelay.hive.galaxy.astrosFactory[dFRelay.targetAstroId]; | ||
if (factory != null) | ||
{ | ||
EnemyCursor = factory.enemyCursor; | ||
EnemyRecyle = new int[factory.enemyRecycleCursor]; | ||
Array.Copy(factory.enemyRecycle, EnemyRecyle, EnemyRecyle.Length); | ||
} | ||
else | ||
{ | ||
EnemyCursor = -1; | ||
EnemyRecyle = []; | ||
} | ||
} | ||
|
||
public int HiveAstroId { get; set; } | ||
public int RelayId { get; set; } | ||
public int RelayNeutralizedCounter { get; set; } | ||
public int HiveSeed { get; set; } | ||
public int HiveRtseed { get; set; } | ||
public int TargetAstroId { get; set; } | ||
public Float3 TargetLPos { get; set; } | ||
public float TargetYaw { get; set; } | ||
public int BaseTicks { get; set; } | ||
public int EnemyCursor { get; set; } | ||
public int[] EnemyRecyle { get; set; } | ||
} |
62 changes: 62 additions & 0 deletions
62
NebulaNetwork/PacketProcessors/Combat/CombatStatFullHpProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#region | ||
|
||
using NebulaAPI.Packets; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets; | ||
using NebulaModel.Packets.Combat; | ||
using NebulaWorld; | ||
|
||
#endregion | ||
|
||
namespace NebulaNetwork.PacketProcessors.Combat; | ||
|
||
[RegisterPacketProcessor] | ||
public class CombatStatFullHpProcessor : PacketProcessor<CombatStatFullHpPacket> | ||
{ | ||
protected override void ProcessPacket(CombatStatFullHpPacket packet, NebulaConnection conn) | ||
{ | ||
var combatStatId = 0; | ||
var starId = 0; | ||
if (packet.OriginAstroId > 100 && packet.OriginAstroId <= 204899 && packet.OriginAstroId % 100 > 0) | ||
{ | ||
var planetFactory = GameMain.spaceSector.skillSystem.astroFactories[packet.OriginAstroId]; | ||
if (planetFactory != null) | ||
{ | ||
starId = packet.OriginAstroId / 100; | ||
|
||
if (packet.ObjectType == 0 && packet.ObjectId < planetFactory.entityPool.Length) | ||
{ | ||
combatStatId = planetFactory.entityPool[packet.ObjectId].combatStatId; | ||
planetFactory.entityPool[packet.ObjectId].combatStatId = 0; | ||
} | ||
} | ||
} | ||
|
||
var skillSystem = GameMain.spaceSector.skillSystem; | ||
if (combatStatId > 0 && combatStatId < skillSystem.combatStats.cursor) | ||
{ | ||
ref var combatStatRef = ref skillSystem.combatStats.buffer[combatStatId]; | ||
if (combatStatRef.id == combatStatId) | ||
{ | ||
if (IsHost && combatStatRef.warningId > 0) | ||
{ | ||
GameMain.data.warningSystem.RemoveWarningData(combatStatRef.warningId); | ||
} | ||
skillSystem.OnRemovingSkillTarget(combatStatRef.id, combatStatRef.originAstroId, ETargetType.CombatStat); | ||
skillSystem.combatStats.Remove(combatStatRef.id); | ||
} | ||
} | ||
|
||
if (IsHost) | ||
{ | ||
if (starId > 0) | ||
{ | ||
Multiplayer.Session.Server.SendPacketToStarExclude(packet, starId, conn); | ||
} | ||
else | ||
{ | ||
Multiplayer.Session.Server.SendPacketExclude(packet, conn); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
NebulaNetwork/PacketProcessors/Combat/DFRelay/DFRelayRealizePlanetBaseProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#region | ||
|
||
using NebulaAPI.DataStructures; | ||
using NebulaAPI.Packets; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets; | ||
using NebulaModel.Packets.Combat.DFRelay; | ||
using NebulaWorld; | ||
using NebulaWorld.Combat; | ||
|
||
#endregion | ||
|
||
namespace NebulaNetwork.PacketProcessors.Combat.DFRelay; | ||
|
||
[RegisterPacketProcessor] | ||
public class DFRelayRealizePlanetBaseProcessor : PacketProcessor<DFRelayRealizePlanetBasePacket> | ||
{ | ||
protected override void ProcessPacket(DFRelayRealizePlanetBasePacket packet, NebulaConnection conn) | ||
{ | ||
var hiveSystem = GameMain.spaceSector.GetHiveByAstroId(packet.HiveAstroId); | ||
if (hiveSystem == null) return; | ||
|
||
var dfrelayComponent = hiveSystem.relays.buffer[packet.RelayId]; | ||
if (dfrelayComponent?.id != packet.RelayId) return; | ||
|
||
dfrelayComponent.hive.relayNeutralizedCounter = packet.RelayNeutralizedCounter; | ||
dfrelayComponent.hive.seed = packet.HiveSeed; | ||
dfrelayComponent.hive.rtseed = packet.HiveRtseed; | ||
dfrelayComponent.targetAstroId = packet.TargetAstroId; | ||
dfrelayComponent.targetLPos = packet.TargetLPos.ToVector3(); | ||
dfrelayComponent.targetYaw = packet.TargetYaw; | ||
dfrelayComponent.baseTicks = packet.BaseTicks; | ||
|
||
using (Multiplayer.Session.Enemies.IsIncomingRelayRequest.On()) | ||
{ | ||
using (Multiplayer.Session.Combat.IsIncomingRequest.On()) | ||
{ | ||
var factory = dfrelayComponent.hive.galaxy.astrosFactory[dfrelayComponent.targetAstroId]; | ||
if (factory != null && packet.EnemyCursor != -1) | ||
{ | ||
// Prepare enemyIds in CreateEnemyPlanetBase | ||
EnemyManager.SetPlanetFactoryRecycle(factory, packet.EnemyCursor, packet.EnemyRecyle); | ||
} | ||
dfrelayComponent.RealizePlanetBase(GameMain.spaceSector); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.