WhatsApp Discord
Nueva takumi12 - CustomMix v2 100% - Source Mu - Mu Server Files
 

Noticias:

SMF - Just Installed!

Menú principal

Nueva takumi12 - CustomMix v2 100%

Publicado por Dakosmu, Jul 09, 2025, 02:28 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Dakosmu

Información Reconstruida para SMF

Antes de que empiecen a criticar, por favor, vean el código, ya que es código único. Ya había compartido una versión de esta, la cual funciona perfectamente. Este código es diferente al otro, realicé optimizaciones y mejoras, cambié el algoritmo y la forma en un 95%, así que lo comparto como una segunda versión.

Before you go to barde see the code, since it is a unique code I had already shared a version of it, which works perfectly, this code is different from the other which I made optimizations improvements, I changed the algorithm and the shape of 95% like this I share it as a second version.

SYSTEMA DE CUSTOMMIX ÚNICO

Código de Configuración:
0
//Index MixMoney MixRate_AL0 MixRate_AL1 MixRate_AL2 MixRate_AL3 CountGroup CountItem
148 1000 100 100 100 100 27 6
end

1
//Index ItemMix level Count
//-- SET HOLYANGEL
148 6809 0 1 //HolyAngel Soul
148 6159 0 1 //Jewel Chaos
148 6174 2 1 //Jewel Bless
148 6175 2 1 //Jewel Soul
148 7190 0 1 //Jewel Creation
end
2
//Index Group Count ItemIndexMin ItemIndexMax MinItemLevel Skill Luck MinAdicional Exe ItemSetOption
//-- HELM DARKANGEL
148 0 1 3722 3722 11 0 -1 4 -1 5
148 1 1 3723 3723 11 0 -1 4 -1 5
148 2 1 3724 3724 11 0 -1 4 -1 5
148 3 1 3725 3725 11 0 -1 4 -1 5
148 4 1 3727 3727 11 0 -1 4 -1 5
148 5 1 3728 3728 11 0 -1 4 -1 5
//-- ARMOR DARKANGEL
148 6 1 4234 4234 11 0 -1 4 -1 5
148 7 1 4235 4235 11 0 -1 4 -1 5
148 8 1 4236 4236 11 0 -1 4 -1 5
148 9 1 4237 4237 11 0 -1 4 -1 5
148 10 1 4238 4238 11 0 -1 4 -1 5
148 11 1 4239 4239 11 0 -1 4 -1 5
148 12 1 4240 4240 11 0 -1 4 -1 5
//-- PANTS DARKANGEL
148 13 1 4746 4746 11 0 -1 4 -1 5
148 14 1 4747 4747 11 0 -1 4 -1 5
148 15 1 4748 4748 11 0 -1 4 -1 5
148 16 1 4749 4749 11 0 -1 4 -1 5
148 17 1 4750 4750 11 0 -1 4 -1 5
148 18 1 4751 4751 11 0 -1 4 -1 5
148 19 1 4752 4752 11 0 -1 4 -1 5
//-- GLOVES DARKANGEL
148 20 1 5259 5259 11 0 -1 4 -1 5
148 21 1 5260 5260 11 0 -1 4 -1 5
148 22 1 5261 5261 11 0 -1 4 -1 5
148 23 1 5263 5263 11 0 -1 4 -1 5
//-- BOOTS DARKANGEL
148 24 1 5770 5770 11 0 -1 4 -1 5
148 25 1 5774 5774 11 0 -1 4 -1 5
148 26 1 5776 5776 11 0 -1 4 -1 5
//------------------------------------------------------------------------------------------------------------------------
end
//------------------------------------------------------------------------------------------------------------------------
3
//Index Group ItemIndexMin ItemIndexMax ItemLevel Skill Luck Adicional Exe ItemSetOption
//-- HELM HOLYANGEL
148 0 3734 3734 11 0 -1 -1 0 5
148 1 3735 3735 11 0 -1 -1 0 5
148 2 3736 3736 11 0 -1 -1 0 5
148 3 3737 3737 11 0 -1 -1 0 5
148 4 3739 3739 11 0 -1 -1 0 5
148 5 3740 3740 11 0 -1 -1 0 5
//-- ARMOR HOLYANGEL
148 6 4246 4246 11 0 -1 -1 0 5
148 7 4247 4247 11 0 -1 -1 0 5
148 8 4248 4248 11 0 -1 -1 0 5
148 9 4249 4249 11 0 -1 -1 0 5
148 10 4250 4250 11 0 -1 -1 0 5
148 11 4251 4251 11 0 -1 -1 0 5
148 12 4252 4252 11 0 -1 -1 0 5
//-- PANTS HOLYANGEL
148 13 4758 4758 11 0 -1 -1 0 5
148 14 4759 4759 11 0 -1 -1 0 5
148 15 4760 4760 11 0 -1 -1 0 5
148 16 4761 4761 11 0 -1 -1 0 5
148 17 4762 4762 11 0 -1 -1 0 5
148 18 4763 4763 11 0 -1 -1 0 5
148 19 4764 4764 11 0 -1 -1 0 5
//-- GLOVES HOLYANGEL
148 20 5271 5271 11 0 -1 -1 0 5
148 21 5272 5272 11 0 -1 -1 0 5
148 22 5273 5273 11 0 -1 -1 0 5
148 23 5275 5275 11 0 -1 -1 0 5
//-- BOOTS HOLYANGEL
148 24 5782 5782 11 0 -1 -1 0 5
148 25 5786 5786 11 0 -1 -1 0 5
148 26 5788 5788 11 0 -1 -1 0 5
end

