Instructions Jenkins Doxygen

[Changed] Enabled village jedi progression system. 15/915/2
authorLoshult <loshult@swgemu.com>
Mon, 14 Oct 2013 09:02:15 +0000 (09:02 +0000)
committerLoshult <loshult@swgemu.com>
Mon, 14 Oct 2013 09:02:15 +0000 (09:02 +0000)
[Added] badge id number constants to Lua through the director manager.
[Added] checkForceStatus command for village jedi progression system.
[Added] setJediManagerName method to jedi manager to help out with
testing.

Change-Id: Ia35ba94a4adbbe98c48d526bb40c83287e080f35

MMOCoreORB/bin/scripts/managers/holocron_jedi_manager.lua
MMOCoreORB/bin/scripts/managers/jedi_manager.lua
MMOCoreORB/bin/scripts/managers/tests/village_jedi_manager_Test.lua
MMOCoreORB/bin/scripts/managers/village_jedi_manager.lua
MMOCoreORB/src/server/zone/managers/director/DirectorManager.cpp
MMOCoreORB/src/server/zone/managers/jedi/JediManager.cpp
MMOCoreORB/src/server/zone/managers/jedi/JediManager.h
MMOCoreORB/src/server/zone/managers/jedi/tests/JediManagerTest.cpp

index 627e942..116c72f 100644 (file)
@@ -18,49 +18,49 @@ HolocronJediManager = JediManager:new {
 function HolocronJediManager:getGrindableProfessionList()
        local grindableProfessions = {
                -- String Id, badge number, profession name
-               --{ "pilot_rebel_navy_corellia",        131 },
-               --{ "pilot_imperial_navy_corellia",     134 },
-               --{ "pilot_neutral_corellia",           137 },
-               --{ "pilot_rebel_navy_tatooine",        132 },
-               --{ "pilot_imperial_navy_naboo",        133 },
-               { "crafting_architect_master",          54  },
-               { "crafting_armorsmith_master",         55  },
-               { "crafting_artisan_master",            56  },
-               { "outdoors_bio_engineer_master",       62  },
-               { "combat_bountyhunter_master",         44  },
-               { "combat_brawler_master",              45  },
-               { "combat_carbine_master",              46  },
-               { "crafting_chef_master",               57  },
-               { "science_combatmedic_master",         67  },
-               { "combat_commando_master",             47  },
-               --{ "outdoors_creaturehandler_master",  63  },
-               { "social_dancer_master",               70  },
-               { "science_doctor_master",              68  },
-               { "crafting_droidengineer_master",      58  },
-               { "social_entertainer_master",          71  },
-               { "combat_1hsword_master",              42  },
-               { "social_imagedesigner_master",        72  },
-               { "combat_marksman_master",             48  },
-               { "science_medic_master",               69  },
-               { "crafting_merchant_master",           59  },
-               { "social_musician_master",             73  },
-               { "combat_polearm_master",              50  },
-               { "combat_pistol_master",               49  },
-               --{ "social_politician_master",         74  },
-               { "outdoors_ranger_master",             64  },
-               { "combat_rifleman_master",             51  },
-               { "outdoors_scout_master",              65  },
-               --{ "crafting_shipwright",              129 },
-               { "combat_smuggler_master",             52  },
-               { "outdoors_squadleader_master",        66  },
-               { "combat_2hsword_master",              43  },
-               { "crafting_tailor_master",             60  },
-               { "crafting_weaponsmith_master",        61  },
-               --{ "pilot_neutral_naboo",              136 },
-               --{ "pilot_neutral_tatooine",           138 },
-               --{ "pilot_imperial_navy_tatooine",     135 },
-               { "combat_unarmed_master",              53  },
-               --{ "pilot_rebel_navy_naboo",           130 }
+               --{ "pilot_rebel_navy_corellia",        PILOT_REBEL_NAVY_CORELLIA },
+               --{ "pilot_imperial_navy_corellia",     PILOT_IMPERIAL_NAVY_CORELLIA },
+               --{ "pilot_neutral_corellia",           PILOT_CORELLIA },
+               --{ "pilot_rebel_navy_tatooine",        PILOT_REBEL_NAVY_TATOOINE },
+               --{ "pilot_imperial_navy_naboo",        PILOT_IMPERIAL_NAVY_NABOO },
+               { "crafting_architect_master",          CRAFTING_ARCHITECT_MASTER  },
+               { "crafting_armorsmith_master",         CRAFTING_ARMORSMITH_MASTER  },
+               { "crafting_artisan_master",            CRAFTING_ARTISAN_MASTER  },
+               { "outdoors_bio_engineer_master",       OUTDOORS_BIOENGINEER_MASTER  },
+               { "combat_bountyhunter_master",         COMBAT_BOUNTYHUNTER_MASTER  },
+               { "combat_brawler_master",              COMBAT_BRAWLER_MASTER  },
+               { "combat_carbine_master",              COMBAT_CARBINE_MASTER  },
+               { "crafting_chef_master",               CRAFTING_CHEF_MASTER  },
+               { "science_combatmedic_master",         SCIENCE_COMBATMEDIC_MASTER  },
+               { "combat_commando_master",             COMBAT_COMMANDO_MASTER  },
+               --{ "outdoors_creaturehandler_master",  OUTDOORS_CREATUREHANDLER_MASTER  },
+               { "social_dancer_master",               SOCIAL_DANCER_MASTER  },
+               { "science_doctor_master",              SCIENCE_DOCTOR_MASTER  },
+               { "crafting_droidengineer_master",      CRAFTING_DROIDENGINEER_MASTER  },
+               { "social_entertainer_master",          SOCIAL_ENTERTAINER_MASTER  },
+               { "combat_1hsword_master",              COMBAT_1HSWORD_MASTER  },
+               { "social_imagedesigner_master",        SOCIAL_IMAGEDESIGNER_MASTER  },
+               { "combat_marksman_master",             COMBAT_MARKSMAN_MASTER  },
+               { "science_medic_master",               SCIENCE_MEDIC_MASTER  },
+               { "crafting_merchant_master",           CRAFTING_MERCHANT_MASTER  },
+               { "social_musician_master",             SOCIAL_MUSICIAN_MASTER  },
+               { "combat_polearm_master",              COMBAT_POLEARM_MASTER  },
+               { "combat_pistol_master",               COMBAT_PISTOL_MASTER  },
+               --{ "social_politician_master",         SOCIAL_POLITICIAN_MASTER  },
+               { "outdoors_ranger_master",             OUTDOORS_RANGER_MASTER  },
+               { "combat_rifleman_master",             COMBAT_RIFLEMAN_MASTER  },
+               { "outdoors_scout_master",              OUTDOORS_SCOUT_MASTER  },
+               --{ "crafting_shipwright",              CRAFTING_SHIPWRIGHT },
+               { "combat_smuggler_master",             COMBAT_SMUGGLER_MASTER  },
+               { "outdoors_squadleader_master",        OUTDOORS_SQUADLEADER_MASTER  },
+               { "combat_2hsword_master",              COMBAT_2HSWORD_MASTER  },
+               { "crafting_tailor_master",             CRAFTING_TAILOR_MASTER  },
+               { "crafting_weaponsmith_master",        CRAFTING_WEAPONSMITH_MASTER  },
+               --{ "pilot_neutral_naboo",              PILOT_NEUTRAL_NABOO },
+               --{ "pilot_neutral_tatooine",           PILOT_TATOOINE },
+               --{ "pilot_imperial_navy_tatooine",     PILOT_IMPERIAL_NAVY_TATOOINE },
+               { "combat_unarmed_master",              COMBAT_UNARMED_MASTER  },
+               --{ "pilot_rebel_navy_naboo",           PILOT_REBEL_NAVY_NABOO }
        }
        return grindableProfessions
 end
index 89b9ba6..f05df80 100644 (file)
@@ -6,7 +6,7 @@ HOLOCRONJEDIPROGRESSION = 1
 VILLAGEJEDIPROGRESSION = 2
 CUSTOMJEDIPROGRESSION = 3
 
-jediProgressionType = NOJEDIPROGRESSION
+jediProgressionType = VILLAGEJEDIPROGRESSION
 
 jediManagerName = "JediManager"
 
index 25890b9..ca9302c 100644 (file)
@@ -68,6 +68,29 @@ describe("Village Jedi Manager", function()
                                VillageJediManager.cannotUseHolocron = realCannotUseHolocron
                        end)
                end)
