TR

Mounts Usando Attackspeed

Por Tryller, 04 de jan. de 2011 em Linguagens de Programação

otserv
tibia
10
3.6k
TryllerT
04 de janeiro de 2011 às 13:52

Olá XTibianos.

 

Eu modifiquei o mount system do OpenTibia Server para que pudesse usar attackspeed no mounts.xml.

Exemplo de como isto funciona, caso você tenha no vocations.xml attackspeed="2000" e no mounts.xml você tem attackspeed="1900", o attackspeed do player será 100. Este código eu fiz para OpenTibia SVN Servers, testado na Rev 5948

Vamos começar.

 

Em creature.cpp depois de

mountSpeed = 0;

 

Adicione isto

mountAttackSpeed = 0;

 

depois de

mountSpeed = mount.speed;

 

Adicione isto

mountAttackSpeed = mount.attackSpeed;

 

 

 

 

Em creature.h depois de

const int32_t getMountSpeed() const {return (ridingMount ? mountSpeed : 0);}

 

Adicione isto

const int32_t getMountAttackSpeed() const {return (ridingMount ? mountAttackSpeed : 0);}

 

Depois de

int32_t mountSpeed;

 

Adicione isto

int32_t mountAttackSpeed;

 

 

 

Em mount.cpp depois de

						if(readXMLInteger(p, "speed", intValue)){
						mount.speed = intValue;
					}

 

Adicione isto

						if(readXMLInteger(p, "attackspeed", intValue)){
						mount.attackSpeed = intValue;
					}

 

Em mount.h troque isto

Mount() : mountId(0), lookType(0), speed(0), isPremium(false), isDefault(false), name("") {}

 

Por isto

Mount() : mountId(0), lookType(0), speed(0), attackSpeed(0), isPremium(false), isDefault(false), name("") {}

 

depois de

uint32_t speed;

 

Adicione isto

uint32_t attackSpeed;

 

 

 

Em player.cpp na função uint32_t Player::getAttackSpeed() const troque isto

return vocation->getAttackSpeed();

 

Por isto

return vocation->getAttackSpeed() - getPlayer()->getMountAttackSpeed();

 

Compile, e Rebuild all

Não esqueça de adicionar attackspeed="0" no seu mounts.xml

 

 

Créditos: Tryller

renansdcR
04 de janeiro de 2011 às 14:04

Excelente Tryller, concerteza vai ser útil para bastante gente, já que isso é uma novidade no OpenTibia né.

REP +

Saymon14S
04 de janeiro de 2011 às 14:05

Mais ja nao tem attackspeed no vocations.xml ? como vai ficar esse attackspeed no vocations e no mount.xml ?

 

 

tem como criar isso pra colocar uma tag nas armas ? armas de distancia (bow, crosbow..)

TryllerT
04 de janeiro de 2011 às 14:15

Mais ja nao tem attackspeed no vocations.xml ? como vai ficar esse attackspeed no vocations e no mount.xml ?

 

 

tem como criar isso pra colocar uma tag nas armas ? armas de distancia (bow, crosbow..)

 

 

Você não leu o tópico!!!!

Isto é a diferença entre os 2, p como eu falei se no attack speed tiver 2000 lá nas vocations.xml e no mount tiver attackspeed 1900, o player vai ficar com attackspeed 100, ou seja bem rápido, quanto menor a diferença maioro attackspeed u.u

Saymon14S
04 de janeiro de 2011 às 14:21

agora entedi, tu sabe se tem como criar uma tag pra colocar nas armas no itens.xml ?

TryllerT
04 de janeiro de 2011 às 14:30

agora entedi, tu sabe se tem como criar uma tag pra colocar nas armas no itens.xml ?

 

depende a função... não estou entendendo o que você está querendo dizer ;x

Saymon14S
04 de janeiro de 2011 às 14:35

Um Exemplo...

 

<item id="2455" article="a" name="crossbow">

<attribute key="weight" value="4000" />

<attribute key="attackspeed" value="1500" />

<attribute key="weaponType" value="distance" />

<attribute key="slotType" value="two-handed" />

<attribute key="ammoType" value="bolt" />

<attribute key="range" value="5" />

</item>

 

 

:surprised:

TryllerT
04 de janeiro de 2011 às 14:39

Um Exemplo...

 

<item id="2455" article="a" name="crossbow">

<attribute key="weight" value="4000" />

<attribute key="attackspeed" value="1500" />

<attribute key="weaponType" value="distance" />

<attribute key="slotType" value="two-handed" />

<attribute key="ammoType" value="bolt" />

<attribute key="range" value="5" />

</item>

 

 

:surprised:

 

Você quer saber se no OpenTibia SVN dá de adionar esta tag? se for isto... é possivel sim ;), já viu meu TBRServer? eu adicionei a tag extraAttackSpeed

Saymon14S
04 de janeiro de 2011 às 14:46

To baizando aqui, será que tem como colocar pra 8.54 ? é porque é para um projeto OPEN que to fazendo a algum tempo aqui para o xtibia.

 

me da seu msn pls

SanfS
06 de janeiro de 2011 às 12:16

Eu tenho uma idéia melhor, fazer uma tag de Critical hit para determinada arma.. ex:

<item id="2455" article="a" name="crossbow">

<attribute key="weight" value="4000" />

<attribute key="CriticalHitPercent" value="30" />

<attribute key="weaponType" value="distance" />

<attribute key="slotType" value="two-handed" />

<attribute key="ammoType" value="bolt" />

<attribute key="range" value="5" />

</item>

 

 

dai era só desativar o critical que existe no Config.lua ;)