Exemplo n.º 1
0
    /// <summary>
    /// Returns a list of random affixes in this pool, making sure they are all of different types. The tiers will be determined through the provided Lottery.
    /// </summary>
    /// <param name="totalTiers">The total number of tiers of affixes to be generated</param>
    /// <param name="tierDistribution">The distribution of tiers</param>
    /// <returns></returns>
    public Affix[] GetUniqueRandomAffixes(int totalTiers, Lottery <int> tierDistribution, HashSet <AffixType> blacklist)
    {
        List <Affix> affixes = new List <Affix>();

        lottery.StartBatchDraw(blacklist);
        while (totalTiers > 0)
        {
            // Get the tier of the Affix to be generated and cap it if it exceeds the total number of tiers left
            int tier = tierDistribution.Draw();
            tier = tier > totalTiers ? totalTiers : tier;

            AffixType type = GetRandomType();
            if (type == AffixType.None)
            {
                // We've run out of AffixTypes to draw from
                break;
            }

            affixes.Add(AffixInfo.GetAffixInfo(type).GenerateAffix(tier));
            totalTiers -= tier;
        }
        lottery.EndBatchDraw();

        return(affixes.ToArray());
    }
        public SubconditionAffixControlViewModel(ConditionAffix condition, List <Affix> affixes, StatValueType statValueType, AffixType affixType, PoeCrafting.Entities.ItemBase itemBase)
        {
            _statValueType = statValueType;
            _affixes       = affixes;
            _affixType     = affixType;
            _itemBase      = itemBase;

            AffixName = condition.ModType;

            if (condition.Min1.HasValue)
            {
                FirstStatMin = condition.Min1.Value;
            }
            if (condition.Max1.HasValue)
            {
                FirstStatMax = condition.Max1.Value;
            }
            if (condition.Min2.HasValue)
            {
                SecondStatMin = condition.Min2.Value;
            }
            if (condition.Max2.HasValue)
            {
                SecondStatMax = condition.Max2.Value;
            }
            if (condition.Min3.HasValue)
            {
                ThirdStatMin = condition.Min3.Value;
            }
            if (condition.Max3.HasValue)
            {
                ThirdStatMax = condition.Max3.Value;
            }
        }
Exemplo n.º 3
0
        private void SaveAffixJson(AffixType type, List <AffixBase> affixList)
        {
            string fileName = type.ToString().ToLower();
            string filePath = "\\affixes\\" + fileName;

            SaveToJson <AffixBase>(filePath, affixList);
        }
Exemplo n.º 4
0
 public void SetType(AffixType type)
 {
     currentInfo      = AffixInfo.GetAffixInfo(type);
     NameDisplay.text = currentInfo.Name;
     DescriptionDisplay.SetText(currentInfo.Description);
     ValueInfoDisplay.SetInfo(currentInfo.ValueInfo);
 }
Exemplo n.º 5
0
        public void GetFlatPrefixMultipleAffixTest()
        {
            String    correctModName   = "correctMod";
            String    incorrectModName = "incorrectMod";
            int       testValue1       = 5;
            int       testValue2       = 10;
            int       testValue3       = 3;
            AffixType affixType        = AffixType.Prefix;

            Affix correctAffix   = CreateTestAffix(correctModName, affixType);
            Affix incorrectAffix = CreateTestAffix(incorrectModName, affixType);
            Stat  stat1          = CreateTestStat(testValue1, null, null, correctAffix);
            Stat  stat2          = CreateTestStat(testValue2, null, null, incorrectAffix);
            Stat  stat3          = CreateTestStat(testValue3, null, null, incorrectAffix);

            Equipment testEquipment = new Equipment();

            testEquipment.Stats.Add(stat1);
            testEquipment.Stats.Add(stat2);
            testEquipment.Stats.Add(stat3);

            List <int> values = _affixValueCalculator.GetAffixValues(correctModName, testEquipment, affixType, StatValueType.Flat);

            Assert.AreEqual(stat1.Value1, values[0]);
        }
Exemplo n.º 6
0
        public static int CreateMessageLocalizedAffix(
            Span <byte> buffer,
            Serial serial, int graphic, MessageType type, int hue, int font, int number, string name,
            AffixType affixType, string affix = "", string args = ""
            )
        {
            name ??= "";
            affix ??= "";
            args ??= "";

            if (hue == 0)
            {
                hue = 0x3B2;
            }

            var writer = new SpanWriter(buffer);

            writer.Write((byte)0xCC);
            writer.Seek(2, SeekOrigin.Current);
            writer.Write(serial);
            writer.Write((short)graphic);
            writer.Write((byte)type);
            writer.Write((short)hue);
            writer.Write((short)font);
            writer.Write(number);
            writer.Write((byte)affixType);
            writer.WriteAscii(name, 30);
            writer.WriteAsciiNull(affix);
            writer.WriteBigUniNull(args);

            writer.WritePacketLength();
            return(writer.Position);
        }
Exemplo n.º 7
0
        public MessageLocalizedAffix(
            Serial serial, int graphic, MessageType messageType, int hue, int font, int number,
            string name, AffixType affixType, string affix, string args
            ) : base(0xCC)
        {
            name ??= "";
            affix ??= "";
            args ??= "";

            if (hue == 0)
            {
                hue = 0x3B2;
            }

            EnsureCapacity(52 + affix.Length + args.Length * 2);

            Stream.Write(serial);
            Stream.Write((short)graphic);
            Stream.Write((byte)messageType);
            Stream.Write((short)hue);
            Stream.Write((short)font);
            Stream.Write(number);
            Stream.Write((byte)affixType);
            Stream.WriteAsciiFixed(name, 30);
            Stream.WriteAsciiNull(affix);
            Stream.WriteBigUniNull(args);
        }
Exemplo n.º 8
0
    public Affix(AffixBase affixBase, bool isCrafted = false, bool isLocked = false)
    {
        Base        = affixBase;
        affixValues = new List <float>();
        AffixType   = affixBase.affixType;
        IsCrafted   = isCrafted;
        IsLocked    = isLocked;
        foreach (AffixBonusProperty mod in affixBase.affixBonuses)
        {
            if (mod.readAsFloat)
            {
                int roll = UnityEngine.Random.Range((int)(mod.minValue * 10f), (int)(mod.maxValue * 10f + 1));
                affixValues.Add((float)Math.Round(roll / 10d, 1));
            }
            else
            {
                affixValues.Add(UnityEngine.Random.Range((int)mod.minValue, (int)mod.maxValue + 1));
            }
        }

        if (affixBase.triggeredEffects.Count > 0)
        {
            addedEffectValues = new List <float>();
            foreach (TriggeredEffectBonusProperty addedEffect in affixBase.triggeredEffects)
            {
                int roll = UnityEngine.Random.Range((int)(addedEffect.effectMinValue * 10f), (int)(addedEffect.effectMaxValue * 10f + 1));
                addedEffectValues.Add((float)Math.Round(roll / 10d, 1));
            }
        }
    }
Exemplo n.º 9
0
 /// <summary>
 /// Deregisters an affix type from the affix info dictionary
 /// </summary>
 /// <param name="type"></param>
 public static void Deregister(AffixType type)
 {
     if (affixInfoDictionary.ContainsKey(type))
     {
         affixInfoDictionary.Remove(type);
     }
 }
Exemplo n.º 10
0
    public Affix GetRandomAffix(AffixType type)
    {
        List <Affix> listToRemoveFrom;

        if (type == AffixType.PREFIX && prefixes.Count > 0)
        {
            listToRemoveFrom = prefixes;
        }
        else if (type == AffixType.SUFFIX && suffixes.Count > 0)
        {
            listToRemoveFrom = suffixes;
        }
        else
        {
            return(null);
        }

        var newList = listToRemoveFrom.Where(x => !x.IsLocked).ToList();

        if (newList.Count == 0)
        {
            return(null);
        }

        return(newList[Random.Range(0, newList.Count)]);
    }
