コード例 #1
0
        private void SetupWorldClient(byte[] encryptionKey, uint accountId, ulong timestamp)
        {
            WorldClient = new WorldClient(encryptionKey, accountId, timestamp, SocketFactory);
            WorldClient.OnConnectSuccess         += GenerateEventHandler <EventArgs>(HandleWorldConnectSuccess);
            WorldClient.OnDisconnect             += GenerateEventHandler <EventArgs>(HandleWorldDisconnect);
            WorldClient.OnWorldEnterSuccess      += GenerateEventHandler <FinalWorldEnterData>(HandleWorldEnterSuccess);
            WorldClient.OnInstanceListSuccess    += GenerateEventHandler <List <InstanceInfo> >(HandleInstanceListSuccess);
            WorldClient.OnDistrictListSuccess    += GenerateEventHandler <List <DistrictInfo> >(HandleDistrictListSuccess);
            WorldClient.OnDistrictReserveSuccess += GenerateEventHandler <ReserveInfo>(HandleDistrictReserveSuccess);
            WorldClient.OnDistrictReserveFailed  += GenerateEventHandler <int>(HandleDistrictReserveFailed);
            WorldClient.OnDistrictEnterSuccess   += GenerateEventHandler <DistrictEnterInfo>(HandleDistrictEnterSuccess);
            WorldClient.OnDistrictEnterFailed    += GenerateEventHandler <int>(HandleDistrictEnterFailed);
            WorldClient.OnGetClanInfoSuccess     += GenerateEventHandler <ClanInfo>(HandleGetClanInfoSuccess);
            WorldClient.OnGetClanMOTDSuccess     += GenerateEventHandler <string>(HandleGetClanMOTDSuccess);
            WorldClient.OnGetFriendlistSuccess   += GenerateEventHandler <FriendlistInfo>(HandleGetFriendlistSuccess);
            WorldClient.OnGetIgnorelistSuccess   += GenerateEventHandler <IgnorelistInfo>(HandleGetIgnorelistSuccess);
            WorldClient.OnGetChallengesSuccess   += GenerateEventHandler <ChallengesInfo>(HandleGetChallengesSuccess);
            WorldClient.OnGetVoiceChannelSuccess += GenerateEventHandler <VoiceChannelInfo>(HandleGetVoiceChannelSuccess);
            WorldClient.OnGetMailInfoSuccess     += GenerateEventHandler <MailInfo>(HandleGetMailInfoSuccess);

            DistrictMap  = null;
            ClanInfo     = null;
            ClanMOTD     = null;
            Friends      = null;
            Ignores      = null;
            Challenges   = null;
            VoiceChannel = null;
            MailInfo     = null;
        }
コード例 #2
0
        /// <summary>
        /// Создает лидера клана
        /// </summary>
        private void CreateLeader(ClanInfo clanInfo)
        {
            var ped = _pointCreator.CreatePed(
                clanInfo.LeaderHash, clanInfo.LeaderName, clanInfo.LeaderPosition,
                clanInfo.LeaderRotation, clanInfo.LeaderMarker, Colors.VividCyan
                );

            if (clanInfo.ClanId == 3)
            {
                var bitches = API.createPed(PedHash.Tanisha, new Vector3(-124.01, -642.23, 168.82), 0);
                API.setEntityRotation(bitches, new Vector3(0.00, 0.00, 41.92));
            }
            ped.ColShape.onEntityEnterColShape += (shape, entity) => {
                PlayerHelper.ProcessAction(entity, player => {
                    if (!HasRight(player, clanInfo.ClanId, ClanRank.Lowest))
                    {
                        return;
                    }
                    API.triggerClientEvent(
                        player, ServerEvent.SHOW_CLAN_LEADER_MENU, (int)clanInfo.ClanId,
                        ClanMissionManager.GetMissionVotes(clanInfo.ClanId),
                        ClanManager.GetAuthority(clanInfo.ClanId)
                        );
                });
            };
            ped.ColShape.onEntityExitColShape += (shape, entity) => {
                var player = API.getPlayerFromHandle(entity);
                API.triggerClientEvent(player, ServerEvent.HIDE_CLAN_LEADER_MENU);
            };
        }
コード例 #3
0
        /// <summary>
        /// Создать гардероб
        /// </summary>
        private void CreateDressingRoom(ClanInfo clanInfo)
        {
            var dressing = _pointCreator.CreateMarker(Marker.VerticalCylinder, clanInfo.DressingMarker, Colors.VividCyan, 1.3f, "Гардероб");

            dressing.ColShape.onEntityEnterColShape += (shape, entity) => PlayerHelper.ProcessAction(entity, player => {
                if (!HasRight(player, clanInfo.ClanId, ClanRank.Low))
                {
                    return;
                }
                var playerInfo = _playerInfoManager.GetInfo(player);
                var clothes    = CopyHelper.DeepCopy(playerInfo.Clothes);
                var isMale     = playerInfo.Skin == Skin.Male;
                foreach (var clanClothes in ClanDataGetter.GetClanClothes(clanInfo.ClanId, isMale))
                {
                    if (clothes.Any(e => e.Variation == clanClothes.Variation && e.Slot == clanClothes.Slot))
                    {
                        continue;
                    }
                    clothes.Add(clanClothes);
                }
                API.triggerClientEvent(
                    player, ServerEvent.SHOW_CLOTHES_MENU, 0,
                    JsonConvert.SerializeObject(clanInfo.DressingRoomPositions),
                    JsonConvert.SerializeObject(clothes), (int)Validator.INVALID_ID
                    );
            });
            dressing.ColShape.onEntityExitColShape += (shape, entity) =>
                                                      PlayerHelper.ProcessAction(entity, player => {
                if (HasRight(player, clanInfo.ClanId, ClanRank.Low))
                {
                    API.triggerClientEvent(player, ServerEvent.HIDE_CLOTHES_MENU);
                }
            }
                                                                                 );
        }
コード例 #4
0
        public async void NameTagClanLevelAreCorrect()
        {
            var testClanInfo = new ClanInfo();
            await testClanInfo.GetClanInfoWithRest();

            Assert.Equal("Nuke", testClanInfo.Name);
            Assert.Equal("#GC9L8QR", testClanInfo.Tag);
            Assert.Equal(12, testClanInfo.ClanLevel);
        }
コード例 #5
0
        static async Task Main(string[] args)
        {
            var clanInfo = new ClanInfo();
            await clanInfo.GetClanInfoWithRest();

            Console.WriteLine($"ClanInfo -- {DateTime.Now}\nClanName: {clanInfo.Name}\nClanTag: {clanInfo.Tag}\nClanLevel: {clanInfo.ClanLevel}" +
                              $"\nMember Count: {clanInfo.MemberCount}");
            Console.WriteLine("----------------------------------");

            var playerInfo = new PlayerInfo();

            playerInfo.PrintPlayers(StaticVariables.ClanTag);

            Console.ReadKey();
        }
コード例 #6
0
 public bool DeepEquals(GroupV2Card?other)
 {
     return(other is not null &&
            GroupId == other.GroupId &&
            Name == other.Name &&
            GroupType == other.GroupType &&
            CreationDate == other.CreationDate &&
            About == other.About &&
            Motto == other.Motto &&
            MemberCount == other.MemberCount &&
            Locale == other.Locale &&
            MembershipOption == other.MembershipOption &&
            Capabilities == other.Capabilities &&
            (ClanInfo is not null ? ClanInfo.DeepEquals(other.ClanInfo) : other.ClanInfo is null) &&
            AvatarPath == other.AvatarPath &&
            Theme == other.Theme);
 }
