mob_drop_item.txt mob - item ismilerini yanına yazssın

  • Konuyu açan Konuyu açan emrahdmr47
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 1
  • Gösterim Gösterim 442

emrahdmr47

MT Üye
MT Üye
Mesaj
233
Çözümler
8
Beğeni
83
Puan
479
Ticaret Puanı
0
Alttaki kodu itemname.py olarak kaydedin
itemname.py
item_names.txt
mob_names.txt
mob_drop_item.txt
aynı klasörde olsun itemname.py calıstırın

mobname itemname ekler:
Genişlet Daralt Kopyala
import re, os

def load_item_names(item_names_filename):
    item_names = {}
    with open(item_names_filename, "r", encoding="windows-1254") as f:
        for line in f:
            line = line.strip()
            if not line or line.startswith("VNUM"):
                continue
            parts = line.split("\t")
            if len(parts) < 2:
                parts = line.split()
                if len(parts) < 2:
                    continue
                vnum = parts[0]
                name = " ".join(parts[1:])
            else:
                vnum = parts[0]
                name = parts[1].strip()
            item_names[vnum] = name
    return item_names

def load_mob_names(mob_names_filename):
    mob_names = {}
    with open(mob_names_filename, "r", encoding="windows-1254") as f:
        for line in f:
            line = line.strip()
            if not line or line.startswith("VNUM"):
                continue
            parts = line.split("\t")
            if len(parts) < 2:
                parts = line.split()
                if len(parts) < 2:
                    continue
                vnum = parts[0]
                name = " ".join(parts[1:])
            else:
                vnum = parts[0]
                name = parts[1].strip()
            mob_names[vnum] = name
    return mob_names

def annotate_mob_drop_items(mob_drop_filename, item_names, mob_names, output_filename):
    with open(mob_drop_filename, "r", encoding="windows-1254") as fin, open(output_filename, "w", encoding="windows-1254") as fout:
        current_mob_vnum = None
        current_mob_name = ""

        for line in fin:
            stripped_line = line.strip()

            if stripped_line.startswith("Mob"):
                parts = stripped_line.split()
                if len(parts) > 1:
                    current_mob_vnum = parts[1]
                    current_mob_name = mob_names.get(current_mob_vnum, "Bilinmeyen Mob")
                fout.write(line.rstrip() + f" -- {current_mob_name}\n")
                continue

            if re.match(r"^\d+", stripped_line):
                tokens = stripped_line.split()
                if len(tokens) >= 2:
                    vnum = tokens[1]
                    item_name = item_names.get(vnum, "Bilinmeyen Eşya")
                    fout.write(line.rstrip() + f" -- {item_name}\n")
                    continue

            fout.write(line)

if __name__ == "__main__":
    current_dir = os.getcwd()

    item_names_file = os.path.join(current_dir, "item_names.txt")
    mob_names_file = os.path.join(current_dir, "mob_names.txt")
    mob_drop_file = os.path.join(current_dir, "mob_drop_item.txt")
    output_file = os.path.join(current_dir, "new_mob_drop_item.txt")

    if not os.path.exists(item_names_file) or not os.path.exists(mob_drop_file) or not os.path.exists(mob_names_file):
        print("Item names, mob names veya mob drop dosyalarından biri eksik!")
    else:
        item_names = load_item_names(item_names_file)
        mob_names = load_mob_names(mob_names_file)
        annotate_mob_drop_items(mob_drop_file, item_names, mob_names, output_file)

        print("Tamamlandı:", output_file)

yapay zeka saolsun :)

eski hali

