📄 map.cpp
字号:
}
////////////////////////////////////////////////////////////////////////////////////////
// PLAYER ID肺 Socket Handle 茫扁
//
// - 家巩磊 PLAYER ID啊 措盒磊肺 摹券 登绢 TEMP函荐 荤侩
////////////////////////////////////////////////////////////////////////////////////////
_LPSOCKET_FD Map::Find_Player(char * pPlayerID)
{
char strTempPlayer[22] ={0,} ;
memcpy( strTempPlayer, pPlayerID, 20 );
return (_LPSOCKET_FD)m_MapPlayerID.Find( strupr( strTempPlayer ) );
}
////////////////////////////////////////////////////////////////////////////////////////
// PARTY甫 涝仿 矫糯
//
// - 秦寸 颇萍啊 捞固 粮犁窍绰 版快 CHECKING
// - 葛碘 窜鉴拳 累诀 荐青
////////////////////////////////////////////////////////////////////////////////////////
void Map::Party_Create(_LPZW_PARTYCREATE_REP pPacket)
{
CParty *pParty = (CParty *)m_MapParty.Find( pPacket->dwPartyHandle );
/*
扁粮 Memory粮犁矫
- 扁粮 Pointer甫 弊措肺背眉 矫糯
- 眠饶 包访 Field楷荤俊 包茄 八配 累诀 鞘夸
*/
if( pParty )
{
ErrorMsg( "(X)Party_Create - exsit party (%d)", pPacket->dwPartyHandle );
}
else
{
pParty = (CParty *)m_PoolParty.RemoveHead(); // POP Party POOL
if(pParty == NULL)
{
pParty = new CParty;
if(NULL == pParty) return ;
}
}
pParty->Party_Create( pPacket ); // 秦寸 沥焊甫 涝仿 矫糯
m_MapParty.Insert( pPacket->dwPartyHandle, pParty );
}
////////////////////////////////////////////////////////////////////////////////////////
// PARTY甫 涝仿 矫糯
//
// - MAP捞悼 矫 LIST夸没 窍咯 罐篮 版快 贸府
// - 秦寸 颇萍啊 捞固 粮犁窍绰 版快 CHECKING
// - 葛碘 窜鉴拳 累诀 荐青
////////////////////////////////////////////////////////////////////////////////////////
void Map::Party_Create(_LPZW_PARTYLIST_REP pPacket)
{
CParty *pParty = (CParty *)m_MapParty.Find( pPacket->dwPartyHandle );
if( pParty )
{
;
}
else
{
// 粮犁 窍瘤 臼绰 版快 货肺 积己
pParty = (CParty *)m_PoolParty.RemoveHead(); // POP Party POOL
if(pParty == NULL)
{
pParty = new CParty;
if(NULL == pParty) return ;
}
m_MapParty.Insert( pPacket->dwPartyHandle, pParty ); // Party积己
pParty->Party_Create( pPacket ); // 秦寸 颇萍盔阑 涝仿 矫糯
}
}
////////////////////////////////////////////////////////////////////////////////////////
// PARTY甫 昏力 矫糯
//
// - 檬扁拳 风凭阑 涝仿 矫糯
// bForce - World Server俊辑 颇萍啊 家戈登菌促绰巴阑 舅妨 吭阑锭 true
////////////////////////////////////////////////////////////////////////////////////////
void Map::Party_Delete(DWORD pHandle, bool bForce)
{
CParty *pParty = Find_Party( pHandle );
if( ( pParty ) &&
( pParty->m_bPartyDelete == false ) )
{
pParty->Close(bForce);
m_MapParty.Delete( pHandle );
m_PoolParty.Insert( pParty );
}
}
////////////////////////////////////////////////////////////////////////////////////////
// 甘狼 DB加己 沥焊甫 涝仿 矫糯
////////////////////////////////////////////////////////////////////////////////////////
#ifdef DEF_AZITSIMULATION
void Map::SetMapConfig( BYTE pLayer, DWORD pMapSeq, BYTE pMapID, BOOL pPKMode,char * strMapFile,__int64 i64Tax)
#else
void Map::SetMapConfig( BYTE pLayer, DWORD pMapSeq, BYTE pMapID, BOOL pPKMode,char * strMapFile)
#endif
{
MapConfig[ pLayer ].dwMapSeq = pMapSeq;
MapConfig[ pLayer ].nMapID = pMapID;
MapConfig[ pLayer ].bPKMode = pPKMode;
memcpy(MapConfig[ pLayer ].m_strMapFile, strMapFile, 100) ;
#ifdef DEF_AZITSIMULATION
MapConfig[ pLayer ].m_i64TotalTax = i64Tax ;
#endif
}
////////////////////////////////////////////////////////////////////////////////////////
// 甘捞 加己 沥焊甫 涝仿 矫糯
//
// - 甘 捞抚篮 Table俊辑 掘澜
////////////////////////////////////////////////////////////////////////////////////////
//Jason 2004-07-02
#ifdef DEF_PARTYQUEST
void Map::SetGlobalMapProperty( int pMapType, BYTE pLayer, int pMaxX, int pMaxY, CBeing *pProperty, char *pMapTitle, _POINT pPoint, _POINT* pPvpPoint)
#else
void Map::SetGlobalMapProperty(BYTE pLayer, int pMaxX, int pMaxY, CBeing *pProperty, char *pMapTitle, _POINT pPoint, _POINT* pPvpPoint)
#endif
{
#ifdef DEF_PARTYQUEST
MapConfig[ pLayer ].nMapType = pMapType; // Map Type
#endif
MapConfig[ pLayer ].nMaxX = pMaxX; // Map Max X Size
MapConfig[ pLayer ].nMaxY = pMaxY; // Map Max Y Size
MapConfig[ pLayer ].GlobalMapProperty = *pProperty; // 甘 檬扁 加己
memcpy( MapConfig[ pLayer ].strMapTitle, pMapTitle, 20 ); // 甘 捞抚
MapConfig[ pLayer ].StartPoint = pPoint; // 甘 矫累困摹
MapConfig[ pLayer ].PvpSpawnPoint[0] = pPvpPoint[0]; // PVP俊辑 磷阑锭 矫累 困摹
MapConfig[ pLayer ].PvpSpawnPoint[1] = pPvpPoint[1]; // PVP俊辑 磷阑锭 矫累 困摹
#ifdef DEF_AZIT
/*
* 酒瘤飘 甘牢 版快 抛胶飘 侩栏肺 弥措 肮荐甫 2肺 瘤沥窃
*/
if( pMapType == MAP_AZIT )
MapConfig[ pLayer ].nAzitMax = 2;
#endif
}
////////////////////////////////////////////////////////////////////////////////////////
//
//
////////////////////////////////////////////////////////////////////////////////////////
void * Map::GetTargetObject( BYTE pMapLayer, WORD pX, WORD pY,bool & IsNPC)
{
// 救傈 瘤开
if(_MAP[pMapLayer][pX][pY].nCheckBit & CHK_SAFEZONE) return NULL; // 捞悼 阂啊 瘤开牢 版快
if( _MAP[pMapLayer][pX][pY].nType == MAP_SUMMONNPC )
{
IsNPC = true ;
return _MAP[pMapLayer][pX][pY].pObject;
}
// PC捞芭唱
if( _MAP[pMapLayer][pX][pY].nType == MAP_PC )
{
IsNPC = false ;
return _MAP[pMapLayer][pX][pY].pObject;
}
return NULL;
}
////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void * Map::GetAllTargetObject( BYTE pMapLayer, WORD pX, WORD pY,bool & IsNPC)
{
// 救傈 瘤开
if(_MAP[pMapLayer][pX][pY].nCheckBit & CHK_SAFEZONE) return NULL; // 捞悼 阂啊 瘤开牢 版快
if(_MAP[pMapLayer][pX][pY].nType == MAP_SUMMONNPC || _MAP[pMapLayer][pX][pY].nType == MAP_MONSTER )
{
IsNPC = true ;
return _MAP[pMapLayer][pX][pY].pObject;
}
// PC捞芭唱
if( _MAP[pMapLayer][pX][pY].nType == MAP_PC )
{
IsNPC = false ;
return _MAP[pMapLayer][pX][pY].pObject;
}
return NULL;
}
////////////////////////////////////////////////////////////////////////////////////////
// 秦寸 困摹俊 NPC硅摹 啊瓷 咯何 魄沥
////////////////////////////////////////////////////////////////////////////////////////
bool Map::IsMoveable(BYTE pMapLayer, _POINT_TILE pPoint )
{
// 救傈 瘤开牢 版快
if(_MAP[pMapLayer][pPoint.x][pPoint.y].nCheckBit & CHK_SAFEZONE) return false; // 捞悼 阂啊 瘤开牢 版快
// 框流老荐 绝绰 瘤开牢 版快
if( !(_MAP[pMapLayer][pPoint.x][pPoint.y].nCheckBit & CHK_MOVE) )
return false;
// 秦寸 困摹 Object粮犁 矫
if( _MAP[ pMapLayer][pPoint.x][pPoint.y].dwHandle )
return false;
return true;
}
////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void Map::SetFightZoneProperty(_FIGHTZONE * lpFightZone ,int nLayer)
{
if(m_bHaveFightzone == false)
{
m_bHaveFightzone = true;
g_lpFightzoneManager = new CFightzoneManager() ;
if(_LOBBY_.dwMapID != 0 )
g_lpFightzoneManager->SetLobby(nLayer, GetMapSeq(nLayer) ,_LOBBY_.StartPoint ) ;
}
if(_HIDDENLOBBY_.dwMapID != 0 && MapConfig[ nLayer ].nMapID == _HIDDENLOBBY_.dwMapID )
{
g_lpFightzoneManager->SetLobby(nLayer, GetMapSeq(nLayer) ,_HIDDENLOBBY_.StartPoint,true ) ;
}
// --------------------------------------------------------------------------------
// 捞甘篮 荤捧厘甘涝阑 眉农窃
// --------------------------------------------------------------------------------
MapConfig[ nLayer ].m_bIsFightZone = true ;
g_lpFightzoneManager->Register(lpFightZone,MapConfig[ nLayer ].dwMapSeq ,nLayer, MapConfig[ nLayer ].bPKMode ) ;
}
////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void Map::SetLobby(int nLayer, int x, int y)
{
if(_LOBBY_.dwMapID == 0 )
{
_LOBBY_.dwMapID = MapConfig[ nLayer ].nMapID ;
_LOBBY_.StartPoint.x = x ;
_LOBBY_.StartPoint.y = y ;
}
else
{
_HIDDENLOBBY_.dwMapID = MapConfig[ nLayer ].nMapID ;
_HIDDENLOBBY_.StartPoint.x = x ;
_HIDDENLOBBY_.StartPoint.y = y ;
}
}
////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void Map::Delete_Player(char *pPlayerID)
{
char strTempPlayer[22] ={0,} ;
memcpy( strTempPlayer, pPlayerID, 20 );
m_MapPlayerID.Delete( strupr( strTempPlayer ) );
//#ifdef DEF_LOGOUT_TO_WORLD
// m_MapTempPlayerID.Delete ( strTempPlayer ); // 烙矫 历厘侩 AccountID
//#endif
}
////////////////////////////////////////////////////////////////////////////////////////
// 秦寸 甘狼 荤捧厘 勘何 魄窜
////////////////////////////////////////////////////////////////////////////////////////
bool Map::IsFightMap(BYTE pMapLayer)
{
return MapConfig[ pMapLayer ].m_bIsFightZone;
}
// --------------------------------------------------------------------------------
// NOTENOTE: 2003-10-30 badajoa CriticalSection甫 临捞扁 困茄 累诀阑 茄促.
// --------------------------------------------------------------------------------
void Map::AOI_PlayerFastDelete(CPlayer *pPlayer )
{
if( !pPlayer ) return ;
BYTE nMapLayer = pPlayer->m_nMapLayer;
if( nMapLayer >= m_nMaxLayer ) return;
if( pPlayer->m_Tile.x < 0 ) return;
if( pPlayer->m_Tile.y < 0 ) return;
int nMaxX = MapConfig[nMapLayer].nMaxX;
int nMaxY = MapConfig[nMapLayer].nMaxY;
if( pPlayer->m_Tile.x >= nMaxX ) return;
if( pPlayer->m_Tile.y >= nMaxY ) return;
// 秦寸 MAP俊辑 秦寸 Object甫 茫酒辑 NULL肺 父惦
if( _MAP[nMapLayer][pPlayer->m_Tile.x][pPlayer->m_Tile.y].dwHandle == pPlayer->m_dwHandle )
{
_MAP[nMapLayer][pPlayer->m_Tile.x][pPlayer->m_Tile.y].pObject = NULL;
_MAP[nMapLayer][pPlayer->m_Tile.x][pPlayer->m_Tile.y].dwHandle = NULL;
}
}
////////////////////////////////////////////////////////////////////////////////////////
// Guild List俊 Pop矫糯
//
////////////////////////////////////////////////////////////////////////////////////////
void* Map::Pool_Guild_Pop()
{
_LPGUILD lpGuild = (_LPGUILD) m_PoolGuild.RemoveHead(); // POP Guild POOL
if (NULL == lpGuild)
{
lpGuild = new _CGUILD ;
if(lpGuild == NULL) return NULL;
}
memset(lpGuild, 0x0, sizeof(_GUILDINFO) ) ;
#ifdef DEF_GUILDWAR
memset(&lpGuild->GuildWarList,0x0, sizeof(_ZP_GUILDWARLIST) ) ;
#endif
lpGuild->m_bGetGuildInfor = false ;
return lpGuild;
}
////////////////////////////////////////////////////////////////////////////////////////
// 甘包访 郴开阑 檬扁拳 矫糯
//
////////////////////////////////////////////////////////////////////////////////////////
bool Map::Initialize()
{
// Multi Map File Load
gMapData MapFileData;
gArchiveMap ar( &MapFileData );
for( int i=0; i < m_nMaxLayer; i ++ )
{
if( !ar.Load( _Module.m_strMapFile[i], i ) )
{
ErrorMsg("(X) Map Server : Map Load Error %s", _Module.m_strMapFile[i] );
return false;
}
//
// AZIT MAP牢 版快
//
// - 秦寸 酒瘤飘 按眉甫 积己矫糯
#ifdef DEF_AZIT
//
// Azit Max蔼阑 掘绰 规侥栏肺 包访 内靛甫 荐沥矫糯
//
if( MAP_AZIT == MapConfig[i].nMapType )
{
_Module.m_pAzitManager->CreateAzit( 1 );
_Module.m_pAzitManager->CreateAzit( 2 );
_Module.m_pAzitManager->CreateAzit( 3 );
_Module.m_pAzitManager->CreateAzit( 4 );
_Module.m_pAzitManager->CreateAzit( 5 );
_Module.m_pAzitManager->CreateAzit( 6 );
}
#endif
}
//
// 荤侩磊啊 荤侩且 Memory甫 亲寸 矫糯
//
// - 眠饶 ServerMem栏肺 捞傈 矫糯
if( !CreateMemory() )
{
ErrorMsg("(X) Map Server : Create Meory Error ");
return false;
}
//
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -