Example #1
0
        public static string BuildPropertyPlus(PropertyPlusEntity plusEntity)
        {
            string pName = EmulatorHelper.GetPropertyStr(plusEntity.PropertyId);

            if (plusEntity.PlusType == (int)EnumPlusType.Abs)
            {
                return(string.Format("{0} +{1}", pName, plusEntity.PlusValue));
            }
            return(string.Format("{0} +{1}%", pName, plusEntity.PlusValue));
        }
Example #2
0
        public static string BuildPropertyPlus(PropertyPlusEntity plusEntity)
        {
            string pName = GetEnumName("EnumProperty", plusEntity.PropertyId);

            if (plusEntity.PlusType == (int)EnumPlusType.Abs)
            {
                return(string.Format("{0} +{1}", pName, plusEntity.PlusValue));
            }
            return(string.Format("{0} +{1}%", pName, plusEntity.PlusValue));
        }
Example #3
0
 void WriteEquipmentPropertyPlus(BinaryWriter writer, PropertyPlusEntity property)
 {
     ByteWriter.WriteTo(writer, property != null);
     if (property == null)
     {
         return;
     }
     ByteWriter.WriteTo(writer, property.PlusType);
     ByteWriter.WriteTo(writer, property.PlusValue);
     ByteWriter.WriteTo(writer, property.PropertyId);
 }
Example #4
0
        PropertyPlusEntity ReadEquipmentPropertyPlus(byte[] buffer, ref int offset)
        {
            PropertyPlusEntity property = null;
            var flag = ByteReader.ReadBoolean(buffer, ref offset);

            if (flag)
            {
                property            = new PropertyPlusEntity();
                property.PlusType   = ByteReader.ReadInt32(buffer, ref offset);
                property.PlusValue  = ByteReader.ReadDouble(buffer, ref offset);
                property.PropertyId = ByteReader.ReadInt32(buffer, ref offset);
            }
            return(property);
        }
Example #5
0
        EquipmentProperty RandomProperty(int equipmentId, out ConfigEquipmentplusEntity plusEntity, int level = 0)
        {
            var equipEntity = GetEquipment(equipmentId);

            if (equipEntity == null)
            {
                throw new CacheException("can't find equip,id:" + equipmentId);
            }
            plusEntity = GetEquipmentPlus(equipEntity.Quality);
            if (plusEntity == null)
            {
                throw new CacheException("can't find equip plus,quality:" + equipEntity.Quality);
            }
            var itemProperty = new EquipmentProperty();

            itemProperty.PropertyPluses = new List <PropertyPlusEntity>(2);
            var plus1 = new PropertyPlusEntity(EnumPlusType.Abs, equipEntity.PropertyType1, RandomPlus1(plusEntity));

            itemProperty.PropertyPluses.Add(plus1);
            var plus2 = new PropertyPlusEntity(EnumPlusType.Percent, equipEntity.PropertyType2, RandomPlus2(plusEntity));

            itemProperty.PropertyPluses.Add(plus2);

            if (level > 0)
            {
                var upgradeEntity = PandoraCache.Instance.GetEquipmentUpgradeEntityByTarget(equipEntity.Quality, level);
                if (upgradeEntity != null)
                {
                    itemProperty.PrecisionCastingPropertis =
                        new List <PrecisionCastingPropertyEntity>(upgradeEntity.PropertyNum);

                    for (int i = 0; i < upgradeEntity.PropertyNum; i++)
                    {
                        var plus = AddPrecisionCastingProperty(itemProperty, equipEntity.Quality);
                        if (plus != null)
                        {
                            itemProperty.PrecisionCastingPropertis.Add(plus);
                        }
                    }
                }
            }
            return(itemProperty);
        }