郁金香灬老师 游戏安全  驱动 逆向调试 C/C++编程  脚本 UE4/UE5

找回密码
立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
发新帖
课程大纲和价格
官方联系方式2024在线课大纲QQ咨询

34万

积分

124

好友

132

主题
发表于 2023-10-7 21:45:45 | 查看: 1862| 回复: 0





local ThrowDamageNumMediator = class('ThrowDamageNumMediator', framework.Mediator)
ThrowDamageNumMediator.NAME  = "ThrowDamageNumMediator"
local optionsUtils           = requireProxy( "optionsUtils" )

function ThrowDamageNumMediator:handle_enemy( launchActorID, actor, actorID )
    local petActorID = -1
    local heroActorID = global.gamePlayerController:GetMainHeroID()
    local mainPlayerID = global.gamePlayerController:GetMainPlayerID()

    if not launchActorID then
        return nil
    end
    -- 怪物不记录
    local launchActor = global.actorManager:GetActor( launchActorID )
    if launchActor and launchActor:GetType() == global.MMO.ACTOR_MONSTER then
        return nil
    end
    -- 我的宠物/元神/主角造成伤害
    if launchActorID == petActorID or launchActorID == heroActorID or launchActorID == mainPlayerID then
        return nil
    end
    -- 攻击 我的宠物/元神/主角
    if not (actorID == petActorID or actorID == heroActorID or actorID == mainPlayerID) then
        return nil
    end

    global.Facade:sendNotification( global.NoticeTable.AddEnemyActor, launchActorID )
end


function ThrowDamageNumMediator:handle_MSG_SC_NET_ACTOR_DAMAGE_NUMBER_SHOW( msg )
    local jsonData = ParseRawMsgToJson( msg )
    if not jsonData then
        return -1
    end

    local numID = jsonData.Id
    if not numID then
        return -1
    end

    local damageProxy = self:getFacade():retrieveProxy( global.ProxyTable.ThrowDamageNumProxy)

    local actorID       = jsonData.UserID
    local launchActorID = jsonData.TargetID
    local actor         = global.actorManager:GetActor( actorID )
    local mainPlayerID  = global.gamePlayerController:GetMainPlayerID()
    local mainHeroID    = global.gamePlayerController:GetMainHeroID()
    local isMainHero    = (global.gamePlayerController:GetMainHeroID() == launchActorID)

    -- 飘血
    self:handle_throwDamageNum( actor, actorID, mainPlayerID, jsonData, isMainHero )

    -- 受击表现
    self:handle_hitAction( numID, actor )

    -- 仇敌列表 攻击你的玩家列表
    self:handle_enemy( launchActorID, actor, actorID )



    -- 主玩家攻击了someone
    if mainPlayerID == launchActorID then
        self:getFacade():sendNotification( global.NoticeTable.PlayerAttackedSomeone, actorID )
    end


    -- 主玩家被攻击了
    -- if mainPlayerID == actorID and damageProxy:IsBeDamaged( numID ) then
    --     self:getFacade():sendNotification( global.NoticeTable.PlayerBeDamaged)
    -- end

    -- 英雄被攻击了
    if mainHeroID == actorID and damageProxy:IsBeDamaged( numID ) then
        self:getFacade():sendNotification( global.NoticeTable.HeroBeDamaged)
    end
   
    if numID then
        self:getFacade():sendNotification( global.NoticeTable.ActorBeDamaged, {actorID = actorID, damage = numID})
    end
end



游戏安全课程 学员办理咨询联系QQ150330575 手机 139 9636 2600  免费课程 在 www.bilibili.com 搜 郁金香灬老师
您需要登录后才可以回帖 登录 | 立即注册

QQ咨询

QQ|Archiver|手机版|小黑屋|郁金香游戏技术

GMT+8, 2024-5-3 14:16 , Processed in 0.086462 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表