Advertisement
kolton

Untitled

Jan 7th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function NTSI_findItemGID(GID){
  2.     if (!gid) {
  3.         return false;
  4.     }
  5.  
  6.     var _itemunit = getUnit(4,-1,-1,GID);
  7.  
  8.     if (!_itemunit) { //retry to find item
  9.         var _itemfound = false;
  10.  
  11.         _itemunit = getUnit(4);
  12.  
  13.         if (_itemunit) {
  14.             do {
  15.                 if (_itemunit.gid == GID && (_itemunit.mode == 3 || _itemunit.mode == 5)) {                
  16.                     _itemfound = true;
  17.                     _itemunit = copyUnit(_itemunit);
  18.                     break;
  19.                 }
  20.             } while (_itemunit.getNext());
  21.  
  22.             if (!_itemfound) {
  23.                 //Dprint("finding failed "+GID);
  24.                 return false;
  25.             }                      
  26.         }
  27.     }
  28.  
  29.     if (_itemunit.mode === 3 || _itemunit.mode === 5) {
  30.         return _itemunit;
  31.     }
  32.    
  33.     return false;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement