-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added all shops in Lumbridge, Falador, Edgeville, and Al-Kharid #407
Conversation
Can you please compare your shops to my existing plugin that adds all shops? |
Some item amounts are a little off (mine are from OSRS, I assume yours are from RS3?). Other than that, items seem to be just right. Example, yours:
Mine:
RS3 wiki: http://runescape.wikia.com/wiki/Louie%27s_Armoured_Legs_Bazaar |
Mine is based from a compilation of other rs377 ports. Should not have any rs3, all rs2. I was just wondering, I don't know if mine is correct, just that it is based on what other rs2 377 servers have uses in the past |
Oh I see. Perhaps OSRS is modified? |
Yes, OSRS has had changes to its shops inventories. But I am not sure what those changes are. Honestly, I don't know if there will ever be a way to get the exact shop info without being given the actual code. As far as I am concerned, either of our lists is fine. Yours is more organized than mine, which is why I kept mine in my repo instead of opening a pr. |
Yours is really helpful though. If I have permission, in my free time I could perhaps organize your disordered shops plugin? |
Really good work, thanks, this is a perfect example of how I intended the shops plugin to be used. I think generally if there's a discrepancy we should default to the stock in OSRS, unless there's clear evidence (e.g. a video of real RS from 2006 showing the shop inventory). Lots of other servers will have slapped stuff together and probably isn't all that reliable |
operated by "Louie Legs" | ||
|
||
/* | ||
FIXME when this is a category("platelegs"), the s at the end of 'platelegs' is omitted for some reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solution to this is:
category("platelegs", depluralise = false) {
...
}
Hopefully we can find a way to make this clearer/remove the requirement for this parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably just check if either <name> <category-depluralised>
or <name> <category>
exists, throwing an error if both do.
I've added the fix to the FIXME in my new commit. @Major- |
@tlf30 I found a resource here that matched my shops in both amounts and items. I just converted that JSON file to our Shops DSL. It's 3.3k lines of code, can be found here: As you can see, some shops are empty due to them selling OSRS items, so those would need to be filtered. This list also doesn't have the names of the owners. I think it may be a helpful resource for the future to convert to seperate locations, however. I used the following converter: package org.apollo.util.tools;
import com.google.gson.Gson;
import com.google.gson.stream.JsonReader;
import org.apollo.cache.IndexedFileSystem;
import org.apollo.cache.decoder.ItemDefinitionDecoder;
import org.apollo.cache.def.ItemDefinition;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Paths;
public class JSONtoPlugin {
private static class Shop {
int shopId;
String name;
ShopItem[] originalStock;
}
private static class ShopItem {
int id;
int amount;
}
public static void main(String[] args) throws IOException {
try (IndexedFileSystem fs = new IndexedFileSystem(Paths.get("data/fs/", "377"), true)) {
ItemDefinitionDecoder decoder = new ItemDefinitionDecoder(fs);
decoder.run();
Gson gson = new Gson();
JsonReader reader = new JsonReader(new FileReader("./data/test/osrsshops.json"));
Shop[] values = gson.fromJson(reader, Shop[].class);
for (Shop value : values) {
System.out.println("shop(\"" + value.name + "\") {");
System.out.println("\toperated by \"\"");
System.out.println();
for (ShopItem shopItem : value.originalStock) {
if (shopItem.id >= ItemDefinition.count()) {
continue;
}
ItemDefinition definition = ItemDefinition.lookup(shopItem.id);
if (definition != null) {
int amount = shopItem.amount == -1 ? 0 : shopItem.amount;
String id = "(" + shopItem.id + ")";
boolean duplicates = ItemDefinition.hasDuplicates(definition.getName()) && !ItemDefinition.isFirstItem(definition.getId());
System.out.println("\tsell(" + amount + ") of \"" + definition.getName() + "\"" + (duplicates ? id : ""));
}
}
System.out.println("}");
}
}
}
} public static boolean hasDuplicates(String name) {
int amount = 0;
for (ItemDefinition definition : definitions) {
if (definition.getName() != null) {
if (definition.getName().equals(name)) {
amount++;
}
}
}
return amount > 2;
}
public static boolean isFirstItem(int id) {
String name = lookup(id).getName();
for (ItemDefinition definition : definitions) {
if (definition.getName() != null) {
if (definition.getName().equals(name)) {
return definition.getId() == id;
}
}
}
return false;
} |
@Arham4 that looks great, thank you! |
Nope, LGTM |
Looks good to me! |
Merged in c6cf5a4 . |
Should hopefully resolve issue #362