예제 #1
0
        public async static Task MainAsync(string Token)
        {
            MGXStatistics.StartedAt = DateTime.UtcNow;
            var config = new DiscordSocketConfig {
                MessageCacheSize = 5, TotalShards = 1
            };

            Client = new DiscordShardedClient(config);
            DiscordBotListClient = new AuthDiscordBotListApi(534193192329805854, "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjUzNDE5MzE5MjMyOTgwNTg1NCIsImJvdCI6dHJ1ZSwiaWF0IjoxNTg3NDI3NzQxfQ.lU-e43AqYswMC3UZsc145RgadqEhrrrelKoSCvT8UXg");
            //(await DiscordBotListClient.GetMeAsync()).
            CustomResponses.UpdateResponses();
            await Client.LoginAsync(TokenType.Bot, Token);

            await Client.StartAsync();

            Client.MessageReceived += Client_MessageReceived;
            Client.MessageReceived += globalchat.MessageReceived;
            Client.MessageReceived += snipe.OnReceived;
            Client.MessageReceived += Secondary.MyClient_MessageReceived;
            Client.ShardReady      += Client_Ready;
            Client.JoinedGuild     += Client_JoinedGuild;
            Client.LeftGuild       += Client_LeftGuild;
            Client.MessageDeleted  += snipe.OnDelete;
            new Thread(async x =>
            {
                await Secondary.Secondary_Thread();
            }).Start();

            await Task.Delay(-1);
        }
예제 #2
0
    public static void Main()
    {
        // "boot" process
        // :: begin 1 :: 2 ; 3 maybequit until ;
        //while (true) {
        //    String s = Console.ReadLine();
        //    if (s == "q") {
        //        break;
        //    }
        //    Type t = Type.GetType(s, false, true);
        //    Console.WriteLine(t != null ? t.Name : "null");
        //}
        String        str   = ":: # 1 % 1.2 %% 1.23 $ \"123\\n\" id haha <system.windows.forms.form> ;";
        List <String> terms = Split(str);
        //terms.ForEach(term => Console.WriteLine("'" + term + "'"));
        Secondary parsed = StrTo(str);

        Console.ReadKey();
        //List<Object> outerLoop = new List<object> { _Begin,  _MaybeQuit, _Until }; // outer loop has no semi. It's never popped from RS
        //RS.Push(outerLoop);
        //IP = 0;
        //
        //// inner loop
        //// just keep executing objects one after the other
        //while (IP < RS.Peek().Count) {
        //    OB = RS.Peek()[IP];
        //    Eval();
        //}
    }
예제 #3
0
        public void SetAllStats(int[] primary, int[] secondary, int[] defense, int[] element, int[] armorType, int[] weaponType)
        {
            Primary.SetAll(primary);
            Secondary.SetAll(secondary);
            Defense.SetAll(defense);
            ElementDefense.SetAll(element);
            ArmorTypes.SetAll(armorType);
            WeaponTypes.SetAll(weaponType);

            Major.SetAll
            (
                new int[]
            {
                (
                    Secondary.Stats[SecondaryFlag.Vitality].Value *
                    Primary.Stats[PrimaryFlag.Con].Value *
                    UnitLevel.Value
                ),
                (
                    Primary.Stats[PrimaryFlag.Str].Value +
                    Primary.Stats[PrimaryFlag.Dex].Value +
                    Primary.Stats[PrimaryFlag.Con].Value +
                    PowerBonus()
                ),
                (
                    Primary.Stats[PrimaryFlag.Int].Value +
                    Primary.Stats[PrimaryFlag.Wis].Value +
                    Primary.Stats[PrimaryFlag.Cha].Value +
                    MagicBonus()
                )
            }
            );
        }
예제 #4
0
        public void AssignSecondaryItem(Secondary secondaryItem)
        {
            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (secondaryItem)
            {
            case Secondary.LaserBeam:
            case Secondary.Clock:
            case Secondary.Star:
            case Secondary.Bait:
                if (ExtraItem1 == Secondary.None)
                {
                    ExtraItem1    = secondaryItem;
                    SecondaryItem = Secondary.ExtraSlot1;
                }
                else if (ExtraItem2 == Secondary.None)
                {
                    ExtraItem2    = secondaryItem;
                    SecondaryItem = Secondary.ExtraSlot2;
                }
                break;

            default:
                SecondaryItem = secondaryItem;
                break;
            }
        }
 public void InvokeSecondary()
 {
     if (Secondary != null)
     {
         Secondary.Invoke();
     }
 }
 public void Change(Card c)
 {
     primary   = c.primary;
     secondary = c.secondary;
     BackgroundIni();
     PrimaryImageIni();
 }
        private void UseExtraItem(Secondary extraItem, Point location, Direction facing)
        {
            switch (extraItem)
            {
            case Secondary.LaserBeam:
                Projectiles.Add(new LaserBeam(location, facing));
                break;

            case Secondary.Clock:
                Projectiles.Add(new ClockCollideable());
                UsingSecondaryItem = false;
                break;

            case Secondary.Star:
                _player.MakeInvulnerable();
                UsingSecondaryItem = false;
                break;

            case Secondary.Bait:
                Projectiles.Add(new Bait(new Point(location.X + 4, location.Y)));
                break;

            default:
                UsingSecondaryItem = false;
                break;
            }
        }
예제 #8
0
        private void HandleSavePayorCoverageCompleted(ReceivedResponses receivedResponses)
        {
            var response = receivedResponses.Get <DtoResponse <PayorCoverageCacheDto> >();

            if (response.DataTransferObject.HasErrors)
            {
                var errorMessageBuilder = new StringBuilder();
                foreach (var dataErrorInfo in response.DataTransferObject.DataErrorInfoCollection)
                {
                    errorMessageBuilder.Append(dataErrorInfo.Message + "\n");
                }
                _userDialogService.ShowDialog(errorMessageBuilder.ToString(), "Error Deleting Payor", UserDialogServiceOptions.Ok);
            }
            else
            {
                var payorToDelete = Primary.FirstOrDefault(pc => pc.Key == response.DataTransferObject.Key);
                if (payorToDelete != null)
                {
                    Primary.Remove(payorToDelete);
                }
                else if ((payorToDelete = Secondary.FirstOrDefault(pc => pc.Key == response.DataTransferObject.Key)) != null)
                {
                    Secondary.Remove(payorToDelete);
                }
                else if ((payorToDelete = Tertiary.FirstOrDefault(pc => pc.Key == response.DataTransferObject.Key)) != null)
                {
                    Tertiary.Remove(payorToDelete);
                }
                else if ((payorToDelete = PayorCoverageHistory.FirstOrDefault(pc => pc.Key == response.DataTransferObject.Key)) != null)
                {
                    PayorCoverageHistory.Remove(payorToDelete);
                }
            }
            IsLoading = false;
        }
예제 #9
0
 public void SetActiveSecondary(SecondaryItem swi)
 {
     for (int i = 0; i < secondaries.Count; i++)
     {
         secondaries[i].gameObject.SetActive(false);
     }
     ActiveSecondary     = swi.secondary;
     ActiveSecondaryItem = swi;
     foreach (Secondary sw in secondaries)
     {
         if (sw.secondaryType == swi.secondary.secondaryType)
         {
             sw.gameObject.SetActive(true);
             MeshRenderer[] renderers = sw.gameObject.GetComponentsInChildren <MeshRenderer>();
             foreach (MeshRenderer ren in renderers)
             {
                 ren.enabled = sw.display;
             }
             if (sw.gameObject.GetComponent <MachineGunAuto>())
             {
                 sw.gameObject.GetComponent <MachineGunAuto>().enabled = sw.display;
             }
             break;
         }
     }
 }
예제 #10
0
 public PlayContext()
 {
     finalState      = new Final();
     primaryState    = new Primary();
     professionState = new Professional();
     secondState     = new Secondary();
 }
예제 #11
0
 void Start()
 {
     map.enabled       = false;
     secActive         = Secondary.NONE;
     secondary.enabled = false;
     priActive         = Primary.WOOD;
     clickTooFast      = false;
 }
예제 #12
0
 public override void Close()
 {
     Primary.Close();
     if (AutoClose)
     {
         try { Secondary.Close(); }
         catch (Exception ex) { throw new TeeException(ex); }
     }
 }
예제 #13
0
        private void dataGrid_Secondaries_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Secondary s = dataGrid_Secondaries.SelectedItem as Secondary;
            Product   q = db.Product.FirstOrDefault(x => x.Id == s.Id);

            label_balance.Content  = "На складе : " + Convert.ToString(q.Balance);
            label_Purchase.Content = "Цена закупки : " + Convert.ToString(q.PricePurchase);
            label_Sell.Content     = "Цена продажи : " + Convert.ToString(q.SellPrice);
        }
예제 #14
0
        public override int GetHashCode()
        {
            int hashCode = 1273248884;

            hashCode = hashCode * -1521134295 + Primary.GetHashCode();
            hashCode = hashCode * -1521134295 + Secondary.GetHashCode();
            hashCode = hashCode * -1521134295 + RhPrimary.GetHashCode();
            hashCode = hashCode * -1521134295 + RhSecondary.GetHashCode();
            return(hashCode);
        }
예제 #15
0
 /// <inheritdoc />
 protected override CommandBase DeepCloneForTracing()
 {
     return(new Relate()
     {
         PrimaryType = PrimaryType,
         SecondaryType = SecondaryType,
         Primary = Primary.DeepClone(),
         Secondary = Secondary.DeepClone(),
         ForeignKeySpecifier = ForeignKeySpecifier
     });
 }
예제 #16
0
 public void OnSecondary()
 {
     if (Secondary != null)
     {
         Secondary.Invoke();
     }
     else
     {
         return;
     }
 }
예제 #17
0
 public BowItem(Point location, Secondary bowLevel, int price = 0) : base(location, price)
 {
     _price = price;
     Sprite = bowLevel == Secondary.Bow ? ItemSpriteFactory.Instance.CreateBow()
         : ItemSpriteFactory.Instance.CreateFireBow();
     _priceDisplay = new DrawnText
     {
         Location = new Point(location.X, location.Y + 20),
         Text     = _price.ToString()
     };
 }
예제 #18
0
 public ArrowItem(Point location, Secondary arrowLevel, int price = 0) : base(location, price)
 {
     _arrowLevel = arrowLevel;
     _price      = price;
     Sprite      = arrowLevel == Secondary.Arrow ? ItemSpriteFactory.Instance.CreateArrow()
         : ItemSpriteFactory.Instance.CreateSilverArrow();
     _priceDisplay = new DrawnText
     {
         Text     = _price.ToString(),
         Location = new Point(location.X, location.Y + 20)
     };
 }
        public async void Update_ColorOnPreview(int index, BandTheme _BandTheme)
        {
            switch (index)
            {
            case -1:
                try
                {
                    while (await ContentIsLoaded() == false)
                    {
                        await Task.Delay(100);

                        System.Diagnostics.Debug.WriteLine("Task Delayed");
                    }


                    Base.Set_Color(_BandTheme);
                    HighContrast.Set_Color(_BandTheme);
                    LowLight.Set_Color(_BandTheme);
                    Hightlight.Set_Color(_BandTheme);
                    Muted.Set_Color(_BandTheme);
                    Secondary.Set_Color(_BandTheme);
                } catch (Exception e)
                {
                    System.Diagnostics.Debug.Write(e);
                }

                break;

            case 0:
                Base.Set_Color(_BandTheme);
                break;

            case 1:
                HighContrast.Set_Color(_BandTheme);
                break;

            case 2:
                LowLight.Set_Color(_BandTheme);
                break;

            case 3:
                Hightlight.Set_Color(_BandTheme);
                break;

            case 4:
                Muted.Set_Color(_BandTheme);
                break;

            case 5:
                Secondary.Set_Color(_BandTheme);
                break;
            }
        }
예제 #20
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         Primary.Dispose();
         if (AutoClose)
         {
             try { Secondary.Dispose(); }
             catch (Exception ex) { throw new TeeException(ex); }
         }
     }
 }
예제 #21
0
        ///<inheritdoc/>
        public override int GetHashCode()
        {
            int hash = 17;

            // Overflow is fine, just wrap
            unchecked
            {
                hash = (hash * 29) + Primary.GetHashCode();
                hash = (hash * 29) + Secondary.GetHashCode();
                hash = (hash * 29) + AHD.GetHashCode();
            }

            return(hash);
        }
예제 #22
0
    public GameObject EquipWeapon(Secondary secondWeapon)
    {
        Transform secondarySlotTemp;

        secondarySlotTemp = this.secondarySlot;
        GameObject go = Instantiate(secondWeapon.gameObject, secondarySlotTemp);

        //ParabolicProjectile parabolicProjectile = go.GetComponent<ParabolicProjectile>();
        //if (parabolicProjectile)
        //    parabolicProjectile.enabled = false;
        go.SetActive(false);
        go.layer = gameObject.layer;
        secondaries.Add(go.GetComponent <Secondary>());
        return(go);
    }
        //Write from buffer to secondary stream
        //Write from buffer to primary stream
        public override void Write(byte[] buffer, int offset, int count)
        {
            try
            {
                //write buffer to secondary stream
                Secondary.Write(buffer, offset, count);
            }
            catch (Exception ex)
            {
                throw new TeeException(ex);
            }

            //write buffer to primary stream
            Primary.Write(buffer, offset, count);
        }
예제 #24
0
        public void AddSecondaryItem(Secondary secondaryItem)
        {
            switch (secondaryItem)
            {
            case Secondary.Boomerang:
                HasBoomerang = true;
                break;

            case Secondary.Bomb:
                BombCount = Math.Min(BombCount + 4, MaxBombCount);
                break;

            case Secondary.Bow:
                if (BowLevel == Secondary.None)
                {
                    BowLevel = Secondary.Bow;
                }
                break;

            case Secondary.FireBow:
                BowLevel = Secondary.FireBow;
                break;

            case Secondary.Arrow:
                if (ArrowLevel == Secondary.None)
                {
                    ArrowLevel = Secondary.Arrow;
                }
                break;

            case Secondary.SilverArrow:
                ArrowLevel = Secondary.SilverArrow;
                break;

            case Secondary.Coins:
                Coins = 2;
                break;

            case Secondary.ATWBoomerang:
                HasATWBoomerang = true;
                break;

            case Secondary.BombLauncher:
                HasBombLauncher = true;
                break;
            }
        }
예제 #25
0
        //Read from primary stream into buffer
        //Write buffer to secondary stream
        public override int Read(byte[] buffer, int offset, int count)
        {
            //read into buffer from primary stream
            int read = Primary.Read(buffer, offset, count);

            try
            {
                //write buffer to secondary stream
                Secondary.Write(buffer, offset, read);
            }
            catch (Exception ex)
            {
                throw new TeeException(ex);
            }

            return(read);
        }
예제 #26
0
 public Move(MoveJSONObj obj)
 {
     name = obj.name;
     type = Global.types[obj.type.ToLower()];
     bp = obj.basePower;
     accuracy = ((float)obj.accuracy / 100f);
     group = obj.category.ToLower();
     priority = obj.priority;
     boosts = obj.boosts;
     desc = obj.desc;
     statuseffect = obj.status;
     secondary = obj.secondary;
     if (statuseffect != "none") status = true;
     if (hasBoosts()) isBoost = true;
     if (Convert.ToBoolean(obj.flags.heal)) heal = true; 
     
 }
예제 #27
0
 public void looseBullet()
 {
     foreach (SecondaryItem sw in secondaryItems)
     {
         if (sw.secondary.secondaryType == ActiveSecondaryItem.secondary.secondaryType)
         {
             sw.amount -= 1;
             onItemChangedCallback.Invoke();
             if (sw.amount <= 0)
             {
                 ActiveSecondaryItem = null;
                 ActiveSecondary     = null;
             }
             break;
         }
     }
 }
예제 #28
0
 public void AddItem(SecondaryItem newWeapon)
 {
     if (newWeapon.amount >= 0)
     {
         secondaryItem      = new SecondaryItem(newWeapon.secondary, newWeapon.amount);
         secondary          = secondaryItem.secondary;
         icon.sprite        = secondaryItem.secondary.icon;
         icon.enabled       = true;
         nbItem             = newWeapon.amount;
         textNumber.enabled = true;
         textNumber.text    = newWeapon.amount.ToString();
         if (nbItem <= 0)
         {
             ClearSLot();
         }
     }
 }
예제 #29
0
 void CycleSecondary()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1) && hasBow)
     {
         secActive = Secondary.BOW;
     }
     if (Input.GetKeyDown(KeyCode.Alpha2) && hasRang)
     {
         secActive = Secondary.RANG;
     }
     if (Input.GetKeyDown(KeyCode.Alpha3) && bombs > 0)
     {
         secActive = Secondary.BOMB;
     }
     if (Input.GetMouseButton(2) & !clickTooFast)
     {
         if (secActive == Secondary.BOW && hasRang)
         {
             secActive = Secondary.RANG;
         }
         else if (secActive == Secondary.BOW && bombs > 0)
         {
             secActive = Secondary.BOMB;
         }
         else if (secActive == Secondary.RANG && bombs > 0)
         {
             secActive = Secondary.BOMB;
         }
         else if (secActive == Secondary.RANG && hasBow)
         {
             secActive = Secondary.BOW;
         }
         else if (secActive == Secondary.BOMB && hasBow)
         {
             secActive = Secondary.BOW;
         }
         else if (secActive == Secondary.BOMB && hasRang)
         {
             secActive = Secondary.RANG;
         }
         clickTooFast = true;
         mouseTimer   = mouseTime;
     }
 }
예제 #30
0
        private void buttonChangeProduct_Click(object sender, RoutedEventArgs e)
        {
            MyContext db = new MyContext();

            if (dataGridGoods.SelectedItem != null)
            {
                ProductsViewModel s = dataGridGoods.SelectedItem as ProductsViewModel;
                var bd = db.Product.Include("MainProduct");

                Product  fnd = bd.Include("Secondary").FirstOrDefault(x => x.Id == s.Id);
                Products f   = new Products();
                f.textBox.Text    = Convert.ToString(fnd.Balance);
                f.textBox1.Text   = Convert.ToString(fnd.PricePurchase);
                f.textBox2.Text   = Convert.ToString(fnd.SellPrice);
                f.textBox_Id.Text = Convert.ToString(fnd.Id);
                if (fnd.Secondary != null)
                {
                    Secondary Secondarys = db.Secondaries.Find(s.Id);
                    f.textBox_Type.Text      = Secondarys.Type;
                    f.textBox_Name.Text      = Secondarys.Name;
                    f.textBox_Charact.Text   = Secondarys.Characteristics;
                    f.TypeGoods.SelectedItem = "Дополнительный";
                }
                else
                {
                    MainProduct mainProduct = db.MainProducts.Find(s.Id);
                    f.textBox_TypeProd.Text  = mainProduct.Type;
                    f.textBox_NameProd.Text  = mainProduct.CodeName;
                    f.textBox_Brand.Text     = mainProduct.Brand;
                    f.textBox_TireWidth.Text = Convert.ToString(mainProduct.TireWidth);
                    f.textBox_SpeedNum.Text  = Convert.ToString(mainProduct.SpeedNum);
                    f.textBox_Diameter.Text  = Convert.ToString(mainProduct.Diameter);
                    f.textBox_Info.Text      = mainProduct.Info;
                    f.checkBox.IsChecked     = mainProduct.Used;
                    f.TypeGoods.SelectedItem = "Основной";
                }
                f.Closing += addNoteWindow_Closing;
                f.ShowDialog();
            }
            else
            {
                MessageBox.Show("Вы не выбрали товар для редактирования", "Ошибка");
            }
        }
예제 #31
0
 private void buttonOK_Click(object sender, RoutedEventArgs e)
 {
     if (dataGrid_Secondaries.SelectedItem != null)
     {
         Secondary s = dataGrid_Secondaries.SelectedItem as Secondary;
         Id = s.Id;
         this.Close();
     }
     else if (dataGrid_MainProd.SelectedItem != null)
     {
         MainProduct s = dataGrid_MainProd.SelectedItem as MainProduct;
         Id = s.Id;
         this.Close();
     }
     else
     {
         MessageBox.Show("Вы ничего не выбрали");
     }
 }
예제 #32
0
 public Sprite getNormalSprite(Secondary type)
 {
     return secondaries[type].normal;
 }
예제 #33
0
 public Sprite getGreyedSprite(Secondary type)
 {
     return secondaries[type].greyed;
 }
예제 #34
0
 public Sprite getDisabledSprite(Secondary type)
 {
     return secondaries[type].disabled;
 }