-
Notifications
You must be signed in to change notification settings - Fork 7
/
Mass-Move.js
180 lines (159 loc) · 4.88 KB
/
Mass-Move.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
////////////////////////////////////////////////////////////////////////////////
// ~ Mass Move ~ //
// - Taldor / Quin - //
////////////////////////////////////////////////////////////////////////////////
//
// Presouvani itemu od nekud nekam :p
//
// Pouziti:
// Hotkey -> Run script :
// MassMove()
//
////////////////////////////////////////////////////////////////////////////////
function MassMove() {
var itemToMove = "itemToMove";
var containerMoveTo = "containerMoveTo";
Orion.RemoveObject(itemToMove);
Orion.RemoveObject(containerMoveTo);
Orion.CancelTarget();
var attempt = 0;
Orion.Print("Select type of object which you want to move...");
Orion.AddObject(itemToMove);
while (true) {
if (!Orion.HaveTarget() || attempt > 50) {
break;
}
Orion.Wait(200);
attempt++;
}
objType = Orion.FindObject(itemToMove).Graphic();
containerFrom = Orion.FindObject(itemToMove).Container();
if (Orion.FindObject(itemToMove)) {
Orion.Print("Object type to move is selected. Type is: " + objType);
Orion.Print("Container ID which contains items to move is: " + containerFrom);
} else {
Orion.Print("Object to move didn't selected till timeout, exiting...");
return false;
}
Orion.Print("Select container to move to...");
Orion.AddObject(containerMoveTo);
attempt = 0;
while (true) {
if (!Orion.HaveTarget() || attempt > 50) {
break;
}
Orion.Wait(200);
attempt++;
}
if (Orion.FindObject(containerMoveTo)) {
Orion.Print("Containter to move to is selected. ID is: " + Orion.FindObject(containerMoveTo).Serial());
} else {
Orion.Print("Container to move items to didn't selected till timeout, exiting...");
return false;
}
var found = Orion.FindType(objType, -1, container = containerFrom);
for (i = 0; i < found.length; i++) {
Orion.MoveItem(found[i], -1, container = containerMoveTo);
Orion.Wait(900);
}
Orion.Print("All items has been moved successfully!");
return true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function GrabItem() {
//OpenCorpse();
if (!Orion.HaveTarget() )
{
var toMove = Orion.FindObject('toMove');
if( toMove !== null | toMove !== 0 )
{
Orion.RemoveObject('toMove');
}
Orion.Print( '-1', 'Target something to grab.');
Orion.AddObject('toMove');
while(Orion.HaveTarget())
{
Orion.Wait('50');
}
toMove = Orion.FindObject('toMove');
if ( toMove !== null ) {
Orion.MoveItem( toMove.Serial(), 'all' , backpack);
}
}
}
function OrganizeFromList(frombag, tobag, listname, amount) { //sub function for moving items around
var item = Orion.FindList(listname, frombag);
if ( item !== null ) {
Orion.CharPrint('self', '906', 'moving items');
for (var i = 0; i < item.length; i++) {
Orion.MoveItem(item[i], amount, tobag);
Orion.Wait(700);
}
}
else
Orion.CharPrint('self', '906', 'item not found');
}
function OrganizeToBackpack(listname, amount) {
var frombag = Orion.FindObject('fromBag');
if( frombag !== null | frombag !== 0 )
{
Orion.RemoveObject('fromBag');
}
Orion.Print( '-1', 'Target container to move to.');
Orion.AddObject('fromBag');
while(Orion.HaveTarget())
{
Orion.Wait('50');
}
frombag = Orion.FindObject('fromBag');
if ( frombag !== null ) {
OrganizeFromList( frombag.Serial(), backpack, listname, amount);
}
}
function OrganizeFromBackpack(listname, amount) {
var tobag = Orion.FindObject('toBag');
if( tobag !== null | tobag !== 0 )
{
Orion.RemoveObject('toBag');
}
Orion.Print( '-1', 'Target container to move from.');
Orion.AddObject('toBag');
while(Orion.HaveTarget())
{
Orion.Wait('50');
}
tobag = Orion.FindObject('toBag');
if ( tobag !== null ) {
OrganizeFromList( backpack, tobag.Serial(), listname, amount);
}
}
function OrganizeThisToThat(listname, amount) {
Orion.RemoveObject('MoveFrom');
Orion.RemoveObject('MoveTo');
if (!Orion.FindObject('MoveFrom') ) {
Orion.CharPrint('self', '906', 'select move from bag');
Orion.AddObject('MoveFrom');
WaitForPlayerToTarget(0);
}
if (!Orion.FindObject('MoveTo') ) {
Orion.CharPrint('self', '906', 'select move to bag');
Orion.AddObject('MoveTo');
WaitForPlayerToTarget(0);
}
if ( 'MoveFrom' !== null && 'MoveTo' !== null ) {
OrganizeFromList( 'MoveFrom', 'MoveTo', listname, amount);
}
}
function WaitForPlayerToTarget(a) {
while(Orion.HaveTarget()) {
Orion.Wait(100);
}
}
function WaitForTargetCursor(a) {
while (!Orion.HaveTarget()) {
Orion.Wait(100);
break;
}
}