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;
}
void gObjSetItemApply(LPOBJ lpObj)
{
	lpObj->m_AttackDamageMinLeft += lpObj->SetOpAddAttackDamage;
	lpObj->m_AttackDamageMaxLeft += lpObj->SetOpAddAttackDamage;
	lpObj->m_AttackDamageMinRight += lpObj->SetOpAddAttackDamage;
	lpObj->m_AttackDamageMaxRight += lpObj->SetOpAddAttackDamage;

	lpObj->m_AttackDamageMinLeft += lpObj->SetOpAddMinAttackDamage;
	lpObj->m_AttackDamageMinRight += lpObj->SetOpAddMinAttackDamage;

	lpObj->m_AttackDamageMaxLeft += lpObj->SetOpAddMaxAttackDamage;
	lpObj->m_AttackDamageMaxRight += lpObj->SetOpAddMaxAttackDamage;

	lpObj->m_MagicDamageMin += lpObj->m_MagicDamageMin * lpObj->SetOpAddMagicPower / 100;
	lpObj->m_MagicDamageMax += lpObj->m_MagicDamageMax * lpObj->SetOpAddMagicPower / 100;

	lpObj->AddLife += INT(lpObj->AddVitality * gCharInfo.sCharInfo[lpObj->Class].VitalityToLife);
	lpObj->AddMana += INT(lpObj->AddEnergy * gCharInfo.sCharInfo[lpObj->Class].EnergyToMana);

	lpObj->m_CriticalDamage += lpObj->SetOpAddCriticalDamageSuccessRate;
	lpObj->m_ExcelentDamage += lpObj->SetOpAddExDamageSuccessRate;

	if ( lpObj->pInventory[10].IsSetItem() )
	{
		lpObj->pInventory[10].PlusSpecialSetRing((LPBYTE)lpObj->m_AddResistance);
	}

	if ( lpObj->pInventory[11].IsSetItem() )
	{
		lpObj->pInventory[11].PlusSpecialSetRing((LPBYTE)lpObj->m_AddResistance);
	}

	if ( lpObj->pInventory[9].IsSetItem() )
	{
		lpObj->pInventory[9].PlusSpecialSetRing((LPBYTE)lpObj->m_AddResistance);
	}

	if ( lpObj->SetOpTwoHandSwordImproveDamage )
	{
		if ( !lpObj->pInventory[1].IsItem() && !lpObj->pInventory[0].IsItem() )
		{
			lpObj->SetOpTwoHandSwordImproveDamage = 0;
		}

		if ( lpObj->pInventory[1].IsItem() && lpObj->pInventory[1].m_TwoHand == FALSE )
		{
			lpObj->SetOpTwoHandSwordImproveDamage = 0;
		}

		if ( lpObj->pInventory[0].IsItem() && lpObj->pInventory[0].m_TwoHand == FALSE )
		{
			lpObj->SetOpTwoHandSwordImproveDamage = 0;
		}
	}

	if ( (lpObj->MaxLife + lpObj->AddLife ) < lpObj->Life )
	{
		lpObj->Life = lpObj->MaxLife + lpObj->AddLife;
		GCReFillSend(lpObj->m_Index, lpObj->Life, 0xFF, 0, lpObj->iShield);
	}

	gObjSetBP(lpObj->m_Index);

	if ( (lpObj->MaxMana + lpObj->AddMana ) < lpObj->Mana )
	{
		lpObj->Mana = lpObj->MaxMana + lpObj->AddMana;
		GCManaSend(lpObj->m_Index, lpObj->Mana, 0xFF, 0, lpObj->BP);
	}

	lpObj->m_Defense += lpObj->SetOpAddDefence * 10 / 20;
	lpObj->m_Defense += lpObj->m_Defense * lpObj->SetOpAddDefenceRate / 100;

	if ( lpObj->pInventory[1].m_Type >= ITEMGET(6,0) && lpObj->pInventory[1].m_Type < ITEMGET(7,0) )
	{
		lpObj->m_Defense += lpObj->m_Defense * lpObj->SetOpImproveSheldDefence / 100;
	}
}
bool cChat::AddCommands(LPOBJ gObj, char *Msg, int Type)
{
	int aIndex = User.GetPlayerIndex(gObj->Name);

	switch (Type)
	{
	case 0:
		if (CheckCommand(gObj, Configs.Commands.AddPointEnabled, GmSystem.NONE, Configs.Commands.AddPriceZen,
			Configs.Commands.AddPointLevelReq, 1, 0, "AddStats", "/addstr <num>", Msg))
			return true;
		break;
	case 1:
		if (CheckCommand(gObj, Configs.Commands.AddPointEnabled, GmSystem.NONE, Configs.Commands.AddPriceZen, Configs.Commands.AddPointLevelReq, 1, 0, "AddStats", "/addagi <num>", Msg))
			return true;
		break;
	case 2:
		if (CheckCommand(gObj, Configs.Commands.AddPointEnabled, GmSystem.NONE, Configs.Commands.AddPriceZen, Configs.Commands.AddPointLevelReq, 1, 0, "AddStats", "/addvit <num>", Msg))
			return true;
		break;
	case 3:
		if (CheckCommand(gObj, Configs.Commands.AddPointEnabled, GmSystem.NONE, Configs.Commands.AddPriceZen, Configs.Commands.AddPointLevelReq, 1, 0, "AddStats", "/addene <num>", Msg))
			return true;
		break;
	case 4:
		if (CheckCommand(gObj, Configs.Commands.AddPointEnabled, GmSystem.NONE, Configs.Commands.AddPriceZen, Configs.Commands.AddPointLevelReq, 1, 0, "AddStats", "/addcmd <num>", Msg))
			return true;
		if (gObj->Class != 4)
		{
			TNotice.SendNotice(aIndex, 1, "[AddStats] You are not Dark Lord!!!");
			//MessageLog(1, gObj, "[AddStats] You are not Dark Lord!!!");
			return true;
		}
		break;
	}
	DWORD Points;
	sscanf(Msg, "%d", &Points);

	if (Configs.Commands.MaxAddedStats > 0 && Configs.Commands.MaxAddedStats <= Points)
	{
		TNotice.SendNotice(aIndex, 1, "[AddStats] You can't add more than %d stats!!!", Configs.Commands.MaxAddedStats);
		return true;
	}

	int MaxPoints = 32767;
	//if(Configs.Enable65kStats >= 1)
	//	MaxPoints = -536;	

	int Stats = 0;
	bool bResult = false;
	switch (Type)
	{
	case 0x00:
		Stats = gObj->Strength;
		if (gObj->Class == 0)
			MaxPoints;
		else if (gObj->Class == 1)
			MaxPoints;
		else if (gObj->Class == 2)
			MaxPoints;
		else if (gObj->Class == 3)
			MaxPoints;
		else if (gObj->Class == 4)
			MaxPoints;
		else if (gObj->Class == 5)
			MaxPoints;
		break;
	case 0x01:
		Stats = gObj->Dexterity;
		if (gObj->Class == 0)
			MaxPoints;
		else if (gObj->Class == 1)
			MaxPoints;
		else if (gObj->Class == 2)
			MaxPoints;
		else if (gObj->Class == 3)
			MaxPoints;
		else if (gObj->Class == 4)
			MaxPoints;
		else if (gObj->Class == 5)
			MaxPoints;
		break;
	case 0x02:
		Stats = gObj->Vitality;
		if (gObj->Class == 0)
			MaxPoints;
		else if (gObj->Class == 1)
			MaxPoints;
		else if (gObj->Class == 2)
			MaxPoints;
		else if (gObj->Class == 3)
			MaxPoints;
		else if (gObj->Class == 4)
			MaxPoints;
		else if (gObj->Class == 5)
			MaxPoints;
		break;
	case 0x03:
		Stats = gObj->Energy;
		if (gObj->Class == 0)
			MaxPoints;
		else if (gObj->Class == 1)
			MaxPoints;
		else if (gObj->Class == 2)
			MaxPoints;
		else if (gObj->Class == 3)
			MaxPoints;
		else if (gObj->Class == 4)
			MaxPoints;
		else if (gObj->Class == 5)
			MaxPoints;
		break;
	case 0x04:
		Stats = gObj->Leadership;
		if (gObj->Class == 4)
			MaxPoints;
		break;
	}

	int MaxPointsTemp = MaxPoints;
	if (MaxPoints > 32767)
		MaxPoints = -32768 + (MaxPoints - 32767);

	if (((MaxPoints > 0) && (Stats >= MaxPoints || Stats < 0)) ||
		((MaxPoints < 0) && (Stats < 0) && (Stats >= MaxPoints)))
	{
		TNotice.SendNotice(aIndex, 1, "[AddStats] You have max points for this type!!!");
		return true;
	}

	int StatsTemp = Stats;
	Stats += Points;
	if (gObj->LevelUpPoint < Points)
	{
		TNotice.SendNotice(aIndex, 1, "[AddStats] You don't have enough points to add. Need %d more.", Points - gObj->LevelUpPoint);
		return true;
	}

	if (((MaxPoints > 0) && (Stats > MaxPoints || Stats < 0)) ||
		((MaxPoints < 0) && (Stats < 0) && (Stats > MaxPoints)))
	{
		TNotice.SendNotice(aIndex, 1, "[AddStats] You can't add more than %d points for this type!!!", MaxPoints - StatsTemp);
		return true;
	}

	TakeCommand(gObj, Configs.Commands.AddPriceZen, "AddStats");

	switch (Type)
	{
	case 0x00://str
	{
		//PMSG_CHARREGEN pMsg;
		PMSG_STAT_UPDATE pMsg;
		PHeadSetB((LPBYTE)&pMsg, 0x2C, sizeof(PMSG_STAT_UPDATE));
		pMsg.result = 0;
		pMsg.btFruitType = 3;
		pMsg.btStatValue = Points;
		gObj->Strength += Points;
		gObj->LevelUpPoint -= Points;

		GCLevelUpMsgSend(gObj->m_Index, 1);
		gObjCalCharacter(gObj->m_Index);
		gObjSetBP(gObj->m_Index);

		DataSend(gObj->m_Index, (char*)&pMsg, pMsg.h.size);
		//Utilits.SendEffect(gObj, 5);
		return true;
	}
	case 0x01://agi
	{
		PMSG_STAT_UPDATE pMsg;
		PHeadSetB((LPBYTE)&pMsg, 0x2C, sizeof(PMSG_STAT_UPDATE));
		pMsg.result = 0;
		pMsg.btFruitType = 2;
		pMsg.btStatValue = Points;
		gObj->Dexterity += Points;
		gObj->LevelUpPoint -= Points;

		GCLevelUpMsgSend(gObj->m_Index, 1);
		gObjCalCharacter(gObj->m_Index);
		gObjSetBP(gObj->m_Index);

		DataSend(gObj->m_Index, (char*)&pMsg, pMsg.h.size);

		return true;
	}
	case 0x02://vit
	{
		PMSG_STAT_UPDATE pMsg;
		PHeadSetB((LPBYTE)&pMsg, 0x2C, sizeof(PMSG_STAT_UPDATE));
		pMsg.result = 0;
		pMsg.btStatValue = Points;
		pMsg.btFruitType = 1;
		DataSend(gObj->m_Index, (char*)&pMsg, pMsg.h.size);
		gObj->Vitality += Points;
		gObj->MaxLife += gObj->VitalityToLife * Points;

		gObj->LevelUpPoint -= Points;
		GCLevelUpMsgSend(gObj->m_Index, 1);
		gObjCalCharacter(gObj->m_Index);
		GCReFillSend(gObj->m_Index, gObj->MaxLife + gObj->AddLife, 0xFE, 0, gObj->iMaxShield + gObj->iAddShield);
		gObjSetBP(gObj->m_Index);
		//Utilits.SendEffect(gObj, 2);
		return true;
	}
	case 0x03://ene
	{
		PMSG_STAT_UPDATE pMsg;
		PHeadSetB((LPBYTE)&pMsg, 0x2C, sizeof(PMSG_STAT_UPDATE));
		pMsg.result = 0;
		pMsg.btFruitType = 0;
		pMsg.btStatValue = Points;
		DataSend(gObj->m_Index, (char*)&pMsg, pMsg.h.size);
		gObj->Energy += Points;
		gObj->MaxMana += gObj->EnergyToMana * Points;

		gObj->LevelUpPoint -= Points;
		GCLevelUpMsgSend(gObj->m_Index, 1);
		gObjCalCharacter(gObj->m_Index);
		GCManaSend(gObj->m_Index, gObj->MaxMana + gObj->AddMana, 0xFE, 0, gObj->MaxBP + gObj->AddBP);
		gObjSetBP(gObj->m_Index);

		//Utilits.SendEffect(gObj, 2);
		return true;
	}
	case 0x04://cmd
	{
		PMSG_STAT_UPDATE pMsg;
		PHeadSetB((LPBYTE)&pMsg, 0x2C, sizeof(PMSG_STAT_UPDATE));
		pMsg.result = 0;
		pMsg.btFruitType = 4;
		pMsg.btStatValue = Points;
		gObj->Leadership += Points;
		gObj->LevelUpPoint -= Points;

		DataSend(gObj->m_Index, (char*)&pMsg, pMsg.h.size);
		gObjCalCharacter(aIndex);
		gObjSetBP(aIndex);
		GCLevelUpMsgSend(gObj->m_Index, 0);
		//Utilits.SendEffect(gObj, 2);
		return true;
	}
	default:
	{
		return true;
	}
	}

	TNotice.SendNotice(aIndex, 1, "[AddStats] Your stats successfully added!");
	TNotice.SendNotice(aIndex, 1, "Please Relog!");
	return true;
}
Exemple #4
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;
}
Exemple #5
0
//00553d40	-> 100%
void CMasterLevelSystem::DGAnsMasterLevelInfo(BYTE * aRecv)	//OK
{
	if( !aRecv )
	{
		return;
	}
	// ----
	MLP_ANS_MASTERLEVEL_INFO * lpRecvMsg = (MLP_ANS_MASTERLEVEL_INFO*)aRecv;
	// ----
	if( !gObjIsConnectedGP(lpRecvMsg->iUserIndex) )
	{
		return;
	}
	// ----
	int iIndex	= lpRecvMsg->iUserIndex;
	LPOBJ lpObj	= &gObj[lpRecvMsg->iUserIndex];
	// ---
	if( lpObj->m_bMasterLevelDBLoad )
	{
		return;
	}
	// ----
	if( !lpRecvMsg->btResult )
	{
		LogAddTD("[%s][%s] MasterLevel Info Load Fail", lpObj->AccountID, lpObj->Name);	//-> New
		return;
	}
	// ----
	if( lpRecvMsg->btResult == 1 )
	{
		if( lpObj->m_iMasterLevelPoint + lpRecvMsg->nMLPoint != lpRecvMsg->nMLevel )	//-> New (be good use MASTER_MAX_POINT for check)
		{
			LogAddTD("[%s][%s] MasterLevel Info Mismatch!! - Point(%d), Use Point(%d), Level(%d)",
				lpObj->AccountID, lpObj->Name,
				lpRecvMsg->nMLPoint, lpObj->m_bMasterLevelDBLoad, lpRecvMsg->nMLevel);
		}
		// ----
		lpObj->m_bMasterLevelDBLoad = 1;
		// ----
		if( lpRecvMsg->nMLevel == 0 && lpRecvMsg->i64NextMLExp == 0 )
		{
			lpObj->m_nMasterLevel			= lpRecvMsg->nMLevel;
			lpObj->m_i64MasterLevelExp		= lpRecvMsg->i64MLExp;
			lpObj->m_i64NextMasterLevelExp	= m_i64MasterLevelExpTlb[1];
			lpObj->m_iMasterLevelPoint		= lpRecvMsg->nMLPoint;
			// ----
			LogAddTD("[%s][%s] MasterLevel Info First Set [MLevel:%d][MLExp:%I64d][m_i64NextMasterLevelExp:%I64d][MLPoint:%d]",
				lpObj->AccountID, lpObj->Name, lpObj->m_nMasterLevel, 
				lpObj->m_i64MasterLevelExp, lpObj->m_i64NextMasterLevelExp, lpObj->m_iMasterLevelPoint);
			// ----
			this->GDReqMasterLevelInfoSave(lpObj);
		}
		else
		{
			lpObj->m_nMasterLevel			= lpRecvMsg->nMLevel;
			lpObj->m_i64MasterLevelExp		= lpRecvMsg->i64MLExp;
			lpObj->m_i64NextMasterLevelExp	= lpRecvMsg->i64NextMLExp;
			lpObj->m_iMasterLevelPoint		= lpRecvMsg->nMLPoint;
			// ----
			LogAddTD("[%s][%s] Recv MasterLevel Info [MLevel:%d][MLExp:%I64d][m_i64NextMasterLevelExp:%I64d][MLPoint:%d]", 
				lpObj->AccountID, lpObj->Name, lpObj->m_nMasterLevel, 
				lpObj->m_i64MasterLevelExp, lpObj->m_i64NextMasterLevelExp, lpObj->m_iMasterLevelPoint);
			// ----
			this->GDReqMasterLevelInfoSave(lpObj);
		}
		// ----
		lpObj->MaxLife = DCInfo.DefClass[lpObj->Class].Life + (lpObj->Level + lpObj->m_nMasterLevel - 1) * DCInfo.DefClass[lpObj->Class].LevelLife  + ((lpObj->Vitality - DCInfo.DefClass[lpObj->Class].Vitality ) * DCInfo.DefClass[lpObj->Class].VitalityToLife);
		// ----
		if( lpObj->Life > lpObj->MaxLife + lpObj->AddLife )
		{
			lpObj->Life = lpObj->MaxLife;
		}
		// ----
		lpObj->MaxMana = DCInfo.DefClass[lpObj->Class].Mana + (lpObj->Level + lpObj->m_nMasterLevel - 1) * DCInfo.DefClass[lpObj->Class].LevelMana  + ((lpObj->Energy - DCInfo.DefClass[lpObj->Class].Energy ) * DCInfo.DefClass[lpObj->Class].EnergyToMana);
		// ----
		if( lpObj->Mana > lpObj->MaxMana + lpObj->AddMana )
		{
			lpObj->Mana = lpObj->MaxMana;
		}
		// ----
		gObjCalcMaxLifePower(lpObj->m_Index);
		gObjSetBP(lpObj->m_Index);
		gObjCalcShieldPoint(lpObj);
		// ----
		lpObj->iShield = lpObj->iMaxShield + lpObj->iAddShield;
		// ----
		LogAddTD("[%s][%s] Reset Max Value For MasterLevel [MaxLife:%d][MaxMana:%d][MaxSD:%d]", lpObj->AccountID, lpObj->Name, lpObj->MaxLife, lpObj->MaxMana, lpObj->iShield);
		// ----
		this->GCMasterLevelInfo(lpObj);
		// ----
		GCReFillSend(lpObj->m_Index, lpObj->Life, -1, 0, lpObj->iShield);
		GCManaSend(lpObj->m_Index, lpObj->Mana, -1, 0, lpObj->BP);
	}
	// ----
	gObjCalCharacter(lpObj->m_Index);
	// -----
	gObjCalcMLSkillItemOption(lpObj);
	g_MasterSkillSystem.CGReqGetMasterLevelSkillTree(lpObj->m_Index);
}
Exemple #6
0
//005535a0	-> 100%
int	CMasterLevelSystem::MasterLevelUp(LPOBJ lpObj, __int64 iAddExp, bool bEventMapReward, int iMonsterType)	//OK
{
	if( !this->IsMasterLevelUser(lpObj) )
	{
		return false;
	}
	int m_maxMasterLevel = GetPrivateProfileInt("Common", "MaxMasterLevel", 200, gDirPath.GetNewPath("MasterSystem.cfg"));
	int numCoded = 201;
	if (m_maxMasterLevel >= numCoded || m_maxMasterLevel <= 0){
		int m_maxMasterLevel = 200;
		
	}
	// ----
	if (lpObj->m_nMasterLevel >= m_maxMasterLevel)
	{
		GCServerMsgStringSend(lMsg.Get(1136), lpObj->m_Index, 1);
		return false;
	}
	// ----
	if( bEventMapReward )	//-> New
	{
		iAddExp = iAddExp;	//???
	}
	else
	{
#ifdef GENS
		if( gGensSystem.IsMapBattleZone(lpObj->MapNumber) )	//-> Original g_GensSystem maybe
		{
			iAddExp = iAddExp * (this->m_fAddExpRate + g_MLBattleZoneAddExp);
		}
		else
		{
			iAddExp = iAddExp * this->m_fAddExpRate;
		}
#else
		iAddExp = iAddExp * this->m_fAddExpRate;
#endif
	}
	// ----
	if( lpObj->m_MPSkillOpt.MpsPlusExp > 0 )
	{
		iAddExp += iAddExp * lpObj->m_MPSkillOpt.MpsPlusExp / 100;
	}
	// ----
	if( iAddExp > 0 )
	{
		gObjSetExpPetItem(lpObj->m_Index, iAddExp);
		// ----
		LogAddTD("ML Experience : Map[%d]-(%d,%d) [%s][%s](%d) %I64d %I64d MonsterIndex : %d",	//-> Updated
          lpObj->MapNumber, lpObj->X, lpObj->Y, lpObj->AccountID,lpObj->Name,
          lpObj->m_nMasterLevel, lpObj->m_i64MasterLevelExp, iAddExp, iMonsterType);
		// ----
		if( iAddExp + lpObj->m_i64MasterLevelExp >= lpObj->m_i64NextMasterLevelExp )
		{
			iAddExp = 0;
			// -----
			int m_masterPointsPerLvl = GetPrivateProfileInt("Common", "MasterPointsPerLvl", 100, gDirPath.GetNewPath("MasterSystem.cfg"));
			int numCodeds = 101;
			if (m_maxMasterLevel >= numCodeds)
			{
				int m_masterPointsPerLvl = 1;
			}
			// -----
			lpObj->m_i64MasterLevelExp	= lpObj->m_i64NextMasterLevelExp;
			lpObj->m_nMasterLevel++;
			lpObj->m_iMasterLevelPoint += m_masterPointsPerLvl;	//-> In future can use it for change ml point per level)
			// -----
			gObjCalCharacter(lpObj->m_Index);
			// -----
			lpObj->MaxLife				+= DCInfo.DefClass[ lpObj->Class ].LevelLife;
			lpObj->MaxMana				+= DCInfo.DefClass[ lpObj->Class ].LevelMana;
			lpObj->Life					= lpObj->AddLife + lpObj->MaxLife;
			lpObj->Mana					= lpObj->AddMana + lpObj->MaxMana;
			// -----
			gObjCalcShieldPoint(lpObj);
			lpObj->iShield				= lpObj->iAddShield + lpObj->iMaxShield;
			// -----
			this->gObjNextMLExpCal(lpObj);
			// ----
			gObjCalcMaxLifePower(lpObj->m_Index);
			gObjSetBP(lpObj->m_Index);
			GJSetCharacterInfo(lpObj, lpObj->m_Index, 0, 0);
			this->GCMasterLevelUpInfo(lpObj);
			GCReFillSend(lpObj->m_Index, lpObj->Life, 0xFF, 0, lpObj->iShield);
			GCManaSend(lpObj->m_Index, lpObj->Mana, 0xFF, 0, lpObj->BP);	//-> Original name ->_BP
		}
		else
		{
			lpObj->m_i64MasterLevelExp += iAddExp;
		}
		// ----
		GCSendExp_INT64(lpObj->m_Index, 65535, iAddExp, 0, 0);		
	}
	// ----
	return true;
}