Add new comment
Web-based Item Creator |
||
| Submitted by Dulac on Sat, 2019-05-04 23:21 | ||
I've been thinking of how to create an interface for items in DS2. Perhaps it would be good for new modders. I just started and wrote some of the code for how I want to structure it. I will generate fields for the items based on their type with javaScript. I didn't think I'd start it today, but this took me just a few minutes to write. I did it in a rush, so I plan to write more notes. It will also be open source. Reagents are very easy, so I think I will start with them. It will be open source. I may decide to do a java version in the future, because I know how to build the UI for all platforms in that language. I don't know enough about .net for C# to build an interface for all platforms. A console version wouldn't be as cool. I'm planning to use local storage at first to store user's items they create to reuse later. Eventually, I might use php with a CMS to store it in a database. I also think adding a randomizing feature would be cool, so users could get items with random names and properties. Not much done yet. Just generates a list of item types. Tested it out so I can create the html form in javaScript based on the type of item selected.
const itemType = ["Ring", "Sword", "Bow", "Staff"];
const itemSelect = document.getElementById("itemSelect");
itemType.forEach(options => {
const opt = options;
const el = document.createElement("option");
el.textContent = opt;
el.value = opt;
itemSelect.appendChild(el);
});
checkValue = type => {
if ((itemSelect.value === type)) {
console.log(`${type} is selected`);
}
};
//event listener
itemSelect.addEventListener("change", e => {
checkValue(e.target.value);
});
blogs: |
||