Jump to content

DR Vouchers - change cash to coins [HELP]


Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 6 months later...
On 10/7/2023 at 11:36 PM, Lycawn said:

Hello i have a weird bug - with vouchers

local amount = item . get_value ( 0 ) 
charge_cash_by_voucher . charge ( amount , "cash" ) 


no matter how many times i change cash to coins it  returns to Cash every time i reload

bump, same problem here
quest
 

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' : "cash"(default) | "mileage"
				-- 	 	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



Edit, nevermind.
in db/src/ClientManager.cpp
search for this function 
 

void CClientManager::ChargeCash(const TRequestChargeCash* packet)

and change in this function
 

		sprintf(szQuery, "update account set `cash` = `cash` + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);

with
 

sprintf(szQuery, "update account set `coins` = `coins` + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);

 

Edited by OkamiRo
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.