商店修改

lvxinran 2020-10-29 04:57:51 +08:00
parent 4ff51ce551
commit 34f3d40ee4
2 changed files with 19 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.question.QuestionLogic;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
@ -167,6 +168,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
}
});
}
StoreLogic.reloadStoreInfo(user,7);//重载功能商店
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse
= PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
.setPlayer(player)

View File

@ -757,6 +757,23 @@ public class StoreLogic implements IEventHandler {
}
}
public static void reloadStoreInfo(User user,int type){
Map<Integer, StoreInfo> storeInfoMap = user.getStoreManager().getStoreInfoMap();
if(!storeInfoMap.containsKey(type)){
return;
}
Map<Integer, List<SStoreConfig>> configMap = SStoreConfig.getSstoreConfigBuyStore();
List<SStoreConfig> sStoreConfigs = configMap.get(type);
for(SStoreConfig config:sStoreConfigs){
if(user.getStoreManager().getStoreInfoMap().get(type).getItemNumMap().containsKey(config.getId())){
continue;
}
Map<Integer, Integer> itemNumMap = user.getStoreManager().getStoreInfoMap().get(type).getItemNumMap();
itemNumMap.put(config.getId(),0);
user.getStoreManager().getStoreInfoMap().get(type).setItemNumMap(itemNumMap);
}
}
@Override
public void onEvent(IEvent event) throws Exception {
if(!(event instanceof FunctionRefreshEvent)){