Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player lookat #58

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,8 @@ void Player::check_logindata() {
charQuery.addColumn("chars", "chr_lastsavetime");
charQuery.addColumn("chars", "chr_sex");
charQuery.addColumn("chars", "chr_race");
charQuery.addColumn("chars", "chr_shortdesc_de");
charQuery.addColumn("chars", "chr_shortdesc_us");
charQuery.addEqualCondition<std::string>("chars", "chr_name", getName());
charQuery.addServerTable("chars");

Expand All @@ -836,6 +838,8 @@ void Player::check_logindata() {
lastsavetime = charRow["chr_lastsavetime"].as<time_t>();
setAttribute(Character::sex, charRow["chr_sex"].as<uint16_t>());
setRace(charRow["chr_race"].as<TYPE_OF_RACE_ID>());
descriptionEn = charRow["chr_shortdesc_us"].as<TYPE_OF_ENGLISH>();
descriptionDe = charRow["chr_shortdesc_de"].as<TYPE_OF_GERMAN>();

// first we check the status since we already retrieved it
switch (status) {
Expand Down Expand Up @@ -1080,6 +1084,8 @@ auto Player::save() noexcept -> bool {
query.addAssignColumn<std::string>("chr_lastip", last_ip);
query.addAssignColumn<uint32_t>("chr_onlinetime", onlinetime + lastsavetime - logintime);
query.addAssignColumn<time_t>("chr_lastsavetime", lastsavetime);
query.addAssignColumn<TYPE_OF_ENGLISH>("chr_shortdesc_us", descriptionEn);
query.addAssignColumn<TYPE_OF_GERMAN>("chr_shortdesc_de", descriptionDe);

if (status != 0) {
query.addAssignColumn<time_t>("chr_statustime", statustime);
Expand Down
7 changes: 7 additions & 0 deletions src/Player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,15 @@ class Player : public Character {
CLIENTCOMMANDLIST immediateCommands;
CLIENTCOMMANDLIST queuedCommands;
std::mutex commandMutex;
TYPE_OF_ENGLISH descriptionEn;
TYPE_OF_GERMAN descriptionDe;

public:
auto getDescriptionEn() const -> TYPE_OF_ENGLISH { return descriptionEn; }
void setDescriptionEn(const TYPE_OF_ENGLISH &descrEn) { descriptionEn = descrEn; }
auto getDescriptionDe() const -> TYPE_OF_GERMAN { return descriptionDe; }
void setDescriptionDe(const TYPE_OF_GERMAN &descrDe) { descriptionDe = descrDe; }

void receiveCommand(const ClientCommandPointer &cmd);

void stopAttack() override;
Expand Down
6 changes: 6 additions & 0 deletions src/script/binding/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ namespace binding {

auto player() -> Binding<Player, Character> {
return luabind::class_<Player, Character>("Player")
.def("knows", &Player::knows)
.def("getCustomNameOf", &Player::getCustomNameOf)
.def("getDescriptionEn", &Player::getDescriptionEn)
.def("setDescriptionEn", &Player::setDescriptionEn)
.def("getDescriptionDe", &Player::getDescriptionDe)
.def("setDescriptionDe", &Player::setDescriptionDe)
.enum_("player_language")[luabind::value("german", static_cast<uint32_t>(Language::german)),
luabind::value("english", static_cast<uint32_t>(Language::english))]
.enum_("quest_availability")[luabind::value("questAvailable", static_cast<uint32_t>(questAvailable)),
Expand Down