Пример #1
0
        public static void HandleClanCreation(Client client, Message message)
        {
            if (message.BytesAvaible >= 20)
            {
                var clanName = message.GetString(20);

                var thisClan = Clan.thisClan.FirstOrDefault(x => x.name == clanName);
                if (thisClan == null)
                {
                    if (client.account.char_level >= 10)
                    {
                        if (client.account.char_gamecash >= 2000)
                        {
                            client.account.char_gamecash -= 2000;
                            client.account.char_clanname  = clanName;

                            Clan.AddClanToDatabase((Clan.getClanCount()), clanName, 1, 0, "", $"{client.account.char_name},2|", 0);

                            client.Send(new BM_SC_CREATE_CLAN(clanName));
                            client.Send(new BM_SC_CREATE_CLAN_RESULT("guild_create_success"));
                            client.Send(new BM_SC_BALANCE_INFO(client.account.char_gamecash, client.account.char_coin, client.account.char_cash, client.account.char_questpoint));

                            Log.WriteLog(Log.Type.Info, "'{0}' created clan '{1}'", client.account.char_name, clanName);
                        }
                        else
                        {
                            client.Send(new BM_SC_CREATE_CLAN_RESULT("B_NOT_ENOUGH_GAME_MONEY"));
                        }
                    }
                    else
                    {
                        client.Send(new BM_SC_CREATE_CLAN_RESULT("guild_create_level"));
                    }
                    client.account?.UpdateAccount();
                }
                else
                {
                    client.Send(new BM_SC_CREATE_CLAN_RESULT("guild_exist"));
                }
            }
        }