Jump to content
metin2dev
Metin2International
ѕeмa™

[RELEASE] Coins in InventoryWindow.

Recommended Posts

On 11.7.2014 at 17:55, Ken said:

C+ Form

 

Add this function in input_login.cpp


static void _send_coins(LPCHARACTER ch)
{
	if (ch)
	{
		SQLMsg * pMsg = DBManager::instance().DirectQuery("select coins from account%s WHERE id = %u", get_table_postfix(), ch->GetAID());
		if (pMsg->Get()->uiNumRows > 0)
		{
			MYSQL_ROW  row = mysql_fetch_row(pMsg->Get()->pSQLResult);
			ch->ChatPacket(CHAT_TYPE_COMMAND, "BINARY_Update_Coins %s", row[0]);
			delete pMsg;
		}
	}
}

And search ; 


_send_bonus_info(ch);

Add this under that


_send_coins(ch);

Part of Python ; 

 

Add this command under "mall"


			"mall"			: self.__InGameShop_Show,
			"BINARY_Update_Coins"	: self.Binary_Update_Coins

like this

 

Add this function in game.py


def Binary_Update_Coins(self,coins):
	self.wndMds.SetText(str(coins))

€dit : why is not work these commands?

 

Open char_change_empire.cpp file and find this


DWORD CHARACTER::GetAID() const
{
	char szQuery[1024+1];
	DWORD dwAID = 0;

	snprintf(szQuery, sizeof(szQuery), "SELECT id FROM player_index%s WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u AND empire=%u", 
			get_table_postfix(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());

	SQLMsg* pMsg = DBManager::instance().DirectQuery(szQuery);

	if (pMsg != NULL)
	{
		if (pMsg->Get()->uiNumRows == 0)
		{
			M2_DELETE(pMsg);
			return 0;
		}

		MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);

		str_to_number(dwAID, row[0]);

		M2_DELETE(pMsg);

		return dwAID;
	}
	else
	{
		return 0;
	}
}

change via this


DWORD CHARACTER::GetAID() const
{
	const TAccountTable pAccountTable = GetDesc()->GetAccountTable();
	if (pAccountTable.id)
		return pAccountTable.id;
} 

Meanwhile add this on top.


#include "desc.h"

Best Regards 

Zerelth ~ Ellie

dont work :/

 

missing inventory part :/

Share this post


Link to post
Share on other sites

Hi,
ALL READ !!!!
Problem [DC or MDS not appear only showing 0]
Connect mysql ---> player.quest ---> CTRL + F source u name ..
Example:
dwPID  szName           szState    IValue
0         [007]Dawis      MDS        0

Delete record
in game
/reload Q
now try ...
again bugged (Not showing true value)
IValue  manually replace to 1
Sorry my english is bad
Best Regards,
 

Share this post


Link to post
Share on other sites
On 2/23/2014 at 18:08, ѕeмa™ said:

I go to release a simple system , to see the coins in the inventory.

 

http://youtu.be/93aufcRE_4s


REMEMBER:
localeInfo is from binary r28k
locale is from binary r36k

First, go to uiinventory.py and now search:


self.wndMoneySlot = self.GetChild("Money_Slot")

And down put:


			self.wndMds = self.GetChild("Mds")
			self.wndMdsSlot = self.GetChild("Mds_Slot")

Now, search 


	def Destroy(self):
		self.ClearDictionary()
		....
		....
		self.wndMoney = 0
		self.wndMoneySlot = 0

And down put:


		self.wndMds = 0
		self.wndMdsSlot = 0

Now, Search:


def RefreshStatus(self):

And change to:


	def RefreshStatus(self):
		money = player.GetElk()
		self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
		
		import constInfo
		self.wndMds.SetText(str(constInfo.mds) + " Md's")

And down Put:


	def OnUpdate(self):
		import constInfo
		self.wndMds.SetText(str(constInfo.mds) + " Md's")

The uiinventory is finished, save and close, now go to locale/xx/ui/inventorywindow.py.

 

Search:


## Print
				{
					"name":"Money_Slot",
					"type":"button",

					"x":-68,
					"y":28,

					"horizontal_align":"center",
					"vertical_align":"bottom",

					"default_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",
					"over_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",
					"down_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",

					"children" :
					(
						{
							"name":"Money_Icon",
							"type":"image",

							"x":-21,
							"y":2,

							"image":"d:/ymir work/ui/game/windows/money_icon.sub",
						},

						{
							"name" : "Money",
							"type" : "text",

							"x" : 5,
							"y" : 3,

							"horizontal_align" : "right",
							"text_horizontal_align" : "right",

							"text" : "123456789",
						},
					),
				},

And Down Put:


				{
					"name":"Mds_Slot",
					"type":"button",

					"x":-68,
					"y":48,

					"horizontal_align":"center",
					"vertical_align":"bottom",

					"default_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",
					"over_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",
					"down_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",

					"children" :
					(
						{
							"name":"Mds_Icon",
							"type":"image",

							"x":-21,
							"y":2,

							"image":"d:/ymir work/ui/game/windows/money_icon.sub",
						},

						{
							"name" : "Mds",
							"type" : "text",

							"x" : 5,
							"y" : 3,

							"horizontal_align" : "right",
							"text_horizontal_align" : "right",

							"text" : "123456789 Md's",
						},
					),
				},

Remember change the "x" and "y".

 

Now, go to game.py in root.

 

Search:


	def __ServerCommand_Build(self):
		serverCommandList={

And down put:


			#Carga Mds Start
			"Mds"					: self.__Mds,
			#Carga Mds End

and now, go to the end and put:


	def __Mds(self, coins):
		import constInfo
		constInfo.mds = int(coins)

Save and close.

 

Now go to constinfo.py and put


mds = 0

And Here the quest:


quest mds begin
	state start begin
		when login begin
			loop_timer("carga_mds", 10)
		end
	
		when carga_mds.timer begin
			local coins = mysql_query("SELECT coins from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1]
			cmdchat("Mds "..coins)
		end
	end
end

This is my release in this forum.

 

Sorry my bad english.. I'm Spanish.

 

If you don't know how put, upload my archives uiinventory and inventorywindow.py

 

https://mega.co.nz/#!R9A3SD6Q!IFZ38BXrwGOt0Z8N3qT9g5vr5XAa4DdKdeAf2KRlPEY

 

 

Do you know how can I do to get 1 coin for every metin beaten, and then use this coins in a special shop?

Share this post


Link to post
Share on other sites

does someone know how to get 1 coin for every metin beaten , and then use coins in a special shop ?

Share this post


Link to post
Share on other sites
On 8 martie 2017 at 14:36, Nero said:

does someone know how to get 1 coin for every metin beaten , and then use coins in a special shop ?

UP :P 

Share this post


Link to post
Share on other sites
quest metin2_coins begin 
    state start begin 
        when kill 8003.kill() begin
            local kill_up = mysql_query("UPDATE account.account SET coins = coins+1 WHERE id ='"..pc.get_account_id().."' LIMIT 1")
        end
	end
end

This should solve ur problem. Try this. Not tested but should work.

Share this post


Link to post
Share on other sites
On 23 martie 2017 at 10:55, inferno1966 said:

quest metin2_coins begin 
    state start begin 
        when kill 8003.kill() begin
            local kill_up = mysql_query("UPDATE account.account SET coins = coins+1 WHERE id ='"..pc.get_account_id().."' LIMIT 1")
        end
	end
end

This should solve ur problem. Try this. Not tested but should work.

Thank you! :) I'll try it tomorrow, but with the special shop how can I do? I want a normal shop (like the general shop) but that use points instead of yang.

Share this post


Link to post
Share on other sites

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×