- #include "DLLMain.h"
- void Volatiles::TS_I(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3259,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.STR;
- int atual2 = thisclient->bStatus.INT;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.STR >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.STR = depois1;
- thisclient->bStatus.INT = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Força] para [Inteligêcia] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Força].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::TS_D(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3260,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.STR;
- int atual2 = thisclient->bStatus.DEX;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.STR >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.STR = depois1;
- thisclient->bStatus.DEX = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Força] para [Destreza] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Força].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::TS_C(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3261,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.STR;
- int atual2 = thisclient->bStatus.CON;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.STR >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.STR = depois1;
- thisclient->bStatus.CON = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Força] para [Constituição] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Força].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::TI_S(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3262,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.INT;
- int atual2 = thisclient->bStatus.STR;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.INT >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.INT = depois1;
- thisclient->bStatus.STR = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Inteligêcia] para [Força] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Inteligêcia].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::TI_D(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3263,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.INT;
- int atual2 = thisclient->bStatus.DEX;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.INT >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.INT = depois1;
- thisclient->bStatus.DEX = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Inteligêcia] para [Destreza] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Inteligêcia].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::TI_C(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3264,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.INT;
- int atual2 = thisclient->bStatus.CON;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.INT >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.INT = depois1;
- thisclient->bStatus.CON = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Inteligêcia] para [Constituição] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Inteligêcia].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::TD_S(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3265,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.DEX;
- int atual2 = thisclient->bStatus.STR;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.DEX >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.DEX = depois1;
- thisclient->bStatus.STR = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Destreza] para [Força] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Destreza].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::TD_I(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3266,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.DEX;
- int atual2 = thisclient->bStatus.INT;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.DEX >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.DEX = depois1;
- thisclient->bStatus.INT = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Destreza] para [Inteligêcia] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Destreza].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::TD_C(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3267,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.DEX;
- int atual2 = thisclient->bStatus.CON;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.DEX >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.DEX = depois1;
- thisclient->bStatus.CON = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Destreza] para [Constituição] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Destreza].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::TC_S(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3268,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.CON;
- int atual2 = thisclient->bStatus.STR;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.CON >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.CON = depois1;
- thisclient->bStatus.STR = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Constituição] para [Força] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Constituição].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::TC_I(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3269,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.CON;
- int atual2 = thisclient->bStatus.INT;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.CON >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.CON = depois1;
- thisclient->bStatus.INT = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Constituição] para [Inteligêcia] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Constituição].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::TC_D(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int itenslot = p->GetFirstSlotSADD(clientid,3270,64);
- int retirar = 100;
- int adicionar = 100;
- int atual1 = thisclient->bStatus.CON;
- int atual2 = thisclient->bStatus.DEX;
- int depois1 = 0;
- int depois2 = 0;
- if(thisclient->bStatus.CON >= 100)
- {
- depois1 = atual1-retirar;
- depois2 = adicionar+atual2;
- thisclient->bStatus.CON = depois1;
- thisclient->bStatus.DEX = depois2;
- thisclient->Inventory[itenslot].Index = 0;
- p->SendClientMsg(clientid,"Troca de 100 em [Constituição] para [Destreza] feita com sucesso.");
- p->SendStats(clientid);
- p->SendScore(clientid);
- p->SendEquip(clientid);
- p->SaveChar(1,clientid);
- p->SendALL(clientid);
- p->SendCharList(clientid);
- return;
- }
- else
- {
- p->SendClientMsg(clientid,"É necessário ter 100 ou mais pontos em [Constituição].");
- p->SendALL(clientid);
- return;
- }
- }
- void Volatiles::AceleradorNascimento(int clientid)
- {
- Atualizar *p;
- MOB *player = (MOB*)GetMobFromIndex(clientid);
- int cMes = PInt(0x00A5EA420) + 1; //Mês
- int cDia = PInt(0x00A5EA41c); //Data
- int cHor = PInt(0x00A5EA418); //Hora
- int cMin = PInt(0x00A5EA414); //Minutos
- int cSeg = PInt(0x00A5EA410); //Segundos
- int Acelerador = p->GetFirstSlotSADD(clientid,3272,64);
- int Comparar1 = player->Equip[14].EFV1;
- int Comparar2 = player->Equip[14].EFV2;
- int Resultado = 0;
- {
- if(player->Equip[14].Index >= 2300 && player->Equip[14].Index <= 2329)
- {
- Resultado = Comparar2 - Comparar1;
- if(Resultado >= 2)
- {
- player->Equip[14].EF1 = 43;
- player->Equip[14].EFV1 += 1;
- p->SendEffect(3,0x0E,clientid);
- p->SendEffect(1,0x0E,clientid);
- p->SendItens(clientid,14);
- player->Inventory[Acelerador].Index = 0;
- PrintfTM(clientid,"usou o item usou o item [Acelerador do Crescimento].");
- p->SendALL(clientid);
- return;
- }
- else if(Resultado <= 1)
- {
- int num;
- num = rand() %100;
- p->SendEffect(3,0x0E,clientid);
- p->SendEffect(1,0x0E,clientid);
- player->Inventory[Acelerador].Index = 0;
- PrintfTM(clientid,"usou o item usou o item [Acelerador do Crescimento].");
- p->SendClientMsg(clientid,"Incubação terminada com sucesso.");
- if((num >= 0) && (num <= 10))
- {
- player->Equip[14].Index += 30;
- player->Equip[14].EF1 = 1;
- player->Equip[14].EFV1 = 1;
- player->Equip[14].EF2 = 1;
- player->Equip[14].EFV2 = 22;
- player->Equip[14].EF3 = 1;
- player->Equip[14].EFV3 = 1;
- p->SendItens(clientid,14);
- p->SendALL(clientid);
- return;
- }
- else if((num >= 11) && (num <= 20))
- {
- player->Equip[14].Index += 30;
- player->Equip[14].EF1 = 1;
- player->Equip[14].EFV1 = 1;
- player->Equip[14].EF2 = 1;
- player->Equip[14].EFV2 = 17;
- player->Equip[14].EF3 = 1;
- player->Equip[14].EFV3 = 1;
- p->SendItens(clientid,14);
- p->SendALL(clientid);
- return;
- }
- else if((num >= 21) && (num <= 30))
- {
- player->Equip[14].Index += 30;
- player->Equip[14].EF1 = 1;
- player->Equip[14].EFV1 = 1;
- player->Equip[14].EF2 = 1;
- player->Equip[14].EFV2 = 29;
- player->Equip[14].EF3 = 1;
- player->Equip[14].EFV3 = 1;
- p->SendItens(clientid,14);
- p->SendALL(clientid);
- return;
- }
- else if((num >= 31) && (num <= 40))
- {
- player->Equip[14].Index += 30;
- player->Equip[14].EF1 = 1;
- player->Equip[14].EFV1 = 1;
- player->Equip[14].EF2 = 1;
- player->Equip[14].EFV2 = 25;
- player->Equip[14].EF3 = 1;
- player->Equip[14].EFV3 = 1;
- p->SendItens(clientid,14);
- p->SendALL(clientid);
- return;
- }
- else if((num >= 41) && (num <= 50))
- {
- player->Equip[14].Index += 30;
- player->Equip[14].EF1 = 1;
- player->Equip[14].EFV1 = 1;
- player->Equip[14].EF2 = 1;
- player->Equip[14].EFV2 = 15;
- player->Equip[14].EF3 = 1;
- player->Equip[14].EFV3 = 1;
- p->SendItens(clientid,14);
- p->SendALL(clientid);
- return;
- }
- else if((num >= 51) && (num <= 60))
- {
- player->Equip[14].Index += 30;
- player->Equip[14].EF1 = 1;
- player->Equip[14].EFV1 = 1;
- player->Equip[14].EF2 = 1;
- player->Equip[14].EFV2 = 12;
- player->Equip[14].EF3 = 1;
- player->Equip[14].EFV3 = 1;
- p->SendItens(clientid,14);
- p->SendALL(clientid);
- return;
- }
- else if((num >= 61) && (num <= 70))
- {
- player->Equip[14].Index += 30;
- player->Equip[14].EF1 = 1;
- player->Equip[14].EFV1 = 1;
- player->Equip[14].EF2 = 1;
- player->Equip[14].EFV2 = 24;
- player->Equip[14].EF3 = 1;
- player->Equip[14].EFV3 = 1;
- p->SendItens(clientid,14);
- p->SendALL(clientid);
- return;
- }
- else if((num >= 71) && (num <= 80))
- {
- player->Equip[14].Index += 30;
- player->Equip[14].EF1 = 1;
- player->Equip[14].EFV1 = 1;
- player->Equip[14].EF2 = 1;
- player->Equip[14].EFV2 = 21;
- player->Equip[14].EF3 = 1;
- player->Equip[14].EFV3 = 1;
- p->SendItens(clientid,14);
- p->SendALL(clientid);
- return;
- }
- else if((num >= 81) && (num <= 90))
- {
- player->Equip[14].Index += 30;
- player->Equip[14].EF1 = 1;
- player->Equip[14].EFV1 = 1;
- player->Equip[14].EF2 = 1;
- player->Equip[14].EFV2 = 19;
- player->Equip[14].EF3 = 1;
- player->Equip[14].EFV3 = 1;
- p->SendItens(clientid,14);
- p->SendALL(clientid);
- return;
- }
- else if((num >= 91) && (num <= 99))
- {
- player->Equip[14].Index += 30;
- player->Equip[14].EF1 = 1;
- player->Equip[14].EFV1 = 1;
- player->Equip[14].EF2 = 1;
- player->Equip[14].EFV2 = 30;
- player->Equip[14].EF3 = 1;
- player->Equip[14].EFV3 = 1;
- p->SendItens(clientid,14);
- p->SendALL(clientid);
- return;
- }
- }
- }
- else
- {
- p->SendClientMsg(clientid,"Uso inadequado.");
- p->SendALL(clientid);
- return;
- }
- }
- }
- void Volatiles::Selo_do_guerreiro(int clientid)
- {
- Atualizar *p;
- FILE *arquivo;
- MOB *player = (MOB*)GetMobFromIndex(clientid);
- char quest[100];
- char Fama[100];
- char fama[100];
- char fama2[100];
- char line[100];
- int itenslot = p->GetFirstSlotSADD(clientid,3274,64);
- int fame = PByte(0x04BFBA5);
- int var;
- sprintf(quest,"DataBase/Fama/Fama_de_[%s].xml", player->Name);
- if(file_exists(quest))
- {
- arquivo = fopen(quest, "r");
- while ((fscanf(arquivo, "%[^\n]", line)) != EOF)
- fgetc(arquivo);
- int Fama3;
- sscanf(line, "%d",&Fama3);
- Fama3 += 10;
- arquivo = fopen(quest, "w");
- sprintf(fama,"%d", Fama3);
- fputs(fama, arquivo);
- sprintf(fama2,"Gerado 10 de Fama.", fame);
- p->SendClientMsg(clientid,fama2);
- fclose(arquivo);
- PrintfTM(clientid,"usou o item [Selo do Guerreiro].");
- player->Inventory[itenslot].Index = 0;
- p->SendALL(clientid);
- return;
- }
- else
- {
- arquivo = fopen(quest, "w");
- var = 10;
- sprintf(fama,"%d", var);
- fputs(fama, arquivo);
- fputs(fama, arquivo);
- sprintf(fama2,"Gerado 10 de Fama.", fame);
- p->SendClientMsg(clientid,fama2);
- fclose(arquivo);
- PrintfTM(clientid,"usou o item [Selo do Guerreiro].");
- player->Inventory[itenslot].Index = 0;
- p->SendALL(clientid);
- return;
- return;
- }
- }
- void Volatiles::Pesadelo_A(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int item = p->GetFirstSlotSADD(clientid,930,64);
- {
- VivosPesaA = 8;
- strcpy((char*)UserInPesaA, (const char*)thisclient->Name);
- p->DoTeleport(clientid, 1209, 174);
- p->PTeleport(clientid, 1209+2, 174+2);
- thisclient->Inventory[item].Index = 0;
- p->NpcsAlive(clientid,VivosPesaA,VivosPesaA);
- p->TempoVerde(clientid,900);
- Init(PesA);
- thisclient->Exp += 200000;
- return;
- }
- return;
- }
- void Volatiles::Pesadelo_M(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int item = p->GetFirstSlotSADD(clientid,929,64);
- {
- VivosPesaM = 8;
- strcpy((char*)UserInPesaM, (const char*)thisclient->Name);
- p->DoTeleport(clientid, 1093,310);
- p->PTeleport(clientid, 1093+2,310+2);
- thisclient->Inventory[item].Index = 0;
- p->NpcsAlive(clientid,VivosPesaM,VivosPesaM);
- p->TempoVerde(clientid,900);
- Init(PesM);
- thisclient->Exp += 200000;
- return;
- }
- }
- void Volatiles::Pesadelo_N(int clientid)
- {
- MOB *thisclient = (MOB*)GetMobFromIndex(clientid);
- Atualizar *p;
- int item = p->GetFirstSlotSADD(clientid,928,64);
- {
- StatusPesaN=1;
- VivosPesaN = 8;
- strcpy((char*)UserInPesaN, (const char*)thisclient->Name);
- p->DoTeleport(clientid,1309,312);
- p->PTeleport(clientid,1309+2,312+2);
- thisclient->Inventory[item].Index = 0;
- p->NpcsAlive(clientid,VivosPesaN,VivosPesaN);
- p->TempoVerde(clientid,900);
- Init(PesN);
- thisclient->Exp += 200000;
- return;
- }
- /*
- &&&&&&&&&&&&&&&&&
- & Source Code &
- & By &
- & TheHouse &
- & & &
- & Klafke &
- &&&&&&&&&&&&&&&&&
- */
- #include "DLLMain.h"
- // By fodex3
- void Packets::Donate(WORD clientid,BYTE *m_PacketBuffer)
- {
- FILE *arquivo;
- PacketHeader *Header = (PacketHeader*)m_PacketBuffer;
- Atualizar *a;
- p379 *pNPC = (p379*)m_PacketBuffer;
- MOB *Npc = (MOB*)GetMobFromIndex(pNPC->mobID);
- MOB *player = (MOB*)GetMobFromIndex(clientid);
- WORD Inventario = a->GetFirstSlotSADD(clientid,0,64);
- int Index = Npc->Inventory[pNPC->sellSlot].Index;
- char ARQUI[80], fala[1024];
- int Dinheiro;
- int login = vLogin(clientid);
- sprintf(ARQUI,"DataBase/Cashplayer/[%s].txt",login);
- switch(Npc->bStatus.Level)
- {
- case 12:// Level do Npc que vai vender
- {
- switch(Index)//Switch para o item que está indo
- {
- case 2428:// id do item que ira vender no npc
- {
- int preço_Perga_A = 200; // preço do item
- if(file_exists(ARQUI))
- {
- sprintf(ARQUI,"DataBase/Cashplayer/[%s].txt",login);
- arquivo = fopen(ARQUI, "r");// lê o arquivo
- while ((fscanf(arquivo, "%[^\n]", ARQUI)) != EOF)
- fgetc(arquivo);
- sscanf(ARQUI, "%d", &Dinheiro);// pega o cash no arquivo e armazena na variavél Dinheiro
- fclose(arquivo);//fecha arquivo
- if(Dinheiro >= preço_Perga_A)
- {
- if(Inventario != -1)
- {
- int Retirar = Dinheiro -= preço_Perga_A;
- sprintf(ARQUI,"DataBase/Cashplayer/[%s].txt", login);
- arquivo = fopen(ARQUI, "w");//abre o arquivo
- while ((fscanf(arquivo, "%[^\n]", ARQUI)) != EOF)
- fgetc(arquivo);
- sprintf(ARQUI,"%d",Retirar); //escreve no arquivo
- fputs(ARQUI, arquivo);
- fclose(arquivo);
- player->Inventory[Inventario].Index = 2428;
- a->SendALL(clientid);
- a->SendClientMsg(clientid,"Item Shoping comprado com sucesso!");
- return;
- }
- else
- {
- a->SendClientMsg(clientid,"Inventario cheio!");
- return;
- }
- }
- else
- {
- Header->PacketId = 0;
- a->SendClientMsg(clientid,"Voce nao possui dinheiro suficiente");
- return;
- }
- }
- else
- {
- Header->PacketId = 0;
- a->SendClientMsg(clientid,"Você não possui Dinheiro");
- return;
- }
- }
- case 413:// id do item que ira vender no npc
- {
- int Poeira_Lac = 200; // preço do item
- if(file_exists(ARQUI))
- {
- sprintf(ARQUI,"DataBase/Cashplayer/[%s].txt",login);
- arquivo = fopen(ARQUI, "r");// lê o arquivo
- while ((fscanf(arquivo, "%[^\n]", ARQUI)) != EOF)
- fgetc(arquivo);
- sscanf(ARQUI, "%d", &Dinheiro);// pega o cash no arquivo e armazena na variavél Dinheiro
- fclose(arquivo);//fecha arquivo
- if(Dinheiro >= Poeira_Lac)
- {
- if(Inventario != -1)
- {
- int Retirar = Dinheiro -= Poeira_Lac;
- sprintf(ARQUI,"DataBase/Cashplayer/[%s].txt", login);
- arquivo = fopen(ARQUI, "w");//abre o arquivo
- while ((fscanf(arquivo, "%[^\n]", ARQUI)) != EOF)
- fgetc(arquivo);
- sprintf(ARQUI,"%d",Retirar); //escreve no arquivo
- fputs(ARQUI, arquivo);
- fclose(arquivo);
- player->Inventory[Inventario].Index = 413;
- a->SendALL(clientid);
- a->SendClientMsg(clientid,"Item Shoping comprado com sucesso!");
- return;
- }
- else
- {
- a->SendClientMsg(clientid,"Inventario cheio!");
- return;
- }
- }
- else
- {
- Header->PacketId = 0;
- a->SendClientMsg(clientid,"Voce nao possui dinheiro suficiente");
- return;
- }
- }
- else
- {
- Header->PacketId = 0;
- a->SendClientMsg(clientid,"Você não possui Dinheiro");
- return;
- }
- }
- case 412:// id do item que ira vender no npc
- {
- int Poeira_ori = 200; // preço do item
- if(file_exists(ARQUI))
- {
- sprintf(ARQUI,"DataBase/Cashplayer/[%s].txt",login);
- arquivo = fopen(ARQUI, "r");// lê o arquivo
- while ((fscanf(arquivo, "%[^\n]", ARQUI)) != EOF)
- fgetc(arquivo);
- sscanf(ARQUI, "%d", &Dinheiro);// pega o cash no arquivo e armazena na variavél Dinheiro
- fclose(arquivo);//fecha arquivo
- if(Dinheiro >= Poeira_ori)
- {
- if(Inventario != -1)
- {
- int Retirar = Dinheiro -= Poeira_ori;
- sprintf(ARQUI,"DataBase/Cashplayer/[%s].txt", login);
- arquivo = fopen(ARQUI, "w");//abre o arquivo
- while ((fscanf(arquivo, "%[^\n]", ARQUI)) != EOF)
- fgetc(arquivo);
- sprintf(ARQUI,"%d",Retirar); //escreve no arquivo
- fputs(ARQUI, arquivo);
- fclose(arquivo);
- player->Inventory[Inventario].Index = 412;
- a->SendALL(clientid);
- a->SendClientMsg(clientid,"Item Shoping comprado com sucesso!");
- return;
- }
- else
- {
- a->SendClientMsg(clientid,"Inventario cheio!");
- return;
- }
- }
- else
- {
- Header->PacketId = 0;
- a->SendClientMsg(clientid,"Voce nao possui dinheiro suficiente");
- return;
- }
- }
- else
- {
- Header->PacketId = 0;
- a->SendClientMsg(clientid,"Você não possui Dinheiro");
- return;
- }
- }
- }
- }
- }
- }