• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Delete.

Ezzz

Developer of Nostalrius and The Violet Project
Joined
Feb 26, 2010
Messages
1,889
Solutions
3
Reaction score
794
Location
Spain, Europe
I LOST THE PROJECT FILES, MY HARD DRIVE BURNED.


Yes, as the title says.

I'll be trying to program a Tibia NPCs converter to OT format.

Everything is done in C#

Base code for converting very first lines of the NPC, only obtains NPC Name, walk radius, and outfit.

All code is copied because of noobs. Add 2 richedit components, name one "toConvert" and the other one "Converted".

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;

namespace TibiaConverterGUI
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Match match;
            Regex rx;

            List<string> Script = new List<string>();

            int lines = toConvert.GetLineFromCharIndex(Int32.MaxValue);

            // XML File
            for (int i = 0; i <= lines; i++)
            {
                string temp = "";
                // Name
                if (i == 3)
                {
                    rx = new Regex("Name = \"(.*?)\"");
                    string name = rx.Match(toConvert.Lines[i]).Groups[1].Value;

                    // walk radius
                    rx = new Regex("Radius = (.*)");
                    string radius = rx.Match(toConvert.Lines[i+5]).Groups[1].Value;

                    temp = "<npc name=\"" + name + "\" script=\"" + name + ".lua\" walkinterval=\"2000\" walkradius=\"" + radius + "\">";
                    Script.Add(temp);
                }
                // Outfit
                if (i == 6)
                {
                    rx = new Regex("Outfit = (.)(.*?),(.*?)-(.*?)-(.*?)-(.*)(.)");
                    temp = "\t<look type=\"" + rx.Match(toConvert.Lines[i]).Groups[2].Value + "\" head=\"" + rx.Match(toConvert.Lines[i]).Groups[3].Value + "\" body=\"" + rx.Match(toConvert.Lines[i]).Groups[4].Value + "\" legs=\"" + rx.Match(toConvert.Lines[i]).Groups[5].Value + "\" feet=\"" + rx.Match(toConvert.Lines[i]).Groups[6].Value + "\"/>";
                    Script.Add(temp);
                }
                if (i == 11)
                {
                    Script.Add("</npc>");
                }
            }

            Converted.Lines = Script.ToArray();
        }
    }
}

Example XML:

Code:
<npc name="Azil" script="Azil.lua" walkinterval="2000" walkradius="0">
    <look type="129" head="95" body="10" legs="12" feet="119"/>
</npc>

- - - Updated - - -

Quick Update:

I've completed the Tibia.Wikia NPC Converter! Shop, Dialog and Voices converter is 100% completed.
I'll add the code and download tomorrow at Tools Forum.

Edit: Creating GUI interface for Tibia.wikia npc converter.
 
Last edited:
Back
Top