It's in the sources, add me to Discord and i may help youup, still need help to implement guild on look.
std::string Player::getDescription(int32_t lookDistance) const
{
std::stringstream s;
std::string str;
if(lookDistance == -1){
s << "yourself.";
if(hasFlag(PlayerFlag_ShowGroupInsteadOfVocation))
s << " You are " << getGroupName() << ".";
else if(getVocationId() != VOCATION_NONE)
s << " You are " << vocation->getDescription() << ".";
else
s << " You have no vocation.";
}
else {
s << name << " (Level " << level <<").";
s << " " << playerSexSubjectString(getSex());
if(hasFlag(PlayerFlag_ShowGroupInsteadOfVocation))
s << " is " << getGroupName() << ".";
else if(getVocationId() != VOCATION_NONE)
s << " is " << vocation->getDescription() << ".";
else
s << " has no vocation.";
}
if(getGuild()){
if(lookDistance == -1){
s << " You are ";
}
else{
s << " " << playerSexSubjectString(getSex()) << " is ";
}
if(guildRank.length()){
s << guildRank;
}
else{
s << "a member";
}
s << " of the " << getGuild()->getName();
if(guildNick.length()){
s << " (" << guildNick << ")";
}
s << ".";
}
str = s.str();
return str;
}
It's in the sources, add me to Discord and i may help you
Terotrificy#9257
Currently, this are the Othire sources where the guild looking is working:
TwistedScorpio/OTHire (https://github.com/TwistedScorpio/OTHire/blob/master/source/player.cpp) (line 264)
Exactly, this lines:
C++:std::string Player::getDescription(int32_t lookDistance) const { std::stringstream s; std::string str; if(lookDistance == -1){ s << "yourself."; if(hasFlag(PlayerFlag_ShowGroupInsteadOfVocation)) s << " You are " << getGroupName() << "."; else if(getVocationId() != VOCATION_NONE) s << " You are " << vocation->getDescription() << "."; else s << " You have no vocation."; } else { s << name << " (Level " << level <<")."; s << " " << playerSexSubjectString(getSex()); if(hasFlag(PlayerFlag_ShowGroupInsteadOfVocation)) s << " is " << getGroupName() << "."; else if(getVocationId() != VOCATION_NONE) s << " is " << vocation->getDescription() << "."; else s << " has no vocation."; } if(getGuild()){ if(lookDistance == -1){ s << " You are "; } else{ s << " " << playerSexSubjectString(getSex()) << " is "; } if(guildRank.length()){ s << guildRank; } else{ s << "a member"; } s << " of the " << getGuild()->getName(); if(guildNick.length()){ s << " (" << guildNick << ")"; } s << "."; } str = s.str(); return str; }
I'm not sure, i can't check it because i'm at the work, but if you think it would be the database, then look in the sources where is the "getGuild()" function defined, check what query it does and then check your database structure. I would check first of all, if you're using old guild system or not.This is the sources being used, so then it must be the database or something.
Because the website shows guild membership just fine, but not in-game ... hmm ... or what do you think?
bool IOPlayer::loadPlayer(Player* player, const std::string& name, bool preload /*= false*/)
{
Database* db = Database::instance();
DBQuery query;
DBResult* result;
query << "SELECT `players`.`id` AS `id`, `players`.`name` AS `name`, \
`account_id`, `sex`, `vocation`, `experience`, `level`, `maglevel`, `health`, \
`groups`.`name` AS `groupname`, `groups`.`flags` AS `groupflags`, `groups`.`access` AS `access`, \
`groups`.`maxviplist` AS `maxviplist`, `groups`.`maxdepotitems` AS `maxdepotitems`, `groups`.`violation` AS `violation`, \
`healthmax`, `mana`, `manamax`, `manaspent`, `soul`, `direction`, `lookbody`, \
`lookfeet`, `lookhead`, `looklegs`, `looktype`, `posx`, `posy`, \
`posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `conditions`, `skull_time`, \
`skull_type`, `loss_experience`, `loss_mana`, `loss_skills`, ";
#ifdef __OLD_GUILD_SYSTEM__
query << "`rank_id`, `guildnick`, ";
#endif
query << "`loss_items`, `loss_containers`, `town_id`, `balance` \
FROM `players` \
LEFT JOIN `accounts` ON `account_id` = `accounts`.`id`\
LEFT JOIN `groups` ON `groups`.`id` = `players`.`group_id` \
WHERE `players`.`name` = " + db->escapeString(name);
if(!(result = db->storeQuery(query.str()))){
return false;
}
query.str("");
player->setGUID(result->getDataInt("id"));
player->accountId = result->getDataInt("account_id");
player->groupName = result->getDataString("groupname");
player->accessLevel = result->getDataInt("access");
int32_t violationLevel = result->getDataInt("violation");
if(violationLevel > maxViolationLevel){
violationLevel = maxViolationLevel;
std::cout << "Warning: When loading player, maximum violation level is" << maxViolationLevel << std::endl;
}
player->violationLevel = violationLevel;
player->maxDepotLimit = result->getDataInt("maxdepotitems");
int32_t vipLimit = result->getDataInt("maxviplist");
if(vipLimit > 100){
vipLimit = 100;
std::cout << "Warning: When loading player, maximum size of VIP list is 100." << std::endl;
}
player->maxVipLimit = vipLimit;
player->setFlags(result->getDataLong("groupflags"));
if(preload){
//only loading basic info
db->freeResult(result);
return true;
}
// place it here and now we can drop all additional query instances as all data were loaded
#ifdef __OLD_GUILD_SYSTEM__
uint32_t rankid = result->getDataInt("rank_id");
player->guildNick = result->getDataString("guildnick");
#endif
player->balance = result->getDataInt("balance");
db->freeResult(result);
//guild system
query.str("");
#ifdef __OLD_GUILD_SYSTEM__
query << "SELECT `guild_ranks`.`name` as `rank`, `guild_ranks`.`guild_id` as `guildid`, \
`guild_ranks`.`level` as `level`, `guilds`.`name` as `guildname` \
FROM `guild_ranks`, `guilds` \
WHERE `guild_ranks`.`id` = " << rankid << " AND `guild_ranks`.`guild_id` = `guilds`.`id`";
if((result = db->storeQuery(query.str()))){
Guild* guild = g_guilds.getGuildById(result->getDataInt("guildid"));
if(guild){
player->setGuild(guild);
player->guildRank = result->getDataString("rank");
player->guildLevel = result->getDataInt("level");
db->freeResult(result);
}
}
#else
query << "SELECT `guild_members`.`nick`, `guild_ranks`.`name`, `guild_ranks`.`level`, `guilds`.`id` \
FROM `guild_members` \
LEFT JOIN `guild_ranks` ON `guild_members`.`rank_id` = `guild_ranks`.`id` \
LEFT JOIN `guilds` ON `guilds`.`id` = `guild_ranks`.`guild_id` \
WHERE `guild_members`.`player_id` = " << player->getGUID();
if((result = db->storeQuery(query.str()))){
Guild* guild = g_guilds.getGuildById(result->getDataInt("id"));
if(guild){
player->setGuild(guild);
player->guildRank = result->getDataString("name");
player->guildLevel = result->getDataInt("level");
player->guildNick = result->getDataString("nick");
db->freeResult(result);
}
}
#endif
Let me know when you can help me checkI'm not sure, i can't check it because i'm at the work, but if you think it would be the database, then look in the sources where is the "getGuild()" function defined, check what query it does and then check your database structure. I would check first of all, if you're using old guild system or not.
Also, check ioplayer.cpp (TwistedScorpio/OTHire (https://github.com/TwistedScorpio/OTHire/blob/master/source/ioplayer.cpp)) between the lines 42 and 97, there you have the query responsable for getting the boolean Guild, ranks and tittles.
C++:bool IOPlayer::loadPlayer(Player* player, const std::string& name, bool preload /*= false*/) { Database* db = Database::instance(); DBQuery query; DBResult* result; query << "SELECT `players`.`id` AS `id`, `players`.`name` AS `name`, \ `account_id`, `sex`, `vocation`, `experience`, `level`, `maglevel`, `health`, \ `groups`.`name` AS `groupname`, `groups`.`flags` AS `groupflags`, `groups`.`access` AS `access`, \ `groups`.`maxviplist` AS `maxviplist`, `groups`.`maxdepotitems` AS `maxdepotitems`, `groups`.`violation` AS `violation`, \ `healthmax`, `mana`, `manamax`, `manaspent`, `soul`, `direction`, `lookbody`, \ `lookfeet`, `lookhead`, `looklegs`, `looktype`, `posx`, `posy`, \ `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `conditions`, `skull_time`, \ `skull_type`, `loss_experience`, `loss_mana`, `loss_skills`, "; #ifdef __OLD_GUILD_SYSTEM__ query << "`rank_id`, `guildnick`, "; #endif query << "`loss_items`, `loss_containers`, `town_id`, `balance` \ FROM `players` \ LEFT JOIN `accounts` ON `account_id` = `accounts`.`id`\ LEFT JOIN `groups` ON `groups`.`id` = `players`.`group_id` \ WHERE `players`.`name` = " + db->escapeString(name); if(!(result = db->storeQuery(query.str()))){ return false; } query.str(""); player->setGUID(result->getDataInt("id")); player->accountId = result->getDataInt("account_id"); player->groupName = result->getDataString("groupname"); player->accessLevel = result->getDataInt("access"); int32_t violationLevel = result->getDataInt("violation"); if(violationLevel > maxViolationLevel){ violationLevel = maxViolationLevel; std::cout << "Warning: When loading player, maximum violation level is" << maxViolationLevel << std::endl; } player->violationLevel = violationLevel; player->maxDepotLimit = result->getDataInt("maxdepotitems"); int32_t vipLimit = result->getDataInt("maxviplist"); if(vipLimit > 100){ vipLimit = 100; std::cout << "Warning: When loading player, maximum size of VIP list is 100." << std::endl; } player->maxVipLimit = vipLimit; player->setFlags(result->getDataLong("groupflags")); if(preload){ //only loading basic info db->freeResult(result); return true; }
and lines 175 to 223:
C++:// place it here and now we can drop all additional query instances as all data were loaded #ifdef __OLD_GUILD_SYSTEM__ uint32_t rankid = result->getDataInt("rank_id"); player->guildNick = result->getDataString("guildnick"); #endif player->balance = result->getDataInt("balance"); db->freeResult(result); //guild system query.str(""); #ifdef __OLD_GUILD_SYSTEM__ query << "SELECT `guild_ranks`.`name` as `rank`, `guild_ranks`.`guild_id` as `guildid`, \ `guild_ranks`.`level` as `level`, `guilds`.`name` as `guildname` \ FROM `guild_ranks`, `guilds` \ WHERE `guild_ranks`.`id` = " << rankid << " AND `guild_ranks`.`guild_id` = `guilds`.`id`"; if((result = db->storeQuery(query.str()))){ Guild* guild = g_guilds.getGuildById(result->getDataInt("guildid")); if(guild){ player->setGuild(guild); player->guildRank = result->getDataString("rank"); player->guildLevel = result->getDataInt("level"); db->freeResult(result); } } #else query << "SELECT `guild_members`.`nick`, `guild_ranks`.`name`, `guild_ranks`.`level`, `guilds`.`id` \ FROM `guild_members` \ LEFT JOIN `guild_ranks` ON `guild_members`.`rank_id` = `guild_ranks`.`id` \ LEFT JOIN `guilds` ON `guilds`.`id` = `guild_ranks`.`guild_id` \ WHERE `guild_members`.`player_id` = " << player->getGUID(); if((result = db->storeQuery(query.str()))){ Guild* guild = g_guilds.getGuildById(result->getDataInt("id")); if(guild){ player->setGuild(guild); player->guildRank = result->getDataString("name"); player->guildLevel = result->getDataInt("level"); player->guildNick = result->getDataString("nick"); db->freeResult(result); } } #endif
I'm not sure, i can't check it because i'm at the work, but if you think it would be the database, then look in the sources where is the "getGuild()" function defined, check what query it does and then check your database structure. I would check first of all, if you're using old guild system or not.
Also, check ioplayer.cpp (TwistedScorpio/OTHire (https://github.com/TwistedScorpio/OTHire/blob/master/source/ioplayer.cpp)) between the lines 42 and 97, there you have the query responsable for getting the boolean Guild, ranks and tittles.
C++:bool IOPlayer::loadPlayer(Player* player, const std::string& name, bool preload /*= false*/) { Database* db = Database::instance(); DBQuery query; DBResult* result; query << "SELECT `players`.`id` AS `id`, `players`.`name` AS `name`, \ `account_id`, `sex`, `vocation`, `experience`, `level`, `maglevel`, `health`, \ `groups`.`name` AS `groupname`, `groups`.`flags` AS `groupflags`, `groups`.`access` AS `access`, \ `groups`.`maxviplist` AS `maxviplist`, `groups`.`maxdepotitems` AS `maxdepotitems`, `groups`.`violation` AS `violation`, \ `healthmax`, `mana`, `manamax`, `manaspent`, `soul`, `direction`, `lookbody`, \ `lookfeet`, `lookhead`, `looklegs`, `looktype`, `posx`, `posy`, \ `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `conditions`, `skull_time`, \ `skull_type`, `loss_experience`, `loss_mana`, `loss_skills`, "; #ifdef __OLD_GUILD_SYSTEM__ query << "`rank_id`, `guildnick`, "; #endif query << "`loss_items`, `loss_containers`, `town_id`, `balance` \ FROM `players` \ LEFT JOIN `accounts` ON `account_id` = `accounts`.`id`\ LEFT JOIN `groups` ON `groups`.`id` = `players`.`group_id` \ WHERE `players`.`name` = " + db->escapeString(name); if(!(result = db->storeQuery(query.str()))){ return false; } query.str(""); player->setGUID(result->getDataInt("id")); player->accountId = result->getDataInt("account_id"); player->groupName = result->getDataString("groupname"); player->accessLevel = result->getDataInt("access"); int32_t violationLevel = result->getDataInt("violation"); if(violationLevel > maxViolationLevel){ violationLevel = maxViolationLevel; std::cout << "Warning: When loading player, maximum violation level is" << maxViolationLevel << std::endl; } player->violationLevel = violationLevel; player->maxDepotLimit = result->getDataInt("maxdepotitems"); int32_t vipLimit = result->getDataInt("maxviplist"); if(vipLimit > 100){ vipLimit = 100; std::cout << "Warning: When loading player, maximum size of VIP list is 100." << std::endl; } player->maxVipLimit = vipLimit; player->setFlags(result->getDataLong("groupflags")); if(preload){ //only loading basic info db->freeResult(result); return true; }
and lines 175 to 223:
C++:// place it here and now we can drop all additional query instances as all data were loaded #ifdef __OLD_GUILD_SYSTEM__ uint32_t rankid = result->getDataInt("rank_id"); player->guildNick = result->getDataString("guildnick"); #endif player->balance = result->getDataInt("balance"); db->freeResult(result); //guild system query.str(""); #ifdef __OLD_GUILD_SYSTEM__ query << "SELECT `guild_ranks`.`name` as `rank`, `guild_ranks`.`guild_id` as `guildid`, \ `guild_ranks`.`level` as `level`, `guilds`.`name` as `guildname` \ FROM `guild_ranks`, `guilds` \ WHERE `guild_ranks`.`id` = " << rankid << " AND `guild_ranks`.`guild_id` = `guilds`.`id`"; if((result = db->storeQuery(query.str()))){ Guild* guild = g_guilds.getGuildById(result->getDataInt("guildid")); if(guild){ player->setGuild(guild); player->guildRank = result->getDataString("rank"); player->guildLevel = result->getDataInt("level"); db->freeResult(result); } } #else query << "SELECT `guild_members`.`nick`, `guild_ranks`.`name`, `guild_ranks`.`level`, `guilds`.`id` \ FROM `guild_members` \ LEFT JOIN `guild_ranks` ON `guild_members`.`rank_id` = `guild_ranks`.`id` \ LEFT JOIN `guilds` ON `guilds`.`id` = `guild_ranks`.`guild_id` \ WHERE `guild_members`.`player_id` = " << player->getGUID(); if((result = db->storeQuery(query.str()))){ Guild* guild = g_guilds.getGuildById(result->getDataInt("id")); if(guild){ player->setGuild(guild); player->guildRank = result->getDataString("name"); player->guildLevel = result->getDataInt("level"); player->guildNick = result->getDataString("nick"); db->freeResult(result); } } #endif
What website are you using? check if you're using old guild system in the config file of your websiteLet me know when you can help me check
Post automatically merged:
I noticed that "guildnick" is empty for the player in the database ... how can i fix this?
What website are you using? check if you're using old guild system in the config file of your website
Hey,
Check this topic, it should help you with this problem -> AAC - Guilds on MyAAC (https://otland.net/threads/guilds-on-myaac.268759/)
Have you try to create new one guild ?I deleted guild_members from mysql, still doesn't show guild when i look on the player in-game?
Did you try to insert guild nickname and guild id into players table to some player through sql? Or just edit it in phpmyadmin or the database engine you are using and test it in game, this way you can discard if its either the website inserting wrong values or ingame problem.I deleted guild_members from mysql, still doesn't show guild when i look on the player in-game?
Yes, it didnt work.Have you try to create new one guild ?
Did you try to insert guild nickname and guild id into players table to some player through sql? Or just edit it in phpmyadmin or the database engine you are using and test it in game, this way you can discard if its either the website inserting wrong values or ingame problem.
try to insert into a player through sql (in players table) the values for rank_id and gildnick manually, not from the website and then check if you can see it in-game.Yes, it didnt work.
Post automatically merged:
Seems like the website use $guild_name = get_guild_name($guild['guild_id']);
And the website shows guild name just fine.
But in-game it still doesn't show the guild name or any guild information at all.
try to insert into a player through sql (in players table) the values for rank_id and gildnick manually, not from the website and then check if you can see it in-game.
You should insert a string into guildnick and an int into rank_id, if you're using old guild system, rank_id is an autoincrement value that is created when you create a new guild rank. Do you have discord? I can help you better in that way.What value should i insert into "guildnick" and "rank_id" ?