Changeset 763 for trunk/Modules/Export
- Timestamp:
- Jan 25, 2014, 12:45:26 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/files/5.4.0/CzWoW/CzWoW.lua
r757 r763 5 5 6 6 Debug = false; --turn this when you want to compare trim english text with text database 7 7 8 8 ------------------- 9 9 --global function-- … … 64 64 end 65 65 end 66 return en; 67 66 for i=1, CZWOW_ItemName_count, 1 do 67 if getglobal("CZWOW_ItemName_"..i)[text] then 68 return getglobal("CZWOW_ItemName_"..i)[text]; 69 end 70 end 71 for i=1, CZWOW_ItemDescription_count, 1 do 72 if getglobal("CZWOW_ItemDescription_"..i)[text] then 73 return getglobal("CZWOW_ItemDescription_"..i)[text]; 74 end 75 end 76 for i=1, CZWOW_ObjectName_count, 1 do 77 if getglobal("CZWOW_ObjectName_"..i)[text] then 78 return getglobal("CZWOW_ObjectName_"..i)[text]; 79 end 80 end 81 82 return en; 83 68 84 end 69 85 … … 108 124 self:RegisterEvent("QUEST_LOG_UPDATE"); 109 125 110 if(GameTooltip:GetScript("OnTooltipSetItem")) then 126 127 GameTooltip:HookScript("OnUpdate",GameObjectChange); 128 if(GameTooltip:GetScript("OnTooltipSetItem")) then 111 129 GameTooltip:HookScript("OnTooltipSetItem",ItemChangeName); 112 130 else 113 131 GameTooltip:SetScript("OnTooltipSetItem",ItemChangeName); 114 132 end 115 133 for nn, tooltip in ipairs(TooltipList) do 134 if tooltip then 135 for _, methodName in ipairs(MethodList) do 136 hooksecurefunc(tooltip, methodName, ItemChangeName); 137 end 138 end 139 end 140 141 end 142 143 --------Translate item------------------ 144 TooltipList = { 145 ItemRefTooltip, 146 GameTooltip, 147 ShoppingTooltip1, 148 ShoppingTooltip2, 149 ComparisonTooltip1, 150 ComparisonTooltip2, 151 } 152 153 MethodList = { 154 "SetLootItem", 155 "SetHyperlink", 156 "SetBagItem", 157 "SetInventoryItem", 158 "SetAuctionItem", 159 "SetAuctionSellItem", 160 "SetLootRollItem", 161 "SetTradeSkillItem", 162 "SetTrainerService", 163 "SetInboxItem", 164 "SetSendMailItem", 165 "SetQuestItem", 166 "SetQuestLogItem", 167 "SetTradePlayerItem", 168 "SetTradeTargetItem", 169 "SetMerchantItem", 170 "SetHyperlinkCompareItem", 171 "SetBuybackItem", 172 } 173 174 function TranslateTooltip(this) 175 if this then 176 local text = this:GetText(); 177 for i=1, CZWOW_ItemName_count, 1 do 178 if getglobal("CZWOW_ItemName_"..i)[trim(text)] then 179 text = getglobal("CZWOW_ItemName_"..i)[trim(text)]; 180 end 181 end 182 -- text = "bleble"; 183 -- DEFAULT_CHAT_FRAME:AddMessage(text); 184 this:SetText(text); 185 end 116 186 end 117 187 118 188 function ItemChangeName(this) 119 local name,link = this:GetItem(); 120 -- this:SetText("Fs"); 121 -- this:UpdateTooltip(this); 122 -- this:SetText("Fa"); 123 124 -- this:AddLine("Item name: "..name); 125 -- this:Show(); 126 end 189 local name = "test ěščřžýáíéůú fsd fa"; 190 if CZWOW_ItemName_count > 0 then 191 TranslateTooltip(GameTooltipTextLeft1); 192 TranslateTooltip(ItemRefTooltipTextLeft1); 193 TranslateTooltip(ShoppingTooltip1TextLeft2); 194 TranslateTooltip(ShoppingTooltip2TextLeft2); 195 TranslateTooltip(ComparisonTooltip1TextLeft4); 196 TranslateTooltip(ComparisonTooltip2TextLeft6); 197 --/run 198 end 199 if CZWOW_ItemDescription_count > 0 then 200 for i=1,GameTooltip:NumLines()do 201 local mytext=_G["GameTooltipTextLeft"..i]; 202 if "\"" == strsub(mytext:GetText(), 0,1) then 203 local text = strsub(mytext:GetText(), 2,strlen(mytext:GetText())-2); 204 text = text.."."; 205 for i=1, CZWOW_ItemDescription_count, 1 do 206 if getglobal("CZWOW_ItemDescription_"..i)[trim(text)] then 207 text = getglobal("CZWOW_ItemDescription_"..i)[trim(text)]; 208 end 209 end 210 mytext:SetText("\""..text.."\""); 211 end 212 end 213 end 214 215 this:Show(); 216 end 217 ---------item at vendor------ 218 local old_MerchantFrame_UpdateMerchantInfo = MerchantFrame_UpdateMerchantInfo; 219 function MerchantFrame_UpdateMerchantInfo() 220 old_MerchantFrame_UpdateMerchantInfo(); 221 local numMerchantItems = GetMerchantNumItems(); 222 for i=1, MERCHANT_ITEMS_PER_PAGE, 1 do 223 local index = (((MerchantFrame.page - 1) * MERCHANT_ITEMS_PER_PAGE) + i); 224 if ( index <= numMerchantItems ) then 225 name, texture, price, quantity, numAvailable, isUsable, extendedCost = GetMerchantItemInfo(index); 226 local text = name; 227 for i=1, CZWOW_ItemName_count, 1 do 228 if getglobal("CZWOW_ItemName_"..i)[trim(text)] then 229 text = getglobal("CZWOW_ItemName_"..i)[trim(text)]; 230 end 231 end 232 getglobal("MerchantItem"..i.."Name"):SetText(text); 233 end 234 end 235 end 236 237 -------item at loot-------------------- 238 local old_LootFrame_Update = LootFrame_Update; 239 function LootFrame_Update() 240 old_LootFrame_Update(); 241 local numLootItems = LootFrame.numLootItems; 242 --Logic to determine how many items to show per page 243 local numLootToShow = LOOTFRAME_NUMBUTTONS; 244 if ( numLootItems > LOOTFRAME_NUMBUTTONS ) then 245 numLootToShow = numLootToShow - 1; 246 end 247 local texture, item, quantity, quality; 248 local button, countString, color; 249 for index = 1, LOOTFRAME_NUMBUTTONS do 250 local slot = (numLootToShow * (LootFrame.page - 1)) + index; 251 texture, item, quantity, quality = GetLootSlotInfo(slot); 252 253 local text = item; 254 for i=1, CZWOW_ItemName_count, 1 do 255 if getglobal("CZWOW_ItemName_"..i)[trim(text)] then 256 text = getglobal("CZWOW_ItemName_"..i)[trim(text)]; 257 end 258 end 259 260 getglobal("LootButton"..index.."Text"):SetText(text); 261 end 262 end 263 264 ---------translate gameobject---------- 265 function GameObjectChange(this) 266 if 1 == GameTooltip:NumLines() then 267 if CZWOW_ObjectName_count > 0 then 268 if GameTooltipTextLeft1 then 269 for i=1, CZWOW_ObjectName_count, 1 do 270 local text = GameTooltipTextLeft1:GetText(); 271 if getglobal("CZWOW_ObjectName_"..i)[trim(text)] then 272 GameTooltipTextLeft1:SetText(getglobal("CZWOW_ObjectName_"..i)[trim(text)]); 273 end 274 end 275 GameTooltip:Show(); 276 end; 277 end 278 end 279 end 127 280 128 281 … … 245 398 questLogTitle:SetID(questIndex); 246 399 title, _, _, _, _, _, _, _ = GetQuestLogTitle(questIndex); 247 if questLogTitle then questLogTitle:SetText(Translate(title)); end 400 if questLogTitle then questLogTitle:SetText(Translate(title)); end 248 401 end 249 402 end
Note:
See TracChangeset
for help on using the changeset viewer.