Instructions Jenkins Doxygen

[Updated] checkForceStatus command to show progress of the jedi 61/861/1
authorLoshult <loshult@swgemu.com>
Mon, 30 Sep 2013 04:34:13 +0000 (04:34 +0000)
committerLoshult <loshult@swgemu.com>
Mon, 30 Sep 2013 04:34:13 +0000 (04:34 +0000)
progression.
[Added] Check at login if the player has mastered the professions to
become jedi. A message will be sent to the player in that case.

Change-Id: I74a2998d905badf0aab23a75962c02a67bc418a1

MMOCoreORB/bin/scripts/managers/holocron_jedi_manager.lua
MMOCoreORB/bin/scripts/managers/jedi_manager.lua

index 4c22b2d..033702a 100644 (file)
@@ -73,6 +73,36 @@ function HolocronJediManager:onPlayerCreation(pCreatureObject)
        end)
 end
 
+function HolocronJediManager.getNumberOfMasteredProfessions(pCreatureObject)
+       return HolocronJediManager.withCreaturePlayerObject(pCreatureObject, function(playerObject)
+               local professions = playerObject:getHologrindProfessions()
+               local masteredNumberOfProfessions = 0
+               for i = 1, table.getn(professions), 1 do
+                       if playerObject:hasBadge(professions[i]) then
+                               masteredNumberOfProfessions = masteredNumberOfProfessions + 1
+                       end
+               end
+               return masteredNumberOfProfessions
+       end)
+end
+
+function HolocronJediManager.checkIfProgressedToJedi(pCreatureObject)
+       if HolocronJediManager.getNumberOfMasteredProfessions(pCreatureObject) >= NUMBEROFPROFESSIONSTOMASTER then
+               HolocronJediManager.withCreatureObject(pCreatureObject, function(creatureObject)
+                       creatureObject:sendSystemMessage("JEDI WEEEE!")
+               end)
+       end
+end
+
+function HolocronJediManager.registerObservers(pCreatureObject)
+
+end
+
+function HolocronJediManager:onPlayerLogin(pCreatureObject)
+       HolocronJediManager.checkIfProgressedToJedi(pCreatureObject)
+       HolocronJediManager.registerObservers(pCreatureObject)
+end
+
 function HolocronJediManager.getProfessionNameFromBadgeNumber(badgeNumber)
        local skillList = HolocronJediManager.getGrindableProfessionList()
        for i = 1, table.getn(skillList), 1 do
@@ -89,8 +119,13 @@ function HolocronJediManager:checkForceStatusCommand(pCreatureObject)
                creatureObject:sendSystemMessage("Professions selected for this player:")
                local professions = playerObject:getHologrindProfessions()
                for i = 1, table.getn(professions), 1 do
-                       creatureObject:sendSystemMessage(HolocronJediManager.getProfessionNameFromBadgeNumber(professions[i]))
+                       if playerObject:hasBadge(professions[i]) then
+                               creatureObject:sendSystemMessage(HolocronJediManager.getProfessionNameFromBadgeNumber(professions[i]) .. " - completed")
+                       else
+                               creatureObject:sendSystemMessage(HolocronJediManager.getProfessionNameFromBadgeNumber(professions[i]) .. " - not mastered yet")
+                       end
                end
+               creatureObject:sendSystemMessage("You have mastered " .. HolocronJediManager.getNumberOfMasteredProfessions(pCreatureObject) .. " professions out of " .. NUMBEROFPROFESSIONSTOMASTER)
        end)
 end
 
index c4f22f7..4826463 100644 (file)
@@ -87,7 +87,7 @@ function JediManager:onPlayerLogout(pCreatureObject)
        -- Default behaviour for the onPlayerLogout event, do nothing.
 end
 
-function JediManager.checkForceStatusCommand(pCreatureObject)
+function JediManager:checkForceStatusCommand(pCreatureObject)
        -- Default behaviour for the checkForceStatus command, do nothing.
 end