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


C++ CItem类代码示例

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


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

示例1: ADDTOCALLSTACK

bool CChar::Use_Seed( CItem * pSeed, CPointMap * pPoint )
{
	ADDTOCALLSTACK("CChar::Use_Seed");
	// Use the seed at the current point on the ground or some new point that i can touch.
	// IT_SEED from IT_FRUIT

	ASSERT(pSeed);
	CPointMap pt;
	if ( pPoint )
		pt = *pPoint;
	else if ( pSeed->IsTopLevel() )
		pt = pSeed->GetTopPoint();
	else
		pt = GetTopPoint();

	if ( !CanTouch(pt) )
	{
		SysMessageDefault(DEFMSG_MSG_SEED_REACH);
		return false;
	}

	// is there soil here ? IT_DIRT
	if ( !IsPriv(PRIV_GM) && !g_World.IsItemTypeNear(pt, IT_DIRT, 0, false) )
	{
		SysMessageDefault(DEFMSG_MSG_SEED_TARGSOIL);
		return(false);
	}

	const CItemBase *pItemDef = pSeed->Item_GetDef();
	ITEMID_TYPE idReset = static_cast<ITEMID_TYPE>(RES_GET_INDEX(pItemDef->m_ttFruit.m_idReset));
	if ( idReset == 0 )
	{
		SysMessageDefault(DEFMSG_MSG_SEED_NOGOOD);
		return false;
	}

	// Already a plant here ?
	CWorldSearch AreaItems(pt);
	for (;;)
	{
		CItem *pItem = AreaItems.GetItem();
		if ( !pItem )
			break;
		if ( pItem->IsType(IT_TREE) || pItem->IsType(IT_FOLIAGE) )		// there's already a tree here
		{
			SysMessageDefault(DEFMSG_MSG_SEED_ATREE);
			return false;
		}
		if ( pItem->IsType(IT_CROPS) )		// there's already a plant here
			pItem->Delete();
	}

	// plant it and consume the seed.

	CItem *pPlant = CItem::CreateScript(idReset, this);
	ASSERT(pPlant);

	pPlant->MoveToUpdate(pt);
	if ( pPlant->IsType(IT_CROPS) || pPlant->IsType(IT_FOLIAGE) )
	{
		pPlant->m_itCrop.m_ReapFruitID = pSeed->GetID();
		pPlant->Plant_CropReset();
	}
	else
	{
		pPlant->SetDecayTime(10 * g_Cfg.m_iDecay_Item);
	}

	pSeed->ConsumeAmount();
	return true;
}
开发者ID:DarkLotus,项目名称:Source,代码行数:71,代码来源:CCharUse.cpp

示例2: CreateLaserEntity

