Compare commits
3 Commits
44e70d6d43
...
08dcb9fe93
| Author | SHA1 | Date | |
|---|---|---|---|
| 08dcb9fe93 | |||
| 6320dcde6f | |||
| c89dcae68d |
@@ -1,36 +0,0 @@
|
|||||||
--P-平台福利YY.xlsx 超玩俱乐部
|
|
||||||
GameVIPConfig={
|
|
||||||
host = "proxy.udblogin.game.yy.com",
|
|
||||||
port = "80",
|
|
||||||
api = "/query/cwVipInfo.do",
|
|
||||||
vipMap = {[1]=2,[2]=6,[3]=9},
|
|
||||||
vipGift = {
|
|
||||||
[1]={{type=0,id=261,count=3},{type=0,id=421,count=3},{type=7,id=7,count=3},{type=0,id=247,count=3}},
|
|
||||||
[2]={{type=0,id=261,count=3},{type=0,id=421,count=3},{type=7,id=7,count=3},{type=0,id=247,count=3}},
|
|
||||||
[3]={{type=0,id=261,count=5},{type=0,id=269,count=10},{type=0,id=904,count=1},{type=0,id=914,count=1}},
|
|
||||||
},
|
|
||||||
VIPTitle = "超玩俱乐部会员礼包",
|
|
||||||
VIPContent = "恭喜你领取了超玩俱乐部会员专属礼包",
|
|
||||||
dailyGift = {
|
|
||||||
[1]={{type=0,id=247,count=5},{type=2,id=2,count=3000},{type=5,id=5,count=1000}},
|
|
||||||
[2]={{type=0,id=247,count=5},{type=2,id=2,count=4000},{type=5,id=5,count=2000}},
|
|
||||||
[3]={{type=0,id=247,count=5},{type=2,id=2,count=5000},{type=5,id=5,count=3000}},
|
|
||||||
},
|
|
||||||
VIPDailyTitle = "超玩俱乐部会员每日礼包",
|
|
||||||
VIPDailyContent = "恭喜你领取了超玩俱乐部会员专属礼包",
|
|
||||||
GameVIPbuff = {
|
|
||||||
[1]={buffid=0},
|
|
||||||
[2]={buffid=0},
|
|
||||||
[3]={buffid=0}
|
|
||||||
},
|
|
||||||
vipGiftDisplay = {
|
|
||||||
[1]={index=1,viplvl=1,rewards={{type=0,id=261,count=3},{type=0,id=421,count=3},{type=7,id=7,count=3},{type=0,id=247,count=3}}},
|
|
||||||
[2]={index=2,viplvl=1,rewards={{type=0,id=261,count=3},{type=0,id=421,count=3},{type=7,id=7,count=3},{type=0,id=247,count=3}}},
|
|
||||||
[3]={index=3,viplvl=3,rewards={{type=0,id=261,count=5},{type=0,id=269,count=10},{type=0,id=904,count=1},{type=0,id=914,count=1}}},
|
|
||||||
},
|
|
||||||
dailyGiftDisplay = {
|
|
||||||
[1]={index=1,viplvl=2,rewards={{type=0,id=247,count=5},{type=2,id=2,count=3000},{type=5,id=5,count=1000}}},
|
|
||||||
[2]={index=2,viplvl=6,rewards={{type=0,id=247,count=5},{type=2,id=2,count=4000},{type=5,id=5,count=2000}}},
|
|
||||||
[3]={index=3,viplvl=9,rewards={{type=0,id=247,count=5},{type=2,id=2,count=5000},{type=5,id=5,count=3000}}},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
--P-平台福利YY.xlsx YY大厅特权
|
|
||||||
YYMemberConfig={
|
|
||||||
host = "proxy.udblogin.game.yy.com",
|
|
||||||
port = "80",
|
|
||||||
api = "/yy/lobbygift/query/queryInfo.do",
|
|
||||||
freshmanGift = {{type=0,id=247,count=5},{type=7,id=7,count=3},{type=0,id=261,count=2},{type=2,id=2,count=20000}},
|
|
||||||
fgTitle = "YY大厅新手礼包",
|
|
||||||
fgContent = "恭喜你领取了YY大厅新手礼包",
|
|
||||||
loginGift = {
|
|
||||||
[1]={{type=0,id=269,count=1},{type=7,id=7,count=2},{type=2,id=2,count=10000}},
|
|
||||||
[2]={{type=0,id=421,count=1},{type=7,id=7,count=3},{type=2,id=2,count=10000}},
|
|
||||||
[3]={{type=0,id=261,count=1},{type=7,id=7,count=3},{type=2,id=2,count=10000}},
|
|
||||||
[4]={{type=0,id=269,count=2},{type=7,id=7,count=4},{type=2,id=2,count=10000}},
|
|
||||||
[5]={{type=0,id=421,count=2},{type=7,id=7,count=4},{type=2,id=2,count=10000}},
|
|
||||||
[6]={{type=0,id=261,count=2},{type=7,id=7,count=5},{type=2,id=2,count=10000}},
|
|
||||||
[7]={{type=0,id=421,count=3},{type=7,id=7,count=5},{type=2,id=2,count=10000}},
|
|
||||||
},
|
|
||||||
logTitle = "YY大厅登录礼包",
|
|
||||||
logContent = "你已通过YY大厅登录超过了%d天,领取了YY大厅登录礼包",
|
|
||||||
levelGift = {
|
|
||||||
[1]={lvl=42,awards={{type=0,id=247,count=2},{type=7,id=7,count=2},{type=2,id=2,count=20000}}},
|
|
||||||
[2]={lvl=49,awards={{type=0,id=247,count=3},{type=7,id=7,count=2},{type=2,id=2,count=20000}}},
|
|
||||||
[3]={lvl=55,awards={{type=0,id=247,count=4},{type=7,id=7,count=2},{type=2,id=2,count=20000}}},
|
|
||||||
[4]={lvl=65,awards={{type=0,id=247,count=5},{type=0,id=853,count=2},{type=2,id=2,count=20000}}},
|
|
||||||
[5]={lvl=75,awards={{type=0,id=247,count=6},{type=0,id=365,count=1},{type=2,id=2,count=20000}}},
|
|
||||||
[6]={lvl=85,awards={{type=0,id=247,count=6},{type=0,id=365,count=1},{type=2,id=2,count=20000}}},
|
|
||||||
[7]={lvl=95,awards={{type=0,id=247,count=6},{type=0,id=365,count=1},{type=2,id=2,count=20000}}},
|
|
||||||
},
|
|
||||||
lvgTitle = "YY大厅等级礼包",
|
|
||||||
nobleGift = {
|
|
||||||
[1]={{type=0,id=261,count=5},{type=0,id=854,count=3},{type=2,id=2,count=10000}},
|
|
||||||
[2]={{type=0,id=261,count=5},{type=0,id=854,count=3},{type=2,id=2,count=10000}},
|
|
||||||
[3]={{type=0,id=261,count=5},{type=0,id=854,count=3},{type=2,id=2,count=10000}},
|
|
||||||
},
|
|
||||||
ngTitle = "YY大厅贵族礼包",
|
|
||||||
lvgContent = "你的等级已达到了%d级,领取了YY大厅等级礼包",
|
|
||||||
ngContent = "你的身份为%s,领取了YY大厅贵族礼包",
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
--P-平台福利YY.xlsx YY会员
|
|
||||||
YYVIPConfig={
|
|
||||||
host = "proxy.udblogin.game.yy.com",
|
|
||||||
port = "80",
|
|
||||||
api = "/query/yyVipInfo.do",
|
|
||||||
newServerGift = {
|
|
||||||
[1]={viplvl=1,title={type=16,id=7,count=1},gift={type=0,id=481,count=1}},
|
|
||||||
[2]={viplvl=4,title={type=16,id=8,count=1},gift={type=0,id=482,count=1}},
|
|
||||||
[3]={viplvl=7,title={type=16,id=9,count=1},gift={type=0,id=483,count=1}},
|
|
||||||
},
|
|
||||||
nsTitle = "YY会员新服豪礼",
|
|
||||||
nsContent = "领取了YY会员新服豪礼",
|
|
||||||
weeklyGift = {
|
|
||||||
[1]={yb=160,viplvl=1,gift={type=0,id=487,count=1}},
|
|
||||||
[2]={yb=188,viplvl=4,gift={type=0,id=488,count=1}},
|
|
||||||
[3]={yb=288,viplvl=7,gift={type=0,id=489,count=1}},
|
|
||||||
},
|
|
||||||
wgTitle = "YY会员专属每周礼包",
|
|
||||||
wgContent = "这是您购买的YY会员专属每周礼包,请收下",
|
|
||||||
dailyGift = {
|
|
||||||
[1]={yb=17,viplvl=1,item={type=0,id=484,count=1}},
|
|
||||||
[2]={yb=20,viplvl=4,item={type=0,id=485,count=1}},
|
|
||||||
[3]={yb=35,viplvl=7,item={type=0,id=486,count=1}},
|
|
||||||
},
|
|
||||||
dgTitle = "YY会员专属每日礼包",
|
|
||||||
dgContent = "这是您购买的YY会员专属每日礼包,请收下",
|
|
||||||
SPID = "dudu",
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
--#include "..\..\language\LangCode.txt" once
|
|
||||||
--ͨ<>û<C3BB><EEB6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
ActiGiftBagConfig =
|
|
||||||
{
|
|
||||||
|
|
||||||
--------------------------------ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ActiGiftBagConst actiType
|
|
||||||
--<2D><EFBFBD>б<EFBFBD>
|
|
||||||
commonList=
|
|
||||||
{
|
|
||||||
--2015<31><35><EFBFBD>ڻ-<2D><><EFBFBD><EFBFBD>ӭ<EFBFBD><D3AD> type=1039
|
|
||||||
--#include "actigiftbags/SF2015/SF2015BlessToSprirt.txt"
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
--测试 春节活动-祈福迎神 type=1039
|
|
||||||
{
|
|
||||||
--活动类型. --描述
|
|
||||||
type=1039,
|
|
||||||
--怪物Id
|
|
||||||
name=1356,
|
|
||||||
info=OldLang.Script.wildBossScene001,
|
|
||||||
|
|
||||||
actiList=
|
|
||||||
{
|
|
||||||
|
|
||||||
{
|
|
||||||
--活动id
|
|
||||||
id=1,
|
|
||||||
--名称:喜气礼包(免费领取)
|
|
||||||
name=OldLang.Script.wildBossScene001,
|
|
||||||
--XX礼包名称
|
|
||||||
info=OldLang.Script.wildBossScene001,
|
|
||||||
--最大可领取
|
|
||||||
exValue=1,
|
|
||||||
|
|
||||||
--免费领
|
|
||||||
costAwards=
|
|
||||||
{
|
|
||||||
{ type = 15,count = 0,},
|
|
||||||
},
|
|
||||||
|
|
||||||
--获得的奖励
|
|
||||||
awards =
|
|
||||||
{
|
|
||||||
{ type = 0, id = 2986, count = 2,},
|
|
||||||
{ type = 0, id = 3380, count = 2,},
|
|
||||||
{ type = 0, id = 3386, count = 5,},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
--活动id --对应服务器Id
|
|
||||||
id=2,
|
|
||||||
--名称
|
|
||||||
name=OldLang.Script.wildBossScene002,
|
|
||||||
--XX礼包名称
|
|
||||||
info=OldLang.Script.wildBossScene002,
|
|
||||||
--最大可领取
|
|
||||||
exValue=10,
|
|
||||||
--领取花费元宝
|
|
||||||
costAwards=
|
|
||||||
{
|
|
||||||
{ type = 15,count = 50,},
|
|
||||||
},
|
|
||||||
--获得的奖励
|
|
||||||
awards =
|
|
||||||
{
|
|
||||||
{ type = 0, id = 2745, count = 1,},
|
|
||||||
{ type = 0, id = 2986, count = 3,},
|
|
||||||
{ type = 0, id = 3380, count = 3,},
|
|
||||||
{ type = 0, id = 3386, count = 5,},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
--活动id
|
|
||||||
id=3,
|
|
||||||
--名称
|
|
||||||
name=OldLang.Script.wildBossScene003,
|
|
||||||
--XX礼包名称
|
|
||||||
info=OldLang.Script.wildBossScene003,
|
|
||||||
--最大可领取
|
|
||||||
exValue=10,
|
|
||||||
--领取花费元宝
|
|
||||||
costAwards=
|
|
||||||
{
|
|
||||||
{ type = 15,count = 100,},
|
|
||||||
},
|
|
||||||
--获得的奖励
|
|
||||||
awards =
|
|
||||||
{
|
|
||||||
{ type = 0, id = 3304, count = 1 ,},
|
|
||||||
{ type = 0, id = 3379, count = 2 ,},
|
|
||||||
{ type = 0, id = 2986, count = 5 ,},
|
|
||||||
{ type = 0, id = 3380, count = 5 ,},
|
|
||||||
{ type = 0, id = 3386, count = 10,},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
--AB-活动付费.xlsx 10014-YY微信礼包
|
|
||||||
Activity10014Config={
|
|
||||||
[10027] = {
|
|
||||||
Id = 10027,
|
|
||||||
OpenDays = 1,
|
|
||||||
cdktype = 1015,
|
|
||||||
NormalRewards = {{type=0,id=492,count=1},},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,274 +0,0 @@
|
|||||||
module("ActivityType10011", package.seeall)
|
|
||||||
|
|
||||||
--[[
|
|
||||||
个人活动(玩法),YY大厅特权
|
|
||||||
|
|
||||||
个人数据:YYHallAtv
|
|
||||||
{
|
|
||||||
yydata = 0 YY大厅身份 1平民2贵族3王室
|
|
||||||
freshmanGift = 0/1 是否领取YY大厅新手礼包(0否,1是)
|
|
||||||
lastLoginTime = 0 上一次通过YY大厅登录的时间戳
|
|
||||||
loginDay = 1 通过YY大厅登录的累计天数
|
|
||||||
loginGift = 00000000 32位 是否领取某天的登录礼包
|
|
||||||
levelGift = 00000000 32位 是否领取第n个等级礼包
|
|
||||||
nobleGift = 00000000 32位 是否领取贵族礼包 1平民 2贵族 3王室
|
|
||||||
}
|
|
||||||
]]--
|
|
||||||
|
|
||||||
--活动类型
|
|
||||||
ActivityType = 10011
|
|
||||||
--对应的活动配置
|
|
||||||
ActivityConfig = YYMemberConfig
|
|
||||||
if ActivityConfig == nil then
|
|
||||||
assert(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
local HttpStatus = {
|
|
||||||
Success = "200", -- 成功
|
|
||||||
ArgError = "302", -- 参数错误
|
|
||||||
SignError = "304", -- 签名错误
|
|
||||||
LinkLost = "305", -- 链接失效
|
|
||||||
IpLimit = "306", -- IP受限
|
|
||||||
AccountNotExits = "600", -- 账号不存在
|
|
||||||
UnKnownedError = "299" -- 未知错误
|
|
||||||
}
|
|
||||||
|
|
||||||
-- 服务接口
|
|
||||||
Host = ActivityConfig.host or "proxy.udblogin.game.yy.com"
|
|
||||||
Port = ActivityConfig.port or "80"
|
|
||||||
Api = ActivityConfig.api or "/yy/lobbygift/query/queryInfo.do"
|
|
||||||
|
|
||||||
function getData(pActor)
|
|
||||||
local var = Actor.getStaticVar(pActor)
|
|
||||||
if var.YYHallAtv== nil then
|
|
||||||
var.YYHallAtv = {}
|
|
||||||
end
|
|
||||||
return var.YYHallAtv
|
|
||||||
end
|
|
||||||
|
|
||||||
function SendData(pActor,lvldata)
|
|
||||||
|
|
||||||
--对于lvldata不是 1 2 3 这三个指定数值的直接返回
|
|
||||||
-- if not (lvldata and (lvldata ==1 or lvldata == 2 or lvldata == 3 )) then
|
|
||||||
-- return
|
|
||||||
-- end
|
|
||||||
|
|
||||||
local npack = DataPack.allocPacket(pActor, enActivityID, sYYHallData)
|
|
||||||
if npack then
|
|
||||||
local data = getData(pActor)
|
|
||||||
data.yydata = lvldata
|
|
||||||
DataPack.writeByte(npack, lvldata) --YY身份 1平民 2贵族 3王室
|
|
||||||
DataPack.writeByte(npack, (data.freshmanGift or 0)) --是否已领取YY大厅新手礼包 0否1是
|
|
||||||
DataPack.writeShort(npack, (data.loginDay or 1))--通过YY大厅登录的天数
|
|
||||||
DataPack.writeUInt(npack, (data.loginGift or 0))--登录礼包的领取标记 32 位
|
|
||||||
DataPack.writeUInt(npack, (data.levelGift or 0))--等级礼包的领取标记 32 位
|
|
||||||
DataPack.writeUInt(npack, (data.nobleGift or 0))--贵族礼包的领取标记 32 位
|
|
||||||
DataPack.flush(npack)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function AfterCheckYYHall(paramPack,content,result)
|
|
||||||
local aid = paramPack[1]
|
|
||||||
local pActor = Actor.getActorById(aid)
|
|
||||||
if not pActor then
|
|
||||||
print("[AfterCheckYYHall][" .. aid .. "] 已离线")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
print("[AfterCheckYYHall][" .. Actor.getName(pActor) .. "] content:"..content)
|
|
||||||
print("[AfterCheckYYHall]result:"..result)
|
|
||||||
|
|
||||||
if result == 0 then
|
|
||||||
local data = string.match(content,"\"data\":(%d+)")
|
|
||||||
local status = string.match(content,"\"status\":(%d+)")
|
|
||||||
if status == HttpStatus.Success then
|
|
||||||
SendData(pActor,tonumber(data))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
-- CPP回调
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
function OnYYHallLogin(pActor)
|
|
||||||
local account = Actor.getAccount(pActor)
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
local now = os.time()
|
|
||||||
local gameflag = System.getGameFlag() or "DDCQ"
|
|
||||||
local key = System.getYYKey()
|
|
||||||
local sign = System.MD5(gameflag,account,"1001",now,key)
|
|
||||||
local req = Api..'?account='..account..'&game='..gameflag..'&taskId=1001&time='..now.."&sign="..string.upper(sign)
|
|
||||||
print("Require YYHallLogin[" .. Actor.getName(pActor) .. "] : ".. req)
|
|
||||||
AsyncWorkDispatcher.Add(
|
|
||||||
{'GetHttpContent',Host,Port,req},
|
|
||||||
AfterCheckYYHall,
|
|
||||||
{aid}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- 当天初始化
|
|
||||||
local data = getData(pActor)
|
|
||||||
if data.lastLoginTime == nil then
|
|
||||||
data.lastLoginTime = System.getCurrMiniTime()
|
|
||||||
data.loginDay = 1
|
|
||||||
--print("第一天")
|
|
||||||
else
|
|
||||||
if not System.isSameDay(data.lastLoginTime, System.getCurrMiniTime()) then
|
|
||||||
--print("跨一天")
|
|
||||||
data.lastLoginTime = System.getCurrMiniTime()
|
|
||||||
data.loginDay = data.loginDay + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
-- 客户端请求协议回调
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
function OnReqYYHallFreshManGift(pActor, packet)
|
|
||||||
local idx = DataPack.readByte(packet)
|
|
||||||
local awards = ActivityConfig.freshmanGift
|
|
||||||
local data = getData(pActor)
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
if data.lastLoginTime then
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,1)
|
|
||||||
if (data.freshmanGift == nil) or (data.freshmanGift == 0) then
|
|
||||||
data.freshmanGift = 1
|
|
||||||
SendMail(aid, ActivityConfig.fgTitle or "YY大厅新手礼包", ActivityConfig.fgContent or "恭喜你领取了YY大厅新手礼包!", ActivityConfig.freshmanGift)
|
|
||||||
SendData(pActor,data.yydata)
|
|
||||||
end
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnReqYYHallLoginGift(pActor, packet)
|
|
||||||
local idx = DataPack.readByte(packet)
|
|
||||||
if (idx > 30) or (idx == 0) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if idx > #ActivityConfig.loginGift then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local awards = ActivityConfig.loginGift[idx]
|
|
||||||
idx = idx - 1
|
|
||||||
local data = getData(pActor)
|
|
||||||
if awards and data.lastLoginTime then
|
|
||||||
-- 领取检查
|
|
||||||
if not data.loginGift then
|
|
||||||
data.loginGift = 0
|
|
||||||
end
|
|
||||||
local flag = System.getIntBit(data.loginGift, idx)
|
|
||||||
--print("loginGift="..data.loginGift.." flag="..flag)
|
|
||||||
if flag == 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- 天数检查
|
|
||||||
if data.loginDay and (data.loginDay > idx )then
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,1)
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
data.loginGift = System.setIntBit(data.loginGift, idx, true)
|
|
||||||
local mailcontent = string.format( ActivityConfig.logContent or "你已通过YY大厅登录超过了%d天,领取了YY大厅登录礼包!" , data.loginDay)
|
|
||||||
SendMail(aid, ActivityConfig.logTitle or "YY大厅登录礼包", mailcontent, awards)
|
|
||||||
SendData(pActor,data.yydata)
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnReqYYHallLevelGift(pActor, packet)
|
|
||||||
local idx = DataPack.readByte(packet)
|
|
||||||
if idx > #ActivityConfig.levelGift then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local conf = ActivityConfig.levelGift[idx]
|
|
||||||
local awards = conf.awards
|
|
||||||
idx = idx - 1
|
|
||||||
local data = getData(pActor)
|
|
||||||
if conf and data.lastLoginTime then
|
|
||||||
-- 领取检查
|
|
||||||
if not data.levelGift then
|
|
||||||
data.levelGift = 0
|
|
||||||
end
|
|
||||||
local flag = System.getIntBit(data.levelGift, idx)
|
|
||||||
if flag == 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- 等级检查
|
|
||||||
local lvl = Actor.getIntProperty(pActor,PROP_CREATURE_LEVEL)
|
|
||||||
if lvl >= conf.lvl then
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,1)
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
data.levelGift = System.setIntBit(data.levelGift, idx, true)
|
|
||||||
local mailcontent = string.format( ActivityConfig.lvgContent or "你的等级已达到了%d级,领取了YY大厅等级礼包!" , conf.lvl)
|
|
||||||
SendMail(aid, ActivityConfig.lvgTitle or "YY大厅等级礼包", mailcontent, awards)
|
|
||||||
SendData(pActor,data.yydata)
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
YYIdentity = {[1]="平民",[2]="贵族",[3]="王室"}
|
|
||||||
|
|
||||||
function OnReqYYHallNobleGift(pActor, packet)
|
|
||||||
local idx = DataPack.readByte(packet)
|
|
||||||
if idx > #ActivityConfig.nobleGift then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if idx > #YYIdentity then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local awards = ActivityConfig.nobleGift[idx]
|
|
||||||
idx = idx - 1
|
|
||||||
local data = getData(pActor)
|
|
||||||
if awards and data.lastLoginTime then
|
|
||||||
-- 领取检查
|
|
||||||
if not data.nobleGift then
|
|
||||||
data.nobleGift = 0
|
|
||||||
end
|
|
||||||
local flag = System.getIntBit(data.nobleGift, idx)
|
|
||||||
if flag == 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- 身份检查
|
|
||||||
if data.yydata > idx then
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,1)
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
data.nobleGift = System.setIntBit(data.nobleGift, idx, true)
|
|
||||||
local mailcontent = string.format( ActivityConfig.ngContent or "你的身份为%s,领取了YY大厅贵族礼包!" , YYIdentity[idx+1])
|
|
||||||
SendMail(aid, ActivityConfig.ngTitle or "YY大厅等级礼包", mailcontent, awards)
|
|
||||||
SendData(pActor,data.yydata)
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
NetmsgDispatcher.Reg(enActivityID, cReqYYHallFreshManGift, OnReqYYHallFreshManGift)
|
|
||||||
NetmsgDispatcher.Reg(enActivityID, cReqYYHallLoginGift, OnReqYYHallLoginGift)
|
|
||||||
NetmsgDispatcher.Reg(enActivityID, cReqYYHallLevelGift, OnReqYYHallLevelGift)
|
|
||||||
NetmsgDispatcher.Reg(enActivityID, cReqYYHallNobleGift, OnReqYYHallNobleGift)
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
-- 玩家 回调注册
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- 跨天
|
|
||||||
function OnNewDayArrive(pActor,ndiffday)
|
|
||||||
local currMiniTime = System.getCurrMiniTime()
|
|
||||||
local data = getData(pActor)
|
|
||||||
if data.lastLoginTime then
|
|
||||||
if not System.isSameDay(data.lastLoginTime, System.getCurrMiniTime()) then
|
|
||||||
data.lastLoginTime = System.getCurrMiniTime()
|
|
||||||
data.loginDay = data.loginDay + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
SendData(pActor,data.yydata)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnUserLogout(pActor,actorId)
|
|
||||||
if pActor ==nil then return end
|
|
||||||
local data = getData(pActor)
|
|
||||||
data.yydata =nil
|
|
||||||
end
|
|
||||||
|
|
||||||
ActorEventDispatcher.Reg(aeNewDayArrive, OnNewDayArrive, "ActivityType10011.lua")
|
|
||||||
ActorEventDispatcher.Reg(aeUserLogout, OnUserLogout, "ActivityType10011.lua")
|
|
||||||
@@ -1,384 +0,0 @@
|
|||||||
module("ActivityType10012", package.seeall)
|
|
||||||
|
|
||||||
--[[
|
|
||||||
个人活动(玩法),YY会员
|
|
||||||
|
|
||||||
个人数据:YYVIPeople
|
|
||||||
{
|
|
||||||
isVip = true/false, 是否为YY会员
|
|
||||||
grade = 0, vip等级
|
|
||||||
endTime = 0, vip过期时间戳
|
|
||||||
lastTime = 0 上一次初始化的时间戳
|
|
||||||
newServerGift = 00000000 32位 是否领取第n个新服豪礼
|
|
||||||
dailyGift = 00000000 32位 是否领取第n个每日礼包
|
|
||||||
weeklyGift = 00000000 32位 是否领取第n个每周礼包
|
|
||||||
}
|
|
||||||
]]--
|
|
||||||
|
|
||||||
--活动类型
|
|
||||||
ActivityType = 10012
|
|
||||||
--对应的活动配置
|
|
||||||
ActivityConfig = YYVIPConfig
|
|
||||||
PlatformConfig = YYVIPConfig
|
|
||||||
local PfId = System.getPfId()
|
|
||||||
|
|
||||||
|
|
||||||
if ActivityConfig == nil then
|
|
||||||
assert(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
local HttpStatus = {
|
|
||||||
Success = "200", -- 成功
|
|
||||||
ArgError = "302", -- 参数错误
|
|
||||||
SignError = "304", -- 签名错误
|
|
||||||
LinkLost = "305", -- 链接失效
|
|
||||||
IpLimit = "306", -- IP受限
|
|
||||||
AccountNotExits = "600", -- 账号不存在
|
|
||||||
UnKnownedError = "299" -- 未知错误
|
|
||||||
}
|
|
||||||
|
|
||||||
-- 服务接口
|
|
||||||
Host = ActivityConfig.host or "proxy.udblogin.game.yy.com"
|
|
||||||
Port = ActivityConfig.port or "80"
|
|
||||||
Api = ActivityConfig.api or "/query/yyVipInfo.do"
|
|
||||||
|
|
||||||
function getData(pActor)
|
|
||||||
local var = Actor.getStaticVar(pActor)
|
|
||||||
if var.YYVIPeople== nil then
|
|
||||||
var.YYVIPeople = {}
|
|
||||||
end
|
|
||||||
return var.YYVIPeople
|
|
||||||
end
|
|
||||||
|
|
||||||
function SendData(pActor)
|
|
||||||
if PfId ~= nil and PlatformConfig.SPID ~= nil then
|
|
||||||
--print("[Tip] [YYVIP] SendData ---------------------PfId:"..PfId.."--- SPID:"..PlatformConfig.SPID)
|
|
||||||
if tostring(PfId) ~= tostring(PlatformConfig.SPID) then
|
|
||||||
|
|
||||||
print("[Tip] [YYVIP] [非本平台活动]")
|
|
||||||
return --非本平台活动
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local npack = DataPack.allocPacket(pActor, enActivityID, sYYVipData)
|
|
||||||
if npack then
|
|
||||||
local data = getData(pActor)
|
|
||||||
DataPack.writeByte(npack, (data.isVip or 0)) -- 是否为VIP 0否1是
|
|
||||||
DataPack.writeByte(npack, (data.grade or 1)) -- vip等级
|
|
||||||
DataPack.writeInt64(npack, (data.endTime or 0)) -- 过期时间戳
|
|
||||||
DataPack.writeUInt(npack, (data.newServerGift or 0))-- 32位 是否领取第n个新服豪礼
|
|
||||||
DataPack.writeUInt(npack, (data.dailyGift or 0)) -- 32位 是否领取第n个每日礼包
|
|
||||||
DataPack.writeUInt(npack, (data.weeklyGift or 0)) -- 32位 是否领取第n个每周礼包
|
|
||||||
DataPack.flush(npack)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function AfterCheckYYLogin(paramPack,content,result)
|
|
||||||
if PfId ~= nil and PlatformConfig.SPID ~= nil then
|
|
||||||
--print("[Tip] [YYVIP] SendData ---------------------PfId:"..PfId.."--- SPID:"..PlatformConfig.SPID)
|
|
||||||
if tostring(PfId) ~= tostring(PlatformConfig.SPID) then
|
|
||||||
|
|
||||||
print("[Tip] [YYVIP] [非本平台活动]")
|
|
||||||
return --非本平台活动
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local aid = paramPack[1]
|
|
||||||
local pActor = Actor.getActorById(aid)
|
|
||||||
if not pActor then
|
|
||||||
print("[AfterCheckYYLogin][" .. aid .. "] 已离线")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
print("[AfterCheckYYLogin][" .. Actor.getName(pActor) .. "] content:"..content)
|
|
||||||
print("[AfterCheckYYLogin]result:"..result)
|
|
||||||
|
|
||||||
if result == 0 then
|
|
||||||
local status = string.match(content,"\"status\":(%d+)")
|
|
||||||
if (status == HttpStatus.Success) then
|
|
||||||
local isvip = string.match(content,"\"isVip\":(%a+)")
|
|
||||||
local grade = string.match(content,"\"grade\":(%d+)")
|
|
||||||
local endTime = string.match(content,"\"endTime\":(%a+)")
|
|
||||||
if isvip == "true" then
|
|
||||||
isvip = 1
|
|
||||||
else
|
|
||||||
isvip = 0
|
|
||||||
end
|
|
||||||
grade = tonumber(grade)
|
|
||||||
if endTime ~= "null" then
|
|
||||||
endTime = tonumber(endTime)
|
|
||||||
else
|
|
||||||
endTime = 0
|
|
||||||
end
|
|
||||||
local data = getData(pActor)
|
|
||||||
data.isVip = isvip
|
|
||||||
data.grade = grade
|
|
||||||
data.endTime = endTime
|
|
||||||
SendData(pActor)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
-- CPP回调
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
function OnYYLogin(pActor)
|
|
||||||
if PfId ~= nil and PlatformConfig.SPID ~= nil then
|
|
||||||
--print("[Tip] [YYVIP] SendData ---------------------PfId:"..PfId.."--- SPID:"..PlatformConfig.SPID)
|
|
||||||
if tostring(PfId) ~= tostring(PlatformConfig.SPID) then
|
|
||||||
|
|
||||||
print("[Tip] [YYVIP] [非本平台活动]")
|
|
||||||
return --非本平台活动
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local account = Actor.getAccount(pActor)
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
local now = os.time()
|
|
||||||
local gameflag = System.getGameFlag() or "DDCQ"
|
|
||||||
local key = System.getYYKey()
|
|
||||||
local sign = System.MD5(gameflag,account,now,key)
|
|
||||||
local req = Api..'?game='..gameflag..'&account='..account..'&ts='..now.."&sign="..string.upper(sign)
|
|
||||||
print("Require OnYYLogin[" .. Actor.getName(pActor) .. "] : ".. req)
|
|
||||||
AsyncWorkDispatcher.Add(
|
|
||||||
{'GetHttpContent',Host,Port,req},
|
|
||||||
AfterCheckYYLogin,
|
|
||||||
{aid}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- 当天初始化
|
|
||||||
local currMiniTime = System.getCurrMiniTime()
|
|
||||||
local data = getData(pActor)
|
|
||||||
if data.lastTime == nil then
|
|
||||||
data.lastTime = currMiniTime
|
|
||||||
data.newServerGift = 0
|
|
||||||
data.dailyGift = 0
|
|
||||||
data.weeklyGift = 0
|
|
||||||
--print("第一天")
|
|
||||||
else
|
|
||||||
if not System.isSameDay(data.lastTime, currMiniTime) then
|
|
||||||
--print("跨一天")
|
|
||||||
if System.isSameWeek(data.lastTime, currMiniTime) then
|
|
||||||
--print("跨一周")
|
|
||||||
data.weeklyGift = 0
|
|
||||||
end
|
|
||||||
data.lastTime = currMiniTime
|
|
||||||
data.dailyGift = 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
-- 客户端请求协议回调
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
function OnReqYYVIPNewSrvGift(pActor, packet)
|
|
||||||
if PfId ~= nil and PlatformConfig.SPID ~= nil then
|
|
||||||
--print("[Tip] [YYVIP] SendData ---------------------PfId:"..PfId.."--- SPID:"..PlatformConfig.SPID)
|
|
||||||
if tostring(PfId) ~= tostring(PlatformConfig.SPID) then
|
|
||||||
|
|
||||||
print("[Tip] [YYVIP] [非本平台活动]")
|
|
||||||
return --非本平台活动
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local idx = DataPack.readByte(packet)
|
|
||||||
if idx > (2 * #ActivityConfig.newServerGift) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local confid = math.ceil(idx/2)
|
|
||||||
local conf = ActivityConfig.newServerGift[confid]
|
|
||||||
|
|
||||||
local istitle = (idx%2 == 1)
|
|
||||||
|
|
||||||
idx = idx - 1
|
|
||||||
local data = getData(pActor)
|
|
||||||
|
|
||||||
if conf and data.lastTime then
|
|
||||||
|
|
||||||
-- 领取检查
|
|
||||||
if not data.newServerGift then
|
|
||||||
data.newServerGift = 0
|
|
||||||
end
|
|
||||||
local flag = System.getIntBit(data.newServerGift, idx)
|
|
||||||
print("newServerGift="..data.newServerGift.." flag="..flag)
|
|
||||||
if flag == 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 等级检查
|
|
||||||
if data.grade < conf.viplvl then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
--检测格子
|
|
||||||
if CommonFunc.Awards.CheckBagIsEnough(pActor,16,tmDefNoBagNum,tstUI) ~= true then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 设置标志
|
|
||||||
data.newServerGift = System.setIntBit(data.newServerGift, idx, true)
|
|
||||||
SendData(pActor)
|
|
||||||
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,1)
|
|
||||||
if istitle then
|
|
||||||
local awards = {conf.title}
|
|
||||||
CommonFunc.Awards.Give(pActor, awards, GameLog.Log_Activity10012, "YYVIP NewSrvGift")
|
|
||||||
else
|
|
||||||
--获取
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
local awards = {conf.gift}
|
|
||||||
SendMail(aid, ActivityConfig.nsTitle, ActivityConfig.nsContent, awards)
|
|
||||||
end
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnReqYYVIPDailyGift(pActor, packet)
|
|
||||||
if PfId ~= nil and PlatformConfig.SPID ~= nil then
|
|
||||||
--print("[Tip] [YYVIP] SendData ---------------------PfId:"..PfId.."--- SPID:"..PlatformConfig.SPID)
|
|
||||||
if tostring(PfId) ~= tostring(PlatformConfig.SPID) then
|
|
||||||
|
|
||||||
print("[Tip] [YYVIP] [非本平台活动]")
|
|
||||||
return --非本平台活动
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local idx = DataPack.readByte(packet)
|
|
||||||
if idx > #ActivityConfig.dailyGift then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local conf = ActivityConfig.dailyGift[idx]
|
|
||||||
idx = idx - 1
|
|
||||||
local data = getData(pActor)
|
|
||||||
if conf and data.lastTime then
|
|
||||||
-- 领取检查
|
|
||||||
if not data.dailyGift then
|
|
||||||
data.dailyGift = 0
|
|
||||||
end
|
|
||||||
local flag = System.getIntBit(data.dailyGift, idx)
|
|
||||||
--print("dailyGift="..data.dailyGift.." flag="..flag)
|
|
||||||
if flag == 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 等级检查
|
|
||||||
if data.grade < conf.viplvl then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 元宝检查
|
|
||||||
local consumes = {{type=4,id=4,count=conf.yb}}
|
|
||||||
if CommonFunc.Consumes.CheckActorSources(pActor, consumes, tstUI) ~= true then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
--消耗
|
|
||||||
CommonFunc.Consumes.Remove(pActor, consumes, GameLog.Log_Activity10012, "YYVIP dailyGift | " .. ActivityType)
|
|
||||||
|
|
||||||
-- 设置标志
|
|
||||||
data.dailyGift = System.setIntBit(data.dailyGift, idx, true)
|
|
||||||
SendData(pActor)
|
|
||||||
|
|
||||||
--获取
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
local awards = {conf.item}
|
|
||||||
SendMail(aid, ActivityConfig.dgTitle, ActivityConfig.dgContent, awards)
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,1)
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnReqYYVIPWeeklyGift(pActor, packet)
|
|
||||||
if PfId ~= nil and PlatformConfig.SPID ~= nil then
|
|
||||||
--print("[Tip] [YYVIP] SendData ---------------------PfId:"..PfId.."--- SPID:"..PlatformConfig.SPID)
|
|
||||||
if tostring(PfId) ~= tostring(PlatformConfig.SPID) then
|
|
||||||
|
|
||||||
print("[Tip] [YYVIP] [非本平台活动]")
|
|
||||||
return --非本平台活动
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local idx = DataPack.readByte(packet)
|
|
||||||
if idx > #ActivityConfig.weeklyGift then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local conf = ActivityConfig.weeklyGift[idx]
|
|
||||||
idx = idx - 1
|
|
||||||
local data = getData(pActor)
|
|
||||||
if conf and data.lastTime then
|
|
||||||
-- 领取检查
|
|
||||||
if not data.weeklyGift then
|
|
||||||
data.weeklyGift = 0
|
|
||||||
end
|
|
||||||
local flag = System.getIntBit(data.weeklyGift, idx)
|
|
||||||
--print("weeklyGift="..data.weeklyGift.." flag="..flag)
|
|
||||||
if flag == 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 等级检查
|
|
||||||
if data.grade < conf.viplvl then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
--检测格子
|
|
||||||
if CommonFunc.Awards.CheckBagIsEnough(pActor,16,tmDefNoBagNum,tstUI) ~= true then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 元宝检查
|
|
||||||
local consumes = {{type=4,id=4,count=conf.yb}}
|
|
||||||
if CommonFunc.Consumes.CheckActorSources(pActor, consumes, tstUI) ~= true then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
--消耗
|
|
||||||
CommonFunc.Consumes.Remove(pActor, consumes, GameLog.Log_Activity10012, "YYVIP WeeklyGift | " .. ActivityType)
|
|
||||||
|
|
||||||
-- 设置标志
|
|
||||||
data.weeklyGift = System.setIntBit(data.weeklyGift, idx, true)
|
|
||||||
SendData(pActor)
|
|
||||||
|
|
||||||
--获取
|
|
||||||
CommonFunc.Awards.Give(pActor, awards, GameLog.Log_Activity10012, "YYVIP WeeklyGift | " .. ActivityType)
|
|
||||||
|
|
||||||
--获取
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
local awards = {conf.gift}
|
|
||||||
SendMail(aid, ActivityConfig.wgTitle, ActivityConfig.wgContent, awards)
|
|
||||||
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,1)
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
NetmsgDispatcher.Reg(enActivityID, cReqYYVIPNewSrvGift, OnReqYYVIPNewSrvGift)
|
|
||||||
NetmsgDispatcher.Reg(enActivityID, cReqYYVIPDailyGift, OnReqYYVIPDailyGift)
|
|
||||||
NetmsgDispatcher.Reg(enActivityID, cReqYYVIPWeeklyGift, OnReqYYVIPWeeklyGift)
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
-- 玩家 回调注册
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- 跨天
|
|
||||||
function OnNewDayArrive(pActor,ndiffday)
|
|
||||||
if PfId ~= nil and PlatformConfig.SPID ~= nil then
|
|
||||||
--print("[Tip] [YYVIP] SendData ---------------------PfId:"..PfId.."--- SPID:"..PlatformConfig.SPID)
|
|
||||||
if tostring(PfId) ~= tostring(PlatformConfig.SPID) then
|
|
||||||
|
|
||||||
print("[Tip] [YYVIP] [非本平台活动]")
|
|
||||||
return --非本平台活动
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local currMiniTime = System.getCurrMiniTime()
|
|
||||||
local data = getData(pActor)
|
|
||||||
if data.lastTime then
|
|
||||||
if not System.isSameDay(data.lastTime, currMiniTime) then
|
|
||||||
--print("跨一天")
|
|
||||||
if not System.isSameWeek(data.lastTime, currMiniTime) then
|
|
||||||
--print("跨一周")
|
|
||||||
data.weeklyGift = 0
|
|
||||||
end
|
|
||||||
data.lastTime = currMiniTime
|
|
||||||
data.dailyGift = 0
|
|
||||||
end
|
|
||||||
SendData(pActor)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
ActorEventDispatcher.Reg(aeNewDayArrive, OnNewDayArrive, "ActivityType10012.lua")
|
|
||||||
@@ -1,289 +0,0 @@
|
|||||||
module("ActivityType10013", package.seeall)
|
|
||||||
|
|
||||||
--[[
|
|
||||||
个人活动(玩法),超玩会员
|
|
||||||
|
|
||||||
个人数据:SupperVIPeople
|
|
||||||
{
|
|
||||||
isVip = true/false 是否是会员
|
|
||||||
lastTime = 0 上一次初始化的时间戳
|
|
||||||
v1_v3Gift = 00000000 32位 是否领取第n个v1-v3礼包
|
|
||||||
dailyGift = 00000000 32位 是否领取第n个每日礼包
|
|
||||||
}
|
|
||||||
]]--
|
|
||||||
|
|
||||||
--活动类型
|
|
||||||
ActivityType = 10013
|
|
||||||
--对应的活动配置
|
|
||||||
ActivityConfig = GameVIPConfig
|
|
||||||
if ActivityConfig == nil then
|
|
||||||
assert(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
local HttpStatus =
|
|
||||||
{
|
|
||||||
Success = "200", -- 成功
|
|
||||||
ArgError = "302", -- 参数错误
|
|
||||||
SignError = "304", -- 签名错误
|
|
||||||
LinkLost = "305", -- 链接失效
|
|
||||||
IpLimit = "306", -- IP受限
|
|
||||||
AccountNotExits = "600", -- 账号不存在
|
|
||||||
UnKnownedError = "299", -- 未知错误
|
|
||||||
}
|
|
||||||
|
|
||||||
-- 服务接口
|
|
||||||
Host = ActivityConfig.host or "proxy.udblogin.game.yy.com"
|
|
||||||
Port = ActivityConfig.port or "80"
|
|
||||||
Api = ActivityConfig.api or "/query/cwVipInfo.do"
|
|
||||||
|
|
||||||
function getData(pActor)
|
|
||||||
local var = Actor.getStaticVar(pActor)
|
|
||||||
if var.SupperVIPeople== nil then
|
|
||||||
var.SupperVIPeople = {}
|
|
||||||
end
|
|
||||||
return var.SupperVIPeople
|
|
||||||
end
|
|
||||||
|
|
||||||
function SendData(pActor)
|
|
||||||
local npack = DataPack.allocPacket(pActor, enActivityID, sSupperVipData)
|
|
||||||
if npack then
|
|
||||||
local data = getData(pActor)
|
|
||||||
DataPack.writeUInt(npack, (data.v1_v3Gift or 0))
|
|
||||||
--print("v1-v3 giftbit : "..(data.v1_v3Gift or 0 ) )
|
|
||||||
DataPack.writeUInt(npack, (data.dailyGift or 0))
|
|
||||||
--print("daily giftbit : "..(data.dailyGift or 0))
|
|
||||||
DataPack.flush(npack)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function AfterCheckSupperLogin(paramPack,content,result)
|
|
||||||
local aid = paramPack[1]
|
|
||||||
local pActor = Actor.getActorById(aid)
|
|
||||||
if not pActor then
|
|
||||||
--print("[AfterCheckSupperLogin][" .. aid .. "] 已离线")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
--print("[AfterCheckSupperLogin][" .. Actor.getName(pActor) .. "] content:"..content)
|
|
||||||
--print("[AfterCheckSupperLogin]result:"..result)
|
|
||||||
|
|
||||||
if Actor.getEntityType(pActor) ~= enActor then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
--先清buff
|
|
||||||
for i = 1 , #ActivityConfig.GameVIPbuff do
|
|
||||||
Actor.delBuffById(pActor, (ActivityConfig.GameVIPbuff[i].buffid or 0))
|
|
||||||
end
|
|
||||||
|
|
||||||
local data = getData(pActor)
|
|
||||||
|
|
||||||
if result == 0 then
|
|
||||||
local status = string.match(content,"\"status\":(%d+)")
|
|
||||||
if status == HttpStatus.Success then
|
|
||||||
local vipLevel = string.match(content,"\"vipLevel\":(%d+)")
|
|
||||||
vipLevel = tonumber(vipLevel)
|
|
||||||
Actor.setUIntProperty(pActor,PROP_ACTOR_SUPPER_PLAY_LVL,vipLevel)
|
|
||||||
Actor.updateActorEntityProp(pActor)
|
|
||||||
--local grade = string.match(content,"\"grade\":(%d+)")
|
|
||||||
--local endTime = string.match(content,"\"endTime\":(%a+)")
|
|
||||||
data.isVip = 1
|
|
||||||
|
|
||||||
--加超玩特权buff
|
|
||||||
if(vipLevel >= 9) then
|
|
||||||
Actor.addBuffById(pActor, (ActivityConfig.GameVIPbuff[3].buffid or 0))
|
|
||||||
elseif (vipLevel >= 6) then
|
|
||||||
Actor.addBuffById(pActor, (ActivityConfig.GameVIPbuff[2].buffid or 0))
|
|
||||||
elseif (vipLevel >= 2) then
|
|
||||||
Actor.addBuffById(pActor, (ActivityConfig.GameVIPbuff[1].buffid or 0))
|
|
||||||
end
|
|
||||||
|
|
||||||
else
|
|
||||||
data.isVip = 0
|
|
||||||
Actor.setUIntProperty(pActor,PROP_ACTOR_SUPPER_PLAY_LVL,0)
|
|
||||||
Actor.updateActorEntityProp(pActor)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
SendData(pActor)
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
-- CPP回调
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
function OnSupperLogin(pActor)
|
|
||||||
local account = Actor.getAccount(pActor)
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
local now_milli = os.time()*1000
|
|
||||||
local gameflag = System.getGameFlag() or "DDCQ"
|
|
||||||
local key = System.getYYKey()
|
|
||||||
local sign = System.MD5(gameflag,account,now_milli,key)
|
|
||||||
local req = Api..'?game='..gameflag..'&account='..account..'&ts='..now_milli.."&sign="..string.upper(sign)
|
|
||||||
--print("Require OnSupperLogin[" .. Actor.getName(pActor) .. "] : ".. req)
|
|
||||||
AsyncWorkDispatcher.Add(
|
|
||||||
{'GetHttpContent',Host,Port,req},
|
|
||||||
AfterCheckSupperLogin,
|
|
||||||
{aid}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- 当天初始化
|
|
||||||
local currMiniTime = System.getCurrMiniTime()
|
|
||||||
local data = getData(pActor)
|
|
||||||
if data.lastTime == nil then
|
|
||||||
data.lastTime = currMiniTime
|
|
||||||
--print("第一天")
|
|
||||||
else
|
|
||||||
if not System.isSameDay(data.lastTime, currMiniTime) then
|
|
||||||
data.lastTime = currMiniTime
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
-- 客户端请求协议回调
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
--v1-v3等级礼包
|
|
||||||
function OnReqSuperVipV1_V3(pActor, packet)
|
|
||||||
local idx = DataPack.readByte(packet)
|
|
||||||
if idx > #ActivityConfig.vipGift or idx <= 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local conf = ActivityConfig.vipGift[idx]
|
|
||||||
local myLevel = Actor.getIntProperty(pActor, PROP_ACTOR_SUPPER_PLAY_LVL)
|
|
||||||
|
|
||||||
--一级玩家增加领取范围
|
|
||||||
if myLevel ==1 then
|
|
||||||
myLevel = 2
|
|
||||||
end
|
|
||||||
|
|
||||||
local data = getData(pActor)
|
|
||||||
|
|
||||||
if data.isVip == 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if conf and data.lastTime then
|
|
||||||
-- 领取检查
|
|
||||||
if not data.v1_v3Gift then
|
|
||||||
data.v1_v3Gift = 0
|
|
||||||
end
|
|
||||||
local flag = System.getIntBit(data.v1_v3Gift, idx-1)
|
|
||||||
if flag == 1 then
|
|
||||||
Actor.sendTipmsg(pActor, "|C:0xf56f00&T:奖励已领取|", tstUI)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- 等级检查
|
|
||||||
if myLevel < idx then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
--消耗
|
|
||||||
--CommonFunc.Consumes.Remove(pActor, consumes, GameLog.Log_Activity10013, "super Player v1-v3")
|
|
||||||
|
|
||||||
--记录日志
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,1)
|
|
||||||
|
|
||||||
--获取
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
local awards = conf
|
|
||||||
SendMail(aid, ActivityConfig.VIPTitle, ActivityConfig.VIPContent, awards)
|
|
||||||
|
|
||||||
--记录日志
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,2)
|
|
||||||
-- 设置标志
|
|
||||||
data.v1_v3Gift = System.setIntBit(data.v1_v3Gift, idx-1, true)
|
|
||||||
SendData(pActor)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- 每日礼包,初中高级
|
|
||||||
function OnReqSuperVipDaily(pActor, packet)
|
|
||||||
local idx = DataPack.readByte(packet)
|
|
||||||
if idx > #ActivityConfig.dailyGift or idx <= 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local conf = ActivityConfig.dailyGift[idx]
|
|
||||||
|
|
||||||
local myLevel = Actor.getIntProperty(pActor, PROP_ACTOR_SUPPER_PLAY_LVL)
|
|
||||||
|
|
||||||
local data = getData(pActor)
|
|
||||||
|
|
||||||
if data.isVip == 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if conf and data.lastTime then
|
|
||||||
-- 领取检查
|
|
||||||
if not data.dailyGift then
|
|
||||||
data.dailyGift = 0
|
|
||||||
end
|
|
||||||
local flag = System.getIntBit(data.dailyGift, idx-1)
|
|
||||||
if flag == 1 then
|
|
||||||
Actor.sendTipmsg(pActor, "|C:0xf56f00&T:奖励已领取|", tstUI)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 等级检查
|
|
||||||
if myLevel < ActivityConfig.vipMap[idx] then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
--记录日志
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,1)
|
|
||||||
|
|
||||||
--获取
|
|
||||||
local aid = Actor.getActorId(pActor)
|
|
||||||
local awards = conf
|
|
||||||
SendMail(aid, ActivityConfig.VIPDailyTitle, ActivityConfig.VIPDailyContent, awards)
|
|
||||||
|
|
||||||
--记录日志
|
|
||||||
Actor.SendActivityLog(pActor,ActivityType,ActivityType,2)
|
|
||||||
|
|
||||||
-- 设置标志
|
|
||||||
data.dailyGift = System.setIntBit(data.dailyGift, idx-1, true)
|
|
||||||
|
|
||||||
SendData(pActor)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
NetmsgDispatcher.Reg(enActivityID, cReqSuperVipV1_V3, OnReqSuperVipV1_V3)
|
|
||||||
NetmsgDispatcher.Reg(enActivityID, cReqSuperVipDaily, OnReqSuperVipDaily)
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
-- 玩家 回调注册
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- 跨天
|
|
||||||
function OnNewDayArrive(pActor,ndiffday)
|
|
||||||
local currMiniTime = System.getCurrMiniTime()
|
|
||||||
local data = getData(pActor)
|
|
||||||
if data.lastTime then
|
|
||||||
if not System.isSameDay(data.lastTime, currMiniTime) then
|
|
||||||
--print("跨一天")
|
|
||||||
data.lastTime = currMiniTime
|
|
||||||
data.dailyGift = 0
|
|
||||||
end
|
|
||||||
SendData(pActor)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnUserLogout(pActor,actorId)
|
|
||||||
--local pActor = Actor.getActorById(actorId)
|
|
||||||
|
|
||||||
--离线就删除buff
|
|
||||||
--没有对会员时间处理,上线是超玩就加buff,离线就删buff
|
|
||||||
for i = 1 , #ActivityConfig.GameVIPbuff do
|
|
||||||
Actor.delBuffById(pActor, (ActivityConfig.GameVIPbuff[i].buffid or 0))
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ActorEventDispatcher.Reg(aeNewDayArrive, OnNewDayArrive, "ActivityType10013.lua")
|
|
||||||
ActorEventDispatcher.Reg(aeUserLogout, OnUserLogout, "ActivityType10013.lua")
|
|
||||||
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
module("ActivityType10014", package.seeall)
|
|
||||||
--[[
|
|
||||||
|
|
||||||
微信礼包
|
|
||||||
|
|
||||||
个人数据:ActorData[AtvId]
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
全局缓存:Cache[AtvId]
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
全局数据:GlobalData[AtvId]
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
]]--
|
|
||||||
|
|
||||||
--活动类型
|
|
||||||
ActivityType = 10014
|
|
||||||
--对应的活动配置
|
|
||||||
ActivityConfig = Activity10014Config
|
|
||||||
if ActivityConfig == nil then
|
|
||||||
assert(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------我是分界线----------------------------
|
|
||||||
-- 初始化玩家数据
|
|
||||||
function OnInit(atvId, pActor)
|
|
||||||
-- local Cfg = ActivityConfig[atvId];
|
|
||||||
-- if Cfg == nil then
|
|
||||||
-- return;
|
|
||||||
-- end
|
|
||||||
-- local data = getActorCdkData(pActor)
|
|
||||||
-- if data then
|
|
||||||
-- if data.codeTypeTimes then
|
|
||||||
-- if data.codeTypeTimes[Cfg.cdktype] then
|
|
||||||
-- Actor.closeOneActivity(pActor,atvId)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
--活动开始
|
|
||||||
function OnStart(atvId, pActor)
|
|
||||||
-- local Cfg = ActivityConfig[atvId];
|
|
||||||
-- if Cfg == nil then
|
|
||||||
-- return;
|
|
||||||
-- end
|
|
||||||
-- local data =getActorCdkData(pActor)
|
|
||||||
-- if data then
|
|
||||||
-- if data.codeTypeTimes then
|
|
||||||
-- if data.codeTypeTimes[Cfg.cdktype] then
|
|
||||||
-- Actor.closeOneActivity(pActor,atvId)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- 获取活动数据
|
|
||||||
function OnReqData(atvId, pActor, outPack)
|
|
||||||
-- local Cfg = ActivityConfig[atvId];
|
|
||||||
-- if Cfg == nil then
|
|
||||||
-- return;
|
|
||||||
-- end
|
|
||||||
-- local data = getActorCdkData(pActor)
|
|
||||||
-- if data then
|
|
||||||
-- if data.codeTypeTimes then
|
|
||||||
-- if data.codeTypeTimes[Cfg.cdktype] then
|
|
||||||
-- Actor.closeOneActivity(pActor,atvId)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 活动结束
|
|
||||||
function OnUpdate(atvId, curTime, pActor)
|
|
||||||
local Cfg = ActivityConfig[atvId];
|
|
||||||
if Cfg == nil then
|
|
||||||
return;
|
|
||||||
end
|
|
||||||
local data = getActorCdkData(pActor)
|
|
||||||
if data then
|
|
||||||
if data.codeTypeTimes then
|
|
||||||
if data.codeTypeTimes[Cfg.cdktype] then
|
|
||||||
Actor.closeOneActivity(pActor,atvId)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
ActivityDispatcher.Reg(ActivityEvent.OnStart, ActivityType, OnStart, "ActivityType10014.lua")
|
|
||||||
ActivityDispatcher.Reg(ActivityEvent.OnInit, ActivityType, OnInit, "ActivityType10014.lua")
|
|
||||||
|
|
||||||
ActivityDispatcher.Reg(ActivityEvent.OnReqData, ActivityType, OnReqData, "ActivityType10014.lua")
|
|
||||||
ActivityDispatcher.Reg(ActivityEvent.OnUpdate, ActivityType, OnUpdate, "ActivityType10014.lua")
|
|
||||||
@@ -35,17 +35,12 @@ require("Activity.ActivityType10005") --个人活动:月份签到
|
|||||||
require("Activity.ActivityType10006") --个人活动:登录基金
|
require("Activity.ActivityType10006") --个人活动:登录基金
|
||||||
require("Activity.ActivityType10009") --个人活动:达标活动
|
require("Activity.ActivityType10009") --个人活动:达标活动
|
||||||
require("Activity.ActivityType10010") --个人活动:寻宝活动
|
require("Activity.ActivityType10010") --个人活动:寻宝活动
|
||||||
require("Activity.ActivityType10011") --玩法:YY大厅特权
|
|
||||||
require("Activity.ActivityType10012") --玩法:YY会员
|
|
||||||
require("Activity.ActivityType10013") --玩法:超玩会员
|
|
||||||
require("Activity.ActivityType10014") --玩法:微信礼包
|
|
||||||
require("Activity.ActivityType10015") --全局个人活动:每周固定时间的礼包活动
|
require("Activity.ActivityType10015") --全局个人活动:每周固定时间的礼包活动
|
||||||
require("Activity.ActivityType10017") --兑换活动
|
require("Activity.ActivityType10017") --兑换活动
|
||||||
require("Activity.ActivityQQHall") --QQ大厅
|
require("Activity.ActivityType10019") --个人活动:达标活动
|
||||||
require("Activity.ActivityType10019") --
|
require("Activity.ActivityLuckyTree") --摇钱树
|
||||||
require("Activity.ActivityLuckyTree") --
|
require("Activity.ActivityOnlineMin") --累计在线
|
||||||
require("Activity.ActivityOnlineMin") --
|
require("Activity.ActivityType10020") --个人活动:寻宝
|
||||||
require("Activity.ActivityType10020") --
|
|
||||||
require("Activity.ActivityType10021") --个人活动:二充
|
require("Activity.ActivityType10021") --个人活动:二充
|
||||||
|
|
||||||
require("Activity.ActivityType10033") --区服冠名
|
require("Activity.ActivityType10033") --区服冠名
|
||||||
|
|||||||
@@ -51,7 +51,6 @@
|
|||||||
--#include "data/config/activity/Activity10006Config.config" once
|
--#include "data/config/activity/Activity10006Config.config" once
|
||||||
--#include "data/config/activity/Activity10009Config.config" once
|
--#include "data/config/activity/Activity10009Config.config" once
|
||||||
--#include "data/config/activity/Activity10010Config.config" once
|
--#include "data/config/activity/Activity10010Config.config" once
|
||||||
--#include "data/config/activity/Activity10014Config.config" once
|
|
||||||
--#include "data/config/activity/Activity10015Config.config" once
|
--#include "data/config/activity/Activity10015Config.config" once
|
||||||
--#include "data/config/activity/Activity10017Config.config" once
|
--#include "data/config/activity/Activity10017Config.config" once
|
||||||
--#include "data/config/activity/Activity10019Config.config" once
|
--#include "data/config/activity/Activity10019Config.config" once
|
||||||
@@ -65,11 +64,6 @@
|
|||||||
--#include "data/config/OnlineTime/OnlineTimeReward.config" once --累计在线
|
--#include "data/config/OnlineTime/OnlineTimeReward.config" once --累计在线
|
||||||
--#include "data/config/OnlineTime/OnlineTimeconst.config" once --在线
|
--#include "data/config/OnlineTime/OnlineTimeconst.config" once --在线
|
||||||
|
|
||||||
--平台活动
|
|
||||||
--#include "data/config/YYPlatform/YYMemberConfig.config" once
|
|
||||||
--#include "data/config/YYPlatform/YYVIPConfig.config" once
|
|
||||||
--#include "data/config/YYPlatform/GameVIPConfig.config" once
|
|
||||||
|
|
||||||
-- 套装
|
-- 套装
|
||||||
--#include "data/config/SuitConfig.config" once
|
--#include "data/config/SuitConfig.config" once
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user