• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Gesior ACC] Items price test [v.2.0]

2.2 [BUGS REPAIR]

* I THINK that should destroy all errors ;]
Code:
/ You should know that IPT (all versions) are create
/ [B]ONLY FOR OtLand![/B] and if you want's to distribute it
/ [B]YOU MUST TO[/B] GIVE LINK TO OTLAND.NET, info
/ about author and optionally to his site/profile.
                            ~Thanks, MappingFOR





UPGRADE ALL OLDEST VERSION

BETWEEN
Code:
//NPC CHECK by MappingFOR  // www.mayu11.webd.pl // PL & EN
AND
Code:
// END NPC CHECK

PASTE


Code:
if($action == "npc_check_by_mappingfor") {

$language['en']['none'] = "NONE";
$language['en']['name'] = "Name";
$language['en']['script'] = "Script";
$language['en']['mod_off'] = "The shop module is off.";
$language['en']['error_none'] = "<font color=\"red\"><b>ERROR!</b></font> NPC which has switched shop module should have at least one item to buy or sell.";
$language['en']['errors'] = "Now, I'll show You errors ;]";
$language['en']['error'] = "<center><small>I can buy item %s from %s for %s and sell at %s for %s. I'd like it :D</small></center>";
$language['en']['added'] = "Added as '%s' type.";
$language['en']['iit'] = "%s items in '%s' type.";
$language['en']['checked'] = "%s rows checked.";
$language['en']['no_erros'] = "<small>Like no errors here ;[</small>";

$language['pl']['none'] = "BRAK";
$language['pl']['name'] = "Nazwa";
$language['pl']['script'] = "Skrypt";
$language['pl']['mod_off'] = "Moduł sklepu jest wyłączony.";
$language['pl']['error_none'] = "<font color=\"red\">BŁĄD!</font> NPC z włączonym modułem sklepu powinien posiadać przynajmniej jeden przedmiot do kupienia lub sprzedania.";
$language['pl']['errors'] = "Teraz pokaże Ci błędy ;]";
$language['pl']['error'] = "<center><small>Mogę kupić przedmiot %s u %s za %s i sprzedać u %s za %s. Lubię to :D</small></center>";
$language['pl']['added'] = "Dodane jako typ '%s'.";
$language['pl']['iit'] = "%s przedmiotów w typie '%s'.";
$language['pl']['checked'] = "Sprawdzono %s linijek.";
$language['pl']['no_erros'] = "<small>Wygląda na to, że nie ma tutaj błędów ;[</small>";



$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>Add Files</B></TD></TR>';
	// Magic cutting function by MappingFOR ("change_c($back_g,$bgcolor);" to use)
function change_c(&$back_g,&$bgcolor){
if(is_int($back_g / 2))
	$bgcolor = "#D4C0A1";
else
	$bgcolor = "#F1E0C6";
$back_g++;
}


if(isset($_GET['lng'])){$lng = $_GET['lng'];}else{$lng = 'pl';} // Change language
$scdost = $config['site']['server_path']."data/npc"; // data/npc Path

$a = 0;
$dir = opendir($scdost);

while(false !== ($file = readdir($dir)))
  if($file != '.' && $file != '..' && preg_match("([a-zA-Z0-9].xml)" , $file)){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>+ ['.$scdost.'/'.$file.']</small></td></tr>';
$npcs[$a] = $file;
$a++;
}
$b = 0;

/* "Teraz nastąpi dodanie wszystkich możliwych do kupiienia i sprzedania przedmiotów. " */

$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>Raport</B></TD></TR>';


while($b + 1 != $a){ // Sprawdzenie wszystkich plików 
$infoXML = simplexml_load_file(''.$scdost.'\\'.$npcs[$b].''); // Wczytanie piku XML do zbadania.

$npc['name'] = $infoXML[name]; // Pobranie nazwy NPC
$npc['script'] = $infoXML[script]; // Pobranie skryptu który obsługuje

if(empty($npc['script']))
{
$npc['script'] = '<b>'.$language[$lng]['none'].'</b>';
}
else
{
$scripts[] = $infoXML[script];
}// Wczytanie do ogólnej zmiennej}

## Pobranie wszystkich możliwych parametrów.
$z = 0;
while(isset($infoXML->parameters->parameter[$z][key])){
$npc['param'][''.$infoXML->parameters->parameter[$z][key].''] = $infoXML->parameters->parameter[$z][value];
$z++;
}


## Jeśli modół sklepu jest włączony to pobierz wszystkie przedmioty.
if($npc['param']['module_shop'] == 1){

if(isset($npc['param']['shop_sellable'])){
## Wpisanie wszystkich przedmiotów, które można sprzedać.
$npc['sell_able'] = $npc['param']['shop_sellable'];
$npc['sell_able_array'] = explode(';',$npc['sell_able']);
$npc['sell_count'] = count($npc['sell_able_array']);

$c = 0;
while($npc['sell_able_array'][$c] != ""){
$npc['sell_able_array_positions'][$c] = explode(',',$npc['sell_able_array'][$c]);
$c++;
}
## Wyświetlenie informacji o tym, że nie ma żadnego przedmiotu który można sprzedać.
}else{$npc['sell_count'] = "None";}

if(isset($npc['param']['shop_buyable'])){
## Wpisanie wszystkich przedmiotów, które można kupić.
$npc['buy_able'] = $npc['param']['shop_buyable'];
$npc['buy_able_array'] = explode(';',$npc['buy_able']);
$npc['buy_count'] = count($npc['buy_able_array']);

$c = 0;
while($npc['buy_able_array'][$c] != ""){
$npc['buy_able_array_positions'][$c] = explode(',',$npc['buy_able_array'][$c]);
$c++;
}
## Wyświetlenie informacji o tym, że nie ma żadnego przedmiotu który można kupić.
}else{$npc['buy_count'] = "None";}



## Wyświetlenie informacji o tym, że NPC ma włączony "module_shop", a nie posiada żadnego przedmiotu do kupienia lub sprzedaży.
if($npc['buy_count'] == "None" AND $npc['sell_count'] == "None"){
$npc['shop'] = "<br/>".$language[$lng]['error_none']."";
}else{
$npc['shop'] = '['.$npc['buy_count'].' b;s '.$npc['sell_count'].']';
}

}else{
## Wyświetlenie informacji o tym, że NPC ma wyłączony "module_shop".
$npc['shop'] = $language[$lng]['mod_off'];
}

## Wyświetlenie informacji o NPC (Nazwa, Skrypt, Ilość sprzedawanych;kupowanych rzeczy.
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.$language[$lng]['name'].': '.$npc['name'].'; '.$language[$lng]['script'].': '.$npc['script'].'; '.$npc['shop'].'</small></td></tr>';

## Wyświetlanie listy przedmiotów do kupienia i sprzedania.
$c = 0;

while($npc['sell_able_array_positions'][$c] != ""){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td> * * * * * * * * * * * *- <small>';
$main_content .= print_r($npc['sell_able_array_positions'][$c],true);
$main_content .= ' [SELLABLE]</small></td></tr>';
$list['sell'][$npc['sell_able_array_positions'][$c][1]] = $npc['sell_able_array_positions'][$c][2];
$list['sell_npc'][$npc['sell_able_array_positions'][$c][1]] = $npc['name'];
$c++;
}
$c = 0;
while($npc['buy_able_array_positions'][$c] != ""){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td> * * * * * * * * * * * *- <small>';
$main_content .= print_r($npc['buy_able_array_positions'][$c],true);
$main_content .= ' [BUYALBE]</small></td></tr>';
$list['buy'][$npc['buy_able_array_positions'][$c][1]] = $npc['buy_able_array_positions'][$c][2];
$list['buy_npc'][$npc['buy_able_array_positions'][$c][1]] = $npc['name'];
$c++;
}

$npc = null;
$b++;
}

if(!empty($list['buy'])){
foreach($list['buy'] as $id => $price){
if($list['buy'][$id] < $list['sell'][$id] AND $list['buy'][$id] != 0){
change_c($back_g,$bgcolor);
$errors_items .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.sprintf($language[$lng]['error'],$id,$list['buy_npc'][$id],$list['buy'][$id],$list['sell_npc'][$id],$list['sell'][$id]).'</td></tr>';
}
}
}

$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] XML Results</B></TD></TR>';

if(!empty($errors_items)){
$main_content .= $errors_items;
}else{
$main_content .= $language[$lng]['no_erros'];
}


$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] Lua Results</B></TD></TR>';

## LUA LOOKUP


$item = "";

$a = 0;
$b = 0;
$c = 0;


$item['buy']['addBuyableItem'] = array();
$item['sell']['addSellableItem'] = array();
$item['buy']['addBuyableItemContainer'] = array();

while(is_file($scdost.'\\scripts\\'.$scripts[$a])){
$content = file($scdost.'\\scripts\\'.$scripts[$a]);

if(!empty($content))
foreach($content as $data)
{

if(preg_match("/shopModule:addBuyableItem\(/",$data) == true){
$item['buy']['addBuyableItem'][] = preg_replace("/shopModule:addBuyableItem({'(.*)'}, (.*), (.*), '(.*)')/i", "$1.$2.$3", $data).', '.$scripts[$a];
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addBuyableItem').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}

if(preg_match("/shopModule:addSellableItem\(/",$data) == true){
$item['sell']['addSellableItem'][] = preg_replace("/shopModule:addSellableItem({'(.*)', '(.*)'}, (.*), (.*), '(.*)')/i", "$1.$2.$3.$4.$5", $data).', '.$scripts[$a];
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addSellableItem').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}

if(preg_match("/shopModule:addBuyableItemContainer\(/",$data) == true){
$item['buy']['addBuyableItemContainer'][] = preg_replace("/shopModule:addBuyableItemContainer({'(.*)'}, (.*), (.*), (.*), '(.*)')/i", "$1", $data).', '.$scripts[$a];
$data .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addBuyableItemContainer').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}


change_c($back_g,$bgcolor);
$a++;
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>[FILE: '.$a.'][ROW: '.$b.']'.$found.' '.$data.'</small></td></tr>';
$a--;
$found = "";
$b++;
$c++;
}

$a++;
$b = 0;
}


if(is_array($item['buy']['addBuyableItem'])){
$count['addBuyableItem'] = count($item['buy']['addBuyableItem']);

}
if(is_array($item['buy']['addSellableItem'])){
$count['addSellableItem'] = count($item['sell']['addSellableItem']);
}

if(is_array($item['buy']['addBuyableItemContainer'])){
$count['addBuyableItemContainer'] = count($item['buy']['addBuyableItemContainer']);
}



change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addBuyableItem'],'addBuyableItem').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addSellableItem'],'addSellableItem').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addBuyableItemContainer'],'addBuyableItemContainer').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['checked'],$c).'</small></td></tr>';

// Czas na ścięcie.

$list = "";
if(!empty($item['buy']['addBuyableItem']))
foreach($item['buy']['addBuyableItem'] as $data){
//shopModule:addBuyableItem({'WYPOWIEDŹ'}, ID, CENA, 'NAZWA')

$step = explode(', ', $data);
$id = $step[1];
$cena = $step[2];
$npc = $step[5];

$list['buy'][$id] = $cena;
$list['buy_npc'][$id] = $npc;
}
if(!empty($item['sell']['addSellableItem']))
foreach($item['sell']['addSellableItem'] as $data){
//shopModule:addSellableItem({'WYPOWIEDŹ', 'WYPOWIEDŹ'}, ID, CENA, 'NAZWA')

$step = explode(', ', $data);
$id = $step[2];
$cena = $step[3];
$npc = $step[5];

$list['sell'][$id] = $cena;
$list['sell_npc'][$id] = $npc;
}

if(!empty($item['buy']['addBuyableItemContainer']))
foreach($item['buy']['addBuyableItemContainer'] as $data){
$step = explode(', ', $data);
$id = $step[2];
$cena = $step[3] / 20;
$npc = $step[6];
$list['buy'][$id] = $cena;
$list['buy_npc'][$id] = $npc;
}

$errors_items = '';

if(!empty($list['buy']))
foreach($list['buy'] as $id => $price){
if($list['buy'][$id] < $list['sell'][$id] AND $list['buy'][$id] != 0){
change_c($back_g,$bgcolor);
$errors_items .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.sprintf($language[$lng]['error'],$id,$list['buy_npc'][$id],$list['buy'][$id],$list['sell_npc'][$id],$list['sell'][$id]).'</td></tr>';
}
}


if(!empty($errors_items)){
$main_content .= $errors_items;
}else{
$main_content .= $language[$lng]['no_erros'];
}
$main_content .= '</table>';

## DO NOT DELETE FOOTER! // NIE USUWAĆ STOPKI!
$main_content .= '<p align="right"><small>Scripted by <b><a href="http://mayu11.webd.pl">MappingFOR</a> [<a href="http://otland.net/members/mappingfor/">OTLand Profile</a>]</b>. I <font size="5">♥</font> <a href="http://otland.net">OTLand.net</a></small></p>';
$main_content .= '<TABLE id="lua_report" BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] Lua raport</B></TD></TR>';
$main_content .= $lua_testing;
$main_content .= '</table>';
}


ISTALL VERSION

CHANGE

Code:
<tr bgcolor='.$config['site']['lightborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_monsters">Reload Monsters</a></b></td><td><b>Load information about monsters from directory "your_server_path/data/monsters/". Delete old mosters configuration!</b></td></tr>
<tr bgcolor='.$config['site']['darkborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_spells">Reload Spells</a></b></td><td><b>Load information about spells from file "your_server_path/data/spells/spells.xml". Delete old spells configuration!</b></td></tr>
</table>';
}

TO

Code:
<tr bgcolor='.$config['site']['lightborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_monsters">Reload Monsters</a></b></td><td><b>Load information about monsters from directory "your_server_path/data/monsters/". Delete old mosters configuration!</b></td></tr>
<tr bgcolor='.$config['site']['darkborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_spells">Reload Spells</a></b></td><td><b>Load information about spells from file "your_server_path/data/spells/spells.xml". Delete old spells configuration!</b></td></tr>
<tr bgcolor='.$config['site']['lightborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=npc_check_by_mappingfor&lng=pl">Check NPCs</a> [PL]</b></td><td><b>Sprawdzanie cen przedmiotów.</b></td></tr>
<tr bgcolor='.$config['site']['darkborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=npc_check_by_mappingfor&lng=en">Check NPCs</a> [EN]</b></td><td><b>Check items prices.</b></td></tr>
</table>';
}










//NPC CHECK by MappingFOR  // www.mayu11.webd.pl // PL & EN

if($action == "npc_check_by_mappingfor") {

$language['en']['none'] = "NONE";
$language['en']['name'] = "Name";
$language['en']['script'] = "Script";
$language['en']['mod_off'] = "The shop module is off.";
$language['en']['error_none'] = "<font color=\"red\"><b>ERROR!</b></font> NPC which has switched shop module should have at least one item to buy or sell.";
$language['en']['errors'] = "Now, I'll show You errors ;]";
$language['en']['error'] = "<center><small>I can buy item %s from %s for %s and sell at %s for %s. I'd like it :D</small></center>";
$language['en']['added'] = "Added as '%s' type.";
$language['en']['iit'] = "%s items in '%s' type.";
$language['en']['checked'] = "%s rows checked.";
$language['en']['no_erros'] = "<small>Like no errors here ;[</small>";

$language['pl']['none'] = "BRAK";
$language['pl']['name'] = "Nazwa";
$language['pl']['script'] = "Skrypt";
$language['pl']['mod_off'] = "Moduł sklepu jest wyłączony.";
$language['pl']['error_none'] = "<font color=\"red\">BŁĄD!</font> NPC z włączonym modułem sklepu powinien posiadać przynajmniej jeden przedmiot do kupienia lub sprzedania.";
$language['pl']['errors'] = "Teraz pokaże Ci błędy ;]";
$language['pl']['error'] = "<center><small>Mogę kupić przedmiot %s u %s za %s i sprzedać u %s za %s. Lubię to :D</small></center>";
$language['pl']['added'] = "Dodane jako typ '%s'.";
$language['pl']['iit'] = "%s przedmiotów w typie '%s'.";
$language['pl']['checked'] = "Sprawdzono %s linijek.";
$language['pl']['no_erros'] = "<small>Wygląda na to, że nie ma tutaj błędów ;[</small>";



$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>Add Files</B></TD></TR>';
	// Magic cutting function by MappingFOR ("change_c($back_g,$bgcolor);" to use)
function change_c(&$back_g,&$bgcolor){
if(is_int($back_g / 2))
	$bgcolor = "#D4C0A1";
else
	$bgcolor = "#F1E0C6";
$back_g++;
}


if(isset($_GET['lng'])){$lng = $_GET['lng'];}else{$lng = 'pl';} // Change language
$scdost = $config['site']['server_path']."data/npc"; // data/npc Path

$a = 0;
$dir = opendir($scdost);

while(false !== ($file = readdir($dir)))
  if($file != '.' && $file != '..' && preg_match("([a-zA-Z0-9].xml)" , $file)){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>+ ['.$scdost.'/'.$file.']</small></td></tr>';
$npcs[$a] = $file;
$a++;
}
$b = 0;

/* "Teraz nastąpi dodanie wszystkich możliwych do kupiienia i sprzedania przedmiotów. " */

$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>Raport</B></TD></TR>';


while($b + 1 != $a){ // Sprawdzenie wszystkich plików 
$infoXML = simplexml_load_file(''.$scdost.'\\'.$npcs[$b].''); // Wczytanie piku XML do zbadania.

$npc['name'] = $infoXML[name]; // Pobranie nazwy NPC
$npc['script'] = $infoXML[script]; // Pobranie skryptu który obsługuje

if(empty($npc['script']))
{
$npc['script'] = '<b>'.$language[$lng]['none'].'</b>';
}
else
{
$scripts[] = $infoXML[script];
}// Wczytanie do ogólnej zmiennej}

## Pobranie wszystkich możliwych parametrów.
$z = 0;
while(isset($infoXML->parameters->parameter[$z][key])){
$npc['param'][''.$infoXML->parameters->parameter[$z][key].''] = $infoXML->parameters->parameter[$z][value];
$z++;
}


## Jeśli modół sklepu jest włączony to pobierz wszystkie przedmioty.
if($npc['param']['module_shop'] == 1){

if(isset($npc['param']['shop_sellable'])){
## Wpisanie wszystkich przedmiotów, które można sprzedać.
$npc['sell_able'] = $npc['param']['shop_sellable'];
$npc['sell_able_array'] = explode(';',$npc['sell_able']);
$npc['sell_count'] = count($npc['sell_able_array']);

$c = 0;
while($npc['sell_able_array'][$c] != ""){
$npc['sell_able_array_positions'][$c] = explode(',',$npc['sell_able_array'][$c]);
$c++;
}
## Wyświetlenie informacji o tym, że nie ma żadnego przedmiotu który można sprzedać.
}else{$npc['sell_count'] = "None";}

if(isset($npc['param']['shop_buyable'])){
## Wpisanie wszystkich przedmiotów, które można kupić.
$npc['buy_able'] = $npc['param']['shop_buyable'];
$npc['buy_able_array'] = explode(';',$npc['buy_able']);
$npc['buy_count'] = count($npc['buy_able_array']);

$c = 0;
while($npc['buy_able_array'][$c] != ""){
$npc['buy_able_array_positions'][$c] = explode(',',$npc['buy_able_array'][$c]);
$c++;
}
## Wyświetlenie informacji o tym, że nie ma żadnego przedmiotu który można kupić.
}else{$npc['buy_count'] = "None";}



## Wyświetlenie informacji o tym, że NPC ma włączony "module_shop", a nie posiada żadnego przedmiotu do kupienia lub sprzedaży.
if($npc['buy_count'] == "None" AND $npc['sell_count'] == "None"){
$npc['shop'] = "<br/>".$language[$lng]['error_none']."";
}else{
$npc['shop'] = '['.$npc['buy_count'].' b;s '.$npc['sell_count'].']';
}

}else{
## Wyświetlenie informacji o tym, że NPC ma wyłączony "module_shop".
$npc['shop'] = $language[$lng]['mod_off'];
}

## Wyświetlenie informacji o NPC (Nazwa, Skrypt, Ilość sprzedawanych;kupowanych rzeczy.
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.$language[$lng]['name'].': '.$npc['name'].'; '.$language[$lng]['script'].': '.$npc['script'].'; '.$npc['shop'].'</small></td></tr>';

## Wyświetlanie listy przedmiotów do kupienia i sprzedania.
$c = 0;

while($npc['sell_able_array_positions'][$c] != ""){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td> * * * * * * * * * * * *- <small>';
$main_content .= print_r($npc['sell_able_array_positions'][$c],true);
$main_content .= ' [SELLABLE]</small></td></tr>';
$list['sell'][$npc['sell_able_array_positions'][$c][1]] = $npc['sell_able_array_positions'][$c][2];
$list['sell_npc'][$npc['sell_able_array_positions'][$c][1]] = $npc['name'];
$c++;
}
$c = 0;
while($npc['buy_able_array_positions'][$c] != ""){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td> * * * * * * * * * * * *- <small>';
$main_content .= print_r($npc['buy_able_array_positions'][$c],true);
$main_content .= ' [BUYALBE]</small></td></tr>';
$list['buy'][$npc['buy_able_array_positions'][$c][1]] = $npc['buy_able_array_positions'][$c][2];
$list['buy_npc'][$npc['buy_able_array_positions'][$c][1]] = $npc['name'];
$c++;
}

$npc = null;
$b++;
}

if(!empty($list['buy'])){
foreach($list['buy'] as $id => $price){
if($list['buy'][$id] < $list['sell'][$id] AND $list['buy'][$id] != 0){
change_c($back_g,$bgcolor);
$errors_items .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.sprintf($language[$lng]['error'],$id,$list['buy_npc'][$id],$list['buy'][$id],$list['sell_npc'][$id],$list['sell'][$id]).'</td></tr>';
}
}
}

$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] XML Results</B></TD></TR>';

if(!empty($errors_items)){
$main_content .= $errors_items;
}else{
$main_content .= $language[$lng]['no_erros'];
}


$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] Lua Results</B></TD></TR>';

## LUA LOOKUP


$item = "";

$a = 0;
$b = 0;
$c = 0;


$item['buy']['addBuyableItem'] = array();
$item['sell']['addSellableItem'] = array();
$item['buy']['addBuyableItemContainer'] = array();

while(is_file($scdost.'\\scripts\\'.$scripts[$a])){
$content = file($scdost.'\\scripts\\'.$scripts[$a]);

if(!empty($content))
foreach($content as $data)
{

if(preg_match("/shopModule:addBuyableItem\(/",$data) == true){
$item['buy']['addBuyableItem'][] = preg_replace("/shopModule:addBuyableItem({'(.*)'}, (.*), (.*), '(.*)')/i", "$1.$2.$3", $data).', '.$scripts[$a];
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addBuyableItem').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}

if(preg_match("/shopModule:addSellableItem\(/",$data) == true){
$item['sell']['addSellableItem'][] = preg_replace("/shopModule:addSellableItem({'(.*)', '(.*)'}, (.*), (.*), '(.*)')/i", "$1.$2.$3.$4.$5", $data).', '.$scripts[$a];
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addSellableItem').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}

if(preg_match("/shopModule:addBuyableItemContainer\(/",$data) == true){
$item['buy']['addBuyableItemContainer'][] = preg_replace("/shopModule:addBuyableItemContainer({'(.*)'}, (.*), (.*), (.*), '(.*)')/i", "$1", $data).', '.$scripts[$a];
$data .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addBuyableItemContainer').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}


change_c($back_g,$bgcolor);
$a++;
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>[FILE: '.$a.'][ROW: '.$b.']'.$found.' '.$data.'</small></td></tr>';
$a--;
$found = "";
$b++;
$c++;
}

$a++;
$b = 0;
}

if(is_array($item['buy']['addBuyableItem'])){
$count['addBuyableItem'] = count($item['buy']['addBuyableItem']);

}
if(is_array($item['buy']['addSellableItem'])){
$count['addSellableItem'] = count($item['sell']['addSellableItem']);
}

if(is_array($item['buy']['addBuyableItemContainer'])){
$count['addBuyableItemContainer'] = count($item['buy']['addBuyableItemContainer']);
}


change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addBuyableItem'],'addBuyableItem').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addSellableItem'],'addSellableItem').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addBuyableItemContainer'],'addBuyableItemContainer').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['checked'],$c).'</small></td></tr>';

// Czas na ścięcie.

$list = "";
if(!empty($item['buy']['addBuyableItem']))
foreach($item['buy']['addBuyableItem'] as $data){
//shopModule:addBuyableItem({'WYPOWIEDŹ'}, ID, CENA, 'NAZWA')

$step = explode(', ', $data);
$id = $step[1];
$cena = $step[2];
$npc = $step[5];

$list['buy'][$id] = $cena;
$list['buy_npc'][$id] = $npc;
}
if(!empty($item['sell']['addSellableItem']))
foreach($item['sell']['addSellableItem'] as $data){
//shopModule:addSellableItem({'WYPOWIEDŹ', 'WYPOWIEDŹ'}, ID, CENA, 'NAZWA')

$step = explode(', ', $data);
$id = $step[2];
$cena = $step[3];
$npc = $step[5];

$list['sell'][$id] = $cena;
$list['sell_npc'][$id] = $npc;
}

if(!empty($item['buy']['addBuyableItemContainer']))
foreach($item['buy']['addBuyableItemContainer'] as $data){
$step = explode(', ', $data);
$id = $step[2];
$cena = $step[3] / 20;
$npc = $step[6];
$list['buy'][$id] = $cena;
$list['buy_npc'][$id] = $npc;
}

$errors_items = '';

if(!empty($list['buy']))
foreach($list['buy'] as $id => $price){
if($list['buy'][$id] < $list['sell'][$id] AND $list['buy'][$id] != 0){
change_c($back_g,$bgcolor);
$errors_items .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.sprintf($language[$lng]['error'],$id,$list['buy_npc'][$id],$list['buy'][$id],$list['sell_npc'][$id],$list['sell'][$id]).'</td></tr>';
}
}


if(!empty($errors_items)){
$main_content .= $errors_items;
}else{
$main_content .= $language[$lng]['no_erros'];
}
$main_content .= '</table>';

## DO NOT DELETE FOOTER! // NIE USUWAĆ STOPKI!
$main_content .= '<p align="right"><small>Scripted by <b><a href="http://mayu11.webd.pl">MappingFOR</a> [<a href="http://otland.net/members/mappingfor/">OTLand Profile</a>]</b>. I <font size="5">♥</font> <a href="http://otland.net">OTLand.net</a></small></p>';
$main_content .= '<TABLE id="lua_report" BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] Lua raport</B></TD></TR>';
$main_content .= $lua_testing;
$main_content .= '</table>';
}
// END NPC CHECK
 
