思路
1、主要源代码文件夹The Scroll of Taiwu_Data/Managed 其中文件大多是dll
2、运用dnSpy等反编译软件 获取源代码
3、moding 源码
4、导出成为dll放入mod文件夹
Libs
0Harmony.dll
using HarmonyLib;
提供补丁方法 可以用于修补类的方法 有自动补丁和手动补丁,也分PrePatch前置补丁和PostPatch后置补丁
Assembly-CSharp.dll
using Config;
using Config.ConfigCells.Character;
using GameData.Domains.Character;
using GameData.Domains.Item;
using GameData.Utilities;
前端主要文件,包括了初始化功法和功法书的部分
注意前端与后端GameData.dll有许多同名类,需要前后端分离
TaiwuModdingLib.dll
using TaiwuModdingLib.Core.Plugin;
官方提供的Mod接口,里面有Initialize等方法
自建命名空间,自建类MoreCombatSkill继承自TaiwuRemakePlugin,然后重载public override void Initialize()
UnityEngine.CoreModule.dll
using UnityEngine;
Debug.Log(“xxxx”)在这个里面
(令人惊讶的是并不是在UnityEngine.dll里面,我通过dnSpy反编译看过了)
.csproj
这个文件给出编译.NET的配置信息
指定.NET框架版本
<TargetFramework>net48</TargetFramework>
指定使用的.dll
<ItemGroup> <Reference Include="Assembly-CSharp"> <HintPath>libs\Assembly-CSharp.dll</HintPath> </Reference> <Reference Include="HarmonyLib"> <HintPath>libs\0Harmony.dll</HintPath> </Reference> <Reference Include="TaiwuModdingLib"> <HintPath>libs\TaiwuModdingLib.dll</HintPath> </Reference> <Reference Include="UnityEngine.CoreModule"> <HintPath>libs\UnityEngine.CoreModule.dll</HintPath> </Reference> <Reference Include="UnityEngine"> <HintPath>libs\UnityEngine.dll</HintPath> </Reference> </ItemGroup>
实操
COED
//MoreCombatSkill.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using HarmonyLib; using TaiwuModdingLib.Core.Plugin; using Config; using Config.ConfigCells.Character; using GameData.Domains.Character; using GameData.Domains.Item; using GameData.Utilities; using UnityEngine; namespace MoreCombatSkill { [PluginConfig("MoreCombatSkill", "mozhongzhou", "1.0.0")] public class MoreCombatSkill : TaiwuRemakePlugin { public override void Initialize() { Debug.Log("Initializing NEWCombatSkill."); AddCombatSkill(); Debug.Log("Initializing NEWSkillBook."); AddSkillBook(); } public override void Dispose() { // 清理资源 } private void AddCombatSkill() { var newCombatSkill = new CombatSkillItem( 30000, // TemplateId 模板ID 1860, // Name 名称 1, // Grade 等级 0-8 1861, // Desc 描述 "sp_icon_combatskill_7_7", // Icon 图标 1, // EquipType 装备类型 7, // Type 类型 ECombatSkillSubType.Invalid, // SubType 子类型 1, // GridCost 格子消耗 0, // SectId 门派ID 1, // FiveElements 五行 20000, // BookId 书籍ID false, // CanObtainByAdventure 可通过冒险获得 true, // IsNonPublic 是否非公开 1, // OrderIdInSect 门派中的顺序ID new List<PropertyAndValue> // UsingRequirement 使用要求 { new PropertyAndValue(1, 1), new PropertyAndValue(5, 1), new PropertyAndValue(87, 1), new PropertyAndValue(54, 1), new PropertyAndValue(65, 1) }, 388, // DirectEffectID 直接效果ID 1114, // ReverseEffectID 反向效果ID 5, // InheritAttainmentAdiitionRate 继承成就加成率 1, // PracticeType 修炼类型 77, // BreakStart 破绽开始 293, // BreakEnd 破绽结束 true, // GoneMadInnerInjury 疯狂内伤 new List<sbyte> { 0, 1, 2, 3, 4, 5, 6 }, // GoneMadInjuredPart 疯狂受伤部位 3, // GoneMadInjuryValue 疯狂受伤值 500, // GoneMadQiDisorder 疯狂气乱 0, // TotalObtainableNeili 可获得的总内力 0, // ObtainedNeiliPerLoop 每回合获得的内力 -1, // DestTypeWhileLooping 循环时的目标类型 -1, // TransferTypeWhileLooping 循环时的转移类型 0, // FiveElementChangePerLoop 每回合五行变化 new sbyte[4], // SpecificGrids 特定格子 0, // GenericGrid 通用格子 new HitOrAvoidShorts(new short[4]), // HitValues 命中值 new HitOrAvoidShorts(new short[4]), // AvoidValues 闪避值 new OuterAndInnerShorts(0, 0), // Penetrations 穿透 new OuterAndInnerShorts(0, 0), // PenetrationResists 穿透抵抗 new OuterAndInnerShorts(0, 0), // RecoveryOfStanceAndBreath 姿态和呼吸恢复 0, // MoveSpeed 移动速度 0, // RecoveryOfFlaw 破绽恢复 0, // CastSpeed 施法速度 0, // RecoveryOfBlockedAcupoint 被封穴位恢复 0, // WeaponSwitchSpeed 武器切换速度 0, // AttackSpeed 攻击速度 0, // InnerRatio 内力比例 0, // RecoveryOfQiDisorder 气乱恢复 new PoisonShorts(new int[6]), // PoisonResists 毒抗 "70709", // AssetFileName 资源文件名 "C_707", // PrepareAnimation 准备动画 "S_70709", // CastAnimation 施法动画 "Particle_S_70709", // CastParticle 施法粒子效果 null, // CastPetAnimation 施法宠物动画 null, // CastPetParticle 施法宠物粒子效果 new short[] { 52, 52, 53, 54, 54 }, // DistanceWhenFourStepAnimation 四步动画时的距离 "se_skill_70709", // CastSoundEffect 施法音效 null, // PlayerCastBossSkillPrepareAni 玩家施放Boss技能准备动画 null, // PlayerCastBossSkillAni 玩家施放Boss技能动画 null, // PlayerCastBossSkillParticle 玩家施放Boss技能粒子效果 null, // PlayerCastBossSkillSound 玩家施放Boss技能音效 null, // PlayerCastBossSkillDistance 玩家施放Boss技能距离 21000, // PrepareTotalProgress 准备总进度 new List<sbyte> { 0 }, // NeedBodyPartTypes 需要的身体部位类型 0, // MobilityCost 机动性消耗 100, // BreathStanceTotalCost 呼吸姿态总消耗 100, // BaseInnerRatio 基础内力比例 15, // InnerRatioChangeRange 内力比例变化范围 840, // Penetrate 穿透 20, // DistanceAdditionWhenCast 施法时的距离加成 new List<NeedTrick> // TrickCost 诀窍消耗 { new NeedTrick(5, 4) }, 0, // WeaponDurableCost 武器耐久消耗 0, // WugCost 武功消耗 516, // MostFittingWeaponID 最适合的武器ID new sbyte[] { 30, 30, 1, 20, 20, 10, 10 }, // InjuryPartAtkRateDistribution 受伤部位攻击率分布 220, // TotalHit 总命中 new sbyte[4], // PerHitDamageRateDistribution 每次命中伤害率分布 false, // HasAtkAcupointEffect 是否有攻击穴位效果 false, // HasAtkFlawEffect 是否有攻击破绽效果 new PoisonsAndLevels(new short[12]), // Poisons 毒素 50, // EquipmentBreakOdds 装备破损几率 -1, // AddWugType 增加的武功类型 null, // AddBreakBodyFeature 增加的破体特性 0, // AddMoveSpeedOnCast 施法时增加的移动速度 0, // AddPercentMoveSpeedOnCast 施法时增加的移动速度百分比 0, // MoveCdBonus 移动冷却加成 new short[4], // AddHitOnCast 施法时增加的命中 36, // MobilityReduceSpeed 机动性降低速度 0, // MobilityAddSpeed 机动性增加速度 36, // MoveCostMobility 移动消耗机动性 -1, // MaxJumpDistance 最大跳跃距离 -1, // JumpPrepareFrame 跳跃准备帧 false, // CanPartlyJump 是否能部分跳跃 null, // JumpAni 跳跃动画 null, // JumpParticle 跳跃粒子效果 -1, // JumpChangeDistanceFrame 跳跃改变距离帧 -1, // JumpChangeDistanceDuration 跳跃改变距离持续时间 -1, // ScoreBonusType 分数加成类型 0, // ScoreBonus 分数加成 0, // AddOuterPenetrateResistOnCast 施法时增加的外部穿透抵抗 0, // AddInnerPenetrateResistOnCast 施法时增加的内部穿透抵抗 new short[4], // AddAvoidOnCast 施法时增加的闪避 0, // FightBackDamage 反击伤害 0, // BounceRateOfOuterInjury 外伤反弹率 0, // BounceRateOfInnerInjury 内伤反弹率 0, // ContinuousFrames 连续帧数 0, // BounceDistance 反弹距离 0, // RecoverBlockPercent 恢复格挡百分比 null, // DefendAnimation 防御动画 null, // DefendParticle 防御粒子效果 null, // DefendSound 防御音效 null, // FightBackAnimation 反击动画 null, // FightBackParticle 反击粒子效果 null, // FightBackSound 反击音效 new List<PropertyAndValue>(), // PropertyAddList 属性增加列表 new int[7], // OuterDamageSteps 外部伤害步骤 new int[7], // InnerDamageSteps 内部伤害步骤 0, // FatalDamageStep 致命伤害步骤 80, // MindDamageStep 心理伤害步骤 new List<sbyte>(), // PossibleQiArtStrategyList 可能的气功策略列表 new sbyte[5], // ExtraNeiliAllocationProgress 额外内力分配进度 new List<short>(), // LoopBonusSkillList 循环加成技能列表 -1 // QiArtStrategyGenerateProbability 气功策略生成概率 ); Debug.Log("Adding new combat skill:"); Debug.Log($"TemplateId: {newCombatSkill.TemplateId}"); Debug.Log($"Name: {newCombatSkill.Name}"); Debug.Log($"Grade: {newCombatSkill.Grade}"); Debug.Log($"Desc: {newCombatSkill.Desc}"); Debug.Log($"Icon: {newCombatSkill.Icon}"); Debug.Log($"EquipType: {newCombatSkill.EquipType}"); Debug.Log($"Type: {newCombatSkill.Type}"); Debug.Log($"SubType: {newCombatSkill.SubType}"); Debug.Log($"GridCost: {newCombatSkill.GridCost}"); Debug.Log($"SectId: {newCombatSkill.SectId}"); Debug.Log($"FiveElements: {newCombatSkill.FiveElements}"); Debug.Log($"BookId: {newCombatSkill.BookId}"); Debug.Log($"CanObtainByAdventure: {newCombatSkill.CanObtainByAdventure}"); Debug.Log($"IsNonPublic: {newCombatSkill.IsNonPublic}"); Debug.Log($"OrderIdInSect: {newCombatSkill.OrderIdInSect}"); Debug.Log($"DirectEffectID: {newCombatSkill.DirectEffectID}"); Debug.Log($"ReverseEffectID: {newCombatSkill.ReverseEffectID}"); Debug.Log($"InheritAttainmentAdiitionRate: {newCombatSkill.InheritAttainmentAdiitionRate}"); Debug.Log($"PracticeType: {newCombatSkill.PracticeType}"); Debug.Log($"BreakStart: {newCombatSkill.BreakStart}"); Debug.Log($"BreakEnd: {newCombatSkill.BreakEnd}"); Debug.Log($"GoneMadInnerInjury: {newCombatSkill.GoneMadInnerInjury}"); Debug.Log($"GoneMadInjuryValue: {newCombatSkill.GoneMadInjuryValue}"); Debug.Log($"GoneMadQiDisorder: {newCombatSkill.GoneMadQiDisorder}"); Debug.Log($"TotalObtainableNeili: {newCombatSkill.TotalObtainableNeili}"); Debug.Log($"ObtainedNeiliPerLoop: {newCombatSkill.ObtainedNeiliPerLoop}"); Debug.Log($"DestTypeWhileLooping: {newCombatSkill.DestTypeWhileLooping}"); Debug.Log($"TransferTypeWhileLooping: {newCombatSkill.TransferTypeWhileLooping}"); Debug.Log($"FiveElementChangePerLoop: {newCombatSkill.FiveElementChangePerLoop}"); Debug.Log($"MoveSpeed: {newCombatSkill.MoveSpeed}"); Debug.Log($"RecoveryOfFlaw: {newCombatSkill.RecoveryOfFlaw}"); Debug.Log($"CastSpeed: {newCombatSkill.CastSpeed}"); Debug.Log($"RecoveryOfBlockedAcupoint: {newCombatSkill.RecoveryOfBlockedAcupoint}"); Debug.Log($"WeaponSwitchSpeed: {newCombatSkill.WeaponSwitchSpeed}"); Debug.Log($"AttackSpeed: {newCombatSkill.AttackSpeed}"); Debug.Log($"InnerRatio: {newCombatSkill.InnerRatio}"); Debug.Log($"RecoveryOfQiDisorder: {newCombatSkill.RecoveryOfQiDisorder}"); Debug.Log($"AssetFileName: {newCombatSkill.AssetFileName}"); Debug.Log($"PrepareAnimation: {newCombatSkill.PrepareAnimation}"); Debug.Log($"CastAnimation: {newCombatSkill.CastAnimation}"); Debug.Log($"CastParticle: {newCombatSkill.CastParticle}"); Debug.Log($"PrepareTotalProgress: {newCombatSkill.PrepareTotalProgress}"); Debug.Log($"MobilityCost: {newCombatSkill.MobilityCost}"); Debug.Log($"BreathStanceTotalCost: {newCombatSkill.BreathStanceTotalCost}"); Debug.Log($"BaseInnerRatio: {newCombatSkill.BaseInnerRatio}"); Debug.Log($"InnerRatioChangeRange: {newCombatSkill.InnerRatioChangeRange}"); Debug.Log($"Penetrate: {newCombatSkill.Penetrate}"); Debug.Log($"DistanceAdditionWhenCast: {newCombatSkill.DistanceAdditionWhenCast}"); Debug.Log($"MostFittingWeaponID: {newCombatSkill.MostFittingWeaponID}"); Debug.Log($"TotalHit: {newCombatSkill.TotalHit}"); Debug.Log($"EquipmentBreakOdds: {newCombatSkill.EquipmentBreakOdds}"); // 假设 combatSkill 是一个全局变量或通过其他方式获取 Config.CombatSkill.Instance.AddExtraItem("MOD_MoreCombatSkill", "newCombatSkill", newCombatSkill); Debug.Log("New combat skill added successfully."); } private void AddSkillBook() { // 定义新技能书的属性 var newSkillBook = new SkillBookItem( 20000, // TemplateId 模板ID 1402, // Name 名称 10, // ItemType 物品类型 1001, // ItemSubType 物品子类型 8, // Grade 等级 693, // GroupId 组ID "icon_SkillBook_wanhuashisijian", // Icon 图标 1403, // Desc 描述 false, // Transferable 可转让 false, // Stackable 可堆叠 false, // Wagerable 可赌注 false, // Refinable 可精炼 false, // Poisonable 可中毒 false, // Repairable 可修复 9999, // MaxDurability 最大耐久度 0, // BaseWeight 基础重量 0, // BaseValue 基础价值 0, // BasePrice 基础价格 0, // MerchantLevel 商人等级 0, // BaseHappinessChange 基础幸福度变化 0, // BaseFavorabilityChange 基础好感度变化 0, // GiftLevel 礼物等级 false, // AllowRandomCreate 允许随机创建 0, // DropRate 掉落率 true, // IsSpecial 是否特殊 4, // ResourceType 资源类型 36, // PreservationDuration 保质期 -1, // LifeSkillType 生活技能类型 -1, // LifeSkillTemplateId 生活技能模板ID 7, // CombatSkillType 战斗技能类型 30000, // CombatSkillTemplateId 战斗技能模板ID 1860, // LegacyPoint 传承点 new List<short> { 44, 143 } // ReferenceBooksWithBonus 参考书籍加成 ); Debug.Log("Adding new skill book:"); Debug.Log($"TemplateId: {newSkillBook.TemplateId}"); Debug.Log($"Name: {newSkillBook.Name}"); Debug.Log($"Desc: {newSkillBook.Desc}"); Debug.Log($"Icon: {newSkillBook.Icon}"); Debug.Log($"ItemType: {newSkillBook.ItemType}"); Debug.Log($"ItemSubType: {newSkillBook.ItemSubType}"); Debug.Log($"Grade: {newSkillBook.Grade}"); Debug.Log($"GroupId: {newSkillBook.GroupId}"); Debug.Log($"Transferable: {newSkillBook.Transferable}"); Debug.Log($"Stackable: {newSkillBook.Stackable}"); Debug.Log($"Wagerable: {newSkillBook.Wagerable}"); Debug.Log($"Refinable: {newSkillBook.Refinable}"); Debug.Log($"Poisonable: {newSkillBook.Poisonable}"); Debug.Log($"Repairable: {newSkillBook.Repairable}"); Debug.Log($"MaxDurability: {newSkillBook.MaxDurability}"); Debug.Log($"BaseWeight: {newSkillBook.BaseWeight}"); Debug.Log($"BaseValue: {newSkillBook.BaseValue}"); Debug.Log($"BasePrice: {newSkillBook.BasePrice}"); Debug.Log($"MerchantLevel: {newSkillBook.MerchantLevel}"); Debug.Log($"BaseHappinessChange: {newSkillBook.BaseHappinessChange}"); Debug.Log($"BaseFavorabilityChange: {newSkillBook.BaseFavorabilityChange}"); Debug.Log($"GiftLevel: {newSkillBook.GiftLevel}"); Debug.Log($"AllowRandomCreate: {newSkillBook.AllowRandomCreate}"); Debug.Log($"DropRate: {newSkillBook.DropRate}"); Debug.Log($"IsSpecial: {newSkillBook.IsSpecial}"); Debug.Log($"ResourceType: {newSkillBook.ResourceType}"); Debug.Log($"PreservationDuration: {newSkillBook.PreservationDuration}"); Debug.Log($"LifeSkillType: {newSkillBook.LifeSkillType}"); Debug.Log($"LifeSkillTemplateId: {newSkillBook.LifeSkillTemplateId}"); Debug.Log($"CombatSkillType: {newSkillBook.CombatSkillType}"); Debug.Log($"CombatSkillTemplateId: {newSkillBook.CombatSkillTemplateId}"); Debug.Log($"LegacyPoint: {newSkillBook.LegacyPoint}"); Debug.Log($"ReferenceBooksWithBonus: {string.Join(", ", newSkillBook.ReferenceBooksWithBonus)}"); // 添加新的技能书 Config.SkillBook.Instance.AddExtraItem("MOD_MoreCombatSkill", "newSkillBook", newSkillBook); Debug.Log("New skill book added successfully."); } } }
//MoreCombatSkill.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Library</OutputType> <TargetFramework>net48</TargetFramework> </PropertyGroup> <ItemGroup> <Reference Include="Assembly-CSharp"> <HintPath>libs\Assembly-CSharp.dll</HintPath> </Reference> <Reference Include="HarmonyLib"> <HintPath>libs\0Harmony.dll</HintPath> </Reference> <Reference Include="TaiwuModdingLib"> <HintPath>libs\TaiwuModdingLib.dll</HintPath> </Reference> <Reference Include="UnityEngine.CoreModule"> <HintPath>libs\UnityEngine.CoreModule.dll</HintPath> </Reference> <Reference Include="UnityEngine"> <HintPath>libs\UnityEngine.dll</HintPath> </Reference> </ItemGroup> </Project>
//项目目录
添加的思路是什么?
游戏在前端初始化功法和功法书,然后CombatSkill和SkillBook类都提供了AddExtraItem()方法
所以只需要在mod加载之初分别调用Config.CombatSkill.Instance.AddExtraItem(xxx)
Config.SkillBook.Instance.AddExtraItem(xxx)即可
Instance为两个类都有的静态实例
这会用到功法和功法书的定义
CombatSkill
var newCombatSkill = new CombatSkillItem( 30000, // TemplateId 模板ID 1860, // Name 名称 1, // Grade 等级 0-8 1861, // Desc 描述 "sp_icon_combatskill_7_7", // Icon 图标 1, // EquipType 装备类型 7, // Type 类型 ECombatSkillSubType.Invalid, // SubType 子类型 1, // GridCost 格子消耗 0, // SectId 门派ID 1, // FiveElements 五行 20000, // BookId 书籍ID false, // CanObtainByAdventure 可通过冒险获得 true, // IsNonPublic 是否非公开 1, // OrderIdInSect 门派中的顺序ID new List<PropertyAndValue> // UsingRequirement 使用要求 { new PropertyAndValue(1, 1), new PropertyAndValue(5, 1), new PropertyAndValue(87, 1), new PropertyAndValue(54, 1), new PropertyAndValue(65, 1) }, 388, // DirectEffectID 直接效果ID 1114, // ReverseEffectID 反向效果ID 5, // InheritAttainmentAdiitionRate 继承成就加成率 1, // PracticeType 修炼类型 77, // BreakStart 破绽开始 293, // BreakEnd 破绽结束 true, // GoneMadInnerInjury 疯狂内伤 new List<sbyte> { 0, 1, 2, 3, 4, 5, 6 }, // GoneMadInjuredPart 疯狂受伤部位 3, // GoneMadInjuryValue 疯狂受伤值 500, // GoneMadQiDisorder 疯狂气乱 0, // TotalObtainableNeili 可获得的总内力 0, // ObtainedNeiliPerLoop 每回合获得的内力 -1, // DestTypeWhileLooping 循环时的目标类型 -1, // TransferTypeWhileLooping 循环时的转移类型 0, // FiveElementChangePerLoop 每回合五行变化 new sbyte[4], // SpecificGrids 特定格子 0, // GenericGrid 通用格子 new HitOrAvoidShorts(new short[4]), // HitValues 命中值 new HitOrAvoidShorts(new short[4]), // AvoidValues 闪避值 new OuterAndInnerShorts(0, 0), // Penetrations 穿透 new OuterAndInnerShorts(0, 0), // PenetrationResists 穿透抵抗 new OuterAndInnerShorts(0, 0), // RecoveryOfStanceAndBreath 姿态和呼吸恢复 0, // MoveSpeed 移动速度 0, // RecoveryOfFlaw 破绽恢复 0, // CastSpeed 施法速度 0, // RecoveryOfBlockedAcupoint 被封穴位恢复 0, // WeaponSwitchSpeed 武器切换速度 0, // AttackSpeed 攻击速度 0, // InnerRatio 内力比例 0, // RecoveryOfQiDisorder 气乱恢复 new PoisonShorts(new int[6]), // PoisonResists 毒抗 "70709", // AssetFileName 资源文件名 "C_707", // PrepareAnimation 准备动画 "S_70709", // CastAnimation 施法动画 "Particle_S_70709", // CastParticle 施法粒子效果 null, // CastPetAnimation 施法宠物动画 null, // CastPetParticle 施法宠物粒子效果 new short[] { 52, 52, 53, 54, 54 }, // DistanceWhenFourStepAnimation 四步动画时的距离 "se_skill_70709", // CastSoundEffect 施法音效 null, // PlayerCastBossSkillPrepareAni 玩家施放Boss技能准备动画 null, // PlayerCastBossSkillAni 玩家施放Boss技能动画 null, // PlayerCastBossSkillParticle 玩家施放Boss技能粒子效果 null, // PlayerCastBossSkillSound 玩家施放Boss技能音效 null, // PlayerCastBossSkillDistance 玩家施放Boss技能距离 21000, // PrepareTotalProgress 准备总进度 new List<sbyte> { 0 }, // NeedBodyPartTypes 需要的身体部位类型 0, // MobilityCost 机动性消耗 100, // BreathStanceTotalCost 呼吸姿态总消耗 100, // BaseInnerRatio 基础内力比例 15, // InnerRatioChangeRange 内力比例变化范围 840, // Penetrate 穿透 20, // DistanceAdditionWhenCast 施法时的距离加成 new List<NeedTrick> // TrickCost 诀窍消耗 { new NeedTrick(5, 4) }, 0, // WeaponDurableCost 武器耐久消耗 0, // WugCost 武功消耗 516, // MostFittingWeaponID 最适合的武器ID new sbyte[] { 30, 30, 1, 20, 20, 10, 10 }, // InjuryPartAtkRateDistribution 受伤部位攻击率分布 220, // TotalHit 总命中 new sbyte[4], // PerHitDamageRateDistribution 每次命中伤害率分布 false, // HasAtkAcupointEffect 是否有攻击穴位效果 false, // HasAtkFlawEffect 是否有攻击破绽效果 new PoisonsAndLevels(new short[12]), // Poisons 毒素 50, // EquipmentBreakOdds 装备破损几率 -1, // AddWugType 增加的武功类型 null, // AddBreakBodyFeature 增加的破体特性 0, // AddMoveSpeedOnCast 施法时增加的移动速度 0, // AddPercentMoveSpeedOnCast 施法时增加的移动速度百分比 0, // MoveCdBonus 移动冷却加成 new short[4], // AddHitOnCast 施法时增加的命中 36, // MobilityReduceSpeed 机动性降低速度 0, // MobilityAddSpeed 机动性增加速度 36, // MoveCostMobility 移动消耗机动性 -1, // MaxJumpDistance 最大跳跃距离 -1, // JumpPrepareFrame 跳跃准备帧 false, // CanPartlyJump 是否能部分跳跃 null, // JumpAni 跳跃动画 null, // JumpParticle 跳跃粒子效果 -1, // JumpChangeDistanceFrame 跳跃改变距离帧 -1, // JumpChangeDistanceDuration 跳跃改变距离持续时间 -1, // ScoreBonusType 分数加成类型 0, // ScoreBonus 分数加成 0, // AddOuterPenetrateResistOnCast 施法时增加的外部穿透抵抗 0, // AddInnerPenetrateResistOnCast 施法时增加的内部穿透抵抗 new short[4], // AddAvoidOnCast 施法时增加的闪避 0, // FightBackDamage 反击伤害 0, // BounceRateOfOuterInjury 外伤反弹率 0, // BounceRateOfInnerInjury 内伤反弹率 0, // ContinuousFrames 连续帧数 0, // BounceDistance 反弹距离 0, // RecoverBlockPercent 恢复格挡百分比 null, // DefendAnimation 防御动画 null, // DefendParticle 防御粒子效果 null, // DefendSound 防御音效 null, // FightBackAnimation 反击动画 null, // FightBackParticle 反击粒子效果 null, // FightBackSound 反击音效 new List<PropertyAndValue>(), // PropertyAddList 属性增加列表 new int[7], // OuterDamageSteps 外部伤害步骤 new int[7], // InnerDamageSteps 内部伤害步骤 0, // FatalDamageStep 致命伤害步骤 80, // MindDamageStep 心理伤害步骤 new List<sbyte>(), // PossibleQiArtStrategyList 可能的气功策略列表 new sbyte[5], // ExtraNeiliAllocationProgress 额外内力分配进度 new List<short>(), // LoopBonusSkillList 循环加成技能列表 -1 // QiArtStrategyGenerateProbability 气功策略生成概率 );
SkillBook
// 定义新技能书的属性 var newSkillBook = new SkillBookItem( 20000, // TemplateId 模板ID 1402, // Name 名称 10, // ItemType 物品类型 1001, // ItemSubType 物品子类型 8, // Grade 等级 693, // GroupId 组ID "icon_SkillBook_wanhuashisijian", // Icon 图标 1403, // Desc 描述 false, // Transferable 可转让 false, // Stackable 可堆叠 false, // Wagerable 可赌注 false, // Refinable 可精炼 false, // Poisonable 可中毒 false, // Repairable 可修复 9999, // MaxDurability 最大耐久度 0, // BaseWeight 基础重量 0, // BaseValue 基础价值 0, // BasePrice 基础价格 0, // MerchantLevel 商人等级 0, // BaseHappinessChange 基础幸福度变化 0, // BaseFavorabilityChange 基础好感度变化 0, // GiftLevel 礼物等级 false, // AllowRandomCreate 允许随机创建 0, // DropRate 掉落率 true, // IsSpecial 是否特殊 4, // ResourceType 资源类型 36, // PreservationDuration 保质期 -1, // LifeSkillType 生活技能类型 -1, // LifeSkillTemplateId 生活技能模板ID 7, // CombatSkillType 战斗技能类型 30000, // CombatSkillTemplateId 战斗技能模板ID 1860, // LegacyPoint 传承点 new List<short> { 44, 143 } // ReferenceBooksWithBonus 参考书籍加成 );
AddExtraItem
以CombatSkill的定义为例
public int AddExtraItem(string identifier, string refName, object configItem) { CombatSkillItem item = (CombatSkillItem)configItem; int id = (int)item.TemplateId; bool flag = id < this._dataArray.Count; if (flag) { throw new Exception(string.Format("CombatSkill template id {0} created by {1} already exist.", item.TemplateId, identifier)); } bool flag2 = this._extraDataMap.ContainsKey(id); if (flag2) { throw new Exception(string.Format("CombatSkill extra template id {0} created by {1} already exist.", item.TemplateId, identifier)); } int refId; bool flag3 = this._refNameMap.TryGetValue(refName, out refId); if (flag3) { throw new Exception(string.Format("CombatSkill template reference name {0}(id = {1}) created by {2} already exist with templateId {3}).", new object[] { refName, item.TemplateId, identifier, refId })); } this._refNameMap.Add(refName, id); this._extraDataMap.Add(id, item); return id; }
EventManager
使用官方的事件编辑器
提供物品是AddItemToRole方法
然后如何触发事件?先Check 在OnClicked Enter 类似Qt的信号槽机制
Last but not least,编译导出和放入Mod时候要编写Lua设置
dotnet build 编译的dll会在bin里
Lua设置要写前后端