福利红包
parent
2010a1a9ce
commit
e5c6a1723a
|
@ -0,0 +1,22 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
public class WelfareRedPacketSendRequestHandler extends BaseHandler<PlayerInfoProto.WelfareRedPacketSendRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.WELFARE_RED_PACKET_SEND_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.WelfareRedPacketSendRequest proto) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
GuildLogic.sendRedPackage(user.getId(),proto.getId());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.ljsd.jieling.logic.redpacket;
|
||||
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
|
||||
public class WelfareRedPackEvent implements IEvent {
|
||||
private int uid;
|
||||
private int type;
|
||||
private int num;
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public WelfareRedPackEvent(int uid, int type, int num){
|
||||
this.uid = uid;
|
||||
this.type = type;
|
||||
this.num = num;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.ljsd.jieling.logic.redpacket;
|
||||
|
||||
import com.ljsd.jieling.logic.activity.IEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import config.SGuildRedPackConfig;
|
||||
|
||||
public class WelfareRedPackSendHandler implements IEventHandler {
|
||||
|
||||
public WelfareRedPackSendHandler(){
|
||||
Poster.getPoster().listenEvent(this,WelfareRedPackEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof WelfareRedPackEvent))
|
||||
return;
|
||||
WelfareRedPackEvent directEvent = (WelfareRedPackEvent) event;
|
||||
if(!SGuildRedPackConfig.sWelfareRedPackByRule.containsKey(directEvent.getType())){
|
||||
return;
|
||||
}
|
||||
SGuildRedPackConfig sGuildRedPackConfig = SGuildRedPackConfig.sWelfareRedPackByRule.get(directEvent.getType());
|
||||
if(sGuildRedPackConfig.getRuleType() == 3){
|
||||
boolean f = false;
|
||||
for(SGuildRedPackConfig config : SGuildRedPackConfig.welfareRedPackBySerise.get(sGuildRedPackConfig.getGroupId())){
|
||||
if(config.getRuleId()[1] == directEvent.getNum()){
|
||||
sGuildRedPackConfig = config;
|
||||
f=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!f){
|
||||
return;
|
||||
}
|
||||
}
|
||||
GuildLogic.addWelfareRedPacket(directEvent.getUid(),sGuildRedPackConfig.getId());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.ljsd.jieling.logic.redpacket;
|
||||
|
||||
public enum WelfareRedPacketType {
|
||||
arena_rank(1),
|
||||
top_match_rank(2),
|
||||
newfish_come(3),
|
||||
random_pokemon(4),
|
||||
game_pokemon(5),
|
||||
hero_star(6),
|
||||
soul_demon(7),
|
||||
;
|
||||
private int type;
|
||||
WelfareRedPacketType(int type){
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue