![]() |
|
|
#1 |
|
Архивный участник
Join Date: May 2006
Posts: 55
|
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;
}
}
}
}
|
|
|
|
|
#2 |
|
Архивный участник
Join Date: Aug 2006
Posts: 9
|
thanks too
testing
|
|
|
|
|
#3 |
|
Архивный участник
Join Date: Oct 2005
Posts: 41
|
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 |
|
|
|
|
#4 |
|
Архивный участник
Join Date: Apr 2005
Posts: 555
|
You're awsome
|
|
|
|
|
#5 |
|
Архивный участник
Join Date: Jan 2006
Posts: 79
|
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 байт |
|
|
|
|
#6 |
|
Архивный участник
Join Date: May 2005
Posts: 979
|
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 |
|
|
|
|
#7 |
|
Архивный участник
Join Date: Apr 2006
Posts: 105
|
Change php.ini (max script execution time + memory for script)
|
|
|
|
|
#8 | |
|
Архивный участник
Join Date: Jan 2006
Posts: 79
|
Quote:
php.exe aitrans.php
|
|
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|