添加批量删除道具GM

back_recharge
yuanshuai 2021-12-14 14:55:59 +08:00
parent 1ee2a60fc0
commit 2fcf50d33e
3 changed files with 15 additions and 3 deletions

View File

@ -375,4 +375,6 @@ public interface BIReason {
int BUY_GOOD_ITEM_COST =1225;//妖晶购买道具消耗 int BUY_GOOD_ITEM_COST =1225;//妖晶购买道具消耗
int BUY_GOOD_ITEM_GET =1226;//妖晶购买道具获得 int BUY_GOOD_ITEM_GET =1226;//妖晶购买道具获得
int LIFE_STONE_UP = 1227;//命石合成 int LIFE_STONE_UP = 1227;//命石合成
int GM_COST = 1228;//gm删除道具
} }

View File

@ -29,5 +29,6 @@ public interface GlobalGm {
// int POKEMAN_MAX = 22;//一键获得所有满级异妖 // int POKEMAN_MAX = 22;//一键获得所有满级异妖
int HARD_STAGE =25;//一键通关山河社稷图特定关卡之前的所有关卡 int HARD_STAGE =25;//一键通关山河社稷图特定关卡之前的所有关卡
int FOUR_SPIRITS =26;//一键通关山河社稷图特定关卡之前的所有关卡 int FOUR_SPIRITS =26;//一键通关山河社稷图特定关卡之前的所有关卡
int CLEAR_ITEM=27;//批量清除道具
} }

View File

@ -102,7 +102,7 @@ public class GMRequestHandler extends BaseHandler{
// if(!GameApplication.serverProperties.isDebug()){ // if(!GameApplication.serverProperties.isDebug()){
// throw new ErrorCodeException("In a formal setting"); // throw new ErrorCodeException("In a formal setting");
// } // }
if (!command.contains("#") || command.split("#").length < 3) { if (!command.contains("#") || command.split("#").length < 2) {
LOGGER.error("wrong command :" + command); LOGGER.error("wrong command :" + command);
return; return;
} }
@ -120,7 +120,7 @@ public class GMRequestHandler extends BaseHandler{
if (gmCommandType == GlobalGm.RESET_USER_NAME){ if (gmCommandType == GlobalGm.RESET_USER_NAME){
prarm3 = commandArray[2]; prarm3 = commandArray[2];
}else{ }else{
if(gmCommandType!=GlobalGm.TIME_INFO){ if(gmCommandType!=GlobalGm.TIME_INFO&&gmCommandType!=GlobalGm.CLEAR_ITEM){
prarm2 = Integer.parseInt(commandArray[2]); prarm2 = Integer.parseInt(commandArray[2]);
} }
} }
@ -471,11 +471,20 @@ public class GMRequestHandler extends BaseHandler{
prarm2 = Integer.parseInt(commandArray[2]); prarm2 = Integer.parseInt(commandArray[2]);
cUser.getPlayerInfoManager().updateFourChallengeByIndex(prarm1, prarm2); cUser.getPlayerInfoManager().updateFourChallengeByIndex(prarm1, prarm2);
break; break;
case GlobalGm.CLEAR_ITEM:
Map<Integer,Long>costMap=new HashMap<>();
for (int i = 1; i < commandArray.length; i++) {
Item item=cUser.getItemManager().getItem(Integer.parseInt(commandArray[i]));
if (item!=null){
costMap.put(item.getItemId(),item.getItemNum());
}
}
ItemUtil.itemCostLong(cUser, costMap, BIReason.GM_COST, GlobalGm.CLEAR_ITEM);
break;
default: default:
break; break;
} }
try { try {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, gmBuilder.build(), true); MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, gmBuilder.build(), true);
LOGGER.info("back to client!"); LOGGER.info("back to client!");
} catch (Exception e) { } catch (Exception e) {