Open Sources

This commit is contained in:
2022-05-07 21:24:57 +08:00
parent 8470654472
commit c6c6cab1b3
64 changed files with 40533 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GrasscutterTools.Game
{
internal enum ClimateType
{
/// <summary>
/// 无
/// </summary>
None,
/// <summary>
/// 晴天
/// </summary>
Sunny,
/// <summary>
/// 多云
/// </summary>
Cloudy,
/// <summary>
/// 雨
/// </summary>
Rain,
/// <summary>
/// 雷暴
/// </summary>
Thunderstorm,
/// <summary>
/// 雪
/// </summary>
Snow,
/// <summary>
/// 雾
/// </summary>
Mist
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GrasscutterTools.Game.Gacha
{
public enum BannerType
{
STANDARD, EVENT, WEAPON
}
}

View File

@@ -0,0 +1,122 @@
using System.ComponentModel;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace GrasscutterTools.Game.Gacha
{
/// <summary>
/// 使用这个只需替换掉你原来的的data/banner.json文件
/// 然后重启服务器和客户端,即可享受全卡池抽卡,卡池的选择方式是点击左右箭头进行切换
/// </summary>
public class GachaBanner
{
/// <summary>
/// 添加卡池请从400开始增加id数值进行添加这个id需要每个池子不一样
/// 如果你想添加大量卡池请按照每次增加固定数值的id进行添加比如411412413....
/// </summary>
[JsonProperty("gachaType")]
public int GachaType { get; set; }
/// <summary>
/// 这个id需要每个池子不一样如果你想添加大量卡池
/// 请按照每次增加固定数值的id进行添加,比如210022002300....
/// </summary>
[JsonProperty("scheduleId")]
public int ScheduleId { get; set; }
/// <summary>
/// 这个有3种类型standard表示常驻池event表示限时角色祈愿池
/// weapon表示限时武器祈愿池选择一种类型的卡池
/// </summary>
[JsonProperty("bannerType", DefaultValueHandling = DefaultValueHandling.Include), JsonConverter(typeof(StringEnumConverter))]
public BannerType BannerType { get; set; }
/// <summary>
/// 这个是卡池的预制路径id
/// </summary>
[JsonProperty("prefabPath")]
public string PrefabPath { get; set; }
/// <summary>
/// 这个是抽卡的预览背景路径id
/// </summary>
[JsonProperty("previewPrefabPath")]
public string PreviewPrefabPath { get; set; }
/// <summary>
/// 这个是抽卡的标题路径id有可能与之前两项的id不同
/// 一般这3项的id只需保持一致即可就是A0xxxx为同一id
/// </summary>
[JsonProperty("titlePath")]
public string TitlePath { get; set; }
/// <summary>
/// 这个表示祈愿用的道具224是相遇之缘223是纠缠之缘 - 选择一个作为该卡池的抽卡道具
/// (提示请不要随便修改祈愿道具除了蓝球和粉球有可能会引发bug比如修改成摩拉抽卡可能导致卡住)
/// </summary>
[JsonProperty("costItem")]
public int CostItem { get; set; }
/// <summary>
/// 祈愿什么时候开始默认设置为0
/// </summary>
[JsonProperty("beginTime")]
public int BeginTime { get; set; } = 0;
/// <summary>
/// 这个卡池持续多长时间(默认为这个极大的数字)
/// </summary>
[JsonProperty("endTime")]
public int EndTime { get; set; } = 1924992000;
/// <summary>
/// 暂时未搞清楚功能,可能与卡池在屏幕的左右顺序有关
/// </summary>
[JsonProperty("sortId")]
public int SortId { get; set; }
/// <summary>
/// 通常为5星的up角色或物品可修改可添加查看gm手册可修改为任意角色或者物品
/// </summary>
[JsonProperty("rateUpItems1")]
public int[] RateUpItems1 { get; set; }
/// <summary>
/// 通常为4星的up物品或者角色(可修改可添加查看gm手册可修改为任意角色或者物品)
/// </summary>
[JsonProperty("rateUpItems2")]
public int[] RateUpItems2 { get; set; }
/// <summary>
/// 5星概率(0~10000)
/// </summary>
[JsonProperty("baseYellowWeight", DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(60)]
public int BaseYellowWeight { get; set; } = 60; // Max 10000
/// <summary>
/// 4星概率(0~10000)
/// </summary>
[JsonProperty("basePurpleWeight", DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(510)]
public int BasePurpleWeight { get; set; } = 510; // Max 10000
/// <summary>
/// 事件概率抽中后摇1~100随机数如果大于该值则抽中up池
/// </summary>
[JsonProperty("eventChance", DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(50)]
public int EventChance { get; set; } = 50; // Chance to win a featured event item
/// <summary>
/// 软保底失败多少次开始提升抽中概率在这之上每失败一次概率增加1%
/// </summary>
[JsonProperty("softPity", DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(75)]
public int SoftPity { get; set; } = 75;
/// <summary>
/// 硬保底(失败多少次必出)
/// </summary>
[JsonProperty("hardPity", DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(90)]
public int HardPity { get; set; } = 90;
}
}

View File

@@ -0,0 +1,15 @@
namespace GrasscutterTools.Game
{
public class GameCommand
{
public GameCommand(string name, string command)
{
Name=name;
Command=command;
}
public string Name { get; set; }
public string Command { get; set; }
}
}

View File

@@ -0,0 +1,54 @@
using GrasscutterTools.Properties;
namespace GrasscutterTools.Game
{
internal static class GameData
{
public static void LoadResources()
{
Animals = new ItemMap(Resources.Animal);
Artifacts = new ItemMap(Resources.Artifact);
ArtifactCats = new ItemMap(Resources.ArtifactCat);
ArtifactMainAttribution = new ItemMap(Resources.ArtifactMainAttribution);
ArtifactSubAttribution = new ItemMap(Resources.ArtifactSubAttribution);
Avatars = new ItemMap(Resources.Avatar);
AvatarColors = new ItemMap(Resources.AvatarColor);
Items = new ItemMap(Resources.Item);
Monsters = new ItemMap(Resources.Monster);
NPCs = new ItemMap(Resources.NPC);
Scenes = new ItemMap(Resources.Scene);
Weapons = new ItemMap(Resources.Weapon);
WeaponColors = new ItemMap(Resources.WeaponColor);
Ornaments = new ItemMap(Resources.Ornament);
}
public static ItemMap Animals { get; private set; }
public static ItemMap Artifacts { get; private set; }
public static ItemMap ArtifactCats { get; private set; }
public static ItemMap ArtifactMainAttribution { get; private set; }
public static ItemMap ArtifactSubAttribution { get; private set; }
public static ItemMap Avatars { get; private set; }
public static ItemMap AvatarColors { get; private set; }
public static ItemMap Items { get; private set; }
public static ItemMap Monsters { get; private set; }
public static ItemMap NPCs { get; private set; }
public static ItemMap Scenes { get; private set; }
public static ItemMap Weapons { get; private set; }
public static ItemMap WeaponColors { get; private set; }
public static ItemMap Ornaments { get; private set; }
}
}

View File

@@ -0,0 +1,57 @@
using System.Collections.Generic;
namespace GrasscutterTools.Game
{
public class ItemMap
{
public ItemMap(string idNamePairs)
{
var lines = idNamePairs.Split('\n');
var capacity = lines.Length;
//IdMap = new Dictionary<int, string>(capacity);
//NameMap = new Dictionary<string, int>(capacity);
var IdList = new List<int>(capacity);
var NameList = new List<string>(capacity);
var lineList = new List<string>(capacity);
foreach (var line in lines)
{
var si = line.IndexOf(':');
if (si > 0 && int.TryParse(line.Substring(0, si).Trim(), out int id))
{
var name = line.Substring(si+1).Trim();
if (!string.IsNullOrEmpty(name))
{
//IdMap[id] = name;
//NameMap[name] = id;
IdList.Add(id);
NameList.Add(name);
lineList.Add(line);
}
}
}
Ids = IdList.ToArray();
Names = NameList.ToArray();
Lines = lineList.ToArray();
}
//Dictionary<int, string> IdMap;
//Dictionary<string, int> NameMap;
//List<int> IdList;
//List<string> NameList;
public int Count => Ids.Length;
//public string this[int id] => IdMap[id];
//public int this[string name] => NameMap[name];
public int[] Ids { get; }
public string[] Names { get; }
public string[] Lines { get; }
}
}

View File

@@ -0,0 +1,79 @@
using System.Collections.Generic;
namespace GrasscutterTools.Game
{
internal static class SetStatsCommand
{
public class Stat
{
public Stat(string name, string argName, bool percent, string tip = "")
{
Name=name;
ArgName=argName;
Percent=percent;
Tip = tip;
}
/// <summary>
/// 属性名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 参数名
/// </summary>
public string ArgName { get; set; }
/// <summary>
/// 是否百分比
/// </summary>
public bool Percent { get; set; }
/// <summary>
/// 提示
/// </summary>
public string Tip { get; set; }
}
public static List<Stat> Stats { get; set; }
static SetStatsCommand()
{
Stats = new List<Stat>
{
new Stat("最大生命值", "maxhp", false),
new Stat("当前生命值", "hp", false),
new Stat("当前攻击力", "atk", false),
new Stat("基础攻击力", "atkb", false, "这似乎不会重新计算攻击力可能只对buff类有效。"),
new Stat("防御力", "def", false),
new Stat("元素精通", "em", false),
new Stat("元素充能效率", "er", true),
new Stat("暴击率", "crate", true),
new Stat("暴击伤害", "cdmg", true),
new Stat("伤害加成", "dmg", true, "这似乎在攻击后被重置"),
new Stat("风元素伤害加成", "eanemo", true),
new Stat("冰元素伤害加成", "ecryo", true),
new Stat("草元素伤害加成", "edendro", true),
new Stat("雷元素伤害加成", "eelectro", true),
new Stat("土元素伤害加成", "egeo", true),
new Stat("水元素伤害加成", "ehydro", true),
new Stat("火元素伤害加成", "epyro", true),
new Stat("物理伤害加成", "ephys", true),
new Stat("伤害减免", "resall", true, "这似乎在攻击后被重置"),
new Stat("风元素伤害减免", "resanemo", true),
new Stat("冰元素伤害减免", "rescryo", true),
new Stat("草元素伤害减免", "resdendro", true),
new Stat("雷元素伤害减免", "reselectro", true),
new Stat("土元素伤害减免", "resgeo", true),
new Stat("水元素伤害减免", "reshydro", true),
new Stat("火元素伤害减免", "respyro", true),
new Stat("物理伤害减免", "resphys", true),
new Stat("冷却缩减", "cdr", true),
new Stat("治疗加成", "heal", true),
new Stat("受治疗加成", "heali", true),
new Stat("护盾强效","shield", true),
new Stat("忽略防御", "defi", true),
};
}
}
}