+
+               describe("checkForceStatusCommand", function()
+                       it("Should call getJediProgressionStatus and send the appropriate string id to the player", function()
+                               local pCreatureObject = { "creatureObjectPointer" }
+                               local sendSystemMessageSpy = spy.new(function() end)
+                               local creatureObject = { sendSystemMessage = sendSystemMessageSpy }
+                               local realWithCreatureObject = VillageJediManager.withCreatureObject
+                               VillageJediManager.withCreatureObject = spy.new(function(pCreatureObject, performThisFunction)
+                                       return performThisFunction(creatureObject)
+                               end)
+                               local realGetJediProgressionStatus = VillageJediManager.getJediProgressionStatus
+                               VillageJediManager.getJediProgressionStatus = spy.new(function() return 2 end)
+
+                               VillageJediManager:checkForceStatusCommand(pCreatureObject)
+
+                               assert.spy(VillageJediManager.withCreatureObject).was.called(1)
+                               assert.spy(VillageJediManager.getJediProgressionStatus).was.called_with(pCreatureObject)
+                               assert.spy(sendSystemMessageSpy).was.called_with(creatureObject, "@jedi_spam:fs_progress_2")
+
+                               VillageJediManager.withCreatureObject = realWithCreatureObject
+                               VillageJediManager.getJediProgressionStatus = realGetJediProgressionStatus
+                       end)
+               end)
        end)
 
        describe("Private functions", function() 
@@ -242,5 +265,156 @@ describe("Village Jedi Manager", function()
                                VillageJediManager.withCreatureObject = realWithCreatureObject
                        end)
                end)
