Commit 7a749326b3c0adfb4d0f56f7ebc47263412f06e3
Merge branch 'cn/develop' into cn/publish/preview
# Conflicts: # config/nodenames.lua
Showing
7 changed files
with
540 additions
and
3 deletions
Show diff stats
config/nodenames.lua
src/ProtocolCode.lua
@@ -270,6 +270,12 @@ actionCodes = { | @@ -270,6 +270,12 @@ actionCodes = { | ||
270 | Activity_actNewUserTaskRpc = 674, | 270 | Activity_actNewUserTaskRpc = 674, |
271 | Activity_buyBattleTicketRpc = 675, | 271 | Activity_buyBattleTicketRpc = 675, |
272 | Activity_resetGachakonRpc = 676, --狩猎祭,重制扭蛋机 | 272 | Activity_resetGachakonRpc = 676, --狩猎祭,重制扭蛋机 |
273 | + Activity_startRegularWorldBossBattleRpc = 677, | ||
274 | + Activity_endRegularWorldBossBattleRpc = 678, | ||
275 | + Activity_regularWorldBossRewardRpc = 679, | ||
276 | + Activity_buyWorldBossBattleTicketRpc = 680, | ||
277 | + Activity_regularWorldBossMilestoneRpc = 681, | ||
278 | + | ||
273 | 279 | ||
274 | Radio_startQuestRpc = 700, | 280 | Radio_startQuestRpc = 700, |
275 | Radio_finishQuestRpc = 701, | 281 | Radio_finishQuestRpc = 701, |
src/RedisKeys.lua
@@ -22,6 +22,7 @@ RANK_COMMON = "rank:common:" | @@ -22,6 +22,7 @@ RANK_COMMON = "rank:common:" | ||
22 | RANK_TYPE = { | 22 | RANK_TYPE = { |
23 | ActBattleBoss = "act_battle_boss", | 23 | ActBattleBoss = "act_battle_boss", |
24 | ActCrisis = "crisis", | 24 | ActCrisis = "crisis", |
25 | + RegularWorldBoos = "regular_world_boss" | ||
25 | } | 26 | } |
26 | 27 | ||
27 | -- rank | 28 | -- rank |
src/actions/ActivityAction.lua
@@ -918,6 +918,7 @@ function _M.battleRankRpc(agent, data) | @@ -918,6 +918,7 @@ function _M.battleRankRpc(agent, data) | ||
918 | local actTypeToRank = { | 918 | local actTypeToRank = { |
919 | [role.activity.ActivityType.ChallengeLevel] = RANK_TYPE.ActBattleBoss, | 919 | [role.activity.ActivityType.ChallengeLevel] = RANK_TYPE.ActBattleBoss, |
920 | [role.activity.ActivityType.Crisis] = RANK_TYPE.ActCrisis, | 920 | [role.activity.ActivityType.Crisis] = RANK_TYPE.ActCrisis, |
921 | + [role.activity.ActivityType.RegularWorldBoos] = RANK_TYPE.RegularWorldBoos, | ||
921 | } | 922 | } |
922 | if not actTypeToRank[cfg.showType] then return end | 923 | if not actTypeToRank[cfg.showType] then return end |
923 | local rankInfo = role:getRankInfoCommon(actTypeToRank[cfg.showType]) | 924 | local rankInfo = role:getRankInfoCommon(actTypeToRank[cfg.showType]) |
@@ -1541,4 +1542,457 @@ function _M.buyBattleTicketRpc(agent, data) | @@ -1541,4 +1542,457 @@ function _M.buyBattleTicketRpc(agent, data) | ||
1541 | return true | 1542 | return true |
1542 | end | 1543 | end |
1543 | 1544 | ||
1545 | + | ||
1546 | +-- 常规世界boss | ||
1547 | +function _M.startRegularWorldBossBattleRpc(agent, data) | ||
1548 | + local role = agent.role | ||
1549 | + local msg = MsgPack.unpack(data) | ||
1550 | + local actid = msg.actid | ||
1551 | + local id = msg.id | ||
1552 | + local count = msg.count | ||
1553 | + | ||
1554 | + local actCfg = csvdb["activity_battleCsv"][actid] | ||
1555 | + if not actCfg then return 2 end | ||
1556 | + | ||
1557 | + local battleCfg = actCfg[id] | ||
1558 | + if not battleCfg then return 3 end | ||
1559 | + | ||
1560 | + local actData = role.activity:getActData("RegularWorldBoos") or {} | ||
1561 | + | ||
1562 | + local preArr = battleCfg.prepose:toArray(true, "=") | ||
1563 | + for _, v in ipairs(preArr) do | ||
1564 | + local battleInfo = actData[v] | ||
1565 | + if not battleInfo then | ||
1566 | + return 4 | ||
1567 | + end | ||
1568 | + local star = battleInfo["star"] or 0 | ||
1569 | + if star <= 0 then | ||
1570 | + return 4 | ||
1571 | + end | ||
1572 | + end | ||
1573 | + -- check cost | ||
1574 | + local changeFlag = false | ||
1575 | + local ticket = actData["ticket"] | ||
1576 | + local num = 0 -- cost num | ||
1577 | + if battleCfg.type ~= "" then | ||
1578 | + role.activity:getRegularWorldBossTicket(actid) | ||
1579 | + num = battleCfg.type:toArray(true, "=")[3] | ||
1580 | + if count and count > 0 then | ||
1581 | + if battleCfg.rank ~= 0 then | ||
1582 | + local bi = actData[id] | ||
1583 | + if not bi then return 8 end | ||
1584 | + local star = bi["star"] or 0 | ||
1585 | + local maxP = bi["maxP"] or 0 | ||
1586 | + -- 世界boss | ||
1587 | + if battleCfg.worldBoss_award ~= 0 then | ||
1588 | + if maxP < 1 then | ||
1589 | + return 9 | ||
1590 | + end | ||
1591 | + else | ||
1592 | + if star < 1 then | ||
1593 | + return 9 | ||
1594 | + end | ||
1595 | + end | ||
1596 | + end | ||
1597 | + num = num * count | ||
1598 | + else | ||
1599 | + num = 0 | ||
1600 | + end | ||
1601 | + if ticket < num then | ||
1602 | + return 6 | ||
1603 | + end | ||
1604 | + changeFlag = true | ||
1605 | + end | ||
1606 | + -- 解锁活动剧情 | ||
1607 | + role:checkStoryStatus(false, 5, id) | ||
1608 | + | ||
1609 | + if not count then | ||
1610 | + role.__regularWorldBossBattleCache = { | ||
1611 | + key = tostring(math.random()), | ||
1612 | + actid = actid, | ||
1613 | + id = id, | ||
1614 | + format = msg.format, | ||
1615 | + } | ||
1616 | + SendPacket(actionCodes.Activity_startRegularWorldBossBattleRpc, MsgPack.pack({key = role.__regularWorldBossBattleCache.key})) | ||
1617 | + else | ||
1618 | + if count <= 0 then | ||
1619 | + return | ||
1620 | + end | ||
1621 | + | ||
1622 | + local bi = actData[id] | ||
1623 | + local star = bi["star"] or 0 | ||
1624 | + local award = battleCfg.item_clear:toNumMap() | ||
1625 | + | ||
1626 | + if battleCfg.rank ~= 0 then | ||
1627 | + if getStarCount(battleCfg, star) == 3 then | ||
1628 | + local aw = battleCfg.perfect_reward:toNumMap() | ||
1629 | + for k, v in pairs(aw) do | ||
1630 | + award[k] = (award[k] or 0) + v | ||
1631 | + end | ||
1632 | + end | ||
1633 | + end | ||
1634 | + for k, v in pairs(award) do | ||
1635 | + award[k] = v * count | ||
1636 | + end | ||
1637 | + local reward, change = role:award(award, {log = {desc = "regularWorldBossBattle", int1 = actid, int2 = count or 0}}) | ||
1638 | + | ||
1639 | + changeFlag = true | ||
1640 | + actData["ticket"] = ticket - num | ||
1641 | + | ||
1642 | + if battleCfg.rank ~= 0 then | ||
1643 | + if battleCfg.worldBoss_award ~= 0 and (bi["maxP"] or 0) > 0 then | ||
1644 | + bi["bossP"] = (bi["bossP"] or 0) + bi["maxP"] * count | ||
1645 | + end | ||
1646 | + | ||
1647 | + bi["sum"] = bi["sum"] + bi["top"] * count | ||
1648 | + actData[id] = bi | ||
1649 | + | ||
1650 | + local rankVal = 0 | ||
1651 | + if battleCfg.rank == 1 then | ||
1652 | + rankVal = bi["sum"] | ||
1653 | + elseif battleCfg.rank == 2 then | ||
1654 | + rankVal = bi["top"] | ||
1655 | + end | ||
1656 | + role:updateRankCommon(RANK_TYPE.RegularWorldBoos, rankVal) | ||
1657 | + end | ||
1658 | + role.activity:updateActData("RegularWorldBoos", actData) | ||
1659 | + | ||
1660 | + SendPacket(actionCodes.Activity_startRegularWorldBossBattleRpc, MsgPack.pack(role:packReward(reward, change))) | ||
1661 | + | ||
1662 | + return true | ||
1663 | + end | ||
1664 | + | ||
1665 | + return true | ||
1666 | +end | ||
1667 | + | ||
1668 | +function _M.endRegularWorldBossBattleRpc(agent, data) | ||
1669 | + local role = agent.role | ||
1670 | + local msg = MsgPack.unpack(data) | ||
1671 | + local actid = msg.actid | ||
1672 | + local id = msg.id | ||
1673 | + local key = msg.key | ||
1674 | + local isWin = msg.isWin | ||
1675 | + local heros = msg.heros | ||
1676 | + local support = msg.support | ||
1677 | + if not role.activity:isOpenById(actid, "RegularWorldBoos") then | ||
1678 | + SendPacket(actionCodes.Activity_endRegularWorldBossBattleRpc, MsgPack.pack({})) | ||
1679 | + return true | ||
1680 | + end | ||
1681 | + | ||
1682 | + if not role.__regularWorldBossBattleCache then return 2 end | ||
1683 | + | ||
1684 | + if role.__regularWorldBossBattleCache.id ~= id or role.__regularWorldBossBattleCache.key ~= key and role.__regularWorldBossBattleCache.actid ~= actid then | ||
1685 | + SendPacket(actionCodes.Activity_endRegularWorldBossBattleRpc, MsgPack.pack({errorCode = 1})) | ||
1686 | + end | ||
1687 | + | ||
1688 | + -- 防作弊 | ||
1689 | + if not role:checkBattleCheat("act_battle", { | ||
1690 | + id = id, | ||
1691 | + isWin = isWin, | ||
1692 | + info = msg.info, | ||
1693 | + format = role.__regularWorldBossBattleCache.format | ||
1694 | + }) then | ||
1695 | + SendPacket(actionCodes.Activity_endRegularWorldBossBattleRpc, MsgPack.pack({errorCode = 1})) | ||
1696 | + return true | ||
1697 | + end | ||
1698 | + role.__regularWorldBossBattleCache = nil | ||
1699 | + | ||
1700 | + local actCfg = csvdb["activity_battleCsv"][actid] | ||
1701 | + if not actCfg then return 3 end | ||
1702 | + | ||
1703 | + local battleCfg = actCfg[id] | ||
1704 | + if not battleCfg then return 4 end | ||
1705 | + | ||
1706 | + local actData = role.activity:getActData("RegularWorldBoos") or {} | ||
1707 | + | ||
1708 | + -- 总输出 | ||
1709 | + local dmg = 0 | ||
1710 | + for k, v in pairs(msg.info.damage) do | ||
1711 | + if k % 100 == 2 then | ||
1712 | + dmg = dmg + v | ||
1713 | + end | ||
1714 | + end | ||
1715 | + | ||
1716 | + local reward, change = {}, nil | ||
1717 | + | ||
1718 | + local battleInfo = actData[id] or {} | ||
1719 | + local curStar = 0 | ||
1720 | + if isWin then | ||
1721 | + local herosInfo = msg.heros | ||
1722 | + | ||
1723 | + local check = {} | ||
1724 | + -- 1 通关 | ||
1725 | + check[1] = function(_) | ||
1726 | + return true | ||
1727 | + end | ||
1728 | + -- 2 阵亡人数 <= N | ||
1729 | + check[2] = function(_, cond) | ||
1730 | + return msg.info.dead and msg.info.dead <= cond | ||
1731 | + end | ||
1732 | + -- 3 全员存活 | ||
1733 | + check[3] = function(_) | ||
1734 | + return msg.info.dead and msg.info.dead == 0 | ||
1735 | + end | ||
1736 | + -- 4 指定种族 >= N | ||
1737 | + check[4] = function(_, cond) | ||
1738 | + local count = 0 | ||
1739 | + for _, one in pairs(herosInfo) do | ||
1740 | + local heroData = csvdb["unitCsv"][one.type] | ||
1741 | + if heroData.camp == cond then | ||
1742 | + count = count + 1 | ||
1743 | + end | ||
1744 | + end | ||
1745 | + return count >= cond | ||
1746 | + end | ||
1747 | + -- 5 指定职业 >= N | ||
1748 | + check[5] = function(_, cond) | ||
1749 | + local count = 0 | ||
1750 | + for _, one in pairs(herosInfo) do | ||
1751 | + local heroData = csvdb["unitCsv"][one.type] | ||
1752 | + if heroData.job == cond then | ||
1753 | + count = count + 1 | ||
1754 | + end | ||
1755 | + end | ||
1756 | + return count >= cond | ||
1757 | + end | ||
1758 | + -- 6 含有指定角色 | ||
1759 | + check[6] = function(_, cond) | ||
1760 | + for _, one in pairs(herosInfo) do | ||
1761 | + if one.type == cond then | ||
1762 | + return true | ||
1763 | + end | ||
1764 | + end | ||
1765 | + return false | ||
1766 | + end | ||
1767 | + -- 7 通关耗时 <= X 秒 msg.info.atime | ||
1768 | + check[7] = function(_, cond) | ||
1769 | + return msg.info.atime and msg.info.atime <= cond | ||
1770 | + end | ||
1771 | + -- 8 总输出值 msg.info.atime | ||
1772 | + check[8] = function(_, cond) | ||
1773 | + return dmg >= cond | ||
1774 | + end | ||
1775 | + curStar = 0 | ||
1776 | + local sweepConds = battleCfg.sweep_condition:toTableArray(true) | ||
1777 | + for i, cond in ipairs(sweepConds) do | ||
1778 | + if check[cond[1]] and check[cond[1]](table.unpack(cond)) then | ||
1779 | + curStar = curStar + (1 << (i - 1)) | ||
1780 | + end | ||
1781 | + end | ||
1782 | + | ||
1783 | + role:checkTaskEnter("ActBattlePass", {chapterId = id}) | ||
1784 | + else | ||
1785 | + curStar = 0 | ||
1786 | + if battleCfg.rank ~= 0 then | ||
1787 | + curStar = 1 | ||
1788 | + end | ||
1789 | + end | ||
1790 | + local oldStarNum = getStarCount(battleCfg, battleInfo["star"] or 0) | ||
1791 | + local newStarNum = getStarCount(battleCfg, curStar) | ||
1792 | + if newStarNum > oldStarNum then | ||
1793 | + battleInfo["star"] = curStar | ||
1794 | + end | ||
1795 | + | ||
1796 | + if battleCfg.rank ~= 0 and isWin then | ||
1797 | + if battleCfg.type ~= "" then | ||
1798 | + -- 消耗门票 | ||
1799 | + role.activity:getRegularWorldBossTicket(actid) | ||
1800 | + local num = battleCfg.type:toArray(true, "=")[3] | ||
1801 | + actData["ticket"] = math.max(actData["ticket"] - num, 0) | ||
1802 | + end | ||
1803 | + | ||
1804 | + -- 更新排行榜 最高伤害 | ||
1805 | + battleInfo["top"] = math.max(battleInfo["top"] or 0, dmg) | ||
1806 | + battleInfo["sum"] = (battleInfo["sum"] or 0) + dmg | ||
1807 | + local rankVal = 0 | ||
1808 | + if battleCfg.rank == 1 then | ||
1809 | + rankVal = battleInfo["sum"] | ||
1810 | + elseif battleCfg.rank == 2 then | ||
1811 | + rankVal = battleInfo["top"] | ||
1812 | + end | ||
1813 | + if rankVal > 0 then | ||
1814 | + role:updateRankCommon(RANK_TYPE.RegularWorldBoos, rankVal) | ||
1815 | + end | ||
1816 | + end | ||
1817 | + | ||
1818 | + if (oldStarNum == 0 and newStarNum > 0) or battleCfg.rank ~= 0 then | ||
1819 | + reward = battleCfg.item_clear:toNumMap() | ||
1820 | + end | ||
1821 | + if (oldStarNum < 3 and newStarNum == 3) or (battleCfg.rank ~= 0 and newStarNum == 3) then | ||
1822 | + local aw = battleCfg.perfect_reward:toNumMap() | ||
1823 | + for k, v in pairs(aw) do | ||
1824 | + reward[k] = (reward[k] or 0) + v | ||
1825 | + end | ||
1826 | + end | ||
1827 | + | ||
1828 | + role:checkBattle("act_battle", { | ||
1829 | + cfg = battleCfg, | ||
1830 | + star = newStarNum, | ||
1831 | + isWin = isWin, | ||
1832 | + info = msg.info, | ||
1833 | + reward = reward, | ||
1834 | + heros = heros, | ||
1835 | + supports = support, | ||
1836 | + }) | ||
1837 | + | ||
1838 | + -- 解锁活动剧情 | ||
1839 | + if newStarNum >= 3 then | ||
1840 | + role:checkStoryStatus(false, 5, id) | ||
1841 | + end | ||
1842 | + | ||
1843 | + if battleCfg.worldBoss_award ~= 0 and msg.point then | ||
1844 | + battleInfo["bossP"] = (battleInfo["bossP"] or 0) + msg.point | ||
1845 | + battleInfo["maxP"] = math.max(msg.point, (battleInfo["maxP"] or 0)) | ||
1846 | + end | ||
1847 | + actData[id] = battleInfo | ||
1848 | + role.activity:updateActData("RegularWorldBoos", actData) | ||
1849 | + | ||
1850 | + reward, change = role:award(reward, {log = {desc = "actBattle", int1 = actid, int2 = newStarNum}}) | ||
1851 | + | ||
1852 | + SendPacket(actionCodes.Activity_endRegularWorldBossBattleRpc, MsgPack.pack({ | ||
1853 | + reward = reward, | ||
1854 | + change = change | ||
1855 | + })) | ||
1856 | + | ||
1857 | + return true | ||
1858 | +end | ||
1859 | + | ||
1860 | +function _M.regularWorldBossRewardRpc(agent, data) | ||
1861 | + local role = agent.role | ||
1862 | + local msg = MsgPack.unpack(data) | ||
1863 | + local actid = msg.actid | ||
1864 | + local id = msg.id | ||
1865 | + local index = msg.index | ||
1866 | + | ||
1867 | + if not role.activity:isOpenById(actid, "RegularWorldBoos") then return 1 end | ||
1868 | + | ||
1869 | + local actCfg = csvdb["activity_battleCsv"][actid] | ||
1870 | + if not actCfg then return 2 end | ||
1871 | + | ||
1872 | + local battleCfg = actCfg[id] | ||
1873 | + if not battleCfg then return 3 end | ||
1874 | + | ||
1875 | + if battleCfg.worldBoss_award == 0 then return 4 end | ||
1876 | + | ||
1877 | + actCfg = csvdb["activity_wordboss_awardCsv"][battleCfg.worldBoss_award] | ||
1878 | + if not actCfg then return 5 end | ||
1879 | + local awardCfg = actCfg[index] | ||
1880 | + if not awardCfg then return 6 end | ||
1881 | + | ||
1882 | + local totalAwardCnt = #actCfg | ||
1883 | + local preList = awardCfg.condition1:toArray(true, "=") | ||
1884 | + | ||
1885 | + local actData = role.activity:getActData("RegularWorldBoos") or {} | ||
1886 | + local battleInfo = actData[id] or {} | ||
1887 | + local bossPoint = battleInfo["bossP"] or 0 | ||
1888 | + if bossPoint < 1 then return 7 end | ||
1889 | + | ||
1890 | + local bossRecord = battleInfo["bossR"] or "" | ||
1891 | + local r = string.char(string.getbit(bossRecord, index)) | ||
1892 | + if r == "1" then | ||
1893 | + return 9 | ||
1894 | + end | ||
1895 | + local ok = false | ||
1896 | + if #preList == 0 then | ||
1897 | + ok = true | ||
1898 | + else | ||
1899 | + for _, i in ipairs(preList) do | ||
1900 | + local flag = string.char(string.getbit(bossRecord, i)) | ||
1901 | + if flag == "1" then | ||
1902 | + ok = true | ||
1903 | + break | ||
1904 | + end | ||
1905 | + end | ||
1906 | + end | ||
1907 | + if not ok then return 8 end | ||
1908 | + | ||
1909 | + battleInfo["bossR"] = string.setbit(bossRecord, index) | ||
1910 | + local allFinish = true | ||
1911 | + for i = 1, totalAwardCnt do | ||
1912 | + if string.char(string.getbit(battleInfo["bossR"], i)) == "0" then | ||
1913 | + allFinish = false | ||
1914 | + break | ||
1915 | + end | ||
1916 | + end | ||
1917 | + if allFinish then | ||
1918 | + battleInfo["bossR"] = "" | ||
1919 | + end | ||
1920 | + battleInfo["bossP"] = bossPoint - 1 | ||
1921 | + actData[id] = battleInfo | ||
1922 | + role.activity:updateActData("RegularWorldBoos", actData) | ||
1923 | + | ||
1924 | + local award = awardCfg.reward:toNumMap() | ||
1925 | + local reward, change = role:award(award, {log = {desc = "regularWorldBossReward", int1 = actid, int2 = index}}) | ||
1926 | + SendPacket(actionCodes.Activity_regularWorldBossRewardRpc, MsgPack.pack(role:packReward(reward, change))) | ||
1927 | + return true | ||
1928 | +end | ||
1929 | + | ||
1930 | +function _M.buyWorldBossBattleTicketRpc(agent, data) | ||
1931 | + local role = agent.role | ||
1932 | + local msg = MsgPack.unpack(data) | ||
1933 | + local actid = msg.actid | ||
1934 | + local id = msg.id | ||
1935 | + local count = msg.count | ||
1936 | + if not role.activity:isOpenById(actid, "RegularWorldBoos") then return 1 end | ||
1937 | + role.activity:getRegularWorldBossTicket(actid) | ||
1938 | + local actData = role.activity:getActData("RegularWorldBoos") or {} | ||
1939 | + local battleInfo = actData[id] or {} | ||
1940 | + --["activity_scrofa_tickets"] = { 10, 20, 30, 40, 50, 100, 150, 200, 200, 200 } | ||
1941 | + --TODO | ||
1942 | + local limit = #(globalCsv.activity_scrofa_tickets) | ||
1943 | + local curCount = actData["buyC"] or 0 | ||
1944 | + if count <= 0 or curCount + count > limit then | ||
1945 | + return 2 | ||
1946 | + end | ||
1947 | + local cost = globalCsv.activity_scrofa_tickets[curCount + 1] | ||
1948 | + if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 3 end | ||
1949 | + role:costItems({[ItemId.Jade] = cost}, {log = {desc = "buyRegularWorldBossTicket", int1 = actid, int2 = count, long1 = curCount}}) | ||
1950 | + actData["ticket"] = (actData["ticket"] or 0) + 1 | ||
1951 | + actData["buyC"] = curCount + count | ||
1952 | + | ||
1953 | + role.activity:updateActData("RegularWorldBoos", actData) | ||
1954 | + SendPacket(actionCodes.Activity_buyWorldBossBattleTicketRpc, "") | ||
1955 | + return true | ||
1956 | +end | ||
1957 | + | ||
1958 | +function _M.regularWorldBossMilestoneRpc(agent, data) | ||
1959 | + local role = agent.role | ||
1960 | + local msg = MsgPack.unpack(data) | ||
1961 | + local actid = msg.actid | ||
1962 | + local id = msg.id | ||
1963 | + local index = msg.index | ||
1964 | + | ||
1965 | + if not role.activity:isOpenById(actid, "RegularWorldBoos") then return 1 end | ||
1966 | + | ||
1967 | + local actCfg = csvdb["activity_mileageCsv"][actid] | ||
1968 | + if not actCfg then return 3 end | ||
1969 | + | ||
1970 | + local mileCfg = actCfg[index] | ||
1971 | + if not mileCfg then return 4 end | ||
1972 | + | ||
1973 | + local actData = role.activity:getActData("RegularWorldBoos") or {} | ||
1974 | + local battleInfo = actData[id] or {} | ||
1975 | + local val = 0 | ||
1976 | + if mileCfg.type == 1 then | ||
1977 | + val = battleInfo["sum"] or 0 | ||
1978 | + elseif mileCfg.type == 2 then | ||
1979 | + val = battleInfo["top"] or 0 | ||
1980 | + end | ||
1981 | + | ||
1982 | + local record = battleInfo["r"] or "" | ||
1983 | + local flag = string.char(string.getbit(record, index)) | ||
1984 | + if flag == "1" then return 5 end | ||
1985 | + if mileCfg.condition > val then return 6 end | ||
1986 | + | ||
1987 | + battleInfo["r"] = string.setbit(record, index) | ||
1988 | + actData[id] = battleInfo | ||
1989 | + role.activity:updateActData("RegularWorldBoos", actData) | ||
1990 | + | ||
1991 | + local award = mileCfg.reward:toNumMap() | ||
1992 | + local reward, change = role:award(award, {log = {desc = "regularWorldBossMilestone", int1 = actid, int2 = index}}) | ||
1993 | + SendPacket(actionCodes.Activity_regularWorldBossMilestoneRpc, MsgPack.pack(role:packReward(reward, change))) | ||
1994 | + | ||
1995 | + return true | ||
1996 | +end | ||
1997 | + | ||
1544 | return _M | 1998 | return _M |
src/actions/GmAction.lua
@@ -1101,6 +1101,16 @@ function _M.do_lua(role, pms) | @@ -1101,6 +1101,16 @@ function _M.do_lua(role, pms) | ||
1101 | return "成功" | 1101 | return "成功" |
1102 | end | 1102 | end |
1103 | 1103 | ||
1104 | + | ||
1105 | +table.insert(helpDes, {"每日活跃度拉满", "full_active"}) | ||
1106 | +function _M.full_active(role, pms) | ||
1107 | + local taskStatus = role:getProperty("dTask") | ||
1108 | + taskStatus["a"] = 200 | ||
1109 | + role:updateProperty({field="dTask", value=taskStatus}) | ||
1110 | + role:checkTaskEnter("DailyTask", {pre = 0, cur = 200}) | ||
1111 | + return "成功" | ||
1112 | +end | ||
1113 | + | ||
1104 | table.insert(helpDes, {"抽英雄", "get_draw_hero_pro"}) | 1114 | table.insert(helpDes, {"抽英雄", "get_draw_hero_pro"}) |
1105 | function _M.get_draw_hero_pro(role, pms) | 1115 | function _M.get_draw_hero_pro(role, pms) |
1106 | -- 普池 10 up池 207 心愿单 20 | 1116 | -- 普池 10 up池 207 心愿单 20 |
src/models/Activity.lua
@@ -40,6 +40,8 @@ Activity.ActivityType = { | @@ -40,6 +40,8 @@ Activity.ActivityType = { | ||
40 | 40 | ||
41 | BattleCommandTask = 38, -- 战令任务活动 | 41 | BattleCommandTask = 38, -- 战令任务活动 |
42 | NewUserTask = 41, -- 新用户任务 | 42 | NewUserTask = 41, -- 新用户任务 |
43 | + | ||
44 | + RegularWorldBoos = 42, -- 常规世界boos | ||
43 | } | 45 | } |
44 | 46 | ||
45 | local function checkActivityType(activityType) | 47 | local function checkActivityType(activityType) |
@@ -93,6 +95,7 @@ Activity.schema = { | @@ -93,6 +95,7 @@ Activity.schema = { | ||
93 | 95 | ||
94 | act34 = {"table", {}}, -- 战令记录{unlock = 1, freeR = "", payR = "", lvl = 10, sum = 100} | 96 | act34 = {"table", {}}, -- 战令记录{unlock = 1, freeR = "", payR = "", lvl = 10, sum = 100} |
95 | act36 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1} | 97 | act36 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1} |
98 | + act42 = {"table", {}}, -- | ||
96 | 99 | ||
97 | reset20 = {"number", 1}, -- 重置扭蛋机 | 100 | reset20 = {"number", 1}, -- 重置扭蛋机 |
98 | } | 101 | } |
@@ -123,6 +126,7 @@ function Activity:data() | @@ -123,6 +126,7 @@ function Activity:data() | ||
123 | 126 | ||
124 | act34 = self:getProperty("act34"), | 127 | act34 = self:getProperty("act34"), |
125 | act36 = self:getProperty("act36"), | 128 | act36 = self:getProperty("act36"), |
129 | + act42 = self:getProperty("act42"), | ||
126 | 130 | ||
127 | reset20 = self:getProperty("reset20") | 131 | reset20 = self:getProperty("reset20") |
128 | } | 132 | } |
@@ -836,6 +840,21 @@ activityFunc[Activity.ActivityType.ChallengeLevel] = { | @@ -836,6 +840,21 @@ activityFunc[Activity.ActivityType.ChallengeLevel] = { | ||
836 | end, | 840 | end, |
837 | } | 841 | } |
838 | 842 | ||
843 | +--RegularWorldBoos | ||
844 | +activityFunc[Activity.ActivityType.RegularWorldBoos] = { | ||
845 | + ["init"] = function(self, actType, isCrossDay, notify, actId) | ||
846 | + self:getRegularWorldBossTicket(actId) | ||
847 | + end, | ||
848 | + ["login"] = function(self, actType, actId) | ||
849 | + self:getRegularWorldBossTicket(actId) | ||
850 | + end, | ||
851 | + ["crossDay"] = function(self, actType, notify) | ||
852 | + local actData = self:getActData(actType) | ||
853 | + actData["buyC"] = 0 | ||
854 | + self:updateActData(actType, actData, not notify) | ||
855 | + end, | ||
856 | +} | ||
857 | + | ||
839 | function Activity:onLoginActivity(actId) | 858 | function Activity:onLoginActivity(actId) |
840 | local actData = csvdb["activity_ctrlCsv"][actId] | 859 | local actData = csvdb["activity_ctrlCsv"][actId] |
841 | if not actData then return end | 860 | if not actData then return end |
@@ -1056,6 +1075,45 @@ function Activity:getBattleTicket(actId) | @@ -1056,6 +1075,45 @@ function Activity:getBattleTicket(actId) | ||
1056 | end | 1075 | end |
1057 | end | 1076 | end |
1058 | 1077 | ||
1078 | +--常规世界boss计算门票 | ||
1079 | +function Activity:getRegularWorldBossTicket(actId) | ||
1080 | + local role = self.owner | ||
1081 | + local createTs = role:getProperty("ctime") | ||
1082 | + local actCfg = csvdb["activity_ctrlCsv"][actId] | ||
1083 | + if not actCfg then return 0 end | ||
1084 | + | ||
1085 | + local actStartTime = 0 | ||
1086 | + local openTimes = actCfg.time:toArray(false, "=") | ||
1087 | + actStartTime = toUnixtime(openTimes[1]..string_format("%02x", RESET_TIME)) | ||
1088 | + local actData = self:getActData("RegularWorldBoos") or {} | ||
1089 | + local startTs = actData["ts"] or math.max(actStartTime, createTs) | ||
1090 | + local timeNow = skynet.timex() | ||
1091 | + local modify = false | ||
1092 | + local arr = actCfg.condition2:toArray(true, "=") | ||
1093 | + | ||
1094 | + local ticketId, init, limit, duration = arr[1] or 0, arr[2] or 0, arr[3] or 0, arr[4] or 10000 | ||
1095 | + | ||
1096 | + local count = actData["ticket"] or init | ||
1097 | + if count >= limit then | ||
1098 | + actData["ts"] = timeNow | ||
1099 | + self:updateActData("RegularWorldBoos", actData) | ||
1100 | + return | ||
1101 | + end | ||
1102 | + local add = math.max(math.floor((timeNow - startTs) / (duration * 60)), 0) | ||
1103 | + | ||
1104 | + local newCount= math.min(count + add, limit) | ||
1105 | + if newCount ~= count or newCount >= limit then | ||
1106 | + modify = true | ||
1107 | + end | ||
1108 | + add = newCount - count | ||
1109 | + | ||
1110 | + if modify or not next(actData) then | ||
1111 | + actData["ticket"] = newCount | ||
1112 | + actData["ts"] = newCount >= limit and timeNow or (startTs + add * duration * 60) | ||
1113 | + self:updateActData("RegularWorldBoos", actData) | ||
1114 | + end | ||
1115 | +end | ||
1116 | + | ||
1059 | activityFunc[Activity.ActivityType.ActShopGoods] = { | 1117 | activityFunc[Activity.ActivityType.ActShopGoods] = { |
1060 | ["init"] = function(self, actType, isCrossDay, notify, actId) | 1118 | ["init"] = function(self, actType, isCrossDay, notify, actId) |
1061 | end, | 1119 | end, |
@@ -1216,7 +1274,7 @@ activityFunc[Activity.ActivityType.BattleCommand] = { | @@ -1216,7 +1274,7 @@ activityFunc[Activity.ActivityType.BattleCommand] = { | ||
1216 | actData["week"] = math.min(old + count, limit) | 1274 | actData["week"] = math.min(old + count, limit) |
1217 | count = actData["week"] - old | 1275 | count = actData["week"] - old |
1218 | end | 1276 | end |
1219 | - local total = actData["sum"] + count | 1277 | + local total = (actData["sum"] or 0) + count |
1220 | local curLvl = actData["lvl"] or 0 | 1278 | local curLvl = actData["lvl"] or 0 |
1221 | if actCfg.condition == 1 then -- 代表sum需要转换为等级 | 1279 | if actCfg.condition == 1 then -- 代表sum需要转换为等级 |
1222 | local bpCfg = csvdb["activity_battlepass_rewardCsv"][actId] | 1280 | local bpCfg = csvdb["activity_battlepass_rewardCsv"][actId] |
src/models/RoleLog.lua
@@ -70,6 +70,11 @@ local ItemReason = { | @@ -70,6 +70,11 @@ local ItemReason = { | ||
70 | buyDiamondCardReward = 154, --购买钻石额外赠送奖励 | 70 | buyDiamondCardReward = 154, --购买钻石额外赠送奖励 |
71 | firstMonthCardReward = 155, --首次订阅月卡奖励 | 71 | firstMonthCardReward = 155, --首次订阅月卡奖励 |
72 | firstSMonthCardReward = 156, --首次订阅特刊奖励 | 72 | firstSMonthCardReward = 156, --首次订阅特刊奖励 |
73 | + regularWorldBossReward = 157, -- 常规世界boss | ||
74 | + regularWorldBossMilestone = 158, -- 常规世界boss伤害里程碑 | ||
75 | + regularWorldBossBattle = 159, -- 常规世界boss战斗奖励 | ||
76 | + | ||
77 | + | ||
73 | 78 | ||
74 | advHang = 301, -- 拾荒挂机 | 79 | advHang = 301, -- 拾荒挂机 |
75 | hangBattle = 302, -- 挂机战斗 | 80 | hangBattle = 302, -- 挂机战斗 |
@@ -115,6 +120,8 @@ local ItemReason = { | @@ -115,6 +120,8 @@ local ItemReason = { | ||
115 | battleCommandTask = 1011, -- 将军令任务 | 120 | battleCommandTask = 1011, -- 将军令任务 |
116 | newUserTask = 1012, -- 新玩家任务 | 121 | newUserTask = 1012, -- 新玩家任务 |
117 | buyActivityBattleTicket = 1013, -- 购买门票 | 122 | buyActivityBattleTicket = 1013, -- 购买门票 |
123 | + buyRegularWorldBossTicket = 1014, -- 购买门票 | ||
124 | + | ||
118 | 125 | ||
119 | -- 餐厅 | 126 | -- 餐厅 |
120 | greenHourse = 1101, -- 食材获得 | 127 | greenHourse = 1101, -- 食材获得 |