Ejemplo n.º 1
0
void MyObjCalCharacter(int aIndex)
{
     OBJECTSTRUCT * lpObj = (OBJECTSTRUCT*) OBJECT_POINTER (aIndex);
     // -----
     gObjCalCharacter(aIndex);
     // -----
     if(lpObj->pInventory[8].m_Type == 0x1A50) //Panda
     {
          lpObj->m_Defense                  += Config.Panda.PetPandaDefense;
          lpObj->m_AttackDamageMinLeft		+= Config.Panda.PetPandaAttackDamageMinLeft;
          lpObj->m_AttackDamageMaxLeft		+= Config.Panda.PetPandaAttackDamageMaxLeft;
          lpObj->m_AttackDamageMinRight     += Config.Panda.PetPandaAttackDamageMinRight;
          lpObj->m_AttackDamageMaxRight     += Config.Panda.PetPandaAttackDamageMaxRight;
          lpObj->m_MagicDamageMin           += Config.Panda.PetPandaMagicDamageMin;
          lpObj->m_MagicDamageMax           += Config.Panda.PetPandaMagicDamageMax;
          lpObj->m_MagicSpeed               += Config.Panda.PetPandaMagicSpeed;
          lpObj->m_AttackSpeed              += Config.Panda.PetPandaAttackSpeed;
     }
   if(lpObj->pInventory[10].m_Type == 0x1A4C || lpObj->pInventory[11].m_Type == 0x1A4C) // Panda Ring
    {
         lpObj->m_Defense                   += Config.Panda.PandaRingDefense;
         lpObj->m_AttackDamageMinLeft		+= Config.Panda.PandaRingAttackDamageMinLeft;
         lpObj->m_AttackDamageMaxLeft		+= Config.Panda.PandaRingAttackDamageMaxLeft;
         lpObj->m_AttackDamageMinRight		+= Config.Panda.PandaRingAttackDamageMinRight;
         lpObj->m_AttackDamageMaxRight		+= Config.Panda.PandaRingAttackDamageMaxRight;
         lpObj->m_MagicDamageMin            += Config.Panda.PandaRingMagicDamageMin;
         lpObj->m_MagicDamageMax            += Config.Panda.PandaRingMagicDamageMax;
         lpObj->m_MagicSpeed                += Config.Panda.PandaRingMagicSpeed;
         lpObj->m_AttackSpeed               += Config.Panda.PandaRingAttackSpeed;	
    }
}
Ejemplo n.º 2
0
//006bbca0
void CPeriodItemEx::CheckPeriodData()	//OK
{
	LPOBJ lpObj = 0;

	for(int i = 0; i < OBJMAXUSER; i++)
	{
		if( this->m_PeriodData[i].bInUse == true && this->m_PeriodData[i].lpObj != NULL )
		{
			lpObj = this->m_PeriodData[i].lpObj;

			if( lpObj->Type == OBJ_USER && lpObj->Connected >= PLAYER_LOGGED )
			{
				for(int iItemSlotIndex = 0; iItemSlotIndex < MAX_ITEMDATA; iItemSlotIndex++)
				{
					if( this->m_PeriodData[i].itemData[iItemSlotIndex].bInUse == true && this->CheckExpireDate(this->m_PeriodData[i].itemData[iItemSlotIndex].lExpireDate) == true )
					{
						LogAddTD("[PeriodItemEx][Remove PeriodItem] Expire PeriodItem Data. User Id : %s(%d), Name : %s, Item : %s(%d), Type : %d, Serial : %u, ExpireDate : %d",
							lpObj->AccountID,lpObj->DBNumber,lpObj->Name,ItemAttribute[this->m_PeriodData[i].itemData[iItemSlotIndex].wItemCode].Name,this->m_PeriodData[i].itemData[iItemSlotIndex].wItemCode,this->m_PeriodData[i].itemData[iItemSlotIndex].btType,this->m_PeriodData[i].itemData[iItemSlotIndex].dwSerial,this->m_PeriodData[i].itemData[iItemSlotIndex].lExpireDate);
						this->RemovePeriodItemData(lpObj,this->m_PeriodData[i].itemData[iItemSlotIndex].btType,this->m_PeriodData[i].itemData[iItemSlotIndex].wItemCode,this->m_PeriodData[i].itemData[iItemSlotIndex].dwSerial);
						this->m_PeriodData[i].itemData[iItemSlotIndex].Clear();
						gObjUseSkill.SkillChangeUse(lpObj->m_Index);
						gObjCalCharacter(lpObj->m_Index);
					}
				}
			}
		}
	}
}
Ejemplo n.º 3
0
BOOL CCashItemPeriodSystem::ApplyItemPeriodEffect(LPOBJ lpObj, int iItemCode, int iDuration)
{
	BOOL bResult = FALSE;
	int iEffectIndex = 0;

	iEffectIndex = this->GetItemPeriodInfoEffectID(iItemCode);
	
	if(iEffectIndex != 0)
	{
		int iUseTime = iDuration * 60;

		bResult = gObjAddBuffEffect(lpObj, iEffectIndex, iUseTime);

		switch(iEffectIndex) //Leaps
		{
		case AT_CSHOP_LEAP_OF_STRENGTH:
		case AT_CSHOP_LEAP_OF_QUICKNESS:
		case AT_CSHOP_LEAP_OF_HEALTH:
		case AT_CSHOP_LEAP_OF_ENERGY:
		case AT_CSHOP_LEAP_OF_CONTROL:
			gObjCalCharacter(lpObj->m_Index);
			break;
		}
	}
	else
	{
		bResult = g_ItemAddOption.SetItemEffect(lpObj, iItemCode, iDuration) == TRUE; //!( g_ItemAddOption.SetItemEffect(lpObj, iItemCode, iItemTime) - 1 );
	}

	return bResult;
}
bool gObjAddBuffEffectForInGameShop(LPOBJ lpObj,WORD wItemCode,int iTimeValue)
{
	if(lpObj == NULL)
		return false;

	if(lpObj->m_Index < 0 || lpObj->m_Index > OBJMAX)
		return false;

	int iItemCode = 0;
	LPITEMEFFECT lpItemEffectInfo = NULL;
	LPBUFF_EFFECT_DATE lpBuffData = NULL;

	lpBuffData = g_BuffEffectSlot.GetEffectDataFromItemCode(wItemCode);

	if(lpBuffData == NULL)
		return false;

	iItemCode = (lpBuffData->btItemType << 9) + lpBuffData->btItemIndex;

	if(g_ItemAddOption.IsItemEffect(iItemCode) == FALSE)
		return false;

	lpItemEffectInfo = g_ItemAddOption.GetItemEffect(iItemCode);

	int iRemoveBuffIndex = 0;

	iRemoveBuffIndex = g_BuffEffectSlot.SetEffect(lpObj, lpBuffData->btIndex, lpItemEffectInfo->wEffectType1, lpItemEffectInfo->wEffectType2, lpItemEffectInfo->iEffectValue1, lpItemEffectInfo->iEffectValue2, iTimeValue);

	if(iRemoveBuffIndex != -1)
	{
		if(iRemoveBuffIndex > 0)
		{
			GCUseBuffEffect(lpObj, iRemoveBuffIndex, 2, lpItemEffectInfo->wOptionType, 0, 0);
		}
		else
		{
			lpObj->btEffectCount++;
			gObjCalCharacter(lpObj->m_Index);
		}

		GCUseBuffEffect(lpObj, lpBuffData->btIndex, 0, lpItemEffectInfo->wOptionType, lpItemEffectInfo->wEffectType1, iTimeValue);
		return true;
	}
	return false;
}
Ejemplo n.º 5
0
//006bbc00
bool CPeriodItemEx::RemovePeriodItemData(LPOBJ lpObj,WORD wItemCode,unsigned long dwSerial)	//OK
{
	int iInventoryPosition = 0;

	if( !lpObj )
		return false;

	if( lpObj->Type != OBJ_USER || lpObj->Connected < PLAYER_LOGGED )
		return false;

	iInventoryPosition = this->GetItemFromInventory(lpObj,wItemCode,dwSerial);

	if( iInventoryPosition == -1 )
		return false;
	//auto-deleting
	gObjInventoryDeleteItem(lpObj->m_Index, iInventoryPosition);
	GCInventoryItemDeleteSend(lpObj->m_Index, iInventoryPosition, 1);
	gObjCalCharacter(lpObj->m_Index);
	// ----
	this->SetDisableItemToExpire(lpObj,iInventoryPosition);
	return true;
}
Ejemplo n.º 6
0
//006bbab0
bool CPeriodItemEx::RemovePeriodItemData(LPOBJ lpObj, BYTE btItemType, WORD wItemCode, unsigned long dwSerial)	//OK
{
	if( !lpObj )
		return false;

	if( lpObj->Type != OBJ_USER || lpObj->Connected < 2 )
		return false;

	if( btItemType == 1 )
	{
		BUFF_EFFECT_DATE* lpBuffData = 0;
		lpBuffData = g_BuffEffectSlot.GetEffectDataFromItemCode(wItemCode);

		if( !lpBuffData )
			return false;

		gObjRemoveBuffEffect(lpObj,lpBuffData->btIndex);
	}
	else if( btItemType == 2 )
	{
		if( dwSerial == 0 )
			return false;

		int iInventoryPosition = 0;
		iInventoryPosition = this->GetItemFromInventory(lpObj,wItemCode,dwSerial);

		if( iInventoryPosition == -1 )
			return false;

		SetDisableItemToExpire(lpObj,iInventoryPosition);
		//auto-deleting
		gObjInventoryDeleteItem(lpObj->m_Index, iInventoryPosition);
		GCInventoryItemDeleteSend(lpObj->m_Index, iInventoryPosition, 1);
		gObjCalCharacter(lpObj->m_Index);
		// ----
		if( iInventoryPosition < 12 )
		{
			if( iInventoryPosition == 10 || iInventoryPosition == 11 )
			{
				gObjUseSkill.SkillChangeUse(lpObj->m_Index);
			}
			// ----
			gObjMakePreviewCharSet(lpObj->m_Index);
			PMSG_USEREQUIPMENTCHANGED pChange;
			PHeadSetB((LPBYTE)&pChange, 0x25, sizeof(pChange));
			pChange.NumberH = SET_NUMBERH(lpObj->m_Index);
			pChange.NumberL = SET_NUMBERL(lpObj->m_Index);
			ItemByteConvert(pChange.ItemInfo, lpObj->pInventory[iInventoryPosition]);
			pChange.ItemInfo[1] = iInventoryPosition <<  4;
			pChange.ItemInfo[1] |= LevelSmallConvert(lpObj->m_Index, iInventoryPosition) & 0x0F;
			DataSend(lpObj->m_Index, (LPBYTE)&pChange, pChange.h.size);
			MsgSendV2(lpObj, (LPBYTE)&pChange, pChange.h.size);
		}
	}
	else
	{
		return false;
	}


	ITEMDATA ItemData;
	ItemData.btType = btItemType;
	ItemData.wItemCode = wItemCode;
	ItemData.dwSerial = dwSerial;

	RequestPeriodItemDelete(lpObj,&ItemData);
	return true;
}
Ejemplo n.º 7
0
//5C95A0
BOOL CCashItemPeriodSystem::ClearPeriodItemEffect(LPOBJ lpObj, int ItemCode)//Identical
{
	int iItemInfoIndex =0 ;
	iItemInfoIndex = lpObj->m_iPeriodItemEffectIndex;

	if ( iItemInfoIndex < 0 || iItemInfoIndex > MAX_ITEM_PERIOD_INFO )
		return FALSE;

	if ( this->ItemPeriodInfo[iItemInfoIndex].btUsedInfo != TRUE )
	{
		if ( this->ItemPeriodInfo[iItemInfoIndex].wdUserIndex != lpObj->m_Index )
		{
			return FALSE;
		}
	}

	this->ItemPeriodInfo[iItemInfoIndex].btCountItems--;

	if( this->ItemPeriodInfo[iItemInfoIndex].btCountItems == 0 || ItemCode == -1 )
	{
		this->ItemPeriodInfo[iItemInfoIndex].btUsedInfo = FALSE;
		this->ItemPeriodInfo[iItemInfoIndex].wdUserIndex = 0;
		this->ItemPeriodInfo[iItemInfoIndex].iUserGuid = 0;
		this->ItemPeriodInfo[iItemInfoIndex].btCountItems = 0;
		this->ItemPeriodInfo[iItemInfoIndex].dwItemCheckTickCount = 0;
		this->ItemPeriodInfo[iItemInfoIndex].chCharacterName[0] = NULL;

		for( int iOptionIndex = 0; iOptionIndex < MAX_ITEM_PERIOD_EFFECT; iOptionIndex++ )
		{
			g_ItemAddOption.ClearItemEffect2(lpObj,this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].iItemCode,2);
			this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].bInUse = false;
			this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].iItemCode = 0;
			this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].btOptionType = 0;
			this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].btEffectType1 = 0;
			this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].btEffectType2 = 0;
			this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].iItemPeriodLeftTime = 0;
			this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].iItemPeriodUsedTime = 0;
		}
		lpObj->m_iPeriodItemEffectIndex = -1;
	}
	else
	{
		int iOptionIndex = 0;

		for( iOptionIndex = 0; iOptionIndex < MAX_ITEM_PERIOD_EFFECT; iOptionIndex++ )
		{
			if( this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].iItemCode == ItemCode )
			{
				g_ItemAddOption.ClearItemEffect2(lpObj,this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].iItemCode,2);
				this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].bInUse = false;
				this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].iItemCode = 0;
				this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].btOptionType = 0;
				this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].btEffectType1 = 0;
				this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].btEffectType2 = 0;
				this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].iItemPeriodLeftTime = 0;
				this->ItemPeriodInfo[iItemInfoIndex].vItemEffect[iOptionIndex].iItemPeriodUsedTime = 0;
			}
		}
	}

	int iEffectIndex = 0;

	iEffectIndex = this->GetItemPeriodInfoEffectID(ItemCode);

	switch(iEffectIndex) //Leaps
	{
	case AT_CSHOP_LEAP_OF_STRENGTH:
	case AT_CSHOP_LEAP_OF_QUICKNESS:
	case AT_CSHOP_LEAP_OF_HEALTH:
	case AT_CSHOP_LEAP_OF_ENERGY:
	case AT_CSHOP_LEAP_OF_CONTROL:
		gObjCalCharacter(lpObj->m_Index);
		break;
	}

	return TRUE;
}
void gObjCheckBuffEffectList(LPOBJ lpObj)
{
	if(lpObj == NULL)
		return;

	if(lpObj->m_Index < 0 || lpObj->m_Index > OBJMAX)
		return;

	if( (lpObj->Type == OBJ_USER && lpObj->Connected >= PLAYER_PLAYING) || lpObj->Type == OBJ_MONSTER)
	{
		for(int i = 0; i < MAX_STATE_COUNT; i++)
		{
			if(lpObj->pEffectInfo[i].iTimeValue == -10)
				continue;

			if(lpObj->pEffectInfo[i].btEffectNum == NULL)
				continue;

			switch(lpObj->pEffectInfo[i].btEffectNum)
			{
			case AT_POISON:
				{
					if((lpObj->pEffectInfo[i].iTimeValue % 3) == 0) //Rand type??
					{
						g_BuffEffect.SetActiveBuffEffect(lpObj, lpObj->pEffectInfo[i].btEffectType1, lpObj->pEffectInfo[i].iEffectValue1);
						g_BuffEffect.SetActiveBuffEffect(lpObj, lpObj->pEffectInfo[i].btEffectType2, lpObj->pEffectInfo[i].iEffectValue2);
					}
				}
				break;
			default:
				{
					g_BuffEffect.SetActiveBuffEffect(lpObj, lpObj->pEffectInfo[i].btEffectType1, lpObj->pEffectInfo[i].iEffectValue1);
					g_BuffEffect.SetActiveBuffEffect(lpObj, lpObj->pEffectInfo[i].btEffectType2, lpObj->pEffectInfo[i].iEffectValue2);
				}
				break;
			}
			
			lpObj->pEffectInfo[i].iTimeValue--;

			if(lpObj->pEffectInfo[i].iTimeValue <= 0)
			{
				/*if( lpObj->pEffectInfo[i].btEffectNum == AT_RFVITALITY ||
					lpObj->pEffectInfo[i].btEffectNum == BUFF_SWELL_LIFE3 ||
					lpObj->pEffectInfo[i].btEffectNum == BUFF_MANASHIELD2 ||)
				{
					gObjRemoveBuffEffect(lpObj, lpObj->pEffectInfo[i].btEffectNum);
					gObjCalCharacter(lpObj->m_Index);
				}
				else
				{
					
				}*/
				gObjRemoveBuffEffect(lpObj, lpObj->pEffectInfo[i].btEffectNum);

				switch( lpObj->pEffectInfo[i].btEffectNum )
				{
				case BUFF_INCREASE_VIT:
				case BUFF_INCREASE_VIT2:
				case BUFF_SWELL_LIFE3:
				case BUFF_MANASHIELD2:
				case BUFF_BLESS:
				case BUFF_BLESS2:
				case BUFF_ADD_CRITDMG3:
					gObjCalCharacter(lpObj->m_Index);
					break;
				}
			}
		}
	}
}
Ejemplo n.º 9
0
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;
}
Ejemplo n.º 10
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);
}
Ejemplo n.º 11
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;
}