Jump to content
  • 0
rituel

#cashpoints on Herc Fluxcp ?

Question

Hello to all. 
 
Is it possible to use #CASHPOINTS during a donation on FluxCP ?
It exist a paying patch on rathena but not functional for hercules.   :(
 
I have not found anything about Hercules.
 
Cordialy.
Edited by rituel

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

An alternative is to just insert an item and sell that in the cash shop that can either be consumed or turned in to an NPC for Cash Points. Alternatively, and with a bit of adjusting of the default rewards NPC code, it would be possible to make it not give a physical item to the player when redeeming if the ID of the reward(s) match the ID of a specific item sold on the panel and just adjust cash points accordingly. Just an idea. :)

Share this post


Link to post
Share on other sites
  • 0
Hello to you. 
Today I'm stuck on this part:
 
	public function hasCreditsRecord($accountID)	{		$creditsTable = Flux::config('FluxTables.CreditsTable');				$sql = "SELECT COUNT(account_id) AS hasRecord FROM {$this->charMapDatabase}.`acc_reg_num_db` where `account_id` = ? and `key` = '#CASHPOINTS'";		$sth = $this->connection->getStatement($sql);				$sth->execute(array($accountID));				if ($sth->fetch()->hasRecord) {			return true;		}		else {			return false;		}	}		/**	 *	 */	    public function depositCredits($targetAccountID, $credits, $donationAmount = null)	{		$sql = "SELECT COUNT(account_id) AS accountExists FROM {$this->loginDatabase}.login WHERE account_id = ?";		$sth = $this->connection->getStatement($sql);				if (!$sth->execute(array($targetAccountID)) || !$sth->fetch()->accountExists) {			return false; // Account doesn't exist.		}				$creditsTable = Flux::config('FluxTables.CreditsTable');				if (!$this->hasCreditsRecord($targetAccountID)) {			$fields = 'account_id, balance';			$values = '?, ?';						/*if (!is_null($donationAmount)) {				$fields .= ', last_donation_date, last_donation_amount';				$values .= ', NOW(), ?';			}*/						$sql  = "INSERT INTO {$this->loginDatabase}.$creditsTable ($fields) VALUES ($values)";			$sth  = $this->connection->getStatement($sql);			$vals = array($targetAccountID, $credits);						/*if (!is_null($donationAmount)) {				$vals[] = $donationAmount;			}*/						return $sth->execute($vals);		}				else {			$vals = array();			$sql  = "UPDATE {$this->loginDatabase}.$creditsTable SET balance = balance + ? ";			/*if (!is_null($donationAmount)) {				$sql .= ", last_donation_date = NOW(), last_donation_amount = ? ";			}*/						$vals[] = $credits;			/*if (!is_null($donationAmount)) {				$vals[] = $donationAmount;			}*/			$vals[] = $targetAccountID;						$sql .= "WHERE account_id = ?";			$sth  = $this->connection->getStatement($sql);						return $sth->execute($vals);		}	}

 

This part, update or insert the crédtis in "cp_credits" table.
So to be on, I modified like this to write (insert into) fix values and see if it was well written.

 

			$sql  = "INSERT INTO {$this->loginDatabase}.$creditsTable ($fields) VALUES ($values)";			$sth  = $this->connection->getStatement($sql);			$vals = array(999, 999);

Result after credits transfert on the website:

 

1404818920-sans-titre.png

 

 

 

Now I change that (INSERT INTO & UPDATE) works (normally) in "acc_reg_num_db" table with the variable (# CASHPOINTS) 

 

	public function hasCreditsRecord($accountID)	{		$creditsTable = Flux::config('FluxTables.CreditsTable');				$sql = "SELECT COUNT(account_id) AS hasRecord FROM {$this->charMapDatabase}.`acc_reg_num_db` where `account_id` = ? and `key` = '#CASHPOINTS'";		$sth = $this->connection->getStatement($sql);				$sth->execute(array($accountID));				if ($sth->fetch()->hasRecord) {			return true;		}		else {			return false;		}	}		/**	 *	 */	public function depositCredits($targetAccountID, $credits, $donationAmount = null)	{		$sql = "SELECT COUNT(account_id) AS accountExists FROM {$this->loginDatabase}.login WHERE account_id = ?";		$sth = $this->connection->getStatement($sql);				if (!$sth->execute(array($targetAccountID)) || !$sth->fetch()->accountExists) {			return false; // Account doesn't exist.		}				$creditsTable = Flux::config('FluxTables.CreditsTable');				if (!$this->hasCreditsRecord($targetAccountID)) {			$fields = 'account_id, key, index, value';			$values = '?, ?, ?, ?';						/*if (!is_null($donationAmount)) {				$fields .= ', last_donation_date, last_donation_amount';				$values .= ', NOW(), ?';			}*/						$sql  = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values)";			$sth  = $this->connection->getStatement($sql);			$vals = array($targetAccountID, '#CASHPOINTS', 0, $credits);						/*if (!is_null($donationAmount)) {				$vals[] = $donationAmount;			}*/						return $sth->execute($vals);		}		else {			$vals = array();			$sql  = "UPDATE {$this->charMapDatabase}.`acc_reg_num_db` SET value = value + ? ";			/*if (!is_null($donationAmount)) {				$sql .= ", last_donation_date = NOW(), last_donation_amount = ? ";			}*/						$vals[] = $credits;			/*if (!is_null($donationAmount)) {				$vals[] = $donationAmount;			}*/			$vals[] = $targetAccountID;						$sql .= "WHERE account_id = ? and `key` = '#CASHPOINTS'";			$sth  = $this->connection->getStatement($sql);						return $sth->execute($vals);		}	}

 

Voila. Now try a tranferst on a player already possessing #CASHPOINTS in "acc_reg_num_db" table [uPDATE].

 

1404820062-sans-titre.png

 

1404820213-sans-titre.png

 

Result ?

 

1404820306-sans-titre.png

 

Finally, try transferring to a player who has not yet #CASHPOINTS in "acc_reg_num_db" table [iNSER INTO].

We will call "Fiotass" that exists in the table "char" and his account in "login" under the accound_id "2000008"

 

1404820933-sans-titre.png

 

Result ?

 

1404820998-sans-titre.png

 

 

 

I've been here yesterday but I did not find my error. 

Edited by rituel

Share this post


Link to post
Share on other sites
  • 0

tried something like?

public function depositCredits($targetAccountID, $credits, $donationAmount = null)	{		$sql = "SELECT COUNT(account_id) AS accountExists FROM {$this->loginDatabase}.login WHERE account_id = ?";		$sth = $this->connection->getStatement($sql);				if (!$sth->execute(array($targetAccountID)) || !$sth->fetch()->accountExists) {			return false; // Account doesn't exist.		}				$creditsTable = Flux::config('FluxTables.CreditsTable');				$fields = 'account_id, key, index, value';		$values = '?, ?, ?, ?';				/*if (!is_null($donationAmount)) {			$fields .= ', last_donation_date, last_donation_amount';			$values .= ', NOW(), ?';		}*/				$sql  = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values) ON DUPLICATE KEY UPDATE `value`=`value`+?";		$sth  = $this->connection->getStatement($sql);		$vals = array($targetAccountID, '#CASHPOINTS', 0, $credits, $credits);				/*if (!is_null($donationAmount)) {			$vals[] = $donationAmount;		}*/				return $sth->execute($vals);	}

Share this post


Link to post
Share on other sites
  • 0

Hi

/fluxcp/lib/Flux/LoginServer.php

 

Unexpected error occurred.

 

Again and again  :ph34r:

 

Work: (UPDATE):

 

		else {			$vals = array();			$sql  = "UPDATE {$this->charMapDatabase}.`acc_reg_num_db` SET value = value + ? ";			/*if (!is_null($donationAmount)) {				$sql .= ", last_donation_date = NOW(), last_donation_amount = ? ";			}*/						$vals[] = $credits;			/*if (!is_null($donationAmount)) {				$vals[] = $donationAmount;			}*/			$vals[] = $targetAccountID;						$sql .= "WHERE account_id = ? and `key` = '#CASHPOINTS'";			$sth  = $this->connection->getStatement($sql);						return $sth->execute($vals);		}	}

Not Work: (INSERT INTO):

 

		if (!$this->hasCreditsRecord($targetAccountID)) {			$fields = 'account_id, key, index, value';			$values = '?, ?, ?, ?';						/*if (!is_null($donationAmount)) {				$fields .= ', last_donation_date, last_donation_amount';				$values .= ', NOW(), ?';			}*/						$sql  = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values)ON DUPLICATE KEY UPDATE `value`=`value`+?";			$sth  = $this->connection->getStatement($sql);			$vals = array($targetAccountID, '#CASHPOINTS', 0, $credits);						/*if (!is_null($donationAmount)) {				$vals[] = $donationAmount;			}*/						return $sth->execute($vals);		}

 

Not Work: (INSERT INTO & UPDATE):

 

public function depositCredits($targetAccountID, $credits, $donationAmount = null)	{		$sql = "SELECT COUNT(account_id) AS accountExists FROM {$this->loginDatabase}.login WHERE account_id = ?";		$sth = $this->connection->getStatement($sql);				if (!$sth->execute(array($targetAccountID)) || !$sth->fetch()->accountExists) {			return false; // Account doesn't exist.		}				$creditsTable = Flux::config('FluxTables.CreditsTable');				$fields = 'account_id, key, index, value';		$values = '?, ?, ?, ?';				/*if (!is_null($donationAmount)) {			$fields .= ', last_donation_date, last_donation_amount';			$values .= ', NOW(), ?';		}*/				$sql  = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values) ON DUPLICATE KEY UPDATE `value`=`value`+?";		$sth  = $this->connection->getStatement($sql);		$vals = array($targetAccountID, '#CASHPOINTS', 0, $credits, $credits);				/*if (!is_null($donationAmount)) {			$vals[] = $donationAmount;		}*/				return $sth->execute($vals);	}
Edited by rituel

Share this post


Link to post
Share on other sites
  • 0
		if (!$this->hasCreditsRecord($targetAccountID)) {			$sql  = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` (`account_id`, `key`, `index`, `value`) VALUES (?,'#CASHPOINTS',0,?) ON DUPLICATE KEY UPDATE `value`=`value`+?";			$sth  = $this->connection->getStatement($sql);			$vals = array($targetAccountID, $credits,$credits);			return $sth->execute($vals);		}

Works fine for me... well for the exact error, enable the error reporting from config/error.php :

Change

 

$showExceptions = false;  

 

to

 

$showExceptions = true;  

Share this post


Link to post
Share on other sites
  • 0

Thanks  :D

I have also been able to find my mistake.

 

 

Not work:

		if (!$this->hasCreditsRecord($targetAccountID)) {			$fields = $fields = 'account_id, key, index, value';			$values = '?, ?, ?, ?';						/*if (!is_null($donationAmount)) {				$fields .= ', last_donation_date, last_donation_amount';				$values .= ', NOW(), ?';			}*/						$sql  = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values)";			$sth  = $this->connection->getStatement($sql);			$vals = array($targetAccountID, '#CASHPOINTS', 0, $credits);						/*if (!is_null($donationAmount)) {				$vals[] = $donationAmount;			}*/						return $sth->execute($vals);		}

 

Work!

 

		if (!$this->hasCreditsRecord($targetAccountID)) {			$fields = $fields = '`account_id`, `key`, `index`, `value`';			$values = '?, ?, ?, ?';						/*if (!is_null($donationAmount)) {				$fields .= ', last_donation_date, last_donation_amount';				$values .= ', NOW(), ?';			}*/						$sql  = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values)";			$sth  = $this->connection->getStatement($sql);			$vals = array($targetAccountID, '#CASHPOINTS', 0, $credits);						/*if (!is_null($donationAmount)) {				$vals[] = $donationAmount;			}*/						return $sth->execute($vals);		}

Share this post


Link to post
Share on other sites
  • 0
Another question:
 
Is there a way that cash shop tests with sandbox.paypal, credit my game account on my Fluxcp site?
What is complicated currently for testing .
 
Fix & Work  :p_idea:
 
 
With 0.01€
1404843943-sans-titre.png
Edited by rituel

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.