Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 07.07.2007, 22:52   #1
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

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.
hel is offline  
Old 07.07.2007, 23:11   #2
Guaresnay
Архивный участник
 
Join Date: Oct 2005
Posts: 113
Default

Quote:
Originally Posted by hel View Post
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...
Guaresnay is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 16:58.