本文整理汇总了C++中Zone::addItem方法的典型用法代码示例。如果您正苦于以下问题:C++ Zone::addItem方法的具体用法?C++ Zone::addItem怎么用?C++ Zone::addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zone
的用法示例。
在下文中一共展示了Zone::addItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unaffect
//----------------------------------------------------------------------
// remove effect from target
//----------------------------------------------------------------------
void EffectCallMotorcycle::unaffect (Motorcycle* pMotorcycle, Slayer* pSlayer)
throw(Error)
{
__BEGIN_TRY
// Slayer의 정보(Zone, x, y)를 구한다.
Zone* pZone = pSlayer->getZone();
Coord_t x = pSlayer->getX();
Coord_t y = pSlayer->getY();
// Slayer의 정보가 유효한지 검사한다.
// 존의 타일 정보를 가져온다.
Tile & tile = pZone->getTile(x, y);
// 만약 해당 존에 아이템이 있다면??
if(tile.hasItem())
{
}
else
{
pZone->addItem(pMotorcycle, x, y);
// 아이템이 이동했다는 패킷을 날린다.
}
__END_CATCH
}
示例2: execute
void InstallMine::execute(Slayer* pSlayer, ObjectID_t, CoordInven_t X, CoordInven_t Y, CoordInven_t TargetX, CoordInven_t TargetY, SkillSlot* pSkillSlot)
throw(Error)
{
__BEGIN_TRY
Assert(pSlayer != NULL);
Assert(pSkillSlot != NULL);
try
{
Player* pPlayer = pSlayer->getPlayer();
Zone* pZone = pSlayer->getZone();
Assert(pPlayer != NULL);
Assert(pZone != NULL);
GCSkillToInventoryOK1 _GCSkillToInventoryOK1;
// GCSkillToTileOK1 _GCSkillToTileOK1;
// GCSkillToTileOK5 _GCSkillToTileOK5;
SkillType_t SkillType = pSkillSlot->getSkillType();
SkillInfo * pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType);
SkillLevel_t SkillLevel = pSkillSlot->getExpLevel();
// 명중률.
//ToHit_t ToHit = pSlayer->getToHit();
int RequiredMP = (int)pSkillInfo->getConsumeMP();
bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP);
bool bTimeCheck = verifyRunTime(pSkillSlot);
bool bRangeCheck = checkZoneLevelToUseSkill(pSlayer);
ZoneCoord_t slayerX = pSlayer->getX(), slayerY = pSlayer->getY();
bool bInstallAction = false;
Mine* pMine = NULL;
Inventory * pInventory = pSlayer->getInventory();
Assert(pInventory != NULL);
if(bManaCheck && bTimeCheck &&bRangeCheck ) {
// mine을 찾는다.
Item* pItem = pInventory->getItem(X, Y);
if(pItem != NULL && pItem->getItemClass() == Item::ITEM_CLASS_MINE)
{
bInstallAction = true;
pMine = dynamic_cast<Mine*>(pItem);
}
}
// 기술의 성패를 따진다.
if (bInstallAction )
{
//Range_t Range = 1;
GCSkillToInventoryOK1 _GCSkillToInventoryOK1;
// GCSkillToInventoryOK5 _GCSkillToInventoryOK5;
ItemInfo* pItemInfo = g_pItemInfoManager->getItemInfo(Item::ITEM_CLASS_MINE, pMine->getItemType());
Damage_t MinDamage = pItemInfo->getMinDamage();
Damage_t MaxDamage = pItemInfo->getMaxDamage();
Damage_t RealDamage = MinDamage + (max (0, ((int)MaxDamage * (int)SkillLevel / 100 ) - MinDamage ));
Mine * pInstallMine = new Mine();
ObjectRegistry& OR = pZone->getObjectRegistry();
OR.registerObject(pInstallMine);
Assert(pInstallMine != NULL);
pInstallMine->setItemType(pMine->getItemType());
pInstallMine->setDir(TargetX);
pInstallMine->setDamage(RealDamage);
pInstallMine->setInstallerName(pSlayer->getName());
pInstallMine->setInstallerPartyID(pSlayer->getPartyID());
pInstallMine->setFlag(Effect::EFFECT_CLASS_INSTALL);
// 아이템 사라지는게 3분인거 때문에 지뢰도 사라졌는데..
// 10분으로 고정. by sigi. 2002.11.3
TPOINT pt = pZone->addItem(pInstallMine, slayerX, slayerY, true, 6000);
// EXP up
Exp_t Point = pSkillInfo->getPoint();
shareAttrExp(pSlayer, 100, 1, 8, 1, _GCSkillToInventoryOK1);
increaseDomainExp(pSlayer, SKILL_DOMAIN_GUN, Point, _GCSkillToInventoryOK1);
increaseSkillExp(pSlayer, SKILL_DOMAIN_GUN, pSkillSlot, pSkillInfo, _GCSkillToInventoryOK1);
decreaseMana(pSlayer, RequiredMP, _GCSkillToInventoryOK1);
decreaseItemNum(pMine, pInventory, pSlayer->getName(), STORAGE_INVENTORY, 0, X, Y);
_GCSkillToInventoryOK1.setObjectID(pInstallMine->getObjectID());
_GCSkillToInventoryOK1.setSkillType(SkillType);
_GCSkillToInventoryOK1.setCEffectID(0);
_GCSkillToInventoryOK1.setX(X);
_GCSkillToInventoryOK1.setY(Y);
_GCSkillToInventoryOK1.setDuration(0);
/*
//.........这里部分代码省略.........
示例3: addShrineToZone
Item* CastleShrineInfoManager::addShrineToZone(ShrineInfo& shrineInfo, ItemType_t itemType )
throw(Error)
{
__BEGIN_TRY
// 성단을 넣을 존을 가져온다.
Zone* pZone = getZoneByZoneID(shrineInfo.getZoneID());
Assert(pZone != NULL);
MonsterCorpse* pShrine = new MonsterCorpse(shrineInfo.getMonsterType(), shrineInfo.getName(), 2);
Assert(pShrine != NULL);
pShrine->setShrine(true);
pShrine->setZone(pZone);
pZone->getObjectRegistry().registerObject(pShrine);
shrineInfo.setObjectID(pShrine->getObjectID());
Item* pItem = NULL;
/* if (shrineInfo.getShrineType() == ShrineInfo::SHRINE_GUARD )
{
pShrine->setFlag(Effect::EFFECT_CLASS_SHRINE_GUARD);
EffectShrineGuard* pEffect = new EffectShrineGuard(pShrine);
pEffect->setShrineID(itemType);
pEffect->setTick(60 * 10);
pShrine->getEffectManager().addEffect(pEffect);
}
else if (shrineInfo.getShrineType() == ShrineInfo::SHRINE_HOLY )
{
pShrine->setFlag(Effect::EFFECT_CLASS_SHRINE_HOLY);
EffectShrineHoly* pEffect = new EffectShrineHoly(pShrine);
pEffect->setShrineID(itemType);
pEffect->setTick(60 * 10);
pShrine->getEffectManager().addEffect(pEffect);
}*/
TPOINT tp = pZone->addItem(pShrine, shrineInfo.getX(), shrineInfo.getY(), true);
Assert(tp.x != -1);
// 성의 상징을 추가할 필요가 있다면 추가한다.
if (shrineInfo.getShrineType() == ShrineInfo::SHRINE_GUARD )
{
//if (AddBible[ itemType ] )
{
list<OptionType_t> optionNULL;
pItem = g_pItemFactoryManager->createItem(Item::ITEM_CLASS_CASTLE_SYMBOL, itemType, optionNULL);
Assert(pItem != NULL);
char strZoneID[10];
sprintf(strZoneID, "%d", (int)pZone->getZoneID());
pZone->registerObject(pItem);
pItem->create(strZoneID, STORAGE_CORPSE, pShrine->getObjectID(), 0, 0);
pShrine->addTreasure(pItem);
}
// 수호성단이라는걸 표시해둔다.
pShrine->setFlag(Effect::EFFECT_CLASS_CASTLE_SHRINE_GUARD);
// 모든 수호성단에 Shield Effect 붙인다
pShrine->setFlag(Effect::EFFECT_CLASS_SHRINE_SHIELD);
EffectShrineShield* pEffect = new EffectShrineShield(pShrine);
pEffect->setShrineID(itemType);
pEffect->setTick(60 * 10);
pShrine->getEffectManager().addEffect(pEffect);
}
else
{
// 성지성단이라는걸 표시해둔다.
pShrine->setFlag(Effect::EFFECT_CLASS_CASTLE_SHRINE_HOLY);
}
// 성단 좌표를 새로 세팅한다.
shrineInfo.setX(tp.x);
shrineInfo.setY(tp.y);
return pItem;
__END_CATCH
}
示例4: execute
//.........这里部分代码省略.........
Tile& tile = pZone->getTile(x, y);
// 곧 pFromCreature 즉, 원래의 뱀파이어 객체는 지워질 것이므로,
// PCFinder에 들어가 있는 값은 쓰레기 값이 될 것이다.
// 그러므로 뱀파이어 포인터를 지워주고, 새로운 슬레이어 포인터를 더한다.
g_pPCFinder->deleteCreature(pFromCreature->getName());
g_pPCFinder->addCreature(pNewSlayer);
// 길드 현재 접속 멤버 리스트에서 삭제한다.
if (pVampire->getGuildID() != 0 )
g_pGuildManager->getGuild(pVampire->getGuildID() )->deleteCurrentMember(pVampire->getName());
// 인벤토리 교체.
Inventory* pInventory = pVampire->getInventory();
pNewSlayer->setInventory(pInventory);
pVampire->setInventory(NULL);
// 보관함 교체
pNewSlayer->deleteStash();
pNewSlayer->setStash(pVampire->getStash());
pNewSlayer->setStashNum(pVampire->getStashNum());
pNewSlayer->setStashStatus(false);
pVampire->setStash(NULL);
/*
// 가비지 교체
while (true)
{
Item* pGarbage = pVampire->popItemFromGarbage();
// 더 이상 없다면 브레이크...
if (pGarbage == NULL) break;
pNewSlayer->addItemToGarbage(pGarbage);
}
*/
// 플래그 셋 교체
pNewSlayer->deleteFlagSet();
pNewSlayer->setFlagSet(pVampire->getFlagSet());
pVampire->setFlagSet(NULL);
Item* pItem = NULL;
_TPOINT point;
// 입고 있는 아이템들을 인벤토리 또는 바닥으로 옮긴다.
for(int part = 0; part < (int)Vampire::VAMPIRE_WEAR_MAX; part++)
{
pItem = pVampire->getWearItem((Vampire::WearPart)part);
if (pItem != NULL)
{
// 먼저 기어에서 삭제하고...
pVampire->deleteWearItem((Vampire::WearPart)part);
// 인벤토리에 자리가 있으면 인벤토리에 더하고...
if (pInventory->getEmptySlot(pItem, point))
{
pInventory->addItem(point.x, point.y, pItem);
pItem->save(pNewSlayer->getName(), STORAGE_INVENTORY, 0, point.x, point.y);
}
// 자리가 없으면 바닥에 떨어뜨린다.
else
{
ZoneCoord_t ZoneX = pVampire->getX();
ZoneCoord_t ZoneY = pVampire->getY();