CLimitDungeonManager::CLimitDungeonManager() : mMapType(MAPTYPE(g_pServerSystem->GetMapNum())) { ZeroMemory(&mFileStatus, sizeof(mFileStatus)); // 091106 LUJ, 크기가 0인지 검사를 피하기 위해 무의미한 값을 넣는다 const Event emptyEvent = {Event::TypeNone, 0, 0, 0}; __time64_t todayTime = 0; _time64(&todayTime); mScheduleMap.insert(std::make_pair(todayTime, emptyEvent)); }
void CLimitDungeonManager::NetworkMsgParser(MSGBASE* receivedMessage) { switch(receivedMessage->Protocol) { case MP_LIMITDUNGEON_JOIN_SYN : { const MSG_DWORD3* const message = (MSG_DWORD3*)receivedMessage; const DWORD playerIndex = message->dwObjectID; const MAPTYPE mapType = MAPTYPE(message->dwData1); const DWORD channelIndex = message->dwData2; const POSTYPE itemPosition = POSTYPE(message->dwData3); AskJoin( playerIndex, mapType, channelIndex, itemPosition); break ; } } }
/* ================= ParseMapEntity parses a single entity out of a map file ================= */ static bool ParseMapEntity( bool onlyLights ) { epair_t *ep; token_t token; const char *classname, *value; float lightmapScale; char shader[ MAX_SHADERPATH ]; shaderInfo_t *celShader = NULL; brush_t *brush; parseMesh_t *patch; bool funcGroup; int castShadows, recvShadows; static bool map_type = false; if( !Com_ReadToken( mapfile, SC_ALLOW_NEWLINES|SC_COMMENT_SEMICOLON, &token )) return false; // end of .map file if( com.stricmp( token.string, "{" )) Sys_Break( "ParseEntity: found %s instead {\n", token.string ); if( numEntities >= MAX_MAP_ENTITIES ) Sys_Break( "MAX_MAP_ENTITIES limit exceeded\n" ); entitySourceBrushes = 0; mapEnt = &entities[numEntities]; numEntities++; memset( mapEnt, 0, sizeof( *mapEnt )); mapEnt->mapEntityNum = numMapEntities; numMapEntities++; while( 1 ) { if( !Com_ReadToken( mapfile, SC_ALLOW_NEWLINES|SC_COMMENT_SEMICOLON, &token )) Sys_Break( "ParseEntity: EOF without closing brace\n" ); if( !com.stricmp( token.string, "}" )) break; if( !com.stricmp( token.string, "{" )) { // parse a brush or patch if( !Com_ReadToken( mapfile, SC_ALLOW_NEWLINES, &token )) break; if( !com.stricmp( token.string, "patchDef2" )) { numMapPatches++; ParsePatch( onlyLights ); g_bBrushPrimit = BRUSH_RADIANT; } else if( !com.stricmp( token.string, "terrainDef" )) { MsgDev( D_WARN, "Terrain entity parsing not supported in this build.\n" ); Com_SkipBracedSection( mapfile, 0 ); g_bBrushPrimit = BRUSH_RADIANT; } else if( !com.stricmp( token.string, "brushDef" )) { // parse brush primitive g_bBrushPrimit = BRUSH_RADIANT; ParseBrush( onlyLights ); } else { if( g_bBrushPrimit == BRUSH_RADIANT ) Sys_Break( "mixed brush primitive with another format\n" ); if( g_bBrushPrimit == BRUSH_UNKNOWN ) g_bBrushPrimit = BRUSH_WORLDCRAFT_21; // QuArK or WorldCraft map (unknown at this point) Com_SaveToken( mapfile, &token ); ParseBrush( onlyLights ); } entitySourceBrushes++; } else { // parse a key / value pair ep = ParseEpair( mapfile, &token ); if( !com.strcmp( ep->key, "mapversion" )) { if( com.atoi( ep->value ) == VALVE_FORMAT ) { Msg( "Valve Format Map detected\n" ); g_bBrushPrimit = BRUSH_WORLDCRAFT_22; } else if( com.atoi( ep->value ) == GEARBOX_FORMAT ) { Msg( "Gearcraft Format Map detected\n" ); g_bBrushPrimit = BRUSH_GEARCRAFT_40; } else g_bBrushPrimit = BRUSH_WORLDCRAFT_21; } if( ep->key[0] != '\0' && ep->value[0] != '\0' ) { ep->next = mapEnt->epairs; mapEnt->epairs = ep; } } } if( !map_type && g_bBrushPrimit != BRUSH_UNKNOWN ) { MAPTYPE(); map_type = true; } classname = ValueForKey( mapEnt, "classname" ); if( onlyLights && com.strnicmp( classname, "light", 5 )) { numEntities--; return true; } if( !com.stricmp( "func_group", classname )) funcGroup = true; else funcGroup = false; // worldspawn (and func_groups) default to cast/recv shadows in worldspawn group if( funcGroup || mapEnt->mapEntityNum == 0 ) { castShadows = WORLDSPAWN_CAST_SHADOWS; recvShadows = WORLDSPAWN_RECV_SHADOWS; } else // other entities don't cast any shadows, but recv worldspawn shadows { castShadows = ENTITY_CAST_SHADOWS; recvShadows = ENTITY_RECV_SHADOWS; } // get explicit shadow flags GetEntityShadowFlags( mapEnt, NULL, &castShadows, &recvShadows ); // get lightmap scaling value for this entity if( com.strcmp( "", ValueForKey( mapEnt, "lightmapscale" )) || com.strcmp( "", ValueForKey( mapEnt, "_lightmapscale" ))) { // get lightmap scale from entity lightmapScale = FloatForKey( mapEnt, "lightmapscale" ); if( lightmapScale <= 0.0f ) lightmapScale = FloatForKey( mapEnt, "_lightmapscale" ); if( lightmapScale > 0.0f ) Msg( "Entity %d (%s) has lightmap scale of %.4f\n", mapEnt->mapEntityNum, classname, lightmapScale ); } else lightmapScale = 0.0f; // get cel shader :) for this entity value = ValueForKey( mapEnt, "_celshader" ); if( value[0] == '\0' ) value = ValueForKey( &entities[0], "_celshader" ); if( value[0] != '\0' ) { com.snprintf( shader, sizeof( shader ), "textures/%s", value ); celShader = ShaderInfoForShader( shader ); Msg( "Entity %d (%s) has cel shader %s\n", mapEnt->mapEntityNum, classname, celShader->shader ); } else celShader = NULL; // attach stuff to everything in the entity for( brush = mapEnt->brushes; brush != NULL; brush = brush->next ) { brush->entityNum = mapEnt->mapEntityNum; brush->castShadows = castShadows; brush->recvShadows = recvShadows; brush->lightmapScale = lightmapScale; brush->celShader = celShader; } for( patch = mapEnt->patches; patch != NULL; patch = patch->next ) { patch->entityNum = mapEnt->mapEntityNum; patch->castShadows = castShadows; patch->recvShadows = recvShadows; patch->lightmapScale = lightmapScale; patch->celShader = celShader; } SetEntityBounds( mapEnt ); // load shader index map (equivalent to old terrain alphamap) LoadEntityIndexMap( mapEnt ); // get entity origin and adjust brushes GetVectorForKey( mapEnt, "origin", mapEnt->origin ); if( mapEnt->origin[0] || mapEnt->origin[1] || mapEnt->origin[2] ) AdjustBrushesForOrigin( mapEnt ); // group_info entities are just for editor grouping if( !com.stricmp( "group_info", classname )) { numEntities--; return true; } // group entities are just for editor convenience, toss all brushes into worldspawn if( funcGroup ) { MoveBrushesToWorld( mapEnt ); numEntities--; return true; } return true; }
void cSkillManager::NetworkMsgParse( BYTE Protocol, void* pMsg ) { switch(Protocol) { case MP_SKILL_START_SYN: { MSG_SKILL_START_SYN* pmsg = ( MSG_SKILL_START_SYN* )pMsg; CObject* object = g_pUserTable->FindUser( pmsg->Operator ); if( ! object ) { break; } // 080904 LYW --- SkillManager : 공성전 중 사용할 수 없는 스킬 체크. if( SIEGEWARFAREMGR->Is_CastleMap() == FALSE && SIEGEWARFAREMGR->IsSiegeWarfareZone() && SIEGEWARFAREMGR->GetState() > eSiegeWarfare_State_Before ) { if( SIEGEWARFAREMGR->IsFobiddenSkill(pmsg->SkillIdx) ) return ; } SKILL_RESULT result = SKILL_FAIL_ETC; if( object->GetObjectKind() == eObjectKind_Player ) result = OnSkillStartSyn( pmsg ); else if( object->GetObjectKind() == eObjectKind_Pet ) result = OnPetSkillStartSyn( pmsg ); // 080610 LUJ, 스킬 실패 시 메시지를 반환하도록 함 if( result != SKILL_SUCCESS ) { CObject* object = g_pUserTable->FindUser( pmsg->Operator ); if( ! object ) { break; } MSG_DWORD2 message; ZeroMemory( &message, sizeof( message ) ); message.Category = MP_SKILL; message.Protocol = MP_SKILL_START_NACK; message.dwData1 = pmsg->SkillIdx; message.dwData2 = result; object->SendMsg( &message, sizeof( message ) ); } } break; // 080602 LUJ, 전서버 대상 스킬이 전파됨 case MP_SKILL_START_TO_MAP: { const MSG_ITEM_SKILL_START_TO_MAP* const receivedMessage = (MSG_ITEM_SKILL_START_TO_MAP*)pMsg; const cActiveSkillInfo* const skillInfo = GetActiveInfo( receivedMessage->mSkill.wSkillIdx ); if(0 == skillInfo || TARGET_KIND_WORLD != skillInfo->GetInfo().Area) { break; } typedef std::set< DWORD > ObjectIndexSet; ObjectIndexSet objectIndexSet; switch(skillInfo->GetInfo().AreaTarget) { case eSkillAreaTargetGuild: { GUILDMEMBERINFO memberInfo[ MAX_GUILD_MEMBER ] = { 0 }; CGuild* guild = GUILDMGR->GetGuild( receivedMessage->dwObjectID ); if( ! guild ) { break; } guild->GetTotalMember( memberInfo ); for( DWORD size = sizeof( memberInfo ) / sizeof( *memberInfo ); size--; ) { objectIndexSet.insert( memberInfo[ size ].MemberIdx ); } break; } case eSkillAreaTargetFamily: { const DWORD familyIndex = receivedMessage->dwObjectID; // 080602 LUJ, 패밀리는 맵 서버에 데이타가 없고, 에이전트에 있다. 번거롭지만 // DB에 회원 목록을 쿼리해서 버프를 적용하도록 하자. // 081012 LUJ, 일부 로컬은 프로시저 호출 시 대소문자까지 일치해야 한다. 단, dbo는 소문자로 해야함. 이에 모든 프로시저 이름을 수정함 g_DB.FreeMiddleQuery( RSkillAddToFamily, skillInfo->GetIndex(), "EXEC dbo.MP_FAMILY_MEMBER_LOADINFO %d", familyIndex ); break; } case eSkillAreaTargetParty: { const DWORD partyIndex = receivedMessage->dwObjectID; CParty* party = PARTYMGR->GetParty( partyIndex ); if( ! party ) { break; } for( DWORD i = 0; i < MAX_PARTY_LISTNUM; ++i ) { objectIndexSet.insert(party->GetMemberID(i)); } break; } } // 080602 LUJ, 선택된 집단을 대상으로 버프 스킬을 적용한다 for( ObjectIndexSet::const_iterator it = objectIndexSet.begin(); objectIndexSet.end() != it; ++it ) { CPlayer* player = ( CPlayer* )g_pUserTable->FindUser( *it ); if( ! player || player->GetObjectKind() != eObjectKind_Player ) { continue; } AddBuffSkill( *player, skillInfo->GetInfo()); } break; } case MP_SKILL_UPDATE_TARGET_SYN: { MSG_SKILL_UPDATE_TARGET* pmsg = ( MSG_SKILL_UPDATE_TARGET* )pMsg; OnSkillTargetUpdate( pmsg ); } break; case MP_SKILL_CANCEL_SYN: { MSG_DWORD* pmsg = ( MSG_DWORD* )pMsg; OnSkillCancel( pmsg ); } break; // 091127 LUJ, 플레이어를 소환한다 case MP_SKILL_RECALL_SYN: { const MSG_NAME_DWORD3* const receivedMessage = (MSG_NAME_DWORD3*)pMsg; const DWORD recallPlayerIndex = receivedMessage->dwObjectID; const DWORD targetPlayerinex = receivedMessage->dwData1; const DWORD skillIndex = receivedMessage->dwData2; const MAPTYPE targetMap = MAPTYPE(receivedMessage->dwData3); LPCTSTR targetPlayerName = receivedMessage->Name; Recall( recallPlayerIndex, targetPlayerinex, targetPlayerName, targetMap, skillIndex); } break; // 100211 ONS 부활계열 스킬 사용시 대상자에게 부활의사를 묻는 처리 추가 case MP_SKILL_RESURRECT_ACK: { MSGBASE* pmsg = ( MSGBASE* )pMsg; CPlayer* pPlayer = (CPlayer*)g_pUserTable->FindUser( pmsg->dwObjectID ); if( ! pPlayer || eObjectKind_Player != pPlayer->GetObjectKind() ) { break; } const cActiveSkillInfo* const pSkillInfo = GetActiveInfo( pPlayer->GetCurResurrectIndex()); if(0 == pSkillInfo) { break; } // 부활대상이 수락했을 경우, 부활 처리를 실행한다. EXPTYPE exp = pPlayer->OnResurrect(); exp = (EXPTYPE)(exp * ( pSkillInfo->GetInfo().UnitData / 100.f )) ; if( exp ) { pPlayer->AddPlayerExpPoint( exp ); } pPlayer->SetCurResurrectIndex( 0 ); } break; // 부활 스킬에 의한 부활을 거부했을 경우 case MP_SKILL_RESURRECT_NACK: { MSGBASE* pmsg = ( MSGBASE* )pMsg; CObject* object = g_pUserTable->FindUser( pmsg->dwObjectID ); if( ! object || eObjectKind_Player != object->GetObjectKind() ) { break; } CPlayer* pPlayer = (CPlayer*)object; pPlayer->SetCurResurrectIndex( 0 ); } break; } }