GithubHelp home page GithubHelp logo

the-marenga / sf-api Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 2.0 401 KB

Manage Shakes & Fidget characters via simple commands. Handles encryption, response parsing and everything else for you

License: MIT License

Rust 100.00%
shakes-and-fidget

sf-api's People

Contributors

the-marenga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sf-api's Issues

Fix fight parsing

The parsing of fights is wrong. With the sf-server repo, I should be able to actually fix that now, to see how it actually works

Detailed data of guild members

Heyy,

I wonder if I can fetch more data of guild member, I mean I get the player name but that's not the same with character id.
I need to fetch Cons, Main stat, Album and number of defeated bosses in personal portal.

I'm aware I can easily fetch those data for myself, but is there a way now to fetch guild members?

Why is OtherPlayers.other_players private?

Probably iam missing something, but when i used ViewPlayer command i didn't find a way to look at his stats etc. unless i forked library and made OtherPlayers.other_players public in src/gamestate/social.rs
Is it necessary to have this as private, or is there another intented way to do what iam doing?

unintutitive names of variable in FortressRessources

When i tried accessing resources in fortress i felt very confused
especially because of property limit (currently in storage), why call it limit ???
and the i looked at max_limit_next and thought, oh its probably current storage limit in fortress, but it isn't
so maybe in next release change would be welcoming

i proposed something but i don't think that it will be ideal, but i was not able to thought of anything better

current
pub struct FortessRessource {
pub limit: u64, //currently in storage
pub current: u64, //currently in resource gathering building
pub max_in_building: u64,
pub max_save: u64,
pub per_hour: u64,
/// The limit after the next upgrade
pub max_limit_next: u64,
}
proposed

pub struct FortessRessource {
pub storage: u64, //currently in storage
pub gathering: u64, //currently in resource gathering building
pub max_gathering: u64,
pub max_in_storage: u64,
pub per_hour: u64,
/// The limit after the next upgrade
pub max_limit_next: u64,
}

dungeons.get_light(dungeon_name) sometimes crashes

i tried iterating thru lightdungeons and getting them but sometimes it crashes (output1) but sometimes dont (output2).
for me it looks like sometimes it thinks that only 26 dungeons exist (probably error on loading data?)

any idea how to fix it?

os: wsl2, linux ubuntu 22.04.3 LTS

my code:

288 let mut i = 0; //counter for my better understanding of problem
289 let dungeons = game_state.unlocks.dungeons.clone(); //getting dungeons from gamestate
290 for dungeon_name in LightDungeon::iter() {
291 println!("{}", i);
292 let d = dungeons.get_light(dungeon_name);
293 i += 1;
294 //here i have my code but commented out

...

304 }

output1: //only few lines

...
23 //print of i
24
25
thread 'main' panicked at /home/tiquis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sf-api-0.1.2/src/gamestate/dungeons.rs:210:28:
index out of bounds: the len is 26 but the index is 26
stack backtrace:
0: rust_begin_unwind
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
1: core::panicking::panic_fmt
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
2: core::panicking::panic_bounds_check
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:208:5
3: <usize as core::slice::index::SliceIndex<[T]>>::index
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/slice/index.rs:255:10
4: core::slice::index::<impl core::ops::index::Index for [T]>::index
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/slice/index.rs:18:9
5: <alloc::vec::Vec<T,A> as core::ops::index::Index>::index
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/vec/mod.rs:2770:9
6: sf_api::gamestate::dungeons::Dungeons::get_light
at /home/tiquis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sf-api-0.1.2/src/gamestate/dungeons.rs:210:28
7: sf_bot::dungeons_attack::{{closure}}
at ./src/main.rs:292:21
8: sf_bot::login::{{closure}}
at ./src/main.rs:121:56
9: sf_bot::main::{{closure}}
at ./src/main.rs:44:45
10: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
at /home/tiquis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/park.rs:281:63
11: tokio::runtime::coop::with_budget
at /home/tiquis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/coop.rs:107:5
12: tokio::runtime::coop::budget
at /home/tiquis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/coop.rs:73:5
13: tokio::runtime::park::CachedParkThread::block_on
at /home/tiquis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/park.rs:281:31
14: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
at /home/tiquis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/context/blocking.rs:66:9
15: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
at /home/tiquis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/scheduler/multi_thread/mod.rs:87:13
16: tokio::runtime::context::runtime::enter_runtime
at /home/tiquis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/context/runtime.rs:65:16
17: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
at /home/tiquis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/scheduler/multi_thread/mod.rs:86:9
18: tokio::runtime::runtime::Runtime::block_on
at /home/tiquis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/runtime.rs:351:45
19: sf_bot::main
at ./src/main.rs:43:5
20: core::ops::function::FnOnce::call_once
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5