void CLaserBeam::UpdateLaser(const CLaserBeam::SLaserUpdateDesc& laserUpdateDesc)
{
	if(m_pLaserParams && m_laserOn)
	{
		IEntity* pLaserEntity = CreateLaserEntity();
		if (pLaserEntity)
		{
			m_lastLaserUpdatePosition = laserUpdateDesc.m_laserPos;
			m_lastLaserUpdateDirection = laserUpdateDesc.m_laserDir;

			m_laserUpdateTimer += laserUpdateDesc.m_frameTime;

			UpdateLaserGeometry(*pLaserEntity);

			if(m_laserUpdateTimer < LASER_UPDATE_TIME)
				return;

			m_laserUpdateTimer = Random(0.0f, LASER_UPDATE_TIME * 0.4f);

			if ((laserUpdateDesc.m_ownerCloaked && !laserUpdateDesc.m_weaponZoomed) || laserUpdateDesc.m_bOwnerHidden)
			{
				pLaserEntity->Hide(true);
				return;
			}
			pLaserEntity->Hide(false);

			const float range = m_pLaserParams->laser_range[GetIndexFromGeometrySlot()];

			// Use the same flags as the AI system uses for visbility.
			const int objects = ent_terrain|ent_static|ent_rigid|ent_sleeping_rigid|ent_independent; //ent_living;
			const int flags = (geom_colltype_ray << rwi_colltype_bit) | rwi_colltype_any | (10 & rwi_pierceability_mask) | (geom_colltype14 << rwi_colltype_bit);

			//If we did not get a result, just cancel it, we will queue a new one again
			RayCastRequest::Priority requestPriority = RayCastRequest::MediumPriority;
			if (m_queuedRayId != 0)
			{
				g_pGame->GetRayCaster().Cancel(m_queuedRayId);
				m_queuedRayId = 0;
				requestPriority = RayCastRequest::HighPriority;
			}

			IItemSystem* pItemSystem = g_pGame->GetIGameFramework()->GetIItemSystem();
			IPhysicalEntity* pSkipEntity = NULL;
			uint8 numSkips = 0;

			CItem* pItem = static_cast<CItem*>(pItemSystem->GetItem(m_ownerEntityId));

			if(pItem)
			{
				if(pItem->IsAccessory())
				{
					CItem* pParentItem = static_cast<CItem*>(pItemSystem->GetItem(pItem->GetParentId()));
				
					if(pParentItem)
					{
						pItem = pParentItem;
					}					
				}

				IEntity* pOwnerEnt = 0;
				CWeapon* pWeapon = static_cast<CWeapon*>(pItem->GetIWeapon());
				if (pWeapon && pWeapon->GetHostId() != 0)
				{
					pOwnerEnt = gEnv->pEntitySystem->GetEntity(pWeapon->GetHostId());
				}
				else
				{
					pOwnerEnt = pItem->GetOwner();
				}

				if(pOwnerEnt)
				{
					IPhysicalEntity* pOwnerPhysics = pOwnerEnt->GetPhysics();

					if(pOwnerPhysics)
					{
						pSkipEntity = pOwnerPhysics;
						numSkips++;
					}
				}
			}

			m_queuedRayId = g_pGame->GetRayCaster().Queue(
				requestPriority,
				RayCastRequest(laserUpdateDesc.m_laserPos, laserUpdateDesc.m_laserDir*range,
				objects,
				flags,
				&pSkipEntity,
				numSkips),
				functor(*this, &CLaserBeam::OnRayCastDataReceived));
		}

	}
	else if (!m_pLaserParams)
	{
		GameWarning("LASER PARAMS: Item of type CLaser is missing it's laser params!");
	}
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:98,代码来源:Laser.cpp

示例3: ZTLuaManager

void ClassCalc::GetAttackDamage(LPOBJ lpUser)
{
#if (ENABLETEST_ZTLUA == 1)
    ZTLuaManager* LuaMng = new ZTLuaManager(FILE_LUA_CHARACTERBASICS);
    ZTLuaUnit::Bind(LuaMng->getLua());
    ZTLuaItem::Bind(LuaMng->getLua());
    LuaMng->Call("setAttackDamage", lpUser->m_Index);
    ZTLuaManager::Delete(LuaMng);
#else
    CItem* Right	= &lpUser->pInventory[0];
    CItem* Left		= &lpUser->pInventory[1];
    int Strength	= lpUser->Strength + lpUser->AddStrength;
    int Dexterity	= lpUser->Dexterity + lpUser->AddDexterity;
    int Vitality	= lpUser->Vitality + lpUser->AddVitality;
    int Energy		= lpUser->Energy + lpUser->AddEnergy;
    WORD Class		= lpUser->Class;
    // ----
    if( Class == CLASS_WIZARD || Class == CLASS_KNIGHT )
    {
        lpUser->m_AttackDamageMinRight	= Strength / this->m_Data[Class].AttackDamageMinRightDiv1;
        lpUser->m_AttackDamageMaxRight	= Strength / this->m_Data[Class].AttackDamageMaxRightDiv1;
        lpUser->m_AttackDamageMinLeft	= Strength / this->m_Data[Class].AttackDamageMinLeftDiv1;
        lpUser->m_AttackDamageMaxLeft	= Strength / this->m_Data[Class].AttackDamageMaxLeftDiv1;
    }
    else if( Class == CLASS_ELF )
    {
        if(		(Right->m_Type >= ITEMGET(4,8) && Right->m_Type < ITEMGET(4,15) )
                ||	(Left->m_Type >= ITEMGET(4,0) && Left->m_Type < ITEMGET(4,7))
                ||	Right->m_Type == ITEMGET(4,16)
                ||	Left->m_Type == ITEMGET(4,17)
                ||	Right->m_Type == ITEMGET(4,18)
                ||	Right->m_Type == ITEMGET(4,19)
                ||	Left->m_Type == ITEMGET(4,20)
                ||	Left->m_Type == ITEMGET(4,21)
                ||	Left->m_Type == ITEMGET(4,22)
                ||	Left->m_Type == ITEMGET(4,23)
                ||	Left->m_Type == ITEMGET(4,24)
                ||	Left->m_Type == ITEMGET(4,25)
                ||	Right->m_Type == ITEMGET(4,26)
                ||	Left->m_Type == ITEMGET(4,27))
        {
            if(		(Right->IsItem() && !Right->m_IsValidItem)
                    ||	(Left->IsItem() && !Left->m_IsValidItem) )
            {
                lpUser->m_AttackDamageMinRight	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMinRightDiv3;
                lpUser->m_AttackDamageMaxRight	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMaxRightDiv3;
                lpUser->m_AttackDamageMinLeft	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMinLeftDiv3;
                lpUser->m_AttackDamageMaxLeft	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMaxLeftDiv3;
            }
            else
            {
                lpUser->m_AttackDamageMinRight	= (Dexterity / this->m_Data[Class].AttackDamageMinRightDiv1) + (Strength / this->m_Data[Class].AttackDamageMinRightDiv2);
                lpUser->m_AttackDamageMaxRight	= (Dexterity / this->m_Data[Class].AttackDamageMaxRightDiv1) + (Strength / this->m_Data[Class].AttackDamageMaxRightDiv2);
                lpUser->m_AttackDamageMinLeft	= (Dexterity / this->m_Data[Class].AttackDamageMinLeftDiv1) + (Strength / this->m_Data[Class].AttackDamageMinLeftDiv2);
                lpUser->m_AttackDamageMaxLeft	= (Dexterity / this->m_Data[Class].AttackDamageMaxLeftDiv1) + (Strength / this->m_Data[Class].AttackDamageMaxLeftDiv2);
            }
        }
        else
        {
            lpUser->m_AttackDamageMinRight	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMinRightDiv3;
            lpUser->m_AttackDamageMaxRight	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMaxRightDiv3;
            lpUser->m_AttackDamageMinLeft	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMinLeftDiv3;
            lpUser->m_AttackDamageMaxLeft	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMaxLeftDiv3;
        }
    }
    else if( Class == CLASS_MAGUMSA || Class == CLASS_DARKLORD )
    {
        lpUser->m_AttackDamageMinRight	= (Strength / this->m_Data[Class].AttackDamageMinRightDiv1) + (Energy / this->m_Data[Class].AttackDamageMinRightDiv2);
        lpUser->m_AttackDamageMaxRight	= (Strength / this->m_Data[Class].AttackDamageMaxRightDiv1) + (Energy / this->m_Data[Class].AttackDamageMaxRightDiv2);
        lpUser->m_AttackDamageMinLeft	= (Strength / this->m_Data[Class].AttackDamageMinLeftDiv1) + (Energy / this->m_Data[Class].AttackDamageMinLeftDiv2);
        lpUser->m_AttackDamageMaxLeft	= (Strength / this->m_Data[Class].AttackDamageMaxLeftDiv1) + (Energy / this->m_Data[Class].AttackDamageMaxLeftDiv2);
    }
    else if( Class == CLASS_SUMMONER )
    {
        lpUser->m_AttackDamageMinRight	= ((Strength + Dexterity) / this->m_Data[Class].AttackDamageMinRightDiv1);
        lpUser->m_AttackDamageMaxRight	= ((Strength + Dexterity) / this->m_Data[Class].AttackDamageMaxRightDiv1);
        lpUser->m_AttackDamageMinLeft	= ((Strength + Dexterity) / this->m_Data[Class].AttackDamageMinLeftDiv1);
        lpUser->m_AttackDamageMaxLeft	= ((Strength + Dexterity) / this->m_Data[Class].AttackDamageMaxLeftDiv1);
    }
    else if( Class == CLASS_FIGHTER )
    {
        lpUser->m_AttackDamageMinRight	= Vitality / this->m_Data[Class].AttackDamageMinRightDiv1 + Strength / this->m_Data[Class].AttackDamageMinRightDiv2;
        lpUser->m_AttackDamageMaxRight	= Vitality / this->m_Data[Class].AttackDamageMaxRightDiv1 + Strength / this->m_Data[Class].AttackDamageMaxRightDiv2;
        lpUser->m_AttackDamageMinLeft	= Vitality / this->m_Data[Class].AttackDamageMinLeftDiv1 + Strength / this->m_Data[Class].AttackDamageMinLeftDiv2;
        lpUser->m_AttackDamageMaxLeft	= Vitality / this->m_Data[Class].AttackDamageMaxLeftDiv1 + Strength / this->m_Data[Class].AttackDamageMaxLeftDiv2;
    }
    else
    {
        lpUser->m_AttackDamageMinRight	= Strength / 8;
        lpUser->m_AttackDamageMaxRight	= Strength / 4;
        lpUser->m_AttackDamageMinLeft	= Strength / 8;
        lpUser->m_AttackDamageMaxLeft	= Strength / 4;
    }
#endif
}
开发者ID:stimpy76,项目名称:OpenMuS9,代码行数:95,代码来源:ClassCalc.cpp

示例4: assert

void CSeparateDlg::Update( CObservable* pObservable, CTObject* pObj )
{
	assert( pObservable );
	assert( pObj && strcmp( pObj->toString() ,"Separate" ) == 0 );
	if( pObj == NULL || strcmp( pObj->toString() ,"Separate" ) ) return;

	CTEventSeparate* pEvent = (CTEventSeparate*)pObj;
	switch( pEvent->GetID() )
	{
	case CTEventSeparate::EID_REMOVE_MATERIAL_ITEM:
		ClientLog (LOG_NORMAL, "CSeperateDlg::Update.  Event 2: EID_REMOVE_MATERIAL_ITEM");
		m_MaterialItemSlot.DetachIcon();
		break;
	case CTEventSeparate::EID_SET_MATERIAL_ITEM:
		{
			CItem* pItem = pEvent->GetItem();
			ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Event 1: EID_SET_MATERIAL_ITEM Item Type %i Item ID %i", pItem->GetType(), pItem->GetItemNo());
			assert( pItem );
			if( pItem  )
				m_MaterialItemSlot.AttachIcon( pItem->CreateItemIcon() );
		
			break;
		}
	case CTEventSeparate::EID_REMOVE_OUTPUT_ITEM:
		{
			ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Event 4: EID_REMOVE_OUTPUT_ITEM");
			int iIndex = pEvent->GetIndex();
			//assert( iIndex >= 0 && iIndex < (int)m_OutputItemSlots.size() );
			if( iIndex  >= 0 && iIndex < (int)m_OutputItemSlots.size() )
				m_OutputItemSlots[iIndex].DetachIcon();	
			break;
		}
	case CTEventSeparate::EID_SET_OUTPUT_ITEM:
		{
			ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Event 3: EID_SET_OUTPUT_ITEM");
			int e = m_OutputItemSlots.size();
			int iIndex = pEvent->GetIndex();
			//assert( iIndex >= 0 && iIndex < (int)m_OutputItemSlots.size() );
			if( iIndex  >= 0 && iIndex < (int)m_OutputItemSlots.size() )
			{
				CItem* pItem = pEvent->GetItem();
				ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Event 3: EID_SET_OUTPUT_ITEM Item Type %i Item ID %i", pItem->GetType(), pItem->GetItemNo());
				//assert( pItem && m_OutputItemSlots[iIndex].GetIcon() == NULL );


				if( pItem && m_OutputItemSlots[iIndex].GetIcon() == NULL )
				{
					m_OutputItemSlots[iIndex].AttachIcon( pItem->CreateItemIcon() );
				}
				else if( pItem && m_OutputItemSlots[iIndex].GetIcon() != NULL)
				{
					m_OutputItemSlots[iIndex].DetachIcon();	
					m_OutputItemSlots[iIndex].AttachIcon( pItem->CreateItemIcon() );
				}
				else
				{
					assert(" pItem && m_OutputItemSlots[iIndex].GetIcon() == NULL ?? ");  //PY: Logically speaking, this can never happen unless it is simultaineously neither NULL or Not NULL. Duhh!! 
				}
			}
			break;
		}
	case CTEventSeparate::EID_RECEIVE_RESULT:
		{
			ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Event 5: EID_RECEIVE_RESULT");
			ChangeState( STATE_RESULT );
			break;
		}
	default:
		{
			ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Invalid Seperate Event");
			assert( 0 && "Invalid Separate Event Type" );
		}
		break;
	}

}
开发者ID:PurpleYouko,项目名称:Wibble_Wibble,代码行数:76,代码来源:CSeparateDlg.cpp

示例5: Ctx

int CUIHelper::CalcItemEntryHeight (CSpaceObject *pSource, const CItem &Item, const RECT &rcRect, DWORD dwOptions) const

//	CalcItemEntryHeight
//
//	Computes the height necessary to paint the item entry.

	{
	const CVisualPalette &VI = m_HI.GetVisuals();
	const CG16bitFont &LargeBold = VI.GetFont(fontLargeBold);
	const CG16bitFont &Medium = VI.GetFont(fontMedium);

	bool bNoIcon = ((dwOptions & OPTION_NO_ICON) == OPTION_NO_ICON);
	bool bTitle = ((dwOptions & OPTION_TITLE) == OPTION_TITLE);

	//	Get the item

	CItemCtx Ctx(&Item, pSource);
	CItemType *pType = Item.GetType();
	if (pType == NULL)
		return ITEM_DEFAULT_HEIGHT;

	//	Compute the rect where the reference text will paint

	RECT rcDrawRect = rcRect;
	rcDrawRect.left += ITEM_TEXT_MARGIN_X;
	rcDrawRect.right -= ITEM_TEXT_MARGIN_X;
	if (!bNoIcon)
		rcDrawRect.left += ICON_WIDTH;

	int iLevel = pType->GetApparentLevel();

	//	Compute the height of the row

	int cyHeight = 0;

	//	Account for margin

	cyHeight += ITEM_TEXT_MARGIN_Y;

	//	Item title

	cyHeight += LargeBold.GetHeight();
	if (bTitle)
		cyHeight += ITEM_TITLE_EXTRA_MARGIN;

	//	Attributes

	TArray<SDisplayAttribute> Attribs;
	if (Item.GetDisplayAttributes(Ctx, &Attribs))
		{
		int cyAttribs;
		FormatDisplayAttributes(Attribs, rcDrawRect, &cyAttribs);
		cyHeight += cyAttribs + ATTRIB_SPACING_Y;
		}

	//	Reference

	CString sReference = pType->GetReference(Ctx);

	//	If this is a weapon, then add room for the weapon damage

	if (Item.GetReferenceDamageType(pSource, -1, 0, NULL, NULL))
		cyHeight += Medium.GetHeight();

	//	If this is armor or a shield, then add room for damage resistance

	else if (Item.GetReferenceDamageAdj(pSource, 0, NULL, NULL))
		cyHeight += Medium.GetHeight();

	//	Measure the reference text

	int iLines;
	if (!sReference.IsBlank())
		{
		iLines = Medium.BreakText(sReference, RectWidth(rcDrawRect), NULL, 0);
		cyHeight += iLines * Medium.GetHeight();
		}

	//	Measure the description

	CString sDesc = Item.GetDesc();
	iLines = Medium.BreakText(sDesc, RectWidth(rcDrawRect), NULL, 0);
	cyHeight += iLines * Medium.GetHeight();

	//	Margin

	cyHeight += ITEM_TEXT_MARGIN_BOTTOM;

	//	Done

	cyHeight = Max(ITEM_DEFAULT_HEIGHT, cyHeight);

	return cyHeight;
	}
开发者ID:,项目名称:,代码行数:94,代码来源:

示例6: GCServerMsgStringSend

BOOL CJewelOfHarmonySystem::StrengthenItemByJewelOfHarmony(LPOBJ lpObj, int source, int target)
{
	if ( this->m_bSystemStrengthenItem == FALSE )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(13, 52)), lpObj->m_Index, 1);
		return FALSE;
	}

	if ( source < 0 || source > MAIN_INVENTORY_SIZE-1 )
		return FALSE;

	if ( target < 0 || target > MAIN_INVENTORY_SIZE-1 )
		return FALSE;

	if ( lpObj->pInventory[source].IsItem() == FALSE )
		return FALSE;

	if ( lpObj->pInventory[target].IsItem() == FALSE )
		return FALSE;

	CItem * pSource = &lpObj->pInventory[source];
	CItem * pTarget = &lpObj->pInventory[target];

	if ( this->IsStrengthenByJewelOfHarmony(pTarget) == TRUE )
	{
		CLog.LogAdd("[JewelOfHarmony][Strengten Item] Already Strengtened [%s][%s]",
			lpObj->AccountID, lpObj->Name);

		return FALSE;
	}

	if (pTarget->IsSetItem() == TRUE )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(13, 44)), lpObj->m_Index, 1);
		CLog.LogAdd("[JewelOfHarmony][Strengten Item] SetItem not enable to Strengtened [%s][%s]",
			lpObj->AccountID, lpObj->Name);

		return FALSE;
	}

	int iItemType = this->_GetItemType(pTarget);

	if ( iItemType == JEWELOFHARMONY_ITEM_TYPE_NULL )
	{
		CLog.LogAdd("[JewelOfHarmony][Strengten Item] Strenghten Fail [%s][%s] Name[%s] Type[%d] Serial[%d] Invalid ItemType[%d]",
			lpObj->AccountID, lpObj->Name, pTarget->GetName(), pTarget->m_Type,
			pTarget->m_Number, iItemType);
		
		return FALSE;
	}

	int iItemOption = this->_GetSelectRandomOption(pTarget, iItemType);

	if ( iItemOption == AT_JEWELOFHARMONY_NOT_STRENGTHEN_ITEM )
	{
		CLog.LogAdd("[JewelOfHarmony][Strengten Item] Strenghten Fail - NOT OPTION [%s][%s] Name[%s] Type[%d] Serial[%d] ItemType[%d]",
			lpObj->AccountID, lpObj->Name, pTarget->GetName(), pTarget->m_Type,
			pTarget->m_Number, iItemType);
		
		return FALSE;
	}

	int iItemOptionLevel = this->m_itemOption[iItemType][iItemOption].iRequireLevel;
	int iSuccessRate = rand() % 100;

	if ( iSuccessRate >= this->m_iRateStrengthenSuccess )
	{
		CLog.LogAdd("[JewelOfHarmony][Strengten Item] Strenghten Fail [%s][%s] Name[%s] Type[%d] Serial[%d]  Rate (%d/%d)",
			lpObj->AccountID, lpObj->Name, pTarget->GetName(), pTarget->m_Type,
			pTarget->m_Number, iSuccessRate, this->m_iRateStrengthenSuccess);
		GCServerMsgStringSend(lMsg.Get(MSGGET(13, 45)), lpObj->m_Index, 1);
		return TRUE;
	}


	this->_MakeOption(pTarget, iItemOption, iItemOptionLevel);

	CLog.LogAdd("[JewelOfHarmony][Strengten Item] Strenghten Success [%s][%s] Name[%s] Type[%d] Serial[%d] Rate (%d/%d) Option %d OptionLevel %d",
		lpObj->AccountID, lpObj->Name, pTarget->GetName(), pTarget->m_Type,
		pTarget->m_Number, iSuccessRate, this->m_iRateStrengthenSuccess,
		iItemOption, iItemOptionLevel);

	GCServerMsgStringSend(lMsg.Get(MSGGET(13, 46)), lpObj->m_Index, 1);

	gObjMakePreviewCharSet(lpObj->m_Index);

	float levelitemdur = (float)ItemGetDurability(lpObj->pInventory[target].m_Type,
		lpObj->pInventory[target].m_Level, lpObj->pInventory[target].IsExtItem(),
		lpObj->pInventory[target].IsSetItem());

	lpObj->pInventory[target].m_Durability = levelitemdur * lpObj->pInventory[target].m_Durability / lpObj->pInventory[target].m_BaseDurability;

	lpObj->pInventory[target].Convert(lpObj->pInventory[target].m_Type,
		lpObj->pInventory[target].m_Option1, lpObj->pInventory[target].m_Option2,
		lpObj->pInventory[target].m_Option3, lpObj->pInventory[target].m_NewOption,
		lpObj->pInventory[target].m_SetOption, lpObj->pInventory[target].m_ItemOptionEx,lpObj->pInventory[target].m_ItemSocket);


	return TRUE;
}
开发者ID:ElBedeawi,项目名称:mu-server-ex,代码行数:100,代码来源:JewelOfHarmonySystem.cpp

示例7: ADDTOCALLSTACK

// timer expired, should I grow?
bool CItem::Plant_OnTick()
{
	ADDTOCALLSTACK("CItem::Plant_OnTick");
	ASSERT( IsType(IT_CROPS) || IsType(IT_FOLIAGE));
	// If it is in a container, kill it.
	if ( !IsTopLevel())
	{
		return false;
	}

	// Make sure the darn thing isn't moveable
	SetAttr(ATTR_MOVE_NEVER);
	Plant_SetTimer();

	// No tree stuff below here
	if ( IsAttr(ATTR_INVIS)) // If it's invis, take care of it here and return
	{
		SetHue( HUE_DEFAULT );
		ClrAttr(ATTR_INVIS);
		Update();
		return true;
	}

	const CItemBase * pItemDef = Item_GetDef();
	ITEMID_TYPE iGrowID = pItemDef->m_ttCrops.m_idGrow;

	if ( iGrowID == -1 )
	{
		// Some plants generate a fruit on the ground when ripe.
		ITEMID_TYPE iFruitID = static_cast<ITEMID_TYPE>(RES_GET_INDEX(pItemDef->m_ttCrops.m_idGrow));
		if ( m_itCrop.m_ReapFruitID )
		{
			iFruitID = static_cast<ITEMID_TYPE>(RES_GET_INDEX(m_itCrop.m_ReapFruitID));
		}
		if ( ! iFruitID )
		{
			return( true );
		}

		// put a fruit on the ground if not already here.
		CWorldSearch AreaItems( GetTopPoint() );
		for (;;)
		{
			CItem * pItem = AreaItems.GetItem();
			if ( pItem == NULL )
			{
				CItem * pItemFruit = CItem::CreateScript( iFruitID );
				ASSERT(pItemFruit);
				pItemFruit->MoveToDecay(GetTopPoint(),10*g_Cfg.m_iDecay_Item);
				break;
			}
			if ( pItem->IsType( IT_FRUIT ) || pItem->IsType( IT_REAGENT_RAW ))
				break;
		}

		// NOTE: ??? The plant should cycle here as well !
		iGrowID = pItemDef->m_ttCrops.m_idReset;
	}

	if ( iGrowID > 0 )
	{
		SetID(static_cast<ITEMID_TYPE>(RES_GET_INDEX(iGrowID)));
		Update();
		return true;
	}

	// some plants go dormant again ?

	// m_itCrop.m_Fruit_ID = iTemp;
	return true;
}
开发者ID:leandrorenato,项目名称:Source,代码行数:72,代码来源:CItemSpawn.cpp

