当前位置: 首页>>代码示例>>C#>>正文


C# WorldObject.Values方法代码示例

本文整理汇总了C#中WorldObject.Values方法的典型用法代码示例。如果您正苦于以下问题:C# WorldObject.Values方法的具体用法?C# WorldObject.Values怎么用?C# WorldObject.Values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WorldObject的用法示例。


在下文中一共展示了WorldObject.Values方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

		public static MyWorldObject Create(WorldObject wo)
		{
			MyWorldObject mwo = new MyWorldObject();

			Dictionary<int, bool> boolValues = new Dictionary<int,bool>();
			Dictionary<int, double> doubleValues = new Dictionary<int,double>();
			Dictionary<int, int> intValues = new Dictionary<int, int>();
			Dictionary<int, string> stringValues = new Dictionary<int,string>();
			List<int> activeSpells = new List<int>();
			List<int> spells = new List<int>();

			foreach (var key in wo.BoolKeys)
				boolValues.Add(key, wo.Values((BoolValueKey)key));

			foreach (var key in wo.DoubleKeys)
				doubleValues.Add(key, wo.Values((DoubleValueKey)key));

			foreach (var key in wo.LongKeys)
				intValues.Add(key, wo.Values((LongValueKey)key));

			foreach (var key in wo.StringKeys)
				stringValues.Add(key, wo.Values((StringValueKey)key));

			for (int i = 0 ; i < wo.ActiveSpellCount ; i++)
				activeSpells.Add(wo.ActiveSpell(i));

			for (int i = 0; i < wo.SpellCount; i++)
				spells.Add(wo.Spell(i));

			mwo.Init(wo.HasIdData, wo.Id, wo.LastIdTime, (int)wo.ObjectClass, boolValues, doubleValues, intValues, stringValues, activeSpells, spells);

			return mwo;
		}
开发者ID:IbespwnAC,项目名称:MagTools,代码行数:33,代码来源:MyWorldObjectCreator.cs

示例2: CapturedWorldObject

        internal CapturedWorldObject(WorldObject wo)
        {
            this.Id = wo.Id;
            this.Name = wo.Name;
            this.ObjectClass = wo.ObjectClass;

            this.Behavior = wo.Behavior;
            this.Category = wo.Category;
            this.Container = wo.Container;
            this.GameDataFlags1 = wo.GameDataFlags1;
            this.Icon = wo.Icon;
            this.LastIdTime = wo.LastIdTime;
            this.PhysicsDataFlags = wo.PhysicsDataFlags;
            this.Type = wo.Type;

            this.HasIdData = wo.HasIdData;

            this._coordinates = wo.Coordinates();
            this._orientation = wo.Orientation();
            this._offset = wo.Offset();
            this._rawCoordinates = wo.RawCoordinates();

            var tmpIntList = new List<int>();
            for (int i = 0; i < wo.ActiveSpellCount; i++)
            {
                tmpIntList.Add(wo.ActiveSpell(i));
            }

            this._activeSpells = General.ListOperations.Capture(tmpIntList).AsReadOnly();

            tmpIntList.Clear();
            for (int i = 0; i < wo.SpellCount; i++)
            {
                tmpIntList.Add(wo.Spell(i));
            }

            this._spells = General.ListOperations.Capture(tmpIntList).AsReadOnly();

            foreach (var key in wo.BoolKeys)
                _boolValues.Add(key, wo.Values((BoolValueKey)key));

            foreach (var key in wo.DoubleKeys)
                _doubleValues.Add(key, wo.Values((DoubleValueKey)key));

            foreach (var key in wo.LongKeys)
                this._longValues.Add(key, wo.Values((LongValueKey)key));

            foreach (var key in wo.StringKeys)
                _stringValues.Add(key, wo.Values((StringValueKey)key));
        }
开发者ID:mrvoorhe,项目名称:redox-extensions,代码行数:50,代码来源:CapturedWorldObject.cs

