Skip to content

Commit

Permalink
update to net8
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudokhvist committed Dec 18, 2023
1 parent 45fbda1 commit 8801925
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 82 deletions.
2 changes: 1 addition & 1 deletion ArchiSteamFarm
Submodule ArchiSteamFarm updated 412 files
4 changes: 2 additions & 2 deletions ItemDispenser/ItemDispenser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task<bool> OnBotTradeOffer(Bot bot, TradeOffer tradeOffer) {
}

public Task OnLoaded() {
ASF.ArchiLogger.LogGenericInfo("Item Dispenser Plugin by Ryzhehvost, powered by ginger cats");
ASF.ArchiLogger.LogGenericInfo("Item Dispenser Plugin by Rudokhvist, powered by ginger cats");
return Task.CompletedTask;
}

Expand All @@ -81,7 +81,7 @@ public Task OnBotInitModules(Bot bot, IReadOnlyDictionary<string, JToken>? addit
return Task.CompletedTask;
}

if (!additionalConfigProperties.TryGetValue("Ryzhehvost.DispenseItems", out JToken? jToken)) {
if (!additionalConfigProperties.TryGetValue("Rudokhvist.DispenseItems", out JToken? jToken)) {
BotSettings.AddOrUpdate(bot, new ConcurrentHashSet<DispenseItem>(), (k, v) => new ConcurrentHashSet<DispenseItem>());
return Task.CompletedTask;
}
Expand Down
6 changes: 3 additions & 3 deletions ItemDispenser/ItemDispenser.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Authors>Ryzhehvost</Authors>
<AssemblyVersion>0.3.1.1</AssemblyVersion>
<TargetFrameworks>net6.0;net48</TargetFrameworks>
<Authors>Rudokhvist</Authors>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
62 changes: 5 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
This plugin allows you to set your bot(s) to accept incoming trade requests for certain type(s) of items from your inventory. It's primary use is giving away your coupons to people who need it. Initially I planned to make plugin for coupons only, but decided that a bit of flexibility won't hurt, so you could specify any inventory you want to give away. Also, if your bot has `AcceptDonations` set in `TradingPreferences`, trade offers are allowed, apart from items you give, to have **any** items you will receive as a donation. It **will not**, however, accept "mixed" trade offers, i.e. trades where someone wants to both exchange with you some items on 1:1 basis and at the same time take some items you dispense.

## Installation
- download .zip file from [latest release](https://github.com/Ryzhehvost/ItemDispenser/releases/latest), in most cases you need `ItemDispenser.zip`, but if you use ASF-generic-netf.zip (you really need a strong reason to do that) download `ItemDispenser-netf.zip`.
- download `ItemDispenser.zip` file from [latest release](https://github.com/Rudokhvist/ItemDispenser/releases/latest).
- unpack downloaded .zip file to `plugins` folder inside your ASF folder.
- (re)start ASF, you should get a message indicating that plugin loaded successfully.

## Configuration
For this plugin to work you need to add a specific configuration parameter to configuration of your bot. Example of general structure of configuration parameter is shown below:
```
"Ryzhehvost.DispenseItems" : [
"Rudokhvist.DispenseItems" : [
{ "AppID": 753, "ContextID": 3},
{ "AppID": 753, "ContextID": 6, "Types": [ 2, 4 ]},
{ "AppID": 440, "ContextID": 2}
]
```
This is an example structure, **don't use it on real bots**, you may lose items that you still need. In this structure:

`Ryzhehvost.DispenseItems` - is parameter of **array of objects** type. Every element of array specifies steam inventory and optionally type of an item to give away. In this element there are up to three fields:
`Rudokhvist.DispenseItems` - is parameter of **array of objects** type. Every element of array specifies steam inventory and optionally type of an item to give away. In this element there are up to three fields:

`AppID` - field of **uint** type. AppID of application which inventory we want to give away. This field is required.<br/>
`ContextID` - field of **ulong** type. ContextID of inventory we want to give away. This field is required.<br/>
Expand All @@ -33,7 +33,7 @@ So, with the example above, plugin will accept trades with requests of such item
If you only want to give away coupons (and that's a primary use of this plugin), you just need to add to configuration of your bot following structure (you can just copy & paste):

```
"Ryzhehvost.DispenseItems" : [{ "AppID": 753, "ContextID": 3}]
"Rudokhvist.DispenseItems" : [{ "AppID": 753, "ContextID": 3}]
```

### How to find AppID and ContextID?
Expand All @@ -43,56 +43,4 @@ It's simple, as one-two-three:
3. Link will have three numbers after `#` character, separated with `_`. You need first two, those are AppID and ContextID respectively. Look at the following picture for better understanding:
![AppID and ContextID](https://i.imgur.com/hom2PZq.png)

You can get support for this plugin in https://steamcommunity.com/groups/Ryzheplugins (or just use github issues).

---

# Плагин ASF для раздачи предметов


# Введение
Этот плагин позволяет вам настроить бота так, чтобы он принимал входящие обмены с запросом вещей определённых типов из вашего инвентаря. Его основное назначение - раздача купонов нуждающимся в них людях. Изначально я планировал создать плагин исключительно для купонов, но решил что немного гибкости не повредит, поэтому вы можете его настроить на раздачу предметов из любого инвентаря стим. Также, если у вашего бота включено значение `AcceptDonations` в параметре `TradingPreferences`, в предложениях обмена, кроме вещей которые вы отдаёте, могут присутствовать также **любые** предметы которые вы получите в качестве пожертвований. Однако он **не** примет "смешанные" предложения обмена, т.е. такие где с вами хотят обменяться предметами 1:1 и одновременно взять предметы которые вы раздаёте.

## Установка
- скачайте файл .zip из [последнего релиза](https://github.com/Ryzhehvost/ItemDispenser/releases/latest), в большинстве случаев вам нужен файл `ItemDispenser.zip`, не если вы по какой-то причине пользуетесь ASF-generic-netf.zip (а для этого нужны веские причины) - скачайте `ItemDispenser-netf.zip`.
- распакуйте скачанный файл .zip в папку `plugins` внутри вашей папки с ASF.
- (пере)запустите ASF, вы должны получить сообщение что плагин успешно загружен.

## Конфигурирование
Для работы этого плагина вам необходимо добавить особый конфигурационный параметр в конфигурацию вашего бота. Пример общего вида структуры этого конфигурационного параметра показан ниже:
```
"Ryzhehvost.DispenseItems" : [
{ "AppID": 753, "ContextID": 3},
{ "AppID": 753, "ContextID": 6, "Types": [ 2, 4 ]},
{ "AppID": 440, "ContextID": 2}
]
```
Это только пример структуры, **не используйте его на реальных ботах**, вы можете потерять нужные вам предметы. В этой структуре:

`Ryzhehvost.DispenseItems` - параметр типа **массив объектов**. Каждый элемент этого массива задаёт один из инвентарей Steam, из которого вы хотите раздавать предметы. В этом элементе может быть до трёх полей:

`AppID` - поле типа **uint**. AppID приложения, из инвентаря которого вы хотите раздавать предметы. Это обязательное поле.<br/>
`ContextID` - поле типа **ulong**. ContextID инвентаря, из которого вы хотите раздавать предметы. Это обязательное поле.<br/>
`Types` - поле типа **массив byte**. Это необязательное поле, и оно имеет смысл только если вы планируете раздавать предметы из инвентаря Steam "Сообщество". Возможные типы такие же, как в параметре бота [MatchableTypes](https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Configuration-ru-RU#matchabletypes) в ASF.

Итак, если мы используем структуру из примера выше, плагин будет принимать предложения обмена с запросом следующих предметов:
1. `{ "AppID": 753, "ContextID": 3}` купоны Steam
2. `{ "AppID": 753, "ContextID": 6, "Types": [ 2, 4 ]}` смайлики и фоны профиля Steam
3. `{ "AppID": 440, "ContextID": 2}` любые предметы из инвентаря Team Fortress 2

Если вы хотите только раздавать купоны (а это и есть основное применение этого плагина), вам нужно просто добавить следующую структуру в конфигурацию вашего бота (можно просто скоприровать и вставить):

```
"Ryzhehvost.DispenseItems" : [{ "AppID": 753, "ContextID": 3}]
```

### Как найти AppID и ContextID?
Это очень просто, как раз-два-три:
1. Откройте инвентарь, предметы из которого хотите раздать, в браузере, и выберите любой предмет.
2. Скопируйте ссылку на этот предмет в блокнот, **или**, если ваш браузер показывает ссылку, на которую вы наводите, просто посмотрите на неё.
3. Ссылка будет иметь три числа после символа `#`, разделённые символом `_`. Вам нужны первые два, это и будут AppID и ContextID соответственно. Посмотрите на следующую картинку для лучшего понимания:
![AppID и ContextID](https://i.imgur.com/hom2PZq.png)

Помощь по этому плагину вы можете получить в https://steamcommunity.com/groups/Ryzheplugins (или просто используйте раздел issues)

![downloads](https://img.shields.io/github/downloads/Ryzhehvost/ItemDispenser/total.svg?style=social)
![downloads](https://img.shields.io/github/downloads/Rudokhvist/ItemDispenser/total.svg?style=social)
20 changes: 1 addition & 19 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if exist out rmdir /Q /S out

rem release generic version

dotnet publish -c "Release" -f "net6.0" -o "out/generic" "/p:LinkDuringPublish=false"
dotnet publish -c "Release" -f "net8.0" -o "out/generic" "/p:LinkDuringPublish=false"
mkdir .\out\%CurrDirName%
copy .\out\generic\%CurrDirName%.dll .\out\%CurrDirName%
rem comment section below (downto :zip label) if you don't want to include documentation
Expand All @@ -37,21 +37,3 @@ if ERRORLEVEL 1 (
7z a -tzip -mx7 .\out\%CurrDirName%.zip .\out\%CurrDirName%
rmdir /Q /S out\%CurrDirName%

rem release generic-netf version
rem comment section below if you don't target netf ASF version

dotnet publish -c "Release" -f "net48" -o "out/generic-netf"
mkdir .\out\%CurrDirName%
copy .\out\generic-netf\%CurrDirName%.dll .\out\%CurrDirName%
rem comment section below (downto :zipnetf label) if you don't want to include documentation
if not exist README.md (goto zipnetf)
where /q pandoc.exe
if ERRORLEVEL 1 (
copy README.md .\out\%CurrDirName%
goto zipnetf
) else (
pandoc --metadata title="%CurrDirName%" --standalone --columns 2000 -f markdown -t html --self-contained -c .\github-pandoc.css -o .\out\%CurrDirName%\README.html README.md
)
:zipnetf
7z a -tzip -mx7 .\out\%CurrDirName%-netf.zip .\out\%CurrDirName%
rmdir /Q /S out\%CurrDirName%

0 comments on commit 8801925

Please sign in to comment.