コード例 #1
0
 public ModItemStat(float FlatBonus, float StackBonus, float MultBonus, StatIndex Stat)
 {
     m_BaseBonus      = FlatBonus;
     m_StackBonus     = StackBonus;
     m_BaseMultBonus  = MultBonus;
     m_StackMultBonus = MultBonus;
     this.Stat        = Stat;
 }
コード例 #2
0
        /// <summary>
        /// Get Multiplicative Bonus from Count
        /// </summary>
        /// <param name="Stat"></param>
        /// <param name="Count"></param>
        /// <returns></returns>
        public float GetMultStackBonusFromCount(StatIndex Stat, int Count)
        {
            ModItemStat s = m_StatList.Find(x => x.Stat == Stat);

            if (s != null)
            {
                return(s.GetPercentBonusFromCount(Count));
            }
            return(0);
        }
コード例 #3
0
        /// <summary>
        /// Multiplicative bonus Per item after the first one
        /// </summary>
        /// <param name="Stat"></param>
        /// <returns></returns>
        public float MultStackBonus(StatIndex Stat)
        {
            ModItemStat s = m_StatList.Find(x => x.Stat == Stat);

            if (s != null)
            {
                return(s.MultStackBonus);
            }
            return(0);
        }
コード例 #4
0
        private void ClientData(QClientDataMessage msg, short entity)
        {
            StatIndex hpstat = (StatIndex)(100 + entity - 1);
            StatIndex wpstat = (StatIndex)(110 + entity - 1);
            StatIndex amstat = (StatIndex)(120 + entity - 1);

            State.Stats[hpstat] = msg.Health;
            State.Stats[wpstat] = msg.Weapon;
            State.Stats[amstat] = msg.Currentammo;
        }
コード例 #5
0
        static public float GetMultiplierForStat(CharacterBody c, StatIndex stat)
        {
            float value = 0;

            if (c.inventory)
            {
                foreach (KeyValuePair <int, ModItem> kv in ModItemDictionary)
                {
                    if (ModItemDictionary.ContainsKey(kv.Key) && c.inventory.GetItemCount(kv.Key) > 0)
                    {
                        value += kv.Value.GetMultStackBonusFromCount(stat, c.inventory.GetItemCount(kv.Key));
                    }
                }
            }
            return(value);
        }
