探索达人替换为极速达人,增加探索次数特权逻辑
parent
bf1ef4c1a3
commit
2cdf521ce3
|
@ -1,10 +1,26 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SecretEvent;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.ToolsUtil;
|
||||
import config.SGlobalActivity;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
class SecretExpectRankActivity extends ExpectRankActivity {
|
||||
|
||||
|
@ -13,6 +29,23 @@ class SecretExpectRankActivity extends ExpectRankActivity {
|
|||
Poster.getPoster().listenEvent(this, SecretEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
List<Integer> listValue = new ArrayList<>();
|
||||
listValue.add(36);//额外购买次数
|
||||
listValue.add(37);//额外免费次数
|
||||
Set<Integer> changedSet = new HashSet<>();
|
||||
long endTime = ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(), sGlobalActivity.getEndTimeLong(), sGlobalActivity.getTime(), 0, 2);
|
||||
int time = (int)(endTime / 1000);
|
||||
listValue.forEach(privilegeId -> {
|
||||
changedSet.add(privilegeId);
|
||||
if (!user.getPlayerInfoManager().containPrivilageId(privilegeId))
|
||||
user.getPlayerInfoManager().addVipByTime(privilegeId, time);
|
||||
});
|
||||
notifyClient(user, changedSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof SecretEvent))
|
||||
|
@ -20,4 +53,12 @@ class SecretExpectRankActivity extends ExpectRankActivity {
|
|||
update(UserManager.getUser(((SecretEvent) event).getUid()), 1);
|
||||
|
||||
}
|
||||
|
||||
private void notifyClient(User user, Set<Integer> changedSet) {
|
||||
PlayerInfoProto.PrivilegeIndication.Builder indication = PlayerInfoProto.PrivilegeIndication.newBuilder();
|
||||
Set<CommonProto.Privilege> privilege = PlayerLogic.getInstance().getPrivilege(user, changedSet);
|
||||
indication.addAllInfos(privilege);
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
MessageUtil.sendIndicationMessage(sessionByUid, 1, MessageTypeProto.MessageType.PRIVILLEGE_ADD_INDICATION_VALUE, indication.build(), true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue