灵兽礼包
parent
8e37bd922c
commit
d01dcff730
|
|
@ -0,0 +1,32 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* Description: 五星灵兽获得事件
|
||||
* Author: zsx
|
||||
* CreateDate: 2019/11/25 10:36
|
||||
*/
|
||||
public class PokemonFiveStarGetEvent implements IEvent {
|
||||
private int uid;
|
||||
private int star;
|
||||
private int num;
|
||||
|
||||
public PokemonFiveStarGetEvent(int uid, int star, int num) {
|
||||
this.uid = uid;
|
||||
this.star = star;
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public int getNum(){return num;}
|
||||
|
||||
public int getStar() {
|
||||
return star;
|
||||
}
|
||||
|
||||
public PokemonFiveStarGetEvent(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.ljsd.jieling.logic.activity.eventhandler;
|
||||
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.IEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.PokemonFiveStarGetEvent;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
||||
public class PokemonFiveStarGetEventHandler implements IEventHandler {
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof PokemonFiveStarGetEvent))
|
||||
return;
|
||||
//动态控制购买数量
|
||||
User user = UserManager.getUser(((PokemonFiveStarGetEvent) event).getUid());
|
||||
int star = ((PokemonFiveStarGetEvent) event).getStar();
|
||||
int num = ((PokemonFiveStarGetEvent) event).getNum();
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
BuyGoodsNewLogic.openPush(session,user,8,star,num);
|
||||
}
|
||||
}
|
||||
|
|
@ -22,6 +22,7 @@ import com.ljsd.jieling.logic.OnlineUserManager;
|
|||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.PokemonFiveStarGetEventHandler;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
||||
|
|
@ -57,6 +58,7 @@ public class HeroLogic{
|
|||
public HeroLogic(){
|
||||
//英雄事件监听
|
||||
Poster.getPoster().listenEvent(new HeroFiveStarGetEventHandler(), HeroFiveStarGetEvent.class);
|
||||
Poster.getPoster().listenEvent(new PokemonFiveStarGetEventHandler(), PokemonFiveStarGetEvent.class);
|
||||
}
|
||||
|
||||
public static List<Integer> transTemplate = new ArrayList<>();
|
||||
|
|
@ -2477,7 +2479,7 @@ public class HeroLogic{
|
|||
fiveStarPushByCombine(user,drop.getHero(0).getHeroId(), composeNum);
|
||||
}
|
||||
if(drop.getPokemonList().size()>0){
|
||||
fiveStarPokemonPushByCombine(user,drop.getPokemonList().get(0).getTempId());
|
||||
fiveStarPokemonPushByCombine(user,drop.getPokemonList().get(0).getTempId(),composeNum);
|
||||
}
|
||||
HeroInfoProto.HeroComposeResponse heroComposeResponse = HeroInfoProto.HeroComposeResponse
|
||||
.newBuilder()
|
||||
|
|
@ -4597,24 +4599,22 @@ public class HeroLogic{
|
|||
for(int[] i : getHeros){
|
||||
SSpiritAnimal ssa = SSpiritAnimal.mapConfig.get(i[0]);
|
||||
if(ssa != null && ssa.getQuality()==5){
|
||||
fiveStarNum = 1;
|
||||
fiveStarNum++;
|
||||
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.random_pokemon.getType(),1));
|
||||
}
|
||||
}
|
||||
if(fiveStarNum > 0){
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
BuyGoodsNewLogic.openPush(session,user,8,5,fiveStarNum);
|
||||
Poster.getPoster().dispatchEvent(new PokemonFiveStarGetEvent(user.getId(),5,fiveStarNum));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*五星灵兽合成推送
|
||||
*/
|
||||
public static void fiveStarPokemonPushByCombine(User user,int itemId) throws Exception{
|
||||
public static void fiveStarPokemonPushByCombine(User user,int itemId,int num) throws Exception{
|
||||
SSpiritAnimal ssa = SSpiritAnimal.mapConfig.get(itemId);
|
||||
if(ssa != null && ssa.getQuality()==5){
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
BuyGoodsNewLogic.openPush(session,user,8,5,1);
|
||||
Poster.getPoster().dispatchEvent(new PokemonFiveStarGetEvent(user.getId(),5,num));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -856,6 +856,9 @@ public class BuyGoodsNewLogic {
|
|||
if(id == 21 || id == 400 || id == 401 || id == 402 ){
|
||||
return true;
|
||||
}
|
||||
if(id >= 7300 && id <= 7304){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue