Source Control add points 100% In-Game!
YouTube - eGamesDev.avi
Code:
//Adiciona pontos para o personagem
#define CMD_FORCA "/addstr "
#define CMD_AGILIDADE "/addagi "
#define CMD_VITALIDADE "/addvit "
#define CMD_ENERGIA "/addene "
#define CMD_CARISMA "/addcmd "
bool IsPonto(DWORD PlayerID, LPCSTR Comando)
{
int CmdLen, Pontos;
char* Atributo = "";
char Mensagem[100] = "";
PMSG_USE_STAT_FRUIT pResult;
PHeadSetB((LPBYTE)&pResult,0x2C,sizeof(pResult));
if(memicmp(CMD_FORCA, Comando, sizeof(CMD_FORCA)-1) == 0)
{
if( CheckIfLevelUpPoint(PlayerID) == TRUE)
return false;
CmdLen = sizeof(CMD_FORCA)-1;
sscanf(Comando+CmdLen,"%d", &Pontos);
Pontos = abs(Pontos);
Atributo = msg[14].Message;
if((CheckLevelUpPoint(PlayerID,Pontos,3)) == FALSE)
{
wsprintf(Mensagem, msg[19].Message, Atributo); // "Essa quantidade de pontos excede o maximo de pontos em %s para sua classe"
C1TipPlayer(PlayerID,Mensagem,1);
return false;
}
pResult.result = 0;
pResult.btStatValue = Pontos;
pResult.btFruitType = 3;
DataSend(PlayerID,(unsigned char *)&pResult,pResult.h.size);
Obj[PlayerID].Strength += Pontos;
wsprintf(Mensagem, msg[20].Message, Pontos, Atributo); // "Foram adicionados %d pontos em %s"
C1TipPlayer(PlayerID,Mensagem,1);
}
else if(memicmp(CMD_AGILIDADE, Comando, sizeof(CMD_AGILIDADE)-1) == 0)
{
if( CheckIfLevelUpPoint(PlayerID) == TRUE)
return false;
CmdLen = sizeof(CMD_AGILIDADE)-1;
sscanf(Comando+CmdLen,"%d", &Pontos);
Pontos = abs(Pontos);
Atributo = msg[15].Message;
if((CheckLevelUpPoint(PlayerID,Pontos,2)) == FALSE)
{
wsprintf(Mensagem, msg[19].Message, Atributo); // "Essa quantidade de pontos excede o maximo de pontos em %s para sua classe"
C1TipPlayer(PlayerID,Mensagem,1);
return false;
}
pResult.result = 0;
pResult.btStatValue = Pontos;
pResult.btFruitType = 2;
DataSend(PlayerID,(unsigned char *)&pResult,pResult.h.size);
Obj[PlayerID].Dexterity += Pontos;
wsprintf(Mensagem, msg[20].Message, Pontos, Atributo); // "Foram adicionados %d pontos em %s"
C1TipPlayer(PlayerID,Mensagem,1);
}
else if(memicmp(CMD_VITALIDADE, Comando, sizeof(CMD_VITALIDADE)-1) == 0)
{
if( CheckIfLevelUpPoint(PlayerID) == TRUE)
return false;
CmdLen = sizeof(CMD_VITALIDADE)-1;
sscanf(Comando+CmdLen,"%d", &Pontos);
Pontos = abs(Pontos);
Atributo = msg[16].Message;
if((CheckLevelUpPoint(PlayerID,Pontos,1)) == FALSE)
{
wsprintf(Mensagem, msg[19].Message, Atributo); // "Essa quantidade de pontos excede o maximo de pontos em %s para sua classe"
C1TipPlayer(PlayerID,Mensagem,1);
return false;
}
pResult.result = 0;
pResult.btStatValue = Pontos;
pResult.btFruitType = 1;
DataSend(PlayerID,(unsigned char *)&pResult,pResult.h.size);
Obj[PlayerID].Vitality += Pontos;
Obj[PlayerID].MaxLife += Obj[PlayerID].VitalityToLife * Pontos;
wsprintf(Mensagem, msg[20].Message, Pontos, Atributo); // "Foram adicionados %d pontos em %s"
C1TipPlayer(PlayerID,Mensagem,1);
}
else if(memicmp(CMD_ENERGIA, Comando, sizeof(CMD_ENERGIA)-1) == 0)
{
if( CheckIfLevelUpPoint(PlayerID) == TRUE)
return false;
CmdLen = sizeof(CMD_ENERGIA)-1;
sscanf(Comando+CmdLen,"%d", &Pontos);
Pontos = abs(Pontos);
Atributo = msg[17].Message;
if((CheckLevelUpPoint(PlayerID,Pontos,0)) == FALSE)
{
wsprintf(Mensagem, msg[19].Message, Atributo); // "Essa quantidade de pontos excede o maximo de pontos em %s para sua classe"
C1TipPlayer(PlayerID,Mensagem,1);
return false;
}
pResult.result = 0;
pResult.btStatValue = Pontos;
pResult.btFruitType = 0;
DataSend(PlayerID,(unsigned char *)&pResult,pResult.h.size);
Obj[PlayerID].Energy += Pontos;
Obj[PlayerID].MaxMana += Obj[PlayerID].EnergyToMana * Pontos;
gObjSetBP(PlayerID);
wsprintf(Mensagem, msg[20].Message, Pontos, Atributo); // "Foram adicionados %d pontos em %s"
C1TipPlayer(PlayerID,Mensagem,1);
}
else if(memicmp(CMD_CARISMA, Comando, sizeof(CMD_CARISMA)-1) == 0)
{
if( CheckIfLevelUpPoint(PlayerID) == TRUE)
return false;
if(Obj[PlayerID].DbClass == DarkLord || Obj[PlayerID].DbClass == LordEmperor){
CmdLen = sizeof(CMD_CARISMA)-1;
sscanf(Comando+CmdLen,"%d", &Pontos);
Pontos = abs(Pontos);
Atributo = msg[18].Message;
if((CheckLevelUpPoint(PlayerID,Pontos,4)) == FALSE)
{
wsprintf(Mensagem, msg[19].Message, Atributo); // "Essa quantidade de pontos excede o maximo de pontos em %s para sua classe"
C1TipPlayer(PlayerID,Mensagem,1);
return false;
}
pResult.result = 0;
pResult.btStatValue = Pontos;
pResult.btFruitType = 4;
DataSend(PlayerID,(unsigned char *)&pResult,pResult.h.size);
Obj[PlayerID].Leadership += Pontos;
wsprintf(Mensagem, msg[20].Message, Pontos, Atributo); // "Foram adicionados %d pontos em %s"
C1TipPlayer(PlayerID,Mensagem,1);
}
else
{
MenssagemAlerta(4,PlayerID);
return false;
}
}
else {
return false;
}
Obj[PlayerID].LevelUpPoint -= Pontos;
gObjCalCharacter(PlayerID);
GCReFillSend(Obj[PlayerID].m_Index,(WORD)Obj[PlayerID].MaxLife + Obj[PlayerID].AddLife,0xFE,0,Obj[PlayerID].iMaxShield + Obj[PlayerID].iAddShield);
gObjSetBP(PlayerID);
GCManaSend(Obj[PlayerID].m_Index,(short)Obj[PlayerID].MaxMana + Obj[PlayerID].AddMana,0xFE,0,Obj[PlayerID].MaxBP + Obj[PlayerID].AddBP);
GCLevelUpMsgSend( Obj[PlayerID].m_Index , FALSE );
return true;
}
bool CheckIfLevelUpPoint(DWORD PlayerID)
{
if( Obj[PlayerID].Level < Load.AddLevel )
{
MenssagemAlerta(1,PlayerID);
return true;
}
if( (TiraZen(PlayerID, Load.AddCost)) == FALSE )
{
MenssagemAlerta(0,PlayerID);
return true;
}
return false;
}
Code:
struct PMSG_USE_STAT_FRUIT {
struct PBMSG_HEAD h;
unsigned char result;
unsigned short btStatValue;
unsigned char btFruitType;
};
Creditos:
Diel and Kimdu ( Development Code )
Hermex
Re: Source Control add points 100% In-Game!
Re: Source Control add points 100% In-Game!
can be added to season 1 ?
not the 1.00.8
clean season 1 - 1.0N
Re: Source Control add points 100% In-Game!
Friends! This command works on versions and protocols that have CashShop for example!
Re: Source Control add points 100% In-Game!
Nice release Diel. Please post the defines of funtions like GCManaSend, etc.
PHeadSetB functions is very important and C1TipPlayer will be nice too :wink:
Thanks.
Re: Source Control add points 100% In-Game!
Re: Source Control add points 100% In-Game!
made by me already in true-mu source....
Re: Source Control add points 100% In-Game!
Found some needed codes for the function:
Code:
#define gObjCalCharacter ((void(*)(int)) 0x004E8AC0)
#define GCRefillSend ((int(*)(DWORD,int,int,int,int)) 0x0045F9F0)
#define GCLevelUpMsgSend ((void(*)(int, unsigned char)) 0x0043BDC0)
struct PBMSG_HEAD
{
public:
void set ( LPBYTE lpBuf, BYTE head, BYTE size)
{
lpBuf[0] = 0xC1;
lpBuf[1] = size;
lpBuf[2] = head;
};
void setE ( LPBYTE lpBuf, BYTE head, BYTE size)
{
lpBuf[0] = 0xC3;
lpBuf[1] = size;
lpBuf[2] = head;
};
BYTE c;
BYTE size;
BYTE headcode;
};
void PHeadSetB(LPBYTE Packet,BYTE Head,BYTE Size)
{
Packet[0] = 0xC1;
Packet[1] = Size;
Packet[2] = Head;
}
void gObjSetBP(int aIndex)
{
int Strength = gObj[aIndex].Strength + gObj[aIndex].AddStrength;
int Dexterity = gObj[aIndex].Dexterity + gObj[aIndex].AddDexterity;
int Vitality = gObj[aIndex].Vitality + gObj[aIndex].AddVitality;
int Energy = gObj[aIndex].Energy + gObj[aIndex].AddEnergy;
int Leadership = gObj[aIndex].Leadership + gObj[aIndex].AddLeadership;
switch ( gObj[aIndex].Class )
{
case 0:
gObj[aIndex].MaxBP = (Strength * 0.2) + (Dexterity * 0.4) + (Vitality * 0.3) + (Energy * 0.2);
break;
case 1:
gObj[aIndex].MaxBP = (Strength * 0.15) + (Dexterity * 0.2) + (Vitality * 0.3) + (Energy * 1.0);
break;
case 2:
gObj[aIndex].MaxBP = (Strength * 0.3) + (Dexterity * 0.2) + (Vitality * 0.3) + (Energy * 0.2);
break;
case 3:
gObj[aIndex].MaxBP = (Strength * 0.2) + (Dexterity * 0.25) + (Vitality * 0.3) + (Energy * 0.15);
break;
case 4:
gObj[aIndex].MaxBP = (Strength * 0.3) + (Dexterity * 0.2) + (Vitality * 0.1) + (Energy * 0.15) + (Leadership * 0.3);
break;
}
}
Credits: ACGSeason5Premium
Ps.: Please share GCManaSend def and C1TipPlayer function. :love:
Re: Source Control add points 100% In-Game!
#define GCManaSend ((void(*)(int aIndex, short Mana, BYTE Ipos, unsigned char flag, WORD BP)) 0x0045FAA0)
Re: Source Control add points 100% In-Game!
Quote:
Originally Posted by
DielDF
#define gObjCalCharacter ((void(*)(nt aIndex, short Mana, BYTE Ipos, unsigned char flag, WORD BP)) 0x0045FAA0)
What about GCManaSend def and C1TipPlayer function ??? :blush:
Re: Source Control add points 100% In-Game!
friend, I do not need to post all the functions that you may complete the command! you need this command on a topic! now and so you deploy in your source! anyone who understands a bit of programming! 'll know perfectly deploy code.
Att Diel
Re: Source Control add points 100% In-Game!
Quote:
Originally Posted by
DielDF
friend, I do not need to post all the functions that you may complete the command! you need this command on a topic! now and so you deploy in your source! anyone who understands a bit of programming! 'll know perfectly deploy code.
Att Diel
I really don't understand the why of posting an incomplete source. If you don't intend to share all, at least remove the lines. I'm just trying to help...
Very sad. :glare:
Re: Source Control add points 100% In-Game!
Hi My Friends, C1TIPPlayer is func of send messages
The True name is: GCServerMsgStringSend
The args:
PHP Code:
#define GCServerMsgStringSend ((void(*)(char* msg,DWORD aIndex, BYTE Type)) 0x0040167C) //Offset for 0.96.40 Version
/*
BYTE Type Args:
0x00 -> Send Gold Message in center of screen! (GM Notice)
0x01 -> Send normal message!
0x02 -> Send a Guild Notice!
works on 97d(0.96.40) if make some functions with a small alteration in gObjCalCharacter and gObjSetBP(I not found in 97d)!
*/
Sorry for my bad english! I am Brazil
^^
Re: Source Control add points 100% In-Game!
Quote:
Originally Posted by
Young
I really don't understand the why of posting an incomplete source. If you don't intend to share all, at least remove the lines. I'm just trying to help...
Very sad. :glare:
this is complete source, if you cant adapt it to your server source you are incomplete coder. cuz mostly all the functions here is in every serrvers dll already present.
Re: Source Control add points 100% In-Game!
Reupload video without sound, so we can watch it..