Ir para conteúdo

[Função] Doplayersetextraattackspeed


Snowsz

Posts Recomendados

FUNÇÃO PARA QUEM TEM PROBLEMAS NO TFS 0.3.6PL1 TUTORIAL ABAIXO \/

 

Créditos:

50% darkhaos

50% Eu Snowsz por ter passado para versão TFS 0.3.6pl1

 

Função testada no TFS 0.3.6pl1.

 

* player.cpp

 

Procure:

lastAttack = idleTime = marriage = blessings = balance = premiumDays = mana = manaMax = manaSpent = 0;

 

Troque por isso

 

lastAttack = idleTime = marriage = blessings = balance = premiumDays = mana = manaMax = manaSpent = extraAttackSpeed = 0;

 

Procure:

 

return vocation->getAttackSpeed()

 

Troque por isso:

 

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

 

No fim do arquivo coloque isto:

 

void Player::setPlayerExtraAttackSpeed(uint32_t speed)
{
extraAttackSpeed = speed;
}

 

* player.h

 

Depois de:

 

uint64_t getSpentMana() const {return manaSpent;}

 

Coloque isto:

 

uint32_t getExtraAttackSpeed() const {return extraAttackSpeed;}
void setPlayerExtraAttackSpeed(uint32_t speed);

 

Depois de:

 

uint32_t idleTime;

 

Coloque isto:

 

uint32_t extraAttackSpeed;

 

* luascript.cpp

 

Depois de:

 

//doPlayerAddSoul(cid, soul)
lua_register(m_luaState, "doPlayerAddSoul", LuaScriptInterface::luaDoPlayerAddSoul);

 

Coloque isto:

 

//doPlayerSetExtraAttackSpeed(cid, speed)
lua_register(m_luaState, "doPlayerSetExtraAttackSpeed", LuaScriptInterface::luaDoPlayerSetExtraAttackSpeed);

 

Depois de:

 

int32_t LuaScriptInterface::luaDoPlayerAddSoul(lua_State* L)
{
//doPlayerAddSoul(cid, soul)
int32_t soul = popNumber(L);

ScriptEnviroment* env = getScriptEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
{
	player->changeSoul(soul);
	lua_pushboolean(L, true);
}
else
{
	reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND));
	lua_pushboolean(L, false);
}
return 1;
}

 

Coloque isto:

 

int32_t LuaScriptInterface::luaDoPlayerSetExtraAttackSpeed(lua_State *L)
{	
uint32_t speed = popNumber(L);						
ScriptEnviroment* env = getEnv();
	   if(Player* player = env->getPlayerByUID(popNumber(L))){	
				player->setPlayerExtraAttackSpeed(speed);
				lua_pushnumber(L, true);
	   }	
	   else
	   {		  
	errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
			   lua_pushnumber(L, false);
	   }	  
return 1;
}[/b]
[b]

 

* luacript.h

 

Depois de:

 

	static int32_t luaDoPlayerAddSoul(lua_State* L);

 

Coloque isto:

 

	static int32_t luaDoPlayerSetExtraAttackSpeed(lua_State* L);

 

Como usar:

 

doPlayerSetExtraAttackSpeed(cid, 2000) <- irá atacar 2 segundos mais rápido

 

Para voltar ao normal use isto:

 

doPlayerSetExtraAttackSpeed(cid, 0)
Link para o comentário
Compartilhar em outros sites

  • 1 year later...

Até onde eu entendi vc cria uma funçao que da esse atributo :

 

ex : quando o ´player fazer 1 quest vc da 250ms de atk + rapido

 

 

doPlayerSetExtraAttackSpeed(cid, 250)

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...