CELua[RU]
    • Категории
    • Последние
    • Метки
    • Популярные
    • Пользователи
    • Группы
    • Зарегистрироваться
    • Войти

    [The Escapists 2 + Unity + dnSpy] Спавн итемов

    Запланировано Прикреплена Закрыта Перенесена Статьи
    unitycheatsdnspycsharpблог
    1 Сообщения 1 Posters 41 Просмотры 1 Watching
    Загружаем больше сообщений
    • Сначала старые
    • Сначала новые
    • По количеству голосов
    Ответить
    • Ответить, создав новую тему
    Авторизуйтесь, чтобы ответить
    Эта тема была удалена. Только пользователи с правом управления темами могут её видеть.
    • MasterGHM Не в сети
      MasterGH Администраторы
      отредактировано MasterGH

      Спавн итемов удалось сделать через dnSpy

      При клике на любой предмет на меню крафта он создается в инвентаре, а если там занято, то выкидывается на карту.

      Я переписал метод клика на рецепт, вот он оригинальный

      // Token: 0x060069FA RID: 27130 RVA: 0x00254874 File Offset: 0x00252A74
      	private void OnRecipeSlotClicked(int recipeSlotID)
      	{
      		if (recipeSlotID == this.m_CurrentClickedRecipeID)
      		{
      			if (!T17RewiredStandaloneInputModule.IsCurrentActiveModuleUsingController())
      			{
      				this.m_CurrentClickedRecipeID = -1;
      			}
      			return;
      		}
      		if (!this.CheckHasItemsForRecipe(recipeSlotID))
      		{
      			this.m_CurrentClickedRecipeID = -1;
      			return;
      		}
      		CraftManager.Recipe recipeByID = CraftManager.GetInstance().GetRecipeByID(recipeSlotID);
      		if (recipeByID != null && (!recipeByID.m_bHidden || recipeByID.m_bDiscovered))
      		{
      			this.FillSlots(recipeSlotID);
      			this.m_CurrentClickedRecipeID = recipeSlotID;
      			return;
      		}
      		this.m_CurrentClickedRecipeID = -1;
      	}
      

      На этот

      private void OnRecipeSlotClicked(int recipeSlotID)
      	{
      		int itemDataID = CraftManager.GetInstance().GetCurrentRecipes()[recipeSlotID].m_Product.m_ItemDataID;
      		Character character = base.CurrentGamePlayer.GetComponent();
      		ItemManager.GetInstance().AssignItemRPC(character.m_NetView.ownerId, itemDataID, new ItemManager.ItemManagerEvent(this.OnStandingAnimItemSpawn), ref character.m_StandingStillEquipID, -1);
      	}
      
      	private void OnStandingAnimItemSpawn(Item item, int eventID)
      	{
      		if (base.CurrentGamePlayer.GetComponent().m_StandingStillEquipID == eventID)
      		{
      			Player player = base.CurrentGamePlayer;
      			bool flag = false;
      			if (player.GetEquippedItem() == null)
      			{
      				flag = player.SetEquippedItem(item, true, false, RPC_CallContexts.Master);
      			}
      			if (!flag)
      			{
      				item.DropItemInLevel(player, player.transform.position);
      			}
      		}
      	}
      

      7c8381aa-0c85-466d-9743-42edabd7eb9c-изображение.png
      ac1cd6a8-5078-48ea-9f4a-3d605db0971c-изображение.png
      Для спавна заменить Assembly-CSharp.dll из архива, сделав копию предварительно
      Assembly-CSharp.rar

      1 ответ Последний ответ Ответить Цитировать 0
      • MasterGHM MasterGH переместил эту тему из в

      • 1 / 1
      • Первое сообщение
        Последнее сообщение
      Powered by NodeBB | Contributors
      СeLua[RU] 2025©