Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. ALUA(dungeon_warp_local)
  2. {
  3. if (!lua_isnumber(L, 1))
  4. {
  5. sys_err("no map index argument");
  6. return 0;
  7. }
  8.  
  9. if (!lua_isnumber(L, 2) || !lua_isnumber(L, 3))
  10. {
  11. sys_err("no coodinate argument");
  12. return 0;
  13. }
  14.  
  15. long lMapIndex = (long) lua_tonumber(L, 1);
  16. const TMapRegion * region = SECTREE_MANAGER::instance().GetMapRegion(lMapIndex);
  17.  
  18. if (!region)
  19. {
  20. sys_err("invalid map index %d", lMapIndex);
  21. return 0;
  22. }
  23.  
  24. int x = (int) lua_tonumber(L, 2);
  25. int y = (int) lua_tonumber(L, 3);
  26.  
  27. if (x > region->ex - region->sx)
  28. {
  29. sys_err("x coordinate overflow max: %d input: %d", region->ex - region->sx, x);
  30. return 0;
  31. }
  32.  
  33. if (y > region->ey - region->sy)
  34. {
  35. sys_err("y coordinate overflow max: %d input: %d", region->ey - region->sy, y);
  36. return 0;
  37. }
  38.  
  39. CQuestManager::instance().GetCurrentCharacterPtr()->WarpSet(region->sx + x, region->sy + y);
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement