Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifdef __SEND_TARGET_INFO__
- bool ITEM_MANAGER::CreateDropItemVector(LPCHARACTER pkChr, LPCHARACTER pkKiller, std::vector<LPITEM> & vec_item)
- {
- if (pkChr->IsPolymorphed() || pkChr->IsPC())
- {
- return false;
- }
- int iLevel = pkKiller->GetLevel();
- bool iLevelMin = false;
- bool iLevelMax = false;
- BYTE bRank = pkChr->GetMobRank();
- LPITEM item = NULL;
- std::vector<CItemDropInfo>::iterator it = g_vec_pkCommonDropItem[bRank].begin();
- while (it != g_vec_pkCommonDropItem[bRank].end())
- {
- const CItemDropInfo & c_rInfo = *(it++);
- if (iLevel < c_rInfo.m_iLevelStart || iLevel > c_rInfo.m_iLevelEnd)
- continue;
- //TItemTable * table = GetTable(c_rInfo.m_dwVnum);
- DWORD ranItem = number(c_rInfo.m_dwVnumStart, c_rInfo.m_dwVnumEnd);
- TItemTable * table = GetTable(ranItem);
- if (!table)
- continue;
- item = NULL;
- if (table->bType == ITEM_POLYMORPH)
- {
- if (ranItem == pkChr->GetPolymorphItemVnum())
- {
- item = CreateItem(ranItem, 1, 0, true);
- if (item)
- item->SetSocket(0, pkChr->GetRaceNum());
- }
- }
- else
- item = CreateItem(ranItem, 1, 0, true);
- if (item) vec_item.push_back(item);
- }
- // Drop Item Group
- {
- //itertype(m_map_pkDropItemGroup) it;
- auto it = m_map_pkDropItemGroup.find(pkChr->GetRaceNum());
- if (it != m_map_pkDropItemGroup.end())
- {
- //typeof(it->second->GetVector())
- auto v = it->second->GetVector();
- for (DWORD i = 0; i < v.size(); ++i)
- {
- //item = CreateItem(v.dwVnum, v.iCount, 0, true);
- item = CreateItem(v.dwVnumStart, v.dwVnumEnd, v.iCount, 0, true);
- if (item)
- {
- if (item->GetType() == ITEM_POLYMORPH)
- {
- if (item->GetVnum() == pkChr->GetPolymorphItemVnum())
- {
- item->SetSocket(0, pkChr->GetRaceNum());
- }
- }
- vec_item.push_back(item);
- }
- }
- }
- }
- // MobDropItem Group
- {
- //itertype(m_map_pkMobItemGroup) it;
- auto it = m_map_pkMobItemGroup.find(pkChr->GetRaceNum());
- if (it != m_map_pkMobItemGroup.end())
- {
- std::vector<CMobItemGroup*>& vec_pGroups = it->second;
- for (int i = 0; i < vec_pGroups.size(); ++i)
- {
- CMobItemGroup* pGroup = vec_pGroups;
- // MOB_DROP_ITEM_BUG_FIX
- // 20050805.myevan.MobDropItem ? ???? ?? ?? CMobItemGroup::GetOne() ??? ?? ?? ??
- if (pGroup && !pGroup->IsEmpty())
- {
- const CMobItemGroup::SMobItemGroupInfo& info = pGroup->GetOne();
- //item = CreateItem(info.dwItemVnum, info.iCount, 0, true, info.iRarePct);
- item = CreateItem(info.dwItemVnumStart, info.dwItemVnumEnd, info.iCount, 0, true, info.iRarePct);
- if (item) vec_item.push_back(item);
- }
- // END_OF_MOB_DROP_ITEM_BUG_FIX
- }
- }
- }
- // Level Item Group
- {
- // itertype(m_map_pkLevelItemGroup) it;
- auto it = m_map_pkLevelItemGroup.find(pkChr->GetRaceNum());
- if (it != m_map_pkLevelItemGroup.end())
- {
- if (it->second->GetLevelLimitStart() <= (DWORD)iLevel)
- {
- //pkKiller->ChatPacket(CHAT_TYPE_INFO_ITEM, "GetLevelLimitStart %d", it->second->GetLevelLimitStart());// Only Output Info for test
- iLevelMin = true;
- }
- if (it->second->GetLevelLimitEnd() >= (DWORD)iLevel)
- {
- //pkKiller->ChatPacket(CHAT_TYPE_INFO_ITEM, "GetLevelLimitEnd %d", it->second->GetLevelLimitEnd());// Only Output Info for test
- iLevelMax = true;
- }
- if (iLevelMin && iLevelMax)
- {
- // typeof(it->second->GetVector()) v = it->second->GetVector();
- auto v = it->second->GetVector();
- for (DWORD i = 0; i < v.size(); i++)
- {
- //DWORD dwVnum = v.dwVNum;
- DWORD dwVnum = number(v.dwVNumStart, v.dwVNumEnd);
- item = CreateItem(dwVnum, v.iCount, 0, true);
- if (item) vec_item.push_back(item);
- }
- }
- }
- }
- // BuyerTheitGloves Item Group
- {
- // by mhh ?? ??? ??? ?? drop ? ???? ??
- if (pkKiller->GetPremiumRemainSeconds(PREMIUM_ITEM) > 0 ||
- pkKiller->IsEquipUniqueGroup(UNIQUE_GROUP_DOUBLE_ITEM))
- {
- //itertype(m_map_pkGloveItemGroup) it;
- auto it = m_map_pkGloveItemGroup.find(pkChr->GetRaceNum());
- if (it != m_map_pkGloveItemGroup.end())
- {
- //typeof(it->second->GetVector())
- auto v = it->second->GetVector();
- for (DWORD i = 0; i < v.size(); ++i)
- {
- //DWORD dwVnum = v[i].dwVnum;
- //item = CreateItem(dwVnum, v[i].iCount, 0, true);
- DWORD dwVnum = number(v[i].dwVnumStart, v[i].dwVnumEnd);
- item = CreateItem(dwVnum, v[i].iCount, 0, true);
- if (item) vec_item.push_back(item);
- }
- }
- }
- }
- // ??
- if (pkChr->GetMobDropItemVnum())
- {
- //itertype(m_map_dwEtcItemDropProb)
- auto it = m_map_dwEtcItemDropProb.find(pkChr->GetMobDropItemVnum());
- if (it != m_map_dwEtcItemDropProb.end())
- {
- item = CreateItem(pkChr->GetMobDropItemVnum(), 1, 0, true);
- if (item) vec_item.push_back(item);
- }
- }
- if (pkChr->IsStone())
- {
- if (pkChr->GetDropMetinStoneVnum())
- {
- item = CreateItem(pkChr->GetDropMetinStoneVnum(), 1, 0, true);
- if (item) vec_item.push_back(item);
- }
- }
- return vec_item.size();
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment