mirror of
https://github.com/Campofinale/CampofinaleBackup.git
synced 2025-12-15 23:24:37 +00:00
Compare commits
2 Commits
96048df57c
...
460bfe527c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
460bfe527c | ||
|
|
f210746859 |
@ -21,15 +21,11 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CsvHelper" Version="33.0.1" />
|
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.27.2" />
|
<PackageReference Include="Google.Protobuf" Version="3.27.2" />
|
||||||
<PackageReference Include="HttpServerLite" Version="2.1.5" />
|
<PackageReference Include="HttpServerLite" Version="2.1.5" />
|
||||||
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
|
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="NLua" Version="1.7.3" />
|
|
||||||
<PackageReference Include="Pastel" Version="5.1.0" />
|
<PackageReference Include="Pastel" Version="5.1.0" />
|
||||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
|
||||||
<PackageReference Include="SQLiteNetExtensions" Version="2.1.0" />
|
|
||||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="9.0.3" />
|
<PackageReference Include="System.ServiceProcess.ServiceController" Version="9.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ namespace Campofinale.Game.Factory
|
|||||||
{
|
{
|
||||||
public class BlockCalculator
|
public class BlockCalculator
|
||||||
{
|
{
|
||||||
public static float CalculateTotalBlocks(List<Vector3f> points)
|
public static int CalculateTotalBlocks(List<Vector3f> points)
|
||||||
{
|
{
|
||||||
if (points == null || points.Count < 2)
|
if (points == null || points.Count < 2)
|
||||||
return 0;
|
return 0;
|
||||||
@ -36,7 +36,6 @@ namespace Campofinale.Game.Factory
|
|||||||
int y1 = (int)Math.Floor(p2.y);
|
int y1 = (int)Math.Floor(p2.y);
|
||||||
int z1 = (int)Math.Floor(p2.z);
|
int z1 = (int)Math.Floor(p2.z);
|
||||||
|
|
||||||
// Algoritmo di Bresenham 3D
|
|
||||||
int dx = Math.Abs(x1 - x0);
|
int dx = Math.Abs(x1 - x0);
|
||||||
int dy = Math.Abs(y1 - y0);
|
int dy = Math.Abs(y1 - y0);
|
||||||
int dz = Math.Abs(z1 - z0);
|
int dz = Math.Abs(z1 - z0);
|
||||||
@ -44,7 +43,6 @@ namespace Campofinale.Game.Factory
|
|||||||
int sy = y0 < y1 ? 1 : -1;
|
int sy = y0 < y1 ? 1 : -1;
|
||||||
int sz = z0 < z1 ? 1 : -1;
|
int sz = z0 < z1 ? 1 : -1;
|
||||||
|
|
||||||
// Decision variables
|
|
||||||
if (dx >= dy && dx >= dz)
|
if (dx >= dy && dx >= dz)
|
||||||
{
|
{
|
||||||
int err1 = 2 * dy - dx;
|
int err1 = 2 * dy - dx;
|
||||||
@ -89,7 +87,7 @@ namespace Campofinale.Game.Factory
|
|||||||
y0 += sy;
|
y0 += sy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // dz è la dimensione dominante
|
else
|
||||||
{
|
{
|
||||||
int err1 = 2 * dy - dz;
|
int err1 = 2 * dy - dz;
|
||||||
int err2 = 2 * dx - dz;
|
int err2 = 2 * dx - dz;
|
||||||
@ -112,7 +110,6 @@ namespace Campofinale.Game.Factory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aggiungi l'ultimo punto
|
|
||||||
blocks.Add(Tuple.Create(x1, y1, z1));
|
blocks.Add(Tuple.Create(x1, y1, z1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ namespace Campofinale.Game.Factory.BuildingsBehaviour
|
|||||||
public uint inputCacheId = 0;
|
public uint inputCacheId = 0;
|
||||||
public uint outputCacheId = 0;
|
public uint outputCacheId = 0;
|
||||||
public uint producerId = 0;
|
public uint producerId = 0;
|
||||||
public int currentProgress = 0;
|
public long timestampFinish = 0;
|
||||||
public override void Init(FactoryChapter chapter, FactoryNode node)
|
public override void Init(FactoryChapter chapter, FactoryNode node)
|
||||||
{
|
{
|
||||||
FComponentCache cache1 = (FComponentCache)new FComponentCache(chapter.nextCompV(), FCComponentPos.CacheIn1).Init();
|
FComponentCache cache1 = (FComponentCache)new FComponentCache(chapter.nextCompV(), FCComponentPos.CacheIn1).Init();
|
||||||
@ -71,11 +71,14 @@ namespace Campofinale.Game.Factory.BuildingsBehaviour
|
|||||||
producer.inProduce = true;
|
producer.inProduce = true;
|
||||||
|
|
||||||
producer.lastFormulaId = recipe;
|
producer.lastFormulaId = recipe;
|
||||||
producer.progress += craftingRecipe.totalProgress/craftingRecipe.progressRound;
|
if (timestampFinish == 0)
|
||||||
currentProgress++;
|
|
||||||
if (currentProgress >= craftingRecipe.progressRound)
|
|
||||||
{
|
{
|
||||||
currentProgress = 0;
|
timestampFinish = DateTime.UtcNow.ToUnixTimestampMilliseconds() + 1000 * craftingRecipe.progressRound;
|
||||||
|
}
|
||||||
|
producer.progress = (DateTime.UtcNow.ToUnixTimestampMilliseconds()/timestampFinish)* craftingRecipe.totalProgress;
|
||||||
|
if (DateTime.UtcNow.ToUnixTimestampMilliseconds() >= timestampFinish)
|
||||||
|
{
|
||||||
|
timestampFinish= DateTime.UtcNow.ToUnixTimestampMilliseconds()+1000* craftingRecipe.progressRound;
|
||||||
List<ItemCount> toConsume = craftingRecipe.GetIngredients();
|
List<ItemCount> toConsume = craftingRecipe.GetIngredients();
|
||||||
inCache.ConsumeItems(toConsume);
|
inCache.ConsumeItems(toConsume);
|
||||||
craftingRecipe.outcomes.ForEach(e =>
|
craftingRecipe.outcomes.ForEach(e =>
|
||||||
@ -92,6 +95,7 @@ namespace Campofinale.Game.Factory.BuildingsBehaviour
|
|||||||
{
|
{
|
||||||
producer.inProduce = false;
|
producer.inProduce = false;
|
||||||
producer.progress = 0;
|
producer.progress = 0;
|
||||||
|
timestampFinish = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -99,6 +103,7 @@ namespace Campofinale.Game.Factory.BuildingsBehaviour
|
|||||||
producer.inBlock = false;
|
producer.inBlock = false;
|
||||||
producer.inProduce = false;
|
producer.inProduce = false;
|
||||||
producer.progress = 0;
|
producer.progress = 0;
|
||||||
|
timestampFinish = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ namespace Campofinale.Game.Factory.BuildingsBehaviour
|
|||||||
public uint inputCacheIdFluid = 0;
|
public uint inputCacheIdFluid = 0;
|
||||||
public uint outputCacheIdFluid = 0;
|
public uint outputCacheIdFluid = 0;
|
||||||
public uint producerId = 0;
|
public uint producerId = 0;
|
||||||
public int currentProgress = 0;
|
public long timestampFinish = 0;
|
||||||
public override void Init(FactoryChapter chapter, FactoryNode node)
|
public override void Init(FactoryChapter chapter, FactoryNode node)
|
||||||
{
|
{
|
||||||
FComponentCache cache1 = (FComponentCache)new FComponentCache(chapter.nextCompV(), FCComponentPos.CacheIn1).Init();
|
FComponentCache cache1 = (FComponentCache)new FComponentCache(chapter.nextCompV(), FCComponentPos.CacheIn1).Init();
|
||||||
@ -79,11 +79,14 @@ namespace Campofinale.Game.Factory.BuildingsBehaviour
|
|||||||
producer.inProduce = true;
|
producer.inProduce = true;
|
||||||
|
|
||||||
producer.lastFormulaId = recipe;
|
producer.lastFormulaId = recipe;
|
||||||
producer.progress += craftingRecipe.totalProgress/craftingRecipe.progressRound;
|
if (timestampFinish == 0)
|
||||||
currentProgress++;
|
|
||||||
if (currentProgress >= craftingRecipe.progressRound)
|
|
||||||
{
|
{
|
||||||
currentProgress = 0;
|
timestampFinish = DateTime.UtcNow.ToUnixTimestampMilliseconds() + 1000 * craftingRecipe.progressRound;
|
||||||
|
}
|
||||||
|
producer.progress = (DateTime.UtcNow.ToUnixTimestampMilliseconds() / timestampFinish) * craftingRecipe.totalProgress;
|
||||||
|
if (DateTime.UtcNow.ToUnixTimestampMilliseconds() >= timestampFinish)
|
||||||
|
{
|
||||||
|
timestampFinish = DateTime.UtcNow.ToUnixTimestampMilliseconds() + 1000 * craftingRecipe.progressRound;
|
||||||
List<ItemCount> toConsume = craftingRecipe.GetIngredients();
|
List<ItemCount> toConsume = craftingRecipe.GetIngredients();
|
||||||
inCache.ConsumeItems(toConsume);
|
inCache.ConsumeItems(toConsume);
|
||||||
craftingRecipe.outcomes.ForEach(e =>
|
craftingRecipe.outcomes.ForEach(e =>
|
||||||
@ -100,6 +103,7 @@ namespace Campofinale.Game.Factory.BuildingsBehaviour
|
|||||||
{
|
{
|
||||||
producer.inProduce = false;
|
producer.inProduce = false;
|
||||||
producer.progress = 0;
|
producer.progress = 0;
|
||||||
|
timestampFinish = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -107,6 +111,7 @@ namespace Campofinale.Game.Factory.BuildingsBehaviour
|
|||||||
producer.inBlock = false;
|
producer.inBlock = false;
|
||||||
producer.inProduce = false;
|
producer.inProduce = false;
|
||||||
producer.progress = 0;
|
producer.progress = 0;
|
||||||
|
timestampFinish = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,6 @@ namespace Campofinale.Game.Factory.Components
|
|||||||
lastPopTms=DateTime.UtcNow.ToUnixTimestampMilliseconds();
|
lastPopTms=DateTime.UtcNow.ToUnixTimestampMilliseconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void SetComponentInfo(ScdFacCom proto)
|
public override void SetComponentInfo(ScdFacCom proto)
|
||||||
{
|
{
|
||||||
if (items == null)
|
if (items == null)
|
||||||
@ -26,8 +25,10 @@ namespace Campofinale.Game.Factory.Components
|
|||||||
LastPopTms = lastPopTms,
|
LastPopTms = lastPopTms,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
items.ForEach(item =>
|
items.ForEach(item =>
|
||||||
{
|
{
|
||||||
|
if(item!=null)
|
||||||
proto.BoxConveyor.Items.Add(item.ToFactoryItemProto());
|
proto.BoxConveyor.Items.Add(item.ToFactoryItemProto());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using Campofinale.Game.Factory.Components;
|
using Campofinale.Game.Factory.Components;
|
||||||
using Campofinale.Resource;
|
using Campofinale.Resource;
|
||||||
using MongoDB.Bson.Serialization.Attributes;
|
using MongoDB.Bson.Serialization.Attributes;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -104,5 +105,7 @@ namespace Campofinale.Game.Factory
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,24 +18,59 @@ namespace Campofinale.Game.Factory
|
|||||||
public uint v = 1;
|
public uint v = 1;
|
||||||
public uint compV = 0;
|
public uint compV = 0;
|
||||||
public int bandwidth = 200;
|
public int bandwidth = 200;
|
||||||
|
public FactoryBlackboard blackboard = new();
|
||||||
|
public class FactoryBlackboard
|
||||||
|
{
|
||||||
|
public uint inventoryNodeId=1;
|
||||||
|
public FacBbPower power = new();
|
||||||
|
|
||||||
|
public class FacBbPower
|
||||||
|
{
|
||||||
|
public long powerGen;
|
||||||
|
public long powerSaveMax;
|
||||||
|
public long powerSaveCurrent;
|
||||||
|
public long powerCost;
|
||||||
|
public bool isStopByPower;
|
||||||
|
}
|
||||||
|
public ScdFactorySyncBlackboard ToProto()
|
||||||
|
{
|
||||||
|
return new ScdFactorySyncBlackboard()
|
||||||
|
{
|
||||||
|
InventoryNodeId = inventoryNodeId,
|
||||||
|
Power = new()
|
||||||
|
{
|
||||||
|
IsStopByPower=power.isStopByPower,
|
||||||
|
PowerCost=power.powerCost,
|
||||||
|
PowerGen=power.powerGen,
|
||||||
|
PowerSaveCurrent=power.powerSaveCurrent,
|
||||||
|
PowerSaveMax=power.powerSaveMax,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScdFactoryHsBb ToProtoHsBb()
|
||||||
|
{
|
||||||
|
return new ScdFactoryHsBb()
|
||||||
|
{
|
||||||
|
Power = new()
|
||||||
|
{
|
||||||
|
IsStopByPower = power.isStopByPower,
|
||||||
|
PowerSaveCurrent = power.powerSaveCurrent,
|
||||||
|
PowerSaveMax = power.powerSaveMax,
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
public ScFactorySyncChapter ToProto()
|
public ScFactorySyncChapter ToProto()
|
||||||
{
|
{
|
||||||
|
blackboard = new();
|
||||||
ScFactorySyncChapter chapter = new()
|
ScFactorySyncChapter chapter = new()
|
||||||
{
|
{
|
||||||
ChapterId = chapterId,
|
ChapterId = chapterId,
|
||||||
Tms = DateTime.UtcNow.ToUnixTimestampMilliseconds(),
|
Tms = DateTime.UtcNow.ToUnixTimestampMilliseconds(),
|
||||||
Blackboard = new()
|
Blackboard = new(),
|
||||||
{
|
|
||||||
Power = new()
|
|
||||||
{
|
|
||||||
PowerGen = 0,
|
|
||||||
PowerSaveMax = 0,
|
|
||||||
PowerSaveCurrent = 0,
|
|
||||||
PowerCost = 0
|
|
||||||
},
|
|
||||||
InventoryNodeId = 1
|
|
||||||
},
|
|
||||||
Statistic = new()
|
Statistic = new()
|
||||||
{
|
{
|
||||||
LastDay = new()
|
LastDay = new()
|
||||||
@ -57,15 +92,15 @@ namespace Campofinale.Game.Factory
|
|||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
chapter.Blackboard.Power.PowerSaveCurrent = bandwidth;
|
blackboard.power.powerSaveCurrent = bandwidth;
|
||||||
domainDataTable[chapterId].levelGroup.ForEach(levelGroup =>
|
domainDataTable[chapterId].levelGroup.ForEach(levelGroup =>
|
||||||
{
|
{
|
||||||
int grade = GetOwner().sceneManager.GetScene(GetSceneNumIdFromLevelData(levelGroup)).grade;
|
int grade = GetOwner().sceneManager.GetScene(GetSceneNumIdFromLevelData(levelGroup)).grade;
|
||||||
LevelGradeInfo sceneGrade = ResourceManager.levelGradeTable[levelGroup].grades.Find(g => g.grade == grade);
|
LevelGradeInfo sceneGrade = ResourceManager.levelGradeTable[levelGroup].grades.Find(g => g.grade == grade);
|
||||||
if (sceneGrade != null)
|
if (sceneGrade != null)
|
||||||
{
|
{
|
||||||
chapter.Blackboard.Power.PowerGen += sceneGrade.bandwidth;
|
blackboard.power.powerGen += sceneGrade.bandwidth;
|
||||||
chapter.Blackboard.Power.PowerSaveMax += sceneGrade.bandwidth;
|
blackboard.power.powerSaveMax += sceneGrade.bandwidth;
|
||||||
|
|
||||||
var scene = new ScdFactorySyncScene()
|
var scene = new ScdFactorySyncScene()
|
||||||
{
|
{
|
||||||
@ -141,7 +176,7 @@ namespace Campofinale.Game.Factory
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
chapter.Blackboard = blackboard.ToProto();
|
||||||
chapter.Maps.AddRange(GetMaps());
|
chapter.Maps.AddRange(GetMaps());
|
||||||
return chapter;
|
return chapter;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,33 +73,18 @@ namespace Campofinale.Game.Factory
|
|||||||
{
|
{
|
||||||
if (!player.Initialized) return;
|
if (!player.Initialized) return;
|
||||||
if (player.GetCurrentChapter() == "") return;
|
if (player.GetCurrentChapter() == "") return;
|
||||||
long curtimestamp = DateTime.UtcNow.ToUnixTimestampMilliseconds();
|
List<FactoryNode> nodeUpdateList = new();
|
||||||
|
|
||||||
ScFactoryHsSync hs = new()
|
|
||||||
{
|
|
||||||
Tms = curtimestamp,
|
|
||||||
CcList =
|
|
||||||
{
|
|
||||||
},
|
|
||||||
Blackboard = GetChapter(player.GetCurrentChapter()).ToProto().Blackboard,
|
|
||||||
ChapterId = player.GetCurrentChapter(),
|
|
||||||
};
|
|
||||||
foreach (var node in GetChapter(player.GetCurrentChapter()).nodes)
|
foreach (var node in GetChapter(player.GetCurrentChapter()).nodes)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (node != null)
|
if (node != null)
|
||||||
{
|
{
|
||||||
if (node.position.DistanceXZ(player.position) < 150)
|
if (node.position.DistanceXZ(player.position) < 150 && node.nodeBehaviour!=null)
|
||||||
{
|
{
|
||||||
node.components.ForEach(c =>
|
nodeUpdateList.Add(node);
|
||||||
{
|
|
||||||
hs.CcList.Add(c.ToProto());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.Send(ScMsgId.ScFactoryHsSync, hs);
|
player.Send(new PacketScFactoryHsSync(player,GetChapter(player.GetCurrentChapter()), nodeUpdateList));
|
||||||
}
|
}
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,6 +11,7 @@ using static Campofinale.Resource.ResourceManager.FactoryBuildingTable;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using Campofinale.Game.Inventory;
|
using Campofinale.Game.Inventory;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
namespace Campofinale.Game.Factory
|
namespace Campofinale.Game.Factory
|
||||||
{
|
{
|
||||||
@ -135,7 +136,7 @@ namespace Campofinale.Game.Factory
|
|||||||
count = 1
|
count = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
if (conveyorNode.AddConveyorItem(add))
|
if (conveyorNode.AddConveyorItem(chapter,add))
|
||||||
{
|
{
|
||||||
did = true;
|
did = true;
|
||||||
outputCache.ConsumeItems(new List<ItemCount>() { add });
|
outputCache.ConsumeItems(new List<ItemCount>() { add });
|
||||||
@ -199,7 +200,7 @@ namespace Campofinale.Game.Factory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(toRemove!=null)
|
if(toRemove!=null)
|
||||||
input.items.Remove(toRemove);
|
conveyorNode.RemoveConveyorItem(chapter,toRemove);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,7 +209,14 @@ namespace Campofinale.Game.Factory
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool AddConveyorItem(ItemCount i)
|
private void RemoveConveyorItem(FactoryChapter chapter,ItemCount toRemove)
|
||||||
|
{
|
||||||
|
FComponentBoxConveyor conveyorComp = GetComponent<FComponentBoxConveyor>();
|
||||||
|
conveyorComp.items.Remove(toRemove);
|
||||||
|
chapter.GetOwner().Send(new PacketScFactoryHsSync(chapter.GetOwner(), chapter, new List<FactoryNode>() { this}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool AddConveyorItem(FactoryChapter chapter,ItemCount i)
|
||||||
{
|
{
|
||||||
float length=BlockCalculator.CalculateTotalBlocks(points);
|
float length=BlockCalculator.CalculateTotalBlocks(points);
|
||||||
FComponentBoxConveyor conveyorComp = GetComponent<FComponentBoxConveyor>();
|
FComponentBoxConveyor conveyorComp = GetComponent<FComponentBoxConveyor>();
|
||||||
@ -222,6 +230,7 @@ namespace Campofinale.Game.Factory
|
|||||||
conveyorComp.items.Add(i);
|
conveyorComp.items.Add(i);
|
||||||
i.tms = DateTime.UtcNow.ToUnixTimestampMilliseconds();
|
i.tms = DateTime.UtcNow.ToUnixTimestampMilliseconds();
|
||||||
conveyorComp.lastPopTms = i.tms;
|
conveyorComp.lastPopTms = i.tms;
|
||||||
|
chapter.GetOwner().Send(new PacketScFactoryHsSync(chapter.GetOwner(), chapter, new List<FactoryNode>() { this }));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -11,7 +11,6 @@ using static Campofinale.Resource.ResourceManager;
|
|||||||
using Google.Protobuf.Collections;
|
using Google.Protobuf.Collections;
|
||||||
using Campofinale.Packets.Sc;
|
using Campofinale.Packets.Sc;
|
||||||
using Campofinale.Protocol;
|
using Campofinale.Protocol;
|
||||||
using CsvHelper.Configuration.Attributes;
|
|
||||||
|
|
||||||
namespace Campofinale.Game.Inventory
|
namespace Campofinale.Game.Inventory
|
||||||
{
|
{
|
||||||
@ -141,14 +140,15 @@ namespace Campofinale.Game.Inventory
|
|||||||
Inst = new()
|
Inst = new()
|
||||||
{
|
{
|
||||||
InstId = guid,
|
InstId = guid,
|
||||||
|
|
||||||
Equip = new()
|
Equip = new()
|
||||||
{
|
{
|
||||||
|
|
||||||
EquipCharId = GetOwner().chars.Find(c => c.IsEquipped(guid)) != null ? GetOwner().chars.Find(c => c.IsEquipped(guid)).guid : 0,
|
EquipCharId = GetOwner().chars.Find(c => c.IsEquipped(guid)) != null ? GetOwner().chars.Find(c => c.IsEquipped(guid)).guid : 0,
|
||||||
Equipid = guid,
|
Equipid = guid,
|
||||||
Templateid = ResourceManager.GetItemTemplateId(id),
|
Templateid = ResourceManager.GetItemTemplateId(id),
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
IsLock = locked
|
IsLock = locked
|
||||||
}
|
}
|
||||||
@ -241,6 +241,7 @@ namespace Campofinale.Game.Inventory
|
|||||||
|
|
||||||
};
|
};
|
||||||
GetOwner().Send(ScMsgId.ScWeaponAddExp, levelUp);
|
GetOwner().Send(ScMsgId.ScWeaponAddExp, levelUp);
|
||||||
|
|
||||||
GetOwner().Send(new PacketScSyncWallet(GetOwner()));
|
GetOwner().Send(new PacketScSyncWallet(GetOwner()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,6 +259,10 @@ namespace Campofinale.Game.Inventory
|
|||||||
return false;
|
return false;
|
||||||
case ItemValuableDepotType.MissionItem:
|
case ItemValuableDepotType.MissionItem:
|
||||||
return true;
|
return true;
|
||||||
|
case ItemValuableDepotType.Factory:
|
||||||
|
return false;
|
||||||
|
case ItemValuableDepotType.CommercialItem:
|
||||||
|
return false;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
31
Campofinale/Packets/Sc/PacketScFactoryHsSync.cs
Normal file
31
Campofinale/Packets/Sc/PacketScFactoryHsSync.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using Campofinale.Game.Factory;
|
||||||
|
using Campofinale.Network;
|
||||||
|
using Campofinale.Protocol;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
|
namespace Campofinale.Packets.Sc
|
||||||
|
{
|
||||||
|
public class PacketScFactoryHsSync : Packet
|
||||||
|
{
|
||||||
|
|
||||||
|
public PacketScFactoryHsSync(Player client, FactoryChapter chapter, List<FactoryNode> nodes) {
|
||||||
|
|
||||||
|
long curtimestamp = DateTime.UtcNow.ToUnixTimestampMilliseconds();
|
||||||
|
ScFactoryHsSync hs = new()
|
||||||
|
{
|
||||||
|
Tms = curtimestamp,
|
||||||
|
Blackboard = chapter.blackboard.ToProto(),
|
||||||
|
ChapterId = chapter.chapterId,
|
||||||
|
};
|
||||||
|
nodes.ForEach(node =>
|
||||||
|
{
|
||||||
|
node.components.ForEach(c =>
|
||||||
|
{
|
||||||
|
hs.CcList.Add(c.ToProto());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
SetData(ScMsgId.ScFactoryHsSync, hs);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -312,24 +312,6 @@ namespace Campofinale
|
|||||||
teams.Add(new Team());
|
teams.Add(new Team());
|
||||||
teams.Add(new Team());
|
teams.Add(new Team());
|
||||||
bitsetManager.Load(new Dictionary<int, List<int>>());
|
bitsetManager.Load(new Dictionary<int, List<int>>());
|
||||||
/*mails.Add(new Mail()
|
|
||||||
{
|
|
||||||
expireTime=DateTime.UtcNow.AddDays(30).Ticks,
|
|
||||||
sendTime=DateTime.UtcNow.Ticks,
|
|
||||||
claimed=false,
|
|
||||||
guid=random.Next(),
|
|
||||||
owner=roleId,
|
|
||||||
isRead=false,
|
|
||||||
content=new Mail_Content()
|
|
||||||
{
|
|
||||||
content= "Welcome to Campofinale, Join our Discord for help: https://discord.gg/5uJGJJEFHa",
|
|
||||||
senderName="SuikoAkari",
|
|
||||||
title="Welcome",
|
|
||||||
templateId="",
|
|
||||||
}
|
|
||||||
|
|
||||||
});*/
|
|
||||||
|
|
||||||
|
|
||||||
spaceshipManager.Load();
|
spaceshipManager.Load();
|
||||||
}
|
}
|
||||||
@ -348,8 +330,6 @@ namespace Campofinale
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//sceneManager.UnloadCurrent(false);
|
|
||||||
//sceneManager.LoadCurrent();
|
|
||||||
sceneLoadState = SceneLoadState.Loading;
|
sceneLoadState = SceneLoadState.Loading;
|
||||||
Send(new PacketScEnterSceneNotify(this, curSceneNumId));
|
Send(new PacketScEnterSceneNotify(this, curSceneNumId));
|
||||||
}
|
}
|
||||||
@ -370,7 +350,6 @@ namespace Campofinale
|
|||||||
|
|
||||||
}
|
}
|
||||||
public SceneLoadState sceneLoadState=0;
|
public SceneLoadState sceneLoadState=0;
|
||||||
// public bool LoadFinish = true;
|
|
||||||
public void EnterScene(int sceneNumId, Vector3f pos, Vector3f rot, PassThroughData passThroughData = null)
|
public void EnterScene(int sceneNumId, Vector3f pos, Vector3f rot, PassThroughData passThroughData = null)
|
||||||
{
|
{
|
||||||
// if (!LoadFinish) return;
|
// if (!LoadFinish) return;
|
||||||
@ -573,15 +552,10 @@ namespace Campofinale
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Disconnect();
|
Disconnect();
|
||||||
}
|
}
|
||||||
public void Kick(CODE code, string optionalMsg="")
|
public void Kick(CODE code, string optionalMsg="")
|
||||||
{
|
{
|
||||||
|
|
||||||
Send(ScMsgId.ScNtfErrorCode, new ScNtfErrorCode()
|
Send(ScMsgId.ScNtfErrorCode, new ScNtfErrorCode()
|
||||||
{
|
{
|
||||||
Details = optionalMsg,
|
Details = optionalMsg,
|
||||||
@ -606,8 +580,6 @@ namespace Campofinale
|
|||||||
Logger.Print($"{nickname} Disconnected");
|
Logger.Print($"{nickname} Disconnected");
|
||||||
socket.Disconnect(false);
|
socket.Disconnect(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -67,7 +67,7 @@ namespace Campofinale
|
|||||||
public static Dispatch? dispatch;
|
public static Dispatch? dispatch;
|
||||||
public static ConfigFile? config;
|
public static ConfigFile? config;
|
||||||
public static List<CsMsgId> csMessageToHide = new() { CsMsgId.CsMoveObjectMove, CsMsgId.CsBattleOp,CsMsgId.CsPing };
|
public static List<CsMsgId> csMessageToHide = new() { CsMsgId.CsMoveObjectMove, CsMsgId.CsBattleOp,CsMsgId.CsPing };
|
||||||
public static List<ScMsgId> scMessageToHide = new() { ScMsgId.ScMoveObjectMove, ScMsgId.ScPing,ScMsgId.ScObjectEnterView };
|
public static List<ScMsgId> scMessageToHide = new() { ScMsgId.ScMoveObjectMove, ScMsgId.ScPing,ScMsgId.ScObjectEnterView,ScMsgId.ScFactoryHsSync };
|
||||||
public void Start(ConfigFile config)
|
public void Start(ConfigFile config)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -152,7 +152,7 @@ namespace Campofinale
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
clients.ForEach(client => { if (client != null) client.Update(); });
|
clients.ForEach(client => { if (client != null) client.Update(); });
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(250);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
229
Dotfuscator1.xml
229
Dotfuscator1.xml
@ -1,229 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<!--This config file was generated by Dotfuscator. Please use the Dotfuscator Config Editor to modify.-->
|
|
||||||
<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v2.5.dtd">
|
|
||||||
<dotfuscator version="2.3">
|
|
||||||
<global>
|
|
||||||
<option>debugauto</option>
|
|
||||||
</global>
|
|
||||||
<input>
|
|
||||||
<loadpaths />
|
|
||||||
<asmlist>
|
|
||||||
<package refid="75fb581d-504b-40a3-8b1a-b1ac03b08930">
|
|
||||||
<file dir="C:\Users\Alessandro\source\repos\Campofinale\Campofinale\bin\Release" name="net8.0" />
|
|
||||||
<asmlist>
|
|
||||||
<inputassembly refid="604ebecb-0504-454e-ad08-34eda9a04774">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="Campofinale.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="3ae7d7b1-7703-4c9d-b40f-15d33288f11a">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="Campofinale.Protocol.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="08e7eb08-20c7-4681-a00a-838c9388cfe8">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="CavemanTcp.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="75176245-be9c-450b-b68a-878bff8bf51a">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="CsvHelper.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="16c2e47d-0170-4a33-bc31-1d97d021bb5d">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="DnsClient.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="ba0d0ec2-a7da-4b55-9409-e2fb34ed45f2">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="Google.Protobuf.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="df591eb9-0816-47c5-a869-3ac41b3611c4">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="HttpServerLite.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="56b0c337-902f-4a99-b0f9-c78a8989d37a">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="IpMatcher.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="2c1d4661-b740-491b-a9c7-0ab81f686612">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="KeraLua.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="794877c9-4ede-4a5d-826e-634289672ee2">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="Microsoft.Extensions.Logging.Abstractions.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="164f6b24-38c1-4a23-9c04-bbdef42b8f98">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="MongoDB.Bson.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="c99724b1-c389-4524-afb2-eb102c333d4a">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="MongoDB.Driver.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="7d96e1ea-bbf7-43b1-a538-41493fb3871c">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="Newtonsoft.Json.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="17cea055-f817-486d-aa3a-1e1afbe52764">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="NLua.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="c5299b3b-de5c-4470-b57f-70b04e714b9b">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="Pastel.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="04df18de-2ea9-4bf6-96e6-1a52d414729a">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="RegexMatcher.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="489010cf-b982-47d2-aebb-b2ccaf6e3f57">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="SharpCompress.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="8b2b943b-7677-4533-a1e5-15edfa90bd84">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="Snappier.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="3fed8738-cc79-4768-94e9-209f629f5a4d">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="SQLite-net.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="f91f7184-71b8-45b9-a8ed-eb565daff3f5">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="SQLiteNetExtensions.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="e923d72d-35da-435a-aa9a-2d540caff040">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="SQLitePCLRaw.batteries_v2.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="bbd50d8d-d78c-404f-8120-5b611a3714c4">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="SQLitePCLRaw.core.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="492c3d97-8768-4ac6-aa9b-0f85acc706cd">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="SQLitePCLRaw.provider.e_sqlite3.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="77f2e352-f3ad-4fe8-b924-9e27f1184e1a">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="Timestamps.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="222ebd59-927a-46a3-bdef-e6f61e3fd73f">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="UrlMatcher.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
<inputassembly refid="668764f1-b4c4-40ba-8631-24e31fcacc2a">
|
|
||||||
<option>honoroas</option>
|
|
||||||
<option>stripoa</option>
|
|
||||||
<option>library</option>
|
|
||||||
<option>transformxaml</option>
|
|
||||||
<file dir="" name="ZstdSharp.dll" />
|
|
||||||
</inputassembly>
|
|
||||||
</asmlist>
|
|
||||||
</package>
|
|
||||||
</asmlist>
|
|
||||||
</input>
|
|
||||||
<output>
|
|
||||||
<file dir="${configdir}/Dotfuscated" />
|
|
||||||
</output>
|
|
||||||
<renaming>
|
|
||||||
<option>xmlserialization</option>
|
|
||||||
<excludelist>
|
|
||||||
<namespace name="Campofinale.Resource" regex="true" />
|
|
||||||
<type name="ConfigFile" regex="true" />
|
|
||||||
</excludelist>
|
|
||||||
<mapping>
|
|
||||||
<mapoutput overwrite="false">
|
|
||||||
<file dir="" name="${configdir}/Dotfuscated/Map.xml" />
|
|
||||||
</mapoutput>
|
|
||||||
</mapping>
|
|
||||||
<referencerulelist>
|
|
||||||
<referencerule rulekey="{6655B10A-FD58-462d-8D4F-5B1316DFF0FF}" />
|
|
||||||
<referencerule rulekey="{7D9C8B02-2383-420f-8740-A9760394C2C1}" />
|
|
||||||
<referencerule rulekey="{229FD6F8-5BCC-427b-8F72-A7A413ECDF1A}" />
|
|
||||||
<referencerule rulekey="{2B7E7C8C-A39A-4db8-9DFC-6AFD38509061}" />
|
|
||||||
<referencerule rulekey="{494EA3BA-B947-44B5-BEE8-A11CC85AAF9B}" />
|
|
||||||
<referencerule rulekey="{89769974-93E9-4e71-8D92-BE70E855ACFC}" />
|
|
||||||
<referencerule rulekey="{4D81E604-A545-4631-8B6D-C3735F793F80}" />
|
|
||||||
<referencerule rulekey="{62bd3899-7d53-4336-8ca2-4e5dbae187d5}" />
|
|
||||||
</referencerulelist>
|
|
||||||
</renaming>
|
|
||||||
<sos />
|
|
||||||
<smartobfuscation>
|
|
||||||
<smartobfuscationreport verbosity="all" overwrite="false" />
|
|
||||||
</smartobfuscation>
|
|
||||||
</dotfuscator>
|
|
||||||
Loading…
Reference in New Issue
Block a user