Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int target_pos(lua_State* L)
- {
- LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
- int iQuestIndex = CQuestManager::instance().GetCurrentPC()->GetCurrentQuestIndex();
- if (!lua_isstring(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3))
- {
- sys_err("invalid argument, name: %s, quest_index %d", ch->GetName(), iQuestIndex);
- return 0;
- }
- PIXEL_POSITION pos;
- if (!SECTREE_MANAGER::instance().GetMapBasePositionByMapIndex(ch->GetMapIndex(), pos))
- {
- sys_err("cannot find base position in this map %d", ch->GetMapIndex());
- return 0;
- }
- int x = pos.x + (int) lua_tonumber(L, 2) * 100;
- int y = pos.y + (int) lua_tonumber(L, 3) * 100;
- CTargetManager::instance().CreateTarget(ch->GetPlayerID(),
- iQuestIndex,
- lua_tostring(L, 1),
- TARGET_TYPE_POS,
- x,
- y,
- (int) lua_tonumber(L, 4),
- lua_isstring(L, 5) ? lua_tostring(L, 5) : NULL,
- lua_isnumber(L, 6) ? (int)lua_tonumber(L, 6): 1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement