Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 16.12.2005, 12:36   #1
Digital
Архивный участник
 
Join Date: Nov 2004
Posts: 1,405
Default Some random code [rumblings... dun mind me :p]

all these code doesnt belong to me... i just pasted them here in case there's need for it in the future.

import java.io.*;
import java.util.*;
import java.text.NumberFormat;
import java.text.DecimalFormat;

public class Class1 extends Thread {
public int DELAY = 25;

public void run(){
try { Thread.sleep(DELAY); }
catch (InterruptedException e){
System.out.println("ERROR: Thread Sleeping unfunctionable");
}

}
public Class1(int count,String name, int pos_x,int pos_y,int pos_z,int pos_w){
int a,b,c,d,e,f;
a = pos_x - 100;
b = pos_x + 100;

c = pos_y - 100;
d = pos_y + 100;

e = pos_z - 100;
f = pos_z + 100;
String line = "territory_begin\t[Heine_NPC_"+count+"]\t{"
+ "{" + a + ";" + c + ";" + e + ";" + f + "};"
+ "{" + b + ";" + c + ";" + e + ";" + f + "};"
+ "{" + b + ";" + d + ";" + e + ";" + f + "};"
+ "{" + a + ";" + d + ";" + e + ";" + f + "}"
+ "}\tterritory_end\n"
+ "npcmaker_begin\t[Heine_NPC_" + +count+"]"
+ " \tinitial_spawn = all\tmaximum_npc = 1\n"
+ "npc_begin\t" + name + "\tpos = "
+ "{" + pos_x + ";" + pos_y + ";" + pos_z + ";" + pos_w + "}"
+ "\ttotal = 1\trespawn = 1min\tnpc_end\n"
+ "npcmaker_end\n";

try{
PrintWriter out = new PrintWriter(new FileWriter("npcpos.txt",true));
out.println(line);
out.close();
} catch (FileNotFoundException ee) {
System.out.println("Error: Cannot open file for writing.");
} catch (IOException ee) {
System.out.println("Error: Cannot write to file.");
}
}

public static void main (String args []) {

String aFileName = "npc.txt";

try{

BufferedReader in = new BufferedReader(new FileReader(aFileName));
String line = null;
int i = 0;
NumberFormat formatter = new DecimalFormat("1000000");
while ((line = in.readLine()) != null) {
String name, a,b,c,d;
i ++;
int pos_a,pos_b,pos_c,pos_d;
StringTokenizer words = new StringTokenizer(line,";");
try{
//7890;[trader_espen];[??];[???];115797;217696;-3579;16384;
words.nextToken();
name = words.nextToken();
words.nextToken();
words.nextToken();
a = words.nextToken();//115797
b = words.nextToken();//217696
c = words.nextToken();//-3579
d = words.nextToken();//-3579
Integer tmp = new Integer(a);
pos_a = tmp.intValue();
tmp = new Integer(b);
pos_b = tmp.intValue();
tmp = new Integer(c);
pos_c = tmp.intValue();
tmp = new Integer(d);
pos_d = tmp.intValue();

new Class1(i,name,pos_a,pos_b,pos_c,pos_d).start();
}catch (NoSuchElementException e){
System.out.println(e);
}
try { Thread.sleep(25); }
catch (InterruptedException e){
System.out.println("ERROR: Thread Sleeping unfunctionable");
}
}

} catch (FileNotFoundException e) {
System.out.println("Error: Cannot find the file");
} catch (IOException e) {
System.out.println("Error: Cannot load the file.");
}

}

}


--------------------

