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


C++ PlayerCreature::setGoldEx方法代码示例

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


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

示例1: execute


//.........这里部分代码省略.........

				Zone* pZone = pCreature->getZone();
				Assert(pZone != NULL);

				pZone->broadcastPacket(pCreature->getX(), pCreature->getY(), &gcOtherModifyInfo, pCreature);
			}

			__LEAVE_CRITICAL_SECTION((*g_pPCFinder))

			// Guild Member 객체를 삭제한다.
			SAFE_DELETE(pGuildMember);
		}

		// 길드 멤버 맵을 삭제한다.
		Members.clear();

		// 길드 매니저에서 길드를 삭제한다.
		g_pGuildManager->deleteGuild(pGuild->getID());

		// 길드 객체를 삭제한다.
		SAFE_DELETE(pGuild);
	}
	else if (pGuild->getState() == Guild::GUILD_STATE_WAIT )
	{
		HashMapGuildMember& Members = pGuild->getMembers();
		HashMapGuildMemberItor itr = Members.begin();

		Statement* pStmt = NULL;
		Result* pResult = NULL;

		BEGIN_DB
		{
			pStmt = g_pDatabaseManager->getConnection("DARKEDEN" )->createStatement();
			
			for (; itr != Members.end(); itr++ )
			{
				GuildMember* pGuildMember = itr->second;

				// 접속해 있으면
				__ENTER_CRITICAL_SECTION((*g_pPCFinder))

				Creature* pCreature = g_pPCFinder->getCreature_LOCKED(pGuildMember->getName());
				if (pCreature != NULL && pCreature->isPC() )
				{
					Player* pPlayer = pCreature->getPlayer();
					Assert(pPlayer != NULL);

					PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pCreature);
					Assert(pPlayerCreature != NULL);

					// 등록비를 환불한다.
					Gold_t Gold = pPlayerCreature->getGold();
					if (pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_MASTER )
					{
						Gold = min((uint64_t)(Gold + RETURN_SLAYER_MASTER_GOLD), (uint64_t)2000000000);
					}
					else if (pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_SUBMASTER )
					{
						Gold = min((uint64_t)(Gold + RETURN_SLAYER_SUBMASTER_GOLD), (uint64_t)2000000000);
					}

					pPlayerCreature->setGoldEx(Gold);

					GCModifyInformation gcModifyInformation;
					gcModifyInformation.addLongData(MODIFY_GOLD, Gold);
					pPlayer->sendPacket(&gcModifyInformation);

					// 메시지를 보낸다.
					pResult = pStmt->executeQuery("SELECT Message FROM Messages WHERE Receiver = '%s'", pCreature->getName().c_str());

					while (pResult->next() )
					{
						GCSystemMessage message;
						message.setMessage(pResult->getString(1));
						pPlayer->sendPacket(&message);
					}

					pStmt->executeQuery("DELETE FROM Messages WHERE Receiver = '%s'", pCreature->getName().c_str());
				}

				__LEAVE_CRITICAL_SECTION((*g_pPCFinder))

				// 길드 멤버 객체를 삭제한다.
				SAFE_DELETE(pGuildMember);
			}

			// 길드 멤버 해쉬 맵을 지운다.
			Members.clear();

			// 길드 매니저에서 길드를 삭제한다.
			g_pGuildManager->deleteGuild(pGuild->getID());
			GuildUnionManager::Instance().removeMasterGuild(pGuild->getID());

			// 길드 객체를 삭제한다.
			SAFE_DELETE(pGuild);

			SAFE_DELETE(pStmt);
		}
		END_DB(pStmt)
	}
开发者ID:jun199004,项目名称:server,代码行数:101,代码来源:SGDeleteGuildOKHandler.cpp

示例2: execute

//----------------------------------------------------------------------
//
// SGAddGuildMemberOKHandler::execute()
//
//----------------------------------------------------------------------
void SGAddGuildMemberOKHandler::execute (SGAddGuildMemberOK* pPacket )
throw(ProtocolException , Error )
{
    __BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

    // 길드 멤버 object 를 만든다.
    GuildMember* pGuildMember = new GuildMember();
    pGuildMember->setGuildID(pPacket->getGuildID());
    pGuildMember->setName(pPacket->getName());
    pGuildMember->setRank(pPacket->getGuildMemberRank());

    // 길드에 추가한다.
    Guild* pGuild = g_pGuildManager->getGuild(pGuildMember->getGuildID());
    pGuild->addMember(pGuildMember);

    // 멤버에게 메세지를 보낸다.
    __ENTER_CRITICAL_SECTION((*g_pPCFinder))

    Creature* pCreature = g_pPCFinder->getCreature_LOCKED(pGuildMember->getName());
    if (pCreature != NULL && pCreature->isPC() )
    {
        Player* pPlayer = pCreature->getPlayer();
        Assert(pPlayer != NULL);

        if (pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_MASTER ||
                pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_SUBMASTER )		// 길드마스터나 서브마스터일 경우
        {
            PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pCreature);
            Assert(pPlayerCreature != NULL);

            Gold_t Fee;
            if (pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_MASTER )
                Fee = REQUIRE_SLAYER_MASTER_GOLD;
            else if (pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_SUBMASTER )
                Fee = REQUIRE_SLAYER_SUBMASTER_GOLD;
            else
                Fee = 0;

            Gold_t CurMoney = pPlayerCreature->getGold();
            if (CurMoney < Fee )
            {
                // 큰일났군
                CurMoney = 0;
            }
            else
                CurMoney -= Fee;

            pPlayerCreature->setGoldEx(CurMoney);

            if (Fee != 0 )
            {
                GCModifyInformation gcModifyInformation;
                gcModifyInformation.addLongData(MODIFY_GOLD, CurMoney);

                // 바뀐정보를 클라이언트에 보내준다.
                pPlayer->sendPacket(&gcModifyInformation);
            }

            // 길드 가입 메시지를 보여준다.
            GCSystemMessage gcSystemMessage;
            if (pGuild->getRace() == Guild::GUILD_RACE_SLAYER )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_TEAM_JOIN_ACCEPTED ));
            else if (pGuild->getRace() == Guild::GUILD_RACE_VAMPIRE )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CLAN_JOIN_ACCEPTED ));
            else if (pGuild->getRace() == Guild::GUILD_RACE_OUSTERS )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CLAN_JOIN_ACCEPTED ));
            pPlayer->sendPacket(&gcSystemMessage);

        }
        else if (pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_WAIT )
        {
            // 길드 가입 신청 메시지를 보낸다.
            GCSystemMessage gcSystemMessage;
            if (pGuild->getRace() == Guild::GUILD_RACE_SLAYER )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_TEAM_JOIN_TRY ));
            else if (pGuild->getRace() == Guild::GUILD_RACE_VAMPIRE )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CLAN_JOIN_TRY ));
            else if (pGuild->getRace() == Guild::GUILD_RACE_OUSTERS )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CLAN_JOIN_TRY ));

            pPlayer->sendPacket(&gcSystemMessage);
        }
    }
    else
    {
        // 접속이 안되어 있다.

        // 마스터나 서브마스터일 경우
        // DB 에서 돈을 까도록 한다.
        if ((pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_MASTER ||
                pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_SUBMASTER )		// 길드마스터나 서브마스터일 경우
                && pPacket->getServerGroupID() == g_pConfig->getPropertyInt("ServerID" ) )		// 이 게임 서버에서 추가한 길드원인가?
        {
//.........这里部分代码省略.........
开发者ID:opendarkeden,项目名称:server,代码行数:101,代码来源:SGAddGuildMemberOKHandler.cpp


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