示例3: InspectorPickSalvage

        private List<int> InspectorPickSalvage(WorldObject SalvageBag)
        {
            try
            {
                SalvageRule sr = new SalvageRule();
                //Find an applicable material rule.
                List<SalvageRule> materialrules = (from allrules in SalvageRulesList
                    where (allrules.material == SalvageBag.Values(LongValueKey.Material)) &&
                           (SalvageBag.Values(DoubleValueKey.SalvageWorkmanship) >= allrules.minwork) &&
                           (SalvageBag.Values(DoubleValueKey.SalvageWorkmanship) <= (allrules.maxwork +0.99))
                           select allrules).ToList();

                if(materialrules.Count > 0){sr = materialrules.First();}
                else
                {
                    sr.material = SalvageBag.Values(LongValueKey.Material);
                    sr.minwork = 1;
                    sr.maxwork = 10;
                    sr.ruleid = "Default Rule";
                }

                List<WorldObject> PartialBags = Core.WorldFilter.GetInventory().Where(x => x.ObjectClass == ObjectClass.Salvage && x.Id != SalvageBag.Id &&
                                                x.Values(LongValueKey.Material) == sr.material && x.Values(LongValueKey.UsesRemaining) < 100  &&
                                                x.Values(DoubleValueKey.SalvageWorkmanship) >= sr.minwork && x.Values(DoubleValueKey.SalvageWorkmanship) <= (sr.maxwork + 0.99)
                                                ).ToList();

                //Why work if you don't have to.
                if(PartialBags.Count == 0) {return new List<int>();}

                List<int> CombineBagsList = new List<int>();
                CombineBagsList.Add(SalvageBag.Id);
                int salvagesum = SalvageBag.Values(LongValueKey.UsesRemaining);

                foreach(WorldObject salvbag in PartialBags)
                {
                    if(salvagesum < 100)
                    {
                        if(salvagesum + salvbag.Values(LongValueKey.UsesRemaining) < 125)
                        {
                            CombineBagsList.Add(salvbag.Id);
                            salvagesum += salvbag.Values(LongValueKey.UsesRemaining);
                        }
                    }
                    if(salvagesum >= 100) {break;}
                }

                return CombineBagsList;
            }catch(Exception ex){LogError(ex); return new List<int>();}
        }
开发者ID:Kkarinisme,项目名称:GearTemp,代码行数:49,代码来源:ItemTrackerActions.cs

示例4: LogLandblock

        public void LogLandblock(WorldObject container, Queue<string> LandBlockStrings)
        {
            try{

            location.Length = 0;
            //The below check should only log outdoor monsters if my reading is correct.

            if(!((container.Values(LongValueKey.Landblock) & (long)0xFF00) != 0))
            {
                //writer.WriteLine("LogTime,ContainerLocation,ContainerID,Container");
                location.Append(DateTime.Now.ToString("yyyyMMddHHmmss") + "," + container.Values(LongValueKey.Landblock) + "," + container.Id.ToString() + "," + container.Name);

                LandBlockStrings.Enqueue(location.ToString());

            }

            }catch{}
            return;
        }
开发者ID:irquk,项目名称:Gleaner,代码行数:19,代码来源:MDCLogger.cs

示例5: RecaclulteState

		private EquipmentTrackedItemState RecaclulteState(WorldObject wo)
		{
			// We need basic IdData to determine if an item is active
			if (!wo.HasIdData)
				return EquipmentTrackedItemState.Unknown;

			// If this item has no spells, its not activateable
			if (wo.SpellCount == 0 || wo.Values(LongValueKey.MaximumMana) == 0)
				return EquipmentTrackedItemState.NotActivatable;

			// If this item has no mana in it, it's not active
			if (wo.Values(LongValueKey.CurrentMana, 0) == 0)
				return EquipmentTrackedItemState.NotActive;


			// Go through and find all of our current active spells (enchantments)
			List<int> activeSpellsOnChar = new List<int>();

			foreach (EnchantmentWrapper wrapper in CoreManager.Current.CharacterFilter.Enchantments)
			{
				// Only add ones that are cast by items (have no duration)
				if (wrapper.TimeRemaining <= 0)
					activeSpellsOnChar.Add(wrapper.SpellId);
			}

			FileService service = CoreManager.Current.Filter<FileService>();


			// Lets check if the item is not active We check to see if this item has any spells that are not activated.
			bool inactiveSpellFound = false;

			// Go through all of this items spells to determine if all are active.
			for (int i = 0 ; i < wo.SpellCount ; i++)
			{
				int spellOnItemId = wo.Spell(i);

				if (wo.Exists(LongValueKey.AssociatedSpell) && (wo.Values(LongValueKey.AssociatedSpell) == spellOnItemId))
					continue;

				Spell spellOnItem = service.SpellTable.GetById(spellOnItemId);

				// If it is offensive, it is probably a cast on strike spell
				if (spellOnItem.IsDebuff || spellOnItem.IsOffensive)
					continue;


				// Check if this particular spell is active
				bool thisSpellIsActive = false;


				// Check to see if this item cast any spells on itself.
				for (int j = 0 ; j < wo.ActiveSpellCount ; j++)
				{
					int activeSpellOnItemId = wo.ActiveSpell(j);

					if ((service.SpellTable.GetById(activeSpellOnItemId).Family == spellOnItem.Family) && (service.SpellTable.GetById(activeSpellOnItemId).Difficulty >= spellOnItem.Difficulty))
					{
						thisSpellIsActive = true;
						break;
					}
				}

				if (thisSpellIsActive)
					continue;


				// Check to see if this item cast any spells on the player.
				foreach (int j in activeSpellsOnChar)
				{
					if (service.SpellTable.GetById(j) != null && (service.SpellTable.GetById(j).Family == spellOnItem.Family) && (service.SpellTable.GetById(j).Difficulty >= spellOnItem.Difficulty))
					{
						thisSpellIsActive = true;
						break;
					}
				}

				if (thisSpellIsActive)
					continue;

				// This item has not cast this particular spell.
				inactiveSpellFound = true;
				break;
			}


			if (inactiveSpellFound)
				return EquipmentTrackedItemState.NotActive;

			return EquipmentTrackedItemState.Active;
		}
