当前位置: 首页>>代码示例>>C++>>正文


C++ Guild::GetBankMoney方法代码示例

本文整理汇总了C++中Guild::GetBankMoney方法的典型用法代码示例。如果您正苦于以下问题:C++ Guild::GetBankMoney方法的具体用法?C++ Guild::GetBankMoney怎么用?C++ Guild::GetBankMoney使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Guild的用法示例。


在下文中一共展示了Guild::GetBankMoney方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleGuildInfoCommand

	static bool HandleGuildInfoCommand(ChatHandler* handler, char const* args)
    {
        Player* target;
        uint32 guildId;
        std::string guildName;
        std::string guildMasterName;
        Guild* guild;

        if (!*args)
        {
            if (target = handler->getSelectedPlayer())
                guild = target->GetGuild();
            else
                return false;
        }
        else if (guildId = atoi(args))
            guild = sGuildMgr->GetGuildById(guildId);
        else
        {
            char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
            if (!tailStr)
                return false;

            char* guildStr = handler->extractQuotedArg((char*)args);
            if (!guildStr)
                return false;

            guildName = guildStr;
            guild = sGuildMgr->GetGuildByName(guildName);
        }

        if (!guild)
            return false;

        handler->PSendSysMessage(LANG_GUILD_INFO_NAME, guild->GetName().c_str(), guild->GetId());
        if (sObjectMgr->GetPlayerNameByGUID(guild->GetLeaderGUID(), guildMasterName))
            handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID());

        char createdDateStr[20];
        time_t createdDate = guild->GetCreatedDate();
        strftime(createdDateStr, 20, "%Y-%m-%d %H:%M:%S", localtime(&createdDate));

        handler->PSendSysMessage(LANG_GUILD_INFO_CREATION_DATE, createdDateStr);
        handler->PSendSysMessage(LANG_GUILD_INFO_MEMBER_COUNT, guild->GetMemberCount());
        handler->PSendSysMessage(LANG_GUILD_INFO_BANK_GOLD, guild->GetBankMoney() / 100 / 100);
        handler->PSendSysMessage(LANG_GUILD_INFO_MOTD, guild->GetMOTD().c_str());
        handler->PSendSysMessage(LANG_GUILD_INFO_EXTRA_INFO, guild->GetInfo().c_str());
        return true;
	}
开发者ID:boom8866,项目名称:new,代码行数:49,代码来源:cs_guild.cpp

示例2: HandleGuildInfoCommand

    static bool HandleGuildInfoCommand(ChatHandler* handler, char const* args)
    {
        Guild* guild = nullptr;

        if (args && args[0] != '\0')
        {
            if (isNumeric(args))
            {
                uint32 guildId = uint32(atoi(args));
                guild = sGuildMgr->GetGuildById(guildId);
            }
            else
            {
                std::string guildName = args;
                guild = sGuildMgr->GetGuildByName(guildName);
            }
        }
        else if (Player* target = handler->getSelectedPlayerOrSelf())
            guild = target->GetGuild();

        if (!guild)
            return false;

        // Display Guild Information
        handler->PSendSysMessage(LANG_GUILD_INFO_NAME, guild->GetName().c_str(), guild->GetId()); // Guild Id + Name

        std::string guildMasterName;
        if (sCharacterCache->GetCharacterNameByGuid(guild->GetLeaderGUID(), guildMasterName))
            handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID().GetCounter()); // Guild Master

        // Format creation date
        char createdDateStr[20];
        time_t createdDate = guild->GetCreatedDate();
        tm localTm;
        strftime(createdDateStr, 20, "%Y-%m-%d %H:%M:%S", localtime_r(&createdDate, &localTm));

        handler->PSendSysMessage(LANG_GUILD_INFO_CREATION_DATE, createdDateStr); // Creation Date
        handler->PSendSysMessage(LANG_GUILD_INFO_MEMBER_COUNT, guild->GetMemberCount()); // Number of Members
        handler->PSendSysMessage(LANG_GUILD_INFO_BANK_GOLD, guild->GetBankMoney() / 100 / 100); // Bank Gold (in gold coins)
        handler->PSendSysMessage(LANG_GUILD_INFO_MOTD, guild->GetMOTD().c_str()); // Message of the Day
        handler->PSendSysMessage(LANG_GUILD_INFO_EXTRA_INFO, guild->GetInfo().c_str()); // Extra Information
        return true;
    }
开发者ID:AvariusProject,项目名称:AvariusCore,代码行数:43,代码来源:cs_guild.cpp


注:本文中的Guild::GetBankMoney方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。