Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MacHu-GWU committed Sep 17, 2022
1 parent 8115e8c commit 31ba736
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

传送坐标汇总 (Teleport)
==============================================================================
.. contents:: 目录
:class: this-will-duplicate-information-and-it-is-still-useful-here
:depth: 1
:local:

.. include:: ./常用传送命令.rst
.. include:: ./主城传送命令.rst
.. include:: ./职业技能训练师传送命令.rst
.. include:: ./商业技能训练师传送命令.rst
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. _常用传送GM命令:

常用传送GM命令
------------------------------------------------------------------------------
.. jinja:: doc_data

{{ doc_data.lt_list_common_gsp().render() }}
4 changes: 4 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. image:: https://img.shields.io/badge/STAR_Me_on_GitHub!--None.svg?style=social
:target: https://github.com/MacHu-GWU/wotlkdoc-project


魔兽世界 巫妖王之怒 文档大全
==============================================================================

Expand Down
8 changes: 4 additions & 4 deletions tests/test_docs/test_gps/test_gps_go_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
class TestGoCmd:
def test_from_string(self):
go_cmd = GoCmd.from_string("123.123 456.456 789.789 0")
assert go_cmd.go_cmd == ".go 123.12 456.46 789.79 0"
assert go_cmd.go_cmd == ".go 123.1 456.5 789.8 0"

go_cmd = GoCmd.from_string(".go 123.123 456.456 789.789 0")
assert go_cmd.go_cmd == ".go 123.12 456.46 789.79 0"
assert go_cmd.go_cmd == ".go 123.1 456.5 789.8 0"

go_cmd = GoCmd.from_string(".go xyz 123.123 456.456 789.789 0")
assert go_cmd.go_cmd == ".go 123.12 456.46 789.79 0"
assert go_cmd.go_cmd == ".go 123.1 456.5 789.8 0"


def test_with_teleport_command():
Expand All @@ -25,7 +25,7 @@ def test_with_teleport_command():
]
df = pl.DataFrame(data, columns=["go_command", ])
new_df = with_teleport_command(df, go_cmd_col="go_command")
assert new_df.columns == ["传送命令1", "传送命令2"]
assert new_df.columns == ["传送命令", ]


if __name__ == "__main__":
Expand Down
13 changes: 13 additions & 0 deletions wotlkdoc/docs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# -*- coding: utf-8 -*-

from . import gps

doc_data = dict(
lt_list_common_gsp=gps.lt_list_common_gsp,
lt_list_main_city_gps_and_label_and_image=gps.lt_list_main_city_gps_and_label_and_image,
lt_list_class_trainer_gsp=gps.lt_list_class_trainer_gsp,
lt_list_trade_skill_trainer_gsp=gps.lt_list_trade_skill_trainer_gsp,
lt_list_east_map_gps=gps.lt_list_east_map_gps,
lt_list_kali_map_gps=gps.lt_list_kali_map_gps,
lt_list_tbc_map_gps=gps.lt_list_tbc_map_gps,
lt_list_wlk_map_gps=gps.lt_list_wlk_map_gps,
)

# import logging
#
# try:
Expand Down
10 changes: 5 additions & 5 deletions wotlkdoc/docs/gps/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-

from .common import lt_list_common_gsp
from .main_city import lt_list_main_city_gps_and_label_and_image
from .class_skill_trainer import lt_list_class_trainer_gsp
from .trade_skill_trainer import lt_list_trade_skill_trainer_gsp
from .zone import (
lt_list_east_map_gps,
lt_list_kali_map_gps,
lt_list_tbc_map_gps,
lt_list_wlk_map_gps,
)
from .main_city import lt_list_main_city_gps
from .class_skill_trainer import lt_list_class_trainer_gsp
from .trade_skill_trainer import lt_list_trade_skill_trainer_gsp
from .instance import list_of_lt_list_instance_gps
)
Binary file modified wotlkdoc/docs/gps/class-skill-trainer.tsv.gz
Binary file not shown.
Binary file modified wotlkdoc/docs/gps/main-city.tsv.gz
Binary file not shown.
86 changes: 57 additions & 29 deletions wotlkdoc/docs/gps/zone.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,67 @@
# -*- coding: utf-8 -*-

"""
import typing as T
import polars as pl

"""
try:
from .helper import (
remove_go_cmd_construct_teleport,
disaggregate_df_transform_to_list_table,
)
except:
from wotlkdoc.docs.gps.helper import (
remove_go_cmd_construct_teleport,
disaggregate_df_transform_to_list_table,
from ..importer import (
TsvGzReader,
dataframe_to_list_table,
)
from ..images import image_by_map
from .go_cmd import with_teleport_command

if T.TYPE_CHECKING:
from rstobj import Image, ListTable


def _lt_list_zone_gps_and_label_and_image(
filename: str,
) -> T.List[T.Tuple["ListTable", str, "Image"]]:
reader = TsvGzReader(__file__)
df = reader.read_df(filename)
df = (
df.select(
[
pl.col("zone").alias("地图"),
pl.col("loc").alias("地点"),
pl.col("detail").alias("位置"),
pl.col("description").alias("描述"),
pl.col("go_cmd").alias("go_cmd"),
]
)
.fill_null("")
.filter(pl.col("go_cmd") != "")
)
from wotlkdoc.compressed_tsv import make_gzip, read_compressed_tsv
df = with_teleport_command(df, go_cmd_col="go_cmd")
lst = list()
for map in df["地图"].unique(maintain_order=True):
sub_df = df.filter(df["地图"] == map)
image = image_by_map(map)
image.height = 480
lst.append(
(
dataframe_to_list_table(
sub_df,
title=f"{map} 传送GM命令",
),
map,
image,
)
)
return lst


def lt_list_east_map_gps():
return _lt_list_zone_gps_and_label_and_image("zone-1-a-vanilla-eastern-kingdom.tsv")

zone_gps_columns = "地图,地点,位置,描述,gm_cmd".split(",")
"""
各个地图的 GM 传送命令一定都有这么5列.
"""

def lt_list_kali_map_gps():
return _lt_list_zone_gps_and_label_and_image("zone-1-b-vanilla-kalimdor.tsv.gz")

def read_data_and_derive_df_list(tsv_filename):
make_gzip(this_file=__file__, filename=tsv_filename)
df = read_compressed_tsv(this_file=__file__, filename=tsv_filename + ".gz")
df.columns = zone_gps_columns
df = remove_go_cmd_construct_teleport(df)
lt_list = disaggregate_df_transform_to_list_table(df, "地图")
return lt_list

def lt_list_tbc_map_gps():
return _lt_list_zone_gps_and_label_and_image("zone-2-tbc.tsv.gz")

lt_list_east_map_gps = read_data_and_derive_df_list("vanilla-eastern-kingdom-gps.tsv")
lt_list_kali_map_gps = read_data_and_derive_df_list("vanilla-kalimdor-gps.tsv")
lt_list_tbc_map_gps = read_data_and_derive_df_list("tbc-map-gps.tsv")
lt_list_wlk_map_gps = read_data_and_derive_df_list("wlk-map-gps.tsv")

if __name__ == "__main__":
print(lt_list_east_map_gps[0][1].render())
def lt_list_wlk_map_gps():
return _lt_list_zone_gps_and_label_and_image("zone-3-wlk.tsv.gz")

0 comments on commit 31ba736

Please sign in to comment.