id npc_name nick name locx locy locz heading
7890 [trader_espen] [??] [???] 115797 217696 -3579 16384
7891 [trader_verona] [??] [???] 115937 217850 -3582 33584
7892 [trader_enverun] [??] [???] 107084 216676 -3594 14904
7893 [trader_payel] [??] [??] 107138 216678 -3594 13666
7894 [warehouse_chief_natools] [???????] [???] 109617 220159 -3514 946
7895 [warehouse_keeper_kluck] [??????????] [???] 109614 220098 -3514 65536
7896 [warehouse_keeper_mia] [?????] [??] 109615 220232 -3515 65014
7897 [head_blacksmith_roman] [????] [??] 108004 218972 -3653 45796
7898 [blacksmith_morning] [??] [??] 107765 218739 -3659 14326
7899 [gatekeeper_flauen] [???] [???] 111386 219394 -3546 49449
7900 [grandmaster_marcus] [??] [???] 113730 218423 -3625 65281
7901 [master_arti] [??] [??] 113911 218591 -3625 48351
7902 [master_karuna] [??] [???] 114365 218250 -3625 17865
7903 [master_traus] [??] [????] 114239 219445 -3625 49152
7904 [master_naiel] [??] [???] 114206 219126 -3631 65536
7905 [highpriest_squillari] [???] [????] 111387 216803 -3458 16963
7906 [priest_ranton] [??] [??] 111225 217001 -3459 65014
7907 [magister_minevia] [??] [????] 111228 217233 -3459 868
7908 [priest_tanios] [??] [????] 111550 217136 -3458 35000
7909 [magister_anabel] [??] [???] 111546 217377 -3459 30710
7910 [grandmaster_xairakin] [??] [????] 115897 219909 -3627 30567
7912 [magister_xenovia] [??] [????] 115603 220259 -3627 57956
7913 [high_prefect_tushku] [???] [???] 107521 221029 -3614 49441
7914 [prefect_sorbo] [??] [??] 107453 220962 -3613 65536
7915 [seer_takina] [???] [???] 107465 220886 -3614 3539
7916 [captain_gosta] [????] [???] 106917 218035 -3675 65536
7917 [guard_duphis] [??] [???] 106920 218282 -3675 64735
7920 [guard_kraisen] [??] [???] 106948 218048 -3675 781
7921 [guard_timos] [??] [???] 106949 218282 -3675 63813
7924 [wharf_manager_nedy] [?????] [??] 112042 225479 -3625 39479

------------------

import java.io.*;
import java.util.*;
import java.lang.*;