Last edited by a moderator:
Version 2.2, Work Perfect.

Nice Job. MappingFOR.

;]


Layout Fix:
PHP:
if($action == "npc_check_by_mappingfor") {

$language['en']['none'] = "NONE";
$language['en']['name'] = "Name";
$language['en']['script'] = "Script";
$language['en']['mod_off'] = "The shop module is off.";
$language['en']['error_none'] = "<font color=\"red\"><b>ERROR!</b></font> NPC which has switched shop module should have at least one item to buy or sell.";
$language['en']['errors'] = "Now, I'll show You errors ;]";
$language['en']['error'] = "<center><small>I can buy item %s from %s for %s and sell at %s for %s. I'd like it :D</small></center>";
$language['en']['added'] = "Added as '%s' type.";
$language['en']['iit'] = "%s items in '%s' type.";
$language['en']['checked'] = "%s rows checked.";
$language['en']['no_erros'] = "<small>Like no errors here ;[</small>";

$language['pl']['none'] = "BRAK";
$language['pl']['name'] = "Nazwa";
$language['pl']['script'] = "Skrypt";
$language['pl']['mod_off'] = "Modul sklepu jest wylaczony.";
$language['pl']['error_none'] = "<font color=\"red\">BLAD!</font> NPC z wlaczonym modulem sklepu powinien posiadac przynajmniej jeden przedmiot do kupienia lub sprzedania.";
$language['pl']['errors'] = "Teraz pokaze Ci bledy ;]";
$language['pl']['error'] = "<center><small>Moge kupic przedmiot %s u %s za %s i sprzedac u %s za %s. Lubie to :D</small></center>";
$language['pl']['added'] = "Dodane jako typ '%s'.";
$language['pl']['iit'] = "%s przedmiotów w typie '%s'.";
$language['pl']['checked'] = "Sprawdzono %s linijek.";
$language['pl']['no_erros'] = "<small>Wyglada na to, ze nie ma tutaj bledów ;[</small>";



$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>Add Files</B></TD></TR>';
	// Magic cutting function by MappingFOR ("change_c($back_g,$bgcolor);" to use)
function change_c(&$back_g,&$bgcolor){
if(is_int($back_g / 2))
	$bgcolor = $config['site']['darkborder'];
else
	$bgcolor = $config['site']['lightborder'];
$back_g++;
}


if(isset($_GET['lng'])){$lng = $_GET['lng'];}else{$lng = 'pl';} // Change language
$scdost = $config['site']['server_path']."data/npc"; // data/npc Path

$a = 0;
$dir = opendir($scdost);

while(false !== ($file = readdir($dir)))
  if($file != '.' && $file != '..' && preg_match("([a-zA-Z0-9].xml)" , $file)){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>+ ['.$scdost.'/'.$file.']</small></td></tr>';
$npcs[$a] = $file;
$a++;
}
$b = 0;

/* "Teraz nastapi dodanie wszystkich mozliwych do kupiienia i sprzedania przedmiotów. " */

$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>Raport</B></TD></TR>';


while($b + 1 != $a){ // Sprawdzenie wszystkich plików 
$infoXML = simplexml_load_file(''.$scdost.'\\'.$npcs[$b].''); // Wczytanie piku XML do zbadania.

$npc['name'] = $infoXML[name]; // Pobranie nazwy NPC
$npc['script'] = $infoXML[script]; // Pobranie skryptu który obsluguje

if(empty($npc['script']))
{
$npc['script'] = '<b>'.$language[$lng]['none'].'</b>';
}
else
{
$scripts[] = $infoXML[script];
}// Wczytanie do ogólnej zmiennej}

## Pobranie wszystkich mozliwych parametrów.
$z = 0;
while(isset($infoXML->parameters->parameter[$z][key])){
$npc['param'][''.$infoXML->parameters->parameter[$z][key].''] = $infoXML->parameters->parameter[$z][value];
$z++;
}


## Jesli modól sklepu jest wlaczony to pobierz wszystkie przedmioty.
if($npc['param']['module_shop'] == 1){

if(isset($npc['param']['shop_sellable'])){
## Wpisanie wszystkich przedmiotów, które mozna sprzedac.
$npc['sell_able'] = $npc['param']['shop_sellable'];
$npc['sell_able_array'] = explode(';',$npc['sell_able']);
$npc['sell_count'] = count($npc['sell_able_array']);

$c = 0;
while($npc['sell_able_array'][$c] != ""){
$npc['sell_able_array_positions'][$c] = explode(',',$npc['sell_able_array'][$c]);
$c++;
}
## Wyswietlenie informacji o tym, ze nie ma zadnego przedmiotu który mozna sprzedac.
}else{$npc['sell_count'] = "None";}

if(isset($npc['param']['shop_buyable'])){
## Wpisanie wszystkich przedmiotów, które mozna kupic.
$npc['buy_able'] = $npc['param']['shop_buyable'];
$npc['buy_able_array'] = explode(';',$npc['buy_able']);
$npc['buy_count'] = count($npc['buy_able_array']);

$c = 0;
while($npc['buy_able_array'][$c] != ""){
$npc['buy_able_array_positions'][$c] = explode(',',$npc['buy_able_array'][$c]);
$c++;
}
## Wyswietlenie informacji o tym, ze nie ma zadnego przedmiotu który mozna kupic.
}else{$npc['buy_count'] = "None";}



## Wyswietlenie informacji o tym, ze NPC ma wlaczony "module_shop", a nie posiada zadnego przedmiotu do kupienia lub sprzedazy.
if($npc['buy_count'] == "None" AND $npc['sell_count'] == "None"){
$npc['shop'] = "<br/>".$language[$lng]['error_none']."";
}else{
$npc['shop'] = '['.$npc['buy_count'].' b;s '.$npc['sell_count'].']';
}

}else{
## Wyswietlenie informacji o tym, ze NPC ma wylaczony "module_shop".
$npc['shop'] = $language[$lng]['mod_off'];
}

## Wyswietlenie informacji o NPC (Nazwa, Skrypt, Ilosc sprzedawanych;kupowanych rzeczy.
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.$language[$lng]['name'].': '.$npc['name'].'; '.$language[$lng]['script'].': '.$npc['script'].'; '.$npc['shop'].'</small></td></tr>';

## Wyswietlanie listy przedmiotów do kupienia i sprzedania.
$c = 0;

while($npc['sell_able_array_positions'][$c] != ""){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td> * * * * * * * * * * * *- <small>';
$main_content .= print_r($npc['sell_able_array_positions'][$c],true);
$main_content .= ' [SELLABLE]</small></td></tr>';
$list['sell'][$npc['sell_able_array_positions'][$c][1]] = $npc['sell_able_array_positions'][$c][2];
$list['sell_npc'][$npc['sell_able_array_positions'][$c][1]] = $npc['name'];
$c++;
}
$c = 0;
while($npc['buy_able_array_positions'][$c] != ""){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td> * * * * * * * * * * * *- <small>';
$main_content .= print_r($npc['buy_able_array_positions'][$c],true);
$main_content .= ' [BUYALBE]</small></td></tr>';
$list['buy'][$npc['buy_able_array_positions'][$c][1]] = $npc['buy_able_array_positions'][$c][2];
$list['buy_npc'][$npc['buy_able_array_positions'][$c][1]] = $npc['name'];
$c++;
}

$npc = null;
$b++;
}

if(!empty($list['buy'])){
foreach($list['buy'] as $id => $price){
if($list['buy'][$id] < $list['sell'][$id] AND $list['buy'][$id] != 0){
change_c($back_g,$bgcolor);
$errors_items .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.sprintf($language[$lng]['error'],$id,$list['buy_npc'][$id],$list['buy'][$id],$list['sell_npc'][$id],$list['sell'][$id]).'</td></tr>';
}
}
}

$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] XML Results</B></TD></TR>';

if(!empty($errors_items)){
$main_content .= $errors_items;
}else{
$main_content .= $language[$lng]['no_erros'];
}


$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] Lua Results</B></TD></TR>';

## LUA LOOKUP


$item = "";

$a = 0;
$b = 0;
$c = 0;


$item['buy']['addBuyableItem'] = array();
$item['sell']['addSellableItem'] = array();
$item['buy']['addBuyableItemContainer'] = array();