コード例 #7
0
        public static void Load(ReceiveGPacket p)
        {
            long playerId = p.readQ(),
                 memberId;
            int     type   = p.readC();
            Account player = AccountManager.getInstance().getAccount(playerId, true);

            if (player == null)
            {
                return;
            }

            if (type == 0)
            {
                ClanInfo.ClearList(player);
            }
            else if (type == 1)
            {
                memberId = p.readQ();
                string  name   = p.readS(p.readC());
                byte[]  status = p.readB(4);
                byte    rank   = p.readC();
                Account member = new Account
                {
                    player_id   = memberId,
                    player_name = name,
                    _rank       = rank
                };
                member._status.SetData(status, memberId);
                ClanInfo.AddMember(player, member);
            }
            else if (type == 2)
            {
                memberId = p.readQ();
                ClanInfo.RemoveMember(player, memberId);
            }
            else if (type == 3)
            {
                int clanId     = p.readD();
                int clanAccess = p.readC();
                player.clan_id    = clanId;
                player.clanAccess = clanAccess;
            }
        }
コード例 #8
0
ファイル: Net_Clan_Sync.cs プロジェクト: ProjectsPZ/PB0.1
        public static void Load(ReceiveGPacket p)
        {
            long    id1     = p.readQ();
            int     num1    = (int)p.readC();
            Account account = AccountManager.getInstance().getAccount(id1, true);

            if (account == null)
            {
                return;
            }
            switch (num1)
            {
            case 0:
                ClanInfo.ClearList(account);
                break;

            case 1:
                long    pId    = p.readQ();
                string  str    = p.readS((int)p.readC());
                byte[]  buffer = p.readB(4);
                byte    num2   = p.readC();
                Account member = new Account()
                {
                    player_id   = pId,
                    player_name = str,
                    _rank       = (int)num2
                };
                member._status.SetData(buffer, pId);
                ClanInfo.AddMember(account, member);
                break;

            case 2:
                long id2 = p.readQ();
                ClanInfo.RemoveMember(account, id2);
                break;

            case 3:
                int num3 = p.readD();
                int num4 = (int)p.readC();
                account.clan_id    = num3;
                account.clanAccess = num4;
                break;
            }
        }
コード例 #9
0
    internal async Task <Clan> UpdateClanInfoAsync(ApiDbContext context, uint clanId, Clan clan, CancellationToken ct)
    {
        ClanInfo apiClan = (await _clansApi.FetchClanViewAsync(clanId, ct))?.Clan;

        clan = clan is null
                        ? apiClan?.Adapt <Clan>()
                        : clan with
        {
            Tag         = apiClan.Tag,
            Name        = apiClan.Name,
            Description = apiClan.Description,
            LeagueColor = (uint)ColorTranslator.FromHtml(apiClan.Color).ToArgb()
        };

        clan !.UpdatedAt = DateTime.UtcNow;
        await context.Clans.Upsert(clan).RunAsync(ct);

        return(clan);
    }
コード例 #10
0
        public LoginMessageServer()
        {
            ServerStatusCode = LoginStatusCode.Success;
            Permissions      = PermissionStatus.Normal;

            Clan = new ClanInfo
            {
                Id       = -1,
                Name     = "NULL",
                Rank     = -1,
                UserRank = -1,
            };

            ClanBattle = new ClanBattleInfo
            {
                Key      = "0",
                ServerId = 0
            };
        }
コード例 #11
0
        /// <summary>
        /// Создает админа на ресепшене
        /// </summary>
        private void CreateAdmin(ClanInfo clanInfo)
        {
            var ped = _pointCreator.CreatePed(
                clanInfo.AdminHash, "Администратор", clanInfo.AdminPosition,
                clanInfo.AdminRotation, clanInfo.AdminMarker, Colors.VividCyan
                );

            ped.ColShape.onEntityEnterColShape += (shape, entity) =>
                                                  PlayerHelper.ProcessAction(entity, player => {
                var playerInfo = _playerInfoManager.GetInfo(player);
                if (playerInfo.Clan != null && playerInfo.Clan.ClanId != clanInfo.ClanId)
                {
                    API.sendColoredNotificationToPlayer(player, "Вы состоите в другой банде", 0, 6, true);
                    return;
                }
                API.triggerClientEvent(player, ServerEvent.SHOW_CLAN_MENU, (int)clanInfo.ClanId);
            });
            ped.ColShape.onEntityExitColShape += (shape, entity) =>
                                                 PlayerHelper.ProcessAction(entity, player => API.triggerClientEvent(player, ServerEvent.HIDE_CLAN_MENU));
        }
コード例 #12
0
        /// <summary>
        /// Создает оружейника
        /// </summary>
        private void CreateGunsmith(ClanInfo clanInfo)
        {
            var ped = _pointCreator.CreatePed(
                clanInfo.GunsmithHash, "Оружейник", clanInfo.GunsmithPosition,
                clanInfo.GunsmithRotation, clanInfo.GunsmithMarker, Colors.VividCyan
                );

            ped.ColShape.onEntityEnterColShape += (shape, entity) => PlayerHelper.ProcessAction(entity, player => {
                if (!HasRight(player, clanInfo.ClanId, ClanRank.Middle))
                {
                    return;
                }
                API.triggerClientEvent(player, ServerEvent.SHOW_AMMU_NATION_MENU,
                                       JsonConvert.SerializeObject(ClanDataGetter.Weapons),
                                       JsonConvert.SerializeObject(ClanDataGetter.Ammo),
                                       (int)Validator.INVALID_ID
                                       );
            });
            ped.ColShape.onEntityExitColShape += (shape, entity) =>
                                                 PlayerHelper.ProcessAction(entity, player => API.triggerClientEvent(player, ServerEvent.HIDE_AMMU_NATION_MENU));
        }
コード例 #13
0
        public JoinServerMessageServer()
        {
            ServerName = "JAWE_PRE_ALPHA-0.0.1";
            Status     = JoinServerStatus.Success;

            Clan = new ClanInfo
            {
                Id       = -1,
                Name     = "NULL",
                Rank     = -1,
                UserRank = -1,
            };

            SlotStates = "F,F,F,F";

            Equipment = new EquipmentList(new[]
            {
                "DA02,DB01,^,^,^,^,^,^",
                "DA02,DB01,^,^,^,^,^,^",
                "DA02,DB01,^,^,^,^,^,^",
                "DA02,DB01,^,^,^,^,^,^",
                "DA02,DB01,^,^,^,^,^,^",
            });

            Inventory = "^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^";

            Characters = new EquipmentList(new[]
            {
                "BA01,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^",
                "BA02,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^",
                "BA03,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^",
                "BA04,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^",
                "BA05,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^",
            });

            CharacterInventory = "^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^";
            AiState            = AiServerType.Disabled;
        }
コード例 #14
0
        /// <summary>
        /// Создает автомеханика
        /// </summary>
        private void CreateMechanic(ClanInfo clanInfo)
        {
            var ped = _pointCreator.CreatePed(
                clanInfo.MechHash, "Механик", clanInfo.MechPosition,
                clanInfo.MechRotation, clanInfo.MechMarker, Colors.VividCyan
                );

            ped.ColShape.onEntityEnterColShape += (shape, entity) => PlayerHelper.ProcessAction(entity, player => {
                if (!HasRight(player, clanInfo.ClanId, ClanRank.Middle))
                {
                    return;
                }
                API.triggerClientEvent(player, ServerEvent.SHOW_SHOWROOM_MENU,
                                       JsonConvert.SerializeObject(ClanDataGetter.ClanVehicles[clanInfo.ClanId]),
                                       GetPlayerVehiclesData(player),
                                       JsonConvert.SerializeObject(ClanDataGetter.ClanVehicleShowroom[clanInfo.ClanId]),
                                       (int)ShowroomType.Clan, (int)Validator.INVALID_ID
                                       );
            });
            ped.ColShape.onEntityExitColShape += (shape, entity) => PlayerHelper.ProcessAction(entity, player => {
                API.triggerClientEvent(player, ServerEvent.HIDE_SHOWROOM_MENU);
            });
        }
