mirror of
https://git.muiegratis.online/suikoakari/Campofinale
synced 2025-12-12 09:34:34 +01:00
cleaning code
This commit is contained in:
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,10 +76,9 @@ namespace Campofinale.Game.Factory
|
|||||||
List<FactoryNode> nodeUpdateList = new();
|
List<FactoryNode> nodeUpdateList = new();
|
||||||
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 && node.nodeType != FCNodeType.BoxConveyor)
|
if (node.position.DistanceXZ(player.position) < 150 && node.nodeBehaviour!=null)
|
||||||
{
|
{
|
||||||
nodeUpdateList.Add(node);
|
nodeUpdateList.Add(node);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,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
|
||||||
}
|
}
|
||||||
@@ -240,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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user