Workshop bugfixes

This commit is contained in:
Anuken
2019-10-30 01:24:03 -04:00
parent 42bf1df424
commit ee5d229f51

View File

@@ -76,8 +76,7 @@ public class SWorkshop implements SteamUGCCallback{
public void updateItem(Publishable p, String changelog){ public void updateItem(Publishable p, String changelog){
String id = p.getSteamID(); String id = p.getSteamID();
long handle = Strings.parseLong(id, -1); long handle = Strings.parseLong(id, -1);
SteamPublishedFileID fid = new SteamPublishedFileID(handle); update(p, new SteamPublishedFileID(handle), changelog);
update(p, fid, changelog);
} }
/** Fetches info for an item, checking to make sure that it exists.*/ /** Fetches info for an item, checking to make sure that it exists.*/
@@ -113,6 +112,11 @@ public class SWorkshop implements SteamUGCCallback{
field.setMaxLength(400); field.setMaxLength(400);
buttons.defaults().size(120, 54).pad(4); buttons.defaults().size(120, 54).pad(4);
buttons.addButton("$ok", () -> { buttons.addButton("$ok", () -> {
if(!p.prePublish()){
Log.info("Rejecting due to pre-publish.");
return;
}
ui.loadfrag.show("$publishing"); ui.loadfrag.show("$publishing");
updateItem(p, field.getText().replace("\r", "\n")); updateItem(p, field.getText().replace("\r", "\n"));
dialog.hide(); dialog.hide();
@@ -143,7 +147,7 @@ public class SWorkshop implements SteamUGCCallback{
} }
void update(Publishable p, SteamPublishedFileID id, String changelog){ void update(Publishable p, SteamPublishedFileID id, String changelog){
Log.info("Calling update({0})", p.steamTitle()); Log.info("Calling update({0}) {1}", p.steamTitle(), SteamNativeHandle.getNativeHandle(id));
String sid = SteamNativeHandle.getNativeHandle(id) + ""; String sid = SteamNativeHandle.getNativeHandle(id) + "";
updateItem(id, h -> { updateItem(id, h -> {
@@ -197,7 +201,7 @@ public class SWorkshop implements SteamUGCCallback{
void updateItem(SteamPublishedFileID publishedFileID, Cons<SteamUGCUpdateHandle> tagger, Runnable updated){ void updateItem(SteamPublishedFileID publishedFileID, Cons<SteamUGCUpdateHandle> tagger, Runnable updated){
try{ try{
SteamUGCUpdateHandle h = ugc.startItemUpdate(SVars.steamID, publishedFileID); SteamUGCUpdateHandle h = ugc.startItemUpdate(SVars.steamID, publishedFileID);
Log.info("begin updateItem({0})", publishedFileID.toString()); Log.info("begin updateItem({0})", SteamNativeHandle.getNativeHandle(publishedFileID));
tagger.get(h); tagger.get(h);
Log.info("Tagged."); Log.info("Tagged.");
@@ -274,7 +278,7 @@ public class SWorkshop implements SteamUGCCallback{
Log.info("Passing to first handler."); Log.info("Passing to first handler.");
itemHandlers.first().get(publishedFileID); itemHandlers.first().get(publishedFileID);
}else{ }else{
ui.showErrorMessage(Core.bundle.format("publish.error ", result.name())); ui.showErrorMessage(Core.bundle.format("publish.error", result.name()));
} }
itemHandlers.remove(0); itemHandlers.remove(0);
@@ -286,7 +290,7 @@ public class SWorkshop implements SteamUGCCallback{
@Override @Override
public void onSubmitItemUpdate(SteamPublishedFileID publishedFileID, boolean needsToAcceptWLA, SteamResult result){ public void onSubmitItemUpdate(SteamPublishedFileID publishedFileID, boolean needsToAcceptWLA, SteamResult result){
ui.loadfrag.hide(); ui.loadfrag.hide();
Log.info("onsubmititemupdate {0} {1} {2}", publishedFileID, needsToAcceptWLA, result); Log.info("onsubmititemupdate {0} {1} {2}", SteamNativeHandle.getNativeHandle(publishedFileID), needsToAcceptWLA, result);
if(result == SteamResult.OK){ if(result == SteamResult.OK){
//redirect user to page for further updates //redirect user to page for further updates
SVars.net.friends.activateGameOverlayToWebPage("steam://url/CommunityFilePage/" + SteamNativeHandle.getNativeHandle(publishedFileID)); SVars.net.friends.activateGameOverlayToWebPage("steam://url/CommunityFilePage/" + SteamNativeHandle.getNativeHandle(publishedFileID));
@@ -298,9 +302,8 @@ public class SWorkshop implements SteamUGCCallback{
updatedHandlers.get(publishedFileID).run(); updatedHandlers.get(publishedFileID).run();
} }
}else{ }else{
ui.showErrorMessage(Core.bundle.format("publish.error ", result.name())); ui.showErrorMessage(Core.bundle.format("publish.error", result.name()));
} }
} }
@Override @Override