+
+               describe("countBadgesInListToUpperLimit", function()
+                       it("Should check if the player has each badge number in the list", function()
+                               local pCreatureObject = { "creatureObjectPointer" }
+                               local list = { 1, 2, 3, 4 }
+                               local currentListItem = 0
+                               local hasBadgeSpy = spy.new(function(playerObject, badgeNumber)
+                                       currentListItem = currentListItem + 1
+                                       return badgeNumber == list[currentListItem] 
+                               end)
+                               local playerObject = { hasBadge = hasBadgeSpy }
+                               local realWithCreaturePlayerObject = VillageJediManager.withCreaturePlayerObject
+                               VillageJediManager.withCreaturePlayerObject = spy.new(function(pCreatureObject, performThisFunction)
+                                       return performThisFunction(playerObject)
+                               end)
+
+                               assert.is.same(VillageJediManager.countBadgesInListToUpperLimit(pCreatureObject, list, 10), 4)
+
+                               assert.spy(hasBadgeSpy).was.called(4)
+                               assert.spy(VillageJediManager.withCreaturePlayerObject).was.called(1)
+
+                               VillageJediManager.withCreaturePlayerObject = realWithCreaturePlayerObject
+                       end)
+
+                       it("Should return the correct number of badges that the player has", function()
+                               local pCreatureObject = { "creatureObjectPointer" }
+                               local list = { 1, 2, 3, 4 }
+                               local hasBadgeSpy = spy.new(function(playerObject, badgeNumber) 
+                                       return badgeNumber < 3 
+                               end)
+                               local playerObject = { hasBadge = hasBadgeSpy }
+                               local realWithCreaturePlayerObject = VillageJediManager.withCreaturePlayerObject
+                               VillageJediManager.withCreaturePlayerObject = spy.new(function(pCreatureObject, performThisFunction)
+                                       return performThisFunction(playerObject)
+                               end)
+
+                               assert.is.same(VillageJediManager.countBadgesInListToUpperLimit(pCreatureObject, list, 10), 2)
+
+                               assert.spy(hasBadgeSpy).was.called(4)
+                               assert.spy(VillageJediManager.withCreaturePlayerObject).was.called(1)
+
+                               VillageJediManager.withCreaturePlayerObject = realWithCreaturePlayerObject
+                       end)
+
+                       it("Should abort the counting early if upper limit is reached", function()
+                               local pCreatureObject = { "creatureObjectPointer" }
+                               local list = { 1, 2, 3, 4 }
+                               local hasBadgeSpy = spy.new(function(playerObject, badgeNumber) 
+                                       return badgeNumber < 4 
+                               end)
+                               local playerObject = { hasBadge = hasBadgeSpy }
+                               local realWithCreaturePlayerObject = VillageJediManager.withCreaturePlayerObject
+                               VillageJediManager.withCreaturePlayerObject = spy.new(function(pCreatureObject, performThisFunction)
+                                       return performThisFunction(playerObject)
+                               end)
+
+                               assert.is.same(VillageJediManager.countBadgesInListToUpperLimit(pCreatureObject, list, 2), 2)
+
+                               assert.spy(hasBadgeSpy).was.called(2)
+                               assert.spy(VillageJediManager.withCreaturePlayerObject).was.called(1)
+
+                               VillageJediManager.withCreaturePlayerObject = realWithCreaturePlayerObject
+                       end)
+               end)
+
+               describe("countBadges", function()
+                       it("Should call the countBadgesInListToUpperLimit five times with correct arguments", function()
+                               local pCreatureObject = { "creatureObjectPointer" }
+                               local argumentList = {
+                                       { PROFESSIONBADGES, 1, false },
+                                       { JEDIBADGES, 3, false },
+                                       { CONTENTBADGES, 5, false },
+                                       { DIFFICULTBADGES, 3, false },
+                                       { EASYBADGES, 5, false }
+                               }
+                               local realCountBadgesInListToUpperLimit = VillageJediManager.countBadgesInListToUpperLimit
+                               VillageJediManager.countBadgesInListToUpperLimit = spy.new(function(pCO, l, n)
+                                       for i = 1, table.getn(argumentList), 1 do
+                                               if argumentList[i][1] == l and argumentList[i][2] == n and pCO == pCreatureObject then
+                                                       argumentList[i][3] = true
+                                               end
+                                       end
+                                       return 0
+                               end)
+
+                               assert.is.same(VillageJediManager.countBadges(pCreatureObject), 0)
+
+                               assert.is.same(argumentList[1][3] and argumentList[2][3] and argumentList[3][3] and argumentList[4][3] and argumentList[5][3], true)
+                               assert.spy(VillageJediManager.countBadgesInListToUpperLimit).was.called(5)
+
+                               VillageJediManager.countBadgesInListToUpperLimit = realCountBadgesInListToUpperLimit
+                       end)
+
+                       it("Should sum the return values from countBadgesInListToUpperLimit", function()
+                               local pCreatureObject = { "creatureObjectPointer" }
+                               local returnList = { 
+                                       1, 1, 1, 1, 1, 
+                                       2, 2, 2, 2, 2, 
+                                       3, 3, 3, 3, 3, 
+                                       3, 4, 3, 6, 7 
+                               }
+                               local returnNo = 0
+                               local realCountBadgesInListToUpperLimit = VillageJediManager.countBadgesInListToUpperLimit
+                               VillageJediManager.countBadgesInListToUpperLimit = spy.new(function()
+                                       returnNo = returnNo + 1
+                                       return returnList[returnNo]
+                               end)
+                               
+                               assert.is.same(VillageJediManager.countBadges(pCreatureObject), 5)
+                               assert.is.same(VillageJediManager.countBadges(pCreatureObject), 10)
+                               assert.is.same(VillageJediManager.countBadges(pCreatureObject), 15)
+                               assert.is.same(VillageJediManager.countBadges(pCreatureObject), 23)
+
+                               VillageJediManager.countBadgesInListToUpperLimit = realCountBadgesInListToUpperLimit
+                       end)
+               end)
+
+               describe("getJediProgressionStatus", function()
+                       it("Should return linear values between 0 and 5 depending on the number of counted badges", function()
+                               local pCreatureObject = { "creatureObjectPointer" }
+                               local returnValue = -1
+                               local realCountBadges = VillageJediManager.countBadges
+                               VillageJediManager.countBadges = spy.new(function() 
+                                       returnValue = returnValue + 1 
+                                       return returnValue 
+                               end)
+
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 0)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 0)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 0)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 0)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 1)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 1)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 1)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 2)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 2)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 2)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 2)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 3)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 3)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 3)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 4)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 4)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 4)
+                               assert.is.same(VillageJediManager.getJediProgressionStatus(pCreatureObject), 5)
+
+                               assert.spy(VillageJediManager.countBadges).was.called(18)
+
+                               VillageJediManager.countBadges = realCountBadges
+                       end)
+               end)
        end)
 end)
index ad2d2e7..5fd9cac 100644 (file)
@@ -3,6 +3,119 @@ JediManager = require("jedi_manager")
 
 jediManagerName = "VillageJediManager"
 