开发者ID:IbespwnAC,项目名称:MagTools,代码行数:90,代码来源:EquipmentTrackedItem.cs

示例6: PropertySet

            public void PropertySet(WorldObject wo)
            {
                ObjectClass = wo.ObjectClass.ToString();

                foreach (var key in wo.BoolKeys)
                {
                    KeyBool kb = new KeyBool();
                    kb.Key = key;
                    kb.bValue = wo.Values((BoolValueKey)key);
                    BoolVals.Add(kb);

                    if(!MasterKeyClass.BoolKeys.Contains(key)){MasterKeyClass.BoolKeys.Add(key);}
                }

                foreach (var key in wo.DoubleKeys)
                {
                    KeyDouble kd = new KeyDouble();
                    kd.Key = key;
                    kd.dValue =  wo.Values((DoubleValueKey)key);
                    DoubleVals.Add(kd);

                    if(!MasterKeyClass.DoubleKeys.Contains(key)){MasterKeyClass.DoubleKeys.Add(key);}
                }

                foreach (var key in wo.LongKeys)
                {
                    KeyLong kl = new KeyLong();
                    kl.Key = key;
                    kl.lValue = wo.Values((LongValueKey)key);
                    LongVals.Add(kl);

                    if(!MasterKeyClass.LongKeys.Contains(key)){MasterKeyClass.LongKeys.Add(key);}
                }

                foreach (var key in wo.StringKeys)
                {
                    KeyString ks = new KeyString();
                    ks.Key = key;
                    ks.sValue = wo.Values((StringValueKey)key);
                    StringVals.Add(ks);

                    if(!MasterKeyClass.StringKeys.Contains(key)){MasterKeyClass.StringKeys.Add(key);}
                }

                for (int i = 0; i < wo.SpellCount; i++)
                {
                    SpellVals.Add(wo.Spell(i));
                }
            }
开发者ID:irquk,项目名称:Gleaner,代码行数:49,代码来源:DataStructures.cs

示例7: ItemIsEquippedByMe

		bool ItemIsEquippedByMe(WorldObject obj)
		{
			if (obj.Values(LongValueKey.EquippedSlots) <= 0)
				return false;

			// Weapons are in the -1 slot
			if (obj.Values(LongValueKey.Slot, -1) == -1)
				return (obj.Container == CoreManager.Current.CharacterFilter.Id);

			return true;
		}
开发者ID:IbespwnAC,项目名称:MagTools,代码行数:11,代码来源:EquipmentTracker.cs

示例8: ProcessPortalTie

		private void ProcessPortalTie(WorldObject spellTarget, RouteStartType type)
		{
			RouteStart startLoc = GetStartLocationByType(type);
			Coordinates coords;
			string dest = spellTarget.Values(StringValueKey.PortalDestination, "<None>");
			if (Coordinates.TryParse(dest, out coords))
			{
				if (startLoc.Coords != coords)
				{
					startLoc.Coords = coords;
					RefreshStartLocationListCoords();
					if (startLoc.Enabled)
						Util.Message(startLoc.Name + " start location set to " + startLoc.Coords);
				}
			}
			else
			{
				startLoc.Coords = Coordinates.NO_COORDINATES;
				RefreshStartLocationListCoords();
				if (startLoc.Enabled)
				{
					Util.Message("Could not determine destination of primary portal tie. "
						+ startLoc.Name + " start location set to " + startLoc.Coords);
				}
			}
		}
开发者ID:joshlatte,项目名称:goarrow,代码行数:26,代码来源:PluginCore.cs

示例9: LogItem

		private void LogItem(WorldObject item)
		{
			if (itemsLogged.Contains(item.Id))
				return;

			itemsLogged.Add(item.Id);

			DirectoryInfo pluginPersonalFolder = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\Decal Plugins\Mag-LootLogger");

			if (!pluginPersonalFolder.Exists)
				pluginPersonalFolder.Create();

			FileInfo logFile = new FileInfo(pluginPersonalFolder.FullName + @"\Loot.csv");

			if (!logFile.Exists)
			{
				using (StreamWriter writer = new StreamWriter(logFile.FullName, true))
				{
					writer.WriteLine("Timestamp,Container,Id,Name,ObjectClass,EquipSkill,MasteryBonus,DamageType,Variance,MaxDamage,ElementalDmgBonus,DamageBonus,ElementalDamageVersusMonsters,AttackBonus,MeleeDefenseBonus,MagicDBonus,MissileDBonus,ManaCBonus,BuffedMaxDamage,BuffedElementalDmgBonus,BuffedDamageBonus,BuffedElementalDamageVersusMonsters,BuffedAttackBonus,BuffedMeleeDefenseBonus,BuffedManaCBonus,WieldReqValue,Work,Value,Burden");

					writer.Close();
				}
			}

			using (StreamWriter writer = new StreamWriter(logFile.FullName, true))
			{
				MyWorldObject mwo = MyWorldObjectCreator.Create(item);

				StringBuilder output = new StringBuilder();

				output.Append(String.Format("{0:u}", DateTime.UtcNow) + ",");

				string containerName = CoreManager.Current.WorldFilter[item.Container] != null ? CoreManager.Current.WorldFilter[item.Container].Name : null;
				output.Append('"' + containerName + '"' + ",");

				output.Append(item.Id + ",");
				output.Append('"' + item.Name + '"' + ",");
				output.Append(item.ObjectClass.ToString() + ",");

				string skillName = Constants.SkillInfo.ContainsKey(item.Values(LongValueKey.EquipSkill)) ? Constants.SkillInfo[item.Values(LongValueKey.EquipSkill)] : null;
				output.Append((item.Values(LongValueKey.EquipSkill) > 0 ? skillName : String.Empty) + ",");

				string masteryName = Constants.MasteryInfo.ContainsKey(item.Values((LongValueKey)353)) ? Constants.MasteryInfo[item.Values((LongValueKey)353)] : null;
				output.Append((item.Values((LongValueKey)353) > 0 ? masteryName : String.Empty) + ",");

				if (item.Values(LongValueKey.DamageType) > 0)
				{
					if ((item.Values(LongValueKey.DamageType) & 1) == 1) output.Append("Slash");
					if ((item.Values(LongValueKey.DamageType) & 2) == 2) output.Append("Pierce");
					if ((item.Values(LongValueKey.DamageType) & 4) == 4) output.Append("Bludge");
					if ((item.Values(LongValueKey.DamageType) & 8) == 8) output.Append("Cold");
					if ((item.Values(LongValueKey.DamageType) & 16) == 16) output.Append("Fire");
					if ((item.Values(LongValueKey.DamageType) & 32) == 32) output.Append("Acid");
					if ((item.Values(LongValueKey.DamageType) & 64) == 64) output.Append("Electrical");
				}
				else if (item.Values(LongValueKey.WandElemDmgType) > 0)
				{
					if ((item.Values(LongValueKey.WandElemDmgType) & 1) == 1) output.Append("Slash");
					if ((item.Values(LongValueKey.WandElemDmgType) & 2) == 2) output.Append("Pierce");
					if ((item.Values(LongValueKey.WandElemDmgType) & 4) == 4) output.Append("Bludge");
					if ((item.Values(LongValueKey.WandElemDmgType) & 8) == 8) output.Append("Cold");
					if ((item.Values(LongValueKey.WandElemDmgType) & 16) == 16) output.Append("Fire");
					if ((item.Values(LongValueKey.WandElemDmgType) & 32) == 32) output.Append("Acid");
					if ((item.Values(LongValueKey.WandElemDmgType) & 64) == 64) output.Append("Electrical");
				}
				output.Append(",");

				output.Append((item.Values(DoubleValueKey.Variance) > 0 ? item.Values(DoubleValueKey.Variance).ToString("N3") : String.Empty) + ",");
				output.Append((item.Values(LongValueKey.MaxDamage) > 0 ? item.Values(LongValueKey.MaxDamage).ToString() : String.Empty) + ",");
				output.Append((item.Values(LongValueKey.ElementalDmgBonus, 0) != 0 ? item.Values(LongValueKey.ElementalDmgBonus).ToString() : String.Empty) + ",");
				output.Append((item.Values(DoubleValueKey.DamageBonus, 1) != 1 ? Math.Round(((item.Values(DoubleValueKey.DamageBonus) - 1) * 100)).ToString() : String.Empty) + ",");
				output.Append((item.Values(DoubleValueKey.ElementalDamageVersusMonsters, 1) != 1 ? Math.Round(((item.Values(DoubleValueKey.ElementalDamageVersusMonsters) - 1) * 100)).ToString() : String.Empty) + ",");
				output.Append((item.Values(DoubleValueKey.AttackBonus, 1) != 1 ? Math.Round(((item.Values(DoubleValueKey.AttackBonus) - 1) * 100)).ToString() : String.Empty) + ",");
				output.Append((item.Values(DoubleValueKey.MeleeDefenseBonus, 1) != 1 ? Math.Round(((item.Values(DoubleValueKey.MeleeDefenseBonus) - 1) * 100)).ToString() : String.Empty) + ",");
				output.Append((item.Values(DoubleValueKey.MagicDBonus, 1) != 1 ? Math.Round(((item.Values(DoubleValueKey.MagicDBonus) - 1) * 100), 1).ToString() : String.Empty) + ",");
				output.Append((item.Values(DoubleValueKey.MissileDBonus, 1) != 1 ? Math.Round(((item.Values(DoubleValueKey.MissileDBonus) - 1) * 100), 1).ToString() : String.Empty) + ",");
				output.Append((item.Values(DoubleValueKey.ManaCBonus) != 0 ? Math.Round((item.Values(DoubleValueKey.ManaCBonus) * 100)).ToString() : String.Empty) + ",");

				output.Append((mwo.GetBuffedIntValueKey((int)LongValueKey.MaxDamage) > 0 ? mwo.GetBuffedIntValueKey((int)LongValueKey.MaxDamage).ToString() : String.Empty) + ",");
				output.Append((mwo.GetBuffedIntValueKey((int)LongValueKey.ElementalDmgBonus) > 0 ? mwo.GetBuffedIntValueKey((int)LongValueKey.ElementalDmgBonus).ToString() : String.Empty) + ",");
				output.Append((mwo.GetBuffedDoubleValueKey((int)DoubleValueKey.DamageBonus, 1) != 1 ? Math.Round(((mwo.GetBuffedDoubleValueKey((int)DoubleValueKey.DamageBonus) - 1) * 100)).ToString() : String.Empty) + ",");
				output.Append((mwo.BuffedElementalDamageVersusMonsters != -1 ? Math.Round(((mwo.BuffedElementalDamageVersusMonsters - 1) * 100)).ToString() : String.Empty) + ",");
				output.Append((mwo.BuffedAttackBonus != -1 ? Math.Round(((mwo.BuffedAttackBonus - 1) * 100)).ToString() : String.Empty) + ",");
				output.Append((mwo.BuffedMeleeDefenseBonus != -1 ? Math.Round(((mwo.BuffedMeleeDefenseBonus - 1) * 100)).ToString() : String.Empty) + ",");
				output.Append((mwo.BuffedManaCBonus != -1 ? Math.Round(mwo.BuffedManaCBonus * 100).ToString() : String.Empty) + ",");

				output.Append((item.Values(LongValueKey.WieldReqValue) > 0 ? item.Values(LongValueKey.WieldReqValue).ToString() : String.Empty) + ",");

				output.Append((item.Values(LongValueKey.Workmanship) > 0 ? item.Values(LongValueKey.Workmanship).ToString() : String.Empty) + ",");
				output.Append((item.Values(LongValueKey.Value) > 0 ? item.Values(LongValueKey.Value).ToString() : String.Empty) + ",");
				output.Append((item.Values(LongValueKey.Burden) > 0 ? item.Values(LongValueKey.Burden).ToString() : String.Empty) + ",");

				writer.WriteLine(output);

				writer.Close();
			}
		}
开发者ID:IbespwnAC,项目名称:MagTools,代码行数:97,代码来源:Class1.cs


注:本文中的WorldObject.Values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。