Example #1
0
        public LuaSystem(string folder, ClientConnection connection, ClientControl control, MMobCore mob)
        {
            Connection = connection;
            Control    = control;
            Mob        = mob;
            Folder     = folder;

            Lua = new Lua();
            Lua.LoadCLRPackage();
        }
Example #2
0
        public static int GetMaxAbility(MMobCore mob, int eff)
        {
            int maxAbility = 0;

            for (int i = 0; i < GameBasics.MAXL_EQUIP; i++)
            {
                if (mob.Equip.Items[i].Index == 0)
                {
                    continue;
                }

                short itemAbility = GetItemAbility(mob.Equip.Items[i], eff);
                if (maxAbility < itemAbility)
                {
                    maxAbility = itemAbility;
                }
            }

            return(maxAbility);
        }
Example #3
0
        public static short GetMobAbility(MMobCore mob, int eff)
        {
            short total = 0;

            if (eff == MItemDefinition.RANGE)
            {
                total = (short)GetMaxAbility(mob, eff);

                int face = mob.Equip.Items[0].Index / 10;
                if (total < 2 && face == 3)
                {
                    if ((mob.LearnedSkill & 0x040) != 0)
                    {
                        total = 2;
                    }
                }

                return(total);
            }

            int[] array = new int[GameBasics.MAXL_EQUIP];
            for (int i = 0; i < GameBasics.MAXL_EQUIP; i++)
            {
                array[i] = 0;

                int itemId = mob.Equip.Items[i].Index;
                if (itemId == 0 && i != 7)
                {
                    continue;
                }

                if (i >= 1 && i <= 5)
                {
                    array[i] = ItemList[itemId].Unique;
                }

                if (eff == MItemDefinition.DAMAGE && i == 6)
                {
                    continue;
                }

                if (eff == MItemDefinition.MAGIC && i == 7)
                {
                    continue;
                }

                if (i == 7 && eff == MItemDefinition.DAMAGE)
                {
                    int dam1 = GetItemAbility(mob.Equip.Items[6], MItemDefinition.DAMAGE) +
                               GetItemAbility(mob.Equip.Items[6], MItemDefinition.DAMAGE2);

                    int dam2 = GetItemAbility(mob.Equip.Items[7], MItemDefinition.DAMAGE) +
                               GetItemAbility(mob.Equip.Items[7], MItemDefinition.DAMAGE2);

                    int arm1 = mob.Equip.Items[6].Index;
                    int arm2 = mob.Equip.Items[7].Index;

                    int unique1 = 0;
                    if (arm1 > 0 && arm1 < GameBasics.MAX_ITEMLIST)
                    {
                        unique1 = ItemList[itemId].Unique;
                    }

                    int unique2 = 0;
                    if (arm2 > 0 && arm2 < GameBasics.MAX_ITEMLIST)
                    {
                        unique2 = ItemList[itemId].Unique;
                    }

                    if (unique1 != 0 && unique2 != 0)
                    {
                        int porc = 50;
                        if (unique1 == unique2)
                        {
                            porc = 70;
                        }

                        if (dam1 > dam2)
                        {
                            total = (short)((total + dam1) + (dam2 * porc / 100));
                        }
                        else
                        {
                            total = (short)((total + dam2) + (dam1 * porc / 100));
                        }

                        continue;
                    }

                    if (dam1 > dam2)
                    {
                        total += (short)dam1;
                    }
                    else
                    {
                        total += (short)dam2;
                    }

                    continue;
                }

                short value = GetItemAbility(mob.Equip.Items[i], eff);
                if (eff == MItemDefinition.ATTSPEED && value == 1)
                {
                    value = 10;
                }

                total += value;
            }

            return(total);
        }