• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Ranking guilds in game

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
Where do we see about look in the player and appears the ranking of the guild? I searched on the player.lua onLook and did not find it;

Problem: We change the ranking on the website and it is right on the site, but in the game only appears the first 3 ranking in the players, while giving look.

tfs 1.2 and gesior acc
 
Last edited by a moderator:
Tested with LIMIT 9 and still the same problem, in website and DB are all correctly, the problem is on game when Look players, only appear 1, 2 and 3º rank names.

C++:
std::ostringstream query;
    query << "SELECT `guild_id`, `rank_id`, `nick` FROM `guild_membership` WHERE `player_id` = " << player->getGUID();
    if ((result = db->storeQuery(query.str()))) {
        uint32_t guildId = result->getNumber<uint32_t>("guild_id");
        uint32_t playerRankId = result->getNumber<uint32_t>("rank_id");
        player->guildNick = result->getString("nick");

        Guild* guild = g_game.getGuild(guildId);
        if (!guild) {
            query.str(std::string());
            query << "SELECT `name`, `balance` FROM `guilds` WHERE `id` = " << guildId;
            if ((result = db->storeQuery(query.str()))) {
                guild = new Guild(guildId, result->getString("name"));
                guild->setBankBalance(result->getNumber<uint32_t>("balance"));
                g_game.addGuild(guild);

                query.str(std::string());
                              
                // TESTED with guild_ranks LIMIT 9 and same problem
                //query << "SELECT `id`, `name`, `level` FROM `guild_ranks` WHERE `guild_id` = " << guildId << " LIMIT 3";

                if ((result = db->storeQuery(query.str()))) {
                    do {
                        guild->addRank(result->getNumber<uint32_t>("id"), result->getString("name"), result->getNumber<uint16_t>("level"));
                    } while (result->next());
                }
            }
        }

        if (guild) {
            player->guild = guild;
            GuildRank* rank = guild->getRankById(playerRankId);
            if (rank) {
                player->guildLevel = rank->level;
            } else {
                player->guildLevel = 1;
            }

            IOGuild::getWarList(guildId, player->guildWarList);

            query.str(std::string());
            query << "SELECT COUNT(*) AS `members` FROM `guild_membership` WHERE `guild_id` = " << guildId;
            if ((result = db->storeQuery(query.str()))) {
                guild->setMemberCount(result->getNumber<uint32_t>("members"));
            }
        }
    }

someone can help?


script player.lua onLook
LUA:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
           
        elseif thing.itemid >= 29082 and thing.itemid <= 29086 or thing.itemid >= 29092 and thing.itemid <= 29095 or thing.itemid >= 29102 and thing.itemid <= 29103 or thing.itemid >= 29106 and thing.itemid <= 29117 then
            description = description .. thing:getDescription(distance)
            local charges = thing.actionid - 1000
            if charges >= 0 then
            description = string.format('%s \nRefillings left: %d', description, charges)
            elseif thing.itemid <= 29103 then
            description = string.format('%s That is brand-new\nRefillings left: 1000', description, charges)
            elseif thing.itemid >= 29106 then
            description = string.format('%s That is brand-new\nRefillings left: 500', description, charges)
            end
           
        else
            description = description .. thing:getDescription(distance)
        end
    else
        description = description .. thing:getDescription(distance)
    end   

    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format('%s\nItem ID: %d', description, thing.itemid)

            local actionId = thing.actionid
            if actionId ~= 0 then
                description = string.format('%s, Action ID: %d', description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format('%s, Unique ID: %d', description, uniqueId)
            end

            description = description .. '.'
            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onEquip)', description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onDeEquip)', description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format('%s\nDecays to: %d', description, decayId)
            end
        elseif thing:isCreature() then
            local str = '%s\nHealth: %d / %d'
            if thing:getMaxMana() > 0 then
                str = string.format('%s, Mana: %d / %d', str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. '.'
        end

        local position = thing:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )
       
       

        if thing:isCreature() and thing:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(thing:getIp()))
        end
    end   
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
Back
Top