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


C++ Ousters::decreaseGoldEx方法代码示例

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


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

示例1: execute


//.........这里部分代码省略.........
                ((pZoneInfo->isPayPlay() || pZoneInfo->isPremiumZone()) && (!pGamePlayer->isPayPlaying() && !pGamePlayer->isFamilyFreePass()))) {
              //Statement* pStmt = NULL;
							string connectIP = pGamePlayer->getSocket()->getHost();

							// 유료 서비스 사용이 가능한가?
							if (pGamePlayer->loginPayPlay(connectIP, pGamePlayer->getID())) {
								sendPayInfo(pGamePlayer);
							} else if (pZoneInfo->isPayPlay()) {
								// 유료 서비스 사용 불가인 경우
								GCSystemMessage gcSystemMessage;

								if (g_pConfig->getPropertyInt("IsNetMarble") == 0) {
									gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CANNOT_ENTER));
								} else {
									gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CANNOT_ENTER));
								}

								pGamePlayer->sendPacket (&gcSystemMessage);

								bCancel = true;
							}
						}
#endif

						if (!bCancel) {
							// 이동시키기 전에 이펙트를 삭제한다.
							if (pCreature->isSlayer())
								pCreature->removeFlag(Effect::EFFECT_CLASS_SLAYER_PORTAL);

							if (pCreature->isOusters()) {
								Ousters* pOusters = dynamic_cast<Ousters*>(pCreature);
								Assert(pOusters != NULL);

								GCNoticeEvent gcNoticeEvent;

								// 대지정령의 뿔을 사용할라면 시오람과 계약을 맺었어야 한다.
								if (!pOusters->getFlagSet()->isOn(FLAGSET_GNOMES_HORN)) {
									gcNoticeEvent.setCode(NOTICE_EVENT_CONTRACT_GNOMES_HORN);
									pPlayer->sendPacket(&gcNoticeEvent);
									return;
								}

								Level_t level = pOusters->getLevel();
								Price_t price = sPriceMap[level];

								if (price == 0) {
									price = (Price_t)(pow((double)level, 1.3) * 100) / 2;
									sPriceMap[level] = price;
								}

								/*if (g_pFlagManager->hasFlagWar() && 
										pPacket->getZoneID() == 32 &&
										pPacket->getX() == 124 &&
										pPacket->getY() == 144 ) price = 0;*/

								if (pOusters->getGold() < price) {
									gcNoticeEvent.setCode(NOTICE_EVENT_NOT_ENOUGH_MONEY);
									pPlayer->sendPacket(&gcNoticeEvent);
									return;
								} else {
									pOusters->decreaseGoldEx(price);
									GCModifyInformation gcMI;
									gcMI.addLongData(MODIFY_GOLD, pOusters->getGold());
									pPlayer->sendPacket(&gcMI);
								}
							}

							// 올바른 웨이포인트라면 슬레이어를 이동시켜준다.
							pPC->getGQuestManager()->illegalWarp();
							transportCreature(pCreature, id, x, y, false);
						}
					}
				} catch (NoSuchElementException&) {
					bCancel = true;
				}
			}
		}

		if (bCancel && pCreature->isSlayer()) {
			Zone* pZone = pCreature->getZone();
			Assert(pZone != NULL);

			// id, x, y가 모두 0일 경우 이동을 취소한다는 뜻이다.
			pCreature->removeFlag(Effect::EFFECT_CLASS_SLAYER_PORTAL);

			// 헬기를 제거하라고 뿌려준다.
			GCAddHelicopter gcAddHelicopter;
			gcAddHelicopter.setObjectID(pCreature->getObjectID());
			gcAddHelicopter.setCode(1);
			pZone->broadcastPacket(pCreature->getX(), pCreature->getY(), &gcAddHelicopter);
		}
	} 
	catch (Throwable & t) { 
		cerr << t.toString() << endl; 
	}

#endif	// __GAME_SERVER__
		
	__END_DEBUG_EX __END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:101,代码来源:CGSelectWayPointHandler.cpp

示例2: executeNormal


