Mechanic

1 - Colors for Bright Wizard/Sorceress

What does the provided patch do?
Added color support for Bright Wizard and Sorceress depending on what stage they're in (0 gray, 1-10 green, 11-30 yellow, 31-70 orange, 71-90 red, 91-100 purple), so its easy to see at first glance if you better get rid of the build up cumbustion.
Since I was at it and played a Swordmaster at that time, I also added color codes for their different balance states. (Blue, green and yellow based on the original UI colors)
Added the same for Black Orc (Green, yellow, red based on their colors)

Please provide any additional information below.

Entire sourcecode (mechanic.lua

Mechanic = {}

function Mechanic.Initialize()

   CreateWindow("MechanicWindow", true)

   LayoutEditor.RegisterWindow( "MechanicWindow",
                                L"Mechanic Indicator",
                                L"Displays the current mechanic value.",
                                false, false,
                                true, nil )  

    RegisterEventHandler (SystemData.Events.PLAYER_CAREER_RESOURCE_UPDATED "Mechanic.UpdateResourceDisplay";)
end

function Mechanic.UpdateResourceDisplay(previousResourceValue, currentResourceValue)
    if GameData.Player.career.line == GameData.CareerLine.ARCHMAGE then
        if currentResourceValue > 5 then
            LabelSetText("MechanicWindowText", L""..(currentResourceValue-5))
            LabelSetTextColor("MechanicWindowText", 0, 200, 255) -- blue for tranquility
        else
            if currentResourceValue > 0 then
                LabelSetTextColor("MechanicWindowText", 255, 200, 0) -- yellow for force
            else
                LabelSetTextColor("MechanicWindowText", 213, 2, 0) -- red for nothing
            end
            LabelSetText("MechanicWindowText", L""..currentResourceValue)
        end
    elseif GameData.Player.career.line == GameData.CareerLine.SHAMAN then
        if currentResourceValue > 5 then
            LabelSetText("MechanicWindowText", L""..(currentResourceValue-5))
            LabelSetTextColor("MechanicWindowText", 213, 2, 0) -- red for gork's waagh
        else
            if currentResourceValue > 0 then
                LabelSetTextColor("MechanicWindowText", 255, 200, 0) -- gold for mork's waagh
            else
                LabelSetTextColor("MechanicWindowText", 150, 150, 150) -- gray for nothing
            end
            LabelSetText("MechanicWindowText", L""..currentResourceValue)
        end

    elseif GameData.Player.career.line == GameData.CareerLine.BRIGHT_WIZARD then
        LabelSetText("MechanicWindowText", L""..(currentResourceValue))
        if currentResourceValue > 90 then
            LabelSetTextColor("MechanicWindowText", 128, 0, 128) -- purple for 91 - 100
        elseif currentResourceValue > 70 then
            LabelSetTextColor("MechanicWindowText", 255, 0, 0) -- red for 71 - 90
        elseif currentResourceValue > 30 then
            LabelSetTextColor("MechanicWindowText", 244, 122, 0) -- Orange for 31 - 70
        elseif currentResourceValue > 10 then
            LabelSetTextColor("MechanicWindowText", 255, 255, 0) -- Yellow for 11 - 30
        elseif currentResourceValue > 0 then
            LabelSetTextColor("MechanicWindowText", 47, 243, 12) -- green for 1 - 10
    else
            LabelSetTextColor("MechanicWindowText", 150, 150, 150) -- gray for nothing
    end

    elseif GameData.Player.career.line == GameData.CareerLine.SORCERER then
        LabelSetText("MechanicWindowText", L""..(currentResourceValue))
        if currentResourceValue > 90 then
            LabelSetTextColor("MechanicWindowText", 128, 0, 128) -- purple for 91 - 100
        elseif currentResourceValue > 70 then
            LabelSetTextColor("MechanicWindowText", 255, 0, 0) -- red for 71 - 90
        elseif currentResourceValue > 30 then
            LabelSetTextColor("MechanicWindowText", 244, 122, 0) -- Orange for 31 - 70
        elseif currentResourceValue > 10 then
            LabelSetTextColor("MechanicWindowText", 255, 255, 0) -- Yellow for 11 - 30
        elseif currentResourceValue > 0 then
            LabelSetTextColor("MechanicWindowText", 47, 243, 12) -- green for 1 - 10
    else
            LabelSetTextColor("MechanicWindowText", 150, 150, 150) -- gray for nothing
    end

 
     elseif GameData.Player.career.line == GameData.CareerLine.SWORDMASTER then
        LabelSetText("MechanicWindowText", L""..(currentResourceValue))
        if currentResourceValue == 0 then
            LabelSetTextColor("MechanicWindowText", 0, 0, 255) -- blue for normal Balance
        elseif currentResourceValue == 1 then
            LabelSetTextColor("MechanicWindowText", 47, 243, 12) -- green for Improved Balance
        elseif currentResourceValue == 2 then
            LabelSetTextColor("MechanicWindowText", 255, 255, 0) -- Yellow for Perfect balance
    end    

     elseif GameData.Player.career.line == GameData.CareerLine.BLACK_ORC then
        LabelSetText("MechanicWindowText", L""..(currentResourceValue))
        if currentResourceValue == 0 then
            LabelSetTextColor("MechanicWindowText", 47, 243, 12) -- green for No Plan
        elseif currentResourceValue == 1 then
            LabelSetTextColor("MechanicWindowText", 255, 255, 0) -- Yellow for  Da gud plan
        elseif currentResourceValue == 2 then
            LabelSetTextColor("MechanicWindowText", 255, 0, 0) -- red for Da best plan
    end    

    else
        LabelSetText("MechanicWindowText", L""..currentResourceValue)
    end
end

User When Change
Eriandi Mon, 29 Sep 2008 12:58:19 Create

You must login to post a comment. Don't have an account? Register to get one!

Facts

Reported on
29 Sep 2008
Status
New - Issue has not had initial review yet.
Type
Patch - Source code patch for review
Priority
Medium - Normal priority.

Reported by

Possible assignees