コード例 #15
0
        static async Task MainTask(string[] args)
        {
            string token = WargaminAPI.Enigma.Decrypt(resourceMan.GetString("DisToken"), PHRASE);

            discord = new DiscordClient(new DiscordConfiguration
            {
                Token                 = token,
                TokenType             = TokenType.Bot,
                UseInternalLogHandler = true,
                LogLevel              = LogLevel.Debug
            });

            discord.MessageCreated += async e =>
            {
                string message = e.Message.Content;
                if (message.StartsWith("&"))
                {
                    if (message.ToLower().StartsWith(HELP))
                    {
                        string helpMsg = e.Author.Mention + "```css\nПомните: [] - обязательный параметр  \n" +
                                         "&stats_player [type_of_game] [your_nick] - показывает вашу статистику\n" +
                                         "&clan [type_of_game] [clan_name] - показывает инфу про клан\n" +
                                         "Где [type_of_game] - список игр варгейминг:\n" +
                                         "- WoT\n- WoW\n ```";
                        await e.Message.RespondAsync(helpMsg);
                    }
                    else
                    {
                        string typeOfGame = parseTypeOfGame(message);
                        if (typeOfGame == null || typeOfGame == "")
                        {
                            await e.Message.RespondAsync(e.Author.Mention + ",\nВы не указали, какая игра. Введите &help для помощи.");
                        }
                        else if (typeOfGame.ToLower() == "wow")
                        {
                            await e.Message.RespondAsync(e.Author.Mention + ",\nВ связи с тем, что разработчики по неизвестным причинам " +
                                                         "сделали очень скудный набор публичный данных для разработчиков, адекватную статистику для WoWS сделать невозможно!\n");
                        }
                        else if (typeOfGame.ToLower() == "wot")
                        {
                            PlayerInfo operations = new PlayerInfo();

                            if (message.ToLower().StartsWith(STAT_PLAYER))
                            {
                                string playerNickname = parseName(message, STAT_PLAYER, typeOfGame, true);
                                Player currentPlayer  = new Player();
                                bool   foundPlayer    = false;
                                try
                                {
                                    currentPlayer = operations.FindPlayer(playerNickname);
                                    foundPlayer   = true;
                                }
                                catch (PlayerNotFound ex)
                                {
                                    await e.Message.RespondAsync(ex.Message);
                                }
                                catch
                                {
                                    string infoMsg = e.Author.Mention + "Напишите GRAF или hunterlan об ошибке и пропишите все ваши действия.";
                                    await e.Message.RespondAsync(infoMsg);
                                }
                                if (foundPlayer)
                                {
                                    Statistics playerStatistics = operations.GetStatistic(currentPlayer);
                                    await e.Message.RespondAsync(e.Author.Mention + "\n```Игрок: " + currentPlayer.ToString() +
                                                                 "  \n" + playerStatistics.ToString() + "```");
                                }
                            }
                            else if (message.ToLower().StartsWith(INFO_CLAN))
                            {
                                ClanInfo ops  = new ClanInfo();
                                ClanWoT  clan = new ClanWoT();
                                clan.ClanName = parseName(message, INFO_CLAN, typeOfGame, false);
                                try
                                {
                                    ops.GetClan(clan);
                                }
                                catch (ClanNotFound ex)
                                {
                                    await e.Message.RespondAsync(e.Author.Mention + "\n" + ex.Message);
                                }
                                catch
                                {
                                    string infoMsg = e.Author.Mention + "\nНапишите GRAF или hunterlan об ошибке и пропишите все ваши действия.";
                                    await e.Message.RespondAsync(infoMsg);
                                }
                                try
                                {
                                    ops.GetStat(clan);
                                    await e.Message.RespondAsync(e.Author.Mention + clan.ToString());
                                }
                                catch (ClanNotFound ex)
                                {
                                    await e.Message.RespondAsync(e.Author.Mention + "\n" + ex.Message);
                                }
                                catch
                                {
                                    string infoMsg = e.Author.Mention + "\nНапишите GRAF или hunterlan об ошибке и пропишите все ваши действия.";
                                    await e.Message.RespondAsync(infoMsg);
                                }
                            }
                        }
                    }
                }
            };

            await discord.ConnectAsync();

            await Task.Delay(-1);
        }
