-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
85 additions
and
0 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.Factory; | ||
|
||
public class ExtraInfoUpdatePacket | ||
{ | ||
public ExtraInfoUpdatePacket() { } | ||
|
||
public ExtraInfoUpdatePacket(int planetId, int objId, string info) | ||
{ | ||
PlanetId = planetId; | ||
ObjId = objId; | ||
Info = info; | ||
} | ||
|
||
public int PlanetId { get; set; } | ||
public int ObjId { get; set; } | ||
public string Info { get; set; } | ||
} |
44 changes: 44 additions & 0 deletions
44
NebulaNetwork/PacketProcessors/Factory/Entity/ExtraInfoUpdateProcessor.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,44 @@ | ||
#region | ||
|
||
using NebulaAPI.Packets; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets; | ||
using NebulaModel.Packets.Factory; | ||
using NebulaWorld; | ||
|
||
#endregion | ||
|
||
namespace NebulaNetwork.PacketProcessors.Factory.Entity; | ||
|
||
[RegisterPacketProcessor] | ||
internal class ExtraInfoUpdateProcessor : PacketProcessor<ExtraInfoUpdatePacket> | ||
{ | ||
protected override void ProcessPacket(ExtraInfoUpdatePacket packet, NebulaConnection conn) | ||
{ | ||
var factory = GameMain.galaxy.PlanetById(packet.PlanetId)?.factory; | ||
if (factory == null) | ||
{ | ||
return; | ||
} | ||
|
||
using (Multiplayer.Session.Factories.IsIncomingRequest.On()) | ||
{ | ||
if (packet.ObjId < 0) | ||
{ | ||
var prebuildId = -packet.ObjId; | ||
if (prebuildId > 0 && prebuildId < factory.prebuildCursor) | ||
{ | ||
factory.WriteExtraInfoOnPrebuild(prebuildId, packet.Info); | ||
} | ||
} | ||
else | ||
{ | ||
var entityId = packet.ObjId; | ||
if (entityId > 0 && entityId < factory.entityCursor) | ||
{ | ||
factory.WriteExtraInfoOnEntity(entityId, packet.Info); | ||
} | ||
} | ||
} | ||
} | ||
} |
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