Skip to content

Commit

Permalink
feat: rpg - char image & updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Istani committed Oct 6, 2024
1 parent 9aded03 commit bd09b07
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 2 deletions.
1 change: 1 addition & 0 deletions discord/models
11 changes: 11 additions & 0 deletions migrations/20241006220701_rpg_char_picture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exports.up = function(knex, Promise) {
return knex.schema.alterTable("rpg_char", function(t) {
t.string("picture", 300).defaultTo("");
});
};

exports.down = function(knex, Promise) {
return knex.schema.alterTable("rpg_char", function(t) {
t.dropColumn("picture");
});
};
11 changes: 11 additions & 0 deletions migrations/20241006233015_drop_duplicatecol_userpicture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exports.up = function(knex, Promise) {
return knex.schema.alterTable("chat_user", function(t) {
t.dropColumn("picture");
});
};

exports.down = function(knex, Promise) {
return knex.schema.alterTable("chat_user", function(t) {
t.string("picture", 300).defaultTo("");
});
};
11 changes: 11 additions & 0 deletions migrations/20241006233144_rpg_char_last_update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exports.up = function(knex, Promise) {
return knex.schema.alterTable("rpg_char", function(t) {
t.timestamps(true, false);
});
};

exports.down = function(knex, Promise) {
return knex.schema.alterTable("rpg_char", function(t) {
t.timestamps(false, false);
});
};
2 changes: 1 addition & 1 deletion models/rpg_char.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Char extends Model {
}

$beforeUpdate() {
//this.updated_at = new Date().toISOString();
this.updated_at = new Date().toISOString();
}
}

Expand Down
3 changes: 2 additions & 1 deletion rpg/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ async function genChar(syth_user, msg) {
chat_user[0].msg_avg = monsters[0].dmg_cap;
}
my_char.displayname = chat_user[0].name;
my_char.hp_max += chat_user[0].msg_sum;
(my_char.picture = chat_user[0].profile_picture),
(my_char.hp_max += chat_user[0].msg_sum);
my_char.atk += chat_user[0].msg_avg;
}

Expand Down

0 comments on commit bd09b07

Please sign in to comment.