C++ Damage Reflection (Todos Elementos) TFS 1.3

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Hola a todos,
Aportado por Gazia,
Testeado en TFS 1.3, protocolo 12.72

Utilizaremos el Visual Studio 2019 para poder compilar,

Abriremos items.cpp y buscaremos:
Código:
else if (tmpStrValue == "absorbpercentall" || tmpStrValue == "absorbpercentallelements") {
            int16_t value = pugi::cast<int16_t>(valueAttribute.value());
            Abilities& abilities = it.getAbilities();
            for (auto& i : abilities.absorbPercent) {
                i += value;
            }
debajo pegaremos:
Código:
else if (tmpStrValue == "reflectpercentall") {
        int16_t value = pugi::cast<int16_t>(valueAttribute.value());
        Abilities& abilities = it.getAbilities();
        for (auto& i : abilities.reflectPercent) {
            i += value;
            }
        }

Ahora nos iremos en item.cpp
buscaremos:
Código:
for (size_t i = 0; i < COMBAT_COUNT; ++i) {
                if (it.abilities->absorbPercent[i] == 0) {
                    continue;
                }

                ss.str("");
                ss << getCombatName(indexToCombatType(i)) << ' '
                                            << std::showpos << it.abilities->absorbPercent[i] << std::noshowpos << '%';
                descriptions.emplace_back("Protection", ss.str());
        }

Pegaremos encima esto:
Código:
for (size_t i = 0; i < COMBAT_COUNT; ++i) {
                if (it.abilities->reflectPercent[i] == 0) {
                    continue;
                }

                ss.str("");
                ss << getCombatName(indexToCombatType(i)) << ' '
                    << std::showpos << it.abilities->reflectPercent[i] << std::noshowpos << '%';
                descriptions.emplace_back("Damage Reflection", ss.str());
            }
buscaremos:
Código:
for (size_t i = 0; i < COMBAT_COUNT; ++i) {
                if (it.abilities->fieldAbsorbPercent[i] == 0) {
                    continue;
                }

                ss.str("");
                ss << getCombatName(indexToCombatType(i)) << ' '
                                       << std::showpos << it.abilities->fieldAbsorbPercent[i] << std::noshowpos << '%';
                descriptions.emplace_back("Field Protection", ss.str());
            }

Debajo copiaremos:
Código:
for (size_t i = 0; i < COMBAT_COUNT; ++i) {
                if (it.abilities->reflectPercent[i] == 0) {
                    continue;
                }

                ss.str("");
                ss << getCombatName(indexToCombatType(i)) << ' '
                    << std::showpos << it.abilities->reflectPercent[i] << std::noshowpos << '%';
                descriptions.emplace_back("Damage Reflection", ss.str());
            }

buscaremos:
Código:
for (size_t i = 0; i < COMBAT_COUNT; ++i) {
                if (it.abilities->absorbPercent[i] == 0) {
                    continue;
                }

                ss.str("");
                ss << getCombatName(indexToCombatType(i)) << ' '
                                            << std::showpos << it.abilities->absorbPercent[i] << std::noshowpos << '%';
                descriptions.emplace_back("Protection", ss.str());
            }
debajo pondremos:
Código:
for (size_t i = 0; i < COMBAT_COUNT; ++i) {
                if (it.abilities->reflectPercent[i] == 0) {
                    continue;
                }

                ss.str("");
                ss << getCombatName(indexToCombatType(i)) << ' '
                    << std::showpos << it.abilities->reflectPercent[i] << std::noshowpos << '%';
                descriptions.emplace_back("Damage Reflection", ss.str());
            }
buscaremos: ( linea 1640 approximadamente )
Código:
int16_t show = it.abilities->absorbPercent[0];
Encima pegaremos:
Código:
int16_t show = it.abilities->reflectPercent[0];
                if (show != 0) {
                    for (size_t i = 1; i < COMBAT_COUNT; ++i) {
                        if (it.abilities->reflectPercent[i] != show) {
                            show = 0;
                            break;
                        }
                    }
                }

                if (show == 0) {
                    bool tmp = true;

                    for (size_t i = 0; i < COMBAT_COUNT; ++i) {
                        if (it.abilities->reflectPercent[i] == 0) {
                            continue;
                        }

                        if (tmp) {
                            tmp = false;

                            if (begin) {
                                begin = false;
                                s << " (";
                            }
                            else {
                                s << ", ";
                            }

                            s << "damage reflection ";
                        }
                        else {
                            s << ", ";
                        }

                        s << getCombatName(indexToCombatType(i)) << ' ' << std::showpos << it.abilities->reflectPercent[i] << std::noshowpos << '%';
                    }
                }
                else {
                    if (begin) {
                        begin = false;
                        s << " (";
                    }
                    else {
                        s << ", ";
                    }

                    s << "damage reflection all " << std::showpos << show << std::noshowpos << '%';
                }

Justo debajo , aparecerá el
Código:
int16_t show = it.abilities->absorbPercent[0];
que reemplazaremos por:
Código:
show = it.abilities->absorbPercent[0];

Buscamos por el mismo codigo de nuevo ( hay 3 en total )
Código:
int16_t show = it.abilities->absorbPercent[0];
Encima copiaremos este codigo, y debajo repetiremos lo mismo que arriba, borraremos el int16_t (ver despues del codigo)
Código:
int16_t show = it.abilities->reflectPercent[0];
                if (show != 0) {
                    for (size_t i = 1; i < COMBAT_COUNT; ++i) {
                        if (it.abilities->reflectPercent[i] != show) {
                            show = 0;
                            break;
                        }
                    }
                }

                if (show == 0) {
                    bool tmp = true;

                    for (size_t i = 0; i < COMBAT_COUNT; ++i) {
                        if (it.abilities->reflectPercent[i] == 0) {
                            continue;
                        }

                        if (tmp) {
                            tmp = false;

                            if (begin) {
                                begin = false;
                                s << " (";
                            }
                            else {
                                s << ", ";
                            }

                            s << "damage reflection ";
                        }
                        else {
                            s << ", ";
                        }

                        s << getCombatName(indexToCombatType(i)) << ' ' << std::showpos << it.abilities->reflectPercent[i] << std::noshowpos << '%';
                    }
                }
                else {
                    if (begin) {
                        begin = false;
                        s << " (";
                    }
                    else {
                        s << ", ";
                    }

                    s << "damage reflection all " << std::showpos << show << std::noshowpos << '%';
                }
De la siguiente manera de nuevo:
Código:
int16_t show = it.abilities->absorbPercent[0];
que reemplazaremos por:
Código:
show = it.abilities->absorbPercent[0];

Por último,
Buscamos de nuevo:
Código:
int16_t show = it.abilities->absorbPercent[0];
Reemplazamos por:
Código:
show = it.abilities->absorbPercent[0];
y encima pondremos:
Código:
int16_t show = it.abilities->reflectPercent[0];
            if (show != 0) {
                for (size_t i = 1; i < COMBAT_COUNT; ++i) {
                    if (it.abilities->reflectPercent[i] != show) {
                        show = 0;
                        break;
                    }
                }
            }

            if (!show) {
                bool damageReflected = true;
                for (size_t i = 0; i < COMBAT_COUNT; ++i) {
                    if (it.abilities->reflectPercent[i] == 0) {
                        continue;
                    }

                    if (damageReflected) {
                        damageReflected = false;

                        if (begin) {
                            begin = false;
                            s << " (";
                        }
                        else {
                            s << ", ";
                        }

                        s << "damage reflection ";
                    }
                    else {
                        s << ", ";
                    }

                    s << getCombatName(indexToCombatType(i)) << ' ' << std::showpos << it.abilities->reflectPercent[i] << std::noshowpos << '%';
                }
            }
            else {
                if (begin) {
                    begin = false;
                    s << " (";
                }
                else {
                    s << ", ";
                }

                s << "damage reflection all " << std::showpos << show << std::noshowpos << '%';
            }


Terminando con esto, compilamos y pasamos los .DLL y .EXE a nuestro servidor.

Ahora en items.xml podremos utilizar el nuevo attributo: <attribute key="reflectpercentall" value="VALOR" />
En donde Valor indicaran un número de valor para reflejar.
Refleja todo tipo de elementos, incluyendo life, drown, healing, holy, earth, energy, physical, etc.
 
Última edición:
Arriba