void CGSkillToNamedHandler::execute (CGSkillToNamed* pPacket , Player* pPlayer)
	 throw(Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
		
#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	try 
	{
		GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
		Assert(pGamePlayer != NULL);	// by sigi

		if (pGamePlayer->getPlayerStatus() != GPS_NORMAL) return;

		Creature* pCreature = pGamePlayer->getCreature();
		Assert(pCreature != NULL);	// by sigi

		Zone* pZone = pCreature->getZone();
		Assert(pZone != NULL);
	
		SkillType_t SkillType = pPacket->getSkillType();

		// 완전 안전지대라면 기술 사용 불가. by sigi. 2002.11.14
		ZoneLevel_t ZoneLevel = pZone->getZoneLevel(pCreature->getX(), pCreature->getY());
		if ((ZoneLevel & COMPLETE_SAFE_ZONE) ||
            (pCreature->isFlag(Effect::EFFECT_CLASS_PARALYZE)) ||
            (pCreature->isFlag(Effect::EFFECT_CLASS_CAUSE_CRITICAL_WOUNDS)) ||
            (pCreature->isFlag(Effect::EFFECT_CLASS_EXPLOSION_WATER)) ||
            (pCreature->isFlag(Effect::EFFECT_CLASS_COMA)))
		{
			GCSkillFailed1 _GCSkillFailed1;
			_GCSkillFailed1.setSkillType(SkillType);
			pPlayer->sendPacket(&_GCSkillFailed1);

			return;
		}

        if (pCreature->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WERWOLF)) {
            switch(SkillType) {
                case SKILL_ATTACK_MELEE:
                case SKILL_BITE_OF_DEATH:
                case SKILL_UN_TRANSFORM:
                case SKILL_RAPID_GLIDING:
                    break;
                default:
                    GCSkillFailed1 _GCSkillFailed1;
                    _GCSkillFailed1.setSkillType(SkillType);
                    pPlayer->sendPacket(&_GCSkillFailed1);
                    dynamic_cast<Vampire*>(pCreature)->sendVampireSkillInfo();
                    return;
            }
        }

		disableFlags(pCreature, pZone, SkillType);

		if (pCreature->isSlayer()) 
		{
			Slayer*    pSlayer    = dynamic_cast<Slayer*>(pCreature);
			SkillSlot* pSkillSlot = ((Slayer *)pCreature)->hasSkill(SkillType);
			bool       bSuccess   = true;

			if (pSkillSlot == NULL) bSuccess = false;
			if (!isAbleToUseSelfSkill(pSlayer, SkillType)) bSuccess = false;

/*			if (pSlayer->isFlag(Effect::EFFECT_CLASS_SNIPING_MODE))
			{
				g_Sniping.checkRevealRatio(pSlayer, 20, 10);
			} */

			if (bSuccess) 
			{
				SkillHandler* pSkillHandler = g_pSkillHandlerManager->getSkillHandler(SkillType);
				Assert(pSkillHandler != NULL);
				pSkillHandler->execute(pSlayer, pPacket->getTargetName(), pSkillSlot, pPacket->getCEffectID());
			 }
			 else
			 {
				 GCSkillFailed1 _GCSkillFailed1;
				_GCSkillFailed1.setSkillType(SkillType);
				 pPlayer->sendPacket(&_GCSkillFailed1);
			 }
		} 
		else if (pCreature->isVampire()) 
		{
			Vampire*          pVampire          = dynamic_cast<Vampire*>(pCreature);
			VampireSkillSlot* pVampireSkillSlot = ((Vampire *)pCreature)->hasSkill(SkillType);
			bool              bSuccess          = true;

			//cout << "SkillType:" << (int)SkillType << endl;

/*			if (pVampire->isFlag(Effect::EFFECT_CLASS_EXTREME))
		    {
		   		EffectManager * pEffectManager = pVampire->getEffectManager();
		    	Assert(pEffectManager != NULL);
		    	Effect * pEffect = pEffectManager->findEffect(Effect::EFFECT_CLASS_EXTREME);
		    	if (pEffect != NULL ) {
		    		pEffect->setDeadline(0);
		   	 	}
            } */
			if (pVampireSkillSlot == NULL) bSuccess = false;
			if (!isAbleToUseSelfSkill(pVampire, SkillType)) bSuccess = false;

/*			if (pVampire->isFlag(Effect::EFFECT_CLASS_INVISIBILITY))
			{
				addVisibleCreature(pZone, pVampire, true);
			} */

			if (bSuccess) 
			{
				SkillHandler* pSkillHandler = g_pSkillHandlerManager->getSkillHandler(SkillType);
				Assert(pSkillHandler != NULL);
				pSkillHandler->execute(pVampire, pPacket->getTargetName(), pVampireSkillSlot, pPacket->getCEffectID());
			}
			else
			{
				GCSkillFailed1 _GCSkillFailed1;
				_GCSkillFailed1.setSkillType(SkillType);
				pPlayer->sendPacket(&_GCSkillFailed1);
			}
		} 
		else if (pCreature->isOusters()) 
		{
			Ousters*          pOusters          = dynamic_cast<Ousters*>(pCreature);
			OustersSkillSlot* pOustersSkillSlot = ((Ousters *)pCreature)->hasSkill(SkillType);
			bool              bSuccess          = true;

			if (pOustersSkillSlot == NULL) bSuccess = false;
			if (!isAbleToUseSelfSkill(pOusters, SkillType)) bSuccess = false;

			if (bSuccess) 
			{
				SkillHandler* pSkillHandler = g_pSkillHandlerManager->getSkillHandler(SkillType);
				Assert(pSkillHandler != NULL);
				pSkillHandler->execute(pOusters, pPacket->getTargetName(), pOustersSkillSlot, pPacket->getCEffectID());
			}
			else
			{
				GCSkillFailed1 _GCSkillFailed1;
				_GCSkillFailed1.setSkillType(SkillType);
				pPlayer->sendPacket(&_GCSkillFailed1);
			}
		} 
	} 
	catch (Throwable & t) 
	{
		//cout << t.toString() << endl;
	}

