Exemplo n.º 1
0
        public void Reinitialize()
        {
            if (ZNet.instance.IsServer() || !ZNet.instance.IsServer() && !ZNet.instance.IsDedicated())
            {
                var pkgString = _zdo.GetString(BountyDataKey);
                var pkg       = new ZPackage(pkgString);
                try
                {
                    _bountyInfo = BountyInfo.FromPackage(pkg);
                }
                catch (Exception)
                {
                    Debug.LogError($"[EpicLoot] Error loading bounty info on creature ({name})! Possibly old or outdated bounty target, destroying creature.\nBountyData:\n{pkgString}");
                    _zdo.Set("BountyTarget", "");
                    _zdo.Set(BountyDataKey, "");
                    _character.m_nview.Destroy();
                    return;
                }
            }
            _monsterID = _zdo.GetString(MonsterIDKey);
            _isAdd     = _zdo.GetBool(IsAddKey);

            _character.m_name = _zdo.GetString(BountyTargetNameKey);
            _character.m_boss = !_zdo.GetBool(IsAddKey);
        }
Exemplo n.º 2
0
        public void Reinitialize()
        {
            var pkgString = _zdo.GetString(BountyDataKey);
            var pkg       = new ZPackage(pkgString);

            _bountyInfo = BountyInfo.FromPackage(pkg);

            _monsterID = _zdo.GetString(MonsterIDKey);
            _isAdd     = _zdo.GetBool(IsAddKey);

            _character.m_name = _zdo.GetString(BountyTargetNameKey);
            _character.m_boss = !_zdo.GetBool(IsAddKey);
        }
Exemplo n.º 3
0
        private static bool ShouldIgnoreDamage(Character tame, Tameable tameable, HitData hit, ZDO zdo)
        {
            bool      tameIsImmortal          = (TameableMortalityTypes)Configuration.Current.Tameable.mortality == TameableMortalityTypes.Immortal;
            bool      tameOwnerDamageOverride = Configuration.Current.Tameable.ownerDamageOverride;
            Character attacker                 = hit.GetAttacker();
            bool      tameAttackerIsOwner      = attacker == tameable.GetPlayer(attacker.GetZDOID());
            bool      tameIsRecoveringFromStun = zdo.GetBool("isRecoveringFromStun");

            return((tameIsImmortal && !(tameOwnerDamageOverride && tameAttackerIsOwner)) || tameIsRecoveringFromStun);
        }
Exemplo n.º 4
0
    // Token: 0x060006E6 RID: 1766 RVA: 0x00038E54 File Offset: 0x00037054
    private void Awake()
    {
        this.m_nview = base.GetComponent <ZNetView>();
        ZDO zdo = this.m_nview.GetZDO();

        if (zdo == null)
        {
            return;
        }
        this.m_nview.Register <bool>("SetPicked", new Action <long, bool>(this.RPC_SetPicked));
        this.m_nview.Register("Pick", new Action <long>(this.RPC_Pick));
        this.m_picked = zdo.GetBool("picked", false);
        this.SetPicked(this.m_picked);
        if (this.m_respawnTimeMinutes > 0)
        {
            base.InvokeRepeating("UpdateRespawn", UnityEngine.Random.Range(1f, 5f), 60f);
        }
    }
Exemplo n.º 5
0
    // Token: 0x060009C5 RID: 2501 RVA: 0x00046F2C File Offset: 0x0004512C
    private void SyncParameters()
    {
        ZDO zdo = this.m_nview.GetZDO();

        if (!this.m_nview.IsOwner())
        {
            for (int i = 0; i < this.m_boolHashes.Length; i++)
            {
                int  num   = this.m_boolHashes[i];
                bool @bool = zdo.GetBool(438569 + num, this.m_boolDefaults[i]);
                this.m_animator.SetBool(num, @bool);
            }
            for (int j = 0; j < this.m_floatHashes.Length; j++)
            {
                int   num2   = this.m_floatHashes[j];
                float @float = zdo.GetFloat(438569 + num2, this.m_floatDefaults[j]);
                if (this.m_smoothCharacterSpeeds && (num2 == ZSyncAnimation.m_forwardSpeedID || num2 == ZSyncAnimation.m_sidewaySpeedID))
                {
                    this.m_animator.SetFloat(num2, @float, 0.2f, Time.fixedDeltaTime);
                }
                else
                {
                    this.m_animator.SetFloat(num2, @float);
                }
            }
            for (int k = 0; k < this.m_intHashes.Length; k++)
            {
                int num3 = this.m_intHashes[k];
                int @int = zdo.GetInt(438569 + num3, this.m_intDefaults[k]);
                this.m_animator.SetInteger(num3, @int);
            }
            float float2 = zdo.GetFloat(ZSyncAnimation.m_animSpeedID, 1f);
            this.m_animator.speed = float2;
            return;
        }
        zdo.Set(ZSyncAnimation.m_animSpeedID, this.m_animator.speed);
    }
Exemplo n.º 6
0
        public static void Prefix(MonsterAI __instance, ref float dt)
        {
            if (Configuration.Current.Tameable.IsEnabled)
            {
                MonsterAI monsterAI = __instance;
                ZDO       zdo       = monsterAI.m_nview.GetZDO();

                if ((TameableMortalityTypes)Configuration.Current.Tameable.mortality != TameableMortalityTypes.Essential || zdo == null || !zdo.GetBool("isRecoveringFromStun"))
                {
                    return;
                }

                if (monsterAI.m_character.m_moveDir != Vector3.zero)
                {
                    monsterAI.StopMoving();
                }

                if (monsterAI.m_sleepTimer != 0f)
                {
                    monsterAI.m_sleepTimer = 0f;
                }

                float timeSinceStun = zdo.GetFloat("timeSinceStun") + dt;
                zdo.Set("timeSinceStun", timeSinceStun);

                if (timeSinceStun >= Configuration.Current.Tameable.stunRecoveryTime)
                {
                    zdo.Set("timeSinceStun", 0f);
                    monsterAI.m_sleepTimer = 0.5f;
                    monsterAI.m_character.m_animator.SetBool("sleeping", false);
                    zdo.Set("sleeping", false);
                    zdo.Set("isRecoveringFromStun", false);
                }

                dt = 0f;
            }
        }
Exemplo n.º 7
0
 public static bool GetEventCreature(this ZDO zdo)
 {
     return(zdo.GetBool(EventCreatureHash));
 }
Exemplo n.º 8
0
 public static bool GetTamed(this ZDO zdo)
 {
     return(zdo.GetBool(TamedHash));
 }