Skip to content

Commit 6e549ae

Browse files
committed
Fixed TrinityCore mapping file generation
1 parent 9d2516e commit 6e549ae

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Classes/DbScriptExtensions_Database.ext

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function Database:GetTableInformations()
3636
["bigint"] = function() return ColumnType.Int64 end,
3737
["bigint unsigned"] = function() return ColumnType.UInt64 end,
3838
["float"] = function() return ColumnType.Float end,
39+
["float unsigned"] = function() return ColumnType.Float end,
3940
["double"] = function() return ColumnType.Double end,
4041
["dec"] = function() return ColumnType.Double end,
4142
["decimal"] = function() return ColumnType.Double end,
@@ -70,6 +71,7 @@ function Database:GetTableInformations()
7071
["bigint"] = function() return "ColumnType.Int64" end,
7172
["bigint unsigned"] = function() return "ColumnType.UInt64" end,
7273
["float"] = function() return "ColumnType.Float" end,
74+
["float unsigned"] = function() return "ColumnType.Float" end,
7375
["double"] = function() return "ColumnType.Double" end,
7476
["dec"] = function() return "ColumnType.Double" end,
7577
["decimal"] = function() return "ColumnType.Double" end,

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ existingCreature:Load(123) -- Load data of entry with guid = 123 (guid is the pr
5252
-- Way 2
5353
local existingCreature = DbCreature():Load(123)
5454

55+
-- You can now access the columns like a normal Lua table. Attribute names are always the same as the column names in the table (case sensitive!).
56+
print(existingCreature.map) -- Prints the map id of the loaded creature
57+
5558
-- Load entry with combined primary keys
5659
local existingPlayerCreateInfo = DbPlayercreateinfo():Load(1, 4) -- Table playercreateinfo has a combined primary key based on column race and class. The order will always be the same as in the database which means we're loading the entry with race = 1 AND class = 4
5760
```
@@ -70,6 +73,9 @@ existingCreature:Delete() -- Delete row with guid = 123
7073
```
7174

7275
## FAQ
76+
### Which emulators does it support?
77+
I only tested it on AzerothCore and TrinityCore, but it should work on all emulators supported by Eluna.
78+
7379
### What can i do when i see errors in my world server console?
7480
Set `DbScriptExtensions_PrintQueries = true` in your file `lua_scripts/extensions/DbScriptExtensions/DbScriptExtensions.ext`. Now restart the world server. It should show all DbScriptExtensions SQL queries that it tries to run. Now you can open up an issue on the GitHub repository with the query it tried to execute and a snippet of your code that leads to this error. Make sure to mention which emulator you're using.
7581

@@ -86,14 +92,15 @@ Yes. After adding a new table to your world database, just regenerate the table
8692
The mapping is done in the file `lua_scripts\extensions\DbScriptExtensions\Mapping\DbScriptExtensions_Mappings.ext`. You can find all class names in there.
8793

8894
### Are there any attributes that could help me to create objects in a generic way?
89-
There are several internal helper attributes that you can use.
95+
There are several internal helper attributes that you can use. Also check the Queryable class for functions that you could call.
96+
Example of internal helper attributes:
9097
```lua
9198
local creature = DbCreature():Load(123)
9299
local guid = creature.__columns["guid"] -- Access column directly by name, same value as creature.guid
93100
local guidColumnId = creature.__columnIds["guid"] -- Will return 0 because guid is the first column in the table creature (it's 0 based because the ElunaQuery functions are 0 based. Lua is usually 1 based)
94101
local guidColumnName = creature.__columnById[guidColumnId] -- Will return "guid" because column 1 is guid as seen in the line above
95102
local amountOfColumns = creature.__columnIdCounter -- Will return 24 because the table creature has 24 columns
96-
local elunaReadColumnFunction = self.__columnFunctions["guid"] -- Will return function ElunaQuery:GetUInt32 because this is the function to read the value out of an query object. Use like this: elunaReadColumnFunction(query)
103+
local elunaReadColumnFunction = creature.__columnFunctions["guid"] -- Will return function ElunaQuery:GetUInt32 because this is the function to read the value out of an query object. Use like this: elunaReadColumnFunction(query, columnId)
97104
local queryObject = WorldDBQuery("SELECT * FROM creature WHERE guid = 123")
98105
if (queryObject) then
99106
local guid = elunaReadColumnFunction(queryObject, guidColumnId) -- Will return 123

0 commit comments

Comments
 (0)