Ir para conteúdo
Entre para seguir isso  
nostra

ATK/DEF/ARM increase

Recommended Posts

nostra    0
nostra

Explicação: No Tibia 8.0 temos algumas armas, armaduras e escudos que tem-se: Def (e.g: You see a XXXX. (Atk: YY Def: ZZ + A)

Eu fiz para aumentar o ataque também pois acho que ficaria melhor, se quiser basta modificar a gosto.

 

O código não foi testado e falta alguns ajustes que são facilmente feitos.

 

O código é totalmente de minha autoria.

 

Vamos ao código:

 

Items.cpp

 

Em ItemType::ItemType()

 

Adicione:

 

atkbonus = 0;
armbonus = 0;
defbonus = 0;

 

 

Depois de:

 

                            else if(strcasecmp(strValue.c_str(), "attack") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                    it.attack = intValue;
                                }
                            }
                            else if(strcasecmp(strValue.c_str(), "armor") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                    it.armor = intValue;
                                }
                            }
                            else if(strcasecmp(strValue.c_str(), "defense") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                    it.defense= intValue;
                                }
                            }

 

Adicione:

 

                            
                                  else if(strcasecmp(strValue.c_str(), "atkincrease") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                         it.atkbonus = intValue;
                                }
                            }
                                  else if(strcasecmp(strValue.c_str(), "armincrease") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                         it.armbonus = intValue;
                                }
                            }
                                  else if(strcasecmp(strValue.c_str(), "defincrease") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                         it.defbonus = intValue;
                                }
                            }

 

Troque:

 

 return baseDefense + (defense * shieldSkill) / 100;

 

Por:

 

    
    if(getDefBonus) {
     return getDefBonus() + baseDefense + (defense * shieldSkill) / 100;
     }
    else if(getArmBonus) {
      return getArmBonus() + baseDefense + (defense * shieldSkill) / 100;
    }
    else if(getDefBonus && getArmBonus) {
      return getArmBonus() + getDefBonus() + baseDefense + (defense * shieldSkill) / 100;
    }
    else {
       return baseDefense + (defense * shieldSkill) / 100;
    }

 

 

Items.h

 

Declare os valores:

 

    int32_t            atkbonus;
    int32_t            armbonus;
    int32_t            defbonus;

 

 

E depois de:

 

int32_t getAttack() const {return items[id].attack;}
int32_t getArmor() const {return items[id].armor;}
int32_t getDefense() const {return items[id].defence;}

 

Adicione:

 

int32_t getAtkBonus() const {return items[id].atkbonus;}
int32_t getArmBonus() const {return items[id].armbonus;}
int32_t getDefBonus() const {return items[id].defbonus;}

 

 

Troque:

 

                if(getAttack())
                    s << article(it.name) << " (Atk:" << (int32_t)getAttack() << " Def:" << (int32_t)getDefense() << ").";
                else
                    s << article(it.name) << " (Def:" << (int32_t)getDefense() << ").";
            }
            else if(getArmor())
                s << article(it.name) << " (Arm:" << (int32_t)getArmor() << ").";

 

Por:

 

 

            if(getAttack())
                s << article(it.name) << " (Atk:" << (int32_t)getAttack() << (getAtkBonus() ? " + " <<  (int32_t)getAtkBonus() << : "") " Def:" << (int32_t)getDefense() << (getDefBonus() ? " + " << (int32_t)getDefBonus() << : "") ").";
            else if(getArmor()) {
                if(getArmBonus()) {
                    s << article(it.name) << " (Arm:" << (int32_t)getArmor() << ") +" << (int32_t)getArmBonus();
                }
                else {
                    s << article(it.name) << " (Arm:" << (int32_t)getArmor() << ").";
                }
            }
            else {
                    if(getDefBonus()) {
                        s << article(it.name) << " (Def:" << (int32_t)getDefense() << " + " << (int32_t)getDefBonus() << ").";
                    }
                    else {    
                        s << article(it.name) << " (Def:" << (int32_t)getDefense() << ").";
                    }
            }

 

Weapons.cpp

 

Troque:

 

int32_t attackValue = item->getAttack();

 

Por:

    if(item->getAtkBonus())
        int32_t attackValue = item->getAttack() + item->getAtkBonus();
    else
        int32_t attackValue = item->getAttack();

 

 

Para usar basta adicionar:

 

<attribute key="atkincrease" value="3"/>
<attribute key="defincrease" value="5"/>
<attribute key="armincrease" value="4"/>

 

Apenas ponha isso em algum item que queira no items.xml

Se não quer aumentar nada, apenas deixe sem isso.

 

 

Compartilhar este post


Link para o post
nostra    0
nostra

Explicação: No Tibia 8.0 temos algumas armas, armaduras e escudos que tem-se: Def (e.g: You see a XXXX. (Atk: YY Def: ZZ + A)

Eu fiz para aumentar o ataque também pois acho que ficaria melhor, se quiser basta modificar a gosto.

 

O código não foi testado e falta alguns ajustes que são facilmente feitos.

 

O código é totalmente de minha autoria.

 

Vamos ao código:

 

Items.cpp

 

Em ItemType::ItemType()

 

Adicione:

 

atkbonus = 0;
armbonus = 0;
defbonus = 0;

 

 

Depois de:

 

                            else if(strcasecmp(strValue.c_str(), "attack") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                    it.attack = intValue;
                                }
                            }
                            else if(strcasecmp(strValue.c_str(), "armor") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                    it.armor = intValue;
                                }
                            }
                            else if(strcasecmp(strValue.c_str(), "defense") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                    it.defense= intValue;
                                }
                            }

 

Adicione:

 

                            
                                  else if(strcasecmp(strValue.c_str(), "atkincrease") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                         it.atkbonus = intValue;
                                }
                            }
                                  else if(strcasecmp(strValue.c_str(), "armincrease") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                         it.armbonus = intValue;
                                }
                            }
                                  else if(strcasecmp(strValue.c_str(), "defincrease") == 0){
                                if(readXMLInteger(itemAttributesNode, "value", intValue)){
                                         it.defbonus = intValue;
                                }
                            }

 

Troque:

 

 return baseDefense + (defense * shieldSkill) / 100;

 

Por:

 

    
    if(getDefBonus) {
     return getDefBonus() + baseDefense + (defense * shieldSkill) / 100;
     }
    else if(getArmBonus) {
      return getArmBonus() + baseDefense + (defense * shieldSkill) / 100;
    }
    else if(getDefBonus && getArmBonus) {
      return getArmBonus() + getDefBonus() + baseDefense + (defense * shieldSkill) / 100;
    }
    else {
       return baseDefense + (defense * shieldSkill) / 100;
    }

 

 

Items.h

 

Declare os valores:

 

    int32_t            atkbonus;
    int32_t            armbonus;
    int32_t            defbonus;

 

 

E depois de:

 

int32_t getAttack() const {return items[id].attack;}
int32_t getArmor() const {return items[id].armor;}
int32_t getDefense() const {return items[id].defence;}

 

Adicione:

 

int32_t getAtkBonus() const {return items[id].atkbonus;}
int32_t getArmBonus() const {return items[id].armbonus;}
int32_t getDefBonus() const {return items[id].defbonus;}

 

 

Troque:

 

                if(getAttack())
                    s << article(it.name) << " (Atk:" << (int32_t)getAttack() << " Def:" << (int32_t)getDefense() << ").";
                else
                    s << article(it.name) << " (Def:" << (int32_t)getDefense() << ").";
            }
            else if(getArmor())
                s << article(it.name) << " (Arm:" << (int32_t)getArmor() << ").";

 

Por:

 

 

            if(getAttack())
                s << article(it.name) << " (Atk:" << (int32_t)getAttack() << (getAtkBonus() ? " + " <<  (int32_t)getAtkBonus() << : "") " Def:" << (int32_t)getDefense() << (getDefBonus() ? " + " << (int32_t)getDefBonus() << : "") ").";
            else if(getArmor()) {
                if(getArmBonus()) {
                    s << article(it.name) << " (Arm:" << (int32_t)getArmor() << ") +" << (int32_t)getArmBonus();
                }
                else {
                    s << article(it.name) << " (Arm:" << (int32_t)getArmor() << ").";
                }
            }
            else {
                    if(getDefBonus()) {
                        s << article(it.name) << " (Def:" << (int32_t)getDefense() << " + " << (int32_t)getDefBonus() << ").";
                    }
                    else {    
                        s << article(it.name) << " (Def:" << (int32_t)getDefense() << ").";
                    }
            }

 

