Ejemplo n.º 1
0
        //初始化强化需求材料
        public void GetEquipEnchance(ItemEquip2 itemequip, CharacterController character, bool isMust = false)
        {
            var tbItem = Table.GetItemBase(itemequip.GetId());

            if (!isMust)
            {
                if (itemequip.GetExdata(22) != -1)
                {
                    return;
                }
                itemequip.MarkDirty();
            }
            Logger.Info("---GetEquipEnchance---Type={0},ItemId={1},Level={2}", tbItem.Type, itemequip.GetId(),
                        itemequip.GetExdata(0));
            //var tbEquip = Table.GetEquip(tbItem.Exdata[0]);
            var nNeedLevel = tbItem.UseLevel;
            //int nColor = tbItem.Color;
            var nLevel     = itemequip.GetExdata(0);
            var tbenchance = Table.GetEquipEnchance(nLevel);
            var tbladder   = Table.GetEquipEnchance(nNeedLevel);


            for (var i = 0; i != 6; ++i)
            {
                var nNewLevel = nNeedLevel + (RandomEquipLevel(tbladder) - 3) * 5;
                var nNewType  = RandomEquipType(tbenchance);
                var nNewColor = RandomEquipColor(tbenchance);
                //参数构造: 装备类型*10000 + 装备等级 * 10 + 颜色
                var nValue = GetEnchanceValue(nNewType, nNewLevel, nNewColor);
                itemequip.SetExdata(22 + i, nValue);
            }
        }
Ejemplo n.º 2
0
        //刷新属性
        public void RefreshAttr(BookManager _this)
        {
            _this.attrs.Clear();
            _this.MonsterAttrs.Clear();
            //图鉴收集
            foreach (var book in _this.Books)
            {
                var tbbook = Table.GetHandBook(book.Key);
                if (tbbook == null)
                {
                    Logger.Fatal("null==Table.GetHandBook({0})", book.Key);
                    continue;
                }
                //----------人物属性
//                ItemEquip2.PushEquipAttr(_this.attrs, tbbook.AttrId, tbbook.AttrValue, _this.mCharacter.GetLevel(), _this.mCharacter.GetAttackType());
                //----------魔物属性
                int attrId     = book.Key * 100 + book.Value;
                var tbBookBase = Table.GetBookBase(attrId);
                if (tbBookBase != null)
                {
                    for (int i = 0; i < tbBookBase.AttrList.Length; i++)
                    {
                        _this.attrs.modifyValue(i + 1, tbBookBase.AttrList[i] * tbBookBase.AddAttr / 10000);
                        _this.MonsterAttrs.modifyValue(i + 1, tbBookBase.AttrList[i]);
                    }
                }
            }
            //组收集
            var groupOkCount = 0;

            foreach (var i in _this.Group)
            {
                var tbGroupBook = Table.GetBookGroup(i);
                if (tbGroupBook == null)
                {
                    Logger.Fatal("null==Table.GetBookGroup({0})", i);
                    continue;
                }
                groupOkCount++;
                for (var j = 0; j != tbGroupBook.GroupAttrId.Length; j++)
                {
                    if (tbGroupBook.GroupAttrId[j] > 0)
                    {
                        ItemEquip2.PushEquipAttr(_this.attrs, tbGroupBook.GroupAttrId[j],
                                                 tbGroupBook.GroupAttrValue[j], _this.mCharacter.GetLevel(),
                                                 _this.mCharacter.GetAttackType());
                    }
                }
            }
            var nowMaxCount = _this.mCharacter.GetExData((int)eExdataDefine.e347);

            if (groupOkCount > nowMaxCount)
            {
                _this.mCharacter.SetExData((int)eExdataDefine.e347, groupOkCount);
            }
        }
Ejemplo n.º 3
0
        //更换装备时新的等级计算
        public void ResetEquipLevel(CharacterController character, ItemEquip2 oldItem, ItemEquip2 newItem)
        {
            var tbOldItem = ItemBase.GetTableItem(oldItem.GetId());

            if (tbOldItem == null)
            {
                Logger.Warn("ResetEquipLevel OldEquip[{0}] not find by Table", oldItem.GetId());
                return;
            }
            var tbNewItem = ItemBase.GetTableItem(newItem.GetId());

            if (tbNewItem == null)
            {
                Logger.Warn("ResetEquipLevel NewEquip[{0}] not find by Table", newItem.GetId());
                return;
            }
            if (tbOldItem.Type != tbNewItem.Type)
            {
                Logger.Warn("ResetEquipLevel OldEquip[{0}] NewEquip[{1}] Type is Different", oldItem.GetId(),
                            newItem.GetId());
                return;
            }
            var nValue = GetEquipAddValue(character, tbOldItem.Type);


            //计算概率
            var nTotleGiveValue = 0;
            var nLevelUp        = 0;

            var tbNewEquip = ItemEquip2.GetTableEquip(newItem.GetId());

            if (tbNewEquip == null)
            {
                Logger.Warn("ResetEquipLevel NewEquip[{0}] not find by Table", newItem.GetId());
                return;
            }
            CalculationEnchance(ref nLevelUp, ref nTotleGiveValue, nValue, 0, tbNewItem, tbNewEquip.MaxLevel);

            //--todo  临时取消了
            //oldItem.SetLevel(0);
            //newItem.SetLevel(nLevelUp);
        }
Ejemplo n.º 4
0
        //属性计算
        public static void GetAttrList(Dictionary <int, int> AttrList,
                                       ItemBase wing,
                                       WingQualityRecord tbWing,
                                       int characterLevel,
                                       int attackType)
        {
            var Quality = tbWing.Segment;

            if (wing.mDbData.Exdata.Count < 11)
            {
                return;
            }
            //基础属性
            for (var i = 0; i != tbWing.AddPropID.Length; ++i)
            {
                var nAttrId = tbWing.AddPropID[i];
                if (nAttrId < 0)
                {
                    break;
                }
                var nValue = tbWing.AddPropValue[i];
                if (nValue > 0 && nAttrId != -1)
                {
                    ItemEquip2.PushEquipAttr(AttrList, nAttrId, nValue, characterLevel, attackType);
                }
            }
            //培养属性
            ////for (var i = 0; i != 5; ++i)
            ////{
            ////    var tbWingTrain = Table.GetWingTrain(wing.GetExdata(1 + i*2));
            ////    if (tbWingTrain == null)
            ////    {
            ////        continue;
            ////    }
            ////    //if (tbWingTrain.Condition > Quality)
            ////    //{
            ////    //    continue;
            ////    //}
            ////    for (var j = 0; j != tbWingTrain.AddPropID.Length; ++j)
            ////    {
            ////        var nAttrId = tbWingTrain.AddPropID[j];
            ////        var nValue = tbWingTrain.AddPropValue[j];
            ////        if (nAttrId < 0 || nValue <= 0)
            ////        {
            ////            break;
            ////        }
            ////        if (nValue > 0 && nAttrId != -1)
            ////        {
            ////            ItemEquip2.PushEquipAttr(AttrList, nAttrId, nValue, characterLevel, attackType);
            ////        }
            ////    }
            ////}
            var tbWingTrain = Table.GetWingTrain(wing.GetExdata(1));

            if (tbWingTrain != null)
            {
                for (var j = 0; j != tbWingTrain.AddPropID.Length; ++j)
                {
                    var nAttrId = tbWingTrain.AddPropID[j];
                    var nValue  = tbWingTrain.AddPropValue[j];
                    if (nAttrId < 0 || nValue <= 0)
                    {
                        break;
                    }
                    if (nValue > 0 && nAttrId != -1)
                    {
                        ItemEquip2.PushEquipAttr(AttrList, nAttrId, nValue, characterLevel, attackType);
                    }
                }
            }

            // 成长属性
            for (var i = (int)eWingExDefine.eGrowProperty; i < wing.mDbData.Exdata.Count; ++i)
            {
                var attrId = WingItem.GetGrowAttrId(wing.mDbData, i);
                if (attrId > 0)
                {
                    var value = wing.GetExdata(i + 1);
                    if (value > 0)
                    {
                        ItemEquip2.PushEquipAttr(AttrList, attrId, value, characterLevel, attackType);
                    }
                    ++i;
                }
            }
        }
