/*
文件名:New_Hook.nut
路径:Dps_A/New_Hook.nut
创建日期:2024-09-23	20:15
文件用途:后续新增的玩家需求的HOOK
*/
//通用HOOK入口函数
function _Hook_Enter_Currency_Func_(args, TableObj) {
    local Ret = null;
    foreach(Func in TableObj) {
        local Buf = Func(args);
        if (Buf) Ret = Buf;
    }
    return Ret;
}
//通用HOOK出口函数
function _Hook_Leave_Currency_Func_(args, TableObj) {
    local Ret = null;
    foreach(Func in TableObj) {
        local Buf = Func(args);
        if (Buf) Ret = Buf;
    }
    return Ret;
}

//通用注册HOOK函数
function _Hook_Register_Currency_Func_(AddressString, ArgRetArr, EnterTable, LeaveTable) {
    Haker.LoadHook(AddressString, ArgRetArr,
        function(args) {
            return _Hook_Enter_Currency_Func_(args, EnterTable);
        },
        function(args) {
            return _Hook_Leave_Currency_Func_(args, LeaveTable);
        }
    );
}


//玩家新增道具时
Cb_User_Insert_Item_Enter_Func <- {};
Cb_User_Insert_Item_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x8502D86", ["pointer", "pointer", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "char", "int", "char", "char", "int"], Cb_User_Insert_Item_Enter_Func, Cb_User_Insert_Item_Leave_Func);


//玩家捡起道具
Cb_User_Get_Item_Enter_Func <- {};
Cb_User_Get_Item_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x85B949C", ["pointer", "pointer", "int", "int", "int"], Cb_User_Get_Item_Enter_Func, Cb_User_Get_Item_Leave_Func);

//服务器Chat日志HOOK
Cb_Server_Chat_Log_Enter_Func <- {};
Cb_Server_Chat_Log_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x86C9638", ["pointer", "pointer", "char", "string", "char"], Cb_Server_Chat_Log_Enter_Func, Cb_Server_Chat_Log_Leave_Func);

//玩家上线设置IP
Cb_User_Set_WebAddress_Enter_Func <- {};
Cb_User_Set_WebAddress_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x84EC918", ["pointer", "pointer", "pointer"], Cb_User_Set_WebAddress_Enter_Func, Cb_User_Set_WebAddress_Leave_Func);

//服务端关闭执行函数
Cb_Server_Close_Enter_Func <- {};
Cb_Server_Close_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x829F28B", ["pointer", "pointer"], Cb_Server_Close_Enter_Func, Cb_Server_Close_Leave_Func);

//检查地下城的状况
Cb_CheckInoutConditionDungeon_Enter_Func <- {};
Cb_CheckInoutConditionDungeon_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x85ABC80", ["pointer", "pointer", "int", "int"], Cb_CheckInoutConditionDungeon_Enter_Func, Cb_CheckInoutConditionDungeon_Leave_Func);

//地下城现场杀死地狱党组怪物Cnt
Cb_Field_KillHellPartyGroupMonsterCnt_Enter_Func <- {};
Cb_Field_KillHellPartyGroupMonsterCnt_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x830D704", ["pointer", "pointer", "pointer", "bool"], Cb_Field_KillHellPartyGroupMonsterCnt_Enter_Func, Cb_Field_KillHellPartyGroupMonsterCnt_Leave_Func);

//经验收益
Cb_Gain_Exp_Sp_Enter_Func <- {};
Cb_Gain_Exp_Sp_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x866A3FE", ["pointer", "int", "int", "int", "int", "int", "char"], Cb_Gain_Exp_Sp_Enter_Func, Cb_Gain_Exp_Sp_Leave_Func);


//货币收益
Cb_Gain_Money_Enter_Func <- {};
Cb_Gain_Money_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x84FF29C", ["int", "int", "char", "int", "int"], Cb_Gain_Money_Enter_Func, Cb_Gain_Money_Leave_Func);

//GetItem检查错误
Cb_GetItem_Check_Error_Enter_Func <- {};
Cb_GetItem_Check_Error_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x81C35AC", ["pointer", "pointer", "pointer", "int"], Cb_GetItem_Check_Error_Enter_Func, Cb_GetItem_Check_Error_Leave_Func);

//队伍清除副本
Cb_ClearDungeon_Enter_Func <- {};
Cb_ClearDungeon_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x85a9330", ["pointer", "void"], Cb_ClearDungeon_Enter_Func, Cb_ClearDungeon_Leave_Func);

//检查选择进入副本时状态
Cb_SelectDungeon_Check_Error_Enter_Func <- {};
Cb_SelectDungeon_Check_Error_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x81C7F32", ["pointer", "pointer", "pointer", "int"], Cb_SelectDungeon_Check_Error_Enter_Func, Cb_SelectDungeon_Check_Error_Leave_Func);

//切换装备
Cb_CInventory_ChangeEquip_Enter_Func <- {};
Cb_CInventory_ChangeEquip_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x84FC37E", ["pointer", "int", "pointer", "int"], Cb_CInventory_ChangeEquip_Enter_Func, Cb_CInventory_ChangeEquip_Leave_Func);

//获取通关时间回调
Cb_CParty_SetBestClearTime_Enter_Func <- {};
Cb_CParty_SetBestClearTime_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x85BE178", ["pointer", "char", "int", "int", "bool"], Cb_CParty_SetBestClearTime_Enter_Func, Cb_CParty_SetBestClearTime_Leave_Func);

//使用称号回收箱时检查使用条件
Cb_UseLimitCube_Check_Error_Enter_Func <- {};
Cb_UseLimitCube_Check_Error_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x081D3BBC", ["pointer", "int", "int", "int", "pointer", "pointer", "pointer", "int"], Cb_UseLimitCube_Check_Error_Enter_Func, Cb_UseLimitCube_Check_Error_Leave_Func);

//使用称号回收箱过程
Cb_UseLimitCube_Process_Enter_Func <- {};
Cb_UseLimitCube_Process_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x081D3D38", ["pointer", "pointer", "pointer", "pointer", "int"], Cb_UseLimitCube_Process_Enter_Func, Cb_UseLimitCube_Process_Leave_Func);

//购买商城物品时日志
Cb_Log_BuyCashShopItem_Enter_Func <- {};
Cb_Log_BuyCashShopItem_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x08686EA0", ["pointer", "int", "int", "int", "int", "char", "int", "int", "int"], Cb_Log_BuyCashShopItem_Enter_Func, Cb_Log_BuyCashShopItem_Leave_Func);

//购买道具获取信息
Cb_BuyItem_Get_Data_Enter_Func <- {};
Cb_BuyItem_Get_Data_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x81BE658", ["pointer", "pointer", "int", "pointer", "int"], Cb_BuyItem_Get_Data_Enter_Func, Cb_BuyItem_Get_Data_Leave_Func);

//设置角色详细信息
Cb_Set_Charac_Info_Detail_Enter_Func <- {};
Cb_Set_Charac_Info_Detail_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x0864AC1A", ["pointer", "int", "int", "pointer", "int"], Cb_Set_Charac_Info_Detail_Enter_Func, Cb_Set_Charac_Info_Detail_Leave_Func);

//使用远古地下城道具
Cb_UseAncientDungeonItems_Enter_Func <- {};
Cb_UseAncientDungeonItems_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x859EAC2", ["pointer", "pointer", "pointer", "pointer", "int"], Cb_UseAncientDungeonItems_Enter_Func, Cb_UseAncientDungeonItems_Leave_Func);

//购买限时商品
Cb_BuyCeraShopLimitItem_Enter_Func <- {};
Cb_BuyCeraShopLimitItem_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x821F9BA", ["pointer", "pointer", "pointer", "int"], Cb_BuyCeraShopLimitItem_Enter_Func, Cb_BuyCeraShopLimitItem_Leave_Func);

//获取下次清除时间
Cb_User_GetLastClearTime_Enter_Func <- {};
Cb_User_GetLastClearTime_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x0864387E", ["pointer", "int"], Cb_User_GetLastClearTime_Enter_Func, Cb_User_GetLastClearTime_Leave_Func);

//每日可交易金币上限
Cb_User_CharacInfo_IsAvailableCurCharacTradeGoldDaily_Enter_Func <- {};
Cb_User_CharacInfo_IsAvailableCurCharacTradeGoldDaily_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x08646496", ["pointer", "int", "int"], Cb_User_CharacInfo_IsAvailableCurCharacTradeGoldDaily_Enter_Func, Cb_User_CharacInfo_IsAvailableCurCharacTradeGoldDaily_Leave_Func);

//进入副本加载完毕时
Cb_Party_OnStartMapFinishLoading_Enter_Func <- {};
Cb_Party_OnStartMapFinishLoading_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x085B170A", ["pointer", "int", "int"], Cb_Party_OnStartMapFinishLoading_Enter_Func, Cb_Party_OnStartMapFinishLoading_Leave_Func);

//房间清理完毕
Cb_Battle_Field_onClearMap_Enter_Func <- {};
Cb_Battle_Field_onClearMap_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x0830DD2C", ["pointer", "bool", "char"], Cb_Battle_Field_onClearMap_Enter_Func, Cb_Battle_Field_onClearMap_Leave_Func);

//放弃副本
Cb_Party_giveup_game_Enter_Func <- {};
Cb_Party_giveup_game_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x085B2BAA", ["pointer", "pointer", "bool", "bool", "bool", "void"], Cb_Party_giveup_game_Enter_Func, Cb_Party_giveup_game_Leave_Func);

//迷妄之塔 死亡之塔通关时
Cb_CDeathTower_onClear_Enter_Func <- {};
Cb_CDeathTower_onClear_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x08467E60", ["pointer", "bool", "int"], Cb_CDeathTower_onClear_Enter_Func, Cb_CDeathTower_onClear_Leave_Func);

//无尽祭坛通关时
Cb_CBloodClearRewardData_Enter_Func <- {};
Cb_CBloodClearRewardData_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x08306FC4", ["pointer", "bool", "int", "pointer", "pointer", "bool"], Cb_CBloodClearRewardData_Enter_Func, Cb_CBloodClearRewardData_Leave_Func);

//进入迷妄之塔 死亡之塔时
Cb_DeathTowerStageCommand_Enter_Func <- {};
Cb_DeathTowerStageCommand_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x08208A9E", ["pointer", "pointer", "pointer", "int"], Cb_DeathTowerStageCommand_Enter_Func, Cb_DeathTowerStageCommand_Leave_Func);

//离开迷妄之塔 死亡之塔时
Cb_CDeathTower_onLeaveUser_Enter_Func <- {};
Cb_CDeathTower_onLeaveUser_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x084636F2", ["pointer", "pointer", "int"], Cb_CDeathTower_onLeaveUser_Enter_Func, Cb_CDeathTower_onLeaveUser_Leave_Func);

//玩家交易过程
Cb_TradeSpace_proceed_trade_Enter_Func <- {};
Cb_TradeSpace_proceed_trade_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x0853087A", ["pointer", "int"], Cb_TradeSpace_proceed_trade_Enter_Func, Cb_TradeSpace_proceed_trade_Leave_Func);

//发送多物品邮件
Cb_MultiMailBoxReqSend_Enter_Func <- {};
Cb_MultiMailBoxReqSend_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x084E27B8", ["pointer", "pointer", "pointer", "int"], Cb_MultiMailBoxReqSend_Enter_Func, Cb_MultiMailBoxReqSend_Leave_Func);

//发送单物品邮件
Cb_MailBox_Send_Enter_Func <- {};
Cb_MailBox_Send_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x081CC958", ["pointer", "pointer", "pointer", "pointer", "int"], Cb_MailBox_Send_Enter_Func, Cb_MailBox_Send_Leave_Func);

//发送金币邮件时是否通过验证
Cb_checkHumanCertify_Enter_Func <- {};
Cb_checkHumanCertify_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x0867F4C8", ["pointer", "int", "pointer", "int"], Cb_checkHumanCertify_Enter_Func, Cb_checkHumanCertify_Leave_Func);

//摆摊购买
Cb_CPrivateStore_BuyItem_Enter_Func <- {};
Cb_CPrivateStore_BuyItem_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x085C924C", ["pointer", "int", "pointer", "int", "int", "int", "int", "int"], Cb_CPrivateStore_BuyItem_Enter_Func, Cb_CPrivateStore_BuyItem_Leave_Func);

//拍卖行上架
Cb_AuctionResultAskRegistedItemNum_Enter_Func <- {};
Cb_AuctionResultAskRegistedItemNum_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x084D5930", ["pointer", "pointer", "pointer", "int"], Cb_AuctionResultAskRegistedItemNum_Enter_Func, Cb_AuctionResultAskRegistedItemNum_Leave_Func);

//拍卖行购买物品
Cb_AuctionLogMessage_Enter_Func <- {};
Cb_AuctionLogMessage_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x084D7A90", ["pointer", "pointer", "pointer", "int"], Cb_AuctionLogMessage_Enter_Func, Cb_AuctionLogMessage_Leave_Func);

//副本内生成物品时
Cb_Battle_Field_MakeDropItems_Enter_Func <- {};
Cb_Battle_Field_MakeDropItems_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x081CC958", ["pointer", "int", "int", "int", "int", "int", "int", "int", "char", "int", "int", "int", "void"], Cb_Battle_Field_MakeDropItems_Enter_Func, Cb_Battle_Field_MakeDropItems_Leave_Func);

//独立掉落几率
Cb_IndependentItemRateControl_Enter_Func <- {};
Cb_IndependentItemRateControl_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x0834972F", ["pointer", "pointer", "int"], Cb_IndependentItemRateControl_Enter_Func, Cb_IndependentItemRateControl_Leave_Func);

//黑钻机添加物品到User时
Cb_UseVendingMachine_putItemIntoUser_Enter_Func <- {};
Cb_UseVendingMachine_putItemIntoUser_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x0821B71C", ["int", "pointer", "int", "int", "int", "int"], Cb_UseVendingMachine_putItemIntoUser_Enter_Func, Cb_UseVendingMachine_putItemIntoUser_Leave_Func);

//查看信息
Cb_GetUserInfo_Enter_Func <- {};
Cb_GetUserInfo_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x081C3DD8", ["pointer", "pointer", "pointer", "int"], Cb_GetUserInfo_Enter_Func, Cb_GetUserInfo_Leave_Func);