Weapons.cpp

 

Troque:

 

int32_t attackValue = item->getAttack();

 

Por:

    if(item->getAtkBonus())
        int32_t attackValue = item->getAttack() + item->getAtkBonus();
    else
        int32_t attackValue = item->getAttack();

 

 

Para usar basta adicionar:

 

<attribute key="atkincrease" value="3"/>
<attribute key="defincrease" value="5"/>
<attribute key="armincrease" value="4"/>

 

Apenas ponha isso em algum item que queira no items.xml

Se não quer aumentar nada, apenas deixe sem isso.

 

 

Compartilhar este post


Link para o post
Boleta    1
Boleta

Preciso dizer algo?

Perfect! Muito bem pensado e programado. Parabéns pelo trabalho!

 

Abraços!

Compartilhar este post


Link para o post
Boleta    1
Boleta

Preciso dizer algo?

Perfect! Muito bem pensado e programado. Parabéns pelo trabalho!

 

Abraços!

Compartilhar este post


Link para o post
Walus    0
Walus
blink.gif cara isso e mt bom fikei esantado perfect! laugh.gif

Compartilhar este post


Link para o post
Rei_vegeta    0
Rei_vegeta

cara muito bom = o global

 

 

uma pena que eu não entendo.

 

 

=/

 

 

onde tem que add isso?

Compartilhar este post


Link para o post
Rogui    0
Rogui

Pow cara... muito bom!

 

Como o boleta disse, Perfect!

 

Parabéns, poste mais códigos aqui :]

Compartilhar este post


Link para o post
lopinho    0
lopinho

Como Boleta e Rogui...rsrs

 

Perfect !!

 

~.~

Compartilhar este post


Link para o post
carol :)    0
carol :)

Muito Bom

Compartilhar este post


Link para o post
Kevox    0
Kevox

Excelente idéia brother. Armas deveriam dar bônus de ataque e armaduras, etc bônus de defesa, assim feito por você.

Bom trabalho.

Compartilhar este post


Link para o post
Godpetri    0
Godpetri

Uma pergunta aonde fica esse Items.cpp

em qual pasta ficaria.

 

Se poder responder ficaria agradecido.

 

Compartilhar este post


Link para o post
Kevox    0
Kevox

Godpetri:

 

Esses códigos são implementados na source do OTServ, ou seja, não é uma pasta do OTServ e sim o próprio OTserv wink.gif

Compartilhar este post


Link para o post
Godpetri    0
Godpetri

Kevox Brigado por fala aonde ficava mais nao to achando aqui tem 6 tpw 4 escritos "itens" e outros 2 escrito "itensloader" e nao sei qual deles sad.gif se poder me ajuda mais uma vez.

Ficaria agradecido smile.gif

Compartilhar este post


Link para o post
Kevox    0
Kevox

Não não brother...Como eu disse, não da pra implementar estes códigos no seu OTServ, a menos que você tenha as source dele. Source é a composição do seu executável, o seu OTServ.exe. Se você fosse desfragmentar o seu executável, encontraria as source.

Resumindo. Se você for iniciante em OTServ, não acesse com frequência essa seção. Entre mais na seção Tutoriais wink.gif

Compartilhar este post


Link para o post
carol :)    0
carol :)

Tava prescisando =p

mto obg

 

Tava prescisando =p

mto obg

Compartilhar este post


Link para o post
widsgooc    0
widsgooc
laugh.gif Muito BOM!!

Compartilhar este post


Link para o post
clokis    0
clokis

rox serve

Compartilhar este post


Link para o post
Fukky~    0
Fukky~

Tava precisando a lot vlwzao !!!

Compartilhar este post


Link para o post
tavinhogj    0
tavinhogj

cara gostei muito xD vo usa no meu ot daew ESK~

Compartilhar este post


Link para o post
BazukeroMaster    0
BazukeroMaster

Imitando td mundo tongue.gif

Perfect!

mt rox vei...

queria saber sobra programaçõao =/

vlws

flws~~

 

Compartilhar este post


Link para o post
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×