Clean up with clippy; Try gitea action
Some checks failed
Podman Image CI / build (push) Failing after 40s

This commit is contained in:
Jeff 2024-07-18 06:03:00 -04:00
parent 385fe651d4
commit 91d0f50fd4
3 changed files with 30 additions and 11 deletions

View File

@ -0,0 +1,20 @@
name: Podman Image CI
on:
push:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Podman
run: |
sudo apt-get update
sudo apt-get install -y podman
- name: Build the image
run: podman build --tag git.jeffa.io/jeff/trade_bot .
- name: Push the image
run: podman push git.jeffa.io/jeff/trade_bot

View File

@ -6,6 +6,7 @@ orientation = 0
"iron|sword.greatsword|sword.long" = 1_000 "iron|sword.greatsword|sword.long" = 1_000
[sell_prices] [sell_prices]
"food.cheese" = 1_000_000
"consumable.potion_minor" = 150 "consumable.potion_minor" = 150
# Modular Weapons # Modular Weapons

View File

@ -33,7 +33,6 @@ use crate::config::PriceList;
const COINS: ItemDefinitionId = const COINS: ItemDefinitionId =
ItemDefinitionId::Simple(Cow::Borrowed("common.items.utility.coins")); ItemDefinitionId::Simple(Cow::Borrowed("common.items.utility.coins"));
const CLIENT_TPS: Duration = Duration::from_millis(33); const CLIENT_TPS: Duration = Duration::from_millis(33);
const TRADE_ACTION_DELAY: Duration = Duration::from_millis(300); const TRADE_ACTION_DELAY: Duration = Duration::from_millis(300);
const ACCOUNCEMENT_DELAY: Duration = Duration::from_mins(45); const ACCOUNCEMENT_DELAY: Duration = Duration::from_mins(45);
@ -41,8 +40,6 @@ const OUCH_DELAY: Duration = Duration::from_secs(2);
/// An active connection to the Veloren server that will attempt to run every time the `tick` /// An active connection to the Veloren server that will attempt to run every time the `tick`
/// function is called. /// function is called.
///
/// See the [module-level documentation](index.html) for more information.
pub struct Bot { pub struct Bot {
username: String, username: String,
position: Pos, position: Pos,
@ -132,10 +129,7 @@ impl Bot {
let position = if let Some(coords) = position { let position = if let Some(coords) = position {
Pos(coords.into()) Pos(coords.into())
} else { } else {
client client.position().map(Pos).ok_or("Failed to get position")?
.position()
.map(|coords| Pos(coords))
.ok_or("Failed to get position")?
}; };
let orientation = if let Some(orientation) = orientation { let orientation = if let Some(orientation) = orientation {
Ori::new(Quaternion::rotation_z(orientation.to_radians())) Ori::new(Quaternion::rotation_z(orientation.to_radians()))
@ -303,7 +297,7 @@ impl Bot {
} }
"price" => { "price" => {
for item_name in split_content { for item_name in split_content {
self.send_price_info(&sender, &item_name)?; self.send_price_info(&sender, item_name)?;
} }
None None
@ -725,8 +719,10 @@ impl Bot {
self.client.perform_trade_action(TradeAction::Accept(phase)); self.client.perform_trade_action(TradeAction::Accept(phase));
return Ok(()); return Ok(());
}
// If they are offering more // If they are offering more
} else if difference > 0 { if difference > 0 {
// If they are offering coins // If they are offering coins
if their_offered_coin_amount > 0 { if their_offered_coin_amount > 0 {
if let Some(their_coins) = get_their_coins { if let Some(their_coins) = get_their_coins {
@ -764,8 +760,10 @@ impl Bot {
), ),
], ],
); );
}
// If I am offering more // If I am offering more
} else if difference < 0 { if difference < 0 {
// If I am offering coins // If I am offering coins
if my_offered_coin_amount > 0 { if my_offered_coin_amount > 0 {
if let Some(my_coins) = get_my_coins { if let Some(my_coins) = get_my_coins {