about summary refs log tree commit diff stats
path: root/vendor/godobuf/LICENSE
blob: 5d473d85e96110d553e3b9a442d08d680a49c681 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
BSD 3-Clause License

Copyright (c) 2018, oniksan
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AP now' href='/lingo-ap-tracker/commit/ap_state.h?h=v0.5.6&id=116ba412079ddf647d19a54d09eb61e67a2f9aac'>116ba41 ^
09d67fb ^

116ba41 ^
09d67fb ^
1ec2738 ^
09d67fb ^
70f1c62 ^
1ec2738 ^
70f1c62 ^
dc4a143 ^


116ba41 ^




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67


                           



                 
                



                          
                                                                              
 









                                                                             

                                                                 

                                            

                                              



                                                                           





                                                                       
         

                        

                                                  

                               


                              

                                       
 
                                                                
                                                     
                                                
 
                                                 
                              


                                                       




                                                      
#ifndef AP_STATE_H_664A4180
#define AP_STATE_H_664A4180

#include <memory>
#include <mutex>
#include <set>
#include <string>
#include <tuple>

#include "game_data.h"
#include "tracker_frame.h"

enum DoorShuffleMode { kNO_DOORS = 0, kSIMPLE_DOORS = 1, kCOMPLEX_DOORS = 2 };

class APState {
 public:
  APState();

  void SetTrackerFrame(TrackerFrame* tracker_frame) {
    tracker_frame_ = tracker_frame;
  }

  void Connect(std::string server, std::string player, std::string password);

  bool HasCheckedGameLocation(int area_id, int section_id) const;

  bool HasColorItem(LingoColor color) const;

  bool HasItem(const std::string& item) const;

  DoorShuffleMode GetDoorShuffleMode() const { return door_shuffle_mode_; }

  bool IsColorShuffle() const { return color_shuffle_; }

  bool IsPaintingShuffle() const { return painting_shuffle_; }

  const std::map<std::string, std::string> GetPaintingMapping() const {
    return painting_mapping_;
  }

 private:
  void RefreshTracker();

  int64_t GetItemId(const std::string& item_name);

  TrackerFrame* tracker_frame_;

  bool client_active_ = false;
  std::mutex client_mutex_;

  std::set<int64_t> inventory_;
  std::set<int64_t> checked_locations_;

  std::map<std::tuple<int, int>, int64_t> ap_id_by_location_id_;
  std::map<std::string, int64_t> ap_id_by_item_name_;
  std::map<LingoColor, int64_t> ap_id_by_color_;

  DoorShuffleMode door_shuffle_mode_ = kNO_DOORS;
  bool color_shuffle_ = false;
  bool painting_shuffle_ = false;

  std::map<std::string, std::string> painting_mapping_;
};

APState& GetAPState();

#endif /* end of include guard: AP_STATE_H_664A4180 */