Esempio n. 1
0
    public void EquipWeapon(WeaponRecord weapon, bool playSound = true)
    {
        // Play equip sound if needed (Don't want to play it when NPC's spawn for example)
        if (playSound)
        {
            weapon.PickupSound.PlaySoundAtPoint(transform.position);
        }

        // If a weapon is equipped, unequip it and equip the new one
        if (weaponEquipped)
        {
            // Unequip any existing weapons from the character's hands
            // Need this null check, as hand-to-hand could be equipped
            if (EquippedWeapon != null)
            {
                (EquippedWeapon as IEquippable).Unequip(body.PartParts);
            }

            (weapon as IEquippable).Equip(body.PartParts);
            OnWeaponChanged?.Invoke(weapon.Data.type);
        }

        EquippedWeapon = weapon;
        equippedItems[EquipmentSlot.Weapon] = weapon;
        animation.SetParameter("WeaponType", EquippedWeapon.Data.type);
    }
        public override bool UseWeapon(short cellid)
        {
            var target = Fight.GetFighter(cellid);
            CharacterItemRecord weapon = Client.Character.Inventory.GetEquipedWeapon();

            if (weapon == null)
            {
                UsePunch(cellid);
                return(true);
            }
            WeaponRecord template = WeaponRecord.GetWeapon(weapon.GID);
            FightSpellCastCriticalEnum critical = RollCriticalDice(template);

            Fight.TryStartSequence(this.ContextualId, 2);
            int targetId = target != null ? target.ContextualId : 0;

            Fight.Send(new GameActionFightCloseCombatMessage(0, this.ContextualId, targetId, cellid, (sbyte)critical, false, weapon.GID));
            var effects = template.GetWeaponEffects(critical);

            this.HandleWeaponEffect(cellid, effects, critical);
            this.FighterStats.Stats.ActionPoints -= template.ApCost;
            this.GameActionFightPointsVariation(ActionsEnum.ACTION_CHARACTER_ACTION_POINTS_USE, (short)(-template.ApCost));
            Fight.TryEndSequence(2, 0);
            return(true);
        }
Esempio n. 3
0
        //  [StartupInvoke("Item SkinModule", StartupInvokePriority.Modules)]
        public static void SynchronizeItems()
        {
            BigEndianReader reader = new BigEndianReader(File.ReadAllBytes(ItemsPath));

            List <MA3Item> items = new List <MA3Item>();

            while (reader.BytesAvailable > 0)
            {
                MA3Item item = new MA3Item();
                item.Deserialize(reader);
                items.Add(item);
            }

            foreach (var item in items)
            {
                ItemRecord record = ItemRecord.GetItem((ushort)item.Id);

                if (record != null && record.AppearanceId != item.Skin && item.Skin != 0)
                {
                    if (record.Weapon)
                    {
                        var weaponRecord = WeaponRecord.GetWeapon((ushort)item.Id);
                        weaponRecord.Template.AppearanceId = (ushort)item.Skin;
                        weaponRecord.UpdateInstantElement();
                    }
                    else
                    {
                        record.AppearanceId = (ushort)item.Skin;
                        record.UpdateInstantElement();
                    }

                    logger.Gray("Fixed: " + record.Name);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// A trouver = TextInformationMessage (Vous avez dus lacher votre arme a deux mains pour pouvoir équiper)
        /// </summary>
        /// <param name="position"></param>
        /// <param name="item"></param>
        public void CheckTwoHandeds(CharacterInventoryPositionEnum position, CharacterItemRecord item)
        {
            if (position == CharacterInventoryPositionEnum.ACCESSORY_POSITION_WEAPON)
            {
                if (WeaponRecord.GetWeapon(item.GId).TwoHanded)
                {
                    CharacterItemRecord shield = GetEquipedItem(CharacterInventoryPositionEnum.ACCESSORY_POSITION_SHIELD);

                    if (shield != null)
                    {
                        UnequipItem(shield, shield.Quantity);
                        OnObjectMoved(shield, CharacterInventoryPositionEnum.INVENTORY_POSITION_NOT_EQUIPED);

                        Character.TextInformation(TextInformationTypeEnum.TEXT_INFORMATION_MESSAGE, 79);
                    }
                }
            }
            else if (position == CharacterInventoryPositionEnum.ACCESSORY_POSITION_SHIELD)
            {
                CharacterItemRecord weapon = GetEquipedItem(CharacterInventoryPositionEnum.ACCESSORY_POSITION_WEAPON);

                if (weapon != null && WeaponRecord.GetWeapon(weapon.GId).TwoHanded)
                {
                    UnequipItem(weapon, weapon.Quantity);
                    OnObjectMoved(weapon, CharacterInventoryPositionEnum.INVENTORY_POSITION_NOT_EQUIPED);

                    Character.TextInformation(TextInformationTypeEnum.TEXT_INFORMATION_MESSAGE, 78);
                }
            }
        }
Esempio n. 5
0
        internal static void filterWeapons(ref SettingHandle <DictWeaponRecordHandler> setting, List <ThingDef> allWeapons, SettingHandle <float> filter = null)
        {
            if (setting.Value == null)
            {
                setting.Value = new DictWeaponRecordHandler();
            }

            Dictionary <String, WeaponRecord> selection = new Dictionary <string, WeaponRecord>();

            foreach (ThingDef weapon in allWeapons)
            {
                bool shouldSelect = false;
                if (filter != null)
                {
                    float mass = weapon.GetStatValueAbstract(StatDefOf.Mass);
                    shouldSelect = mass >= filter.Value;
                }
                WeaponRecord value = null;
                bool         found = setting.Value.InnerList.TryGetValue(weapon.defName, out value);
                if (found && value.isException)
                {
                    selection.Add(weapon.defName, value);
                }
                else
                {
                    selection.Add(weapon.defName, new WeaponRecord(shouldSelect, false, weapon.label));
                }
            }
            selection = selection.OrderBy(d => d.Value.label).ToDictionary(d => d.Key, d => d.Value);
            setting.Value.InnerList = selection;
        }
Esempio n. 6
0
 public MachineGun(WeaponType type, WeaponRecord record)
 {
     _damage   = record.Damage;
     _fireRate = record.FireRate;
     _cooldown = record.Cooldown;
     _speed    = record.Speed;
     _type     = type;
 }
Esempio n. 7
0
        public InstanceWeapon AddWeapon(WeaponRecord weaponRecord)
        {
            this.weapons = this.weapons ?? new List <InstanceWeapon>();
            var instanceWeapon = new InstanceWeapon(weaponRecord);

            this.weapons.Add(instanceWeapon);

            return(instanceWeapon);
        }
        public SpellLevelRecord GetWeaponSpellLevel(WeaponRecord weapon)
        {
            List <EffectInstance> effects         = SelectWeaponEffects(weapon.Template.Effects);
            List <EffectInstance> criticalEffects = GetCriticalEffects(weapon, SelectWeaponEffects(weapon.Template.Effects));
            short maxCastPerTurn = GetMaxCastPerTurn(weapon.ApCost);

            return(new SpellLevelRecord(-1, WeaponManager.PunchSpellId, 1, weapon.ApCost, weapon.MinRange,
                                        weapon.MaxRange, weapon.CastInLine, weapon.CastInDiagonal, weapon.CastTestLos,
                                        weapon.CriticalHitProbability, false, false, false, false, 0, maxCastPerTurn, 0,
                                        0, 0, 0, new List <short>(), new List <short>(), effects, criticalEffects));
        }
Esempio n. 9
0
        public override void Ready(bool ready, ushort step)
        {
            List<CharacterItemRecord> results = new List<CharacterItemRecord>();
            Dictionary<uint, uint> removed = new Dictionary<uint, uint>();

            if (ready)
            {
                var recipe = GetRecipe();

                if (recipe != null && recipe.ResultLevel <= CharacterJob.Level)
                {
                    for (int i = 0; i < Count; i++)
                    {
                        if (Character.IsInExchange(ExchangeTypeEnum.CRAFT))
                        {
                            results.Add(recipe.Result.GetCharacterItem(Character.Id, 1, true)); // True = jet parfait

                            foreach (var ingredient in CraftedItems.GetItems())
                            {
                                if (!removed.ContainsKey(ingredient.UId))
                                    removed.Add(ingredient.UId, ingredient.Quantity);
                                else
                                    removed[ingredient.UId] += ingredient.Quantity;
                            }
                        }
                        else
                            return;
                    }

                    CraftedItems.Clear(false);

                    Character.Inventory.RemoveItems(removed);
                    Character.Inventory.AddItems(results);

                    OnCraftResulted(CraftResultEnum.CRAFT_SUCCESS, results.Last());

                    Character.SendMap(new ExchangeCraftInformationObjectMessage((sbyte)CraftResultEnum.CRAFT_SUCCESS, recipe.ResultId, (ulong)Character.Id));

                    int craftXpRatio = recipe.Result.Weapon ? WeaponRecord.GetWeapon(recipe.ResultId).CraftXpRatio : -1;
                    int exp = FormulasProvider.Instance.GetCraftXpByJobLevel(recipe.ResultLevel, CharacterJob.Level, craftXpRatio);
                    Character.AddJobExp(JobType, (ulong)(exp * Count));
                    SetCount(1);
                }
                else
                {
                    OnCraftResulted(CraftResultEnum.CRAFT_FAILED);
                }
            }
            else
            {
                OnCraftResulted(CraftResultEnum.CRAFT_FAILED);
            }
        }
Esempio n. 10
0
        public FightSpellCastCriticalEnum RollCriticalDice(WeaponRecord weapon)
        {
            AsyncRandom asyncRandom           = new AsyncRandom();
            FightSpellCastCriticalEnum result = FightSpellCastCriticalEnum.NORMAL;
            int num = (int)this.CalculateCriticRate(weapon.CriticalHitProbability) / 6;

            if (weapon.CriticalHitProbability != 0 && asyncRandom.Next(num) == 0)
            {
                result = FightSpellCastCriticalEnum.CRITICAL_HIT;
            }
            return(result);
        }
Esempio n. 11
0
        private List <EffectInstance> GetCriticalEffects(WeaponRecord weapon, List <EffectInstance> effects)
        {
            List <EffectInstance> results = new List <EffectInstance>();

            foreach (var effect in effects.FindAll(x => WeaponBoostableEffects.Contains(x.EffectEnum)))
            {
                EffectInstance newEffect = effect.Clone();
                newEffect.DiceMin += (ushort)weapon.CriticalHitBonus;
                newEffect.DiceMax += (ushort)weapon.CriticalHitBonus;
                results.Add(newEffect);
            }
            return(results);
        }
Esempio n. 12
0
        public override void Initialize()
        {
            this.Id    = (int)Character.Id;
            this.Look  = Character.Look.Clone();
            this.Stats = new FighterStats(Character);

            if (Character.Inventory.HasWeaponEquiped)
            {
                this.WeaponTemplate = WeaponRecord.GetWeapon(Character.Inventory.GetWeapon().GId);
                this.WeaponLevel    = WeaponManager.Instance.GetWeaponSpellLevel(WeaponTemplate);
            }

            base.Initialize();
        }
Esempio n. 13
0
 public WeaponWrapper()
 {
     WrappedItem = new WeaponRecord();
     m_name      = new LangText();
     m_name.SetText(Languages.All, "New weapon");
     m_description = new LangText();
     m_description.SetText(Languages.All, "Item description");
     m_effects                    = new ObservableCollection <EffectWrapper>();
     WrappedItem.recipeIds        = new List <uint>();
     WrappedItem.favoriteSubAreas = new List <uint>();
     WrappedItem.possibleEffects  = new List <EffectInstance>();
     WrappedItem.criteria         = "";
     WrappedItem.criteriaTarget   = "";
     WrappedItem.itemSetId        = -1;
     New = true;
 }
        /// <summary>
        /// 必要な武器を選択し終えるまで選択を再帰的に行う
        /// </summary>
        private static void StartSelectConsumeInstanceWeaponRecursive(
            this ISelectConsumeInstanceWeapons self,
            Actor actor,
            WeaponRecord targetWeaponRecord,
            List <WeaponRecord> targetWeaponRecords,
            List <InstanceWeapon> selectConsumeInstanceWeapons,
            Action <List <InstanceWeapon> > OnCompleteSelect,
            Action OnCancel
            )
        {
            Assert.IsNotNull(targetWeaponRecord, $"対象となる{typeof(WeaponRecord)}がありません");

            // 所持している武器から対象となる武器を抽出
            var targetInstanceWeapons = actor.StatusController.Inventory.Weapons
                                        .Where(x => x.WeaponRecord == targetWeaponRecord)
                                        .ToList();

            Broker.Global.Publish(RequestShowGridUI.Get(targetInstanceWeapons, i =>
            {
                selectConsumeInstanceWeapons.Add(targetInstanceWeapons[i]);

                Broker.Global.Publish(RequestHideGridUI.Get());

                var nextTargetWeaponRecord = GetTargetWeaponRecord(targetWeaponRecords, selectConsumeInstanceWeapons);

                // 次に選択する武器がない場合は完了処理を実行
                if (nextTargetWeaponRecord == null)
                {
                    OnCompleteSelect(selectConsumeInstanceWeapons);
                }
                else
                {
                    self.StartSelectConsumeInstanceWeaponRecursive(
                        actor,
                        nextTargetWeaponRecord,
                        targetWeaponRecords,
                        selectConsumeInstanceWeapons,
                        OnCompleteSelect,
                        OnCancel
                        );
                }
            }, () =>
            {
                OnCancel();
            }));
        }
        public void AddWeapon(WeaponRecord weaponRecord)
        {
            var instanceWeapon = this.Inventory.AddWeapon(weaponRecord);

            // 装備していない箇所があったら自動的に装備する
            for (var i = 0; i < this.status.EquippedWeapons.Count; i++)
            {
                var e = this.status.EquippedWeapons[i];
                if (!e.IsEquipped)
                {
                    this.ChangeEquippedWeapon(i, instanceWeapon);
                    break;
                }
            }

            this.owner.Broker.Publish(AcquiredWeapon.Get(instanceWeapon));
        }
Esempio n. 16
0
    public void UnequipWeapon()
    {
        if (EquippedWeapon == null)
        {
            return;
        }

        if (weaponEquipped)
        {
            (EquippedWeapon as IEquippable).Unequip(body.PartParts);
        }

        EquippedWeapon.DropSound.PlaySoundAtPoint(transform.position);
        equippedItems.Remove(EquipmentSlot.Weapon);
        EquippedWeapon = null;
        animation.SetParameter("WeaponType", WeaponType.HandToHand);
    }
Esempio n. 17
0
        // Token: 0x0600001D RID: 29 RVA: 0x00002B70 File Offset: 0x00000D70
        internal static void filterWeapons(ref SettingHandle <DictWeaponRecordHandler> setting, List <ThingDef> allWeapons, SettingHandle <float> filter = null)
        {
            bool flag = setting.Value == null;

            if (flag)
            {
                setting.Value = new DictWeaponRecordHandler();
            }
            Dictionary <string, WeaponRecord> dictionary = new Dictionary <string, WeaponRecord>();

            foreach (ThingDef thingDef in allWeapons)
            {
                bool flag2 = false;
                bool flag3 = filter != null;
                if (flag3)
                {
                    float statValueAbstract = thingDef.GetStatValueAbstract(StatDefOf.Mass, null);
                    flag2 = (statValueAbstract >= filter.Value);
                }
                WeaponRecord weaponRecord = null;
                bool         flag4        = setting.Value.InnerList.TryGetValue(thingDef.defName, out weaponRecord);
                bool         flag5        = flag4 && weaponRecord.isException;
                if (flag5)
                {
                    dictionary.Add(thingDef.defName, weaponRecord);
                }
                else
                {
                    DefModExtension_SettingDefaults modExtension;
                    bool flag6 = (modExtension = thingDef.GetModExtension <DefModExtension_SettingDefaults>()) != null && modExtension.weaponForbidden;
                    flag2 = ((filter == null) ? flag6 : flag2);
                    dictionary.Add(thingDef.defName, new WeaponRecord(flag2, false, thingDef.label));
                }
            }
            dictionary = (from d in dictionary
                          orderby d.Value.label
                          select d).ToDictionary((KeyValuePair <string, WeaponRecord> d) => d.Key, (KeyValuePair <string, WeaponRecord> d) => d.Value);
            setting.Value.InnerList = dictionary;
        }
Esempio n. 18
0
 public WeaponWrapper(WeaponRecord wrappedWeapon)
     : base(wrappedWeapon)
 {
     WrappedItem = wrappedWeapon;
 }
Esempio n. 19
0
 public void Setup(WeaponRecord weapon)
 {
     this.controlledRenderer.sprite = weapon.Icon;
 }
Esempio n. 20
0
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.Draw(gameTime);

            ActivePlayer.Profile.DrawGamerTag(TransitionAlpha);

            GraphicsDevice device      = ScreenManager.GraphicsDevice;
            SpriteBatch    spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();

            spriteBatch.Draw(background, backgroundRect, Color.White * (TransitionAlpha - 0.2f));

            if (MenuEntries[SelectedEntry].Text != "Back" &&
                ActivePlayer.Profile.IsWeaponUnlocked(MenuEntries[SelectedEntry].Text + ".gun"))
            {
                // Draw weapon record
                WeaponRecord record = ActivePlayer.Profile.WeaponRecords[MenuEntries[SelectedEntry].Text + ".gun"];
                GunStats     stats  = ActivePlayer.Profile.GetWeaponStats(MenuEntries[SelectedEntry].Text + ".gun");

                string recordString = "Ammo        : " + stats.MaxAmmo + "\n" +
                                      "Precision   : " + (1.0f - stats.Accuracy * 10.0f).ToString("P") + "\n" +
                                      "Fire Mode   : " + (stats.FireType == FireType.SemiAuto ? "Semi-Auto\n" : "Full-Auto\n") +
                                      "Bullet Type : " + (stats.BulletType == BulletType.Penetrative ? "FMJ\n" : "Hollow-Point\n") +
                                      "\n" +
                                      "Targets Hit  : " + record.TargetsHit + "\n" +
                                      "Shots Fired  : " + record.ShotsFired + "\n" +
                                      "Accuracy     : " + record.Accuracy.ToString("P") + "\n" +
                                      "Multi-Shots  : " + record.Multishots.ToString() + "\n" +
                                      "Long Shots   : " + record.Longshots.ToString() + "\n" +
                                      "Sniper Shots : " + record.Snipershots.ToString() + "\n" +
                                      "Bullseyes    : " + record.Bullseyes.ToString() + "\n" +
                                      "Headshots    : " + record.Headshots.ToString();

                Vector2 size     = bigFont.MeasureString(recordString);
                Vector2 position = new Vector2(backgroundRect.X + (backgroundRect.Width - size.X) / 2,
                                               backgroundRect.Y + (backgroundRect.Height - size.Y) / 2);

                spriteBatch.DrawString(bigFont, recordString, position, Color.White * TransitionAlpha);
            }
            else
            {
                // Print instructions
                string instructions = "Increase your Total Score" + "\n" +
                                      "to unlock more weapons to" + "\n" +
                                      "use in Score Attack and " + "\n" +
                                      "Weapon Challenges";

                Vector2 size     = bigFont.MeasureString(instructions);
                Vector2 position = new Vector2(backgroundRect.X + (backgroundRect.Width - size.X) / 2,
                                               backgroundRect.Y + (backgroundRect.Height - size.Y) / 2);

                if (MenuEntries[SelectedEntry].Text != "Back")
                {
                    // Print requirements to unlock this weapon
                    string unlockedString = "Locked (" + ActivePlayer.Profile.TotalScore.ToString() + "/" +
                                            ActivePlayer.Profile.GetWeaponScoreRequirement(MenuEntries[SelectedEntry].Text + ".gun") + ")";

                    size = styleFont.MeasureString(unlockedString);
                    Vector2 unlockedPosition = new Vector2(backgroundRect.X + (backgroundRect.Width - size.X) / 2,
                                                           backgroundRect.Y + (backgroundRect.Height * 0.25f - size.Y / 2));

                    spriteBatch.DrawString(styleFont, unlockedString, unlockedPosition, Color.White * TransitionAlpha);
                }

                spriteBatch.DrawString(bigFont, instructions, position, Color.White * TransitionAlpha);
            }

            spriteBatch.End();
        }
Esempio n. 21
0
 void IAddWeapon.Setup(WeaponRecord weapon)
 {
     this.weapon = weapon;
 }
Esempio n. 22
0
        public override void Ready(bool ready, ushort step)
        {
            List <CharacterItemRecord> results = new List <CharacterItemRecord>();
            Dictionary <uint, uint>    removed = new Dictionary <uint, uint>();

            if (ready)
            {
                var recipe = this.GetRecipe();

                if (recipe != null && recipe.ResultLevel <= this.CharacterJob.Level)
                {
                    var recipeResult = recipe.Result;
                    if (recipeResult == null) // Tables load ordering problem. Temporary solution?
                    {
                        recipeResult = ItemRecord.Items.Find(it => it.Id == recipe.ResultId);
                    }

                    for (int i = 0; i < this.Count; i++)
                    {
                        if (this.Character.IsInExchange(ExchangeTypeEnum.CRAFT))
                        {
                            results.Add(recipeResult.GetCharacterItem(this.Character.Id, 1, false)); // True = jet parfait

                            foreach (var ingredient in this.CraftedItems.GetItems())
                            {
                                if (!removed.ContainsKey(ingredient.UId))
                                {
                                    removed.Add(ingredient.UId, ingredient.Quantity);
                                }
                                else
                                {
                                    removed[ingredient.UId] += ingredient.Quantity;
                                }
                            }
                        }
                        else
                        {
                            return;
                        }
                    }

                    this.CraftedItems.Clear(false);

                    this.Character.Inventory.RemoveItems(removed);
                    this.Character.Inventory.AddItems(results);

                    this.OnCraftResulted(CraftResultEnum.CRAFT_SUCCESS, results.Last());

                    this.Character.SendMap(new ExchangeCraftInformationObjectMessage((sbyte)CraftResultEnum.CRAFT_SUCCESS, recipe.ResultId, (ulong)this.Character.Id));

                    int craftXpRatio = recipeResult.Weapon ? WeaponRecord.GetWeapon(recipe.ResultId).CraftXpRatio : -1;
                    int exp          = FormulasProvider.Instance.GetCraftXpByJobLevel(recipe.ResultLevel, this.CharacterJob.Level, craftXpRatio);
                    this.Character.AddJobExp(this.JobType, (ulong)(exp * this.Count * WorldConfiguration.Instance.JobXpRate));
                    this.SetCount(1);
                }
                else
                {
                    this.OnCraftResulted(CraftResultEnum.CRAFT_FAILED);
                }
            }
            else
            {
                this.OnCraftResulted(CraftResultEnum.CRAFT_FAILED);
            }
        }
Esempio n. 23
0
        public void EquipItem(CharacterItemRecord item, ItemRecord template, byte newposition, uint quantity)
        {
            if (!ConditionProvider.ParseAndEvaluate(Character.Client, template.Criteria))
            {
                Character.Reply("Vous n'avez pas les critères nessessaire pour équiper cet objet");
                return;
            }
            if (CheckRingStacks(item, newposition))
            {
                Character.Reply("Vous avez déja équipé cet anneau!");
                return;
            }
            if (CheckDofusStacks(item, newposition))
            {
                Character.Reply("Vous avez déja équipé ce dofus");
                return;
            }
            if (DOFUS_POSITIONS.Contains((CharacterInventoryPositionEnum)item.Position) && DOFUS_POSITIONS.Contains((CharacterInventoryPositionEnum)newposition))
            {
                return;
            }
            if ((CharacterInventoryPositionEnum)newposition == CharacterInventoryPositionEnum.ACCESSORY_POSITION_SHIELD)
            {
                var weapon = GetEquipedWeapon();
                if (weapon != null)
                {
                    if (WeaponRecord.GetWeapon(weapon.GID).TwoHanded)
                    {
                        Character.Reply("Vous devez deséquiper votre arme pour équiper le bouclier.");
                        return;
                    }
                }
            }
            if ((CharacterInventoryPositionEnum)newposition == CharacterInventoryPositionEnum.ACCESSORY_POSITION_WEAPON)
            {
                var shield = GetItemByPosition(CharacterInventoryPositionEnum.ACCESSORY_POSITION_SHIELD);
                if (WeaponRecord.GetWeapon(item.GID).TwoHanded)
                {
                    Character.Reply("Vous devez enlevé votre bouclier pour équiper votre arme.");
                    return;
                }
            }
            var equiped = EquipedItem(newposition);

            if (equiped != null)
            {
                UnequipItem(equiped, 63, equiped.GetTemplate(), quantity);
                SaveTask.UpdateElement(equiped);
            }
            if (item.Quantity == 1)
            {
                item.Position = newposition;
                SaveTask.UpdateElement(item);
                AddItemSkin(item, template);
                ItemEffectsProvider.AddEffects(Character.Client, item.GetEffects());
            }
            else
            {
                var items = ItemCut.Cut(item, quantity, newposition);
                Add(items.newItem);
                ItemEffectsProvider.AddEffects(Character.Client, items.BaseItem.GetEffects());
                AddItemSkin(item, template);
            }
            Character.RefreshGroupInformations();
        }
Esempio n. 24
0
 public InstanceWeapon(WeaponRecord weaponRecord)
 {
     this.WeaponRecord = weaponRecord;
 }
Esempio n. 25
0
        string WriteWeapons(string pc)
        {
            string prefix            = pc + "/_wpn/";
            List <WeaponRecord> wpns = new List <WeaponRecord>();

            foreach (var k in master.Keys)
            {
                if (!k.StartsWith(prefix))
                {
                    continue;
                }

                Dict d = master[k];

                var w = new WeaponRecord();
                w.name     = k.Substring(prefix.Length);
                w.sr       = GetInt(d, "sr");
                w.parry    = GetInt(d, "parry");
                w.attack   = GetInt(d, "attack");
                w.ap       = GetInt(d, "ap");
                w.dmg      = GetStr(d, "dmg");
                w.goodness = w.parry + w.attack;

                wpns.Add(w);
            }

            wpns.Sort((w1, w2) => {
                if (w1.goodness > w2.goodness)
                {
                    return(-1);
                }
                if (w1.goodness < w2.goodness)
                {
                    return(1);
                }
                return(String.Compare(w1.name, w2.name));
            });

            var b = NewTable();

            b.Append("<TR>" +
                     "<TD><B>Name</B></TD>" +
                     "<TD><B>Attack</B></TD>" +
                     "<TD><B>Parry</B></TD>" +
                     "<TD><B>Damage</B></TD>" +
                     "<TD><B>AP</B></TD>" +
                     "<TD><B>SR</B></TD>" +
                     "</TR>");

            foreach (var w in wpns)
            {
                b.Append("<TR><TD>");
                b.Append(w.name);
                b.Append("</TD><TD>");
                b.Append(w.attack);
                b.Append("</TD><TD>");
                b.Append(w.parry);
                b.Append("</TD><TD>");
                b.Append(w.dmg);
                b.Append("</TD><TD>");
                b.Append(w.ap);
                b.Append("</TD><TD>");
                b.Append(w.sr);
                b.Append("</TD></TR>");
            }

            EndTable(b);
            return(b.ToString());
        }