Skip to content
This repository was archived by the owner on Apr 7, 2021. It is now read-only.

Commit

Permalink
Update Custom ItemInfo patch. Fixes issue #116.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neo-Mind committed Mar 13, 2016
1 parent e89e220 commit f44209a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
8 changes: 8 additions & 0 deletions Core/utils.qs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ function ReplaceVarHex(code, nums, values) {
return code;
}

//###########################################################
//# Purpose: Check whether client is Renewal or Main client #
//###########################################################

function IsRenewal() {
return(exe.findString("rdata.grf", RAW) !== -1);
}

//###########################################################
//# Purpose: Extract the g_serviceType address from Client. #
//# Returned value will be in PTYPE_HEX format #
Expand Down
22 changes: 16 additions & 6 deletions Patches/ChangeItemInfo.qs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,25 @@

function ChangeItemInfo() {

//Step 1a - Find offset of "System/iteminfo.lub"
var offset = exe.findString("System/iteminfo.lub", RVA);
//Step 1a - Check if the client is Renewal (iteminfo file name is "System/iteminfo_Sak.lub" for Renewal clients)
if (IsRenewal())
var iiName = "System/iteminfo_Sak.lub";
else
var iiName = "System/iteminfo.lub";

//Step 1b - Find offset of the original string
var offset = exe.findString(iiName, RVA);
if (offset === -1)
return "Failed in Step 1 - iteminfo.lub not found";
return "Failed in Step 1 - iteminfo file name not found";

//Step 1b - Find its reference
offset = exe.findCode("68" + offset.packToHex(4), PTYPE_HEX, false);
if (offset === -1)
return "Failed in Step 1 - iteminfo reference not found";

//Step 2a - Get the new filename from user
var myfile = exe.getUserInput("$newItemInfo", XTYPE_STRING, "String input - maximum 28 characters including folder name/", "Enter the new ItemInfo path (should be relative to RO folder)", "System/iteminfo.lub", 1, 28);
if (myfile === "System/iteminfo.lub")
var myfile = exe.getUserInput("$newItemInfo", XTYPE_STRING, "String input - maximum 28 characters including folder name/", "Enter the new ItemInfo path (should be relative to RO folder)", iiName, 1, 28);
if (myfile === iiName)
return "Patch Cancelled - New value is same as old";

//Step 2b - Allocate space for the new name
Expand All @@ -36,5 +42,9 @@ function ChangeItemInfo() {
// Disable for Unsupported clients //
//=================================//
function ChangeItemInfo_() {
return (exe.findString("System/iteminfo.lub", RAW) !== -1);
if (IsRenewal())
var iiName = "System/iteminfo_Sak.lub";
else
var iiName = "System/iteminfo.lub";
return (exe.findString(iiName, RAW) !== -1);
}
2 changes: 1 addition & 1 deletion Patches/_patchlist.qs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ registerPatch( 63, "UseOfficialClothPalette", "Use Official Cloth Palettes", "UI

registerPatch( 64, "FixChatAt", "@ Bug Fix", "UI", 0, "Shinryo", "Correct the bug to write @ in chat", true);

registerPatch( 65, "ChangeItemInfo", "Load Custom lua file instead of iteminfo.lub", "UI", 0, "Neo", "Makes the client load your own lua file instead of iteminfo.lub . If you directly use ItemInfo.lub for your translated items, it may become lost during the next kRO update", false);
registerPatch( 65, "ChangeItemInfo", "Load Custom lua file instead of iteminfo*.lub", "UI", 0, "Neo", "Makes the client load your own lua file instead of iteminfo*.lub . If you directly use itemInfo*.lub for your translated items, it may become lost during the next kRO update", false);

registerPatch( 66, "LoadItemInfoPerServer", "Load iteminfo with char server", "Data", 0, "Neo", "Load ItemInfo file and call main function with selected char server name as argument", false);

Expand Down
2 changes: 1 addition & 1 deletion lastcommit.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2016-03-13 15:40:36 GMT+0530
2016-03-13 15:59:25 GMT+0530

0 comments on commit f44209a

Please sign in to comment.