Siga-nos em...
Follow us on Twitter Follow us on Facebook Watch us on YouTube
Registro

Alpha Servers
Resultados 1 a 6 de 6

Visão do Encadeamento

  1. #1

    Avatar de Maykon
    Data de Ingresso
    Apr 2014
    Localização
    Imperyus Games
    Idade
    30
    Posts
    124
    Agradecido
    302
    Agradeceu
    80
    Peso da Avaliação
    12

    Padrão Caça ao tesouro - Automático

    Treasure.cpp

    Código:
    #include "StdAfx.h"
    
    TREASURE_CUSTOM Treasure;
    
    char treasureMapName[][15]	 = {"Lorencia", "Devias", "Noria"};
    BYTE treasureMapNumber[]	 = {0,			 2,        3};
    
    BYTE Index = (BYTE)(rand() % sizeof(treasureMapNumber));
    
    bool TREASURE_CUSTOM::Load()
    {
    	ZeroMemory(this->_winner,sizeof(this->_winner));
    
    	this->_enabled		= GetPrivateProfileInt("Pirata Jack","Ativar",1,CFG_PIRATA) > 0 ? true : false;
    	this->_timeOpen		= GetPrivateProfileInt("Pirata Jack","TimeOpen",1,CFG_PIRATA) * 60;
    	this->_timeBuy		= GetPrivateProfileInt("Pirata Jack","TimeBuy",1,CFG_PIRATA);
    	this->_timeClose	= GetPrivateProfileInt("Pirata Jack","TimeClose",1,CFG_PIRATA) * 60;
    
    	this->_state		= treasureOff;
    	this->_timeCount	= this->_timeOpen;
    	this->_index		= -1;
    	this->_shopNumber	= 11;
    
    	return true;
    }
    
    void TREASURE_CUSTOM::Check()
    {
    	if(!this->_enabled)
    	{
    		return;
    	}
    
    	if(this->_timeCount > 0)
    	{
    		this->_timeCount--;
    		return;
    	}
    
    	if(this->_state == treasureOff)
    	{
    		ZeroMemory(this->_winner,sizeof(this->_winner));
    
    		this->_state	 = treasureOn;
    		this->_timeCount = this->_timeClose;
    
    		short X, Y;
    		BYTE Map   = treasureMapNumber[Index];
    
    		while(func.GetBoxPosition(Map,10,10,240,240,X,Y) == 0) {}
    
    		this->_index	 = gObjAddMonsters();
    
    		if(this->_index >= 0 && this->_index < OBJECT_MIN)
    		{			
    
    			OBJECTSTRUCT* lpNpc = &gObj[this->_index];
    
    			lpNpc->Class                    = 201;
    			lpNpc->MapNumber                = Map;
    			lpNpc->X                        = X;
    			lpNpc->Y                        = Y;
    			lpNpc->Dir						= (rand() % 7);
    			lpNpc->m_RecallMon				= this->_index;
    			lpNpc->TargetNumber				= -1;
    			lpNpc->TX						= lpNpc->X;
    			lpNpc->TY						= lpNpc->Y;
    			lpNpc->MTX						= lpNpc->X;
    			lpNpc->MTY						= lpNpc->Y;
    			lpNpc->m_OldX					= lpNpc->X;
    			lpNpc->m_OldY					= lpNpc->Y;
    			lpNpc->StartX					= (BYTE)(lpNpc->X);
    			lpNpc->StartY					= (BYTE)(lpNpc->Y);
    			lpNpc->m_ActState.Emotion		= 0;
    			lpNpc->m_ActState.Attack		= 0;
    			lpNpc->m_ActState.EmotionCount	= 0;        
    			lpNpc->PathCount				= 0;
    			lpNpc->m_MoveRange				= 0;
    			lpNpc->m_PosNum					= -1;
    
    		    Functions::gObjSetMonster(this->_index, 201);
    			gObjViewportListProtocolCreate(&gObj[this->_index]);
    
    			lpNpc->ShopNumber				= this->_shopNumber;
    
    			char Buffer[60];
    
    			sprintf_s(Buffer,"O pirata Jack escondeu seu tesouro em %s",treasureMapName[Index]);
    
    			for(int i = OBJECT_MIN; i != OBJECT_MAX; i++)
    			{
    				if(gObj[i].Connected == 3)
    				{
    					GCServerMsgStringSend(Buffer,i,0);
    					GCServerMsgStringSend("Procure-o e ganhe recompensas!",i,0);
    				}
    			}
    		}
    		else
    		{
    			this->_timeCount = this->_timeOpen;
    			this->_index	 = -1;
    			this->_state	 = treasureOff;
    		}
    	}
    	else if(this->_state == treasureOn)
    	{
    		this->_state	 = treasureOff;
    		this->_timeCount = this->_timeOpen;
    
    		if(this->_index != -1)
    		{
    			gObjDel(this->_index);
    		}
    
    		if(this->_winner[0] == 0)
    		{
    			for(int i = OBJECT_MIN; i != OBJECT_MAX; i++)
    			{
    				if(gObj[i].Connected == 3)
    				{
    					GCServerMsgStringSend("O tesouro do pirata Jack foi destruído por monstros",i,0);
    					GCServerMsgStringSend("Tente ajudá-lo novamente na próxima vez",i,0);
    				}
    			}
    		}
    		else
    		{
    			ZeroMemory(this->_winner,sizeof(this->_winner));
    		}
    
    		this->_index = -1;
    	}
    }
    
    void TREASURE_CUSTOM::Talk(OBJECTSTRUCT* Npc, OBJECTSTRUCT* Player)
    {
    	if(!this->_enabled)
    	{
    		ChatTargetSend(Npc,"Como eu parei aqui? Vixi! Acho que estou perdido",Player->m_Index);
    		return;
    	}
    
    	if(this->_state == treasureOn)
    	{
    		if(this->_winner[0] == 0)
    		{
    			this->_timeCount = this->_timeBuy;
    
    			strcpy_s(this->_winner,Player->Name);
    
    			ChatTargetSend(Npc,"Obrigado por vir! O tesouro é todo seu!",Player->m_Index);
    
    			char Buffer[2][60];
    
    			sprintf_s(Buffer[0],"O tesouro foi encontrado por %s",Player->Name);
    			sprintf_s(Buffer[1],"Localização: %s %02d/%02d",treasureMapName[Index],Npc->X,Npc->Y);
    
    			for(int i = OBJECT_MIN; i != OBJECT_MAX; i++)
    			{
    				if(gObj[i].Connected == 3)
    				{
    					GCServerMsgStringSend(Buffer[0], i, 0);
    					GCServerMsgStringSend(Buffer[1], i, 0);
    				}
    			}
    		}
    		else
    		{
    			if(_stricmp(this->_winner,Player->Name))
    			{
    				ChatTargetSend(Npc,"Parece que você chegou meio tarde, não é?!",Player->m_Index);
    			}
    		}
    	}
    	else
    	{
    		ChatTargetSend(Npc,"Não tem doce no meu baú para você",Player->m_Index);
    	}
    }
    
    BYTE TREASURE_CUSTOM::ShopNumber() const
    {
    	return this->_shopNumber;
    }
    
    const char* TREASURE_CUSTOM::Winner() const
    {
    	return this->_winner;
    }
    Treasure.h

    Código:
    #pragma once
    
    enum TreasureState { treasureOff, treasureOn };
    
    class TREASURE_CUSTOM
    {
    public:
    	bool Load();
    	void Check();
    	void Talk(OBJECTSTRUCT* Npc, OBJECTSTRUCT* Player);
    	BYTE ShopNumber() const;
    	const char* Winner() const;
    
    private:
    	bool	_enabled;
    	BYTE	_state;
    	DWORD	_timeCount;
    	DWORD	_timeBuy;
    	DWORD	_timeOpen;
    	DWORD	_timeClose;
    	int		_index;
    	BYTE	_shopNumber;
    	char	_winner[11];
    };
    
    extern TREASURE_CUSTOM Treasure;
    Créditos: Getulio

  2. Os Seguintes 4 Usuários Agradeceram você Maykon Por este Post Útil:


 

 

Informações de Tópico

Usuários Navegando neste Tópico

Há 1 usuários navegando neste tópico. (0 registrados e 1 visitantes)

Tópicos Similares

  1. |Suporte| Script retorno automático.
    Por pedrobuck no fórum Dúvidas|Pedidos
    Respostas: 0
    Último Post: 23-11-2014, 09:18 PM
  2. |Download| Exclusivo[ Divulgador Automático]
    Por Alafynhow no fórum Downloads
    Respostas: 6
    Último Post: 28-10-2014, 10:12 AM
  3. |Pedido| Shop Automático.
    Por MuVery no fórum Arquivos MuOnline
    Respostas: 9
    Último Post: 20-11-2012, 06:06 PM
  4. |Download| Episodio 33 - Em Busca do Tesouro Secreto
    Por duelhard no fórum Samurai Warriors
    Respostas: 0
    Último Post: 01-11-2009, 10:02 PM

Marcadores

Permissões de Postagem

  • Você não pode iniciar novos tópicos
  • Você não pode enviar respostas
  • Você não pode enviar anexos
  • Você não pode editar suas mensagens
  •