Ayyıldız2 | 2008 TR Yapısı • 1-99 Orta Emek Destan • Oto Avsız • 10 Temmuz 21:00 HEMEN TIKLA!
sağolasın abi eline sağlık. sabitteki Official item_proto ve mob_proto konusunada bir baksan güncel protoları açmıyorda
Oyuna girişte oyuncuların yerlerini görebilmek için SendNPCPosition fonksiyonunu aşağıdaki gibi değişebilirsiniz. Sadece gmler görebilir, oyuncunun direk x,y koordinatlarını alacak fonksiyonu bulamadığım için aşağıdaki gibi yaptım.
C++:
void SECTREE_MANAGER::SendNPCPosition(LPCHARACTER ch)
{
LPDESC d = ch->GetDesc();
if (!d)
return;
long lMapIndex = ch->GetMapIndex();
if (m_mapNPCPosition[lMapIndex].empty())
return;
TEMP_BUFFER buf;
TPacketGCNPCPosition p;
p.header = HEADER_GC_NPC_POSITION;
p.count = m_mapNPCPosition[lMapIndex].size();
TNPCPosition np;
// TODO m_mapNPCPosition[lMapIndex] ¸¦ º¸³»ÁÖ¼¼¿ä
itertype(m_mapNPCPosition[lMapIndex]) it;
for (it = m_mapNPCPosition[lMapIndex].begin(); it != m_mapNPCPosition[lMapIndex].end(); ++it)
{
np.bType = it->bType;
strlcpy(np.name, it->name, sizeof(np.name));
np.x = it->x;
np.y = it->y;
buf.write(&np, sizeof(np));
}
if (ch->IsGM())
{
const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet();
for (itertype(c_ref_set) it2 = c_ref_set.begin(); it2 != c_ref_set.end(); ++it2)
{
LPCHARACTER pkChar = (*it2)->GetCharacter();
if (!pkChar)
continue;
if (pkChar->GetMapIndex() == lMapIndex && pkChar->GetPlayerID() != ch->GetPlayerID())
{
PIXEL_POSITION posBase;
if (!SECTREE_MANAGER::instance().GetMapBasePositionByMapIndex(ch->GetMapIndex(), posBase))
{
continue;
}
DWORD mapX = posBase.x;
DWORD mapY = posBase.y;
const PIXEL_POSITION & vpos = pkChar->GetXYZ();
DWORD playerX = vpos.x;
DWORD playerY = vpos.y;
DWORD finalX = (playerX- mapX)/100;
DWORD finalY = (playerY- mapY)/100;
finalX *= 100;
finalY *= 100;
np.bType = 1;
strlcpy(np.name, pkChar->GetName(), sizeof(np.name));
np.x = finalX;
np.y = finalY;
p.count += 1;
buf.write(&np, sizeof(np));
}
}
}
p.size = sizeof(p) + buf.size();
if (buf.size())
{
d->BufferedPacket(&p, sizeof(TPacketGCNPCPosition));
d->Packet(buf.read_peek(), buf.size());
}
else
d->Packet(&p, sizeof(TPacketGCNPCPosition));
}
Oyuna girişte oyuncuların yerlerini görebilmek için SendNPCPosition fonksiyonunu aşağıdaki gibi değişebilirsiniz. Sadece gmler görebilir, oyuncunun direk x,y koordinatlarını alacak fonksiyonu bulamadığım için aşağıdaki gibi yaptım.
![]()
C++:void SECTREE_MANAGER::SendNPCPosition(LPCHARACTER ch) { LPDESC d = ch->GetDesc(); if (!d) return; long lMapIndex = ch->GetMapIndex(); if (m_mapNPCPosition[lMapIndex].empty()) return; TEMP_BUFFER buf; TPacketGCNPCPosition p; p.header = HEADER_GC_NPC_POSITION; p.count = m_mapNPCPosition[lMapIndex].size(); TNPCPosition np; // TODO m_mapNPCPosition[lMapIndex] ¸¦ º¸³»ÁÖ¼¼¿ä itertype(m_mapNPCPosition[lMapIndex]) it; for (it = m_mapNPCPosition[lMapIndex].begin(); it != m_mapNPCPosition[lMapIndex].end(); ++it) { np.bType = it->bType; strlcpy(np.name, it->name, sizeof(np.name)); np.x = it->x; np.y = it->y; buf.write(&np, sizeof(np)); } if (ch->IsGM()) { const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet(); for (itertype(c_ref_set) it2 = c_ref_set.begin(); it2 != c_ref_set.end(); ++it2) { LPCHARACTER pkChar = (*it2)->GetCharacter(); if (!pkChar) continue; if (pkChar->GetMapIndex() == lMapIndex && pkChar->GetPlayerID() != ch->GetPlayerID()) { PIXEL_POSITION posBase; if (!SECTREE_MANAGER::instance().GetMapBasePositionByMapIndex(ch->GetMapIndex(), posBase)) { continue; } DWORD mapX = posBase.x; DWORD mapY = posBase.y; const PIXEL_POSITION & vpos = pkChar->GetXYZ(); DWORD playerX = vpos.x; DWORD playerY = vpos.y; DWORD finalX = (playerX- mapX)/100; DWORD finalY = (playerY- mapY)/100; finalX *= 100; finalY *= 100; np.bType = 1; strlcpy(np.name, pkChar->GetName(), sizeof(np.name)); np.x = finalX; np.y = finalY; p.count += 1; buf.write(&np, sizeof(np)); } } } p.size = sizeof(p) + buf.size(); if (buf.size()) { d->BufferedPacket(&p, sizeof(TPacketGCNPCPosition)); d->Packet(buf.read_peek(), buf.size()); } else d->Packet(&p, sizeof(TPacketGCNPCPosition)); }
nerede değişiklik yapacaklarını bilmeyenlerOyuna girişte oyuncuların yerlerini görebilmek için SendNPCPosition fonksiyonunu aşağıdaki gibi değişebilirsiniz. Sadece gmler görebilir, oyuncunun direk x,y koordinatlarını alacak fonksiyonu bulamadığım için aşağıdaki gibi yaptım.
![]()
C++:void SECTREE_MANAGER::SendNPCPosition(LPCHARACTER ch) { LPDESC d = ch->GetDesc(); if (!d) return; long lMapIndex = ch->GetMapIndex(); if (m_mapNPCPosition[lMapIndex].empty()) return; TEMP_BUFFER buf; TPacketGCNPCPosition p; p.header = HEADER_GC_NPC_POSITION; p.count = m_mapNPCPosition[lMapIndex].size(); TNPCPosition np; // TODO m_mapNPCPosition[lMapIndex] ¸¦ º¸³»ÁÖ¼¼¿ä itertype(m_mapNPCPosition[lMapIndex]) it; for (it = m_mapNPCPosition[lMapIndex].begin(); it != m_mapNPCPosition[lMapIndex].end(); ++it) { np.bType = it->bType; strlcpy(np.name, it->name, sizeof(np.name)); np.x = it->x; np.y = it->y; buf.write(&np, sizeof(np)); } if (ch->IsGM()) { const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet(); for (itertype(c_ref_set) it2 = c_ref_set.begin(); it2 != c_ref_set.end(); ++it2) { LPCHARACTER pkChar = (*it2)->GetCharacter(); if (!pkChar) continue; if (pkChar->GetMapIndex() == lMapIndex && pkChar->GetPlayerID() != ch->GetPlayerID()) { PIXEL_POSITION posBase; if (!SECTREE_MANAGER::instance().GetMapBasePositionByMapIndex(ch->GetMapIndex(), posBase)) { continue; } DWORD mapX = posBase.x; DWORD mapY = posBase.y; const PIXEL_POSITION & vpos = pkChar->GetXYZ(); DWORD playerX = vpos.x; DWORD playerY = vpos.y; DWORD finalX = (playerX- mapX)/100; DWORD finalY = (playerY- mapY)/100; finalX *= 100; finalY *= 100; np.bType = 1; strlcpy(np.name, pkChar->GetName(), sizeof(np.name)); np.x = finalX; np.y = finalY; p.count += 1; buf.write(&np, sizeof(np)); } } } p.size = sizeof(p) + buf.size(); if (buf.size()) { d->BufferedPacket(&p, sizeof(TPacketGCNPCPosition)); d->Packet(buf.read_peek(), buf.size()); } else d->Packet(&p, sizeof(TPacketGCNPCPosition)); }
sectree_manager.cpp------------->burada dğişiklik yapacaklar
Oyuna girişte oyuncuların yerlerini görebilmek için SendNPCPosition fonksiyonunu aşağıdaki gibi değişebilirsiniz. Sadece gmler görebilir, oyuncunun direk x,y koordinatlarını alacak fonksiyonu bulamadığım için aşağıdaki gibi yaptım.
![]()
C++:void SECTREE_MANAGER::SendNPCPosition(LPCHARACTER ch) { LPDESC d = ch->GetDesc(); if (!d) return; long lMapIndex = ch->GetMapIndex(); if (m_mapNPCPosition[lMapIndex].empty()) return; TEMP_BUFFER buf; TPacketGCNPCPosition p; p.header = HEADER_GC_NPC_POSITION; p.count = m_mapNPCPosition[lMapIndex].size(); TNPCPosition np; // TODO m_mapNPCPosition[lMapIndex] ¸¦ º¸³»ÁÖ¼¼¿ä itertype(m_mapNPCPosition[lMapIndex]) it; for (it = m_mapNPCPosition[lMapIndex].begin(); it != m_mapNPCPosition[lMapIndex].end(); ++it) { np.bType = it->bType; strlcpy(np.name, it->name, sizeof(np.name)); np.x = it->x; np.y = it->y; buf.write(&np, sizeof(np)); } if (ch->IsGM()) { const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet(); for (itertype(c_ref_set) it2 = c_ref_set.begin(); it2 != c_ref_set.end(); ++it2) { LPCHARACTER pkChar = (*it2)->GetCharacter(); if (!pkChar) continue; if (pkChar->GetMapIndex() == lMapIndex && pkChar->GetPlayerID() != ch->GetPlayerID()) { PIXEL_POSITION posBase; if (!SECTREE_MANAGER::instance().GetMapBasePositionByMapIndex(ch->GetMapIndex(), posBase)) { continue; } DWORD mapX = posBase.x; DWORD mapY = posBase.y; const PIXEL_POSITION & vpos = pkChar->GetXYZ(); DWORD playerX = vpos.x; DWORD playerY = vpos.y; DWORD finalX = (playerX- mapX)/100; DWORD finalY = (playerY- mapY)/100; finalX *= 100; finalY *= 100; np.bType = 1; strlcpy(np.name, pkChar->GetName(), sizeof(np.name)); np.x = finalX; np.y = finalY; p.count += 1; buf.write(&np, sizeof(np)); } } } p.size = sizeof(p) + buf.size(); if (buf.size()) { d->BufferedPacket(&p, sizeof(TPacketGCNPCPosition)); d->Packet(buf.read_peek(), buf.size()); } else d->Packet(&p, sizeof(TPacketGCNPCPosition)); }
sadece oyuna ilk girişteki konumları gösteriyor yalnız herhangi bir update'i yok yani oyuncu hareket ettiğinde minimapteki konumu değişmiyor kullanacaklar için belirteyim.