コード例 #6
0
ファイル: DemoDisplay.cs プロジェクト: lagdotcom/qroute
        protected override void OnPaint(PaintEventArgs e)
        {
            if (Demos.Count < 1)
            {
                return;
            }
            g = e.Graphics;

            // update Zoom
            double width  = FirstDemo.MaxX - FirstDemo.MinX + 40;
            double height = FirstDemo.MaxY - FirstDemo.MinY + 40;
            double xratio = ClientRectangle.Width / width;
            double yratio = ClientRectangle.Height / height;

            Zoom = xratio < yratio ? xratio : yratio;

            // draw bsp!
            if (Bsp != null)
            {
                foreach (var ed in Bsp.Edges)
                {
                    var va = Bsp.Vertices[ed.A];
                    var vb = Bsp.Vertices[ed.B];

                    Point pa = Convert(va.X, va.Y);
                    Point pb = Convert(vb.X, vb.Y);

                    e.Graphics.DrawLine(Pens.Gray, pa, pb);
                }
            }

            int keyY = 10;

            foreach (ParsedDemo Demo in Demos)
            {
                // find closest state
                GameState state = Demo.States[0];
                foreach (var pair in Demo.States)
                {
                    if (pair.Key > Time)
                    {
                        break;
                    }
                    state = pair.Value;
                }

                // draw player key
                StatIndex hpstat = StatIndex.Player1HP;
                StatIndex wpstat = StatIndex.Player1Weapon;
                StatIndex amstat = StatIndex.Player1Ammo;
                int       x      = 10;
                foreach (Player pl in Demo.Players.Values)
                {
                    if (pl.Netname == null)
                    {
                        break;
                    }
                    int    windex = state.Stat(wpstat);
                    string hptext = state.Stats.ContainsKey(hpstat) ? state.Stat(hpstat).ToString() : "?";
                    string wptext = Info.WeaponNames.ContainsKey(windex) ? Info.WeaponNames[windex] : "?";
                    string amtext = state.Stats.ContainsKey(amstat) ? state.Stat(amstat).ToString() : "?";

                    Entity ent = state.Entities[pl.Entity];
                    DrawPlayer(e.Graphics, ent, pl, new Rectangle(x, keyY, 10, 10));
                    e.Graphics.DrawString(pl.Netname, Font, Brushes.White, x + 12, keyY);
                    e.Graphics.DrawString(hptext, Font, Brushes.White, x + 82, keyY);
                    e.Graphics.DrawString(wptext, Font, Brushes.White, x + 102, keyY);
                    e.Graphics.DrawString(amtext, Font, Brushes.White, x + 122, keyY);

                    hpstat++;
                    wpstat++;
                    amstat++;
                    keyY += 14;
                }

                // draw messages
                int y = ClientRectangle.Height - 10;
                y -= state.Messages.Count * 14;
                foreach (string msg in state.Messages)
                {
                    e.Graphics.DrawString(msg, Font, Brushes.White, x, y);
                    y += 14;
                }

                // draw counts
                x = ClientRectangle.Width - 100;
                y = ClientRectangle.Height - 24;
                e.Graphics.DrawString($"Kills: {state.Stat(StatIndex.KilledMonsters)} / {state.Stat(StatIndex.NumMonsters)}", Font, Brushes.White, x, y - 14);
                e.Graphics.DrawString($"Secrets: {state.Stat(StatIndex.FoundSecrets)} / {state.Stat(StatIndex.NumSecrets)}", Font, Brushes.White, x, y);

                // draw temps
                foreach (Temp t in state.Temps)
                {
                    t.Draw(this);
                }

                // draw entities
                foreach (Entity ent in state.Entities.Values.Reverse())
                {
                    if (ent.Number == 0)
                    {
                        continue;
                    }
                    if (ent.Model[0] == '*')
                    {
                        continue;
                    }
                    if (ent.Model == "?")
                    {
                        continue;
                    }

                    ModelInfo minf = Info.GetModelInfo(ent.Model, ent.Skin);
                    if (minf.Type == ModelType.Player)
                    {
                        Player pl = Demo.GetPlayer((byte)(ent.Number - 1));
                        DrawPlayer(e.Graphics, ent, pl);
                        DrawAngle(e.Graphics, ent);
                        continue;
                    }

                    if (minf.DeadFrames.Contains(ent.Frame))
                    {
                        Cross(ent.Origin, Color.DarkRed, minf.Size / 2);
                        continue;
                    }

                    Rectangle rect = GetDrawRect(ent, minf.Size);
                    e.Graphics.FillRectangle(minf.Background, rect);
                    if (minf.Type == ModelType.Enemy)
                    {
                        DrawAngle(e.Graphics, ent);
                    }

                    if (minf.Label != null)
                    {
                        SizeF size = e.Graphics.MeasureString(minf.Label, Font);
                        float lx   = rect.Left + rect.Width / 2 - size.Width / 2;
                        float ly   = rect.Top + rect.Height / 2 - size.Height / 2;

                        e.Graphics.DrawString(minf.Label, Font, minf.Foreground, lx, ly);
                    }
                }
            }
        }
コード例 #7
0
 public float GetStat(Stats stat, StatIndex index)
 {
     return(m_cache[(int)StatsOffset.Stats + ((int)stat - 1) * (int)StatIndex.Length + (int)index]);
 }
コード例 #8
0
 public int Stat(StatIndex i) => Stats.ContainsKey(i) ? Stats[i] : 0;