public class L2MapGen {

private ArrayList predata;
private int[] rawdata;
private int[][] geodata;
private ArrayList rbglist;
public int MAP_HEIGHT_TABLE[] = {
//38-3F
(0xE318E318), (0xE46DE46D), (0xE5C2E5C2), (0xE717E717),
(0xE86CE86C), (0xE9C1E9C1), (0xEB16EB16), (0xec6bec6b),
//40-4f
/*
3907905773 E8EDE8ED
- 3505246445 D0EDD0ED
------------------------
0402659328 18001800
*/
(0xD0EDD0ED), (0xE8EDE8ED), (0xf06af06a), (0xf1bff1bf),
(0xf314f314), (0xf469f469), (0xf5bef5be), (0xf713f713),
(0xf868f868), (0x10EB10EB), (0xD8EBD8EB), (0xA0ECA0EC),
(0x68ED68ED), (0xECEEECEE), (0x48EF48EF), (0xA4EFA4EF),
//50-5f
(0x00F000F0), (0x5CF05CF0), (0xB8F0B8F0), (0x14F114F1),
(0x70F170F1), (0xCCF1CCF1), (0x28F228F2), (0x76F276F2),
(0xDAF2DAF2), (0x2DF52DF5), (0x91F591F5), (0xD1F5D1F5),
(0x6EF66EF6), (0x41F541F5), (0x29F629F6), (0x17F717F7),
//60-6f
(0x49F749F7), (0x7BF77BF7), (0xADF7ADF7), (0xDFF7DFF7),
(0x11F811F8), (0x75F875F8), (0xD9F8D9F8), (0x3DF93DF9),

(0x9CF99CF9), (0xCEF9CEF9), (0x37FA37FA), (0x27082708),
(0xA1F9A1F9), (0x05FA05FA), (0x88FA88FA), (0xECFAECFA),
//70-7f
(0x50FB50FB),(0xB4FBB4FB),(0x18FC18FC),(0x7CFC7CFC ),
(0xE0FCE0FC),(0x44FD44FD),(0xA8FDA8FD),(0x0CFE0CFE ),
(0x70FE70FE),(0xD4FED4FE),(0x38FF38FF),(0x9CFF9CFF ),
(0x04010401),(0x68016801),(0xCC01CC01),(0x30203002 ),
//(0x2db12db1), (0x2f062f06), (0x305b305b), (0x31b031b0),
//(0x33053305), (0x345a345a), (0x35af35af), (0x37043704),
//(0x38593859), (0x39ae39ae), (0x3b033b03), (0x3c583c58),
//(0x3dad3dad), (0x3f023f02), (0x40574057), (0x41ac41ac),
//80-8f
(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE ),
(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE ),
(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE ),
(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE ),
//(0x43014301), (0x44564456), (0x45ab45ab), (0x47004700),
//(0x48554855), (0x49aa49aa), (0x4aff4aff), (0x4c544c54),
//(0x4da94da9), (0x4efe4efe), (0x50535053), (0x51a851a8),
//(0x52fd52fd), (0x54525452), (0x55a755a7), (0x56fc56fc),
//90-9f
(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE ),
(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE ),
(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE ),
(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE ),
//(0x58515851), (0x59a659a6), (0x5afb5afb), (0x5c505c50),
//(0x5da55da5), (0x5efa5efa), (0x604f604f), (0x61a461a4),
//(0x62f962f9), (0x644e644e), (0x65a365a3), (0x66f866f8),
//(0x684d684d), (0x69a269a2), (0x6af76af7), (0x6c4c6c4c),
//a0-a5
(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE),(0xC0DEC0DE ),
(0xC0DEC0DE),(0xC0DEC0DE)
//(0x6da16da1), (0x6ef66ef6), (0x704b704b), (0x71a071a0),
//(0x72F572F5), (0x744A744A)
};
public int RGB_TABLE[] = {
56,57,58,59,60,61,62,63,

64,65,66,67,68,69,70,71,
72,73,74,75,76,77,78,79,

80,81,82,83,84,85,86,87,
88,89,90,91,92,93,94,95,

96,97,98,99,100,101,102,103,
104,105,106,107,108,109,110,

111,112,113,114,115,116,117,118,
119,120,121,122,123,124,125,126,

127,128,129,130,131,132,133,134,
135,136,137,138,139,140,141,142,

143,144,145,146,147,148,149,150,
151,152,153,154,155,156,157,158,

159,160,161,162,163,164,165
};
public L2MapGen() {
rawdata = new int[65536];
predata = new ArrayList();
geodata = new int[256][256];
rbglist = new ArrayList();
}
public int tras(int[] arr){
boolean nofound = true;
for (int i = 0; i < 110; i++){
if (Math.abs(arr[0]) == RGB_TABLE[i]){
if (!rbglist.contains(new Integer(Math.abs(arr[0])))) rbglist.add(new Integer(Math.abs(arr[0])));
return MAP_HEIGHT_TABLE[i];
}else{
nofound = true;
}
}
if (nofound){
System.out.println( "TABLE ERR: {" + arr[0] + "," + arr[1] + ","+ arr[2] + "}" );
}
return 0xEDD0EDD0;
}
void CoordTrans(){
for (int i = 0; i < 256; i++){
for (int j = 0; j < 256; j++){
geodata[i][j] = rawdata[j*256+i];
}
}
System.out.println( "CoordTrans() DONE" );
}
void dataFetch(){
FileInputStream fis;
DataInputStream dis;

try {
fis = new FileInputStream("t_25_17.utx-Height.25_17(Texture)_0.BMP");
dis = new DataInputStream( fis );
int[] rawRBG = {0,0,0};
int group = 0, c = 0;
while ( true ) {
rawRBG[0] = dis.readByte();
rawRBG[1] = dis.readByte();
rawRBG[2] = dis.readByte();
group++;
if (group > 1{
rawdata[c] = tras(rawRBG);
c++;
}
}
} catch (EOFException eof) {}
catch (IOException ioe) {}

System.out.println( "dataFetch() DONE" );
}

void geoDataOutput(){
FileOutputStream fos;
DataOutputStream ds;
try {
fos = new FileOutputStream("25_17_conv.dat");
ds = new DataOutputStream( fos );
for (int i = 0; i < 256; i++){
for (int j = 0; j < 256; j++){
writeStr(ds,geodata[i][j]);
}
}
} catch (IOException ioe) {}
System.out.println( "geoDataOutput() DONE" );
}
void writeStr(DataOutputStream ds, int value){
try {
ds.writeByte(0x00);
ds.writeByte(0x00);
ds.writeInt(value);
} catch (IOException ioe) {}
}
void printOutRGBList(){
Object [] arr = rbglist.toArray();
Arrays.sort(arr);
for (int i = 0; i < arr.length; i++){
System.out.println( arr[i] );
}
}
public static void main(String f[]) {
L2MapGen aGener = new L2MapGen();
aGener.dataFetch();
aGener.CoordTrans();
aGener.geoDataOutput();
aGener.printOutRGBList();
}
}
Digital is offline  
Old 16.12.2005, 18:48   #2
greenhope
Архивный участник
 
Join Date: Sep 2005
Posts: 27
Default

First program is convert spawnlist in l2j to l2off.
Second program is convert point node in l2j to l2off geodata map.

Dunno if it work...
greenhope is offline  
 


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 15:57.