Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Author: Garthog
- # You need to download gamh's pyWMO, then create a new file where you paste this code.
- # Don't forget to create a folder "output" where you run this file.
- # Also, you need Python 3.3
- import sys
- from pywmo import Wmo
- wmo_name = input('Enter WMO Filename : ');
- building = Wmo(wmo_name);
- nLight = building.num_lights;
- print("There are " + str(nLight) + " lights in this WMO.");
- while(1):
- command = input("What do you want to do ?\n\"a\" - Add a light\n\"i\" - Get informations about a light\n\"q\" - Exit\n")
- if(command == "q"):
- while(1):
- save = input("Do you want to save (yes/no) ? ")
- if save.upper() == "YES":
- print("Saving file")
- building.write_file("./output/" + wmo_name)
- break;
- elif save.upper() == "NO":
- print("Exiting without saving")
- break;
- else:
- print("You have to write \"yes\" or \"no\"");
- print("See ya later");
- sys.exit();
- elif(command == "a"):
- print("Light definition")
- light = { }
- light["flag1"] = int(input("LightType : "))
- light["flag2"] = int(input("type : "))
- light["flag3"] = int(input("useAtten : "))
- light["flag4"] = int(input("pad : "))
- light["color"] = (int(input("B : ")), int(input("G : ")), int(input("R : ")), int(input("A : ")))
- light["position"] = (float(input("X : ")), float(input("Y : ")), float(input("Z : ")))
- light["intensity"] = float(input("intensity : "))
- light["attenuation_start"] = float(input("attenuation_start : "))
- light["attenuation_stop"] = float(input("attenuation_stop : "))
- light["unknown1"] = float(input("Unknown 1 : "))
- light["unknown2"] = float(input("Unknown 2 : "))
- light["unknown3"] = float(input("Unknown 3 : "))
- light["unknown4"] = float(input("Unknown 4 : "))
- building.num_lights += 1;
- building.lights.append(light);
- print("There are " + str(len(building.groups)) + " groups")
- while(1):
- group = input("In which group do you want to reference that light ( type \"m\" to return the main menu ) ? ")
- if(group == "s"):
- break;
- group = int(group)
- if(group >= 0 and group < len(building.groups)):
- if not building.groups[group].flags & 0x200:
- building.groups[group].flags &= 0x200
- building.groups[group].light_refs = []
- building.groups[group].light_refs.append(building.num_lights - 1)
- print("Light ref added to group " + str(group))
- else:
- print("Bad group.")
- print("Light succefully added. There are now " + str(building.num_lights) + " lights.")
- elif(command == "i"):
- while(1):
- subcommand = input("Type \"l\" to list all lights, or just type a number to print info of that specific light\n( type \"m\" to return the main menu )\n")
- if(subcommand == "m"):
- break;
- elif(subcommand == "l"):
- i = 0;
- while i < building.num_lights:
- print("Light " + str(i) + " X: " + str(building.lights[i]["position"][0]) + " Y: "
- + str(building.lights[i]["position"][1]) + " Z:" + str(building.lights[i]["position"][2]));
- i += 1
- elif(subcommand.isdigit()):
- light_index = int(subcommand)
- if light_index >= 0 and light_index < building.num_lights:
- print("Informations of light " + subcommand)
- print("Flags " + str(building.lights[light_index]["flag1"]) + " " + str(building.lights[light_index]["flag2"])
- + " " + str(building.lights[light_index]["flag3"]) + " " + str(building.lights[light_index]["flag4"]))
- print("Color ( BGRA ) " + str(building.lights[light_index]["color"][0]) + " "+ str(building.lights[light_index]["color"][1]) + " "
- + str(building.lights[light_index]["color"][2]) + " "+ str(building.lights[light_index]["color"][3]))
- print("Position X:" + str(building.lights[light_index]["position"][0]) + " Y: "
- + str(building.lights[light_index]["position"][1]) + " Z:" + str(building.lights[light_index]["position"][2]));
- print("Intensity " + str(building.lights[light_index]["intensity"]))
- print("Attenuation Start " + str(building.lights[light_index]["attenuation_start"]))
- print("Attenuation Stop " + str(building.lights[light_index]["attenuation_stop"]))
- print("Unknown floats " + str(building.lights[light_index]["unknown1"]) + " " + str(building.lights[light_index]["unknown2"]) + " "
- + str(building.lights[light_index]["unknown3"]) + " " + str(building.lights[light_index]["unknown4"]))
- for i in range(len(building.groups)):
- if building.groups[i].flags & 0x200:
- if light_index in building.groups[i].light_refs:
- print("Referenced in group " + str(i))
- else:
- print("This light doesn't exist.")
- else:
- print("Unknown command")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement