Skip to content

Commit 776cb08

Browse files
committed
dust765_x_tazuo
thanks to https://github.com/bittiez/ClassicUO for doing most work TazUO on b7d63e1
1 parent b4d2e7f commit 776cb08

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+6021
-155
lines changed

.github/workflows/deploy.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Deploy
33
on:
44
workflow_dispatch:
55
workflow_run:
6-
branches: [dev_dust765]
6+
branches: [dev_dust765_x_tazuo]
77
workflows: [Build-Test]
88
types:
99
- completed
@@ -13,7 +13,7 @@ env:
1313
CUO_ASSEMBLY_VERSION: '0.1.11.${{ github.run_number }}'
1414
CUO_OUTPUT_PATH: '../../bin/dist'
1515
CUO_PROJECT_PATH: "src/ClassicUO.Client/ClassicUO.Client.csproj"
16-
CUO_ZIP_NAME: "ClassicUO-dev-dust765.zip"
16+
CUO_ZIP_NAME: "ClassicUO-dev-dust765-x-tazuo.zip"
1717

1818
DOTNET_NOLOGO: false
1919
DOTNET_CLI_TELEMETRY_OPTOUT: 1
@@ -31,7 +31,7 @@ jobs:
3131
steps:
3232
- uses: actions/checkout@v3
3333
with:
34-
ref: dev_dust765
34+
ref: dev_dust765_x_tazuo
3535

3636
- name: Get submodules
3737
run: |
@@ -56,7 +56,7 @@ jobs:
5656
exclusions: 'ClassicUO.exe.config'
5757

5858
- name: Create manifest
59-
run: dotnet run --project tools/ManifestCreator/ManifestCreator.csproj "${{ env.CUO_OUTPUT_PATH }}" "dev-dust765" "${{ env.CUO_ZIP_NAME }}"
59+
run: dotnet run --project tools/ManifestCreator/ManifestCreator.csproj "${{ env.CUO_OUTPUT_PATH }}" "dev-dust765-x-tazuo" "${{ env.CUO_ZIP_NAME }}"
6060

6161
- name: Move output
6262
run: |
@@ -68,16 +68,16 @@ jobs:
6868
uses: dev-drprasad/delete-tag-and-release@v0.2.1
6969
with:
7070
delete_release: true
71-
tag_name: ClassicUO-dev-dust765-release
71+
tag_name: ClassicUO-dev-dust765-x-tazuo-release
7272
env:
7373
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7474

7575
- name: Upload Release
7676
uses: ncipollo/release-action@v1
7777
with:
7878
artifacts: "upload/${{ env.CUO_ZIP_NAME }}"
79-
name: '0.1.11.${{ github.run_number }} dev_dust765'
79+
name: '0.1.11.${{ github.run_number }} dev_dust765_x_tazuo'
8080
body: 'This build may not be safe: use it at your own risk.'
8181
prerelease: true
82-
tag: ClassicUO-dev-dust765-release
82+
tag: ClassicUO-dev-dust765-x-tazuo-release
8383
token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,36 @@ This project is to address a problem constructed within the toxicity of this com
1212

