public override void EquipWeapon()
    {
        base.EquipWeapon();
        HeldEntity heldEntity = base.GetHeldEntity();

        if (heldEntity != null)
        {
            Item item = heldEntity.GetItem();
            if (item != null && item.contents != null)
            {
                if (UnityEngine.Random.Range(0, 3) == 0)
                {
                    Item item1 = ItemManager.CreateByName("weapon.mod.flashlight", 1, (ulong)0);
                    if (!item1.MoveToContainer(item.contents, -1, true))
                    {
                        item1.Remove(0f);
                        return;
                    }
                    this.lightsOn = false;
                    base.InvokeRandomized(new Action(this.LightCheck), 0f, 30f, 5f);
                    base.LightCheck();
                    return;
                }
                Item item2 = ItemManager.CreateByName("weapon.mod.lasersight", 1, (ulong)0);
                if (!item2.MoveToContainer(item.contents, -1, true))
                {
                    item2.Remove(0f);
                }
                base.SetLightsOn(true);
                this.lightsOn = true;
            }
        }
    }
示例#2
0
 private void OnHealingItemUse(HeldEntity item, BasePlayer target)
 {
     if (logHealingItems)
     {
         Log("Combat", Lang("Log Player Healing1", target.displayName, target.userID, item.GetItem().info.displayName.english, logPositions ? $"{Lang("Log At")} {EntityPosition(target)}" : null));
     }
     if (putHealingItems)
     {
         Puts(Lang("Log Player Healing1", target.displayName, target.userID, item.GetItem().info.displayName.english, logPositions ? $"{Lang("Log At")} {EntityPosition(target)}" : null));
     }
 }
示例#3
0
    public override void EquipWeapon()
    {
        base.EquipWeapon();
        HeldEntity heldEntity = this.GetHeldEntity();

        if (!Object.op_Inequality((Object)heldEntity, (Object)null))
        {
            return;
        }
        Item obj = heldEntity.GetItem();

        if (obj == null || obj.contents == null)
        {
            return;
        }
        if (Random.Range(0, 3) == 0)
        {
            Item byName = ItemManager.CreateByName("weapon.mod.flashlight", 1, 0UL);
            if (!byName.MoveToContainer(obj.contents, -1, true))
            {
                byName.Remove(0.0f);
            }
            else
            {
                this.lightsOn = false;
                this.InvokeRandomized(new Action(((HumanNPC)this).LightCheck), 0.0f, 30f, 5f);
                this.LightCheck();
            }
        }
        else
        {
            Item byName = ItemManager.CreateByName("weapon.mod.lasersight", 1, 0UL);
            if (!byName.MoveToContainer(obj.contents, -1, true))
            {
                byName.Remove(0.0f);
            }
            this.SetLightsOn(true);
            this.lightsOn = true;
        }
    }
示例#4
0
        public static void Draw()
        {
            if (bDrawPlayers)
            {
                foreach (BasePlayer player in BasePlayer.VisiblePlayerList)
                {
                    //Debug.LogError("1: " + player.displayName);
                    if ((player != null) && !player.IsLocalPlayer() && !player.IsAdmin)
                    {
                        //Debug.LogError("2: " + player.displayName);
                        Vector3 position = player.transform.position;
                        Vector3 vector3  = MainCamera.mainCamera.WorldToScreenPoint(position);
                        if (vector3.z > 0f)
                        {
                            //Debug.LogError("3: " + player.displayName);
                            int distance = (int)Vector3.Distance(LocalPlayer.Entity.transform.position, position);
                            if (distance <= iESPDrawDistance)
                            {
                                //Debug.LogError("4: " + player.displayName);
                                Color color;
                                if (!player.IsSleeping() && player.IsAlive() && !player.HasPlayerFlag(BasePlayer.PlayerFlags.IsAdmin))
                                {
                                    //Debug.LogError("5: " + player.displayName);
                                    Vector3 vector2 =
                                        MainCamera.mainCamera.WorldToScreenPoint(position + new Vector3(0f, 1.7f, 0f));
                                    float y = Mathf.Abs((float)(vector3.y - vector2.y));
                                    float x = y / 2f;
                                    color = Color.red;
                                    if (bDrawHP)
                                    {
                                        Renderer.DrawHealth(new Vector2(vector2.x, Screen.height - vector2.y),
                                                            player.health, true);
                                    }
                                    Renderer.DrawBox(new Vector2(vector2.x - (x / 2f), Screen.height - vector2.y),
                                                     new Vector2(x, y), 1f, color, player.IsDucked());
                                    if (bDrawEquipItem)
                                    {
                                        Item       activeItem = player.Belt.GetActiveItem();
                                        HeldEntity heldEntity = player.GetHeldEntity();

                                        if (activeItem != null)
                                        {
                                            if (heldEntity != null && heldEntity.GetItem() != null && heldEntity
                                                .GetItem()
                                                .info.shortname.Equals(activeItem.info.shortname))
                                            {
                                                Renderer.DrawString(new Vector2(vector3.x, Screen.height - vector3.y),
                                                                    string.Format("{0}\n[{1}m]\n{2}HP\n[{3}]", player.displayName,
                                                                                  distance, (int)player.health, activeItem.info.displayName.english),
                                                                    color, true, 12, true, 4);
                                            }
                                            else
                                            {
                                                Renderer.DrawString(new Vector2(vector3.x, Screen.height - vector3.y),
                                                                    string.Format("{0}\n[{1}m]\n{2}HP\n{3}", player.displayName,
                                                                                  distance,
                                                                                  (int)player.health, activeItem.info.displayName.english), color, true,
                                                                    12,
                                                                    true, 4);
                                            }
                                        }
                                        else
                                        {
                                            Renderer.DrawString(new Vector2(vector3.x, Screen.height - vector3.y),
                                                                string.Format("{0}\n[{1}m]\n{2}HP", player.displayName, distance,
                                                                              (int)player.health), color, true, 12, true, 3);
                                        }
                                    }
                                    else
                                    {
                                        Renderer.DrawString(new Vector2(vector3.x, Screen.height - vector3.y),
                                                            string.Format("{0}\n[{1}m]\n{2}HP", player.displayName, distance,
                                                                          (int)player.health), color, true, 12, true, 3);
                                    }
                                }
                                else if (bDrawSleepers && player.health > 0f)
                                {
                                    color = cSleepingColor;
                                    Renderer.DrawString(new Vector2(vector3.x, Screen.height - vector3.y),
                                                        string.Format("{0}\n[{1}m]\n{2}HP", player.displayName, distance,
                                                                      (int)player.health), color, true, 12, true, 3);
                                }
                                else if (player.IsDead())
                                {
                                    color = cDeadColor;
                                    Renderer.DrawString(new Vector2(vector3.x, Screen.height - vector3.y),
                                                        string.Format("{0}\n[{1}m]\nDEAD", player.displayName, distance), color, true,
                                                        12, true, 3);
                                }
                            }
                        }
                    }
                }
            }
        }