Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Server Modifications ONLY!
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 19.08.2006, 03:43   #1
astrid
Архивный участник
 
Join Date: May 2006
Posts: 55
Default AI ch to eng quest name auto translator

Written in lack of time. will work long time (very unoptimised algoritm, i too lazy to rewrite) and not 100% accurate becouse some quest names are different. But result better than emty strings in quest selection. also you must do search&replace for (in progress) string.

usage: in C:\ai\ put your ai and 2 txt files from pack. start software and wait about 1.5 hour . in c:\ will be generated fixed ai.

rapid:http://rapidshare.de/files/29937170/aifixer.rar.html

have fun

Code:
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;

namespace ConsoleApplication3
{
	public class Class1
	{
		public static void Main() 
		{
			string[] AIArray=new string[4566333];		
			string path = @"c:\ai\ai.obj";
			using (StreamReader sr = new StreamReader(path)) 
			{
				String line;
				int i=0;
				Console.WriteLine("Loading AI...");
				while ((line = sr.ReadLine()) != null) 
				{
					AIArray[i++]=line;
				}
				Console.WriteLine("Loading AI finished...");
			}

			string pathEN = @"c:\ai\QuestName-e.txt";
			using (StreamReader sr = new StreamReader(pathEN)) 
			{
				String line;
				string[] elements;
				string buff="";
				while ((line = sr.ReadLine()) != null) 
				{
					elements=line.Split("	".ToCharArray());
					if (buff!=elements[3])
					{
						buff=elements[3];
						string result=elements[3].Substring(7).TrimEnd("]".ToCharArray());
						string source=GetCN(elements[1]).Substring(7).TrimEnd("]".ToCharArray());
						
						//InAI(source,result);
						int i=0;
						foreach (string linei in AIArray) 
						{
							if (AIArray[i]!=null)
							{
								if (Regex.IsMatch(AIArray[i],source))
								{
									AIArray[i]=Regex.Replace(AIArray[i],source,result);
								}
							}
							++i;
						}
						Console.WriteLine("--- Quest "+elements[1]+" done ---");
					}
				}
				//array to file
				Console.WriteLine("Dumping fixed AI to file...");
				FileStream fs=new FileStream("c:\\ai-fixed.txt", FileMode.Append, FileAccess.Write, FileShare.Write);
				fs.Close();
				StreamWriter sw=new StreamWriter("c:\\ai-fixed.txt", true, Encoding.Unicode);
				foreach (string linei in AIArray) 
				{
					sw.WriteLine(linei);
				}
				sw.Close();
				Console.WriteLine("Done.");
			}
		}
		public static string GetCN(string id) 
		{
			string pathCN = @"c:\ai\QuestName-cn.txt";
			using (StreamReader sr = new StreamReader(pathCN)) 
			{
				String line;
				string[] elements;
				while ((line = sr.ReadLine()) != null) 
				{
					elements=line.Split("	".ToCharArray());
					if (elements[1]==id)
					{
						return elements[3];
					}
				}
				return id;
			}
		}
	}
}
astrid is offline  
Old 19.08.2006, 03:49   #2
darkwire
Архивный участник
 
Join Date: Aug 2006
Posts: 9
Default

thanks too testing
darkwire is offline  
Old 19.08.2006, 05:29   #3
czar
Архивный участник
 
Join Date: Oct 2005
Posts: 41
Default

as of this moment ur ai must be 4566333 lines, or ull crash out like i was.

i think astrid is going to ul his ai, or u can change the value and recompile with the source.

just an fyi if ur crashing
czar is offline  
Old 19.08.2006, 05:56   #4
Sakumi
Архивный участник
 
Join Date: Apr 2005
Posts: 555
Default

You're awsome
Sakumi is offline  
Old 23.08.2006, 09:47   #5
IVB
Архивный участник
 
Join Date: Jan 2006
Posts: 79
Default

Completely rewritten on php with different algorithm. Runs abut 5 minutes on P4 1.5GHz. Unpack archive into any dir, put ai.obj in same dir and run aitrans.php (tested on php 5.1.1). Replaces chinese quest names to english, also replaces "In Progress" and "Completes" from chinese to english. Has no limitations on number of lines in ai.obj.

Resulting file ai.obj.fixed creates in same dir.

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
questfix.rar — 261979 байт
IVB is offline  
Old 26.08.2006, 02:09   #6
rodier
Архивный участник
 
Join Date: May 2005
Posts: 979
Default

hmm.. tried IE/FF on dual xeon 3.0ghz in x64bit os .. not working ;(
it took 3 mins to "done" [show in browser].. but nothing.. no new file..

(I tried the questfix.rar)

php 5.1.4 / apache 2.0.58

the first .exe tool dont work because our ai too long
rodier is offline  
Old 26.08.2006, 09:02   #7
werstein
Архивный участник
 
Join Date: Apr 2006
Posts: 105
Default

Change php.ini (max script execution time + memory for script)
werstein is offline  
Old 26.08.2006, 09:23   #8
IVB
Архивный участник
 
Join Date: Jan 2006
Posts: 79
Default

Quote:
Originally Posted by rodier View Post
hmm.. tried IE/FF on dual xeon 3.0ghz in x64bit os .. not working ;(
it took 3 mins to "done" [show in browser].. but nothing.. no new file..

(I tried the questfix.rar)

php 5.1.4 / apache 2.0.58

the first .exe tool dont work because our ai too long
You don't need run it under Apache! Just run it from commandline:

php.exe aitrans.php

IVB 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 22:10.