Jump to content

Dúvida. Os Coins não atualizam


Lyn2
 Share

Recommended Posts

Boas noites. Ando a rasca a uns dias a tentar fixar isto. 

Implementei as MDS no inventário IN-Game. funciona perfeitamente até posso meter Item-Shop in-game. Mas, os Vouchers são o problema. 

Ao carregar no voucher se for "cash" ele funciona direito e atualiza logo, mas se for Coins ele não atualiza, nem muito menos dá as MDs é como se 100 Mds fossem pro alem pq nada acontece...

Tenho 3 Versões dela (Quest)

1: 

Spoiler

quest charge_cash_by_voucher begin
	state start begin
		function charge(amount, charge_type)
			if charge_type == nil then 
				charge_type = "coins"
			end

			if 0 < amount then
				-- syntax : pc.charge_cash(amount, charge_type)
				-- warning: 	1. 'charge_type' : "coins"(default) | "kim_banlamis"
				-- 	   	2. 'amount' must be positive number.
				local result = pc.charge_cash(amount, charge_type)

				if true == result then
					local item_id = item.get_id()
					char_log(item_id, "CHARGE_CASH_BY_VOUCHER", amount)
					syschat(string.format(gameforge.charge_cash_by_voucher._010_syschat, amount))

					local flag_name = "total_" .. charge_type
					pc.setqf(flag_name, pc.getqf(flag_name) + amount)

					item.remove()
				end
			end

			return false
		end
	
		when 80014.use or 80015.use or 80016.use or 80017.use begin
			local amount = item.get_value(0)

			charge_cash_by_voucher.charge(amount, "coins")
		end
	end
end

 

 

2: 

Spoiler

quest charge_cash_by_voucher begin
	state start begin
		function charge(amount, charge_type)
			if charge_type == nil then 
				charge_type = "coins"
			end

			if 0 < amount then
				-- syntax : pc.charge_cash(amount, charge_type)
				-- warning: 	1. 'charge_type' : "coins"(default) | "kim_banlamis"
				-- 	   	2. 'amount' must be positive number.
				local result = pc.charge_cash(amount, charge_type)

				if true == result then
					local item_id = item.get_id()
					char_log(item_id, "CHARGE_CASH_BY_VOUCHER", amount)
					syschat(string.format(gameforge.charge_cash_by_voucher._010_syschat, amount))

					local flag_name = "total_" .. charge_type
					pc.setqf(flag_name, pc.getqf(flag_name) + amount)

					item.remove()
				end
			end

			return false
		end
	
		when 80014.use or 80015.use or 80016.use or 80017.use begin
			local amount = item.get_value(0)

			charge_cash_by_voucher.charge(amount, "coins")
		end
	end
end

 

 

 

 

3: 

Spoiler

quest voucher_teste begin
	state start begin
		function give_bonus_coins(account, count)
			mysql_query("UPDATE account.account SET coins=coins+'"..count.."' WHERE id='"..account.."'")
			syschat("Recebes-te:  "..count.." Moedas Dragão.")
		end
		when 80014.use or 80015.use or 80016.use or 80017.use begin
			local tableByVnum = 
			{
				[80014] = 100,
				[80015] = 500,
				[80016] = 1000,
				[80017] = 50,
			}
			if pc.count_item(item.get_vnum()) < 1 then
				say_title("Voucher")
				say("")
				say_reward("Já tens as Mds bla bla.")
				return
			end
			ep_kupon.give_bonus_coins(pc.get_account_id(), tableByVnum[item.get_vnum()])
			pc.remove_item(item.get_vnum(), 1)
		end
	end
end

 

Não sei mesmo, tentei até remover o "coins" e implementar de novo mas não atualiza está sempre no -> 0 <-..

O site onde tirei: 

https://metin2dev.org/board/index.php?/topic/267-release-coins-in-inventorywindow/&

 

Obrigado a todos se tentarem ajudar!! 

Edited by JuctionM2
Link to comment
Share on other sites

Vá em db/src/ClientManager.cpp e pesquise por:

void CClientManager::ChargeCash(const TRequestChargeCash* packet)

Depois altere por:

void CClientManager::ChargeCash(const TRequestChargeCash* packet)
{
    char szQuery[512];
	    if (ERequestCharge_Cash == packet->eChargeType)
        // cash to coins
        sprintf(szQuery, "update account set `coins` = `coins` + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);
    else if(ERequestCharge_Mileage == packet->eChargeType)
        sprintf(szQuery, "update account set `mileage` = `mileage` + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);
    else
    {
        sys_err ("Invalid request charge type (type : %d, amount : %d, aid : %d)", packet->eChargeType, packet->dwAmount, packet->dwAID);
        return;
    }
	    sys_err ("Request Charge (type : %d, amount : %d, aid : %d)", packet->eChargeType, packet->dwAmount, packet->dwAID);
	    CDBManager::Instance().AsyncQuery(szQuery, SQL_ACCOUNT);
}

Link to comment
Share on other sites

35 minutos atrás, JuctionM2 disse:

Tentei de diversas maneiras mas não deu, da me erro no ClienteManeger.o . Tive cuidado com as tabs e espaços mas dá erro e antes de tentar testei a ver se compilava direito e não houve qualquer erro... Mas quando meti esse codigo deu erro.. 

Estranho aqui não ocorre nenhum erro.

Build VC141/BSD11:

build_OK.jpg?1527376272

buildbsd_OK.jpg?1527376501

 

Link to comment
Share on other sites

Oh lol, sou tão burro. É source de cliente certo? OMG xD É que eu por acaso tou a ter um problema de source por causa do Packet.h linha 1118 . 

 

Mas o problema é mesmo no mysql os coins não vão, não muda o valor. Ele no cliente se meter manual por mysql account ele muda e acusa no cliente, mas ao fazer pelo item não dá.  Ele não atualiza fica sempre no 0... Penso que seja mesmo pelo Source do server.. 

Link to comment
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
 Share

×
×
  • Create New...