while(is_file($scdost.'\\scripts\\'.$scripts[$a])){
$content = file($scdost.'\\scripts\\'.$scripts[$a]);

if(!empty($content))
foreach($content as $data)
{

if(preg_match("/shopModule:addBuyableItem\(/",$data) == true){
$item['buy']['addBuyableItem'][] = preg_replace("/shopModule:addBuyableItem({'(.*)'}, (.*), (.*), '(.*)')/i", "$1.$2.$3", $data).', '.$scripts[$a];
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addBuyableItem').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}

if(preg_match("/shopModule:addSellableItem\(/",$data) == true){
$item['sell']['addSellableItem'][] = preg_replace("/shopModule:addSellableItem({'(.*)', '(.*)'}, (.*), (.*), '(.*)')/i", "$1.$2.$3.$4.$5", $data).', '.$scripts[$a];
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addSellableItem').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}

if(preg_match("/shopModule:addBuyableItemContainer\(/",$data) == true){
$item['buy']['addBuyableItemContainer'][] = preg_replace("/shopModule:addBuyableItemContainer({'(.*)'}, (.*), (.*), (.*), '(.*)')/i", "$1", $data).', '.$scripts[$a];
$data .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addBuyableItemContainer').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}


change_c($back_g,$bgcolor);
$a++;
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>[FILE: '.$a.'][ROW: '.$b.']'.$found.' '.$data.'</small></td></tr>';
$a--;
$found = "";
$b++;
$c++;
}

$a++;
$b = 0;
}


if(is_array($item['buy']['addBuyableItem'])){
$count['addBuyableItem'] = count($item['buy']['addBuyableItem']);

}
if(is_array($item['buy']['addSellableItem'])){
$count['addSellableItem'] = count($item['sell']['addSellableItem']);
}

if(is_array($item['buy']['addBuyableItemContainer'])){
$count['addBuyableItemContainer'] = count($item['buy']['addBuyableItemContainer']);
}



change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addBuyableItem'],'addBuyableItem').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addSellableItem'],'addSellableItem').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addBuyableItemContainer'],'addBuyableItemContainer').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['checked'],$c).'</small></td></tr>';

// Czas na sciecie.

$list = "";
if(!empty($item['buy']['addBuyableItem']))
foreach($item['buy']['addBuyableItem'] as $data){
//shopModule:addBuyableItem({'WYPOWIEDZ'}, ID, CENA, 'NAZWA')

$step = explode(', ', $data);
$id = $step[1];
$cena = $step[2];
$npc = $step[5];

$list['buy'][$id] = $cena;
$list['buy_npc'][$id] = $npc;
}
if(!empty($item['sell']['addSellableItem']))
foreach($item['sell']['addSellableItem'] as $data){
//shopModule:addSellableItem({'WYPOWIEDZ', 'WYPOWIEDZ'}, ID, CENA, 'NAZWA')

$step = explode(', ', $data);
$id = $step[2];
$cena = $step[3];
$npc = $step[5];

$list['sell'][$id] = $cena;
$list['sell_npc'][$id] = $npc;
}

if(!empty($item['buy']['addBuyableItemContainer']))
foreach($item['buy']['addBuyableItemContainer'] as $data){
$step = explode(', ', $data);
$id = $step[2];
$cena = $step[3] / 20;
$npc = $step[6];
$list['buy'][$id] = $cena;
$list['buy_npc'][$id] = $npc;
}

$errors_items = '';

if(!empty($list['buy']))
foreach($list['buy'] as $id => $price){
if($list['buy'][$id] < $list['sell'][$id] AND $list['buy'][$id] != 0){
change_c($back_g,$bgcolor);
$errors_items .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.sprintf($language[$lng]['error'],$id,$list['buy_npc'][$id],$list['buy'][$id],$list['sell_npc'][$id],$list['sell'][$id]).'</td></tr>';
}
}


if(!empty($errors_items)){
$main_content .= $errors_items;
}else{
$main_content .= $language[$lng]['no_erros'];
}
$main_content .= '</table>';

## DO NOT DELETE FOOTER! // NIE USUWAC STOPKI!
$main_content .= '<p align="right"><small>Scripted by <b><a href="http://mayu11.webd.pl">MappingFOR</a> [<a href="http://otland.net/members/mappingfor/">OTLand Profile</a>]</b>. I <font size="5">?</font> <a href="http://otland.net">OTLand.net</a></small></p>';
$main_content .= '<TABLE id="lua_report" BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] Lua raport</B></TD></TR>';
$main_content .= $lua_testing;
$main_content .= '</table>';
}
 
Last edited:
Well it checks only XML files :/


Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\adminpanel.php on line 334

332-339 lines
PHP:
$errors_items = '';

foreach($list['buy'] as $id => $price){
if($list['buy'][$id] < $list['sell'][$id] AND $list['buy'][$id] != 0){
change_c($back_g,$bgcolor);
$errors_items .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.sprintf($language[$lng]['error'],$id,$list['buy_npc'][$id],$list['buy'][$id],$list['sell_npc'][$id],$list['sell'][$id]).'</td></tr>';
}
}


Code:
[NEW] Lua Results
0 przedmiotów w typie 'addBuyableItem'.
0 przedmiotów w typie 'addSellableItem'.
0 przedmiotów w typie 'addBuyableItemContainer'.
Sprawdzono 0 linijek.



Well after update 2.2 i dont have error but your script still doesnt check lua files :/
Code:
[NEW] Lua Results
0 przedmiotów w typie 'addBuyableItem'.
0 przedmiotów w typie 'addSellableItem'.
0 przedmiotów w typie 'addBuyableItemContainer'.
Sprawdzono 0 linijek.
 
in XML NPCs i have always
Code:
script="data/npc/scripts/xxxx.lua"

for example:
Code:
<npc name="Alwin" script="data/npc/scripts/Alwin.lua" walkinterval="2000" floorchange="0">
 
Ah. know what happ.
Code:
<npc name="Alwin" script="data/npc/scripts/Alwin.lua" walkinterval="2000" floorchange="0">
Change for...
Code:
<npc name="Alwin" script="Alwin.lua" walkinterval="2000" floorchange="0">

I will fix that, but later.
 
LOL have I to change 551 files?
kidding80.jpg
 
2.3

* Propably fix that bug ^.^
* Fix "" obiect bug

Code:
/ You should know that IPT (all versions) are create
/ [B]ONLY FOR OtLand![/B] and if you want's to distribute it
/ [B]YOU MUST TO[/B] GIVE LINK TO OTLAND.NET, info
/ about author and optionally to his site/profile.
                            ~Thanks, MappingFOR



UPGRADE

Change all between
Code:
//NPC CHECK by MappingFOR  // www.mayu11.webd.pl // PL & EN
and
Code:
// END NPC CHECK
to

Code:
if($action == "npc_check_by_mappingfor") {

$language['en']['none'] = "NONE";
$language['en']['name'] = "Name";
$language['en']['script'] = "Script";
$language['en']['mod_off'] = "The shop module is off.";
$language['en']['error_none'] = "<font color=\"red\"><b>ERROR!</b></font> NPC which has switched shop module should have at least one item to buy or sell.";
$language['en']['errors'] = "Now, I'll show You errors ;]";
$language['en']['error'] = "<center><small>I can buy item %s from %s for %s and sell at %s for %s. I'd like it :D</small></center>";
$language['en']['added'] = "Added as '%s' type.";
$language['en']['iit'] = "%s items in '%s' type.";
$language['en']['checked'] = "%s rows checked.";
$language['en']['no_erros'] = "<small>Like no errors here ;[</small>";

$language['pl']['none'] = "BRAK";
$language['pl']['name'] = "Nazwa";
$language['pl']['script'] = "Skrypt";
$language['pl']['mod_off'] = "Moduł sklepu jest wyłączony.";
$language['pl']['error_none'] = "<font color=\"red\">BŁĄD!</font> NPC z włączonym modułem sklepu powinien posiadać przynajmniej jeden przedmiot do kupienia lub sprzedania.";
$language['pl']['errors'] = "Teraz pokaże Ci błędy ;]";
$language['pl']['error'] = "<center><small>Mogę kupić przedmiot %s u %s za %s i sprzedać u %s za %s. Lubię to :D</small></center>";
$language['pl']['added'] = "Dodane jako typ '%s'.";
$language['pl']['iit'] = "%s przedmiotów w typie '%s'.";
$language['pl']['checked'] = "Sprawdzono %s linijek.";
$language['pl']['no_erros'] = "<small>Wygląda na to, że nie ma tutaj błędów ;[</small>";



$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>Add Files</B></TD></TR>';
	// Magic cutting function by MappingFOR ("change_c($back_g,$bgcolor);" to use)
function change_c(&$back_g,&$bgcolor){
if(is_int($back_g / 2))
	$bgcolor = "#D4C0A1";
else
	$bgcolor = "#F1E0C6";
$back_g++;
}


if(isset($_GET['lng'])){$lng = $_GET['lng'];}else{$lng = 'pl';} // Change language
$scdost = $config['site']['server_path']."data/npc"; // data/npc Path

$a = 0;
$dir = opendir($scdost);

while(false !== ($file = readdir($dir)))
  if($file != '.' && $file != '..' && preg_match("([a-zA-Z0-9].xml)" , $file)){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>+ ['.$scdost.'/'.$file.']</small></td></tr>';
$npcs[$a] = $file;
$a++;
}
$b = 0;

/* "Teraz nastąpi dodanie wszystkich możliwych do kupiienia i sprzedania przedmiotów. " */

$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>Raport</B></TD></TR>';


while($b + 1 != $a){ // Sprawdzenie wszystkich plików 
$infoXML = simplexml_load_file(''.$scdost.'\\'.$npcs[$b].''); // Wczytanie piku XML do zbadania.

$npc['name'] = $infoXML[name]; // Pobranie nazwy NPC
$npc['script'] = $infoXML[script]; // Pobranie skryptu który obsługuje

if(empty($npc['script']))
{
$npc['script'] = '<b>'.$language[$lng]['none'].'</b>';
}
else
{
$scripts[] = $infoXML[script];
}// Wczytanie do ogólnej zmiennej}

## Pobranie wszystkich możliwych parametrów.
$z = 0;
while(isset($infoXML->parameters->parameter[$z][key])){
$npc['param'][''.$infoXML->parameters->parameter[$z][key].''] = $infoXML->parameters->parameter[$z][value];
$z++;
}


## Jeśli modół sklepu jest włączony to pobierz wszystkie przedmioty.
if($npc['param']['module_shop'] == 1){

if(isset($npc['param']['shop_sellable'])){
## Wpisanie wszystkich przedmiotów, które można sprzedać.
$npc['sell_able'] = $npc['param']['shop_sellable'];
$npc['sell_able_array'] = explode(';',$npc['sell_able']);
$npc['sell_count'] = count($npc['sell_able_array']);

$c = 0;
while($npc['sell_able_array'][$c] != ""){
$npc['sell_able_array_positions'][$c] = explode(',',$npc['sell_able_array'][$c]);
$c++;
}
## Wyświetlenie informacji o tym, że nie ma żadnego przedmiotu który można sprzedać.
}else{$npc['sell_count'] = "None";}

if(isset($npc['param']['shop_buyable'])){
## Wpisanie wszystkich przedmiotów, które można kupić.
$npc['buy_able'] = $npc['param']['shop_buyable'];
$npc['buy_able_array'] = explode(';',$npc['buy_able']);
$npc['buy_count'] = count($npc['buy_able_array']);

$c = 0;
while($npc['buy_able_array'][$c] != ""){
$npc['buy_able_array_positions'][$c] = explode(',',$npc['buy_able_array'][$c]);
$c++;
}
## Wyświetlenie informacji o tym, że nie ma żadnego przedmiotu który można kupić.
}else{$npc['buy_count'] = "None";}



## Wyświetlenie informacji o tym, że NPC ma włączony "module_shop", a nie posiada żadnego przedmiotu do kupienia lub sprzedaży.
if($npc['buy_count'] == "None" AND $npc['sell_count'] == "None"){
$npc['shop'] = "<br/>".$language[$lng]['error_none']."";
}else{
$npc['shop'] = '['.$npc['buy_count'].' b;s '.$npc['sell_count'].']';
}

}else{
## Wyświetlenie informacji o tym, że NPC ma wyłączony "module_shop".
$npc['shop'] = $language[$lng]['mod_off'];
}

## Wyświetlenie informacji o NPC (Nazwa, Skrypt, Ilość sprzedawanych;kupowanych rzeczy.
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.$language[$lng]['name'].': '.$npc['name'].'; '.$language[$lng]['script'].': '.$npc['script'].'; '.$npc['shop'].'</small></td></tr>';

## Wyświetlanie listy przedmiotów do kupienia i sprzedania.
$c = 0;

while($npc['sell_able_array_positions'][$c] != ""){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td> * * * * * * * * * * * *- <small>';
$main_content .= print_r($npc['sell_able_array_positions'][$c],true);
$main_content .= ' [SELLABLE]</small></td></tr>';
$list['sell'][$npc['sell_able_array_positions'][$c][1]] = $npc['sell_able_array_positions'][$c][2];
$list['sell_npc'][$npc['sell_able_array_positions'][$c][1]] = $npc['name'];
$c++;
}
$c = 0;
while($npc['buy_able_array_positions'][$c] != ""){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td> * * * * * * * * * * * *- <small>';
$main_content .= print_r($npc['buy_able_array_positions'][$c],true);
$main_content .= ' [BUYALBE]</small></td></tr>';
$list['buy'][$npc['buy_able_array_positions'][$c][1]] = $npc['buy_able_array_positions'][$c][2];
$list['buy_npc'][$npc['buy_able_array_positions'][$c][1]] = $npc['name'];
$c++;
}

$npc = null;
$b++;
}

if(!empty($list['buy'])){
foreach($list['buy'] as $id => $price){
if($list['buy'][$id] < $list['sell'][$id] AND $list['buy'][$id] != 0){
change_c($back_g,$bgcolor);
$errors_items .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.sprintf($language[$lng]['error'],$id,$list['buy_npc'][$id],$list['buy'][$id],$list['sell_npc'][$id],$list['sell'][$id]).'</td></tr>';
}
}
}

$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] XML Results</B></TD></TR>';

if(!empty($errors_items)){
$main_content .= $errors_items;
}else{
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.$language[$lng]['no_erros'].'</td></tr>';
}


$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] Lua Results</B></TD></TR>';

## LUA LOOKUP


$item = "";

$a = 0;
$b = 0;
$c = 0;


$item['buy']['addBuyableItem'] = array();
$item['sell']['addSellableItem'] = array();
$item['buy']['addBuyableItemContainer'] = array();

$dats = array();

foreach($scripts as $check){

if(preg_match("/scripts\//",$check)){
$dat = explode('scripts/',$check);
$dats[] = $dat[1];
}else{
$dats[] = $check;
}

}

while(is_file($scdost.'/scripts/'.$dats[$a])){

$content = file($scdost.'/scripts/'.$dats[$a]);

if(!empty($content))
foreach($content as $data)
{

if(preg_match("/shopModule:addBuyableItem\(/",$data) == true){
$item['buy']['addBuyableItem'][] = preg_replace("/shopModule:addBuyableItem({'(.*)'}, (.*), (.*), '(.*)')/i", "$1.$2.$3", $data).', '.$scripts[$a];
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addBuyableItem').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}

if(preg_match("/shopModule:addSellableItem\(/",$data) == true){
$item['sell']['addSellableItem'][] = preg_replace("/shopModule:addSellableItem({'(.*)', '(.*)'}, (.*), (.*), '(.*)')/i", "$1.$2.$3.$4.$5", $data).', '.$scripts[$a];
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addSellableItem').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}

if(preg_match("/shopModule:addBuyableItemContainer\(/",$data) == true){
$item['buy']['addBuyableItemContainer'][] = preg_replace("/shopModule:addBuyableItemContainer({'(.*)'}, (.*), (.*), (.*), '(.*)')/i", "$1", $data).', '.$scripts[$a];
$data .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addBuyableItemContainer').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}


change_c($back_g,$bgcolor);
$a++;
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>[FILE: '.$a.'][ROW: '.$b.']'.$found.' '.$data.'</small></td></tr>';
$a--;
$found = "";
$b++;
$c++;
}

$a++;
$b = 0;
}

if(is_array($item['buy']['addBuyableItem'])){
$count['addBuyableItem'] = count($item['buy']['addBuyableItem']);
}else{
$count['addBuyableItem'] = 0;
}


if(is_array($item['buy']['addSellableItem'])){
$count['addSellableItem'] = count($item['sell']['addSellableItem']);
}else{
$count['addSellableItem'] = 0;
}

if(is_array($item['buy']['addBuyableItemContainer'])){
$count['addBuyableItemContainer'] = count($item['buy']['addBuyableItemContainer']);
}else{
$count['addBuyableItemContainer'] = 0;
}



change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addBuyableItem'],'addBuyableItem').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addSellableItem'],'addSellableItem').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addBuyableItemContainer'],'addBuyableItemContainer').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['checked'],$c).'</small></td></tr>';

// Czas na ścięcie.

$list = "";
if(!empty($item['buy']['addBuyableItem']))
foreach($item['buy']['addBuyableItem'] as $data){
//shopModule:addBuyableItem({'WYPOWIEDŹ'}, ID, CENA, 'NAZWA')

$step = explode(', ', $data);
$id = $step[1];
$cena = $step[2];
$npc = $step[5];

$list['buy'][$id] = $cena;
$list['buy_npc'][$id] = $npc;
}
if(!empty($item['sell']['addSellableItem']))
foreach($item['sell']['addSellableItem'] as $data){
//shopModule:addSellableItem({'WYPOWIEDŹ', 'WYPOWIEDŹ'}, ID, CENA, 'NAZWA')

$step = explode(', ', $data);
$id = $step[2];
$cena = $step[3];
$npc = $step[5];

$list['sell'][$id] = $cena;
$list['sell_npc'][$id] = $npc;
}

if(!empty($item['buy']['addBuyableItemContainer']))
foreach($item['buy']['addBuyableItemContainer'] as $data){
$step = explode(', ', $data);
$id = $step[2];
$cena = $step[3] / 20;
$npc = $step[6];
$list['buy'][$id] = $cena;
$list['buy_npc'][$id] = $npc;
}

$errors_items = '';

if(!empty($list['buy']))
foreach($list['buy'] as $id => $price){
if($list['buy'][$id] < $list['sell'][$id] AND $list['buy'][$id] != 0){
change_c($back_g,$bgcolor);
$errors_items .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.sprintf($language[$lng]['error'],$id,$list['buy_npc'][$id],$list['buy'][$id],$list['sell_npc'][$id],$list['sell'][$id]).'</td></tr>';
}
}


if(!empty($errors_items)){
$main_content .= $errors_items;
}else{
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.$language[$lng]['no_erros'].'</td></tr>';
}
$main_content .= '</table>';

## DO NOT DELETE FOOTER! // NIE USUWAĆ STOPKI!
$main_content .= '<p align="right"><small>Scripted by <b><a href="http://mayu11.webd.pl">MappingFOR</a> [<a href="http://otland.net/members/mappingfor/">OTLand Profile</a>]</b>. I <font size="5">♥</font> <a href="http://otland.net">OTLand.net</a></small></p>';
$main_content .= '<TABLE id="lua_report" BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] Lua raport</B></TD></TR>';
$main_content .= $lua_testing;
$main_content .= '</table>';
}






INSTALL

Code:
<tr bgcolor='.$config['site']['lightborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_monsters">Reload Monsters</a></b></td><td><b>Load information about monsters from directory "your_server_path/data/monsters/". Delete old mosters configuration!</b></td></tr>
<tr bgcolor='.$config['site']['darkborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_spells">Reload Spells</a></b></td><td><b>Load information about spells from file "your_server_path/data/spells/spells.xml". Delete old spells configuration!</b></td></tr>

TO

Code:
<tr bgcolor='.$config['site']['lightborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_monsters">Reload Monsters</a></b></td><td><b>Load information about monsters from directory "your_server_path/data/monsters/". Delete old mosters configuration!</b></td></tr>
<tr bgcolor='.$config['site']['darkborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_spells">Reload Spells</a></b></td><td><b>Load information about spells from file "your_server_path/data/spells/spells.xml". Delete old spells configuration!</b></td></tr>
<tr bgcolor='.$config['site']['lightborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=npc_check_by_mappingfor&lng=pl">Check NPCs</a> [PL]</b></td><td><b>Sprawdzanie cen przedmiotów.</b></td></tr>
<tr bgcolor='.$config['site']['darkborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=npc_check_by_mappingfor&lng=en">Check NPCs</a> [EN]</b></td><td><b>Check items prices.</b></td></tr>
</table>';
}



//NPC CHECK by MappingFOR  // www.mayu11.webd.pl // PL & EN

if($action == "npc_check_by_mappingfor") {

$language['en']['none'] = "NONE";
$language['en']['name'] = "Name";
$language['en']['script'] = "Script";
$language['en']['mod_off'] = "The shop module is off.";
$language['en']['error_none'] = "<font color=\"red\"><b>ERROR!</b></font> NPC which has switched shop module should have at least one item to buy or sell.";
$language['en']['errors'] = "Now, I'll show You errors ;]";
$language['en']['error'] = "<center><small>I can buy item %s from %s for %s and sell at %s for %s. I'd like it :D</small></center>";
$language['en']['added'] = "Added as '%s' type.";
$language['en']['iit'] = "%s items in '%s' type.";
$language['en']['checked'] = "%s rows checked.";
$language['en']['no_erros'] = "<small>Like no errors here ;[</small>";

$language['pl']['none'] = "BRAK";
$language['pl']['name'] = "Nazwa";
$language['pl']['script'] = "Skrypt";
$language['pl']['mod_off'] = "Moduł sklepu jest wyłączony.";
$language['pl']['error_none'] = "<font color=\"red\">BŁĄD!</font> NPC z włączonym modułem sklepu powinien posiadać przynajmniej jeden przedmiot do kupienia lub sprzedania.";
$language['pl']['errors'] = "Teraz pokaże Ci błędy ;]";
$language['pl']['error'] = "<center><small>Mogę kupić przedmiot %s u %s za %s i sprzedać u %s za %s. Lubię to :D</small></center>";
$language['pl']['added'] = "Dodane jako typ '%s'.";
$language['pl']['iit'] = "%s przedmiotów w typie '%s'.";
$language['pl']['checked'] = "Sprawdzono %s linijek.";
$language['pl']['no_erros'] = "<small>Wygląda na to, że nie ma tutaj błędów ;[</small>";



$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>Add Files</B></TD></TR>';
	// Magic cutting function by MappingFOR ("change_c($back_g,$bgcolor);" to use)
function change_c(&$back_g,&$bgcolor){
if(is_int($back_g / 2))
	$bgcolor = "#D4C0A1";
else
	$bgcolor = "#F1E0C6";
$back_g++;
}


if(isset($_GET['lng'])){$lng = $_GET['lng'];}else{$lng = 'pl';} // Change language
$scdost = $config['site']['server_path']."data/npc"; // data/npc Path

$a = 0;
$dir = opendir($scdost);

while(false !== ($file = readdir($dir)))
  if($file != '.' && $file != '..' && preg_match("([a-zA-Z0-9].xml)" , $file)){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>+ ['.$scdost.'/'.$file.']</small></td></tr>';
$npcs[$a] = $file;
$a++;
}
$b = 0;

/* "Teraz nastąpi dodanie wszystkich możliwych do kupiienia i sprzedania przedmiotów. " */

$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>Raport</B></TD></TR>';


while($b + 1 != $a){ // Sprawdzenie wszystkich plików 
$infoXML = simplexml_load_file(''.$scdost.'\\'.$npcs[$b].''); // Wczytanie piku XML do zbadania.

$npc['name'] = $infoXML[name]; // Pobranie nazwy NPC
$npc['script'] = $infoXML[script]; // Pobranie skryptu który obsługuje

if(empty($npc['script']))
{
$npc['script'] = '<b>'.$language[$lng]['none'].'</b>';
}
else
{
$scripts[] = $infoXML[script];
}// Wczytanie do ogólnej zmiennej}

## Pobranie wszystkich możliwych parametrów.
$z = 0;
while(isset($infoXML->parameters->parameter[$z][key])){
$npc['param'][''.$infoXML->parameters->parameter[$z][key].''] = $infoXML->parameters->parameter[$z][value];
$z++;
}


## Jeśli modół sklepu jest włączony to pobierz wszystkie przedmioty.
if($npc['param']['module_shop'] == 1){

if(isset($npc['param']['shop_sellable'])){
## Wpisanie wszystkich przedmiotów, które można sprzedać.
$npc['sell_able'] = $npc['param']['shop_sellable'];
$npc['sell_able_array'] = explode(';',$npc['sell_able']);
$npc['sell_count'] = count($npc['sell_able_array']);

$c = 0;
while($npc['sell_able_array'][$c] != ""){
$npc['sell_able_array_positions'][$c] = explode(',',$npc['sell_able_array'][$c]);
$c++;
}
## Wyświetlenie informacji o tym, że nie ma żadnego przedmiotu który można sprzedać.
}else{$npc['sell_count'] = "None";}

if(isset($npc['param']['shop_buyable'])){
## Wpisanie wszystkich przedmiotów, które można kupić.
$npc['buy_able'] = $npc['param']['shop_buyable'];
$npc['buy_able_array'] = explode(';',$npc['buy_able']);
$npc['buy_count'] = count($npc['buy_able_array']);

$c = 0;
while($npc['buy_able_array'][$c] != ""){
$npc['buy_able_array_positions'][$c] = explode(',',$npc['buy_able_array'][$c]);
$c++;
}
## Wyświetlenie informacji o tym, że nie ma żadnego przedmiotu który można kupić.
}else{$npc['buy_count'] = "None";}



## Wyświetlenie informacji o tym, że NPC ma włączony "module_shop", a nie posiada żadnego przedmiotu do kupienia lub sprzedaży.
if($npc['buy_count'] == "None" AND $npc['sell_count'] == "None"){
$npc['shop'] = "<br/>".$language[$lng]['error_none']."";
}else{
$npc['shop'] = '['.$npc['buy_count'].' b;s '.$npc['sell_count'].']';
}

}else{
## Wyświetlenie informacji o tym, że NPC ma wyłączony "module_shop".
$npc['shop'] = $language[$lng]['mod_off'];
}

## Wyświetlenie informacji o NPC (Nazwa, Skrypt, Ilość sprzedawanych;kupowanych rzeczy.
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.$language[$lng]['name'].': '.$npc['name'].'; '.$language[$lng]['script'].': '.$npc['script'].'; '.$npc['shop'].'</small></td></tr>';

## Wyświetlanie listy przedmiotów do kupienia i sprzedania.
$c = 0;

while($npc['sell_able_array_positions'][$c] != ""){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td> * * * * * * * * * * * *- <small>';
$main_content .= print_r($npc['sell_able_array_positions'][$c],true);
$main_content .= ' [SELLABLE]</small></td></tr>';
$list['sell'][$npc['sell_able_array_positions'][$c][1]] = $npc['sell_able_array_positions'][$c][2];
$list['sell_npc'][$npc['sell_able_array_positions'][$c][1]] = $npc['name'];
$c++;
}
$c = 0;
while($npc['buy_able_array_positions'][$c] != ""){
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td> * * * * * * * * * * * *- <small>';
$main_content .= print_r($npc['buy_able_array_positions'][$c],true);
$main_content .= ' [BUYALBE]</small></td></tr>';
$list['buy'][$npc['buy_able_array_positions'][$c][1]] = $npc['buy_able_array_positions'][$c][2];
$list['buy_npc'][$npc['buy_able_array_positions'][$c][1]] = $npc['name'];
$c++;
}

$npc = null;
$b++;
}

if(!empty($list['buy'])){
foreach($list['buy'] as $id => $price){
if($list['buy'][$id] < $list['sell'][$id] AND $list['buy'][$id] != 0){
change_c($back_g,$bgcolor);
$errors_items .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.sprintf($language[$lng]['error'],$id,$list['buy_npc'][$id],$list['buy'][$id],$list['sell_npc'][$id],$list['sell'][$id]).'</td></tr>';
}
}
}

$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] XML Results</B></TD></TR>';

if(!empty($errors_items)){
$main_content .= $errors_items;
}else{
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.$language[$lng]['no_erros'].'</td></tr>';
}


$main_content .= '</table><br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] Lua Results</B></TD></TR>';

## LUA LOOKUP


$item = "";

$a = 0;
$b = 0;
$c = 0;


$item['buy']['addBuyableItem'] = array();
$item['sell']['addSellableItem'] = array();
$item['buy']['addBuyableItemContainer'] = array();

$dats = array();

foreach($scripts as $check){

if(preg_match("/scripts\//",$check)){
$dat = explode('scripts/',$check);
$dats[] = $dat[1];
}else{
$dats[] = $check;
}

}

while(is_file($scdost.'/scripts/'.$dats[$a])){

$content = file($scdost.'/scripts/'.$dats[$a]);

if(!empty($content))
foreach($content as $data)
{

if(preg_match("/shopModule:addBuyableItem\(/",$data) == true){
$item['buy']['addBuyableItem'][] = preg_replace("/shopModule:addBuyableItem({'(.*)'}, (.*), (.*), '(.*)')/i", "$1.$2.$3", $data).', '.$scripts[$a];
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addBuyableItem').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}

if(preg_match("/shopModule:addSellableItem\(/",$data) == true){
$item['sell']['addSellableItem'][] = preg_replace("/shopModule:addSellableItem({'(.*)', '(.*)'}, (.*), (.*), '(.*)')/i", "$1.$2.$3.$4.$5", $data).', '.$scripts[$a];
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addSellableItem').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}

if(preg_match("/shopModule:addBuyableItemContainer\(/",$data) == true){
$item['buy']['addBuyableItemContainer'][] = preg_replace("/shopModule:addBuyableItemContainer({'(.*)'}, (.*), (.*), (.*), '(.*)')/i", "$1", $data).', '.$scripts[$a];
$data .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['added'],'addBuyableItemContainer').'</small></td></tr>';
$found = '<font color="green">[V]</font>';
}


change_c($back_g,$bgcolor);
$a++;
$lua_testing .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>[FILE: '.$a.'][ROW: '.$b.']'.$found.' '.$data.'</small></td></tr>';
$a--;
$found = "";
$b++;
$c++;
}

$a++;
$b = 0;
}

if(is_array($item['buy']['addBuyableItem'])){
$count['addBuyableItem'] = count($item['buy']['addBuyableItem']);
}else{
$count['addBuyableItem'] = 0;
}


if(is_array($item['buy']['addSellableItem'])){
$count['addSellableItem'] = count($item['sell']['addSellableItem']);
}else{
$count['addSellableItem'] = 0;
}

if(is_array($item['buy']['addBuyableItemContainer'])){
$count['addBuyableItemContainer'] = count($item['buy']['addBuyableItemContainer']);
}else{
$count['addBuyableItemContainer'] = 0;
}



change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addBuyableItem'],'addBuyableItem').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addSellableItem'],'addSellableItem').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['iit'],$count['addBuyableItemContainer'],'addBuyableItemContainer').'</small></td></tr>';
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td><small>'.sprintf($language[$lng]['checked'],$c).'</small></td></tr>';

// Czas na ścięcie.

$list = "";
if(!empty($item['buy']['addBuyableItem']))
foreach($item['buy']['addBuyableItem'] as $data){
//shopModule:addBuyableItem({'WYPOWIEDŹ'}, ID, CENA, 'NAZWA')

$step = explode(', ', $data);
$id = $step[1];
$cena = $step[2];
$npc = $step[5];

$list['buy'][$id] = $cena;
$list['buy_npc'][$id] = $npc;
}
if(!empty($item['sell']['addSellableItem']))
foreach($item['sell']['addSellableItem'] as $data){
//shopModule:addSellableItem({'WYPOWIEDŹ', 'WYPOWIEDŹ'}, ID, CENA, 'NAZWA')

$step = explode(', ', $data);
$id = $step[2];
$cena = $step[3];
$npc = $step[5];

$list['sell'][$id] = $cena;
$list['sell_npc'][$id] = $npc;
}

if(!empty($item['buy']['addBuyableItemContainer']))
foreach($item['buy']['addBuyableItemContainer'] as $data){
$step = explode(', ', $data);
$id = $step[2];
$cena = $step[3] / 20;
$npc = $step[6];
$list['buy'][$id] = $cena;
$list['buy_npc'][$id] = $npc;
}

$errors_items = '';

if(!empty($list['buy']))
foreach($list['buy'] as $id => $price){
if($list['buy'][$id] < $list['sell'][$id] AND $list['buy'][$id] != 0){
change_c($back_g,$bgcolor);
$errors_items .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.sprintf($language[$lng]['error'],$id,$list['buy_npc'][$id],$list['buy'][$id],$list['sell_npc'][$id],$list['sell'][$id]).'</td></tr>';
}
}


if(!empty($errors_items)){
$main_content .= $errors_items;
}else{
change_c($back_g,$bgcolor);
$main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td>'.$language[$lng]['no_erros'].'</td></tr>';
}
$main_content .= '</table>';

## DO NOT DELETE FOOTER! // NIE USUWAĆ STOPKI!
$main_content .= '<p align="right"><small>Scripted by <b><a href="http://mayu11.webd.pl">MappingFOR</a> [<a href="http://otland.net/members/mappingfor/">OTLand Profile</a>]</b>. I <font size="5">♥</font> <a href="http://otland.net">OTLand.net</a></small></p>';
$main_content .= '<TABLE id="lua_report" BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=80% style="border: 1px solid black;margin: 0px auto;"><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=1 CLASS=white><B>[NEW] Lua raport</B></TD></TR>';
$main_content .= $lua_testing;
$main_content .= '</table>';
}
// END NPC CHECK
 
now it loads all xml and lua files but id doesnt show results...

only something like that
Code:
[FILE: 394][ROW: 26]
[FILE: 394][ROW: 27] talk_state = 0
[FILE: 394][ROW: 28] end
[FILE: 394][ROW: 29] -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
[FILE: 394][ROW: 30] return true
[FILE: 394][ROW: 31] end
[FILE: 394][ROW: 32]
[FILE: 394][ROW: 33]
[FILE: 394][ROW: 34] npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
[FILE: 394][ROW: 35] npcHandler:addModule(FocusModule:new())

no results with errors :/
 
I found error.

I wrote for test
Code:
shopModule:addSellableItem({'health potion'}, 7618, 99999, 1, 'health potion')


but your script shows:
Code:
0 items in 'addSellableItem' type.
 
and wtf? for example :
500 people on one time check a items and what? less comp stand.
 
Code:
shopModule:addSellableItem({'health potion'}, 7618, 99999, 1, 'health potion')
Items usually have double name.
Write:
Code:
shopModule:addSellableItem({'health potion', 'hpp'}, 7618, 99999, 1, 'health potion')
 
Back
Top