+JEDIBADGES = { 
+       EXP_TAT_BENS_HUT, 
+       EXP_YAV_TEMPLE_EXAR_KUN, 
+       EXP_DAN_JEDI_TEMPLE 
+}
+DIFFICULTBADGES = { 
+       EXP_TAT_TUSKEN_POOL, 
+       EXP_TAT_KRAYT_SKELETON, 
+       EXP_TAT_SARLACC_PIT, 
+       EXP_TAT_KRAYT_GRAVEYARD, 
+       EXP_DAT_SARLACC 
+}
+EASYBADGES = {
+       EXP_TAT_ESCAPE_POD,
+       EXP_TAT_LARS_HOMESTEAD,
+       EXP_NAB_GUNGAN_SACRED_PLACE,
+       EXP_COR_AGRILAT_SWAMP,
+       EXP_YAV_TEMPLE_WOOLAMANDER,
+       EXP_YAV_TEMPLE_BLUELEAF,
+       EXP_LOK_VOLCANO,
+       EXP_DAT_TARPIT,
+       EXP_DAT_ESCAPE_POD,
+       EXP_DAT_MISTY_FALLS_1,
+       EXP_DAT_MISTY_FALLS_2,
+       EXP_DAN_REBEL_BASE,
+       BDG_EXP_NAB_THEED_FALLS_BOTTOM,
+       BDG_EXP_NAB_DEEJA_FALLS_TOP,
+       BDG_EXP_NAB_AMIDALAS_SANDY_BEACH,
+       BDG_EXP_COR_REBEL_HIDEOUT,
+       BDG_EXP_COR_ROGUE_CORSEC_BASE,
+       BDG_EXP_COR_TYRENA_THEATER,
+       BDG_EXP_COR_BELA_VISTAL_FOUNTAIN,
+       BDG_EXP_DAT_CRASHED_SHIP,
+       BDG_EXP_DAT_IMP_PRISON,
+       BDG_EXP_DAN_DANTARI_VILLAGE1,
+       BDG_EXP_DAN_DANTARI_VILLAGE2,
+       BDG_EXP_END_EWOK_TREE_VILLAGE,
+       BDG_EXP_END_EWOK_LAKE_VILLAGE,
+       BDG_EXP_END_DULOK_VILLAGE,
+       BDG_EXP_END_IMP_OUTPOST,
+       BDG_EXP_TAL_CREATURE_VILLAGE,
+       BDG_EXP_TAL_IMP_BASE,
+       BDG_EXP_TAL_IMP_VS_REB_BATTLE,
+       BDG_EXP_TAL_AQUALISH_CAVE,
+       BDG_EXP_ROR_KOBALA_SPICE_MINE,
+       BDG_EXP_ROR_REBEL_OUTPOST,
+       BDG_EXP_ROR_IMP_CAMP,
+       BDG_EXP_ROR_IMP_HYPERDRIVE_FAC,
+       BDG_EXP_LOK_KIMOGILA_SKELETON
+}
+CONTENTBADGES = { 
+       BDG_THM_PARK_JABBA_BADGE, 
+       BDG_THM_PARK_IMPERIAL_BADGE, 
+       BDG_THM_PARK_REBEL_BADGE, 
+       BDG_THM_PARK_NYM_BADGE, 
+       BDG_CORVETTE_IMP_DESTROY, 
+       BDG_CORVETTE_IMP_RESCUE, 
+       BDG_CORVETTE_IMP_ASSASSIN, 
+       BDG_CORVETTE_NEUTRAL_DESTROY, 
+       BDG_CORVETTE_NEUTRAL_RESCUE, 
+       BDG_CORVETTE_NEUTRAL_ASSASSIN, 
+       BDG_CORVETTE_REB_DESTROY, 
+       BDG_CORVETTE_REB_RESCUE, 
+       BDG_CORVETTE_REB_ASSASSIN, 
+       WARREN_COMPASSION, 
+       WARREN_HERO 
+}
+PROFESSIONBADGES = { 
+       COMBAT_1HSWORD_MASTER, 
+       COMBAT_2HSWORD_MASTER, 
+       COMBAT_BOUNTYHUNTER_MASTER, 
+       COMBAT_BRAWLER_MASTER, 
+       COMBAT_CARBINE_MASTER, 
+       COMBAT_COMMANDO_MASTER, 
+       COMBAT_MARKSMAN_MASTER, 
+       COMBAT_PISTOL_MASTER, 
+       COMBAT_POLEARM_MASTER, 
+       COMBAT_RIFLEMAN_MASTER, 
+       COMBAT_SMUGGLER_MASTER, 
+       COMBAT_UNARMED_MASTER, 
+       CRAFTING_ARCHITECT_MASTER, 
+       CRAFTING_ARMORSMITH_MASTER, 
+       CRAFTING_ARTISAN_MASTER, 
+       CRAFTING_CHEF_MASTER, 
+       CRAFTING_DROIDENGINEER_MASTER, 
+       CRAFTING_MERCHANT_MASTER, 
+       CRAFTING_TAILOR_MASTER, 
+       CRAFTING_WEAPONSMITH_MASTER, 
+       OUTDOORS_BIOENGINEER_MASTER, 
+       OUTDOORS_CREATUREHANDLER_MASTER, 
+       OUTDOORS_RANGER_MASTER, 
+       OUTDOORS_SCOUT_MASTER, 
+       OUTDOORS_SQUADLEADER_MASTER, 
+       SCIENCE_COMBATMEDIC_MASTER, 
+       SCIENCE_DOCTOR_MASTER, 
+       SCIENCE_MEDIC_MASTER, 
+       SOCIAL_DANCER_MASTER, 
+       SOCIAL_ENTERTAINER_MASTER, 
+       SOCIAL_IMAGEDESIGNER_MASTER, 
+       SOCIAL_MUSICIAN_MASTER, 
+       SOCIAL_POLITICIAN_MASTER, 
+       CRAFTING_SHIPWRIGHT, 
+       PILOT_REBEL_NAVY_NABOO, 
+       PILOT_REBEL_NAVY_CORELLIA, 
+       PILOT_REBEL_NAVY_TATOOINE, 
+       PILOT_IMPERIAL_NAVY_NABOO, 
+       PILOT_IMPERIAL_NAVY_CORELLIA, 
+       PILOT_IMPERIAL_NAVY_TATOOINE, 
+       PILOT_NEUTRAL_NABOO, 
+       PILOT_CORELLIA, 
+       PILOT_TATOOINE 
+}
+
 USEDHOLOCRON = "used_holocron"
 HOLOCRONCOOLDOWNTIME = 24 * 60 * 60 * 1000 -- 24 hours
 
@@ -78,6 +191,54 @@ function VillageJediManager:useHolocron(pSceneObject, pCreatureObject)
        end
 end
 
+-- Count the number of badges that the player got in the list.
+-- @param pCreatureObject pointer to the creature object of the player.
+-- @param list the list of badge numbers to check if the player has.
+-- @param upperLimit only count up to this limit.
+-- @return the number of badges in the list that the player has been awarded
+function VillageJediManager.countBadgesInListToUpperLimit(pCreatureObject, list, upperLimit)
+       local numberOfBadges = 0
+       VillageJediManager.withCreaturePlayerObject(pCreatureObject, function(playerObject)
+               for i = 1, table.getn(list), 1 do
+                       if playerObject:hasBadge(list[i]) then
+                               numberOfBadges = numberOfBadges + 1
+                               if numberOfBadges >= upperLimit then
+                                       break
+                               end
+                       end
+               end
+       end)
+       return numberOfBadges
+end
+
+-- Count the total number of badges towards the jedi progression for the player
+-- @param pCreatureObject pointer to the creature object of the player.
+-- @return the total number of interesting badges.
+function VillageJediManager.countBadges(pCreatureObject)
+       local professionBadges = VillageJediManager.countBadgesInListToUpperLimit(pCreatureObject, PROFESSIONBADGES, 1)
+       local jediBadges = VillageJediManager.countBadgesInListToUpperLimit(pCreatureObject, JEDIBADGES, 3)
+       local contentBadges = VillageJediManager.countBadgesInListToUpperLimit(pCreatureObject, CONTENTBADGES, 5)
+       local difficultBadges = VillageJediManager.countBadgesInListToUpperLimit(pCreatureObject, DIFFICULTBADGES, 3)
+       local easyBadges = VillageJediManager.countBadgesInListToUpperLimit(pCreatureObject, EASYBADGES, 5)
+       return professionBadges + jediBadges + contentBadges + difficultBadges + easyBadges
+end
+
+-- Get the jedi progression status for the player
+-- @param pCreatureObject pointer to the creature object of the player.
+-- @return the jedi progression status, 0 to 5 to be used to return correct string id to the player.
+function VillageJediManager.getJediProgressionStatus(pCreatureObject)
+       local numberOfBadges = VillageJediManager.countBadges(pCreatureObject)
+       return math.floor((numberOfBadges / 17) * 5)
+end
+
+-- Handling of the checkForceStatus command.
+-- @param pCreatureObject pointer to the creature object of the player who performed the command
+function VillageJediManager:checkForceStatusCommand(pCreatureObject)
+       VillageJediManager.withCreatureObject(pCreatureObject, function(creatureObject)
+               creatureObject:sendSystemMessage("@jedi_spam:fs_progress_" .. VillageJediManager.getJediProgressionStatus(pCreatureObject))
+       end)
+end
+
 registerScreenPlay("VillageJediManager", true)
 
 return VillageJediManager
