---@class RedNameInfo RedNameInfo = class() local this = RedNameInfo function this:ctor() end function this:Reset() SL:UnRegisterTrigger(LUA_TRIGGER_SET_ACTORNAMECOLOR) end function this:Init() self.redNameInfo={} self:RegistMessages() end function this:RegistMessages() SL:RegisterLuaNetMsg(LuaMessageIdToClient.PK_VALUE_CHANGE,self.PK_VALUE_CHANGE,self) SL:RegisterTrigger(LUA_TRIGGER_SET_ACTORNAMECOLOR,self.LUA_TRIGGER_SET_ACTORNAMECOLOR,self) end function this:PK_VALUE_CHANGE(_,message) local role = SL:GetRoleById(message.rid.id) ---攻城战中不走红名机制 if message.rid.id ~= SL:MeData_GetId() and role and SL:MeData_Check() and InfoManager.loranSiegeInfo:IsMap() then if not InfoManager.loranSiegeInfo:LUA_TRIGGER_CLICK_ROLE(message.rid.id) then SL:SetRedNameColorChange(role,SL:ConvertColorFromHexString("#ff0000")) else SL:SetRedNameColorChange(role,SL:ConvertColorFromHexString("#FFFFFF")) end return end self.redNameInfo[message.rid.id] = message.pkValue if role then local color = cfg_pk_count_post.GetPkValueRedNameColor(message.pkValue) if color then local nameChangeColor = cfg_pk_count_post.GetPkValueNameColor(message.pkValue) local _,_,_,label = cfg_pk_count_post.GetPkInfoByPkValue(message.pkValue) SL:SetRedNameColorChange(role,nameChangeColor) local txt = string.gsub(label, "恶人","e") txt = string.gsub(txt, "阶","#") SL:SetPkIcon(role,txt,color,"redName_font") else SL:SetActorNameColor(role) SL:SetPkIcon(role,nil) end end end function this:IsRedName(id) local pkValue = self.redNameInfo[tonumber(id)] if cfg_pk_count_post.GetInfoByRedNamePkValue(pkValue) then return true end return false end function this:GetPkValueById(id) return self.redNameInfo[tonumber(id)] end function this:IsLimitItemById(pkValue,itemId) local _,_,_,_,shopPurchase = cfg_pk_count_post.GetPkInfoByPkValue(pkValue) if not shopPurchase then return false end return table.contains(shopPurchase,itemId) end function this:IsLimitTransferById(id) local pkValue = self.redNameInfo[tonumber(id)] local _,_,_,_,_,mapTransmission = cfg_pk_count_post.GetPkInfoByPkValue(pkValue) if not mapTransmission then return false end return mapTransmission == 1 end function this:LUA_TRIGGER_SET_ACTORNAMECOLOR(redNameChangeFunc,playerHead,rid) local role = SL:GetRoleById(rid) ---攻城战中不走红名机制 if rid ~= SL:MeData_GetId() and role and SL:MeData_Check() and InfoManager.loranSiegeInfo:IsMap() then if not InfoManager.loranSiegeInfo:LUA_TRIGGER_CLICK_ROLE(rid) then SL:SetRedNameColorChange(role,SL:ConvertColorFromHexString("#ff0000")) else SL:SetRedNameColorChange(role,SL:ConvertColorFromHexString("#FFFFFF")) end return true end local pkValue = self.redNameInfo[tonumber(rid)] if role and pkValue then local color = cfg_pk_count_post.GetPkValueRedNameColor(pkValue) if color then local nameChangeColor = cfg_pk_count_post.GetPkValueNameColor(pkValue) local _,_,_,label = cfg_pk_count_post.GetPkInfoByPkValue(pkValue) redNameChangeFunc(playerHead,nameChangeColor) local txt = string.gsub(label, "恶人","e") txt = string.gsub(txt, "阶","#") SL:SetPkIcon(role,txt,color,"redName_font") return true else SL:SetPkIcon(role,nil) return false end end return false end