Skip to content

Commit

Permalink
Merge pull request #7 from PCL-Community/Silverteal-commits
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
Silverteal authored Jun 14, 2024
2 parents f5c2a5b + e1d7267 commit f90ca12
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 63 deletions.
73 changes: 19 additions & 54 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,47 @@
# 定义工作流名称
name: 编译 PCL
name: Build

# 定义触发器
on:
# 提交内容修改代码或编辑工作流时
push:
paths:
- 'Plain Craft Launcher 2/**'
- '.github/workflows/**'
# 新的PR修改代码或编辑工作流时
pull_request:
paths:
- 'Plain Craft Launcher 2/**'
- '.github/workflows/**'
# 手动触发时
workflow_dispatch:

# 定义工作列表
jobs:
# 唯一的工作:build

build:

strategy:
# 定义矩阵,矩阵中每组都会单独执行,并使矩阵本身成为可用的上下文
# 由于一些奇葩的原因,Artifacts使用中文作为名称会导致它无法被下载,因此此处使用英文名。
# 或许后续可以试着直接发Release?
matrix:
include:
- name: 'Debug with symbols'
configuration: Debug
- name: 'Debug'
configuration: Snapshot
- name: 'Snapshot'
configuration: Release
- name: 'Snapshot from update'
configuration: ReleaseUpdate
- name: 'Release'
configuration: BETA

# 显然,只有Windows才能构建.NET Framework程序

strategy:
matrix:
configuration: [Debug, Release, Snapshot, BETA, ReleaseUpdate]

runs-on: windows-latest

# 定义步骤列表
steps:

# 第一步,签出仓库到本地
- name: 签出仓库
# 调用actions/checkout仓库的调用预设工作流
- name: Checkout
uses: actions/checkout@v4
# 调用参数
with:
# 只签出第一层
fetch-depth: 0

# 第二步,配置生成工具
- name: 配置 MSBuild
- name: Set Describe
shell: bash
run: |
Describe=`git describe --tags`
echo "Describe=$Describe" >> $GITHUB_ENV
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
with:
# 生成工具使用64位架构
msbuild-architecture: x64

# 第三步,编译
- name: 编译源代码
# 直接运行Powershell命令
# ${{}}括号内的是工作流表达式,此处即当前运行的矩阵的参数,运行时将直接替换
# $env:是Powershell读取环境变量的语法
run: msbuild $env:Project_Path /p:Configuration=${{ matrix.configuration }}
env:
# 设置单个步骤的环境变量
# 由于路径包含空格,使用环境变量传入路径,避免令人疑惑的引号写法
Project_Path: Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj
- name: Build
run: msbuild "Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj" -p:Configuration=${{ matrix.configuration }}

# 第四步,打包并上传编译产物到Artifacts
- name: 打包并上传编译产物
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
# Artifact压缩包名称,此处命名为友好名称
name: ${{ matrix.name }}
# 将要上传的对象,将被压缩为Artifact压缩包
name: ${{ matrix.configuration }} ${{ env.Describe }}
path: Plain Craft Launcher 2\obj\${{ matrix.configuration }}\Plain Craft Launcher 2.exe

2 changes: 1 addition & 1 deletion Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ SystemBrowser:
'自定义
Do Until McSkinSex(Uuid) = If(Setup.Get("LaunchSkinSlim"), "Alex", "Steve")
If Uuid.EndsWithF("FFFFF") Then Uuid = Mid(Uuid, 1, 32 - 5) & "00000"
Uuid = Mid(Uuid, 1, 32 - 5) & (Long.Parse(Right(Uuid, 5), Globalization.NumberStyles.AllowHexSpecifier) + 1).ToString("X")
Uuid = Mid(Uuid, 1, 32 - 5) & (Long.Parse(Right(Uuid, 5), Globalization.NumberStyles.AllowHexSpecifier) + 1).ToString("X").PadLeft(5, "0")
Loop
Case 5 '每次都询问
Uuid = Uuid.ToLower()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<local:MyRadioBox Text="Alex(当前版本不支持)" x:Name="RadioSkinType2" Tag="LaunchSkinType/2" Grid.Column="3" IsEnabled="False" Visibility="Collapsed" />
<local:MyRadioBox Text="正版玩家" x:Name="RadioSkinType3" Tag="LaunchSkinType/3" Grid.Column="1" ToolTip="使用指定正版玩家的 UUID 登录" />
<local:MyRadioBox Text="启动时询问" x:Name="RadioSkinType5" Tag="LaunchSkinType/5" Grid.Column="2" ToolTip="每次启动时询问需要使用到 UUID" />
<local:MyRadioBox Text="自定义皮肤" x:Name="RadioSkinType4" Tag="LaunchSkinType/4" Grid.Column="3" ToolTip="使用默认 UUID 的同时以资源包的形式加载自定义皮肤。&#xa;使用此方式更换的皮肤在多人游戏中仅自己可见,且会替换游戏中所有的该角色。" />
<local:MyRadioBox Text="自定义(当前版本不支持)" x:Name="RadioSkinType4" Tag="LaunchSkinType/4" Grid.Column="3" IsEnabled="False" Visibility="Collapsed" ToolTip="使用默认 UUID 的同时以资源包的形式加载自定义皮肤。&#xa;使用此方式更换的皮肤在多人游戏中仅自己可见,且会替换游戏中所有的该角色。" />
</Grid>
<Grid x:Name="PanSkinID" Margin="0,14,0,2" Visibility="Collapsed">
<Grid.ColumnDefinitions>
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
`默认` UUID 的生成函数大致如下(位于`ModLaunch.vb`):
```vb
Public Function McLoginLegacyUuid(Name As String)
Dim NameHash As String = GetStringMD5("OfflinePlayer:" & Name)
Dim PendingVariant As Integer = Conversion.Val("&H" & NameHash(16))
PendingVariant = (PendingVariant Mod 4) + 8
Dim FinalVarient As String = PendingVariant.ToString("x")
Dim FinalUuid As String = (NameHash.Substring(0, 12) & "3" & NameHash.Substring(13, 3) & FinalVarient & NameHash.Substring(17, 15)).ToLower()
Return FinalUuid
End Function
Dim NameHash As String = GetStringMD5("OfflinePlayer:" & Name)
Dim PendingVariant As Integer = Conversion.Val("&H" & NameHash(16))
PendingVariant = (PendingVariant Mod 4) + 8
Dim FinalVarient As String = PendingVariant.ToString("x")
Dim FinalUuid As String = (NameHash.Substring(0, 12) & "3" & NameHash.Substring(13, 3) & FinalVarient & NameHash.Substring(17, 15)).ToLower()
Return FinalUuid
End Function
```

## 杂项
Expand Down

0 comments on commit f90ca12

Please sign in to comment.