index d577b59..3fa91a8 100644 (file)
@@ -235,6 +235,148 @@ void DirectorManager::initializeLuaEngine(Lua* luaEngine) {
        luaEngine->setGlobalInt("BEHAVIOR_SUSPENDED",Behavior::SUSPENDED);
        luaEngine->setGlobalInt("BEHAVIOR_INVALID",Behavior::INVALID);
 
+       // Badges
+       luaEngine->setGlobalInt("COUNT_5", Badge::COUNT_5);
+       luaEngine->setGlobalInt("COUNT_10", Badge::COUNT_10);
+       luaEngine->setGlobalInt("COUNT_25", Badge::COUNT_25);
+       luaEngine->setGlobalInt("COUNT_50", Badge::COUNT_50);
+       luaEngine->setGlobalInt("COUNT_75", Badge::COUNT_75);
+       luaEngine->setGlobalInt("COUNT_100", Badge::COUNT_100);
+       luaEngine->setGlobalInt("COUNT_125", Badge::COUNT_125);
+       luaEngine->setGlobalInt("POI_RABIDBEAST", Badge::POI_RABIDBEAST);
+       luaEngine->setGlobalInt("POI_PRISONBREAK", Badge::POI_PRISONBREAK);
+       luaEngine->setGlobalInt("POI_TWOLIARS", Badge::POI_TWOLIARS);
+       luaEngine->setGlobalInt("POI_FACTORYLIBERATION", Badge::POI_FACTORYLIBERATION);
+       luaEngine->setGlobalInt("POI_FACTORYLIBERATION", Badge::POI_FACTORYLIBERATION);
+       luaEngine->setGlobalInt("POI_HEROMARK", Badge::POI_HEROMARK);
+       luaEngine->setGlobalInt("EXP_TAT_BENS_HUT", Badge::EXP_TAT_BENS_HUT);
+       luaEngine->setGlobalInt("EXP_TAT_TUSKEN_POOL", Badge::EXP_TAT_TUSKEN_POOL);
+       luaEngine->setGlobalInt("EXP_TAT_KRAYT_SKELETON", Badge::EXP_TAT_KRAYT_SKELETON);
+       luaEngine->setGlobalInt("EXP_TAT_ESCAPE_POD", Badge::EXP_TAT_ESCAPE_POD);
+       luaEngine->setGlobalInt("EXP_TAT_SARLACC_PIT", Badge::EXP_TAT_SARLACC_PIT);
+       luaEngine->setGlobalInt("EXP_TAT_LARS_HOMESTEAD", Badge::EXP_TAT_LARS_HOMESTEAD);
+       luaEngine->setGlobalInt("EXP_TAT_KRAYT_GRAVEYARD", Badge::EXP_TAT_KRAYT_GRAVEYARD);
+       luaEngine->setGlobalInt("EXP_NAB_GUNGAN_SACRED_PLACE", Badge::EXP_NAB_GUNGAN_SACRED_PLACE);
+       luaEngine->setGlobalInt("EXP_COR_AGRILAT_SWAMP", Badge::EXP_COR_AGRILAT_SWAMP);
+       luaEngine->setGlobalInt("EXP_YAV_TEMPLE_WOOLAMANDER", Badge::EXP_YAV_TEMPLE_WOOLAMANDER);
+       luaEngine->setGlobalInt("EXP_YAV_TEMPLE_BLUELEAF", Badge::EXP_YAV_TEMPLE_BLUELEAF);
+       luaEngine->setGlobalInt("EXP_YAV_TEMPLE_EXAR_KUN", Badge::EXP_YAV_TEMPLE_EXAR_KUN);
+       luaEngine->setGlobalInt("EXP_LOK_VOLCANO", Badge::EXP_LOK_VOLCANO);
+       luaEngine->setGlobalInt("EXP_DAT_TARPIT", Badge::EXP_DAT_TARPIT);
+       luaEngine->setGlobalInt("EXP_DAT_SARLACC", Badge::EXP_DAT_SARLACC);
+       luaEngine->setGlobalInt("EXP_DAT_ESCAPE_POD", Badge::EXP_DAT_ESCAPE_POD);
+       luaEngine->setGlobalInt("EXP_DAT_MISTY_FALLS_1", Badge::EXP_DAT_MISTY_FALLS_1);
+       luaEngine->setGlobalInt("EXP_DAT_MISTY_FALLS_2", Badge::EXP_DAT_MISTY_FALLS_2);
+       luaEngine->setGlobalInt("EXP_DAN_JEDI_TEMPLE", Badge::EXP_DAN_JEDI_TEMPLE);
+       luaEngine->setGlobalInt("EXP_DAN_REBEL_BASE", Badge::EXP_DAN_REBEL_BASE);
+       luaEngine->setGlobalInt("EVENT_PROJECT_DEAD_EYE_1", Badge::EVENT_PROJECT_DEAD_EYE_1);
+       luaEngine->setGlobalInt("ACC_GOOD_SAMARITAN", Badge::ACC_GOOD_SAMARITAN);
+       luaEngine->setGlobalInt("ACC_FASCINATING_BACKGROUND", Badge::ACC_FASCINATING_BACKGROUND);
+       luaEngine->setGlobalInt("ACC_BRAVE_SOLDIER", Badge::ACC_BRAVE_SOLDIER);
+       luaEngine->setGlobalInt("ACC_INTERESTING_PERSONAGE", Badge::ACC_INTERESTING_PERSONAGE);
+       luaEngine->setGlobalInt("ACC_PROFESSIONAL_DEMEANOR", Badge::ACC_PROFESSIONAL_DEMEANOR);
+       luaEngine->setGlobalInt("WARREN_COMPASSION", Badge::WARREN_COMPASSION);
+       luaEngine->setGlobalInt("WARREN_HERO", Badge::WARREN_HERO);
+       luaEngine->setGlobalInt("EVENT_COA2_REBEL", Badge::EVENT_COA2_REBEL);
+       luaEngine->setGlobalInt("EVENT_COA2_IMPERIAL", Badge::EVENT_COA2_IMPERIAL);
+       luaEngine->setGlobalInt("COMBAT_1HSWORD_MASTER", Badge::COMBAT_1HSWORD_MASTER);
+       luaEngine->setGlobalInt("COMBAT_2HSWORD_MASTER", Badge::COMBAT_2HSWORD_MASTER);
+       luaEngine->setGlobalInt("COMBAT_BOUNTYHUNTER_MASTER", Badge::COMBAT_BOUNTYHUNTER_MASTER);
+       luaEngine->setGlobalInt("COMBAT_BRAWLER_MASTER", Badge::COMBAT_BRAWLER_MASTER);
+       luaEngine->setGlobalInt("COMBAT_CARBINE_MASTER", Badge::COMBAT_CARBINE_MASTER);
+       luaEngine->setGlobalInt("COMBAT_COMMANDO_MASTER", Badge::COMBAT_COMMANDO_MASTER);
+       luaEngine->setGlobalInt("COMBAT_MARKSMAN_MASTER", Badge::COMBAT_MARKSMAN_MASTER);
+       luaEngine->setGlobalInt("COMBAT_PISTOL_MASTER", Badge::COMBAT_PISTOL_MASTER);
+       luaEngine->setGlobalInt("COMBAT_POLEARM_MASTER", Badge::COMBAT_POLEARM_MASTER);
+       luaEngine->setGlobalInt("COMBAT_RIFLEMAN_MASTER", Badge::COMBAT_RIFLEMAN_MASTER);
+       luaEngine->setGlobalInt("COMBAT_SMUGGLER_MASTER", Badge::COMBAT_SMUGGLER_MASTER);
+       luaEngine->setGlobalInt("COMBAT_UNARMED_MASTER", Badge::COMBAT_UNARMED_MASTER);
+       luaEngine->setGlobalInt("CRAFTING_ARCHITECT_MASTER", Badge::CRAFTING_ARCHITECT_MASTER);
+       luaEngine->setGlobalInt("CRAFTING_ARMORSMITH_MASTER", Badge::CRAFTING_ARMORSMITH_MASTER);
+       luaEngine->setGlobalInt("CRAFTING_ARTISAN_MASTER", Badge::CRAFTING_ARTISAN_MASTER);
+       luaEngine->setGlobalInt("CRAFTING_CHEF_MASTER", Badge::CRAFTING_CHEF_MASTER);
+       luaEngine->setGlobalInt("CRAFTING_DROIDENGINEER_MASTER", Badge::CRAFTING_DROIDENGINEER_MASTER);
+       luaEngine->setGlobalInt("CRAFTING_MERCHANT_MASTER", Badge::CRAFTING_MERCHANT_MASTER);
+       luaEngine->setGlobalInt("CRAFTING_TAILOR_MASTER", Badge::CRAFTING_TAILOR_MASTER);
+       luaEngine->setGlobalInt("CRAFTING_WEAPONSMITH_MASTER", Badge::CRAFTING_WEAPONSMITH_MASTER);
+       luaEngine->setGlobalInt("OUTDOORS_BIOENGINEER_MASTER", Badge::OUTDOORS_BIOENGINEER_MASTER);
+       luaEngine->setGlobalInt("OUTDOORS_CREATUREHANDLER_MASTER", Badge::OUTDOORS_CREATUREHANDLER_MASTER);
+       luaEngine->setGlobalInt("OUTDOORS_RANGER_MASTER", Badge::OUTDOORS_RANGER_MASTER);
+       luaEngine->setGlobalInt("OUTDOORS_SCOUT_MASTER", Badge::OUTDOORS_SCOUT_MASTER);
+       luaEngine->setGlobalInt("OUTDOORS_SQUADLEADER_MASTER", Badge::OUTDOORS_SQUADLEADER_MASTER);
+       luaEngine->setGlobalInt("SCIENCE_COMBATMEDIC_MASTER", Badge::SCIENCE_COMBATMEDIC_MASTER);
+       luaEngine->setGlobalInt("SCIENCE_DOCTOR_MASTER", Badge::SCIENCE_DOCTOR_MASTER);
+       luaEngine->setGlobalInt("SCIENCE_MEDIC_MASTER", Badge::SCIENCE_MEDIC_MASTER);
+       luaEngine->setGlobalInt("SOCIAL_DANCER_MASTER", Badge::SOCIAL_DANCER_MASTER);
+       luaEngine->setGlobalInt("SOCIAL_ENTERTAINER_MASTER", Badge::SOCIAL_ENTERTAINER_MASTER);
+       luaEngine->setGlobalInt("SOCIAL_IMAGEDESIGNER_MASTER", Badge::SOCIAL_IMAGEDESIGNER_MASTER);
+       luaEngine->setGlobalInt("SOCIAL_MUSICIAN_MASTER", Badge::SOCIAL_MUSICIAN_MASTER);
+       luaEngine->setGlobalInt("SOCIAL_POLITICIAN_MASTER", Badge::SOCIAL_POLITICIAN_MASTER);
+       luaEngine->setGlobalInt("BDG_EXP_NAB_THEED_FALLS_BOTTOM", Badge::BDG_EXP_NAB_THEED_FALLS_BOTTOM);
+       luaEngine->setGlobalInt("BDG_EXP_NAB_DEEJA_FALLS_TOP", Badge::BDG_EXP_NAB_DEEJA_FALLS_TOP);
+       luaEngine->setGlobalInt("BDG_EXP_NAB_AMIDALAS_SANDY_BEACH", Badge::BDG_EXP_NAB_AMIDALAS_SANDY_BEACH);
+       luaEngine->setGlobalInt("BDG_EXP_COR_REBEL_HIDEOUT", Badge::BDG_EXP_COR_REBEL_HIDEOUT);
+       luaEngine->setGlobalInt("BDG_EXP_COR_ROGUE_CORSEC_BASE", Badge::BDG_EXP_COR_ROGUE_CORSEC_BASE);
+       luaEngine->setGlobalInt("BDG_EXP_COR_TYRENA_THEATER", Badge::BDG_EXP_COR_TYRENA_THEATER);
+       luaEngine->setGlobalInt("BDG_EXP_COR_BELA_VISTAL_FOUNTAIN", Badge::BDG_EXP_COR_BELA_VISTAL_FOUNTAIN);
+       luaEngine->setGlobalInt("BDG_EXP_DAT_CRASHED_SHIP", Badge::BDG_EXP_DAT_CRASHED_SHIP);
+       luaEngine->setGlobalInt("BDG_EXP_DAT_IMP_PRISON", Badge::BDG_EXP_DAT_IMP_PRISON);
+       luaEngine->setGlobalInt("BDG_EXP_DAN_DANTARI_VILLAGE1", Badge::BDG_EXP_DAN_DANTARI_VILLAGE1);
+       luaEngine->setGlobalInt("BDG_EXP_DAN_DANTARI_VILLAGE2", Badge::BDG_EXP_DAN_DANTARI_VILLAGE2);
+       luaEngine->setGlobalInt("BDG_EXP_END_EWOK_TREE_VILLAGE", Badge::BDG_EXP_END_EWOK_TREE_VILLAGE);
+       luaEngine->setGlobalInt("BDG_EXP_END_EWOK_LAKE_VILLAGE", Badge::BDG_EXP_END_EWOK_LAKE_VILLAGE);
+       luaEngine->setGlobalInt("BDG_EXP_END_DULOK_VILLAGE", Badge::BDG_EXP_END_DULOK_VILLAGE);
+       luaEngine->setGlobalInt("BDG_EXP_END_IMP_OUTPOST", Badge::BDG_EXP_END_IMP_OUTPOST);
+       luaEngine->setGlobalInt("BDG_EXP_TAL_CREATURE_VILLAGE", Badge::BDG_EXP_TAL_CREATURE_VILLAGE);
+       luaEngine->setGlobalInt("BDG_EXP_TAL_IMP_BASE", Badge::BDG_EXP_TAL_IMP_BASE);
+       luaEngine->setGlobalInt("BDG_EXP_TAL_IMP_VS_REB_BATTLE", Badge::BDG_EXP_TAL_IMP_VS_REB_BATTLE);
+       luaEngine->setGlobalInt("BDG_EXP_TAL_AQUALISH_CAVE", Badge::BDG_EXP_TAL_AQUALISH_CAVE);
+       luaEngine->setGlobalInt("BDG_EXP_ROR_KOBALA_SPICE_MINE", Badge::BDG_EXP_ROR_KOBALA_SPICE_MINE);
+       luaEngine->setGlobalInt("BDG_EXP_ROR_REBEL_OUTPOST", Badge::BDG_EXP_ROR_REBEL_OUTPOST);
+       luaEngine->setGlobalInt("BDG_EXP_ROR_IMP_CAMP", Badge::BDG_EXP_ROR_IMP_CAMP);
+       luaEngine->setGlobalInt("BDG_EXP_ROR_IMP_HYPERDRIVE_FAC", Badge::BDG_EXP_ROR_IMP_HYPERDRIVE_FAC);
+       luaEngine->setGlobalInt("BDG_EXP_LOK_KIMOGILA_SKELETON", Badge::BDG_EXP_LOK_KIMOGILA_SKELETON);
+       luaEngine->setGlobalInt("BDG_EXP_10_BADGES", Badge::BDG_EXP_10_BADGES);
+       luaEngine->setGlobalInt("BDG_EXP_20_BADGES", Badge::BDG_EXP_20_BADGES);
+       luaEngine->setGlobalInt("BDG_EXP_30_BADGES", Badge::BDG_EXP_30_BADGES);
+       luaEngine->setGlobalInt("BDG_EXP_40_BADGES", Badge::BDG_EXP_40_BADGES);
+       luaEngine->setGlobalInt("BDG_EXP_45_BADGES", Badge::BDG_EXP_45_BADGES);
+       luaEngine->setGlobalInt("BDG_THM_PARK_JABBA_BADGE", Badge::BDG_THM_PARK_JABBA_BADGE);
+       luaEngine->setGlobalInt("BDG_THM_PARK_IMPERIAL_BADGE", Badge::BDG_THM_PARK_IMPERIAL_BADGE);
+       luaEngine->setGlobalInt("BDG_THM_PARK_REBEL_BADGE", Badge::BDG_THM_PARK_REBEL_BADGE);
+       luaEngine->setGlobalInt("BDG_THM_PARK_NYM_BADGE", Badge::BDG_THM_PARK_NYM_BADGE);
+       luaEngine->setGlobalInt("EVENT_COA3_REBEL", Badge::EVENT_COA3_REBEL);
+       luaEngine->setGlobalInt("EVENT_COA3_IMPERIAL", Badge::EVENT_COA3_IMPERIAL);
+       luaEngine->setGlobalInt("BDG_LIBRARY_TRIVIA", Badge::BDG_LIBRARY_TRIVIA);
+       luaEngine->setGlobalInt("BDG_CORVETTE_IMP_DESTROY", Badge::BDG_CORVETTE_IMP_DESTROY);
+       luaEngine->setGlobalInt("BDG_CORVETTE_IMP_RESCUE", Badge::BDG_CORVETTE_IMP_RESCUE);
+       luaEngine->setGlobalInt("BDG_CORVETTE_IMP_ASSASSIN", Badge::BDG_CORVETTE_IMP_ASSASSIN);
+       luaEngine->setGlobalInt("BDG_CORVETTE_NEUTRAL_DESTROY", Badge::BDG_CORVETTE_NEUTRAL_DESTROY);
+       luaEngine->setGlobalInt("BDG_CORVETTE_NEUTRAL_RESCUE", Badge::BDG_CORVETTE_NEUTRAL_RESCUE);
+       luaEngine->setGlobalInt("BDG_CORVETTE_NEUTRAL_ASSASSIN", Badge::BDG_CORVETTE_NEUTRAL_ASSASSIN);
+       luaEngine->setGlobalInt("BDG_CORVETTE_REB_DESTROY", Badge::BDG_CORVETTE_REB_DESTROY);
+       luaEngine->setGlobalInt("BDG_CORVETTE_REB_RESCUE", Badge::BDG_CORVETTE_REB_RESCUE);
+       luaEngine->setGlobalInt("BDG_CORVETTE_REB_ASSASSIN", Badge::BDG_CORVETTE_REB_ASSASSIN);
+       luaEngine->setGlobalInt("BDG_RACING_AGRILAT_SWAMP", Badge::BDG_RACING_AGRILAT_SWAMP);
+       luaEngine->setGlobalInt("BDG_RACING_KEREN_CITY", Badge::BDG_RACING_KEREN_CITY);
+       luaEngine->setGlobalInt("BDG_RACING_MOS_ESPA", Badge::BDG_RACING_MOS_ESPA);
+       luaEngine->setGlobalInt("BDG_ACCOLADE_LIVE_EVENT", Badge::BDG_ACCOLADE_LIVE_EVENT);
+       luaEngine->setGlobalInt("BDG_RACING_LOK_MARATHON", Badge::BDG_RACING_LOK_MARATHON);
+       luaEngine->setGlobalInt("BDG_RACING_NARMLE_MEMORIAL", Badge::BDG_RACING_NARMLE_MEMORIAL);
+       luaEngine->setGlobalInt("BDG_RACING_NASHAL_RIVER", Badge::BDG_RACING_NASHAL_RIVER);
+       luaEngine->setGlobalInt("DESTROY_DEATHSTAR", Badge::DESTROY_DEATHSTAR);
+       luaEngine->setGlobalInt("CRAFTING_SHIPWRIGHT", Badge::CRAFTING_SHIPWRIGHT);
+       luaEngine->setGlobalInt("PILOT_REBEL_NAVY_NABOO", Badge::PILOT_REBEL_NAVY_NABOO);
+       luaEngine->setGlobalInt("PILOT_REBEL_NAVY_CORELLIA", Badge::PILOT_REBEL_NAVY_CORELLIA);
+       luaEngine->setGlobalInt("PILOT_REBEL_NAVY_TATOOINE", Badge::PILOT_REBEL_NAVY_TATOOINE);
+       luaEngine->setGlobalInt("PILOT_IMPERIAL_NAVY_NABOO", Badge::PILOT_IMPERIAL_NAVY_NABOO);
+       luaEngine->setGlobalInt("PILOT_IMPERIAL_NAVY_CORELLIA", Badge::PILOT_IMPERIAL_NAVY_CORELLIA);
+       luaEngine->setGlobalInt("PILOT_IMPERIAL_NAVY_TATOOINE", Badge::PILOT_IMPERIAL_NAVY_TATOOINE);
+       luaEngine->setGlobalInt("PILOT_NEUTRAL_NABOO", Badge::PILOT_NEUTRAL_NABOO);
+       luaEngine->setGlobalInt("PILOT_CORELLIA", Badge::PILOT_CORELLIA);
+       luaEngine->setGlobalInt("PILOT_TATOOINE", Badge::PILOT_TATOOINE);
+       luaEngine->setGlobalInt("BDG_ACCOLATE_HOME_SHOW", Badge::BDG_ACCOLATE_HOME_SHOW);
+
        Luna<LuaCellObject>::Register(luaEngine->getLuaState());
        Luna<LuaBuildingObject>::Register(luaEngine->getLuaState());
        Luna<LuaCreatureObject>::Register(luaEngine->getLuaState());
index ef9c363..efe6abb 100644 (file)
@@ -47,6 +47,7 @@ which carries forward this exception.
 
 JediManager::JediManager() : Logger("JediManager") {
        jediProgressionType = NOJEDIPROGRESSION;
+       setJediManagerName("JediManager");
 }
 
 JediManager::~JediManager() {
@@ -61,6 +62,12 @@ String JediManager::getJediManagerName() {
        return ret;
 }
 
+void JediManager::setJediManagerName(String name) {
+       Locker writeLock(this);
+
+       jediManagerName = name;
+}
+
 void JediManager::loadConfiguration(Lua* luaEngine) {
        luaEngine->runFile("scripts/managers/jedi_manager.lua");
 
@@ -80,9 +87,7 @@ void JediManager::loadConfiguration(Lua* luaEngine) {
                break;
        }
 
-       Locker writeLock(this);
-
-       jediManagerName = luaEngine->getGlobalString(String("jediManagerName"));
+       setJediManagerName(luaEngine->getGlobalString(String("jediManagerName")));
 
        info("Loaded.", true);
 }
index 62fb3d8..ccfe3f5 100644 (file)
@@ -137,6 +137,12 @@ public:
        String getJediManagerName();
 
        /**
+        * Set the name of the currently active lua jedi manager.
+        * @param name the name of the currently active lua jedi manager.
+        */
+       void setJediManagerName(String name);
+
+       /**
         * Handle the holocron use messages.
         * @param holocron pointer to the holocron object.
         * @param creature the creature that used the holocron.
index 31da15f..babf69c 100644 (file)
@@ -77,6 +77,7 @@ public:
        void SetUp() {
                // Perform setup of common constructs here.
                jediManager = new JediManager();
+               jediManager->setJediManagerName("JediManager");
        }
 
        void TearDown() {
@@ -183,7 +184,7 @@ TEST_F(JediManagerTest, OnPlayerCreatedShouldCallTheOnPlayerCreatedMethodInTheLu
 
        DirectorManager::setSingletonInstance(mockDirectorManager);
 
-       JediManager::instance()->onPlayerCreated(mockCreatureObject);
+       jediManager->onPlayerCreated(mockCreatureObject);
 
        DirectorManager::setSingletonInstance(realDirectorManager);
 }
@@ -203,7 +204,7 @@ TEST_F(JediManagerTest, OnPlayerLoggedInShouldCallTheOnPlayerLoggedInMethodInThe
 
        DirectorManager::setSingletonInstance(mockDirectorManager);
 
-       JediManager::instance()->onPlayerLoggedIn(mockCreatureObject);
+       jediManager->onPlayerLoggedIn(mockCreatureObject);
 
        DirectorManager::setSingletonInstance(realDirectorManager);
 }
@@ -223,7 +224,7 @@ TEST_F(JediManagerTest, OnPlayerLoggedOutShouldCallTheOnPlayerLoggedOutMethodInT
 
        DirectorManager::setSingletonInstance(mockDirectorManager);
 
-       JediManager::instance()->onPlayerLoggedOut(mockCreatureObject);
+       jediManager->onPlayerLoggedOut(mockCreatureObject);
 
        DirectorManager::setSingletonInstance(realDirectorManager);
 }
@@ -243,7 +244,7 @@ TEST_F(JediManagerTest, CheckForceStatusCommandShouldCallTheCheckForceStatusComm
 
        DirectorManager::setSingletonInstance(mockDirectorManager);
 
-       JediManager::instance()->checkForceStatusCommand(mockCreatureObject);
+       jediManager->checkForceStatusCommand(mockCreatureObject);
 
        DirectorManager::setSingletonInstance(realDirectorManager);
 }
@@ -264,7 +265,7 @@ TEST_F(JediManagerTest, UseHolocronShouldCallTheUseHolocronMethodInTheLuaJediMan
 
        DirectorManager::setSingletonInstance(mockDirectorManager);
 
-       JediManager::instance()->useHolocron(mockSceneObject, mockCreatureObject);
+       jediManager->useHolocron(mockSceneObject, mockCreatureObject);
 
        DirectorManager::setSingletonInstance(realDirectorManager);
 }