public virtual bool CanPartySetting(BasePlayerCharacterEntity playerCharacterEntity, out int partyId, out PartyData party) { partyId = 0; party = null; if (playerCharacterEntity == null || !IsServer) { return(false); } partyId = playerCharacterEntity.PartyId; if (partyId <= 0 || !parties.TryGetValue(partyId, out party)) { SendServerGameMessage(playerCharacterEntity.ConnectionId, GameMessage.Type.NotJoinedParty); return(false); } if (!party.IsLeader(playerCharacterEntity)) { SendServerGameMessage(playerCharacterEntity.ConnectionId, GameMessage.Type.NotPartyLeader); return(false); } return(true); }
public bool TryGetParty(int id, out PartyData result) { return(parties.TryGetValue(id, out result)); }
public void SendPartySettingToClient(long connectionId, PartyData party) { Server.SendPartySetting(connectionId, MsgTypes.UpdateParty, party.id, party.shareExp, party.shareItem); }
public void SendChangePartyLeaderToClient(long connectionId, PartyData party) { Server.SendChangePartyLeader(connectionId, MsgTypes.UpdateParty, party.id, party.leaderId); }
public void SendCreatePartyToClient(long connectionId, PartyData party) { Server.SendCreateParty(connectionId, MsgTypes.UpdateParty, party.id, party.shareExp, party.shareItem, party.leaderId); }
public virtual bool CanKickFromParty(BasePlayerCharacterEntity playerCharacterEntity, string characterId, out int partyId, out PartyData party) { partyId = 0; party = null; if (playerCharacterEntity == null || !IsServer) { return(false); } partyId = playerCharacterEntity.PartyId; if (partyId <= 0 || !parties.TryGetValue(partyId, out party)) { SendServerGameMessage(playerCharacterEntity.ConnectionId, GameMessage.Type.NotJoinedParty); return(false); } if (party.IsLeader(characterId)) { SendServerGameMessage(playerCharacterEntity.ConnectionId, GameMessage.Type.CannotKickPartyLeader); return(false); } if (!party.CanKick(playerCharacterEntity.Id)) { SendServerGameMessage(playerCharacterEntity.ConnectionId, GameMessage.Type.CannotKickPartyMember); return(false); } if (playerCharacterEntity.Id.Equals(characterId)) { SendServerGameMessage(playerCharacterEntity.ConnectionId, GameMessage.Type.CannotKickYourSelfFromParty); return(false); } if (!party.ContainsMemberId(characterId)) { SendServerGameMessage(playerCharacterEntity.ConnectionId, GameMessage.Type.CharacterNotJoinedParty); return(false); } return(true); }
public virtual bool CanAddPartyMember(BasePlayerCharacterEntity inviteCharacterEntity, BasePlayerCharacterEntity acceptCharacterEntity, out int partyId, out PartyData party) { partyId = 0; party = null; if (inviteCharacterEntity == null || acceptCharacterEntity == null || !IsServer) { return(false); } if (acceptCharacterEntity.PartyId > 0) { SendServerGameMessage(acceptCharacterEntity.ConnectionId, GameMessage.Type.JoinedAnotherParty); return(false); } partyId = inviteCharacterEntity.PartyId; if (partyId <= 0 || !parties.TryGetValue(partyId, out party)) { SendServerGameMessage(acceptCharacterEntity.ConnectionId, GameMessage.Type.CharacterNotJoinedParty); return(false); } if (party.CountMember() >= party.MaxMember()) { SendServerGameMessage(acceptCharacterEntity.ConnectionId, GameMessage.Type.PartyMemberReachedLimit); return(false); } return(true); }