Skip to content

Commit aecc433

Browse files
committed
Initial
0 parents  commit aecc433

File tree

10 files changed

+964
-0
lines changed

10 files changed

+964
-0
lines changed

.github/workflows/release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Create release directory
21+
run: |
22+
mkdir -p release/injector
23+
24+
- name: Download packet definitions
25+
run: |
26+
wget -O release/injector/c2s.lua https://github.com/sruon/XiPackets-definitions/releases/download/latest/c2s.lua
27+
wget -O release/injector/s2c.lua https://github.com/sruon/XiPackets-definitions/releases/download/latest/s2c.lua
28+
29+
- name: Copy addon files to release directory
30+
run: |
31+
cp *.lua release/injector/
32+
cp -r fields release/injector/
33+
34+
- name: Create zip archive
35+
run: |
36+
cd release
37+
zip -r injector.zip injector/
38+
39+
- name: Create Release
40+
uses: actions/create-release@v1
41+
id: create_release
42+
with:
43+
tag_name: ${{ github.run_number }}
44+
release_name: Release ${{ github.run_number }}
45+
draft: false
46+
prerelease: false
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Upload Release Asset
51+
uses: actions/upload-release-asset@v1
52+
with:
53+
upload_url: ${{ steps.create_release.outputs.upload_url }}
54+
asset_path: ./release/injector.zip
55+
asset_name: injector.zip
56+
asset_content_type: application/zip
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Compiled Lua sources
2+
luac.out
3+
4+
# luarocks build files
5+
*.src.rock
6+
*.zip
7+
*.tar.gz
8+
9+
# Object files
10+
*.o
11+
*.os
12+
*.ko
13+
*.obj
14+
*.elf
15+
16+
# Precompiled Headers
17+
*.gch
18+
*.pch
19+
20+
# Libraries
21+
*.lib
22+
*.a
23+
*.la
24+
*.lo
25+
*.def
26+
*.exp
27+
28+
# Shared objects (inc. Windows DLLs)
29+
*.dll
30+
*.so
31+
*.so.*
32+
*.dylib
33+
34+
# Executables
35+
*.exe
36+
*.out
37+
*.app
38+
*.i*86
39+
*.x86_64
40+
*.hex
41+
42+
c2s.lua
43+
s2c.lua

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 sruon
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Ashita-Injector
2+
3+
Inject FFXI packets through an ImgUi form.
4+
5+
## Must read
6+
- Will **100% get you banned** from Retail or the PServer you're playing on.
7+
- Will **100% crash your client** if using bad values.
8+
- Not everything is guaranteed to work
9+
- Unions are not supported
10+
11+
## Getting started
12+
Download the [latest release](https://github.com/sruon/Ashita-Injector/releases).
13+
14+
Do not use a clone of this repository as only the releases contain the necessary definitions from [XiPackets-definitions](https://github.com/sruon/XiPackets-definitions/releases/tag/latest)
15+
16+
Decompress in your Ashita v4 `addons` folder.
17+
18+
```
19+
/addon load injector
20+
```
21+
22+
Use `/injector` to toggle the display.
23+
24+
## Credits
25+
- atom0s for XiPackets

fields/data.lua

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
-- Field data management module
2+
-- Handles initialization and manipulation of field data structures
3+
4+
require('common');
5+
local field_utils = require('fields.utils');
6+
7+
local field_data = {};
8+
9+
-- Field data initialization
10+
function field_data.init_field_data(field)
11+
if field_utils.is_char_array(field) then
12+
return T { '' };
13+
elseif field_utils.is_numeric_array(field) then
14+
local array = T {};
15+
for i = 1, field.array_size do array[i] = 0; end
16+
return array;
17+
else
18+
return T { 0 };
19+
end
20+
end
21+
22+
function field_data.init_nested_struct_data(nested_fields)
23+
local nested_data = T {};
24+
for _, nested_field in ipairs(nested_fields) do
25+
if not nested_field.name:find('padding') then
26+
-- Initialize nested field data exactly like regular fields
27+
if nested_field.array_size then
28+
if nested_field.base_type == 'uint8_t' or nested_field.base_type == 'char' then
29+
nested_data[nested_field.name] = T { '' };
30+
else
31+
local array = T {};
32+
for i = 1, nested_field.array_size do array[i] = 0; end
33+
nested_data[nested_field.name] = array;
34+
end
35+
else
36+
nested_data[nested_field.name] = T { 0 };
37+
end
38+
end
39+
end
40+
return nested_data;
41+
end
42+
43+
function field_data.init_struct_data(struct_name, get_struct_fields_func)
44+
local struct_info = get_struct_fields_func(struct_name);
45+
if not struct_info then return false; end
46+
47+
local struct_data = T {};
48+
49+
struct_info.fields:each(function(field)
50+
if field_utils.is_nested_struct(field) then
51+
-- Handle nested struct or array of structs
52+
local array_count = field.array_size or 1;
53+
local nested_array = T {};
54+
for i = 1, array_count do
55+
nested_array[i] = field_data.init_nested_struct_data(field.nested_fields);
56+
end
57+
struct_data[field.name] = nested_array;
58+
else
59+
-- Handle regular fields
60+
struct_data[field.name] = field_data.init_field_data(field);
61+
end
62+
end);
63+
64+
-- Set packet ID if field exists
65+
if struct_data.id then
66+
struct_data.id[1] = struct_info.packet_id;
67+
end
68+
69+
return struct_data;
70+
end
71+
72+
-- Helper value getters for specific field types
73+
function field_data.get_helper_value(field_name)
74+
local target = AshitaCore:GetMemoryManager():GetTarget();
75+
local party = AshitaCore:GetMemoryManager():GetParty();
76+
77+
if field_name:match('UniqueNo') then
78+
if target and target:GetTargetIndex(0) > 0 then
79+
return target:GetServerId(0);
80+
else
81+
return party:GetMemberServerId(0);
82+
end
83+
elseif field_name:match('ActIndex') then
84+
if target and target:GetTargetIndex(0) > 0 then
85+
return target:GetTargetIndex(0);
86+
else
87+
return party:GetMemberTargetIndex(0);
88+
end
89+
end
90+
return nil;
91+
end
92+
93+
return field_data;

0 commit comments

Comments
 (0)