CustomMix.h
// ---
#include "stdafx.h"
#include "RandomManager.h"
// ---
#define MAX_MIX 5000
#define MAX_CUSTOM_MIX 200
// ---
struct CUSTOM_MIX
{
int  m_Index;
int  m_MixMoney;
int  m_MixRate_AL0;
int  m_MixRate_AL1;
int  m_MixRate_AL2;
int  m_MixRate_AL3;
int  m_CountGroup;
int  m_CountItem;
//Index MixMoney MixRate_AL0 MixRate_AL1 MixRate_AL2 MixRate_AL3 CountGroup CountItem
};

struct CUSTOM_BAG_MIX
{
int  m_Index;
int  m_ItemMix;
int  m_ItemLevel;
int  m_Count;
//Index ItemBag level Count
};

struct CUSTOM_ITEM_MIX
{
int  m_Index;
int  m_Group;
int  m_Count;
int  m_ItemIndexMin;
int  m_ItemIndexMax;
int  m_ItemLevel;
int  m_Skill;
int  m_Luck;
int  m_Opcion;
int  m_Excelent;
int  m_SetACC;
//Index Group Count ItemIndex ItemIndex MinItemLevel Skill Luck MinAdicional Exe ItemSetOption
};
// ---
struct CUSTOM_ITEM_MIX_RESULT
{
int  m_Index;
int  m_Group;
int  m_ItemIndexMin;
int  m_ItemIndexMax;
int  m_ItemLevel;
int  m_Skill;
int  m_Luck;
int  m_Opcion;
int  m_Excelent;
int  m_SetACC;
//Index Group ItemIndexMin ItemIndexMax ItemLevel Skill Luck MinAdicional Exe ItemSetOption ItemClass
};

class CCustomMix
{
public:
int m_count1;
int m_count2;
int m_count3;
int m_count4;

void Load(char* path);
int GetCountItemMix(int IndexMix,int counGroup);
CRandomManager RandomManager(int IndexMix,int counGroup);
CUSTOM_MIX* GetCustomMix(int IndexMix);
CUSTOM_ITEM_MIX_RESULT* GetItemResult(int IndexMix,int group,int ItemIndex);
int GetCountItemBagMix(int IndexMix);
bool istItemMix(int IndexMix, int group, CItem boxItem);
bool istItemBagMix(int IndexMix, CItem boxItem);

CUSTOM_MIX m_Data_Mix[MAX_MIX];
CUSTOM_BAG_MIX m_Data_Bag[MAX_MIX];
CUSTOM_ITEM_MIX m_Data_Item[MAX_MIX];
CUSTOM_ITEM_MIX_RESULT m_Data_Result[MAX_MIX];
private:

};
extern CCustomMix gCustomMix;
// ---

CustomMix.cpp
#include "stdafx.h"
#include "Util.h"
#include "ItemManager.h"
#include "Message.h"
#include "User.h"
#include "Path.h"
#include "MemScript.h"
#include "RandomManager.h"
#include "CustomMix.h"
#include "Log.h"

CCustomMix gCustomMix;

void CCustomMix::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_count1 = 0;
this->m_count2 = 0;
this->m_count3 = 0;
this->m_count4 = 0;

for(int n=0;n < MAX_MIX;n++)
{
this->m_Data_Mix[n];
this->m_Data_Bag[n];
this->m_Data_Item[n];
this->m_Data_Result[n];
}

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

int section = lpMemScript->GetNumber();

while(true)
{
if(section == 0)
{
if(strcmp("end",lpMemScript->GetAsString()) == 0)
{
break;
}

this->m_Data_Mix[this->m_count1].m_Index = lpMemScript->GetNumber();

this->m_Data_Mix[this->m_count1].m_MixMoney = lpMemScript->GetAsNumber();

this->m_Data_Mix[this->m_count1].m_MixRate_AL0 = lpMemScript->GetAsNumber();

this->m_Data_Mix[this->m_count1].m_MixRate_AL1 = lpMemScript->GetAsNumber();

this->m_Data_Mix[this->m_count1].m_MixRate_AL2 = lpMemScript->GetAsNumber();

this->m_Data_Mix[this->m_count1].m_MixRate_AL3 = lpMemScript->GetAsNumber();

this->m_Data_Mix[this->m_count1].m_CountGroup = lpMemScript->GetAsNumber();

this->m_Data_Mix[this->m_count1].m_CountItem = lpMemScript->GetAsNumber();

this->m_count1++;
}
else if(section == 1)
{
if(strcmp("end",lpMemScript->GetAsString()) == 0)
{
break;
}

this->m_Data_Bag[this->m_count2].m_Index = lpMemScript->GetNumber();

this->m_Data_Bag[this->m_count2].m_ItemMix = lpMemScript->GetAsNumber();

this->m_Data_Bag[this->m_count2].m_ItemLevel = lpMemScript->GetAsNumber();

this->m_Data_Bag[this->m_count2].m_Count = lpMemScript->GetAsNumber();

this->m_count2++;
}
else if(section == 2)
{
if(strcmp("end",lpMemScript->GetAsString()) == 0)
{
break;
}

this->m_Data_Item[this->m_count3].m_Index = lpMemScript->GetNumber();

this->m_Data_Item[this->m_count3].m_Group = lpMemScript->GetAsNumber();

this->m_Data_Item[this->m_count3].m_Count = lpMemScript->GetAsNumber();

this->m_Data_Item[this->m_count3].m_ItemIndexMin = lpMemScript->GetAsNumber();

this->m_Data_Item[this->m_count3].m_ItemIndexMax = lpMemScript->GetAsNumber();

this->m_Data_Item[this->m_count3].m_ItemLevel = lpMemScript->GetAsNumber();

this->m_Data_Item[this->m_count3].m_Skill = lpMemScript->GetAsNumber();

this->m_Data_Item[this->m_count3].m_Luck = lpMemScript->GetAsNumber();

this->m_Data_Item[this->m_count3].m_Opcion = lpMemScript->GetAsNumber();

this->m_Data_Item[this->m_count3].m_Excelent = lpMemScript->GetAsNumber();

this->m_Data_Item[this->m_count3].m_SetACC = lpMemScript->GetAsNumber();

this->m_count3++;
}
else if(section == 3)
{
if(strcmp("end",lpMemScript->GetAsString()) == 0)
{
break;
}

this->m_Data_Result[this->m_count4].m_Index = lpMemScript->GetNumber();

this->m_Data_Result[this->m_count4].m_Group = lpMemScript->GetAsNumber();

this->m_Data_Result[this->m_count4].m_ItemIndexMin = lpMemScript->GetAsNumber();

this->m_Data_Result[this->m_count4].m_ItemIndexMax = lpMemScript->GetAsNumber();

this->m_Data_Result[this->m_count4].m_ItemLevel = lpMemScript->GetAsNumber();

this->m_Data_Result[this->m_count4].m_Skill = lpMemScript->GetAsNumber();

this->m_Data_Result[this->m_count4].m_Luck = lpMemScript->GetAsNumber();

this->m_Data_Result[this->m_count4].m_Opcion = lpMemScript->GetAsNumber();

this->m_Data_Result[this->m_count4].m_Excelent = lpMemScript->GetAsNumber();

this->m_Data_Result[this->m_count4].m_SetACC = lpMemScript->GetAsNumber();

this->m_count4++;
}
else
{
break;
}
}
}
}
catch(...)
{
ErrorMessageBox(lpMemScript->GetLastError());
}

delete lpMemScript;
}

bool CCustomMix::istItemBagMix(int IndexMix, CItem boxItem){

for(int n=0;n < MAX_MIX;n++)
{
if(this->m_Data_Bag[n].m_Index != IndexMix)
{
continue;
}
if(this->m_Data_Bag[n].m_Index == IndexMix
&& this->m_Data_Bag[n].m_ItemMix == boxItem.m_Index
&& this->m_Data_Bag[n].m_ItemLevel == boxItem.m_Level)
{
return true;
}
}
return false;
}
//---
bool CCustomMix::istItemMix(int IndexMix, int group, CItem boxItem){

for(int n=0;n < MAX_MIX;n++)
{
if(this->m_Data_Item[n].m_Index != IndexMix)
{
continue;
}

if(this->m_Data_Item[n].m_Index == IndexMix && this->m_Data_Item[n].m_Group == group
&& (boxItem.m_Index >= this->m_Data_Item[n].m_ItemIndexMin && boxItem.m_Index <= this->m_Data_Item[n].m_ItemIndexMax))
{
if(this->m_Data_Item[n].m_ItemLevel != -1){
if(boxItem.m_Level < this->m_Data_Item[n].m_ItemLevel){
return false;
}
}

if(this->m_Data_Item[n].m_Skill != -1){
if(this->m_Data_Item[n].m_Skill != boxItem.m_Option1){
return false;
}
}

if(this->m_Data_Item[n].m_Luck != -1){
if(this->m_Data_Item[n].m_Luck != boxItem.m_Option2){
return false;
}
}
if(this->m_Data_Item[n].m_Opcion != -1){
if(this->m_Data_Item[n].m_Opcion > boxItem.m_Option3){
return false;
}
}

if(this->m_Data_Item[n].m_Excelent != -1){
if(this->m_Data_Item[n].m_Excelent != boxItem.m_NewOption){
return false;
}
}

if(this->m_Data_Item[n].m_SetACC != -1){
if(this->m_Data_Item[n].m_SetACC != boxItem.m_SetOption){
return false;
}
}

return true;
}
}

return false;
}

int CCustomMix::GetCountItemBagMix(int IndexMix){

int itemcount = 0;

for(int n=0;n < MAX_MIX;n++)
{
if(this->m_Data_Bag[n].m_Index != IndexMix)
{
continue;
}

if(this->m_Data_Bag[n].m_Index == IndexMix)
{
itemcount+=this->m_Data_Bag[n].m_Count;
}
}
return itemcount;
}

int CCustomMix::GetCountItemMix(int IndexMix,int Group){

int itemcount = 0;

for(int n=0;n < MAX_MIX;n++)
{
if(this->m_Data_Item[n].m_Index != IndexMix)
{
continue;
}

if(this->m_Data_Item[n].m_Index == IndexMix && this->m_Data_Item[n].m_Group == Group)
{
itemcount+=this->m_Data_Item[n].m_Count;
}
}
return itemcount;
}

//---
CUSTOM_MIX* CCustomMix::GetCustomMix(int IndexMix){

for(int n=0;n < MAX_CUSTOM_MIX ;n++)
{
if(this->m_Data_Mix[n].m_Index == IndexMix)
{
return &this->m_Data_Mix[n];
}
}

return 0;
}

CRandomManager CCustomMix::RandomManager(int IndexMix,int group)
{
CRandomManager RandomManager;

for(int n = 0 ; n < MAX_MIX ; n++)
{
if(this->m_Data_Result[n].m_Index != IndexMix)
{
continue;
}

if(this->m_Data_Result[n].m_Index == IndexMix && this->m_Data_Result[n].m_Group == group)
{
for(int ItemIndex = this->m_Data_Result[n].m_ItemIndexMin; ItemIndex <=this->m_Data_Result[n].m_ItemIndexMax ; ItemIndex++){
RandomManager.AddElement(ItemIndex,1);
}
}
}
return RandomManager;
}
//---
CUSTOM_ITEM_MIX_RESULT* CCustomMix::GetItemResult(int IndexMix,int group,int ItemIndex)
{
for(int n=0;n < MAX_MIX;n++)
{
if(this->m_Data_Result[n].m_Index != IndexMix)
{
continue;
}

if(this->m_Data_Result[n].m_Index == IndexMix
&& this->m_Data_Result[n].m_Group == group
&& (ItemIndex >= this->m_Data_Result[n].m_ItemIndexMin && ItemIndex <= this->m_Data_Result[n].m_ItemIndexMax))
{
return &this->m_Data_Result[n];
}
}
return 0;
}

En ChaosBox.cpp, añadir:
#include "CustomMix.h"

