| 501 | } |
| 502 | |
| 503 | void NpcScriptState::exportScriptState(json& j) |
| 504 | { |
| 505 | // Export current state |
| 506 | exportState(m_CurrentState, j["currentState"]); |
| 507 | |
| 508 | // Export next state |
| 509 | exportState(m_NextState, j["nextState"]); |
| 510 | |
| 511 | j["lastStateSymIndex"] = m_LastStateSymIndex; |
| 512 | |
| 513 | // TODO: Need other/victim/item? |
| 514 | |
| 515 | // Export routine |
| 516 | j["routines"] = json::array(); |
| 517 | for (const RoutineEntry& r : m_Routine.routine) |
| 518 | { |
| 519 | json jr; |
| 520 | jr["hoursStart"] = r.hoursStart; |
| 521 | jr["minutesStart"] = r.minutesStart; |
| 522 | jr["hoursEnd"] = r.hoursEnd; |
| 523 | jr["minutesEnd"] = r.minutesEnd; |
| 524 | jr["symFunc"] = r.symFunc; |
| 525 | jr["waypoint"] = r.waypoint; |
| 526 | jr["isOverlay"] = r.isOverlay; |
| 527 | |
| 528 | j["routines"].push_back(jr); |
| 529 | } |
| 530 | j["activeRoutineIdx"] = m_Routine.routineActiveIdx; |
| 531 | } |
| 532 | |
| 533 | void NpcScriptState::importScriptState(const json& j) |
| 534 | { |