Example #1
0
        static bool Prefix(EntityAlive __instance)
        {
            // Check if this feature is enabled.
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }

            // If a door is found, try to open it. If it returns false, start attacking it.
            EntityAliveSDX myEntity = __instance as EntityAliveSDX;

            if (myEntity)
            {
                myEntity.RestoreSpeed();
            }
            return(true);
        }
Example #2
0
    public static bool ExecuteCMD(int EntityID, String strCommand, EntityPlayer player)
    {
        DisplayLog("ExecuteCMD: " + strCommand);
        EntityAliveSDX myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAliveSDX;

        if (myEntity == null)
        {
            return(false);
        }

        LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);

        Vector3 position = myEntity.position;

        // Restore it's walk speed to default.
        myEntity.RestoreSpeed();

        switch (strCommand)
        {
        case "TellMe":
            //XUiC_TipWindow.ShowTip(myEntity.ToString(), XUiM_Player.GetPlayer() as EntityPlayerLocal,null);
            GameManager.ShowTooltipWithAlert(player as EntityPlayerLocal, myEntity.ToString() + "\n\n\n\n\n", "ui_denied");
            // uiforPlayer.windowManager.Open("EntityInformation", true, false, true);
            break;

        case "ShowAffection":
            GameManager.ShowTooltipWithAlert(player as EntityPlayerLocal, "You gentle scratch and stroke the side of the animal.", "");
            break;

        case "FollowMe":
            SetLeader(EntityID, player.entityId);
            SetCurrentOrder(EntityID, Orders.Follow);
            myEntity.moveSpeed      = player.moveSpeed;
            myEntity.moveSpeedAggro = player.moveSpeedAggro;

            break;

        case "StayHere":
            SetCurrentOrder(EntityID, Orders.Stay);
            myEntity.GuardPosition = position;
            myEntity.moveHelper.Stop();
            break;

        case "GuardHere":
            SetCurrentOrder(EntityID, Orders.Stay);
            myEntity.SetLookPosition(player.GetLookVector());
            myEntity.GuardPosition = position;
            myEntity.moveHelper.Stop();
            myEntity.GuardLookPosition = player.GetLookVector();
            break;

        case "Wander":
            SetCurrentOrder(EntityID, Orders.Wander);
            break;

        case "SetPatrol":
            SetLeader(EntityID, player.entityId);
            SetCurrentOrder(EntityID, Orders.SetPatrolPoint);
            myEntity.moveSpeed      = player.moveSpeed;
            myEntity.moveSpeedAggro = player.moveSpeedAggro;
            myEntity.PatrolCoordinates.Clear();     // Clear the existing point.
            break;

        case "Patrol":
            SetCurrentOrder(EntityID, Orders.Patrol);
            break;

        case "Hire":
            bool result = Hire(EntityID, player as EntityPlayerLocal);
            break;

        case "OpenInventory":
            GameManager.Instance.TELockServer(0, myEntity.GetBlockPosition(), EntityID, player.entityId);
            uiforPlayer.windowManager.CloseAllOpenWindows(null, false);
            if (myEntity.lootContainer == null)
            {
                DisplayLog(" Loot Container is null");
            }
            else
            {
                DisplayLog(" Get Open Time");
                DisplayLog("Loot Container: " + myEntity.lootContainer.ToString());
                myEntity.lootContainer.lootListIndex = 62;
                DisplayLog(" Loot List: " + myEntity.lootContainer.lootListIndex);

                DisplayLog(myEntity.lootContainer.GetOpenTime().ToString());
                lootContainerOpened(myEntity.lootContainer, uiforPlayer, player.entityId);
            }
            break;

        case "Loot":
            SetCurrentOrder(EntityID, Orders.Loot);
            myEntity.Buffs.RemoveCustomVar("Leader");
            break;

        case "Dismiss":
            SetCurrentOrder(EntityID, Orders.Wander);
            myEntity.Buffs.RemoveCustomVar("Leader");
            myEntity.Buffs.RemoveCustomVar("Owner");
            break;
        }

        return(true);
    }
Example #3
0
    public static bool ExecuteCMD(int EntityID, String strCommand, EntityPlayer player)
    {
        String strDisplay = "ExecuteCMD( " + strCommand + " ) to " + EntityID + " From " + player.DebugNameInfo;

        AdvLogging.DisplayLog(AdvFeatureClass, strDisplay);

        EntityAliveSDX myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAliveSDX;

        if (myEntity == null)
        {
            return(false);
        }

        LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);

        Vector3 position = myEntity.position;

        // Restore it's walk speed to default.
        myEntity.RestoreSpeed();

        switch (strCommand)
        {
        case "TellMe":
            GameManager.ShowTooltipWithAlert(player as EntityPlayerLocal, myEntity.ToString() + "\n\n\n\n\n", "ui_denied");
            AdvLogging.DisplayLog(AdvFeatureClass, "\n\nBuffs:");
            foreach (var Buff in myEntity.Buffs.ActiveBuffs)
            {
                AdvLogging.DisplayLog(AdvFeatureClass, "\t" + Buff.BuffName);
            }

            AdvLogging.DisplayLog(AdvFeatureClass, myEntity.ToString());
            AdvLogging.DisplayLog(AdvFeatureClass, "Body Damage: ");
            AdvLogging.DisplayLog(AdvFeatureClass, "\t Has Right Leg? " + myEntity.bodyDamage.HasRightLeg);
            AdvLogging.DisplayLog(AdvFeatureClass, "\t Has Left Leg? " + myEntity.bodyDamage.HasLeftLeg);
            AdvLogging.DisplayLog(AdvFeatureClass, "\t Has Limbs? " + myEntity.bodyDamage.HasLimbs);
            AdvLogging.DisplayLog(AdvFeatureClass, "\t Arm or Leg missing? " + myEntity.bodyDamage.IsAnyArmOrLegMissing);
            AdvLogging.DisplayLog(AdvFeatureClass, "\t Has any leg missing? " + myEntity.bodyDamage.IsAnyLegMissing);
            bool LegDamageTrigger = false;
            myEntity.emodel.avatarController.TryGetTrigger("LegDamageTrigger", out LegDamageTrigger);
            AdvLogging.DisplayLog(AdvFeatureClass, "\t Leg Damage Trigger? " + LegDamageTrigger);
            break;

        case "ShowAffection":
            GameManager.ShowTooltipWithAlert(player as EntityPlayerLocal, "You gentle scratch and stroke the side of the animal.", "");
            break;

        case "FollowMe":
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Leader");
            SetLeader(EntityID, player.entityId);
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Order");
            SetCurrentOrder(EntityID, Orders.Follow);
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Adjusting Speeds");
            myEntity.moveSpeed      = player.moveSpeed;
            myEntity.moveSpeedAggro = player.moveSpeedAggro;
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Done with Order");
            break;

        case "StayHere":
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Order");
            SetCurrentOrder(EntityID, Orders.Stay);
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Position");
            myEntity.GuardPosition = position;
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Stopping Move Helper()");
            if (myEntity.moveHelper != null)     // No move helper on the client when on Dedi
            {
                myEntity.moveHelper.Stop();
            }
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Done with Order");

            break;

        case "GuardHere":
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Order");
            SetCurrentOrder(EntityID, Orders.Stay);
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Look Direction");

            myEntity.SetLookPosition(player.GetLookVector());
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Position");

            myEntity.GuardPosition = position;
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Stopping Move Helper()");

            if (myEntity.moveHelper != null)     // No move helper on the client when on Dedi
            {
                myEntity.moveHelper.Stop();
            }
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Guard Look");
            myEntity.GuardLookPosition = player.GetLookVector();
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Done with Order");

            break;

        case "Wander":
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Order");
            SetCurrentOrder(EntityID, Orders.Wander);
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Done with Order");

            break;

        case "SetPatrol":
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Order");
            SetLeader(EntityID, player.entityId);
            SetCurrentOrder(EntityID, Orders.SetPatrolPoint);
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Move Speed");
            myEntity.moveSpeed      = player.moveSpeed;
            myEntity.moveSpeedAggro = player.moveSpeedAggro;
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Resetting Patrol Points");

            myEntity.PatrolCoordinates.Clear();     // Clear the existing point
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Done with Order");

            break;

        case "Patrol":
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Order");
            SetCurrentOrder(EntityID, Orders.Patrol);
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Done with Order");

            break;

        case "Hire":
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Opening Hire ");
            bool result = Hire(EntityID, player as EntityPlayerLocal);
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Done with Hire");

            break;

        case "OpenInventory":
            AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Setting Order Open Inventory");

            //      GameManager.Instance.TELockServer(0, myEntity.GetBlockPosition(), EntityID, player.entityId);
            //       uiforPlayer.windowManager.CloseAllOpenWindows(null, false);
            if (myEntity.lootContainer == null)
            {
                AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Loot Container is null");
            }

            else
            {
                AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Loot Container: " + myEntity.lootContainer.ToString());
                myEntity.lootContainer.lootListIndex = 62;
                AdvLogging.DisplayLog(AdvFeatureClass, strDisplay + " Opening Loot Container");

                lootContainerOpened(myEntity.lootContainer, uiforPlayer, player.entityId);
            }
            break;

        case "Loot":
            SetCurrentOrder(EntityID, Orders.Loot);
            myEntity.Buffs.RemoveCustomVar("Leader");
            break;

        case "Dismiss":
            SetCurrentOrder(EntityID, Orders.Wander);
            myEntity.Buffs.RemoveCustomVar("Leader");
            myEntity.Buffs.RemoveCustomVar("Owner");
            break;
        }

        return(true);
    }