PDA

View Full Version : |Source| All Class Combo MuEmu



djagripnos
20/11/2018, 04:48 PM
ComboSkillData.h


#pragma once

#define MAX_COMBO_INFO 128

struct COMBO_SKILL_INFO
{
WORD Stage;
WORD Skill;
DWORD Delay;
};

class CComboSkillData
{
public:
CComboSkillData();

void Load(char* path);
void SetInfo(COMBO_SKILL_INFO info);
COMBO_SKILL_INFO* GetInfoBySkill(WORD skill);
DWORD GetSkillDelay(WORD skill);
int GetSkillType(WORD skill);

private:
int m_Count;
COMBO_SKILL_INFO m_Info[MAX_COMBO_INFO];
};

extern CComboSkillData gComboSkillData;


ComboSkillData.cpp


#include "stdafx.h"
#include "ComboSkillData.h"
#include "MemScript.h"
#include "Util.h"

CComboSkillData gComboSkillData;

CComboSkillData::CComboSkillData(void)
{
this->m_Count = 0;
}

void CComboSkillData::Load(char* path)
{
CMemScript* lpMemScript = new CMemScript;

if(lpMemScript == 0)
{
ErrorMessageBox(MEM_SCRIPT_ALLOC_ERROR,path);
return;
}

if(lpMemScript->SetBuffer(path) == 0)
{
ErrorMessageBox(lpMemScript->GetLastError());
delete lpMemScript;
return;
}

this->m_Count = 0;

try
{
COMBO_SKILL_INFO info;

while(true)
{
if(lpMemScript->GetToken() == TOKEN_END)
{
break;
}

if(strcmp("end",lpMemScript->GetString()) == 0)
{
break;
}

memset(&info,NULL,sizeof(info));

info.Stage = lpMemScript->GetNumber();
info.Skill = lpMemScript->GetAsNumber();
info.Delay = lpMemScript->GetAsNumber();

this->SetInfo(info);
}
}
catch(...)
{
ErrorMessageBox(lpMemScript->GetLastError());
}

delete lpMemScript;
}

void CComboSkillData::SetInfo(COMBO_SKILL_INFO info)
{
if(this->m_Count < 0 || this->m_Count >= MAX_COMBO_INFO)
{
return;
}

this->m_Info[this->m_Count++] = info;
}

COMBO_SKILL_INFO* CComboSkillData::GetInfoBySkill(WORD skill)
{
for(int i = 0;i <= this->m_Count;i++)
{
if(this->m_Info[i].Skill == skill)
{
return &this->m_Info[i];
}
}

return NULL;
}

int CComboSkillData::GetSkillType(WORD skill)
{
COMBO_SKILL_INFO* lpInfo = this->GetInfoBySkill(skill);

if(lpInfo != NULL)
{
return lpInfo->Stage;
}

return -1;
}

DWORD CComboSkillData::GetSkillDelay(WORD skill)
{
COMBO_SKILL_INFO* lpInfo = this->GetInfoBySkill(skill);

if(lpInfo != NULL)
{
return lpInfo->Delay;
}

return 0;
}


ServerInfo.cpp at CServerInfo::ReadSkillInfo()


gComboSkillData.Load(gPath.GetFullPath("Skill\\ComboSkill.txt"));


Change ComboSkil.cpp to this


#include "stdafx.h"
#include "ComboSkill.h"
#include "ComboSkillData.h"

CComboSkill gComboSkill;

void CComboSkill::Init()
{
this->m_time = 0;
this->m_skill[0] = 0xFFFF;
this->m_skill[1] = 0xFFFF;
this->m_index = -1;
}

bool CComboSkill::CheckCombo(WORD skill)
{
int type = gComboSkillData.GetSkillType(skill);
DWORD delay = gComboSkillData.GetSkillDelay(skill);

if(type == -1)
{
this->Init();
return 0;
}

if(type == 0)
{
this->m_time = GetTickCount() + delay;
this->m_skill[0] = skill;
this->m_index = 0;
return 0;
}

if(type == 1)
{
if(this->m_time < GetTickCount())
{
this->Init();
return 0;
}

if(this->m_skill[0] == 0xFFFF)
{
this->Init();
return 0;
}

if(this->m_index == 0)
{
this->m_time = GetTickCount() + delay;
this->m_skill[1] = skill;
this->m_index = 1;
return 0;
}

if(this->m_index == 1 && this->m_skill[1] != skill)
{
this->Init();
return 1;
}
}

this->Init();
return 0;
}


Then do file

ComboSkill.txt (Put at Skill folder)


// Stage Skill Delay Comment
0 19 3000 // [DK] Falling Slash
0 20 3000 // [DK] Lunge
0 21 3000 // [DK] Uppercut
0 22 3000 // [DK] Cyclone
0 23 3000 // [DK] Slash
1 41 3000 // [DK] Twisting Slash
1 42 3000 // [DK] Rageful Blow
1 43 3000 // [DK] Death Stab
1 232 3000 // [DK] Frozen Stab
1 344 3000 // [DK] Blood Storm

0 10 3000 // [DW] Hell Fire
0 12 3000 // [DW] Aqua Beam
0 13 3000 // [DW] Blast
0 14 3000 // [DW] Inferno
1 38 3000 // [DW] Decay
1 39 3000 // [DW] Ice Storm
1 40 3000 // [DW] Nova

0 24 3000 // [FE] Triple Shot
1 52 3000 // [FE] Penetration
1 235 3000 // [FE] Five Shot

0 55 3000 // [MG] Fire Slash
0 56 3000 // [MG] Power Slash
0 57 3000 // [MG] Spiral Slash
1 73 3000 // [MG] Mana Rays
1 236 3000 // [MG] Sword Slash
1 237 3000 // [MG] Gigantic Storm

0 61 3000 // [DL] Fire Brust
0 66 3000 // [DL] Eletric Spark
1 78 3000 // [DL] Fire Scream
1 238 3000 // [DL] Birds
1 62 3000 // [DL] Earth Quake

0 214 3000 // [SU] Drain Life
1 215 3000 // [SU] Chain Lightning
1 223 3000 // [SU] Sahamutt
1 224 3000 // [SU] Neil
1 225 3000 // [SU] Ghost Phanton
1 230 3000 // [SU] Red Storm
end



Credits
SmileYzn

Unico
23/11/2018, 03:51 AM
wat season ?