output2:
...
23
24
25
26
27
28

... //my program

wrong pass error on good password

Hi yeasterday i tried your project, (it was pain for me to run it, because of lack of rust skills, but i got to point where it's work)
but when i enter my character name password and server i got this error
ServerError("wrong pass")
i guess it's mean bad password but iam sure its right,
than i tried diffeent server and got player doesnt exist so i am sure that iam trieing the right server with right name and password,
any tips how to fix it?
p.s server is s10.sfgame.eu

Add all events

All events & tasks should be easy to parse via the sf-server

Data of arena fight xp & items in shop

Hey,
thanks for the API, finally I have the courage to look into rust. :D
I have noticed 2 problems so far.

I have not yet found a way to check how many arena battles have already been won today without caching the number myself.

There is no way to retrieve the individual items from the stores. At least I have searched and tried in vain in gamestate::Shop so far.

LIghtdungeon x ShadowDungeon iteration

I am trying to iterate through dungeons, in light it was easy using strum::IntoEnumIterator and then LightDungeon::iter()
but when i look at the shadow dungeon it doesn't has the #[Derive( EnumIter )] so i cannot iter same way.
Is there reason why is it different or should i use something different to get similar result?

little note ShadowDungeons are with s at the end but LightDungeon isn't.

error message on starting quest

i call this
let response = session.send_command(&Command::StartQuest { quest_pos: (3), overwrite_inv: (true) }).await.unwrap();
anp got this err message
called Result::unwrap() on an Err value: ServerError("adventure index must be 1-3")
which is strongly unintuitive because the range is from 0-2, i'am not sure from where this error mesage goes, because i read that you are changing the values because of sfgame servers but i thing that this error message shouldnt be let as it is

unlocking dungeon

I found Command::UnlockFeature { unlockable: Unlockable { main_ident: (), sub_ident: () } } ant thing its the intended way but i am not able to figure out what to pass as main_ident and sub_ident?

idlegame update

when i looked at idlegame i find out that idlesave that get sent to client is not automaticcly updated, i guess there should be another command for updating state of idlegame

Crash on login because of sfgames server bar response

For some reason after expedition normally played in official sfapp, server responds with only 4 long crossroad array and when parsing data through GameState::new(), it crashes because its rightfully expects 5 long array

i could chatch the error but i dont really want to parse it by my self,
fix is to manually start expedition, but i will be happier for something automatic

err:
thread 'main' panicked at .../sf-api-0.1.3/src/gamestate/mod.rs:877:69:
index out of bounds: the len is 4 but the index is 4

raw response:
.../-5/0/1&expeditioncrossroad:21/-2/51/3&expeditionmonster:-32/...

868"expeditioncrossroad" => {
869 // 3/3/132/0/2/2
871 let data: Vec = val.into_list("cross")?;
872 let exp = self
873 .tavern
874 .expedition
875 .get_or_insert_with(Default::default);
876 exp.crossroads = [0, 2, 4].map(|pos| {
877 let typ = match FromPrimitive::from_i64(data[pos]) {
878 Some(x) => x,
879 None => {
880 warn!(
881 "Unknown crossroad enc: {} for {}",
882 data[pos], pos
883 );
884 ExpeditionThing::Unknown
885 }
886 };
887 let heroism = soft_into(data[pos + 1], "e heroism", 0);
888 ExpeditionEncounter { typ, heroism }
889 });

dungeon fight commands missing?

I couldn't find Shadow world, Twister, Continuous loop of idols and Demon portal fight commands. Not sure if I just don't know where to look or it's missing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.