forked from a/lifeto-shop
This commit is contained in:
parent
3493ff2c19
commit
09b4dcbea9
|
@ -17,7 +17,7 @@ class Image implements ColumnInfo {
|
||||||
displayName = " "
|
displayName = " "
|
||||||
renderer = coverRenderer
|
renderer = coverRenderer
|
||||||
getter(item:TricksterItem):(string|number) {
|
getter(item:TricksterItem):(string|number) {
|
||||||
return item.image ? item.image : ""
|
return item.item_image ? item.item_image : ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ class Compound implements ColumnInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
const compFilter= (item:TricksterItem): boolean => {
|
const compFilter= (item:TricksterItem): boolean => {
|
||||||
return (item.item_desc.toLowerCase().includes("compound item"))
|
return (item.item_comment.toLowerCase().includes("compound item"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ class Desc implements ColumnInfo {
|
||||||
displayName = "desc"
|
displayName = "desc"
|
||||||
renderer = descRenderer
|
renderer = descRenderer
|
||||||
getter(item:TricksterItem):(string|number){
|
getter(item:TricksterItem):(string|number){
|
||||||
return item.item_desc
|
return item.item_comment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function descRenderer(instance:any, td:any, row:any, col:any, prop:any, value:any, cellProperties:any) {
|
function descRenderer(instance:any, td:any, row:any, col:any, prop:any, value:any, cellProperties:any) {
|
||||||
|
|
|
@ -46,7 +46,8 @@ export class LTOApiv0 implements LTOApi {
|
||||||
if(char_path.startsWith(":")) {
|
if(char_path.startsWith(":")) {
|
||||||
char_path = char_path.replace(":","")
|
char_path = char_path.replace(":","")
|
||||||
}
|
}
|
||||||
return this.s.request("GET", `item-manager/items/account/${char_path}`,undefined).then((ans:AxiosResponse)=>{
|
let type = char_path.includes("/") ? "char" : "account"
|
||||||
|
return this.s.request("GET", `v2/item-manager/items/${type}/${char_path}`,undefined).then((ans:AxiosResponse)=>{
|
||||||
const o = ans.data
|
const o = ans.data
|
||||||
log.debug("GetInventory", o)
|
log.debug("GetInventory", o)
|
||||||
let name = "bank"
|
let name = "bank"
|
||||||
|
@ -70,6 +71,7 @@ export class LTOApiv0 implements LTOApi {
|
||||||
galders,
|
galders,
|
||||||
items: Object.fromEntries((Object.entries(o.items) as any).map(([k, v]: [string, TricksterItem]):[string, TricksterItem]=>{
|
items: Object.fromEntries((Object.entries(o.items) as any).map(([k, v]: [string, TricksterItem]):[string, TricksterItem]=>{
|
||||||
v.unique_id = Number(k)
|
v.unique_id = Number(k)
|
||||||
|
console.log(k, v)
|
||||||
return [k, v]
|
return [k, v]
|
||||||
})),
|
})),
|
||||||
} as TricksterInventory
|
} as TricksterInventory
|
||||||
|
|
|
@ -117,9 +117,9 @@ export class InvalidOrder extends Order{
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BasicResponse {
|
export interface BasicResponse {
|
||||||
status: number
|
status: string
|
||||||
data: any
|
data: any
|
||||||
msg?: string
|
message?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,14 +153,14 @@ export class InternalXfer extends BasicOrder{
|
||||||
this.mark("WORKING")
|
this.mark("WORKING")
|
||||||
return api.BankAction<InternalXferRequest, InternalXferResponse>("internal-xfer-item",this.originalRequest)
|
return api.BankAction<InternalXferRequest, InternalXferResponse>("internal-xfer-item",this.originalRequest)
|
||||||
.then((x:InternalXferResponse)=>{
|
.then((x:InternalXferResponse)=>{
|
||||||
if(x.status == 200){
|
if(x.status === 'success'){
|
||||||
this.originalResponse = x
|
this.originalResponse = x
|
||||||
this.stage = 1
|
this.stage = 1
|
||||||
this.mark("SUCCESS")
|
this.mark("SUCCESS")
|
||||||
const origin_item = r.invs.value.get(this.details?.origin_path!)!.items[this.details?.item_uid!]!
|
const origin_item = r.invs.value.get(this.details?.origin_path!)!.items[this.details?.item_uid!]!
|
||||||
origin_item.item_count = origin_item.item_count - this.details?.count!
|
origin_item.item_count = origin_item.item_count - this.details?.count!
|
||||||
}else{
|
}else{
|
||||||
throw x.msg
|
throw x.message
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e)=>{
|
.catch((e)=>{
|
||||||
|
@ -207,14 +207,14 @@ export class BankItem extends BasicOrder{
|
||||||
return api.BankAction<BankItemRequest, BankItemResponse>("bank-item",this.originalRequest)
|
return api.BankAction<BankItemRequest, BankItemResponse>("bank-item",this.originalRequest)
|
||||||
.then((x)=>{
|
.then((x)=>{
|
||||||
debug("BankItem",x)
|
debug("BankItem",x)
|
||||||
if(x.status == 200){
|
if(x.status === 'success'){
|
||||||
this.stage = 1
|
this.stage = 1
|
||||||
this.originalResponse = x
|
this.originalResponse = x
|
||||||
this.mark("SUCCESS")
|
this.mark("SUCCESS")
|
||||||
const origin_item = r.invs.value.get(this.details?.origin_path!)!.items[this.details?.item_uid!]!
|
const origin_item = r.invs.value.get(this.details?.origin_path!)!.items[this.details?.item_uid!]!
|
||||||
origin_item.item_count = origin_item.item_count - this.details?.count!
|
origin_item.item_count = origin_item.item_count - this.details?.count!
|
||||||
}else {
|
}else {
|
||||||
throw x.msg ? x.msg : "unknown error"
|
throw x.message ? x.message : "unknown error"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e)=>{
|
.catch((e)=>{
|
||||||
|
@ -272,7 +272,7 @@ export class PrivateMarket extends BasicOrder{
|
||||||
return api.BankAction<PrivateMarketRequest, PrivateMarketResponse>("sell-item",this.originalRequest)
|
return api.BankAction<PrivateMarketRequest, PrivateMarketResponse>("sell-item",this.originalRequest)
|
||||||
.then((x)=>{
|
.then((x)=>{
|
||||||
debug("PrivateMarket",x)
|
debug("PrivateMarket",x)
|
||||||
if(x.status == 200){
|
if(x.status === 'success'){
|
||||||
this.stage = 1
|
this.stage = 1
|
||||||
this.originalResponse = x
|
this.originalResponse = x
|
||||||
this.mark("SUCCESS")
|
this.mark("SUCCESS")
|
||||||
|
@ -284,7 +284,7 @@ export class PrivateMarket extends BasicOrder{
|
||||||
}catch(e){
|
}catch(e){
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
throw x.msg ? x.msg : "unknown error"
|
throw x.message ? x.message : "unknown error"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e)=>{
|
.catch((e)=>{
|
||||||
|
@ -364,7 +364,7 @@ export class MarketMove extends PrivateMarket {
|
||||||
.then((x)=>{
|
.then((x)=>{
|
||||||
debug("MarketMove",x)
|
debug("MarketMove",x)
|
||||||
this.moveResponse = x
|
this.moveResponse = x
|
||||||
if(x.status == 200){
|
if(x.status === 'success'){
|
||||||
this.moveStage = 1
|
this.moveStage = 1
|
||||||
this.moveState = "SUCCESS"
|
this.moveState = "SUCCESS"
|
||||||
this.newUid = x.item_uid
|
this.newUid = x.item_uid
|
||||||
|
@ -440,7 +440,7 @@ export class MarketMoveToChar extends MarketMove {
|
||||||
.then((x)=>{
|
.then((x)=>{
|
||||||
debug("MarketMoveToChar",x)
|
debug("MarketMoveToChar",x)
|
||||||
this.charResponse = x
|
this.charResponse = x
|
||||||
if(x.status == 200){
|
if(x.status === 'success'){
|
||||||
this.charStage = 1
|
this.charStage = 1
|
||||||
this.charState = "SUCCESS"
|
this.charState = "SUCCESS"
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -122,9 +122,9 @@ export class OrderSender {
|
||||||
return notFound
|
return notFound
|
||||||
}
|
}
|
||||||
const [account, name] = splitPath(target.path)
|
const [account, name] = splitPath(target.path)
|
||||||
if(account != origin.path) {
|
/*if(account != origin.path) {
|
||||||
return new MarketMoveToChar(this.transformInternalOrder(o))
|
return new MarketMoveToChar(this.transformInternalOrder(o))
|
||||||
}
|
}*/
|
||||||
return new InternalXfer(this.transformInternalOrder(o))
|
return new InternalXfer(this.transformInternalOrder(o))
|
||||||
}
|
}
|
||||||
user_to_bank(o:OrderDetails): Order{
|
user_to_bank(o:OrderDetails): Order{
|
||||||
|
@ -134,9 +134,9 @@ export class OrderSender {
|
||||||
return notFound
|
return notFound
|
||||||
}
|
}
|
||||||
const [account, name] = splitPath(origin.path)
|
const [account, name] = splitPath(origin.path)
|
||||||
if(account != target.path) {
|
/*if(account != target.path) {
|
||||||
return new MarketMove(this.transformInternalOrder(o))
|
return new MarketMove(this.transformInternalOrder(o))
|
||||||
}
|
}*/
|
||||||
return new BankItem(this.transformInternalOrder(o))
|
return new BankItem(this.transformInternalOrder(o))
|
||||||
}
|
}
|
||||||
user_to_user(o:OrderDetails): Order{
|
user_to_user(o:OrderDetails): Order{
|
||||||
|
@ -145,7 +145,8 @@ export class OrderSender {
|
||||||
if(!(origin && target)) {
|
if(!(origin && target)) {
|
||||||
return notFound
|
return notFound
|
||||||
}
|
}
|
||||||
return new MarketMoveToChar(this.transformInternalOrder(o))
|
// return new MarketMoveToChar(this.transformInternalOrder(o))
|
||||||
|
return new InternalXfer(this.transformInternalOrder(o))
|
||||||
}
|
}
|
||||||
|
|
||||||
private transformInternalOrder(o:OrderDetails):TxnDetails {
|
private transformInternalOrder(o:OrderDetails):TxnDetails {
|
||||||
|
|
|
@ -80,7 +80,7 @@ class Image implements ColumnInfo {
|
||||||
displayName = " "
|
displayName = " "
|
||||||
renderer = coverRenderer
|
renderer = coverRenderer
|
||||||
getter(item:TricksterItem):(string|number) {
|
getter(item:TricksterItem):(string|number) {
|
||||||
return item.image ? item.image : ""
|
return item.item_image ? item.item_image : ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ class Compound implements ColumnInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
const compFilter= (item:TricksterItem): boolean => {
|
const compFilter= (item:TricksterItem): boolean => {
|
||||||
return (item.item_desc.toLowerCase().includes("compound item"))
|
return (item.item_comment.toLowerCase().includes("compound item"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ class Desc implements ColumnInfo {
|
||||||
displayName = "desc"
|
displayName = "desc"
|
||||||
renderer = descRenderer
|
renderer = descRenderer
|
||||||
getter(item:TricksterItem):(string|number){
|
getter(item:TricksterItem):(string|number){
|
||||||
return item.item_desc
|
return item.item_comment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function descRenderer(instance:any, td:any, row:any, col:any, prop:any, value:any, cellProperties:any) {
|
function descRenderer(instance:any, td:any, row:any, col:any, prop:any, value:any, cellProperties:any) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { getCookie, removeCookie } from "typescript-cookie";
|
||||||
export const SITE_ROOT = "/lifeto/"
|
export const SITE_ROOT = "/lifeto/"
|
||||||
|
|
||||||
export const API_ROOT = "api/lifeto/"
|
export const API_ROOT = "api/lifeto/"
|
||||||
export const BANK_ROOT = "item-manager-action/"
|
export const BANK_ROOT = "api/lifeto/v2/item-manager/"
|
||||||
export const MARKET_ROOT = "marketplace-api/"
|
export const MARKET_ROOT = "marketplace-api/"
|
||||||
|
|
||||||
const login_endpoint = (name:string)=>{
|
const login_endpoint = (name:string)=>{
|
||||||
|
|
|
@ -1,24 +1,18 @@
|
||||||
export interface ItemExpireTime {
|
|
||||||
text: string
|
|
||||||
us: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TricksterItem {
|
export interface TricksterItem {
|
||||||
unique_id: number;
|
unique_id: number;
|
||||||
item_name: string;
|
item_name: string;
|
||||||
item_id: number;
|
|
||||||
item_count: number;
|
item_count: number;
|
||||||
item_desc: string;
|
item_comment: string;
|
||||||
item_use: string;
|
item_use: string;
|
||||||
item_slots?: number;
|
item_slots?: number;
|
||||||
item_min_level?: number;
|
item_min_level?: number;
|
||||||
is_equip?: boolean;
|
is_equip?: boolean;
|
||||||
is_drill?: boolean;
|
is_drill?: boolean;
|
||||||
item_expire_time?: ItemExpireTime;
|
item_expire_time?: string;
|
||||||
refine_level?: number;
|
refine_level?: number;
|
||||||
refine_type?: number;
|
refine_type?: number;
|
||||||
refine_state?: number;
|
refine_state?: number;
|
||||||
image?: string;
|
item_image?: string;
|
||||||
stats?: {[key: string]:any}
|
stats?: {[key: string]:any}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue