mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
提交
This commit is contained in:
parent
1b4db3c980
commit
5a58823b4e
Binary file not shown.
Binary file not shown.
@ -28,5 +28,11 @@
|
|||||||
"name": "钥匙:锻造石副本",
|
"name": "钥匙:锻造石副本",
|
||||||
"tig": "锻造石副本的钥匙",
|
"tig": "锻造石副本的钥匙",
|
||||||
"args": ""
|
"args": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 90006,
|
||||||
|
"name": "魂:一品宠物魂",
|
||||||
|
"tig": "用于宠物升星",
|
||||||
|
"args": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -38,5 +38,85 @@
|
|||||||
{
|
{
|
||||||
"grade": 10,
|
"grade": 10,
|
||||||
"merge": 512
|
"merge": 512
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 11,
|
||||||
|
"merge": 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 12,
|
||||||
|
"merge": 2048
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 13,
|
||||||
|
"merge": 4096
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 14,
|
||||||
|
"merge": 8192
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 15,
|
||||||
|
"merge": 16384
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 16,
|
||||||
|
"merge": 32768
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 17,
|
||||||
|
"merge": 65536
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 18,
|
||||||
|
"merge": 131072
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 19,
|
||||||
|
"merge": 262144
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 20,
|
||||||
|
"merge": 524288
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 21,
|
||||||
|
"merge": 1048576
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 22,
|
||||||
|
"merge": 2097152
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 23,
|
||||||
|
"merge": 4194304
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 24,
|
||||||
|
"merge": 8388608
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 25,
|
||||||
|
"merge": 16777216
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 26,
|
||||||
|
"merge": 33554432
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 27,
|
||||||
|
"merge": 67108864
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 28,
|
||||||
|
"merge": 134217728
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 29,
|
||||||
|
"merge": 268435456
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 30,
|
||||||
|
"merge": 536870912
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -32,10 +32,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 12
|
"__id__": 12
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 14
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 14
|
"__id__": 16
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@ -130,8 +133,8 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 100,
|
"width": 55.60546875,
|
||||||
"height": 40
|
"height": 50.4
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@ -173,7 +176,7 @@
|
|||||||
"_fontSize": 20,
|
"_fontSize": 20,
|
||||||
"_fontFamily": "Arial",
|
"_fontFamily": "Arial",
|
||||||
"_lineHeight": 40,
|
"_lineHeight": 40,
|
||||||
"_overflow": 1,
|
"_overflow": 0,
|
||||||
"_enableWrapText": false,
|
"_enableWrapText": false,
|
||||||
"_font": null,
|
"_font": null,
|
||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
@ -216,7 +219,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 100,
|
"width": 85.60546875,
|
||||||
"height": 40
|
"height": 40
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@ -289,7 +292,7 @@
|
|||||||
},
|
},
|
||||||
"clickEvents": [],
|
"clickEvents": [],
|
||||||
"_interactable": true,
|
"_interactable": true,
|
||||||
"_transition": 2,
|
"_transition": 3,
|
||||||
"_normalColor": {
|
"_normalColor": {
|
||||||
"__type__": "cc.Color",
|
"__type__": "cc.Color",
|
||||||
"r": 214,
|
"r": 214,
|
||||||
@ -345,6 +348,44 @@
|
|||||||
"__type__": "cc.CompPrefabInfo",
|
"__type__": "cc.CompPrefabInfo",
|
||||||
"fileId": "fdfZMrUD5LeJ3JUsm5gbF3"
|
"fileId": "fdfZMrUD5LeJ3JUsm5gbF3"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Layout",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"node": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 15
|
||||||
|
},
|
||||||
|
"_resizeMode": 1,
|
||||||
|
"_layoutType": 1,
|
||||||
|
"_cellSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 40,
|
||||||
|
"height": 40
|
||||||
|
},
|
||||||
|
"_startAxis": 0,
|
||||||
|
"_paddingLeft": 15,
|
||||||
|
"_paddingRight": 15,
|
||||||
|
"_paddingTop": 0,
|
||||||
|
"_paddingBottom": 0,
|
||||||
|
"_spacingX": 0,
|
||||||
|
"_spacingY": 0,
|
||||||
|
"_verticalDirection": 1,
|
||||||
|
"_horizontalDirection": 0,
|
||||||
|
"_constraint": 0,
|
||||||
|
"_constraintNum": 2,
|
||||||
|
"_affectedByScale": false,
|
||||||
|
"_isAlign": false,
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "baBTXQ6nBHCZceybmU4sDK"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInfo",
|
"__type__": "cc.PrefabInfo",
|
||||||
"root": {
|
"root": {
|
||||||
@ -354,6 +395,7 @@
|
|||||||
"__id__": 0
|
"__id__": 0
|
||||||
},
|
},
|
||||||
"fileId": "82Bvk1koJK0rGlT67CNSun",
|
"fileId": "82Bvk1koJK0rGlT67CNSun",
|
||||||
|
"instance": null,
|
||||||
"targetOverrides": null
|
"targetOverrides": null
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -942,8 +942,8 @@
|
|||||||
"_paddingRight": 0,
|
"_paddingRight": 0,
|
||||||
"_paddingTop": 0,
|
"_paddingTop": 0,
|
||||||
"_paddingBottom": 0,
|
"_paddingBottom": 0,
|
||||||
"_spacingX": 0,
|
"_spacingX": 5,
|
||||||
"_spacingY": 0,
|
"_spacingY": 5,
|
||||||
"_verticalDirection": 1,
|
"_verticalDirection": 1,
|
||||||
"_horizontalDirection": 0,
|
"_horizontalDirection": 0,
|
||||||
"_constraint": 0,
|
"_constraint": 0,
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -28,12 +28,12 @@ import AppAction from "./AppAction";
|
|||||||
import { Asset } from "cc";
|
import { Asset } from "cc";
|
||||||
import { Component } from "cc";
|
import { Component } from "cc";
|
||||||
|
|
||||||
// let APIPath = `http://localhost:8080`
|
let APIPath = `http://localhost:8080`
|
||||||
// let WsPath = `ws://localhost:8080/websocket`
|
let WsPath = `ws://localhost:8080/websocket`
|
||||||
// let APIPath = `http://192.168.1.23:8080`
|
// let APIPath = `http://192.168.1.23:8080`
|
||||||
// let WsPath = `ws://192.168.1.23:8080/websocket`
|
// let WsPath = `ws://192.168.1.23:8080/websocket`
|
||||||
let APIPath = `http://192.168.0.118:8080`
|
// let APIPath = `http://192.168.0.118:8080`
|
||||||
let WsPath = `ws://192.168.0.118:8080/websocket`
|
// let WsPath = `ws://192.168.0.118:8080/websocket`
|
||||||
// let APIPath = `https://api.pet.jisol.cn`
|
// let APIPath = `https://api.pet.jisol.cn`
|
||||||
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||||
|
|
||||||
|
@ -153,9 +153,7 @@ export const API = {
|
|||||||
/********** 宠物接口 ******************/
|
/********** 宠物接口 ******************/
|
||||||
GetPlayerPets: async () => RData(await app.api.get(`/game/pet/list`),false) as PlayerPetOV[], //获取玩家全部宠物
|
GetPlayerPets: async () => RData(await app.api.get(`/game/pet/list`),false) as PlayerPetOV[], //获取玩家全部宠物
|
||||||
//petId 需合成的Id pets 被合成的Id列表
|
//petId 需合成的Id pets 被合成的Id列表
|
||||||
PetUpStar: async (petId:number,pets:number[]) => RData(await app.api.post(`/game/pet/up/star`,{petId,pets}),true) as PlayerPetOV, //提升宠物星
|
PetUpStar: async (petId:number,consume:number) => RData(await app.api.post(`/game/pet/up/star/${petId}/${consume}`),true) as PlayerPetOV, //提升宠物星
|
||||||
//petId 升级的宠物Id
|
|
||||||
PetUpLevel: async (petId:number) => RData(await app.api.post(`/game/pet/up/level/${petId}`),true) as PlayerPetOV, //升级宠物
|
|
||||||
|
|
||||||
/********** 阵法接口 ******************/
|
/********** 阵法接口 ******************/
|
||||||
GetPlayerTactical: async () => RData(await app.api.get(`/game/tactical/get`),false) as PlayerTacticalOV, //获取玩家阵法
|
GetPlayerTactical: async () => RData(await app.api.get(`/game/tactical/get`),false) as PlayerTacticalOV, //获取玩家阵法
|
||||||
|
@ -26,7 +26,7 @@ export const GAPI = {
|
|||||||
//生成野怪
|
//生成野怪
|
||||||
GOnHookSpawnCreeps : async () => RProto(await app.api.get(`/game/mode/onHook/onSpawnCreeps`,{responseType:'arraybuffer'},false),GActionType.GOnHookPets) as GOnHookPets,
|
GOnHookSpawnCreeps : async () => RProto(await app.api.get(`/game/mode/onHook/onSpawnCreeps`,{responseType:'arraybuffer'},false),GActionType.GOnHookPets) as GOnHookPets,
|
||||||
//捕捉野怪
|
//捕捉野怪
|
||||||
GOnHookCatchCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onCatchCreeps/${creepId}`),true) as PlayerPetOV,
|
GOnHookCatchCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onCatchCreeps/${creepId}`),true) as boolean,
|
||||||
//出售野怪
|
//出售野怪
|
||||||
GOnHookSellCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onSellCreeps/${creepId}`),true) as boolean,
|
GOnHookSellCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onSellCreeps/${creepId}`),true) as boolean,
|
||||||
//下一关
|
//下一关
|
||||||
|
@ -98,23 +98,23 @@ export default class PlayerPetData extends BaseData{
|
|||||||
if(operation == ResourceUpdateType.UPDATE){
|
if(operation == ResourceUpdateType.UPDATE){
|
||||||
//更新资源
|
//更新资源
|
||||||
//找到需要被刷新的宠物 然后刷新 找不到则添加
|
//找到需要被刷新的宠物 然后刷新 找不到则添加
|
||||||
let pet = this.datas.filter(pet => pet.petId == resource.petId)[0];
|
let pet1 = this.datas.filter(pet => pet.petId == resource.petId)[0];
|
||||||
if(pet){
|
if(pet1){
|
||||||
//更新数据
|
//更新数据
|
||||||
Object.assign(pet,resource);
|
Object.assign(pet1,resource);
|
||||||
app.event.emit(PlayerPetEvent.UPDATE_INFO,pet)
|
app.event.emit(PlayerPetEvent.UPDATE_INFO,pet1)
|
||||||
}else{
|
}else{
|
||||||
operation = ResourceUpdateType.ADD;
|
operation = ResourceUpdateType.ADD;
|
||||||
this.onUpdateOV(operation,resource);
|
this.onUpdateOV(operation,resource);
|
||||||
}
|
}
|
||||||
}else if(operation == ResourceUpdateType.ADD){
|
}else if(operation == ResourceUpdateType.ADD){
|
||||||
//查询如果没有这个宠物则添加 负责 刷新
|
//查询如果没有这个宠物则添加 负责 刷新
|
||||||
let pet = this.datas.filter(pet => pet.petId != resource.petId)[0];
|
let pet1 = this.datas.filter(pet => pet.petId == resource.petId)[0];
|
||||||
if(!pet){
|
if(!pet1){
|
||||||
//没有则添加
|
//没有则添加
|
||||||
this.datas.push(resource);
|
this.datas.push(resource);
|
||||||
app.event.emit(PlayerPetEvent.UPDATE)
|
app.event.emit(PlayerPetEvent.UPDATE)
|
||||||
app.event.emit(PlayerPetEvent.UPDATE_ADD,pet)
|
app.event.emit(PlayerPetEvent.UPDATE_ADD,resource)
|
||||||
}else{
|
}else{
|
||||||
operation = ResourceUpdateType.UPDATE;
|
operation = ResourceUpdateType.UPDATE;
|
||||||
this.onUpdateOV(operation,resource);
|
this.onUpdateOV(operation,resource);
|
||||||
|
@ -8,9 +8,12 @@ export enum ResourceEvent{
|
|||||||
|
|
||||||
//资源类型
|
//资源类型
|
||||||
export enum ResourceType{
|
export enum ResourceType{
|
||||||
Gold = 90001, //金币
|
Gold = 90001, //金币
|
||||||
ForgedStones = 90002, //锻造石
|
ForgedStones = 90002, //锻造石
|
||||||
SpeedUp = 90003, //加速卷
|
SpeedUp = 90003, //加速卷
|
||||||
|
DungeonGold = 90004, //钥匙:金币副本
|
||||||
|
DungeonForgedStones = 90005, //钥匙:锻造石副本
|
||||||
|
Q1S = 90006, //魂:一品宠物魂
|
||||||
}
|
}
|
||||||
|
|
||||||
//资源刷新类型
|
//资源刷新类型
|
||||||
|
@ -52,8 +52,6 @@ export default class GOnHookManager extends Singleton{
|
|||||||
|
|
||||||
//需要捕捉的宠物
|
//需要捕捉的宠物
|
||||||
onHookCatchPets:TB.TbGRole[] = [];
|
onHookCatchPets:TB.TbGRole[] = [];
|
||||||
//需要主动吞噬的宠物 (主动吞噬其他 0星 宠物 升星)
|
|
||||||
onHookEngulfPets:PlayerPetOV[] = [];
|
|
||||||
|
|
||||||
//是否挂机
|
//是否挂机
|
||||||
_isOnHook:boolean = false;
|
_isOnHook:boolean = false;
|
||||||
@ -94,21 +92,6 @@ export default class GOnHookManager extends Singleton{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//自动吞噬
|
|
||||||
for (const item of this.onHookEngulfPets) {
|
|
||||||
|
|
||||||
//获取可吞噬的宠物 ( 等级0, 同类宠物, 不是自己, 不在阵法中)
|
|
||||||
let engulfs = PlayerPetData.getIns().getData()
|
|
||||||
.filter(value => (value.petStar || 0) == 0 && item.petTbId == value.petTbId && item.petId != value.petId && PlayerTacticalData.getIns().getItemIndex(value.petId) != -1)
|
|
||||||
.map(value => value.petId);
|
|
||||||
|
|
||||||
//吞噬
|
|
||||||
if(engulfs.length){
|
|
||||||
await API.PetUpStar(item.petId,engulfs);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}).bind(this))
|
}).bind(this))
|
||||||
|
|
||||||
//生成野怪
|
//生成野怪
|
||||||
@ -161,14 +144,7 @@ export default class GOnHookManager extends Singleton{
|
|||||||
//通知添加野怪被删除
|
//通知添加野怪被删除
|
||||||
app.event.emit(GOnHookManagerEvent.DEL_KILL_SREEP,creeps);
|
app.event.emit(GOnHookManagerEvent.DEL_KILL_SREEP,creeps);
|
||||||
|
|
||||||
let pet:PlayerPetOV = await GAPI.GOnHookCatchCreeps(creeps.key);
|
return !!await GAPI.GOnHookCatchCreeps(creeps.key);
|
||||||
|
|
||||||
//保存宠物
|
|
||||||
if(pet){
|
|
||||||
PlayerPetData.getIns().addPet(pet);
|
|
||||||
}
|
|
||||||
|
|
||||||
return !!pet;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,23 +4,18 @@ import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/compone
|
|||||||
import PlayerPetData, { PlayerPetEvent } from '../../data/PlayerPetData';
|
import PlayerPetData, { PlayerPetEvent } from '../../data/PlayerPetData';
|
||||||
import { API, PlayerPetOV } from '../../consts/API';
|
import { API, PlayerPetOV } from '../../consts/API';
|
||||||
import { PetOV, PlayerPetOVSelect } from '../VO/PetOV';
|
import { PetOV, PlayerPetOVSelect } from '../VO/PetOV';
|
||||||
import { PetIconSelectScroll } from '../Consts/Pet/PetIconSelectScroll';
|
|
||||||
import { NodeEventType } from 'cc';
|
|
||||||
import { Label } from 'cc';
|
import { Label } from 'cc';
|
||||||
import { app, TD } from '../../App';
|
import { app, TD } from '../../App';
|
||||||
import { GUI } from '../UIConfig';
|
|
||||||
import { ProgressBar } from 'cc';
|
|
||||||
import JProgressBar from '../../../../extensions/ngame/assets/ngame/util/components/Progress/JProgressBar';
|
import JProgressBar from '../../../../extensions/ngame/assets/ngame/util/components/Progress/JProgressBar';
|
||||||
import { Toggle } from 'cc';
|
import { Slider } from 'cc';
|
||||||
import GOnHookManager from '../../manager/battle/mode/GOnHookManager';
|
import ResourceData, { ResourceType } from '../../data/ResourceData';
|
||||||
|
import { GUI } from '../UIConfig';
|
||||||
|
import { PetPreviewWindow } from '../Consts/Pet/info/PetPreviewWindow';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('PetUpStarView')
|
@ccclass('PetUpStarView')
|
||||||
export class PetUpStarView extends JNLayerBase {
|
export class PetUpStarView extends JNLayerBase {
|
||||||
|
|
||||||
@property(JNScrollView)
|
|
||||||
views:JNScrollView; //宠物列表
|
|
||||||
|
|
||||||
@property(Label)
|
@property(Label)
|
||||||
petNameLabel:Label; //宠物名称
|
petNameLabel:Label; //宠物名称
|
||||||
@property(Label)
|
@property(Label)
|
||||||
@ -32,8 +27,27 @@ export class PetUpStarView extends JNLayerBase {
|
|||||||
@property(JProgressBar)
|
@property(JProgressBar)
|
||||||
viewPetExpProgress:JProgressBar; //预览宠物经验条
|
viewPetExpProgress:JProgressBar; //预览宠物经验条
|
||||||
|
|
||||||
@property(Toggle)
|
@property(PetPreviewWindow)
|
||||||
isEngulfToggle:Toggle; //是否主动吞噬 0 星 宠物
|
petPreview:PetPreviewWindow; //宠物显示窗口
|
||||||
|
|
||||||
|
@property(Slider)
|
||||||
|
slider:Slider; //滑块
|
||||||
|
|
||||||
|
@property(Label)
|
||||||
|
qsLabel:Label; //魂数量
|
||||||
|
|
||||||
|
//消耗数量
|
||||||
|
_consume:number = 0;
|
||||||
|
get consume(){
|
||||||
|
return Math.min(ResourceData.getIns().getValue(ResourceType.Q1S),this._consume);
|
||||||
|
}
|
||||||
|
set consume(value:number){
|
||||||
|
let max = ResourceData.getIns().getValue(ResourceType.Q1S);
|
||||||
|
this._consume = value;
|
||||||
|
//修正
|
||||||
|
this.slider.progress = this.consume / max;
|
||||||
|
this.qsLabel.string = `${ResourceData.getIns().getValue(ResourceType.Q1S) - this.consume}`
|
||||||
|
}
|
||||||
|
|
||||||
data:PlayerPetOV;
|
data:PlayerPetOV;
|
||||||
|
|
||||||
@ -45,39 +59,20 @@ export class PetUpStarView extends JNLayerBase {
|
|||||||
|
|
||||||
//监听
|
//监听
|
||||||
app.event.on(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this); //刷新宠物信息
|
app.event.on(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this); //刷新宠物信息
|
||||||
app.event.on(PlayerPetEvent.UPDATE_MINUS,this.onPetMinus,this); //减少宠物
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onJNClose(): void {
|
onJNClose(): void {
|
||||||
//取消监听
|
//取消监听
|
||||||
app.event.off(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this); //刷新宠物信息
|
app.event.off(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this); //刷新宠物信息
|
||||||
app.event.off(PlayerPetEvent.UPDATE_MINUS,this.onPetMinus,this); //减少宠物
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//刷新页面
|
//刷新页面
|
||||||
onUpdateView(){
|
onUpdateView(){
|
||||||
|
//显示选中宠物
|
||||||
|
this.petPreview.bind(this.data);
|
||||||
this.onUpdateInfo();
|
this.onUpdateInfo();
|
||||||
|
|
||||||
//当前需要升星的宠物并且未上阵 并且排除自己
|
|
||||||
let pets = PetOV.PlayerPetOVSelects(
|
|
||||||
PlayerPetData.getIns().getPetIdData(
|
|
||||||
this.data.petTbId, //同一种宠物
|
|
||||||
PlayerPetData.getIns().getNoTacticalData() //非上阵宠物
|
|
||||||
).filter(pet => pet.petId != this.data.petId) //排除自己
|
|
||||||
);
|
|
||||||
this.views.refreshData(pets);
|
|
||||||
|
|
||||||
//向子节点添加点击事件
|
|
||||||
this.views.addItemEvent(NodeEventType.TOUCH_START,this.onClickItem.bind(this));
|
|
||||||
|
|
||||||
this.onUpdateSelect();
|
|
||||||
|
|
||||||
//更新吞噬
|
|
||||||
this.isEngulfToggle.isChecked = GOnHookManager.getIns().onHookEngulfPets.indexOf(this.data) >= 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//刷新信息
|
//刷新信息
|
||||||
@ -91,37 +86,15 @@ export class PetUpStarView extends JNLayerBase {
|
|||||||
this.petStarExp.string = `升级进度: ${upStarExp} / ${this.data.petStarExp}`;
|
this.petStarExp.string = `升级进度: ${upStarExp} / ${this.data.petStarExp}`;
|
||||||
this.petExpProgress.value = this.data.petStar + (this.data.petStarExp / upStarExp);
|
this.petExpProgress.value = this.data.petStar + (this.data.petStarExp / upStarExp);
|
||||||
|
|
||||||
}
|
this.qsLabel.string = `${ResourceData.getIns().getValue(ResourceType.Q1S) - this.consume}`
|
||||||
|
|
||||||
//减少宠物
|
|
||||||
onPetMinus(pet:PlayerPetOV){
|
|
||||||
this.views.getItems<PetIconSelectScroll>().forEach(item => {
|
|
||||||
if(item.data.petId == pet.petId)
|
|
||||||
this.views.delData(item.data);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//刷新选择
|
|
||||||
onUpdateSelect(){
|
|
||||||
|
|
||||||
//刷新
|
|
||||||
this.views.getItems<PetIconSelectScroll>().forEach((item) => {
|
|
||||||
let data = item.data as PlayerPetOVSelect;
|
|
||||||
item.select.isSelect = data.isSelect;
|
|
||||||
})
|
|
||||||
|
|
||||||
this.onUpdatePreview();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新预览进度条
|
//更新预览进度条
|
||||||
onUpdatePreview(){
|
onUpdatePreview(){
|
||||||
|
|
||||||
//选择得到的经验
|
|
||||||
let exp = this.views.getItems<PetIconSelectScroll>().filter(item => item.select.isSelect).length;
|
|
||||||
|
|
||||||
let upStarExp;
|
let upStarExp;
|
||||||
let petStarExp = this.data.petStarExp + exp;
|
let petStarExp = this.data.petStarExp + this.consume;
|
||||||
let petStar = this.data.petStar;
|
let petStar = this.data.petStar;
|
||||||
|
|
||||||
while(petStarExp >= (upStarExp = TD.TbGRoleUpStar.get(petStar + 1).merge)){
|
while(petStarExp >= (upStarExp = TD.TbGRoleUpStar.get(petStar + 1).merge)){
|
||||||
@ -133,51 +106,42 @@ export class PetUpStarView extends JNLayerBase {
|
|||||||
this.petStarExp.string = `升级进度: ${upStarExp} / ${petStarExp}`;
|
this.petStarExp.string = `升级进度: ${upStarExp} / ${petStarExp}`;
|
||||||
//预览进度
|
//预览进度
|
||||||
this.viewPetExpProgress.value = petStar + (petStarExp / upStarExp);
|
this.viewPetExpProgress.value = petStar + (petStarExp / upStarExp);
|
||||||
|
this.qsLabel.string = `${ResourceData.getIns().getValue(ResourceType.Q1S) - this.consume}`
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//滑动滑块
|
||||||
|
onSliderMove(slider: Slider){
|
||||||
|
|
||||||
|
let max = ResourceData.getIns().getValue(ResourceType.Q1S);
|
||||||
|
if(!max){
|
||||||
|
this.consume = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.consume = Math.ceil(max * slider.progress);
|
||||||
|
|
||||||
|
this.onUpdatePreview();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//选择全部
|
//选择全部
|
||||||
onClickAll(){
|
onClickAll(){
|
||||||
let pets = this.views.getData<PlayerPetOVSelect>();
|
|
||||||
//如果全部选择则全部取消
|
|
||||||
if(pets.filter(pet => pet.isSelect).length == pets.length){
|
|
||||||
pets.forEach(pet => pet.isSelect = false);
|
|
||||||
}else{
|
|
||||||
pets.forEach(pet => pet.isSelect = true);
|
|
||||||
}
|
|
||||||
this.onUpdateSelect();
|
|
||||||
}
|
|
||||||
|
|
||||||
//点击Item
|
|
||||||
onClickItem(index:number){
|
|
||||||
let pets = this.views.getData<PlayerPetOVSelect>();
|
|
||||||
pets[index].isSelect = !pets[index].isSelect;
|
|
||||||
this.onUpdateSelect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//点击合成
|
//点击合成
|
||||||
async onClickUp(){
|
async onClickUp(){
|
||||||
|
|
||||||
//获取被合成的Id
|
if(!this.consume){
|
||||||
let pets = this.views.getData<PlayerPetOVSelect>().filter(pet => pet.isSelect).map(pet => pet.petId);
|
app.layer.Open(GUI.Tips,{text:"拖拽进行升星吧~"})
|
||||||
|
|
||||||
if(pets.length <= 0){
|
|
||||||
app.layer.Open(GUI.Tips,{text:"请选择需要被合成的宠物"});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await API.PetUpStar(this.data.petId,pets);
|
await API.PetUpStar(this.data.petId,this.consume);
|
||||||
|
this.consume = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//点击吞噬选择
|
|
||||||
onClickEngulfToggle(){
|
|
||||||
GOnHookManager.getIns().onHookEngulfPets.splice(GOnHookManager.getIns().onHookEngulfPets.indexOf(this.data),1);
|
|
||||||
if(this.isEngulfToggle.isChecked){
|
|
||||||
GOnHookManager.getIns().onHookEngulfPets.push(this.data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,17 +193,6 @@ export class IntoBattleView extends JNLayerBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//点击升级
|
|
||||||
async onClickUpLevel(){
|
|
||||||
if(this.index < 0){
|
|
||||||
app.layer.Open(GUI.Tips,{text:"请选择宠物."})
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await API.PetUpLevel(this.pets[this.index].petId)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.jisol.game.controller.game;
|
package cn.jisol.game.controller.game;
|
||||||
|
|
||||||
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
||||||
|
import cn.jisol.game.data.ResourceId;
|
||||||
import cn.jisol.game.data.TD;
|
import cn.jisol.game.data.TD;
|
||||||
import cn.jisol.game.entity.table.Player;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.entity.table.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerPet;
|
||||||
@ -8,7 +9,6 @@ import cn.jisol.game.service.PlayerPetService;
|
|||||||
import cn.jisol.game.service.ResourceService;
|
import cn.jisol.game.service.ResourceService;
|
||||||
import cn.jisol.game.vo.news.NewsResource;
|
import cn.jisol.game.vo.news.NewsResource;
|
||||||
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
||||||
import cn.jisol.game.vo.pet.PetUpStarOV;
|
|
||||||
import cn.jisol.ngame.util.NewsContext;
|
import cn.jisol.ngame.util.NewsContext;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -23,6 +23,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static java.awt.SystemColor.info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 玩家宠物
|
* 玩家宠物
|
||||||
*/
|
*/
|
||||||
@ -54,43 +56,30 @@ public class GPlayerPetController {
|
|||||||
//提升宠物星
|
//提升宠物星
|
||||||
@ApiImplicitParams({})
|
@ApiImplicitParams({})
|
||||||
@ApiOperation(value = "提升宠物星")
|
@ApiOperation(value = "提升宠物星")
|
||||||
@PostMapping("/up/star")
|
@PostMapping("/up/star/{petId}/{num}")
|
||||||
@Transactional
|
@Transactional
|
||||||
public NewsResource<PlayerPet> onUpStar(@RequestBody PetUpStarOV info, @CurrentPlayer Player player){
|
public NewsResource<PlayerPet> onUpStar(@CurrentPlayer Player player, @PathVariable String petId, @PathVariable Integer num){
|
||||||
|
|
||||||
//判断参数
|
//判断参数
|
||||||
if(info.getPets().size() <= 0 || Objects.isNull(info.getPetId())){
|
if(Objects.isNull(num) || num <= 0 || Objects.isNull(petId)){
|
||||||
return NewsResource.onFail("参数错误");
|
return NewsResource.onFail("参数错误");
|
||||||
}
|
}
|
||||||
|
//整理刷新数据
|
||||||
//查询被合成的宠物列表
|
ArrayList<ResourceUpdateOV> resources = new ArrayList<>();
|
||||||
//合成数量
|
|
||||||
long petCount = playerPetService.count(
|
|
||||||
Wrappers.lambdaQuery(PlayerPet.class)
|
|
||||||
.eq(PlayerPet::getPetPlayerId, player.getPlayerId())
|
|
||||||
.and(qr -> {
|
|
||||||
//遍历被合成的宠物
|
|
||||||
info.getPets().forEach(petId -> {
|
|
||||||
qr.eq(PlayerPet::getPetId, petId);
|
|
||||||
qr.or();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
if(info.getPets().size() != petCount){
|
|
||||||
return NewsResource.onFail("合成宠物信息错误");
|
|
||||||
}
|
|
||||||
|
|
||||||
//查询被升级的宠物
|
//查询被升级的宠物
|
||||||
PlayerPet pet = playerPetService.getById(info.getPetId());
|
PlayerPet pet = playerPetService.getById(petId);
|
||||||
|
|
||||||
//判断宠物是否是自己的
|
//判断宠物是否是自己的
|
||||||
if(!Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){
|
if(!Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){
|
||||||
return NewsResource.onFail("宠物不是自己的");
|
return NewsResource.onFail("宠物不是自己的");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//扣除魂
|
||||||
|
resources.add(ResourceUpdateOV.onUpdate(resourceService.addResourceValue(player.getPlayerId(), ResourceId.Q1S.id, (long) -num)));
|
||||||
|
|
||||||
//升级星
|
//升级星
|
||||||
pet.setPetStarExp(pet.getPetStarExp() + info.getPets().size());
|
pet.setPetStarExp(pet.getPetStarExp() + num);
|
||||||
|
|
||||||
//判断是否可以升下一星 如果可以则 升
|
//判断是否可以升下一星 如果可以则 升
|
||||||
int upStarExp;
|
int upStarExp;
|
||||||
@ -104,56 +93,11 @@ public class GPlayerPetController {
|
|||||||
//保存宠物信息 (保存失败则重试)
|
//保存宠物信息 (保存失败则重试)
|
||||||
if(!playerPetService.updateById(pet)) throw new RetryException("");
|
if(!playerPetService.updateById(pet)) throw new RetryException("");
|
||||||
|
|
||||||
//删除被合成的宠物
|
|
||||||
playerPetService.removeByIds(info.getPets());
|
|
||||||
|
|
||||||
//整理刷新数据
|
|
||||||
ArrayList<ResourceUpdateOV> resources = new ArrayList<>();
|
|
||||||
//刷新宠物
|
//刷新宠物
|
||||||
resources.add(ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.UPDATE,pet));
|
resources.add(ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.UPDATE,pet));
|
||||||
//删除被合成的宠物
|
|
||||||
info.getPets().forEach(item -> {
|
|
||||||
resources.add(ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.MINUS,PlayerPet.builder().petId(new Long(item)).build()));
|
|
||||||
});
|
|
||||||
|
|
||||||
return NewsResource.onSuccess("升星成功",null, resources.toArray(new ResourceUpdateOV[0]));
|
return NewsResource.onSuccess("升星成功",null, resources.toArray(new ResourceUpdateOV[0]));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// //提升宠物等级
|
|
||||||
// @ApiImplicitParams({})
|
|
||||||
// @ApiOperation(value = "提升宠物等级")
|
|
||||||
// @PostMapping("/up/level/{petId}")
|
|
||||||
// @Transactional
|
|
||||||
// public NewsResource<PlayerPet> onUpLevel(@PathVariable Integer petId, @CurrentPlayer Player player){
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// //获取需要升级的宠物
|
|
||||||
// PlayerPet pet = playerPetService.getById(petId);
|
|
||||||
// if(Objects.isNull(pet) || !Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){
|
|
||||||
// return NewsResource.onFail("你未拥有这个宠物");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// TbGRoleUpLevel resource = TD.DATA.getTbGRoleUpLevel().get(pet.getPetLevel() + 1);
|
|
||||||
//
|
|
||||||
// if(Objects.isNull(resource)) return NewsResource.onFail("无法升级");
|
|
||||||
//
|
|
||||||
// //星级不够则 无法升级
|
|
||||||
// if(pet.getPetStar() * 10 <= pet.getPetLevel()){
|
|
||||||
// return NewsResource.onFail("突破星级 可升级");
|
|
||||||
// }
|
|
||||||
// //扣除玩家材料
|
|
||||||
// ArrayList<ResourceUpdateOV> resources = new ArrayList<>(resourceService.deduct(player, resource.materials));
|
|
||||||
//
|
|
||||||
// //升级
|
|
||||||
// pet.setPetLevel(pet.getPetLevel() + 1);
|
|
||||||
//
|
|
||||||
// //保存
|
|
||||||
// if(!playerPetService.updateById(pet)) throw new RetryException("");
|
|
||||||
// resources.add(ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.UPDATE,pet)); //刷新宠物
|
|
||||||
//
|
|
||||||
// return NewsResource.onSuccess("升级成功",pet,resources.toArray(new ResourceUpdateOV[0]));
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import cn.jisol.game.vo.mode.ModeOnHookRankingOV;
|
|||||||
import cn.jisol.game.vo.news.NewsResource;
|
import cn.jisol.game.vo.news.NewsResource;
|
||||||
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
||||||
import cn.jisol.ngame.util.NewsContext;
|
import cn.jisol.ngame.util.NewsContext;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@ -228,7 +229,7 @@ public class GOnHookController {
|
|||||||
@ApiImplicitParams({})
|
@ApiImplicitParams({})
|
||||||
@ApiOperation(value = "捕捉野怪")
|
@ApiOperation(value = "捕捉野怪")
|
||||||
@PostMapping("/onCatchCreeps/{creepId}")
|
@PostMapping("/onCatchCreeps/{creepId}")
|
||||||
public NewsContext<PlayerPet> onCatchCreeps(@PathVariable String creepId,@CurrentPlayer Player player){
|
public NewsResource<Boolean> onCatchCreeps(@PathVariable String creepId,@CurrentPlayer Player player){
|
||||||
|
|
||||||
//(目前测试阶段 捕捉概率 100%)
|
//(目前测试阶段 捕捉概率 100%)
|
||||||
|
|
||||||
@ -238,22 +239,22 @@ public class GOnHookController {
|
|||||||
//如果没有则生成类
|
//如果没有则生成类
|
||||||
if(Objects.isNull(creeps)){
|
if(Objects.isNull(creeps)){
|
||||||
CREEPS.put(player.getPlayerId(),creeps = new HashMap<>());
|
CREEPS.put(player.getPlayerId(),creeps = new HashMap<>());
|
||||||
return NewsContext.onFail("捕捉失败");
|
return NewsResource.onFail("捕捉失败",false);
|
||||||
}
|
}
|
||||||
|
|
||||||
GOnHookMessage.GOnHookPet onHookPet;
|
GOnHookMessage.GOnHookPet onHookPet;
|
||||||
if(Objects.isNull(onHookPet = creeps.remove(creepId))){
|
if(Objects.isNull(onHookPet = creeps.remove(creepId))){
|
||||||
return NewsContext.onFail("捕捉失败");
|
return NewsResource.onFail("捕捉失败",false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//捕捉
|
//捕捉
|
||||||
PlayerPet pet = PlayerPet.builder().petPlayerId(player.getPlayerId()).petTbId(onHookPet.getPetTbId()).build();
|
PlayerPet pet = PlayerPet.builder().petPlayerId(player.getPlayerId()).petTbId(onHookPet.getPetTbId()).build();
|
||||||
if(playerPetService.save(pet)){
|
ResourceUpdateOV ov = playerPetService.addPlayerPet(player, pet);
|
||||||
return NewsContext.onSuccess("捕捉成功",pet);
|
if (Objects.nonNull(ov)){
|
||||||
|
return NewsResource.onSuccess("捕捉成功",true,ov);
|
||||||
}else{
|
}else{
|
||||||
return NewsContext.onFail("捕捉失败");
|
return NewsResource.onSuccess("捕捉失败",false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//排行榜
|
//排行榜
|
||||||
|
@ -8,6 +8,12 @@ public enum ResourceId {
|
|||||||
ForgedStones(90002),
|
ForgedStones(90002),
|
||||||
//加速卷
|
//加速卷
|
||||||
SpeedUp(90003),
|
SpeedUp(90003),
|
||||||
|
//钥匙:金币副本
|
||||||
|
DungeonGold(90004),
|
||||||
|
//钥匙:锻造石副本
|
||||||
|
DungeonForgedStones(90005),
|
||||||
|
//魂:一品宠物魂
|
||||||
|
Q1S(90006),
|
||||||
;
|
;
|
||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package cn.jisol.game.service;
|
package cn.jisol.game.service;
|
||||||
|
|
||||||
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.entity.table.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerPet;
|
||||||
|
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
public interface PlayerPetService extends IService<PlayerPet> {
|
public interface PlayerPetService extends IService<PlayerPet> {
|
||||||
|
|
||||||
|
//给指定的玩家添加宠物
|
||||||
|
ResourceUpdateOV addPlayerPet(Player player, PlayerPet pet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,40 @@
|
|||||||
package cn.jisol.game.service.impl;
|
package cn.jisol.game.service.impl;
|
||||||
|
|
||||||
|
import cn.jisol.game.data.ResourceId;
|
||||||
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.entity.table.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerPet;
|
||||||
|
import cn.jisol.game.entity.table.Resource;
|
||||||
import cn.jisol.game.mapper.PlayerPetMapper;
|
import cn.jisol.game.mapper.PlayerPetMapper;
|
||||||
import cn.jisol.game.service.PlayerPetService;
|
import cn.jisol.game.service.PlayerPetService;
|
||||||
|
import cn.jisol.game.service.ResourceService;
|
||||||
|
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class PlayerPetServiceImpl extends ServiceImpl<PlayerPetMapper, PlayerPet> implements PlayerPetService {
|
public class PlayerPetServiceImpl extends ServiceImpl<PlayerPetMapper, PlayerPet> implements PlayerPetService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ResourceService resourceService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceUpdateOV addPlayerPet(Player player, PlayerPet pet) {
|
||||||
|
|
||||||
|
//是否有这个宠物
|
||||||
|
long count = this.count(Wrappers.lambdaQuery(PlayerPet.class)
|
||||||
|
.eq(PlayerPet::getPetPlayerId,player.getPlayerId())
|
||||||
|
.eq(PlayerPet::getPetTbId,pet.getPetTbId()));
|
||||||
|
|
||||||
|
if(count > 0){
|
||||||
|
//如果有这个宠物则转换成材料
|
||||||
|
return ResourceUpdateOV.onUpdate(resourceService.addResourceValue(player.getPlayerId(),ResourceId.Q1S.id, 1L));
|
||||||
|
}else{
|
||||||
|
if (this.save(pet)){
|
||||||
|
return ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.ADD,pet);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
package cn.jisol.game.vo.pet;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
@ApiModel(value = "升星请求体")
|
|
||||||
@Builder
|
|
||||||
@Data
|
|
||||||
public class PetUpStarOV {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "需要升级的宠物Id", required = true)
|
|
||||||
private Integer petId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "被吸收的宠物列表", required = true)
|
|
||||||
ArrayList<Integer> pets;
|
|
||||||
|
|
||||||
}
|
|
@ -28,5 +28,11 @@
|
|||||||
"name": "钥匙:锻造石副本",
|
"name": "钥匙:锻造石副本",
|
||||||
"tig": "锻造石副本的钥匙",
|
"tig": "锻造石副本的钥匙",
|
||||||
"args": ""
|
"args": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 90006,
|
||||||
|
"name": "魂:一品宠物魂",
|
||||||
|
"tig": "用于宠物升星",
|
||||||
|
"args": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -38,5 +38,85 @@
|
|||||||
{
|
{
|
||||||
"grade": 10,
|
"grade": 10,
|
||||||
"merge": 512
|
"merge": 512
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 11,
|
||||||
|
"merge": 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 12,
|
||||||
|
"merge": 2048
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 13,
|
||||||
|
"merge": 4096
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 14,
|
||||||
|
"merge": 8192
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 15,
|
||||||
|
"merge": 16384
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 16,
|
||||||
|
"merge": 32768
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 17,
|
||||||
|
"merge": 65536
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 18,
|
||||||
|
"merge": 131072
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 19,
|
||||||
|
"merge": 262144
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 20,
|
||||||
|
"merge": 524288
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 21,
|
||||||
|
"merge": 1048576
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 22,
|
||||||
|
"merge": 2097152
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 23,
|
||||||
|
"merge": 4194304
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 24,
|
||||||
|
"merge": 8388608
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 25,
|
||||||
|
"merge": 16777216
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 26,
|
||||||
|
"merge": 33554432
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 27,
|
||||||
|
"merge": 67108864
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 28,
|
||||||
|
"merge": 134217728
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 29,
|
||||||
|
"merge": 268435456
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"grade": 30,
|
||||||
|
"merge": 536870912
|
||||||
}
|
}
|
||||||
]
|
]
|
Loading…
x
Reference in New Issue
Block a user