コード例 #16
0
 public void Update(GroupV2Card?other)
 {
     if (other is null)
     {
         return;
     }
     if (GroupId != other.GroupId)
     {
         GroupId = other.GroupId;
         OnPropertyChanged(nameof(GroupId));
     }
     if (Name != other.Name)
     {
         Name = other.Name;
         OnPropertyChanged(nameof(Name));
     }
     if (GroupType != other.GroupType)
     {
         GroupType = other.GroupType;
         OnPropertyChanged(nameof(GroupType));
     }
     if (CreationDate != other.CreationDate)
     {
         CreationDate = other.CreationDate;
         OnPropertyChanged(nameof(CreationDate));
     }
     if (About != other.About)
     {
         About = other.About;
         OnPropertyChanged(nameof(About));
     }
     if (Motto != other.Motto)
     {
         Motto = other.Motto;
         OnPropertyChanged(nameof(Motto));
     }
     if (MemberCount != other.MemberCount)
     {
         MemberCount = other.MemberCount;
         OnPropertyChanged(nameof(MemberCount));
     }
     if (Locale != other.Locale)
     {
         Locale = other.Locale;
         OnPropertyChanged(nameof(Locale));
     }
     if (MembershipOption != other.MembershipOption)
     {
         MembershipOption = other.MembershipOption;
         OnPropertyChanged(nameof(MembershipOption));
     }
     if (Capabilities != other.Capabilities)
     {
         Capabilities = other.Capabilities;
         OnPropertyChanged(nameof(Capabilities));
     }
     if (!ClanInfo.DeepEquals(other.ClanInfo))
     {
         ClanInfo.Update(other.ClanInfo);
         OnPropertyChanged(nameof(ClanInfo));
     }
     if (AvatarPath != other.AvatarPath)
     {
         AvatarPath = other.AvatarPath;
         OnPropertyChanged(nameof(AvatarPath));
     }
     if (Theme != other.Theme)
     {
         Theme = other.Theme;
         OnPropertyChanged(nameof(Theme));
     }
 }
コード例 #17
0
ファイル: GroupV2Card.cs プロジェクト: joshhunt/GhostSharper
        public bool Equals(GroupV2Card input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     GroupId == input.GroupId ||
                     (GroupId.Equals(input.GroupId))
                     ) &&
                 (
                     Name == input.Name ||
                     (Name != null && Name.Equals(input.Name))
                 ) &&
                 (
                     GroupType == input.GroupType ||
                     (GroupType != null && GroupType.Equals(input.GroupType))
                 ) &&
                 (
                     CreationDate == input.CreationDate ||
                     (CreationDate != null && CreationDate.Equals(input.CreationDate))
                 ) &&
                 (
                     About == input.About ||
                     (About != null && About.Equals(input.About))
                 ) &&
                 (
                     Motto == input.Motto ||
                     (Motto != null && Motto.Equals(input.Motto))
                 ) &&
                 (
                     MemberCount == input.MemberCount ||
                     (MemberCount.Equals(input.MemberCount))
                 ) &&
                 (
                     Locale == input.Locale ||
                     (Locale != null && Locale.Equals(input.Locale))
                 ) &&
                 (
                     MembershipOption == input.MembershipOption ||
                     (MembershipOption != null && MembershipOption.Equals(input.MembershipOption))
                 ) &&
                 (
                     Capabilities == input.Capabilities ||
                     (Capabilities != null && Capabilities.Equals(input.Capabilities))
                 ) &&
                 (
                     ClanInfo == input.ClanInfo ||
                     (ClanInfo != null && ClanInfo.Equals(input.ClanInfo))
                 ) &&
                 (
                     AvatarPath == input.AvatarPath ||
                     (AvatarPath != null && AvatarPath.Equals(input.AvatarPath))
                 ) &&
                 (
                     Theme == input.Theme ||
                     (Theme != null && Theme.Equals(input.Theme))
                 ));
        }
コード例 #18
0
 private void HandleGetClanInfoSuccess(object sender, ClanInfo e)
 {
     ClanInfo = e;
 }