#endif	// __GAME_SERVER__
		
	__END_DEBUG_EX __END_CATCH
}
Example #2
0
//////////////////////////////////////////////////////////////////////////////
// 클라이언트가 CGLogout 패킷을 보내면, 게임 서버는 크리처를 존에서 삭제하고,
// 크리처와 아이템 정보를 DB에 저장한 후, 접속을 종료한다.
//////////////////////////////////////////////////////////////////////////////
void CGLogoutHandler::execute (CGLogout* pPacket , Player* pPlayer)
	 throw(ProtocolException , Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

//	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);
	
	// 새로그인 구조에서는 Logout을 하면 대기 상태로 나가야 한다.
	// Logout 패킷을 받으면 플레이어를 IncomingPlayerManager로 보낸다.
	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);

	//cout << "CGLogoutHandler: " << pGamePlayer->getID() << endl;

	Creature* pCreature = pGamePlayer->getCreature();

	Assert(pCreature != NULL);

	Zone* pZone = pCreature->getZone();

	Assert(pZone != NULL);


	// 나는 나간다 라고 로그를 남긴다.
	pGamePlayer->logLoginoutDateTime();

    try 
	{
		// 로그아웃할때 성물, 피의 성서 조각을 떨어뜨린다.
//		bool bSendPacket = false;
//		dropRelicToZone(pCreature, bSendPacket);

		if (pCreature->isPLAYER() && g_pPKZoneInfoManager->isPKZone(pCreature->getZoneID() ) )
		{
			g_pPKZoneInfoManager->leavePKZone(pCreature->getZoneID());
		}

		if (g_pConfig->hasKey("Hardcore") && g_pConfig->getPropertyInt("Hardcore")!=0 && pPacket==NULL )
		{
		}
		else
		{
			// 크리처의 정보를 저장한다.
			pCreature->save();

			if (pCreature->isSlayer() )
			{
				Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
				pSlayer->tinysave("LastPlayDate=now()");
			}
			else if (pCreature->isVampire() )
			{
				Vampire* pVampire = dynamic_cast<Vampire*>(pCreature);
				pVampire->tinysave("LastPlayDate=now()");
			}
			else if (pCreature->isOusters() )
			{
				Ousters* pOusters = dynamic_cast<Ousters*>(pCreature);
				pOusters->tinysave("LastPlayDate=now()");
			}

			//////////////////////////////////////////////////////////////
			// 플레이어가 COMA상태(현재 죽은 상태)라면 로그아웃시 자동으로
			// 부활위치로 캐릭터를 이동시킨다.
			// Login/Logout의 반복으로 부활기술을 사용하지 못하게 함
			//
			// Creature의 정보를 먼저 DB에 업데이트한 후 새로 업데이트를 한다.
			//////////////////////////////////////////////////////////////

			// 이터니티를 한번 쓴 상태로 로그아웃하면 부활 위치로 날라간다.
			if (pCreature->isFlag(Effect::EFFECT_CLASS_COMA) || pCreature->isFlag(Effect::EFFECT_CLASS_ETERNITY))
			{
				//cout << "COMA 상태에서 로그아웃했음" << endl;

				ZoneID_t  ZoneID = 0;
				ZoneCoord_t ZoneX = 0;
				ZoneCoord_t ZoneY = 0;
				ZONE_COORD ResurrectCoord;

				if (pCreature->isPC() )
				{
					PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature);

					g_pResurrectLocationManager->getPosition(pPC, ResurrectCoord);

					ZoneID = ResurrectCoord.id;
					ZoneX  = ResurrectCoord.x;
					ZoneY  = ResurrectCoord.y;

					char pField[80];
					sprintf(pField, "ZoneID=%d, XCoord=%d, YCoord=%d, CurrentHP=HP", ZoneID, ZoneX, ZoneY);

					if (pPC->isSlayer() )
					{
						Slayer* pSlayer = dynamic_cast<Slayer*>(pPC);
						pSlayer->tinysave(pField);
					}
					else if (pPC->isVampire() )
					{
						Vampire* pVampire = dynamic_cast<Vampire*>(pPC);
						pVampire->tinysave(pField);
					}
					else if (pPC->isOusters() )
					{
						Ousters* pOusters = dynamic_cast<Ousters*>(pPC);
						pOusters->tinysave(pField);
					}
				}
			}

			// 포스 스크롤이 켜져 있으면 로그아웃하면저 저장한다.
			if (pCreature->isFlag(Effect::EFFECT_CLASS_BEHEMOTH_FORCE_SCROLL) )
			{
				Effect* pEffect = pCreature->findEffect(Effect::EFFECT_CLASS_BEHEMOTH_FORCE_SCROLL);
				pEffect->save(pCreature->getName());
			}
			if (pCreature->isFlag(Effect::EFFECT_CLASS_SAFE_FORCE_SCROLL) )
			{
				Effect* pEffect = pCreature->findEffect(Effect::EFFECT_CLASS_SAFE_FORCE_SCROLL);
				pEffect->save(pCreature->getName());
			}
			if (pCreature->isFlag(Effect::EFFECT_CLASS_CARNELIAN_FORCE_SCROLL) )
			{
				Effect* pEffect = pCreature->findEffect(Effect::EFFECT_CLASS_CARNELIAN_FORCE_SCROLL);
				pEffect->save(pCreature->getName());
			}
/*
			if(pCreature->isSlayer())
			{
				Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
				Assert(pSlayer != NULL);

				if (g_pResurrectLocationManager->getSlayerPosition(pSlayer->getResurrectZoneID(), ResurrectCoord))
				{
					ZoneID = ResurrectCoord.id;
					ZoneX  = ResurrectCoord.x;
					ZoneY  = ResurrectCoord.y;
				}
				else
				{
					if (g_pResurrectLocationManager->getSlayerPosition(pSlayer->getZone()->getZoneID(), ResurrectCoord))
					{
						ZoneID = ResurrectCoord.id;
						ZoneX  = ResurrectCoord.x;
						ZoneY  = ResurrectCoord.y;
					}
					else
					{
						throw Error("Critical Error: ResurrectInfo is not established");
					}
				}

				char pField[80];
				sprintf(pField, "ZoneID=%d, XCoord=%d, YCoord=%d, CurrentHP=HP", ZoneID, ZoneX, ZoneY);
				pSlayer->tinysave(pField);
			}
			else if(pCreature->isVampire())
			{
				Vampire* pVampire = dynamic_cast<Vampire*>(pCreature);
				Assert(pVampire != NULL);

				if (g_pResurrectLocationManager->getVampirePosition(pVampire->getResurrectZoneID(), ResurrectCoord))
				{
					ZoneID = ResurrectCoord.id;
					ZoneX  = ResurrectCoord.x;
					ZoneY  = ResurrectCoord.y;
				}
				else
				{
					if (g_pResurrectLocationManager->getVampirePosition(pVampire->getZone()->getZoneID(), ResurrectCoord))
					{
						ZoneID = ResurrectCoord.id;
						ZoneX  = ResurrectCoord.x;
						ZoneY  = ResurrectCoord.y;
					}
					else
					{
						throw Error("Critical Error: ResurrectInfo is not established");
					}
				}
				// 이제 정보를 저장한다.
				char pField[80];
				sprintf(pField, "ZoneID=%d, XCoord=%d, YCoord=%d, CurrentHP=HP", ZoneID, ZoneX, ZoneY);
				pVampire->tinysave(pField);
			}
*/
		}


		//
		// 이제, 존에서 PC를 삭제한다.
		//
		// *CAUTION*
		//
		// pCreature의 좌표가 실제로 pCreature가 존재하는 타일의 좌표와 같아야 한다.
		// 따라서, 이 메쏘드를 호출하기 전에 좌표를 잘 바꿔놔야 한당..
		//
		pZone->deleteCreature(pCreature , pCreature->getX() , pCreature->getY());

		////cout << "PC deleted from Zone >> ";

		// 존그룹의 ZPM에서 플레이어를 삭제한다.
		// ZonePlayerManager의 ProcessCommand 안에서 지우는 것이므로 반드시 NoBlocked 으로 지워야 한다.
		pZone->getZoneGroup()->getZonePlayerManager()->deletePlayer(pGamePlayer->getSocket()->getSOCKET());

		// IPM으로 플레이어를 옮긴다.
		//g_pIncomingPlayerManager->pushPlayer(pGamePlayer);

		// Core의 구조를 바꾸면서 쓰레드로 부터 독립적으로 행하기 위하여 뒤에 한꺼번에 처리하기 위해서
		// OutList로 넣는다.
		pZone->getZoneGroup()->getZonePlayerManager()->pushOutPlayer(pGamePlayer);

		////cout << "Move PC to IPM >> ";
	} 
	catch (NoSuchElementException & nsee) 
	{
		throw DisconnectException();
	}

	// 로그인 서버로 GLIncomingConnection을 보낸다.
	// PlayerName과 ClientIP를 같이 실어서 보낸다.
	/*
	GLIncomingConnection glIncomingConnection;
	glIncomingConnection.setPlayerID(pGamePlayer->getID());
	glIncomingConnection.setClientIP(pGamePlayer->getSocket()->getHost());

	if (g_pConfig->getProperty("User") == "excel96")
		g_pLoginServerManager->sendPacket("211.117.52.12" , g_pConfig->getPropertyInt("LoginServerUDPPort"), &glIncomingConnection);
	else if (g_pConfig->getProperty("User") == "elcastle")
		g_pLoginServerManager->sendPacket("211.117.52.12" , g_pConfig->getPropertyInt("LoginServerUDPPort"), &glIncomingConnection);
	else if (g_pConfig->getProperty("User") == "elca")
		g_pLoginServerManager->sendPacket("211.117.52.12" , g_pConfig->getPropertyInt("LoginServerUDPPort"), &glIncomingConnection);
	*/

	pGamePlayer->setPlayerStatus(GPS_AFTER_SENDING_GL_INCOMING_CONNECTION);