eski:
Genişlet Daralt Kopyala
Group    µÎ¸ñ´Á´ë
{
    Mob    103
    Type    drop
    1    1012    1    0.2
    2    4012    1    0.2
    3    11402    1    0.2
    4    16022    1    0.2
}
Group    Ǫ¸¥´Á´ë
{
    Mob    104
    Type    drop
    1    32    1    0.2
    2    52    1    0.2
    3    15002    1    0.2
    4    2022    1    0.2
    5    16002    1    0.2
}
Group    Ǫ¸¥µÎ¸ñ´Á´ë
{
    Mob    105
    Type    drop
    1    11602    1    0.2
    2    12482    1    0.2
    3    15022    1    0.2
    4    16062    1    0.2
yeni hali

yeni:
Genişlet Daralt Kopyala
Group    µÎ¸ñ´Á´ë
{
    Mob    103 -- Alfa Kurt
    Type    drop
    1    1012    1    0.2 -- Kobra Hançeri+2
    2    4012    1    0.2 -- Dokuz Pala+2
    3    11402    1    0.2 -- Gök Mavisi Takım+2
    4    16022    1    0.2 -- Bakır Kolye+2
}
Group    Ǫ¸¥´Á´ë
{
    Mob    104 -- Mavi Kurt
    Type    drop
    1    32    1    0.2 -- Hilal kılıç+2
    2    52    1    0.2 -- Geniş kılıç+2
    3    15002    1    0.2 -- Deri Ayakkabı+2
    4    2022    1    0.2 -- Birleşik Yay+2
    5    16002    1    0.2 -- Tahta Kolye+2
}
Group    Ǫ¸¥µÎ¸ñ´Á´ë
{
    Mob    105 -- Alfa Mavi Kurt
    Type    drop
    1    11602    1    0.2 -- Ağıt Plaka Zırh+2
    2    12482    1    0.2 -- Kanlı Kask+2
    3    15022    1    0.2 -- Bambu Derisi Ayakkabı+2
    4    16062    1    0.2 -- Altın Kolye+2
 
Save the code below as itemname.py
itemname.py
item_names.txt
mob_names.txt
mob_drop_item.txt
Run itemname.py in the same folder

mobname adds itemname:
Genişlet Daralt Kopyala
import re, os

def load_item_names(item_names_filename):
    item_names = {}
    with open(item_names_filename, "r", encoding="windows-1254") as f:
        for line in f:
            line = line.strip()
            if not line or line.startswith("VNUM"):
                continue
            parts = line.split("\t")
            if len(parts) < 2:
                parts = line.split()
                if len(parts) < 2:
                    continue
                vnum = parts[0]
                name = " ".join(parts[1:])
            else:
                vnum = parts[0]
                name = parts[1].strip()
            item_names[vnum] = name
    return item_names

def load_mob_names(mob_names_filename):
    mob_names = {}
    with open(mob_names_filename, "r", encoding="windows-1254") as f:
        for line in f:
            line = line.strip()
            if not line or line.startswith("VNUM"):
                continue
            parts = line.split("\t")
            if len(parts) < 2:
                parts = line.split()
                if len(parts) < 2:
                    continue
                vnum = parts[0]
                name = " ".join(parts[1:])
            else:
                vnum = parts[0]
                name = parts[1].strip()
            mob_names[vnum] = name
    return mob_names

def annotate_mob_drop_items(mob_drop_filename, item_names, mob_names, output_filename):
    with open(mob_drop_filename, "r", encoding="windows-1254") as fin, open(output_filename, "w", encoding="windows-1254") as fout:
        current_mob_vnum = None
        current_mob_name = ""

        for line in end:
            stripped_line = line. strip()

            if stripped_line.startswith("Mob"):
                parts = stripped_line.split()
                if len(parts) > 1:
                    current_mob_vnum = parts[1]
                    current_mob_name = mob_names.get(current_mob_vnum, "Unknown Mob")
                fout.write(line.rstrip() + f" -- {current_mob_name}\n")
                continue

            if re.match(r"^\d+", stripped_line):
                tokens = stripped_line.split()
                if len(tokens) >= 2:
                    vnum = tokens[1]
                    item_name = item_names.get(vnum, "Unknown Item")
                    fout.write(line.rstrip() + f" -- {item_name}\n")
                    continue

            fout.write(line)

if __name__ == "__main__":
    current_dir = os.getcwd()

    item_names_file = os.path.join(current_dir, "item_names.txt")
    mob_names_file = os.path.join(current_dir, "mob_names.txt")
    mob_drop_file = os.path.join(current_dir, "mob_drop_item.txt")
    output_file = os.path.join(current_dir, "new_mob_drop_item.txt")

    if not os.path.exists(item_names_file) or not os.path.exists(mob_drop_file) or not os.path.exists(mob_names_file):
        print("One of the item names, mob names or mob drop files is missing!")
    else:
        item_names = load_item_names(item_names_file)
        mob_names = load_mob_names(mob_names_file)
        annotate_mob_drop_items(mob_drop_file, item_names, mob_names, output_file)

        print("Completed:", output_file)

Thanks to artificial intelligence:)

old version

old:
Genişlet Daralt Kopyala
Group µÎ¸ñ´Á´ë
{
    Mob 103
    Type drop
    1 1012 1 0.2
    2 4012 1 0.2
    3 11402 1 0.2
    4 16022 1 0.2
}
Group Ǫ¸¥´Á´ë
{
    Mob 104
    Type drop
    1 32 1 0.2
    2 52 1 0.2
    3 15002 1 0.2
    4 2022 1 0.2
    5 16002 1 0.2
}
Group Ǫ¸¥µÎ¸ñ´Á´ë
{
    Mob 105
    Type drop
    1 11602 1 0.2
    2 12482 1 0.2
    3 15022 1 0.2
    4 16062 1 0.2
New State

new:
Genişlet Daralt Kopyala
Group µÎ¸ñ´Á´ë
{
    Mob 103 -- Alpha Wolf
    Type drop
    1 1012 1 0.2 -- Cobra Dagger+2
    2 4012 1 0.2 -- Nine Blades+2
    3 11402 1 0.2 -- Sky Blue Suite+2
    4 16022 1 0.2 -- Copper Necklace+2
}
Group Ǫ¸¥´Á´ë
{
    Mob 104 -- Blue Wolf
    Type drop
    1 32 1 0.2 -- Crescent sword+2
    2 52 1 0.2 -- Broadsword+2
    3 15002 1 0.2 -- Leather Shoes+2
    4 2022 1 0.2 -- Compound Spring+2
    5 16002 1 0.2 -- Wooden Necklace+2
}
Group Ǫ¸¥µÎ¸ñ´Á´ë
{
    Mob 105 -- Alpha Blue Wolf
    Type drop
    1 11602 1 0.2 -- Lament Plate Armor+2
    2 12482 1 0.2 -- Bloody Helmet+2
    3 15022 1 0.2 -- Bamboo Leather Shoes+2
    4 16062 1 0.2 -- Gold Necklace+2
Boss Man's Work !!!! Thank you 👍
 
Uyarı: Bu konu açıldığından bu yana baya zaman geçmiş.
Muhtemelen daha fazla tartışma gerekli değildir ki bu durumda yeni bir konu başlatmayı öneririz. Eğer yine de cevabınızın gerekli olduğunu düşünüyorsanız buna rağmen cevap verebilirsiniz.
Geri
Üst