Código PHP:
void t_Class_Commands::ChatAddStats(DWORD aIndex,LPCSTR lpBuffer,DWORD tipo)
{
OBJECTSTRUCT * lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
int points = atoi(lpBuffer);
int MaxPoints;
if(FxsStc.StattusMaxPluss == 0){MaxPoints = 32767;}
else{MaxPoints = 65535;}
if (CmdStruct.IsAddStatCMD == 0)
{
GCServerMsgStringSend(StgStc.EnabledADDMSG, aIndex, 1);
return;
}
if(lpObj->LevelUpPoint < points || points < 0 || points == 0)
{
GCServerMsgStringSend(StgStc.PointErrorADDMSG, aIndex, 1);
return;
}
if(lpObj->Authority != 32 && points > MaxPoints)
{
char MaxPointMsg[200];
sprintf(MaxPointMsg,StgStc.LimitPointADDMSG, MaxPoints);
GCServerMsgStringSend(MaxPointMsg, aIndex,1);
return;
}
switch(tipo){
case 0:
{
if(lpObj->Strength+points > MaxPoints){GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1);return;}
PMSG_USE_STAT_FRUIT pMsg;
PHeadSetB((LPBYTE)&pMsg,0x2C,sizeof(PMSG_USE_STAT_FRUIT));
pMsg.result = 0;
pMsg.btFruitType = 3;
pMsg.btStatValue = points;
lpObj->Strength += points;
lpObj->LevelUpPoint -= points;
DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size);
gObjCalCharacter(aIndex);
GCReFillSend(lpObj->m_Index,lpObj->MaxLife + lpObj->AddLife,0xFE,0,lpObj->iMaxShield + lpObj->iAddShield);
gObjSetBP(aIndex);
GCManaSend(lpObj->m_Index,lpObj->MaxMana + lpObj->AddMana,0xFE,0,lpObj->MaxBP+ lpObj->AddBP);
GCLevelUpMsgSend(lpObj->m_Index,0);
}
break;
case 1:
{
if(lpObj->Dexterity+points > MaxPoints){GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1);return;}
PMSG_USE_STAT_FRUIT pMsg;
PHeadSetB((LPBYTE)&pMsg,0x2C,sizeof(PMSG_USE_STAT_FRUIT));
pMsg.result = 0;
pMsg.btFruitType = 2;
pMsg.btStatValue = points;
lpObj->Dexterity += points;
lpObj->LevelUpPoint -= points;
DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size);
gObjCalCharacter(aIndex);
GCReFillSend(lpObj->m_Index,lpObj->MaxLife + lpObj->AddLife,0xFE,0,lpObj->iMaxShield + lpObj->iAddShield);
gObjSetBP(aIndex);
GCManaSend(lpObj->m_Index,lpObj->MaxMana + lpObj->AddMana,0xFE,0,lpObj->MaxBP + lpObj->AddBP);
GCLevelUpMsgSend(lpObj->m_Index,0);
}
break;
case 2:
{
if(lpObj->Vitality+points > MaxPoints){GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1);return;}
PMSG_USE_STAT_FRUIT pMsg;
PHeadSetB((LPBYTE)&pMsg,0x2C,sizeof(PMSG_USE_STAT_FRUIT));
pMsg.result = 0;
pMsg.btFruitType = 1;
pMsg.btStatValue = points;
lpObj->Vitality += points;
lpObj->LevelUpPoint -= points;
lpObj->MaxLife += lpObj->VitalityToLife * points;
DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size);
gObjCalCharacter(aIndex);
GCReFillSend(lpObj->m_Index,lpObj->MaxLife + lpObj->AddLife,0xFE,0,lpObj->iMaxShield + lpObj->iAddShield);
gObjSetBP(aIndex);
GCManaSend(lpObj->m_Index,lpObj->MaxMana + lpObj->AddMana,0xFE,0,lpObj->MaxBP + lpObj->AddBP);
GCLevelUpMsgSend(lpObj->m_Index,0);
}
break;
case 3:
{
if(lpObj->Energy+points > MaxPoints){GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1);return;}
PMSG_USE_STAT_FRUIT pMsg;
PHeadSetB((LPBYTE)&pMsg,0x2C,sizeof(PMSG_USE_STAT_FRUIT));
pMsg.result = 0;
pMsg.btFruitType = 0;
pMsg.btStatValue = points;
lpObj->Energy += points;
lpObj->LevelUpPoint -= points;
lpObj->MaxMana += lpObj->EnergyToMana * points;
DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size);
gObjCalCharacter(aIndex);
GCReFillSend(lpObj->m_Index,lpObj->MaxLife + lpObj->AddLife,0xFE,0,lpObj->iMaxShield + lpObj->iAddShield);
gObjSetBP(aIndex);
GCManaSend(lpObj->m_Index,lpObj->MaxMana + lpObj->AddMana,0xFE,0,lpObj->MaxBP + lpObj->AddBP);
GCLevelUpMsgSend(lpObj->m_Index,0);
}
break;
case 4:
{
if(lpObj->Leadership+points > MaxPoints){GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1);return;}
if(lpObj->DbClass == 64 || lpObj->DbClass == 65 || lpObj->DbClass == 66)
{
PMSG_USE_STAT_FRUIT pMsg;
PHeadSetB((LPBYTE)&pMsg,0x2C,sizeof(PMSG_USE_STAT_FRUIT));
pMsg.result = 0;
pMsg.btFruitType = 4;
pMsg.btStatValue = points;
lpObj->Leadership += points;
lpObj->LevelUpPoint -= points;
DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size);
gObjCalCharacter(aIndex);
GCReFillSend(lpObj->m_Index,lpObj->MaxLife + lpObj->AddLife,0xFE,0,lpObj->iMaxShield + lpObj->iAddShield);
gObjSetBP(aIndex);
GCManaSend(lpObj->m_Index,lpObj->MaxMana + lpObj->AddMana,0xFE,0,lpObj->MaxBP + lpObj->AddBP);
GCLevelUpMsgSend(lpObj->m_Index,0);
}
else
{
GCServerMsgStringSend(StgStc.OnlyDLADDCMD,aIndex,1);
return;
}
}
break;
}
}