| @@ -45,6 +45,8 @@ public: | |||
| [[nodiscard]] virtual int32_t GetChestProgress(int32_t cellX, int32_t cellY) const = 0; | |||
| [[nodiscard]] virtual int32_t GetGateProgress(int32_t cellX, int32_t cellY) const = 0; | |||
| [[nodiscard]] virtual bool IsDoorOpen(int32_t cellX, int32_t cellY) const = 0; | |||
| [[nodiscard]] virtual THUAI6::HiddenGateState GetHiddenGateState(int32_t cellX, int32_t cellY) const = 0; | |||
| [[nodiscard]] virtual int32_t GetDoorProgress(int32_t cellX, int32_t cellY) const = 0; | |||
| [[nodiscard]] virtual std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const = 0; | |||
| @@ -130,6 +132,8 @@ public: | |||
| [[nodiscard]] virtual int32_t GetChestProgress(int32_t cellX, int32_t cellY) const = 0; | |||
| [[nodiscard]] virtual int32_t GetGateProgress(int32_t cellX, int32_t cellY) const = 0; | |||
| [[nodiscard]] virtual int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const = 0; | |||
| [[nodiscard]] virtual THUAI6::HiddenGateState GetHiddenGateState(int32_t cellX, int32_t cellY) const = 0; | |||
| [[nodiscard]] virtual int32_t GetDoorProgress(int32_t cellX, int32_t cellY) const = 0; | |||
| [[nodiscard]] virtual std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const = 0; | |||
| @@ -245,6 +249,8 @@ public: | |||
| [[nodiscard]] int32_t GetChestProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetGateProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] THUAI6::HiddenGateState GetHiddenGateState(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetDoorProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const override; | |||
| @@ -325,6 +331,8 @@ public: | |||
| [[nodiscard]] int32_t GetChestProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetGateProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetDoorProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] THUAI6::HiddenGateState GetHiddenGateState(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const override; | |||
| @@ -397,6 +405,8 @@ public: | |||
| [[nodiscard]] int32_t GetChestProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetGateProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetDoorProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] THUAI6::HiddenGateState GetHiddenGateState(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const override; | |||
| @@ -464,6 +474,8 @@ public: | |||
| [[nodiscard]] int32_t GetChestProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetGateProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetDoorProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] THUAI6::HiddenGateState GetHiddenGateState(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const override; | |||
| @@ -96,11 +96,13 @@ private: | |||
| [[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override; | |||
| [[nodiscard]] std::shared_ptr<const THUAI6::Student> StudentGetSelfInfo() const override; | |||
| [[nodiscard]] std::shared_ptr<const THUAI6::Tricker> TrickerGetSelfInfo() const override; | |||
| [[nodiscard]] THUAI6::HiddenGateState GetHiddenGateState(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override; | |||
| [[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] bool IsDoorOpen(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetDoorProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetChestProgress(int32_t cellX, int32_t cellY) const override; | |||
| [[nodiscard]] int32_t GetGateProgress(int32_t cellX, int32_t cellY) const override; | |||
| @@ -30,8 +30,10 @@ namespace THUAI6 | |||
| Gate = 5, | |||
| HiddenGate = 6, | |||
| Window = 7, | |||
| Door = 8, | |||
| Chest = 9, | |||
| Door3 = 8, | |||
| Door5 = 9, | |||
| Door6 = 10, | |||
| Chest = 11, | |||
| }; | |||
| // 形状标志 | |||
| @@ -46,17 +48,17 @@ namespace THUAI6 | |||
| enum class PropType : unsigned char | |||
| { | |||
| NullPropType = 0, | |||
| PropType1 = 1, | |||
| PropType2 = 2, | |||
| PropType3 = 3, | |||
| Key3 = 1, | |||
| Key5 = 2, | |||
| Key6 = 3, | |||
| PropType4 = 4, | |||
| }; | |||
| enum class BulletType : unsigned char | |||
| { | |||
| NullBulletType = 0, | |||
| LineBullet = 1, | |||
| CommonBullet = 2, | |||
| FlyingKnife = 1, | |||
| CommonAttackOfTricker = 2, | |||
| FastBullet = 3, | |||
| OrdinaryBullet = 4, | |||
| AtomBomb = 5, | |||
| @@ -74,7 +76,7 @@ namespace THUAI6 | |||
| enum class StudentType : unsigned char | |||
| { | |||
| NullStudentType = 0, | |||
| StudentType1 = 1, | |||
| Athlete = 1, | |||
| StudentType2 = 2, | |||
| StudentType3 = 3, | |||
| StudentType4 = 4, | |||
| @@ -84,7 +86,7 @@ namespace THUAI6 | |||
| enum class TrickerType : unsigned char | |||
| { | |||
| NullTrickerType = 0, | |||
| TrickerType1 = 1, | |||
| Assassin = 1, | |||
| TrickerType2 = 2, | |||
| TrickerType3 = 3, | |||
| TrickerType4 = 4, | |||
| @@ -128,6 +130,9 @@ namespace THUAI6 | |||
| Locking = 13, | |||
| Rummaging = 14, | |||
| Climbing = 15, | |||
| OpeningAChest = 16, | |||
| UsingSpecialSkill = 17, | |||
| OpeningAGate = 18, | |||
| }; | |||
| enum class MessageOfObj : unsigned char | |||
| @@ -147,6 +152,13 @@ namespace THUAI6 | |||
| HiddenGateMessage = 12, | |||
| }; | |||
| enum class HiddenGateState : unsigned char | |||
| { | |||
| Null = 0, | |||
| Refreshed = 1, | |||
| Opened = 2, | |||
| }; | |||
| // 玩家类 | |||
| struct Player | |||
| { | |||
| @@ -186,7 +198,6 @@ namespace THUAI6 | |||
| struct Tricker : public Player | |||
| { | |||
| int32_t damage; | |||
| double trickDesire; | |||
| double classVolume; | |||
| TrickerType trickerType; // 捣蛋鬼类型 | |||
| @@ -220,12 +231,10 @@ namespace THUAI6 | |||
| { | |||
| int32_t x; | |||
| int32_t y; | |||
| int32_t size; | |||
| int64_t guid; | |||
| PropType type; | |||
| PlaceType place; | |||
| double facingDirection; // 朝向 | |||
| bool isMoving; | |||
| }; | |||
| struct GameMap | |||
| @@ -235,11 +244,12 @@ namespace THUAI6 | |||
| std::map<std::pair<int32_t, int32_t>, int32_t> gateState; | |||
| std::map<std::pair<int32_t, int32_t>, bool> doorState; | |||
| std::map<std::pair<int32_t, int32_t>, int32_t> doorNumber; | |||
| std::map<std::pair<int32_t, int32_t>, int32_t> doorProgress; | |||
| std::map<std::pair<int32_t, int32_t>, int32_t> chestState; | |||
| std::map<std::pair<int32_t, int32_t>, bool> hiddenGateState; | |||
| std::map<std::pair<int32_t, int32_t>, HiddenGateState> hiddenGateState; | |||
| }; | |||
| struct GameInfo | |||
| @@ -282,6 +292,9 @@ namespace THUAI6 | |||
| {PlayerState::Locking, "Locking"}, | |||
| {PlayerState::Rummaging, "Rummaging"}, | |||
| {PlayerState::Climbing, "Climbing"}, | |||
| {PlayerState::OpeningAChest, "OpeningAChest"}, | |||
| {PlayerState::UsingSpecialSkill, "UsingSpecialSkill"}, | |||
| {PlayerState::OpeningAGate, "OpeningAGate"}, | |||
| }; | |||
| inline std::map<PlayerType, std::string> playerTypeDict{ | |||
| @@ -298,14 +311,28 @@ namespace THUAI6 | |||
| {PlaceType::ClassRoom, "ClassRoom"}, | |||
| {PlaceType::Gate, "Gate"}, | |||
| {PlaceType::HiddenGate, "HiddenGate"}, | |||
| {PlaceType::Door, "Door"}, | |||
| {PlaceType::Door3, "Door3"}, | |||
| {PlaceType::Door5, "Door5"}, | |||
| {PlaceType::Door6, "Door6"}, | |||
| {PlaceType::Window, "Window"}, | |||
| {PlaceType::Chest, "Chest"}, | |||
| }; | |||
| inline std::map<PropType, std::string> propTypeDict{ | |||
| {PropType::NullPropType, "NullPropType"}, | |||
| {PropType::Key3, "Key3"}, | |||
| {PropType::Key5, "Key5"}, | |||
| {PropType::Key6, "Key6"}, | |||
| }; | |||
| inline std::map<BulletType, std::string> bulletTypeDict{ | |||
| {BulletType::NullBulletType, "NullBulletType"}, | |||
| {BulletType::FlyingKnife, "FlyingKnife"}, | |||
| {BulletType::CommonAttackOfTricker, "CommonAttackOfTricker"}, | |||
| {BulletType::FastBullet, "FastBullet"}, | |||
| {BulletType::OrdinaryBullet, "OrdinaryBullet"}, | |||
| {BulletType::AtomBomb, "AtomBomb"}, | |||
| }; | |||
| inline std::map<StudentBuffType, std::string> studentBuffDict{ | |||
| @@ -70,7 +70,9 @@ namespace Proto2THUAI6 | |||
| {protobuf::PlaceType::GATE, THUAI6::PlaceType::Gate}, | |||
| {protobuf::PlaceType::HIDDEN_GATE, THUAI6::PlaceType::HiddenGate}, | |||
| {protobuf::PlaceType::WINDOW, THUAI6::PlaceType::Window}, | |||
| {protobuf::PlaceType::DOOR, THUAI6::PlaceType::Door}, | |||
| {protobuf::PlaceType::DOOR3, THUAI6::PlaceType::Door3}, | |||
| {protobuf::PlaceType::DOOR5, THUAI6::PlaceType::Door5}, | |||
| {protobuf::PlaceType::DOOR6, THUAI6::PlaceType::Door6}, | |||
| {protobuf::PlaceType::CHEST, THUAI6::PlaceType::Chest}, | |||
| }; | |||
| @@ -82,9 +84,9 @@ namespace Proto2THUAI6 | |||
| inline std::map<protobuf::PropType, THUAI6::PropType> propTypeDict{ | |||
| {protobuf::PropType::NULL_PROP_TYPE, THUAI6::PropType::NullPropType}, | |||
| {protobuf::PropType::PTYPE1, THUAI6::PropType::PropType1}, | |||
| {protobuf::PropType::PTYPE2, THUAI6::PropType::PropType2}, | |||
| {protobuf::PropType::PTYPE3, THUAI6::PropType::PropType3}, | |||
| {protobuf::PropType::KEY3, THUAI6::PropType::Key3}, | |||
| {protobuf::PropType::KEY5, THUAI6::PropType::Key5}, | |||
| {protobuf::PropType::KEY6, THUAI6::PropType::Key6}, | |||
| {protobuf::PropType::PTYPE4, THUAI6::PropType::PropType4}, | |||
| }; | |||
| @@ -96,7 +98,7 @@ namespace Proto2THUAI6 | |||
| inline std::map<protobuf::StudentType, THUAI6::StudentType> studentTypeDict{ | |||
| {protobuf::StudentType::NULL_STUDENT_TYPE, THUAI6::StudentType::NullStudentType}, | |||
| {protobuf::StudentType::STUDENTTYPE1, THUAI6::StudentType::StudentType1}, | |||
| {protobuf::StudentType::ATHLETE, THUAI6::StudentType::Athlete}, | |||
| {protobuf::StudentType::STUDENTTYPE2, THUAI6::StudentType::StudentType2}, | |||
| {protobuf::StudentType::STUDENTTYPE3, THUAI6::StudentType::StudentType3}, | |||
| {protobuf::StudentType::STUDENTTYPE4, THUAI6::StudentType::StudentType4}, | |||
| @@ -104,7 +106,7 @@ namespace Proto2THUAI6 | |||
| inline std::map<protobuf::TrickerType, THUAI6::TrickerType> trickerTypeDict{ | |||
| {protobuf::TrickerType::NULL_TRICKER_TYPE, THUAI6::TrickerType::NullTrickerType}, | |||
| {protobuf::TrickerType::TRICKERTYPE1, THUAI6::TrickerType::TrickerType1}, | |||
| {protobuf::TrickerType::ASSASSIN, THUAI6::TrickerType::Assassin}, | |||
| {protobuf::TrickerType::TRICKERTYPE2, THUAI6::TrickerType::TrickerType2}, | |||
| {protobuf::TrickerType::TRICKERTYPE3, THUAI6::TrickerType::TrickerType3}, | |||
| {protobuf::TrickerType::TRICKERTYPE4, THUAI6::TrickerType::TrickerType4}, | |||
| @@ -138,6 +140,14 @@ namespace Proto2THUAI6 | |||
| {protobuf::PlayerState::STUNNED, THUAI6::PlayerState::Stunned}, | |||
| {protobuf::PlayerState::RESCUING, THUAI6::PlayerState::Rescuing}, | |||
| {protobuf::PlayerState::TREATING, THUAI6::PlayerState::Treating}, | |||
| {protobuf::PlayerState::SWINGING, THUAI6::PlayerState::Swinging}, | |||
| {protobuf::PlayerState::ATTACKING, THUAI6::PlayerState::Attacking}, | |||
| {protobuf::PlayerState::LOCKING, THUAI6::PlayerState::Locking}, | |||
| {protobuf::PlayerState::RUMMAGING, THUAI6::PlayerState::Rummaging}, | |||
| {protobuf::PlayerState::CLIMBING, THUAI6::PlayerState::Climbing}, | |||
| {protobuf::PlayerState::OPENING_A_CHEST, THUAI6::PlayerState::OpeningAChest}, | |||
| {protobuf::PlayerState::USING_SPECIAL_SKILL, THUAI6::PlayerState::UsingSpecialSkill}, | |||
| {protobuf::PlayerState::OPENING_A_GATE, THUAI6::PlayerState::OpeningAGate}, | |||
| }; | |||
| inline std::map<protobuf::GameState, THUAI6::GameState> gameStateDict{ | |||
| @@ -149,9 +159,9 @@ namespace Proto2THUAI6 | |||
| inline std::map<protobuf::BulletType, THUAI6::BulletType> bulletTypeDict{ | |||
| {protobuf::BulletType::NULL_BULLET_TYPE, THUAI6::BulletType::NullBulletType}, | |||
| {protobuf::BulletType::COMMON_BULLET, THUAI6::BulletType::CommonBullet}, | |||
| {protobuf::BulletType::FLYING_KNIFE, THUAI6::BulletType::FlyingKnife}, | |||
| {protobuf::BulletType::COMMON_ATTACK_OF_TRICKER, THUAI6::BulletType::CommonAttackOfTricker}, | |||
| {protobuf::BulletType::FAST_BULLET, THUAI6::BulletType::FastBullet}, | |||
| {protobuf::BulletType::LINE_BULLET, THUAI6::BulletType::LineBullet}, | |||
| {protobuf::BulletType::ORDINARY_BULLET, THUAI6::BulletType::OrdinaryBullet}, | |||
| {protobuf::BulletType::ATOM_BOMB, THUAI6::BulletType::AtomBomb}, | |||
| }; | |||
| @@ -185,7 +195,6 @@ namespace Proto2THUAI6 | |||
| tricker->bulletType = bulletTypeDict[trickerMsg.bullet_type()]; | |||
| tricker->trickDesire = trickerMsg.trick_desire(); | |||
| tricker->classVolume = trickerMsg.class_volume(); | |||
| tricker->damage = trickerMsg.damage(); | |||
| for (int i = 0; i < trickerMsg.time_until_skill_available().size(); i++) | |||
| tricker->timeUntilSkillAvailable.push_back(trickerMsg.time_until_skill_available(i)); | |||
| tricker->place = placeTypeDict[trickerMsg.place()]; | |||
| @@ -227,7 +236,7 @@ namespace Proto2THUAI6 | |||
| for (int i = 0; i < studentMsg.prop().size(); i++) | |||
| student->props.push_back(propTypeDict[studentMsg.prop(i)]); | |||
| student->place = placeTypeDict[studentMsg.place()]; | |||
| student->playerState = playerStateDict[studentMsg.state()]; | |||
| student->playerState = playerStateDict[studentMsg.player_state()]; | |||
| student->determination = studentMsg.determination(); | |||
| student->addiction = studentMsg.addiction(); | |||
| student->studentType = studentTypeDict[studentMsg.student_type()]; | |||
| @@ -245,9 +254,7 @@ namespace Proto2THUAI6 | |||
| prop->type = propTypeDict[propMsg.type()]; | |||
| prop->place = placeTypeDict[propMsg.place()]; | |||
| prop->guid = propMsg.guid(); | |||
| prop->size = propMsg.size(); | |||
| prop->facingDirection = propMsg.facing_direction(); | |||
| prop->isMoving = propMsg.is_moving(); | |||
| return prop; | |||
| } | |||
| @@ -293,6 +300,14 @@ namespace Proto2THUAI6 | |||
| return bombedBullet; | |||
| } | |||
| inline THUAI6::HiddenGateState Bool2HiddenGateState(bool gateMsg) | |||
| { | |||
| if (gateMsg) | |||
| return THUAI6::HiddenGateState::Opened; | |||
| else | |||
| return THUAI6::HiddenGateState::Refreshed; | |||
| } | |||
| } // namespace Proto2THUAI6 | |||
| namespace THUAI62Proto | |||
| @@ -306,7 +321,9 @@ namespace THUAI62Proto | |||
| {THUAI6::PlaceType::ClassRoom, protobuf::PlaceType::CLASSROOM}, | |||
| {THUAI6::PlaceType::Gate, protobuf::PlaceType::GATE}, | |||
| {THUAI6::PlaceType::HiddenGate, protobuf::PlaceType::HIDDEN_GATE}, | |||
| {THUAI6::PlaceType::Door, protobuf::PlaceType::DOOR}, | |||
| {THUAI6::PlaceType::Door3, protobuf::PlaceType::DOOR3}, | |||
| {THUAI6::PlaceType::Door5, protobuf::PlaceType::DOOR5}, | |||
| {THUAI6::PlaceType::Door6, protobuf::PlaceType::DOOR6}, | |||
| {THUAI6::PlaceType::Window, protobuf::PlaceType::WINDOW}, | |||
| }; | |||
| @@ -318,9 +335,9 @@ namespace THUAI62Proto | |||
| inline std::map<THUAI6::PropType, protobuf::PropType> propTypeDict{ | |||
| {THUAI6::PropType::NullPropType, protobuf::PropType::NULL_PROP_TYPE}, | |||
| {THUAI6::PropType::PropType1, protobuf::PropType::PTYPE1}, | |||
| {THUAI6::PropType::PropType2, protobuf::PropType::PTYPE2}, | |||
| {THUAI6::PropType::PropType3, protobuf::PropType::PTYPE3}, | |||
| {THUAI6::PropType::Key3, protobuf::PropType::KEY3}, | |||
| {THUAI6::PropType::Key5, protobuf::PropType::KEY5}, | |||
| {THUAI6::PropType::Key6, protobuf::PropType::KEY6}, | |||
| {THUAI6::PropType::PropType4, protobuf::PropType::PTYPE4}, | |||
| }; | |||
| @@ -332,7 +349,7 @@ namespace THUAI62Proto | |||
| inline std::map<THUAI6::StudentType, protobuf::StudentType> studentTypeDict{ | |||
| {THUAI6::StudentType::NullStudentType, protobuf::StudentType::NULL_STUDENT_TYPE}, | |||
| {THUAI6::StudentType::StudentType1, protobuf::StudentType::STUDENTTYPE1}, | |||
| {THUAI6::StudentType::Athlete, protobuf::StudentType::ATHLETE}, | |||
| {THUAI6::StudentType::StudentType2, protobuf::StudentType::STUDENTTYPE2}, | |||
| {THUAI6::StudentType::StudentType3, protobuf::StudentType::STUDENTTYPE3}, | |||
| {THUAI6::StudentType::StudentType4, protobuf::StudentType::STUDENTTYPE4}, | |||
| @@ -348,7 +365,7 @@ namespace THUAI62Proto | |||
| inline std::map<THUAI6::TrickerType, protobuf::TrickerType> trickerTypeDict{ | |||
| {THUAI6::TrickerType::NullTrickerType, protobuf::TrickerType::NULL_TRICKER_TYPE}, | |||
| {THUAI6::TrickerType::TrickerType1, protobuf::TrickerType::TRICKERTYPE1}, | |||
| {THUAI6::TrickerType::Assassin, protobuf::TrickerType::ASSASSIN}, | |||
| {THUAI6::TrickerType::TrickerType2, protobuf::TrickerType::TRICKERTYPE2}, | |||
| {THUAI6::TrickerType::TrickerType3, protobuf::TrickerType::TRICKERTYPE3}, | |||
| {THUAI6::TrickerType::TrickerType4, protobuf::TrickerType::TRICKERTYPE4}, | |||
| @@ -9,9 +9,9 @@ extern const bool asynchronous = false; | |||
| extern const THUAI6::PlayerType playerType = THUAI6::PlayerType::StudentPlayer; | |||
| // 选手需要将两个都定义,本份代码中不选择的阵营任意定义即可 | |||
| extern const THUAI6::TrickerType trickerType = THUAI6::TrickerType::TrickerType1; | |||
| extern const THUAI6::TrickerType trickerType = THUAI6::TrickerType::Assassin; | |||
| extern const THUAI6::StudentType studentType = THUAI6::StudentType::StudentType1; | |||
| extern const THUAI6::StudentType studentType = THUAI6::StudentType::Athlete; | |||
| // 选手只需写一个即可,为了调试方便写了两个的话也不会有影响 | |||
| @@ -319,6 +319,26 @@ int32_t TrickerAPI::GetGateProgress(int32_t cellX, int32_t cellY) const | |||
| return logic.GetGateProgress(cellX, cellY); | |||
| } | |||
| int32_t StudentAPI::GetDoorProgress(int32_t cellX, int32_t cellY) const | |||
| { | |||
| return logic.GetDoorProgress(cellX, cellY); | |||
| } | |||
| int32_t TrickerAPI::GetDoorProgress(int32_t cellX, int32_t cellY) const | |||
| { | |||
| return logic.GetDoorProgress(cellX, cellY); | |||
| } | |||
| THUAI6::HiddenGateState StudentAPI::GetHiddenGateState(int32_t cellX, int32_t cellY) const | |||
| { | |||
| return logic.GetHiddenGateState(cellX, cellY); | |||
| } | |||
| THUAI6::HiddenGateState TrickerAPI::GetHiddenGateState(int32_t cellX, int32_t cellY) const | |||
| { | |||
| return logic.GetHiddenGateState(cellX, cellY); | |||
| } | |||
| std::shared_ptr<const THUAI6::GameInfo> StudentAPI::GetGameInfo() const | |||
| { | |||
| return logic.GetGameInfo(); | |||
| @@ -440,6 +440,26 @@ int32_t TrickerDebugAPI::GetChestProgress(int32_t cellX, int32_t cellY) const | |||
| return logic.GetChestProgress(cellX, cellY); | |||
| } | |||
| int32_t StudentDebugAPI::GetDoorProgress(int32_t cellX, int32_t cellY) const | |||
| { | |||
| return logic.GetDoorProgress(cellX, cellY); | |||
| } | |||
| int32_t TrickerDebugAPI::GetDoorProgress(int32_t cellX, int32_t cellY) const | |||
| { | |||
| return logic.GetDoorProgress(cellX, cellY); | |||
| } | |||
| THUAI6::HiddenGateState StudentDebugAPI::GetHiddenGateState(int32_t cellX, int32_t cellY) const | |||
| { | |||
| return logic.GetHiddenGateState(cellX, cellY); | |||
| } | |||
| THUAI6::HiddenGateState TrickerDebugAPI::GetHiddenGateState(int32_t cellX, int32_t cellY) const | |||
| { | |||
| return logic.GetHiddenGateState(cellX, cellY); | |||
| } | |||
| int32_t StudentDebugAPI::GetGateProgress(int32_t cellX, int32_t cellY) const | |||
| { | |||
| return logic.GetGateProgress(cellX, cellY); | |||
| @@ -595,7 +615,7 @@ void StudentDebugAPI::PrintTricker() const | |||
| logger->info("******Tricker Info******"); | |||
| logger->info("playerID={}, GUID={}, x={}, y={}", tricker->playerID, tricker->guid, tricker->x, tricker->y); | |||
| logger->info("speed={}, view range={}, place={}", tricker->speed, tricker->viewRange, THUAI6::placeTypeDict[tricker->place]); | |||
| logger->info("damage={}, state={}", tricker->damage, THUAI6::playerStateDict[tricker->playerState]); | |||
| logger->info("state={}", THUAI6::playerStateDict[tricker->playerState]); | |||
| std::string skillTime = "skill time="; | |||
| for (const auto& time : tricker->timeUntilSkillAvailable) | |||
| skillTime += std::to_string(time) + ", "; | |||
| @@ -619,7 +639,7 @@ void TrickerDebugAPI::PrintTricker() const | |||
| logger->info("******Tricker Info******"); | |||
| logger->info("playerID={}, GUID={}, x={}, y={}", tricker->playerID, tricker->guid, tricker->x, tricker->y); | |||
| logger->info("speed={}, view range={}, place={}", tricker->speed, tricker->viewRange, THUAI6::placeTypeDict[tricker->place]); | |||
| logger->info("damage={}, state={}", tricker->damage, THUAI6::playerStateDict[tricker->playerState]); | |||
| logger->info("state={}", THUAI6::playerStateDict[tricker->playerState]); | |||
| std::string skillTime = "skill time="; | |||
| for (const auto& time : tricker->timeUntilSkillAvailable) | |||
| skillTime += std::to_string(time) + ", "; | |||
| @@ -641,7 +661,7 @@ void StudentDebugAPI::PrintProp() const | |||
| for (auto prop : logic.GetProps()) | |||
| { | |||
| logger->info("******Prop Info******"); | |||
| logger->info("GUID={}, x={}, y={}, place={}, is moving={}", prop->guid, prop->x, prop->y, THUAI6::placeTypeDict[prop->place], prop->isMoving); | |||
| logger->info("GUID={}, x={}, y={}, place={}", prop->guid, prop->x, prop->y, THUAI6::placeTypeDict[prop->place]); | |||
| logger->info("*********************"); | |||
| } | |||
| } | |||
| @@ -651,7 +671,7 @@ void TrickerDebugAPI::PrintProp() const | |||
| for (auto prop : logic.GetProps()) | |||
| { | |||
| logger->info("******Prop Info******"); | |||
| logger->info("GUID={}, x={}, y={}, place={}, is moving={}", prop->guid, prop->x, prop->y, THUAI6::placeTypeDict[prop->place], prop->isMoving); | |||
| logger->info("GUID={}, x={}, y={}, place={}", prop->guid, prop->x, prop->y, THUAI6::placeTypeDict[prop->place]); | |||
| logger->info("*********************"); | |||
| } | |||
| } | |||
| @@ -684,7 +704,7 @@ void TrickerDebugAPI::PrintSelfInfo() const | |||
| logger->info("******Self Info******"); | |||
| logger->info("playerID={}, GUID={}, x={}, y={}", self->playerID, self->guid, self->x, self->y); | |||
| logger->info("speed={}, view range={}, place={}", self->speed, self->viewRange, THUAI6::placeTypeDict[self->place]); | |||
| logger->info("damage={}, state={}", self->damage, THUAI6::playerStateDict[self->playerState]); | |||
| logger->info("state={}", THUAI6::playerStateDict[self->playerState]); | |||
| std::string skillTime = "skill time="; | |||
| for (const auto& time : self->timeUntilSkillAvailable) | |||
| skillTime += std::to_string(time) + ", "; | |||
| @@ -81,18 +81,38 @@ bool Logic::IsDoorOpen(int32_t cellX, int32_t cellY) const | |||
| logger->debug("Called IsDoorOpen"); | |||
| auto pos = std::make_pair(cellX, cellY); | |||
| if (currentState->mapInfo->doorState.count(pos) == 0) | |||
| { | |||
| logger->warn("Door not found"); | |||
| return false; | |||
| } | |||
| else | |||
| return currentState->mapInfo->doorState[pos]; | |||
| } | |||
| int32_t Logic::GetDoorProgress(int32_t cellX, int32_t cellY) const | |||
| { | |||
| std::unique_lock<std::mutex> lock(mtxState); | |||
| logger->debug("Called GetDoorProgress"); | |||
| auto pos = std::make_pair(cellX, cellY); | |||
| if (currentState->mapInfo->doorProgress.count(pos) == 0) | |||
| { | |||
| logger->warn("Door not found"); | |||
| return -1; | |||
| } | |||
| else | |||
| return currentState->mapInfo->doorProgress[pos]; | |||
| } | |||
| int32_t Logic::GetClassroomProgress(int32_t cellX, int32_t cellY) const | |||
| { | |||
| std::unique_lock<std::mutex> lock(mtxState); | |||
| logger->debug("Called GetClassroomProgress"); | |||
| auto pos = std::make_pair(cellX, cellY); | |||
| if (currentState->mapInfo->classRoomState.count(pos) == 0) | |||
| return 0; | |||
| { | |||
| logger->warn("Classroom not found"); | |||
| return -1; | |||
| } | |||
| else | |||
| return currentState->mapInfo->classRoomState[pos]; | |||
| } | |||
| @@ -103,7 +123,10 @@ int32_t Logic::GetChestProgress(int32_t cellX, int32_t cellY) const | |||
| logger->debug("Called GetChestProgress"); | |||
| auto pos = std::make_pair(cellX, cellY); | |||
| if (currentState->mapInfo->chestState.count(pos) == 0) | |||
| return 0; | |||
| { | |||
| logger->warn("Chest not found"); | |||
| return -1; | |||
| } | |||
| else | |||
| return currentState->mapInfo->chestState[pos]; | |||
| } | |||
| @@ -114,11 +137,28 @@ int32_t Logic::GetGateProgress(int32_t cellX, int32_t cellY) const | |||
| logger->debug("Called GetGateProgress"); | |||
| auto pos = std::make_pair(cellX, cellY); | |||
| if (currentState->mapInfo->gateState.count(pos) == 0) | |||
| return 0; | |||
| { | |||
| logger->warn("Gate not found"); | |||
| return -1; | |||
| } | |||
| else | |||
| return currentState->mapInfo->gateState[pos]; | |||
| } | |||
| THUAI6::HiddenGateState Logic::GetHiddenGateState(int32_t cellX, int32_t cellY) const | |||
| { | |||
| std::unique_lock<std::mutex> lock(mtxState); | |||
| logger->debug("Called GetHiddenGateState"); | |||
| auto pos = std::make_pair(cellX, cellY); | |||
| if (currentState->mapInfo->hiddenGateState.count(pos) == 0) | |||
| { | |||
| logger->warn("HiddenGate not found"); | |||
| return THUAI6::HiddenGateState::Null; | |||
| } | |||
| else | |||
| return currentState->mapInfo->hiddenGateState[pos]; | |||
| } | |||
| std::shared_ptr<const THUAI6::GameInfo> Logic::GetGameInfo() const | |||
| { | |||
| std::unique_lock<std::mutex> lock(mtxState); | |||
| @@ -415,13 +455,13 @@ void Logic::LoadBuffer(protobuf::MessageToClient& message) | |||
| if (bufferState->mapInfo->doorState.count(pos) == 0) | |||
| { | |||
| bufferState->mapInfo->doorState.emplace(pos, item.door_message().is_open()); | |||
| bufferState->mapInfo->doorNumber.emplace(pos, item.door_message().number()); | |||
| bufferState->mapInfo->doorProgress.emplace(pos, item.door_message().progress()); | |||
| logger->debug("Add Door!"); | |||
| } | |||
| else | |||
| { | |||
| bufferState->mapInfo->doorState[pos] = item.door_message().is_open(); | |||
| bufferState->mapInfo->doorNumber[pos] = item.door_message().number(); | |||
| bufferState->mapInfo->doorProgress[pos] = item.door_message().progress(); | |||
| logger->debug("Update Door!"); | |||
| } | |||
| } | |||
| @@ -434,12 +474,12 @@ void Logic::LoadBuffer(protobuf::MessageToClient& message) | |||
| auto pos = std::make_pair(item.hidden_gate_message().x(), item.hidden_gate_message().y()); | |||
| if (bufferState->mapInfo->hiddenGateState.count(pos) == 0) | |||
| { | |||
| bufferState->mapInfo->hiddenGateState.emplace(pos, item.hidden_gate_message().opened()); | |||
| bufferState->mapInfo->hiddenGateState.emplace(pos, Proto2THUAI6::Bool2HiddenGateState(item.hidden_gate_message().opened())); | |||
| logger->debug("Add HiddenGate!"); | |||
| } | |||
| else | |||
| { | |||
| bufferState->mapInfo->hiddenGateState[pos] = item.hidden_gate_message().opened(); | |||
| bufferState->mapInfo->hiddenGateState[pos] = Proto2THUAI6::Bool2HiddenGateState(item.hidden_gate_message().opened()); | |||
| logger->debug("Update HiddenGate!"); | |||
| } | |||
| } | |||
| @@ -551,13 +591,13 @@ void Logic::LoadBuffer(protobuf::MessageToClient& message) | |||
| if (bufferState->mapInfo->doorState.count(pos) == 0) | |||
| { | |||
| bufferState->mapInfo->doorState.emplace(pos, item.door_message().is_open()); | |||
| bufferState->mapInfo->doorNumber.emplace(pos, item.door_message().number()); | |||
| bufferState->mapInfo->doorProgress.emplace(pos, item.door_message().progress()); | |||
| logger->debug("Add Door!"); | |||
| } | |||
| else | |||
| { | |||
| bufferState->mapInfo->doorState[pos] = item.door_message().is_open(); | |||
| bufferState->mapInfo->doorNumber[pos] = item.door_message().number(); | |||
| bufferState->mapInfo->doorProgress[pos] = item.door_message().progress(); | |||
| logger->debug("Update Door!"); | |||
| } | |||
| } | |||
| @@ -570,12 +610,12 @@ void Logic::LoadBuffer(protobuf::MessageToClient& message) | |||
| auto pos = std::make_pair(item.hidden_gate_message().x(), item.hidden_gate_message().y()); | |||
| if (bufferState->mapInfo->hiddenGateState.count(pos) == 0) | |||
| { | |||
| bufferState->mapInfo->hiddenGateState.emplace(pos, item.hidden_gate_message().opened()); | |||
| bufferState->mapInfo->hiddenGateState.emplace(pos, Proto2THUAI6::Bool2HiddenGateState(item.hidden_gate_message().opened())); | |||
| logger->debug("Add HiddenGate!"); | |||
| } | |||
| else | |||
| { | |||
| bufferState->mapInfo->hiddenGateState[pos] = item.hidden_gate_message().opened(); | |||
| bufferState->mapInfo->hiddenGateState[pos] = Proto2THUAI6::Bool2HiddenGateState(item.hidden_gate_message().opened()); | |||
| logger->debug("Update HiddenGate!"); | |||
| } | |||
| } | |||
| @@ -321,19 +321,18 @@ namespace protobuf | |||
| kPlaceFieldNumber = 7, | |||
| kGuidFieldNumber = 10, | |||
| kPlayerStateFieldNumber = 9, | |||
| kStateFieldNumber = 11, | |||
| kBulletTypeFieldNumber = 12, | |||
| kLearningSpeedFieldNumber = 13, | |||
| kPlayerIdFieldNumber = 15, | |||
| kTreatSpeedFieldNumber = 14, | |||
| kPlayerIdFieldNumber = 15, | |||
| kViewRangeFieldNumber = 16, | |||
| kRadiusFieldNumber = 17, | |||
| kScoreFieldNumber = 20, | |||
| kDangerAlertFieldNumber = 19, | |||
| kScoreFieldNumber = 20, | |||
| kTreatProgressFieldNumber = 21, | |||
| kRescueProgressFieldNumber = 22, | |||
| kFacingDirectionFieldNumber = 24, | |||
| kStudentTypeFieldNumber = 23, | |||
| kFacingDirectionFieldNumber = 24, | |||
| }; | |||
| // repeated double time_until_skill_available = 6; | |||
| int time_until_skill_available_size() const; | |||
| @@ -482,16 +481,6 @@ namespace protobuf | |||
| ::protobuf::PlayerState _internal_player_state() const; | |||
| void _internal_set_player_state(::protobuf::PlayerState value); | |||
| public: | |||
| // .protobuf.PlayerState state = 11; | |||
| void clear_state(); | |||
| ::protobuf::PlayerState state() const; | |||
| void set_state(::protobuf::PlayerState value); | |||
| private: | |||
| ::protobuf::PlayerState _internal_state() const; | |||
| void _internal_set_state(::protobuf::PlayerState value); | |||
| public: | |||
| // .protobuf.BulletType bullet_type = 12; | |||
| void clear_bullet_type(); | |||
| @@ -512,16 +501,6 @@ namespace protobuf | |||
| int32_t _internal_learning_speed() const; | |||
| void _internal_set_learning_speed(int32_t value); | |||
| public: | |||
| // int64 player_id = 15; | |||
| void clear_player_id(); | |||
| int64_t player_id() const; | |||
| void set_player_id(int64_t value); | |||
| private: | |||
| int64_t _internal_player_id() const; | |||
| void _internal_set_player_id(int64_t value); | |||
| public: | |||
| // int32 treat_speed = 14; | |||
| void clear_treat_speed(); | |||
| @@ -532,6 +511,16 @@ namespace protobuf | |||
| int32_t _internal_treat_speed() const; | |||
| void _internal_set_treat_speed(int32_t value); | |||
| public: | |||
| // int64 player_id = 15; | |||
| void clear_player_id(); | |||
| int64_t player_id() const; | |||
| void set_player_id(int64_t value); | |||
| private: | |||
| int64_t _internal_player_id() const; | |||
| void _internal_set_player_id(int64_t value); | |||
| public: | |||
| // int32 view_range = 16; | |||
| void clear_view_range(); | |||
| @@ -552,16 +541,6 @@ namespace protobuf | |||
| int32_t _internal_radius() const; | |||
| void _internal_set_radius(int32_t value); | |||
| public: | |||
| // int32 score = 20; | |||
| void clear_score(); | |||
| int32_t score() const; | |||
| void set_score(int32_t value); | |||
| private: | |||
| int32_t _internal_score() const; | |||
| void _internal_set_score(int32_t value); | |||
| public: | |||
| // double danger_alert = 19; | |||
| void clear_danger_alert(); | |||
| @@ -572,6 +551,16 @@ namespace protobuf | |||
| double _internal_danger_alert() const; | |||
| void _internal_set_danger_alert(double value); | |||
| public: | |||
| // int32 score = 20; | |||
| void clear_score(); | |||
| int32_t score() const; | |||
| void set_score(int32_t value); | |||
| private: | |||
| int32_t _internal_score() const; | |||
| void _internal_set_score(int32_t value); | |||
| public: | |||
| // int32 treat_progress = 21; | |||
| void clear_treat_progress(); | |||
| @@ -592,16 +581,6 @@ namespace protobuf | |||
| int32_t _internal_rescue_progress() const; | |||
| void _internal_set_rescue_progress(int32_t value); | |||
| public: | |||
| // double facing_direction = 24; | |||
| void clear_facing_direction(); | |||
| double facing_direction() const; | |||
| void set_facing_direction(double value); | |||
| private: | |||
| double _internal_facing_direction() const; | |||
| void _internal_set_facing_direction(double value); | |||
| public: | |||
| // .protobuf.StudentType student_type = 23; | |||
| void clear_student_type(); | |||
| @@ -612,6 +591,16 @@ namespace protobuf | |||
| ::protobuf::StudentType _internal_student_type() const; | |||
| void _internal_set_student_type(::protobuf::StudentType value); | |||
| public: | |||
| // double facing_direction = 24; | |||
| void clear_facing_direction(); | |||
| double facing_direction() const; | |||
| void set_facing_direction(double value); | |||
| private: | |||
| double _internal_facing_direction() const; | |||
| void _internal_set_facing_direction(double value); | |||
| public: | |||
| // @@protoc_insertion_point(class_scope:protobuf.MessageOfStudent) | |||
| @@ -637,19 +626,18 @@ namespace protobuf | |||
| int place_; | |||
| int64_t guid_; | |||
| int player_state_; | |||
| int state_; | |||
| int bullet_type_; | |||
| int32_t learning_speed_; | |||
| int64_t player_id_; | |||
| int32_t treat_speed_; | |||
| int64_t player_id_; | |||
| int32_t view_range_; | |||
| int32_t radius_; | |||
| int32_t score_; | |||
| double danger_alert_; | |||
| int32_t score_; | |||
| int32_t treat_progress_; | |||
| int32_t rescue_progress_; | |||
| double facing_direction_; | |||
| int student_type_; | |||
| double facing_direction_; | |||
| mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; | |||
| }; | |||
| union | |||
| @@ -824,19 +812,18 @@ namespace protobuf | |||
| kXFieldNumber = 1, | |||
| kYFieldNumber = 2, | |||
| kSpeedFieldNumber = 3, | |||
| kDamageFieldNumber = 4, | |||
| kPlaceFieldNumber = 6, | |||
| kTrickerTypeFieldNumber = 8, | |||
| kGuidFieldNumber = 9, | |||
| kPlayerIdFieldNumber = 11, | |||
| kTrickerTypeFieldNumber = 8, | |||
| kScoreFieldNumber = 10, | |||
| kPlayerIdFieldNumber = 11, | |||
| kViewRangeFieldNumber = 12, | |||
| kRadiusFieldNumber = 13, | |||
| kPlayerStateFieldNumber = 14, | |||
| kTrickDesireFieldNumber = 15, | |||
| kClassVolumeFieldNumber = 16, | |||
| kFacingDirectionFieldNumber = 17, | |||
| kPlayerStateFieldNumber = 14, | |||
| kBulletTypeFieldNumber = 18, | |||
| kFacingDirectionFieldNumber = 17, | |||
| }; | |||
| // repeated double time_until_skill_available = 5; | |||
| int time_until_skill_available_size() const; | |||
| @@ -935,16 +922,6 @@ namespace protobuf | |||
| int32_t _internal_speed() const; | |||
| void _internal_set_speed(int32_t value); | |||
| public: | |||
| // int32 damage = 4; | |||
| void clear_damage(); | |||
| int32_t damage() const; | |||
| void set_damage(int32_t value); | |||
| private: | |||
| int32_t _internal_damage() const; | |||
| void _internal_set_damage(int32_t value); | |||
| public: | |||
| // .protobuf.PlaceType place = 6; | |||
| void clear_place(); | |||
| @@ -955,16 +932,6 @@ namespace protobuf | |||
| ::protobuf::PlaceType _internal_place() const; | |||
| void _internal_set_place(::protobuf::PlaceType value); | |||
| public: | |||
| // .protobuf.TrickerType tricker_type = 8; | |||
| void clear_tricker_type(); | |||
| ::protobuf::TrickerType tricker_type() const; | |||
| void set_tricker_type(::protobuf::TrickerType value); | |||
| private: | |||
| ::protobuf::TrickerType _internal_tricker_type() const; | |||
| void _internal_set_tricker_type(::protobuf::TrickerType value); | |||
| public: | |||
| // int64 guid = 9; | |||
| void clear_guid(); | |||
| @@ -976,14 +943,14 @@ namespace protobuf | |||
| void _internal_set_guid(int64_t value); | |||
| public: | |||
| // int64 player_id = 11; | |||
| void clear_player_id(); | |||
| int64_t player_id() const; | |||
| void set_player_id(int64_t value); | |||
| // .protobuf.TrickerType tricker_type = 8; | |||
| void clear_tricker_type(); | |||
| ::protobuf::TrickerType tricker_type() const; | |||
| void set_tricker_type(::protobuf::TrickerType value); | |||
| private: | |||
| int64_t _internal_player_id() const; | |||
| void _internal_set_player_id(int64_t value); | |||
| ::protobuf::TrickerType _internal_tricker_type() const; | |||
| void _internal_set_tricker_type(::protobuf::TrickerType value); | |||
| public: | |||
| // int32 score = 10; | |||
| @@ -995,6 +962,16 @@ namespace protobuf | |||
| int32_t _internal_score() const; | |||
| void _internal_set_score(int32_t value); | |||
| public: | |||
| // int64 player_id = 11; | |||
| void clear_player_id(); | |||
| int64_t player_id() const; | |||
| void set_player_id(int64_t value); | |||
| private: | |||
| int64_t _internal_player_id() const; | |||
| void _internal_set_player_id(int64_t value); | |||
| public: | |||
| // int32 view_range = 12; | |||
| void clear_view_range(); | |||
| @@ -1015,16 +992,6 @@ namespace protobuf | |||
| int32_t _internal_radius() const; | |||
| void _internal_set_radius(int32_t value); | |||
| public: | |||
| // .protobuf.PlayerState player_state = 14; | |||
| void clear_player_state(); | |||
| ::protobuf::PlayerState player_state() const; | |||
| void set_player_state(::protobuf::PlayerState value); | |||
| private: | |||
| ::protobuf::PlayerState _internal_player_state() const; | |||
| void _internal_set_player_state(::protobuf::PlayerState value); | |||
| public: | |||
| // double trick_desire = 15; | |||
| void clear_trick_desire(); | |||
| @@ -1046,14 +1013,14 @@ namespace protobuf | |||
| void _internal_set_class_volume(double value); | |||
| public: | |||
| // double facing_direction = 17; | |||
| void clear_facing_direction(); | |||
| double facing_direction() const; | |||
| void set_facing_direction(double value); | |||
| // .protobuf.PlayerState player_state = 14; | |||
| void clear_player_state(); | |||
| ::protobuf::PlayerState player_state() const; | |||
| void set_player_state(::protobuf::PlayerState value); | |||
| private: | |||
| double _internal_facing_direction() const; | |||
| void _internal_set_facing_direction(double value); | |||
| ::protobuf::PlayerState _internal_player_state() const; | |||
| void _internal_set_player_state(::protobuf::PlayerState value); | |||
| public: | |||
| // .protobuf.BulletType bullet_type = 18; | |||
| @@ -1065,6 +1032,16 @@ namespace protobuf | |||
| ::protobuf::BulletType _internal_bullet_type() const; | |||
| void _internal_set_bullet_type(::protobuf::BulletType value); | |||
| public: | |||
| // double facing_direction = 17; | |||
| void clear_facing_direction(); | |||
| double facing_direction() const; | |||
| void set_facing_direction(double value); | |||
| private: | |||
| double _internal_facing_direction() const; | |||
| void _internal_set_facing_direction(double value); | |||
| public: | |||
| // @@protoc_insertion_point(class_scope:protobuf.MessageOfTricker) | |||
| @@ -1085,19 +1062,18 @@ namespace protobuf | |||
| int32_t x_; | |||
| int32_t y_; | |||
| int32_t speed_; | |||
| int32_t damage_; | |||
| int place_; | |||
| int tricker_type_; | |||
| int64_t guid_; | |||
| int64_t player_id_; | |||
| int tricker_type_; | |||
| int32_t score_; | |||
| int64_t player_id_; | |||
| int32_t view_range_; | |||
| int32_t radius_; | |||
| int player_state_; | |||
| double trick_desire_; | |||
| double class_volume_; | |||
| double facing_direction_; | |||
| int player_state_; | |||
| int bullet_type_; | |||
| double facing_direction_; | |||
| mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; | |||
| }; | |||
| union | |||
| @@ -1812,8 +1788,6 @@ namespace protobuf | |||
| kYFieldNumber = 3, | |||
| kPlaceFieldNumber = 6, | |||
| kGuidFieldNumber = 5, | |||
| kSizeFieldNumber = 7, | |||
| kIsMovingFieldNumber = 8, | |||
| }; | |||
| // .protobuf.PropType type = 1; | |||
| void clear_type(); | |||
| @@ -1874,26 +1848,6 @@ namespace protobuf | |||
| int64_t _internal_guid() const; | |||
| void _internal_set_guid(int64_t value); | |||
| public: | |||
| // int32 size = 7; | |||
| void clear_size(); | |||
| int32_t size() const; | |||
| void set_size(int32_t value); | |||
| private: | |||
| int32_t _internal_size() const; | |||
| void _internal_set_size(int32_t value); | |||
| public: | |||
| // bool is_moving = 8; | |||
| void clear_is_moving(); | |||
| bool is_moving() const; | |||
| void set_is_moving(bool value); | |||
| private: | |||
| bool _internal_is_moving() const; | |||
| void _internal_set_is_moving(bool value); | |||
| public: | |||
| // @@protoc_insertion_point(class_scope:protobuf.MessageOfProp) | |||
| @@ -1912,8 +1866,6 @@ namespace protobuf | |||
| int32_t y_; | |||
| int place_; | |||
| int64_t guid_; | |||
| int32_t size_; | |||
| bool is_moving_; | |||
| mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; | |||
| }; | |||
| union | |||
| @@ -2973,7 +2925,7 @@ namespace protobuf | |||
| kXFieldNumber = 1, | |||
| kYFieldNumber = 2, | |||
| kIsOpenFieldNumber = 3, | |||
| kNumberFieldNumber = 4, | |||
| kProgressFieldNumber = 4, | |||
| }; | |||
| // int32 x = 1; | |||
| void clear_x(); | |||
| @@ -3005,14 +2957,14 @@ namespace protobuf | |||
| void _internal_set_is_open(bool value); | |||
| public: | |||
| // int32 number = 4; | |||
| void clear_number(); | |||
| int32_t number() const; | |||
| void set_number(int32_t value); | |||
| // int32 progress = 4; | |||
| void clear_progress(); | |||
| int32_t progress() const; | |||
| void set_progress(int32_t value); | |||
| private: | |||
| int32_t _internal_number() const; | |||
| void _internal_set_number(int32_t value); | |||
| int32_t _internal_progress() const; | |||
| void _internal_set_progress(int32_t value); | |||
| public: | |||
| // @@protoc_insertion_point(class_scope:protobuf.MessageOfDoor) | |||
| @@ -3029,7 +2981,7 @@ namespace protobuf | |||
| int32_t x_; | |||
| int32_t y_; | |||
| bool is_open_; | |||
| int32_t number_; | |||
| int32_t progress_; | |||
| mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; | |||
| }; | |||
| union | |||
| @@ -5660,30 +5612,6 @@ namespace protobuf | |||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfStudent.guid) | |||
| } | |||
| // .protobuf.PlayerState state = 11; | |||
| inline void MessageOfStudent::clear_state() | |||
| { | |||
| _impl_.state_ = 0; | |||
| } | |||
| inline ::protobuf::PlayerState MessageOfStudent::_internal_state() const | |||
| { | |||
| return static_cast<::protobuf::PlayerState>(_impl_.state_); | |||
| } | |||
| inline ::protobuf::PlayerState MessageOfStudent::state() const | |||
| { | |||
| // @@protoc_insertion_point(field_get:protobuf.MessageOfStudent.state) | |||
| return _internal_state(); | |||
| } | |||
| inline void MessageOfStudent::_internal_set_state(::protobuf::PlayerState value) | |||
| { | |||
| _impl_.state_ = value; | |||
| } | |||
| inline void MessageOfStudent::set_state(::protobuf::PlayerState value) | |||
| { | |||
| _internal_set_state(value); | |||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfStudent.state) | |||
| } | |||
| // .protobuf.BulletType bullet_type = 12; | |||
| inline void MessageOfStudent::clear_bullet_type() | |||
| { | |||
| @@ -6102,30 +6030,6 @@ namespace protobuf | |||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfTricker.speed) | |||
| } | |||
| // int32 damage = 4; | |||
| inline void MessageOfTricker::clear_damage() | |||
| { | |||
| _impl_.damage_ = 0; | |||
| } | |||
| inline int32_t MessageOfTricker::_internal_damage() const | |||
| { | |||
| return _impl_.damage_; | |||
| } | |||
| inline int32_t MessageOfTricker::damage() const | |||
| { | |||
| // @@protoc_insertion_point(field_get:protobuf.MessageOfTricker.damage) | |||
| return _internal_damage(); | |||
| } | |||
| inline void MessageOfTricker::_internal_set_damage(int32_t value) | |||
| { | |||
| _impl_.damage_ = value; | |||
| } | |||
| inline void MessageOfTricker::set_damage(int32_t value) | |||
| { | |||
| _internal_set_damage(value); | |||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfTricker.damage) | |||
| } | |||
| // repeated double time_until_skill_available = 5; | |||
| inline int MessageOfTricker::_internal_time_until_skill_available_size() const | |||
| { | |||
| @@ -7097,54 +7001,6 @@ namespace protobuf | |||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfProp.place) | |||
| } | |||
| // int32 size = 7; | |||
| inline void MessageOfProp::clear_size() | |||
| { | |||
| _impl_.size_ = 0; | |||
| } | |||
| inline int32_t MessageOfProp::_internal_size() const | |||
| { | |||
| return _impl_.size_; | |||
| } | |||
| inline int32_t MessageOfProp::size() const | |||
| { | |||
| // @@protoc_insertion_point(field_get:protobuf.MessageOfProp.size) | |||
| return _internal_size(); | |||
| } | |||
| inline void MessageOfProp::_internal_set_size(int32_t value) | |||
| { | |||
| _impl_.size_ = value; | |||
| } | |||
| inline void MessageOfProp::set_size(int32_t value) | |||
| { | |||
| _internal_set_size(value); | |||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfProp.size) | |||
| } | |||
| // bool is_moving = 8; | |||
| inline void MessageOfProp::clear_is_moving() | |||
| { | |||
| _impl_.is_moving_ = false; | |||
| } | |||
| inline bool MessageOfProp::_internal_is_moving() const | |||
| { | |||
| return _impl_.is_moving_; | |||
| } | |||
| inline bool MessageOfProp::is_moving() const | |||
| { | |||
| // @@protoc_insertion_point(field_get:protobuf.MessageOfProp.is_moving) | |||
| return _internal_is_moving(); | |||
| } | |||
| inline void MessageOfProp::_internal_set_is_moving(bool value) | |||
| { | |||
| _impl_.is_moving_ = value; | |||
| } | |||
| inline void MessageOfProp::set_is_moving(bool value) | |||
| { | |||
| _internal_set_is_moving(value); | |||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfProp.is_moving) | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| // MessageOfPickedProp | |||
| @@ -7573,28 +7429,28 @@ namespace protobuf | |||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfDoor.is_open) | |||
| } | |||
| // int32 number = 4; | |||
| inline void MessageOfDoor::clear_number() | |||
| // int32 progress = 4; | |||
| inline void MessageOfDoor::clear_progress() | |||
| { | |||
| _impl_.number_ = 0; | |||
| _impl_.progress_ = 0; | |||
| } | |||
| inline int32_t MessageOfDoor::_internal_number() const | |||
| inline int32_t MessageOfDoor::_internal_progress() const | |||
| { | |||
| return _impl_.number_; | |||
| return _impl_.progress_; | |||
| } | |||
| inline int32_t MessageOfDoor::number() const | |||
| inline int32_t MessageOfDoor::progress() const | |||
| { | |||
| // @@protoc_insertion_point(field_get:protobuf.MessageOfDoor.number) | |||
| return _internal_number(); | |||
| // @@protoc_insertion_point(field_get:protobuf.MessageOfDoor.progress) | |||
| return _internal_progress(); | |||
| } | |||
| inline void MessageOfDoor::_internal_set_number(int32_t value) | |||
| inline void MessageOfDoor::_internal_set_progress(int32_t value) | |||
| { | |||
| _impl_.number_ = value; | |||
| _impl_.progress_ = value; | |||
| } | |||
| inline void MessageOfDoor::set_number(int32_t value) | |||
| inline void MessageOfDoor::set_progress(int32_t value) | |||
| { | |||
| _internal_set_number(value); | |||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfDoor.number) | |||
| _internal_set_progress(value); | |||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfDoor.progress) | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -30,43 +30,45 @@ static constexpr ::_pbi::MigrationSchema* schemas = nullptr; | |||
| static constexpr ::_pb::Message* const* file_default_instances = nullptr; | |||
| const char descriptor_table_protodef_MessageType_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = | |||
| "\n\021MessageType.proto\022\010protobuf*{\n\nBulletT" | |||
| "ype\022\024\n\020NULL_BULLET_TYPE\020\000\022\017\n\013LINE_BULLET" | |||
| "\020\001\022\021\n\rCOMMON_BULLET\020\002\022\017\n\013FAST_BULLET\020\003\022\023" | |||
| "\n\017ORDINARY_BULLET\020\004\022\r\n\tATOM_BOMB\020\005*\212\001\n\tP" | |||
| "laceType\022\023\n\017NULL_PLACE_TYPE\020\000\022\010\n\004LAND\020\001\022" | |||
| "\010\n\004WALL\020\002\022\t\n\005GRASS\020\003\022\r\n\tCLASSROOM\020\004\022\010\n\004G" | |||
| "ATE\020\005\022\017\n\013HIDDEN_GATE\020\006\022\n\n\006WINDOW\020\007\022\010\n\004DO" | |||
| "OR\020\010\022\t\n\005CHEST\020\t*8\n\tShapeType\022\023\n\017NULL_SHA" | |||
| "PE_TYPE\020\000\022\n\n\006CIRCLE\020\001\022\n\n\006SQUARE\020\002*N\n\010Pro" | |||
| "pType\022\022\n\016NULL_PROP_TYPE\020\000\022\n\n\006PTYPE1\020\001\022\n\n" | |||
| "\006PTYPE2\020\002\022\n\n\006PTYPE3\020\003\022\n\n\006PTYPE4\020\004*f\n\017Stu" | |||
| "dentBuffType\022\023\n\017NULL_SBUFF_TYPE\020\000\022\016\n\nSBU" | |||
| "FFTYPE1\020\001\022\016\n\nSBUFFTYPE2\020\002\022\016\n\nSBUFFTYPE3\020" | |||
| "\003\022\016\n\nSBUFFTYPE4\020\004*\347\001\n\013PlayerState\022\017\n\013NUL" | |||
| "L_STATUS\020\000\022\010\n\004IDLE\020\001\022\014\n\010LEARNING\020\002\022\014\n\010AD" | |||
| "DICTED\020\003\022\010\n\004QUIT\020\004\022\r\n\tGRADUATED\020\005\022\013\n\007TRE" | |||
| "ATED\020\006\022\013\n\007RESCUED\020\007\022\013\n\007STUNNED\020\010\022\014\n\010TREA" | |||
| "TING\020\t\022\014\n\010RESCUING\020\n\022\014\n\010SWINGING\020\013\022\r\n\tAT" | |||
| "TACKING\020\014\022\013\n\007LOCKING\020\r\022\r\n\tRUMMAGING\020\016\022\014\n" | |||
| "\010CLIMBING\020\017*f\n\017TrickerBuffType\022\023\n\017NULL_T" | |||
| "BUFF_TYPE\020\000\022\016\n\nTBUFFTYPE1\020\001\022\016\n\nTBUFFTYPE" | |||
| "2\020\002\022\016\n\nTBUFFTYPE3\020\003\022\016\n\nTBUFFTYPE4\020\004*J\n\nP" | |||
| "layerType\022\024\n\020NULL_PLAYER_TYPE\020\000\022\022\n\016STUDE" | |||
| "NT_PLAYER\020\001\022\022\n\016TRICKER_PLAYER\020\002*l\n\013Stude" | |||
| "ntType\022\025\n\021NULL_STUDENT_TYPE\020\000\022\020\n\014STUDENT" | |||
| "TYPE1\020\001\022\020\n\014STUDENTTYPE2\020\002\022\020\n\014STUDENTTYPE" | |||
| "3\020\003\022\020\n\014STUDENTTYPE4\020\004*l\n\013TrickerType\022\025\n\021" | |||
| "NULL_TRICKER_TYPE\020\000\022\020\n\014TRICKERTYPE1\020\001\022\020\n" | |||
| "\014TRICKERTYPE2\020\002\022\020\n\014TRICKERTYPE3\020\003\022\020\n\014TRI" | |||
| "CKERTYPE4\020\004*P\n\tGameState\022\023\n\017NULL_GAME_ST" | |||
| "ATE\020\000\022\016\n\nGAME_START\020\001\022\020\n\014GAME_RUNNING\020\002\022" | |||
| "\014\n\010GAME_END\020\003b\006proto3"; | |||
| "\n\021MessageType.proto\022\010protobuf*\207\001\n\nBullet" | |||
| "Type\022\024\n\020NULL_BULLET_TYPE\020\000\022\020\n\014FLYING_KNI" | |||
| "FE\020\001\022\034\n\030COMMON_ATTACK_OF_TRICKER\020\002\022\017\n\013FA" | |||
| "ST_BULLET\020\003\022\023\n\017ORDINARY_BULLET\020\004\022\r\n\tATOM" | |||
| "_BOMB\020\005*\241\001\n\tPlaceType\022\023\n\017NULL_PLACE_TYPE" | |||
| "\020\000\022\010\n\004LAND\020\001\022\010\n\004WALL\020\002\022\t\n\005GRASS\020\003\022\r\n\tCLA" | |||
| "SSROOM\020\004\022\010\n\004GATE\020\005\022\017\n\013HIDDEN_GATE\020\006\022\n\n\006W" | |||
| "INDOW\020\007\022\t\n\005DOOR3\020\010\022\t\n\005DOOR5\020\t\022\t\n\005DOOR6\020\n" | |||
| "\022\t\n\005CHEST\020\013*8\n\tShapeType\022\023\n\017NULL_SHAPE_T" | |||
| "YPE\020\000\022\n\n\006CIRCLE\020\001\022\n\n\006SQUARE\020\002*H\n\010PropTyp" | |||
| "e\022\022\n\016NULL_PROP_TYPE\020\000\022\010\n\004KEY3\020\001\022\010\n\004KEY5\020" | |||
| "\002\022\010\n\004KEY6\020\003\022\n\n\006PTYPE4\020\004*f\n\017StudentBuffTy" | |||
| "pe\022\023\n\017NULL_SBUFF_TYPE\020\000\022\016\n\nSBUFFTYPE1\020\001\022" | |||
| "\016\n\nSBUFFTYPE2\020\002\022\016\n\nSBUFFTYPE3\020\003\022\016\n\nSBUFF" | |||
| "TYPE4\020\004*\251\002\n\013PlayerState\022\017\n\013NULL_STATUS\020\000" | |||
| "\022\010\n\004IDLE\020\001\022\014\n\010LEARNING\020\002\022\014\n\010ADDICTED\020\003\022\010" | |||
| "\n\004QUIT\020\004\022\r\n\tGRADUATED\020\005\022\013\n\007TREATED\020\006\022\013\n\007" | |||
| "RESCUED\020\007\022\013\n\007STUNNED\020\010\022\014\n\010TREATING\020\t\022\014\n\010" | |||
| "RESCUING\020\n\022\014\n\010SWINGING\020\013\022\r\n\tATTACKING\020\014\022" | |||
| "\013\n\007LOCKING\020\r\022\r\n\tRUMMAGING\020\016\022\014\n\010CLIMBING\020" | |||
| "\017\022\023\n\017OPENING_A_CHEST\020\020\022\027\n\023USING_SPECIAL_" | |||
| "SKILL\020\021\022\022\n\016OPENING_A_GATE\020\022*f\n\017TrickerBu" | |||
| "ffType\022\023\n\017NULL_TBUFF_TYPE\020\000\022\016\n\nTBUFFTYPE" | |||
| "1\020\001\022\016\n\nTBUFFTYPE2\020\002\022\016\n\nTBUFFTYPE3\020\003\022\016\n\nT" | |||
| "BUFFTYPE4\020\004*J\n\nPlayerType\022\024\n\020NULL_PLAYER" | |||
| "_TYPE\020\000\022\022\n\016STUDENT_PLAYER\020\001\022\022\n\016TRICKER_P" | |||
| "LAYER\020\002*g\n\013StudentType\022\025\n\021NULL_STUDENT_T" | |||
| "YPE\020\000\022\013\n\007ATHLETE\020\001\022\020\n\014STUDENTTYPE2\020\002\022\020\n\014" | |||
| "STUDENTTYPE3\020\003\022\020\n\014STUDENTTYPE4\020\004*h\n\013Tric" | |||
| "kerType\022\025\n\021NULL_TRICKER_TYPE\020\000\022\014\n\010ASSASS" | |||
| "IN\020\001\022\020\n\014TRICKERTYPE2\020\002\022\020\n\014TRICKERTYPE3\020\003" | |||
| "\022\020\n\014TRICKERTYPE4\020\004*P\n\tGameState\022\023\n\017NULL_" | |||
| "GAME_STATE\020\000\022\016\n\nGAME_START\020\001\022\020\n\014GAME_RUN" | |||
| "NING\020\002\022\014\n\010GAME_END\020\003b\006proto3"; | |||
| static ::_pbi::once_flag descriptor_table_MessageType_2eproto_once; | |||
| const ::_pbi::DescriptorTable descriptor_table_MessageType_2eproto = { | |||
| false, | |||
| false, | |||
| 1261, | |||
| 1348, | |||
| descriptor_table_protodef_MessageType_2eproto, | |||
| "MessageType.proto", | |||
| &descriptor_table_MessageType_2eproto_once, | |||
| @@ -129,6 +131,8 @@ namespace protobuf | |||
| case 7: | |||
| case 8: | |||
| case 9: | |||
| case 10: | |||
| case 11: | |||
| return true; | |||
| default: | |||
| return false; | |||
| @@ -218,6 +222,9 @@ namespace protobuf | |||
| case 13: | |||
| case 14: | |||
| case 15: | |||
| case 16: | |||
| case 17: | |||
| case 18: | |||
| return true; | |||
| default: | |||
| return false; | |||
| @@ -53,8 +53,8 @@ namespace protobuf | |||
| enum BulletType : int | |||
| { | |||
| NULL_BULLET_TYPE = 0, | |||
| LINE_BULLET = 1, | |||
| COMMON_BULLET = 2, | |||
| FLYING_KNIFE = 1, | |||
| COMMON_ATTACK_OF_TRICKER = 2, | |||
| FAST_BULLET = 3, | |||
| ORDINARY_BULLET = 4, | |||
| ATOM_BOMB = 5, | |||
| @@ -93,8 +93,10 @@ namespace protobuf | |||
| GATE = 5, | |||
| HIDDEN_GATE = 6, | |||
| WINDOW = 7, | |||
| DOOR = 8, | |||
| CHEST = 9, | |||
| DOOR3 = 8, | |||
| DOOR5 = 9, | |||
| DOOR6 = 10, | |||
| CHEST = 11, | |||
| PlaceType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(), | |||
| PlaceType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max() | |||
| }; | |||
| @@ -153,9 +155,9 @@ namespace protobuf | |||
| enum PropType : int | |||
| { | |||
| NULL_PROP_TYPE = 0, | |||
| PTYPE1 = 1, | |||
| PTYPE2 = 2, | |||
| PTYPE3 = 3, | |||
| KEY3 = 1, | |||
| KEY5 = 2, | |||
| KEY6 = 3, | |||
| PTYPE4 = 4, | |||
| PropType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(), | |||
| PropType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max() | |||
| @@ -232,12 +234,15 @@ namespace protobuf | |||
| LOCKING = 13, | |||
| RUMMAGING = 14, | |||
| CLIMBING = 15, | |||
| OPENING_A_CHEST = 16, | |||
| USING_SPECIAL_SKILL = 17, | |||
| OPENING_A_GATE = 18, | |||
| PlayerState_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(), | |||
| PlayerState_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max() | |||
| }; | |||
| bool PlayerState_IsValid(int value); | |||
| constexpr PlayerState PlayerState_MIN = NULL_STATUS; | |||
| constexpr PlayerState PlayerState_MAX = CLIMBING; | |||
| constexpr PlayerState PlayerState_MAX = OPENING_A_GATE; | |||
| constexpr int PlayerState_ARRAYSIZE = PlayerState_MAX + 1; | |||
| const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* PlayerState_descriptor(); | |||
| @@ -322,7 +327,7 @@ namespace protobuf | |||
| enum StudentType : int | |||
| { | |||
| NULL_STUDENT_TYPE = 0, | |||
| STUDENTTYPE1 = 1, | |||
| ATHLETE = 1, | |||
| STUDENTTYPE2 = 2, | |||
| STUDENTTYPE3 = 3, | |||
| STUDENTTYPE4 = 4, | |||
| @@ -354,7 +359,7 @@ namespace protobuf | |||
| enum TrickerType : int | |||
| { | |||
| NULL_TRICKER_TYPE = 0, | |||
| TRICKERTYPE1 = 1, | |||
| ASSASSIN = 1, | |||
| TRICKERTYPE2 = 2, | |||
| TRICKERTYPE3 = 3, | |||
| TRICKERTYPE4 = 4, | |||
| @@ -119,68 +119,86 @@ class Communication: | |||
| else: | |||
| return learnResult.act_success | |||
| def EndLearning(self, playerID: int) -> bool: | |||
| def StartTreatMate(self, playerID: int) -> bool: | |||
| try: | |||
| learnResult = self.__THUAI6Stub.EndLearning( | |||
| helpResult = self.__THUAI6Stub.StartTreatMate( | |||
| THUAI62Proto.THUAI62ProtobufID(playerID)) | |||
| except grpc.RpcError as e: | |||
| return False | |||
| else: | |||
| return learnResult.act_success | |||
| return helpResult.act_success | |||
| def StartHelpMate(self, playerID: int) -> bool: | |||
| def StartRescueMate(self, playerID: int) -> bool: | |||
| try: | |||
| helpResult = self.__THUAI6Stub.StartHelpMate( | |||
| helpResult = self.__THUAI6Stub.StartRescueMate( | |||
| THUAI62Proto.THUAI62ProtobufID(playerID)) | |||
| except grpc.RpcError as e: | |||
| return False | |||
| else: | |||
| return helpResult.act_success | |||
| def EndHelpMate(self, playerID: int) -> bool: | |||
| def Attack(self, angle: float, playerID: int) -> bool: | |||
| try: | |||
| helpResult = self.__THUAI6Stub.EndHelpMate( | |||
| attackResult = self.__THUAI6Stub.Attack( | |||
| THUAI62Proto.THUAI62ProtobufTrick(angle, playerID)) | |||
| except grpc.RpcError as e: | |||
| return False | |||
| else: | |||
| return attackResult.act_success | |||
| def OpenDoor(self, playerID: int) -> bool: | |||
| try: | |||
| openResult = self.__THUAI6Stub.OpenDoor( | |||
| THUAI62Proto.THUAI62ProtobufID(playerID)) | |||
| except grpc.RpcError as e: | |||
| return False | |||
| else: | |||
| return helpResult.act_success | |||
| return openResult.act_success | |||
| def Trick(self, angle: float, playerID: int) -> bool: | |||
| def CloseDoor(self, playerID: int) -> bool: | |||
| try: | |||
| trickResult = self.__THUAI6Stub.Trick( | |||
| THUAI62Proto.THUAI62ProtobufTrick(angle, playerID)) | |||
| closeResult = self.__THUAI6Stub.CloseDoor( | |||
| THUAI62Proto.THUAI62ProtobufID(playerID)) | |||
| except grpc.RpcError as e: | |||
| return False | |||
| else: | |||
| return closeResult.act_success | |||
| def SkipWindow(self, playerID: int) -> bool: | |||
| try: | |||
| skipResult = self.__THUAI6Stub.SkipWindow( | |||
| THUAI62Proto.THUAI62ProtobufID(playerID)) | |||
| except grpc.RpcError as e: | |||
| return False | |||
| else: | |||
| return trickResult.act_success | |||
| return skipResult.act_success | |||
| def StartExam(self, playerID: int) -> bool: | |||
| def StartOpenGate(self, playerID: int) -> bool: | |||
| try: | |||
| carryResult = self.__THUAI6Stub.StartExam( | |||
| openResult = self.__THUAI6Stub.StartOpenGate( | |||
| THUAI62Proto.THUAI62ProtobufID(playerID)) | |||
| except grpc.RpcError as e: | |||
| return False | |||
| else: | |||
| return carryResult.act_success | |||
| return openResult.act_success | |||
| def EndExam(self, playerID: int) -> bool: | |||
| def StartOpenChest(self, playerID: int) -> bool: | |||
| try: | |||
| releaseResult = self.__THUAI6Stub.EndExam( | |||
| openResult = self.__THUAI6Stub.StartOpenChest( | |||
| THUAI62Proto.THUAI62ProtobufID(playerID)) | |||
| except grpc.RpcError as e: | |||
| return False | |||
| else: | |||
| return releaseResult.act_success | |||
| return openResult.act_success | |||
| def MakeFail(self, playerID: int) -> bool: | |||
| def EndAllAction(self, playerID: int) -> bool: | |||
| try: | |||
| hangResult = self.__THUAI6Stub.MakeFail( | |||
| endResult = self.__THUAI6Stub.EndAllAction( | |||
| THUAI62Proto.THUAI62ProtobufID(playerID)) | |||
| except grpc.RpcError as e: | |||
| return False | |||
| else: | |||
| return hangResult.act_success | |||
| return endResult.act_success | |||
| def TryConnection(self, playerID: int) -> bool: | |||
| try: | |||
| @@ -11,6 +11,13 @@ class State: | |||
| props: List[THUAI6.Prop] | |||
| map: List[List[THUAI6.PlaceType]] | |||
| gameMap: List[List[THUAI6.PlaceType]] | |||
| bullets: List[THUAI6.Bullet] | |||
| bombedBullets: List[THUAI6.BombedBullet] | |||
| mapInfo: THUAI6.GameMap | |||
| gameInfo: THUAI6.GameInfo | |||
| guids: List[int] | |||
| @@ -89,12 +89,49 @@ class Logic(ILogic): | |||
| def GetFullMap(self) -> List[List[THUAI6.PlaceType]]: | |||
| with self.__mtxState: | |||
| self.__logger.debug("Called GetFullMap") | |||
| return self.__currentState.map | |||
| return self.__currentState.gameMap | |||
| def GetPlaceType(self, x: int, y: int) -> THUAI6.PlaceType: | |||
| with self.__mtxState: | |||
| self.__logger.debug("Called GetPlaceType") | |||
| return self.__currentState.map[x][y] | |||
| return self.__currentState.gameMap[x][y] | |||
| def IsDoorOpen(self, x: int, y: int) -> bool: | |||
| with self.__mtxState: | |||
| self.__logger.debug("Called IsDoorOpen") | |||
| if (x, y) in self.__currentState.mapInfo.doorState: | |||
| return self.__currentState.mapInfo.doorState[(x, y)] | |||
| else: | |||
| return False | |||
| def GetClassroomProgess(self, x: int, y: int) -> int: | |||
| with self.__mtxState: | |||
| self.__logger.debug("Called GetClassroomProgess") | |||
| if (x, y) in self.__currentState.mapInfo.classroomState: | |||
| return self.__currentState.mapInfo.classroomState[(x, y)] | |||
| else: | |||
| return 0 | |||
| def GetChestProgress(self, x: int, y: int) -> int: | |||
| with self.__mtxState: | |||
| self.__logger.debug("Called GetChestProgress") | |||
| if (x, y) in self.__currentState.mapInfo.chestState: | |||
| return self.__currentState.mapInfo.chestState[(x, y)] | |||
| else: | |||
| return 0 | |||
| def GetGateProgress(self, x: int, y: int) -> int: | |||
| with self.__mtxState: | |||
| self.__logger.debug("Called GetGateProgress") | |||
| if (x, y) in self.__currentState.mapInfo.gateState: | |||
| return self.__currentState.mapInfo.gateState[(x, y)] | |||
| else: | |||
| return 0 | |||
| def GetGameInfo(self) -> THUAI6.GameInfo: | |||
| with self.__mtxState: | |||
| self.__logger.debug("Called GetGameInfo") | |||
| return self.__currentState.gameInfo | |||
| def Move(self, time: int, angle: float) -> bool: | |||
| self.__logger.debug("Called Move") | |||
| @@ -146,35 +183,41 @@ class Logic(ILogic): | |||
| self.__logger.debug("Called StartLearning") | |||
| return self.__comm.StartLearning(self.__playerID) | |||
| def EndLearning(self) -> bool: | |||
| self.__logger.debug("Called EndLearning") | |||
| return self.__comm.EndLearning(self.__playerID) | |||
| def StartTreatMate(self) -> bool: | |||
| self.__logger.debug("Called StartTreatMate") | |||
| return self.__comm.StartTreatMate(self.__playerID) | |||
| def StartRescueMate(self) -> bool: | |||
| self.__logger.debug("Called StartRescueMate") | |||
| return self.__comm.StartRescueMate(self.__playerID) | |||
| def StartHelpMate(self) -> bool: | |||
| self.__logger.debug("Called StartHelpMate") | |||
| return self.__comm.StartHelpMate(self.__playerID) | |||
| def Attack(self, angle: float) -> bool: | |||
| self.__logger.debug("Called Trick") | |||
| return self.__comm.Attack(angle, self.__playerID) | |||
| def EndHelpMate(self) -> bool: | |||
| self.__logger.debug("Called EndHelpMate") | |||
| return self.__comm.EndHelpMate(self.__playerID) | |||
| def CloseDoor(self) -> bool: | |||
| self.__logger.debug("Called CloseDoor") | |||
| return self.__comm.CloseDoor(self.__playerID) | |||
| # Tricker使用的接口 | |||
| def OpenDoor(self) -> bool: | |||
| self.__logger.debug("Called OpenDoor") | |||
| return self.__comm.OpenDoor(self.__playerID) | |||
| def Trick(self, angle: float) -> bool: | |||
| self.__logger.debug("Called Trick") | |||
| return self.__comm.Trick(angle, self.__playerID) | |||
| def SkipWindow(self) -> bool: | |||
| self.__logger.debug("Called SkipWindow") | |||
| return self.__comm.SkipWindow(self.__playerID) | |||
| def StartExam(self) -> bool: | |||
| self.__logger.debug("Called StartExam") | |||
| return self.__comm.StartExam(self.__playerID) | |||
| def StartOpenGate(self) -> bool: | |||
| self.__logger.debug("Called StartOpenGate") | |||
| return self.__comm.StartOpenGate(self.__playerID) | |||
| def EndExam(self) -> bool: | |||
| self.__logger.debug("Called EndExam") | |||
| return self.__comm.EndExam(self.__playerID) | |||
| def StartOpenChest(self) -> bool: | |||
| self.__logger.debug("Called StartOpenChest") | |||
| return self.__comm.StartOpenChest(self.__playerID) | |||
| def MakeFail(self) -> bool: | |||
| self.__logger.debug("Called MakeFail") | |||
| return self.__comm.MakeFail(self.__playerID) | |||
| def EndAllAction(self) -> bool: | |||
| self.__logger.debug("Called EndAllAction") | |||
| return self.__comm.EndAllAction(self.__playerID) | |||
| # Logic内部逻辑 | |||
| def __TryConnection(self) -> bool: | |||
| @@ -1,5 +1,5 @@ | |||
| from enum import Enum | |||
| from typing import List, Dict | |||
| from typing import List, Dict, Tuple | |||
| class GameState(Enum): | |||
| @@ -15,9 +15,11 @@ class PlaceType(Enum): | |||
| Wall = 2 | |||
| Grass = 3 | |||
| ClassRoom = 4 | |||
| BlackRoom = 5 | |||
| Gate = 6 | |||
| HiddenGate = 7 | |||
| Gate = 5 | |||
| HiddenGate = 6 | |||
| Window = 7 | |||
| Door = 8 | |||
| Chest = 9 | |||
| class ShapeType(Enum): | |||
| @@ -37,6 +39,15 @@ class PropType(Enum): | |||
| PropType1 = 1 | |||
| class BulletType(Enum): | |||
| NullBulletType = 0 | |||
| LineBullet = 1 | |||
| CommonBullet = 2 | |||
| FastBullet = 3 | |||
| OrdinaryBullet = 4 | |||
| AtomBomb = 5 | |||
| class StudentType(Enum): | |||
| NullStudentType = 0 | |||
| StudentType1 = 1 | |||
| @@ -57,14 +68,35 @@ class TrickerBuffType(Enum): | |||
| TrickerBuffType1 = 1 | |||
| class StudentState(Enum): | |||
| NullStudentState = 0 | |||
| class PlayerState(Enum): | |||
| NullState = 0 | |||
| Idle = 1 | |||
| Learning = 2 | |||
| Fail = 3 | |||
| Emotional = 4 | |||
| Quit = 5 | |||
| Graduated = 6 | |||
| Addicted = 3 | |||
| Quit = 4 | |||
| Graduated = 5 | |||
| Treated = 6 | |||
| Rescued = 7 | |||
| Stunned = 8 | |||
| Treating = 9 | |||
| Rescuing = 10 | |||
| Swinging = 11 | |||
| Attacking = 12 | |||
| Locking = 13 | |||
| Rummaging = 14 | |||
| Climbing = 15 | |||
| class MessageOfObj(Enum): | |||
| NullMessageOfObj = 0 | |||
| StudentMessage = 1 | |||
| TrickerMessage = 2 | |||
| PropMessage = 3 | |||
| BulletMessage = 4 | |||
| BombedBulletMessage = 5 | |||
| ClassroomMessage = 6 | |||
| GateMessage = 7 | |||
| ChestMessage = 8 | |||
| class Player: | |||
| @@ -75,25 +107,22 @@ class Player: | |||
| playerID: int | |||
| guid: int | |||
| radius: int | |||
| timeUntilSkillAvailable: float | |||
| damage: int | |||
| timeUntilSkillAvailable: List[float] | |||
| playerType: PlayerType | |||
| prop: PropType | |||
| prop: List[PropType] | |||
| place: PlaceType | |||
| playerState: PlayerState | |||
| class Student(Player): | |||
| state: StudentState | |||
| determination: int | |||
| failNum: int | |||
| failTime: float | |||
| emoTime: float | |||
| addiction: int | |||
| studentType: StudentType | |||
| buff: List[StudentBuffType] | |||
| class Tricker(Player): | |||
| damage: int | |||
| movable: bool | |||
| trickerType: TrickerType | |||
| buff: List[TrickerBuffType] | |||
| @@ -107,3 +136,42 @@ class Prop: | |||
| place: PlaceType | |||
| facingDirection: float | |||
| isMoving: bool | |||
| class Bullet: | |||
| bulletType: BulletType | |||
| x: int | |||
| y: int | |||
| facingDirection: float | |||
| guid: int | |||
| team: PlayerType | |||
| place: PlaceType | |||
| bombRange: float | |||
| class BombedBullet(): | |||
| bulletType: BulletType | |||
| x: int | |||
| y: int | |||
| facingDirection: float | |||
| mappingID: int | |||
| bombRange: float | |||
| class GameMap: | |||
| classroomState: Dict[tuple[int, int], int] | |||
| gateState: Dict[tuple[int, int], int] | |||
| chestState: Dict[tuple[int, int], bool] | |||
| doorState: Dict[tuple[int, int], bool] | |||
| class GameInfo: | |||
| gameTime: int | |||
| subjectLeft: int | |||
| studentGraduated: int | |||
| studentQuited: int | |||
| studentScore: int | |||
| trickerScore: int | |||
| gateOpened: bool | |||
| hiddenGateRefreshed: bool | |||
| hiddenGateOpened: bool | |||
| @@ -25,22 +25,34 @@ class AssistFunction(NoInstance): | |||
| return grid // numOfGridPerCell | |||
| @staticmethod | |||
| def HaveView(viewRange: int, x: int, y: int, newX: int, newY: int, map: List[List[THUAI6.PlaceType]]) -> bool: | |||
| def HaveView(viewRange: int, x: int, y: int, newX: int, newY: int, myPlace: THUAI6.PlaceType, newPlace: THUAI6.PlaceType, map: List[List[THUAI6.PlaceType]]) -> bool: | |||
| deltaX: int = newX - x | |||
| deltaY: int = newY - y | |||
| if deltaX * deltaX + deltaY * deltaY <= viewRange * viewRange: | |||
| distance: float = deltaX**2 + deltaY**2 | |||
| if myPlace != THUAI6.PlaceType.Grass and newPlace == THUAI6.PlaceType.Grass: | |||
| return False | |||
| if distance <= viewRange * viewRange: | |||
| divide: int = max(abs(deltaX), abs(deltaY)) // 100 | |||
| dx: float = deltaX / divide | |||
| dy: float = deltaY / divide | |||
| selfX: float = float(x) | |||
| selfY: float = float(y) | |||
| for i in range(divide): | |||
| selfX += dx | |||
| selfY += dy | |||
| if map[AssistFunction.GridToCell(int(selfX))][AssistFunction.GridToCell(int(selfY))] != THUAI6.PlaceType.Land: | |||
| return False | |||
| if newPlace == THUAI6.PlaceType.Grass and myPlace == THUAI6.PlaceType.Grass: | |||
| for i in range(divide): | |||
| selfX += dx | |||
| selfY += dy | |||
| if map[AssistFunction.GridToCell(int(selfX))][AssistFunction.GridToCell(int(selfY))] != THUAI6.PlaceType.Grass: | |||
| return False | |||
| else: | |||
| return True | |||
| else: | |||
| return True | |||
| for i in range(divide): | |||
| selfX += dx | |||
| selfY += dy | |||
| if map[AssistFunction.GridToCell(int(selfX))][AssistFunction.GridToCell(int(selfY))] == THUAI6.PlaceType.Wall: | |||
| return False | |||
| else: | |||
| return True | |||
| else: | |||
| return False | |||
| @@ -52,9 +64,11 @@ class Proto2THUAI6(NoInstance): | |||
| MessageType.LAND: THUAI6.PlaceType.Land, | |||
| MessageType.GRASS: THUAI6.PlaceType.Grass, | |||
| MessageType.CLASSROOM: THUAI6.PlaceType.ClassRoom, | |||
| MessageType.BLACKROOM: THUAI6.PlaceType.BlackRoom, | |||
| MessageType.GATE: THUAI6.PlaceType.Gate, | |||
| MessageType.HIDDEN_GATE: THUAI6.PlaceType.HiddenGate} | |||
| MessageType.HIDDEN_GATE: THUAI6.PlaceType.HiddenGate, | |||
| MessageType.WINDOW: THUAI6.PlaceType.Window, | |||
| MessageType.DOOR: THUAI6.PlaceType.Door, | |||
| } | |||
| shapeTypeDict: Final[dict] = { | |||
| MessageType.NULL_SHAPE_TYPE: THUAI6.ShapeType.NullShapeType, | |||
| @@ -86,14 +100,18 @@ class Proto2THUAI6(NoInstance): | |||
| MessageType.NULL_TBUFF_TYPE: THUAI6.TrickerBuffType.NullTrickerBuffType, | |||
| MessageType.TBUFFTYPE1: THUAI6.TrickerBuffType.TrickerBuffType1, } | |||
| studentStateDict: Final[dict] = { | |||
| MessageType.NULL_STATUS: THUAI6.StudentState.NullStudentState, | |||
| MessageType.IDLE: THUAI6.StudentState.Idle, | |||
| MessageType.LEARNING: THUAI6.StudentState.Learning, | |||
| MessageType.FAIL: THUAI6.StudentState.Fail, | |||
| MessageType.EMOTIONAL: THUAI6.StudentState.Emotional, | |||
| MessageType.QUIT: THUAI6.StudentState.Quit, | |||
| MessageType.GRADUATED: THUAI6.StudentState.Graduated} | |||
| playerStateDict: Final[dict] = { | |||
| MessageType.NULL_STATUS: THUAI6.PlayerState.NullState, | |||
| MessageType.IDLE: THUAI6.PlayerState.Idle, | |||
| MessageType.LEARNING: THUAI6.PlayerState.Learning, | |||
| MessageType.ADDICTED: THUAI6.PlayerState.Addicted, | |||
| MessageType.QUIT: THUAI6.PlayerState.Quit, | |||
| MessageType.GRADUATED: THUAI6.PlayerState.Graduated, | |||
| MessageType.RESCUED: THUAI6.PlayerState.Rescued, | |||
| MessageType.TREATED: THUAI6.PlayerState.Treated, | |||
| MessageType.STUNNED: THUAI6.PlayerState.Stunned, | |||
| MessageType.RESCUING: THUAI6.PlayerState.Rescuing, | |||
| MessageType.TREATING: THUAI6.PlayerState.Treating, } | |||
| gameStateDict: Final[dict] = { | |||
| MessageType.NULL_GAME_STATE: THUAI6.GameState.NullGameState, | |||
| @@ -101,6 +119,14 @@ class Proto2THUAI6(NoInstance): | |||
| MessageType.GAME_RUNNING: THUAI6.GameState.GameRunning, | |||
| MessageType.GAME_END: THUAI6.GameState.GameEnd} | |||
| bulletTypeDict: Final[dict] = { | |||
| MessageType.NULL_BULLET_TYPE: THUAI6.BulletType.NullBulletType, | |||
| MessageType.COMMON_BULLET: THUAI6.BulletType.CommonBullet, | |||
| MessageType.FAST_BULLET: THUAI6.BulletType.FastBullet, | |||
| MessageType.LINE_BULLET: THUAI6.BulletType.LineBullet, | |||
| MessageType.ORDINARY_BULLET: THUAI6.BulletType.OrdinaryBullet, | |||
| MessageType.ATOM_BOMB: THUAI6.BulletType.AtomBomb, } | |||
| # 用于将Proto的对象转为THUAI6的对象 | |||
| @staticmethod | |||
| def Protobuf2THUAI6Tricker(trickerMsg: Message2Clients.MessageOfTricker) -> THUAI6.Tricker: | |||
| @@ -109,12 +135,14 @@ class Proto2THUAI6(NoInstance): | |||
| tricker.y = trickerMsg.y | |||
| tricker.speed = trickerMsg.speed | |||
| tricker.damage = trickerMsg.damage | |||
| tricker.timeUntilSkillAvailable = trickerMsg.time_until_skill_available | |||
| for time in trickerMsg.time_until_skill_available: | |||
| tricker.timeUntilSkillAvailable.append(time) | |||
| tricker.place = Proto2THUAI6.placeTypeDict[trickerMsg.place] | |||
| tricker.prop = Proto2THUAI6.propTypeDict[trickerMsg.prop] | |||
| tricker.playerState = Proto2THUAI6.playerStateDict[trickerMsg.player_state] | |||
| for item in trickerMsg.prop: | |||
| tricker.prop.append(Proto2THUAI6.propTypeDict[item]) | |||
| tricker.trickerType = Proto2THUAI6.trickerTypeDict[trickerMsg.tricker_type] | |||
| tricker.guid = trickerMsg.guid | |||
| tricker.movable = trickerMsg.movable | |||
| tricker.playerID = trickerMsg.player_id | |||
| tricker.viewRange = trickerMsg.view_range | |||
| tricker.radius = trickerMsg.radius | |||
| @@ -130,19 +158,19 @@ class Proto2THUAI6(NoInstance): | |||
| student.y = studentMsg.y | |||
| student.speed = studentMsg.speed | |||
| student.determination = studentMsg.determination | |||
| student.failNum = studentMsg.fail_num | |||
| student.failTime = studentMsg.fail_time | |||
| student.emoTime = studentMsg.emo_time | |||
| student.timeUntilSkillAvailable = studentMsg.time_until_skill_available | |||
| student.addiction = studentMsg.addiction | |||
| for time in studentMsg.time_until_skill_available: | |||
| student.timeUntilSkillAvailable.append(time) | |||
| student.damage = studentMsg.damage | |||
| student.place = Proto2THUAI6.placeTypeDict[studentMsg.place] | |||
| student.prop = Proto2THUAI6.propTypeDict[studentMsg.prop] | |||
| for item in studentMsg.prop: | |||
| student.prop.append(Proto2THUAI6.propTypeDict[item]) | |||
| student.studentType = Proto2THUAI6.studentTypeDict[studentMsg.student_type] | |||
| student.guid = studentMsg.guid | |||
| student.state = Proto2THUAI6.studentStateDict[studentMsg.state] | |||
| student.playerState = Proto2THUAI6.playerStateDict[studentMsg.player_state] | |||
| student.playerID = studentMsg.player_id | |||
| student.viewRange = studentMsg.view_range | |||
| student.radius = studentMsg.radius | |||
| student.buff.clear() | |||
| for buff in studentMsg.buff: | |||
| student.buff.append(Proto2THUAI6.studentBuffTypeDict[buff]) | |||
| return student | |||
| @@ -159,6 +187,44 @@ class Proto2THUAI6(NoInstance): | |||
| prop.isMoving = propMsg.is_moving | |||
| return prop | |||
| @staticmethod | |||
| def Protobuf2THUAI6GameInfo(allMsg: Message2Clients.MessageOfAll): | |||
| gameInfo = THUAI6.GameInfo() | |||
| gameInfo.gameTime = allMsg.game_time | |||
| gameInfo.subjectLeft = allMsg.subject_left | |||
| gameInfo.studentGraduated = allMsg.student_graduated | |||
| gameInfo.studentQuited = allMsg.student_quited | |||
| gameInfo.studentScore = allMsg.student_score | |||
| gameInfo.trickerScore = allMsg.tricker_score | |||
| gameInfo.gateOpened = allMsg.gate_opened | |||
| gameInfo.hiddenGateOpened = allMsg.hidden_gate_opened | |||
| gameInfo.hiddenGateRefreshed = allMsg.hidden_gate_refreshed | |||
| return gameInfo | |||
| @staticmethod | |||
| def Protobuf2THUAI6Bullet(bulletMsg: Message2Clients.MessageOfBullet) -> THUAI6.Bullet: | |||
| bullet = THUAI6.Bullet() | |||
| bullet.x = bulletMsg.x | |||
| bullet.y = bulletMsg.y | |||
| bullet.bulletType = Proto2THUAI6.bulletTypeDict[bulletMsg.type] | |||
| bullet.facingDirection = bulletMsg.facing_direction | |||
| bullet.guid = bulletMsg.guid | |||
| bullet.team = Proto2THUAI6.playerTypeDict[bulletMsg.team] | |||
| bullet.place = Proto2THUAI6.placeTypeDict[bulletMsg.place] | |||
| bullet.bombRange = bulletMsg.bomb_range | |||
| return bullet | |||
| @staticmethod | |||
| def Protobuf2THUAI6BombedBullet(bulletMsg: Message2Clients.MessageOfBombedBullet) -> THUAI6.BombedBullet: | |||
| bullet = THUAI6.BombedBullet() | |||
| bullet.x = bulletMsg.x | |||
| bullet.y = bulletMsg.y | |||
| bullet.bulletType = Proto2THUAI6.bulletTypeDict[bulletMsg.type] | |||
| bullet.facingDirection = bulletMsg.facing_direction | |||
| bullet.mappingID = bulletMsg.mapping_id | |||
| bullet.bombRange = bulletMsg.bomb_range | |||
| return bullet | |||
| @staticmethod | |||
| def Protobuf2THUAI6Map(mapMsg: Message2Clients.MessageOfMap) -> List[List[THUAI6.PlaceType]]: | |||
| map = [] | |||
| @@ -177,18 +243,11 @@ class THUAI62Proto(NoInstance): | |||
| THUAI6.PlaceType.Land: MessageType.LAND, | |||
| THUAI6.PlaceType.Grass: MessageType.GRASS, | |||
| THUAI6.PlaceType.ClassRoom: MessageType.CLASSROOM, | |||
| THUAI6.PlaceType.BlackRoom: MessageType.BLACKROOM, | |||
| THUAI6.PlaceType.Gate: MessageType.GATE, | |||
| THUAI6.PlaceType.HiddenGate: MessageType.HIDDEN_GATE} | |||
| shapeTypeDict: Final[dict] = { | |||
| THUAI6.ShapeType.NullShapeType: MessageType.NULL_SHAPE_TYPE, | |||
| THUAI6.ShapeType.Square: MessageType.SQUARE, | |||
| THUAI6.ShapeType.Circle: MessageType.CIRCLE} | |||
| propTypeDict: Final[dict] = { | |||
| THUAI6.PropType.NullPropType: MessageType.NULL_PROP_TYPE, | |||
| THUAI6.PropType.PropType1: MessageType.PTYPE1, } | |||
| THUAI6.PlaceType.HiddenGate: MessageType.HIDDEN_GATE, | |||
| THUAI6.PlaceType.Door: MessageType.DOOR, | |||
| THUAI6.PlaceType.Chest: MessageType.CHEST, | |||
| THUAI6.PlaceType.Window: MessageType.WINDOW, } | |||
| playerTypeDict: Final[dict] = { | |||
| THUAI6.PlayerType.NullPlayerType: MessageType.NULL_PLAYER_TYPE, | |||
| @@ -203,30 +262,12 @@ class THUAI62Proto(NoInstance): | |||
| THUAI6.TrickerType.NullTrickerType: MessageType.NULL_TRICKER_TYPE, | |||
| THUAI6.TrickerType.TrickerType1: MessageType.TRICKERTYPE1, } | |||
| studentBuffTypeDict: Final[dict] = { | |||
| THUAI6.StudentBuffType.NullStudentBuffType: MessageType.NULL_SBUFF_TYPE, | |||
| THUAI6.StudentBuffType.StudentBuffType1: MessageType.SBUFFTYPE1, } | |||
| trickerBuffTypeDict: Final[dict] = { | |||
| THUAI6.TrickerBuffType.NullTrickerBuffType: MessageType.NULL_TBUFF_TYPE, | |||
| THUAI6.TrickerBuffType.TrickerBuffType1: MessageType.TBUFFTYPE1, } | |||
| studentStateDict: Final[dict] = { | |||
| THUAI6.StudentState.NullStudentState: MessageType.NULL_STATUS, | |||
| THUAI6.StudentState.Idle: MessageType.IDLE, | |||
| THUAI6.StudentState.Learning: MessageType.LEARNING, | |||
| THUAI6.StudentState.Fail: MessageType.FAIL, | |||
| THUAI6.StudentState.Emotional: MessageType.EMOTIONAL, | |||
| THUAI6.StudentState.Quit: MessageType.QUIT, | |||
| THUAI6.StudentState.Graduated: MessageType.GRADUATED, } | |||
| gameStateDict: Final[dict] = { | |||
| THUAI6.GameState.NullGameState: MessageType.NULL_GAME_STATE, | |||
| THUAI6.GameState.GameStart: MessageType.GAME_START, | |||
| THUAI6.GameState.GameRunning: MessageType.GAME_RUNNING, | |||
| THUAI6.GameState.GameEnd: MessageType.GAME_END} | |||
| propTypeDict: Final[dict] = { | |||
| THUAI6.PropType.NullPropType: MessageType.NULL_PROP_TYPE, | |||
| THUAI6.PropType.PropType1: MessageType.PTYPE1, } | |||
| # 用于将THUAI6的对象转为Proto的对象 | |||
| @staticmethod | |||
| def THUAI62ProtobufPlayer(playerID: int, playerType: THUAI6.PlayerType, studentType: THUAI6.StudentType, trickerType: THUAI6.TrickerType) -> Message2Server.PlayerMsg: | |||
| return Message2Server.PlayerMsg(player_id=playerID, player_type=THUAI62Proto.playerTypeDict[playerType], student_type=THUAI62Proto.studentTypeDict[studentType], tricker_type=THUAI62Proto.trickerTypeDict[trickerType]) | |||
| @@ -240,13 +281,13 @@ class THUAI62Proto(NoInstance): | |||
| return Message2Server.MoveMsg(player_id=id, angle=angle, time_in_milliseconds=time) | |||
| @staticmethod | |||
| def THUAI62ProtobufPick(prop: THUAI6.PropType, id: int) -> Message2Server.PickMsg: | |||
| return Message2Server.PickMsg(player_id=id, prop_type=THUAI62Proto.propTypeDict[prop]) | |||
| def THUAI62ProtobufPick(prop: THUAI6.PropType, id: int) -> Message2Server.PropMsg: | |||
| return Message2Server.PropMsg(player_id=id, prop_type=THUAI62Proto.propTypeDict[prop]) | |||
| @staticmethod | |||
| def THUAI62ProtobufSend(msg: str, toID: int, id: int) -> Message2Server.SendMsg: | |||
| return Message2Server.SendMsg(player_id=id, to_player_id=toID, message=msg) | |||
| @staticmethod | |||
| def THUAI62ProtobufTrick(angle: float, id: int) -> Message2Server.TrickMsg: | |||
| return Message2Server.TrickMsg(player_id=id, angle=angle) | |||
| def THUAI62ProtobufTrick(angle: float, id: int) -> Message2Server.AttackMsg: | |||
| return Message2Server.AttackMsg(player_id=id, angle=angle) | |||
| @@ -122,8 +122,7 @@ message MessageOfDoor | |||
| int32 x = 1; | |||
| int32 y = 2; | |||
| bool is_open = 3; | |||
| int32 number = 4; | |||
| int32 progress = 5; | |||
| int32 progress = 4; | |||
| } | |||
| message MessageOfChest | |||