Fix guild definitions

master^2
Kevin Zheng 2024-03-31 11:29:50 -07:00
parent 273c571df1
commit 40521c75f5
5 changed files with 35 additions and 38 deletions

View File

@ -22,23 +22,18 @@ import Crossfire
from time import localtime, strftime, time
import os
import sys
from CFDataFile import CFDataFile, CFData
def GuildUpdate():
GuildList = os.path.join(Crossfire.DataDirectory(),Crossfire.MapDirectory(),'templates','guild','GuildList')
try:
guildfile = open(GuildList,'r')
guildlisting = guildfile.read().split('\n')
guildfile.close()
guildlisting.pop()
except:
Crossfire.Log(Crossfire.LogError,'No GuildList file. Please check %s' %GuildList)
if (guildlisting):
Crossfire.Log(Crossfire.LogDebug, '%s' %guildlisting)
for guild in guildlisting:
if not CFGuildHouses().info(guild):
if CFGuildHouses().add_guild(guild):
Crossfire.Log(Crossfire.LogInfo,'New Guild: %s' %guild)
sys.path.append(os.path.join(Crossfire.DataDirectory(), Crossfire.MapDirectory(), 'templates', 'guild'))
from guilds import guilds
guildlisting = list(map(lambda x: x.id, guilds))
Crossfire.Log(Crossfire.LogDebug, 'Found guilds: %s' % guildlisting)
for guild in guildlisting:
if not CFGuildHouses().info(guild):
if CFGuildHouses().add_guild(guild):
Crossfire.Log(Crossfire.LogInfo,'New Guild: %s' %guild)
def SearchGuilds(player):
guildlist = CFGuildHouses().list_guilds()
@ -50,7 +45,7 @@ def SearchGuilds(player):
return 0
class CFGuildHouses:
'''Inter-Guild management class - loads guild from GuildList'''
'''Inter-Guild management class'''
def __init__(self):
guildhousesheader= ['Founded_Date', 'Points', 'Status', 'Quest_points']

View File

@ -1,14 +0,0 @@
PoisonedDagger darcap darcap/darcap/guilds/poisoned_dagger /world/world_116_102 19 41 same 21 26 Poisoned Dagger
GreenGoblin euthville euthville/green_goblin /world/world_105_113 14 20 same 3 22 Green Goblin
SmokingCauldron darcap darcap/darcap/guilds/smoking_cauldron /world/world_116_102 31 26 same 28 28 Smoking Cauldron
DreamingSage navar navar_city/dreaming_sage /world/world_122_117 5 14 /world/world_121_117 41 13 Dreaming Sage
BlackShield brest brest/black_shield /world/world_107_123 39 42 same 27 29 Black Shield
LaughingSkull nurnberg pup_land/guilds/laughing_skull /pup_land/nurnberg/city 16 11 same 21 7 Laughing Skull
PurpleButterfly lonetown pup_land/guilds/purple_butterfly /pup_land/lone_town/town 11 18 same 1 10 Purple Butterfly
MailedFist scorn scorn/guilds/mailed_fist /world/world_105_115 16 32 same 12 26 Mailed Fist
DrunkenBarbarian santodominion santo_dominion/guilds/drunken_barbarian /world/world_102_108 25 13 same 8 19 Drunken Barbarian
DamnedHeretic wolfsburg wolfsburg/guilds/damned_heretics /world/world_128_109 27 16 same 25 8 Damned Heretics
NenshouYouso azumauindo azumauindo/suno-yamatoshi/nenshou_youso /world/world_127_101 47 15 /world/world_126_101 1 22 Nenshou Youso
KetsuekiItsuryuu azumauindo azumauindo/minatomachi/ketsueki_itsuryuu /world/world_129_101 9 35 same 2 33 Ketsueki Itsuryuu
ZasekiDzukiRyoku azumauindo azumauindo/zaseki_dzuki_ryoku /world/world_128_101 40 24 same 44 16 Zaseki Dzuki Ryoku
Mockers butakisfortress lake_country/Butakis/mockers /lake_country/Butakis/Butakis0 2 15 same 2 20 Mockers

View File

