Jump to content

Sistema Negociar A Distancia+Poly+Slidebar [C++ Python Lua]


Dynamic Things

Recommended Posts

Olá TMoore Tutorials.

Sejam bem-Vindos a este tutorial.

Objectivo deste tutorial:

2015-08-27_18-53-29.jpg

Este tutorial vai se dividir em 2 partes, e as suas partes são Serverside e Clientside.

Ficheiros a Editar

exchange.cpp

game.py

uiexchange.py

constInfo.py

locale_list

Game [c++]

Abrir exchange.cpp procurar por:

       if (iDist >= EXCHANGE_MAX_DISTANCE)
	return false;

Agora vamos alterar para o seguinte:

       //if (iDist >= EXCHANGE_MAX_DISTANCE)
	//return false;

Agora procuramos pelo seguinte:

       GetExchange()->SetCompany(victim->GetExchange());

e adicionamos a baixo o seguinte:

       SetPolymorph(30000, true);
victim->SetPolymorph(30000, true);
SetPKMode(PK_MODE_PROTECT);
victim->SetPKMode(PK_MODE_PROTECT);

Ficará assim

victim->GetExchange()->SetCompany(GetExchange());
GetExchange()->SetCompany(victim->GetExchange());
SetPolymorph(30000, true);
victim->SetPolymorph(30000, true);
SetPKMode(PK_MODE_PROTECT);
victim->SetPKMode(PK_MODE_PROTECT);

Agora procuramos por:

       if (GetCompany()->m_lGold)
           victim->Save();

e adicionamos em baixo:

GetOwner()->SetPolymorph(GetOwner()->GetJob(), true);
victim->SetPolymorph(victim->GetJob(), true);

Ficará assim:

		if (GetCompany()->Done())
		{
			if (GetCompany()->m_lGold) // 돈이 있을 때만 저장
				victim->Save();
				GetOwner()->SetPolymorph(GetOwner()->GetJob(), true);
				victim->SetPolymorph(victim->GetJob(), true);

Agora procuramos por

       void CExchange::Cancel()

e adicionamos a baixo o seguinte:

       GetOwner()->SetPolymorph(GetOwner()->GetJob(), true);

Irá fica assim:

void CExchange::Cancel()
{
exchange_packet(GetOwner(), EXCHANGE_SUBHEADER_GC_END, 0, 0, NPOS, 0);
GetOwner()->SetExchange(NULL);
GetOwner()->SetPolymorph(GetOwner()->GetJob(), true);

Após isso vamos procurar por

if (empty_pos < 0)
	{
		sys_err("Exchange::Done : Cannot find blank position in inventory %s <-> %s item %s", 
				m_pOwner->GetName(), victim->GetName(), item->GetName());
		continue;
	}

E adicionamos a baixo, o seguinte:

m_pOwner->SetPolymorph(m_pOwner->GetJob(), true);

irá ficar assim:

if (empty_pos < 0)
	{
		sys_err("Exchange::Done : Cannot find blank position in inventory %s <-> %s item %s", 
				m_pOwner->GetName(), victim->GetName(), item->GetName());
		continue;
	}

	m_pOwner->SetPolymorph(m_pOwner->GetJob(), true);

Feito isso ja podem compilar o game.

Agora vamos começar a parte python.

Vamos abrir game.py

No inicio do ficheiro vamos adicionar o seguinte:

import uisidebar

Agora vamos procurar por :

class GameWindow(ui.ScriptWindow):

Abaixo de:

player.SetGameWindow(self)

Adicionamos o seguinte:

	self.sideBar = uisidebar.SideBar()
	self.sideBar.Show()
	self.sideBar.AddButton("Troca a Distancia", self.__DeschidereFereastra)

Agora adicionamos ao root o ficheiro uisidebar.py que contém no download.

Agora procuramos por:

def __ServerCommand_Build(self):
	serverCommandList={

e Adicionamos a baixo:

		"sistem_negot_map"			: self.__sistem_negot_map,
		"sistem_negot_verificare_nume"			: self.__Sistem_negot_verificare_nume,
		"sistem_negot_deschidere_fereastra"			: self.__sistem_negot_deschidere_fereastra,

Ficará assim:

def __ServerCommand_Build(self):
	serverCommandList={

		"sistem_negot_map"			: self.__sistem_negot_map,
		"sistem_negot_verificare_nume"			: self.__Sistem_negot_verificare_nume,
		"sistem_negot_deschidere_fereastra"			: self.__sistem_negot_deschidere_fereastra,

Agora no final do ficheiro game.py adicionamos o seguinte:

def __Sistem_negot_verificare_nume(self):
	net.SendQuestInputStringPacket(str(constInfo.NegotFereastraNume))

def __sistem_negot_map(self, questindex):
	constInfo.sistem_negot_map = questindex

def __sistem_negot_deschidere_fereastra(self, vid):
	player_vid = int(vid)
	net.SendExchangeStartPacket(player_vid)

def __DeschidereFereastra(self):
	self.Fereastra_Negot_Map_Fereastra2 = ui.BoardWithTitleBar()
	self.Fereastra_Negot_Map_Fereastra2.SetSize(210, 115)
	self.Fereastra_Negot_Map_Fereastra2.SetCenterPosition()
	self.Fereastra_Negot_Map_Fereastra2.AddFlag('float')
	self.Fereastra_Negot_Map_Fereastra2.AddFlag('movable')
	self.Fereastra_Negot_Map_Fereastra2.SetTitleName("Sistema de troca")
	self.Fereastra_Negot_Map_Fereastra2.Show()

	self.Fereastra_Negot_Map_Text = ui.TextLine()
	self.Fereastra_Negot_Map_Text.SetParent(self.Fereastra_Negot_Map_Fereastra2)
	self.Fereastra_Negot_Map_Text.SetText("Procure o jogador que pretende negociar.")
	self.Fereastra_Negot_Map_Text.SetPosition(7,27)
	self.Fereastra_Negot_Map_Text.SetFontColor(1.0, 1.0, 1.0)
	self.Fereastra_Negot_Map_Text.Show()

	self.Fereastra_Negot_Map_Value1 = ui.SlotBar()
	self.Fereastra_Negot_Map_Value1.SetParent(self.Fereastra_Negot_Map_Fereastra2)
	self.Fereastra_Negot_Map_Value1.SetSize(120, 18)
	self.Fereastra_Negot_Map_Value1.SetPosition(50, 50)
	self.Fereastra_Negot_Map_Value1.Show()

	self.Fereastra_Negot_Map_Value = ui.EditLine()
	self.Fereastra_Negot_Map_Value.SetParent(self.Fereastra_Negot_Map_Value1)
	self.Fereastra_Negot_Map_Value.SetSize(120, 18)
	self.Fereastra_Negot_Map_Value.SetPosition(4, 1)
	self.Fereastra_Negot_Map_Value.SetMultiLine()
	self.Fereastra_Negot_Map_Value.SetMax(12)
	self.Fereastra_Negot_Map_Value.SetText("")
	self.Fereastra_Negot_Map_Value.SetFocus()
	self.Fereastra_Negot_Map_Value.Show()

	self.Fereastra_Negot_Map_Test1 = ui.Button()
	self.Fereastra_Negot_Map_Test1.SetEvent(self.__OpenFereastra_Negot_Map_Fereastra2)
	self.Fereastra_Negot_Map_Test1.SetParent(self.Fereastra_Negot_Map_Fereastra2)
	self.Fereastra_Negot_Map_Test1.SetPosition(10, 75)
	self.Fereastra_Negot_Map_Test1.SetUpVisual("d:/ymir work/ui/public/XLarge_Button_01.sub")
	self.Fereastra_Negot_Map_Test1.SetOverVisual("d:/ymir work/ui/public/XLarge_button_02.sub")
	self.Fereastra_Negot_Map_Test1.SetDownVisual("d:/ymir work/ui/public/XLarge_button_03.sub")
	self.Fereastra_Negot_Map_Test1.SetText("Iniciar a procura")
	self.Fereastra_Negot_Map_Test1.Show()

def __OpenFereastra_Negot_Map_Fereastra2(self):
	import event
	ExName = self.Fereastra_Negot_Map_Value.GetText()

	if self.__ProtectieNegot():
		chat.AppendChat(1, "[sERVER] Nu poti negocia cu un jucator in aceasta harta!") #import chat la inceputul modulului
		return    
	if len(ExName) >= 4:
		self.Fereastra_Negot_Map_Fereastra2.Hide() 
		constInfo.NegotFereastraNume = ExName
		event.QuestButtonClick(int(constInfo.sistem_negot_map))
	else: 
		self.Fereastra_Negot_Map_Text.SetText("Numele trebuie sa fie de peste 3 caractere!")
		self.Fereastra_Negot_Map_Text.SetFontColor(1.0, 0.0, 0.0) 

def __ProtectieNegot(self):
	protectie_mape = [
		"season1/metin2_map_oxevent",
		"mape_dungeon/metin2_map_skipia_dungeon_boss",
		"mape_dungeon/metin2_map_skipia_dungeon_boss2",
		"mape_dungeon/metin2_map_devilsCatacomb",
		"mape_dungeon/metin2_map_deviltower1",
		"mape_vegas/metin2_map_wedding_01",
		"mape_dungeon/metin2_map_spiderdungeon_02",
		"mape_beta/Metin2_map_CapeDragonHead",
		"mape_beta/metin2_map_Mt_Thunder",
		"mape_beta/metin2_map_dawnmistwood",
		"mape_beta/metin2_map_BayBlackSand",
		"mape_noi/farmmap1",
		"mape_dungeon/metin2_map_spiderdungeon_03",   
		"mape_vegas/metin2_map_duel",
		"mape_dungeon/metin2_map_n_flame_dungeon_01",
		"mape_dungeon/metin2_map_n_snow_dungeon_01"
	]
	if str(background.GetCurrentMapName()) in protectie_mape: 
		return TRUE
	return FALSE

Ainda no game procurar por novamente por:

def __ServerCommand_Build(self):
	serverCommandList={

e adicionar o seguinte:

		"getinputbegin"			: self.__Input_Get_Vegas_1,
		"getinputend"			: self.__Input_Get_Vegas_2,
		"getinput"				: self.__Input_Get_Vegas_3,

Agora nas ultimas linhas adicionamos o seguinte:

def __Input_Get_Vegas_1(self):
	constInfo.INPUT_IGNORE = 1

def __Input_Get_Vegas_2(self):
	constInfo.INPUT_IGNORE = 0

def __Input_Get_Vegas_3(self):
	net.SendQuestInputStringPacket("1")

Agora procuramos por :

def OpenQuestWindow(self, skin, idx):

e alteramos para o seguinte:

def OpenQuestWindow(self, skin, idx):
	if constInfo.INPUT_IGNORE == 1:
		return
	else:
		self.interface.OpenQuestWindow(skin, idx)

Agora guardamos e fechamos o game.py (atenção as tabs)

Agora abrimos o uiexchange.py

e procuramos por:

def OpenDialog(self):

Agora trocam a função toda pelo seguinte:

def OpenDialog(self):
	self.TitleName.SetText(localeInfo.EXCHANGE_TITLE % (exchange.GetNameFromTarget()))
	if exchange.GetNameFromTarget() == "":
		import constInfo
		self.TitleName.SetText(localeInfo.EXCHANGE_TITLE % (str(constInfo.NegotFereastraNume)))
	self.AcceptButton.Enable()
	self.AcceptButton.SetUp()
	self.Show()

	(self.xStart, self.yStart, z) = player.GetMainCharacterPosition()

Agora guardamos o uiexchange.py e fechamos.

Agora abrimos constInfo.py e adicionamos o seguinte:

NegotFereastraVid = 0
NegotFereastraNume = "un jucator"
sistem_negot_map = 0
INPUT_IGNORE = 0

Agora fechamos e guardamos o constInfo.py e abrimos locale_list e nas ultimas linhas escrevemos o seguinte:

sistem_negot.quest

Feito adicionamos o ficheiro sistem_negot.quest que contém no download, feito isso vamos nossa maquina e digitamos o seguinte:

cd /usr/home/game/share/locale/mexico/quest && sh make.sh

Onde diz mexico será o nome da pasta do vosso locale.

Agora ligam o servidor e o vosso resultado será este:

2015-08-27_20-16-09.png

2015-08-27_20-20-48.png

2015-08-27_18-53-29.jpg

Download:

Mega

Password do download:

TMooreTutorials

Informações adicionais.

MD5 6380296e3a5cad1b501d73131d7634bd

SHA1 c0775dad132643112922e6c895ff315d387d8e92

SHA256 1fb493240f1453db4ef1ac346cabf1ba6fb6345f1f9b0a1bbfe9c17f0e9e6a0d

Informação completa:

Link

Créditos: Dynamic Things, VegaS & Rafa23, Yiv,

Rideas

Cumprimentos Dynamic Things

Link to comment
  • 2 months later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...