def CreateRecipePages(): indexPage = '%META:TOPICINFO{author="JoshRitter" date="1121799107" format="1.0" version="1.1"}%\n' indexPage += "---+ Recipe Index\n\n" listname = "All Recipes" TWIKINAMEALL = "RecipeAllIndex" indexPage += "\t* [[%s][%s]]\n" % (TWIKINAMEALL, listname) allPage = "---+ All Recipes\n\n" recipeCollection = {} recipeCollection[listname] = [] for r in Recipe.select(orderBy="name"): page = RecipePage TWIKINAME = "Recipe" + GetTWikiName(r.name) allPage += "\t* (%i)\t [[%s][%s]]\n" % (r.skillLevel, TWIKINAME, r.name) DESCTEXT = GenDescText(r) page = page.replace("^^RECIPENAME^^", r.name.upper() + " RECIPE") page = page.replace("^^DESCTEXT^^", DESCTEXT) f = file("./distrib/twiki/data/MoMWorld/%s.txt" % TWIKINAME, "w") f.write(page) f.close() if not recipeCollection.has_key(r.skillname): recipeCollection[r.skillname] = [] if r not in recipeCollection[r.skillname]: recipeCollection[r.skillname].append(r) if r not in recipeCollection[listname]: recipeCollection[listname].append(r) f = file("./distrib/twiki/data/MoMWorld/%s.txt" % TWIKINAMEALL, "w") f.write(allPage) f.close() TWIKINAMELEVEL = "RecipeAllLevelIndex" listnameLevel = listname + " by Skill Level" indexPage += "\t* [[%s][%s]]\n\n" % (TWIKINAMELEVEL, listnameLevel) recipeList = recipeCollection[listname] recipeList.sort(RecipeLevelSort) CreateRecipeSubIndex(TWIKINAMELEVEL, listnameLevel, recipeList) del recipeCollection["All Recipes"] for listname in recipeCollection.iterkeys(): recipeList = recipeCollection[listname] TWIKINAME = "Recipe" + GetTWikiName(listname) + "Index" TWIKINAMELEVEL = "Recipe" + GetTWikiName(listname) + "LevelIndex" listnameLevel = listname + " by Skill Level" indexPage += "\t* [[%s][%s]]\n" % (TWIKINAME, listname) indexPage += "\t* [[%s][%s]]\n" % (TWIKINAMELEVEL, listnameLevel) CreateRecipeSubIndex(TWIKINAME, listname, recipeList) recipeList.sort(RecipeLevelSort) CreateRecipeSubIndex(TWIKINAMELEVEL, listnameLevel, recipeList) f = file("./distrib/twiki/data/MoMWorld/RecipeIndex.txt", "w") f.write(indexPage) f.close()
def GatherContent(): from missionsifter import SiftSpellScript from mud.world.crafting import Recipe from mud.world.item import ItemSetPower for power in ItemSetPower.select(): if power.sound: AddSound("./$/data/sound/%s"%power.sound) map(SiftRace,FULL_RACES) map(SiftZone,FULL_ZONES) SiftSpellProtos() SiftItemProtos() for recipe in Recipe.select(): if recipe.craftSound: AddSound("./$/data/sound/%s"%recipe.craftSound) map(SiftSpellScript,COMMON_SPELLSCRIPTS) return CONTENT
def GatherContent(): from missionsifter import SiftSpellScript from mud.world.crafting import Recipe from mud.world.item import ItemSetPower for power in ItemSetPower.select(): if power.sound: AddSound("./$/data/sound/%s" % power.sound) map(SiftRace, FULL_RACES) map(SiftZone, FULL_ZONES) SiftSpellProtos() SiftItemProtos() for recipe in Recipe.select(): if recipe.craftSound: AddSound("./$/data/sound/%s" % recipe.craftSound) map(SiftSpellScript, COMMON_SPELLSCRIPTS) return CONTENT
def GetItemList(spellSummonItems,questItems): items = set() #CRAFTED for rproto in Recipe.select(): iproto = rproto.craftedItemProto craftskill = rproto.skillname if iproto: CRAFTITEMS[craftskill].add(iproto) items.add(iproto) RECIPES[iproto].add(rproto) for ing in rproto.ingredients: iproto = ing.itemProto CRAFTITEMS[craftskill].add(iproto) items.add(iproto) INGREDIENTS[iproto].add(rproto) #LOOT for proto in LootProto.select(): for lootitem in proto.lootItems: items.add(lootitem.itemProto) LOOT[lootitem.itemProto].update(proto.spawns) #VENDORS for proto in VendorProto.select(): for vitem in proto.vendorItems: items.add(vitem.itemProto) VENDORS[vitem.itemProto].update(proto.spawns) #SUMMONED for summonItem in spellSummonItems.iterkeys(): items.add(summonItem) SUMMONEDITEMS.add(summonItem) SUMMONED[summonItem].update(spellSummonItems[summonItem]) #QUEST # first come the items taken for qitem in questItems[0].iterkeys(): items.add(qitem) QUESTITEMS.add(qitem) QUESTSTAKE[qitem].update(questItems[0][qitem]) # then items checked for qitem in questItems[1].iterkeys(): items.add(qitem) QUESTITEMS.add(qitem) QUESTSCHECK[qitem].update(questItems[1][qitem]) # then items given for qitem in questItems[2].iterkeys(): items.add(qitem) QUESTITEMS.add(qitem) QUESTSGIVE[qitem].update(questItems[2][qitem]) for craftskill,itemlist in CRAFTITEMS.iteritems(): ItemSubIndexes.append(("Item%sIndex"%GetTWikiName(craftskill),"%s Crafts and Ingredients"%craftskill,itemlist)) return items
def GetItemList(spellSummonItems, questItems): items = set() #CRAFTED for rproto in Recipe.select(): iproto = rproto.craftedItemProto craftskill = rproto.skillname if iproto: CRAFTITEMS[craftskill].add(iproto) items.add(iproto) RECIPES[iproto].add(rproto) for ing in rproto.ingredients: iproto = ing.itemProto CRAFTITEMS[craftskill].add(iproto) items.add(iproto) INGREDIENTS[iproto].add(rproto) #LOOT for proto in LootProto.select(): for lootitem in proto.lootItems: items.add(lootitem.itemProto) LOOT[lootitem.itemProto].update(proto.spawns) #VENDORS for proto in VendorProto.select(): for vitem in proto.vendorItems: items.add(vitem.itemProto) VENDORS[vitem.itemProto].update(proto.spawns) #SUMMONED for summonItem in spellSummonItems.iterkeys(): items.add(summonItem) SUMMONEDITEMS.add(summonItem) SUMMONED[summonItem].update(spellSummonItems[summonItem]) #QUEST # first come the items taken for qitem in questItems[0].iterkeys(): items.add(qitem) QUESTITEMS.add(qitem) QUESTSTAKE[qitem].update(questItems[0][qitem]) # then items checked for qitem in questItems[1].iterkeys(): items.add(qitem) QUESTITEMS.add(qitem) QUESTSCHECK[qitem].update(questItems[1][qitem]) # then items given for qitem in questItems[2].iterkeys(): items.add(qitem) QUESTITEMS.add(qitem) QUESTSGIVE[qitem].update(questItems[2][qitem]) for craftskill, itemlist in CRAFTITEMS.iteritems(): ItemSubIndexes.append( ("Item%sIndex" % GetTWikiName(craftskill), "%s Crafts and Ingredients" % craftskill, itemlist)) return items