//.........这里部分代码省略.........
		response.setCode(NPC_RESPONSE_REPAIR_FAIL_MONEY);
		pPlayer->sendPacket(&response);
		return;
	}

	// 수리한다.
	repairItem(pItem);

	// 수리한 아이템이 기어창의 아이템이고 이전 내구도가 0 이었다면 정보를 새로 보내줘야한다.
	if (storage == STORAGE_GEAR && oldDurability == 0 )
	{
		if (bSlayer && pSlayer != NULL )
		{
			pSlayer->initAllStatAndSend();
			pSlayer->sendRealWearingInfo();
		}
		else if (bVampire && pVampire != NULL )
		{
			pVampire->initAllStatAndSend();
			pVampire->sendRealWearingInfo();
		}
		else if (bOusters && pOusters != NULL )
		{
			pOusters->initAllStatAndSend();
			pOusters->sendRealWearingInfo();
		}
	}

	// 돈을 줄인다.
	if (bSlayer)
	{
		//pSlayer->setGoldEx(playerMoney-repairPrice);
		// by sigi. 2002.9.4
		pSlayer->decreaseGoldEx(repairPrice);
		//log(LOG_REPAIR_ITEM, pSlayer->getName(), "", pItem->toString());
	}
	else if (bVampire)
	{
		// by sigi. 2002.9.4
		pVampire->decreaseGoldEx(repairPrice);
		//log(LOG_REPAIR_ITEM, pVampire->getName(), "", pItem->toString());
	}
	else if (bOusters)
	{
		// by sigi. 2002.9.4
		pOusters->decreaseGoldEx(repairPrice);
		//log(LOG_REPAIR_ITEM, pOusters->getName(), "", pItem->toString());
	}

	// 아이템을 수리했다는 정보를 DB에다가 저장해준다.
	// 단 분명히 STORAGE_STASH가 돌아올 수 있지만, 
	// 보관함에 있는 것을 수리한다는 것은 말이 안 되므로,
	// 저장하지 않는다.


	// item저장 최적화. by sigi. 2002.5.17
	if (repairPrice>0)
	{
		char pField[80];

		if (pItem->getItemClass()==Item::ITEM_CLASS_SLAYER_PORTAL_ITEM)
		{
			SlayerPortalItem* pSPItem = dynamic_cast<SlayerPortalItem*>(pItem);
			sprintf(pField, "Charge=%d", pSPItem->getCharge());
		}
		else if (pItem->getItemClass()==Item::ITEM_CLASS_OUSTERS_SUMMON_ITEM)
开发者ID:hillwah,项目名称:darkeden,代码行数:67,代码来源:CGRequestRepairHandler.cpp

示例3: execute


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

        for (; itr != rRequiredSkills.end(); ++itr )
        {
            if (pOusters->hasSkill(*itr) != NULL )
            {
                bool canDrop = false;
                SkillInfo* pFollowingSkillInfo = g_pSkillInfoManager->getSkillInfo(*itr);
                list<SkillType_t>& rRequireSkills = pFollowingSkillInfo->getRequireSkills();
                list<SkillType_t>::iterator itr2 = rRequireSkills.begin();
                for (; itr2 != rRequireSkills.end(); ++itr2 )
                {
                    if ((*itr2) != targetSkillType && pOusters->hasSkill(*itr2) != NULL )
                    {
                        SkillInfo* pAlternativeSkillInfo = g_pSkillInfoManager->getSkillInfo(*itr2);
                        if (getSkillMapID((ElementalDomain)pAlternativeSkillInfo->getElementalDomain()) == getSkillMapID((ElementalDomain)pTargetSkillInfo->getElementalDomain()) )
                            canDrop = true;
                    }
                }

                if (!canDrop )
                {
                    failpkt.setDesc(CANNOT_DROP_SKILL);
                    pPlayer->sendPacket(&failpkt);
                    return;
                }
            }
        }
    }

    /*	if (pTargetSkillSlot->getExpLevel() >= 30 )
    	{
    		failpkt.setDesc(TOO_HIGH);
    		pPlayer->sendPacket(&failpkt);
    		return;
    	}*/

    Assert(pTargetSkillInfo != NULL);

    int backPoint = pTargetSkillInfo->getLevelUpPoint();
    Price_t downPrice = (int)(backPoint * pow(pOusters->getLevel(),1.3) * 200);

    if (pTargetSkillSlot->getExpLevel() <= 1 )
    {
        downPrice *= 5;
        if (downPrice == 0 ) downPrice = 1000000;
    }

    if (pOusters->getGold() < downPrice )
    {
        failpkt.setDesc(NOT_ENOUGH_MONEY);
        pPlayer->sendPacket(&failpkt);

        return;
    }

    pOusters->decreaseGoldEx(downPrice);
    pTargetSkillSlot->setExpLevel(pTargetSkillSlot->getExpLevel() - 1);
    pTargetSkillSlot->save();
    if (pTargetSkillSlot->getExpLevel() <= 0 )
    {
        pTargetSkillSlot->destroy(pOusters->getName());
        backPoint = pTargetSkillInfo->getSkillPoint();
        pOusters->removeSkill(targetSkillType);
    }

    pOusters->setSkillBonus(pOusters->getSkillBonus() + backPoint);
    char query[50];
    sprintf(query, "SkillBonus=%d", pOusters->getSkillBonus());
    pOusters->tinysave(query);

    GCDownSkillOK okpkt;
    okpkt.setSkillType(targetSkillType);
    pPlayer->sendPacket(&okpkt);

    GCModifyInformation gcMI;
    gcMI.addLongData(MODIFY_GOLD, pOusters->getGold());
    gcMI.addShortData(MODIFY_SKILL_BONUS_POINT, pOusters->getSkillBonus());

    switch (targetSkillType )
    {
    case SKILL_HIDE_SIGHT:
    {
        OUSTERS_RECORD prev;
        pOusters->getOustersRecord(prev);
        pOusters->initAllStat();
        pOusters->sendRealWearingInfo();
        pOusters->addModifyInfo(prev, gcMI);
    }
    break;

    default :
        break;
    }

    pPlayer->sendPacket(&gcMI);

#endif	// __GAME_SERVER__

    __END_DEBUG_EX __END_CATCH
}
开发者ID:opendarkeden,项目名称:server,代码行数:101,代码来源:CGDownSkillHandler.cpp

示例4: executeAll

//////////////////////////////////////////////////////////////////////////////
// 모든 아이템 수리하기
//////////////////////////////////////////////////////////////////////////////
void CGRequestRepairHandler::executeAll(CGRequestRepair* pPacket , Player* pPlayer)
	 throw(ProtocolException , Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

	Creature*     pPC         = dynamic_cast<GamePlayer*>(pPlayer)->getCreature();
	Price_t       repairPrice = 0;
	GCNPCResponse response;

	bool bSendRealWearingInfo = false;

	if (pPC->isSlayer())
	{
		Slayer* pSlayer = dynamic_cast<Slayer*>(pPC);

		// 모든 아이템을 합한 수리비를 계산한다.
		for (int i=0; i<Slayer::WEAR_MAX; i++)
		{
			Item* pItem = pSlayer->getWearItem((Slayer::WearPart)i);
			if (pItem != NULL)
			{
				if (i == Slayer::WEAR_RIGHTHAND && isTwohandWeapon(pItem))
				{
					// 오른손이고, 현재 들고 있는 무기가 양손 무기라면...
					// 수리 가격에 포함시킬 필요가 없다.
				}
				else
				{
					repairPrice += g_pPriceManager->getRepairPrice(pItem);
				}
			}
		}

		// 돈이 모자라다면 리턴한다.
		if (pSlayer->getGold() < repairPrice)
		{
			response.setCode(NPC_RESPONSE_REPAIR_FAIL_MONEY);
			pPlayer->sendPacket(&response);
			return;
		}

		// 각각의 아이템을 수리하고, DB에 저장한다.
		char pField[80];

		for (int i=0; i<Slayer::WEAR_MAX; i++)
		{
			Item* pItem = pSlayer->getWearItem((Slayer::WearPart)i);
			if (pItem != NULL)
			{
				if (i == Slayer::WEAR_RIGHTHAND && isTwohandWeapon(pItem))
				{
					// 오른손이고, 현재 들고 있는 무기가 양손 무기라면...
					// 수리할 필요가 없다.
				}
				else if (isRepairableItem(pItem ) )
				{
					Durability_t oldDurability = pItem->getDurability();
					repairItem(pItem);
					if (pItem->getDurability() != oldDurability)
					{
						// DB 쿼리를 줄이기 위해서
						// 내구도의 변화가 생긴 경우에만 세이브한다.
						//pItem->save(pSlayer->getName(), STORAGE_GEAR, 0, i, 0);
						// item저장 최적화. by sigi. 2002.5.13
						sprintf(pField, "Durability=%d", pItem->getDurability());
						pItem->tinysave(pField);
					}

					if (oldDurability == 0 )
						bSendRealWearingInfo = true;
				}
			}
		}

		// 돈을 줄이고...
		//pSlayer->setGoldEx(pSlayer->getGold() - repairPrice);

		// by sigi.2002.9.4
		pSlayer->decreaseGoldEx(repairPrice);

		// 로그를 남긴다.
		//log(LOG_REPAIR_ITEM, pSlayer->getName(), "", "ALL");

		// OK 패킷을 날려준다.
		response.setCode(NPC_RESPONSE_REPAIR_OK);
		response.setParameter(pSlayer->getGold());
		pPlayer->sendPacket(&response);
	}
	else if (pPC->isVampire())
	{
		Vampire* pVampire = dynamic_cast<Vampire*>(pPC);

		// 모든 아이템을 합한 수리비를 계산한다.
		for (int i=0; i<Vampire::VAMPIRE_WEAR_MAX; i++)
		{
//.........这里部分代码省略.........
开发者ID:hillwah,项目名称:darkeden,代码行数:101,代码来源:CGRequestRepairHandler.cpp


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