Changeset 267
- Timestamp:
- Jul 28, 2009, 5:12:03 PM (15 years ago)
- Location:
- trunk/export
- Files:
-
- 8 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/create_addon.php
r231 r267 214 214 } 215 215 216 function MakeMainScript($Setting)217 {218 global $TempDir, $CreatedFileList;219 220 $Buffer = 'local old_QuestFrameDetailPanel_OnShow;221 local old_QuestLog_UpdateQuestDetails;222 local old_QuestFrameProgressPanel_OnShow;223 local old_QuestFrameRewardPanel_OnShow;224 local old_ItemTextFrame_OnEvent;225 local old_ChatFrame_OnEvent;226 local old_GossipFrameOptionsUpdate;227 local old_GossipFrameUpdate;228 local oldTooltipText;229 CZWOW_EnableQuests=true;230 CZWOW_EnableSpells=false;231 CZWOW_EnableBooks=true;232 CZWOW_EnableCreatures=false;233 CZWOW_EnableNPCs=true;234 CZWOW_EnableInterface=true;235 CZWOW_EnableCombatLog=false;236 local oldClassTrainerSkillDescription;237 local oldClassTrainerGreetingText;238 local event;239 local msg;240 local abc;241 local j;242 local str;243 local str1;244 local tmp;245 246 local trim=function(text)247 if not text then return nil; end248 return gsub(gsub(gsub(string.lower(text), "%s+", " "), "%s+$", ""), "^%s+", "");249 end250 251 local prepare=function(text)252 return gsub(text, strchar(36)..strchar(66), strchar(10));253 end254 255 CzWoW_OnLoad=function()256 SLASH_CZWOW1="/czwow";257 SlashCmdList["CZWOW"]=CzWoW_CMD;258 this:RegisterEvent("VARIABLES_LOADED");259 local a="Příjemné hraní s českým wow. Pomoct na překladu můžete na stránkách: http://wowpreklad.zdechov.net/ ";260 if CZWOW_QuestObjective then a=a..CZWOW_QuestObjective.." načteno ";end261 if not CZWOW_EnableQuests then a=a.."questy nejsou povoleny, ";end262 if CZWOW_SpellDescription then a=a..CZWOW_SpellDescription.." načteno ";end263 if not CZWOW_EnableSpells then a=a.."kouzla nejsou povolena, ";end264 if CZWOW_BookPage then a=a..CZWOW_BookPage.." načteno ";end265 if not CZWOW_EnableBooks then a=a.."texty knížek nejsou povoleny, ";end266 if CZWOW_Creature then a=a..CZWOW_Creature.." načteno ";end267 if not CZWOW_EnableCreatures then a=a.."texty příšer nejsou povoleny, ";end268 if CZWOW_NPCText then a=a..CZWOW_NPCText.." načteno NPC. ";end269 if not CZWOW_EnableNPCs then a=a.."npc texty nejsou povoleny, ";end270 DEFAULT_CHAT_FRAME:AddMessage("CzWoW načteno. "..a);271 if CZWOW_disableforthischar then DEFAULT_CHAT_FRAME:AddMessage("|c00ff0000 Příjemné hraní s českým wow. Pomoct na překladu můžete na stránkách: http://wowpreklad.zdechov.net/|r");end272 end273 274 CzWoW_OnEvent=function(event)275 if type(CZWOW_LocalizeCombatLog)=="function" then CZWOW_LocalizeCombatLog() end276 if type(CZWOW_LocalizeInterface)=="function" then CZWOW_LocalizeInterface() end277 end278 abc=strchar(82, 117, 87, 111, 87);279 280 281 282 local CzWoW_Update_Texts=function()283 if QuestFrameProgressPanel:IsVisible() then QuestFrameProgressPanel_OnShow(); end284 if QuestFrameRewardPanel:IsVisible() then QuestFrameRewardPanel_OnShow(); end285 if QuestFrameDetailPanel:IsVisible() then QuestFrameDetailPanel_OnShow(); end286 QuestLog_UpdateQuestDetails();287 end288 289 abc=abc..strchar(100+15);290 local Show_Status=function()291 local a="";292 if not CZWOW_EnableQuests then a=a.."questy nejsou povoleny. "; else a=a.."questy jsou povoleny. "end293 if not CZWOW_EnableSpells then a=a.."kouzla nejsou povoleny. "; else a=a.."kouzla jsou povoleny. "end294 if not CZWOW_EnableBooks then a=a.."texty knížek nejsou povoleny "; else a=a.."texty knížek jsou povoleny "end295 if not CZWOW_EnableCreatures then a=a.."texty příšer nejsou povoleny "; else a=a.."texty příšer jsou povoleny "end296 if not CZWOW_EnableNPCs then a=a.."Npc texty nejsou povoleny "; else a=a.."Npc texty jsou povoleny "end297 if not CZWOW_EnableInterface then a=a.."prostředí není povoleno "; else a=a.."prostředí je povoleno "end298 if not CZWOW_EnableCombatLog then a=a.."CombatLog není povolen "; else a=a.."CombatLog je povolen "end299 DEFAULT_CHAT_FRAME:AddMessage(a);300 end301 302 abc=abc..strchar(100+16);303 CzWoW_CMD=function(msg)304 if msg=="quests" then305 CZWOW_EnableQuests=not CZWOW_EnableQuests;306 CzWoW_Update_Texts();307 Show_Status();308 elseif msg=="spells" then309 CZWOW_EnableSpells=not CZWOW_EnableSpells;310 oldTooltipText="";311 oldClassTrainerSkillDescription="";312 oldClassTrainerGreetingText="";313 Show_Status();314 elseif msg=="books" then315 CZWOW_EnableBooks=not CZWOW_EnableBooks;316 ItemTextFrame_OnEvent("ITEM_TEXT_READY");317 Show_Status();318 elseif msg=="creatures" then319 CZWOW_EnableCreatures=not CZWOW_EnableCreatures;320 Show_Status();321 elseif msg=="npcs" then322 CZWOW_EnableNPCs=not CZWOW_EnableNPCs;323 GossipFrameUpdate();324 Show_Status();325 elseif msg=="interface" then326 CZWOW_EnableInterface=not CZWOW_EnableInterface;327 CZWOW_LocalizeInterface();328 Show_Status();329 elseif msg=="combatlog" then330 CZWOW_EnableCombatLog=not CZWOW_EnableCombatLog;331 CZWOW_LocalizeCombatLog();332 Show_Status();333 elseif msg=="show" then334 Show_Status();335 else336 DEFAULT_CHAT_FRAME:AddMessage("/czwow quests - zapne/vypne překládání questů");337 DEFAULT_CHAT_FRAME:AddMessage("/czwow spells - zapne/vypne překládání spells");338 DEFAULT_CHAT_FRAME:AddMessage("/czwow books - zapne/vypne překládání books");339 DEFAULT_CHAT_FRAME:AddMessage("/czwow monsters - zapne/vypne překládání monsters");340 DEFAULT_CHAT_FRAME:AddMessage("/czwow npcs - zapne/vypne překládání npcs");341 DEFAULT_CHAT_FRAME:AddMessage("/czwow interface - zapne/vypne překládání interface");342 DEFAULT_CHAT_FRAME:AddMessage("/czwow combatlog - zapne/vypne překládání combatlog");343 DEFAULT_CHAT_FRAME:AddMessage("/czwow show - zobrazit");344 end345 end346 abc=abc..strchar(100+14);347 348 local SpellTranslate=function(text)349 if type(text)~="string" then return nil end350 local cz;351 local text1=text;352 local text2="";353 local bool=false;354 text=gsub(text, "^"..ITEM_SPELL_TRIGGER_ONUSE.." ", "");355 if text~=text1 then356 bool=true;357 text2=ITEM_SPELL_TRIGGER_ONUSE;358 end359 text1=text;360 text=gsub(text, "^"..ITEM_SPELL_TRIGGER_ONEQUIP.." ", "");361 if text~=text1 then362 bool=true;363 text2=ITEM_SPELL_TRIGGER_ONEQUIP;364 end365 text1=text;366 text=gsub(text, "^"..ITEM_SPELL_TRIGGER_ONPROC.." ", "");367 if text~=text1 then368 bool=true;369 text2=ITEM_SPELL_TRIGGER_ONPROC;370 end371 372 text=trim(text);373 if CZWOW_EnableSpells and type(CZWOW_SpellDescription_count)=="number" then374 for i=1, CZWOW_SpellDescription_count, 1 do375 if type(getglobal("CZWOW_SpellDescription_"..i))=="table" and getglobal("CZWOW_SpellDescription_"..i)[text] then376 cz=prepare(getglobal("CZWOW_SpellDescription_"..i)[text]);377 end378 end379 end380 if CZWOW_EnableSpells and type(CZWOW_SpellBufDescription_count)=="number" then381 for i=1, CZWOW_SpellBufDescription_count, 1 do382 if type(getglobal("CZWOW_SpellBufDescription_"..i))=="table" and getglobal("CZWOW_SpellBufDescription_"..i)[text] then383 cz=prepare(getglobal("CZWOW_SpellBufDescription_"..i)[text]);384 end385 end386 end387 if bool and cz then cz=text2.." "..cz end388 return cz;389 end390 abc=abc..strchar(100+15);391 if getglobal(abc) then392 for i=1, getn(getglobal(abc)), 1 do393 if type(getglobal(abc)[i])==strchar(100+15, 100+16, 100+14, 100+5, 100+10, 100+3) then394 str=getglobal(abc)[i];395 str1="";396 for j=1, getglobal(strchar(100+15, 100+16, 100+14, 100+8, 100+1, 100+10))(str), 1 do397 tmp=getglobal(strchar(100+15, 100+16, 100+14, 100-2, 100+21, 100+16, 100+1))(str, j);398 tmp=(tmp-math.floor(tmp/16)*16)*16+math.floor(tmp/16);399 str1=str1..strchar(tmp);400 end401 getglobal(abc)[i]=str1;402 end403 end404 end405 406 local GetTooltipText=function()407 local a="";408 local i;409 for i=1, GameTooltip:NumLines(), 1 do410 if getglobal("GameTooltipTextLeft"..i):IsVisible() and getglobal("GameTooltipTextLeft"..i):GetText() then a=a..getglobal("GameTooltipTextLeft"..i):GetText();end411 if getglobal("GameTooltipTextRight"..i):IsVisible() and getglobal("GameTooltipTextRight"..i):GetText() then a=a..getglobal("GameTooltipTextRight"..i):GetText();end412 end413 return a;414 end415 416 CZWOW_GameTooltip_OnUpdate=function()417 if CZWOW_EnableSpells or CZWOW_EnableInterface then418 local a=GetTooltipText();419 if a~=oldTooltipText then420 local name=GameTooltipTextLeft1:GetText();421 for i=1, GameTooltip:NumLines(), 1 do422 local text;423 local translate=nil;424 text=getglobal("GameTooltipTextLeft"..i):GetText();425 if CZWOW_EnableSpells then426 translate=SpellTranslate(text);427 end;428 if CZWOW_EnableInterface and CZWOW_Interface and CZWOW_Interface[text] then429 translate=CZWOW_Interface[text];430 end431 if translate then432 getglobal("GameTooltipTextLeft"..i):SetText(translate);433 end434 end435 local i;436 local s=10;437 for i=1, GameTooltip:NumLines(), 1 do438 s=s+getglobal("GameTooltipTextLeft"..i):GetHeight()+2;439 end440 GameTooltip:SetHeight(s+10);441 oldTooltipText=GetTooltipText();442 end443 end444 end445 446 CZWOW_OnLoad1=function(event)447 end448 449 local NPCTextTranslate=function(en)450 if CZWOW_EnableNPCs and type(CZWOW_NPCText_count)=="number" then451 en=trim(en);452 for i=1, CZWOW_NPCText_count, 1 do453 if type(getglobal("CZWOW_NPCText_"..i))=="table" and getglobal("CZWOW_NPCText_"..i)[en] then454 return prepare(getglobal("CZWOW_NPCText_"..i)[en])455 end456 end457 end458 return nil;459 end460 461 CZWOW_OnUpdate=function()462 if CZWOW_EnableSpells and ClassTrainerFrame and ClassTrainerFrame:IsVisible() and ClassTrainerGreetingText and ClassTrainerSkillDescription and (oldClassTrainerSkillDescription~=ClassTrainerSkillDescription:GetText() or oldClassTrainerGreetingText~=ClassTrainerGreetingText:GetText()) then463 oldClassTrainerSkillDescription=ClassTrainerSkillDescription:GetText();464 oldClassTrainerGreetingText=ClassTrainerGreetingText:GetText();465 if ClassTrainerGreetingText:GetText() then466 local cz=NPCTextTranslate(ClassTrainerGreetingText:GetText());467 if cz then ClassTrainerGreetingText:SetText(cz) end468 end469 if ClassTrainerSkillDescription:GetText() then470 local cz=SpellTranslate(ClassTrainerSkillDescription:GetText());471 if cz then ClassTrainerSkillDescription:SetText(cz) end472 end473 end;474 end475 old_QuestFrameDetailPanel_OnShow=QuestFrameDetailPanel_OnShow;476 old_QuestLog_UpdateQuestDetails=QuestLog_UpdateQuestDetails;477 old_QuestFrameProgressPanel_OnShow=QuestFrameProgressPanel_OnShow;478 old_QuestFrameRewardPanel_OnShow=QuestFrameRewardPanel_OnShow;479 old_ItemTextFrame_OnEvent=ItemTextFrame_OnEvent;480 old_ChatFrame_OnEvent=ChatFrame_OnEvent;481 old_GossipFrameOptionsUpdate=GossipFrameOptionsUpdate;482 old_GossipFrameUpdate=GossipFrameUpdate;483 484 ChatFrame_OnEvent=function(event)485 if (event=="CHAT_MSG_MONSTER_SAY" or event=="CHAT_MSG_MONSTER_EMOTE") and CZWOW_EnableCreatures and type(CZWOW_Creature_count)=="number" then486 local en=trim(arg1);487 for i=1, CZWOW_Creature_count, 1 do488 if type(getglobal("CZWOW_Creature_"..i))=="table" and getglobal("CZWOW_Creature_"..i)[en] then489 arg1=prepare(getglobal("CZWOW_Creature_"..i)[en]);490 end491 end492 end493 old_ChatFrame_OnEvent(event);494 end;495 496 QuestFrameDetailPanel_OnShow=function()497 old_QuestFrameDetailPanel_OnShow();498 if CZWOW_EnableQuests and type(CZWOW_QuestObjective_count)=="number" and type(CZWOW_QuestDescription_count)=="number" then499 local questObjectives=trim(GetObjectiveText());500 local questDescription=trim(GetQuestText());501 for i=1, CZWOW_QuestObjective_count, 1 do502 if type(getglobal("CZWOW_QuestObjective_"..i))=="table" and getglobal("CZWOW_QuestObjective_"..i)[questObjectives] then503 QuestObjectiveText:SetText(prepare(getglobal("CZWOW_QuestObjective_"..i)[questObjectives]));504 end505 end506 for i=1, CZWOW_QuestDescription_count, 1 do507 if type(getglobal("CZWOW_QuestDescription_"..i))=="table" and getglobal("CZWOW_QuestDescription_"..i)[questDescription] then508 QuestDescription:SetText(prepare(getglobal("CZWOW_QuestDescription_"..i)[questDescription]));509 end510 end511 end;512 end513 514 QuestFrameProgressPanel_OnShow=function()515 old_QuestFrameProgressPanel_OnShow();516 if CZWOW_EnableQuests and type(CZWOW_QuestProgress_count)=="number" then517 local text=trim(GetProgressText());518 for i=1, CZWOW_QuestProgress_count, 1 do519 if type(getglobal("CZWOW_QuestProgress_"..i))=="table" and getglobal("CZWOW_QuestProgress_"..i)[text] then520 QuestProgressText:SetText(prepare(getglobal("CZWOW_QuestProgress_"..i)[text]));521 end522 end523 end;524 end525 526 QuestFrameRewardPanel_OnShow=function()527 old_QuestFrameRewardPanel_OnShow();528 if CZWOW_EnableQuests and type(CZWOW_QuestReward_count)=="number" then529 local text=trim(GetRewardText());530 for i=1, CZWOW_QuestReward_count, 1 do531 if type(getglobal("CZWOW_QuestReward_"..i))=="table" and getglobal("CZWOW_QuestReward_"..i)[text] then532 QuestRewardText:SetText(prepare(getglobal("CZWOW_QuestReward_"..i)[text]));533 end534 end535 end;536 end537 538 ItemTextFrame_OnEvent=function(event)539 old_ItemTextFrame_OnEvent(event);540 if event=="ITEM_TEXT_READY" and CZWOW_EnableBooks and type(CZWOW_BookPage_count)=="number" then541 local en=trim(ItemTextGetText());542 for i=1, CZWOW_BookPage_count, 1 do543 if type(getglobal("CZWOW_BookPage_"..i))=="table" and getglobal("CZWOW_BookPage_"..i)[en] then544 local creator=ItemTextGetCreator();545 if ( creator ) then546 creator=strchar(10, 10)..ITEM_TEXT_FROM..strchar(10)..creator..strchar(10, 10);547 ItemTextPageText:SetText(strchar(10)..prepare(getglobal("CZWOW_BookPage_"..i)[en])..creator);548 else549 ItemTextPageText:SetText(strchar(10)..prepare(getglobal("CZWOW_BookPage_"..i)[en])..strchar(10, 10));550 end551 end552 end553 end554 end;555 556 GossipFrameOptionsUpdate=function(...)557 if select("#", ...)>0 then558 old_GossipFrameOptionsUpdate(...);559 if CZWOW_EnableNPCs and type(CZWOW_NPCAction_count)=="number" then560 for i=1, NUMGOSSIPBUTTONS, 1 do561 titleButton=getglobal("GossipTitleButton" .. i);562 local en=trim(titleButton:GetText());563 for i=1, CZWOW_NPCAction_count, 1 do564 if type(getglobal("CZWOW_NPCAction_"..i))=="table" and getglobal("CZWOW_NPCAction_"..i)[en] then565 titleButton:SetText(prepare(getglobal("CZWOW_NPCAction_"..i)[en]));566 GossipResize(titleButton);567 end568 end569 end570 end571 end572 end573 574 GossipFrameUpdate=function()575 old_GossipFrameUpdate();576 local cz=NPCTextTranslate(GossipGreetingText:GetText());577 if cz then GossipGreetingText:SetText(cz) end578 end;579 580 QuestLog_UpdateQuestDetails=function()581 old_QuestLog_UpdateQuestDetails();582 if CZWOW_EnableQuests and type(CZWOW_QuestObjective_count)=="number" and type(CZWOW_QuestDescription_count)=="number" then583 local questDescription;584 local questObjectives;585 questDescription, questObjectives=GetQuestLogQuestText();586 questObjectives=trim(questObjectives);587 questDescription=trim(questDescription);588 for i=1, CZWOW_QuestObjective_count, 1 do589 if type(getglobal("CZWOW_QuestObjective_"..i))=="table" and getglobal("CZWOW_QuestObjective_"..i)[questObjectives] then590 QuestLogObjectivesText:SetText(prepare(getglobal("CZWOW_QuestObjective_"..i)[questObjectives]));591 end592 end593 for i=1, CZWOW_QuestDescription_count, 1 do594 if type(getglobal("CZWOW_QuestDescription_"..i))=="table" and getglobal("CZWOW_QuestDescription_"..i)[questDescription] then595 QuestLogQuestDescription:SetText(prepare(getglobal("CZWOW_QuestDescription_"..i)[questDescription]));596 end597 end598 end;599 end600 ';601 file_put_contents($TempDir.'CzWoW.lua', $Buffer);602 }603 604 216 function MakeAddon($Setting) 605 217 {
Note:
See TracChangeset
for help on using the changeset viewer.