jmelnick
Bad Mod Skills, Big Ideas
Found the errors in InstalledPanel.lua and OnlinePanel.lua.
Installed Panel:
INSTALLER_STATUS_ERROR,
statusKey = "TXT_KEY_MODDING_INSTALLER_ERROR";
end
Online Panel:
local statusCode = listingResults.StatusCode();
print(statusCode);
if(statusCode ~= 0) then
HandleListingsError(statusCode);
return;
end
if(alreadyInstalled) then
caption = "TXT_KEY_MODDING_ALREADY_INSTALLED";
bEnableDownloadButton = false;
elseif(downloadingMod) then
bEnableDownloadButton = false;
bShowDownloadButton = false;
elseif(modURL == nil or modURL == "") then
caption = "TXT_KEY_MODDING_ERROR_INVALIDURL";
bEnableDownloadButton = false;
elseif(Modding.IsDownloaderInitialized()) then
caption = "TXT_KEY_MODDING_DOWNLOADMOD";
bEnableDownloadButton = true;
else
Locale.ConvertTextKey("TXT_KEY_MODDING_ERROR_INVALIDURL");
bEnableDownloadButton = false;
else
if( job.State == DownloadStates.SUSPENDED or
job.State == DownloadStates.ERROR) then
hideResumeButton = false;
hideCancelButton = false;
bUseRedLabel = true;
if(job.State == DownloadStates.ERROR or job.State == DownloadStates.WARNING) then
local errorMsg = Modding.GetDownloadErrorMessage(job.ID) or "";
listing.StatusLabel:SetToolTipString(errorMsg);
listing.RedStatusLabel:SetToolTipString(errorMsg);
Error Handling
----------------------------------------------------------------------------------------------
function HandleListingsError(status)
SetListingsMessage(GetOnlineErrorMessage(status));
SetListingsState("message");
end
function HandleDetailsError(status)
SetDetailsMessage(GetOnlineErrorMessage(status));
SetDetailsState("message");
end
function CountCategoryResults(categoryResults)
local statusCode = categoryResults.StatusCode();
if(statusCode ~= 0) then
print("Count Category Result Error! " .. tostring(statusCode));
return;
end
function CountCategoryResultsOptimized(categoryResults)
local statusCode = categoryResults.StatusCode();
if(statusCode ~= 0) then
print("Optimized Count Category Result Error! " .. tostring(statusCode));
return;
end
local statusCode = categoryResults.StatusCode();
if(statusCode ~= 0) then
print("ZOMG CATEGORY ERROR!!!");
return;
end
local statusCode = modInfoResults.StatusCode();
print(statusCode);
if(statusCode ~= 0) then
HandleDetailsError(statusCode);
return;
end
caption = Locale.ConvertTextKey("TXT_KEY_MODDING_ERROR_INVALIDURL");
bEnable = false;
else
caption = Locale.ConvertTextKey("TXT_KEY_MODDING_DOWNLOADMOD");
bEnable = true;
end
Installed Panel:
INSTALLER_STATUS_ERROR,
statusKey = "TXT_KEY_MODDING_INSTALLER_ERROR";
end
Online Panel:
local statusCode = listingResults.StatusCode();
print(statusCode);
if(statusCode ~= 0) then
HandleListingsError(statusCode);
return;
end
if(alreadyInstalled) then
caption = "TXT_KEY_MODDING_ALREADY_INSTALLED";
bEnableDownloadButton = false;
elseif(downloadingMod) then
bEnableDownloadButton = false;
bShowDownloadButton = false;
elseif(modURL == nil or modURL == "") then
caption = "TXT_KEY_MODDING_ERROR_INVALIDURL";
bEnableDownloadButton = false;
elseif(Modding.IsDownloaderInitialized()) then
caption = "TXT_KEY_MODDING_DOWNLOADMOD";
bEnableDownloadButton = true;
else
Locale.ConvertTextKey("TXT_KEY_MODDING_ERROR_INVALIDURL");
bEnableDownloadButton = false;
else
if( job.State == DownloadStates.SUSPENDED or
job.State == DownloadStates.ERROR) then
hideResumeButton = false;
hideCancelButton = false;
bUseRedLabel = true;
if(job.State == DownloadStates.ERROR or job.State == DownloadStates.WARNING) then
local errorMsg = Modding.GetDownloadErrorMessage(job.ID) or "";
listing.StatusLabel:SetToolTipString(errorMsg);
listing.RedStatusLabel:SetToolTipString(errorMsg);
Error Handling
----------------------------------------------------------------------------------------------
function HandleListingsError(status)
SetListingsMessage(GetOnlineErrorMessage(status));
SetListingsState("message");
end
function HandleDetailsError(status)
SetDetailsMessage(GetOnlineErrorMessage(status));
SetDetailsState("message");
end
function CountCategoryResults(categoryResults)
local statusCode = categoryResults.StatusCode();
if(statusCode ~= 0) then
print("Count Category Result Error! " .. tostring(statusCode));
return;
end
function CountCategoryResultsOptimized(categoryResults)
local statusCode = categoryResults.StatusCode();
if(statusCode ~= 0) then
print("Optimized Count Category Result Error! " .. tostring(statusCode));
return;
end
local statusCode = categoryResults.StatusCode();
if(statusCode ~= 0) then
print("ZOMG CATEGORY ERROR!!!");
return;
end
local statusCode = modInfoResults.StatusCode();
print(statusCode);
if(statusCode ~= 0) then
HandleDetailsError(statusCode);
return;
end
caption = Locale.ConvertTextKey("TXT_KEY_MODDING_ERROR_INVALIDURL");
bEnable = false;
else
caption = Locale.ConvertTextKey("TXT_KEY_MODDING_DOWNLOADMOD");
bEnable = true;
end