Ejemplo n.º 5
0
        //初始化附加属性
        public void InitAddAttr(ElfRecord tbElf, int addCount)
        {
            if (addCount <= 0 || addCount > 6)
            {
                return;
            }
            int nRandom, nTotleRandom;
            var TbAttrPro = Table.GetEquipEnchantChance(tbElf.RandomPropPro);

            if (TbAttrPro == null)
            {
                Logger.Error("Equip InitAddAttr Id={0} not find EquipEnchantChance Id={1}", tbElf.Id,
                             tbElf.RandomPropPro);
                return;
            }
            var tempAttrPro   = new Dictionary <int, int>();
            var nTotleAttrPro = 0;

            for (var i = 0; i != 23; ++i)
            {
                var nAttrpro = TbAttrPro.Attr[i];
                if (nAttrpro > 0)
                {
                    nTotleAttrPro += nAttrpro;
                    tempAttrPro[i] = nAttrpro;
                }
            }
            //属性值都在这里
            var tbEnchant = Table.GetEquipEnchant(tbElf.RandomPropValue);

            if (tbEnchant == null)
            {
                Logger.Error("Equip InitAddAttr Id={0} not find tbEquipEnchant Id={1}", tbElf.Id, tbElf.RandomPropValue);
                return;
            }
            //整理概率
            var AttrValue = new Dictionary <int, int>();

            for (var i = 0; i != addCount; ++i)
            {
                nRandom      = MyRandom.Random(nTotleAttrPro);
                nTotleRandom = 0;
                foreach (var i1 in tempAttrPro)
                {
                    nTotleRandom += i1.Value;
                    if (nRandom < nTotleRandom)
                    {
                        //AddCount = i1.Key;
                        AttrValue[i1.Key] = tbEnchant.Attr[i1.Key];
                        nTotleAttrPro    -= i1.Value;
                        tempAttrPro.Remove(i1.Key);
                        break;
                    }
                }
            }
            var NowAttrCount = AttrValue.Count;

            if (NowAttrCount < addCount)
            {
                Logger.Error("Equip InitAddAttr AddAttr Not Enough AddCount={0},NowAttrCount={1}", addCount,
                             NowAttrCount);
            }

            //EquipRelateRecord tbAttrRelate = Table.GetEquipRelate(tbElf.RandomAttrInterval);
            //if (tbAttrRelate == null)
            //{
            //    Logger.Error("Equip tbAttrRelate Id={0} not find EquipRelate Id={1}", tbElf.Id, tbElf.RandomAttrInterval);
            //    return;
            //}

            for (var i = 0; i != NowAttrCount; ++i)
            {
                var nKey    = AttrValue.Keys.Min();
                var nAttrId = ItemEquip2.GetAttrId(nKey);
                if (nAttrId == -1)
                {
                    continue;
                }
                var fValue = tbEnchant.Attr[nKey];
                //int AttrValueMin = fValue * tbElf.RandomValueMin / 100;
                //int AttrValueMax = fValue * tbElf.RandomValueMax / 100;
                //int AttrValueDiff = AttrValueMax - AttrValueMin;
                //nRandom = MyRandom.Random(10000);
                //nTotleRandom = 0;
                //int rMin = 0;
                //int rMax = 10000;
                //for (int j = 0; j != tbAttrRelate.Value.Length; ++j)
                //{
                //    nTotleRandom += tbAttrRelate.Value[j];
                //    if (nRandom < nTotleRandom)
                //    {
                //        switch (j)
                //        {
                //            case 0:
                //                {
                //                    rMin = 0;
                //                    rMax = 5000;
                //                }
                //                break;
                //            case 1:
                //                {
                //                    rMin = 5000;
                //                    rMax = 7500;
                //                }
                //                break;
                //            case 2:
                //                {
                //                    rMin = 7500;
                //                    rMax = 9000;
                //                }
                //                break;
                //            case 3:
                //                {
                //                    rMin = 9000;
                //                    rMax = 10000;
                //                }
                //                break;
                //        }
                //        break;
                //    }
                //}
                //int AttrValueMin2 = AttrValueMin + AttrValueDiff * rMin / 10000;
                //int AttrValueMax2 = AttrValueMin + AttrValueDiff * rMax / 10000;
                //int AttrRealValue = MyRandom.Random(AttrValueMin2, AttrValueMax2);
                AddAttr(i, nAttrId, fValue);
                AttrValue.Remove(nKey);
            }
        }
Ejemplo n.º 6
0
 //更换装备时新的等级计算
 public static void ResetEquipLevel(this CharacterController character, ItemEquip2 oldItem, ItemEquip2 newItem)
 {
     mImpl.ResetEquipLevel(character, oldItem, newItem);
 }
Ejemplo n.º 7
0
 //初始化强化需求材料
 public static void GetEquipEnchance(ItemEquip2 itemequip, CharacterController character, bool isMust = false)
 {
     mImpl.GetEquipEnchance(itemequip, character, isMust);
 }
Ejemplo n.º 8
0
        public void InitByRobot(AutoPlayer _this, ulong npcId, int RobotId)
        {
            _this.mObjId        = npcId;
            _this.mLogicData    = new LogicSimpleData();
            _this.mLogicData.Id = (ulong)RobotId;
            //mSceneData = scene;
            var tbRobot = Table.GetJJCRoot(RobotId);

            _this.mTypeId = tbRobot.Career;
            //mTypeId = logic.TypeId;
            _this.mDirection = new Vector2(1, 0);
            _this.mName      = tbRobot.Name;
            _this.BuffList   = new BuffList();
            _this.BuffList.InitByBase(_this);
            _this.Attr  = new FightAttr(_this);
            _this.Skill = new SkillManager(_this);
            _this.SetLevel(tbRobot.Level);
            var lastLadder = 0;

            Table.ForeachTransmigration(record =>
            {
                if (record.TransLevel <= tbRobot.Level)
                {
                    if (record.PropPoint < lastLadder)
                    {
                        return(false);
                    }
                    lastLadder = record.PropPoint;
                }
                else
                {
                    return(false);
                }
                return(true);
            });
            _this.Attr.Ladder       = lastLadder;
            _this.mLogicData.Ladder = lastLadder;
            _this.InitTableData(tbRobot.Level);
            //InitEquip();
            if (tbRobot.EquipHand != -1)
            {
                var bagId  = 17;
                var dbitem = new ItemBaseData();
                var item   = new ItemEquip2(tbRobot.EquipHand, dbitem);
                item.SetExdata(0, tbRobot.EquipLevel);
                _this.Equip.Add(bagId * 10, item);
                _this.mLogicData.EquipsModel.Add(bagId, tbRobot.EquipHand * 100 + tbRobot.EquipLevel);
            }

            if (tbRobot.EquipHead != -1)
            {
                var bagId  = 7;
                var dbitem = new ItemBaseData();
                var item   = new ItemEquip2(tbRobot.EquipHead, dbitem);
                item.SetExdata(0, tbRobot.EquipLevel);
                _this.Equip.Add(bagId * 10, item);
                _this.mLogicData.EquipsModel.Add(bagId, tbRobot.EquipHead * 100 + tbRobot.EquipLevel);
            }
            if (tbRobot.EquipChest != -1)
            {
                var bagId  = 11;
                var dbitem = new ItemBaseData();
                var item   = new ItemEquip2(tbRobot.EquipChest, dbitem);
                item.SetExdata(0, tbRobot.EquipLevel);
                _this.Equip.Add(bagId * 10, item);
                _this.mLogicData.EquipsModel.Add(bagId, tbRobot.EquipChest * 100 + tbRobot.EquipLevel);
            }

            if (tbRobot.EquipGlove != -1)
            {
                var bagId  = 14;
                var dbitem = new ItemBaseData();
                var item   = new ItemEquip2(tbRobot.EquipGlove, dbitem);
                item.SetExdata(0, tbRobot.EquipLevel);
                _this.Equip.Add(bagId * 10, item);
                _this.mLogicData.EquipsModel.Add(bagId, tbRobot.EquipGlove * 100 + tbRobot.EquipLevel);
            }

            if (tbRobot.EquipTrouser != -1)
            {
                var bagId  = 15;
                var dbitem = new ItemBaseData();
                var item   = new ItemEquip2(tbRobot.EquipTrouser, dbitem);
                item.SetExdata(0, tbRobot.EquipLevel);
                _this.Equip.Add(bagId * 10, item);
                _this.mLogicData.EquipsModel.Add(bagId, tbRobot.EquipTrouser * 100 + tbRobot.EquipLevel);
            }

            if (tbRobot.EquipShoes != -1)
            {
                var bagId  = 16;
                var dbitem = new ItemBaseData();
                var item   = new ItemEquip2(tbRobot.EquipShoes, dbitem);
                item.SetExdata(0, tbRobot.EquipLevel);
                _this.Equip.Add(bagId * 10, item);
                _this.mLogicData.EquipsModel.Add(bagId, tbRobot.EquipShoes * 100 + tbRobot.EquipLevel);
            }

            if (tbRobot.WingID != -1)
            {
                var bagId  = 12;
                var dbitem = new ItemBaseData();
                var item   = new WingItem(tbRobot.WingID, dbitem);
                var ib     = new ItemEquip2();
                ib.SetId(dbitem.ItemId);
                ib.SetCount(dbitem.Count);
                ib.CopyFrom(dbitem.Exdata);
                _this.Equip.Add(bagId * 10, ib);
                _this.mLogicData.EquipsModel.Add(bagId, tbRobot.WingID * 100 + tbRobot.EquipLevel);
            }
            _this.Attr.EquipRefresh();
            //InitSkill();
            _this.NormalSkillId = _this.TableCharacter.InitSkill[0];
            _this.Skill.AddSkill(_this.TableCharacter.InitSkill[0], 1, eAddskillType.InitByRobot);
            foreach (var skill in tbRobot.Skill)
            {
                _this.Skill.AddSkill(skill, 1, eAddskillType.InitByRobot2);
            }
            //InitBuff();
            //InitAttr();
            _this.Attr.mBookData[1] = tbRobot.Power;
            _this.Attr.mBookData[2] = tbRobot.Agility;
            _this.Attr.mBookData[3] = tbRobot.Intelligence;
            _this.Attr.mBookData[4] = tbRobot.physical;
            _this.Attr.mBookData[(int)eAttributeType.PhyPowerMin] = tbRobot.AttackMin;
            _this.Attr.mBookData[(int)eAttributeType.PhyPowerMax] = tbRobot.AttackMax;
            _this.Attr.mBookData[(int)eAttributeType.MagPowerMin] = tbRobot.AttackMin;
            _this.Attr.mBookData[(int)eAttributeType.MagPowerMax] = tbRobot.AttackMax;
            _this.Attr.mBookData[(int)eAttributeType.PhyArmor]    = tbRobot.PhysicsDefense;
            _this.Attr.mBookData[(int)eAttributeType.MagArmor]    = tbRobot.MagicDefense;
            _this.Attr.mBookData[(int)eAttributeType.MpMax]       = tbRobot.MagicLimit;
            _this.Attr.mBookData[(int)eAttributeType.HpMax]       = tbRobot.LifeLimit;
            _this.Attr.InitAttributesAll();
            //阵营
            _this.mCamp     = 2;
            _this.TableCamp = Table.GetCamp(_this.mCamp);
            _this.InitAI(tbRobot.Level);
        }