1313
![dust765_logo](https://user-images.githubusercontent.com/77043734/209156140-14558d04-eaf9-42f0-9939-ddec9cf6c1ac.png)
1414

15+
# Featuring TazUO
16+
17+
check the great Github of [TazUO](https://github.com/bittiez/ClassicUO)
18+
19+
Join TazUO's discord for ideas/support/updates -> https://discord.gg/SqwtB5g95H
20+
21+
This version of CUO adds [grid containers](../../wiki/TazUO.Grid-Containers) to the regular CUO client
22+
23+
Searchable
24+
25+
Resizable
26+
27+
Scrollable
28+
29+
Can lock items in specific place
30+
31+
Quick preview for containers inside *if the client has already cached that bag*
32+
33+
Item scaling!
34+
35+
[Cool down bars](../../wiki/TazUO.Cooldown-bars)
36+
37+
[Follow mode improvements](../../wiki/TazUO.Follow-mode)
38+
39+
[Improved journal](../../wiki/TazUO.Journal)
40+
41+
[Nameplate healthbars](../../wiki/TazUO.Nameplate-Healthbars)
42+
43+
And others in our [wiki](../../wiki)
44+
1545
# contact and team info
1646

1747
Discord: dust765#2787

src/ClassicUO.Assets/ArtLoader.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private bool LoadData(Span<uint> data, int g, out short width, out short height,
210210
* into every pixel in 'data'. We must zero the buffer here since it is
211211
* re-used. But we only have to zero out the (width * height) worth.
212212
*/
213-
data.Slice(0, (width * height)).Fill(0);
213+
data.Slice(0, (width * height)).Fill(0);
214214

215215
ushort fixedGraphic = (ushort)(g - 0x4000);
216216

@@ -301,6 +301,15 @@ public Texture2D GetStaticTexture(uint g, out Rectangle bounds)
301301
{
302302
g += 0x4000;
303303

304+
// ## BEGIN - END ## // TAZUO
305+
Texture2D png = PNGLoader.LoadArtTexture(g);
306+
if (png != null)
307+
{
308+
bounds = png.Bounds;
309+
return png;
310+
}
311+
// ## BEGIN - END ## // TAZUO
312+
304313
ref var spriteInfo = ref _spriteInfos[g];
305314

306315
if (spriteInfo.Texture == null)

src/ClassicUO.Assets/GumpsLoader.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ struct SpriteInfo
160160

161161
public Texture2D GetGumpTexture(uint g, out Rectangle bounds)
162162
{
163+
// ## BEGIN - END ## // TAZUO
164+
Texture2D png = PNGLoader.LoadGumpTexture(g);
165+
if (png != null)
166+
{
167+
bounds = png.Bounds;
168+
return png;
169+
}
170+
// ## BEGIN - END ## // TAZUO
171+
163172
ref var spriteInfo = ref _spriteInfos[g];
164173

165174
if (spriteInfo.Texture == null)
@@ -247,12 +256,12 @@ private unsafe void AddSpriteToAtlas(TextureAtlas atlas, uint index)
247256
if (buffer != null)
248257
{
249258
System.Buffers.ArrayPool<uint>.Shared.Return(buffer, true);
250-
}
259+
}
251260
}
252261
}
253262

254263

255-
264+
256265
public bool PixelCheck(int index, int x, int y)
257266
{
258267
return _picker.Get((ulong) index, x, y);

src/ClassicUO.Assets/PNGLoader.cs

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
using ClassicUO.IO;
2+
using Microsoft.Xna.Framework;
3+
using Microsoft.Xna.Framework.Graphics;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.IO;
7+
using System.Linq;
8+
using System.Threading.Tasks;
9+
10+
namespace ClassicUO.Assets
11+
{
12+
public static class PNGLoader
13+
{
14+
private const string IMAGES_FOLDER = "ExternalImages", GUMP_EXTERNAL_FOLDER = "gumps", ART_EXTERNAL_FOLDER = "art";
15+
16+
private static string exePath;
17+
18+
private static uint[] gump_availableIDs;
19+
private static Dictionary<uint, Texture2D> gump_textureCache = new Dictionary<uint, Texture2D>();
20+
21+
private static uint[] art_availableIDs;
22+
private static Dictionary<uint, Texture2D> art_textureCache = new Dictionary<uint, Texture2D>();
23+
24+
public static GraphicsDevice GraphicsDevice { set; get; }
25+
26+
public static Texture2D GetImageTexture(string fullImagePath)
27+
{
28+
Texture2D texture = null;
29+
30+
if (GraphicsDevice != null && File.Exists(fullImagePath))
31+
{
32+
FileStream titleStream = File.OpenRead(fullImagePath);
33+
texture = Texture2D.FromStream(GraphicsDevice, titleStream);
34+
titleStream.Close();
35+
Color[] buffer = new Color[texture.Width * texture.Height];
36+
texture.GetData(buffer);
37+
for (int i = 0; i < buffer.Length; i++)
38+
buffer[i] = Color.FromNonPremultiplied(buffer[i].R, buffer[i].G, buffer[i].B, buffer[i].A);
39+
texture.SetData(buffer);
40+
}
41+
42+
return texture;
43+
}
44+
45+
public static Texture2D LoadGumpTexture(uint graphic)
46+
{
47+
Texture2D texture;
48+
49+
if (gump_availableIDs == null)
50+
return null;
51+
52+
int index = Array.IndexOf(gump_availableIDs, graphic);
53+
if (index == -1) return null;
54+
55+
gump_textureCache.TryGetValue(graphic, out texture);
56+
57+
if (exePath != null && texture == null && GraphicsDevice != null)
58+
{
59+
string fullImagePath = Path.Combine(exePath, IMAGES_FOLDER, GUMP_EXTERNAL_FOLDER, ((int)graphic).ToString() + ".png");
60+
61+
if (File.Exists(fullImagePath))
62+
{
63+
FileStream titleStream = File.OpenRead(fullImagePath);
64+
texture = Texture2D.FromStream(GraphicsDevice, titleStream);
65+
titleStream.Close();
66+
Color[] buffer = new Color[texture.Width * texture.Height];
67+
texture.GetData(buffer);
68+
for (int i = 0; i < buffer.Length; i++)
69+
buffer[i] = Color.FromNonPremultiplied(buffer[i].R, buffer[i].G, buffer[i].B, buffer[i].A);
70+
texture.SetData(buffer);
71+
72+
gump_textureCache.Add(graphic, texture);
73+
}
74+
}
75+
76+
return texture;
77+
}
78+
79+
public static Texture2D LoadArtTexture(uint graphic)
80+
{
81+
Texture2D texture;
82+
83+
if (art_availableIDs == null)
84+
return null;
85+
86+
int index = Array.IndexOf(art_availableIDs, graphic);
87+
if (index == -1) return null;
88+
89+
art_textureCache.TryGetValue(graphic, out texture);
90+
91+
if (exePath != null && texture == null && GraphicsDevice != null)
92+
{
93+
string fullImagePath = Path.Combine(exePath, IMAGES_FOLDER, ART_EXTERNAL_FOLDER, ((int)graphic).ToString() + ".png");
94+
95+
if (File.Exists(fullImagePath))
96+
{
97+
FileStream titleStream = File.OpenRead(fullImagePath);
98+
texture = Texture2D.FromStream(GraphicsDevice, titleStream);
99+
titleStream.Close();
100+
Color[] buffer = new Color[texture.Width * texture.Height];
101+
texture.GetData(buffer);
102+
for (int i = 0; i < buffer.Length; i++)
103+
buffer[i] = Color.FromNonPremultiplied(buffer[i].R, buffer[i].G, buffer[i].B, buffer[i].A);
104+
texture.SetData(buffer);
105+
106+
art_textureCache.Add(graphic, texture);
107+
}
108+
}
109+
110+
return texture;
111+
}
112+
113+
public static Task Load()
114+
{
115+
return Task.Run
116+
(() =>
117+
{
118+
string strExeFilePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
119+
exePath = Path.GetDirectoryName(strExeFilePath);
120+
121+
string gumpPath = Path.Combine(exePath, IMAGES_FOLDER, GUMP_EXTERNAL_FOLDER);
122+
if (Directory.Exists(gumpPath))
123+
{
124+
string[] files = Directory.GetFiles(gumpPath, "*.png", SearchOption.TopDirectoryOnly);
125+
gump_availableIDs = new uint[files.Length];
126+
127+
for (int i = 0; i < files.Length; i++)
128+
{
129+
string fname = Path.GetFileName(files[i]);
130+
uint.TryParse(fname.Substring(0, fname.Length - 4), out gump_availableIDs[i]);
131+
}
132+
}
133+
134+
string artPath = Path.Combine(exePath, IMAGES_FOLDER, ART_EXTERNAL_FOLDER);
135+
if (Directory.Exists(artPath))
136+
{
137+
string[] files = Directory.GetFiles(artPath, "*.png", SearchOption.TopDirectoryOnly);
138+
art_availableIDs = new uint[files.Length];
139+
140+
for (int i = 0; i < files.Length; i++)
141+
{
142+
string fname = Path.GetFileName(files[i]);
143+
uint.TryParse(fname.Substring(0, fname.Length - 4), out art_availableIDs[i]);
144+
}
145+
}
146+
});
147+
}
148+
}
149+
}

src/ClassicUO.Assets/UOFileManager.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,17 @@ public static void Load(ClientVersion version, string basePath, bool useVerdata,
114114
SpeechesLoader.Instance.Load(),
115115
LightsLoader.Instance.Load(),
116116
SoundsLoader.Instance.Load(),
117-
MultiMapLoader.Instance.Load()
117+
MultiMapLoader.Instance.Load(),
118+
// ## BEGIN - END ## // TAZUO
119+
PNGLoader.Load()
120+
// ## BEGIN - END ## // TAZUO
118121
};
119122

120-
if (!Task.WhenAll(tasks).Wait(TimeSpan.FromSeconds(10)))
123+
// ## BEGIN - END ## // TAZUO
124+
//if (!Task.WhenAll(tasks).Wait(TimeSpan.FromSeconds(10)))
125+
// ## BEGIN - END ## // TAZUO
126+
if (!Task.WhenAll(tasks).Wait(TimeSpan.FromSeconds(15)))
127+
// ## BEGIN - END ## // TAZUO
121128
{
122129
Log.Panic("Loading files timeout.");
123130
}

0 commit comments

Comments
 (0)