From 5dea7567b82ed7bdc18ff6dbf68fd19ec9e27079 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Thu, 1 Apr 2010 05:50:21 -0400 Subject: [PATCH] Re-wrote Player:IsCorrectFaction() for the new flag system - changed its arg to be the table of the specific recipe. --- Player.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Player.lua b/Player.lua index 651e1ec..6ad2b5d 100644 --- a/Player.lua +++ b/Player.lua @@ -25,6 +25,8 @@ local _G = getfenv(0) local table = _G.table +local bit = _G.bit + local pairs = _G.pairs ------------------------------------------------------------------------------- @@ -115,10 +117,13 @@ function Player:HasProperRepLevel(rep_data) return has_faction end -function Player:IsCorrectFaction(recipe_flags) - if self.faction == BFAC["Alliance"] and recipe_flags[F.HORDE] and not recipe_flags[F.ALLIANCE] then +function Player:IsCorrectFaction(recipe) + local flags = recipe.flags.common1 + local C1 = private.common_flags_word1 + + if self.faction == BFAC["Alliance"] and bit.band(flags, C1.HORDE) == C1.HORDE and bit.band(flags, C1.ALLIANCE) ~= C1.ALLIANCE then return false - elseif self.faction == BFAC["Horde"] and recipe_flags[F.ALLIANCE] and not recipe_flags[F.HORDE] then + elseif self.faction == BFAC["Horde"] and bit.band(flags, C1.ALLIANCE) == C1.ALLIANCE and bit.band(flags, C1.HORDE) ~= C1.HORDE then return false end return true -- 1.7.9.5