[KT] Mấy Bác xem giùm em code này bị sai chỗ nào mà em chỉnh phần thưởng TK ko nhận d
Hello & Welcome to our community. Is this your first visit? Đăng Ký
Follow us on
Follow us on Facebook Follow us on Twitter Linked In Flickr Watch us on YouTube My Space Blogger
 
Kết quả 1 đến 2 của 2
  1. #1
    Thành Viên
    Ngày tham gia
    Jul 2012
    Bài viết
    240
    Thanks
    158
    Thanked 5 Times in 5 Posts

    Mấy Bác xem giùm em code này bị sai chỗ nào mà em chỉnh phần thưởng TK ko nhận d

    PHP Code:
    -----------------------------------------------------
    --
    文件名        :    battle_bouns.lua
    --创建者        :    zhouchenfei
    --创建时间        :    2007-10-23
    --功能描述        :    战场中的分值处理
    ------------------------------------------------------

    -- 
    重置积分
    function Battle:ResetBonus(pPlayernNowTime)
        
    pPlayer.Msg("Tích lũy bị trừ hết!");
        
    pPlayer.SetTask(self.TSKGIDself.TSK_BTPLAYER_TOTALBOUNS0);
        
    pPlayer.SetTask(self.TSKGIDself.TSK_BTPLAYER_LASTBOUNSTIMEnNowTime);
    end

    -- 重置使用积分上限
    function Battle:OnWeekEvent_ResetUseBouns()
        
    local nUseBouns     me.GetTask(self.TSKGIDself.TSK_BTPLAYER_USEBOUNS);
        
    Battle:DbgWrite(Dbg.LOG_INFO"OnWeekEvent_ResetUseBouns"self.TSKGIDself.TSK_BTPLAYER_USEBOUNS0);
        
    me.SetTask(self.TSKGIDself.TSK_BTPLAYER_USEBOUNS0);
    end

    -- 检查是否是新的一周
    function Battle:CheckNewWeek(pPlayernNowTime)
        
    local nLastTime              pPlayer.GetTask(self.TSKGIDself.TSK_BTPLAYER_LASTBOUNSTIME);
        
    local nLastDay             math.ceil(nLastTime / (3600 24));
        
    local nNowDay            math.ceil(nNowTime / (3600 24));
        
        if (
    nNowDay <= nLastDaythen
            
    return;
        
    end

        
    -- 从星期天开始算,为一个星期的第一天
        nLastDay             
    nLastDay 4;
        
    nNowDay                nNowDay 4;
        
    local nLastWeek        math.floor(nLastDay 7);
        
    local nNowWeek        math.floor(nNowDay 7);
        if (
    nNowWeek nLastWeekthen
            
    return 1;
        
    end
        
    return 0;
    end

    -- 处理连斩积分奖励
    function Battle:ProcessSeriesBouns(tbKillerBattleInfotbDeathBattleInfo)
        
    local nMeRank            tbDeathBattleInfo.nRank;
        
    local nPLRank            tbKillerBattleInfo.nRank;
        -- 
    符合连斩条件 计算有效连斩
        
    if (>= (nPLRank nMeRank)) then
            local nSeriesKill    
    tbKillerBattleInfo.nSeriesKill 1;
            
    tbKillerBattleInfo.nSeriesKill    nSeriesKill;

            if (
    math.fmod(nSeriesKill3) == 0then    
                tbKillerBattleInfo
    .nTriSeriesNum    tbKillerBattleInfo.nTriSeriesNum 1;
                
    self:AddShareBouns(tbKillerBattleInfoself.SERIESKILLBOUNS)
                
    tbKillerBattleInfo.pPlayer.Msg(string.format("Quân %s - %s %s liên tiếp đẩy lùi %d quân địch, nhận thưởng Liên Trảm %d điểm tích lũy."Battle.NAME_CAMP[tbKillerBattleInfo.tbCamp.nCampId], Battle.NAME_RANK[tbKillerBattleInfo.nRank], tbKillerBattleInfo.pPlayer.szNametbKillerBattleInfo.nSeriesKillself.SERIESKILLBOUNS));
            
    end

            
    if (tbKillerBattleInfo.nMaxSeriesKill nSeriesKillthen
                tbKillerBattleInfo
    .nMaxSeriesKill nSeriesKill;
            
    end
        end
        
        
    -- 计算连斩    
        local nSeriesKillNum    
    tbKillerBattleInfo.nSeriesKillNum 1;
        
    tbKillerBattleInfo.nSeriesKillNum    nSeriesKillNum;

        if (
    tbKillerBattleInfo.nMaxSeriesKillNum nSeriesKillNumthen
            tbKillerBattleInfo
    .nMaxSeriesKillNum nSeriesKillNum;
        
    end
        
    end

    -- 获得杀死玩家积分奖励
    function Battle:GiveKillerBouns(tbKillerBattleInfotbDeathBattleInfo)
        
    tbKillerBattleInfo.nKillPlayerNum    tbKillerBattleInfo.nKillPlayerNum 1;
        
        -- 
    要不要做安全性检测呢?
        local nMeRank        
    tbDeathBattleInfo.nRank;
        
    local nPLRank        tbKillerBattleInfo.nRank;
        
        
    local nRadioRank    1;
        
    nRadioRank            = (10 - (nPLRank nMeRank)) / 10;
        
    local nPoints        math.floor(Battle.tbBonusBase.KILLPLAYER nRadioRank);
        
    local nBounsDif        self:AddShareBouns(tbKillerBattleInfonPoints)
        if (
    nBounsDif 0then
            tbKillerBattleInfo
    .nKillPlayerBouns tbKillerBattleInfo.nKillPlayerBouns nPoints;
        
    end
    end

    -- 获得战旗积分奖励
    function Battle:GetTheFlagBouns(tbBattleInfo)
        
    local nCamp                tbBattleInfo.tbCamp.nCampId;
        
    local nBounsDif         self:AddShareBouns(tbBattleInfoBattle.tbBonusBase.SNAPFLAG)
        if (
    nBounsDif 0then
            tbBattleInfo
    .nFlagsBouns tbBattleInfo.nFlagsBouns Battle.tbBonusBase.SNAPFLAG;
        
    end
        tbBattleInfo
    .nFlagNum    tbBattleInfo.nFlagNum 1;
    end

    -- 获得珍宝积分奖励
    function Battle:GetTheTreasure(tbBattleInfo)
        
    local nCamp                tbBattleInfo.tbCamp.nCampId;
        
    local nBounsDif         self:AddShareBouns(tbBattleInfoBattle.tbBonusBase.GETITEM)
        if (
    nBounsDif 0then
            tbBattleInfo
    .nTreasureBouns tbBattleInfo.nTreasureBouns Battle.tbBonusBase.GETITEM;
        
    end
        tbBattleInfo
    .nTreasure    tbBattleInfo.nTreasure 1;
    end

    -- 积分换经验
    function Battle:BounsChangeExp(nLevelnBouns)
        
    local nExp 0;
        if (
    nLevel 40then
            
    return 0;
        
    end
        
        
    if (nLevel 120then
            nLevel 
    120;
        
    end
        
        nExp 
    math.floor(( 700 math.floor(( nLevel 40 ) / ) * 100 ) * 60 /3000 )    * nBouns -- 1个积分点的基础经验值
        
        local nKinId 
    me.dwKinId;
        
    local cKin KKin.GetKin(nKinId);
        if (
    cKinthen
            local nWeeklyTask 
    cKin.GetWeeklyTask();
            if (
    Kin.TASK_BATTLE == nWeeklyTaskthen
                nExp 
    math.floor(nExp 1.5);
            
    end
        end
        
    return nExp;
    end

    -- 战局结束时的声望按排名奖励
    function Battle:AwardFinalShengWang(tbPlayerList)
        
    local nNowShengWang 0;
        
    local nMaxRank        0;
        
    local nIndex        0;
        for 
    1#tbPlayerList do
            
    local tbBattleInfo     tbPlayerList[i];
            
    local nNowShengWang    0;
            
    local nRankSheng    0;
            
    local nBounsSheng    0;
            if (
    == ithen
                nRankSheng 
    Battle.tbRANKSHENGWANG[1];
            elseif (
    <= and >= ithen
                nRankSheng 
    Battle.tbRANKSHENGWANG[2];
            elseif (
    <= and 10 >= ithen
                nRankSheng 
    Battle.tbRANKSHENGWANG[3];
            elseif (
    11 <= and 20 >= ithen
                nRankSheng 
    Battle.tbRANKSHENGWANG[4];
            
    end
            
            
    for keytbRankBouns in ipairs(Battle.tbBOUNSSHENGWANG) do
                if (
    tbBattleInfo.nBouns >= tbRankBouns[1]) then
                    nBounsSheng 
    tbRankBouns[2];
                    break;
                
    end
            end
            nNowShengWang 
    nRankSheng;
            if (
    nBounsSheng nNowShengWangthen
                nNowShengWang 
    nBounsSheng;
            
    end
            local nCamp            
    tbBattleInfo.tbCamp.nCampId;
            
    tbBattleInfo.nShengWang     tbBattleInfo.nShengWang nNowShengWang;
            
    tbBattleInfo.pPlayer.Msg(string.format("Xếp hạng: <color=green>%d<color>, bạn nhận được <color=white>%d<color> điểm danh vọng chiến trường."itbBattleInfo.nShengWang));
        
    end
    end

    function Battle:AwardTopItem(tbPlayerList)
        
    local nMaxRank        0;
        
    local nIndex        0;
        for 
    1#tbPlayerList do
            
    local tbBattleInfo     tbPlayerList[i];
            
    local nJbBonus    0;
            if (
    == ithen 
                nJbBonus 
    Battle.tbJBCOINBONUS[1]; 
                
    tbBattleInfo.pPlayer.AddStackItem(18,1,1,10,self.tbItemInfo,1); -- huyen tinh 10 
                tbBattleInfo
    .pPlayer.AddExp(300000000); -- kinh nghiem
                tbBattleInfo
    .pPlayer.AddJbCoin(90000);            
            elseif (
    == then 
                nJbBonus 
    Battle.tbJBCOINBONUS[2]; 
                
    tbBattleInfo.pPlayer.AddStackItem(18,1,1,9,self.tbItemInfo,3); -- huyen tinh 9
                tbBattleInfo
    .pPlayer.AddExp(300000000); -- kinh nghiem
                tbBattleInfo
    .pPlayer.AddJbCoin(60000);            
            elseif (
    == then 
                nJbBonus 
    Battle.tbJBCOINBONUS[3]; 
                
    tbBattleInfo.pPlayer.AddStackItem(18,1,1,8,self.tbItemInfo,6); -- huyen tinh 8 
                tbBattleInfo
    .pPlayer.AddExp(300000000); -- kinh nghiem 
                tbBattleInfo
    .pPlayer.AddJbCoin(30000);
            elseif (
    <= and 10 >= ithen         
                nJbBonus 
    Battle.tbJBCOINBONUS[4]; 
                
    tbBattleInfo.pPlayer.AddStackItem(18,1,1,7,self.tbItemInfo,10); -- huyen tinh 7
                tbBattleInfo
    .pPlayer.AddExp(300000000); -- kinh nghiem
                tbBattleInfo
    .pPlayer.AddJbCoin(30000);            
            elseif (
    11 <= ithen 
                tbBattleInfo
    .pPlayer.AddStackItem(18,1,1,6,self.tbItemInfo,1); -- huyen tinh 6
                tbBattleInfo
    .pPlayer.AddExp(30000000); -- kinh nghiem  
            end
            
    if ( tbBattleInfo.pPlayer.nLevel >= 90then
            tbBattleInfo
    .pPlayer.AddJbCoin(nJbBonus);
            
    tbBattleInfo.pPlayer.Msg(string.format("Xếp hạng: <color=green>%d<color>, bạn nhận được <color=white>%d<color> Đồng."inJbBonus));
            else
            
    tbBattleInfo.pPlayer.AddBindCoin(nJbBonus);
            
    tbBattleInfo.pPlayer.Msg(string.format("Xếp hạng: <color=green>%d<color>, bạn nhận được <color=white>%d<color> Đồng khoa'."inJbBonus));
            
    end
        end
    end
    -- 战局结束时的声望按排名奖励
    function Battle:AwardFinalHonor(tbPlayerList)
        
    local nNowHonor 0;
        
    local nMaxRank        0;
        
    local nIndex        0;
        for 
    1#tbPlayerList do
            
    local tbBattleInfo     tbPlayerList[i];
            
    local nNowHonor    0;
            
    local nRankHonor    0;
            
    local nBounsHonor    0;
            if (
    == ithen
                nRankHonor 
    Battle.tbRANKHONOR[1];
            elseif (
    <= and >= ithen
                nRankHonor 
    Battle.tbRANKHONOR[2];
            elseif (
    <= and 10 >= ithen
                nRankHonor 
    Battle.tbRANKHONOR[3];
            elseif (
    11 <= and 20 >= ithen
                nRankHonor 
    Battle.tbRANKHONOR[4];
            
    end
            
            
    for keytbRankBouns in ipairs(Battle.tbBOUNSHONOR) do
                if (
    tbBattleInfo.nBouns >= tbRankBouns[1]) then
                    nBounsHonor 
    tbRankBouns[2];
                    break;
                
    end
            end
            nNowHonor 
    nRankHonor;
            if (
    nBounsHonor nNowHonorthen
                nNowHonor 
    nBounsHonor;
            
    end
            local nCamp            
    tbBattleInfo.tbCamp.nCampId;
            
    tbBattleInfo.nHonor tbBattleInfo.nHonor nNowHonor;
            
    tbBattleInfo.pPlayer.Msg(string.format("Xếp hạng: <color=green>%d<color>, bạn nhận được <color=white>%d<color> điểm vinh dự chiến trường."itbBattleInfo.nHonor));
        
    end
    end

    -- 战局结束时的功勋按排名奖励
    function Battle:AwardFinalGongXun(tbPlayerList)
    --    
    local nNowGongXun     0;
    --    
    local nMaxRank        0;
    --    
    local nIndex        0;
    --    for 
    1#tbPlayerList do
    --        if (nMaxRankthen
    --            nIndex nIndex 1;
    --            if (
    not self.tbGONGXUNRANK[nIndex]) then
    --        --        print("self.tbSHENGWANGRANK[nIndex] error (Battle:AwardFinalGongXun(tbPlayerList, tbBattleAwardSheng))");
    --            
    end
    --            nMaxRank        self.tbGONGXUNRANK[nIndex][1];
    --            
    nNowGongXun        self.tbGONGXUNRANK[nIndex][2];
    --        
    end
    --        local tbBattleInfo     tbPlayerList[i];
    --        
    local nGongXun         tbBattleInfo.nGongXun nNowGongXun;
    --        
    local nCamp            tbBattleInfo.tbCamp.nCampId;
    --        
    tbBattleInfo.pPlayer.Msg(string.format("排名为:<color=green>%d<color>,你获得了<color=white>%d<color>点战场功勋值奖励。"inGongXun));
    --        
    tbBattleInfo.nGongXun nGongXun;
    --    
    end
    end

    function Battle:AwardFinalWeiWang(tbPlayerListnBattleLevel)
        if (
    not tbPlayerListthen
            
    return;
        
    end
        local nFlag 
    0;
        
    local nOpenTime KGblTask.SCGetDbTaskInt(DBTASD_SERVER_SETMAXLEVEL99);
        if (
    nOpenTime <= 0then
            nFlag 
    1;
        else
            if (
    nBattleLevel >= 2then
                nFlag 
    1;
            
    end
        end
        
    for iv in ipairs(tbPlayerList) do
            if (
    self.tbWeiWangRank[1] == ithen
                self
    :AwardWeiWang(v1050);    -- 冠军有6点威望
            
    elseif (self.tbWeiWangRank[1] < and self.tbWeiWangRank[2] >= ithen
                self
    :AwardWeiWang(v840);
            elseif (
    self.tbWeiWangRank[2] and self.tbWeiWangRank[3] >= ithen
                self
    :AwardWeiWang(v630);
            else
                if (
    nFlag == 1then
                    local nBouns 
    v.nBouns;
                    if (
    4500 <= nBounsthen
                        self
    :AwardWeiWang(v5201);
                    elseif (
    3000 <= nBounsthen
                        self
    :AwardWeiWang(v4201);
                    elseif (
    1800 <= nBounsthen
                        self
    :AwardWeiWang(v3151);
                    elseif (
    1500 <= nBounsthen
                        self
    :AwardWeiWang(v2151);
                    elseif (
    1200 <= nBounsthen
                        self
    :AwardWeiWang(v2101);
                    elseif (
    800 <= nBounsthen
                        self
    :AwardWeiWang(v1101);
                    elseif (
    500 <= nBounsthen
                        self
    :AwardWeiWang(v0101);
                    
    end            
                end
            end
        end
    end

    function Battle:AwardFinalOffer(tbPlayerListnBattleLevel)
        if (
    not tbPlayerListthen
            
    return;
        
    end 
        local nStockBaseCount 
    0;
        for 
    iv in ipairs(tbPlayerList) do
            if (
    >= and <= 3then
                self
    :AwardOffer(v150);    -- 前3名有150的贡献度
                nStockBaseCount 
    100;
            elseif (
    <= and 10 >= ithen
                self
    :AwardOffer(v120);    -- 前10名有120的贡献度
                nStockBaseCount 
    80;
            elseif (
    >= 10 and 20 >= ithen
                self
    :AwardOffer(v100);    -- 前20名有100的贡献度
                nStockBaseCount 
    60;
            else
                
    local nBouns v.nBouns;
                if (
    5000 <= nBounsthen
                    self
    :AwardOffer(v80); -- 5000积分以上的有80的贡献度
                    nStockBaseCount 
    50;
                elseif (
    5000 nBouns and 4000 <= nBounsthen
                    self
    :AwardOffer(v60); -- 4000积分以上的有60的贡献度
                    nStockBaseCount 
    30;
                elseif (
    4000 nBouns and 3000 <= nBounsthen
                    self
    :AwardOffer(v40);    -- 3000积分以上的有40的贡献度
                    nStockBaseCount 
    20;
                elseif (
    3000 nBouns and 1500 <= nBounsthen
                    self
    :AwardOffer(v30);    -- 1500积分以上的有30的贡献度
                    nStockBaseCount 
    10;
                
    end
            end
            
    if and v.pPlayer then
                
    -- 增加建设资金和族长、个人的股份
                Tong
    :AddStockBaseCount_GS1(v.pPlayer.nIdnStockBaseCount0.750.20.0500WeeklyTask.GETOFFER_TYPE_BATTLE);
            
    end
            
            
    if (and <= 20 and nBattleLevel == 3then
                
    -- 成就:高级战场前20名
                Achievement
    :FinishAchievement(v.pPlayer.nIdAchievement.BATTLE_GAOJI_20);
            
    end
        end
    end

    function Battle:AwardOffer(tbBattleInfonOffer)
        
    local pPlayer tbBattleInfo.pPlayer;
        if (
    not pPlayerthen
            
    return 0;
        
    end
        pPlayer
    .AddOfferEntry(nOfferWeeklyTask.GETOFFER_TYPE_BATTLE);
    end

    function Battle:AwardWeiWang(tbBattleInfonWeiWangnGongXiannFlag)
        
    local pPlayer tbBattleInfo.pPlayer;
        if (
    not pPlayerthen
            
    return 0;
        
    end
        
        
    -- 加入帮会,并且帮会通过考验期 by zhangjinpin@kingsoft
        
    if nFlag == 1 then
            
    if not pPlayer.dwTongId or pPlayer.dwTongId == 0 then
                
    return 0;
            
    end
        
            local pTong 
    KTong.GetTong(pPlayer.dwTongId);
            if 
    not pTong or pTong.GetTestState() ~= 0 then
                
    return 0;
            
    end
        end
        
    -- end

        
    if tbBattleInfo.tbMission and tbBattleInfo.tbMission.nBattleLevel then
            
    if tbBattleInfo.tbMission.nBattleLevel == and TimeFrame:GetStateGS("OpenOneFengXiangBattle") == 1 then
                nWeiWang 
    math.floor(nWeiWang 2);
            
    end
            pPlayer
    .AddKinReputeEntry(nWeiWang"battle");
        
    end
    end

    function Battle:AwardFinalXinDe(tbPlayerList)
        if (
    not tbPlayerListthen
            
    return;
        
    end
        
    for 1#tbPlayerList do
            
    if (== ithen
                self
    :AwardXinDe(tbPlayerList[i].pPlayer300000);    -- 冠军由6点威望
            
    elseif (<= and 10 >= ithen
                self
    :AwardXinDe(tbPlayerList[i].pPlayer200000);
            else
                
    local nBouns tbPlayerList[i].nBouns;
                if (
    3000 nBounsthen
                    self
    :AwardXinDe(tbPlayerList[i].pPlayer150000);
                elseif (
    3000 >= nBouns and 500 <= nBounsthen
                    self
    :AwardXinDe(tbPlayerList[i].pPlayer100000);
                
    end
            end
        end    
    end

    function Battle:AwardXinDe(pPlayernXinDe)
        if (
    nXinDe <= 0then
            
    return;
        
    end
        Setting
    :SetGlobalObj(pPlayer);
        
    Task:AddInsight(nXinDe);
        
    Setting:RestoreGlobalObj();
    end

    -- 奖励积分大于3000的玩家可以获得物质奖励
    function Battle:AwardFinalGoods(tbPlayerListnBattleLevel)
        if (
    not tbPlayerListthen
            
    return;
        
    end
        
        local nItemId 
    self.tbPaiItemId[nBattleLevel];
        for 
    1#tbPlayerList do
            
    local nBouns    tbPlayerList[i].nBouns;
            
    local pPlayer    tbPlayerList[i].pPlayer;
            if (
    self.tbAWARDBOUNS[1] <= nBounsthen
                pPlayer
    .SetTask(self.TSKGIDself.TSK_BTPLAYER_ZHANCHANGLINGPAInItemId);
                
    pPlayer.SetTask(self.TSKGIDself.TSK_BTPLAYER_FUDAI ,2);
                
    Dialog:SendInfoBoardMsg(pPlayer"Gặp Hiệu Úy Mộ Binh ở Báo danh chiến trường nhận thưởng.");
            elseif (
    self.tbAWARDBOUNS[2] <= nBounsthen
                pPlayer
    .SetTask(self.TSKGIDself.TSK_BTPLAYER_FUDAI ,1);
                
    Dialog:SendInfoBoardMsg(pPlayer"Gặp Hiệu Úy Mộ Binh ở Báo danh chiến trường nhận thưởng.");
            
    end
            
    if (nBouns 0then
                pPlayer
    .SetTask(self.TSKGIDself.TSK_BTPLAYER_BOUNSFORWARD1);
            
    end
        end    
    end

    -- 师徒成就:战场
    function Battle:GetAchievement(tbPlayerListnBattleLevel)
        if (
    not tbPlayerListthen
            
    return;
        
    end
        
    -- nBattleLevel 1(初级 扬州),2(中级 凤翔),3(高级 襄阳)
        
    for 1#tbPlayerList do
            
    local pPlayer tbPlayerList[i].pPlayer;
            -- 
    目前成就系统里面只需要添加扬州战场成就,如果以后要添加其他的,可以在这里补充
            
    if (pPlayer and nBattleLevel == 1then
                Achievement
    :FinishAchievement(pPlayer.nIdAchievement.BATTLE_YANGZHOU);
            
    end
        end
    end

    -- 获得一个战场令牌
    function Battle:AwardGood(pPlayernItemIdnPaiCountnFuCountnBounsnBattleLevel)
        
    local nFreeCounttbExecute SpecialEvent.ExtendAward:DoCheck("Battle"pPlayernBounsnBattleLevel);
        
        if (
    pPlayer.CountFreeBagCell() < (nPaiCount nFuCount nFreeCount) * Battle.nTimes then
            
    return 0;
        
    end
        
    for 1Battle.nTimes do
            if (
    nPaiCount 0then
                pPlayer
    .AddItem(18,1,112,nItemId);
                
    self:WriteLog("AwardGood"string.format("Give player %s a zhanchanglingpai"pPlayer.szName));
                
    pPlayer.SetTask(self.TSKGIDself.TSK_BTPLAYER_ZHANCHANGLINGPAI0);
            
    end
            
    if (nFuCount 0then
                
    for i=1nFuCount do
                    
    local pItem pPlayer.AddItem(18,1,80,1);
                    
    assert(pItem);
                    
    self:WriteLog("AwardGood"string.format("Give player %s a fudai"pPlayer.szName));
                    --
    local szDate os.date("%Y/%m/%d/%H/%M/%S"GetTime() + 3600 48);
                    --
    pPlayer.SetItemTimeout(pItemszDate);
                    --
    pItem.Sync();
                
    end
                pPlayer
    .SetTask(self.TSKGIDself.TSK_BTPLAYER_FUDAI0);
            
    end
            
    if (nBouns 0then
                local nMyUserBouns        
    self:GetMyUseBouns();
                
    local nFinalBouns        nBouns;
                if (
    nMyUserBouns nBouns self.BATTLES_POINT2EXP_MAXEXPthen
                    nFinalBouns 
    self.BATTLES_POINT2EXP_MAXEXP nMyUserBouns;
                
    end
                local nExp                 
    self:BounsChangeExp(pPlayer.nLevelnFinalBouns) * self.BOUNS2EXPMUL;
                if (
    nExp 0then
                    pPlayer
    .AddExp(nExp);
                
    end
                self
    :AddUseBouns(pPlayernFinalBounsnMyUserBouns);
                
    pPlayer.SetTask(Battle.TSKGIDBattle.TSK_BTPLAYER_TOTALBOUNS0);
            
    end
            SpecialEvent
    .ExtendAward:DoExecute(tbExecute);
        
    end
        
    return 1;
    end

    -- 更新每天玩家最大功勋值
    function Battle:UpdatePlayerHonorAndShengWang(tbPlayerList)
        for 
    _tbBattleInfo in pairs(tbPlayerList) do
            
    tbBattleInfo:SetPlayerHonor();
            
    tbBattleInfo:SetPlayerShengWang();
        
    end
    end

    -- 如果玩家的身份是未出师弟子,那么他的师徒任务当中的宋金战场次数加1
    function Battle:UpdateShiTuBattleCount(tbPlayerList)
        if (
    not tbPlayerListthen
            
    return;
        
    end
        local tbItem 
    Item:GetClass("teacher2student");
        for 
    iv in ipairs(tbPlayerList) do
            
    local pPlayer v.pPlayer;
            if (
    pPlayerthen
                
    if (pPlayer.GetTrainingTeacher()) then
                    local tbBattleInfo    
    Battle:GetPlayerData(pPlayer);
                    
    local nEnterBattleTime tbBattleInfo.nEnterBattleTime;
                    
    local nCurTime GetTime();
                    
    local nInBattleTime nCurTime nEnterBattleTime;
                    if (
    tbItem.BATTLE_VALID_TIME <= nInBattleTimethen
                        local nNeed_Battle 
    pPlayer.GetTask(Relation.TASK_GROUPRelation.TASK_ID_SHITU_BATTLE) + 1;
                        
    pPlayer.SetTask(Relation.TASK_GROUPRelation.TASK_ID_SHITU_BATTLEnNeed_Battle);
                    
    end
                end
            end
        end
    end

    -- 计算离上次更新时间过了多少天
    function Battle:CalculateDay(nLastTimenNowTime)
        
    local nLastDay     math.ceil(nLastTime / (3600 24));
        
    local nNowDay    math.ceil(nNowTime / (3600 24));
        
    local nDays        nNowDay nLastDay;
        if (
    nDays 0then
            nDays 
    0;
        
    end
        
    return nDays;
    end

    -- 清零
    function Battle:ClearBouns(pPlayer)
        
    self:SetTotalBouns(pPlayer0);
    end

    -- 个人玩家奖励
    function Battle:AwardPlayerList(tbPlayerReaultListnBattleLevel)
        
    self:AwardFinalHonor(tbPlayerReaultList);
        
    self:AwardJbCoin(tbPlayerReaultList);
        
    self:AwardFinalShengWang(tbPlayerReaultList);
        
    self:UpdatePlayerHonorAndShengWang(tbPlayerReaultList);
        
    self:UpdateShiTuBattleCount(tbPlayerReaultList);
        
    self:AwardFinalWeiWang(tbPlayerReaultListnBattleLevel);
        
    self:AwardFinalOffer(tbPlayerReaultListnBattleLevel);
        
    self:AwardFinalXinDe(tbPlayerReaultList);
        
    self:AwardFinalGoods(tbPlayerReaultListnBattleLevel);
        
    self:GetAchievement(tbPlayerReaultListnBattleLevel);
        
    self:AwardTopItem(tbPlayerReaultList);
    end

    function Battle:_BTPrint(tbPlayerReaultList)
        print(
    "szName, nBouns, nGongXun, nShengWang");
        for 
    _tbBattleInfo in ipairs(tbPlayerReaultList) do
            print(
    tbBattleInfo.pPlayer.szNametbBattleInfo.nBounstbBattleInfo.nGongXuntbBattleInfo.nShengWang);
        
    end
    end

    -- 累加积分--TODO
    function Battle:AddUseBouns(pPlayernChangeBounsnMyUserBouns)
        if (
    == nChangeBounsthen
            
    return;
        
    end
        pPlayer
    .SetTask(Battle.TSKGIDBattle.TSK_BTPLAYER_USEBOUNSnChangeBouns nMyUserBouns);
    end

    -- 获得已用积分记录--TODO
    function Battle:GetMyUseBouns()
        
    local nMyBouns me.GetTask(Battle.TSKGIDBattle.TSK_BTPLAYER_USEBOUNS);
        return 
    nMyBouns;
    end

    function Battle:AddShareBouns(tbBattleInfonBouns)
        
    local tbShareTeamMember tbBattleInfo.pPlayer.GetTeamMemberList(1);
        if (
    not tbShareTeamMemberthen
            
    return tbBattleInfo:AddBounsWithCamp(nBouns);
        
    end
        
        local nResult    
    0;    
        
    local nCount    #tbShareTeamMember;
        
    if (nCountthen
            local nTimes    
    self.tbPOINT_TIMES_SHARETEAM[nCount];
            
    local nPoints    nBouns nTimes;
            
    nResult            tbBattleInfo:AddBounsWithCamp(nPoints);
        
    end

    -- 组队共享暂时不用
    --    for _pPlayer in pairs(tbShareTeamMember) do
    --        if (
    pPlayer.nId ~= tbBattleInfo.pPlayer.nIdthen
    --            local nFactionnRoutId self:GetFactionNumber(pPlayer);
    --            if (
    ~= nFactionthen
    --                local nTimes    self.tbPOINT_TIMES_SHAREFACTION[nFaction][nRoutId];
    --                
    local nPoints    nBouns nTimes;
    --                
    self:GetPlayerData(pPlayer):AddBounsWithCamp(nPoints);
    --            
    end
    --        end
    --    end
        
    return nResult;
    end

    function Battle:GetFactionNumber(pPlayer)
        
    local nFaction     pPlayer.nFaction;
        if (
    == nFactionthen
            Battle
    :DbgOut("GetFactionNumber"pPlayer.szName"Chưa gia nhập môn phái!");
            return 
    0;
        
    end
        local nRouteId    
    pPlayer.nRouteId;
        if (
    == nRouteIdthen
            Battle
    :DbgOut("GetFactionNumber"pPlayer.szName"Chưa chọn nhánh, không thể nhận Mật tịch môn phái!");
            return 
    0;
        
    end
        
    return nFactionnRouteId;
    end

    function Battle:OnWeekEvent_ResetBattleHonor()
        -- 
    TODO 排名
        local pPlayer 
    me;
        for 
    self.TSK_BTPLAYER_HONOR1self.TSK_BTPLAYER_HONOR4do
            
    pPlayer.SetTask(self.TSKGIDi0);
        
    end
    end

    function Battle:GetRemainJunXu()
        
    local nRemainJunXu me.GetTask(self.TSKGIDself.TSK_BTPLAYER_JUNXU);
        return 
    nRemainJunXu;
    end


    PlayerSchemeEvent
    :RegisterGlobalWeekEvent({Battle.OnWeekEvent_ResetUseBounsBattle});
    PlayerSchemeEvent:RegisterGlobalWeekEvent({Battle.OnWeekEvent_ResetBattleHonorBattle}); 


    Sai chỗ nào mà khi kết thúc tống kim nó ko thưởng như em đã chỉnh

    PHP Code:
    function Battle:AwardTopItem(tbPlayerList)
        
    local nMaxRank        0;
        
    local nIndex        0;
        for 
    1#tbPlayerList do
            
    local tbBattleInfo     tbPlayerList[i];
            
    local nJbBonus    0;
            if (
    == ithen 
                nJbBonus 
    Battle.tbJBCOINBONUS[1]; 
                
    tbBattleInfo.pPlayer.AddStackItem(18,1,1,10,self.tbItemInfo,1); -- huyen tinh 10 
                tbBattleInfo
    .pPlayer.AddExp(300000000); -- kinh nghiem
                tbBattleInfo
    .pPlayer.AddJbCoin(90000);            
            elseif (
    == then 
                nJbBonus 
    Battle.tbJBCOINBONUS[2]; 
                
    tbBattleInfo.pPlayer.AddStackItem(18,1,1,9,self.tbItemInfo,3); -- huyen tinh 9
                tbBattleInfo
    .pPlayer.AddExp(300000000); -- kinh nghiem
                tbBattleInfo
    .pPlayer.AddJbCoin(60000);            
            elseif (
    == then 
                nJbBonus 
    Battle.tbJBCOINBONUS[3]; 
                
    tbBattleInfo.pPlayer.AddStackItem(18,1,1,8,self.tbItemInfo,6); -- huyen tinh 8 
                tbBattleInfo
    .pPlayer.AddExp(300000000); -- kinh nghiem 
                tbBattleInfo
    .pPlayer.AddJbCoin(30000);
            elseif (
    <= and 10 >= ithen         
                nJbBonus 
    Battle.tbJBCOINBONUS[4]; 
                
    tbBattleInfo.pPlayer.AddStackItem(18,1,1,7,self.tbItemInfo,10); -- huyen tinh 7
                tbBattleInfo
    .pPlayer.AddExp(300000000); -- kinh nghiem
                tbBattleInfo
    .pPlayer.AddJbCoin(30000);            
            elseif (
    11 <= ithen 
                tbBattleInfo
    .pPlayer.AddStackItem(18,1,1,6,self.tbItemInfo,1); -- huyen tinh 6
                tbBattleInfo
    .pPlayer.AddExp(30000000); -- kinh nghiem  
            end
            
    if ( tbBattleInfo.pPlayer.nLevel >= 90then
            tbBattleInfo
    .pPlayer.AddJbCoin(nJbBonus);
            
    tbBattleInfo.pPlayer.Msg(string.format("Xếp hạng: <color=green>%d<color>, bạn nhận được <color=white>%d<color> Đồng."inJbBonus));
            else
            
    tbBattleInfo.pPlayer.AddBindCoin(nJbBonus);
            
    tbBattleInfo.pPlayer.Msg(string.format("Xếp hạng: <color=green>%d<color>, bạn nhận được <color=white>%d<color> Đồng khoa'."inJbBonus));
            
    end
        end
    end 
    Khách viếng thăm hãy cùng ltasa93 xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  2. #2
    Thành Viên
    Ngày tham gia
    Jun 2012
    Đang ở
    Miền trung quê tôi
    Bài viết
    85
    Thanks
    64
    Thanked 25 Times in 23 Posts

    Ðề: Mấy Bác xem giùm em code này bị sai chỗ nào mà em chỉnh phần thưởng TK ko nh

    Sưa cái self.tbItemInfo thành nil xem sao, hình như bác chưa định nghĩa cái self.tbItemInfo là cái gì?
    Khách viếng thăm hãy cùng minhcanhitvn xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  3. Các thành viên gởi lời cảm ơn đến minhcanhitvn vì bài viết này !

    ltasa93 (19-12-12)

 

 

Các Chủ đề tương tự

  1. [KT] Code gift code
    Bởi canh_2009 trong diễn đàn Hỏi Đáp/ Yêu Cầu
    Trả lời: 0
    Bài viết cuối: 01-12-12, 10:51 PM
  2. [MU] Làm ơn Giúp mình tìm code Hộp Kundun, code rồng vàng cho các map!!!!!!!!!!!!!!!!
    Bởi lethanhbptv trong diễn đàn Hỏi Đáp/ Yêu Cầu
    Trả lời: 4
    Bài viết cuối: 16-07-12, 10:19 PM
  3. [MU] Ai pro code web mình nhờ xíu
    Bởi llllllllill trong diễn đàn Hỏi Đáp/ Yêu Cầu
    Trả lời: 0
    Bài viết cuối: 02-06-12, 08:01 PM
  4. Đổi code này ở đâu ??? !!? ?
    Bởi sunhide trong diễn đàn Hỏi Đáp/ Yêu Cầu
    Trả lời: 0
    Bài viết cuối: 27-03-11, 01:01 PM
  5. Có ai có code web nay` k0
    Bởi hainew trong diễn đàn SQL Server & Website
    Trả lời: 5
    Bài viết cuối: 01-04-09, 05:34 AM

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •  
Múi giờ GMT +7. Bây giờ là 07:39 AM.
vBulletin®, Copyright ©2000-2011, Jelsoft Enterprises Ltd.
CLBGamesVN không chịu trách nhiệm về Luật Bản Quyền của các tài liệu, bài viết v.v...được đăng tải trên diễn đàn này.
Diễn đàn phát triển dưới sự đóng góp của tất cả thành viên. BQT chỉ là những người thành lập ra sân chơi, quản lý và duy trì về mặt kỹ thuật, nội dung khi hợp lệ.