Example #1
0
        internal static void add_affect(bool call_spell_jump_list, int data, ushort minutes, Affects type, Player player)
        {
            Affect affect = new Affect(type, minutes, (byte)data, call_spell_jump_list);

            player.affects.Add(affect);
            //TODO simplify this funcation.
        }
Example #2
0
        public Affect ShallowClone()
        {
            Affect a = (Affect)this.MemberwiseClone();

            return(a);
        }
Example #3
0
        /* sub_646D9 */
        internal static void decode_strength(out int str_00, out int str, Affect arg_8)
        {
            str_00 = 0;
            str = (byte)(arg_8.affect_data & 0x7F);

            if (str <= 101)
            {
                str_00 = (byte)(str - 1);
                str = 18;
            }
            else
            {
                str -= 100;
            }
        }
Example #4
0
        internal static void remove_affect(Affect affect, Affects affect_id, Player player)
        {
            if (affect == null)
            {
                affect = player.GetAffect(affect_id);
            }

            if (affect != null)
            {
                if (affect.callAffectTable == true)
                {
                    ovr013.CallAffectTable(Effect.Remove, affect, player, affect_id);
                }

                player.affects.Remove(affect);

                if (affect_id == Affects.resist_fire)
                {
                    CalcStatBonuses(Stat.CHA, player);
                }

                if (affect_id == Affects.enlarge ||
                    affect_id == Affects.strength ||
                    affect_id == Affects.strength_spell)
                {
                    CalcStatBonuses(Stat.STR, player);
                }
            }
        }
Example #5
0
        internal static bool FindAffect(out Affect affectFound, Affects affect_type, Player player)
        {
            affectFound = player.affects.Find(aff => aff.type == affect_type);

            return affectFound != null;
        }
Example #6
0
        internal static Player load_mob(int monster_id, bool exit)
        {
            string area_text = gbl.game_area.ToString();

            byte[] data;
            short decode_size;
            seg042.load_decode_dax(out data, out decode_size, monster_id, "MON" + area_text + "CHA.dax");

            if (decode_size == 0)
            {
                if (exit)
                {
                    seg041.DisplayAndPause("Unable to load monster", 15);
                    seg043.print_and_exit();
                }
                else
                {
                    return null;
                }
            }

            Player player = new Player(data, 0);

            seg042.load_decode_dax(out data, out decode_size, monster_id, "MON" + area_text + "SPC.dax");

            if (decode_size != 0)
            {
                int offset = 0;

                do
                {
                    Affect affect = new Affect(data, offset);
                    player.affects.Add(affect);

                    offset += 9;
                } while (offset < decode_size);
            }

            seg042.load_decode_dax(out data, out decode_size, monster_id, "MON" + area_text + "ITM.dax");

            if (decode_size != 0)
            {
                for (int offset = 0; offset < decode_size; offset += Item.StructSize)
                {
                    player.items.Add(new Item(data, offset));
                }
            }

            seg043.clear_keyboard();

            return player;
        }
Example #7
0
        internal static void import_char01(ref Player player, string arg_8)
        {
            Classes.File file;

            seg042.find_and_open_file(out file, false, Path.Combine(Config.GetSavePath(), arg_8));

            seg041.displayString("Loading...Please Wait", 0, 10, 0x18, 0);

            if (gbl.import_from == ImportSource.Curse)
            {
                byte[] data = new byte[Player.StructSize];
                seg051.BlockRead(Player.StructSize, data, file);
                seg051.Close(file);

                player = new Player(data, 0);

            }
            else if (gbl.import_from == ImportSource.Pool)
            {
                byte[] data = new byte[PoolRadPlayer.StructSize];
                seg051.BlockRead(PoolRadPlayer.StructSize, data, file);
                seg051.Close(file);

                PoolRadPlayer poolRadPlayer = new PoolRadPlayer(data);

                player = ConvertPoolRadPlayer(poolRadPlayer);
            }
            else if (gbl.import_from == ImportSource.Hillsfar)
            {
                byte[] data = new byte[HillsFarPlayer.StructSize];
                seg051.BlockRead(HillsFarPlayer.StructSize, data, file);
                seg051.Close(file);

                HillsFarPlayer var_1C4 = new HillsFarPlayer(data);

                player = ConvertHillsFarPlayer(var_1C4, arg_8);

                var_1C4 = null;
            }

            if (gbl.import_from == ImportSource.Curse)
            {
                arg_8 = System.IO.Path.GetFileNameWithoutExtension(arg_8);
            }
            else
            {
                arg_8 = seg042.clean_string(player.name);
            }

            string filename = Path.Combine(Config.GetSavePath(), arg_8 + ".swg");
            if (seg042.file_find(filename) == true)
            {
                byte[] data = new byte[Item.StructSize];

                seg042.find_and_open_file(out file, false, filename);

                while (true)
                {
                    if (seg051.BlockRead(Item.StructSize, data, file) == Item.StructSize)
                    {
                        player.items.Add(new Item(data, 0));
                    }
                    else
                    {
                        break;
                    }
                }

                seg051.Close(file);
            }

            filename = Path.Combine(Config.GetSavePath(), arg_8 + ".fx");
            if (seg042.file_find(filename) == true)
            {
                byte[] data = new byte[Affect.StructSize];
                seg042.find_and_open_file(out file, false, filename);

                while (true)
                {
                    if (seg051.BlockRead(Affect.StructSize, data, file) == Affect.StructSize)
                    {
                        Affect tmp_affect = new Affect(data, 0);

                        player.affects.Add(new Affect(data, 0));
                    }
                    else
                    {
                        break;
                    }
                }

                seg051.Close(file);
            }

            filename = Path.Combine(Config.GetSavePath(), arg_8 + ".spc");
            if (gbl.import_from == ImportSource.Pool)
            {
                if (seg042.file_find(filename) == true)
                {
                    byte[] data = new byte[Affect.StructSize];
                    seg042.find_and_open_file(out file, false, filename);

                    while (true)
                    {
                        if (seg051.BlockRead(Affect.StructSize, data, file) == Affect.StructSize)
                        {
                            if (asc_49280.MemberOf(data[0]) == true)
                            {
                                Affect tmpAffect = new Affect(data, 0);
                                player.affects.Add(tmpAffect);
                            }
                        }
                        else
                        {
                            break;
                        }
                    }

                    seg051.Close(file);

                }
            }

            seg043.clear_keyboard();
            ovr025.reclac_player_values(player);
            ovr026.ReclacClassBonuses(player);
        }