@ -4,14 +4,14 @@
1 Install:
Both the install process and the maps themselves require python, so make sure you have that, version 2.5 or later.
There are 5 files involved in the automatic install, convert.py, convertall.py, GuildLocations, and filelist.py. GuildLocations is what is used by the install script for setting up the maps. It has 9 columns in it, the first is the name of the guild, no spaces. The second is the region of the guild, the third is the destination folder for the maps, the fourth is the exit location (usually the world map), the fifth and sixth are the x and y coords within the exit map, the seventh eighth and ninth are the exit location for the storage hall. If field seven is 'same', then it uses the same exit map as for the guild hall itself.
There are 5 files involved in the automatic install, convert.py, convertall.py, guilds.py, and filelist.py. guilds.py is what is used by the install script for setting up the maps. It has 9 columns in it, the first is the name of the guild, no spaces. The second is the region of the guild, the third is the destination folder for the maps, the fourth is the exit location (usually the world map), the fifth and sixth are the x and y coords within the exit map, the seventh eighth and ninth are the exit location for the storage hall. If field seven is 'same', then it uses the same exit map as for the guild hall itself.
filelist.py has a list of which files to process for each guild hall.
convert.py takes all the files in filelist.py and customises them to the specific guild hall, then outputs them into a new (or overwrites an existing) folder in the current working directory. The output folder is the name of the guildhall.
It also writes them into the destination dir. It takes the arguments from argv, in the same order that they are listed in GuildLocations.
convertall.py reads the lines from GuildLocations and runs them, line by line, through convert.py
It also writes them into the destination dir. It takes the arguments from argv, in the same order that they are listed in guilds.py.
convertall.py reads the lines from guilds.py and runs them, line by line, through convert.py
Generally speaking, configuring GuildLocations and the running convertall.py is all that is needed. If that doesn't work, then I suggest looking at how convert.py functions before trying to make a work around.
Generally speaking, configuring guilds.py and the running convertall.py is all that is needed. If that doesn't work, then I suggest looking at how convert.py functions before trying to make a work around.
2 Bug reporting:

View File

@ -2,6 +2,7 @@
# This Python script installs all guilds to their location.
import os
from optparse import OptionParser
from guilds import guilds
parser = OptionParser()
parser.add_option("--local-copy",dest="local_copy",help="puts a copy of generated files in a templates/guild/<guildname>",default=False,action="store_true")
parser.add_option("--no-install-copy",dest="install_copy",help="installs a remote copy to the destination directory. If false, only configures the files for installation.",default=False,action="store_true")
@ -9,10 +10,7 @@ parser.add_option("--no-install-copy",dest="install_copy",help="installs a remot
(options, args) = parser.parse_args()
local_copy = " --local-copy" if options.local_copy else ""
local_copy+=' --no-install-copy' if options.install_copy else ''
t=open('GuildLocations')
a=t.read()
t.close()
b=a.split('\n')
for c in b:
for guild in guilds:
c = " ".join(map(str, guild))
print(c + local_copy)
os.system('./convert.py '+c + local_copy)

View File

@ -0,0 +1,18 @@
from collections import namedtuple
GuildDef = namedtuple("GuildDef", "id region path exit_path exit_x exit_y storage_path storage_x storage_y name")
guilds = [
GuildDef("PoisonedDagger", "darcap", "darcap/darcap/guilds/poisoned_dagger", "/world/world_116_102", 19, 41, "same", 21, 26, "Poisoned Dagger"),
GuildDef("GreenGoblin", "euthville", "euthville/green_goblin", "/world/world_105_113", 14, 20, "same", 3, 22, "Green Goblin"),
GuildDef("SmokingCauldron", "darcap", "darcap/darcap/guilds/smoking_cauldron", "/world/world_116_102", 31, 26, "same", 28, 28, "Smoking Cauldron"),
GuildDef("DreamingSage", "navar", "navar_city/dreaming_sage", "/world/world_122_117", 5, 14, "/world/world_121_117", 41, 13, "Dreaming Sage"),
GuildDef("BlackShield", "brest", "brest/black_shield", "/world/world_107_123", 39, 42, "same", 27, 29, "Black Shield"),
GuildDef("LaughingSkull", "nurnberg", "pup_land/guilds/laughing_skull", "/pup_land/nurnberg/city", 16, 11, "same", 21, 7, "Laughing Skull"),
GuildDef("PurpleButterfly", "lonetown", "pup_land/guilds/purple_butterfly", "/pup_land/lone_town/town", 11, 18, "same", 1, 10, "Purple Butterfly"),
GuildDef("MailedFist", "scorn", "scorn/guilds/mailed_fist", "/world/world_105_115", 16, 32, "same", 12, 26, "Mailed Fist"),
GuildDef("DrunkenBarbarian", "santodominion", "santo_dominion/guilds/drunken_barbarian", "/world/world_102_108", 25, 13, "same", 8, 19, "Drunken Barbarian"),
GuildDef("DamnedHeretic", "wolfsburg", "wolfsburg/guilds/damned_heretics", "/world/world_128_109", 27, 16, "same", 25, 8, "Damned Heretics"),
GuildDef("NenshouYouso", "azumauindo", "azumauindo/suno-yamatoshi/nenshou_youso", "/world/world_127_101", 47, 15, "/world/world_126_101", 1, 22, "Nenshou Youso"),
GuildDef("KetsuekiItsuryuu", "azumauindo", "azumauindo/minatomachi/ketsueki_itsuryuu", "/world/world_129_101", 9, 35, "same", 2, 33, "Ketsueki Itsuryuu"),
GuildDef("ZasekiDzukiRyoku", "azumauindo", "azumauindo/zaseki_dzuki_ryoku", "/world/world_128_101", 40, 24, "same", 44, 16, "Zaseki Dzuki Ryoku"),
GuildDef("Mockers", "butakisfortress", "lake_country/Butakis/mockers", "/lake_country/Butakis/Butakis0", 2, 15, "same", 2, 20, "Mockers"),
]