添加圣物
parent
0caf4ddadc
commit
805745fdfa
|
@ -0,0 +1,66 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.ExpeditionItem;
|
||||
import com.ljsd.jieling.logic.dao.ExpeditionManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.Expedition;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SExpeditionHolyConfig;
|
||||
import manager.STableManager;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class Cmd_addholy extends GmRoleAbstract{
|
||||
@Override
|
||||
public boolean exec(String[] args) throws Exception {
|
||||
|
||||
|
||||
if(args.length!=1){
|
||||
return true;
|
||||
}
|
||||
int itemId = Integer.valueOf(args[0]);
|
||||
ISession iSession = OnlineUserManager.getSessionByUid(getUser().getId());
|
||||
|
||||
SExpeditionHolyConfig sExpeditionHolyConfig = STableManager.getConfig(SExpeditionHolyConfig.class).get(itemId);
|
||||
if(sExpeditionHolyConfig==null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
//更新背包
|
||||
ExpeditionItem expeditionItem = new ExpeditionItem(iSession.getUid(), itemId);
|
||||
ExpeditionManager expeditionManager = getUser().getExpeditionManager();
|
||||
expeditionManager.addPropertyItems(expeditionItem);
|
||||
|
||||
//更新effectitem 参与计算
|
||||
if(expeditionManager.getEffectItems().size()==0){
|
||||
ExpeditionLogic.getFirstRankHoly(expeditionManager);
|
||||
}
|
||||
Map<Integer,SExpeditionHolyConfig> effectItems = expeditionManager.getEffectItems();
|
||||
SExpeditionHolyConfig orDefault = effectItems.getOrDefault(sExpeditionHolyConfig.geteffect(), null);
|
||||
|
||||
if(orDefault==null){
|
||||
effectItems.put(sExpeditionHolyConfig.geteffect(),sExpeditionHolyConfig);
|
||||
}else {
|
||||
if(sExpeditionHolyConfig.gettype()>orDefault.gettype()){
|
||||
effectItems.put(sExpeditionHolyConfig.geteffect(),sExpeditionHolyConfig);
|
||||
}
|
||||
}
|
||||
|
||||
//notify client
|
||||
Expedition.ExpeditionEquipIndication.Builder indication = Expedition.ExpeditionEquipIndication.newBuilder();
|
||||
indication.addEquipIds(CommonProto.ExpeditionEquip.newBuilder().setId(expeditionItem.getId()).setEquiptId(expeditionItem.getEquipId()).build());
|
||||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.EXPEDITION_HOLY_BAG_INDICATION_VALUE, indication.build(), true);
|
||||
|
||||
getUser().getUserMissionManager().onGameEvent(getUser(), GameEvent.EXPEDITION_TIMES);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
import com.ljsd.jieling.core.Lockeys;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 锁操作
|
||||
* //test_lock 1
|
||||
* CreateDate: 2020/6/11 11:48
|
||||
*/
|
||||
public class Cmd_test_lock extends GmAbstract {
|
||||
@Override
|
||||
public boolean exec(String[] args) throws Exception {
|
||||
Set<Integer> sendUids = new HashSet<>();
|
||||
sendUids.add(Integer.valueOf( args[0]));
|
||||
Lockeys.getLockeys().lock("guild",sendUids);
|
||||
int i=1;
|
||||
while (i++<10){
|
||||
String name = Thread.currentThread().getName();
|
||||
Thread.currentThread().sleep(1000);
|
||||
System.out.println("name"+name+" = [" + i + "]");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue