Пример #1
0
 public ItemStatRecord(MDRItem item)
 {
     this.Item    = item;
     this.ID      = item.ID;
     this.Name    = item.Name;
     this.IDLevel = IdentificationLevel.Auto;
 }
Пример #2
0
        /** Registers that a given item has been identified to given level */
        public void RegisterItemIdentified(MDRItem item, IdentificationLevel idLevel)
        {
            if (!Enabled)
            {
                return;
            }

            if (item == null)
            {
                return;
            }
            if (idLevel == IdentificationLevel.Auto || idLevel == null)
            {
                return;
            }

            if (!ItemStats.ContainsKey(item))
            {
                ItemStats[item] = new ItemStatRecord(item);
            }
            ItemStatRecord record = ItemStats[item];

            if (idLevel.ID > record.IDLevel.ID)
            {
                record.IDLevel = idLevel;
            }
        }
Пример #3
0
        /** Registers that a given monster has been identified to given level */
        public void RegisterMonsterIdentified(MDRMonster monster, IdentificationLevel idLevel)
        {
            if (!Enabled)
            {
                return;
            }

            if (monster == null)
            {
                return;
            }

            if (idLevel == IdentificationLevel.Auto || idLevel == null)
            {
                return;
            }

            if (!MonsterStats.ContainsKey(monster))
            {
                MonsterStats[monster] = new MonsterStatRecord(monster);
            }
            MonsterStatRecord record = MonsterStats[monster];

            if (idLevel.ID > record.IDLevel.ID)
            {
                record.IDLevel = idLevel;
            }
        }
Пример #4
0
 public MonsterStatRecord(MDRMonster monster)
 {
     this.Monster = monster;
     this.ID      = monster.ID;
     this.Name    = monster.Name;
     this.IDLevel = IdentificationLevel.Auto;
 }
        public void SetIdentity(string newIdentity, IdentificationLevel idLevel)
        {
            if (string.IsNullOrWhiteSpace(newIdentity) && idLevel != IdentificationLevel.None)
            {
                throw new ArgumentOutOfRangeException("newIdentity", "A contact identity value must be supplied to match the identification level of " + idLevel);
            }

            this.identity = newIdentity;
            this.identityLevel = idLevel;
        }
        public ElasticContactIdentification(
            string identity, 
            AuthenticationLevel authLevel, 
            IdentificationLevel idLevel)
        {
            if (string.IsNullOrWhiteSpace(identity) && idLevel != IdentificationLevel.None)
            {
                throw new ArgumentOutOfRangeException("identity", "A contact identity value must be supplied to match the identification level of " + idLevel);    
            }

            this.authLevel = authLevel;
            this.SetIdentity(identity, idLevel);
        }
Пример #7
0
        // ----------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------

        /** Sets the item color, indicator color, and overlay based on this items characteristics. */
        private void updateItemDisplay()
        {
            IndicatorColor = Color.clear;

            ItemIcon.Color          = Color.white;
            ItemIcon.ColorTransform = ColorTransform.Identity;

            OverlaySprite = null;

            if (IsEmpty)
            {
                return;
            }

            bool isCursed = DataLink.ItemInstance.KnownToBeCursed;
            IdentificationLevel idLevel = DataLink.ItemInstance.IDLevel;

            // Indicator color:
            var backgroundColor = isCursed ? Color.red : DataLink.ItemInstance.Item.QualityBackgroundColor;

            IndicatorColor = backgroundColor.Faded(0.33f);

            // Item color:
            MDRCharacter character = DataLink.Character;

            if (idLevel.CanUse && character != null)
            {
                bool usable        = DataLink.ItemInstance.Item.Usable;
                bool canUseOrEquip = usable ? DataLink.ItemInstance.CanBeUsedBy(character) : DataLink.ItemInstance.CanBeEquipedBy(character);

                if (!canUseOrEquip)
                {
                    ItemIcon.Color          = new Color(0.5f, 0.25f, 0.25f);
                    ItemIcon.ColorTransform = ColorTransform.Saturation(0.5f);
                }
            }

            // Item ID level
            if (idLevel == IdentificationLevel.Full)
            {
                OverlaySprite = null;
            }
            else
            {
                OverlaySprite = (idLevel.CanUse) ? IDPartial : IDNone;
            }
        }
Пример #8
0
        /** Updates labels accoding to item */
        override public void UpdateToolTip()
        {
            if (ItemInstance == null)
            {
                return;
            }

            string attributes = "";

            MDRItem             item    = ItemInstance.Item;
            MDRItemType         type    = item.Type;
            IdentificationLevel idLevel = ShowAllInfo ? IdentificationLevel.Full : ItemInstance.IDLevel;

            // stub: getting character from party selected
            MDRCharacter character = CoM.Party.Selected;

            IconSprite.Sprite = CoM.Instance.ItemIconSprites[item.IconID];

            if (idLevel >= IdentificationLevel.Mostly)
            {
                HeaderLabel.Caption = FormatHeader(ItemInstance.Name + "\n(" + type.Name + ")");
            }
            else
            {
                HeaderLabel.Caption = FormatHeader(ItemInstance.Name);
            }

            // Usability
            Color skillRequirementColor = Color.yellow;
            Color guildRequirementColor = Color.yellow;

            if (character != null)
            {
                skillRequirementColor = (character.HasSkillToUseItem(item) ? Color.green : Color.red);
                guildRequirementColor = (item.GuildCanUseItem(character.CurrentGuild) ? Color.green : Color.red);
            }

            // --------------------------------------------
            // Skill requirement

            if (item.Type.SkillRequired != null && item.SkillLevel > 0)
            {
                attributes += string.Format("Requires {0} - {1}\n",
                                            Util.Colorise("[" + item.Type.SkillRequired.Name + "]", skillRequirementColor),
                                            Util.Colorise(SkillLevelRank.GetSkillRank(item.SkillLevel), skillRequirementColor)
                                            );
            }

            // --------------------------------------------
            // Guild restrictions

            if (idLevel >= IdentificationLevel.Mostly && item.GuildRestricted)
            {
                attributes += "Restricted ";

                foreach (MDRGuild guild in CoM.Guilds)
                {
                    if (item.GuildCanUseItem(guild))
                    {
                        attributes += Util.Colorise(string.Format("[{0}] ", guild), guildRequirementColor);
                    }
                }
                attributes += "\n";
            }

            // Stats

            string statsReq = "";

            for (int lp = 0; lp < 6; lp++)
            {
                if (item.StatsReq[lp] == 0)
                {
                    continue;
                }

                string amount = item.StatsReq[lp].ToString();

                if ((character != null) && (item.StatsReq[lp] > character.BaseStats[lp]))
                {
                    amount = Util.Colorise(amount, Color.red);
                }

                statsReq += MDRStats.SHORT_STAT_NAME[lp] + " " + amount + " ";
            }

            if (statsReq != "")
            {
                statsReq.Remove(statsReq.Length - 1);
            }

            string statsMod =
                FormatStatMod(item.StatsMod.Str, "Str") +
                FormatStatMod(item.StatsMod.Dex, "Dex") +
                FormatStatMod(item.StatsMod.Int, "Int") +
                FormatStatMod(item.StatsMod.Wis, "Wis") +
                FormatStatMod(item.StatsMod.Chr, "Chr") +
                FormatStatMod(item.StatsMod.Con, "Con");

            if (statsMod != "")
            {
                statsMod.Remove(statsMod.Length - 1);
            }

            // --------------------------------------------
            // cursed

            if (idLevel == IdentificationLevel.Full)
            {
                string curseString = "";

                if (item.CurseType == ItemCurseType.Cursed)
                {
                    curseString = "[CURSED]\n";
                }
                if (item.CurseType == ItemCurseType.AutoEquipCursed)
                {
                    curseString = "[AUTO EQUIP CURSED]\n";
                }

                if ((curseString != "") && (!ItemInstance.Cursed))
                {
                    curseString = "[UNCURSED]\n";
                }

                if (curseString != "")
                {
                    attributes += Util.Colorise(curseString + "\n", Color.red);
                }
            }

            // --------------------------------------------
            // Hands

            if (item.Hands == 2)
            {
                attributes += FormatNormal("Two Handed") + "\n";
            }

            attributes += "<Size=6>\n</Size>";

            // --------------------------------------------
            // Attack / Defense

            if (idLevel >= IdentificationLevel.Partial)
            {
                if (item.isWeapon)
                {
                    attributes += "Damage " + FormatHilight((int)item.Damage) + "\n";
                }
                if (item.Armour > 0)
                {
                    attributes += "Armour " + FormatNormal(item.Armour) + "\n";
                }
            }

            // --------------------------------------------
            // general information

            if (idLevel >= IdentificationLevel.Mostly)
            {
                if (item.Hit != 0)
                {
                    attributes += string.Format("Hit {0}\n", FormatHilight(item.Hit));
                }
                if (item.Pierce != 0)
                {
                    attributes += string.Format("Pierce {0}\n", FormatHilight(item.Pierce));
                }

                if (item.isWeapon)
                {
                    if (item.CriticalModifier != 0)
                    {
                        attributes += FormatHilight("Crit") + Util.Colorise(" " + item.CriticalModifier.ToString("0.0") + "%", new Color(1f, 0.9f, 0.5f));
                    }
                    if (item.BackstabModifier != 0)
                    {
                        attributes += FormatHilight("Backstab") + Util.Colorise(" " + item.BackstabModifier.ToString("0.0") + "%", new Color(1f, 0.9f, 0.5f));
                    }
                    if ((item.BackstabModifier != 0) || (item.CriticalModifier != 0))
                    {
                        attributes += "\n";
                    }
                }
            }

            if (idLevel >= IdentificationLevel.Partial)
            {
                if (statsReq != "")
                {
                    attributes += FormatHilight("Stat Req") + " " + FormatNormal(statsReq) + "\n";
                }
            }

            if (idLevel >= IdentificationLevel.Full)
            {
                if (statsMod != "")
                {
                    attributes += FormatHilight("Stat Mod") + " " + FormatNormal(statsMod) + "\n";
                }
            }

            // --------------------------------------------
            // resistances information

            if (idLevel == IdentificationLevel.Full)
            {
                string resistanceString = item.Resistance.ToString();
                if (resistanceString != "")
                {
                    attributes += string.Format("{0} [{1}]", FormatHilight("Resistances"), resistanceString) + "\n";
                }
            }

            attributes += "<Size=6>\n</Size>";

            if (!ShowAllInfo)
            {
                attributes += string.Format("You know {0} about this item.", idLevel.Description);
            }

            InfoLabel.Caption = attributes;

            if (AutoFit)
            {
                FitToChildren();
                Width  += 10;
                Height += 10;
            }
        }
 public void RemoveIdentity()
 {
     this.identity = null;
     this.identityLevel = IdentificationLevel.None;
 }
Пример #10
0
 public override void ReadNode(XElement node)
 {
     base.ReadNode(node);
     IDLevel = IdentificationLevel.FromName(ReadValue(node, "IDLevel", "none"));
 }
 public ElasticContactCustomization(IdentificationLevel idLevel = IdentificationLevel.Known)
 {
     this._idLevel = idLevel;
 }