Beispiel #1
0
        public uint GetLevel(uint dwLevel)
        {
            UnitAny unit;

            if (!game.GetPlayerUnit(out unit) || unit.pAct == 0)
            {
                return(0);
            }

            var act = game.Debugger.Read <Act>(unit.pAct);

            if (act.pMisc == 0)
            {
                return(0);
            }

            var actMisc = game.Debugger.Read <ActMisc>(act.pMisc);

            var  lvl    = game.Debugger.Read <Level>(actMisc.pLevelFirst);
            uint pLevel = 0;

            for (pLevel = actMisc.pLevelFirst; pLevel != 0; pLevel = lvl.pNextLevel)
            {
                if (pLevel != actMisc.pLevelFirst)
                {
                    lvl = game.Debugger.Read <Level>(pLevel);
                }

                if (lvl.dwLevelNo == (uint)dwLevel && lvl.dwPosX > 0)
                {
                    return(pLevel);
                }
            }

            pLevel = game.Debugger.Call <uint>(D2Common.GetLevel,
                                               MagicConvention.FastCall,
                                               act.pMisc, dwLevel);

            return(pLevel);
        }
Beispiel #2
0
        public bool Update()
        {
            var player = game.GetPlayerUnit();

            if (player == 0)
            {
                return(false);
            }

            if (!game.GameReady())
            {
                return(false);
            }

            Name = game.GetPlayerName();

            foreach (var stat in CollectableStats)
            {
                stats[stat] = game.GetUnitStat(player, stat);
            }

            return(true);
        }