#endif

	__END_DEBUG_EX __END_CATCH
}
Example #3
0
//////////////////////////////////////////////////////////////////////////////
// 뱀파이어 타일 핸들러
//////////////////////////////////////////////////////////////////////////////
void BloodyBreaker::execute(Vampire* pVampire, ZoneCoord_t X, ZoneCoord_t Y, VampireSkillSlot* pVampireSkillSlot, CEffectID_t CEffectID)
	throw(Error)
{
	__BEGIN_TRY

	//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << "begin " << endl;
	SkillType_t SkillType = getSkillType();

	// Knowledge of Blood 가 있다면 hit bonus 10
	int HitBonus = 0;
	if (pVampire->hasRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_BLOOD ) )
	{
		RankBonus* pRankBonus = pVampire->getRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_BLOOD);
		Assert(pRankBonus != NULL);

		HitBonus = pRankBonus->getPoint();
	}

	try 
	{
		SkillInput input(pVampire);
		SkillOutput output;
		computeOutput(input, output);

		Dir_t	Dir		= getDirectionToPosition(pVampire->getX(), pVampire->getY(), X, Y);

		// 강제로 knockback시킬 확률
//		bool bForceKnockback = rand()%100 < output.ToHit;

		Player* pPlayer = pVampire->getPlayer();
		Zone* pZone = pVampire->getZone();
		Assert(pPlayer != NULL);
		Assert(pZone != NULL);

		VSRect rect(1, 1, pZone->getWidth()-2, pZone->getHeight()-2);
		if (!rect.ptInRect(X, Y ))
		{
			executeSkillFailException(pVampire, SkillType);
			return;
		}


		GCSkillToTileOK1 _GCSkillToTileOK1;
		GCSkillToTileOK2 _GCSkillToTileOK2;
//		GCSkillToTileOK3 _GCSkillToTileOK3;
//		GCSkillToTileOK4 _GCSkillToTileOK4;
		GCSkillToTileOK5 _GCSkillToTileOK5;
//		GCSkillToTileOK6 _GCSkillToTileOK6;

		SkillInfo*  pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType);

		int  RequiredMP  = decreaseConsumeMP(pVampire, pSkillInfo);
		bool bManaCheck  = hasEnoughMana(pVampire, RequiredMP);
		bool bTimeCheck  = verifyRunTime(pVampireSkillSlot);
		bool bRangeCheck = verifyDistance(pVampire, X, Y, pSkillInfo->getRange());

		if (bManaCheck && bTimeCheck && bRangeCheck )
		{
			// 마나를 떨어뜨린다.
			decreaseMana(pVampire, RequiredMP, _GCSkillToTileOK1);

			// 좌표와 방향을 구한다.
			ZoneCoord_t myX          = pVampire->getX();
			ZoneCoord_t myY          = pVampire->getY();
			Dir_t       dir          = calcDirection(myX, myY, X, Y);

			list<Creature*> cList;

			// knockback 때문에 recursive 하게 데미지를 먹는 경우가 있다.
			// 그래서 제일 먼쪽에 있는 마스크부터 체크한다.
			for (int i = 21; i >= 0; i-- )
			{
				int tileX   = myX + m_pBloodyBreakerMask[Dir][i].x;
				int tileY   = myY + m_pBloodyBreakerMask[Dir][i].y;

				// 현재 타일이 존 내부이고, 안전지대가 아니라면 맞을 가능성이 있다.
				if (rect.ptInRect(tileX, tileY))
				{
					// 타일을 받아온다.
					Tile& tile = pZone->getTile(tileX, tileY);

					list<Creature*> targetList;
					if (tile.hasCreature(Creature::MOVE_MODE_WALKING))
					{
						Creature* pCreature = tile.getCreature(Creature::MOVE_MODE_WALKING);
						targetList.push_back(pCreature);
					}
					if (tile.hasCreature(Creature::MOVE_MODE_FLYING))
					{
						Creature* pCreature = tile.getCreature(Creature::MOVE_MODE_FLYING);
						targetList.push_back(pCreature);
					}
					if (tile.hasCreature(Creature::MOVE_MODE_BURROWING))
					{
						Creature* pCreature = tile.getCreature(Creature::MOVE_MODE_BURROWING);
						targetList.push_back(pCreature);
					}

					list<Creature*>::iterator itr = targetList.begin();
					for(; itr != targetList.end(); itr++)
					{
						Creature* pTargetCreature = (*itr);
						Assert(pTargetCreature != NULL);

						if (!canAttack(pVampire, pTargetCreature )
							|| pTargetCreature->isFlag(Effect::EFFECT_CLASS_COMA) )
						{
							continue;
						}

						if (pTargetCreature != pVampire)
						{
							bool bPK             = verifyPK(pVampire, pTargetCreature);
							bool bRaceCheck      = pTargetCreature->isSlayer() || pTargetCreature->isMonster() || pTargetCreature->isOusters();
							bool bZoneLevelCheck = checkZoneLevelToHitTarget(pTargetCreature);
							bool bHitRoll        = false;//HitRoll::isSuccessMagic(pVampire, pSkillInfo, pVampireSkillSlot, HitBonus);

							int EnemyLevel = 0;

							if (pTargetCreature->isSlayer() )
							{
								Slayer* pSlayer = dynamic_cast<Slayer*>(pTargetCreature);
								EnemyLevel = pSlayer->getHighestSkillDomainLevel();
							}
							else if (pTargetCreature->isOusters() )
							{
								Ousters* pOusters = dynamic_cast<Ousters*>(pTargetCreature);
								EnemyLevel = pOusters->getLevel();
							}
							else if (pTargetCreature->isMonster() )
							{
								Monster* pMonster = dynamic_cast<Monster*>(pTargetCreature);
								EnemyLevel = pMonster->getLevel();
							}

							// min : 20, max : 100
							int hitRatio = max(20, 50 + pVampire->getLevel() - EnemyLevel + HitBonus);
							bHitRoll = (rand()%100) < hitRatio;

							if (bPK && bRaceCheck && bZoneLevelCheck && bHitRoll)
							{
								Damage_t Damage = 0;
								bool bForceKnockback = rand() & 1;

								Damage += computeMagicDamage(pTargetCreature, output.Damage, SkillType, true, pVampire);

								ObjectID_t targetObjectID = pTargetCreature->getObjectID();
								cList.push_back(pTargetCreature);

								_GCSkillToTileOK1.addCListElement(targetObjectID);
								_GCSkillToTileOK2.addCListElement(targetObjectID);
								_GCSkillToTileOK5.addCListElement(targetObjectID);

								// 일단 맞는 놈이 받을 패킷은 널 상태로 한 채로, 데미지를 준다.
								setDamage(pTargetCreature, Damage, pVampire, SkillType, NULL, &_GCSkillToTileOK1);
								computeAlignmentChange(pTargetCreature, Damage, pVampire, NULL, &_GCSkillToTileOK1);

								increaseAlignment(pVampire, pTargetCreature, _GCSkillToTileOK1);

								// 크리티컬 히트라면 상대방을 뒤로 물러나게 한다.
								if (bForceKnockback)
								{
									knockbackCreature(pZone, pTargetCreature, pVampire->getX(), pVampire->getY());
								}

								if (pTargetCreature->isDead())
								{
									int exp = computeCreatureExp(pTargetCreature, KILL_EXP);
									shareVampExp(pVampire, exp, _GCSkillToTileOK1);
								}
							}
						}
					}
				}
			}


			// 공격자의 아이템 내구성을 떨어뜨린다.
			decreaseDurability(pVampire, NULL, pSkillInfo, &_GCSkillToTileOK1, NULL);

			_GCSkillToTileOK1.setSkillType(SkillType);
			_GCSkillToTileOK1.setCEffectID(0);
			_GCSkillToTileOK1.setX(X);
			_GCSkillToTileOK1.setY(Y);
			_GCSkillToTileOK1.setRange(dir);
			_GCSkillToTileOK1.setDuration(0);

			_GCSkillToTileOK2.setObjectID(pVampire->getObjectID());
			_GCSkillToTileOK2.setSkillType(SkillType);
			_GCSkillToTileOK2.setX(X);
			_GCSkillToTileOK2.setY(Y);
			_GCSkillToTileOK2.setRange(dir);
			_GCSkillToTileOK2.setDuration(0);

			_GCSkillToTileOK5.setObjectID(pVampire->getObjectID());
			_GCSkillToTileOK5.setSkillType(SkillType);
			_GCSkillToTileOK5.setX(X);
			_GCSkillToTileOK5.setY(Y);
			_GCSkillToTileOK5.setRange(dir);
			_GCSkillToTileOK5.setDuration(0);

			pPlayer->sendPacket(&_GCSkillToTileOK1);

			// 이 기술에 의해 영향을 받는 놈들에게 패킷을 보내줘야 한다.
			for (list<Creature*>::const_iterator itr = cList.begin(); itr != cList.end(); itr++)
			{
				Creature * pTargetCreature = *itr;
				Assert(pTargetCreature != NULL);

				if (pTargetCreature->isPC())
				{
					_GCSkillToTileOK2.clearList();

					// HP의 변경사항을 패킷에다 기록한다.
					HP_t targetHP = 0;
					if (pTargetCreature->isSlayer())
					{
						targetHP = (dynamic_cast<Slayer*>(pTargetCreature))->getHP(ATTR_CURRENT);
					}
					else if (pTargetCreature->isVampire())
					{
						targetHP = (dynamic_cast<Vampire*>(pTargetCreature))->getHP(ATTR_CURRENT);
					}
					else if (pTargetCreature->isOusters())
					{
						targetHP = (dynamic_cast<Ousters*>(pTargetCreature))->getHP(ATTR_CURRENT);
					}

					_GCSkillToTileOK2.addShortData(MODIFY_CURRENT_HP, targetHP);

					// 아이템의 내구력을 떨어뜨린다.
					decreaseDurability(NULL, pTargetCreature, pSkillInfo, NULL, &_GCSkillToTileOK2);

					// 패킷을 보내준다.
					pTargetCreature->getPlayer()->sendPacket(&_GCSkillToTileOK2);
				}
				else if (pTargetCreature->isMonster())
				{
					// 당근 적으로 인식한다.
					Monster* pMonster = dynamic_cast<Monster*>(pTargetCreature);
					pMonster->addEnemy(pVampire);
				}
			}

			cList.push_back(pVampire);

			pZone->broadcastPacket(myX, myY, &_GCSkillToTileOK5 , cList);

			// set Next Run Time
			pVampireSkillSlot->setRunTime(output.Delay);
		}
		else 
		{
			executeSkillFailNormal(pVampire, SkillType, NULL);
		}
	}
	catch (Throwable & t) 
	{
		executeSkillFailException(pVampire, SkillType);
	}