Posteriormente, declarar la función en ChaosBox.h:
void CustomItemMix(LPOBJ lpObj, int type);
Luego, inicializar dicha función:
void CChaosBox::CustomItemMix(LPOBJ lpObj, int type) // OK
{
CUSTOM_MIX* CustomMix = gCustomMix.GetCustomMix(type);

if(CustomMix){

int itemMixCount,groupMix = -1;

int ItemBagMixCount = 0;

int itemCountComplet = CustomMix->m_CountItem;

int ItemMixGroupCount = itemCountComplet - gCustomMix.GetCountItemBagMix(CustomMix->m_Index);

//-- primera comprobación de item bag no cambiantes
for(int slot = 0;slot < CHAOS_BOX_SIZE;slot++)
{
if(lpObj->ChaosBox[slot].IsItem() == 0)
{
continue;
}

if(gCustomMix.istItemBagMix(CustomMix->m_Index,lpObj->ChaosBox[slot])){
ItemBagMixCount++;
}
}

//validación de item por grupos existentes
for(int Group = 0 ; Group < CustomMix->m_CountGroup ; Group++){

itemMixCount = 0;

for(int slot = 0;slot < CHAOS_BOX_SIZE;slot++)
{
if(lpObj->ChaosBox[slot].IsItem() == 0)
{
continue;
}

if(gCustomMix.istItemMix(CustomMix->m_Index, Group,lpObj->ChaosBox[slot])) // validación si existe el item
{
itemMixCount++;
}
}

if(itemMixCount == ItemMixGroupCount){
groupMix = Group;
Group = CustomMix->m_CountGroup;
}
}

if((itemMixCount + ItemBagMixCount) != itemCountComplet) // falló la combinación
{
this->GCChaosMixSend(lpObj->Index,7,0);
return;
}

if(this->GetTalismanOfLuckRate(lpObj,&lpObj->ChaosSuccessRate) == 0)
{
this->GCChaosMixSend(lpObj->Index,240,0);
return;
}

switch(lpObj->AccountLevel){
case 1:
lpObj->ChaosSuccessRate =  ((CustomMix->m_MixRate_AL1 < 0 || CustomMix->m_MixRate_AL1 > 100)?90:CustomMix->m_MixRate_AL1);
break;
case 2:
lpObj->ChaosSuccessRate =  ((CustomMix->m_MixRate_AL2 < 0 || CustomMix->m_MixRate_AL2 > 100)?90:CustomMix->m_MixRate_AL2);
break;
case 3:
lpObj->ChaosSuccessRate =  ((CustomMix->m_MixRate_AL3 < 0 || CustomMix->m_MixRate_AL3 > 100)?90:CustomMix->m_MixRate_AL3);
break;
default:
lpObj->ChaosSuccessRate =  ((CustomMix->m_MixRate_AL0 < 0 || CustomMix->m_MixRate_AL0 > 100)?90:CustomMix->m_MixRate_AL0);
break;
}

lpObj->ChaosMoney = lpObj->ChaosSuccessRate * ((CustomMix->m_MixMoney < 0)?1000:CustomMix->m_MixMoney);

int TaxMoney = (lpObj->ChaosMoney*gCastleSiegeSync.GetTaxRateChaos(lpObj->Index))/100;

lpObj->ChaosMoney += TaxMoney;

if(lpObj->Money < ((DWORD)lpObj->ChaosMoney))
{
this->GCChaosMixSend(lpObj->Index,2,0);
return;
}

lpObj->Money -= lpObj->ChaosMoney;

GCMoneySend(lpObj->Index,lpObj->Money);

gCastleSiegeSync.AddTributeMoney(TaxMoney);

if((GetLargeRand()%100) < lpObj->ChaosSuccessRate)
{

WORD ItemIndex = 0;
BYTE ItemOption1 = 0;
BYTE ItemOption2 = 0;
BYTE ItemOption3 = 0;
BYTE ItemNewOption = 0;
BYTE ItemSetOption = 0;

CRandomManager RandomManager = gCustomMix.RandomManager(CustomMix->m_Index,groupMix);

RandomManager.GetRandomElement(&ItemIndex);

CUSTOM_ITEM_MIX_RESULT* ItemCreate = gCustomMix.GetItemResult(CustomMix->m_Index,groupMix,ItemIndex);

if(ItemCreate->m_Skill == -1){
gItemOptionRate.GetItemOption1(6,&ItemOption1);
}else{
ItemOption1 = ItemCreate->m_Skill;
}

if(ItemCreate->m_Luck == -1){
gItemOptionRate.GetItemOption2(6,&ItemOption2);
}else{
ItemOption2 = ItemCreate->m_Luck;
}

if(ItemCreate->m_Opcion == -1){
gItemOptionRate.GetItemOption3(6,&ItemOption3);
}else{
ItemOption3 = ItemCreate->m_Opcion;
}

if(ItemCreate->m_Excelent == -1){

gItemOptionRate.GetItemOption4(6,&ItemNewOption);

gItemOptionRate.MakeNewOption(ItemIndex,ItemNewOption,&ItemNewOption);

}else{
ItemNewOption = ItemCreate->m_Excelent;
}

if(ItemCreate->m_SetACC == -1){

gItemOptionRate.GetItemOption5(6,&ItemSetOption);

gItemOptionRate.MakeSetOption(ItemIndex,ItemSetOption,&ItemSetOption);

}else{
ItemSetOption = ItemCreate->m_SetACC;
}

if(ItemNewOption == 0){
GDCreateItemSend(lpObj->Index,0xFF,0,0,ItemIndex,0,0,0,ItemOption2,ItemOption3,-1,ItemNewOption,ItemSetOption,0,0,0,0xFF,0);
}else{
GDCreateItemSend(lpObj->Index,0xFF,0,0,ItemIndex,0,0,0,ItemOption2,ItemOption3,-1,(ItemNewOption+(16*(GetLargeRand()%3))),ItemSetOption,0,0,0,0xFF,0);
}
gLog.Output(LOG_CHAOS_MIX,"[CustomMix][Success][%s][%s] - (ChaosSuccessRate: %d, ChaosMoney: %d)",lpObj->Account,lpObj->Name,100,lpObj->ChaosMoney);
}
else
{
this->ChaosBoxInit(lpObj);

this->GCChaosBoxSend(lpObj,0);

this->GCChaosMixSend(lpObj->Index,0,0);

gLog.Output(LOG_CHAOS_MIX,"[CustomMix][Failure][%s][%s] - (ChaosSuccessRate: %d, ChaosMoney: %d)",lpObj->Account,lpObj->Name,lpObj->ChaosSuccessRate,lpObj->ChaosMoney);
}
}
else{
gLog.Output(LOG_CHAOS_MIX,"[CustomMix][Failure][%s][%s] - CustomMix No Existente",lpObj->Account,lpObj->Name);
}
}

Y llamarla en:
void CChaosBox::CGChaosMixRecv(PMSG_CHAOS_MIX_RECV* lpMsg,int aIndex) // OK
Dentro, en la última parte del switch, agregar esto:
default:
this->CustomItemMix(lpObj,lpMsg->type);
break;

CRÉDITOS
  • Takumi12
Bon Dia

🡱 🡳
Real Time Web Analytics