When i have stack item detector i mean 27989 than after one used all items disappear
here is the function:
Code
- case 27989: // 영석감지기
- case 76006: // 선물용 영석감지기
- {
- LPSECTREE_MAP pMap = SECTREE_MANAGER::instance().GetMap(GetMapIndex());
- if (pMap != NULL)
- {
- item->SetSocket(0, item->GetSocket(0) + 1);
- FFindStone f;
- // <Factor> SECTREE::for_each -> SECTREE::for_each_entity
- pMap->for_each(f);
- if (f.m_mapStone.size() > 0)
- {
- std::map<DWORD, LPCHARACTER>::iterator stone = f.m_mapStone.begin();
- DWORD max = UINT_MAX;
- LPCHARACTER pTarget = stone->second;
- while (stone != f.m_mapStone.end())
- {
- DWORD dist = (DWORD)DISTANCE_SQRT(GetX()-stone->second->GetX(), GetY()-stone->second->GetY());
- if (dist != 0 && max > dist)
- {
- max = dist;
- pTarget = stone->second;
- }
- stone++;
- }
- if (pTarget != NULL)
- {
- int val = 3;
- if (max < 10000) val = 2;
- else if (max < 70000) val = 1;
- ChatPacket(CHAT_TYPE_COMMAND, "StoneDetect %u %d %d", (DWORD)GetVID(), val,
- (int)GetDegreeFromPositionXY(GetX(), pTarget->GetY(), pTarget->GetX(), GetY()));
- }
- else
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("감지기를 작용하였으나 감지되는 영석이 없습니다."));
- }
- }
- else
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("감지기를 작용하였으나 감지되는 영석이 없습니다."));
- }
- if (item->GetSocket(0) >= 6)
- {
- ChatPacket(CHAT_TYPE_COMMAND, "StoneDetect %u 0 0", (DWORD)GetVID());
- item->SetCount(item->GetCount() - 1);
- }
- }
- break;
What i should change? I dont want disappear items stack