bool CItem::IsRideItem() { if (ITEM_UNIQUE == GetType() && UNIQUE_SPECIAL_RIDE == GetSubType()) return true; if (ITEM_UNIQUE == GetType() && UNIQUE_SPECIAL_MOUNT_RIDE == GetSubType()) return true; return false; }
bool CItem::SetCount(DWORD count) { if (GetType() == ITEM_ELK) { m_dwCount = MIN(count, INT_MAX); } else { m_dwCount = MIN(count, ITEM_MAX_COUNT); } if (count == 0 && m_pOwner) { if (GetSubType() == USE_ABILITY_UP || GetSubType() == USE_POTION || GetVnum() == 70020) { LPCHARACTER pOwner = GetOwner(); WORD wCell = GetCell(); RemoveFromCharacter(); if (!IsDragonSoul()) { LPITEM pItem = pOwner->FindSpecifyItem(GetVnum()); if (NULL != pItem) { pOwner->ChainQuickslotItem(pItem, QUICKSLOT_TYPE_ITEM, wCell); } else { pOwner->SyncQuickslot(QUICKSLOT_TYPE_ITEM, wCell, 255); } } M2_DESTROY_ITEM(this); } else { if (!IsDragonSoul()) { m_pOwner->SyncQuickslot(QUICKSLOT_TYPE_ITEM, m_wCell, 255); } M2_DESTROY_ITEM(RemoveFromCharacter()); } return false; } UpdatePacket(); Save(); return true; }
String MimeBody::GetCleanContentType() const { String sMainPart = GetMainType(); String sSubPart = GetSubType(); return sMainPart + "/" + sSubPart; }
void Object::CollideEntity(EntityCommon *pEntity, const gfxTrace & trace) { //pEntity->Callback(ENTITYMSG_ENTITYCOLLIDE, (WPARAM)this, 0); RETCODE ret = Callback(ENTITYMSG_ENTITYCOLLIDE, (WPARAM)pEntity, (LPARAM)&trace); //push depending on type switch(pEntity->GetEntityType()) { case ENTITY_TYPE_TATA: case ENTITY_TYPE_ENEMY: //push the entity //only if I'm a platform. if(GetSubType() == OBJECT_PLATFORM) AddPushList(pEntity->GetID()); break; case ENTITY_TYPE_OBJECT: { if(GetSubType() == OBJECT_BLOCK) { //if I'm a block and I collided with a platform //then let myself be pushed by that platform if(pEntity->GetSubType() == OBJECT_PLATFORM) pEntity->AddPushList(GetID()); } else if(GetSubType() == OBJECT_PLATFORM) { //if I'm a platform and I collided with a block //then let's push that SOB if(pEntity->GetSubType() == OBJECT_BLOCK) AddPushList(pEntity->GetID()); } } break; case ENTITY_TYPE_PROJECTILE: //tag projectile death if(!pEntity->CheckFlag(PROJ_FLAG_OBJINVUL)) pEntity->SetFlag(ENTITY_FLAG_POLLDEATH, true); break; case ENTITY_TYPE_ITEM: //ignore break; } }
void Value::Modify(u64& rValue) const { switch (GetSubType() & ValueDetail::ModifierMask) { case ValueDetail::NotType: rValue = ~rValue; break; case ValueDetail::NegateType: rValue = -static_cast<s64>(rValue); break; default: break; } }
MEDUSA_NAMESPACE_BEGIN void Value::Modify(u8& rValue) const { switch (GetSubType() & ValueDetail::ModifierMask) { case ValueDetail::NotType: rValue = ~rValue; break; case ValueDetail::NegateType: rValue = -static_cast<s8>(rValue); break; default: break; } }
ACBaseCodec::ACBaseCodec( AudioComponentInstance inInstance ) : ACCodec(inInstance), mIsInitialized(false), mInputFormatList(), mInputFormat(), mOutputFormatList(), mOutputFormat() { mCodecSubType = 0; if (inInstance) GetSubType(); }
/************************************* * Destroy *************************************/ SHVBool SHVControlImplementerContainerWindowWin32::Destroy(SHVControl* owner) { if (IsCreated() && GetSubType(owner) == SHVControlContainer::SubTypeTabPage) { HWND tabHandle = ::GetParent(GetHandle()); SHVBool retVal(SHVControlImplementerWin32<SHVControlImplementerContainerCustomDraw>::Destroy(owner)); SHVControlImplementerTabWin32::RemovePageByHandle(tabHandle,(SHVControlContainer*)owner); return retVal; } return SHVControlImplementerWin32<SHVControlImplementerContainerCustomDraw>::Destroy(owner); }
Activity C_TFWeaponBuilder::GetDrawActivity( void ) { CTFPlayer *pOwner = ToTFPlayer( GetOwner() ); // hax alert! use the one handed sapper deploy if we're invis if ( pOwner && pOwner->m_Shared.InCond( TF_COND_STEALTHED ) && GetSubType() == OBJ_ATTACHMENT_SAPPER ) { return ACT_VM_DRAW_DEPLOYED; } else { return BaseClass::GetDrawActivity(); } }
bool MimeBody::IsEncapsulatedRFC822Message() const { if (!IsAttachment()) return false; String sMainType = GetMainType(); String sSubType = GetSubType(); sMainType.ToUpper(); sSubType.ToUpper(); if (sMainType == _T("MESSAGE") && sSubType == _T("RFC822")) return true; else return false; }
void CItem::ModifyPoints(bool bAdd) { int accessoryGrade; // ¹«±â¿Í °©¿Ê¸¸ ¼ÒÄÏÀ» Àû¿ë½ÃŲ´Ù. if (false == IsAccessoryForSocket()) { if (m_pProto->bType == ITEM_WEAPON || m_pProto->bType == ITEM_ARMOR) { // ¼ÒÄÏÀÌ ¼Ó¼º°È¿¡ »ç¿ëµÇ´Â °æ¿ì Àû¿ëÇÏÁö ¾Ê´Â´Ù (ARMOR_WRIST ARMOR_NECK ARMOR_EAR) for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) { DWORD dwVnum; if ((dwVnum = GetSocket(i)) <= 2) continue; TItemTable * p = ITEM_MANAGER::instance().GetTable(dwVnum); if (!p) { sys_err("cannot find table by vnum %u", dwVnum); continue; } if (ITEM_METIN == p->bType) { //m_pOwner->ApplyPoint(p->alValues[0], bAdd ? p->alValues[1] : -p->alValues[1]); for (int i = 0; i < ITEM_APPLY_MAX_NUM; ++i) { if (p->aApplies[i].bType == APPLY_NONE) continue; if (p->aApplies[i].bType == APPLY_SKILL) m_pOwner->ApplyPoint(p->aApplies[i].bType, bAdd ? p->aApplies[i].lValue : p->aApplies[i].lValue ^ 0x00800000); else m_pOwner->ApplyPoint(p->aApplies[i].bType, bAdd ? p->aApplies[i].lValue : -p->aApplies[i].lValue); } } } } accessoryGrade = 0; } else { accessoryGrade = MIN(GetAccessorySocketGrade(), ITEM_ACCESSORY_SOCKET_MAX_NUM); } for (int i = 0; i < ITEM_APPLY_MAX_NUM; ++i) { if (m_pProto->aApplies[i].bType == APPLY_NONE) continue; long value = m_pProto->aApplies[i].lValue; if (m_pProto->aApplies[i].bType == APPLY_SKILL) { m_pOwner->ApplyPoint(m_pProto->aApplies[i].bType, bAdd ? value : value ^ 0x00800000); } else { if (0 != accessoryGrade) value += MAX(accessoryGrade, value * aiAccessorySocketEffectivePct[accessoryGrade] / 100); m_pOwner->ApplyPoint(m_pProto->aApplies[i].bType, bAdd ? value : -value); } } // Ãʽ´ÞÀÇ ¹ÝÁö, ÇÒ·ÎÀ© »çÅÁ, ÇູÀÇ ¹ÝÁö, ¿µ¿øÇÑ »ç¶ûÀÇ Ææ´øÆ®ÀÇ °æ¿ì // ±âÁ¸ÀÇ Çϵå ÄÚµùÀ¸·Î °Á¦·Î ¼Ó¼ºÀ» ºÎ¿©ÇßÁö¸¸, // ±× ºÎºÐÀ» Á¦°ÅÇÏ°í special item group Å×ÀÌºí¿¡¼ ¼Ó¼ºÀ» ºÎ¿©Çϵµ·Ï º¯°æÇÏ¿´´Ù. // ÇÏÁö¸¸ Çϵå ÄÚµùµÇ¾îÀÖÀ» ¶§ »ý¼ºµÈ ¾ÆÀÌÅÛÀÌ ³²¾ÆÀÖÀ» ¼öµµ ÀÖ¾î¼ Æ¯¼öó¸® Çسõ´Â´Ù. // ÀÌ ¾ÆÀÌÅÛµéÀÇ °æ¿ì, ¹Ø¿¡ ITEM_UNIQUEÀÏ ¶§ÀÇ Ã³¸®·Î ¼Ó¼ºÀÌ ºÎ¿©µÇ±â ¶§¹®¿¡, // ¾ÆÀÌÅÛ¿¡ ¹ÚÇôÀÖ´Â attribute´Â Àû¿ëÇÏÁö ¾Ê°í ³Ñ¾î°£´Ù. if (true == CItemVnumHelper::IsRamadanMoonRing(GetVnum()) || true == CItemVnumHelper::IsHalloweenCandy(GetVnum()) || true == CItemVnumHelper::IsHappinessRing(GetVnum()) || true == CItemVnumHelper::IsLovePendant(GetVnum())) { // Do not anything. } else { for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; ++i) { if (GetAttributeType(i)) { const TPlayerItemAttribute& ia = GetAttribute(i); if (ia.bType == APPLY_SKILL) m_pOwner->ApplyPoint(ia.bType, bAdd ? ia.sValue : ia.sValue ^ 0x00800000); else m_pOwner->ApplyPoint(ia.bType, bAdd ? ia.sValue : -ia.sValue); } } } switch (m_pProto->bType) { case ITEM_PICK: case ITEM_ROD: { if (bAdd) { if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON) m_pOwner->SetPart(PART_WEAPON, GetVnum()); } else { if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON) m_pOwner->SetPart(PART_WEAPON, m_pOwner->GetOriginalPart(PART_WEAPON)); } } break; case ITEM_WEAPON: { if (bAdd) { if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON) m_pOwner->SetPart(PART_WEAPON, GetVnum()); } else { if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON) m_pOwner->SetPart(PART_WEAPON, m_pOwner->GetOriginalPart(PART_WEAPON)); } } break; case ITEM_ARMOR: { // ÄÚ½ºÃõ body¸¦ ÀÔ°íÀÖ´Ù¸é armor´Â ¹þ´ø ÀÔ´ø »ó°ü ¾øÀÌ ºñÁÖ¾ó¿¡ ¿µÇâÀ» ÁÖ¸é ¾È µÊ. if (0 != m_pOwner->GetWear(WEAR_COSTUME_BODY)) break; if (GetSubType() == ARMOR_BODY || GetSubType() == ARMOR_HEAD || GetSubType() == ARMOR_FOOTS || GetSubType() == ARMOR_SHIELD) { if (bAdd) { if (GetProto()->bSubType == ARMOR_BODY) m_pOwner->SetPart(PART_MAIN, GetVnum()); } else { if (GetProto()->bSubType == ARMOR_BODY) m_pOwner->SetPart(PART_MAIN, m_pOwner->GetOriginalPart(PART_MAIN)); } } } break; // ÄÚ½ºÃõ ¾ÆÀÌÅÛ ÀÔ¾úÀ» ¶§ ij¸¯ÅÍ parts Á¤º¸ ¼¼ÆÃ. ±âÁ¸ ½ºÅ¸ÀÏ´ë·Î Ãß°¡ÇÔ.. case ITEM_COSTUME: { DWORD toSetValue = this->GetVnum(); EParts toSetPart = PART_MAX_NUM; // °©¿Ê ÄÚ½ºÃõ if (GetSubType() == COSTUME_BODY) { toSetPart = PART_MAIN; if (false == bAdd) { // ÄÚ½ºÃõ °©¿ÊÀ» ¹þ¾úÀ» ¶§ ¿ø·¡ °©¿ÊÀ» ÀÔ°í ÀÖ¾ú´Ù¸é ±× °©¿ÊÀ¸·Î look ¼¼ÆÃ, ÀÔÁö ¾Ê¾Ò´Ù¸é default look const CItem* pArmor = m_pOwner->GetWear(WEAR_BODY); toSetValue = (NULL != pArmor) ? pArmor->GetVnum() : m_pOwner->GetOriginalPart(PART_MAIN); } } // Çì¾î ÄÚ½ºÃõ else if (GetSubType() == COSTUME_HAIR) { toSetPart = PART_HAIR; // ÄÚ½ºÃõ Çì¾î´Â shape°ªÀ» item protoÀÇ value3¿¡ ¼¼ÆÃÇϵµ·Ï ÇÔ. Ưº°ÇÑ ÀÌÀ¯´Â ¾ø°í ±âÁ¸ °©¿Ê(ARMOR_BODY)ÀÇ shape°ªÀÌ ÇÁ·ÎÅäÀÇ value3¿¡ ÀÖ¾î¼ Çì¾îµµ °°ÀÌ value3À¸·Î ÇÔ. // [NOTE] °©¿ÊÀº ¾ÆÀÌÅÛ vnumÀ» º¸³»°í Çì¾î´Â shape(value3)°ªÀ» º¸³»´Â ÀÌÀ¯´Â.. ±âÁ¸ ½Ã½ºÅÛÀÌ ±×·¸°Ô µÇ¾îÀÖÀ½... toSetValue = (true == bAdd) ? this->GetValue(3) : 0; } if (PART_MAX_NUM != toSetPart) { m_pOwner->SetPart((BYTE)toSetPart, toSetValue); m_pOwner->UpdatePacket(); } } break; case ITEM_UNIQUE: { if (0 != GetSIGVnum()) { const CSpecialItemGroup* pItemGroup = ITEM_MANAGER::instance().GetSpecialItemGroup(GetSIGVnum()); if (NULL == pItemGroup) break; DWORD dwAttrVnum = pItemGroup->GetAttrVnum(GetVnum()); const CSpecialAttrGroup* pAttrGroup = ITEM_MANAGER::instance().GetSpecialAttrGroup(dwAttrVnum); if (NULL == pAttrGroup) break; for (itertype (pAttrGroup->m_vecAttrs) it = pAttrGroup->m_vecAttrs.begin(); it != pAttrGroup->m_vecAttrs.end(); it++) { m_pOwner->ApplyPoint(it->apply_type, bAdd ? it->apply_value : -it->apply_value); } } } break; } }
// return false on error state bool CItem::EquipTo(LPCHARACTER ch, BYTE bWearCell) { if (!ch) { sys_err("EquipTo: nil character"); return false; } // ¿ëÈ¥¼® ½½·Ô index´Â WEAR_MAX_NUM º¸´Ù Å. if (IsDragonSoul()) { if (bWearCell < WEAR_MAX_NUM || bWearCell >= WEAR_MAX_NUM + DRAGON_SOUL_DECK_MAX_NUM * DS_SLOT_MAX) { sys_err("EquipTo: invalid dragon soul cell (this: #%d %s wearflag: %d cell: %d)", GetOriginalVnum(), GetName(), GetSubType(), bWearCell - WEAR_MAX_NUM); return false; } } else { if (bWearCell >= WEAR_MAX_NUM) { sys_err("EquipTo: invalid wear cell (this: #%d %s wearflag: %d cell: %d)", GetOriginalVnum(), GetName(), GetWearFlag(), bWearCell); return false; } } if (ch->GetWear(bWearCell)) { sys_err("EquipTo: item already exist (this: #%d %s cell: %d %s)", GetOriginalVnum(), GetName(), bWearCell, ch->GetWear(bWearCell)->GetName()); return false; } if (GetOwner()) RemoveFromCharacter(); ch->SetWear(bWearCell, this); // ¿©±â¼ ÆÐŶ ³ª°¨ m_pOwner = ch; m_bEquipped = true; m_wCell = INVENTORY_MAX_NUM + bWearCell; DWORD dwImmuneFlag = 0; for (int i = 0; i < WEAR_MAX_NUM; ++i) if (m_pOwner->GetWear(i)) SET_BIT(dwImmuneFlag, m_pOwner->GetWear(i)->m_pProto->dwImmuneFlag); m_pOwner->SetImmuneFlag(dwImmuneFlag); if (IsDragonSoul()) { DSManager::instance().ActivateDragonSoul(this); } else { ModifyPoints(true); StartUniqueExpireEvent(); if (-1 != GetProto()->cLimitTimerBasedOnWearIndex) StartTimerBasedOnWearExpireEvent(); // ACCESSORY_REFINE StartAccessorySocketExpireEvent(); // END_OF_ACCESSORY_REFINE } ch->BuffOnAttr_AddBuffsFromItem(this); m_pOwner->ComputeBattlePoints(); m_pOwner->UpdatePacket(); Save(); return (true); }
wxThread::ExitCode wxGxMLDatasetUI::Entry() { //ITrackCancel trackcancel; wxGISDataset* pDSet = GetDataset(false); wxGxCatalogUI* pCat = wxDynamicCast(GetGxCatalog(), wxGxCatalogUI); if(pDSet) { for(size_t i = 0; i < pDSet->GetSubsetsCount(); ++i) { wxGISDataset* pwxGISFeatureSuDataset = m_pwxGISDataset->GetSubset(i); wxString sSubsetName = pwxGISFeatureSuDataset->GetName(); wxGxMLSubDatasetUI* pGxMLSubDatasetUI = new wxGxMLSubDatasetUI((wxGISEnumVectorDatasetType)GetSubType(), pwxGISFeatureSuDataset, wxStaticCast(this, wxGxObject), sSubsetName, wxGxObjectContainer::GetPath(), m_LargeSubIcon, m_SmallSubIcon); wxGIS_GXCATALOG_EVENT_ID(ObjectAdded, pGxMLSubDatasetUI->GetId()); } wsDELETE(pDSet); } if(m_nPendUId != wxNOT_FOUND && pCat) { pCat->RemovePending(m_nPendUId); m_nPendUId = wxNOT_FOUND; } //wxGIS_GXCATALOG_EVENT(ObjectChanged); return (wxThread::ExitCode)wxTHREAD_NO_ERROR; }
int CItem::FindEquipCell(LPCHARACTER ch, int iCandidateCell) { // ÄÚ½ºÃõ ¾ÆÀÌÅÛ(ITEM_COSTUME)Àº WearFlag ¾ø¾îµµ µÊ. (sub typeÀ¸·Î Âø¿ëÀ§Ä¡ ±¸ºÐ. ±ÍÂú°Ô ¶Ç wear flag ÁÙ ÇÊ¿ä°¡ ÀÖ³ª..) // ¿ëÈ¥¼®(ITEM_DS, ITEM_SPECIAL_DS)µµ SUB_TYPEÀ¸·Î ±¸ºÐ. ½Å±Ô ¹ÝÁö, º§Æ®´Â ITEM_TYPEÀ¸·Î ±¸ºÐ -_- if ((0 == GetWearFlag() || ITEM_TOTEM == GetType()) && ITEM_COSTUME != GetType() && ITEM_DS != GetType() && ITEM_SPECIAL_DS != GetType() && ITEM_RING != GetType() && ITEM_BELT != GetType()) return -1; // ¿ëÈ¥¼® ½½·ÔÀ» WEAR·Î ó¸®ÇÒ ¼ö°¡ ¾ø¾î¼(WEAR´Â ÃÖ´ë 32°³±îÁö °¡´ÉÇѵ¥ ¿ëÈ¥¼®À» Ãß°¡Çϸé 32°¡ ³Ñ´Â´Ù.) // Àκ¥Å丮ÀÇ Æ¯Á¤ À§Ä¡((INVENTORY_MAX_NUM + WEAR_MAX_NUM)ºÎÅÍ (INVENTORY_MAX_NUM + WEAR_MAX_NUM + DRAGON_SOUL_DECK_MAX_NUM * DS_SLOT_MAX - 1)±îÁö)¸¦ // ¿ëÈ¥¼® ½½·ÔÀ¸·Î Á¤ÇÔ. // return ÇÒ ¶§¿¡, INVENTORY_MAX_NUMÀ» »« ÀÌÀ¯´Â, // º»·¡ WearCellÀÌ INVENTORY_MAX_NUM¸¦ »©°í return Çϱ⠶§¹®. if (GetType() == ITEM_DS || GetType() == ITEM_SPECIAL_DS) { if (iCandidateCell < 0) { return WEAR_MAX_NUM + GetSubType(); } else { for (int i = 0; i < DRAGON_SOUL_DECK_MAX_NUM; i++) { if (WEAR_MAX_NUM + i * DS_SLOT_MAX + GetSubType() == iCandidateCell) { return iCandidateCell; } } return -1; } } else if (GetType() == ITEM_COSTUME) { if (GetSubType() == COSTUME_BODY) return WEAR_COSTUME_BODY; else if (GetSubType() == COSTUME_HAIR) return WEAR_COSTUME_HAIR; } else if (GetType() == ITEM_RING) { if (ch->GetWear(WEAR_RING1)) return WEAR_RING2; else return WEAR_RING1; } else if (GetType() == ITEM_BELT) return WEAR_BELT; else if (GetWearFlag() & WEARABLE_BODY) return WEAR_BODY; else if (GetWearFlag() & WEARABLE_HEAD) return WEAR_HEAD; else if (GetWearFlag() & WEARABLE_FOOTS) return WEAR_FOOTS; else if (GetWearFlag() & WEARABLE_WRIST) return WEAR_WRIST; else if (GetWearFlag() & WEARABLE_WEAPON) return WEAR_WEAPON; else if (GetWearFlag() & WEARABLE_SHIELD) return WEAR_SHIELD; else if (GetWearFlag() & WEARABLE_NECK) return WEAR_NECK; else if (GetWearFlag() & WEARABLE_EAR) return WEAR_EAR; else if (GetWearFlag() & WEARABLE_ARROW) return WEAR_ARROW; else if (GetWearFlag() & WEARABLE_UNIQUE) { if (ch->GetWear(WEAR_UNIQUE1)) return WEAR_UNIQUE2; else return WEAR_UNIQUE1; } // ¼öÁý Äù½ºÆ®¸¦ À§ÇÑ ¾ÆÀÌÅÛÀÌ ¹ÚÈ÷´Â°÷À¸·Î Çѹø ¹ÚÈ÷¸é Àý´ë –E¼ö ¾ø´Ù. else if (GetWearFlag() & WEARABLE_ABILITY) { if (!ch->GetWear(WEAR_ABILITY1)) { return WEAR_ABILITY1; } else if (!ch->GetWear(WEAR_ABILITY2)) { return WEAR_ABILITY2; } else if (!ch->GetWear(WEAR_ABILITY3)) { return WEAR_ABILITY3; } else if (!ch->GetWear(WEAR_ABILITY4)) { return WEAR_ABILITY4; } else if (!ch->GetWear(WEAR_ABILITY5)) { return WEAR_ABILITY5; } else if (!ch->GetWear(WEAR_ABILITY6)) { return WEAR_ABILITY6; } else if (!ch->GetWear(WEAR_ABILITY7)) { return WEAR_ABILITY7; } else if (!ch->GetWear(WEAR_ABILITY8)) { return WEAR_ABILITY8; } else { return -1; } } return -1; }
CPDF_PageObject* CPDF_Annot::GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions* pOptions) { if (GetSubType() == "Popup") { return NULL; } FX_DWORD annot_flags = GetFlags(); if (annot_flags & ANNOTFLAG_HIDDEN) { return NULL; } FX_BOOL bPrinting = bPrint || (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW)); if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { return NULL; } if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { return NULL; } CPDF_Dictionary* pBS = m_pAnnotDict->GetDict("BS"); char style_char; FX_FLOAT width; CPDF_Array* pDashArray = NULL; if (pBS == NULL) { CPDF_Array* pBorderArray = m_pAnnotDict->GetArray("Border"); style_char = 'S'; if (pBorderArray) { width = pBorderArray->GetNumber(2); if (pBorderArray->GetCount() == 4) { pDashArray = pBorderArray->GetArray(3); if (pDashArray == NULL) { return NULL; } style_char = 'D'; } } else { width = 1; } } else { CFX_ByteString style = pBS->GetString("S"); pDashArray = pBS->GetArray("D"); style_char = style[1]; width = pBS->GetNumber("W"); } if (width <= 0) { return NULL; } CPDF_Array* pColor = m_pAnnotDict->GetArray("C"); FX_DWORD argb = 0xff000000; if (pColor != NULL) { int R = (FX_INT32)(pColor->GetNumber(0) * 255); int G = (FX_INT32)(pColor->GetNumber(1) * 255); int B = (FX_INT32)(pColor->GetNumber(2) * 255); argb = ArgbEncode(0xff, R, G, B); } nonstd::unique_ptr<CPDF_PathObject> pPathObject(new CPDF_PathObject()); CPDF_GraphStateData *pGraphState = pPathObject->m_GraphState.GetModify(); if (!pGraphState) { return NULL; } pGraphState->m_LineWidth = width; CPDF_ColorStateData *pColorData = pPathObject->m_ColorState.GetModify(); if (!pColorData) { return NULL; } pColorData->m_StrokeRGB = argb; pPathObject->m_bStroke = TRUE; pPathObject->m_FillType = 0; if (style_char == 'D') { if (pDashArray) { FX_DWORD dash_count = pDashArray->GetCount(); if (dash_count % 2) { dash_count ++; } pGraphState->m_DashArray = FX_Alloc(FX_FLOAT, dash_count); if (pGraphState->m_DashArray == NULL) { return NULL; } pGraphState->m_DashCount = dash_count; FX_DWORD i; for (i = 0; i < pDashArray->GetCount(); i ++) { pGraphState->m_DashArray[i] = pDashArray->GetNumber(i); } if (i < dash_count) { pGraphState->m_DashArray[i] = pGraphState->m_DashArray[i - 1]; } } else { pGraphState->m_DashArray = FX_Alloc(FX_FLOAT, 2); if (pGraphState->m_DashArray == NULL) { return NULL; } pGraphState->m_DashCount = 2; pGraphState->m_DashArray[0] = pGraphState->m_DashArray[1] = 3 * 1.0f; } } CFX_FloatRect rect; GetRect(rect); width /= 2; CPDF_PathData *pPathData = pPathObject->m_Path.GetModify(); if (pPathData) { pPathData->AppendRect(rect.left + width, rect.bottom + width, rect.right - width, rect.top - width); } pPathObject->CalcBoundingBox(); return pPathObject.release(); }
void CItem::AlterToMagicItem() { int idx = GetAttributeSetIndex(); if (idx < 0) return; // Appeariance Second Third // Weapon 50 20 5 // Armor 30 10 2 // Acc 20 10 1 int iSecondPct; int iThirdPct; if (g_iUseLocale) { switch (GetType()) { case ITEM_WEAPON: iSecondPct = 20; iThirdPct = 5; break; case ITEM_ARMOR: case ITEM_COSTUME: if (GetSubType() == ARMOR_BODY) { iSecondPct = 10; iThirdPct = 2; } else { iSecondPct = 10; iThirdPct = 1; } break; default: return; } } else { switch (GetType()) { case ITEM_WEAPON: iSecondPct = 30; iThirdPct = 15; break; case ITEM_ARMOR: case ITEM_COSTUME: if (GetSubType() == ARMOR_BODY) { iSecondPct = 20; iThirdPct = 10; } else { iSecondPct = 10; iThirdPct = 5; } break; default: return; } } // 100% È®·ü·Î ÁÁÀº ¼Ó¼º Çϳª PutAttribute(aiItemMagicAttributePercentHigh); if (number(1, 100) <= iSecondPct) PutAttribute(aiItemMagicAttributePercentLow); if (number(1, 100) <= iThirdPct) PutAttribute(aiItemMagicAttributePercentLow); }
void CItem::ModifyPoints(bool bAdd) { int accessoryGrade; // №«±вїН °©їКёё јТДПА» АыїлЅГЕІґЩ. if (false == IsAccessoryForSocket()) { if (m_pProto->bType == ITEM_WEAPON || m_pProto->bType == ITEM_ARMOR) { // јТДПАМ јУјє°ИїЎ »зїлµЗґВ °жїм АыїлЗПБц ѕКґВґЩ (ARMOR_WRIST ARMOR_NECK ARMOR_EAR) for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) { DWORD dwVnum; if ((dwVnum = GetSocket(i)) <= 2) continue; TItemTable * p = ITEM_MANAGER::instance().GetTable(dwVnum); if (!p) { sys_err("cannot find table by vnum %u", dwVnum); continue; } if (ITEM_METIN == p->bType) { //m_pOwner->ApplyPoint(p->alValues[0], bAdd ? p->alValues[1] : -p->alValues[1]); for (int i = 0; i < ITEM_APPLY_MAX_NUM; ++i) { if (p->aApplies[i].bType == APPLY_NONE) continue; if (p->aApplies[i].bType == APPLY_SKILL) m_pOwner->ApplyPoint(p->aApplies[i].bType, bAdd ? p->aApplies[i].lValue : p->aApplies[i].lValue ^ 0x00800000); else m_pOwner->ApplyPoint(p->aApplies[i].bType, bAdd ? p->aApplies[i].lValue : -p->aApplies[i].lValue); } } } } accessoryGrade = 0; } else { accessoryGrade = MIN(GetAccessorySocketGrade(), ITEM_ACCESSORY_SOCKET_MAX_NUM); } for (int i = 0; i < ITEM_APPLY_MAX_NUM; ++i) { if (m_pProto->aApplies[i].bType == APPLY_NONE) continue; long value = m_pProto->aApplies[i].lValue; if (m_pProto->aApplies[i].bType == APPLY_SKILL) { m_pOwner->ApplyPoint(m_pProto->aApplies[i].bType, bAdd ? value : value ^ 0x00800000); } else { if (0 != accessoryGrade) value += MAX(accessoryGrade, value * aiAccessorySocketEffectivePct[accessoryGrade] / 100); m_pOwner->ApplyPoint(m_pProto->aApplies[i].bType, bAdd ? value : -value); } } // ГКЅВґЮАЗ №ЭБц, ЗТ·ОА© »зЕБ, Зає№АЗ №ЭБц, їµїшЗС »з¶ыАЗ ЖжґшЖ®АЗ °жїм // ±вБёАЗ ЗПµе ДЪµщАё·О °Б¦·О јУјєА» єОї©ЗЯБцёё, // ±Ч єОєРА» Б¦°ЕЗП°н special item group ЕЧАМєнїЎј јУјєА» єОї©ЗПµµ·П єЇ°жЗПїґґЩ. // ЗПБцёё ЗПµе ДЪµщµЗѕоАЦА» ¶§ »эјєµИ ѕЖАМЕЫАМ іІѕЖАЦА» јцµµ АЦѕој ЖЇјцГіё® ЗШіхґВґЩ. // АМ ѕЖАМЕЫµйАЗ °жїм, №ШїЎ ITEM_UNIQUEАП ¶§АЗ Гіё®·О јУјєАМ єОї©µЗ±в ¶§№®їЎ, // ѕЖАМЕЫїЎ №ЪЗфАЦґВ attributeґВ АыїлЗПБц ѕК°н іСѕо°ЈґЩ. if (true == CItemVnumHelper::IsRamadanMoonRing(GetVnum()) || true == CItemVnumHelper::IsHalloweenCandy(GetVnum()) || true == CItemVnumHelper::IsHappinessRing(GetVnum()) || true == CItemVnumHelper::IsLovePendant(GetVnum())) { // Do not anything. } else { for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; ++i) { if (GetAttributeType(i)) { const TPlayerItemAttribute& ia = GetAttribute(i); if (ia.bType == APPLY_SKILL) m_pOwner->ApplyPoint(ia.bType, bAdd ? ia.sValue : ia.sValue ^ 0x00800000); else m_pOwner->ApplyPoint(ia.bType, bAdd ? ia.sValue : -ia.sValue); } } } switch (m_pProto->bType) { case ITEM_PICK: case ITEM_ROD: { if (bAdd) { if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON) m_pOwner->SetPart(PART_WEAPON, GetVnum()); } else { if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON) m_pOwner->SetPart(PART_WEAPON, m_pOwner->GetOriginalPart(PART_WEAPON)); } } break; case ITEM_WEAPON: { if (bAdd) { if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON) m_pOwner->SetPart(PART_WEAPON, GetVnum()); } else { if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON) m_pOwner->SetPart(PART_WEAPON, m_pOwner->GetOriginalPart(PART_WEAPON)); } } break; case ITEM_ARMOR: { // ДЪЅєГх bodyё¦ АФ°нАЦґЩёй armorґВ №юґш АФґш »у°ь ѕшАМ єсБЦѕуїЎ їµЗвА» БЦёй ѕИ µК. if (0 != m_pOwner->GetWear(WEAR_COSTUME_BODY)) break; if (GetSubType() == ARMOR_BODY || GetSubType() == ARMOR_HEAD || GetSubType() == ARMOR_FOOTS || GetSubType() == ARMOR_SHIELD) { if (bAdd) { if (GetProto()->bSubType == ARMOR_BODY) m_pOwner->SetPart(PART_MAIN, GetVnum()); } else { if (GetProto()->bSubType == ARMOR_BODY) m_pOwner->SetPart(PART_MAIN, m_pOwner->GetOriginalPart(PART_MAIN)); } } } break; // ДЪЅєГх ѕЖАМЕЫ АФѕъА» ¶§ ДіёЇЕН parts Б¤єё јјЖГ. ±вБё ЅєЕёАПґл·О ГЯ°ЎЗФ.. case ITEM_COSTUME: { DWORD toSetValue = this->GetVnum(); EParts toSetPart = PART_MAX_NUM; // °©їК ДЪЅєГх if (GetSubType() == COSTUME_BODY) { toSetPart = PART_MAIN; if (false == bAdd) { // ДЪЅєГх °©їКА» №юѕъА» ¶§ їш·Ў °©їКА» АФ°н АЦѕъґЩёй ±Ч °©їКАё·О look јјЖГ, АФБц ѕКѕТґЩёй default look const CItem* pArmor = m_pOwner->GetWear(WEAR_BODY); toSetValue = (NULL != pArmor) ? pArmor->GetVnum() : m_pOwner->GetOriginalPart(PART_MAIN); } } // Змѕо ДЪЅєГх else if (GetSubType() == COSTUME_HAIR) { toSetPart = PART_HAIR; // ДЪЅєГх ЗмѕоґВ shape°ЄА» item protoАЗ value3їЎ јјЖГЗПµµ·П ЗФ. ЖЇє°ЗС АМАЇґВ ѕш°н ±вБё °©їК(ARMOR_BODY)АЗ shape°ЄАМ ЗБ·ОЕдАЗ value3їЎ АЦѕој Змѕоµµ °°АМ value3Аё·О ЗФ. // [NOTE] °©їКАє ѕЖАМЕЫ vnumА» єёі»°н ЗмѕоґВ shape(value3)°ЄА» єёі»ґВ АМАЇґВ.. ±вБё ЅГЅєЕЫАМ ±Ч·ё°Ф µЗѕоАЦАЅ... toSetValue = (true == bAdd) ? this->GetValue(3) : 0; } if (PART_MAX_NUM != toSetPart) { m_pOwner->SetPart((BYTE)toSetPart, toSetValue); m_pOwner->UpdatePacket(); } } break; case ITEM_UNIQUE: { if (0 != GetSIGVnum()) { const CSpecialItemGroup* pItemGroup = ITEM_MANAGER::instance().GetSpecialItemGroup(GetSIGVnum()); if (NULL == pItemGroup) break; DWORD dwAttrVnum = pItemGroup->GetAttrVnum(GetVnum()); const CSpecialAttrGroup* pAttrGroup = ITEM_MANAGER::instance().GetSpecialAttrGroup(dwAttrVnum); if (NULL == pAttrGroup) break; for (SpecialAttrInfoVector::const_iterator it = pAttrGroup->m_vecAttrs.begin(); it != pAttrGroup->m_vecAttrs.end(); it++) { m_pOwner->ApplyPoint(it->apply_type, bAdd ? it->apply_value : -it->apply_value); } } } break; } }
int CItem::FindEquipCell(LPCHARACTER ch, int iCandidateCell) { // ДЪЅєГх ѕЖАМЕЫ(ITEM_COSTUME)Ає WearFlag ѕшѕоµµ µК. (sub typeАё·О ВшїлА§ДЎ ±ёєР. ±НВъ°Ф ¶З wear flag БЩ ЗКїд°Ў АЦіЄ..) // їлИҐј®(ITEM_DS, ITEM_SPECIAL_DS)µµ SUB_TYPEАё·О ±ёєР. ЅЕ±Ф №ЭБц, є§Ж®ґВ ITEM_TYPEАё·О ±ёєР -_- if ((0 == GetWearFlag() || ITEM_TOTEM == GetType()) && ITEM_COSTUME != GetType() && ITEM_DS != GetType() && ITEM_SPECIAL_DS != GetType() && ITEM_RING != GetType() && ITEM_BELT != GetType()) return -1; // їлИҐј® ЅЅ·ФА» WEAR·О Гіё®ЗТ јц°Ў ѕшѕој(WEARґВ ГЦґл 32°і±оБц °ЎґЙЗСµҐ їлИҐј®А» ГЯ°ЎЗПёй 32°Ў іСґВґЩ.) // АОєҐЕдё®АЗ ЖЇБ¤ А§ДЎ((INVENTORY_MAX_NUM + WEAR_MAX_NUM)єОЕН (INVENTORY_MAX_NUM + WEAR_MAX_NUM + DRAGON_SOUL_DECK_MAX_NUM * DS_SLOT_MAX - 1)±оБц)ё¦ // їлИҐј® ЅЅ·ФАё·О Б¤ЗФ. // return ЗТ ¶§їЎ, INVENTORY_MAX_NUMА» »« АМАЇґВ, // є»·Ў WearCellАМ INVENTORY_MAX_NUMё¦ »©°н return ЗП±в ¶§№®. if (GetType() == ITEM_DS || GetType() == ITEM_SPECIAL_DS) { if (iCandidateCell < 0) { return WEAR_MAX_NUM + GetSubType(); } else { for (int i = 0; i < DRAGON_SOUL_DECK_MAX_NUM; i++) { if (WEAR_MAX_NUM + i * DS_SLOT_MAX + GetSubType() == iCandidateCell) { return iCandidateCell; } } return -1; } } else if (GetType() == ITEM_COSTUME) { if (GetSubType() == COSTUME_BODY) return WEAR_COSTUME_BODY; else if (GetSubType() == COSTUME_HAIR) return WEAR_COSTUME_HAIR; } else if (GetType() == ITEM_RING) { if (ch->GetWear(WEAR_RING1)) return WEAR_RING2; else return WEAR_RING1; } else if (GetType() == ITEM_BELT) return WEAR_BELT; else if (GetWearFlag() & WEARABLE_BODY) return WEAR_BODY; else if (GetWearFlag() & WEARABLE_HEAD) return WEAR_HEAD; else if (GetWearFlag() & WEARABLE_FOOTS) return WEAR_FOOTS; else if (GetWearFlag() & WEARABLE_WRIST) return WEAR_WRIST; else if (GetWearFlag() & WEARABLE_WEAPON) return WEAR_WEAPON; else if (GetWearFlag() & WEARABLE_SHIELD) return WEAR_SHIELD; else if (GetWearFlag() & WEARABLE_NECK) return WEAR_NECK; else if (GetWearFlag() & WEARABLE_EAR) return WEAR_EAR; else if (GetWearFlag() & WEARABLE_ARROW) return WEAR_ARROW; else if (GetWearFlag() & WEARABLE_UNIQUE) { if (ch->GetWear(WEAR_UNIQUE1)) return WEAR_UNIQUE2; else return WEAR_UNIQUE1; } // јцБэ ДщЅєЖ®ё¦ А§ЗС ѕЖАМЕЫАМ №ЪИчґВ°чАё·О ЗС№ш №ЪИчёй Аэґл –Eјц ѕшґЩ. else if (GetWearFlag() & WEARABLE_ABILITY) { if (!ch->GetWear(WEAR_ABILITY1)) { return WEAR_ABILITY1; } else if (!ch->GetWear(WEAR_ABILITY2)) { return WEAR_ABILITY2; } else if (!ch->GetWear(WEAR_ABILITY3)) { return WEAR_ABILITY3; } else if (!ch->GetWear(WEAR_ABILITY4)) { return WEAR_ABILITY4; } else if (!ch->GetWear(WEAR_ABILITY5)) { return WEAR_ABILITY5; } else if (!ch->GetWear(WEAR_ABILITY6)) { return WEAR_ABILITY6; } else if (!ch->GetWear(WEAR_ABILITY7)) { return WEAR_ABILITY7; } else if (!ch->GetWear(WEAR_ABILITY8)) { return WEAR_ABILITY8; } else { return -1; } } return -1; }
void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device, const CPDF_RenderOptions* pOptions) { if (GetSubType() == "Popup") { return; } FX_DWORD annot_flags = GetFlags(); if (annot_flags & ANNOTFLAG_HIDDEN) { return; } FX_BOOL bPrinting = pDevice->GetDeviceClass() == FXDC_PRINTER || (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW)); if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { return; } if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { return; } CPDF_Dictionary* pBS = m_pAnnotDict->GetDict("BS"); char style_char; FX_FLOAT width; CPDF_Array* pDashArray = NULL; if (pBS == NULL) { CPDF_Array* pBorderArray = m_pAnnotDict->GetArray("Border"); style_char = 'S'; if (pBorderArray) { width = pBorderArray->GetNumber(2); if (pBorderArray->GetCount() == 4) { pDashArray = pBorderArray->GetArray(3); if (pDashArray == NULL) { return; } int nLen = pDashArray->GetCount(); int i = 0; for (; i < nLen; ++i) { CPDF_Object*pObj = pDashArray->GetElementValue(i); if (pObj && pObj->GetInteger()) { break; } } if (i == nLen) { return; } style_char = 'D'; } } else { width = 1; } } else { CFX_ByteString style = pBS->GetString("S"); pDashArray = pBS->GetArray("D"); style_char = style[1]; width = pBS->GetNumber("W"); } if (width <= 0) { return; } CPDF_Array* pColor = m_pAnnotDict->GetArray("C"); FX_DWORD argb = 0xff000000; if (pColor != NULL) { int R = (FX_INT32)(pColor->GetNumber(0) * 255); int G = (FX_INT32)(pColor->GetNumber(1) * 255); int B = (FX_INT32)(pColor->GetNumber(2) * 255); argb = ArgbEncode(0xff, R, G, B); } CPDF_GraphStateData graph_state; graph_state.m_LineWidth = width; if (style_char == 'D') { if (pDashArray) { FX_DWORD dash_count = pDashArray->GetCount(); if (dash_count % 2) { dash_count ++; } graph_state.m_DashArray = FX_Alloc(FX_FLOAT, dash_count); if (graph_state.m_DashArray == NULL) { return ; } graph_state.m_DashCount = dash_count; FX_DWORD i; for (i = 0; i < pDashArray->GetCount(); i ++) { graph_state.m_DashArray[i] = pDashArray->GetNumber(i); } if (i < dash_count) { graph_state.m_DashArray[i] = graph_state.m_DashArray[i - 1]; } } else { graph_state.m_DashArray = FX_Alloc(FX_FLOAT, 2); if (graph_state.m_DashArray == NULL) { return ; } graph_state.m_DashCount = 2; graph_state.m_DashArray[0] = graph_state.m_DashArray[1] = 3 * 1.0f; } } CFX_FloatRect rect; GetRect(rect); CPDF_PathData path; width /= 2; path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, rect.top - width); int fill_type = 0; if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { fill_type |= FXFILL_NOPATHSMOOTH; } pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); }