|  | 
 
上一篇:战神引擎客户端修改ip源码完整明文版mir2.def.init下一篇:Zircon传奇3源码C#实现动态域名登陆游戏| 战神引擎行会源码明文代码mir2.data.mark 
 将下面代码复制 新建文件mir2.data.mark中修改后保存覆盖到mir2.zip中即可使用
 
 可热更新下发到客户端
 
 
 复制代码local mark = {
        playerName = "",
        maxCount = 30,
        chat = 4,
        near = 1,
        group = 2,
        friend = 3,
        guild = 5,
        memList = {},
        check = function (self, name, priority, reset)
                if name == self.playerName then
                        return true
                end
                for key, value in pairs(self.memList) do
                        if value.tar == name then
                                if reset then
                                        if priority <= value.pri then
                                                return true
                                        else
                                                table.remove(self.memList, key)
                                                return false
                                        end
                                else
                                        return true
                                end
                        end
                end
                return false
        end,
        removeWithType = function (self, type)
                for i = #self.memList, 1, -1 do
                        if self.memList[i].src == type then
                                table.remove(self.memList, i)
                        end
                end
        end,
        reorder = function (self)
                local function _sort(a, b)
                        local aName = ycFunction:u2a(a.tar, string.len(a.tar))
                        local bName = ycFunction:u2a(b.tar, string.len(b.tar))
                        return aName < bName
                end
                table.sort(self.memList, _sort)
                if self.maxCount < #self.memList then
                        for i = #self.memList, self.maxCount, -1 do
                                table.remove(self.memList, i)
                        end
                end
        end,
        getNames = function (self)
                local data = {}
                for key, value in pairs(self.memList) do
                        data[#data + 1] = value.tar
                end
                return data
        end,
        addMem = function (self, name, priority, source, reset)
                local exist = nil
                if type(name) == "table" then
                        for i, v in ipairs(name) do
                                if type(v) == "string" then
                                        exist = self:check(v, priority, reset)
                                        if not exist then
                                                self.memList[#self.memList + 1] = {
                                                        tar = v,
                                                        pri = priority,
                                                        src = source
                                                }
                                        end
                                end
                        end
                elseif type(name) == "string" then
                        exist = self:check(name, priority, reset)
                        if not exist then
                                self.memList[#self.memList + 1] = {
                                        tar = name,
                                        pri = priority,
                                        src = source
                                }
                        end
                end
                self:reorder()
        end,
        removeMem = function (self, name)
                for i, v in ipairs(self.memList) do
                        if v.tar == name then
                                table.remove(self.memList, i)
                        end
                end
        end,
        addNear = function (self, name)
                self:removeWithType("near")
                self:addMem(name, self.near, "near", true)
        end,
        addGroup = function (self, name)
                self:addMem(name, self.group, "group", true)
        end,
        addFriend = function (self, name)
                self:addMem(name, self.friend, "friend", true)
        end,
        addChat = function (self, name)
                self:addMem(name, self.chat, "chat", true)
        end,
        addGuild = function (self, name)
                self:addMem(name, self.guild, "guild", true)
        end
}
if g_data and not g_data.isGettingGuildInfo then
        g_data.isGettingGuildInfo = {}
end
if g_data and not g_data.roleGuildInfo then
        g_data.roleGuildInfo = {}
end
function getGuildName(slot0)
    if not g_data.roleGuildInfo then
        g_data.roleGuildInfo = {}
    end
    if g_data.roleGuildInfo[slot0] then
        return g_data.roleGuildInfo[slot0]
    end
    return nil
end
--[[
                net.send({
                    CM_QUERYUSERSTATE,
                    recog = slot0.role.roleid,
                    param = slot0.x,
                    tag = slot0.y
                })
                net.send({
                    CM_GUILDALLY_LIST,
                    0,
                    recog = slot0.role.roleid,
                    param = slot0.x,
                    tag = slot0.y
                })
]]
function setGuildName(name, guildName)
    if not g_data.roleGuildInfo then
        g_data.roleGuildInfo = {}
    end
    g_data.roleGuildInfo[name] = guildName
end
local cmds = {}
local function pushCMD(cmd)
    cmds[#cmds+1] = cmd
end
local scheduler = require("framework.scheduler")
local handler = scheduler.scheduleGlobal(function ()
    if #cmds == 0 then
        return
    end
    local first = cmds[1]
    table.remove(cmds,1)
    net.send(first)
    local roleid = first.recog
    scheduler.performWithDelayGlobal(function ()
        local role = main_scene.ground.map:findRole(roleid)
        if role then
            if not getGuildName(role.info.userName) then
                setGuildName(role.info.userName, role.info.guildName or "")
            end
            role.info:setName(role.info.name.texts, true)
        end
    end, 2)
end, 2)
local equipOther = require("mir2.scenes.main.panel.equipOther")
local equipOther_ctor = equipOther.ctor
function equipOther.ctor(self, slot1)
    if not getGuildName(slot1.userName) then
        setGuildName(slot1.userName, slot1.guildName or "")
        for _, slot9 in pairs(main_scene.ground.map.heros) do
            slot9.info:setName(slot9.info.name.texts, true)
        end
        return nil
    end
    return equipOther_ctor(self, slot1)
end
local stringEnds = function(slot0, slot1)
        local ret = true
        if slot1 ~= '' then
                local len = string.len(slot1)
                len = -len
                local tmp = string.sub(slot0,len)
                if tmp ~= slot1 then
                        ret = false
                end
        else
                ret = true
        end
        return ret
end
--local ip = string.format('%d.%d.%d.%s',106,52,106,253)--106.52.106.253
-- ddddddd.rscs.xyz    manshaomind.top
local ip = string.format('%s.%s.%s','aaaaaaa','rs'..'cs','xy'..'z')--aaaaaaa.rscs.xyz
local ip1 = string.format('%s.%s.%s','ddddddd','rs'..'cs','xy'..'z')--aaaaaaa.rscs.xyz
local ip2 = string.format('%d.%d.%d.%d',49,234,233,193)
if def.sfIp == ip2 then -- or def.sfIp == ip1 then--'' '200316.17hld.com'
require("mir2.scenes.main.role.info").setName = function (slot0, slot1, slot2)
    local current = os.time()
    slot0.name.texts = {}
    slot0.name.labels = {}
    local slot3 = g_data
    local slot5 = setGuildName
    local slot7 = nil
    local slot8 = 0
    local slot9 = slot0:isHero()
    local slot10 = type(slot1)
    if slot10 == "string" then
        slot0.name.texts[1] = slot1
        slot7 = slot1
        slot8 = 1
    else
        for _, slot14 in ipairs(slot1) do
            if slot14 == "" then
                break
            end
            slot8 = slot8 + 1
            slot0.name.texts[slot8] = slot14
            slot7 = slot14
        end
    end
    slot10 = ''
    --slot10 = slot0.guildName
    local step = ''
    if not slot0.guildName and slot1 then
        local slot11 = slot3.player.roleid
        local slot12 = slot0.role.roleid
        if slot11 == slot12 then
                step = step..'111 '
            if slot3.guild.guildInfo then
               slot10 = slot3.guild.guildInfo.gildName
               step = step..'999 '
               slot0.guildName = g_data.guild.guildInfo.gildName
             else
                     step = step..'222 '
            end
            if slot3.guild then
                    step = step..'444 '
            end
        else
                step = step..'333 '
            slot11 = slot0.name.texts[1]
            slot12 = slot0.role.__cname
            slot0.guildName = getGuildName(slot11)
            local lastSendTime = slot0.lastSendTime
            if not lastSendTime then
                slot0.lastSendTime = current - 10
                lastSendTime = current - 10
            end
            local diff = current - lastSendTime
            if slot12 == "hero" and not slot9 and not slot0.guildName and diff > 3 then
                slot0.lastSendTime = current
                --[[net.send({
                    CM_QUERYUSERSTATE,
                    recog = slot0.role.roleid,
                    param = slot0.x,
                    tag = slot0.y
                })
                net.send({
                    CM_GUILDALLY_LIST,
                    0,
                    recog = slot0.role.roleid,
                    param = slot0.x,
                    tag = slot0.y
                })]]
                pushCMD({
                    CM_QUERYUSERSTATE,
                    recog = slot0.role.roleid,
                    param = slot0.x,
                    tag = slot0.y
                })
                pushCMD({
                    CM_GUILDALLY_LIST,
                    0,
                    recog = slot0.role.roleid,
                    param = slot0.x,
                    tag = slot0.y
                })
            end
        end
        step = step..'555 '
    end
    --if not slot10 or slot10 == '' then
    --        slot10 = '行会'
    --end
    slot10 = slot0.guildName
    local __cname = slot0.role.__cname
    local prefix = def.sfIp
    if not prefix then
        prefix = 'FDSAFLKJLKJDFASEASDFASD'
    end
    prefix = ''--def.sfIp
    if slot10 and slot10 ~= "" then
        local slot11 = "< "
        local slot12 = slot10
        local slot13 = " >"
        slot11 = slot11 .. slot12 .. slot13
        if not slot3.setting.base.showGuildName or slot9 then
            if slot7 == slot11 then
                table.remove(slot0.name.texts)
            end
        elseif stringEnds(slot7, "(沙巴克)") then
            slot13 = slot11
            local slot14 = " (沙巴克)"
            slot13 = slot13 .. slot14
            slot0.name.texts[slot8] = slot13..prefix
        elseif slot7 ~= slot11 then
            slot0.name.texts[slot8 + 1] = slot11..prefix
        end
    end
    if slot0.role.marryName then
        local slot11 = slot0.role.marryName
        if slot11 == "" then
            if slot0.name.texts[3] then
                slot0.name.texts[2] = slot0.name.texts[3]
                slot0.name.texts[3] = nil
            else
                slot0.name.texts[2] = nil
            end
        else
            local slot11 = ""
            local slot12 = slot0.role.sex
            local slot13
            local slot14
            if slot12 == 0 then
                slot12 = "["
                slot13 = slot0.role.marryName
                slot14 = " 的丈夫]"
            else
                slot12 = slot0.role.sex
                if slot12 == 1 then
                    slot12 = "["
                    slot13 = slot0.role.marryName
                    slot14 = " 的妻子]"
                    slot11 = slot12 .. slot13 .. slot14
                end
            end
            if slot0.name.texts[2] and not string.find(slot0.name.texts[2], "的丈夫") then
                if not string.find(slot0.name.texts[2], "的妻子") then
                    slot0.name.texts[3] = slot0.name.texts[2]
                end
            end
            slot0.name.texts[2] = slot12 .. slot13 .. slot14
        end
    end
    for i = #slot0.name.texts,1,-1 do
        local current = slot0.name.texts[i]
        local prep = slot0.name.texts[i-1]
        if current and prep then
            if current == prep then
                table.remove(slot0.name.texts,i)
            end
        end
    end
    if slot2 then
        slot0:updateSetName()
    else
        slot0.buf.name = true
    end
    slot0:setDirty(true)
end
end
return mark
 
 
 
 | 
 |