Exemple #1
0
void CCrywolf::NotifyCrywolfPersonalRank()
{
	PMSG_ANS_CRYWOLF_PERSONAL_RANK pMsg;

	PHeadSubSetB((LPBYTE)&pMsg, 0xBD, 0x07, sizeof(pMsg));
	pMsg.btRank = 0;

	for ( int i=OBJ_STARTUSERINDEX;i<OBJMAX;i++)
	{
		if ( gObj[i].Connected == PLAYER_PLAYING &&
			 gObj[i].Type == OBJ_USER &&
			 gObj[i].MapNumber == MAP_INDEX_CRYWOLF_FIRSTZONE)
		{
			pMsg.btRank = this->CalcGettingRank(i);
			pMsg.iGettingExp = this->CalcGettingRewardExp(i, pMsg.btRank);

			if ( gObj[i].m_wExprienceRate == 0)
				pMsg.iGettingExp = 0;

			this->GiveRewardExp(i, pMsg.iGettingExp);

			MsgOutput(i, "MvP rank: [%d]", pMsg.btRank);
			MsgOutput(i, "MvP rank: experience points [%d]", pMsg.iGettingExp);

			LogAdd("[ Crywolf ][Personal Rank & Exp.] [%s][%s] Score(%d) Rank(%d) Exp(%d)",
				gObj[i].AccountID, gObj[i].Name, gObj[i].m_iCrywolfMVPScore, pMsg.btRank, pMsg.iGettingExp);

			DataSend(i, (LPBYTE)&pMsg, sizeof(pMsg));
		}
	}
}
Exemple #2
0
void CGMMng::SetInfinityArrowTime(LPOBJ lpObj, int iValue)
{
	if ( lpObj->Class == CLASS_ELF && lpObj->Type == OBJ_USER && lpObj->ChangeUP == 1 )
	{
		lpObj->m_iMuseElfInfinityArrowSkillTime = iValue;
		MsgOutput(lpObj->m_Index, "ÀÎÇÇ´ÏƼ ¾Ö·Î¿ì ½Ã°£ °­Á¦ ¼³Á¤ : %dÃÊ", iValue);
	}
	else
	{
		MsgOutput(lpObj->m_Index, "220·¹º§ ÀÌ»ó ¹ÂÁÇÁ¸¸ »ç¿ë°¡´ÉÇÕ´Ï´Ù.");
	}
}
Exemple #3
0
void CGMMng::SetInfinityArrowTime(LPOBJ lpObj, int iValue)
{
	if ( lpObj->Class == CLASS_ELF && lpObj->Type == OBJ_USER && lpObj->ChangeUP >= 1 )
	{
		lpObj->m_iMuseElfInfinityArrowSkillTime = iValue;
		MsgOutput(lpObj->m_Index, "인피니티 애로우 시간 강제 설정 : %d초", iValue);
	}
	else
	{
		MsgOutput(lpObj->m_Index, "220레벨 이상 뮤즈엘프만 사용가능합니다.");
	}
}
Exemple #4
0
void CGMMng::GetInfinityArrowMPConsumption(LPOBJ lpObj)
{
	MsgOutput(lpObj->m_Index, "인피니티 애로우 MP 소모량[+0:%d] [+1:%d] [+2:%d]",
		g_SkillAdditionInfo.GetInfinityArrowMPConsumptionPlus0(),
		g_SkillAdditionInfo.GetInfinityArrowMPConsumptionPlus1(),
		g_SkillAdditionInfo.GetInfinityArrowMPConsumptionPlus2());
}
void CCrywolfAltar::ResetAltarUserIndex(int iAltarObjIndex, int iClass)
{
	int iAltarNumber = this->GetAlatarNumber(iClass);
	CCrywolfAltarInfo * AltarInfo = &this->m_AltarInfo[iAltarNumber];

	if ( gObjIsConnected(AltarInfo->m_iUserIndex) != FALSE )
	{
		MsgOutput(AltarInfo->m_iUserIndex, lMsg.Get(MSGGET(13, 4)), iAltarNumber);
		CLog.LogAdd("[ Crywolf ][Altar Op.] [%s][%s] Remove contract Altar[%d]",
		gObj[AltarInfo->m_iUserIndex].AccountID, gObj[AltarInfo->m_iUserIndex].Name,
		iAltarNumber);
	}

	if ( AltarInfo->m_iContractCount >= MAX_ALTAR_CONTRACTS )
	{
		AltarInfo->SetAltarState(3);

		memset(gObj[iAltarObjIndex].m_ViewSkillState, 0, sizeof(gObj[iAltarObjIndex].m_ViewSkillState));
		gObj[iAltarObjIndex].m_ViewSkillState[eVS_ALTAR_MAX_CONTRACT] = 1;
		GCStateInfoSend(&gObj[iAltarObjIndex], 1, eVS_ALTAR_MAX_CONTRACT);
	}
	else
	{
		memset(gObj[iAltarObjIndex].m_ViewSkillState, 0, sizeof(gObj[iAltarObjIndex].m_ViewSkillState));
		gObj[iAltarObjIndex].m_ViewSkillState[eVS_POTION_SOUL] = 1;
		GCStateInfoSend(&gObj[iAltarObjIndex], 1, eVS_POTION_SOUL);
		AltarInfo->SetAltarState(0);
	}

	AltarInfo->m_iUserIndex = -1;
	AltarInfo->m_dwAppliedContractTime = 0;
	AltarInfo->m_dwValidContractTime = 0;
	AltarInfo->m_dwLastValidContractTime = GetTickCount();
}
Exemple #6
0
void CGMMng::GetInfinityArrowMPConsumption(LPOBJ lpObj)
{
	MsgOutput(lpObj->m_Index, "ÀÎÇÇ´ÏƼ ¾Ö·Î¿ì MP ¼Ò¸ð·®[+0:%d] [+1:%d] [+2:%d]",
		g_SkillAdditionInfo.GetInfinityArrowMPConsumptionPlus0(),
		g_SkillAdditionInfo.GetInfinityArrowMPConsumptionPlus1(),
		g_SkillAdditionInfo.GetInfinityArrowMPConsumptionPlus2());
}
void CCrywolfAltar::ResetAltarUserIndex(int iAltarObjIndex, int iClass)
{
    int iAltarNumber = this->GetAlatarNumber(iClass);
    CCrywolfAltarInfo * AltarInfo = &this->m_AltarInfo[iAltarNumber];

    if ( gObjIsConnected(AltarInfo->m_iUserIndex) != FALSE )
    {
        MsgOutput(AltarInfo->m_iUserIndex, lMsg.Get(MSGGET(13, 4)), iAltarNumber);
        LogAddTD("[ Crywolf ][Altar Op.] [%s][%s] Remove contract Altar[%d]", gObj[AltarInfo->m_iUserIndex].AccountID, gObj[AltarInfo->m_iUserIndex].Name, iAltarNumber);
    }

    if ( AltarInfo->m_iContractCount >= MAX_ALTAR_CONTRACTS )
    {
        AltarInfo->SetAltarState(3);
        gObjAddBuffEffect(&gObj[iAltarObjIndex], AT_CW_ALTAR_INACTIVE, 0, 0, 0, 0, -10);
    }
    else
    {
        gObjAddBuffEffect(&gObj[iAltarObjIndex], AT_CW_ALTAR_ACTIVE, 0, 0, 0, 0, -10);
        AltarInfo->SetAltarState(0);
    }

    AltarInfo->m_iUserIndex = -1;
    AltarInfo->m_dwAppliedContractTime = 0;
    AltarInfo->m_dwValidContractTime = 0;
    AltarInfo->m_dwLastValidContractTime = GetTickCount();
}
BOOL NpcReira(LPOBJ lpNpc, LPOBJ lpObj)
{
	if( lpObj->Authority != 32 )
	{
		MsgOutput(lpObj->m_Index,"This shop is only for admins!");
		return TRUE;
	}
	return FALSE;
}
// --------------------------------------------------------------------------------------------------------------------------------------------------
void CGoldenArcher::NPCTalk_GoldenArcher(int PlayerID)
{
    if(this->GetRenaCount(PlayerID) > 0)
    {
        LPOBJ lpObj = &gObj[PlayerID];

        unsigned short *ActualPts = (unsigned short*)&lpObj->m_Quest[29];

        if(*ActualPts == 0xFFFF)
        {
            *ActualPts = 0;
        }

        if(*ActualPts > this->ReqItem)
        {
            *ActualPts = 0;
        }

        *ActualPts += 1;

        this->PlayerDeleteQuestItem(PlayerID);

        if(*ActualPts == this->ReqItem)
        {
            this->RewardItem(PlayerID);
            MsgOutput(PlayerID,"[GoldenArcher] Enjoy Reward");
            *ActualPts = *ActualPts - this->ReqItem;
        }
        else
        {
            int RenasCount = 0;
            RenasCount = RenasCount + *ActualPts;
            MsgOutput(PlayerID,"[%s]: Your 'Rena' accepted, You Sent (%d) Rena(s), For Reward need (%d).",lpObj->Name,RenasCount,this->ReqItem);
        }

        unsigned char GAMsg[7] = {0xc1, 0x07, 0x94, 0x00};
        memcpy(&GAMsg[4], ActualPts, 2);
        gSendProto.DataSend(lpObj->m_Index, GAMsg, 7);
    }
    else
    {
        SendMsg.MessageOut(PlayerID, 0x01, "[Golden Archer] You don't have the required Renas");
    }
}
Exemple #10
0
void CCrywolf::CrywolfMonsterDieProc(int iMonIndex, int iKillerIndex)
{
	LPOBJ lpMonObj = &gObj[iMonIndex];
	LPOBJ lpKillerObj = &gObj[iKillerIndex];
	BOOL bExistKiller = gObjIsConnected(iKillerIndex);

	if ( g_Crywolf.GetCrywolfState() == CRYWOLF_STATE_START )
	{
		if ( lpMonObj->MapNumber == MAP_INDEX_CRYWOLF_FIRSTZONE )
		{
			if ( lpMonObj->m_iCurrentAI != 0 )
			{
				if ( lpMonObj->Class == 349 )
				{
					if ( bExistKiller )
					{
						UTIL.SendCrywolfUserAnyMsg(2, lMsg.Get(MSGGET(12, 247)), lpKillerObj->Name);

						LogAddTD("[ Crywolf ][MVP] [Balgars Dead] by [%s][%s]",
							lpKillerObj->AccountID, lpKillerObj->Name);
					}
					else
					{
						UTIL.SendCrywolfUserAnyMsg(2, lMsg.Get(MSGGET(12, 248)));

						LogAddTD("[ Crywolf ][MVP] [Balgars Dead] by Unknown User");
					}
				}

				if ( lpMonObj->Class == 340 )
				{
					if ( bExistKiller )
					{
						UTIL.SendCrywolfUserAnyMsg(2, lMsg.Get(MSGGET(12, 249)),
							lpMonObj->m_iGroupNumber, lpKillerObj->Name);

						LogAddTD("[ Crywolf ][MVP] [DarkElf Dead] by [%s][%s]",
							lpKillerObj->AccountID, lpKillerObj->Name);
					}
				}
		
				int iScore = this->CalcGettingScore(iKillerIndex, iMonIndex, 100);


				if ( iScore != -1 )
				{
					MsgOutput(iKillerIndex, lMsg.Get(MSGGET(12, 250)), iScore);
				}
			}
		}
	}
}
Exemple #11
0
void CCrywolf::CrywolfMonsterDieProc(int iMonIndex, int iKillerIndex)
{
	LPOBJ lpMonObj = &gObj[iMonIndex];
	LPOBJ lpKillerObj = &gObj[iKillerIndex];
	BOOL bExistKiller = gObjIsConnected(iKillerIndex);

	if ( g_Crywolf.GetCrywolfState() == CRYWOLF_STATE_START )
	{
		if ( lpMonObj->MapNumber == MAP_INDEX_CRYWOLF_FIRSTZONE )
		{
			if ( lpMonObj->m_iCurrentAI != 0 )
			{
				if ( lpMonObj->Class == 349 )
				{
					if ( bExistKiller )
					{
						UTIL.SendCrywolfUserAnyMsg(2, "Balgass has been killed by  %s!", lpKillerObj->Name);

						LogAdd("[ Crywolf ][MVP] [Balgass Dead] by [%s][%s]",
							lpKillerObj->AccountID, lpKillerObj->Name);
					}
					else
					{
						UTIL.SendCrywolfUserAnyMsg(2, "Balgass is dead");

						LogAdd("[ Crywolf ][MVP] [Balgass Dead] by Unknown User");
					}
				}

				if ( lpMonObj->Class == 340 )
				{
					if ( bExistKiller )
					{
						UTIL.SendCrywolfUserAnyMsg(2, "The darkelf leader [%d] of Balgass's army has been killed by  %s!",
							lpMonObj->m_iGroupNumber, lpKillerObj->Name);

						LogAdd("[ Crywolf ][MVP] [DarkElf Dead] by [%s][%s]",
							lpKillerObj->AccountID, lpKillerObj->Name);
					}
				}
		
				int iScore = this->CalcGettingScore(iKillerIndex, iMonIndex, 100);


				if ( iScore != -1 )
				{
					MsgOutput(iKillerIndex, "Current MvP point is : %d", iScore);
				}
			}
		}
	}
}
Exemple #12
0
BOOL NpcCastleSwitch(LPOBJ lpNpc, LPOBJ lpObj) //GS-CS Decompiled 100%
{
	#if(GS_CASTLE==1)
	if(gObjIsConnected(lpObj->m_Index) == FALSE )
	{
		return TRUE;
	}

	if(g_CastleSiege.GetCastleState() != 7)
	{
		return TRUE;
	}
	
	if(lpObj->m_btCsJoinSide < 2)
	{
		return TRUE;
	}

	if((lpObj->Y - lpNpc->Y) > 3 || (lpObj->X - lpNpc->X) > 3)
	{
		return TRUE;
	}

	if(g_CastleSiege.CheckGuardianStatueExist())
	{
		MsgOutput(lpObj->m_Index,lMsg.Get(MSGGET(6, 200)));
		return TRUE;
	}

	int iUserIndex = g_CastleSiege.GetCrownSwitchUserIndex(lpNpc->Class);

	if(!gObjIsConnected(iUserIndex))
	{
		GCAnsCsAccessSwitchState(lpObj->m_Index,lpNpc->m_Index,-1,1);
		g_CastleSiege.SetCrownSwitchUserIndex(lpNpc->Class,lpObj->m_Index);
		LogAddTD("[CastleSiege] [%s][%s] Start to Push Castle Crown Switch (GUILD:%s) - CS X:%d/Y:%d",lpObj->AccountID,lpObj->Name,lpObj->GuildName,lpNpc->X,lpNpc->Y);
	}
	else if(lpObj->m_Index != iUserIndex)
	{
		GCAnsCsAccessSwitchState(lpObj->m_Index,lpNpc->m_Index,iUserIndex,2);
	}

	return TRUE;

	#else
	return TRUE;
	#endif
}
BOOL CCrywolfAltar::SetAltarUserIndex(int iAltarObjIndex, int iClass, int iUserIndex)
{
	int iAltarNumber = this->GetAlatarNumber(iClass);
	CCrywolfAltarInfo * AltarInfo = &this->m_AltarInfo[iAltarNumber];
	DWORD dwCurrentTime = GetTickCount();

	if ( gObjIsConnected(AltarInfo->m_iUserIndex) != FALSE )
	{
		MsgOutput(iUserIndex, lMsg.Get(MSGGET(12, 253)), iAltarNumber);
		return FALSE;
	}

	if ( (dwCurrentTime-AltarInfo->m_dwLastValidContractTime) < 10000 )
	{
		MsgOutput(iUserIndex, lMsg.Get(MSGGET(12, 254)), iAltarNumber);
		return FALSE;
	}

	if ( AltarInfo->m_iContractCount > MAX_ALTAR_CONTRACTS ) 
	{
		MsgOutput(iUserIndex, lMsg.Get(MSGGET(12, 255)), iAltarNumber);
		return FALSE;
	}

	if ( abs(gObj[iAltarObjIndex].Y - gObj[iUserIndex].Y) > 0 || abs(gObj[iAltarObjIndex].X - gObj[iUserIndex].X) > 0 )
	{
		MsgOutput(iUserIndex, lMsg.Get(MSGGET(13, 0)), iAltarNumber);
		return FALSE;
	}

	AltarInfo->SetAltarState(2);
	AltarInfo->m_iUserIndex = iUserIndex;
	AltarInfo->m_dwAppliedContractTime = dwCurrentTime;
	AltarInfo->m_dwValidContractTime = dwCurrentTime + 5000;	// It Get Active after 5 Seconds
	AltarInfo->m_dwLastValidContractTime = dwCurrentTime;
	AltarInfo->m_iContractCount++;

	memset(gObj[iAltarObjIndex].m_ViewSkillState, 0, sizeof(gObj[iAltarObjIndex].m_ViewSkillState));
	gObj[iAltarObjIndex].m_ViewSkillState[eVS_ALTAR_ATTEMP_CONTRACT] = 1;
	GCStateInfoSend(&gObj[iAltarObjIndex], 1, eVS_ALTAR_VALID_CONTRACT);

	UTIL.SendCrywolfUserAnyMsg(2, lMsg.Get(MSGGET(13, 1)), gObj[AltarInfo->m_iUserIndex].Name, iAltarNumber);

	CLog.LogAdd("[ Crywolf ][Altar Op.] [%s][%s] Attempt to contract Altar[%d]",
		gObj[AltarInfo->m_iUserIndex].AccountID, gObj[AltarInfo->m_iUserIndex].Name,
		iAltarNumber);

	MsgOutput(iUserIndex, lMsg.Get(MSGGET(13, 2)));
	MsgOutput(iUserIndex, lMsg.Get(MSGGET(13, 3)));

	return TRUE;
}
BOOL NpcCastleSwitch(LPOBJ lpNpc, LPOBJ lpObj)
{
#if (GS_CASTLE == 1)

	if(gObjIsConnected(lpObj->m_Index) == FALSE)
		return TRUE;

	if(g_CastleSiege.GetCastleState() != CASTLESIEGE_STATE_STARTSIEGE)
		return TRUE;

	if(lpObj->m_btCsJoinSide < 2)
		return TRUE;

	if( abs( lpObj->Y - lpNpc->Y) > 3 || abs(lpObj->X - lpNpc->X) > 3)
		return TRUE;

	if(g_CastleSiege.CheckGuardianStatueExist() == TRUE)
	{
		MsgOutput(lpObj->m_Index,lMsg.Get(MSGGET(6,200)));
		return TRUE;
	}

	int SwitchIndex = g_CastleSiege.GetCrownSwitchUserIndex(lpNpc->Class);

	if( gObjIsConnected(SwitchIndex) == FALSE)
	{
		GCAnsCsAccessSwitchState(lpObj->m_Index,lpNpc->m_Index,-1,1);
		g_CastleSiege.SetCrownSwitchUserIndex(lpNpc->Class,lpObj->m_Index);
		LogAddTD("[CastleSiege] [%s][%s] Start to Push Castle Crown Switch (GUILD:%s) - CS X:%d/Y:%d",
			lpObj->AccountID,lpObj->Name,lpObj->GuildName,lpNpc->X,lpNpc->Y);
	}
	else if(lpObj->m_Index != SwitchIndex)
	{
		GCAnsCsAccessSwitchState(lpObj->m_Index,lpNpc->m_Index,SwitchIndex,2);
	}



#endif
	return TRUE;
}
BOOL NpcGuildMasterTalk(LPOBJ lpNpc, LPOBJ lpObj)
{
#if (__GENS_SYSTEM__ == 1)

	if( lpObj->m_GensInfo.btFamily == GENS_NONE )
	{
		MsgOutput(lpObj->m_Index,"You are not a member of any gens clan!");
		return TRUE;
	}

#endif

	if ( gGuildCreate == FALSE )
	{
		ChatTargetSend(lpNpc, "Guild creation is disabled!", lpObj->m_Index);
		return TRUE;
	}

	if ( lpObj->GuildNumber > 0 )
	{
		ChatTargetSend(lpNpc, lMsg.Get(MSGGET(4, 116)), lpObj->m_Index);
		return TRUE;
	}

	int capacity = gObjGuildMasterCapacityTest(lpObj);

	if ( capacity == 0 )
	{
		ChatTargetSend(lpNpc, lMsg.Get(MSGGET(4, 117)), lpObj->m_Index);
	}
	else if ( capacity == 2 )
	{
		ChatTargetSend(lpNpc, lMsg.Get(MSGGET(4, 118)), lpObj->m_Index);
	}
	else
	{
		GCGuildMasterQuestionSend(lpObj->m_Index);
	}

	return TRUE;
}
BOOL CCrywolfAltar::SetAltarUserIndex(int iAltarObjIndex, int iClass, int iUserIndex)
{
    int iAltarNumber = this->GetAlatarNumber(iClass);
    CCrywolfAltarInfo * AltarInfo = &this->m_AltarInfo[iAltarNumber];
    DWORD dwCurrentTime = GetTickCount();

    if ( gObjIsConnected(AltarInfo->m_iUserIndex) != FALSE )
    {
        MsgOutput(iUserIndex, lMsg.Get(MSGGET(12, 253)), iAltarNumber);
        return FALSE;
    }

    if ( (dwCurrentTime-AltarInfo->m_dwLastValidContractTime) < 10000 )
    {
        MsgOutput(iUserIndex, lMsg.Get(MSGGET(12, 254)), iAltarNumber);
        return FALSE;
    }

    if ( AltarInfo->m_iContractCount > MAX_ALTAR_CONTRACTS )
    {
        MsgOutput(iUserIndex, lMsg.Get(MSGGET(12, 255)), iAltarNumber);
        return FALSE;
    }

    if ( abs(gObj[iAltarObjIndex].Y - gObj[iUserIndex].Y) > 0 || abs(gObj[iAltarObjIndex].X - gObj[iUserIndex].X) > 0 )
    {
        MsgOutput(iUserIndex, lMsg.Get(MSGGET(13, 0)), iAltarNumber);
        return FALSE;
    }

    AltarInfo->SetAltarState(2);
    AltarInfo->m_iUserIndex = iUserIndex;
    AltarInfo->m_dwAppliedContractTime = dwCurrentTime;
    AltarInfo->m_dwValidContractTime = dwCurrentTime + 5000;
    AltarInfo->m_dwLastValidContractTime = dwCurrentTime;
    AltarInfo->m_iContractCount++;

    gObjAddBuffEffect(&gObj[iAltarObjIndex], AT_CW_ALTAR_ATTEMPT, 0, 0, 0, 0, -10);

    UTIL.SendCrywolfUserAnyMsg(2, lMsg.Get(MSGGET(13, 1)), gObj[AltarInfo->m_iUserIndex].Name, iAltarNumber);

    LogAddTD("[ Crywolf ][Altar Op.] [%s][%s] Attempt to contract Altar[%d]", gObj[AltarInfo->m_iUserIndex].AccountID, gObj[AltarInfo->m_iUserIndex].Name, iAltarNumber);

    MsgOutput(iUserIndex, lMsg.Get(MSGGET(13, 2)));
    MsgOutput(iUserIndex, lMsg.Get(MSGGET(13, 3)));

    return TRUE;
}
void CCrywolfAltar::SetAltarValidContract(int iAltarObjIndex, int iClass)
{
	int iAltarNumber = this->GetAlatarNumber(iClass);
	CCrywolfAltarInfo * AltarInfo = &this->m_AltarInfo[iAltarNumber];

	if ( AltarInfo->GetAltarState() != 2 )
		return;

	if ( AltarInfo->m_dwValidContractTime < (int)GetTickCount() )
	{
		MsgOutput(AltarInfo->m_iUserIndex, lMsg.Get(MSGGET(12, 251)), iAltarNumber);
		UTIL.SendCrywolfUserAnyMsg(2, lMsg.Get(MSGGET(12, 252)), gObj[AltarInfo->m_iUserIndex].Name, iAltarNumber);

		CLog.LogAdd("[ Crywolf ][Altar Op.]  [%s][%s] Set Valid Contract Altar[%d]",
			gObj[AltarInfo->m_iUserIndex].AccountID, gObj[AltarInfo->m_iUserIndex].Name, iAltarNumber);

		AltarInfo->SetAltarState(1);

		memset(gObj[iAltarObjIndex].m_ViewSkillState,0, sizeof(gObj[iAltarObjIndex].m_ViewSkillState));
		gObj[iAltarObjIndex].m_ViewSkillState[eVS_ALTAR_VALID_CONTRACT] = 1;
		GCStateInfoSend(&gObj[iAltarObjIndex], 1, eVS_ALTAR_VALID_CONTRACT);
	}
}
void CCrywolfAltar::SetAltarValidContract(int iAltarObjIndex, int iClass)
{
    int iAltarNumber = this->GetAlatarNumber(iClass);
    CCrywolfAltarInfo * AltarInfo = &this->m_AltarInfo[iAltarNumber];

    if ( AltarInfo->GetAltarState() != 2 )
    {
        return;
    }

    if ( AltarInfo->m_dwValidContractTime < GetTickCount() )
    {
        MsgOutput(AltarInfo->m_iUserIndex, lMsg.Get(MSGGET(12, 251)), iAltarNumber);

        UTIL.SendCrywolfUserAnyMsg(2, lMsg.Get(MSGGET(12, 252)), gObj[AltarInfo->m_iUserIndex].Name, iAltarNumber);

        LogAddTD("[ Crywolf ][Altar Op.]  [%s][%s] Set Valid Contract Altar[%d]", gObj[AltarInfo->m_iUserIndex].AccountID, gObj[AltarInfo->m_iUserIndex].Name, iAltarNumber);

        AltarInfo->SetAltarState(1);

        gObjAddBuffEffect(&gObj[iAltarObjIndex], AT_CW_ALTAR_STATUS, 0, 0, 0, 0, -10);
    }
}
Exemple #19
0
void CCrywolf::OperateGmCommand(int iUserIndex, int iCommand)
{
	if ( !gObjIsConnected(iUserIndex))
		return;

	if ( (gObj[iUserIndex].Authority & 0x02) != 0x02 )
		return;

	LogAdd("[ Crywolf ][Use GM Command] [%s][%s] Command : %d",
		gObj[iUserIndex].AccountID, gObj[iUserIndex].Name, iCommand);

	switch ( iCommand )
	{
		case 0:
			this->SetState(CRYWOLF_STATE_NOTIFY_2);
			break;

		case 1:
			this->SetState(CRYWOLF_STATE_READY);
			break;

		case 2:
			if ( this->GetCrywolfState() == CRYWOLF_STATE_READY )
			{
				this->SetState(CRYWOLF_STATE_START);
			}
			else
			{
				MsgOutput(iUserIndex, "Prepare for the attack of Balgass's army on Crywolf Fortress");
			}
			break;

		case 3:
			this->SetState(CRYWOLF_STATE_END);
			break;
	}
}
Exemple #20
0
void CCrywolf::OperateGmCommand(int iUserIndex, int iCommand)
{
	if ( !gObjIsConnected(iUserIndex))
		return;

	if ( (gObj[iUserIndex].Authority & 0x02) != 0x02 )
		return;

	LogAddTD("[ Crywolf ][Use GM Command] [%s][%s] Command : %d",
		gObj[iUserIndex].AccountID, gObj[iUserIndex].Name, iCommand);

	switch ( iCommand )
	{
		case 0:
			this->SetState(CRYWOLF_STATE_NOTIFY_2);
			break;

		case 1:
			this->SetState(CRYWOLF_STATE_READY);
			break;

		case 2:
			if ( this->GetCrywolfState() == CRYWOLF_STATE_READY )
			{
				this->SetState(CRYWOLF_STATE_START);
			}
			else
			{
				MsgOutput(iUserIndex, lMsg.Get(MSGGET(12, 246)));
			}
			break;

		case 3:
			this->SetState(CRYWOLF_STATE_END);
			break;
	}
}
Exemple #21
0
void CGMMng::ControlFireScreamDoubleAttackDistance(LPOBJ lpObj, int iValue)
{
	g_SkillAdditionInfo.SetFireScreamExplosionAttackDistance(iValue);
	MsgOutput(lpObj->m_Index, "파이어스크림 더블데미지 폭발거리 변경:%d", iValue);
}
Exemple #22
0
BOOL CQuestInfo::MonsterItemDrop(LPOBJ lpObj)
{
	int MaxHitUser = gObjMonsterTopHitDamageUser(lpObj);

	if ( MaxHitUser == -1 )
	{
		return false;
	}

	int partycount = gParty.GetPartyCount(gObj[MaxHitUser].PartyNumber);

	if ( partycount > 0 )
	{
		return false;
	}

	LPOBJ lpTarget = &gObj[MaxHitUser];
	int questcount = this->GetQeustCount();
	int foundquest = 0;
	LPQUEST_INFO lpQuestInfo;
	LPQUEST_SUB_INFO lpSubInfo;
	int type;
	int level;
	int x;
	int y;
	float dur = 0;
	int Option1 = 0;
	int Option2 = 0;
	int Option3 = 0;

	

	for ( int i=0;i<MAX_QUEST_INFO;i++)
	{
		lpQuestInfo = this->GetQuestInfo(i);

		if ( lpQuestInfo == NULL )
		{
			continue;
		}

		for ( int n =0;n<lpQuestInfo->QuestSubInfoCount;n++)
		{
			lpSubInfo = this->GetSubquestInfo(lpTarget, lpQuestInfo, n);
			
			if ( lpSubInfo != NULL )
			{
				if ( lpSubInfo->QuestType == 1 && lpSubInfo->NeedTargetMinLevel != -1 ) //Third Quest Fix, only READS Monster Level Min and Max if Level Min is != 1
				{
					if ( lpObj->Level >= lpSubInfo->NeedTargetMinLevel)
					{
						if ( lpObj->Level <= lpSubInfo->NeedTargetMaxLevel )
						{
							if ( this->GetQuestState(lpTarget, lpQuestInfo->QuestIndex) == TRUE )
							{
								if ( (rand() % ITEM_QUEST_DROP_PROBABILITY) < lpSubInfo->NeedDropRate)
								{
									int itemcount = gObjGetItemCountInIventory(MaxHitUser, lpSubInfo->NeedType,
										lpSubInfo->NeedSubType, lpSubInfo->ItemLevel);

									if ( itemcount >= lpSubInfo->NeedNumber)
									{
										continue;
									}

									dur = 0;
									x = lpObj->X;
									y = lpObj->Y;
									level = lpSubInfo->ItemLevel;
									type = ItemGetNumberMake(lpSubInfo->NeedType, lpSubInfo->NeedSubType);
									ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, x, y, type, level, dur, Option1,
										Option2, Option3, MaxHitUser, 0, 0);
									LogAddTD("[Quest] Quest Item Drop [%s]: [%s][%s] (%s) (%d,%d)", lpObj->Name,
										lpTarget->AccountID, lpTarget->Name, lpQuestInfo->Name, lpSubInfo->NeedType,
										lpSubInfo->NeedSubType);
									qMsg->Msg(lpObj->m_Index, "@[Quest] Your item droped.");
									return true;
								}
							}
						}
					}
				}
				//Start of S3 Quest
				if ( lpSubInfo->QuestType == 1 && lpSubInfo->NeedTargetMinLevel == -1 ) //Third Quest
				{
					if ( lpObj->Class == lpSubInfo->NeedTargetMaxLevel) //READS Monster Class on TargetMax Level Category (for Original Quest.txt)
					{
						if ( this->GetQuestState(lpTarget, lpQuestInfo->QuestIndex) == TRUE )
							{
								if ( (rand() % ITEM_QUEST_DROP_PROBABILITY) < lpSubInfo->NeedDropRate)
								{
									int itemcount = gObjGetItemCountInIventory(MaxHitUser, lpSubInfo->NeedType,
										lpSubInfo->NeedSubType, lpSubInfo->ItemLevel);

									if ( itemcount >= lpSubInfo->NeedNumber)
									{
										continue;
									}

									dur = 0;
									x = lpObj->X;
									y = lpObj->Y;
									level = lpSubInfo->ItemLevel;
									type = ItemGetNumberMake(lpSubInfo->NeedType, lpSubInfo->NeedSubType);
									ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, x, y, type, level, dur, Option1,
										Option2, Option3, MaxHitUser, 0, 0);
									LogAddTD("[Season3 Quest] Quest Item Drop [%s]: [%s][%s] (%s) (%d,%d)", lpObj->Name,
										lpTarget->AccountID, lpTarget->Name, lpQuestInfo->Name, lpSubInfo->NeedType,
										lpSubInfo->NeedSubType);
									return true;
								}
							}
					}
				}
				if ( lpSubInfo->QuestType == 2 && lpSubInfo->NeedTargetMinLevel == -1 ) //Third Quest for Kill Count
				{
					if ( lpObj->Class == lpSubInfo->NeedTargetMaxLevel) //READS Monster Class on TargetMax Level Category (for Original Quest.txt)
					{
						if ( this->GetQuestState(lpTarget, lpQuestInfo->QuestIndex) == TRUE )
						{
							if( lpTarget->m_Quest[1] == 0xF6 && lpTarget->MapNumber == 41 )
							{
								if( lpTarget->m_Quest[30] > 10)
								{
									lpTarget->m_Quest[30] = 0;
								}
								if( lpTarget->m_Quest[31] > 10 )
								{
									lpTarget->m_Quest[31] = 0;
								}
								if( lpTarget->m_Quest[32] > 10 )
								{
									lpTarget->m_Quest[32] = 0;
								}

								if(lpObj->Class == 409 && lpTarget->m_Quest[30] < 10)
								{
									lpTarget->m_Quest[30] += 1;
									MsgOutput(lpTarget->m_Index, "[Quest] (%d/10) Balram(Hero)", lpTarget->m_Quest[30]);
								}

								if(lpObj->Class == 410 && lpTarget->m_Quest[31] < 10)
								{
									lpTarget->m_Quest[31] += 1;
									MsgOutput(lpTarget->m_Index, "[Quest] (%d/10) Death Spirit(Hero)", lpTarget->m_Quest[31]);
								}

								if(lpObj->Class == 411 && lpTarget->m_Quest[32] < 10)
								{
									lpTarget->m_Quest[32] += 1;
									lpTarget->m_Quest[34] += 1;
									MsgOutput(lpTarget->m_Index, "[Quest] (%d/10) Soram(Hero).", lpTarget->m_Quest[32]);
								}
							}
							if( lpTarget->m_Quest[1] == 0xDA && lpTarget->MapNumber == 42 )
							{
								if( lpTarget->m_Quest[34] > 1 )
								{
									lpTarget->m_Quest[34] = 0;
								}
									
								if(lpObj->Class == 412 && lpTarget->m_Quest[34] < 1)
								{
									lpTarget->m_Quest[34] += 1;
									MsgOutput(lpTarget->m_Index, "[Quest] (%d/1) Dark Elf(Hero)", lpTarget->m_Quest[34]);
								}
							}
						//End of S3 Quest
						}
					}
				}
			//
			}
		}

		foundquest++;

		if ( foundquest == questcount )
		{
			break;
		}
	}

	return false;
}
Exemple #23
0
BOOL CGuardian::CreateGuardian(int iIndex)
{	
	MsgOutput(iIndex, lMsg.Get( MSGGET(6,104) ));
	return true;
}
Exemple #24
0
void CGMMng::ControlInfinityArrowMPConsumption2(LPOBJ lpObj, int iValue)
{
	g_SkillAdditionInfo.SetInfinityArrowMPConsumptionPlus2(iValue);
	MsgOutput(lpObj->m_Index, "ÀÎÇÇ´ÏƼ ¾Ö·Î¿ì MP ¼Ò¸ð·® º¯°æ(+2) : %d",iValue);

}
Exemple #25
0
BOOL CJewelMixSystem::MixJewel( int iIndex, int iJewelType, int iMixType)
{
	if ( !gObjIsConnected(iIndex))
		return FALSE;

	if ( gObjCheckInventorySerial0Item(&gObj[iIndex]))
	{
		MsgOutput(iIndex, lMsg.Get(MSGGET(13,26)));
		GCAnsJewelMix(iIndex, 4);

		LogAddTD("[ANTI-HACK][Serial 0 Item] [Mix Jewel] (%s)(%s)",
			gObj[iIndex].AccountID, gObj[iIndex].Name);

		return FALSE;
	}

	if ( gObj[iIndex].m_IfState.type == 1 )
	{
		LogAddTD("[JewelMix] [%s][%s] Attempted ItemCopy using Trade Window",
			gObj[iIndex].AccountID, gObj[iIndex].Name);
		return FALSE;
	}

	if ( gObj[iIndex].ChaosLock == TRUE )
	{
		LogAddTD("[JewelMix] [%s][%s] Chaos Mix is already working",
			gObj[iIndex].AccountID, gObj[iIndex].Name);

		GCAnsJewelMix(iIndex, 0);
		return FALSE;
	}

	gObj[iIndex].ChaosLock = TRUE;

	if ( !CHECK_LIMIT(iJewelType, 10) )
	{
		LogAddTD("[JewelMix] [%s][%s] Mix iJewelType is out of bound : %d",
			gObj[iIndex].AccountID, gObj[iIndex].Name, iJewelType);

		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelMix(iIndex, 2);
		return FALSE;
	}

	if ( !CHECK_LIMIT(iMixType, 3))
	{
		LogAddTD("[JewelMix] [%s][%s] iMixType is out of bound : %d",
			gObj[iIndex].AccountID, gObj[iIndex].Name, iMixType);

		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelMix(iIndex, 3);
		return FALSE;
	}

	int iItemType = g_JewelMixInfo[iJewelType][iMixType].m_iSourceType;
	int iJewelCount = g_JewelMixInfo[iJewelType][iMixType].m_iJewelCount;
	int iMixMoney = g_JewelMixInfo[iJewelType][iMixType].m_iMixMoney;
	int iChangeType = g_JewelMixInfo[iJewelType][iMixType].m_iChangeType;

	if ( iJewelCount <= 0 )
	{
		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelMix(iIndex, 0);
		return FALSE;
	}

	int iUserJewelCount = gObjGetItemCountInIventory(iIndex, iItemType);

	if ( iJewelCount > iUserJewelCount )
	{
		LogAddTD("[JewelMix] [%s][%s] lack of jewel to mix : %d / %d",
			gObj[iIndex].AccountID, gObj[iIndex].Name,
			iUserJewelCount, iJewelCount);

		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelMix(iIndex, 4);
		return FALSE;
	}

	if ( iMixMoney > gObj[iIndex].Money )
	{
		LogAddTD("[JewelMix] [%s][%s] lack of money to mix : %d / %d",
			gObj[iIndex].AccountID, gObj[iIndex].Name,
			gObj[iIndex].Money, iMixMoney);

		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelMix(iIndex, 5);
		return FALSE;
	}

	int iDelJewelCount = 0;
	BOOL bItemDelOK = FALSE;


	int invSize = MAIN_INVENTORY_SIZE;

	if( gObj[iIndex].pInventoryExtend <= 4 )	{
		invSize = (MAIN_INVENTORY_SIZE)-(32*(4-gObj[iIndex].pInventoryExtend));
	}

	for ( int x= INVETORY_WEAR_SIZE ; x< invSize; x++)
	{
		if ( gObj[iIndex].pInventory[x].IsItem() == TRUE )
		{
			if ( gObj[iIndex].pInventory[x].m_Type == iItemType )
			{
				LogAddTD("[JewelMix] [%s][%s] Mix - Delete Jewel, Type:%d, Level:%d, Serial:%d",
					gObj[iIndex].AccountID, gObj[iIndex].Name,
					gObj[iIndex].pInventory[x].m_Type,
					gObj[iIndex].pInventory[x].m_Level,
					gObj[iIndex].pInventory[x].m_Number);

				gObjInventoryItemSet(iIndex, x, 0xFF);
				gObj[iIndex].pInventory[x].Clear();
				iDelJewelCount++;

				if ( iJewelCount <= iDelJewelCount )
				{
					bItemDelOK = TRUE;
					break;
				}
			}
		}
	}

	GCItemListSend(iIndex);

	if ( bItemDelOK == FALSE )
	{
		LogAddTD("[JewelMix] [%s][%s] lack of jewel to mix (in deleting) : %d / %d",
			gObj[iIndex].AccountID, gObj[iIndex].Name,
			iDelJewelCount, iJewelCount);

		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelMix(iIndex, 0);
		return FALSE;
	}

	ItemSerialCreateSend(iIndex, 235, gObj[iIndex].X,
						gObj[iIndex].Y, iChangeType,
						iMixType, 0, 0, 0, 0,
						iIndex, 0, 0);

	gObj[iIndex].ChaosLock = FALSE;
	gObj[iIndex].Money -= iMixMoney;
	GCMoneySend(iIndex, gObj[iIndex].Money);
	GCAnsJewelMix(iIndex, 1);

	LogAddTD("[JewelMix] [%s][%s] jewel mix succeed : ItemType:%d, JewelCount:%d",
		gObj[iIndex].AccountID, gObj[iIndex].Name,
		iItemType, iJewelCount);

	return TRUE;
}
Exemple #26
0
void CChaosCard::ChaosCardMix(LPOBJ lpObj)
{
	lpObj->ChaosLock = TRUE;
	int iChaosCardCount = 0;
	int iChaosMoney = 0;
	int iInvalidItemCount = 0;

	PMSG_CHAOSMIXRESULT pMsg;

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

	for ( int n=0;n<CHAOS_BOX_SIZE;n++)
	{
		if ( lpObj->pChaosBox[n].IsItem() == TRUE )
		{
			if ( lpObj->pChaosBox[n].m_Type == ITEMGET(14,54) )
			{
				iChaosCardCount++;
			}
			else
			{
				iInvalidItemCount++;
			}
		}
	}

	if ( iChaosCardCount == 0 )
	{
		return;
	}

	if ( iInvalidItemCount > 0 )
	{
		return;
	}

	if ( iChaosCardCount > 1 )
	{
		MsgOutput(lpObj->m_Index,"[ChaosCard]: Can only use 1 card at the same time");
		gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size);
		lpObj->ChaosLock = FALSE;
		return;
	}

	LogChaosItem(lpObj,"ChaosCard");
	CLog.LogAdd("[ChaosCard] Chaos Mix Start");
	lpObj->ChaosSuccessRate = 100;

	BYTE Socket[5];
	Socket[0] = 0xFF;
	Socket[1] = 0xFF;
	Socket[2] = 0xFF;
	Socket[3] = 0xFF;
	Socket[4] = 0xFF;

	if ( (rand()%100) < lpObj->ChaosSuccessRate )
	{
		int ItemNum = ITEMGET(14,14);
		int Level = 0;

		ItemSerialCreateSend(lpObj->m_Index, -1, 0, 0, ItemNum, Level, 0, 0, 0, 0, -1, 0, 0, Socket);
		::gObjInventoryCommit(lpObj->m_Index);

		CLog.LogAdd("[ChaosCard] [%s][%s] CBMix Success %d ", lpObj->AccountID, lpObj->Name, lpObj->ChaosSuccessRate);
	}
	else
	{
		gChaosBox.ChaosBoxInit(lpObj);
		::GCUserChaosBoxSend(lpObj, 1);
		gSendProto.DataSend(lpObj->m_Index, (UCHAR*)&pMsg, pMsg.h.size);
		CLog.LogAdd("[ChaosCard] [%s][%s] CBMix Fail %d ", lpObj->AccountID, lpObj->Name, lpObj->ChaosSuccessRate);
		lpObj->ChaosLock = FALSE;
	}
}
Exemple #27
0
int CLifeStone::CreateLifeStone(int iIndex)
{
	LPOBJ lpObj = &gObj[iIndex];
	int iMonsterIndex = -1;
	BYTE cX = (BYTE)lpObj->X;
	BYTE cY = (BYTE)lpObj->Y;

	if ( g_CastleSiegeSync.GetCastleState() != 7 )
	{
		MsgOutput(iIndex, "You can't summon the Life Stone after the Siege begins.");
		return FALSE;
	}

	if ( lpObj->GuildStatus != 0x80 )
		return FALSE;

	if ( lpObj->m_btCsJoinSide < 2 )
	{
		MsgOutput(iIndex, "Can only be used by the Offensive Alliance.");
		return FALSE;
	}

	if ( lpObj->lpGuild->lpLifeStone  )
	{
		MsgOutput(iIndex, "Life Stone has already been summoned.");
		return FALSE;
	}

	if ( cX > 150 && cX < 210 && cY > 175 && cY < 230 )
	{
		MsgOutput(iIndex, "You can't summon the Life Stone inside the Dragon Tower.");
		return FALSE;
	}

	BYTE btMapAttr = MapC[lpObj->MapNumber].GetAttr(cX, cY);

	if ( gObj[iIndex].MapNumber != MAP_INDEX_CASTLESIEGE )
	{
		MsgOutput(iIndex, "This is not a map of the Offensive Alliance.");
		return FALSE;
	}

	iMonsterIndex = gObjAddMonster(lpObj->MapNumber);

	if ( iMonsterIndex >= 0 )
	{
		MONSTER_ATTRIBUTE * MAttr = gMAttr.GetAttr(278);

		if ( MAttr == NULL )
		{
			gObjDel(iMonsterIndex);
			return FALSE;
		}

		gObjSetMonster(iMonsterIndex, 278);

		gObj[iMonsterIndex].Live = TRUE;
		gObj[iMonsterIndex].Life = MAttr->m_Hp;
		gObj[iMonsterIndex].MaxLife = MAttr->m_Hp;
		gObj[iMonsterIndex].m_PosNum = -1;
		gObj[iMonsterIndex].X = cX;
		gObj[iMonsterIndex].Y = cY;
		gObj[iMonsterIndex].MTX = cX;
		gObj[iMonsterIndex].MTY = cY;
		gObj[iMonsterIndex].TX = cX;
		gObj[iMonsterIndex].TY = cY;
		gObj[iMonsterIndex].m_OldX = cX;
		gObj[iMonsterIndex].m_OldY = cY;
		gObj[iMonsterIndex].StartX = cX;
		gObj[iMonsterIndex].StartY = cY;
		gObj[iMonsterIndex].MapNumber = lpObj->MapNumber;
		gObj[iMonsterIndex].m_MoveRange = 0;
		gObj[iMonsterIndex].Level = MAttr->m_Level;
		gObj[iMonsterIndex].Type = OBJ_MONSTER;
		gObj[iMonsterIndex].MaxRegenTime = 1000;
		gObj[iMonsterIndex].Dir = 1;
		gObj[iMonsterIndex].RegenTime = GetTickCount();
		gObj[iMonsterIndex].m_Attribute = 0;
		gObj[iMonsterIndex].DieRegen = 0;
		gObj[iMonsterIndex].m_btCsNpcType = OBJ_NPC;
		gObj[iMonsterIndex].m_btCsJoinSide = lpObj->m_btCsJoinSide;
		gObj[iMonsterIndex].lpGuild = lpObj->lpGuild;
		gObj[iMonsterIndex].m_btCreationState = 0;
		lpObj->lpGuild->lpLifeStone = &gObj[iMonsterIndex];

		MsgOutput(iIndex, "Life Stone summon succeeded!");

		LogAdd("[CastleSiege] LifeStone is created - [%s] [%s][%s] (Map:%d)(X:%d, Y:%d)",
			lpObj->lpGuild->Name, lpObj->AccountID, lpObj->Name, lpObj->MapNumber, cX, cY);

		lpObj->m_btLifeStoneCount++;

	}
	else
	{
		MsgOutput(iIndex, "Life Stone summon failed!");
		return FALSE;
	}

	return TRUE;
}
Exemple #28
0
void CGMMng::ControlFireScreamDoubleAttackDistance(LPOBJ lpObj, int iValue)
{
	g_SkillAdditionInfo.SetFireScreamExplosionAttackDistance(iValue);
	MsgOutput(lpObj->m_Index, "ÆÄÀ̾ũ¸² ´õºíµ¥¹ÌÁö Æø¹ß°Å¸® º¯°æ:%d", iValue);
}
Exemple #29
0
int CLifeStone::CreateLifeStone(int iIndex)
{
	LPOBJ lpObj = &gObj[iIndex];
	int iMonsterIndex = -1;
	BYTE cX = lpObj->X;
	BYTE cY = lpObj->Y;

	if ( g_CastleSiegeSync.GetCastleState() != CASTLESIEGE_STATE_STARTSIEGE )
	{
		MsgOutput(iIndex, lMsg.Get(1645));
		return FALSE;
	}

	if ( lpObj->GuildStatus != G_MASTER )
	{
		return FALSE;
	}

	if ( lpObj->m_btCsJoinSide < 2 )
	{
		MsgOutput(iIndex, lMsg.Get(1641)); //HermeX Fix
		return FALSE;
	}

	if ( lpObj->lpGuild->lpLifeStone  ) //HermeX Fix
	{
		MsgOutput(iIndex, lMsg.Get(1642)); //HermeX Fix
		return FALSE;
	}
	
	if( cX > 150 && cX < 210 && cY > 175 && cY < 230 )
	{
		MsgOutput(iIndex, lMsg.Get(1644)); //HermeX Fix
		return FALSE;
	}

	BYTE btMapAttr = MapC[lpObj->MapNumber].GetAttr(cX, cY);
	
	if ( btMapAttr & 16 != 16 ) //siege camp?
	{
		//return FALSE;
	}

	if ( gObj[iIndex].MapNumber != MAP_INDEX_CASTLESIEGE )
	{
		MsgOutput(iIndex, lMsg.Get(1627)); //HermeX Fix
		return FALSE;
	}
	
	iMonsterIndex = gObjAddMonster(lpObj->MapNumber);

	if ( iMonsterIndex >= 0 )
	{
	
		MONSTER_ATTRIBUTE * MAttr = gMAttr.GetAttr(278);
	
		if ( MAttr == NULL )
		{
			gObjDel(iMonsterIndex);
			return FALSE;
		}

		gObjSetMonster(iMonsterIndex, 278);
		gObj[iMonsterIndex].Live = TRUE;
		gObj[iMonsterIndex].Life = MAttr->m_Hp;
		gObj[iMonsterIndex].MaxLife = MAttr->m_Hp;
		gObj[iMonsterIndex].m_PosNum = -1;
		gObj[iMonsterIndex].X = cX;
		gObj[iMonsterIndex].Y = cY;
		gObj[iMonsterIndex].MTX = cX;
		gObj[iMonsterIndex].MTY = cY;
		gObj[iMonsterIndex].TX = cX;
		gObj[iMonsterIndex].TY = cY;
		gObj[iMonsterIndex].m_OldX = cX;
		gObj[iMonsterIndex].m_OldY = cY;
		gObj[iMonsterIndex].StartX = cX;
		gObj[iMonsterIndex].StartY = cY;
		gObj[iMonsterIndex].MapNumber = lpObj->MapNumber;
		gObj[iMonsterIndex].m_MoveRange = 0;
		gObj[iMonsterIndex].Level = MAttr->m_Level;
		gObj[iMonsterIndex].Type = OBJ_MONSTER;
		gObj[iMonsterIndex].MaxRegenTime = 1000;
		gObj[iMonsterIndex].Dir = 1;
		gObj[iMonsterIndex].RegenTime = GetTickCount();
		gObj[iMonsterIndex].m_Attribute = 0;
		gObj[iMonsterIndex].DieRegen = 0;
		gObj[iMonsterIndex].m_btCsNpcType = OBJ_NPC; //HermeX Fix
		gObj[iMonsterIndex].m_btCsJoinSide = lpObj->m_btCsJoinSide;
		gObj[iMonsterIndex].lpGuild = lpObj->lpGuild;
		gObj[iMonsterIndex].m_btCreationState = 0;

		lpObj->lpGuild->lpLifeStone = &gObj[iMonsterIndex]; //SirMaster Fix
		gObj[iMonsterIndex].m_iCreatedActivationTime = 0; //new

		MsgOutput(iIndex, lMsg.Get(1646));
		LogAddTD("[CastleSiege] LifeStone is created - [%s] [%s][%s] (Map:%d)(X:%d, Y:%d)",lpObj->lpGuild->Name,
		lpObj->AccountID,lpObj->Name,lpObj->MapNumber,cX,cY);
		lpObj->m_btLifeStoneCount++;
	}
	else
	{
		MsgOutput(iIndex, lMsg.Get(1647));
		return FALSE;
	}
	return TRUE;
}
Exemple #30
0
BOOL CJewelMixSystem::UnMixJewel(int iIndex, int iJewelType, int iJewelLevel, int iInventoryPos)
{
	if ( !gObjIsConnected(iIndex))
		return FALSE;

	if ( gObjCheckInventorySerial0Item(&gObj[iIndex]))
	{
		MsgOutput(iIndex, lMsg.Get(MSGGET(13,26)));
		GCAnsJewelUnMix(iIndex, 0);

		LogAddTD("[ANTI-HACK][Serial 0 Item] [UnMix Jewel] (%s)(%s)",
			gObj[iIndex].AccountID, gObj[iIndex].Name);

		return FALSE;
	}

	if ( gObj[iIndex].m_IfState.type == 1 )
	{
		LogAddTD("[JewelMix] [%s][%s] Attempted ItemCopy using Trade Window",
			gObj[iIndex].AccountID, gObj[iIndex].Name);
		return FALSE;
	}

	if ( gObj[iIndex].ChaosLock == TRUE )
	{
		LogAddTD("[JewelMix] [%s][%s] Chaos Mix is already working",
			gObj[iIndex].AccountID, gObj[iIndex].Name);

		GCAnsJewelUnMix(iIndex, 0);
		return FALSE;
	}

	gObj[iIndex].ChaosLock = TRUE;

	if ( !CHECK_LIMIT(iJewelType, 10) )
	{
		LogAddTD("[JewelMix] [%s][%s] UnMix iJewelType is out of bound : %d",
			gObj[iIndex].AccountID, gObj[iIndex].Name, iJewelType);

		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelUnMix(iIndex, 2);
		return FALSE;
	}

	if ( !CHECK_LIMIT(iInventoryPos, MAIN_INVENTORY_SIZE))
	{
		LogAddTD("[JewelMix] [%s][%s] iInventoryPos is out of bound : %d",
			gObj[iIndex].AccountID, gObj[iIndex].Name, iInventoryPos);

		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelUnMix(iIndex, 5);
		return FALSE;
	}

	int iInventoryItemType;
	int iInventoryItemLevel;

	if ( gObj[iIndex].pInventory[iInventoryPos].IsItem() == TRUE )
	{
		if ( gObj[iIndex].pInventory[iInventoryPos].m_Level == iJewelLevel )
		{
			iInventoryItemType = gObj[iIndex].pInventory[iInventoryPos].m_Type;
			iInventoryItemLevel = gObj[iIndex].pInventory[iInventoryPos].m_Level;
		}
		else
		{
			LogAddTD("[JewelMix] [%s][%s] iJewelLevel is different from request : %d / %d",
				gObj[iIndex].AccountID, gObj[iIndex].Name,
				gObj[iIndex].pInventory[iInventoryPos].m_Level, iJewelLevel);

			gObj[iIndex].ChaosLock = FALSE;
			GCAnsJewelUnMix(iIndex, 3);
			return FALSE;
		}
	}
	else
	{
		LogAddTD("[JewelMix] [%s][%s] Item to unmix is not exist",
			gObj[iIndex].AccountID, gObj[iIndex].Name);
	
		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelUnMix(iIndex, 4);
		return FALSE;
	}

	if ( !CHECK_LIMIT(iInventoryItemLevel, 3))
	{
		LogAddTD("[JewelMix] [%s][%s] iInventoryItemLevel is out of bound : %d",
			gObj[iIndex].AccountID, gObj[iIndex].Name, iInventoryItemLevel);

		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelUnMix(iIndex, 3);
		return FALSE;
	}

	int iItemType = g_JewelMixInfo[iJewelType][iInventoryItemLevel].m_iChangeType;
	int iJewelCount = g_JewelMixInfo[iJewelType][iInventoryItemLevel].m_iJewelCount;
	int iChangeType = g_JewelMixInfo[iJewelType][iInventoryItemLevel].m_iSourceType;
	int iMixMoney = 1000000;

	if ( iInventoryItemType != iItemType )
	{
		LogAddTD("[JewelMix] [%s][%s] iItemType is different from request : %d / %d",
			gObj[iIndex].AccountID, gObj[iIndex].Name,
			iInventoryItemType, iItemType);

		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelUnMix(iIndex, 6);
		return FALSE;
	}

	if ( iMixMoney > gObj[iIndex].Money )
	{
		LogAddTD("[JewelMix] [%s][%s] lack of money to unmix : %d / %d",
			gObj[iIndex].AccountID, gObj[iIndex].Name,
			gObj[iIndex].Money, iMixMoney);

		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelUnMix(iIndex, 8);
		return FALSE;
	}

	int invSize = INVENTORY_MAP_SIZE-PSHOP_MAP_SIZE;

	if( gObj[iIndex].pInventoryExtend <= 4 )	{
		invSize = (INVENTORY_MAP_SIZE-PSHOP_MAP_SIZE)-(32*(4-gObj[iIndex].pInventoryExtend));
	}

	int iEmptyCount = 0;

	int x;
	for ( x=0;x<invSize;x++)
	{
		if ( gObj[iIndex].pInventoryMap[x] == 0xFF )
		{
			iEmptyCount++;
		}
	}

	if ( iEmptyCount < iJewelCount )
	{
		LogAddTD("[JewelMix] [%s][%s] lack of empty slot to unmix : %d / %d",
			gObj[iIndex].AccountID, gObj[iIndex].Name,
			iEmptyCount, iJewelCount);

		gObj[iIndex].ChaosLock = FALSE;
		GCAnsJewelUnMix(iIndex, 7);
		return FALSE;
	}

	LogAddTD("[JewelMix] [%s][%s] UnMix - Delete Jewel, Type:%d, Level:%d, Serial:%d",
		gObj[iIndex].AccountID, gObj[iIndex].Name,
		gObj[iIndex].pInventory[iInventoryPos].m_Type,
		gObj[iIndex].pInventory[iInventoryPos].m_Level,
		gObj[iIndex].pInventory[iInventoryPos].m_Number);

	gObjInventoryItemSet(iIndex, iInventoryPos, 0xFF);
	gObjInventoryDeleteItem(iIndex, iInventoryPos);
	GCInventoryItemDeleteSend(iIndex, iInventoryPos, 1);

	int iCrtJewelCount = 0;
	BOOL bItemCrtOK = FALSE;

	for ( x=0;x<invSize;x++)
	{
		if ( gObj[iIndex].pInventoryMap[x] == 0xFF )
		{
			ItemSerialCreateSend(iIndex, 235, gObj[iIndex].X, gObj[iIndex].Y,
								iChangeType, 0, 0, 0, 0, 0,
								iIndex, 0, 0);

			iCrtJewelCount++;

			if ( iJewelCount <= iCrtJewelCount )
			{
				bItemCrtOK = TRUE;
				break;
			}
		}
	}

	gObj[iIndex].ChaosLock = FALSE;

	if ( bItemCrtOK == TRUE )
	{
		LogAddTD("[JewelMix] [%s][%s] jewel unmix succeed : ItemType:%d, JewelCount:%d",
			gObj[iIndex].AccountID, gObj[iIndex].Name,
			iItemType, iJewelCount);

		gObj[iIndex].Money -= iMixMoney;
		GCMoneySend(iIndex, gObj[iIndex].Money);
		GCAnsJewelUnMix(iIndex, 1);
	}
	else
	{
		LogAddTD("[JewelMix] [%s][%s] jewel unmix failed : ItemType:%d, JewelCount:%d",
			gObj[iIndex].AccountID, gObj[iIndex].Name,
			iItemType, iJewelCount);

		GCAnsJewelUnMix(iIndex, 0);
	}

	return TRUE;
}