Advertisement
Guest User

Comando AddPoint

a guest
Mar 17th, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.48 KB | None | 0 0
  1. void t_Class_Commands::ChatAddStats(DWORD aIndex,LPCSTR lpBuffer,DWORD tipo)
  2. {
  3.     OBJECTSTRUCT * lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
  4.     int points = atoi(lpBuffer);
  5.  
  6.     enum
  7.     {
  8.         STAT_FRUIT_STR = 3,
  9.         STAT_FRUIT_DEX = 2,
  10.         STAT_FRUIT_VIT = 1,
  11.         STAT_FRUIT_ENE = 0,
  12.         STAT_FRUIT_CMD = 4
  13.     };
  14.  
  15.     int MaxPoints;
  16.     if(FxsStc.StattusMaxPluss == 0)
  17.     {
  18.         MaxPoints = 32767;
  19.     }
  20.     else
  21.     {
  22.         MaxPoints = 65535;
  23.     }
  24.  
  25.     if (CmdStruct.IsAddStatCMD == 0)
  26.     {
  27.         GCServerMsgStringSend(StgStc.EnabledADDMSG, aIndex, 1);
  28.         return;
  29.     }
  30.    
  31.     if(lpObj->LevelUpPoint < points || points < 0 || points == 0)
  32.     {
  33.         GCServerMsgStringSend(StgStc.PointErrorADDMSG, aIndex, 1);
  34.         return;
  35.     }
  36.        
  37.     if(points > MaxPoints)
  38.     {
  39.         char MaxPointMsg[200];
  40.         sprintf(MaxPointMsg,StgStc.LimitPointADDMSG, MaxPoints);
  41.         GCServerMsgStringSend(MaxPointMsg, aIndex,1);
  42.         return;
  43.     }
  44.  
  45.     PMSG_USE_STAT_FRUIT pMsg;
  46.     PHeadSetB((LPBYTE)&pMsg,0x2C,sizeof(PMSG_USE_STAT_FRUIT));
  47.     pMsg.result = 0;
  48.     pMsg.btStatValue = points;
  49.  
  50.     switch(tipo)
  51.     {
  52.         case 0:
  53.             if(lpObj->Strength+points > MaxPoints) GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1); return; break;
  54.         case 1:
  55.             if(lpObj->Dexterity+points > MaxPoints) GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1); return; break;
  56.         case 2:
  57.             if(lpObj->Vitality+points > MaxPoints) GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1); return; break;
  58.         case 3:
  59.             if(lpObj->Energy+points > MaxPoints) GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1); return; break;
  60.         case 4:
  61.             if(lpObj->Leadership+points > MaxPoints) GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1); return; break;
  62.     }
  63.  
  64.     switch(tipo)
  65.     {
  66.         case 0:
  67.             pMsg.btFruitType = STAT_FRUIT_STR;
  68.             lpObj->Strength += points;
  69.             break;
  70.         case 1:
  71.             pMsg.btFruitType = STAT_FRUIT_DEX;
  72.             lpObj->Dexterity += points;
  73.             break;
  74.         case 2:
  75.             pMsg.btFruitType = STAT_FRUIT_VIT;
  76.             lpObj->Vitality += points;
  77.             break;
  78.         case 3:
  79.             pMsg.btFruitType = STAT_FRUIT_ENE;
  80.             lpObj->Energy += points;
  81.             break;
  82.         case 4:
  83.             pMsg.btFruitType = STAT_FRUIT_CMD;
  84.             lpObj->Leadership += points;
  85.             break;
  86.     }
  87.  
  88.     lpObj->LevelUpPoint -= points;
  89.     DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size);
  90.     gObjCalCharacter(aIndex);
  91.     GCReFillSend(lpObj->m_Index,lpObj->MaxLife + lpObj->AddLife,0xFE,0,lpObj->iMaxShield + lpObj->iAddShield);
  92.     gObjSetBP(aIndex);
  93.     GCManaSend(lpObj->m_Index,lpObj->MaxMana + lpObj->AddMana,0xFE,0,lpObj->MaxBP+ lpObj->AddBP);
  94.     GCLevelUpMsgSend(lpObj->m_Index,0);
  95.     return;
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement