mirror of
https://git.muiegratis.online/suikoakari/Campofinale
synced 2025-12-12 17:44:37 +01:00
real enemy drops, improved code etc, i dont remember everything i made LOL
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Campofinale.Resource;
|
||||
using System.Threading;
|
||||
using static Campofinale.Resource.ResourceManager;
|
||||
using static Campofinale.Resource.ResourceManager.LevelScene.LevelData;
|
||||
|
||||
@@ -41,6 +42,10 @@ namespace Campofinale.Game.Entities
|
||||
public virtual void Heal(double heal)
|
||||
{
|
||||
|
||||
}
|
||||
public virtual void OnDie()
|
||||
{
|
||||
|
||||
}
|
||||
public virtual bool Interact(string eventName, Google.Protobuf.Collections.MapField<string, DynamicParameter> properties)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Campofinale.Protocol;
|
||||
using Campofinale.Resource;
|
||||
using Campofinale.Resource.Table;
|
||||
using System.Threading;
|
||||
using static Campofinale.Resource.ResourceManager;
|
||||
|
||||
namespace Campofinale.Game.Entities
|
||||
@@ -97,6 +99,23 @@ namespace Campofinale.Game.Entities
|
||||
};
|
||||
return proto;
|
||||
}
|
||||
public override void OnDie()
|
||||
{
|
||||
if (!wikiEnemyDropTable.ContainsKey(templateId)) return;
|
||||
WikiEnemyDropTable table = wikiEnemyDropTable[templateId];
|
||||
if (table!=null)
|
||||
{
|
||||
table.dropItemIds.ForEach(id =>
|
||||
{
|
||||
GetOwner().sceneManager.CreateDrop(Position, new RewardTable.ItemBundle()
|
||||
{
|
||||
id = id,
|
||||
count = 1
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
public override void Damage(double dmg)
|
||||
{
|
||||
curHp -= dmg;
|
||||
|
||||
@@ -11,6 +11,7 @@ using static Campofinale.Resource.ResourceManager;
|
||||
using Google.Protobuf.Collections;
|
||||
using Campofinale.Packets.Sc;
|
||||
using Campofinale.Protocol;
|
||||
using CsvHelper.Configuration.Attributes;
|
||||
|
||||
namespace Campofinale.Game.Inventory
|
||||
{
|
||||
|
||||
25
Campofinale/Game/MissionSys/GameMission.cs
Normal file
25
Campofinale/Game/MissionSys/GameMission.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Campofinale.Resource;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Campofinale.Game.MissionSys
|
||||
{
|
||||
public class GameMission
|
||||
{
|
||||
public string missionId;
|
||||
public MissionState state;
|
||||
|
||||
public GameMission()
|
||||
{
|
||||
|
||||
}
|
||||
public GameMission(string id, MissionState state = MissionState.Available)
|
||||
{
|
||||
missionId = id;
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Campofinale/Game/MissionSys/GameQuest.cs
Normal file
24
Campofinale/Game/MissionSys/GameQuest.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Campofinale.Resource;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Campofinale.Game.MissionSys
|
||||
{
|
||||
public class GameQuest
|
||||
{
|
||||
public string questId;
|
||||
public QuestState state;
|
||||
public GameQuest()
|
||||
{
|
||||
|
||||
}
|
||||
public GameQuest(string id, QuestState state = QuestState.Available)
|
||||
{
|
||||
questId = id;
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -266,33 +266,6 @@ namespace Campofinale.Game.MissionSys
|
||||
}
|
||||
}
|
||||
}
|
||||
public class GameQuest
|
||||
{
|
||||
public string questId;
|
||||
public QuestState state;
|
||||
public GameQuest()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
public GameQuest(string id, QuestState state = QuestState.Available)
|
||||
{
|
||||
questId = id;
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
public class GameMission
|
||||
{
|
||||
public string missionId;
|
||||
public MissionState state;
|
||||
|
||||
public GameMission()
|
||||
{
|
||||
|
||||
}
|
||||
public GameMission(string id, MissionState state = MissionState.Available)
|
||||
{
|
||||
missionId = id;
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,24 +90,10 @@ namespace Campofinale.Game
|
||||
|
||||
if (scene != null)
|
||||
{
|
||||
if(GetEntity(guid) is EntityMonster)
|
||||
Entity entity = GetEntity(guid);
|
||||
if (entity != null)
|
||||
{
|
||||
EntityMonster monster = (EntityMonster)GetEntity(guid);
|
||||
CreateDrop(monster.Position, new RewardTable.ItemBundle()
|
||||
{
|
||||
id = "item_gem_rarity_3",
|
||||
count=1
|
||||
});
|
||||
LevelScene lv_scene = ResourceManager.GetLevelData(GetEntity(guid).sceneNumId);
|
||||
LevelEnemyData d = lv_scene.levelData.enemies.Find(l => l.levelLogicId == monster.guid);
|
||||
if (d != null)
|
||||
{
|
||||
if (!d.respawnable)
|
||||
{
|
||||
player.noSpawnAnymore.Add(monster.guid);
|
||||
}
|
||||
}
|
||||
}
|
||||
entity.OnDie();
|
||||
if (killClient)
|
||||
{
|
||||
ScSceneDestroyEntity destroy = new()
|
||||
@@ -117,15 +103,26 @@ namespace Campofinale.Game
|
||||
SceneNumId = GetEntity(guid).sceneNumId,
|
||||
};
|
||||
player.Send(Protocol.ScMsgId.ScSceneDestroyEntity, destroy);
|
||||
|
||||
}
|
||||
if (GetEntity(guid) != null)
|
||||
if (entity is EntityMonster monster)
|
||||
{
|
||||
if(scenes.Find(s => s.sceneNumId == GetEntity(guid).sceneNumId) != null)
|
||||
LevelScene lv_scene = ResourceManager.GetLevelData(entity.sceneNumId);
|
||||
LevelEnemyData d = lv_scene.levelData.enemies.Find(l => l.levelLogicId == monster.guid);
|
||||
if (d != null)
|
||||
{
|
||||
scenes.Find(s => s.sceneNumId == GetEntity(guid).sceneNumId).entities.Remove(GetEntity(guid));
|
||||
if (!d.respawnable)
|
||||
{
|
||||
player.noSpawnAnymore.Add(monster.guid);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (scenes.Find(s => s.sceneNumId == entity.sceneNumId) != null)
|
||||
{
|
||||
scenes.Find(s => s.sceneNumId == entity.sceneNumId).entities.Remove(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -400,8 +397,11 @@ namespace Campofinale.Game
|
||||
{
|
||||
|
||||
List<Entity> toSpawn = new();
|
||||
foreach(Entity e in GetEntityExcludingChar().FindAll(e=>e.spawned==false))
|
||||
List<Entity> toCheck = GetEntityExcludingChar().FindAll(e => e.spawned == false);
|
||||
toCheck.Sort((a, b) => a.Position.Distance(GetOwner().position).CompareTo(b.Position.Distance(GetOwner().position)));
|
||||
foreach (Entity e in toCheck)
|
||||
{
|
||||
|
||||
if(e.spawned==false && (GetActiveScript(e.belongLevelScriptId) || e.belongLevelScriptId==0))
|
||||
{
|
||||
if (!e.defaultHide)
|
||||
|
||||
@@ -122,7 +122,19 @@ namespace Campofinale.Http
|
||||
|
||||
await ctx.Response.SendAsync(resp);
|
||||
}
|
||||
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/1003/prod-cbt/default/Windows/res_version")]
|
||||
public static async Task os_windows_res_version(HttpContext ctx)
|
||||
{
|
||||
|
||||
string resp = "{\"version\": \"2089329-32\", \"kickFlag\": true}";
|
||||
|
||||
|
||||
ctx.Response.StatusCode = 200;
|
||||
//ctx.Response.ContentLength = resp.Length;
|
||||
ctx.Response.ContentType = "application/json";
|
||||
|
||||
await ctx.Response.SendAsync(resp);
|
||||
}
|
||||
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/gameBulletin/version")]
|
||||
public static async Task Version(HttpContext ctx)
|
||||
{
|
||||
|
||||
@@ -11,8 +11,6 @@ namespace Campofinale.Packets.Cs
|
||||
{
|
||||
CsSceneSetLastSafeZone req = packet.DecodeBody<CsSceneSetLastSafeZone>();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,20 +44,21 @@ namespace Campofinale.Packets.Cs
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ScSceneLevelScriptStateNotify rsp = new ScSceneLevelScriptStateNotify()
|
||||
var sceneScript = session.sceneManager.GetCurScene().scripts.Find(s => s.scriptId == req.ScriptId);
|
||||
if (sceneScript != null)
|
||||
{
|
||||
sceneScript.state = 2;
|
||||
ScSceneLevelScriptStateNotify rsp = new ScSceneLevelScriptStateNotify()
|
||||
{
|
||||
SceneNumId = req.SceneNumId,
|
||||
ScriptId = req.ScriptId,
|
||||
|
||||
State = 3
|
||||
State = sceneScript.state
|
||||
};
|
||||
|
||||
if (!session.sceneManager.GetCurScene().activeScripts.Contains(req.ScriptId))
|
||||
{
|
||||
session.sceneManager.GetCurScene().activeScripts.Add(req.ScriptId);
|
||||
session.sceneManager.GetCurScene().UpdateShowEntities();
|
||||
session.Send(ScMsgId.ScSceneLevelScriptStateNotify, rsp);
|
||||
}
|
||||
session.Send(ScMsgId.ScSceneLevelScriptStateNotify, rsp);*/
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +87,23 @@ namespace Campofinale.Packets.Cs
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var sceneScript = session.sceneManager.GetCurScene().scripts.Find(s => s.scriptId == req.ScriptId);
|
||||
if (sceneScript != null)
|
||||
{
|
||||
sceneScript.state = 3;
|
||||
ScSceneLevelScriptStateNotify rsp = new ScSceneLevelScriptStateNotify()
|
||||
{
|
||||
SceneNumId = req.SceneNumId,
|
||||
ScriptId = req.ScriptId,
|
||||
|
||||
State = sceneScript.state
|
||||
};
|
||||
|
||||
session.Send(ScMsgId.ScSceneLevelScriptStateNotify, rsp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Campofinale.Resource
|
||||
{
|
||||
public enum MissionState : int// TypeDefIndex: 33630
|
||||
public enum MissionState
|
||||
{
|
||||
None = 0,
|
||||
Available = 1,
|
||||
@@ -17,6 +17,14 @@
|
||||
Completed = 3,
|
||||
Failed = 4,
|
||||
}
|
||||
public enum LevelScriptState
|
||||
{
|
||||
None = 0,
|
||||
Disabled = 1,
|
||||
Enabled = 2,
|
||||
Active = 3,
|
||||
Running = 4
|
||||
}
|
||||
public enum InteractiveComponentType
|
||||
{
|
||||
TriggerObserver = 0,
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace Campofinale.Resource
|
||||
public static Dictionary<string, GachaWeaponPoolTable> gachaWeaponPoolTable = new();
|
||||
//
|
||||
public static Dictionary<string, EnemyTable> enemyTable = new();
|
||||
public static Dictionary<string, WikiEnemyDropTable> wikiEnemyDropTable = new();
|
||||
public static Dictionary<string, EquipTable> equipTable = new();
|
||||
public static Dictionary<string, EquipSuitTable> equipSuitTable = new();
|
||||
public static Dictionary<string, SpaceShipCharBehaviourTable> spaceShipCharBehaviourTable = new();
|
||||
@@ -107,7 +108,6 @@ namespace Campofinale.Resource
|
||||
// TODO: move all tables to the folder
|
||||
sceneAreaTable=JsonConvert.DeserializeObject<Dictionary<string, SceneAreaTable>>(ReadJsonFile("TableCfg/SceneAreaTable.json"));
|
||||
strIdNumTable = JsonConvert.DeserializeObject<StrIdNumTable>(ReadJsonFile("TableCfg/StrIdNumTable.json"));
|
||||
characterTable = JsonConvert.DeserializeObject<Dictionary<string, CharacterTable>>(ReadJsonFile("TableCfg/CharacterTable.json"));
|
||||
systemJumpTable = JsonConvert.DeserializeObject<Dictionary<string, SystemJumpTable>>(ReadJsonFile("TableCfg/SystemJumpTable.json"));
|
||||
settlementBasicDataTable = JsonConvert.DeserializeObject<Dictionary<string, SettlementBasicDataTable>>(ReadJsonFile("TableCfg/SettlementBasicDataTable.json"));
|
||||
blocMissionTable = JsonConvert.DeserializeObject<Dictionary<string, BlocMissionTable>>(ReadJsonFile("TableCfg/BlocMissionTable.json"));
|
||||
@@ -138,15 +138,12 @@ namespace Campofinale.Resource
|
||||
spaceshipRoomInsTable = JsonConvert.DeserializeObject<Dictionary<string, SpaceshipRoomInsTable>>(ReadJsonFile("TableCfg/SpaceshipRoomInsTable.json"));
|
||||
dungeonTable = JsonConvert.DeserializeObject<Dictionary<string, DungeonTable>>(ReadJsonFile("TableCfg/DungeonTable.json"));
|
||||
equipSuitTable = JsonConvert.DeserializeObject<Dictionary<string, EquipSuitTable>>(ReadJsonFile("TableCfg/EquipSuitTable.json"));
|
||||
levelGradeTable = JsonConvert.DeserializeObject<Dictionary<string, LevelGradeTable>>(ReadJsonFile("TableCfg/LevelGradeTable.json"));
|
||||
levelShortIdTable = JsonConvert.DeserializeObject<Dictionary<string, LevelShortIdTable>>(ReadJsonFile("DynamicAssets/gamedata/gameplayconfig/jsoncfg/LevelShortIdTable.json"));
|
||||
rewardTable = JsonConvert.DeserializeObject<Dictionary<string, RewardTable>>(ReadJsonFile("TableCfg/RewardTable.json"));
|
||||
adventureTaskTable = JsonConvert.DeserializeObject<Dictionary<string, AdventureTaskTable>>(ReadJsonFile("TableCfg/AdventureTaskTable.json"));
|
||||
factoryBuildingTable = JsonConvert.DeserializeObject<Dictionary<string, FactoryBuildingTable>>(ReadJsonFile("TableCfg/FactoryBuildingTable.json"));
|
||||
facSTTNodeTable = JsonConvert.DeserializeObject<Dictionary<string, FacSTTNodeTable>>(ReadJsonFile("TableCfg/FacSTTNodeTable.json"));
|
||||
facSTTLayerTable = JsonConvert.DeserializeObject<Dictionary<string, FacSTTLayerTable>>(ReadJsonFile("TableCfg/FacSTTLayerTable.json"));
|
||||
itemTypeTable = JsonConvert.DeserializeObject<Dictionary<int, ItemTypeTable>>(ReadJsonFile("TableCfg/ItemTypeTable.json"));
|
||||
interactiveTable = JsonConvert.DeserializeObject<InteractiveTable>(ReadJsonFile("Json/Interactive/InteractiveTable.json"));
|
||||
LoadInteractiveData();
|
||||
LoadLevelDatas();
|
||||
LoadScriptsEvent();
|
||||
@@ -155,7 +152,7 @@ namespace Campofinale.Resource
|
||||
|
||||
if (missingResources)
|
||||
{
|
||||
Logger.PrintWarn("Missing some resources. The gameserver will probably crash.");
|
||||
Logger.PrintWarn("Some Resources are Missing. The Game server may not work properly.");
|
||||
}
|
||||
}
|
||||
public static List<int> GetAllShortIds()
|
||||
@@ -242,6 +239,8 @@ namespace Campofinale.Resource
|
||||
{
|
||||
Logger.Print("Loading ScriptsEvents");
|
||||
string directoryPath = @"Json/ScriptEvents";
|
||||
try
|
||||
{
|
||||
string[] jsonFiles = Directory.GetFiles(directoryPath, "*.json", SearchOption.AllDirectories);
|
||||
foreach (string json in jsonFiles)
|
||||
{
|
||||
@@ -261,11 +260,20 @@ namespace Campofinale.Resource
|
||||
|
||||
}
|
||||
Logger.Print($"Loaded {levelScriptsEvents.Count} ScriptsEvents");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.PrintWarn($"No ScriptsEvents folder found in Json.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public static void LoadSpawners()
|
||||
{
|
||||
Logger.Print("Loading Spawners");
|
||||
string directoryPath = @"DynamicAssets\gamedata\spawnerconfig";
|
||||
try
|
||||
{
|
||||
string[] jsonFiles = Directory.GetFiles(directoryPath, "*.json", SearchOption.AllDirectories);
|
||||
foreach (string json in jsonFiles)
|
||||
{
|
||||
@@ -275,6 +283,12 @@ namespace Campofinale.Resource
|
||||
}
|
||||
Logger.Print($"Loaded {spawnerConfigs.Count} Spawners");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.PrintError($"Error occured when loading SpawnerConfigs: " + e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
public static void LoadLevelDatas()
|
||||
{
|
||||
Logger.Print("Loading LevelData resources");
|
||||
@@ -302,7 +316,7 @@ namespace Campofinale.Resource
|
||||
catch (Exception ex)
|
||||
{
|
||||
//Logger.PrintError(ex.Message);
|
||||
Logger.PrintWarn("Missing levelData natural spawns file for scene " + data.mapIdStr + " path: " + path);
|
||||
Logger.PrintWarn("Missing LevelData natural spawns file for scene " + data.mapIdStr + " path: " + path);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
8
Campofinale/Resource/Table/WikiEnemyDropTable.cs
Normal file
8
Campofinale/Resource/Table/WikiEnemyDropTable.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Campofinale.Resource.Table
|
||||
{
|
||||
[TableCfgType("TableCfg/WikiEnemyDropTable.json", LoadPriority.LOW)]
|
||||
public class WikiEnemyDropTable
|
||||
{
|
||||
public List<string> dropItemIds = new();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user