Merge branch 'master' of http://60.1.1.230/backend/jieling_server
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.javaback_recharge
commit
6fef8b2297
|
@ -1,5 +1,5 @@
|
||||||
Id BackpackOrNot ItemType ItemBaseType Quantity Isopen Price UseType RewardGroup UsePerCount IsSave HeroStar Ifopen
|
Id BackpackOrNot ItemType ItemBaseType Quantity Isopen Price UseType RewardGroup UsePerCount IsSave HeroStar Ifopen
|
||||||
int bool int int int bool mut,int#int,1 int int int int mut,int#int,1 int
|
int bool int int int bool string int int int int mut,int#int,1 int
|
||||||
1 false 0 0 1 false null 0 0 0 0 null 1
|
1 false 0 0 1 false null 0 0 0 0 null 1
|
||||||
2 false 0 0 2 false null 0 0 0 0 null 1
|
2 false 0 0 2 false null 0 0 0 0 null 1
|
||||||
3 false 0 0 3 false null 0 0 0 1 null 1
|
3 false 0 0 3 false null 0 0 0 1 null 1
|
||||||
|
@ -19,9 +19,9 @@ int bool int int int bool mut,int#int,1 int int int int mut,int#int,1 int
|
||||||
1004 true 0 2 4 false null 0 0 0 0 null 1
|
1004 true 0 2 4 false null 0 0 0 0 null 1
|
||||||
1005 true 0 2 5 false null 0 0 0 0 null 1
|
1005 true 0 2 5 false null 0 0 0 0 null 1
|
||||||
1006 true 0 2 1 false null 0 0 0 0 null 1
|
1006 true 0 2 1 false null 0 0 0 0 null 1
|
||||||
1007 true 0 2 3 false null 0 0 0 0 null 1
|
1007 true 0 2 3 false 0 0 0 0 null 1
|
||||||
1008 true 0 2 4 false null 0 0 0 0 null 1
|
1008 true 0 2 4 false 0 0 0 0 null 1
|
||||||
1009 true 0 2 5 false null 0 0 0 0 null 1
|
1009 true 0 2 5 false 0 0 0 0 null 1
|
||||||
1010 true 0 4 1 false null 0 0 0 0 null 1
|
1010 true 0 4 1 false null 0 0 0 0 null 1
|
||||||
1011 true 0 4 2 false null 0 0 0 0 null 1
|
1011 true 0 4 2 false null 0 0 0 0 null 1
|
||||||
1012 true 0 4 3 false null 0 0 0 0 null 1
|
1012 true 0 4 3 false null 0 0 0 0 null 1
|
||||||
|
@ -380,58 +380,58 @@ int bool int int int bool mut,int#int,1 int int int int mut,int#int,1 int
|
||||||
10050 false 1 0 3 false null 0 0 0 0 10050#3 1
|
10050 false 1 0 3 false null 0 0 0 0 10050#3 1
|
||||||
10051 false 1 0 3 false null 0 0 0 0 10051#3 1
|
10051 false 1 0 3 false null 0 0 0 0 10051#3 1
|
||||||
10052 false 1 0 3 false null 0 0 0 0 10052#3 1
|
10052 false 1 0 3 false null 0 0 0 0 10052#3 1
|
||||||
11001 true 2 5 5 false 14#1000 1 701 50 0 null 1
|
11001 true 2 5 5 false 100001 1 701 50 0 null 1
|
||||||
11002 true 2 5 5 false 14#1001 1 702 50 0 null 1
|
11002 true 2 5 5 false 100001 1 702 50 0 null 1
|
||||||
11003 true 2 5 5 false 14#1002 1 703 50 0 null 1
|
11003 true 2 5 5 false 100001 1 703 50 0 null 1
|
||||||
11004 true 2 5 5 false 14#1003 1 704 50 0 null 1
|
11004 true 2 5 5 false 100001 1 704 50 0 null 1
|
||||||
11005 true 2 5 5 false 14#1004 1 705 50 0 null 1
|
11005 true 2 5 5 false 100001 1 705 50 0 null 1
|
||||||
11006 true 2 5 5 false 14#1005 1 706 50 0 null 1
|
11006 true 2 5 5 false 100001 1 706 50 0 null 1
|
||||||
11007 true 2 5 5 false 14#1006 1 707 50 0 null 1
|
11007 true 2 5 5 false 100001 1 707 50 0 null 1
|
||||||
11008 true 2 5 5 false 14#1007 1 708 50 0 null 1
|
11008 true 2 5 5 false 100001 1 708 50 0 null 1
|
||||||
11009 true 2 5 5 false 14#1008 1 709 50 0 null 1
|
11009 true 2 5 5 false 100001 1 709 50 0 null 1
|
||||||
11010 true 2 5 5 false 14#1009 1 710 50 0 null 1
|
11010 true 2 5 5 false 100001 1 710 50 0 null 1
|
||||||
11011 true 2 5 5 false 14#1010 1 711 50 0 null 1
|
11011 true 2 5 5 false 100001 1 711 50 0 null 1
|
||||||
11012 true 2 5 5 false 14#1011 1 712 50 0 null 1
|
11012 true 2 5 5 false 100001 1 712 50 0 null 1
|
||||||
11013 true 2 5 5 false 14#1012 1 713 50 0 null 1
|
11013 true 2 5 5 false 100001 1 713 50 0 null 1
|
||||||
11014 true 2 5 5 false 14#1013 1 714 50 0 null 1
|
11014 true 2 5 5 false 100001 1 714 50 0 null 1
|
||||||
11015 true 2 5 5 false 14#1014 1 715 50 0 null 1
|
11015 true 2 5 5 false 100001 1 715 50 0 null 1
|
||||||
11016 true 2 5 5 false 14#1015 1 716 50 0 null 1
|
11016 true 2 5 5 false 100001 1 716 50 0 null 1
|
||||||
11017 true 2 5 5 false 14#1016 1 717 50 0 null 1
|
11017 true 2 5 5 false 100001 1 717 50 0 null 1
|
||||||
11018 true 2 5 5 false 14#1017 1 718 50 0 null 1
|
11018 true 2 5 5 false 100001 1 718 50 0 null 1
|
||||||
11019 true 2 5 5 false 14#1018 1 719 50 0 null 1
|
11019 true 2 5 5 false 100001 1 719 50 0 null 1
|
||||||
11020 true 2 5 5 false 14#1019 1 720 50 0 null 1
|
11020 true 2 5 5 false 100001 1 720 50 0 null 1
|
||||||
11021 true 2 5 5 false 14#1020 1 721 50 0 null 1
|
11021 true 2 5 5 false 100001 1 721 50 0 null 1
|
||||||
11022 true 2 5 5 false 14#1021 1 722 50 0 null 1
|
11022 true 2 5 5 false 100001 1 722 50 0 null 1
|
||||||
11023 true 2 5 5 false 14#1022 1 723 50 0 null 1
|
11023 true 2 5 5 false 100001 1 723 50 0 null 1
|
||||||
11024 true 2 5 4 false 14#1023 1 724 40 0 null 1
|
11024 true 2 5 4 false 100001 1 724 40 0 null 1
|
||||||
11025 true 2 5 4 false 14#1024 1 725 40 0 null 1
|
11025 true 2 5 4 false 100001 1 725 40 0 null 1
|
||||||
11026 true 2 5 4 false 14#1025 1 726 40 0 null 1
|
11026 true 2 5 4 false 100001 1 726 40 0 null 1
|
||||||
11027 true 2 5 4 false 14#1026 1 727 40 0 null 1
|
11027 true 2 5 4 false 100001 1 727 40 0 null 1
|
||||||
11028 true 2 5 4 false 14#1027 1 728 40 0 null 1
|
11028 true 2 5 4 false 100001 1 728 40 0 null 1
|
||||||
11029 true 2 5 4 false 14#1028 1 729 40 0 null 1
|
11029 true 2 5 4 false 100001 1 729 40 0 null 1
|
||||||
11030 true 2 5 4 false 14#1029 1 730 40 0 null 1
|
11030 true 2 5 4 false 100001 1 730 40 0 null 1
|
||||||
11031 true 2 5 4 false 14#1030 1 731 40 0 null 1
|
11031 true 2 5 4 false 100001 1 731 40 0 null 1
|
||||||
11032 true 2 5 4 false 14#1031 1 732 40 0 null 1
|
11032 true 2 5 4 false 100001 1 732 40 0 null 1
|
||||||
11033 true 2 5 4 false 14#1032 1 733 40 0 null 1
|
11033 true 2 5 4 false 100001 1 733 40 0 null 1
|
||||||
11034 true 2 5 4 false 14#1033 1 734 40 0 null 1
|
11034 true 2 5 4 false 100001 1 734 40 0 null 1
|
||||||
11035 true 2 5 4 false 14#1034 1 735 40 0 null 1
|
11035 true 2 5 4 false 100001 1 735 40 0 null 1
|
||||||
11036 true 2 5 4 false 14#1035 1 736 40 0 null 1
|
11036 true 2 5 4 false 100001 1 736 40 0 null 1
|
||||||
11037 true 2 5 4 false 14#1036 1 737 40 0 null 1
|
11037 true 2 5 4 false 100001 1 737 40 0 null 1
|
||||||
11038 true 2 5 4 false 14#1037 1 738 40 0 null 1
|
11038 true 2 5 4 false 100001 1 738 40 0 null 1
|
||||||
11039 true 2 5 4 false 14#1038 1 739 40 0 null 1
|
11039 true 2 5 4 false 100001 1 739 40 0 null 1
|
||||||
11040 true 2 5 4 false 14#1039 1 740 40 0 null 1
|
11040 true 2 5 4 false 100001 1 740 40 0 null 1
|
||||||
11041 true 2 5 4 false 14#1040 1 741 40 0 null 1
|
11041 true 2 5 4 false 100001 1 741 40 0 null 1
|
||||||
11042 true 2 5 4 false 14#1041 1 742 40 0 null 1
|
11042 true 2 5 4 false 100001 1 742 40 0 null 1
|
||||||
11043 true 2 5 4 false 14#1042 1 743 40 0 null 1
|
11043 true 2 5 4 false 100001 1 743 40 0 null 1
|
||||||
11044 true 2 5 4 false 14#1043 1 744 40 0 null 1
|
11044 true 2 5 4 false 100001 1 744 40 0 null 1
|
||||||
11045 true 2 5 4 false 14#1044 1 745 40 0 null 1
|
11045 true 2 5 4 false 100001 1 745 40 0 null 1
|
||||||
11046 true 2 5 4 false 14#1045 1 746 40 0 null 1
|
11046 true 2 5 4 false 100001 1 746 40 0 null 1
|
||||||
11047 true 2 5 3 false 14#1046 1 747 30 0 null 1
|
11047 true 2 5 3 false 100001 1 747 30 0 null 1
|
||||||
11048 true 2 5 3 false 14#1047 1 748 30 0 null 1
|
11048 true 2 5 3 false 100001 1 748 30 0 null 1
|
||||||
11049 true 2 5 3 false 14#1048 1 749 30 0 null 1
|
11049 true 2 5 3 false 100001 1 749 30 0 null 1
|
||||||
11050 true 2 5 3 false 14#1049 1 750 30 0 null 1
|
11050 true 2 5 3 false 100001 1 750 30 0 null 1
|
||||||
11051 true 2 5 3 false 14#1050 1 751 30 0 null 1
|
11051 true 2 5 3 false 100001 1 751 30 0 null 1
|
||||||
11052 true 2 5 3 false 14#1051 1 752 30 0 null 1
|
11052 true 2 5 3 false 100001 1 752 30 0 null 1
|
||||||
12001 true 2 5 3 false null 1 501 30 0 null 0
|
12001 true 2 5 3 false null 1 501 30 0 null 0
|
||||||
12002 true 2 5 4 false null 1 502 40 0 null 0
|
12002 true 2 5 4 false null 1 502 40 0 null 0
|
||||||
12003 true 2 5 4 false null 1 503 40 0 null 0
|
12003 true 2 5 4 false null 1 503 40 0 null 0
|
||||||
|
@ -468,4 +468,4 @@ int bool int int int bool mut,int#int,1 int int int int mut,int#int,1 int
|
||||||
13044 false 1 0 5 false null 0 0 0 0 10044#5 1
|
13044 false 1 0 5 false null 0 0 0 0 10044#5 1
|
||||||
13045 false 1 0 5 false null 0 0 0 0 10045#5 1
|
13045 false 1 0 5 false null 0 0 0 0 10045#5 1
|
||||||
13046 false 1 0 5 false null 0 0 0 0 10046#5 1
|
13046 false 1 0 5 false null 0 0 0 0 10046#5 1
|
||||||
400001 true 5 3 5 false 14#1000 1 2 1 0 null 0
|
400001 true 5 3 5 false 100001 1 2 1 0 null 0
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class SItem implements BaseConfig {
|
||||||
private int itemType;
|
private int itemType;
|
||||||
private int itemBaseType; //道具类型(该道具在哪个背包显示)
|
private int itemBaseType; //道具类型(该道具在哪个背包显示)
|
||||||
private int quantity;
|
private int quantity;
|
||||||
private int[] price;
|
private String price;
|
||||||
private int useType; //使用类型0不使用 1掉落组 2N选1
|
private int useType; //使用类型0不使用 1掉落组 2N选1
|
||||||
private int rewardGroup;
|
private int rewardGroup;
|
||||||
private int usePerCount;
|
private int usePerCount;
|
||||||
|
@ -52,7 +52,7 @@ public class SItem implements BaseConfig {
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getPrice() {
|
public String getPrice() {
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class UseAndPriceItemHandler extends BaseHandler {
|
public class UseAndPriceItemHandler extends BaseHandler {
|
||||||
|
|
||||||
|
@ -25,13 +27,16 @@ public class UseAndPriceItemHandler extends BaseHandler {
|
||||||
PlayerInfoProto.UseAndPriceItemRequest useAndPriceItemRequest
|
PlayerInfoProto.UseAndPriceItemRequest useAndPriceItemRequest
|
||||||
= PlayerInfoProto.UseAndPriceItemRequest.parseFrom(netData.parseClientProtoNetData());
|
= PlayerInfoProto.UseAndPriceItemRequest.parseFrom(netData.parseClientProtoNetData());
|
||||||
int type = useAndPriceItemRequest.getType();
|
int type = useAndPriceItemRequest.getType();
|
||||||
CommonProto.Item item = useAndPriceItemRequest.getItem();
|
List<CommonProto.Item> itemList = useAndPriceItemRequest.getItemsList();
|
||||||
if (type == 0){
|
List<String> equipIdsList = useAndPriceItemRequest.getEquipIdsList();
|
||||||
ItemLogic.getInstance().useItem(iSession,item);
|
if (type == 0){ //使用
|
||||||
}else{
|
ItemLogic.getInstance().useItem(iSession,itemList);
|
||||||
ItemLogic.getInstance().priceItem(iSession,item);
|
}else if (type == 2){ //分解装备
|
||||||
}
|
ItemLogic.getInstance().decomposeEquip(iSession,equipIdsList);
|
||||||
|
}else{// 分解道具
|
||||||
|
ItemLogic.getInstance().priceItem(iSession,itemList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -529,7 +529,8 @@ public class MapLogic {
|
||||||
targetEventId = nextEventId;
|
targetEventId = nextEventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMapMission(mapManager,EventType.updateEvent, targetEventId,0);
|
updateMapMission(mapManager,EventType.updateEvent, optionId,0);
|
||||||
|
LOGGER.info("optionId={}" ,optionId);
|
||||||
int totalWeight = updateMapMission(mapManager,EventType.updateEvent, pointId,0);
|
int totalWeight = updateMapMission(mapManager,EventType.updateEvent, pointId,0);
|
||||||
if (totalWeight >= 100) {
|
if (totalWeight >= 100) {
|
||||||
CrossInfo crossInfo = mapManager.getCrossInfoMap().get(mapManager.getCurMapId());
|
CrossInfo crossInfo = mapManager.getCrossInfoMap().get(mapManager.getCurMapId());
|
||||||
|
@ -906,7 +907,6 @@ public class MapLogic {
|
||||||
if (cell.getEventId() != -1) {
|
if (cell.getEventId() != -1) {
|
||||||
cell.setEventId(Integer.parseInt(nextEventId));
|
cell.setEventId(Integer.parseInt(nextEventId));
|
||||||
mapManager.addOrUpdateCell(triggerXY, cell);
|
mapManager.addOrUpdateCell(triggerXY, cell);
|
||||||
updateMapMission(mapManager, EventType.updateEvent, cell.getEventId(), 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
||||||
|
@ -1110,7 +1110,6 @@ public class MapLogic {
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
cell.setEventId(nextEventId);
|
cell.setEventId(nextEventId);
|
||||||
mapManager.addOrUpdateCell(triggerXY, cell);
|
mapManager.addOrUpdateCell(triggerXY, cell);
|
||||||
updateMapMission(mapManager,EventType.updateEvent,cell.getEventId(),0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
||||||
|
|
|
@ -159,12 +159,8 @@ public class MapManager extends MongoBase {
|
||||||
|
|
||||||
|
|
||||||
public void eatFood(int foodId,int remainStep){
|
public void eatFood(int foodId,int remainStep){
|
||||||
int finalRemainStep = remainStep;
|
this.foodBufferMap.put(foodId,remainStep);
|
||||||
if(this.foodBufferMap.containsKey(foodId)){
|
updateString( "foodBuffers."+foodId, remainStep);
|
||||||
finalRemainStep += this.foodBufferMap.get(foodId);
|
|
||||||
}
|
|
||||||
this.foodBufferMap.put(foodId,finalRemainStep);
|
|
||||||
updateString( "foodBuffers."+foodId, this.foodBufferMap.get(foodId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -896,7 +896,7 @@ public class HeroLogic {
|
||||||
}
|
}
|
||||||
Map<Integer,Integer> randomMap = new ConcurrentHashMap<>();
|
Map<Integer,Integer> randomMap = new ConcurrentHashMap<>();
|
||||||
randomMap.put(itemId,itemNum);
|
randomMap.put(itemId,itemNum);
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.useRandomItem(user,randomMap );
|
CommonProto.Drop.Builder drop = ItemUtil.useRandomItem(user,randomMap);
|
||||||
HeroInfoProto.HeroComposeResponse heroComposeResponse = HeroInfoProto.HeroComposeResponse
|
HeroInfoProto.HeroComposeResponse heroComposeResponse = HeroInfoProto.HeroComposeResponse
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
.setDrop(drop)
|
.setDrop(drop)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ljsd.jieling.logic.item;
|
package com.ljsd.jieling.logic.item;
|
||||||
|
|
||||||
import com.ljsd.jieling.config.*;
|
import com.ljsd.jieling.config.*;
|
||||||
|
import com.ljsd.jieling.logic.dao.Equip;
|
||||||
|
import com.ljsd.jieling.logic.dao.EquipManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
@ -8,9 +10,11 @@ import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
import com.ljsd.jieling.util.*;
|
import com.ljsd.jieling.util.*;
|
||||||
|
import com.sun.org.apache.regexp.internal.RE;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
@ -28,35 +32,35 @@ public class ItemLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 出售道具
|
* 分解道具
|
||||||
* @param iSession
|
* @param iSession
|
||||||
* @param item
|
* @param itemList
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void priceItem(ISession iSession,CommonProto.Item item) throws Exception {
|
public void priceItem(ISession iSession,List<CommonProto.Item> itemList) throws Exception {
|
||||||
int uid = iSession.getUid();
|
int uid = iSession.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
|
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
|
||||||
int itemId = item.getItemId();
|
StringBuilder cost = new StringBuilder();
|
||||||
int itemNum = item.getItemNum();
|
StringBuilder reward = new StringBuilder();
|
||||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
for (CommonProto.Item item :itemList){
|
||||||
if (sItem == null){
|
if (cost.length() == 0){
|
||||||
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
|
cost = new StringBuilder(item.getItemId() + "#" + item.getItemNum());
|
||||||
return;
|
SItem sItem = SItem.getsItemMap().get(item.getItemId());
|
||||||
|
reward = new StringBuilder(sItem.getPrice());
|
||||||
|
}else{
|
||||||
|
cost.append("|").append(item.getItemId()).append("#").append(item.getItemNum());
|
||||||
|
SItem sItem = SItem.getsItemMap().get(item.getItemId());
|
||||||
|
reward.append("#").append(sItem.getPrice());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String costItem = itemId + "#"+ itemNum;
|
int[][] costItemArr = StringUtil.parseFiledInt2(cost.toString());
|
||||||
int[][] costItemArr = StringUtil.parseFiledInt2(costItem);
|
|
||||||
boolean result = ItemUtil.itemCost(user, costItemArr);
|
boolean result = ItemUtil.itemCost(user, costItemArr);
|
||||||
if (!result){
|
if (!result){
|
||||||
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
|
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int[] prices = sItem.getPrice();
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, StringUtil.parseFiledInt(reward.toString()), 1, 0);
|
||||||
int priceItemId = prices[0];
|
|
||||||
int priceItemNum = prices[1] * itemNum;
|
|
||||||
String priceReward = priceItemId+"#"+priceItemNum;
|
|
||||||
int[][] ints = StringUtil.parseFiledInt2(priceReward);
|
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, ints);
|
|
||||||
sendUseAndPriceItemMessage(iSession, msgId, drop);
|
sendUseAndPriceItemMessage(iSession, msgId, drop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,22 +74,54 @@ public class ItemLogic {
|
||||||
/**
|
/**
|
||||||
* 使用道具
|
* 使用道具
|
||||||
* @param iSession
|
* @param iSession
|
||||||
* @param item
|
* @param itemList
|
||||||
*/
|
*/
|
||||||
public void useItem(ISession iSession, CommonProto.Item item) throws Exception {
|
public void useItem(ISession iSession,List<CommonProto.Item> itemList) throws Exception {
|
||||||
|
// int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
|
||||||
|
// int uid = iSession.getUid();
|
||||||
|
// User user = UserManager.getUser(uid);
|
||||||
|
// int itemId = item.getItemId();
|
||||||
|
// int itemNum = item.getItemNum();
|
||||||
|
// SItem sItem = SItem.getsItemMap().get(itemId);
|
||||||
|
// boolean result = ItemUtil.checkCost(user, sItem, itemNum);
|
||||||
|
// if (!result){
|
||||||
|
// MessageUtil.sendErrorResponse(iSession,0,msgId,"");
|
||||||
|
// }
|
||||||
|
// Map<Integer,Integer> randomMap = new ConcurrentHashMap<>();
|
||||||
|
// randomMap.put(itemId,itemNum);
|
||||||
|
// CommonProto.Drop.Builder drop = ItemUtil.useRandomItem(user,randomMap);
|
||||||
|
// sendUseAndPriceItemMessage(iSession, msgId, drop);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分解装备
|
||||||
|
* @param iSession
|
||||||
|
* @param equipIdsList
|
||||||
|
*/
|
||||||
|
public void decomposeEquip(ISession iSession, List<String> equipIdsList) throws Exception {
|
||||||
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
|
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
|
||||||
int uid = iSession.getUid();
|
int uid = iSession.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
int itemId = item.getItemId();
|
EquipManager equipManager = user.getEquipManager();
|
||||||
int itemNum = item.getItemNum();
|
StringBuilder reward = new StringBuilder();
|
||||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
if (equipIdsList.size() == 0){
|
||||||
boolean result = ItemUtil.checkCost(user, sItem, itemNum);
|
for (String equipId :equipIdsList){
|
||||||
if (!result){
|
Equip equip = equipManager.getEquipMap().get(equipId);
|
||||||
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
|
if (equip == null){
|
||||||
|
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SItem sItem = SItem.getsItemMap().get(equip.getEquipId());
|
||||||
|
equipManager.remove(equipId);
|
||||||
|
if (reward.length() == 0){
|
||||||
|
reward = new StringBuilder(sItem.getPrice());
|
||||||
|
}else{
|
||||||
|
reward.append("#").append(sItem.getPrice());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Map<Integer,Integer> randomMap = new ConcurrentHashMap<>();
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user,StringUtil.parseFiledInt(reward.toString()),1,0);
|
||||||
randomMap.put(itemId,itemNum);
|
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.useRandomItem(user,randomMap);
|
|
||||||
sendUseAndPriceItemMessage(iSession, msgId, drop);
|
sendUseAndPriceItemMessage(iSession, msgId, drop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.ljsd.jieling.network.server;
|
||||||
import com.google.protobuf.GeneratedMessage;
|
import com.google.protobuf.GeneratedMessage;
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
import com.google.protobuf.InvalidProtocolBufferException;
|
||||||
import com.ljsd.GameApplication;
|
import com.ljsd.GameApplication;
|
||||||
|
import com.ljsd.common.mogodb.LjsdMongoTemplate;
|
||||||
|
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||||
import com.ljsd.jieling.db.redis.RedisKey;
|
import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
|
@ -228,6 +230,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
OnlineUserManager.userOffline(session.getUid());
|
OnlineUserManager.userOffline(session.getUid());
|
||||||
User user = UserManager.getUser(session.getUid());
|
User user = UserManager.getUser(session.getUid());
|
||||||
user.getPlayerInfoManager().setOffLineTime(System.currentTimeMillis());
|
user.getPlayerInfoManager().setOffLineTime(System.currentTimeMillis());
|
||||||
|
MongoUtil.getInstence().lastUpdate();
|
||||||
// 下线处理的逻辑需要添加在这里
|
// 下线处理的逻辑需要添加在这里
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue