refactored guild and guild alliance into internal/service

This commit is contained in:
stratic-dev
2024-10-17 19:16:09 +01:00
parent fa35141f97
commit 5baff56517
11 changed files with 846 additions and 786 deletions

View File

@@ -4,6 +4,7 @@ import (
"erupe-ce/config"
"erupe-ce/internal/constant"
"erupe-ce/internal/model"
"erupe-ce/internal/service"
"erupe-ce/network/mhfpacket"
"erupe-ce/utils/byteframe"
@@ -354,10 +355,10 @@ func handleMsgMhfInfoFesta(s *Session, db *sqlx.DB, p mhfpacket.MHFPacket) {
func handleMsgMhfStateFestaU(s *Session, db *sqlx.DB, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfStateFestaU)
guild, err := GetGuildInfoByCharacterId(s, s.CharID)
guild, err := service.GetGuildInfoByCharacterId(s.CharID)
applicant := false
if guild != nil {
applicant, _ = guild.HasApplicationForCharID(s, s.CharID)
applicant, _ = guild.HasApplicationForCharID(s.CharID)
}
if err != nil || guild == nil || applicant {
s.DoAckSimpleFail(pkt.AckHandle, make([]byte, 4))
@@ -381,10 +382,10 @@ func handleMsgMhfStateFestaU(s *Session, db *sqlx.DB, p mhfpacket.MHFPacket) {
// state festa (G)uild
func handleMsgMhfStateFestaG(s *Session, db *sqlx.DB, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfStateFestaG)
guild, err := GetGuildInfoByCharacterId(s, s.CharID)
guild, err := service.GetGuildInfoByCharacterId(s.CharID)
applicant := false
if guild != nil {
applicant, _ = guild.HasApplicationForCharID(s, s.CharID)
applicant, _ = guild.HasApplicationForCharID(s.CharID)
}
resp := byteframe.NewByteFrame()
if err != nil || guild == nil || applicant {
@@ -406,7 +407,7 @@ func handleMsgMhfStateFestaG(s *Session, db *sqlx.DB, p mhfpacket.MHFPacket) {
func handleMsgMhfEnumerateFestaMember(s *Session, db *sqlx.DB, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfEnumerateFestaMember)
guild, err := GetGuildInfoByCharacterId(s, s.CharID)
guild, err := service.GetGuildInfoByCharacterId(s.CharID)
if err != nil || guild == nil {
s.DoAckSimpleFail(pkt.AckHandle, make([]byte, 4))
return
@@ -450,7 +451,7 @@ func handleMsgMhfVoteFesta(s *Session, db *sqlx.DB, p mhfpacket.MHFPacket) {
func handleMsgMhfEntryFesta(s *Session, db *sqlx.DB, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfEntryFesta)
guild, err := GetGuildInfoByCharacterId(s, s.CharID)
guild, err := service.GetGuildInfoByCharacterId(s.CharID)
if err != nil || guild == nil {
s.DoAckSimpleFail(pkt.AckHandle, make([]byte, 4))
return