fix tribemember list, database storage location
@@ -464,13 +464,38 @@ button {
464
464
margin-bottom: 10px;
465
465
}
466
466
467
.events-list,
468
.tribe-list {
467
.events-list {
469
468
display: flex;
470
469
flex-direction: column;
471
470
gap: 10px;
472
471
}
473
472
473
.tribe-list {
474
max-height: -webkit-fill-available;
475
overflow-y: auto;
476
}
477
478
.tribe-table {
479
width: 100%;
480
border-collapse: collapse;
481
table-layout: fixed;
482
}
483
484
.tribe-table td {
485
width: 50%;
486
vertical-align: top;
487
padding: 0 6px 10px;
488
}
489
490
.tribe-item-content {
491
display: flex;
492
align-items: center;
493
}
494
495
.tribe-cell-empty {
496
padding: 0 6px 10px;
497
}
498
474
499
.event-item,
475
500
.tribe-item {
476
501
background: white;
@@ -499,6 +524,11 @@ button {
499
524
color: #333;
500
525
}
501
526
527
.tribe-item-title {
528
font-size: 0.85em;
529
color: #666;
530
}
531
502
532
.tribe-item-age {
503
533
font-size: 0.8em;
504
534
color: #999;
@@ -464,13 +464,38 @@ button {464
margin-bottom: 10px;464
margin-bottom: 10px;465
}465
}466
466
467
.events-list,467
.events-list {468
.tribe-list {469
display: flex;468
display: flex;470
flex-direction: column;469
flex-direction: column;471
gap: 10px;470
gap: 10px;472
}471
}473
472
473
.tribe-list {474
max-height: -webkit-fill-available;475
overflow-y: auto;476
}477
478
.tribe-table {479
width: 100%;480
border-collapse: collapse;481
table-layout: fixed;482
}483
484
.tribe-table td {485
width: 50%;486
vertical-align: top;487
padding: 0 6px 10px;488
}489
490
.tribe-item-content {491
display: flex;492
align-items: center;493
}494
495
.tribe-cell-empty {496
padding: 0 6px 10px;497
}498
474
.event-item,499
.event-item,475
.tribe-item {500
.tribe-item {476
background: white;501
background: white;@@ -499,6 +524,11 @@ button {499
color: #333;524
color: #333;500
}525
}501
526
527
.tribe-item-title {528
font-size: 0.85em;529
color: #666;530
}531
502
.tribe-item-age {532
.tribe-item-age {503
font-size: 0.8em;533
font-size: 0.8em;504
color: #999;534
color: #999;@@ -132,7 +132,6 @@
132
132
</div>
133
133
134
134
<div class="panel">
135
<h3>Tribe Members</h3>
136
135
<div id="tribeList" class="tribe-list"></div>
137
136
</div>
138
137
@@ -132,7 +132,6 @@132
</div>132
</div>133
133
134
<div class="panel">134
<div class="panel">135
<h3>Tribe Members</h3>136
<div id="tribeList" class="tribe-list"></div>135
<div id="tribeList" class="tribe-list"></div>137
</div>136
</div>138
137
@@ -847,28 +847,52 @@ class TribeGenApp
847
847
const list = document.getElementById('tribeList');
848
848
list.innerHTML = '';
849
849
850
this.currentTribe.kobolds.forEach(kobold =>
850
if (!this.currentTribe || !Array.isArray(this.currentTribe.kobolds))
851
851
{
852
return;
853
}
854
855
const table = document.createElement('table');
856
table.className = 'tribe-table';
857
const tbody = document.createElement('tbody');
858
table.appendChild(tbody);
859
860
let currentRow = null;
861
862
this.currentTribe.kobolds.forEach((kobold, index) =>
863
{
864
if (index % 2 === 0)
865
{
866
currentRow = document.createElement('tr');
867
tbody.appendChild(currentRow);
868
}
869
870
const cell = document.createElement('td');
852
871
const spriteUrl = `api/game/sprite?userId=${this.currentUser.email}&koboldId=${kobold.id}&age=${kobold.ageCategory}`;
853
872
const item = document.createElement('div');
854
873
const isInjured = kobold.injuries && kobold.injuries.length > 0;
855
874
item.className = `tribe-item ${isInjured ? 'injured' : ''}`;
856
875
item.innerHTML = `
857
<table style="width:100%">
858
<td style="width:100px">
876
<div class="tribe-item-content">
859
877
<img class="kobold-list-sprite" src="${spriteUrl}"/>
860
</td>
861
<td>
862
<div>
863
<span class="tribe-item-name">${kobold.name}</span><span class="tribe-item-title">${kobold.title != '' ? (', ' + kobold.title) : ''}</span>
864
<div class="tribe-item-age">${(kobold.age > 0 ? kobold.age : 0)} years old</div>
878
<div>
879
<span class="tribe-item-name">${kobold.name}</span><br/><span class="tribe-item-title">${kobold.title != '' ? (kobold.title) : ''}</span>
880
</div>
865
881
</div>
866
</td>
867
</table>
868
882
`;
869
883
item.addEventListener('click', () => this.showKoboldModal(kobold));
870
list.appendChild(item);
884
cell.appendChild(item);
885
currentRow.appendChild(cell);
871
886
});
887
888
if (currentRow && currentRow.children.length === 1)
889
{
890
const emptyCell = document.createElement('td');
891
emptyCell.className = 'tribe-cell-empty';
892
currentRow.appendChild(emptyCell);
893
}
894
895
list.appendChild(table);
872
896
}
873
897
874
898
renderEvents ()
@@ -847,28 +847,52 @@ class TribeGenApp847
const list = document.getElementById('tribeList');847
const list = document.getElementById('tribeList');848
list.innerHTML = '';848
list.innerHTML = '';849
849
850
this.currentTribe.kobolds.forEach(kobold =>850
if (!this.currentTribe || !Array.isArray(this.currentTribe.kobolds))851
{851
{852
return;853
}854
855
const table = document.createElement('table');856
table.className = 'tribe-table';857
const tbody = document.createElement('tbody');858
table.appendChild(tbody);859
860
let currentRow = null;861
862
this.currentTribe.kobolds.forEach((kobold, index) =>863
{864
if (index % 2 === 0)865
{866
currentRow = document.createElement('tr');867
tbody.appendChild(currentRow);868
}869
870
const cell = document.createElement('td');852
const spriteUrl = `api/game/sprite?userId=${this.currentUser.email}&koboldId=${kobold.id}&age=${kobold.ageCategory}`;871
const spriteUrl = `api/game/sprite?userId=${this.currentUser.email}&koboldId=${kobold.id}&age=${kobold.ageCategory}`;853
const item = document.createElement('div');872
const item = document.createElement('div');854
const isInjured = kobold.injuries && kobold.injuries.length > 0;873
const isInjured = kobold.injuries && kobold.injuries.length > 0;855
item.className = `tribe-item ${isInjured ? 'injured' : ''}`;874
item.className = `tribe-item ${isInjured ? 'injured' : ''}`;856
item.innerHTML = `875
item.innerHTML = `857
<table style="width:100%">876
<div class="tribe-item-content">858
<td style="width:100px">859
<img class="kobold-list-sprite" src="${spriteUrl}"/>877
<img class="kobold-list-sprite" src="${spriteUrl}"/>860
</td>878
<div>861
<td>879
<span class="tribe-item-name">${kobold.name}</span><br/><span class="tribe-item-title">${kobold.title != '' ? (kobold.title) : ''}</span>862
<div>880
</div>863
<span class="tribe-item-name">${kobold.name}</span><span class="tribe-item-title">${kobold.title != '' ? (', ' + kobold.title) : ''}</span>864
<div class="tribe-item-age">${(kobold.age > 0 ? kobold.age : 0)} years old</div>865
</div>881
</div>866
</td>867
</table>868
`;882
`;869
item.addEventListener('click', () => this.showKoboldModal(kobold));883
item.addEventListener('click', () => this.showKoboldModal(kobold));870
list.appendChild(item);884
cell.appendChild(item);885
currentRow.appendChild(cell);871
});886
});887
888
if (currentRow && currentRow.children.length === 1)889
{890
const emptyCell = document.createElement('td');891
emptyCell.className = 'tribe-cell-empty';892
currentRow.appendChild(emptyCell);893
}894
895
list.appendChild(table);872
}896
}873
897
874
renderEvents ()898
renderEvents ()@@ -7,7 +7,7 @@ class Database
7
7
8
8
private function __construct()
9
9
{
10
$dataDir = __DIR__ . '\\..\\..\\data\\';
10
$dataDir = __DIR__ . "/../../data/";
11
11
$dbPath = $dataDir . 'tribegen.db';
12
12
13
13
if (!is_dir($dataDir)) {
@@ -7,7 +7,7 @@ class Database7
7
8
private function __construct()8
private function __construct()9
{9
{10
$dataDir = __DIR__ . '\\..\\..\\data\\';10
$dataDir = __DIR__ . "/../../data/";11
$dbPath = $dataDir . 'tribegen.db';11
$dbPath = $dataDir . 'tribegen.db';12
12
13
if (!is_dir($dataDir)) {13
if (!is_dir($dataDir)) {@@ -126,10 +126,10 @@ class ExplorationEvent extends Event
126
126
}
127
127
}
128
128
129
$eggFound = rand(1, 100) <= 3;
129
$eggFound = rand(1, 100) <= 5;
130
130
if ($eggFound) {
131
131
$this->tribe->addKobold(Kobold::generate($this->tribe->getUserId(), $this->tribe->getSaveId(), rand(-6, -1)));
132
$this->story .= "The party finds a lost Kobold egg... What might be inside?\n";
132
$this->story .= "The party finds a lost Kobold egg... Who might be inside?\n";
133
133
}
134
134
135
135
$this->story .= "\nThe exploration party returned to the tribe with their findings.";
@@ -126,10 +126,10 @@ class ExplorationEvent extends Event126
}126
}127
}127
}128
128
129
$eggFound = rand(1, 100) <= 3;129
$eggFound = rand(1, 100) <= 5;130
if ($eggFound) {130
if ($eggFound) {131
$this->tribe->addKobold(Kobold::generate($this->tribe->getUserId(), $this->tribe->getSaveId(), rand(-6, -1)));131
$this->tribe->addKobold(Kobold::generate($this->tribe->getUserId(), $this->tribe->getSaveId(), rand(-6, -1)));132
$this->story .= "The party finds a lost Kobold egg... What might be inside?\n";132
$this->story .= "The party finds a lost Kobold egg... Who might be inside?\n";133
}133
}134
134
135
$this->story .= "\nThe exploration party returned to the tribe with their findings.";135
$this->story .= "\nThe exploration party returned to the tribe with their findings.";@@ -86,8 +86,8 @@ class JealousItemEvent extends MonthEndEvent
86
86
$jealous->dataStore->likes[$target->getId()] = $current - 2;
87
87
88
88
$variations = [
89
"{$jealous->getName()} grew jealous of {$target->getName()}'s {$itemName}. The envy lingered, souring their opinion.",
90
"Seeing {$target->getName()} with {$itemName} stirred jealousy in {$jealous->getName()}. Their feelings toward {$target->getName()} cooled.",
89
"{$jealous->getName()} grew jealous of {$target->getName()}'s {$itemName}. The envy lingered, souring {$jealous->his()} opinion.",
90
"Seeing {$target->getName()} with {$itemName} stirred jealousy in {$jealous->getName()}. {$jealous->his()} feelings toward {$target->getName()} cooled.",
91
91
"{$jealous->getName()} fixated on {$target->getName()}'s {$itemName} and felt a sharp pang of envy, weakening the bond between them."
92
92
];
93
93
@@ -86,8 +86,8 @@ class JealousItemEvent extends MonthEndEvent86
$jealous->dataStore->likes[$target->getId()] = $current - 2;86
$jealous->dataStore->likes[$target->getId()] = $current - 2;87
87
88
$variations = [88
$variations = [89
"{$jealous->getName()} grew jealous of {$target->getName()}'s {$itemName}. The envy lingered, souring their opinion.",89
"{$jealous->getName()} grew jealous of {$target->getName()}'s {$itemName}. The envy lingered, souring {$jealous->his()} opinion.",90
"Seeing {$target->getName()} with {$itemName} stirred jealousy in {$jealous->getName()}. Their feelings toward {$target->getName()} cooled.",90
"Seeing {$target->getName()} with {$itemName} stirred jealousy in {$jealous->getName()}. {$jealous->his()} feelings toward {$target->getName()} cooled.",91
"{$jealous->getName()} fixated on {$target->getName()}'s {$itemName} and felt a sharp pang of envy, weakening the bond between them."91
"{$jealous->getName()} fixated on {$target->getName()}'s {$itemName} and felt a sharp pang of envy, weakening the bond between them."92
];92
];93
93