| 8 | { |
| 9 | template <class TAction> |
| 10 | TAction * PrepareAction(OsiArgumentDesc const & args, GameActionType type) |
| 11 | { |
| 12 | auto character = FindCharacterByNameGuid(args[0].String); |
| 13 | if (character == nullptr) { |
| 14 | OsiError("Character '" << args[0].String << "' does not exist!"); |
| 15 | return nullptr; |
| 16 | } |
| 17 | |
| 18 | auto skillId = ToFixedString(args[1].String); |
| 19 | if (!skillId) { |
| 20 | OsiError("'" << args[1].String << "' is not a valid FixedString!"); |
| 21 | return nullptr; |
| 22 | } |
| 23 | |
| 24 | auto pos = args.GetVector(2); |
| 25 | |
| 26 | if (pos.x == -1.0f && pos.y == -1.0f && pos.z == -1.0f) { |
| 27 | pos = character->WorldPos; |
| 28 | } |
| 29 | |
| 30 | auto const & lib = gOsirisProxy->GetLibraryManager(); |
| 31 | auto actionMgr = lib.GetGameActionManager(); |
| 32 | |
| 33 | if (lib.CreateGameAction == nullptr || lib.AddGameAction == nullptr || actionMgr == nullptr) { |
| 34 | OsiError("Game Action maanger not available"); |
| 35 | return false; |
| 36 | } |
| 37 | |
| 38 | auto action = (TAction *)lib.CreateGameAction(actionMgr, type, 0); |
| 39 | |
| 40 | action->SkillId = skillId; |
| 41 | ObjectHandle characterHandle; |
| 42 | character->GetObjectHandle(&characterHandle); |
| 43 | action->OwnerHandle = characterHandle; |
| 44 | |
| 45 | action->Position = pos; |
| 46 | return action; |
| 47 | } |
| 48 | |
| 49 | bool CreateRain(OsiArgumentDesc & args) |
| 50 | { |
nothing calls this directly
no test coverage detected