Jump to content

Stone Detector problem C++


Recommended Posts

When i have stack item detector i mean 27989 than after one used all items disappear 
here is the function:
 
	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
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.