Files
ZYZ/shared/domain/roleField/friend.ts
2021-02-02 19:48:06 +08:00

80 lines
2.0 KiB
TypeScript

import { RoleType } from "../../db/Role";
import { FriendShipType } from "../../db/FriendShip";
export class FriendParams {
roleId: string;
roleName: string;
lv: number;
headHid: number;
sHid: number;
ce: number;
title: number;
constructor(role: RoleType) {
this.roleId = role.roleId;
this.roleName = role.roleName;
this.lv = role.lv;
this.headHid = role.headHid;
this.sHid = role.sHid;
this.ce = role.ce;
this.title = role.title;
}
}
export class FriendRecommendParams extends FriendParams {
friendCnt: number = 0;
recFrdApplyCnt: number = 0;
type: number;
constructor(role: RoleType) {
super(role);
if(role.friendCnt) this.friendCnt = role.friendCnt;
if(role.recFrdApplyCnt) this.recFrdApplyCnt = role.recFrdApplyCnt;
}
setType(type: number) {
this.type = type;
}
}
export class FriendApplyParams extends FriendParams {
applyCode: string;
friendCnt: number = 0;
constructor(applyCode: string, role: RoleType) {
super(role);
this.applyCode = applyCode;
if(role.friendCnt) this.friendCnt = role.friendCnt;
}
}
export class FriendListParam extends FriendParams {
guildName: string = "";
isOnline: boolean = false;
quitTime: number = 0;
friendValue: number = 0;
friendLv: number = 1;
canReceive: boolean = false; // 初始没人送肯定不能领取
canSend: boolean = true; // 初始可以赠送
constructor(role: RoleType, friendship: FriendShipType) {
super(role);
if(role.guildName) this.guildName = role.guildName;
this.quitTime = role.quitTime;
this.friendLv = friendship.friendLv;
this.friendValue = friendship.friendValue;
}
setOnline(isOnline: boolean) {
this.isOnline = isOnline;
}
setCanReceive(canReceive: boolean) {
this.canReceive = canReceive;
}
setCanSend(canSend: boolean) {
this.canSend = canSend;
}
}