//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " end " << endl;

	__END_CATCH
}
void CGUseBonusPointHandler::execute (CGUseBonusPoint* pPacket , Player* pPlayer)
	 throw(Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
	__BEGIN_DEBUG
		
#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	// 정상적인 상태가 아니라면 리턴
	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
	if (pGamePlayer->getPlayerStatus() != GPS_NORMAL) return;

	Creature*      pCreature  = pGamePlayer->getCreature();
	BYTE           which      = pPacket->getWhich();
	Attr_t         cur        = 0;

	if (pCreature->isSlayer() )
	{
		Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
		if (pSlayer->getBonus() <= 0 )
		{
			GCUseBonusPointFail failPkt;
			pPlayer->sendPacket(&failPkt);
			return;
		}

		bool success = false;
		if (which == INC_INT )
		{
			success = pSlayer->putAdvancedBonusToINT();
		}
		else if (which == INC_STR)
		{
			success = pSlayer->putAdvancedBonusToSTR();
		}
		else if (which == INC_DEX)
		{
			success = pSlayer->putAdvancedBonusToDEX();
		}

		if (success )
		{
			GCUseBonusPointOK okpkt;
			pGamePlayer->sendPacket (&okpkt);

			pSlayer->saveExps();
			pSlayer->initAllStatAndSend();
		}
		else
		{
			GCUseBonusPointFail failPkt;
			pPlayer->sendPacket(&failPkt);
			return;
		}
	}
	else if (pCreature->isVampire() ) 
	{
		// 보너스 포인트가 없다면 리턴
		Vampire* pVampire = dynamic_cast<Vampire*>(pCreature);
		if (pVampire->getBonus() <= 0)
		{
			GCUseBonusPointFail failPkt;
			pPlayer->sendPacket(&failPkt);
			return;
		}

		VAMPIRE_RECORD oldRecord;
		// 능력치를 올리기 전에 기존의 능력치를 저장한다.
		pVampire->getVampireRecord(oldRecord);

		if (which == INC_INT)
		{
			cur = pVampire->getINT(ATTR_BASIC) + 1;
			pVampire->setINT(cur, ATTR_BASIC);

			StringStream sst;
			sst << "INTE = " << (int)cur;
			pVampire->tinysave(sst.toString());
			
			/*
			// INT가 증가하면 새로운 기술을 배울 수 있는 가능성이 있다.
			SkillType_t lastSkill = pVampire->findLastSkill();


			// lastSkill의 다음 level의 기술을 찾는다.
			// 못찾았다면 더이상 배울것이 없다는 것.
			for(int i = SKILL_BLOOD_DRAIN + 1 ; i < SKILL_MAX; i++)
			{
				SkillParentInfo* pParentInfo = g_pSkillParentInfoManager->getSkillParentInfo(i);

				if (pParentInfo->hasParent(lastSkill))// 찾았다!
				{
					SkillInfo* pNewSkillInfo = g_pSkillInfoManager->getSkillInfo(i);
					if (pNewSkillInfo->getEXP() <= cur && pVampire->hasSkill(i) == NULL)
					{
						//cout << "(" << pVampire->getName() << ") can learn new skill >> ";

						// 새로운 기술을 배울 수 있다.
						GCLearnSkillReady gcLSR;
						gcLSR.setSkillDomainType(SKILL_DOMAIN_VAMPIRE);
						pVampire->getPlayer()->sendPacket(&gcLSR);
						break;
					}
				}

			}
			*/

			//log(LOG_USE_BONUS_POINT, pVampire->getName(), "", "INT");
		}
		else if (which == INC_STR)
		{
			cur = pVampire->getSTR(ATTR_BASIC) + 1;
			pVampire->setSTR(cur, ATTR_BASIC);

			StringStream sst;
			sst << "STR = " << (int)cur;
			pVampire->tinysave(sst.toString());

			//log(LOG_USE_BONUS_POINT, pVampire->getName(), "", "STR");
		}
		else if (which == INC_DEX)
		{
			cur = pVampire->getDEX(ATTR_BASIC) + 1;
			pVampire->setDEX(cur, ATTR_BASIC);

			StringStream sst;
			sst << "DEX = " << (int)cur;
			pVampire->tinysave(sst.toString());

			//log(LOG_USE_BONUS_POINT, pVampire->getName(), "", "DEX");
		}

		// 바뀐 보너스 포인트를 저장한다.
		Bonus_t OldBonus = pVampire->getBonus();
		pVampire->setBonus(OldBonus - 1);
		StringStream sst;
		sst << "Bonus = " << (int)(OldBonus - 1);
		pVampire->tinysave(sst.toString());

		// 능력치가 변화되었으니, stat을 새로 고친다.
		pVampire->initAllStat();
		
		// 클라이언트의 계산 순서 때문에 생기는 버그로 인하여,
		// 먼저 인증 패킷을 날려준 후에, 바뀐 능력치에 대한 정보를 보낸다.
		// 나중에 CGUseBonusPointOK에다 바로 바뀐 능력치에 대한 정보를 
		// 실어보내도록 해야 한다.

		// OK 패킷을 보내준다.
		GCUseBonusPointOK okpkt;
		pGamePlayer->sendPacket (&okpkt);

		// 바뀐 능력치에 관한 정보를 보내준다.
		pVampire->sendModifyInfo(oldRecord);
		pVampire->sendRealWearingInfo();
	}
	else if (pCreature->isOusters() ) 
	{
		// 보너스 포인트가 없다면 리턴
		Ousters* pOusters = dynamic_cast<Ousters*>(pCreature);
		if (pOusters->getBonus() <= 0)
		{
			GCUseBonusPointFail failPkt;
			pPlayer->sendPacket(&failPkt);
			return;
		}

		OUSTERS_RECORD oldRecord;
		// 능력치를 올리기 전에 기존의 능력치를 저장한다.
		pOusters->getOustersRecord(oldRecord);

		if (which == INC_INT)
		{
			cur = pOusters->getINT(ATTR_BASIC) + 1;
			pOusters->setINT(cur, ATTR_BASIC);

			StringStream sst;
			sst << "INTE = " << (int)cur;
			pOusters->tinysave(sst.toString());
		}
		else if (which == INC_STR)
		{
			cur = pOusters->getSTR(ATTR_BASIC) + 1;
			pOusters->setSTR(cur, ATTR_BASIC);

			StringStream sst;
			sst << "STR = " << (int)cur;
			pOusters->tinysave(sst.toString());
		}
		else if (which == INC_DEX)
		{
			cur = pOusters->getDEX(ATTR_BASIC) + 1;
			pOusters->setDEX(cur, ATTR_BASIC);

			StringStream sst;
			sst << "DEX = " << (int)cur;
			pOusters->tinysave(sst.toString());
		}

		// 바뀐 보너스 포인트를 저장한다.
		Bonus_t OldBonus = pOusters->getBonus();
		pOusters->setBonus(OldBonus - 1);
		StringStream sst;
		sst << "Bonus = " << (int)(OldBonus - 1);
		pOusters->tinysave(sst.toString());

		// 능력치가 변화되었으니, stat을 새로 고친다.
		pOusters->initAllStat();
		
		// OK 패킷을 보내준다.
		GCUseBonusPointOK okpkt;
		pGamePlayer->sendPacket(&okpkt);

		// 바뀐 능력치에 관한 정보를 보내준다.
		pOusters->sendModifyInfo(oldRecord);
		pOusters->sendRealWearingInfo();
	}
	else
	{
		GCUseBonusPointFail failPkt;
		pPlayer->sendPacket(&failPkt);
		return;
	}


#endif	// __GAME_SERVER__

	__END_DEBUG
	__END_DEBUG_EX __END_CATCH
}
Example #5
0
//////////////////////////////////////////////////////////////////////////////
// 뱀파이어 타일 핸들러
//  뱀파이어가 Energy Drop Skill을 Tile에 사용했을때 사용하는 Handler
//////////////////////////////////////////////////////////////////////////////
void EnergyDrop::execute(Slayer* pSlayer, ZoneCoord_t X, ZoneCoord_t Y, SkillSlot* pSkillSlot, CEffectID_t CEffectID)
	throw(Error)
{
	__BEGIN_TRY

	//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << "begin " << endl;

	EffectEnergyDrop * pEffect = NULL;
	EffectEnergyDrop * pEffect2 = NULL;

	try
	{
		Player* pPlayer = pSlayer->getPlayer();
		Zone* pZone = pSlayer->getZone();

		Assert(pPlayer != NULL);
		Assert(pZone != NULL);

		GCSkillToTileOK1 _GCSkillToTileOK1;
		GCSkillToTileOK2 _GCSkillToTileOK2;
		GCSkillToTileOK3 _GCSkillToTileOK3;
		GCSkillToTileOK4 _GCSkillToTileOK4;
		GCSkillToTileOK5 _GCSkillToTileOK5;
		GCSkillToTileOK6 _GCSkillToTileOK6;

		SkillType_t SkillType = pSkillSlot->getSkillType();
		SkillInfo*  pSkillInfo =  g_pSkillInfoManager->getSkillInfo(SkillType);
		SkillDomainType_t DomainType = pSkillInfo->getDomainType();

		ZoneCoord_t myX = pSlayer->getX();
		ZoneCoord_t myY = pSlayer->getY();

		int  RequiredMP = (int)pSkillInfo->getConsumeMP();
		bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP);
		bool bTimeCheck = verifyRunTime(pSkillSlot);
		bool bRangeCheck = verifyDistance(pSlayer, X, Y, pSkillInfo->getRange());
		bool bHitRoll = HitRoll::isSuccessMagic(pSlayer, pSkillInfo, pSkillSlot);


		bool bTileCheck = false;

		VSRect rect(0, 0, pZone->getWidth()-1, pZone->getHeight()-1);

		if(rect.ptInRect(X, Y))
		{
			Tile& tile = pZone->getTile(X, Y);
			if (tile.canAddEffect()) bTileCheck = true;
		}


		if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && bTileCheck)
		{
			decreaseMana(pSlayer, RequiredMP, _GCSkillToTileOK1);

			// calculate damage and duration time
			SkillInput input(pSlayer, pSkillSlot);
			SkillOutput output;
			computeOutput(input, output);

			// Holy Smashing 이 있다면 데미지 10% 증가
			if (pSlayer->hasRankBonus(RankBonus::RANK_BONUS_HOLY_SMASHING ) )
			{
				RankBonus* pRankBonus = pSlayer->getRankBonus(RankBonus::RANK_BONUS_HOLY_SMASHING);
				Assert(pRankBonus != NULL);

				output.Damage += pRankBonus->getPoint();
			}

			Range_t Range = 3;

			// 기존에 같은 이펙트가 타일에 있다면 지우고 새로 설정한다.
			Tile& tile = pZone->getTile(X, Y);
			Effect* pOldEffect = tile.getEffect(Effect::EFFECT_CLASS_ENERGY_DROP);
			if(pOldEffect != NULL)
			{
				ObjectID_t effectID = pOldEffect->getObjectID();
				pZone->deleteEffect(effectID);
			}

			// 이펙트 오브젝트를 생성해서 타일에 붙인다. 
			//cout << "make EffectObject to Tile" << X << " " << Y << endl;
			pEffect = new EffectEnergyDrop(pZone, X, Y);

			pEffect->setUserObjectID(pSlayer->getObjectID());
//			pEffect->setCasterName(pSlayer->getName());
//			pEffect->setPartyID(pSlayer->getPartyID());
			pEffect->setDeadline(output.Duration);
			pEffect->setNextTime(0);
			pEffect->setTick(output.Tick);
			pEffect->setDamage(output.Damage);
			pEffect->setLevel(pSkillInfo->getLevel()/2);

			//
			//ObjectRegistry& objectregister = pZone->getObjectRegistry();
			//objectregister.registerObject(pEffect);

			//
			//
			//pZone->addEffect(pEffect);
			//tile.addEffect(pEffect);
			// 이펙트 오브젝트를 생성해서 타일에 붙인다. 
			pEffect2 = new EffectEnergyDrop(pZone, X, Y);
			pEffect2->setUserObjectID(pSlayer->getObjectID());
			pEffect2->setDeadline(output.Duration);
			pEffect2->setNextTime(0);
			pEffect2->setTick(output.Tick);
			pEffect2->setDamage(output.Damage * 30 / 100);
			pEffect2->setLevel(pSkillInfo->getLevel()/2);

			// 이펙트 범위내의 모든 Creature에게 effect를 붙여준다.
			// Slayer가 기술을 사용한 경우 같은 Slayer에게는
			// 해당하지 않는다.
			bool bEffected = false;
			bool bHit = false;

			Creature* pTargetCreature;

			list<Creature*> cList;
			cList.push_back(pSlayer);

			int oX, oY;

			Level_t maxEnemyLevel = 0;
			uint EnemyNum = 0;

			for(oX = -2; oX <= 2; oX++)
			for(oY = -2; oY <= 2; oY++)
			{
				int tileX = X+oX;
				int tileY = Y+oY;
				if (!rect.ptInRect(tileX, tileY)) continue;

				Tile& tile = pZone->getTile(tileX, tileY);
		    	if (!tile.canAddEffect()) continue; 

				pTargetCreature = NULL;
				if(tile.hasCreature(Creature::MOVE_MODE_WALKING))
					pTargetCreature = tile.getCreature(Creature::MOVE_MODE_WALKING);

				EffectEnergyDrop * pTempEffect = NULL;

				if(oX == 2 || oX == -2 || oY == 2 || oY == -2 ) pTempEffect = pEffect2;
				else pTempEffect = pEffect;

				if(pTargetCreature != NULL && canAttack(pSlayer, pTargetCreature ))
				{
					if(pTargetCreature->isVampire()||pTargetCreature->isOusters())
					{
						if(pTempEffect->affectCreature(pTargetCreature, false) == true)
						{
							//cout << "EnergyDrop to Slayer Success" << endl;
							Player* pTargetPlayer = pTargetCreature->getPlayer();
							bEffected = true;

							bHit = true;

							if (maxEnemyLevel < pTargetCreature->getLevel() ) maxEnemyLevel = pTargetCreature->getLevel();
							EnemyNum++;

							bool bCanSee = canSee(pTargetCreature, pSlayer);

							_GCSkillToTileOK1.addCListElement(pTargetCreature->getObjectID());
							_GCSkillToTileOK4.addCListElement(pTargetCreature->getObjectID());
							_GCSkillToTileOK5.addCListElement(pTargetCreature->getObjectID());

							cList.push_back(pTargetCreature);

							if (bCanSee)
							{
								// 공격을 당한 사람에게 
								_GCSkillToTileOK2.setObjectID(pSlayer->getObjectID());
								_GCSkillToTileOK2.setSkillType(SkillType);
								_GCSkillToTileOK2.setX(X);
								_GCSkillToTileOK2.setY(Y);
								_GCSkillToTileOK2.setDuration(output.Duration);
								_GCSkillToTileOK2.setRange(Range);
								pTargetPlayer->sendPacket(&_GCSkillToTileOK2);
							}
						}
						else
						{
							//cout << "EnergyDrop to Vampire fail" << endl;
						}
					}
					else if(pTargetCreature->isMonster())
					{
						if(pTempEffect->affectCreature(pTargetCreature, false) == true)
						{
							//cout << "EnergyDrop to Monster Success" << endl;
							bHit = true;

							if (maxEnemyLevel < pTargetCreature->getLevel() ) maxEnemyLevel = pTargetCreature->getLevel();
							EnemyNum++;

							Monster* pMonster = dynamic_cast<Monster*>(pTargetCreature);
							pMonster->addEnemy(pSlayer);

							// 마지막 때린 애가 슬레이어라고 설정한다. by sigi. 2002.6.21
							pMonster->setLastHitCreatureClass(Creature::CREATURE_CLASS_SLAYER);
						}
						else
						{
							//cout << "EnergyDrop to Monster Falis" << endl;
						}

					}
				} // if(pTargetCreature!= NULL)
			}

			if(bHit)
			{
				//cout << "Skill Succesfully Attacked(" << output.Damage << ")" << endl;
				shareAttrExp(pSlayer, output.Damage, 1, 1, 8, _GCSkillToTileOK1);
				increaseDomainExp(pSlayer, DomainType, pSkillInfo->getPoint(), _GCSkillToTileOK1, maxEnemyLevel, EnemyNum);
				increaseSkillExp(pSlayer, DomainType, pSkillSlot, pSkillInfo, _GCSkillToTileOK1);
			}

			// 기술을 사용한 사람들에게
			_GCSkillToTileOK1.setSkillType(SkillType);
			_GCSkillToTileOK1.setCEffectID(CEffectID);
			_GCSkillToTileOK1.setX(X);
			_GCSkillToTileOK1.setY(Y);
			_GCSkillToTileOK1.setDuration(output.Duration);
			_GCSkillToTileOK1.setRange(Range);
		
			// 기술을 쓴 사람만 볼 수 있는 사람들에게
			_GCSkillToTileOK3.setSkillType(SkillType);
			_GCSkillToTileOK3.setX(X);
			_GCSkillToTileOK3.setY(Y);
			//_GCSkillToTileOK3.setDuration(output.Duration);
			//_GCSkillToTileOK3.setRange(Range);

			// 기술을 당한 사람만 볼 수 있는 사람들에게
			_GCSkillToTileOK4.setSkillType(SkillType);
			_GCSkillToTileOK4.setX(X);
			_GCSkillToTileOK4.setY(Y);
			_GCSkillToTileOK4.setDuration(output.Duration);
			_GCSkillToTileOK4.setRange(Range);

			//기술을 쓴 사람과 당한 사람을 모두 볼 수 있는 사람들에게
			_GCSkillToTileOK5.setObjectID(pSlayer->getObjectID());
			_GCSkillToTileOK5.setSkillType(SkillType);
			_GCSkillToTileOK5.setX(X);
			_GCSkillToTileOK5.setY(Y);
			_GCSkillToTileOK5.setDuration(output.Duration);
			_GCSkillToTileOK5.setRange(Range);
	
			// 기술을 사용한 사람에게 packet 전달
			pPlayer->sendPacket(&_GCSkillToTileOK1);

			// 기술을 쓸 사람과 당한 사람을 모두 볼 수 있는 사람들에게 broadcasing
			// broadcasting후 5번OK를 받은 사람을 기록한다.
			// 여기에 기록된 사람은 차후 broadcasting에서 제외된다.
			cList = pZone->broadcastSkillPacket(myX, myY, X, Y, &_GCSkillToTileOK5, cList);
			
			// 기술을 쓴 사람을 볼 수 있는 사람들에게 broadcasting
			pZone->broadcastPacket(myX, myY, &_GCSkillToTileOK3, cList);

			// 기술을 당한 사람을 볼 수 있는 사람들에게 broadcasting
			pZone->broadcastPacket(X, Y, &_GCSkillToTileOK4, cList);

			// 기술 delay setting
			pSkillSlot->setRunTime(output.Delay);

		}
		else
		{
			executeSkillFailNormal(pSlayer, getSkillType(), NULL);
		}

		SAFE_DELETE(pEffect);
		SAFE_DELETE(pEffect2);
	}
	catch(Throwable& t)
	{
		SAFE_DELETE(pEffect);
		SAFE_DELETE(pEffect2);
		executeSkillFailException(pSlayer, getSkillType());
	}

	//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " end " << endl;

	__END_CATCH
}
void CGSkillToTileHandler::execute (CGSkillToTile* pPacket , Player* pPlayer)
throw(Error)
{
    __BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

    Assert(pPacket != NULL);
    Assert(pPlayer != NULL);

    try
    {
        // 특수기술 테스트를 위해서 임시로 넣어두는 코드이다.
        GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);

        Assert(pGamePlayer != NULL);	// by sigi

        if (pGamePlayer->getPlayerStatus() == GPS_NORMAL)
        {
            Creature* pCreature = pGamePlayer->getCreature();
            Assert(pCreature != NULL);	// by sigi

            Zone* pZone = pCreature->getZone();
            Assert(pZone != NULL);

            SkillType_t SkillType = pPacket->getSkillType();

            // 완전 안전지대라면 기술 사용 불가. by sigi. 2002.11.14
            ZoneLevel_t ZoneLevel = pZone->getZoneLevel(pCreature->getX(), pCreature->getY());
            if ((ZoneLevel & COMPLETE_SAFE_ZONE) ||
                    (pCreature->isFlag(Effect::EFFECT_CLASS_PARALYZE)) ||
                    (pCreature->isFlag(Effect::EFFECT_CLASS_CAUSE_CRITICAL_WOUNDS)) ||
                    (pCreature->isFlag(Effect::EFFECT_CLASS_EXPLOSION_WATER)) ||
                    (pCreature->isFlag(Effect::EFFECT_CLASS_COMA)))
            {
                GCSkillFailed1 _GCSkillFailed1;
                _GCSkillFailed1.setSkillType(SkillType);
                pPlayer->sendPacket(&_GCSkillFailed1);

                return;
            }
            if (pCreature->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WERWOLF)) {
                switch(SkillType) {
                case SKILL_ATTACK_MELEE:
                case SKILL_BITE_OF_DEATH:
                case SKILL_UN_TRANSFORM:
                case SKILL_RAPID_GLIDING:
                    break;
                default:
                    GCSkillFailed1 _GCSkillFailed1;
                    _GCSkillFailed1.setSkillType(SkillType);
                    pPlayer->sendPacket(&_GCSkillFailed1);
                    dynamic_cast<Vampire*>(pCreature)->sendVampireSkillInfo();
                    return;
                }
            }
            if (pCreature->isFlag(Effect::EFFECT_CLASS_ABERRATION ) )
            {
                EffectAberration* pEffect = dynamic_cast<EffectAberration*>(pCreature->findEffect(Effect::EFFECT_CLASS_ABERRATION));
                if (pEffect != NULL && (rand()%100) < pEffect->getRatio())
                {
                    //cout << "aberration affected " << endl;
                    Dir_t dir = rand()%8;
                    pPacket->setX(pPacket->getX() + dirMoveMask[dir].x*3);
                    pPacket->setY(pPacket->getY() + dirMoveMask[dir].y*3);
                }
            }

            disableFlags(pCreature, pZone, SkillType);

            if (pCreature->isSlayer())
            {
                Slayer*    pSlayer    = dynamic_cast<Slayer*>(pCreature);
                SkillSlot* pSkillSlot = ((Slayer *)pCreature)->hasSkill(SkillType);
                bool       bSuccess   = true;

                if (SkillType == SKILL_BURNING_SOL_LAUNCH )
                {
                    pSkillSlot = ((Slayer *)pCreature)->hasSkill(SKILL_BURNING_SOL_CHARGING);
                }

                if (SkillType == SKILL_SWEEP_VICE_3 || SkillType == SKILL_SWEEP_VICE_5 )
                {
                    pSkillSlot = ((Slayer *)pCreature)->hasSkill(SKILL_SWEEP_VICE_1);
                }

                if (SkillType == SKILL_TURRET_FIRE ) pSkillSlot = ((Slayer *)pCreature)->hasSkill(SKILL_INSTALL_TURRET);

                if (pSkillSlot == NULL) bSuccess = false;
                if (!isAbleToUseTileSkill(pSlayer)) bSuccess = false;

                /*				if (pCreature->isSlayer() && pCreature->isFlag(Effect::EFFECT_CLASS_SNIPING_MODE))
                				{
                					Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
                					Assert(pSlayer != NULL);
                					g_Sniping.checkRevealRatio(pSlayer, 20, 10);
                				} */

                if (bSuccess)
                {
                    SkillHandler* pSkillHandler = g_pSkillHandlerManager->getSkillHandler(SkillType);
                    Assert(pSkillHandler != NULL);

#ifdef __PROFILE_SKILLS__
                    beginProfileEx(SkillTypes2String[SkillType]);
                    pSkillHandler->execute(pSlayer, pPacket->getX(), pPacket->getY(), pSkillSlot, pPacket->getCEffectID());
                    endProfileEx(SkillTypes2String[SkillType]);
#else
                    pSkillHandler->execute(pSlayer, pPacket->getX(), pPacket->getY(), pSkillSlot, pPacket->getCEffectID());
#endif
                }
                else
                {
                    GCSkillFailed1 _GCSkillFailed1;
                    _GCSkillFailed1.setSkillType(SkillType);
                    pPlayer->sendPacket(&_GCSkillFailed1);
                }
            }
            else if (pCreature->isVampire())
            {
                Vampire*          pVampire          = dynamic_cast<Vampire*>(pCreature);
                VampireSkillSlot* pVampireSkillSlot = pVampire->hasSkill(SkillType);
                bool              bSuccess          = true;

                if (SkillType == SKILL_EAT_CORPSE && pVampire->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF))
                {
                    SkillHandler* pSkillHandler = g_pSkillHandlerManager->getSkillHandler(SKILL_EAT_CORPSE);
                    Assert(pSkillHandler != NULL);
                    pSkillHandler->execute(pVampire, pPacket->getX(), pPacket->getY(), pVampireSkillSlot, pPacket->getCEffectID());
                    return;
                }

                if (pVampireSkillSlot == NULL) bSuccess = false;
                if (!isAbleToUseTileSkill(pVampire)) bSuccess = false;

                /*				if (pVampire->isFlag(Effect::EFFECT_CLASS_INVISIBILITY))
                				{
                					addVisibleCreature(pZone, pVampire, true);
                				}

                                if (pVampire->isFlag(Effect::EFFECT_CLASS_EXTREME))
                	            {
                	            	EffectManager * pEffectManager = pVampire->getEffectManager();
                	            	Assert(pEffectManager != NULL);
                	            	Effect * pEffect = pEffectManager->findEffect(Effect::EFFECT_CLASS_EXTREME);
                	            	if (pEffect != NULL ) {
                	            		pEffect->setDeadline(0);
                	            	}
                				} */
                if (bSuccess)
                {
                    SkillHandler* pSkillHandler = g_pSkillHandlerManager->getSkillHandler(SkillType);
                    Assert(pSkillHandler != NULL);

#ifdef __PROFILE_SKILLS__
                    beginProfileEx(SkillTypes2String[SkillType]);
                    pSkillHandler->execute(pVampire, pPacket->getX(), pPacket->getY(), pVampireSkillSlot, pPacket->getCEffectID());
                    endProfileEx(SkillTypes2String[SkillType]);
#else
                    pSkillHandler->execute(pVampire, pPacket->getX(), pPacket->getY(), pVampireSkillSlot, pPacket->getCEffectID());
#endif
                }
                else
                {
                    GCSkillFailed1 _GCSkillFailed1;
                    _GCSkillFailed1.setSkillType(SkillType);
                    pPlayer->sendPacket(&_GCSkillFailed1);
                }
            }
            else if (pCreature->isOusters())
            {
                Ousters*          pOusters          = dynamic_cast<Ousters*>(pCreature);
                OustersSkillSlot* pOustersSkillSlot = pOusters->hasSkill(SkillType);
                bool              bSuccess          = true;

                if (pOustersSkillSlot == NULL) bSuccess = false;
                if (!isAbleToUseTileSkill(pOusters)) bSuccess = false;
                if (SkillType == SKILL_DESTRUCTION_SPEAR && pOusters->hasSkill(SKILL_DESTRUCTION_SPEAR_MASTERY) == NULL )
                {
                    //cout << "has no mastery : destruction spear" << endl;
                    bSuccess = false;
                }
                if (SkillType == SKILL_ICE_LANCE && pOusters->hasSkill(SKILL_ICE_LANCE_MASTERY) == NULL )
                {
                    //cout << "has no mastery : ice lance" << endl;
                    bSuccess = false;
                }

                if (bSuccess)
                {
                    SkillHandler* pSkillHandler = g_pSkillHandlerManager->getSkillHandler(SkillType);
                    Assert(pSkillHandler != NULL);

#ifdef __PROFILE_SKILLS__
                    beginProfileEx(SkillTypes2String[SkillType]);
                    pSkillHandler->execute(pOusters, pPacket->getX(), pPacket->getY(), pOustersSkillSlot, pPacket->getCEffectID());
                    endProfileEx(SkillTypes2String[SkillType]);
#else
                    pSkillHandler->execute(pOusters, pPacket->getX(), pPacket->getY(), pOustersSkillSlot, pPacket->getCEffectID());
#endif
                }
                else
                {
                    GCSkillFailed1 _GCSkillFailed1;
                    _GCSkillFailed1.setSkillType(SkillType);
                    pPlayer->sendPacket(&_GCSkillFailed1);
                }
            }
        }
    }
    catch(Throwable & t)
    {
        //cout << t.toString() << endl;
    }

#endif	// __GAME_SERVER__

    __END_DEBUG_EX __END_CATCH
}