增加登录奖励,活跃奖励
This commit is contained in:
parent
5e2c3acafc
commit
5a5135270e
11
go.mod
11
go.mod
@ -5,7 +5,6 @@ go 1.24
|
||||
require (
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/oylshe1314/framework v1.0.21
|
||||
github.com/xuri/excelize/v2 v2.9.1
|
||||
go.mongodb.org/mongo-driver v1.17.4
|
||||
golang.org/x/crypto v0.39.0
|
||||
google.golang.org/protobuf v1.36.6
|
||||
@ -19,31 +18,23 @@ require (
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||
github.com/go-zookeeper/zk v1.0.4 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/klauspost/compress v1.16.7 // indirect
|
||||
github.com/kr/fs v0.1.0 // indirect
|
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect
|
||||
github.com/lestrrat-go/strftime v1.1.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/montanaflynn/stats v0.7.1 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pkg/sftp v1.13.7 // indirect
|
||||
github.com/redis/go-redis/v9 v9.7.0 // indirect
|
||||
github.com/richardlehane/mscfb v1.0.4 // indirect
|
||||
github.com/richardlehane/msoleps v1.0.4 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/tiendc/go-deepcopy v1.6.0 // indirect
|
||||
github.com/stretchr/testify v1.10.0 // indirect
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||
github.com/xdg-go/scram v1.1.2 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||
github.com/xuri/efp v0.0.1 // indirect
|
||||
github.com/xuri/nfp v0.0.1 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
|
||||
golang.org/x/net v0.40.0 // indirect
|
||||
golang.org/x/sync v0.15.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
golang.org/x/text v0.26.0 // indirect
|
||||
|
43
go.sum
43
go.sum
@ -15,8 +15,6 @@ github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpv
|
||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||
github.com/go-zookeeper/zk v1.0.4 h1:DPzxraQx7OrPyXq2phlGlNSIyWEsAox0RJmjTseMV6I=
|
||||
github.com/go-zookeeper/zk v1.0.4/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
@ -32,8 +30,6 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
|
||||
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
|
||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8=
|
||||
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is=
|
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4=
|
||||
@ -48,41 +44,23 @@ github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8
|
||||
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.13.7 h1:uv+I3nNJvlKZIQGSr8JVQLNHFU9YhhNpvC14Y6KgmSM=
|
||||
github.com/pkg/sftp v1.13.7/go.mod h1:KMKI0t3T6hfA+lTR/ssZdunHo+uwq7ghoN09/FSu3DY=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
|
||||
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
|
||||
github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM=
|
||||
github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
|
||||
github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
|
||||
github.com/richardlehane/msoleps v1.0.4 h1:WuESlvhX3gH2IHcd8UqyCuFY5yiq/GR/yqaSM/9/g00=
|
||||
github.com/richardlehane/msoleps v1.0.4/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tiendc/go-deepcopy v1.6.0 h1:0UtfV/imoCwlLxVsyfUd4hNHnB3drXsfle+wzSCA5Wo=
|
||||
github.com/tiendc/go-deepcopy v1.6.0/go.mod h1:toXoeQoUqXOOS/X4sKuiAoSk6elIdqc0pN7MTgOOo2I=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
||||
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
|
||||
github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
|
||||
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
|
||||
github.com/xuri/efp v0.0.1 h1:fws5Rv3myXyYni8uwj2qKjVaRP30PdjeYe2Y6FDsCL8=
|
||||
github.com/xuri/efp v0.0.1/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
|
||||
github.com/xuri/excelize/v2 v2.9.1 h1:VdSGk+rraGmgLHGFaGG9/9IWu1nj4ufjJ7uwMDtj8Qw=
|
||||
github.com/xuri/excelize/v2 v2.9.1/go.mod h1:x7L6pKz2dvo9ejrRuD8Lnl98z4JLt0TGAwjhW+EiP8s=
|
||||
github.com/xuri/nfp v0.0.1 h1:MDamSGatIvp8uOmDP8FnmjuQpu90NzdJxo7242ANR9Q=
|
||||
github.com/xuri/nfp v0.0.1/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
@ -90,23 +68,14 @@ go.mongodb.org/mongo-driver v1.17.4 h1:jUorfmVzljjr0FLzYQsGP8cgN/qzzxlY9Vh0C9KFX
|
||||
go.mongodb.org/mongo-driver v1.17.4/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
||||
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
||||
golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
|
||||
golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
||||
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@ -115,31 +84,19 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
|
||||
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
|
||||
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||
|
@ -249,6 +249,12 @@ enum MoneyType {
|
||||
|
||||
// 威望
|
||||
Prestige = 24;
|
||||
|
||||
//日活跃
|
||||
DailyActive = 101;
|
||||
|
||||
//周活跃值
|
||||
WeeklyActive = 102;
|
||||
}
|
||||
|
||||
enum HeroType {
|
||||
@ -357,6 +363,70 @@ enum MailStatus {
|
||||
Deleted = 3;
|
||||
}
|
||||
|
||||
enum TaskType {
|
||||
|
||||
//主线任务
|
||||
TaskMain = 0;
|
||||
|
||||
//主线章节任务
|
||||
TaskMainChapter = 1;
|
||||
|
||||
//每日任务
|
||||
TaskDaily = 2;
|
||||
|
||||
//每周任务
|
||||
TaskWeekly = 3;
|
||||
|
||||
//通行证任务
|
||||
TaskPass = 4;
|
||||
}
|
||||
|
||||
enum TaskArgs {
|
||||
TaskConditionNone = 0;
|
||||
|
||||
// 完成任务ID(参数2:任务ID,参数3:次数)
|
||||
TaskArgsId = 1;
|
||||
|
||||
//完成任务类型(参数2:任务类型,参数3:次数)
|
||||
TaskArgsType = 2;
|
||||
|
||||
// 签到(参数3:次)
|
||||
TaskSignIn = 3;
|
||||
|
||||
//上阵武装名将册激活(参数3:个)
|
||||
TaskHeroBook = 4;
|
||||
|
||||
//上阵英雄等级(参数2:等级,参数3:个)
|
||||
TaskHeroLevel = 5;
|
||||
|
||||
//英雄突破(参数2:等级,参数3:个)
|
||||
TaskHeroBreak = 6;
|
||||
|
||||
//佩戴装备等级(参数2:等级,参数3:个)
|
||||
TaskEquipLevel = 7;
|
||||
|
||||
//佩戴装备精炼(参数2:等级,参数3:个)
|
||||
TaskEquipRefine = 8;
|
||||
|
||||
//佩戴宝物等级(参数2:等级,参数3:个)
|
||||
TaskTreasureLevel = 9;
|
||||
|
||||
//佩戴宝物精炼(参数2:等级,参数3:个)
|
||||
TaskTreasureRefine = 10;
|
||||
|
||||
//通关副本章节(参数2:副本类型,参数3:章节)
|
||||
TaskCopyChapter = 11;
|
||||
|
||||
//通关副本关卡(参数2:副本类型,参数3:关卡)
|
||||
TaskCopyLevel = 12;
|
||||
}
|
||||
|
||||
enum DaysModule {
|
||||
NaturalDays = 0;
|
||||
|
||||
PeriodDays = 1;
|
||||
}
|
||||
|
||||
enum AttrType {
|
||||
AttrTypeNone = 0; //无属性
|
||||
Attack = 1; //攻击
|
||||
|
75
proto/idl/mod_reward.proto
Normal file
75
proto/idl/mod_reward.proto
Normal file
@ -0,0 +1,75 @@
|
||||
syntax = "proto3";
|
||||
package Pb;
|
||||
option go_package = "pb/";
|
||||
|
||||
import "enums.proto";
|
||||
import "mod_item.proto";
|
||||
|
||||
// ModId.ModuleReward: 12000
|
||||
// 角色模块消息定义
|
||||
// 如果定义的消息内没有字段或者消息被注释掉了,说明该请求不需要参数,发送消息时仅发送包头即可,包体可为空, 返回的消息亦是如此。
|
||||
|
||||
message RewardStatus {
|
||||
uint32 Id = 2;
|
||||
AbleStatus Status = 3; //奖励状态,见AbleStatus
|
||||
}
|
||||
|
||||
message RewardActive {
|
||||
MoneyType MoneyType = 1; //货币类型
|
||||
uint32 ActiveValue = 2;
|
||||
repeated RewardStatus StatusList = 3;
|
||||
}
|
||||
|
||||
// ModId.ModRewardActiveList = 12001;
|
||||
// 活动奖励列表返回
|
||||
message RewardActiveListAck {
|
||||
repeated RewardActive ActiveList = 1;
|
||||
}
|
||||
|
||||
// ModId.ModRewardActiveChange = 12002;
|
||||
// 活动奖励变更返回
|
||||
message RewardActiveChangeAck {
|
||||
RewardActive RewardActive = 1;
|
||||
}
|
||||
|
||||
// ModId.ModRewardActiveReceive = 12003;
|
||||
// 活动奖励领取请求
|
||||
message RewardActiveReceiveReq {
|
||||
uint32 Id = 1;
|
||||
}
|
||||
|
||||
// ModId.ModRewardActiveReceive = 12003;
|
||||
// 活动奖励领取返回
|
||||
message RewardActiveReceiveAck {
|
||||
repeated Item ItemList = 1;
|
||||
}
|
||||
|
||||
message RewardLogin {
|
||||
uint32 SeriesId = 1;
|
||||
uint32 LoginDays = 2;
|
||||
repeated RewardStatus StatusList = 3;
|
||||
}
|
||||
|
||||
// ModId.ModRewardLoginList = 12011;
|
||||
// 登录奖励列表返回
|
||||
message RewardLoginListAck {
|
||||
repeated RewardLogin LoginList = 1;
|
||||
}
|
||||
|
||||
// ModId.ModRewardLoginChange = 12012;
|
||||
// 登录奖励变更返回
|
||||
message RewardLoginChangeAck {
|
||||
RewardLogin RewardLogin = 1;
|
||||
}
|
||||
|
||||
// ModId.ModRewardLoginReceive = 12013;
|
||||
// 登录奖励领取请求
|
||||
message RewardLoginReceiveReq {
|
||||
uint32 Id = 1;
|
||||
}
|
||||
|
||||
// ModId.ModRewardLoginReceive = 12013;
|
||||
// 登录奖励领取返回
|
||||
message RewardLoginReceiveAck {
|
||||
repeated Item ItemList = 1;
|
||||
}
|
46
proto/idl/mod_task.proto
Normal file
46
proto/idl/mod_task.proto
Normal file
@ -0,0 +1,46 @@
|
||||
syntax = "proto3";
|
||||
package Pb;
|
||||
option go_package = "pb/";
|
||||
|
||||
import "enums.proto";
|
||||
import "mod_item.proto";
|
||||
|
||||
// ModId.ModuleTask = 9000;
|
||||
// 任务模块消息定义
|
||||
// 如果定义的消息内没有字段或者消息被注释掉了,说明该请求不需要参数,发送消息时仅发送包头即可,包体可为空, 返回的消息亦是如此。
|
||||
|
||||
message Task {
|
||||
uint32 Id = 1; //任务ID(配置表ID)
|
||||
AbleStatus Status = 3;//任务状态:0.不可提交(未完成),1.可提交(已完成),2.已提交(奖励已领取)
|
||||
repeated uint32 Process = 2; //任务进度,元素个数与条件个数一致
|
||||
}
|
||||
|
||||
//MsgId.ModTaskList = 9001;
|
||||
//任务列表返回
|
||||
message MsgTaskListAck {
|
||||
repeated Task TaskList = 1;
|
||||
}
|
||||
|
||||
message TaskChange {
|
||||
ChangeType ChangeType = 1;
|
||||
Task task = 2;
|
||||
}
|
||||
|
||||
//MsgId.ModTaskChange = 9002;
|
||||
//任务变更列表返回
|
||||
message TaskChangeListAck {
|
||||
repeated TaskChange ChangeList = 1;
|
||||
}
|
||||
|
||||
//MsgId.ModTaskCommit = 9003;
|
||||
//任务提交请求
|
||||
message TaskCommitReq {
|
||||
uint32 Id = 1; //任务ID(配置表ID)
|
||||
}
|
||||
|
||||
//MsgId.ModTaskCommit = 9003;
|
||||
//任务提交返回
|
||||
message TaskCommitAck {
|
||||
uint32 Id = 1; //任务ID(配置表ID)
|
||||
repeated Item ItemList = 2; //物品列表
|
||||
}
|
@ -42,8 +42,8 @@ enum ModId{
|
||||
// 商店模块
|
||||
ModuleStore = 110000;
|
||||
|
||||
// 活动模块
|
||||
ModuleActivity = 12000;
|
||||
// 奖励模块
|
||||
ModuleReward = 12000;
|
||||
}
|
||||
|
||||
// 公共模块消息ID
|
||||
@ -276,4 +276,34 @@ enum MsgId {
|
||||
|
||||
// 邮件删除
|
||||
ModMailDeleteAll = 8008;
|
||||
|
||||
//-------------------------------------------------------------------------- 任务模块 --------------------------------------------------------------------------
|
||||
// 任务列表
|
||||
ModTaskList = 9001;
|
||||
|
||||
// 任务变更
|
||||
ModTaskChange = 9002;
|
||||
|
||||
// 任务提交
|
||||
ModTaskCommit = 9003;
|
||||
|
||||
//-------------------------------------------------------------------------- 奖励模块 --------------------------------------------------------------------------
|
||||
// 任务列表
|
||||
// 活动奖励列表
|
||||
ModRewardActiveList = 12001;
|
||||
|
||||
// 活动奖励变更
|
||||
ModRewardActiveChange = 12002;
|
||||
|
||||
// 活动奖励领取
|
||||
ModRewardActiveReceive = 12003;
|
||||
|
||||
// 登录奖励列表
|
||||
ModRewardLoginList = 12011;
|
||||
|
||||
// 登录奖励变更
|
||||
ModRewardLoginChange = 12012;
|
||||
|
||||
// 登录奖励领取
|
||||
ModRewardLoginReceive = 12013;
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
49
servers/game/data/reward_active.go
Normal file
49
servers/game/data/reward_active.go
Normal file
@ -0,0 +1,49 @@
|
||||
package data
|
||||
|
||||
import json "github.com/json-iterator/go"
|
||||
|
||||
type RewardActive struct {
|
||||
Id int `json:"id"`
|
||||
MoneyType int `json:"money_type"`
|
||||
ActiveValue int `json:"active_value"`
|
||||
ItemIds []int `json:"item_ids"`
|
||||
ItemNums []int `json:"item_nums"`
|
||||
}
|
||||
|
||||
type RewardActiveTable struct {
|
||||
l []*RewardActive
|
||||
m1 map[int]*RewardActive
|
||||
m2 map[int][]*RewardActive
|
||||
}
|
||||
|
||||
func (this *RewardActiveTable) load(buf []byte) error {
|
||||
var err = json.Unmarshal(buf, &this.l)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
this.m1 = make(map[int]*RewardActive)
|
||||
this.m2 = make(map[int][]*RewardActive)
|
||||
for i := range this.l {
|
||||
this.m1[this.l[i].Id] = this.l[i]
|
||||
this.m2[this.l[i].MoneyType] = append(this.m2[this.l[i].Id], this.l[i])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *RewardActiveTable) List() []*RewardActive {
|
||||
return this.l
|
||||
}
|
||||
|
||||
//func (this *RewardActiveTable) Get(i int) *RewardActive {
|
||||
// return this.l[i]
|
||||
//}
|
||||
|
||||
func (this *RewardActiveTable) Find1(id int) *RewardActive {
|
||||
return this.m1[id]
|
||||
}
|
||||
|
||||
func (this *RewardActiveTable) Find2(montyType int) []*RewardActive {
|
||||
return this.m2[montyType]
|
||||
}
|
69
servers/game/data/reward_daily.go
Normal file
69
servers/game/data/reward_daily.go
Normal file
@ -0,0 +1,69 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
json "github.com/json-iterator/go"
|
||||
"github.com/oylshe1314/framework/util"
|
||||
"time"
|
||||
)
|
||||
|
||||
type RewardDaily struct {
|
||||
Id int `json:"id"`
|
||||
SeriesId int `json:"series_id"`
|
||||
BeginTime string `json:"begin_time"`
|
||||
BeginTimeRaw int64 `json:"-"`
|
||||
EndTime string `json:"end_time"`
|
||||
EndTimeRaw int64 `json:"-"`
|
||||
ItemIds []int `json:"item_ids"`
|
||||
ItemNums []int `json:"item_nums"`
|
||||
AllowNums int `json:"allow_nums"`
|
||||
}
|
||||
|
||||
type RewardDailyTable struct {
|
||||
l []*RewardDaily
|
||||
m1 map[int]*RewardDaily
|
||||
m2 map[int][]*RewardDaily
|
||||
}
|
||||
|
||||
func (this *RewardDailyTable) load(buf []byte) error {
|
||||
var err = json.Unmarshal(buf, &this.l)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
this.m1 = make(map[int]*RewardDaily)
|
||||
this.m2 = make(map[int][]*RewardDaily)
|
||||
for i := range this.l {
|
||||
if this.l[i].BeginTime != "" {
|
||||
this.l[i].BeginTimeRaw, err = util.ParseUnix(time.TimeOnly, this.l[i].BeginTime)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if this.l[i].EndTime != "" {
|
||||
this.l[i].EndTimeRaw, err = util.ParseUnix(time.TimeOnly, this.l[i].EndTime)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
this.m1[this.l[i].Id] = this.l[i]
|
||||
this.m2[this.l[i].SeriesId] = append(this.m2[this.l[i].Id], this.l[i])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *RewardDailyTable) List() []*RewardDaily {
|
||||
return this.l
|
||||
}
|
||||
|
||||
//func (this *RewardDailyTable) Get(i int) *RewardDaily {
|
||||
// return this.l[i]
|
||||
//}
|
||||
|
||||
func (this *RewardDailyTable) Find1(id int) *RewardDaily {
|
||||
return this.m1[id]
|
||||
}
|
||||
|
||||
func (this *RewardDailyTable) Find2(seriesId int) []*RewardDaily {
|
||||
return this.m2[seriesId]
|
||||
}
|
69
servers/game/data/reward_login.go
Normal file
69
servers/game/data/reward_login.go
Normal file
@ -0,0 +1,69 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
json "github.com/json-iterator/go"
|
||||
"github.com/oylshe1314/framework/util"
|
||||
)
|
||||
|
||||
type RewardLogin struct {
|
||||
Id int `json:"id"`
|
||||
SeriesId int `json:"series_id"`
|
||||
Days int `json:"days"`
|
||||
DaysModule int `json:"days_module"`
|
||||
ItemIds []interface{} `json:"item_ids"`
|
||||
ItemNums []interface{} `json:"item_nums"`
|
||||
VipLevel int `json:"vip_level"`
|
||||
VipMultiple int `json:"vip_multiple"`
|
||||
}
|
||||
|
||||
type RewardLoginTable struct {
|
||||
l []*RewardLogin
|
||||
m1 map[int]*RewardLogin
|
||||
m2 map[int][]*RewardLogin
|
||||
m3 map[int]int
|
||||
}
|
||||
|
||||
func (this *RewardLoginTable) load(buf []byte) error {
|
||||
var err = json.Unmarshal(buf, &this.l)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
this.m1 = make(map[int]*RewardLogin)
|
||||
this.m2 = make(map[int][]*RewardLogin)
|
||||
this.m3 = make(map[int]int)
|
||||
for i := range this.l {
|
||||
this.m1[this.l[i].Id] = this.l[i]
|
||||
this.m2[this.l[i].SeriesId] = append(this.m2[this.l[i].Id], this.l[i])
|
||||
if this.l[i].Days > this.m3[this.l[i].SeriesId] {
|
||||
this.m3[this.l[i].SeriesId] = this.l[i].Days
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *RewardLoginTable) List() []*RewardLogin {
|
||||
return this.l
|
||||
}
|
||||
|
||||
//func (this *RewardLoginTable) Get(i int) *RewardLogin {
|
||||
// return this.l[i]
|
||||
//}
|
||||
|
||||
func (this *RewardLoginTable) Find1(id int) *RewardLogin {
|
||||
return this.m1[id]
|
||||
}
|
||||
|
||||
func (this *RewardLoginTable) Find2(seriesId int) []*RewardLogin {
|
||||
return this.m2[seriesId]
|
||||
}
|
||||
|
||||
func (this *RewardLoginTable) SeriesIds() []int {
|
||||
return util.MapKeys(this.m3)
|
||||
}
|
||||
|
||||
func (this *RewardLoginTable) MaxDays(seriesId int) (days int, ok bool) {
|
||||
days, ok = this.m3[seriesId]
|
||||
return
|
||||
}
|
@ -33,10 +33,14 @@ type Tables struct {
|
||||
FunctionOpen FunctionOpenTable
|
||||
Item ItemTable
|
||||
Monster MonsterTable
|
||||
RewardActive RewardActiveTable
|
||||
RewardDaily RewardDailyTable
|
||||
RewardLogin RewardLoginTable
|
||||
Scene SceneTable
|
||||
ServerConfig ServerConfigTable
|
||||
Skill SkillTable
|
||||
SkillBuff SkillBuffTable
|
||||
Task TaskTable
|
||||
Treasure TreasureTable
|
||||
TreasureLevel TreasureLevelTable
|
||||
TreasureRefine TreasureRefineTable
|
||||
|
56
servers/game/data/task.go
Normal file
56
servers/game/data/task.go
Normal file
@ -0,0 +1,56 @@
|
||||
package data
|
||||
|
||||
import json "github.com/json-iterator/go"
|
||||
|
||||
type Task struct {
|
||||
Id int `json:"id"`
|
||||
Type int `json:"type"`
|
||||
RearId int `json:"rear_id"`
|
||||
Sort int `json:"sort"`
|
||||
ActiveValue int `json:"active_value"`
|
||||
ExpMultiple int `json:"exp_multiple"`
|
||||
CoinMultiple int `json:"coin_multiple"`
|
||||
ItemIds []int `json:"item_ids"`
|
||||
ItemNums []int `json:"item_nums"`
|
||||
TaskArgs1 []int `json:"task_args1"`
|
||||
TaskArgs2 []int `json:"task_args2"`
|
||||
TaskArgs3 []int `json:"task_args3"`
|
||||
}
|
||||
|
||||
type TaskTable struct {
|
||||
l []*Task
|
||||
m1 map[int]*Task
|
||||
m2 map[int][]*Task
|
||||
}
|
||||
|
||||
func (this *TaskTable) load(buf []byte) error {
|
||||
var err = json.Unmarshal(buf, &this.l)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
this.m1 = make(map[int]*Task)
|
||||
this.m2 = make(map[int][]*Task)
|
||||
for i := range this.l {
|
||||
this.m1[this.l[i].Id] = this.l[i]
|
||||
this.m2[this.l[i].Type] = append(this.m2[this.l[i].Id], this.l[i])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *TaskTable) List() []*Task {
|
||||
return this.l
|
||||
}
|
||||
|
||||
//func (this *TaskTable) Get(i int) *Task {
|
||||
// return this.l[i]
|
||||
//}
|
||||
|
||||
func (this *TaskTable) Find1(id int) *Task {
|
||||
return this.m1[id]
|
||||
}
|
||||
|
||||
func (this *TaskTable) Find2(tipe int) []*Task {
|
||||
return this.m2[tipe]
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package logic
|
||||
|
||||
import "github.com/oylshe1314/framework/util"
|
||||
import (
|
||||
"github.com/oylshe1314/framework/util"
|
||||
)
|
||||
|
||||
const GameDailyResetHour int64 = 0
|
||||
const GameDailyResetTime int64 = 3600 * GameDailyResetHour
|
||||
@ -27,6 +29,8 @@ func NewGameTime(timestamp int64) *GameTime {
|
||||
return gt
|
||||
}
|
||||
|
||||
util.Unix()
|
||||
|
||||
gt.Days, gt.Weeks, gt.Months, gt.Years = absDate(gt.Timestamp)
|
||||
return gt
|
||||
}
|
||||
|
@ -252,19 +252,11 @@ func (this *PlayerManager) NewPlayer() *Player {
|
||||
//MonthlyCard: map[uint32]*PlayerMonthlyCard{},
|
||||
//Planet: map[uint32]*PlayerPlanet{},
|
||||
//RawStone: map[uint32]*PlayerRawStone{},
|
||||
//RigCharacter: map[uint32]*PlayerRigCharacter{},
|
||||
//RigComponent: map[uint32]*PlayerRigComponent{},
|
||||
//RigCore: map[uint32]*PlayerRigCore{},
|
||||
//RigEquip: map[uint32]*PlayerRigEquip{},
|
||||
//RigPendant: map[uint32]*PlayerRigPendant{},
|
||||
//RigRemains: map[uint32]*PlayerRigRemains{},
|
||||
//RigSmelter: map[uint32]*PlayerRigSmelter{},
|
||||
//RigTrammels: map[uint32]*PlayerRigTrammels{},
|
||||
//RigWarship: map[uint32]*PlayerRigWarship{},
|
||||
RewardActive: map[uint32]*PlayerRewardActive{},
|
||||
RewardLogin: map[uint32]*PlayerRewardLogin{},
|
||||
//RoleTalent: map[uint32]*PlayerRoleTalent{},
|
||||
//StorePool: map[uint32]*PlayerStorePool{},
|
||||
//Task: map[uint32]*PlayerTask{},
|
||||
//TaskActive: map[uint32]*PlayerTaskActive{},
|
||||
Task: map[uint32]*PlayerTask{},
|
||||
Treasure: map[uint64]*PlayerTreasure{},
|
||||
}
|
||||
}
|
||||
|
@ -79,19 +79,11 @@ type Player struct {
|
||||
//MonthlyCard map[uint32]*PlayerMonthlyCard `bson:"monthly_card"`
|
||||
//Planet map[uint32]*PlayerPlanet `bson:"planet"`
|
||||
//RawStone map[uint32]*PlayerRawStone `bson:"raw_stone"`
|
||||
//RigCharacter map[uint32]*PlayerRigCharacter `bson:"rig_character"`
|
||||
//RigComponent map[uint32]*PlayerRigComponent `bson:"rig_component"`
|
||||
//RigCore map[uint32]*PlayerRigCore `bson:"rig_core"`
|
||||
//RigEquip map[uint32]*PlayerRigEquip `bson:"rig_equip"`
|
||||
//RigPendant map[uint32]*PlayerRigPendant `bson:"rig_pendant"`
|
||||
//RigRemains map[uint32]*PlayerRigRemains `bson:"rig_remains"`
|
||||
//RigSmelter map[uint32]*PlayerRigSmelter `bson:"rig_smelter"`
|
||||
//RigTrammels map[uint32]*PlayerRigTrammels `bson:"rig_trammels"`
|
||||
//RigWarship map[uint32]*PlayerRigWarship `bson:"rig_warship"`
|
||||
RewardActive map[uint32]*PlayerRewardActive `bson:"reward_active"`
|
||||
RewardLogin map[uint32]*PlayerRewardLogin `bson:"reward_login"`
|
||||
//RoleTalent map[uint32]*PlayerRoleTalent `bson:"role_talent"`
|
||||
//StorePool map[uint32]*PlayerStorePool `bson:"store_pool"`
|
||||
//Task map[uint32]*PlayerTask `bson:"task"`
|
||||
//TaskActive map[uint32]*PlayerTaskActive `bson:"task_active"`
|
||||
Task map[uint32]*PlayerTask `bson:"task"`
|
||||
Treasure map[uint64]*PlayerTreasure `bson:"treasure"`
|
||||
|
||||
//Temporary
|
||||
|
@ -96,42 +96,14 @@ func (this *Player) checkCorrectModules(cur *GameTime) {
|
||||
// this.RawStone = make(map[uint32]*PlayerRawStone)
|
||||
// this.SaveField("raw_stone", this.RawStone)
|
||||
//}
|
||||
//if this.RigCharacter == nil {
|
||||
// this.RigCharacter = make(map[uint32]*PlayerRigCharacter)
|
||||
// this.SaveField("rig_character", this.RigCharacter)
|
||||
//}
|
||||
//if this.RigComponent == nil {
|
||||
// this.RigComponent = make(map[uint32]*PlayerRigComponent)
|
||||
// this.SaveField("rig_component", this.RigComponent)
|
||||
//}
|
||||
//if this.RigCore == nil {
|
||||
// this.RigCore = make(map[uint32]*PlayerRigCore)
|
||||
// this.SaveField("rig_core", this.RigCore)
|
||||
//}
|
||||
//if this.RigEquip == nil {
|
||||
// this.RigEquip = make(map[uint32]*PlayerRigEquip)
|
||||
// this.SaveField("rig_equip", this.RigEquip)
|
||||
//}
|
||||
//if this.RigPendant == nil {
|
||||
// this.RigPendant = make(map[uint32]*PlayerRigPendant)
|
||||
// this.SaveField("rig_pendant", this.RigPendant)
|
||||
//}
|
||||
//if this.RigRemains == nil {
|
||||
// this.RigRemains = make(map[uint32]*PlayerRigRemains)
|
||||
// this.SaveField("rig_remains", this.RigRemains)
|
||||
//}
|
||||
//if this.RigSmelter == nil {
|
||||
// this.RigSmelter = make(map[uint32]*PlayerRigSmelter)
|
||||
// this.SaveField("rig_smelter", this.RigSmelter)
|
||||
//}
|
||||
//if this.RigTrammels == nil {
|
||||
// this.RigTrammels = make(map[uint32]*PlayerRigTrammels)
|
||||
// this.SaveField("rig_trammels", this.RigTrammels)
|
||||
//}
|
||||
//if this.RigWarship == nil {
|
||||
// this.RigWarship = make(map[uint32]*PlayerRigWarship)
|
||||
// this.SaveField("rig_warship", this.RigWarship)
|
||||
//}
|
||||
if this.RewardActive == nil {
|
||||
this.RewardActive = make(map[uint32]*PlayerRewardActive)
|
||||
this.SaveField("reward_active", this.RewardActive)
|
||||
}
|
||||
if this.RewardLogin == nil {
|
||||
this.RewardLogin = make(map[uint32]*PlayerRewardLogin)
|
||||
this.SaveField("reward_active", this.RewardLogin)
|
||||
}
|
||||
//if this.RoleTalent == nil {
|
||||
// this.RoleTalent = make(map[uint32]*PlayerRoleTalent)
|
||||
// this.SaveField("role_talent", this.RoleTalent)
|
||||
@ -144,10 +116,6 @@ func (this *Player) checkCorrectModules(cur *GameTime) {
|
||||
// this.Task = make(map[uint32]*PlayerTask)
|
||||
// this.SaveField("task", this.Task)
|
||||
//}
|
||||
//if this.TaskActive == nil {
|
||||
// this.TaskActive = make(map[uint32]*PlayerTaskActive)
|
||||
// this.SaveField("task_active", this.TaskActive)
|
||||
//}
|
||||
if this.Treasure == nil {
|
||||
this.Treasure = make(map[uint64]*PlayerTreasure)
|
||||
this.SaveField("achievement", this.Treasure)
|
||||
|
@ -47,7 +47,7 @@ func (this *Player) checkRefresh(login bool, pre, cur *GameTime) {
|
||||
this.checkPerSecond(login, pre, cur)
|
||||
if this.checkAcrossTime(login, pre, cur,
|
||||
this.checkLoginDays,
|
||||
//this.checkTaskRefresh,
|
||||
this.checkTaskRefresh,
|
||||
//this.checkMonthlyCard,
|
||||
//this.checkIdleBattle,
|
||||
//this.checkCopyRefresh,
|
||||
@ -71,29 +71,29 @@ func (this *Player) checkLoginDays(login bool, pre, cur *GameTime) bool {
|
||||
|
||||
this.ChangeProperty(util.NewPair(pb.RolePropertyType_LoginDays, int64(this.LoginDays+1)))
|
||||
|
||||
//this.checkLoginReward()
|
||||
//this.CheckRewardLogin()
|
||||
//this.CheckTask(proto.TaskSection1LoginDays, 0, 1)
|
||||
//this.CheckAchievement(proto.AchievementTypeLoginDays, 0, 1)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
//func (this *Player) checkTaskRefresh(login bool, pre, cur *GameTime) (changed bool) {
|
||||
// if login {
|
||||
// changed = this.checkTaskDeprecated() || changed
|
||||
// }
|
||||
//
|
||||
// if pre.Days != cur.Days {
|
||||
// changed = this.ActivationReset() || changed
|
||||
// changed = this.checkTaskReset(proto.TaskTypeDaily) || changed
|
||||
// }
|
||||
//
|
||||
// if pre.Weeks != cur.Weeks {
|
||||
// changed = this.checkTaskReset(proto.TaskTypeWeekly) || changed
|
||||
// }
|
||||
//
|
||||
// return changed
|
||||
//}
|
||||
func (this *Player) checkTaskRefresh(login bool, pre, cur *GameTime) (changed bool) {
|
||||
if login {
|
||||
changed = this.checkTaskDeprecated()
|
||||
}
|
||||
|
||||
if pre.Days != cur.Days {
|
||||
changed = this.MoneyActiveValueReset(pb.MoneyType_DailyActive) || changed
|
||||
changed = this.checkTaskReset(pb.TaskType_TaskDaily) || changed
|
||||
}
|
||||
|
||||
if pre.Weeks != cur.Weeks {
|
||||
changed = this.checkTaskReset(pb.TaskType_TaskWeekly) || changed
|
||||
}
|
||||
|
||||
return changed
|
||||
}
|
||||
|
||||
//func (this *Player) checkMonthlyCard(login bool, pre, cur *GameTime) (changed bool) {
|
||||
// if cur.Days == pre.Days {
|
||||
|
@ -1,51 +0,0 @@
|
||||
package logic
|
||||
|
||||
//type PlayerLoginReward struct {
|
||||
// StatusList []uint32 `bson:"status_list"`
|
||||
//}
|
||||
//
|
||||
//func (this *Player) checkLoginReward() (changed bool) {
|
||||
// var days = this.manager.tables.LoginRewardExtend.Days()
|
||||
// if days == 0 {
|
||||
// return false
|
||||
// }
|
||||
//
|
||||
// if this.LoginReward == nil || len(this.LoginReward.StatusList) != days {
|
||||
// this.LoginReward = &PlayerLoginReward{StatusList: make([]uint32, days)}
|
||||
// this.LoginReward.StatusList[0] = uint32(proto.RewardStatusCanGet)
|
||||
// this.SaveField("login_reward", this.LoginReward)
|
||||
//
|
||||
// _ = this.Send(proto.ModIdActivity, proto.MsgIdLoginRewardInfo, this.BuildMsgLoginRewardInfoAck())
|
||||
// return true
|
||||
// } else {
|
||||
// var index = int(this.Role.LoginDays-1) % days
|
||||
// if index == 0 {
|
||||
// for i := range this.LoginReward.StatusList {
|
||||
// this.LoginReward.StatusList[i] = uint32(proto.RewardStatusUnable)
|
||||
// }
|
||||
//
|
||||
// this.LoginReward.StatusList[0] = uint32(proto.RewardStatusCanGet)
|
||||
// this.SaveField("login_reward.status_list", this.LoginReward.StatusList)
|
||||
//
|
||||
// _ = this.Send(proto.ModIdActivity, proto.MsgIdLoginRewardInfo, this.BuildMsgLoginRewardInfoAck())
|
||||
// return true
|
||||
// } else {
|
||||
// if proto.RewardStatus(this.LoginReward.StatusList[index]) == proto.RewardStatusUnable {
|
||||
// this.LoginReward.StatusList[index] = uint32(proto.RewardStatusCanGet)
|
||||
// this.SaveArray("login_reward.status_list", index, this.LoginReward.StatusList[index])
|
||||
//
|
||||
// _ = this.Send(proto.ModIdActivity, proto.MsgIdLoginRewardInfo, this.BuildMsgLoginRewardInfoAck())
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return false
|
||||
//}
|
||||
//
|
||||
//func (this *Player) BuildMsgLoginRewardInfoAck() *proto.MsgLoginRewardInfoAck {
|
||||
// if this.LoginReward == nil {
|
||||
// return &proto.MsgLoginRewardInfoAck{}
|
||||
// } else {
|
||||
// return &proto.MsgLoginRewardInfoAck{LoginDays: this.Role.LoginDays, StatusList: this.LoginReward.StatusList}
|
||||
// }
|
||||
//}
|
@ -24,12 +24,22 @@ func (this *Player) GetMoney(moneyType pb.MoneyType) *PlayerMoney {
|
||||
return money
|
||||
}
|
||||
|
||||
func (this *Player) GetMoneyValue(moneyType pb.MoneyType) uint32 {
|
||||
var money = this.Money[uint32(moneyType)]
|
||||
if money == nil {
|
||||
return 0
|
||||
}
|
||||
return money.Value
|
||||
}
|
||||
|
||||
func (this *Player) AddMoney(moneyType pb.MoneyType, value uint32, logType LogType) bool {
|
||||
switch moneyType {
|
||||
case pb.MoneyType_Exp:
|
||||
this.addExp(value, logType)
|
||||
case pb.MoneyType_Power:
|
||||
this.addPower(value, logType)
|
||||
case pb.MoneyType_DailyActive:
|
||||
this.addActiveValue(moneyType, value, logType)
|
||||
default:
|
||||
this.addMoney(moneyType, value, logType)
|
||||
}
|
||||
@ -187,50 +197,33 @@ func (this *Player) reducePower(value uint32, logType LogType) {
|
||||
//}
|
||||
}
|
||||
|
||||
//func (this *Player) updateActiveReward(moneyActivation *PlayerMoney) {
|
||||
// for _, active := range this.TaskActive {
|
||||
// if proto.RewardStatus(active.Status) == proto.RewardStatusUnable {
|
||||
// var activeTable = this.manager.tables.Active.Get(int(active.Id))
|
||||
// if activeTable == nil {
|
||||
// this.WipeModel(active)
|
||||
// delete(this.TaskActive, active.Id)
|
||||
// } else {
|
||||
// if moneyActivation.Value >= uint32(activeTable.ActiveValue) {
|
||||
// active.Status = uint32(proto.RewardStatusCanGet)
|
||||
// this.SaveModel(active)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//func (this *Player) resetActiveReward() {
|
||||
// var activeTables = this.manager.tables.Active.List()
|
||||
//
|
||||
// this.TaskActive = map[uint32]*PlayerTaskActive{}
|
||||
// for _, activeTable := range activeTables {
|
||||
// var active = &PlayerTaskActive{Id: uint32(activeTable.Id), Status: uint32(proto.RewardStatusUnable)}
|
||||
// this.TaskActive[active.Id] = active
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//func (this *Player) ActivationReset() bool {
|
||||
// var money = this.GetMoney(proto.MoneyTypeActivation)
|
||||
// if money.Value == 0 {
|
||||
// return false
|
||||
// }
|
||||
//
|
||||
// money.Value = 0
|
||||
// this.SaveModel(money)
|
||||
//
|
||||
// _ = this.Send(proto.ModIdRole, proto.MsgIdRoleMoneyChange, &proto.MsgRoleMoneyListAck{List: []*proto.RoleMoney{money.BuildMsgMoney()}})
|
||||
//
|
||||
// this.resetActiveReward()
|
||||
//
|
||||
// _ = this.Send(proto.ModIdTask, proto.MsgIdActiveInfo, this.BuildMsgActiveInfoAck())
|
||||
//
|
||||
// return true
|
||||
//}
|
||||
func (this *Player) addActiveValue(moneyType pb.MoneyType, value uint32, logType LogType) {
|
||||
var money = this.GetMoney(pb.MoneyType_Power)
|
||||
money.Value += value
|
||||
this.SaveModel(money)
|
||||
|
||||
_ = this.Send(pb.ModId_ModuleRole, pb.MsgId_ModRoleMoneyChange, &pb.MoneyListAck{MoneyList: []*pb.Money{money.BuildMsgMoney()}})
|
||||
|
||||
this.checkRewardActive(money)
|
||||
}
|
||||
|
||||
func (this *Player) MoneyActiveValueReset(moneyType pb.MoneyType) bool {
|
||||
var money = this.GetMoney(moneyType)
|
||||
if money.Value == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
money.Value = 0
|
||||
this.SaveModel(money)
|
||||
|
||||
_ = this.Send(pb.ModId_ModuleRole, pb.MsgId_ModRoleMoneyChange, &pb.MoneyListAck{MoneyList: []*pb.Money{money.BuildMsgMoney()}})
|
||||
|
||||
var rewardActive = this.newRewardActive(money)
|
||||
|
||||
_ = this.Send(pb.ModId_ModuleReward, pb.MsgId_ModRewardActiveChange, &pb.RewardActiveChangeAck{RewardActive: rewardActive.BuildMsgRewardActive()})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *Player) BuildMsgMoneyListAck() *pb.MoneyListAck {
|
||||
var list []*pb.Money
|
||||
|
76
servers/game/logic/player_reward_active.go
Normal file
76
servers/game/logic/player_reward_active.go
Normal file
@ -0,0 +1,76 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"ecs/proto/pb"
|
||||
"github.com/oylshe1314/framework/util"
|
||||
)
|
||||
|
||||
type PlayerRewardActive struct {
|
||||
MoneyType uint32 `bson:"money_type" key:"1"`
|
||||
RewardStatus [][2]uint32 `bson:"reward_status"`
|
||||
}
|
||||
|
||||
func (this *PlayerRewardActive) BuildMsgRewardActive() *pb.RewardActive {
|
||||
var msg = &pb.RewardActive{MoneyType: pb.MoneyType(this.MoneyType)}
|
||||
for _, status := range this.RewardStatus {
|
||||
msg.StatusList = append(msg.StatusList, &pb.RewardStatus{Id: status[0], Status: pb.AbleStatus(status[1])})
|
||||
}
|
||||
return msg
|
||||
}
|
||||
|
||||
func (this *Player) checkRewardActive(money *PlayerMoney) bool {
|
||||
var changed = false
|
||||
var rewardActive = this.RewardActive[money.Type]
|
||||
if rewardActive == nil {
|
||||
rewardActive = this.newRewardActive(money)
|
||||
if rewardActive == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
this.RewardActive[rewardActive.MoneyType] = rewardActive
|
||||
changed = true
|
||||
} else {
|
||||
for i := range rewardActive.RewardStatus {
|
||||
if pb.AbleStatus(rewardActive.RewardStatus[i][1]) == pb.AbleStatus_Unable {
|
||||
var activeTable = this.manager.tables.RewardActive.Find1(int(rewardActive.RewardStatus[i][0]))
|
||||
if activeTable != nil {
|
||||
if money.Value >= uint32(activeTable.ActiveValue) {
|
||||
rewardActive.RewardStatus[i][1] = uint32(pb.AbleStatus_Able)
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if changed {
|
||||
this.SaveModel(rewardActive)
|
||||
_ = this.Send(pb.ModId_ModuleReward, pb.MsgId_ModRewardActiveChange, &pb.RewardActiveChangeAck{RewardActive: rewardActive.BuildMsgRewardActive()})
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
func (this *Player) newRewardActive(money *PlayerMoney) *PlayerRewardActive {
|
||||
var rewardTables = this.manager.tables.RewardActive.Find2(int(money.Type))
|
||||
if len(rewardTables) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var rewardActive = &PlayerRewardActive{MoneyType: money.Type, RewardStatus: make([][2]uint32, len(rewardTables))}
|
||||
for i, rewardTable := range rewardTables {
|
||||
rewardActive.RewardStatus[i] = [2]uint32{
|
||||
uint32(rewardTable.Id),
|
||||
util.If(money.Value >= uint32(rewardTable.ActiveValue), uint32(pb.AbleStatus_Able), uint32(pb.AbleStatus_Unable)),
|
||||
}
|
||||
}
|
||||
|
||||
return rewardActive
|
||||
}
|
||||
|
||||
func (this *Player) BuildMsgRewardActiveListAck() *pb.RewardActiveListAck {
|
||||
var activeList []*pb.RewardActive
|
||||
for _, rewardStatus := range this.RewardActive {
|
||||
activeList = append(activeList, rewardStatus.BuildMsgRewardActive())
|
||||
}
|
||||
return &pb.RewardActiveListAck{ActiveList: activeList}
|
||||
}
|
122
servers/game/logic/player_reward_login.go
Normal file
122
servers/game/logic/player_reward_login.go
Normal file
@ -0,0 +1,122 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"ecs/proto/pb"
|
||||
"github.com/oylshe1314/framework/util"
|
||||
)
|
||||
|
||||
type PlayerRewardLogin struct {
|
||||
SeriesId uint32 `bson:"series_id" key:"1"`
|
||||
RewardStatus [][2]uint32 `bson:"reward_status"`
|
||||
}
|
||||
|
||||
func (this *PlayerRewardLogin) BuildMsgRewardLogin() *pb.RewardLogin {
|
||||
var msg = &pb.RewardLogin{SeriesId: this.SeriesId}
|
||||
for _, status := range this.RewardStatus {
|
||||
msg.StatusList = append(msg.StatusList, &pb.RewardStatus{Id: status[0], Status: pb.AbleStatus(status[1])})
|
||||
}
|
||||
return msg
|
||||
}
|
||||
|
||||
func (this *Player) CheckRewardLogin() bool {
|
||||
var changed = false
|
||||
for _, seriesId := range this.manager.tables.RewardLogin.SeriesIds() {
|
||||
changed = this.checkRewardLogin(uint32(seriesId)) || changed
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
func (this *Player) checkRewardLogin(seriesId uint32) bool {
|
||||
var changed = false
|
||||
var rewardLogin = this.RewardLogin[seriesId]
|
||||
if rewardLogin == nil {
|
||||
rewardLogin = this.newRewardLogin(seriesId)
|
||||
if rewardLogin == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
this.RewardLogin[rewardLogin.SeriesId] = rewardLogin
|
||||
changed = true
|
||||
} else {
|
||||
var rewardTables = this.manager.tables.RewardLogin.Find2(int(seriesId))
|
||||
if len(rewardTables) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
_, _, days := util.YMD()
|
||||
if pb.DaysModule(rewardTables[0].DaysModule) == pb.DaysModule_PeriodDays {
|
||||
maxDays, ok := this.manager.tables.RewardLogin.MaxDays(int(seriesId))
|
||||
if !ok {
|
||||
maxDays = len(rewardTables)
|
||||
}
|
||||
days = int(this.LoginDays-1)%maxDays + 1
|
||||
}
|
||||
|
||||
if len(rewardLogin.RewardStatus) != len(rewardTables) {
|
||||
var newRewardStatus = make([][2]uint32, len(rewardTables))
|
||||
for i := range rewardLogin.RewardStatus {
|
||||
if i >= len(newRewardStatus) {
|
||||
break
|
||||
}
|
||||
if rewardLogin.RewardStatus[i][0] == newRewardStatus[i][0] &&
|
||||
pb.AbleStatus(rewardLogin.RewardStatus[i][1]) == pb.AbleStatus_Able {
|
||||
newRewardStatus[i][1] = uint32(pb.AbleStatus_Able)
|
||||
}
|
||||
}
|
||||
rewardLogin.RewardStatus = newRewardStatus
|
||||
changed = true
|
||||
}
|
||||
|
||||
for i := range rewardLogin.RewardStatus {
|
||||
if pb.AbleStatus(rewardLogin.RewardStatus[i][1]) == pb.AbleStatus_Unable {
|
||||
var activeTable = this.manager.tables.RewardLogin.Find1(int(rewardLogin.RewardStatus[i][0]))
|
||||
if activeTable != nil {
|
||||
if days >= activeTable.Days {
|
||||
rewardLogin.RewardStatus[i][1] = uint32(pb.AbleStatus_Able)
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if changed {
|
||||
this.SaveModel(rewardLogin)
|
||||
_ = this.Send(pb.ModId_ModuleReward, pb.MsgId_ModRewardLoginChange, &pb.RewardLoginChangeAck{RewardLogin: rewardLogin.BuildMsgRewardLogin()})
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
func (this *Player) newRewardLogin(seriesId uint32) *PlayerRewardLogin {
|
||||
var rewardTables = this.manager.tables.RewardLogin.Find2(int(seriesId))
|
||||
if len(rewardTables) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, _, days := util.YMD()
|
||||
if pb.DaysModule(rewardTables[0].DaysModule) == pb.DaysModule_PeriodDays {
|
||||
maxDays, ok := this.manager.tables.RewardLogin.MaxDays(int(seriesId))
|
||||
if !ok {
|
||||
maxDays = len(rewardTables)
|
||||
}
|
||||
days = int(this.LoginDays-1)%maxDays + 1
|
||||
}
|
||||
|
||||
var rewardLogin = &PlayerRewardLogin{SeriesId: seriesId, RewardStatus: make([][2]uint32, len(rewardTables))}
|
||||
for i, rewardTable := range rewardTables {
|
||||
rewardLogin.RewardStatus[i] = [2]uint32{
|
||||
uint32(rewardTable.Id),
|
||||
util.If(days < rewardTable.Days, uint32(pb.AbleStatus_Unable), uint32(pb.AbleStatus_Able)),
|
||||
}
|
||||
}
|
||||
|
||||
return rewardLogin
|
||||
}
|
||||
|
||||
func (this *Player) BuildMsgRewardLoginListAck() *pb.RewardLoginListAck {
|
||||
var activeList []*pb.RewardLogin
|
||||
for _, rewardStatus := range this.RewardLogin {
|
||||
activeList = append(activeList, rewardStatus.BuildMsgRewardLogin())
|
||||
}
|
||||
return &pb.RewardLoginListAck{LoginList: activeList}
|
||||
}
|
@ -1,271 +1,238 @@
|
||||
package logic
|
||||
|
||||
//type PlayerTask struct {
|
||||
// Id uint32 `bson:"id" key:"1"`
|
||||
// Process []int `bson:"process"` //进度
|
||||
// Okay []bool `bson:"nice"` //点赞
|
||||
// Status uint32 `bson:"status"` //任务状态:0.未完成,1.已完成,2.已提交(已领取)
|
||||
//}
|
||||
//
|
||||
//func (this *PlayerTask) BuildMsgTask() *proto.Task {
|
||||
// return &proto.Task{Id: this.Id, Process: this.Process, Status: this.Status}
|
||||
//}
|
||||
//
|
||||
//func (this *Player) checkTaskCompetedAhead(task *PlayerTask, taskTable *data.Task) {
|
||||
// if proto.TaskType(taskTable.TaskType) != proto.TaskTypeMainline {
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// var changed = false
|
||||
// var completed = true
|
||||
// for i := range taskTable.Section1 {
|
||||
// switch proto.TaskSection1(taskTable.Section1[i]) {
|
||||
// case proto.TaskSection1PassSpecificScene:
|
||||
// if len(taskTable.Section2) > 0 && taskTable.Section2[i] > 0 {
|
||||
// changed = this.processTask(task, taskTable, i, int(this.GetCopyPassedNum(uint32(taskTable.Section2[i])))) || changed
|
||||
// }
|
||||
// case proto.TaskSection1HeadComponentMaxLevel:
|
||||
// changed = this.processTask(task, taskTable, i, int(this.GetRigCompnentLevels(proto.EquipTypeHead))) || changed
|
||||
// case proto.TaskSection1BodyComponentMaxLevel:
|
||||
// changed = this.processTask(task, taskTable, i, int(this.GetRigCompnentLevels(proto.EquipTypeBody))) || changed
|
||||
// case proto.TaskSection1TailComponentMaxLevel:
|
||||
// changed = this.processTask(task, taskTable, i, int(this.GetRigCompnentLevels(proto.EquipTypeTail))) || changed
|
||||
// case proto.TaskSection1ComponentsAllLevels:
|
||||
// changed = this.processTask(task, taskTable, i, int(this.GetAllRigCompnentLevels())) || changed
|
||||
// default:
|
||||
// return
|
||||
// }
|
||||
// completed = completed && task.Okay[i]
|
||||
// }
|
||||
// if completed {
|
||||
// task.Status = uint32(proto.TaskStatusCompleted)
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//func (this *Player) addTask(taskTable *data.Task) *PlayerTask {
|
||||
//
|
||||
// if taskTable.Id == 200002 {
|
||||
// this.manager.logger.Error("200002")
|
||||
// }
|
||||
//
|
||||
// var task = &PlayerTask{Id: uint32(taskTable.Id), Process: make([]int, len(taskTable.Section1)), Okay: make([]bool, len(taskTable.Section1))}
|
||||
// this.Task[task.Id] = task
|
||||
// this.checkTaskCompetedAhead(task, taskTable)
|
||||
// this.SaveModel(task)
|
||||
//
|
||||
// this.manager.eventManager.PlayerTaskLog(this, LogTypeTaskAdd, uint32(taskTable.Id), taskTable.Section1, taskTable.Section2, taskTable.Section3)
|
||||
// return task
|
||||
//}
|
||||
//
|
||||
//func (this *Player) AddTask(taskIds ...int) {
|
||||
// if len(taskIds) == 0 {
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// var changeList []*proto.TaskChange
|
||||
// for _, taskId := range taskIds {
|
||||
// var task = this.Task[uint32(taskId)]
|
||||
// if task != nil {
|
||||
// continue
|
||||
// }
|
||||
//
|
||||
// var taskTable = this.manager.tables.Task.Get(taskId)
|
||||
// if taskTable == nil {
|
||||
// continue
|
||||
// }
|
||||
//
|
||||
// task = this.addTask(taskTable)
|
||||
// changeList = append(changeList, &proto.TaskChange{Task: task.BuildMsgTask(), ChangeType: uint32(proto.ChangeTypeAdd)})
|
||||
// }
|
||||
// if len(changeList) > 0 {
|
||||
// _ = this.Send(proto.ModIdTask, proto.MsgIdTaskChange, &proto.MsgTaskChangeListAck{List: changeList})
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//func (this *Player) checkTaskDeprecated() (changed bool) {
|
||||
// for id, task := range this.Task {
|
||||
// if taskTable := this.manager.tables.Task.Get(int(id)); taskTable == nil {
|
||||
// delete(this.Task, id)
|
||||
// this.WipeModel(task)
|
||||
// changed = true
|
||||
// }
|
||||
// }
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//func (this *Player) checkTaskReset(taskType proto.TaskType) (changed bool) {
|
||||
// if taskType == proto.TaskTypeLevelJudge {
|
||||
// return false
|
||||
// }
|
||||
//
|
||||
// var list []*proto.TaskChange
|
||||
// var taskTables = this.manager.tables.TaskExtend.Get(int(taskType))
|
||||
// for _, taskTable := range taskTables {
|
||||
// var task = this.Task[uint32(taskTable.Id)]
|
||||
// if task != nil {
|
||||
// task.Process = make([]int, len(taskTable.Section1))
|
||||
// task.Okay = make([]bool, len(taskTable.Section1))
|
||||
// task.Status = uint32(proto.TaskStatusIncomplete)
|
||||
// list = append(list, &proto.TaskChange{Task: task.BuildMsgTask(), ChangeType: uint32(proto.ChangeTypeChange)})
|
||||
// } else {
|
||||
// task = this.addTask(taskTable)
|
||||
// list = append(list, &proto.TaskChange{Task: task.BuildMsgTask(), ChangeType: uint32(proto.ChangeTypeAdd)})
|
||||
// }
|
||||
//
|
||||
// this.SaveModel(task)
|
||||
// this.ResetCounterDaily(proto.CounterTypeTaskCompleted, task.Id)
|
||||
// changed = true
|
||||
// }
|
||||
//
|
||||
// _ = this.Send(proto.ModIdTask, proto.MsgIdTaskChange, &proto.MsgTaskChangeListAck{List: list})
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//func (this *Player) CheckTask(section1 proto.TaskSection1, section2, value int) bool {
|
||||
// var changeList []*proto.TaskChange
|
||||
// for _, task := range this.Task {
|
||||
// var taskTable = this.manager.tables.Task.Get(int(task.Id))
|
||||
// if taskTable == nil {
|
||||
// continue
|
||||
// }
|
||||
//
|
||||
// if proto.TaskType(taskTable.TaskType) == proto.TaskTypeLevelJudge {
|
||||
// continue
|
||||
// }
|
||||
//
|
||||
// if proto.TaskStatus(task.Status) >= proto.TaskStatusCompleted {
|
||||
// continue
|
||||
// }
|
||||
//
|
||||
// var changed = false
|
||||
// if len(task.Process) != len(taskTable.Section1) {
|
||||
// var process = task.Process
|
||||
// var okay = task.Okay
|
||||
//
|
||||
// task.Process = make([]int, len(taskTable.Section1))
|
||||
// task.Okay = make([]bool, len(taskTable.Section1))
|
||||
//
|
||||
// copy(task.Process, process)
|
||||
// copy(task.Okay, okay)
|
||||
//
|
||||
// changed = true
|
||||
// }
|
||||
//
|
||||
// var completed = true
|
||||
// for i := range taskTable.Section1 {
|
||||
// if task.Okay[i] {
|
||||
// continue
|
||||
// }
|
||||
//
|
||||
// if proto.TaskSection1(taskTable.Section1[i]) != section1 {
|
||||
// completed = false
|
||||
// continue
|
||||
// }
|
||||
//
|
||||
// if len(taskTable.Section2) > 0 && taskTable.Section2[i] > 0 {
|
||||
// if section2 != taskTable.Section2[i] {
|
||||
// completed = false
|
||||
// continue
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// changed = this.processTask(task, taskTable, i, value) || changed
|
||||
// completed = completed && task.Okay[i]
|
||||
// }
|
||||
//
|
||||
// if changed {
|
||||
// if completed {
|
||||
// task.Status = uint32(proto.TaskStatusCompleted)
|
||||
// }
|
||||
// this.SaveModel(task)
|
||||
// changeList = append(changeList, &proto.TaskChange{Task: task.BuildMsgTask(), ChangeType: uint32(proto.ChangeTypeChange)})
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if len(changeList) == 0 {
|
||||
// return false
|
||||
// }
|
||||
//
|
||||
// _ = this.Send(proto.ModIdTask, proto.MsgIdTaskChange, &proto.MsgTaskChangeListAck{List: changeList})
|
||||
// return true
|
||||
//}
|
||||
//
|
||||
//func (this *Player) processTask(task *PlayerTask, taskTable *data.Task, i, value int) bool {
|
||||
// switch proto.TaskSection1(taskTable.Section1[i]) {
|
||||
// case proto.TaskSection1PassSpecificScene,
|
||||
// proto.TaskSection1PassAnyScene,
|
||||
// proto.TaskSection1CollectSpecificItem,
|
||||
// proto.TaskSection1PassedClassifyCopies,
|
||||
// proto.TaskSection1KillSpecificMonster,
|
||||
// proto.TaskSection1LoginDays,
|
||||
// proto.TaskSection1BoughtInSpecificStore,
|
||||
// proto.TaskSection1SmelterSmeltTimes,
|
||||
// proto.TaskSection1InfrastructureProduce,
|
||||
// proto.TaskSection1GetIdleBattleRewards,
|
||||
// proto.TaskSection1KillClassifyMonsters,
|
||||
// proto.TaskSection1UpgradeHeadComponents,
|
||||
// proto.TaskSection1UpgradeBodyComponents,
|
||||
// proto.TaskSection1UpgradeTailComponents,
|
||||
// proto.TaskSection1LevelBattleScore,
|
||||
// proto.TaskSection1UpgradeComponents,
|
||||
// proto.TaskSection1UpgradeComponentStars,
|
||||
// proto.TaskSection1UpgradeCharacters,
|
||||
// proto.TaskSection1UpgradeCharacterStars,
|
||||
// proto.TaskSection1UpgradeRemains,
|
||||
// proto.TaskSection1ArenaChallengeTimes,
|
||||
// proto.TaskSection1PlanetMineTimes,
|
||||
// proto.TaskSection1BuildCivilizations:
|
||||
// if task.Process[i] >= taskTable.Section3[i] {
|
||||
// return false
|
||||
// }
|
||||
//
|
||||
// task.Process[i] += value
|
||||
// if task.Process[i] >= taskTable.Section3[i] {
|
||||
// task.Process[i] = taskTable.Section3[i]
|
||||
// task.Okay[i] = true
|
||||
// }
|
||||
// case proto.TaskSection1ArriveSpecificDepth,
|
||||
// proto.TaskSection1HeadComponentMaxLevel,
|
||||
// proto.TaskSection1BodyComponentMaxLevel,
|
||||
// proto.TaskSection1TailComponentMaxLevel,
|
||||
// proto.TaskSection1ComponentsAllLevels:
|
||||
// if task.Process[i] >= taskTable.Section3[i] {
|
||||
// return false
|
||||
// }
|
||||
//
|
||||
// task.Process[i] = value
|
||||
// if task.Process[i] >= taskTable.Section3[i] {
|
||||
// task.Process[i] = taskTable.Section3[i]
|
||||
// task.Okay[i] = true
|
||||
// }
|
||||
// case proto.TaskSection1ArrivedDesignatedArea:
|
||||
// task.Process[i] = value
|
||||
// if len(taskTable.Section2) == 0 {
|
||||
// return false
|
||||
// }
|
||||
//
|
||||
// switch taskTable.Section2[i] {
|
||||
// case 1, 2:
|
||||
// if task.Process[i] >= taskTable.Section3[i] {
|
||||
// task.Process[i] = taskTable.Section3[i]
|
||||
// task.Okay[i] = true
|
||||
// }
|
||||
// case 3, 4:
|
||||
// if task.Process[i] <= taskTable.Section3[i] {
|
||||
// task.Process[i] = taskTable.Section3[i]
|
||||
// task.Okay[i] = true
|
||||
// }
|
||||
// }
|
||||
// default:
|
||||
// return false
|
||||
// }
|
||||
// return true
|
||||
//}
|
||||
//
|
||||
//func (this *Player) BuildMsgTaskListAck() *proto.MsgTaskListAck {
|
||||
// var list []*proto.Task
|
||||
// for _, task := range this.Task {
|
||||
// list = append(list, task.BuildMsgTask())
|
||||
// }
|
||||
// return &proto.MsgTaskListAck{List: list}
|
||||
//}
|
||||
import (
|
||||
"ecs/proto/pb"
|
||||
"ecs/servers/game/data"
|
||||
)
|
||||
|
||||
type PlayerTask struct {
|
||||
Id uint32 `bson:"id" key:"1"`
|
||||
Status uint32 `bson:"status"` //任务状态见pb.AbleStatus - 0.不可提交(未完成),1.可提交(已完成),2.已提交(奖励已领取)
|
||||
Okayed []bool `bson:"okayed"` //点赞
|
||||
Process []uint32 `bson:"process"` //进度
|
||||
}
|
||||
|
||||
func (this *PlayerTask) BuildMsgTask() *pb.Task {
|
||||
return &pb.Task{Id: this.Id, Process: this.Process, Status: pb.AbleStatus(this.Status)}
|
||||
}
|
||||
|
||||
func (this *Player) checkTaskCompetedAhead(task *PlayerTask, taskTable *data.Task) {
|
||||
if pb.TaskType(taskTable.Type) != pb.TaskType_TaskMain && pb.TaskType(taskTable.Type) != pb.TaskType_TaskMainChapter {
|
||||
return
|
||||
}
|
||||
|
||||
var changed = false
|
||||
var completed = true
|
||||
for i := range taskTable.TaskArgs1 {
|
||||
var arg1 = taskTable.TaskArgs1[i]
|
||||
switch pb.TaskArgs(arg1) {
|
||||
case pb.TaskArgs_TaskArgsId:
|
||||
changed = this.processTask(task, taskTable, i, this.GetCounterTotal(pb.CounterType_TaskCompleted, uint64(taskTable.TaskArgs2[i]))) || changed
|
||||
case pb.TaskArgs_TaskArgsType:
|
||||
case pb.TaskArgs_TaskSignIn:
|
||||
case pb.TaskArgs_TaskHeroBook:
|
||||
case pb.TaskArgs_TaskHeroLevel:
|
||||
case pb.TaskArgs_TaskHeroBreak:
|
||||
case pb.TaskArgs_TaskEquipLevel:
|
||||
case pb.TaskArgs_TaskEquipRefine:
|
||||
case pb.TaskArgs_TaskTreasureLevel:
|
||||
case pb.TaskArgs_TaskTreasureRefine:
|
||||
case pb.TaskArgs_TaskCopyChapter:
|
||||
case pb.TaskArgs_TaskCopyLevel:
|
||||
default:
|
||||
continue
|
||||
}
|
||||
completed = completed && task.Okayed[i]
|
||||
}
|
||||
if completed {
|
||||
task.Status = uint32(pb.AbleStatus_Able)
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Player) addTask(taskTable *data.Task) *PlayerTask {
|
||||
var task = &PlayerTask{
|
||||
Id: uint32(taskTable.Id),
|
||||
Status: uint32(pb.AbleStatus_Unable),
|
||||
Okayed: make([]bool, len(taskTable.TaskArgs1)),
|
||||
Process: make([]uint32, len(taskTable.TaskArgs1)),
|
||||
}
|
||||
|
||||
this.Task[task.Id] = task
|
||||
this.checkTaskCompetedAhead(task, taskTable)
|
||||
this.SaveModel(task)
|
||||
|
||||
//this.manager.eventManager.PlayerTaskLog(this, LogTypeTaskAdd, uint32(taskTable.Id), taskTable.Section1, taskTable.Section2, taskTable.Section3)
|
||||
return task
|
||||
}
|
||||
|
||||
func (this *Player) AddTask(taskIds ...int) {
|
||||
if len(taskIds) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
var changeList []*pb.TaskChange
|
||||
for _, taskId := range taskIds {
|
||||
var task = this.Task[uint32(taskId)]
|
||||
if task != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
var taskTable = this.manager.tables.Task.Find1(taskId)
|
||||
if taskTable == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
for i := range taskTable.TaskArgs1 {
|
||||
if pb.TaskArgs(taskTable.TaskArgs1[i]) == pb.TaskArgs_TaskArgsId {
|
||||
var subTaskTable = this.manager.tables.Task.Find1(taskTable.TaskArgs1[i])
|
||||
if subTaskTable != nil {
|
||||
var subTask = this.addTask(taskTable)
|
||||
changeList = append(changeList, &pb.TaskChange{ChangeType: pb.ChangeType_Add, Task: subTask.BuildMsgTask()})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task = this.addTask(taskTable)
|
||||
changeList = append(changeList, &pb.TaskChange{ChangeType: pb.ChangeType_Add, Task: task.BuildMsgTask()})
|
||||
}
|
||||
if len(changeList) > 0 {
|
||||
_ = this.Send(pb.ModId_ModuleTask, pb.MsgId_ModTaskChange, &pb.TaskChangeListAck{ChangeList: changeList})
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Player) checkTaskDeprecated() (changed bool) {
|
||||
for id, task := range this.Task {
|
||||
if taskTable := this.manager.tables.Task.Find1(int(id)); taskTable == nil {
|
||||
delete(this.Task, id)
|
||||
this.WipeModel(task)
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Player) checkTaskReset(taskType pb.TaskType) (changed bool) {
|
||||
var changeList []*pb.TaskChange
|
||||
var taskTables = this.manager.tables.Task.Find2(int(taskType))
|
||||
for _, taskTable := range taskTables {
|
||||
var task = this.Task[uint32(taskTable.Id)]
|
||||
if task != nil {
|
||||
task.Okayed = make([]bool, len(taskTable.TaskArgs1))
|
||||
task.Process = make([]uint32, len(taskTable.TaskArgs1))
|
||||
task.Status = uint32(pb.AbleStatus_Unable)
|
||||
changeList = append(changeList, &pb.TaskChange{ChangeType: pb.ChangeType_Changed, Task: task.BuildMsgTask()})
|
||||
} else {
|
||||
task = this.addTask(taskTable)
|
||||
changeList = append(changeList, &pb.TaskChange{ChangeType: pb.ChangeType_Add, Task: task.BuildMsgTask()})
|
||||
}
|
||||
|
||||
this.SaveModel(task)
|
||||
this.ResetCounterDaily(pb.CounterType_TaskCompleted, uint64(task.Id))
|
||||
changed = true
|
||||
}
|
||||
|
||||
_ = this.Send(pb.ModId_ModuleTask, pb.MsgId_ModTaskChange, &pb.TaskChangeListAck{ChangeList: changeList})
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Player) CheckTask(arg1 pb.TaskArgs, arg2 int, value uint32) bool {
|
||||
var changeList []*pb.TaskChange
|
||||
|
||||
for _, task := range this.Task {
|
||||
var taskTable = this.manager.tables.Task.Find1(int(task.Id))
|
||||
if taskTable == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if pb.AbleStatus(task.Status) >= pb.AbleStatus_Able {
|
||||
continue
|
||||
}
|
||||
|
||||
var changed = false
|
||||
if len(task.Process) != len(taskTable.TaskArgs1) {
|
||||
var process = task.Process
|
||||
var okay = task.Okayed
|
||||
|
||||
task.Process = make([]uint32, len(taskTable.TaskArgs1))
|
||||
task.Okayed = make([]bool, len(taskTable.TaskArgs1))
|
||||
|
||||
copy(task.Process, process)
|
||||
copy(task.Okayed, okay)
|
||||
|
||||
changed = true
|
||||
}
|
||||
|
||||
var completed = true
|
||||
for i := range taskTable.TaskArgs1 {
|
||||
if task.Okayed[i] {
|
||||
continue
|
||||
}
|
||||
|
||||
if pb.TaskArgs(taskTable.TaskArgs1[i]) != arg1 {
|
||||
completed = false
|
||||
continue
|
||||
}
|
||||
|
||||
if len(taskTable.TaskArgs2) > i && taskTable.TaskArgs2[i] > 0 {
|
||||
if arg2 != taskTable.TaskArgs2[i] {
|
||||
completed = false
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
changed = this.processTask(task, taskTable, i, value) || changed
|
||||
completed = completed && task.Okayed[i]
|
||||
}
|
||||
|
||||
if changed {
|
||||
if completed {
|
||||
task.Status = uint32(pb.AbleStatus_Able)
|
||||
}
|
||||
this.SaveModel(task)
|
||||
changeList = append(changeList, &pb.TaskChange{ChangeType: pb.ChangeType_Changed, Task: task.BuildMsgTask()})
|
||||
}
|
||||
}
|
||||
|
||||
if len(changeList) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
_ = this.Send(pb.ModId_ModuleTask, pb.MsgId_ModTaskChange, &pb.TaskChangeListAck{ChangeList: changeList})
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *Player) processTask(task *PlayerTask, taskTable *data.Task, i int, value uint32) bool {
|
||||
switch pb.TaskArgs(taskTable.TaskArgs1[i]) {
|
||||
case pb.TaskArgs_TaskArgsType:
|
||||
if task.Process[i] >= uint32(taskTable.TaskArgs3[i]) {
|
||||
return false
|
||||
}
|
||||
|
||||
task.Process[i] += value
|
||||
if task.Process[i] >= uint32(taskTable.TaskArgs3[i]) {
|
||||
task.Process[i] = uint32(taskTable.TaskArgs3[i])
|
||||
task.Okayed[i] = true
|
||||
}
|
||||
case pb.TaskArgs_TaskArgsId:
|
||||
if task.Process[i] >= uint32(taskTable.TaskArgs3[i]) {
|
||||
return false
|
||||
}
|
||||
|
||||
task.Process[i] = value
|
||||
if task.Process[i] >= uint32(taskTable.TaskArgs3[i]) {
|
||||
task.Process[i] = uint32(taskTable.TaskArgs3[i])
|
||||
task.Okayed[i] = true
|
||||
}
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *Player) BuildMsgTaskListAck() *pb.MsgTaskListAck {
|
||||
var list []*pb.Task
|
||||
for _, task := range this.Task {
|
||||
list = append(list, task.BuildMsgTask())
|
||||
}
|
||||
return &pb.MsgTaskListAck{TaskList: list}
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
package logic
|
||||
|
||||
//type PlayerTaskActive struct {
|
||||
// Id uint32 `bson:"id" key:"1"`
|
||||
// Status uint32 `bson:"status"`
|
||||
//}
|
||||
//
|
||||
//func (this *PlayerTaskActive) BuildActiveReward() *proto.ActiveReward {
|
||||
// return &proto.ActiveReward{Id: this.Id, Status: this.Status}
|
||||
//}
|
||||
//
|
||||
//func (this *Player) BuildMsgActiveInfoAck() *proto.MsgActiveInfoAck {
|
||||
// var statusList []*proto.ActiveReward
|
||||
// for _, avtive := range this.TaskActive {
|
||||
// statusList = append(statusList, avtive.BuildActiveReward())
|
||||
// }
|
||||
// return &proto.MsgActiveInfoAck{Value: this.GetMoney(proto.MoneyTypeActivation).Value, StatusList: statusList}
|
||||
//}
|
Loading…
x
Reference in New Issue
Block a user