示例#1
0
void GJReqMapSvrAuth(int iIndex, LPSTR lpszAccountID, LPSTR lpszCharName, int iJA1, int iJA2, int iJA3, int iJA4)
{
    if ( !OBJMAX_RANGE(iIndex))
    {
        LogAdd( "[MapServerMng] Packet Error GJ [0x7B] - Index out of bound : %d", iIndex);
        return;
    }

    PMSG_REQ_MAPSVRAUTH pMsg;

    PHeadSetB((LPBYTE)&pMsg, 0x7B, sizeof(pMsg));
    pMsg.iIndex = iIndex;
    memcpy(pMsg.szAccountID, lpszAccountID, MAX_ACCOUNT_LEN);
    memcpy(pMsg.szCharName, lpszCharName, MAX_ACCOUNT_LEN);
    pMsg.wDstMapSvrCode = gGameServerCode;
    pMsg.iJoinAuthCode1 = iJA1;
    pMsg.iJoinAuthCode2 = iJA2;
    pMsg.iJoinAuthCode3 = iJA3;
    pMsg.iJoinAuthCode4 = iJA4;

    wsJServerCli.DataSend((PCHAR)&pMsg, pMsg.h.size);

    gObj[iIndex].m_bMapSvrMoveReq = true;
}
示例#2
0
_MONSTER_HERD_DATA * MonsterHerd::GetMonsterData(int iIndex)
{
	if ( OBJMAX_RANGE(iIndex) == FALSE )
	{
		return NULL;
	}

	LPOBJ lpOBJ = &gObj[iIndex];

	if ( lpOBJ->Connected < PLAYER_PLAYING || lpOBJ->Type != OBJ_MONSTER )
	{
		return NULL;
	}

	MonsterHerd * lpMH = (MonsterHerd *)lpOBJ->m_lpMonsterHerd;

	if ( lpMH == NULL )
	{
		return NULL;
	}

	_MONSTER_HERD_DATA * lpMHD_RETURN = NULL;

	EnterCriticalSection(&lpMH->m_critMonsterHerd);
	
	std::map<int, _MONSTER_HERD_DATA>::iterator it = lpMH->m_mapMonsterHerd.find(iIndex);

	if ( it != lpMH->m_mapMonsterHerd.end() )
	{
		lpMHD_RETURN = &it->second;
	}

	LeaveCriticalSection(&lpMH->m_critMonsterHerd);

	return lpMHD_RETURN;
}
BOOL CIllusionTempleEvent::CheckRelics(int nIndex)
{
	if (  gObjIsConnected(nIndex) == FALSE )
	{
		return FALSE;
	}

	if( OBJMAX_RANGE(nIndex) == FALSE )
	{
		return FALSE;
	}

	if(IT_MAP_RANGE(gObj[nIndex].MapNumber) == FALSE || this->m_cIllusionTempleProc[gObj[nIndex].MapNumber - 45].GetIllusionTempleState() != 2)
	{
		return FALSE;
	}

	if(nIndex == this->m_cIllusionTempleProc[gObj[nIndex].MapNumber - 45].GetRelicsUserIndex())
	{
		return TRUE;
	}

	return FALSE;
}
示例#4
0
BOOL MonsterHerd::CheckInRadius(int iIndex)
{
	if ( OBJMAX_RANGE(iIndex) == FALSE )
	{
		return FALSE;
	}

	LPOBJ lpOBJ = &gObj[iIndex];

	if ( lpOBJ->Connected < PLAYER_PLAYING || lpOBJ->Type != OBJ_MONSTER )
	{
		return FALSE;
	}

	int iX2 = (lpOBJ->X - this->m_iCUR_X) * (lpOBJ->X - this->m_iCUR_X);
	int iY2 = (lpOBJ->Y - this->m_iCUR_Y) * (lpOBJ->Y - this->m_iCUR_Y);

	if ( (this->m_iRADIUS * this->m_iRADIUS) < (iX2+iY2) )
	{
		return FALSE;
	}

	return TRUE;
}
void GuildMatch::DGAnsJoinReqAnswer(GUILDMATCH_DGANS_REQUESTANSWER* lpData)
{
	if(		!OBJMAX_RANGE(lpData->UserIndex)
		||	gObj[lpData->UserIndex].Connected != PLAYER_PLAYING )
	{
		return;
	}
	// ----
	GUILDMATCH_GCANS_REQUESTANSWER lpAnswer = { 0 };
	lpAnswer.h.c			= 0xC1;
	lpAnswer.h.headcode		= 0xED;
	lpAnswer.h.subcode		= 0x06;
	lpAnswer.h.size			= sizeof(GUILDMATCH_GCANS_REQUESTANSWER);
	lpAnswer.Type			= lpData->Type;
	memcpy(lpAnswer.Character, lpData->Character, 10);
	// ----
	if( lpData->Type == 0 )
	{
		if( lpData->Result == -1 )
		{
			lpAnswer.Type = -1;
			DataSend(lpData->UserIndex, (LPBYTE)&lpAnswer, sizeof(GUILDMATCH_GCANS_REQUESTANSWER));
			return;
		}
		// ----
		DataSend(lpData->UserIndex, (LPBYTE)&lpAnswer, sizeof(GUILDMATCH_GCANS_REQUESTANSWER));
	}
	else if( lpData->Type == 1 )
	{
		if( lpData->Result == -1 )
		{
			lpAnswer.Type = -1;
			DataSend(lpData->UserIndex, (LPBYTE)&lpAnswer, sizeof(GUILDMATCH_GCANS_REQUESTANSWER));
			return;
		}
		// ----
		if( lpData->Result == 0 ) //User already in guild
		{
			lpAnswer.Type = -1;
			DataSend(lpData->UserIndex, (LPBYTE)&lpAnswer, sizeof(GUILDMATCH_GCANS_REQUESTANSWER));
			return;
		}
		// ----
		for( int i = OBJ_STARTUSERINDEX; i < OBJMAX; i++ )
		{
			if( gObj[i].Name != NULL && !strcmp(lpData->Character, gObj[i].Name) )
			{
				if( gObj[i].Connected == PLAYER_PLAYING )
				{
					_GUILD_INFO_STRUCT* lpGuild = Guild.AddMember(gObj[lpData->UserIndex].lpGuild->Name, gObj[i].Name, i, -1, 0, gGameServerCode / 20);
					// ----
					if( lpGuild != NULL )
					{
						gObj[i].lpGuild = lpGuild;
						gObj[i].GuildStatus = 0;
						gObj[i].GuildNumber = lpGuild->Number;
						gObj[i].iGuildUnionTimeStamp = 0;
						GCGuildViewportNowPaint(i, gObj[lpData->UserIndex].lpGuild->Name, gObj[i].lpGuild->Mark, FALSE);
						break;
					}
				}
			}
		}
		// ----
		DataSend(lpData->UserIndex, (LPBYTE)&lpAnswer, sizeof(GUILDMATCH_GCANS_REQUESTANSWER));
	}
}
示例#6
0
void CDevilSquare::gObjExpParty(LPOBJ lpObj, LPOBJ lpTargetObj, int AttackDamage, BOOL MSBFlag)
{
	int n;
	DWORD exp;
	DWORD maxexp = 0;
	int totalexp;
	int level = ((lpTargetObj->Level + 25) * lpTargetObj->Level) / 3;
	int number;
	int partynum = 0;
	int totallevel = 0;
	int partylevel;
	int partycount;
	int dis[MAX_USER_IN_PARTY];
	int viewplayer = 0;
	int viewpercent = 100;
	BOOL bApplaySetParty = FALSE;
	bool bCheckSetParty[MAX_TYPE_PLAYER];
	partynum = lpObj->PartyNumber;
	LPOBJ lpPartyObj;

	
	int toplevel = 0;

	for (n=0;n<MAX_USER_IN_PARTY;n++)
	{
		number = gParty.m_PartyS[partynum].Number[n];

		if ( number >= 0 )
		{
			lpPartyObj = &gObj[number];

			if ( lpPartyObj->Level > toplevel )
			{
				toplevel = lpPartyObj->Level;
			}
		}
	}

	if ( OBJMAX_RANGE(partynum) == FALSE )
	{
		LogAdd("error : %s %d", __FILE__, __LINE__);
		return;
	}

	partycount = gParty.m_PartyS[partynum].Count;

	for ( n =0;n<MAX_USER_IN_PARTY;n++)
	{
		number = gParty.m_PartyS[partynum].Number[n];

		if ( number >= 0 )
		{
			lpPartyObj = &gObj[number];

			if ( lpTargetObj->MapNumber ==lpPartyObj->MapNumber )
			{
				dis[n] = gObjCalDistance(lpTargetObj, &gObj[number]);

				if ( dis[n] < 10 )
				{
					lpPartyObj = &gObj[number];

					if ( toplevel >= (lpPartyObj->Level + 200 ) ) // #formula
					{
						totallevel = totallevel + lpPartyObj->Level + 200;
					}
					else
					{
						totallevel += lpPartyObj->Level;
					}

					viewplayer++;
					bCheckSetParty[lpPartyObj->Class] = true;
				}
			}
		}
	}

	if ( bCheckSetParty[0] != false && bCheckSetParty[1] != false && bCheckSetParty[2] != false )
	{
		bApplaySetParty = TRUE;
	}

	if ( viewplayer > 1 )
	{
		if ( bApplaySetParty != FALSE )
		{
			if ( viewplayer == 3 )
			{
				viewpercent = 230;
			}
			else if ( viewplayer == 4 )
			{
				viewpercent = 270;
			}
			else if ( viewplayer >= 5 )
			{
				viewpercent = 300;
			}
			else
			{
				viewpercent = 120;
			}
		}
		else
		{
			if ( viewplayer == 2 )
			{
				viewpercent = 160;
			}
			else if ( viewplayer == 3 )
			{
				viewpercent = 180;
			}
			else if ( viewplayer == 4 )
			{
				viewpercent = 200;
			}
			else if ( viewplayer >= 5 )
			{
				viewpercent = 220;
			}
			else
			{
				viewpercent = 120;
			}
		}

		partylevel = totallevel / viewplayer;
	}
	else
	{
		partylevel = totallevel;
	}

	if ( (lpTargetObj->Level +10) < partylevel )
	{
		level = (level * (lpTargetObj->Level+10) ) / partylevel;
	}

	if ( lpTargetObj->Level >= 65 )
	{
		if ( viewplayer == 1 )
		{
			level += (lpTargetObj->Level - 64) * (lpTargetObj->Level/ 4);
		}
		else
		{
			level += int(200.0 - (lpObj->Level * 0.2));
		}
	}

	if ( level > 0 )
	{
		maxexp = level / 2;
	}
	else
	{
		level = 0;
	}

	if ( maxexp < 1 )
	{
		totalexp = level;
	}
	else
	{
		totalexp = level + Random(0,maxexp);
	}

	if ( lpTargetObj->Type == OBJ_MONSTER )
	{
		lpTargetObj->Money = totalexp;
	}

	for ( n=0;n<MAX_USER_IN_PARTY;n++)
	{
		number = gParty.m_PartyS[partynum].Number[n];

		if ( number >= 0 )
		{
			lpPartyObj = &gObj[number];

			if ( lpTargetObj->MapNumber == lpPartyObj->MapNumber )
			{
				if ( dis[n] < 10 )
				{
					DWORD myexp = gLevelExperience[lpPartyObj->Level];
					exp = ((totalexp * viewpercent* lpPartyObj->Level ) / totallevel ) / 100;

					if ( exp > myexp  )
					{
						exp = myexp;
					}

					if( lpPartyObj->Type == OBJ_USER )
					{
						if ( lpTargetObj->Type == OBJ_USER )
						{
							exp = 0;
						}
					}

					//exp *= (DWORD)gAddExperience;
					exp *= VipSystem_MapExp[lpObj->VipType][lpObj->MapNumber];

					if ( lpPartyObj->m_wExprienceRate == 0 )
						exp = 0;
					else
						exp =  DWORD( (double)exp * ((double)lpPartyObj->m_wExprienceRate  / 100.0) );

					if ( g_CrywolfSync.GetOccupationState() == 1 && g_iCrywolfApplyMvpPenalty != FALSE)
					{
						exp =  (exp * g_CrywolfSync.GetGettingExpPenaltyRate()) / 100;
					}

					if ( exp > 0 )
					{
						if ( lpPartyObj->Type == OBJ_USER )
						{
							if ( lpPartyObj->m_wExprienceRate > 0 )
							{
								lpPartyObj->Experience += exp;
								lpPartyObj->m_nEventExp += exp;
							}

							if ( gObjLevelUp(lpPartyObj, exp, lpTargetObj->Class, EVENT_TYPE_PARTY) == false )
							{
								continue;
							}
						}
					}

					if ( lpPartyObj->Type == OBJ_USER )
					{
						if ( lpPartyObj->m_wExprienceRate > 0 )
						{
							GCKillPlayerExpSend(lpPartyObj->m_Index, lpTargetObj->m_Index, exp, AttackDamage, MSBFlag);
						}
					}
				}
			}
		}
	}
}
示例#7
0
//00416F70 - identical
void CKalimaGate::KalimaGateAct2(int iIndex)
{
	LPOBJ lpObj = NULL;
	LPOBJ lpObjCallOwner = NULL;

	if ( OBJMAX_RANGE(iIndex) == FALSE )
		return;

	if ( gObj[iIndex].Live == 0 )
		return;

	if ( !gObjIsConnected(gObj[iIndex].m_RecallMon ) )
	{
		LogAddTD("[Kalima] Kalima Gate Vanished (NextMap) - Summoner Vanished (SummonIndex:%d, EnterCount:%d)",
			iIndex, gObj[iIndex].m_cKalimaGateEnterCount);

		GCDiePlayerSend(&gObj[iIndex], iIndex, 0, 0);
		gObjDel(iIndex);
		gObjCharZeroSet(iIndex);

		return;
	}

	lpObj = &gObj[iIndex];
	lpObjCallOwner = &gObj[lpObj->m_RecallMon];

	if ( gObj[iIndex].m_cKalimaGateEnterCount >= MAX_KALIMA_ENTER )
	{
		lpObjCallOwner->AccountID[MAX_ACCOUNT_LEN]=0;
		lpObjCallOwner->Name[MAX_ACCOUNT_LEN]=0;

		LogAddTD("[Kalima] [%s][%s] Kalima Gate Vanished - Enter Count Over (SummonIndex:%d, EnterCount:%d)",
			lpObjCallOwner->AccountID, lpObjCallOwner->Name, iIndex, gObj[iIndex].m_cKalimaGateEnterCount);

		this->DeleteKalimaGate(iIndex, gObj[iIndex].m_RecallMon);

		return;
	}

	DWORD dwTickCount = GetTickCount();

	if ( dwTickCount > (lpObj->RegenTime+60000) )
	{
		lpObjCallOwner->AccountID[MAX_ACCOUNT_LEN]=0;
		lpObjCallOwner->Name[MAX_ACCOUNT_LEN]=0;

		LogAddTD("[Kalima] [%s][%s] Kalima Gate Vanished (NextMap) - Time Out (SummonIndex:%d, EnterCount:%d)",
			lpObjCallOwner->AccountID, lpObjCallOwner->Name, iIndex, gObj[iIndex].m_cKalimaGateEnterCount);

		this->DeleteKalimaGate(lpObj->m_Index, lpObjCallOwner->m_Index);

		return;
	}

	if ( lpObj->VPCount < 1 )
		return;

	if ( lpObj->MapNumber < MAP_INDEX_KALIMA1 || lpObj->MapNumber > MAP_INDEX_KALIMA6-1 )
		return;

	int tObjNum = -1;

	for ( int i=0;i<MAX_VIEWPORT_MONSTER;i++)
	{
		tObjNum = lpObj->VpPlayer[i].number;

		if ( tObjNum >= 0 )
		{
			if ( gObj[tObjNum].Type == OBJ_USER )
			{
				if ( gObj[tObjNum].Live )
				{
					if ( abs(lpObj->Y - gObj[tObjNum].Y) < 2 )
					{
						if ( abs(lpObj->X - gObj[tObjNum].X) < 2 )
						{
							if ( lpObj->m_RecallMon == tObjNum || (gObj[tObjNum].PartyNumber != -1 && lpObjCallOwner->PartyNumber == gObj[tObjNum].PartyNumber ))
							{
								int iMoveMapLevel = lpObj->MapNumber - MAP_INDEX_KALIMA1+1;	// #error "Deatwway - remove the -1
								int iGateNumber = g_iKalimaGateGateIndex[iMoveMapLevel];

								if ( !gObjMoveGate(tObjNum, iGateNumber))
								{
									LogAddTD("[Kalima] [%s][%s] - [%s][%s] move fail (MapNumber:%d)",
										lpObjCallOwner->AccountID, lpObjCallOwner->Name,
										gObj[tObjNum].AccountID, gObj[tObjNum].Name,
										lpObj->MapNumber);
								}
								else
								{
									LogAddTD("[Kalima] [%s][%s] - [%s][%s] Transported by Kalima Gate (NextMap) (SummonIndex:%d, GateNo.:%d, MapNumber:%d)",
										lpObjCallOwner->AccountID, lpObjCallOwner->Name,
										gObj[tObjNum].AccountID, gObj[tObjNum].Name,
										iIndex, iMoveMapLevel+1, lpObj->MapNumber);

									gObj[iIndex].m_cKalimaGateEnterCount++;

									if ( gObj[iIndex].m_cKalimaGateEnterCount >= MAX_KALIMA_ENTER )
										break;
								}
							}
						}
					}
				}
			}
		}
	}
}
void TMonsterSkillManager::UseMonsterSkill(int iIndex, int iTargetIndex, int iMonsterSkillUnitType)
{
	LPOBJ lpObj = &gObj[iIndex];
	LPOBJ lpTargetObj = &gObj[iTargetIndex];
	TMonsterSkillInfo * lpMonsterSkillInfo = &TMonsterSkillManager::s_MonsterSkillInfoArray[lpObj->Class];

	if ( lpMonsterSkillInfo->IsValid() == FALSE )
		return;
	
	TMonsterSkillUnit * lpMonsterSkillUnit = TMonsterSkillManager::FindMonsterSkillUnit(iIndex, iMonsterSkillUnitType);

	if ( lpMonsterSkillUnit == NULL )
	{
		LogAddC(2, "[Monster Skill Manager] SkillUnit is NULL ");
		return;
	}

	GCUseMonsterSkillSend(lpObj, lpTargetObj, lpMonsterSkillUnit->m_iUnitNumber);

	if ( lpMonsterSkillUnit->m_iUnitScopeType == -1 )
	{
		lpMonsterSkillUnit->RunSkill(iIndex, iTargetIndex);
	}
	else
	{
		int iCount = 0;
		int iRangeTargetIndex = -1;
		int iAngle = gObjUseSkill.GetAngle(lpObj->X, lpObj->Y, lpTargetObj->X, lpTargetObj->Y);

		while ( true )
		{
			if ( lpObj->VpPlayer2[iCount].state )
			{
				iRangeTargetIndex = lpObj->VpPlayer2[iCount].number;

				if ( OBJMAX_RANGE(iRangeTargetIndex))
				{
					if ( gObj[iRangeTargetIndex].Type == OBJ_USER )
					{
						BOOL bTargetOK = FALSE;

						if ( lpMonsterSkillUnit->m_iUnitScopeType == 0 )
						{
							if ( gObjCalDistance(lpObj, &gObj[iRangeTargetIndex]) < lpMonsterSkillUnit->m_iUnitScopeValue )
							{
								bTargetOK = TRUE;
							}
						}
						else  if ( lpMonsterSkillUnit->m_iUnitScopeType == 1 )
						{
							if ( SkillElectricSparkHitBox.HitCheck(iAngle, lpObj->X, lpObj->Y,
								gObj[iRangeTargetIndex].X, gObj[iRangeTargetIndex].Y) )
							{
								bTargetOK = TRUE;
							}
						}
						else if ( lpMonsterSkillUnit->m_iUnitScopeType == 2 )
						{
							bTargetOK = TRUE;
						}
						else if ( lpMonsterSkillUnit->m_iUnitScopeType == 3 )
						{
							bTargetOK = TRUE;
						}

						if ( bTargetOK )
						{
							lpMonsterSkillUnit->RunSkill(iIndex, iRangeTargetIndex);
						}
					}
				}
			}

			iCount++;

			if ( iCount > MAX_VIEWPORT_MONSTER-1)
				break;
		}
	}
						
}
示例#9
0
// --------------------------------------------------------------------------------------------------------------------------------------------------
void PMoveProc(PMSG_MOVE* lpMove, int aIndex)
{
	LPOBJ lpObj = &gObj[aIndex];
	// -----
	PMSG_RECVMOVE pMove;
	// -----
	unsigned char	ax;
	unsigned char	ay;
	unsigned char	sx;
	unsigned char	sy;
	unsigned char	pathtable;
	// -----
	if( !OBJMAX_RANGE(aIndex) )
	{
		CLog.LogAddC(TColor.Red(), "Error: Protocol Index wrong!", lpObj->AccountID, lpObj->Name);
		return;
	}
	// -----
	if( lpObj->RegenOk > NULL ) return;
	// -----
	if( lpObj->SkillRecallParty_Time > NULL )
	{
		lpObj->SkillRecallParty_Time = 0;
		SendMsg.MessageOut(aIndex, 0x01, "Summoning cancelled.");
	}
	// -----
	if( (GetTickCount()-lpObj->m_LastMoveTime) < 100 ) return;
	// -----
	if( lpObj->Teleport ) return;
	// -----
	if( lpObj->m_SkillHarden )
	{
		gObjSetPosition(lpObj->m_Index, lpObj->X, lpObj->Y);
		return;
	}
	// -----
	if ( lpObj->m_iSkillStunTime > 0 )
	{
		gObjSetPosition(lpObj->m_Index, lpObj->X, lpObj->Y);
		return;
	}
	// -----
	lpObj->m_LastMoveTime	= GetTickCount();
	lpObj->m_Rest			= 0;
	lpObj->PathCur			= 0;
	lpObj->Dir				= lpMove->Path[0] >> 4;
	lpObj->PathCount		= lpMove->Path[0] & 0x0F;
	// -----
	if ( lpObj->PathCount > 15 )
	{
		CLog.LogAddC(TColor.Red(), "Error: [%s][%s] Path Count (%d)", lpObj->AccountID, lpObj->Name, lpObj->PathCount);
		return;
	}
	// -----
	for( int n=0; n<15; n++)
	{
		lpObj->PathX[n]		= 0;
		lpObj->PathY[n]		= 0;
		lpObj->PathOri[n]	= 0;
	}
	// -----
	sx = lpMove->X;
	sy = lpMove->Y;
	// -----
	if( gObjCheckXYMapTile(lpObj, 1) == TRUE )
	{
		lpObj->PathCount	= 0;
		lpObj->PathCur		= 0;
		lpObj->PathStartEnd = 0;
		// -----
		gObjSetPosition(lpObj->m_Index, lpObj->X, lpObj->Y);
		return;
	}
	// -----
	lpObj->PathX[0]			= lpMove->X;
	ax						= lpObj->PathX[0];
	lpObj->PathY[0]			= lpMove->Y;
	ay						= lpObj->PathY[0];
	lpObj->PathDir[0]		= lpObj->Dir;
	lpObj->PathStartEnd		= 1;
	// -----
	if( lpObj->PathCount > 0 )
	{
		lpObj->PathCur = 1;
		lpObj->PathCount++;
	}
	// -----
	for(int n=1; n<lpObj->PathCount; n++)
	{
		if( (n%2) == 1 )
		{
			pathtable = lpMove->Path[(n+1) / 2] >> 4;
		}
		else
		{
BOOL CIllusionTempleEvent::CheckChaosMixItem(int nIndex)
{
	 int result; // eax@5
  int v3; // [sp+4Ch] [bp-40h]@37
  int v4; // [sp+50h] [bp-3Ch]@32
  int v5; // [sp+54h] [bp-38h]@2
  signed int i; // [sp+60h] [bp-2Ch]@6
  signed int iCharmOfLuckCount; // [sp+64h] [bp-28h]@6
  int iCovenantOfIllusionLevel; // [sp+68h] [bp-24h]@6
  int iOldScroolLevel; // [sp+6Ch] [bp-20h]@6
  signed int iEventItemCount; // [sp+70h] [bp-1Ch]@6
  signed int bIsOtherItemExist; // [sp+74h] [bp-18h]@6
  signed int bIsCovenantOfIllusionExist; // [sp+78h] [bp-14h]@6
  signed int bIsOldScrollExist; // [sp+7Ch] [bp-10h]@6
  signed int bIsChaosGemExist; // [sp+80h] [bp-Ch]@6

  if( OBJMAX_RANGE(nIndex) == FALSE )
	{
		return FALSE;
	}

    bIsChaosGemExist = 0;
    bIsOldScrollExist = 0;
    bIsCovenantOfIllusionExist = 0;
    bIsOtherItemExist = 0;
    iEventItemCount = 0;
    iOldScroolLevel = 0;
    iCovenantOfIllusionLevel = 0;
    iCharmOfLuckCount = 0;
    for ( i = 0; i < 32; ++i )
    {
      if ( gObj[nIndex].pChaosBox[i].IsItem() == 1 )
      {
        switch ( gObj[nIndex].pChaosBox[i].m_Type )
        {
          case 0x180F:
            bIsChaosGemExist = 1;
            break;
          case 0x1A31:
            ++iEventItemCount;
            bIsOldScrollExist = 1;
            iOldScroolLevel = gObj[nIndex].pChaosBox[i].m_Level;
            break;
          case 0x1A32:
            ++iEventItemCount;
            bIsCovenantOfIllusionExist = 1;
            iCovenantOfIllusionLevel = gObj[nIndex].pChaosBox[i].m_Level;
            break;
          case 0x1C35:
            iCharmOfLuckCount = (signed __int64)((double)iCharmOfLuckCount + gObj[nIndex].pChaosBox[i].m_Durability);
            break;
          default:
            bIsOtherItemExist = 1;
            break;
        }
      }
    }
    if ( bIsOtherItemExist )
    {
      result = 8;
    }
    else
    {
      if ( bIsOldScrollExist || bIsCovenantOfIllusionExist )
      {
        if ( bIsOldScrollExist && bIsCovenantOfIllusionExist )
        {
          if ( iEventItemCount <= 2 )
          {
            if ( iOldScroolLevel == iCovenantOfIllusionLevel )
            {
              if ( iOldScroolLevel - 1 >= 0 )
                v4 = iOldScroolLevel - 1 <= 5;
              else
                v4 = 0;
              if ( v4 )
              {
                if ( iCovenantOfIllusionLevel - 1 >= 0 )
                  v3 = iCovenantOfIllusionLevel - 1 <= 5;
                else
                  v3 = 0;
                if ( v3 )
                {
                  if ( bIsChaosGemExist )
                  {
                    if ( gObj[nIndex].Level >= 10 )
                    {
                      if ( bIsChaosGemExist && bIsOldScrollExist && bIsCovenantOfIllusionExist )
                        result = iOldScroolLevel;
                      else
                        result = 0;
                    }
                    else
                    {
                      result = 14;
                    }
                  }
                  else
                  {
                    result = 10;
                  }
                }
                else
                {
                  result = 9;
                }
              }
              else
              {
                result = 9;
              }
            }
            else
            {
              result = 9;
            }
          }
          else
          {
            result = 12;
          }
        }
        else
        {
          result = 11;
        }
      }
      else
      {
        result = 0;
      }
    }

  return result;
}
void CDevilSquare::gObjExpParty(LPOBJ lpObj, LPOBJ lpTargetObj, int AttackDamage, BOOL MSBFlag)
{
    int n;
    __int64 exp;
    __int64 maxexp = 0;
    __int64 totalexp;
    int level = ((lpTargetObj->Level + 25) * lpTargetObj->Level) / 3;
    int number;
    int partynum = 0;
    int totallevel = 0;
    int partylevel;
    int partycount;
    int dis[6];
    int viewplayer = 0;
    int viewpercent = 100;
    BOOL bApplaySetParty = FALSE;
    bool bCheckSetParty[6];
    partynum = lpObj->PartyNumber;
    LPOBJ lpPartyObj;


    int toplevel = 0;
    int distance;

    for (n=0; n<MAX_USER_IN_PARTY; n++)
    {
        number = gParty.m_PartyS[partynum].Number[n];

        if ( number >= 0 )
        {
            lpPartyObj = &gObj[number];

            distance = gObjCalDistance(lpObj,lpPartyObj);

            if( distance < 10 )
            {
                if(lpPartyObj->Level > toplevel)
                {
                    toplevel = lpPartyObj->Level;
                }
            }
        }
    }

    if ( OBJMAX_RANGE(partynum) == FALSE )
    {
        LogAdd("error : %s %d", __FILE__, __LINE__);
        return;
    }

    partycount = gParty.m_PartyS[partynum].Count;

    for ( n =0; n<MAX_USER_IN_PARTY; n++)
    {
        number = gParty.m_PartyS[partynum].Number[n];

        if ( number >= 0 )
        {
            lpPartyObj = &gObj[number];

            if ( lpTargetObj->MapNumber ==lpPartyObj->MapNumber )
            {
                dis[n] = gObjCalDistance(lpTargetObj, &gObj[number]);

                if ( dis[n] < 10 )
                {
                    lpPartyObj = &gObj[number];

                    if ( toplevel >= (lpPartyObj->Level + 200 ) ) // #formula
                    {
                        totallevel = totallevel + lpPartyObj->Level + 200;
                    }
                    else
                    {
                        totallevel += lpPartyObj->Level;
                    }

                    viewplayer++;
                    bCheckSetParty[lpPartyObj->Class] = true;
                }
            }
        }
    }

    viewpercent += gParty.GetExpBonus(lpObj, lpTargetObj, partynum);

    if ( viewplayer > 1 )
    {
        partylevel = totallevel / viewplayer;
    }
    else
    {
        partylevel = totallevel;
    }

    if ( (lpTargetObj->Level +10) < partylevel )
    {
        level = (level * (lpTargetObj->Level+10) ) / partylevel;
    }

    if ( lpTargetObj->Level >= 65 )
    {
        if ( viewplayer == 1 )
        {
            level += (lpTargetObj->Level - 64) * (lpTargetObj->Level/ 4);
        }
        else
        {
            level += (int)(200.0 - (lpObj->Level * 0.2));
        }
    }

    if ( level > 0 )
    {
        maxexp = level / 2;
    }
    else
    {
        level = 0;
    }

    if ( maxexp < 1 )
    {
        totalexp = level;
    }
    else
    {
        totalexp = level + rand()%maxexp;
    }

    if ( lpTargetObj->Type == OBJ_MONSTER )
    {
        lpTargetObj->Money = (int)totalexp;
    }

    for ( n=0; n<MAX_USER_IN_PARTY; n++)
    {
        number = gParty.m_PartyS[partynum].Number[n];

        if ( number >= 0 )
        {
            lpPartyObj = &gObj[number];

            if ( lpTargetObj->MapNumber == lpPartyObj->MapNumber )
            {
                if ( dis[n] < 10 )
                {
                    DWORD myexp = gLevelExperience[lpPartyObj->Level];
                    exp = ((totalexp * viewpercent* lpPartyObj->Level ) / totallevel ) / 100;

                    if ( exp > myexp  )
                    {
                        exp = myexp;
                    }

                    if( lpPartyObj->Type == OBJ_USER )
                    {
                        if ( lpTargetObj->Type == OBJ_USER )
                        {
                            exp = 0;
                        }
                    }

                    if ( g_MasterExp.IsEnabled(lpPartyObj) == FALSE )
                    {
                        exp += (exp * m_ObjBill[lpPartyObj->m_Index].GetExp()) / 100;
                        exp = int(exp * g_MapRateInfo.GetExp(lpPartyObj->MapNumber));
                    }

                    if ( g_CrywolfSync.GetOccupationState() == 1 && g_iCrywolfApplyMvpPenalty != FALSE)
                    {
                        exp =  (exp * g_CrywolfSync.GetGettingExpPenaltyRate()) / 100;
                    }

                    if ( exp > 0 )
                    {
                        if ( lpPartyObj->Type == OBJ_USER )
                        {

                            CheckItemOptForGetExpEx(lpPartyObj,exp,0);

                            lpPartyObj->Experience += (DWORD)exp;
                            lpPartyObj->m_nEventExp += (int)exp;

                            if ( gObjLevelUp(lpPartyObj, &exp, lpTargetObj->Class, EVENT_TYPE_PARTY) == false )
                            {
                                continue;
                            }
                        }
                    }

                    if ( lpPartyObj->Type == OBJ_USER )
                    {
                        GCKillPlayerExpSend(lpPartyObj->m_Index, lpTargetObj->m_Index,(int)exp, AttackDamage, MSBFlag);
                    }
                }
            }
        }
    }
}
示例#12
0
bool GensPvP::KillPlayer(int aIndex, int tIndex)
{
	if ( OBJMAX_RANGE(aIndex) == FALSE || OBJMAX_RANGE(tIndex) == FALSE)
	{
		return false;
	}
	if ( gObj[aIndex].Type != OBJ_USER || gObj[aIndex].Connected <= PLAYER_LOGGED )
	{
		return false;
	}
	if ( gObj[tIndex].Type != OBJ_USER || gObj[tIndex].Connected <= PLAYER_LOGGED )
	{
		return false;
	}
	if((gObj[aIndex].GensFam != 0 && gObj[tIndex].GensFam != 0) && (gObj[aIndex].GensFam != gObj[tIndex].GensFam))
	{
		int myLevel = gObj[aIndex].Level + gObj[aIndex].MasterCharacterInfo->MasterLevel;
		int tLevel = gObj[tIndex].Level + gObj[tIndex].MasterCharacterInfo->MasterLevel;
		if(myLevel >= tLevel)
		{
			int Dif = myLevel - tLevel;
			//Less
			for(int i=0;i<this->KillLessCount;i++)
			{
				if(Dif >= this->KillLess[i].MinLevel && Dif <= this->KillLess[i].MaxLevel)
				{
					if(this->WinPointsIfRivalDoesntHavePoints == 0 && gObj[tIndex].GensCont <=0)
					{
					}else
					{
						gObj[aIndex].GensCont += this->KillLess[i].ContKill;
					}
				}				
			}
			for(int i=0;i<this->KillMoreCount;i++)
			{
				if(Dif >= this->KillMore[i].MinLevel && Dif <= this->KillMore[i].MaxLevel)
				{
					gObj[tIndex].GensCont -= this->KillMore[i].ContKill;
				}				
			}
		}else
		{
			int Dif = tLevel - myLevel;
			//More
			for(int i=0;i<this->KillMoreCount;i++)
			{
				if(Dif >= this->KillMore[i].MinLevel && Dif <= this->KillMore[i].MaxLevel)
				{
					if(this->WinPointsIfRivalDoesntHavePoints == 0 && gObj[tIndex].GensCont <=0)
					{
					}else
					{
						gObj[aIndex].GensCont += this->KillMore[i].ContKill;
					}
				}				
			}
			for(int i=0;i<this->KillLessCount;i++)
			{
				if(Dif >= this->KillLess[i].MinLevel && Dif <= this->KillLess[i].MaxLevel)
				{
					gObj[tIndex].GensCont -= this->KillLess[i].ContKill;
				}				
			}
		}
		if(gObj[aIndex].GensCont < 0)
			gObj[aIndex].GensCont = 0;
		if(gObj[tIndex].GensCont < 0)
			gObj[tIndex].GensCont = 0;
		this->Ranking(aIndex);
		this->Ranking(tIndex);

		qs5.KillPlayerGensEnemy(aIndex);
#if (PACK_EDITION>=3)
		GensCloseMap.AddKills(aIndex);
#endif
		gObj[aIndex].PlayerExtraInfoModified = 1;
		gObj[tIndex].PlayerExtraInfoModified = 1;
		return true;
	}
	return false;
}
示例#13
0
void MonsterHerd::BeenAttacked(LPOBJ lpObj, LPOBJ lpTargetObj)
{
	if ( lpObj == NULL )
	{
		return;
	}

	if ( lpObj->Connected != PLAYER_PLAYING || lpObj->Type != OBJ_MONSTER )
	{
		return;
	}

	if ( lpTargetObj->Connected != PLAYER_PLAYING )
	{
		return;
	}

	if ( this->m_bHerdActive == 0 )
	{
		return;
	}

	for ( std::map<int, _MONSTER_HERD_DATA>::iterator it = this->m_mapMonsterHerd.begin(); it != this->m_mapMonsterHerd.end() ; it++)
	{
		_MONSTER_HERD_DATA * lpMHD = &it->second;

		if (  OBJMAX_RANGE(lpMHD->m_iIndex)== FALSE )
		{
			continue;
		}

		if ( gObj[lpMHD->m_iIndex].Live == FALSE || gObj[lpMHD->m_iIndex].m_State != 2 )
		{
			continue;
		}

		if ( gObj[lpMHD->m_iIndex].m_lpMonsterHerd != lpObj->m_lpMonsterHerd )
		{
			continue;
		}

		if ( lpMHD->m_iIndex == lpObj->m_Index )
		{
			continue;
		}

		if ( gObj[lpMHD->m_iIndex].TargetNumber == -1 )
		{
			if ( Random(0,99) < 70 )
			{
				gObj[lpMHD->m_iIndex].TargetNumber = lpTargetObj->m_Index;
				gObj[lpMHD->m_iIndex].m_ActState.Emotion = 1;
				gObj[lpMHD->m_iIndex].m_ActState.EmotionCount = 50;
				continue;
			}
		}
		else if ( Random(0,99) < 30 )
		{
			gObj[lpMHD->m_iIndex].TargetNumber = lpTargetObj->m_Index;
			gObj[lpMHD->m_iIndex].m_ActState.Emotion = 1;
			gObj[lpMHD->m_iIndex].m_ActState.EmotionCount = 50;
			continue;
		}
	}
}
示例#14
0
void GensPvP::RewardRank(int aIndex)
{
	if(OBJMAX_RANGE(aIndex) == 0)
	{
		return;
	}

	PMSG_GENSREPLY pResult = {0};
	PHeadSubSetB((LPBYTE)&pResult,0xF8,0x0A,sizeof(PMSG_GENSREPLY));
	LPOBJ lpObj = &gObj[aIndex];
	int Family = 0;

	if(lpObj->m_IfState.type >= 100 && lpObj->m_IfState.type <= 101)
	{
		Family = lpObj->m_IfState.type - 99;
	}else
	{
		//error
		return;
	}

	if (lpObj->PlayerExtraInfoReceived != 1)
	{
		GCServerMsgStringSend ("ERROR: Please relogin!",lpObj->m_Index,0x01 ) ;
		LogAddC(2, "ERROR: GENS Info [%s][%s] Line: %d", lpObj->AccountID, lpObj->Name, __LINE__);
		return;
	}

	//BYTE TempInventoryMap[BASIC_INVENTORY_SIZE + (MAX_EXTENDED_INV*EXTENDED_INV_SIZE)];
	//memcpy(TempInventoryMap,gObj[aIndex].pInventoryMap,ReadConfig.GETSLOTS(aIndex));

	this->Ranking(aIndex);
	SYSTEMTIME sysTime;
	GetLocalTime(&sysTime);
	if(sysTime.wDay >= 7)
	{
		//Gens ranking rewards are given out in the first week of each month
		pResult.state = 1;
		goto DSEND;
	}
	if(gObj[aIndex].GensLevel > 8)
	{
		//Regrettably, you are not eligible for a reward. Please try harder next time
		pResult.state = 2;
		goto DSEND;
	}

	if(lpObj->RecvRewItem != 0)
	{
		//The reward has already been handed out
		pResult.state = 4;
		goto DSEND;
	}

	if(lpObj->GensFam != Family)
	{
		//U r member of different fam
		pResult.state = 5;
		goto DSEND;
	}
	if(lpObj->GensFam == 0)
	{
		//U r not joined the gens
		pResult.state = 6;
		goto DSEND;
	}

	if(this->CheckInvFree(aIndex) == false)
	{
		//You do not have enough space for the item. Please free up your inventory and try again.
		pResult.state = 3;
		goto DSEND;
	}

	pResult.state = 0;

	BYTE Num = gObj[aIndex].GensLevel -1;
	for(int x=0;x<this->rItem[Num].Count;x++)
	{
		int item = ITEMGET(this->rItem[Num].Type,this->rItem[Num].Index);
		ItemSerialCreateSend(aIndex, 235, 0, 0, item, this->rItem[Num].Level, this->rItem[Num].Dur, this->rItem[Num].Skill, this->rItem[Num].Luck, this->rItem[Num].Opt, -1, this->rItem[Num].Exc, 0);
	}
	lpObj->RecvRewItem = 1;
	gObj[aIndex].PlayerExtraInfoModified = 1;
	LogAddTD("[GensPvP] [%s][%s] Get Rank Reward", lpObj->AccountID, lpObj->Name);

DSEND:
	DataSend(aIndex,(UCHAR *)&pResult, pResult.h.size);
}
示例#15
0
void GensPvP::LeaveGens(int aIndex)
{
	if(OBJMAX_RANGE(aIndex) == 0)
	{
		return;
	}

	PMSG_GENSREPLY pResult = {0};
	PHeadSubSetB((LPBYTE)&pResult,0xF8,4,sizeof(PMSG_GENSREPLY));

	LPOBJ lpObj = &gObj[aIndex];
	int Family = 0;
	if(lpObj->m_IfState.type >= 100 && lpObj->m_IfState.type <= 101)
	{
		Family = lpObj->m_IfState.type - 99;
	}else
	{
		//error
		return;
	}

	if (lpObj->PlayerExtraInfoReceived != 1)
	{
		GCServerMsgStringSend ("ERROR: Please relogin!",lpObj->m_Index,0x01 ) ;
		LogAddC(2, "ERROR: GENS Info [%s][%s] Line: %d", lpObj->AccountID, lpObj->Name, __LINE__);
		return;
	}

	if(lpObj->GensFam == 0)
	{
		//U Must Have a Gens fam before leave it
		pResult.state = 1;
		goto DSEND;
	}

	if(lpObj->GensFam != Family)
	{
		//U r member of different fam
		pResult.state = 3;
		goto DSEND;
	}

	if(lpObj->GuildNumber > 0)
	{		
		if(lpObj->lpGuild != NULL)
		{
			if ( strcmp(gObj[aIndex].lpGuild->Names[0], gObj[aIndex].Name) == 0) // Case Guild Master
			{
				if(this->AllowLeaveGM == 0)
				{
					//GMs Cant leave Gens Family
					pResult.state = 2;
					goto DSEND;
				}else
				{
					lpObj->lpGuild->GensFam = 0;
				}
			}
		}
	}
	//All Ok Leave in GENS Family

	LogAddTD("[GensPvP] [%s][%s] Leave Gens Family", lpObj->AccountID, lpObj->Name);

	pResult.state = 0;

	lpObj->GensFam = 0;
	lpObj->GensCont = 0;
	lpObj->GensLevel = 0;
	if(this->AllowJoinIfLeftLessThan3Days == 0)
		lpObj->GensNotAllow = 1;
	lpObj->RecvRewItem = 0;


	DataSend(aIndex,(UCHAR *)&pResult, pResult.h.size);

	qs5.RemoveGensQuest(aIndex);
	this->Ranking(aIndex);
	gObjViewportListProtocolCreate(lpObj);
	gObj[aIndex].PlayerExtraInfoModified = 1;
	return;

DSEND:
	DataSend(aIndex,(UCHAR *)&pResult, pResult.h.size);
}
示例#16
0
void GensPvP::JoinGens(int aIndex)
{
	if(OBJMAX_RANGE(aIndex) == 0)
	{
		return;
	}

	PMSG_GENSREPLY pResult = {0};
	PHeadSubSetB((LPBYTE)&pResult,0xF8,0x02,sizeof(PMSG_GENSREPLY));

	LPOBJ lpObj = &gObj[aIndex];
	int Family = 0;
	if(lpObj->m_IfState.type >= 100 && lpObj->m_IfState.type <= 101)
	{
		Family = lpObj->m_IfState.type - 99;
	}else
	{
		//error
		return;
	}
	
	if (lpObj->PlayerExtraInfoReceived != 1)
	{
		GCServerMsgStringSend ("ERROR: Please relogin!",lpObj->m_Index,0x01 ) ;
		LogAddC(2, "ERROR: GENS Info [%s][%s] Line: %d", lpObj->AccountID, lpObj->Name, __LINE__);
		return;
	}

	if(lpObj->GensFam != 0)
	{
		//U r already in a family
		pResult.state = 1;
		goto DSEND;
	}
	if(lpObj->GensNotAllow == 1 && this->AllowJoinIfLeftLessThan3Days == 0)
	{
		//You can not join coz need to pass 3 days before join again
		pResult.state = 2;
		goto DSEND;
	}
	if(lpObj->Level < this->MinLevel)
	{
		//Need X Level to Join in Gens
		pResult.state = 3;
		goto DSEND;
	}

	if(lpObj->Resets < this->MinReset)
	{
		//Need X Level to Join in Gens
		char sbuf[100]={0};
		wsprintf(sbuf,"You need %d Resets before join Gens",this->MinReset);
		GCServerMsgStringSend(sbuf,lpObj->m_Index, 0x01);
		pResult.state = 3;
		goto DSEND;
	}

	if(lpObj->PartyNumber >= 0 && this->AllowJoinInParty == 0)
	{
		//Cant Join if you are in Party
		pResult.state = 6;
		goto DSEND;
	}
	
	if(lpObj->GuildNumber > 0)
	{			
		
		//DWORD dwGuildNumber = lpObj->GuildNumber;
		//_GUILD_INFO_STRUCT * lpGuildInfo = Guild.SearchGuild_Number(dwGuildNumber);

		if(lpObj->lpGuild != NULL)
		{
			if(lpObj->lpGuild->GensFam != Family && lpObj->lpGuild->GensFam != 0 && this->AllowJoinIfGuildMemberIsInOtherGens == 0)
			{
				//Your GM is in other family
				pResult.state = 4;
				goto DSEND;
			}else if(lpObj->lpGuild->GensFam == 0 && ( strcmp(lpObj->Name, lpObj->lpGuild->Names[0] ) ) && this->AllowJoinInGuild == 0)
			{
				//Your GM must be in gens before join you
				pResult.state = 5;
				goto DSEND;
			}else
			{
				TUnionInfo * pUnionInfo = UnionManager.SearchUnion(lpObj->lpGuild->iGuildUnion);

				if ( pUnionInfo && this->AllowJoinInGuildAlliance == 0)
				{
					//Cant join if you are in guild alliance
					pResult.state = 7;
					goto DSEND;
				}else
				{	
					if(this->AllowJoinIfGuildMemberIsInOtherGens == 0)
					{
						for ( int n=0;n<MAX_USER_GUILD;n++)
						{
							if ( lpObj->lpGuild->Use[n] == TRUE )
							{
								int gpIndex = gObjGetIndex(lpObj->lpGuild->Names[n]);
								if ( gpIndex != -1 )
								{
									if(gObj[gpIndex].GensFam != Family && gObj[gpIndex].GensFam != 0)
									{
										//Your guild is part of a different gens
										pResult.state = 4;
										goto DSEND;
									}
								}
							}
						}
					}
				}
			}
		}
	}

	//All Ok Join in GENS Family
	pResult.state = 0;

	lpObj->GensFam = Family;
	lpObj->GensCont = 0;
	lpObj->RecvRewItem = 0;
	lpObj->GensLevel = 14;

	gObj[aIndex].PlayerExtraInfoModified = 1;
	gObjViewportListProtocolCreate(&gObj[aIndex]);
	LogAddTD("[GensPvP] [%s][%s] Join Gens Family", lpObj->AccountID, lpObj->Name);

	if(lpObj->GuildNumber > 0)
	{			
		if(lpObj->lpGuild != NULL)
		{
			if ( strcmp(lpObj->lpGuild->Names[0], lpObj->Name) == 0) // Case Guild Master
			{
				lpObj->lpGuild->GensFam = Family;
				if(this->JoinGuildIntoGensWhenYouAreGM == 1)
				{
					for ( int n=0;n<MAX_USER_GUILD;n++)
					{
						if ( lpObj->lpGuild->Use[n] == TRUE )
						{
							int gpIndex = gObjGetIndex(lpObj->lpGuild->Names[n]);
							if ( gpIndex != -1 && gpIndex != aIndex )
							{
								if(gObj[gpIndex].GensFam == 0)
								{
									if (gObj[gpIndex].PlayerExtraInfoReceived != 1)
									{
										GCServerMsgStringSend ("ERROR: Please relogin!",gpIndex,0x01 ) ;
										LogAddC(2, "ERROR: GENS Info [%s][%s] Line: %d", lpObj->AccountID, lpObj->Name, __LINE__);
										continue;
									}
									gObj[gpIndex].PlayerExtraInfoModified = 1;
									gObj[gpIndex].RecvRewItem = 0;
									gObj[gpIndex].GensFam = Family;
									gObj[gpIndex].GensCont = 0;
									gObj[gpIndex].GensLevel = 14;
									this->Ranking(gpIndex);
									gObjViewportListProtocolCreate(&gObj[gpIndex]);
									LogAddTD("[GensPvP] [%s][%s] Leave Gens Family", gObj[gpIndex].AccountID, gObj[gpIndex].Name);
								}
							}
						}
					}
				}
			}
		}
	}
	
	DataSend(aIndex,(UCHAR *)&pResult, pResult.h.size);
	this->Ranking(aIndex);
	return;

DSEND:
	DataSend(aIndex,(UCHAR *)&pResult, pResult.h.size);
}
示例#17
0
BOOL TMonsterAIUtil::GetXYToChase(LPOBJ lpObj)
{
	int tpx;	// Target Player X
	int tpy;
	int mtx;	// Monster Target X
	int mty;
	int searchp = 0;
	int sn = 0;
	int searchcount = MAX_ROAD_PATH_TABLE/2-1;
	BYTE attr;
	BOOL result = 0;
	LPOBJ lpTargetObj;

	if ( OBJMAX_RANGE(lpObj->TargetNumber) == FALSE )
	{
		return FALSE;
	}

	lpTargetObj = &gObj[lpObj->TargetNumber];
	tpx = lpTargetObj->X;
	mtx = tpx;
	tpy = lpTargetObj->Y;
	mty = tpy;
	int dis = lpObj->m_AttackRange / sqrt(2.0);

	if ( lpObj->X < mtx )
	{
		tpx -= dis;
	}

	if ( lpObj->X > mtx )
	{
		tpx += dis;
	}

	if ( lpObj->Y < mty )
	{
		tpy -= dis;
	}

	if ( lpObj->Y > mty )
	{
		tpy += dis;
	}

	searchp = GetPathPacketDirPos( (lpTargetObj->X - tpx), (lpTargetObj->Y - tpy) ) * 2;

	if ( MapC[lpObj->MapNumber].GetStandAttr(tpx, tpy) == 0 )
	{
		while ( searchcount-- )
		{
			mtx = lpTargetObj->X + RoadPathTable[searchp];
			mty = lpTargetObj->Y + RoadPathTable[1+searchp];
			attr = MapC[lpObj->MapNumber].GetAttr(mtx, mty);
			
			if ( (attr&1) != 1 && (attr&2) != 2 && (attr&4) != 4 && (attr&8) != 8  )
			{
				lpObj->MTX = mtx;
				lpObj->MTY = mty;
				return TRUE;
			}

			searchp += 2;

			if ( searchp > MAX_ROAD_PATH_TABLE-1 )
			{
				searchp = 0;
			}
		}

		return FALSE;
	}

	attr = MapC[lpObj->MapNumber].GetAttr(tpx, tpy);

	if ( (attr&1) != 1 && (attr&2) != 2 && (attr&4) != 4 && (attr&8) != 8  )
	{
		lpObj->MTX = tpx;
		lpObj->MTY = tpy;
		return TRUE;
	}

	return FALSE;
}
示例#18
0
int CIllusionTempleEvent::ChaosMixItemGet(int iIndex)
{
	if( OBJMAX_RANGE(iIndex) == FALSE )
	{
		return FALSE;
	}

	int Empty = FALSE;
	int bChaos = FALSE;
	int bScroll = FALSE;
	int bPotion = FALSE;
	int bOtherItem = FALSE;
	int iItemCount = 0;
	int iScrollLevel = 0;
	int iPotionLevel = 0;
	int iCharmOfLuckCount = 0;

	for(int n = 0; n < CHAOS_BOX_SIZE; n++)
	{
		if( gObj[iIndex].pChaosBox[n].IsItem() == TRUE )
		{
			if( gObj[iIndex].pChaosBox[n].m_Type == ITEMGET(12,15) )
			{
				bChaos = TRUE;
			}
			else if( gObj[iIndex].pChaosBox[n].m_Type == ITEMGET(13,49) )
			{
				int iLevel = gObj[iIndex].pChaosBox[n].m_Level;
				iItemCount++;
				bScroll = TRUE;
				iScrollLevel = iLevel;
			}
			else if( gObj[iIndex].pChaosBox[n].m_Type == ITEMGET(13,50) )
			{
				int iLevel = gObj[iIndex].pChaosBox[n].m_Level;
				iItemCount++;
				bPotion = TRUE;
				iPotionLevel = iLevel;
			}
			else if( gObj[iIndex].pChaosBox[n].m_Type == ITEMGET(14,53) )
			{
				iCharmOfLuckCount += (int)gObj[iIndex].pChaosBox[n].m_Durability;
			}
			else
			{
				bOtherItem = TRUE;
			}
		}
	}

	if( bOtherItem != FALSE )
	{
		return 8;
	}

	if( bScroll == FALSE && bPotion == FALSE )
	{
		return 0;
	}

	if( bScroll == FALSE || bPotion == FALSE )
	{
		return 11;
	}

	if( iItemCount > 2 )
	{
		return 12;
	}

	if( iScrollLevel != iPotionLevel )
	{
		return 9;
	}

	if( IT_TEMPLE_RANGE( iScrollLevel - 1 ) == FALSE )
	{
		return 9;
	}

	if( IT_TEMPLE_RANGE( iPotionLevel - 1 ) == FALSE )
	{
		return 9;
	}

	if( bChaos == FALSE )
	{
		return 10;
	}

	if( gObj[iIndex].Level < 10 )
	{
		return 14;
	}

	if( bChaos != FALSE && bScroll != FALSE && bPotion != FALSE )
	{
		return iScrollLevel;
	}

return FALSE;
}
//good
void TMonsterSkillManager::UseMonsterSkill(int iIndex, int iTargetIndex, int iMonsterSkillUnitType, int iMonsterSkillUnit,CMagicInf * lpMagic)
{
	if (iIndex >= OBJ_MAXMONSTER || iIndex < 0)
	{
		LogAddC(2,"[TMonsterSkillManager][UserMonsterSkill] error: iIndex(%d)",iIndex);
		return;
	}

	if (iTargetIndex >= OBJMAX || iTargetIndex < 0)
	{
		LogAddC(2,"[TMonsterSkillManager][UserMonsterSkill] error: iTargetIndex(%d)",iTargetIndex);
		return;
	}

	LPOBJ lpObj = &gObj[iIndex]; //loc1
	LPOBJ lpTargetObj = &gObj[iTargetIndex]; //loc2
	TMonsterSkillInfo * lpMonsterSkillInfo = &TMonsterSkillManager::s_MonsterSkillInfoArray[lpObj->Class]; //loc3

	if ( lpMonsterSkillInfo->IsValid() == FALSE )
		return;
	
	TMonsterSkillUnit * lpMonsterSkillUnit = NULL; //loc4

	if ( iMonsterSkillUnit > -1) //arg4
	{
		int iMonsterSkill = iMonsterSkillUnit; //loc5

		lpMonsterSkillUnit = lpMonsterSkillInfo->m_lpSkillUnitArray[iMonsterSkill];
	}
	else
	{
		lpMonsterSkillUnit = TMonsterSkillManager::FindMonsterSkillUnit(iIndex, iMonsterSkillUnitType);
	}

	if ( lpMonsterSkillUnit == NULL )
	{
		LogAddC(2, "[Monster Skill Manager] SkillUnit is NULL : ObjIndex[%d], SkillUnitType[%d] ",iIndex,iMonsterSkillUnitType);
		return;
	}

	GCUseMonsterSkillSend(lpObj, lpTargetObj, lpMonsterSkillUnit->m_iUnitNumber);

	//TEST
	//char szTemp[256];
	//wsprintf(szTemp, "[USEMONSTERSKILL] %d", lpMonsterSkillUnit->m_iUnitNumber);
	//GCServerMsgStringSend(szTemp, lpTargetObj->m_Index, 1);

	if ( lpMonsterSkillUnit->m_iUnitScopeType == -1 )
	{
		if ( lpObj->MapNumber == MAP_INDEX_RAKLION )
		{
			gObjAttack(lpObj, lpTargetObj, NULL, FALSE, 0, 0, FALSE);
		}
        if ( lpObj->MapNumber == MAP_INDEX_RAKLION_BOSS )
        {
			if ( lpObj->Class == 459 )
			{
                if ( lpMonsterSkillUnit->m_iUnitNumber == 40 )
                {
					gObjAttack(lpObj, lpTargetObj, NULL, FALSE, 0, 0, FALSE);
                }
				else
                {
					if ( lpMagic )
					{
						gObjAttack(lpObj, lpTargetObj,lpMagic, 0, 0, 0, 0);
					}
                }
            }
            else
            {
                gObjAttack(lpObj, lpTargetObj, 0, 0, 0, 0, 0);
            }
        }

		lpMonsterSkillUnit->RunSkill(iIndex, iTargetIndex);
	}
	else
	{
		int iCount = 0;
		int iRangeTargetIndex = -1;
		int iAngle = gObjUseSkill.GetAngle(lpObj->X, lpObj->Y, lpTargetObj->X, lpTargetObj->Y);

		while ( true )
		{
			if ( lpObj->VpPlayer2[iCount].state )
			{
				iRangeTargetIndex = lpObj->VpPlayer2[iCount].number;

				if ( OBJMAX_RANGE(iRangeTargetIndex))
				{
					if ( gObj[iRangeTargetIndex].Type == OBJ_USER )
					{
						BOOL bTargetOK = FALSE;

						if ( lpMonsterSkillUnit->m_iUnitScopeType == 0 )
						{
							if ( gObjCalDistance(lpObj, &gObj[iRangeTargetIndex]) < lpMonsterSkillUnit->m_iUnitScopeValue )
							{
								bTargetOK = TRUE;
							}
						}
						else  if ( lpMonsterSkillUnit->m_iUnitScopeType == 1 )
						{
							if ( SkillElectricSparkHitBox.HitCheck(iAngle, lpObj->X, lpObj->Y,
								gObj[iRangeTargetIndex].X, gObj[iRangeTargetIndex].Y) )
							{
								bTargetOK = TRUE;
							}
						}
						else if ( lpMonsterSkillUnit->m_iUnitScopeType == 2 )
						{
							bTargetOK = TRUE;
						}
						else if ( lpMonsterSkillUnit->m_iUnitScopeType == 3 )
						{
							bTargetOK = TRUE;
						}

						if ( bTargetOK )
						{
							if ( lpObj->MapNumber == MAP_INDEX_RAKLION )
							{
								gObjAttack(lpObj, lpTargetObj, NULL, FALSE, 0, 0, FALSE);
							}
							if ( lpObj->MapNumber == MAP_INDEX_RAKLION_BOSS )
							{
								if ( lpObj->Class == 459 )
								{
									if ( lpMonsterSkillUnit->m_iUnitNumber == 40 )
									{
										gObjAttack(lpObj, lpTargetObj, NULL, FALSE, 0, 0, FALSE);
									}
									else
									{
										if ( lpMagic )
										{
											gObjAttack(lpObj, lpTargetObj,lpMagic, 0, 0, 0, 0);
										}
									}
								}
								else
								{
									gObjAttack(lpObj, lpTargetObj, 0, 0, 0, 0, 0);
								}
							}

							lpMonsterSkillUnit->RunSkill(iIndex, iRangeTargetIndex);
						}
					}
				}
			}

			iCount++;

			if ( iCount > MAX_VIEWPORT_MONSTER-1)
				break;
		}
	}
}
BYTE CIllusionTempleEvent::IllusionTempleChaosMix(int nIndex, int nLEVEL, int iCharmOfLuckCount)
{
	if( OBJMAX_RANGE(nIndex) == FALSE )
	{
		return FALSE;
	}

	if ( IT_MAP_RANGE((nLEVEL+(45-1))) == FALSE )
	{
		return FALSE;
	}

	int loc2 = 0;

	PMSG_CHAOSMIXRESULT pMsg;
	PHeadSetB((LPBYTE)&pMsg.h, 0x86, sizeof(PMSG_CHAOSMIXRESULT));
	pMsg.Result = CB_ERROR;

	gObj[nIndex].ChaosLock = TRUE;
	LogAddTD("[Illusion Temple] 피의 두루마리 Mix Chaos Mix Start (Account:%s, Name:%s, Level:%d)", gObj[nIndex].AccountID, gObj[nIndex].Name, nLEVEL);

	char szTemp[17];
	wsprintf(szTemp, "피의 두루마리 Mix,%d", nLEVEL);

	g_MixSystem.LogChaosItem(&gObj[nIndex], szTemp);

	int iMIX_SUCCESS_RATE = g_iIT_ChoasMixSuccessRate[nLEVEL-1]; //loc11

	if ( iMIX_SUCCESS_RATE < 0 || iMIX_SUCCESS_RATE > 100 )
	{
		DataSend(nIndex, (LPBYTE)&pMsg, pMsg.h.size);
		LogAddTD("[Illusion Temple] 피의 두루마리 Mix Chaos Mix Failed - MixRate Out of Bound (Account:%s, Name:%s, Level:%d)", gObj[nIndex].AccountID, gObj[nIndex].Name, nLEVEL);
		return FALSE;
	}

	if ( g_CrywolfSync.GetOccupationState() == 0 && g_iCrywolfApplyMvpBenefit )
	{
		iMIX_SUCCESS_RATE += g_CrywolfSync.GetPlusChaosRate();
	}

	int iMIX_NEED_MONEY = g_iIT_ChoasMixMoney[nLEVEL-1]; //loc12

	int iChaosTaxMoney = (int)((__int64)(iMIX_NEED_MONEY) * (__int64)(g_CastleSiegeSync.GetTaxRateChaos(nIndex)) / (__int64)100); //loc13

	if ( iChaosTaxMoney < 0 )
	{
		iChaosTaxMoney = 0;
	}

	iMIX_NEED_MONEY += iChaosTaxMoney;

	if ( iMIX_NEED_MONEY <  0 )
	{
		DataSend(nIndex, (LPBYTE)&pMsg, pMsg.h.size);
		LogAddTD("[Illusion Temple] 피의 두루마리 Mix Chaos Mix Failed - MixMoney < 0 (Account:%s, Name:%s, Level:%d)",	gObj[nIndex].AccountID, gObj[nIndex].Name, nLEVEL);
		return FALSE;
	}

	if ( (gObj[nIndex].Money - iMIX_NEED_MONEY) < 0 )
	{
		pMsg.Result = CB_BC_NOT_ENOUGH_ZEN;
		DataSend(nIndex, (LPBYTE)&pMsg, pMsg.h.size);
		LogAddTD("[Illusion Temple] 피의 두루마리 Mix Chaos Mix Failed - Not Enough Money (Account:%s, Name:%s, Level:%d)",	gObj[nIndex].AccountID, gObj[nIndex].Name, nLEVEL);
		return FALSE;
	}

	gObj[nIndex].Money -= iMIX_NEED_MONEY;
	g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney);
	GCMoneySend(nIndex, gObj[nIndex].Money);

	iMIX_SUCCESS_RATE += iCharmOfLuckCount; //season 3.0 moved

	if ( (rand()%100) < iMIX_SUCCESS_RATE )	// Success (season 3.0 changed)
	{
		int item_num = ITEMGET(13,51);	// Blood Scroll loc14
		ItemSerialCreateSend(nIndex, -1, 0, 0, item_num, nLEVEL, 0, 0, 0, 0, -1, 0, 0);
		LogAddTD("[피의 두루마리 Mix] [%s][%s] CBMix Success %d Money : %d-%d, CharmRate : %d",	gObj[nIndex].AccountID, gObj[nIndex].Name, iMIX_SUCCESS_RATE, gObj[nIndex].Money, iMIX_NEED_MONEY, iCharmOfLuckCount);
	}
	else
	{
		g_MixSystem.ChaosBoxInit(&gObj[nIndex]);
		GCUserChaosBoxSend(&gObj[nIndex], 0);
		DataSend(nIndex, (LPBYTE)&pMsg, pMsg.h.size);
		LogAddTD("[피의 두루마리 Mix] [%s][%s] CBMix Fail %d Money : %d-%d, CharmRate : %d", gObj[nIndex].AccountID, gObj[nIndex].Name, iMIX_SUCCESS_RATE, gObj[nIndex].Money, iMIX_NEED_MONEY, iCharmOfLuckCount);
		return FALSE;
	}

	::gObjInventoryCommit(nIndex);
	return TRUE;
}
示例#21
0
int CIllusionTempleEvent::GetEnterLevel(int aIndex)
{
	int TempleLevel = 0;
	LPOBJ lpObj = &gObj[aIndex];

	if( OBJMAX_RANGE( aIndex ) == FALSE )
	{
		LogAdd("return %s %d",__FILE__,__LINE__);
		return -1;
	}

	if( lpObj->Level < 220 )
	{
		return 0;
	}

	if( lpObj->Level < 271 )
	{
		return 1;
	}

	if( lpObj->Level < 321 )
	{
		return 2;
	}

	if( lpObj->Level < 351 )
	{
		return 3;
	}

	if( lpObj->Level < 381 )
	{
		return 4;
	}

	if( lpObj->Level < 400 )
	{
		return 5;
	}

	if( lpObj->Level == 400 )
	{
		if( lpObj->ChangeUP == FALSE )
		{
			return 5;
		}
	}

	if( lpObj->Level == 400 )
	{
		if( lpObj->ChangeUP != FALSE )
		{
			if( g_bMaxLevelIllusion != 0 )
			{
				return 6;
			}
			else
			{
				return 5;
			}
		}
	}
return -1;
}
示例#22
0
void JGAnsMapSvrAuth(PMSG_ANS_MAPSVRAUTH * lpMsg)
{
    if ( !OBJMAX_RANGE(lpMsg->iIndex))
    {
        LogAdd( "[MapServerMng] Packet Error JG [0x7B] - Index out of bound : %d",
                lpMsg->iIndex);

        return;
    }

    LPOBJ lpObj = &gObj[lpMsg->iIndex];
    memcpy(lpObj->Name, lpMsg->szCharName, MAX_ACCOUNT_LEN);


    if ( lpObj->m_bMapSvrMoveReq == false )
    {
        LogAdd( "[MapServerMng] MapSvr MoveReq Error JG [0x7B] - No Request [%s] (%d)",
                lpObj->AccountID, lpObj->m_Index);

        gObjDel(lpMsg->iIndex);
        return;
    }

    BOOL bAuthOK = FALSE;
    int iSendResult = 0;
    char szId[11];
    char szJN[14] = "";
    int iIndex = lpMsg->iIndex;
    SDHP_DBCHARINFOREQUEST pMsg;
    char szName[11];

    memset(szId, 0, sizeof(szId));
    memcpy(szId, lpMsg->szAccountID, MAX_ACCOUNT_LEN);
    memcpy(szJN, lpMsg->cJoominNumber, sizeof(lpMsg->cJoominNumber));

    switch ( lpMsg->iResult )
    {
    case 0:
        iSendResult = 0;
        bAuthOK = FALSE;

        if ( !gObjSetAccountLogin(iIndex, szId, lpMsg->iUserNumber, lpMsg->iDBNumber, szJN))
        {
            GJPAccountFail(iIndex, szId, lpMsg->iDBNumber, lpMsg->iUserNumber);
            lpMsg->iResult = 4;
        }
        else
        {
            LogAdd("***0467*** login     : (%s)[%s] number:%d/ db:%d", gObj[iIndex].Ip_addr, szId, lpMsg->iUserNumber, lpMsg->iDBNumber);
            iSendResult = 1;
            bAuthOK = TRUE;
        }

        if ( lpMsg->iUserNumber == 0 && lpMsg->iDBNumber == 0 )
        {
            LogAdd("Both user number and DB number are 0 (%s) %d %d", szId, lpMsg->iUserNumber, lpMsg->iDBNumber);
        }

        switch ( lpMsg->btBlockCode )
        {
        case 70:	// 0x46
            gObj[iIndex].m_cAccountItemBlock = 1;
            break;
        }
        break;

    default:
        iSendResult = 0;
        bAuthOK = FALSE;
        break;
    }

    GCAnsMapSvrAuth(iIndex, iSendResult);

    if ( bAuthOK == FALSE )
    {
        LogAdd( "[MapServerMng] [%s][%s] JG [0x7B] - Join Result Failed : RST:%d, BLK:%c",
                szId, lpMsg->szCharName, lpMsg->iResult, lpMsg->btBlockCode);
        gObjDel(lpMsg->iIndex);

        return;
    }

    gObj[iIndex].m_sPrevMapSvrCode = lpMsg->wPrevMapSvrCode;
    gObj[iIndex].m_sDestMapNumber  = lpMsg->wMapNumber;
    gObj[iIndex].m_btDestX = lpMsg->btX;
    gObj[iIndex].m_btDestY = lpMsg->btY;
    gObj[iIndex].bEnableDelCharacter = FALSE;

    PHeadSetB((LPBYTE)&pMsg, 0x06, sizeof(pMsg));
    memset(szName, 0, sizeof(szName));
    memcpy(szName, lpMsg->szCharName, MAX_ACCOUNT_LEN);
    BuxConvert(szName, MAX_ACCOUNT_LEN);
    memcpy(pMsg.Name, szName, MAX_ACCOUNT_LEN);
    strcpy_s(pMsg.AccountID, sizeof(pMsg.AccountID), lpMsg->szAccountID);
    pMsg.Number = lpObj->m_Index;

    wsDataServerCli.DataSend((PCHAR)&pMsg, pMsg.h.size);

    LogAdd("[MapServerMng] [%s][%s] JG [0x7B] - Join Result OK : RST:%d, BLK:%c",
           szId, lpMsg->szCharName, lpMsg->iResult, lpMsg->btBlockCode);

}
示例#23
0
BYTE CIllusionTempleEvent::TicketMix(int iIndex, int iLevel, int iCharmCount)
{
	if( OBJMAX_RANGE( iIndex ) == FALSE )
	{
		return FALSE;
	}

	if( IT_MAP_RANGE( iLevel + (MAP_INDEX_ILLUSIONTEMPLE1 - 1)) == FALSE )
	{
		return FALSE;
	}

	int Empty = 0;
	PMSG_CHAOSMIXRESULT pMsg;
	PHeadSetB((LPBYTE)&pMsg,0x86,sizeof(pMsg));

	pMsg.Result = 0;
	gObj[iIndex].ChaosLock = TRUE;

	LogAddTD("[Illusion Temple] Mix Chaos Mix Start (Account:%s, Name:%s, Level:%d)",
		gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel);

	char szTmp[23];

	wsprintf(szTmp,"IllusionTemple Mix,%d",iLevel);
	g_ChaosBox.LogChaosItem(&gObj[iIndex],szTmp);

	int MixRate = IT_TicketRate[-1 + iLevel];

	if( MixRate < 0 || MixRate > 100 )
	{
		DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size);
		LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - MixRate Out of Bound (Account:%s, Name:%s, Level:%d)",
			gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel);
		return FALSE;
	}

	if ( g_CrywolfSync.GetOccupationState() == 0 && g_iCrywolfApplyMvpBenefit )
	{	
		MixRate += g_CrywolfSync.GetPlusChaosRate();
	}

	int iNeedChaosMoney = IT_TicketZen[-1 + iLevel];

	int iChaosTaxMoney = (int)((__int64)iNeedChaosMoney * (__int64)g_CastleSiegeSync.GetTaxRateChaos(iIndex) / (__int64)100);

	if ( iChaosTaxMoney < 0 )
	{
		iChaosTaxMoney = 0;
	}

	iNeedChaosMoney += iChaosTaxMoney;

	if ( iNeedChaosMoney < 0 )
	{
		DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size);
		LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - MixMoney< 0 (Account:%s, Name:%s, Level:%d).",
			gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel);
		return false;
	}

	if ( ( gObj[iIndex].Money - iNeedChaosMoney ) < 0 )
	{
		pMsg.Result = 11;
		DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size);
		LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - Not Enough Money (Account:%s, Name:%s, Level:%d)",
			gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel);
		return false;
	}

	gObj[iIndex].Money -= iNeedChaosMoney;
	g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney);
	GCMoneySend(iIndex, gObj[iIndex].Money);

	MixRate += iCharmCount;

	if( rand() % 100 < MixRate )
	{
#if( __4GAMERS__ == 1 )
			g_Achievements.GD_UpdateMixData(&gObj[iIndex], true);
#endif
		int Item = ITEMGET(13,51);
		ItemSerialCreateSend(iIndex,0xFF,0,0,Item,iLevel,0,0,0,0,-1,0,0);
		LogAddTD("[Illusion Temple] [%s][%s] CBMix Success %d Money : %d-%d, CharmRate : %d",
			gObj[iIndex].AccountID,gObj[iIndex].Name,MixRate,gObj[iIndex].Money,iNeedChaosMoney,iCharmCount);
	}
	else
	{
#if( __4GAMERS__ == 1 )
			g_Achievements.GD_UpdateMixData(&gObj[iIndex], false);
#endif
		g_ChaosBox.ChaosBoxInit(&gObj[iIndex]);
		GCUserChaosBoxSend(&gObj[iIndex], 0);
		DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size);

		LogAddTD("[Illusion Temple] [%s][%s] CBMix Fail %d Money : %d-%d, CharmRate : %d",
			gObj[iIndex].AccountID,gObj[iIndex].Name,MixRate,gObj[iIndex].Money,iNeedChaosMoney,iCharmCount);
		return FALSE;
	}

	gObjInventoryCommit(iIndex);
	return TRUE;
}
示例#24
0
void MonsterHerd::OrderAttack(LPOBJ lpObj, LPOBJ lpTargetObj, int iAttackPercent)
{
	if ( lpObj == NULL )
	{
		return;
	}

	if ( lpObj->Connected < PLAYER_PLAYING || lpObj->Type != OBJ_MONSTER )
	{
		return;
	}

	if ( lpTargetObj->Connected < PLAYER_PLAYING )
	{
		return;
	}

	if ( this->m_bHerdActive == 0 )
	{
		return;
	}

	if ( ((iAttackPercent<0)?FALSE:(iAttackPercent>100)?FALSE:TRUE) == FALSE )
	{
		return;
	}

	for ( std::map<int, _MONSTER_HERD_DATA>::iterator it = this->m_mapMonsterHerd.begin(); it != this->m_mapMonsterHerd.end() ; it++)
	{
		_MONSTER_HERD_DATA * lpMHD = &it->second;

		if ( OBJMAX_RANGE(lpMHD->m_iIndex)  == FALSE )
		{
			continue;
		}

		if ( gObj[lpMHD->m_iIndex].Live == FALSE || gObj[lpMHD->m_iIndex].m_State != 2 )
		{
			continue;
		}

		if ( gObj[lpMHD->m_iIndex].m_lpMonsterHerd != lpObj->m_lpMonsterHerd )
		{
			continue;
		}

		if ( lpMHD->m_iIndex == lpObj->m_Index )
		{
			continue;
		}

		if ( (rand()%100) < iAttackPercent )
		{
			gObj[lpMHD->m_iIndex].TargetNumber = lpTargetObj->m_Index;
			gObj[lpMHD->m_iIndex].m_ActState.Emotion = 1;
			gObj[lpMHD->m_iIndex].m_ActState.EmotionCount = 50;

			continue;
		}
	}
}
示例#25
0
int CCrywolfUtil::CrywolfMVPLevelUp(int iUserIndex, int iAddExp)
{
	if ( !OBJMAX_RANGE(iUserIndex ) )
		return 0;

	int iLEFT_EXP = 0;

	LogAddTD("[ Crywolf ][MVP Exp.] : [%s][%s](%d) %u %d",
		gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
		gObj[iUserIndex].Level, gObj[iUserIndex].Experience,
		iAddExp);

	LogAddTD("Experience : Map[%d]-(%d,%d) [%s][%s](%d) %u %d MonsterIndex : %d, EventType : %d",
		gObj[iUserIndex].MapNumber, gObj[iUserIndex].X, gObj[iUserIndex].Y, // #error Deathway - Must be Y
		gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
		gObj[iUserIndex].Level, gObj[iUserIndex].Experience, iAddExp, 0, EVENT_TYPE_CRYWOLF);

	gObjSetExpPetItem(iUserIndex, iAddExp);

	if ( gObj[iUserIndex].Level >= MAX_CHAR_LEVEL )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(4, 112)), gObj[iUserIndex].m_Index, 1);
		return 0;
	}

	if ( (gObj[iUserIndex].Experience + iAddExp) < gObj[iUserIndex].NextExp )
	{
		gObj[iUserIndex].Experience += iAddExp;
	}
	else
	{
		iLEFT_EXP = gObj[iUserIndex].Experience + iAddExp - gObj[iUserIndex].NextExp;
		gObj[iUserIndex].Experience = gObj[iUserIndex].NextExp;
		gObj[iUserIndex].Level++;

		if ( gObj[iUserIndex].Class == CLASS_DARKLORD || gObj[iUserIndex].Class == CLASS_MAGUMSA )
		{
			gObj[iUserIndex].LevelUpPoint += gLevelUpPointMGDL;
		}
		else
		{
			gObj[iUserIndex].LevelUpPoint += gLevelUpPointNormal;
		}

		if ( gObj[iUserIndex].PlusStatQuestClear != false )
		{
			gObj[iUserIndex].LevelUpPoint++;

			LogAddTD("[ Crywolf ][MVP Exp.] [%s][%s] LevelUp PlusStatQuest Clear AddStat %d",
				gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
				gObj[iUserIndex].LevelUpPoint);
		}

		gObj[iUserIndex].MaxLife += DCInfo.DefClass[gObj[iUserIndex].Class].LevelLife;
		gObj[iUserIndex].MaxMana += DCInfo.DefClass[gObj[iUserIndex].Class].LevelMana;
		gObj[iUserIndex].Life = gObj[iUserIndex].MaxLife;
		gObj[iUserIndex].Mana = gObj[iUserIndex].MaxMana;
		gObjNextExpCal(&gObj[iUserIndex]);
		gObjSetBP(gObj[iUserIndex].m_Index);
		GCLevelUpMsgSend(gObj[iUserIndex].m_Index, 1);
		gObjCalcMaxLifePower(gObj[iUserIndex].m_Index);

		LogAddTD(lMsg.Get(MSGGET(2, 8)), gObj[iUserIndex].AccountID,
			gObj[iUserIndex].Name, gObj[iUserIndex].Level);
	}

	return iLEFT_EXP;
}
示例#26
0
// -----------------------------------------------------------------------------------------------------------------------
void CIllusionTemple::UseSkillProc(OBJECTSTRUCT* lpObj, PMSG_ILLUSION_USESKILL* pMsg)
{
	LPOBJ lpTargetObj = &gObj[pMsg->m_TargetIndex];

	int TargePosx = lpTargetObj->X;
	int TargePosy = lpTargetObj->Y;

	int iangle = gObjUseSkill.GetAngle(lpObj->X,lpObj->Y,TargePosx,TargePosy);

	if(!(IT_FLOOR_RANGE(lpObj->m_IllusionIndex) && IT_MAP_RANGE(lpObj->MapNumber)))
	{
		GCMagicAttackNumberSend(lpObj, (BYTE)pMsg->m_SkillIndex, lpObj->m_Index, 1);
		return;
	}

	int SkillPoint = MagicDamageC.CheckKillCount(pMsg->m_SkillIndex, lpObj->m_IllusionKillCount);

	if(SkillPoint < 0)
	{
		GCMagicAttackNumberSend(lpObj, (BYTE)pMsg->m_SkillIndex, lpObj->m_Index, 1);
		CLog.LogAddC(2, "[IllusionTemple][%s] Use skill without enough points (%d)(%d)", lpObj->Name, lpObj->m_IllusionKillCount, pMsg->m_SkillIndex);
		return;
	}

	switch(pMsg->m_SkillIndex)
	{
		case IT_SKILL_SHIELD:
		{
			if(lpObj->m_IllusionShieldSkillTime > 0)
			{
				GCMagicAttackNumberSend(lpObj, AT_SKILL_ITSHIELD, lpObj->m_Index, 0);
				return;
			}

			if(lpObj->Mana < MagicDamageC.SkillGetMana(IT_SKILL_SHIELD))
			{
				GCMagicAttackNumberSend(lpObj, AT_SKILL_ITSHIELD, lpObj->m_Index, 0);
				return;
			}

			lpObj->Mana -= MagicDamageC.SkillGetMana(IT_SKILL_SHIELD);
			GCManaSend(lpObj->m_Index, (short)lpObj->Mana, 0xFF, 0, lpObj->BP);
			lpObj->m_IllusionShieldSkillTime = MagicDamageC.GetDelayTime(IT_SKILL_SHIELD);
			GCStateInfoSend(lpObj, 1, eVS_ILLUSION_PROTECTION);
			gObjSetIllusionKillCount(lpObj->m_Index, KILLCOUNT_DECREASE, MagicDamageC.GetKillCount(IT_SKILL_SHIELD));
			GCMagicAttackNumberSend(lpObj, AT_SKILL_ITSHIELD, lpObj->m_Index, 1);
		}break;

		case IT_SKILL_RESIST:
		{
			if(lpObj->Type != OBJ_USER )
			{
				CLog.LogAddC(2, "[IllusionTemple][%s] can't use Skill (%d) in normal state,only in PVP", lpObj->Name, pMsg->m_SkillIndex );
				return;
			}

			if(gObjCalDistance(lpObj,lpTargetObj) <= 4)
			{
				if(SkillElectricSparkHitBox.HitCheck(iangle,lpObj->X,lpObj->Y,lpObj->X,lpObj->Y))
				{
					lpTargetObj->m_btSkillRestraintOrder = TRUE;
					lpTargetObj->m_btSkillRestraintOrderTime = 15;
					//this->GCEffectSkillSend(aIndex,lpTargetObj->m_Index,lpMagic->m_Skill,btType);
					gObjSetPosition(lpObj->m_Index,lpObj->X,lpObj->Y);
				}
			}
		}break;

		case IT_SKILL_TRACK:
		{
			if(lpObj->m_Index != this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner)
			{
				if(OBJMAX_RANGE(this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner))
				{
					gObjSetIllusionKillCount(lpObj->m_Index, KILLCOUNT_DECREASE, MagicDamageC.GetKillCount(IT_SKILL_TRACK));
					gObjTeleport(lpObj->m_Index, gObj[this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner].MapNumber, 
						gObj[this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner].X, 
						gObj[this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner].Y); 
				}
			}
		}break;

		case IT_SKILL_FREEZE:
		{
			if(lpObj->Type != OBJ_USER )
			{
				CLog.LogAddC(2, "[IllusionTemple][%s] can't use Skill (%d) in normal state,only in PVP", lpObj->Name, pMsg->m_SkillIndex );
				return;
			}

			lpObj->iShield -= (lpObj->iMaxShield / 2);

			if( lpObj->iShield < 0 )
			{
				lpObj->iShield = 0;
			}

			GCReFillSend(lpObj->m_Index,(WORD)lpObj->Life,0xFF,0,lpObj->iShield);
			GCSendEffectInfo(lpTargetObj->m_Index, 17);
		}break;
	}
}
示例#27
0
//00415910 - identical
void CKalimaGate::KalimaGateAct(int iIndex)
{
	LPOBJ lpObj=NULL;
	LPOBJ lpObjCallOwner=NULL;

	if ( OBJMAX_RANGE(iIndex ) == FALSE)
	{
		return;
	}

	if ( gObj[iIndex].Live == FALSE )
	{
		return;
	}

	if ( gObjIsConnected( gObj[iIndex].m_RecallMon ) == PLAYER_EMPTY )
	{
		LogAddTD("[Kalima] Kalima Gate Vanished - Summoner Vanished (SummonIndex:%d, EnterCount:%d)",
			iIndex, gObj[iIndex].m_cKalimaGateEnterCount );
		GCDiePlayerSend( &gObj[iIndex], iIndex, 0, 0);
		gObjDel(iIndex);
		gObjCharZeroSet(iIndex);
		return;
	}

	lpObj = &gObj[iIndex];
	lpObjCallOwner = &gObj[lpObj->m_RecallMon];

	if ( gObj[gObj[iIndex].m_RecallMon].DieRegen > 0 )
	{
		lpObjCallOwner->AccountID[MAX_ACCOUNT_LEN]=0;
		lpObjCallOwner->Name[MAX_ACCOUNT_LEN]=0;

		LogAddTD("[Kalima] [%s][%s] Kalima Gate Vanished - Summoner Died (SummonIndex:%d, EnterCount:%d)",
			lpObjCallOwner->AccountID, lpObjCallOwner->Name,
			iIndex, gObj[iIndex].m_cKalimaGateEnterCount );
		this->DeleteKalimaGate(iIndex, gObj[iIndex].m_RecallMon);
		return;
	}

	if ( gObj[iIndex].m_cKalimaGateEnterCount >= MAX_KALIMA_ENTER )
	{
		lpObjCallOwner->AccountID[MAX_ACCOUNT_LEN]=0;
		lpObjCallOwner->Name[MAX_ACCOUNT_LEN]=0;
		
		LogAddTD("[Kalima] [%s][%s] Kalima Gate Vanished - Enter Count Over (SummonIndex:%d, EnterCount:%d)",
			lpObjCallOwner->AccountID, lpObjCallOwner->Name,
			iIndex, gObj[iIndex].m_cKalimaGateEnterCount );
		this->DeleteKalimaGate(iIndex, gObj[iIndex].m_RecallMon);
		return;
	}
		
	DWORD dwTickCount = GetTickCount();

	if ( dwTickCount > lpObj->RegenTime + KALIMA_GATE_TIMEOUT )
	{
		lpObjCallOwner->AccountID[MAX_ACCOUNT_LEN]=0;
		lpObjCallOwner->Name[MAX_ACCOUNT_LEN]=0;
		
		LogAddTD("[Kalima] [%s][%s] Kalima Gate Vanished - Time Out (SummonIndex:%d, EnterCount:%d)",
			lpObjCallOwner->AccountID, lpObjCallOwner->Name,
			iIndex, gObj[iIndex].m_cKalimaGateEnterCount );
		this->DeleteKalimaGate(lpObj->m_Index, lpObjCallOwner->m_Index);
		return;
	}

	if ( lpObj->VPCount < 1 )
	{
		return;
	}

	int tObjNum=-1;

	for ( int i=0;i<MAX_VIEWPORT_MONSTER;i++)
	{
		tObjNum = lpObj->VpPlayer[i].number;

		if ( tObjNum >= 0 )
		{
			if ( gObj[tObjNum].Type == OBJ_USER )
			{
				if ( gObj[tObjNum].Live != FALSE )
				{
					if ( abs(lpObj->Y - gObj[tObjNum].Y) < 2 )
					{
						if ( abs(lpObj->X - gObj[tObjNum].X) < 2 )
						{
							if ( lpObj->m_RecallMon == tObjNum || (gObj[tObjNum].PartyNumber != -1 && lpObjCallOwner->PartyNumber == gObj[tObjNum].PartyNumber ))
							{
								int iMoveMapLevel = lpObj->m_Attribute -51;
								int iMapNumber = iMoveMapLevel + 24;
								int iGateNumber = g_iKalimaGateGateIndex[iMoveMapLevel];
								int iOverLevel = this->GetKalimaGateLevel(tObjNum);

								if ( iOverLevel >= iMoveMapLevel )
								{
									if ( gObjMoveGate(tObjNum, iGateNumber) == FALSE )
									{
										LogAddTD("[Kalima] [%s][%s] - [%s][%s] move fail (MapNumber:%d)", 
											lpObjCallOwner->AccountID, lpObjCallOwner->Name,
											gObj[tObjNum].AccountID, gObj[tObjNum].Name, iMapNumber);
									}
									else
									{
										LogAddTD("[Kalima] [%s][%s] - [%s][%s] Transported by Kalima Gate (SummonIndex:%d, GateNo.:%d, MapNumber:%d)",
											lpObjCallOwner->AccountID, lpObjCallOwner->Name, 
											gObj[tObjNum].AccountID, gObj[tObjNum].Name, iIndex, iMoveMapLevel + 1, iMapNumber);
										gObj[iIndex].m_cKalimaGateEnterCount ++;

										if ( gObj[iIndex].m_cKalimaGateEnterCount >= MAX_KALIMA_ENTER )
										{
											return;
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
}
示例#28
0
int CCrywolfUtil::CrywolfMVPLevelUp(int iUserIndex,int iAddExp)
{
	if ( !OBJMAX_RANGE(iUserIndex ) )
		return 0;

	LogAddTD("[ Crywolf ][MVP Exp.] : [%s][%s](%d) %u %d",
		gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
		gObj[iUserIndex].Level, gObj[iUserIndex].Experience,
		iAddExp);

	if( g_MasterExp.LevelUp(&gObj[iUserIndex],iAddExp) )
	{
		return FALSE;
	}

	gObjSetExpPetItem(iUserIndex, iAddExp);
	int iLEFT_EXP = 0;

	LogAddTD("Experience : Map[%d]-(%d,%d) [%s][%s](%d) %u %d MonsterIndex : %d, EventType : %d",
		gObj[iUserIndex].MapNumber, gObj[iUserIndex].X, gObj[iUserIndex].Y,
		gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
		gObj[iUserIndex].Level, gObj[iUserIndex].Experience, iAddExp, 0, EVENT_TYPE_CRYWOLF);

	if ( gObj[iUserIndex].Level >= MAX_CHAR_LEVEL )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(4, 112)), gObj[iUserIndex].m_Index, 1);
		return 0;
	}

	if ( (gObj[iUserIndex].Experience + iAddExp) < gObj[iUserIndex].NextExp )
	{
		gObj[iUserIndex].Experience += iAddExp;
	}
	else
	{
		iLEFT_EXP = gObj[iUserIndex].Experience + iAddExp - gObj[iUserIndex].NextExp;
		gObj[iUserIndex].Experience = gObj[iUserIndex].NextExp;
		gObj[iUserIndex].Level++;
#if (ENABLE_CUSTOM_CLASSCALC == 1)
		gObj[iUserIndex].LevelUpPoint += g_ClassCalc.GetLevelPoint(&gObj[iUserIndex], 0, 0);
#else
		if( gObj[iUserIndex].Class == CLASS_DARKLORD )
		{
			gObj[iUserIndex].LevelUpPoint += 7;
		}
		else if( gObj[iUserIndex].Class == CLASS_MAGUMSA )
		{
			gObj[iUserIndex].LevelUpPoint += 7;
		}
		else if( gObj[iUserIndex].Class == CLASS_FIGHTER )
		{
			gObj[iUserIndex].LevelUpPoint += 7;
		}
		else
		{
			gObj[iUserIndex].LevelUpPoint += 5;
		}
#endif

		if( gObj[iUserIndex].PlusStatQuestClear != false )
		{
#if (ENABLE_CUSTOM_CLASSCALC == 1)
			gObj[iUserIndex].LevelUpPoint += g_ClassCalc.GetLevelPoint(&gObj[iUserIndex], 0, 1);
#else
			gObj[iUserIndex].LevelUpPoint += 1;
#endif
			LogAddTD("[ Crywolf ][MVP Exp.] [%s][%s] LevelUp PlusStatQuest Clear AddStat %d",
				gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
				gObj[iUserIndex].LevelUpPoint);
		}

		gObj[iUserIndex].MaxLife += DCInfo.DefClass[gObj[iUserIndex].Class].LevelLife;
		gObj[iUserIndex].MaxMana += DCInfo.DefClass[gObj[iUserIndex].Class].LevelMana;
		gObj[iUserIndex].Life = gObj[iUserIndex].MaxLife;
		gObj[iUserIndex].Mana = gObj[iUserIndex].MaxMana;
		gObjNextExpCal(&gObj[iUserIndex]);
		gObjSetBP(gObj[iUserIndex].m_Index);
		GCLevelUpMsgSend(gObj[iUserIndex].m_Index, 1);
		LogAddTD(lMsg.Get(MSGGET(2, 8)), gObj[iUserIndex].AccountID,
			gObj[iUserIndex].Name, gObj[iUserIndex].Level);


		if( gObj[iUserIndex].Level == 400 && gObj[iUserIndex].PartyNumber >= 0 )
		{
			int partynumber = gObj[iUserIndex].PartyNumber;
			char szTmp[256];

			sprintf(szTmp,"400 LevelUp (%s)(%s) Party ",gObj[iUserIndex].AccountID,gObj[iUserIndex].Name);

			int tObjNum;

			for(int i = 0; i < 5; i++)
			{
				tObjNum = gParty.m_PartyS[partynumber].Number[i];
				if( tObjNum >= 0 )
				{
					int len = strlen(szTmp);
					sprintf(&szTmp[len],",(%s)(%s) ",gObj[tObjNum].AccountID,gObj[tObjNum].Name);
				}
			}

			LogAddTD(szTmp);
		}
	}

	return iLEFT_EXP;
}
示例#29
0
void JGAnsMapSvrAuth(PMSG_ANS_MAPSVRAUTH * lpMsg)
{
	if ( !OBJMAX_RANGE(lpMsg->iIndex))
	{
		LogAddC(2, "[MapServerMng] Packet Error JG [0x7B] - Index out of bound : %d",
			lpMsg->iIndex);
		
		return;
	}

	LPOBJ lpObj = &gObj[lpMsg->iIndex];
	memcpy(lpObj->Name, lpMsg->szCharName, MAX_ACCOUNT_LEN);


	if ( lpObj->m_bMapSvrMoveReq == false )
	{
		LogAddC(2, "[MapServerMng] MapSvr MoveReq Error JG [0x7B] - No Request [%s] (%d)",
			lpObj->AccountID, lpObj->m_Index);

		gObjDel(lpMsg->iIndex);
		return;
	}

	BOOL bAuthOK = FALSE;
	int iSendResult = 0;
	char szId[11];
	char szJN[21] = "";
	int iIndex = lpMsg->iIndex;
	SDHP_DBCHARINFOREQUEST pMsg;
	char szName[11];

	memset(szId, 0, sizeof(szId));
	memcpy(szId, lpMsg->szAccountID, MAX_ACCOUNT_LEN);
	memcpy(szJN, lpMsg->cJoominNumber, sizeof(lpMsg->cJoominNumber));
	
	switch ( lpMsg->iResult )
	{
		case 0:
			iSendResult = 0;
			bAuthOK = FALSE;

			if ( !gObjSetAccountLogin(iIndex, szId, lpMsg->iUserNumber, lpMsg->iDBNumber, szJN))
			{
				GJPAccountFail(iIndex, szId, lpMsg->iDBNumber, lpMsg->iUserNumber);
				lpMsg->iResult = 4;
			}
			else
			{
				LogAddTD(lMsg.Get(MSGGET(1, 211)), gObj[iIndex].Ip_addr, szId, lpMsg->iUserNumber, lpMsg->iDBNumber);
				iSendResult = 1;
				bAuthOK = TRUE;
			}

			if ( lpMsg->iUserNumber == 0 && lpMsg->iDBNumber == 0 )
			{
				LogAddTD(lMsg.Get(MSGGET(1, 212)), szId, lpMsg->iUserNumber, lpMsg->iDBNumber);
			}

			switch ( lpMsg->btBlockCode )
			{
				case 70:	// 0x46
					gObj[iIndex].m_cAccountItemBlock = 1;
					break;
			}
			break;

		default:
			iSendResult = 0;
			bAuthOK = FALSE;
			break;
	}

	GCAnsMapSvrAuth(iIndex, iSendResult);

	if ( bAuthOK == FALSE )
	{
		LogAddC(2, "[MapServerMng] [%s][%s] JG [0x7B] - Join Result Failed : RST:%d, BLK:%c",
			szId, lpMsg->szCharName, lpMsg->iResult, lpMsg->btBlockCode);
		gObjDel(lpMsg->iIndex);

		return;
	}
	
	gObj[iIndex].m_sPrevMapSvrCode = lpMsg->wPrevMapSvrCode;
	gObj[iIndex].m_sDestMapNumber  = lpMsg->wMapNumber;
	gObj[iIndex].m_btDestX = lpMsg->btX;
	gObj[iIndex].m_btDestY = lpMsg->btY;
	gObj[iIndex].bEnableDelCharacter = FALSE;

#if (ENABLETEST_ARCA == 1)
	if( g_ArcaBattle.IsArcaBattleServer() )
    {
          g_ArcaBattle.SendArcaBattlePlayInfo(gObj[iIndex], 1);
          g_ArcaBattle.SendArcaBattleCurrentState(gObj[iIndex]);
    }
#endif

	PHeadSetB((LPBYTE)&pMsg, 0x06, sizeof(pMsg));
	memset(szName, 0, sizeof(szName));
	memcpy(szName, lpMsg->szCharName, MAX_ACCOUNT_LEN);
	BuxConvert(szName, MAX_ACCOUNT_LEN);
	memcpy(pMsg.Name, szName, MAX_ACCOUNT_LEN);
	strcpy(pMsg.AccountID, lpMsg->szAccountID);
	pMsg.Number = lpObj->m_Index;

	cDBSMng.Send((PCHAR)&pMsg, pMsg.h.size);

	LogAddTD("[MapServerMng] [%s][%s] JG [0x7B] - Join Result OK : RST:%d, BLK:%c",
		szId, lpMsg->szCharName, lpMsg->iResult, lpMsg->btBlockCode);

}
示例#30
0
void CMuRummyMng::CGReqMuRummyEventOpen(_tagPMSG_REQ_MURUMMY_EVENT_OPEN* lpMsg, int aIndex)
{	
	_tagPMSG_ANS_MURUMMY_EVENT_OPEN pMsg;
	pMsg.h.set((LPBYTE)&pMsg, 0x4D, 0xF, sizeof(_tagPMSG_ANS_MURUMMY_EVENT_OPEN));
	pMsg.btResult = -1;

	if (!OBJMAX_RANGE(aIndex))
	{
		return;
	}

	if (!gObjIsConnected(aIndex))
	{
		return;
	}
	
	LPOBJ lpObj = &gObj[aIndex];
	
	if (!lpObj)
	{
		return;
	}

	if (lpObj->CloseType != -1) 
	{
		return;
	}

	if (lpObj->m_IfState.use > 0 && lpObj->m_IfState.type != 3)
	{
		 LogAddTD("[MuRummy][Error] [%s][%s][%d] : not event ofen",
			 lpObj->AccountID,lpObj->Name, lpObj->m_IfState.type);
		 return;
	}

	if (lpObj->m_bPShopOpen == 1 || lpObj->ChaosLock == 1)
    {
		LogAddTD("[MuRummy][Error] [%s][%s][%d] : not event ofen",
			 lpObj->AccountID,lpObj->Name, lpObj->m_IfState.type);
		 return;
	}

	CMuRummyInfo* pMuRummyInfo;// = lpObj->m_pCMuRummyInfo;

	if (!pMuRummyInfo)
	{
		LogAddTD("[MuRummy][Error] pMuRummyInfo is NULL [%s][%s] [%s, %d]",
			lpObj->AccountID, lpObj->Name, __FILE__, __LINE__);
		return;
	}

	if (pMuRummyInfo->IsWaitReward())
	{
		LogAddTD("[MuRummy][DebugLog][%s][%s] Waiting Item Reward(Req Open)", lpObj->AccountID, lpObj->Name);
		GCServerMsgStringSend(lMsg.Get(3539), lpObj->m_Index, 1);
	}
	else if (this->IsMuRummyEventOn())
	{
		CTime tExpireTime; //maybe special initilizator
		DWORD dwExpireSec = 0;//g_PeriodItemEx.GetLeftDate(tExpireTime.GetTime());
		pMsg.btEventTime1 = DWORD((DWORD(dwExpireSec >> 32) >> 16) & 0xFFFF) >> 8;
		pMsg.btEventTime2 = DWORD((DWORD(dwExpireSec >> 32) >> 16) & 0xFFFF) & 0xFF;
		pMsg.btEventTime3 = DWORD((DWORD(dwExpireSec >> 32) & 0xFFFF) & 0xFFFF) >> 8;
		pMsg.btEventTime4 = DWORD((DWORD(dwExpireSec >> 32) & 0xFFFF) & 0xFFFF) & 0xFF;
		
		if (!pMuRummyInfo->IsGetPlayCard())
		{
			 pMsg.btResult = 1;
             DataSend(aIndex, (LPBYTE)&pMsg, pMsg.h.size);
			 return;
		}

		pMsg.btResult = 2;
        DataSend(aIndex, (LPBYTE)&pMsg, pMsg.h.size);
        this->CGReqMuRummyStart(0, aIndex);

		LogAddTD("[MuRummy] [%s][%s] : Mini Game Open", lpObj->AccountID, lpObj->Name);
	}