示例8: Ctx

void CGItemListArea::PaintItem (CG16bitImage &Dest, const CItem &Item, const RECT &rcRect, bool bSelected)

//	PaintItem
//
//	Paints the item

	{
	//	Item context

	CItemCtx Ctx(&Item, m_pListData->GetSource());
	CItemType *pItemType = Item.GetType();

	//	Paint the image

	DrawItemTypeIcon(Dest, rcRect.left, rcRect.top, pItemType);

	RECT rcDrawRect = rcRect;
	rcDrawRect.left += ICON_WIDTH + ITEM_TEXT_MARGIN_X;
	rcDrawRect.right -= ITEM_TEXT_MARGIN_X;
	rcDrawRect.top += ITEM_TEXT_MARGIN_Y;

	//	Paint the attribute blocks

	RECT rcAttrib;
	rcAttrib = rcDrawRect;
	rcAttrib.bottom = rcAttrib.top + m_pFonts->MediumHeavyBold.GetHeight();

	if (Item.IsDamaged())
		PaintItemModifier(Dest,
				CONSTLIT("Damaged"),
				RGB_ILLEGAL_BACKGROUND,
				&rcAttrib);
	else if (Item.IsDisrupted())
		PaintItemModifier(Dest,
				CONSTLIT("Ionized"),
				RGB_ILLEGAL_BACKGROUND,
				&rcAttrib);

	if (pItemType->IsKnown()
			&& pItemType->HasAttribute(CONSTLIT("Military")))
		PaintItemModifier(Dest, 
				CONSTLIT("Military"),
				RGB_MILITARY_BACKGROUND,
				&rcAttrib);

	if (pItemType->IsKnown()
			&& pItemType->HasAttribute(CONSTLIT("Illegal")))
		PaintItemModifier(Dest, 
				CONSTLIT("Illegal"),
				RGB_ILLEGAL_BACKGROUND,
				&rcAttrib);

	CString sEnhanced = Item.GetEnhancedDesc(m_pListData->GetSource());
	if (!sEnhanced.IsBlank())
		{
		bool bDisadvantage = (*(sEnhanced.GetASCIIZPointer()) == '-');
		PaintItemModifier(Dest,
				sEnhanced,
				(bDisadvantage ? RGB_ILLEGAL_BACKGROUND : RGB_MILITARY_BACKGROUND),
				&rcAttrib);
		}

	//	Paint the item name

	int cyHeight;
	RECT rcTitle = rcDrawRect;
	rcTitle.right = rcAttrib.right;
	m_pFonts->LargeBold.DrawText(Dest,
			rcTitle,
			m_pFonts->wItemTitle,
			Item.GetNounPhrase(nounCount | nounNoModifiers),
			0,
			CG16bitFont::SmartQuotes | CG16bitFont::TruncateLine,
			&cyHeight);

	rcDrawRect.top += cyHeight;

	//	Stats

	CString sStat;

	int iLevel = pItemType->GetApparentLevel();
	CString sReference = pItemType->GetReference(Ctx);
	DamageTypes iDamageType;
	CString sDamageRef;
	int iDamageAdj[damageCount];
	int iHP;

	if (Item.GetReferenceDamageType(m_pListData->GetSource(), -1, 0, &iDamageType, &sDamageRef))
		{
		//	Paint the initial text

		sStat = strPatternSubst("Level %s —", strLevel(iLevel));
		int cxWidth = m_pFonts->Medium.MeasureText(sStat, &cyHeight);
		m_pFonts->Medium.DrawText(Dest, 
				rcDrawRect,
				m_pFonts->wItemRef,
				sStat,
				0,
				0,
//.........这里部分代码省略.........
开发者ID:Sdw195,项目名称:Transcendence,代码行数:101,代码来源:CGItemListArea.cpp

示例9: gObjAddCallMon

void ObjBotWarper::MakeBot()
{
	if(this->Enabled == true)
	{
		for(int botNum=0;botNum<MAX_BOTWARPER;botNum++)
		{
			if(this->bot[botNum].Enabled == true)
			{
				int result = gObjAddCallMon();

				if(result >= 0)
				{
					this->bot[botNum].index = result;
					gObj[result].m_PosNum = (WORD)-1;
					gObj[result].X = this->bot[botNum].X;
					gObj[result].Y = this->bot[botNum].Y;
					gObj[result].m_OldX = this->bot[botNum].X;
					gObj[result].m_OldY = this->bot[botNum].Y;
					gObj[result].TX = this->bot[botNum].X;
					gObj[result].TY = this->bot[botNum].Y;
					gObj[result].MTX = this->bot[botNum].X;
					gObj[result].MTY = this->bot[botNum].Y;
					gObj[result].Dir = this->bot[botNum].Dir;
					gObj[result].MapNumber = this->bot[botNum].Map;
					gObj[result].Live = TRUE;
					gObj[result].PathCount = 0;
					gObj[result].IsBot = 10;
					gObjSetMonster(result,this->bot[botNum].Class,"PetBot");

					gObj[result].ChangeUP = this->bot[botNum].Class & 0x07;	// Set Second Type of Character
					gObj[result].Class = this->bot[botNum].Class;
					gObj[result].Level = 400;
					gObj[result].Life = 1;
					gObj[result].MaxLife = 2;
					gObj[result].Mana = 1;
					gObj[result].MaxMana = 2;
					gObj[result].Experience = 0;
					gObj[result].DbClass = this->bot[botNum].Class;
					
					gObj[result].pInventory = new CItem[INVENTORY_NORMAL_SIZE];	
					gObj[result].Inventory1 = new CItem[INVENTORY_NORMAL_SIZE];
					gObj[result].InventoryMap1 = new BYTE[INVENTORY_NORMAL_SIZE];
					gObj[result].pInventoryMap = new BYTE[INVENTORY_NORMAL_SIZE];

					for (int i=0;i<INVENTORY_NORMAL_SIZE;i++)
					{
						gObj[result].pInventory[i].Clear();
						gObj[result].Inventory1[i].Clear();
					}

					memset(&gObj[result].pInventoryMap[0], (BYTE)-1, INVENTORY_NORMAL_SIZE);
					memset(&gObj[result].InventoryMap1[0], (BYTE)-1, INVENTORY_NORMAL_SIZE);

					strncpy(gObj[result].Name,this->bot[botNum].Name,sizeof(gObj[result].Name));


					for(int i=0;i<9;i++)
					{
						if(this->bot[botNum].body[i].num >= 0 && this->bot[botNum].body[i].Enabled == true)
						{
							CItem item;
							item.m_Level = this->bot[botNum].body[i].level;
							item.m_SkillOption = 0;
							item.m_LuckOption = 1;
							item.m_Z28Option = this->bot[botNum].body[i].opt;
							item.m_Durability = 255.0f;
							item.m_JewelOfHarmonyOption = 0;
							item.m_ItemOptionEx = 0;
							item.m_ItemSlot1 = 0;
							item.m_ItemSlot2 = 0;
							item.m_ItemSlot3 = 0;
							item.m_ItemSlot4 = 0;
							item.m_ItemSlot5 = 0;
							item.Convert(this->bot[botNum].body[i].num,item.m_SkillOption,item.m_LuckOption,item.m_Z28Option,0,0,item.m_ItemOptionEx,3);

							gObj[result].pInventory[i].m_SkillOption = item.m_SkillOption;
							gObj[result].pInventory[i].m_LuckOption = item.m_LuckOption;
							gObj[result].pInventory[i].m_Z28Option = item.m_Z28Option;
							gObj[result].pInventory[i].m_JewelOfHarmonyOption = item.m_JewelOfHarmonyOption;
							gObj[result].pInventory[i].m_ItemOptionEx = item.m_ItemOptionEx;

							item.m_Number = 0;
							
							gObjInventoryInsertItemPos(gObj[result].m_Index,item,i,0);
						}
					}
					
					gObj[result].Inventory1 = gObj[result].pInventory;
					gObj[result].InventoryMap1 = gObj[result].pInventoryMap;
					gObjMakePreviewCharSet(result);

					gObj[result].m_AttackType = 0;
					gObj[result].BotSkillAttack = 0;					

					gObj[result].m_Attribute = 100;
					gObj[result].TargetNumber = (WORD)-1;
					gObj[result].m_ActState.Emotion = 0;
					gObj[result].m_ActState.Attack = 0;
					gObj[result].m_ActState.EmotionCount = 0;
					gObj[result].PathCount = 0;
//.........这里部分代码省略.........
开发者ID:ADMTec,项目名称:GameServer,代码行数:101,代码来源:ObjBotWarper.cpp

示例10: fopen

void CShop::Load()
{
	// Create a variable to store the item names
	char szName[MAX_PATH] = {0};	
	char szType[MAX_PATH] = {0};	

	// Open our info file in "read" mode.
	FILE *fp = fopen(kItemInfoFile, "r");

	// Make sure we found the file, if not report the error
	if(!fp)
	{
		// Display an error message if we couldn't find the file
		MessageBox(NULL, "Unable to find items in the items file", "Error", MB_OK);
		return;
	}

	// Keep going through the file until we reach the end of it
	while(!feof(fp))
	{

		CItem tempItem;						   // Create a temp item tile
		int life = 0, str = 0, protection = 0; // Create variables for read data and item's image
		CHAR_INFO image = {'I', FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE};

		// Read in the current line for this item in the info file
		fscanf(fp, "%s > lifeInc: %d strengthInc: %d protectionInc: %d type: %s\n", szName, &life, &str, &protection, szType);
			
		// Set the info read in for this item
		tempItem.SetChar(image);
		tempItem.SetLifeInc(life);
		tempItem.SetStrengthInc(str);
		tempItem.SetProtectionInc(protection);
		tempItem.SetName(szName);

		// Let's grab the type of this item
		string strType = szType;
		int type = kItem;

		// Depending on the string read in, set the item's type
		if(strType == "head") type = kHead;
		else if(strType == "chest")  type = kChest;
		else if(strType == "weapon") type = kWeapon;
		else if(strType == "feet")   type = kFeet;

		// Set the numeric item type
		tempItem.SetItemType(type);

		// Set this tile type as an item
		tempItem.SetType(kItemType);
		
		// Here is where the random selection comes in.  We give this item a %50 chance
		// of not being added to the shop keeper's list of items being sold.
		if(rand() % 3)
			m_vItems.push_back(tempItem);

		// Make sure that the size of our item list isn't over the maximum limit for shops
		if((int)m_vItems.size() >= kMaxShopKeeperInv)
			break;
	}
	
	// Close the file, a success!
	fclose(fp);
}
开发者ID:88er,项目名称:tutorials,代码行数:64,代码来源:ShopKeeper.cpp

示例11: execute

 void execute(CItem *_this)
 {
     item->SwitchToHand(hand);
 }
开发者ID:eBunny,项目名称:EmberProject,代码行数:4,代码来源:ItemResource.cpp

示例12: GetGoodsProp

UINT16 CGoods::UseBox(DT_ITEM_DATA_LIST_CLI2& stBoxItemInfo)
{
    SGoodsProp*	pstGoodsProp =  GetGoodsProp();
    if(NULL == pstGoodsProp)
    {
        RETURN_OTHER_ERR;
    }

    SItemComposeProp* pstItemComposeProp = CItemComposePropMgr::Instance()->GetProp(pstGoodsProp->wKindID);
    if(NULL == pstItemComposeProp)
    {
        SYS_CRITICAL(_SDT("[%s: %d]: pstItemComposeProp is NULL!"), MSG_MARK);
        RETURN_OTHER_ERR;
    }

    CItemRateMap& mapComposeItem = pstItemComposeProp->mapComposeItem;
    if(0 == mapComposeItem.size())
    {
        SYS_CRITICAL(_SDT("[%s: %d]: mapComposeItem[%d] is 0!"), MSG_MARK, pstGoodsProp->wKindID);
        RETURN_OTHER_ERR;
    }

    INT32 nGap = (INT32)(m_poOwner->GetBag().GetIdleSize()) - (INT32)(mapComposeItem.size());
    if(nGap < 0)
    {
        //判断背包中是否存在该物品,若存在则可少使用一个格子
        CBag& oBag = m_poOwner->GetBag();
        for(CItemRateMapItr itr = mapComposeItem.begin(); itr != mapComposeItem.end(); itr++)
        {
            //只有物品有效,装备叠加数为1,则只找Goods
            if(oBag.GetGoodsItem(itr->first))
            {
                nGap++;
            }
        }
    }

    //背包容量不足
    if(nGap < 0)
    {
        return ERR_GOODS_USE::ID_BAG_FULL;
    }

    for(CItemRateMapItr itr = mapComposeItem.begin(); itr != mapComposeItem.end(); itr++)
    {
        //若是系统可以直接使用的物品,则使用
        if(CItemMgr::Instance()->SysUseGoods(m_poOwner, itr->first, itr->second.wItemNum))
        {
            CItemMgr::Instance()->GetDT_ITEM_DATA_CLI2(itr->first, itr->second.wItemNum, stBoxItemInfo.astItemList[stBoxItemInfo.byItemNum]);
        }
        else
        {
            ECreateItemRet eRet;
            CItem* poItem = CItemMgr::Instance()->CreateItemIntoBag(m_poOwner, itr->first, itr->second.wItemNum, eRet, 0, CRecordMgr::EAIT_BOX, m_stDT_GOODS_DATA.wKindID);
            if(NULL == poItem)
            {
                //异常
                SYS_CRITICAL(_SDT("[%s: %d]: CreateItemIntoBag failed[%d]!"), MSG_MARK, itr->first);
            }
            //装备没有叠加数,可以直接poEquip->GetDT_EQUIP_DATA_CLI(stEquip);
            if(EIK_EQUIP == poItem->GetItemKind())
            {
                CEquip* poEquip = dynamic_cast<CEquip*>(poItem);
                if(NULL == poEquip)
                {
                    //异常
                    continue;
                }
                stBoxItemInfo.astItemList[stBoxItemInfo.byItemNum].byItemType = EIK_EQUIP;
                DT_EQUIP_DATA_CLI& stEquip = stBoxItemInfo.astItemList[stBoxItemInfo.byItemNum].stItemInfo.stEquip ;
                poEquip->GetDT_EQUIP_DATA_CLI(stEquip);
            }
            else
            {
                //内部礼包,返回的是礼包的物品
                SGoodsProp* pstGoodsProp = CGoodsPropMgr::Instance()->GetPropByPrimaryKey(itr->first);
                if((pstGoodsProp) && (EGMK_INNERBOX == pstGoodsProp->byMainKindID))
                {
                    CItemMgr::Instance()->GetDT_ITEM_DATA_CLI2(poItem->GetItemKindID(), 1, stBoxItemInfo.astItemList[stBoxItemInfo.byItemNum]);
                }
                else
                {
                    CItemMgr::Instance()->GetDT_ITEM_DATA_CLI2(itr->first, itr->second.wItemNum, stBoxItemInfo.astItemList[stBoxItemInfo.byItemNum]);
                }
            }
        }

        stBoxItemInfo.byItemNum++;
    }

    return ERR_GOODS_USE::ID_SUCCESS;
}
开发者ID:mildrock,项目名称:dummy,代码行数:92,代码来源:goods.cpp

示例13: if

void CCalCharacter::gObjCalCharacter(int aIndex)
{
	LPOBJ lpObj = &gObj[aIndex];
	int Strength = 0;
	int Dexterity = 0;
	int Vitality = 0;
	int Energy = 0;
	int Leadership = 0;
	// ----
	CItem * Right = &lpObj->pInventory[0];
	CItem * Left  = &lpObj->pInventory[1];
	CItem * Helm  = &lpObj->pInventory[2];
	CItem * Armor  = &lpObj->pInventory[3];
	CItem * Pants  = &lpObj->pInventory[4];
	CItem * Gloves = &lpObj->pInventory[5];
	CItem * Boots = &lpObj->pInventory[6];
	CItem * Wings = &lpObj->pInventory[7];
	CItem * Helper = &lpObj->pInventory[8];
	CItem * Amulet = &lpObj->pInventory[9];
	CItem * Ring01 = &lpObj->pInventory[10];
	CItem * Ring02 = &lpObj->pInventory[11];
	lpObj->HaveWeaponInHand = true;
	// -------------------------------------------------------
	// Check Weapon in hand
	// -------------------------------------------------------
	if ( Right->IsItem() == false && Left->IsItem() == false )
	{
		lpObj->HaveWeaponInHand = false;
	}
	else if ( Left->IsItem() == false && Right->m_Type == ITEMGET(4,15) ) // Arrow
	{
		lpObj->HaveWeaponInHand = false;
	}
	else if ( Right->IsItem() == false )
	{
		int iType = Left->m_Type / MAX_SUBTYPE_ITEMS;

		if ( Left->m_Type == ITEMGET(4,7) ) // Bolt
		{
			lpObj->HaveWeaponInHand = false;
		}
		else if ( iType == 6 ) // Shield
		{
			lpObj->HaveWeaponInHand = false;
		}
	}
	// -------------------------------------------------------
	lpObj->AddLife = 0;
	lpObj->AddMana = 0;
	lpObj->MonsterDieGetMoney = 0;
	lpObj->MonsterDieGetLife = 0;
	lpObj->MonsterDieGetMana = 0;
	lpObj->DamageReflect = 0;
	lpObj->DamageMinus = 0;
	lpObj->SkillLongSpearChange = false;

	if ( lpObj->m_iItemEffectValidTime > 0 )
	{
		g_ItemAddOption.PrevSetItemLastEffectForHallowin(lpObj);
	}

	int iItemIndex;
	BOOL bIsChangeItem;	// lc34

	for ( iItemIndex=0; iItemIndex<MAX_PLAYER_EQUIPMENT;iItemIndex++)
	{
		if ( lpObj->pInventory[iItemIndex].IsItem() != FALSE )
		{
			lpObj->pInventory[iItemIndex].m_IsValidItem = true;
		}
	}

	do
	{
		lpObj->SetOpAddMaxAttackDamage = 0;
		lpObj->SetOpAddMinAttackDamage = 0;
		lpObj->SetOpAddDamage = 0;
		lpObj->SetOpIncAGValue = 0;
		lpObj->SetOpAddCriticalDamageSuccessRate = 0;
		lpObj->SetOpAddCriticalDamage = 0;
		lpObj->SetOpAddExDamageSuccessRate = 0;
		lpObj->SetOpAddExDamage = 0;
		lpObj->SetOpAddSkillAttack = 0;
		lpObj->AddStrength = 0;
		lpObj->AddDexterity = 0;
		lpObj->AddVitality = 0;
		lpObj->AddEnergy = 0;
		lpObj->AddBP = 0;
		lpObj->iAddShield = 0;
		lpObj->SetOpAddAttackDamage = 0;
		lpObj->SetOpAddDefence = 0;
		lpObj->SetOpAddMagicPower = 0;
		lpObj->SetOpAddDefenceRate = 0;
		lpObj->SetOpIgnoreDefense = 0;
		lpObj->SetOpDoubleDamage = 0;
		lpObj->SetOpTwoHandSwordImproveDamage = 0;
		lpObj->SetOpImproveSuccessAttackRate = 0;
		lpObj->SetOpReflectionDamage = 0;
		lpObj->SetOpImproveSheldDefence = 0;
		lpObj->SetOpDecreaseAG = 0;
//.........这里部分代码省略.........
开发者ID:kelemeto76,项目名称:mu-bk-server-sourcecode,代码行数:101,代码来源:ObjCalCharacter.cpp

示例14: ReadHeaderReal

bool CInArchive::ReadHeaderReal(const Byte *p, unsigned size, CItem &item)
{
  const Byte *pStart = p;

  item.Clear();
  item.Flags = m_BlockHeader.Flags;

  const unsigned kFileHeaderSize = 25;

  if (size < kFileHeaderSize)
    return false;

  item.PackSize = Get32(p);
  item.Size = Get32(p + 4);
  item.HostOS = p[8];
  item.FileCRC = Get32(p + 9);
  item.MTime.DosTime = Get32(p + 13);
  item.UnPackVersion = p[17];
  item.Method = p[18];
  unsigned nameSize = Get16(p + 19);
  item.Attrib = Get32(p + 21);

  item.MTime.LowSecond = 0;
  item.MTime.SubTime[0] =
      item.MTime.SubTime[1] =
      item.MTime.SubTime[2] = 0;

  p += kFileHeaderSize;
  size -= kFileHeaderSize;
  if ((item.Flags & NHeader::NFile::kSize64Bits) != 0)
  {
    if (size < 8)
      return false;
    item.PackSize |= ((UInt64)Get32(p) << 32);
    item.Size |= ((UInt64)Get32(p + 4) << 32);
    p += 8;
    size -= 8;
  }
  if (nameSize > size)
    return false;
  ReadName(p, nameSize, item);
  p += nameSize;
  size -= nameSize;

  /*
  // It was commented, since it's difficult to support alt Streams for solid archives.
  if (m_BlockHeader.Type == NHeader::NBlockType::kSubBlock)
  {
    if (item.HasSalt())
    {
      if (size < sizeof(item.Salt))
        return false;
      size -= sizeof(item.Salt);
      p += sizeof(item.Salt);
    }
    if (item.Name == "ACL" && size == 0)
    {
      item.IsAltStream = true;
      item.Name.Empty();
      item.UnicodeName = L".ACL";
    }
    else if (item.Name == "STM" && size != 0 && (size & 1) == 0)
    {
      item.IsAltStream = true;
      item.Name.Empty();
      for (UInt32 i = 0; i < size; i += 2)
      {
        wchar_t c = Get16(p + i);
        if (c == 0)
          return false;
        item.UnicodeName += c;
      }
    }
  }
  */

  if (item.HasSalt())
  {
    if (size < sizeof(item.Salt))
      return false;
    for (unsigned i = 0; i < sizeof(item.Salt); i++)
      item.Salt[i] = p[i];
    p += sizeof(item.Salt);
    size -= sizeof(item.Salt);
  }

  // some rar archives have HasExtTime flag without field.
  if (size >= 2 && item.HasExtTime())
  {
    Byte aMask = (Byte)(p[0] >> 4);
    Byte b = p[1];
    p += 2;
    size -= 2;
    Byte mMask = (Byte)(b >> 4);
    Byte cMask = (Byte)(b & 0xF);
    if ((mMask & 8) != 0)
    {
      READ_TIME(mMask, item.MTime);
    }
    READ_TIME_2(cMask, item.CTimeDefined, item.CTime);
//.........这里部分代码省略.........
开发者ID:borneq,项目名称:bind7z,代码行数:101,代码来源:RarHandler.cpp

示例15: startSynth

int32 startSynth(CCharEntity* PChar)
{
	PROFILE_FUNC();
	uint16 effect  = 0;
	uint8  element = 0;

	uint16 crystalType = PChar->CraftContainer->getItemID(0);

	switch(crystalType)
	{
		case 0x1000:
		case 0x108E:
			effect  = EFFECT_FIRESYNTH;
			element = ELEMENT_FIRE;
			break;
		case 0x1001:
		case 0x108F:
			effect  = EFFECT_ICESYNTH;
			element = ELEMENT_ICE;
			break;
		case 0x1002:
		case 0x1090:
			effect  = EFFECT_WINDSYNTH;
			element = ELEMENT_WIND;
			break;
		case 0x1003:
		case 0x1091:
			effect  = EFFECT_EARTHSYNTH;
			element = ELEMENT_EARTH;
			break;
		case 0x1004:
		case 0x1092:
			effect  = EFFECT_LIGHTNINGSYNTH;
			element = ELEMENT_LIGHTNING;
			break;
		case 0x1005:
		case 0x1093:
			effect  = EFFECT_WATERSYNTH;
			element = ELEMENT_WATER;
			break;
		case 0x1006:
		case 0x1094:
			effect  = EFFECT_LIGHTSYNTH;
			element = ELEMENT_LIGHT;
			break;
		case 0x1007:
		case 0x1095:
			effect  = EFFECT_DARKSYNTH;
			element = ELEMENT_DARK;
			break;
	}

	PChar->CraftContainer->setType(element);

	if (!isRightRecipe(PChar))
	{
		return 0;
	}

	// удаляем кристалл
	charutils::UpdateItem(PChar, LOC_INVENTORY, PChar->CraftContainer->getInvSlotID(0), -1);

	uint8 result = calcSynthResult(PChar);

	uint8  invSlotID  = 0;
	uint8  tempSlotID = 0;
	uint16 itemID     = 0;
	uint32 quantity   = 0;

	for(uint8 slotID = 1; slotID <= 8; ++slotID)
	{
		tempSlotID = PChar->CraftContainer->getInvSlotID(slotID);
		if ((tempSlotID != 0xFF) && (tempSlotID != invSlotID))
		{
			invSlotID = tempSlotID;

			CItem* PItem = PChar->getStorage(LOC_INVENTORY)->GetItem(invSlotID);

			if (PItem != NULL)
			{
				PItem->setSubType(ITEM_LOCKED);
				PChar->pushPacket(new CInventoryAssignPacket(PItem, INV_NOSELECT));
			}
		}
	}

	PChar->animation = ANIMATION_SYNTH;
	PChar->pushPacket(new CCharUpdatePacket(PChar));

    if(PChar->loc.zone->GetID() != 255 && PChar->loc.zone->GetID() != 0)
    {
        PChar->loc.zone->PushPacket(PChar, CHAR_INRANGE_SELF, new CSynthAnimationPacket(PChar,effect,result));
    }
    else
    {
        PChar->pushPacket(new CSynthAnimationPacket(PChar, effect, result));
    }

	return 0;
}
开发者ID:bluekirby0,项目名称:darkstar,代码行数:100,代码来源:synthutils.cpp


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