Specify dino sex in list and info block

Unfortunately, I'm still unsure of how to tell sexless and male dinos
apart. The only information on sex in the saves seems to be the
"isFemale" property, which is always true.
This commit is contained in:
Justin C. Miller
2021-10-03 20:39:27 -07:00
parent 51102e6dbe
commit ae7cc9f9ea
10 changed files with 55 additions and 14 deletions

View File

@@ -18,6 +18,7 @@ var databaseSchema = []string{`
list INTEGER,
world INTEGER,
class INTEGER,
is_female BOOLEAN,
is_tamed BOOLEAN,
name TEXT,
level_wild INTEGER,
@@ -84,7 +85,7 @@ const insertDino = `
INSERT INTO dinos (
id, list, world,
class, name, is_tamed,
class, name, is_female, is_tamed,
level_wild, level_tamed,
dino_id1, dino_id2,
is_cryo, parent_class, parent_name,
@@ -104,7 +105,7 @@ const insertDino = `
)
VALUES (
?, ?, ?,
?, ?, ?,
?, ?, ?, ?,
?, ?,
?, ?,
?, ?, ?,

View File

@@ -8,6 +8,7 @@ type dinoResult struct {
LevelsWild int `json:"levels_wild" db:"level_wild"`
LevelsTamed int `json:"levels_tamed" db:"level_tamed"`
LevelsTotal int `json:"levels_total" db:"level_total"`
IsFemale bool `json:"is_female" db:"is_female"`
IsCryopod bool `json:"is_cryo" db:"is_cryo"`
ParentClass *string `json:"parent_class" db:"parent_class"`
@@ -70,6 +71,7 @@ SELECT
level_wild,
level_tamed,
level_total,
d.is_female,
is_cryo,
c2.name as parent_class,
parent_name,
@@ -95,6 +97,7 @@ SELECT
d.dino_id1|d.dino_id2 as dino_id,
level_wild,
level_total,
d.is_female,
x, y, z,
color0, color1, color2, color3, color4, color5,
health_wild, stamina_wild, torpor_wild, oxygen_wild, food_wild, weight_wild, melee_wild, speed_wild

2
go.mod
View File

@@ -6,7 +6,7 @@ require (
github.com/fsnotify/fsnotify v1.5.0
github.com/gorilla/mux v1.8.0
github.com/jmoiron/sqlx v1.3.4
github.com/justinian/ark v1.0.0
github.com/justinian/ark v1.1.1
github.com/mattn/go-sqlite3 v1.14.8
github.com/spf13/pflag v1.0.5
)

4
go.sum
View File

@@ -8,8 +8,8 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/jmoiron/sqlx v1.3.4 h1:wv+0IJZfL5z0uZoUjlpKgHkgaFSYD+r9CfrXjEXsO7w=
github.com/jmoiron/sqlx v1.3.4/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
github.com/justinian/ark v1.0.0 h1:cD7SHtxXhNJFE+9KX/d9/Ax2o6ILcV15zquhCErRfFc=
github.com/justinian/ark v1.0.0/go.mod h1:b6Qzv82gyC6F+0IqGghi9oJvHlFzKoIIsGhHnEGwqbM=
github.com/justinian/ark v1.1.1 h1:r+FBVQXv9QJSjEO8V25icDj6B18eXSmBCgZq9OqQJLw=
github.com/justinian/ark v1.1.1/go.mod h1:b6Qzv82gyC6F+0IqGghi9oJvHlFzKoIIsGhHnEGwqbM=
github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=

View File

@@ -200,6 +200,15 @@ func (l *Loader) insertDinos(objlists [][]*ark.GameObject, world int, tx *sqlx.T
loc := obj.Location
isFemale := false
sexProp := obj.Properties.Get("bIsFemale", 0)
if sexProp != nil {
boolProp, ok := sexProp.(*ark.BoolProperty)
if ok {
isFemale = boolProp.Value
}
}
var err error
parentClass := 0
parentName := ""
@@ -250,7 +259,7 @@ func (l *Loader) insertDinos(objlists [][]*ark.GameObject, world int, tx *sqlx.T
_, err = stmt.Exec(
i, listNum, world,
classId, name, tamed,
classId, name, isFemale, tamed,
levelWild, levelTamed,
dinoId1, dinoId2,
obj.IsCryopod, parentClass, parentName,

View File

@@ -1,3 +1,10 @@
var renderName = function (data, type, row, meta) {
if (type === "display" && row.is_female) {
return "<span class='name_female'>" + data + "</span>";
}
return data;
}
var populateWildLinks = function (listElement) {
$.ajax("/api/worlds", {
dataType: "json",

View File

@@ -18,7 +18,7 @@ var showStats = function () {
};
var columns = [
{"data": "name", "title": "Name"},
{"data": "name", "title": "Name", "render": renderName},
{"data": "world", "title": "World", "visible": false},
{"data": "class_name", "title": "Class"},
{"data": "levels_wild", "title": "Base Lvl", "visible": false},
@@ -74,7 +74,9 @@ var columns = [
{"data": "food_total", "title":"F", "searchBuilderTitle": "Total Food"},
{"data": "weight_total", "title":"W", "searchBuilderTitle": "Total Weight"},
{"data": "melee_total", "title":"M", "searchBuilderTitle": "Total Melee"},
{"data": "speed_total", "title":"Sp", "searchBuilderTitle": "Total Speed"}
{"data": "speed_total", "title":"Sp", "searchBuilderTitle": "Total Speed"},
{"data": "is_female", "title": "Female", "searchBuilderTitle": "Female?", "visible": false}
];
var tableOptions = {
@@ -98,7 +100,7 @@ var tableOptions = {
},
"searchBuilder": {
"columns": [0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17,
"columns": [0, 1, 2, 3, 4, 5, 7, 8, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41,

View File

@@ -9,7 +9,7 @@ var showStats = function () {
var columns = [
{"data": "world", "title": "World", "visible": false},
{"data": "class_name", "title": "Class"},
{"data": "class_name", "title": "Class", "render": renderName},
{"data": "levels_wild", "title": "Level"},
{"data": "x", "visible": false},

View File

@@ -35,12 +35,17 @@
table.on( "select", function () {
row = table.row({"selected":true}).data();
name = "Unnamed " + row.class_name;
if (row.name) {
$( '#dinoName' ).html(row.name);
} else {
$( '#dinoName' ).html("Unnamed " + row.class_name);
name = row.name;
}
if (row.is_female) {
name += " " + String.fromCodePoint(0x2640);
}
$( '#dinoName' ).html(name);
$( '#dinoWorldName' ).html(row.world);
$( '#dinoId' ).html(row.dino_id);
$( '#dinoClass' ).html(row.class_name);
@@ -79,6 +84,10 @@
</script>
<style>
.name_female {
color: #ff00ff;
}
.swatch {
float: left;
height: 18px;

View File

@@ -42,7 +42,13 @@
table.on( "select", function () {
row = table.row({"selected":true}).data();
$( '#dinoName' ).html(row.class_name);
name = row.class_name;
if (row.is_female) {
name += " " + String.fromCodePoint(0x2640);
}
$( '#dinoName' ).html(name);
$( '#dinoWorldName' ).html(row.world);
$( '#dinoId' ).html(row.dino_id);
@@ -70,6 +76,10 @@
</script>
<style>
.name_female {
color: #ff00ff;
}
.swatch {
float: left;
height: 18px;