Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Yommy src flux + fixes
Both flux addons fixes for named item
- Loading branch information
Showing
with
449 additions
and 5 deletions.
- +3 −1 merchant_db_flux/README.md
- +11 −2 merchant_db_flux/vending/modules/vending/index.php
- +7 −2 merchant_db_flux/vending/themes/default/vending/index.php
- +10 −0 merchant_db_flux_yommy/README.md
- +9 −0 merchant_db_flux_yommy/vending/config/access.php
- +7 −0 merchant_db_flux_yommy/vending/config/addon.php
- +13 −0 merchant_db_flux_yommy/vending/modules/map/bin.php
- +161 −0 merchant_db_flux_yommy/vending/modules/map/gat.php
- +13 −0 merchant_db_flux_yommy/vending/modules/map/map.php
- BIN merchant_db_flux_yommy/vending/modules/map/prontera.gat
- +92 −0 merchant_db_flux_yommy/vending/modules/vending/index.php
- +123 −0 merchant_db_flux_yommy/vending/themes/default/vending/index.php
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,10 @@ | ||
| Hercules Merchant Database for FluxCP | ||
| ======= | ||
|
|
||
| For Yommy src | ||
| https://github.com/HerculesWS/StaffPlugins/blob/master/Yommy/Vend_SQL/Vend_SQL.c | ||
|
|
||
|  | ||
|  | ||
|  | ||
|  |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,9 @@ | ||
| <?php | ||
| return array( | ||
| 'modules' => array( | ||
| 'vending' => array( | ||
| 'index' => AccountLevel::ANYONE | ||
| ) | ||
| ) | ||
| ) | ||
| ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,7 @@ | ||
| <?php | ||
| return array( | ||
| 'MenuItems' => array( | ||
| 'Information' => array('Vending DB' => array('module' => 'vending')) | ||
| ) | ||
| ) | ||
| ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,13 @@ | ||
| <?php | ||
|
|
||
| function dword(&$buf, $offset=0) | ||
| { | ||
| return ord($buf{$offset++})+(ord($buf{$offset++})<<8)+(ord($buf{$offset++})<<16)+(ord($buf{$offset})<<24); | ||
| } | ||
|
|
||
| function byte(&$buf, $offset=0) | ||
| { | ||
| return ord($buf{$offset}); | ||
| } | ||
|
|
||
| ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,161 @@ | ||
| <?php | ||
|
|
||
| require_once('bin.php'); | ||
|
|
||
| class gat { | ||
| private $m; | ||
| private $r; | ||
| private $xs, $ys; | ||
|
|
||
| public function __construct($b) { | ||
| $this->xs = dword($b, 6); | ||
| $this->ys = dword($b, 10); | ||
| //printf("Loading map: %03d*%03d\n", $this->xs, $this->ys); | ||
|
|
||
| $n = $this->xs * $this->ys; | ||
| $i = 14; | ||
| $x = 0; | ||
| $y = 0; | ||
| $this->m = array(); | ||
| for($xy = 0; $xy < $n; $xy++) { | ||
| $this->m[$x++][$y] = (dword($b, $i + 16) == 0 ? true : false); | ||
| if( $x == $this->xs ) { | ||
| $x = 0; | ||
| $y++; | ||
| } | ||
| $i += 20; | ||
| } | ||
| } | ||
|
|
||
| public function c($x, $y) { | ||
| if( $x < 0 || $x >= $this->xs || $y < 0 || $y >= $this->ys ) | ||
| return false; | ||
| return $this->m[$x][$y]; | ||
| } | ||
|
|
||
| public function near_free($x, $y, $mr=8) { | ||
| static $s = array( array(1,0), array(0,-1), array(-1,0), array(0,1) ); | ||
| if( $this->c($x, $y) ) | ||
| return array($x, $y); | ||
| for($r=1; $r<=$mr; $r++) { | ||
| $ax = $x - $r; | ||
| $ay = $y + $r; | ||
| for($j=0;$j<4;$j++) { | ||
| for($k=0;$k<2*$r;$k++) { | ||
| if( $this->c($ax, $ay) ) | ||
| return array($ax, $ay); | ||
| $ax+=$s[$j][0]; | ||
| $ay+=$s[$j][1]; | ||
| } | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public function init_room() { | ||
| $this->r = array(); | ||
| $rooms = array(); | ||
| $id = 1; | ||
| for($x=0;$x<$this->xs;$x++) | ||
| $this->r[$x][0] = false; | ||
| for($y=0;$y<$this->ys;$y++) | ||
| $this->r[0][$y] = false; | ||
| for($x=1; $x<$this->xs; $x++) { | ||
| for($y=1; $y<$this->ys; $y++) { | ||
| if( $this->c($x,$y) !== true ) { | ||
| $this->r[$x][$y] = false; | ||
| continue; | ||
| } | ||
| if( is_numeric($this->r[$x][$y-1]) ) { | ||
| $rid = $this->r[$x][$y-1]; | ||
| $this->r[$x][$y] = $rid; | ||
| $rooms[$rid][] = array($x,$y); | ||
| if( is_numeric($this->r[$x-1][$y]) && ($o=$this->r[$x-1][$y])!=$rid ) { | ||
| foreach($rooms[$o] as $e) | ||
| { | ||
| $this->r[$e[0]][$e[1]] = $rid; | ||
| $rooms[$rid][] = array($e[0], $e[1]); | ||
| } | ||
| unset($rooms[$o]); | ||
| } | ||
| } | ||
| else if( is_numeric($this->r[$x-1][$y]) ) { | ||
| $rid = $this->r[$x-1][$y]; | ||
| $this->r[$x][$y] = $rid; | ||
| $rooms[$rid][] = array($x,$y); | ||
| if( is_numeric($this->r[$x][$y-1]) && ($o=$this->r[$x][$y-1])!=$rid ) { | ||
| foreach($rooms[$o] as $e) | ||
| { | ||
| $this->r[$e[0]][$e[1]] = $rid; | ||
| $rooms[$rid][] = array($e[0], $e[1]); | ||
| } | ||
| unset($rooms[$o]); | ||
| printf("%d > %d\n", $rid, $o); | ||
| die('waiting...'); | ||
| } | ||
| } | ||
| else { | ||
| $rooms[$id] = array( array($x, $y) ); | ||
| $this->r[$x][$y] = $id++; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public function r($x,$y) { | ||
| if( $x < 0 || $x >= $this->xs || $y < 0 || $y >= $this->ys ) | ||
| return false; | ||
| return $this->r[$x][$y]; | ||
| } | ||
|
|
||
| public function draw_map($return=false,$scale=2, $xc, $yc) { | ||
| $im = imagecreatetruecolor($this->xs*$scale,$this->ys*$scale); | ||
|
|
||
| $c = imagecolorallocate($im, 255, 255, 255); | ||
| for($x=0;$x<($this->xs-1);$x++) { | ||
| for($y=0;$y<($this->ys-1);$y++) { | ||
| if( !$this->c($x, $y) ) | ||
| continue; | ||
| imagefilledrectangle($im, $x*$scale-$scale/2,$y*$scale-$scale/2,$x*$scale+$scale/2,$y*$scale+$scale/2, $c); | ||
| } | ||
| } | ||
|
|
||
| $black = imagecolorallocate($im, 0, 0, 0); | ||
| $white = imagecolorallocate($im, 0, 255, 0); | ||
| imagefilledarc($im, $xc*$scale-$scale/2, ($this->ys*$scale)-($yc*$scale-$scale/2), 10, 10, 0, 360, $white, IMG_ARC_PIE); | ||
| imagearc($im, $xc*$scale-$scale/2, ($this->ys*$scale)-($yc*$scale-$scale/2), 10, 10, 0, 360, $black); | ||
|
|
||
| if( $return ) | ||
| return $im; | ||
| imagepng($im, 'test2.png'); | ||
| return true; | ||
| } | ||
|
|
||
| public function draw_map_room($return=false,$scale=2) { | ||
| $im = imagecreatetruecolor($this->xs*$scale,$this->ys*$scale); | ||
| //echo $this->xs*$scale.' '.$this->ys*$scale; | ||
| $w = imagecolorallocate($im, 255, 255, 255); | ||
| $rooms = array(); | ||
| for($x=0;$x<($this->xs-1);$x++) { | ||
| for($y=0;$y<($this->ys-1);$y++) { | ||
| if( !$this->c($x, $y) ) | ||
| continue; | ||
| if( !isset($this->r[$x][$y]) || !is_numeric($this->r[$x][$y]) ) { | ||
| die('Something went wrong..'); | ||
| } | ||
| if( isset($rooms[$this->r[$x][$y]]) ) | ||
| $c = $rooms[$this->r[$x][$y]]; | ||
| else | ||
| $c=$rooms[$this->r[$x][$y]]=imagecolorallocate($im, rand(40,250), rand(40,250), rand(40,250)); | ||
| imagefilledrectangle($im, $x*$scale-$scale/2,$y*$scale-$scale/2,$x*$scale+$scale/2,$y*$scale+$scale/2, $c); | ||
| } | ||
| } | ||
| if( $return ) | ||
| return $im; | ||
| imagepng($im, 'test4.png'); | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,13 @@ | ||
| <?php | ||
| header("Content-type: image/png"); | ||
| require("gat.php"); | ||
| $p = new gat(file_get_contents($_GET["map"].".gat")); | ||
|
|
||
| $x = $_GET["x"]; | ||
| $y = $_GET["y"]; | ||
|
|
||
| $im = $p->draw_map(true, 1, $x, $y); | ||
|
|
||
| imagepng($im); | ||
| imagedestroy($im); | ||
| ?> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,92 @@ | ||
| <?php | ||
| if (!defined('FLUX_ROOT')) exit; | ||
|
|
||
| $refine = array(0=>"-", "+1", "+2", "+3", "+4", "+5", "+6", "+7", "+8", "+9", "+10"); | ||
|
|
||
| function get_item_name($id, $server) | ||
| { | ||
| if($id>255) | ||
| { | ||
| $sql = "SELECT name_japanese, slots FROM {$server->charMapDatabase}.`item_db` where id='{$id}'"; | ||
| $sth = $server->connection->getStatement($sql); | ||
| $sth->execute(); | ||
| $r = $sth->fetch(); | ||
| $slots = ($r->slots > 0) ? "[{$r->slots}]":""; | ||
| return $r->name_japanese.$slots; | ||
| } | ||
| else | ||
| { | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| function get_char_name($id, $server) | ||
| { | ||
| $sql = "SELECT name FROM {$server->charMapDatabase}.`char` where char_id='{$id}'"; | ||
| $sth = $server->connection->getStatement($sql); | ||
| $sth->execute(); | ||
| $r = $sth->fetch(); | ||
| return $r->name; | ||
| } | ||
|
|
||
| $bind = array(); | ||
| $sqlpartial = ''; | ||
| $iname = $params->get('item_name'); | ||
|
|
||
| if ($iname) { | ||
| if(is_numeric($iname)) | ||
| { | ||
| $sql = "SELECT id FROM {$server->charMapDatabase}.`item_db` where id='{$iname}'"; | ||
| $sth = $server->connection->getStatement($sql); | ||
| $sth->execute(); | ||
| $item = $sth->fetchAll(); | ||
| } | ||
| else | ||
| { | ||
| $sql = "SELECT id FROM {$server->charMapDatabase}.`item_db` where UPPER(name_japanese) LIKE '%{$iname}%'"; | ||
| $sth = $server->connection->getStatement($sql); | ||
| $sth->execute(); | ||
| $item = $sth->fetchAll(); | ||
| } | ||
| $itemsearch = array(); | ||
| foreach($item as $search_id) | ||
| { | ||
| $itemsearch[] = $search_id->id; | ||
| } | ||
|
|
||
| $items = implode(",",$itemsearch); | ||
|
|
||
| if(count($itemsearch) >= 1) | ||
| { | ||
| $search_info = "<b>Perhaps you were looking for:</b> "; | ||
| $i=0; | ||
| foreach($itemsearch as $id){ if($i>10) break; $searchitems[] = $this->linkToItem($id, get_item_name($id,$server)); $i++;} | ||
| $search_info .= implode(", ",$searchitems); | ||
|
|
||
| $sqlpartial .= "where v.`nameid` in ({$items})"; | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| $sql = "SELECT count(*) AS total FROM {$server->charMapDatabase}.`vending_stat` AS v $sqlpartial"; | ||
| $sth = $server->connection->getStatement($sql); | ||
|
|
||
| $sth->execute($bind); | ||
|
|
||
| $sortable = array('shop', 'owner', 'nameid', 'amount', 'price', 'refine', 'card0', 'card1', 'card2', 'card3'); | ||
|
|
||
| $paginator = $this->getPaginator($sth->fetch()->total); | ||
| $paginator->setSortableColumns($sortable); | ||
|
|
||
|
|
||
| $col = "v.*"; | ||
|
|
||
| $sql = $paginator->getSQL("SELECT $col FROM {$server->charMapDatabase}.`vending_stat` AS v $sqlpartial"); | ||
| $sth = $server->connection->getStatement($sql); | ||
|
|
||
| $sth->execute($bind); | ||
|
|
||
| $chars = $sth->fetchAll(); | ||
| ?> |
Oops, something went wrong.