nostra 0 #1 Posted July 9, 2007 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. Share this post Link to post
nostra 0 #2 Posted July 9, 2007 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. Share this post Link to post
Boleta 1 #3 Posted July 9, 2007 Preciso dizer algo? Perfect! Muito bem pensado e programado. Parabéns pelo trabalho! Abraços! Share this post Link to post
Boleta 1 #4 Posted July 9, 2007 Preciso dizer algo? Perfect! Muito bem pensado e programado. Parabéns pelo trabalho! Abraços! Share this post Link to post
Walus 0 #5 Posted July 9, 2007 cara isso e mt bom fikei esantado perfect! Share this post Link to post
Rei_vegeta 0 #6 Posted July 10, 2007 cara muito bom = o global uma pena que eu não entendo. =/ onde tem que add isso? Share this post Link to post
Rogui 0 #7 Posted July 10, 2007 Pow cara... muito bom! Como o boleta disse, Perfect! Parabéns, poste mais códigos aqui :] Share this post Link to post
lopinho 0 #8 Posted July 12, 2007 Como Boleta e Rogui...rsrs Perfect !! ~.~ Share this post Link to post
Kevox 0 #10 Posted July 15, 2007 Excelente idéia brother. Armas deveriam dar bônus de ataque e armaduras, etc bônus de defesa, assim feito por você. Bom trabalho. Share this post Link to post
Godpetri 0 #11 Posted July 15, 2007 Uma pergunta aonde fica esse Items.cpp em qual pasta ficaria. Se poder responder ficaria agradecido. Share this post Link to post
Kevox 0 #12 Posted July 15, 2007 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 Share this post Link to post
Godpetri 0 #13 Posted July 15, 2007 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 se poder me ajuda mais uma vez. Ficaria agradecido Share this post Link to post
Kevox 0 #14 Posted July 15, 2007 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 Share this post Link to post
carol :) 0 #15 Posted July 16, 2007 Tava prescisando =p mto obg Tava prescisando =p mto obg Share this post Link to post
tavinhogj 0 #19 Posted July 20, 2007 cara gostei muito xD vo usa no meu ot daew ESK~ Share this post Link to post
BazukeroMaster 0 #20 Posted July 23, 2007 Imitando td mundo Perfect! mt rox vei... queria saber sobra programaçõao =/ vlws flws~~ Share this post Link to post