Exemplo n.º 1
0
 public static bool CreateClan(Clan clan, ClanMember member)
 {
     try {
     Database.Query("INSERT INTO Clans (Name, Owner, InviteMode, ChatColor, Bans) VALUES (@0, @1, @2, @3, @4)", clan.Name, clan.Owner, (int)InviteMode.False, Config.DefaultChatColor, "[]");
     Clans.Add(clan.Name, clan);
     JoinClan(clan, member);
     ClanHooks.OnClanCreated(getClanMember(member.Name), clan.Name);
     return true;
       }
       catch (Exception ex) {
     TShock.Log.Error(ex.ToString());
     return false;
       }
 }
Exemplo n.º 2
0
 public static bool JoinClan(Clan clan, ClanMember member)
 {
     try {
     if (ClanMembers.ContainsKey(member.UserID)) {
       ClanMembers[member.UserID] = member;
     } else {
       ClanMembers.Add(member.UserID, member);
     }
     Database.Query("INSERT INTO ClanMembers (UserID, PlayerName, ClanName) VALUES (@0, @1, @2)", member.UserID, member.Name, clan.Name);
     if (member.Name != clan.Owner)
       ClanHooks.OnClanJoin(member, clan);
     UpdateTag(clan, clan.Tag);
     return true;
       }
       catch (Exception ex) {
     TShock.Log.Error(ex.ToString());
     return false;
       }
 }
Exemplo n.º 3
0
        public static void LeaveClan(Clan clan, ClanMember member)
        {
            try {
            ClanHooks.OnClanLeave(member, clan);
            if (member.Name == clan.Owner) {
              ClanHooks.OnClanRemoved(clan);
              RemoveClan(clan);
            }
            else {
              Database.Query("DELETE FROM ClanMembers WHERE UserID = @0 AND ClanName = @1", member.UserID, clan.Name);
            }

            if (ClanMembers.ContainsKey(member.UserID))
              ClanMembers.Remove(member.UserID);
            UserSpecificFunctions.UserSpecificFunctions.LatestInstance.removeUserSuffix(member.UserID);
              }
              catch (Exception ex) {
            TShock.Log.Error(ex.ToString());
              }
        }
Exemplo n.º 4
0
 public static bool InsertBan(Clan clan, ClanMember member)
 {
     if (clan.Bans.Contains(member.Name))
     return false;
       clan.Bans.Add(member.Name);
       LeaveClan(clan, member);
       UpdateBans(clan);
       return true;
 }