Autor Tema: Replicar efeito de MasterSkillTree level up  (Leído 1038 veces)

Desconectado zettao

  • *


  • 4

    2

    0
  • br
Boa noite pessoal, beleza?

A alguns dias estou mexendo na source do Louis/MuEMU (season4) e tentando chegar ao seguinte resultado:

Utilizar o efeito de MasterSkillTree LevelUp (imagem1) quando ele upar normal (imagem 2).

Imagem1


Imagem2


Pensei em diversas formas de fazer isso, desde substituir o arquivo do efeito e renomear com o nome do outro (ficaria ruim devido a movimentação q o efeito tem) até mexer na source, que é o que eu estou fazendo hoje.

Não mexi muito com linguagens de baixo nivel, como C++ e assembly, e percebi que os efeitos são puramente essas duas linguagens.

Então vem a minha questão: qual a melhor forma de fazer isso? Acredito que seja mexendo direto na main, o que eu consegui encontrar foi o metodo a seguir, no arquivo "Common.cpp" dentro dos arquivos da main (EX401).

Código
__declspec(naked) void CheckMasterLevel() // OK
{
static DWORD CheckMasterLevelAddress1 = 0x004FD158;

_asm
{
Push Ebp
Mov Ebp,Esp
Mov Eax,Dword Ptr Ds:[MAIN_CHARACTER_STRUCT]
Xor Ecx,Ecx
Mov Cx,Word Ptr Ds:[Eax+0x0E]
Cmp Ecx,0x190
Je NEXT
Xor Eax,Eax
Jmp EXIT
NEXT:
Xor Edx,Edx
Mov Dl,Byte Ptr Ss:[Ebp+0x08]
Push Edx
Call [CheckMasterLevelAddress1]
Add Esp,0x04
EXIT:
Pop Ebp
Retn
}
}

Na parte superior, vejo que também tem comentários no código relacionados a "LevelUp" e um outro comentário com o valor C1:48 (que é o valor utilizado na interface do método GCEffect no GS para realizar o trigger do efeito).

Código
void InitCommon() // OK
{
SetCompleteHook(0xE9,0x005ED21F,&CheckTickCount);

SetCompleteHook(0xFF,0x004BDB34,&CheckMasterLevel); // C1:16

SetCompleteHook(0xFF,0x004BDB95,&CheckMasterLevel); // C1:16

SetCompleteHook(0xFF,0x0061FE6F,&CheckMasterLevel); // C1:48

SetCompleteHook(0xFF,0x0060D415,&CheckMasterLevel); // C1:9C

SetCompleteHook(0xFF,0x0060D4C7,&CheckMasterLevel); // C1:9C

SetCompleteHook(0xFF,0x0060095B,&CheckMasterLevel); // C1:F3:03

SetCompleteHook(0xFF,0x00600A59,&CheckMasterLevel); // C1:F3:03

SetCompleteHook(0xFF,0x0060151F,&CheckMasterLevel); // C1:F3:04

SetCompleteHook(0xFF,0x0060FF37,&CheckMasterLevel); // LevelUp

SetCompleteHook(0xFF,0x006D5E30,&CheckMasterLevel); // Print Level

SetCompleteHook(0xFF,0x0071ACEA,&CheckMasterLevel); // Experience Bar

SetCompleteHook(0xFF,0x0071AD6F,&CheckMasterLevel); // Experience Bar

DisableStaticEffect = GetPrivateProfileIntA("AntiLag", "DisableStaticEffect", 0, "./Settings.ini");
DisableDynamicEffect = GetPrivateProfileIntA("AntiLag", "DisableDynamicEffect", 0, "./Settings.ini");
DisableSkillEffect = GetPrivateProfileIntA("AntiLag", "DisableSkillEffect", 0, "./Settings.ini");
DisableGlowEffect = GetPrivateProfileIntA("AntiLag", "DisableGlowEffect", 0, "./Settings.ini");

Anisotropy = GetPrivateProfileIntA("Graphics","Anisotropy",1,"./Settings.ini");
MaxAnisotropy = GetPrivateProfileIntA("Graphics","MaxAnisotropy",1,"./Settings.ini");
Linear = GetPrivateProfileIntA("Graphics","Linear",1,"./Settings.ini");
Tron = GetPrivateProfileIntA("Graphics","TronEffects", 0, "./Settings.ini");
Fog = GetPrivateProfileIntA("Graphics","Fog",0,"./Settings.ini");

}

Mais uma coisa que percebi é que no GS, tanto o trigger de levelup quanto de masterlevelup, utilizam o mesmo metodo (C1:48) passando os mesmos parâmetros. Isso me fez chegar no comentado acima (que provavelmente o controlador do efeito está na main e nao no GS).

Se alguém puder dar um help e me dizer a melhor forma de fazer isso, ficaria grato! :)

Meu discord: zettao#5633

Desconectado Louis

  • *
  • *


  • 1192

    164

    17548
  • br
  • Louis Emulator
    • +55 15 997401274 +55 15 997401274
    • @jogandomu @jogandomu
    • tec-facil tec-facil
@zettao isso é no gs mesmo, só colocar o GCEffectInfoSend(lpObj->Index,16); onde você precisar.
Please donate to keep this website running. Thank you for your support.

Desconectado zettao

  • *


  • 4

    2

    0
  • br
Ja havia feito essas alterações, Louis. Inclusive, se não me falha a memoria, elas ja vieram assim na source...

No Protocol.cpp (arquivo onde trigga o efeito de levelup comum):
Código
void GCLevelUpSend(LPOBJ lpObj) // OK
{
PMSG_LEVEL_UP_SEND pMsg;

pMsg.header.set(0xF3,0x05,sizeof(pMsg)); // common level up

pMsg.Level = lpObj->Level;

pMsg.LevelUpPoint = lpObj->LevelUpPoint;

pMsg.MaxLife = GET_MAX_WORD_VALUE((lpObj->MaxLife+lpObj->AddLife));

pMsg.MaxMana = GET_MAX_WORD_VALUE((lpObj->MaxMana+lpObj->AddMana));

pMsg.MaxShield = GET_MAX_WORD_VALUE((lpObj->MaxShield+lpObj->AddShield));

pMsg.MaxBP = GET_MAX_WORD_VALUE((lpObj->MaxBP+lpObj->AddBP));

pMsg.FruitAddPoint = lpObj->FruitAddPoint;

pMsg.MaxFruitAddPoint = gFruit.GetMaxFruitPoint(lpObj);

pMsg.FruitSubPoint = lpObj->FruitSubPoint;

pMsg.MaxFruitSubPoint = gFruit.GetMaxFruitPoint(lpObj);

#if(GAMESERVER_EXTRA==1)
pMsg.ViewPoint = (DWORD)(lpObj->LevelUpPoint);
pMsg.ViewMaxHP = (DWORD)(lpObj->MaxLife+lpObj->AddLife);
pMsg.ViewMaxMP = (DWORD)(lpObj->MaxMana+lpObj->AddMana);
pMsg.ViewMaxBP = (DWORD)(lpObj->MaxBP+lpObj->AddBP);
pMsg.ViewMaxSD = (DWORD)(lpObj->MaxShield+lpObj->AddShield);
pMsg.ViewExperience = lpObj->Experience;
pMsg.ViewNextExperience = lpObj->NextExperience;
#endif

DataSend(lpObj->Index,(BYTE*)&pMsg,pMsg.header.size);

LogAdd(LOG_BLUE,"[LevelUpNormal] lpObj->Index (%d)", lpObj->Index);

GCEffectInfoSend(lpObj->Index,16);
}

No arquivo MasterSkillTree.cpp (trigger do masterlevelup):

Código
void CMasterSkillTree::GCMasterLevelUpSend(LPOBJ lpObj) // OK
{
#if(GAMESERVER_UPDATE>=401)

PMSG_MASTER_LEVEL_UP_SEND pMsg;

pMsg.header.set(0xF3,0x51,sizeof(pMsg));

pMsg.MasterLevel = lpObj->MasterLevel;

pMsg.MinMasterLevel = 1;

pMsg.MasterPoint = lpObj->MasterPoint;

pMsg.MaxMasterLevel = gServerInfo.m_MasterSkillTreeMaxLevel;

pMsg.MaxLife = GET_MAX_WORD_VALUE((lpObj->MaxLife+lpObj->AddLife));

pMsg.MaxMana = GET_MAX_WORD_VALUE((lpObj->MaxMana+lpObj->AddMana));

pMsg.MaxShield = GET_MAX_WORD_VALUE((lpObj->MaxShield+lpObj->AddShield));

pMsg.MaxBP = GET_MAX_WORD_VALUE((lpObj->MaxBP+lpObj->AddBP));

#if(GAMESERVER_EXTRA==1)
pMsg.ViewMaxHP = (DWORD)(lpObj->MaxLife+lpObj->AddLife);
pMsg.ViewMaxMP = (DWORD)(lpObj->MaxMana+lpObj->AddMana);
pMsg.ViewMaxBP = (DWORD)(lpObj->MaxBP+lpObj->AddBP);
pMsg.ViewMaxSD = (DWORD)(lpObj->MaxShield+lpObj->AddShield);
pMsg.ViewMasterExperience = lpObj->MasterExperience;
pMsg.ViewMasterNextExperience = lpObj->MasterNextExperience;
#endif

DataSend(lpObj->Index,(BYTE*)&pMsg,pMsg.header.size);

LogAdd(LOG_BLUE,"[MasterSkillLevel] lpObj->Index (%d)", lpObj->Index);

GCEffectInfoSend(lpObj->Index,16);

#endif
}

Ambos estão com a chamada para o metodo da mesma forma. Cheguei até a colocar um log pra ver se o Index era diferente, porém o index é o mesmo para ambos os casos...

Alguma luz? Hahahahahahaha

Duvida paralela: para testar essa alteração, buildei apenas o GS e coloquei no Mu Server. Era só isso que era necessário?

Valeu!

Desconectado zettao

  • *


  • 4

    2

    0
  • br
@zettao isso é no gs mesmo, só colocar o GCEffectInfoSend(lpObj->Index,16); onde você precisar.

Sem ideia do que possa ser?

Desconectado Louis

  • *
  • *


  • 1192

    164

    17548
  • br
  • Louis Emulator
    • +55 15 997401274 +55 15 997401274
    • @jogandomu @jogandomu
    • tec-facil tec-facil
Sem ideia do que possa ser?

no caso teria que verificar na dec do cliente como é a função 0xF3,0x05 e adicionar na level up normal
Please donate to keep this website running. Thank you for your support.

 

.