Exemplo n.º 11
0
        private void AffixInfosListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_last_index != -1 && AffixInfosListBox.SelectedIndex == _last_index)
            {
                return;
            }

            if (HasUnsavedChanges())
            {
                if (MessageBox.Show("Unsaved changes will be lost. Proceed?", "Unsaved Changes", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                {
                    AffixInfosListBox.SelectedIndex = _last_index;
                    return;
                }
            }

            if (AffixInfosListBox.SelectedIndex == -1)
            {
                currentInfo = null;
            }
            else
            {
                currentInfo = AffixInfo.GetAffixInfo((AffixType)AffixInfosListBox.Items[AffixInfosListBox.SelectedIndex]);

                if (localType != currentInfo.Type)
                {
                    UpdateCurrentAffixInfoDisplay();
                }

                localType = currentInfo.Type;
            }
            _last_index = AffixInfosListBox.SelectedIndex;
        }
Exemplo n.º 12
0
    public Affix(AffixType type, AffixValue value, int tier)
    {
        Type  = type;
        Value = value;
        Tier  = tier;

        info = AffixInfo.GetAffixInfo(type);
    }
Exemplo n.º 13
0
        private static Affix CreateTestAffix(string modName, AffixType affixType)
        {
            Affix affix = new Affix();

            affix.Group          = modName;
            affix.GenerationType = affixType.ToString();
            return(affix);
        }
Exemplo n.º 14
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="type">Affix Category to Generate</param>
    /// <param name="ilvl">Level of Target</param>
    /// <param name="targetTypeTags">List of target's tags to determine base spawn weights</param>
    /// <param name="affixBonusTypeStrings">List of strings to determine which affixes have already been applied to target</param>
    /// <param name="weightModifiers">Values to multiply base spawn weight by if they match the group tags</param>
    /// <returns></returns>
    public AffixBase GetRandomAffixBase(AffixType type, int ilvl, HashSet <GroupType> targetTypeTags, List <string> affixBonusTypeStrings, Dictionary <GroupType, float> weightModifiers = null, float affixLevelSkewFactor = 1f)
    {
        WeightList <AffixBase> possibleAffixList = GetPossibleAffixes(type, ilvl, targetTypeTags, affixBonusTypeStrings, weightModifiers, affixLevelSkewFactor);

        if (possibleAffixList.Count == 0)
        {
            return(null);
        }
        return(possibleAffixList.ReturnWeightedRandom());
    }
Exemplo n.º 15
0
    void AddTypeToLIst(AffixType type)
    {
        var display_go           = Instantiate(AffixTypeDisplay, transform);
        AffixTypeDisplay display = display_go.GetComponent <AffixTypeDisplay>();

        displays[type] = display;

        display.SetAffixType(type);
        display.OnClick += SelectType;
    }
Exemplo n.º 16
0
 private void AddAffix(AffixType affixType)
 {
     if (!AffixTypes.Contains(affixType))
     {
         AffixTypes.Add(affixType);
         Affix newAffix = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.Affix].AllocateGameObject <Affix>(AffixContainer);
         newAffix.Initialize(affixType);
         Affixes.Add(newAffix);
     }
 }
        public List <int> GetAffixValues(string mod, Equipment item, AffixType type, StatValueType valueType)
        {
            var conditionItem = new ConditionContainer()
            {
                ItemBase = item.ItemBase,
                Affixes  = item.Stats.Select(x => AffixToItemProperty(x.Affix, valueType, x.Values)).ToList()
            };

            return(GetAffixValue(mod, type, conditionItem));
        }
Exemplo n.º 18
0
        public SubconditionAffixesControlViewModel(List <ConditionAffix> conditions, List <Affix> affixes, AffixType affixType, PoeCrafting.Entities.ItemBase itemBase, StatValueType valueType)
        {
            _affixType = affixType;
            Initialize(conditions, affixes, affixType, itemBase, valueType);
            _valueType = valueType;

            OnPropertyChanged(nameof(FirstAffix));
            OnPropertyChanged(nameof(SecondAffix));
            OnPropertyChanged(nameof(ThirdAffix));
        }
 public void InitializeAffixes()
 {
     if (!isContextSet)
     {
         Enum.TryParse(AffixProp, out AffixType aff);
         affixContext = aff;
     }
     Affixes = Helpers.affixLists[affixContext];
     AffixesList.ItemsSource = Affixes;
 }
Exemplo n.º 20
0
    public void Initialize(AffixType affixType)
    {
        string text = "";

        text = BaseInfo.AddHighLightColorToText(AffixNameDict[LanguageManager.Instance.GetCurrentLanguage()][affixType]) + ": " + AffixDescDict[LanguageManager.Instance.GetCurrentLanguage()][affixType];
        Text.enableAutoSizing = LanguageManager.Instance.IsEnglish;

        Text.text        = text;
        BoardImage.color = AffixColorDict[affixType];
    }
Exemplo n.º 21
0
 public UOMessageEventArgs(string text, Hue hue, MessageType type, MessageFont font,
     uint cliloc, AffixType affixType = AffixType.None, string affix = null)
 {
     Text = text;
     Hue = hue;
     Type = type;
     Font = font;
     Cliloc = cliloc;
     AffixType = affixType;
     Affix = affix;
 }
Exemplo n.º 22
0
 public UOMessageEventArgs(string text, Hue hue, MessageType type, MessageFont font, uint cliloc, bool unicode = false, AffixType affixType = AffixType.None, string affix = null)
 {
     Text      = text;
     Hue       = hue;
     Type      = type;
     Font      = font;
     Cliloc    = cliloc;
     AffixType = affixType;
     Affix     = affix;
     IsUnicode = unicode;
 }
        public SubconditionAffixesControl(List<ConditionAffix> conditions, List<Affix> affixes, AffixType affixType, ItemBase itemBase, StatValueType valueType)
        {
            _affixType = affixType;
            Dispatcher.Invoke(() => Initialize(conditions, affixes, affixType, itemBase, valueType), DispatcherPriority.SystemIdle);
            _valueType = valueType;
            DataContext = this;
            InitializeComponent();

            OnPropertyChanged(nameof(FirstAffix));
            OnPropertyChanged(nameof(SecondAffix));
            OnPropertyChanged(nameof(ThirdAffix));
        }
Exemplo n.º 24
0
    public override AffixPool ReadJson(JsonReader reader, Type objectType, AffixPool existingValue, bool hasExistingValue, JsonSerializer serializer)
    {
        List <string> names = serializer.Deserialize <List <string> >(reader);

        AffixType[] types = new AffixType[names.Count];
        for (int i = 0; i < names.Count; i++)
        {
            types[i] = AffixType.GetByName(names[i]);
        }

        return(new AffixPool(types));
    }
Exemplo n.º 25
0
 public UOMessageEventArgs(Entity parent, string text, ushort hue, MessageType type, byte font, uint cliloc, bool unicode = false, AffixType affixType = AffixType.None, string affix = null)
 {
     Parent    = parent;
     Text      = text;
     Hue       = hue;
     Type      = type;
     Font      = font;
     Cliloc    = cliloc;
     AffixType = affixType;
     Affix     = affix;
     IsUnicode = unicode;
 }
Exemplo n.º 26
0
    public async Task RenameSelectedType()
    {
        if (selectedType == AffixType.None)
        {
            return;
        }

        if (!AffixInfoDisplay.IsValid)
        {
            DialogBasic.Show("Renaming requires that all changes are saved first, but there are invalid entries. Please fix all errors before trying again.");
            return;
        }

        if (AffixInfoDisplay.IsChanged)
        {
            if ((await DialogCancellable.Show("Renaming requires that all changes be saved first. Save now?").result).IsCancelled)
            {
                return;
            }

            if (await SaveSelectedType() == false)
            {
                DialogBasic.Show("There was a problem saving. Please recheck the values and try again.");
                return;
            }
        }

        var result = await DialogStringInput.ShowBlocking($"Enter a new name for '{selectedType.Name}'",
                                                          name => !AffixType.Exists(name) && AffixType.IsValidName(name), ShowInvalidNameMessage).result;

        if (result.IsOK)
        {
            string name = result.Value;

            var oldInfo = AffixInfo.GetAffixInfo(selectedType);
            AffixInfo.Deregister(selectedType);
            Serializer.DeleteAffixInfo(oldInfo.Type);

            var newType = AffixType.Replace(selectedType.ID, name);
            var newInfo = new AffixInfo(newType, oldInfo.ValueInfo, oldInfo.Description);
            AffixInfo.Register(newInfo);
            Serializer.SaveAffixInfoToDisk(newInfo);

            var display = displays[selectedType];
            displays.Remove(selectedType);
            displays.Add(newType, display);
            display.SetAffixType(newType);
            SelectType(newType);
        }
    }
Exemplo n.º 27
0
        public void GetFlatImplicitValueNotYetImplementedTest()
        {
            String    modName    = "testMod";
            int       testValue1 = 5;
            int       testValue2 = 10;
            int       testValue3 = 15;
            AffixType affixType  = AffixType.Implicit;

            Affix     affix         = CreateTestAffix(modName, affixType);
            Stat      stat          = CreateTestStat(testValue1, testValue2, testValue3, affix);
            Equipment testEquipment = CreateTestEquipment(stat);

            List <int> values = _affixValueCalculator.GetAffixValues(modName, testEquipment, affixType, StatValueType.Flat);
        }
Exemplo n.º 28
0
 private void RemoveAffix(AffixType affixType)
 {
     if (AffixTypes.Contains(affixType))
     {
         AffixTypes.Remove(affixType);
         foreach (Affix affix in Affixes)
         {
             if (affix.AffixType == affixType)
             {
                 Affixes.Remove(affix);
                 affix.PoolRecycle();
             }
         }
     }
 }
Exemplo n.º 29
0
    /// <summary>
    /// Shows a prompt for the user to enter a new name.
    /// </summary>
    public async Task CreateNew()
    {
        var result = await DialogStringInput.ShowBlocking("Enter a name:", name => !AffixType.Exists(name) && AffixType.IsValidName(name), ShowInvalidNameMessage).result;

        if (result.IsOK)
        {
            string name = result.Value;

            AffixInfo info = new AffixInfo(name, new AffixValueInfo());
            AffixInfo.Register(info);
            AddTypeToLIst(info.Type);
            UpdateHeight();
            SelectType(info.Type);
        }
    }
Exemplo n.º 30
0
    /// <summary>
    /// Returns the AffixInfo object for a certain AffixType, provided it exists
    /// </summary>
    public static AffixInfo GetAffixInfo(AffixType type)
    {
        // If the requested type is random, select a random affix
        if (type == AffixType.Random)
        {
            System.Random rng = new System.Random();
            return(affixInfoDictionary.ElementAt(rng.Next() % affixInfoDictionary.Count).Value);
        }

        if (affixInfoDictionary.ContainsKey(type))
        {
            return(affixInfoDictionary[type]);
        }
        return(null);
    }
Exemplo n.º 31
0
        public static void  AddAffixType(AffixType type)
        {
            // This gets the _Types filed of AffixType by reference
            HashSet <AffixType> types = typeof(AffixType).GetField("_Types", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null) as HashSet <AffixType>;

            if (!types.Contains(type))
            {
                types.Add(type);

                // TODO: Make not hardcoded
                using (StreamWriter writer = File.AppendText("Data\\Affix\\AffixTypes"))
                {
                    writer.WriteLine(type);
                }
            }
        }
Exemplo n.º 32
0
        public Affix GetRandomAffix(AffixType affixType, ItemType itemType, int qualityLevel)
        {
            var query = from a in db.Affixes
                        where (a.Type == affixType) && (a.QualityLevel <= qualityLevel)
                        select a;

            if(itemType == ItemType.Weapon)
            {
                query = from a in query
                        where a.ForWeapon == true
                        select a;
            }
            else if(itemType == ItemType.Shield)
            {
                query = from a in query
                        where a.ForShield == true
                        select a;
            }
            else if(itemType == ItemType.Armor)
            {
                query = from a in query
                        where a.ForArmor == true
                        select a;
            }
            else
            {
                query = from a in query
                        where a.ForJewelry == true
                        select a;
            }

            int itemCount = query.Count();

            if (itemCount == 0)
            {
                return null;
            }

            Random dice = new Random();
            int record = dice.Next(0, itemCount);

            var item = query.OrderBy(i => i.Id).Skip(record).FirstOrDefault();
            return item;
        }
Exemplo n.º 33
0
Arquivo: Affix.cs Projeto: rmunn/cog
 public Affix(string strRep, AffixType type, string category)
 {
     _strRep = strRep;
     _type = type;
     _category = category;
 }
Exemplo n.º 34
0
        public void SendLocalizedMessageTo( Mobile to, int number, AffixType affixType, string affix, string args )
        {
            if ( Deleted || !to.CanSee( this ) )
                return;

            to.Send( new MessageLocalizedAffix( Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", affixType, affix, args ) );
        }
Exemplo n.º 35
0
 public void LabelToAffix( Mobile to, int number, AffixType type, string affix, string args )
 {
     to.Send( new MessageLocalizedAffix( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, number, "", type, affix, args ) );
 }
Exemplo n.º 36
0
        public MessageLocalizedAffix( Serial serial, int graphic, MessageType messageType, int hue, int font, int number, string name, AffixType affixType, string affix, string args )
            : base(0xCC)
        {
            if (Core.Config.Features["delocalize"]) {
                string text = StringList.Localization[number];
                if (text != null) {
                    if ( (affixType & AffixType.Prepend) == AffixType.Prepend )
                        text = affix + text;
                    else
                        text += affix;

                    /* this hack replaces the packet data generated by
                       this class with an AsciiMessage packet */
                    Packet p = new AsciiMessage(serial, graphic, messageType,
                                                hue, font, name, text);
                    EnsureCapacity(3);
                    m_Stream = p.UnderlyingStream;
                    return;
                }
            }

            if ( name == null ) name = "";
            if ( affix == null ) affix = "";
            if ( args == null ) args = "";

            if ( hue == 0 )
                hue = 0x3B2;

            this.EnsureCapacity( 52 + affix.Length + (args.Length * 2) );

            m_Stream.Write( (int) serial );
            m_Stream.Write( (short) graphic );
            m_Stream.Write( (byte) messageType );
            m_Stream.Write( (short) hue );
            m_Stream.Write( (short) font );
            m_Stream.Write( (int) number );
            m_Stream.Write( (byte) affixType );
            m_Stream.WriteAsciiFixed( name, 30 );
            m_Stream.WriteAsciiNull( affix );
            m_Stream.WriteBigUniNull( args );
        }
Exemplo n.º 37
0
        public MessageLocalizedAffix( Serial serial, int graphic, MessageType messageType, int hue, int font, int number, string name, AffixType affixType, string affix, string args )
            : base(0xCC)
        {
            if ( name == null ) name = "";
            if ( affix == null ) affix = "";
            if ( args == null ) args = "";

            if ( hue == 0 )
                hue = 0x3B2;

            this.EnsureCapacity( 52 + affix.Length + (args.Length * 2) );

            m_Stream.Write( (int) serial );
            m_Stream.Write( (short) graphic );
            m_Stream.Write( (byte) messageType );
            m_Stream.Write( (short) hue );
            m_Stream.Write( (short) font );
            m_Stream.Write( (int) number );
            m_Stream.Write( (byte) affixType );
            m_Stream.WriteAsciiFixed( name, 30 );
            m_Stream.WriteAsciiNull( affix );
            m_Stream.WriteBigUniNull( args );
        }
Exemplo n.º 38
0
        /*public MessageLocalizedAffix( Serial serial, int graphic, MessageType messageType, int hue, int font, int number, string name, AffixType affixType, string affix, string args ) : base( 0xCC )
        {
            if ( name == null ) name = "";
            if ( affix == null ) affix = "";
            if ( args == null ) args = "";

            if ( hue == 0 )
                hue = 0x3B2;

            this.EnsureCapacity( 52 + affix.Length + (args.Length * 2) );

            m_Stream.Write( (int) serial );
            m_Stream.Write( (short) graphic );
            m_Stream.Write( (byte) messageType );
            m_Stream.Write( (short) hue );
            m_Stream.Write( (short) font );
            m_Stream.Write( (int) number );
            m_Stream.Write( (byte) affixType );
            m_Stream.WriteAsciiFixed( name, 30 );
            m_Stream.WriteAsciiNull( affix );
            m_Stream.WriteBigUniNull( args );
        }*/
        public MessageLocalizedAffix( Serial serial, int graphic, MessageType type, int hue, int font, int number, string name, AffixType affixType, string affix, string args )
            : base(0x1C)
        {
            if (name == null)
                name = "";

            if (affix == null)
                affix = "";

            if (args == null)
                args = "";

            if (hue == 0)
                hue = 0x3B2;

            string text = "";
            if ((affixType & AffixType.Prepend) != AffixType.Append)
                text = string.Format("{0}{1}", affix, Core.CliLoc.SplitFormat(number, args));
            else
                text = string.Format("{0}{1}", Core.CliLoc.SplitFormat(number, args), affix);

            this.EnsureCapacity(45 + text.Length);

            m_Stream.Write((int)serial);
            m_Stream.Write((short)graphic);
            m_Stream.Write((byte)type);
            m_Stream.Write((short)hue);
            m_Stream.Write((short)font);
            m_Stream.WriteAsciiFixed(name, 30);
            m_Stream.WriteAsciiNull(text);
        }
Exemplo n.º 39
0
        public void PublicOverheadMessage( MessageType type, int hue, int number, AffixType affixType, string affix, string args, bool noLineOfSight = true )
        {
            if ( m_Map != null )
            {
                Packet p = null;

                foreach ( GameClient state in m_Map.GetClientsInRange( m_Location ) )
                {
                    if ( state.Mobile.CanSee( this ) && ( noLineOfSight || state.Mobile.InLOS( this ) ) )
                    {
                        if ( p == null )
                            p = Packet.Acquire( new MessageLocalizedAffix( this.Serial, Body, type, hue, 3, number, Name, affixType, affix, args ) );

                        state.Send( p );
                    }
                }

                Packet.Release( p );
            }
        }
Exemplo n.º 40
0
 public void PublicOverheadMessage( MessageType type, int hue, int number, AffixType affixType, string affix, string args )
 {
     PublicOverheadMessage( type, hue, number, affixType, affix, args, true );
 }
Exemplo n.º 41
0
        public void PublicOverheadMessage( MessageType type, int hue, int number, AffixType affixType, string affix, string args, bool noLineOfSight )
        {
            if ( m_Map != null )
            {
                Packet p = null;

                IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location );

                foreach ( NetState state in eable )
                {
                    if ( state.Mobile.CanSee( this ) && (noLineOfSight || state.Mobile.InLOS( this )) )
                    {
                        if ( p == null )
                            p = new MessageLocalizedAffix( m_Serial, Body, type, hue, 3, number, Name, affixType, affix, args );

                        state.Send( p );
                    }
                }

                eable.Free();
            }
        }
Exemplo n.º 42
0
 public void Say( int number, AffixType type, string affix, string args )
 {
     PublicOverheadMessage( MessageType.Regular, m_SpeechHue, number, type, affix, args );
 }