Populate Trunk with Familiars and Purchasable

- Doesn't persist through loads yet.  Need to modify gua still
This commit is contained in:
Julia Butenhoff 2022-07-21 23:53:30 -05:00
parent 81c995be48
commit 2557b09ce1
2 changed files with 40 additions and 3 deletions

View File

@ -144,6 +144,12 @@ public class ArkOneController implements TcpHandler {
case "glb":
responses.add(trunkPlugin.GetLootBalance());
break;
case "gfl":
responses.add(trunkPlugin.GetFamiliarsList());
break;
case "bf":
responses.add(trunkPlugin.BuyFamiliar(commandInfo));
break;
// Catch Unhandled Commands
default:

View File

@ -1,6 +1,10 @@
package com.icedberries.UBFunkeysServer.ArkOne.Plugins;
import org.springframework.stereotype.Service;
import org.w3c.dom.Element;
import java.util.Arrays;
import java.util.List;
@Service
public class TrunkPlugin {
@ -8,12 +12,39 @@ public class TrunkPlugin {
private final Integer LOOT_BALANCE = 2500;
public String GetUserAssets() {
//TODO: IMPLEMENT ME
return "<h10_0><gua></gua></h10_0>";
//TODO: IMPLEMENT ME TO READ FROM USER PROFILE
return "<h10_0><gua><m id=\"80041a\" /></gua></h10_0>";
}
public String GetLootBalance() {
return "<h10_0><glb b=\"" + LOOT_BALANCE + "\" /></h10_0>";
}
public String GetFamiliarsList() {
// Create list of all familiar IDs
List<String> familiarIds = Arrays.asList("80036a", "80035a", "80034a", "80033a", "80032a", "80031a", "80030a",
"80029a", "80028a", "80027a", "80026a", "80025a", "80017a", "80016a", "80015a", "80007a", "80006a",
"80005a", "80004a", "80003a", "80002a", "80001a", "80000a");
// Build the list
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("<h10_0><gfl>");
// Iterate over the IDs to append them
for (String id : familiarIds) {
stringBuilder.append("<f rid=\"" + id + "\" id=\"" + id + "\" c=\"100\" dc=\"50\" h=\"720\" d=\"false\" />");
}
// Add closing tags
stringBuilder.append("</gfl></h10_0>");
// Return the list
return stringBuilder.toString();
}
public String BuyFamiliar(Element element) {
// We always return LOOT_BALANCE so players are never charged for these items
return "<h10_0><bf id=\"" + element.getAttribute("id") + "\" b=\"" + LOOT_BALANCE + "\" /></h10_0>";
}
}