wolfrpg_map_parser/command/set_variable_plus_command/
target.rs

1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3
4#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5#[derive(PartialEq, Clone)]
6pub enum Target {
7    CurrentMapId            = 0x00000000,
8    PlayingBGM              = 0x00000001,
9    PlayingBGS              = 0x00000002,
10    BGMPosition             = 0x00000003,
11    BGSPosition             = 0x00000004,
12    CurrentBGMLength        = 0x00000005,
13    CurrentBGSLength        = 0x00000006,
14    MouseLeftClick          = 0x00000007,
15    MouseRightClick         = 0x00000008,
16    MouseMiddleClick        = 0x00000009,
17    MouseWheelDelta         = 0x0000000a,
18    MouseXDelta             = 0x0000000b,
19    MouseYDelta             = 0x0000000c,
20    EventIDAtMousePosition  = 0x0000000d,
21    CallerId                = 0x0000000e,
22    MapWidth                = 0x0000000f,
23    MapHeight               = 0x00000010,
24    ThisCommonId            = 0x00000011,
25    ActiveEventId           = 0x00000012,
26    ActiveEventLine         = 0x00000013,
27    MouseX                  = 0x00000014,
28    MouseY                  = 0x00000015,
29    Unknown
30}
31
32impl Target {
33    pub const fn new(target: u32) -> Self {
34        match target {
35            0x00000000 => Target::CurrentMapId,
36            0x00000001 => Target::PlayingBGM,
37            0x00000002 => Target::PlayingBGS,
38            0x00000003 => Target::BGMPosition,
39            0x00000004 => Target::BGSPosition,
40            0x00000005 => Target::CurrentBGMLength,
41            0x00000006 => Target::CurrentBGSLength,
42            0x00000007 => Target::MouseLeftClick,
43            0x00000008 => Target::MouseRightClick,
44            0x00000009 => Target::MouseMiddleClick,
45            0x0000000a => Target::MouseWheelDelta,
46            0x0000000b => Target::MouseXDelta,
47            0x0000000c => Target::MouseYDelta,
48            0x0000000d => Target::EventIDAtMousePosition,
49            0x0000000e => Target::CallerId,
50            0x0000000f => Target::MapWidth,
51            0x00000010 => Target::MapHeight,
52            0x00000011 => Target::ThisCommonId,
53            0x00000012 => Target::ActiveEventId,
54            0x00000013 => Target::ActiveEventLine,
55            0x00000014 => Target::MouseX,
56            0x00000015 => Target::MouseY,
57            _ => Target::Unknown
58        }
59    }
60}