mirror of
https://github.com/sebastian-heinz/Arrowgene.DragonsDogmaOnline
synced 2026-08-03 11:12:41 -04:00
- Enemies which are now labeled as an area boss will reward AP when
the group is defeated.
- The amount of AP is configurable via the new setting AreaBossApReward.
- The default value is 500 AP for the current Area the defeated enemy
is in.
- Added a new member to instance enemy properties which allows a rank to
be assigned to a scripts. The rank helps to control the order scripts
are executed. The scripts with a lower rank are executed before
scripts with a higher rank.
- Added a new script module InstanceEnemyDropGenerator. This module can
be used to have the server assign drops to an enemy when killed.
Intended to eventually replace the event item generator via json.
- Fixed a few await warnings introduced from PR #919 related to
scripting.
128 lines
5.1 KiB
C#
128 lines
5.1 KiB
C#
using Arrowgene.Ddon.GameServer.Scripting.Modules;
|
|
using Arrowgene.Ddon.Server;
|
|
using Arrowgene.Ddon.Shared.Scripting;
|
|
using Arrowgene.Logging;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
namespace Arrowgene.Ddon.GameServer.Scripting
|
|
{
|
|
public class GlobalVariables
|
|
{
|
|
public GlobalVariables()
|
|
{
|
|
}
|
|
};
|
|
|
|
public class GameServerScriptManager : ScriptManager<GlobalVariables>
|
|
{
|
|
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(GameServerScriptManager));
|
|
|
|
private DdonGameServer Server { get; }
|
|
private GlobalVariables Globals { get; }
|
|
public NpcExtendedFacilityModule NpcExtendedFacilityModule { get; private set; } = new NpcExtendedFacilityModule();
|
|
public GameItemModule GameItemModule { get; private set; } = new GameItemModule();
|
|
public MixinModule MixinModule { get; private set; } = new MixinModule();
|
|
public QuestModule QuestModule { get; private set; } = new QuestModule();
|
|
public ChatCommandModule ChatCommandModule { get; private set; } = new ChatCommandModule();
|
|
public PointModifierModule PointModifierModule { get; private set; } = new PointModifierModule();
|
|
public AddendumModule AddendumModule { get; private set; } = new AddendumModule();
|
|
public MonsterCautionSpotModule MonsterCautionSpotModule { get; private set; } = new MonsterCautionSpotModule();
|
|
public InstanceEnemyPropertyGeneratorModule InstanceEnemyPropertyGeneratorModule { get; private set; } = new InstanceEnemyPropertyGeneratorModule();
|
|
public JobOrbTreeModule SkillAugmentationModule { get; private set; } = new JobOrbTreeModule("job_orb_tree/skill_augmentation");
|
|
public JobOrbTreeModule SpecialSkillAugmentationModule { get; private set; } = new JobOrbTreeModule("job_orb_tree/special_skill_augmentation");
|
|
public JobOrbTreeSpecialConditionModule JobOrbSpecialConditionModule { get; private set; } = new();
|
|
public JobEmblemStatModule JobEmblemStatModule { get; private set; } = new JobEmblemStatModule();
|
|
public InstanceEnemyDropModule InstanceEnemyDropModule { get; private set; } = new();
|
|
|
|
|
|
public GameServerScriptManager(DdonGameServer server) : base(server.AssetRepository.AssetsPath, ".")
|
|
{
|
|
Server = server;
|
|
Globals = new GlobalVariables();
|
|
|
|
// Initialize LibDdon Singleton
|
|
LibDdon.SetServer(server);
|
|
|
|
// Add modules to the list so the generic logic can iterate over all scripting modules
|
|
AddModule(ChatCommandModule);
|
|
AddModule(GameItemModule);
|
|
AddModule(MixinModule);
|
|
AddModule(NpcExtendedFacilityModule);
|
|
AddModule(PointModifierModule);
|
|
AddModule(InstanceEnemyPropertyGeneratorModule);
|
|
AddModule(SkillAugmentationModule);
|
|
AddModule(JobEmblemStatModule);
|
|
AddModule(SpecialSkillAugmentationModule);
|
|
AddModule(JobOrbSpecialConditionModule);
|
|
AddModule(MonsterCautionSpotModule);
|
|
AddModule(InstanceEnemyDropModule);
|
|
}
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize(Globals);
|
|
}
|
|
|
|
protected override void CompileScripts(List<ScriptModule> modules = null)
|
|
{
|
|
base.CompileScripts(modules);
|
|
|
|
// World Manage Quests have a dependency on Caution Spots, so load quests after
|
|
// caution spots
|
|
base.CompileScripts([QuestModule]);
|
|
AddModule(QuestModule);
|
|
|
|
// This module should run last since it applies fine grained modifications to other modules
|
|
base.CompileScripts([AddendumModule]);
|
|
AddModule(AddendumModule);
|
|
}
|
|
|
|
protected override void OnChanged(object sender, FileSystemEventArgs e)
|
|
{
|
|
if (e.ChangeType != WatcherChangeTypes.Changed)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var module = GetModuleFromFilePath(e.FullPath);
|
|
if (module == null)
|
|
{
|
|
// No module associated with this script
|
|
return;
|
|
}
|
|
|
|
base.OnChanged(sender, e);
|
|
|
|
if (!module.GetType().Equals(typeof(AddendumModule)))
|
|
{
|
|
if (AddendumModule.Scripts.Count == 0)
|
|
{
|
|
// No addendums to be reapplied
|
|
return;
|
|
}
|
|
|
|
try
|
|
{
|
|
Logger.Info("Reapplying addendums");
|
|
foreach (var watcher in AddendumModule.Watchers)
|
|
{
|
|
watcher.EnableRaisingEvents = false;
|
|
}
|
|
|
|
foreach (var script in AddendumModule.Scripts)
|
|
{
|
|
CompileScript(AddendumModule, script);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
foreach (var watcher in AddendumModule.Watchers)
|
|
{
|
|
watcher.EnableRaisingEvents = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|