Commit 85720790 authored by Akhmad Fakhoni Listiyan Dede's avatar Akhmad Fakhoni Listiyan Dede
Browse files

Fixing return for mix item

parent 8144ed99
......@@ -85,18 +85,18 @@ public class Database {
// System.out.println(saveOfferToTradeBox("553b64d23c892b2d5b772c74", 4, 5, 6, 2));
// addItemToInventory("553b6adc3c892b2edffa877c", 3);
// addItemToInventory("553b6adc3c892b2edffa877c", 2);
// addItemToInventory("553b6adc3c892b2edffa877c", 3);
// addItemToInventory("553b6adc3c892b2edffa877c", 4);
// addItemToInventory("553b6adc3c892b2edffa877c", 4);
// addItemToInventory("553b6adc3c892b2edffa877c", 4);
addItemToInventory("553b6adc3c892b2edffa877c", 3);
addItemToInventory("553b6adc3c892b2edffa877c", 2);
addItemToInventory("553b6adc3c892b2edffa877c", 3);
addItemToInventory("553b6adc3c892b2edffa877c", 4);
addItemToInventory("553b6adc3c892b2edffa877c", 4);
addItemToInventory("553b6adc3c892b2edffa877c", 4);
//
// System.out.println(saveOfferToTradeBox("553b6adc3c892b2edffa877c", 4, 1, 5, 3));
// getTradebox("553b64d23c892b2d5b772c74");
// changeLocalTradeboxToFalse("553c36143c892b1bbf7723d6");
System.out.println(isExist("sijc"));
// System.out.println(isExist("sijc"));
}
......@@ -205,7 +205,7 @@ public class Database {
inventory.set(resultItem, inventory.get(resultItem) + 1);
result = updateInventory(token, inventory);
}
}
return result;
}
......
......@@ -69,8 +69,11 @@ public class Message {
// System.out.println(move("553b17283c892b1a8d00961f", 2, 5));
getTradeBox("553b64d23c892b2d5b772c74");
sendFind("553b64d23c892b2d5b772c74", 4);
// getTradeBox("553b64d23c892b2d5b772c74");
// sendFind("553b64d23c892b2d5b772c74", 4);
System.out.println("Mix item: " + mixItem("553b6adc3c892b2edffa877c", 2, 3));
System.out.println("Get inventory: " + getInventory("553b6adc3c892b2edffa877c"));
System.out.println("Get tradebox: " + getTradeBox("553a1674179bf4356b7198d5"));
}
public static String callURL(String myURL) {
......@@ -442,20 +445,25 @@ public class Message {
// Save to database and Sending response
JSONObject jsonObj = new JSONObject();
if(result != 0 && Database.mixItem(token, item1, item2, result))
if(result != 0 )
{
try {
jsonObj.put("status", "ok");
jsonObj.put("item", result);
} catch (JSONException ex) {
response = error();
if(Database.mixItem(token, item1, item2, result))
{
try {
jsonObj.put("status", "ok");
jsonObj.put("item", result);
response = jsonObj.toString();
} catch (JSONException ex) {
response = error();
}
}
}
else
{
response = fail("Item not match");
else
{
response = fail("Insufficient");
}
}else{
response = fail("wrong mixture");
}
if(log)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment