54 lines
1.4 KiB
Go
54 lines
1.4 KiB
Go
package logic
|
|
|
|
import (
|
|
"ecs/proto/pb"
|
|
"fmt"
|
|
)
|
|
|
|
type PlayerContact struct {
|
|
Key string `bson:"key" key:"1"`
|
|
ServerId uint32 `bson:"server_id"`
|
|
RoleId uint64 `bson:"role_id"`
|
|
UserId uint64 `bson:"user_id"`
|
|
Type uint32 `bson:"type"`
|
|
ServerArea string `bson:"server_area"`
|
|
ServerName string `bson:"server_name"`
|
|
RoleName string `bson:"role_name"`
|
|
Capacity uint64 `bson:"capacity"`
|
|
Corps string `bson:"corps"`
|
|
Mining string `bson:"mining"`
|
|
Hatred uint32 `bson:"hatred"`
|
|
}
|
|
|
|
func (this *PlayerContact) BuildMsgContact() *pb.Contact {
|
|
return &pb.Contact{
|
|
ServerId: this.ServerId,
|
|
RoleId: this.RoleId,
|
|
UserId: this.UserId,
|
|
Type: pb.ContactType(this.Type),
|
|
ServerArea: this.ServerArea,
|
|
ServerName: this.ServerName,
|
|
RoleName: this.RoleName,
|
|
Capacity: this.Capacity,
|
|
Corps: this.Corps,
|
|
Mining: this.Mining,
|
|
Hatred: this.Hatred,
|
|
}
|
|
}
|
|
|
|
func (this *Player) ContactKey(serverId uint32, roleId uint64) string {
|
|
return fmt.Sprint(serverId, ":", roleId)
|
|
}
|
|
|
|
func (this *Player) AddContact(target *Player, areaConfig *AreaConfig) {
|
|
|
|
}
|
|
|
|
func (this *Player) BuildMsgContactListAck() *pb.ContactListAck {
|
|
var contactList []*pb.Contact
|
|
for _, contact := range this.Contact {
|
|
contactList = append(contactList, contact.BuildMsgContact())
|
|
}
|
|
return &pb.ContactListAck{ContactList: contactList}
|
|
}
|