Quote:
Originally Posted by hel
Guaresnay:
1. why you're getting itemnames through sql and not simply parse item_pch?
Code:
foreach(file("item_pch.txt") as $iitem){
str_replace(array("\xFF\xFE","\x00"),"",trim($iitem));
$iitem=str_replace(array(" ","\t"),"",$iitem);
$eitem=explode("=",$iitem);
$itemids[($eitem[1])]=str_replace(array("[","]"),"",$eitem[0]);
}
// after that you may use for example $itemids[1], it returns short_sword.
as you see, there is many citizen classes. why not set as there:
Code:
function get_type($type){
switch($type){
...
default:
$type="citizen";break; //every case need to break, or switch will continue from begining, you forgot about it.
}
return $type;
}
the $type=$type is wrong. it will cause l2server parsing problems.
|
1.- I've tested both ways and for some reason parsing the txt file takes longer, so I chose the sql one.
2.- Yeh I'll change the default to 'citizen', my bad. Are you sure the default case also need the "break;"? I though switch wasn't iterative, so it doesnt continue from begining...