Browse Source

noob island gear

lakebane-new
FatBoy-DOTC 5 months ago
parent
commit
c0cb856961
  1. 47
      src/engine/devcmd/cmds/AddNPCCmd.java
  2. 17
      src/engine/net/client/ClientMessagePump.java
  3. 8
      src/engine/objects/Contract.java
  4. 4
      src/engine/objects/Item.java
  5. 2
      src/engine/objects/MobEquipment.java

47
src/engine/devcmd/cmds/AddNPCCmd.java

@ -13,6 +13,7 @@ import engine.Enum.GameObjectType;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.*; import engine.gameManager.*;
import engine.math.Vector3fImmutable;
import engine.objects.*; import engine.objects.*;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@ -31,7 +32,6 @@ public class AddNPCCmd extends AbstractDevCmd {
int contractID; int contractID;
String name = ""; String name = "";
int level = 0; int level = 0;
if (words.length < 2) { if (words.length < 2) {
this.sendUsage(pc); this.sendUsage(pc);
return; return;
@ -39,59 +39,54 @@ public class AddNPCCmd extends AbstractDevCmd {
try { try {
contractID = Integer.parseInt(words[0]); contractID = Integer.parseInt(words[0]);
level = Integer.parseInt(words[1]); level = Integer.parseInt(words[1]);
for (int i = 2; i < words.length; i++) { for (int i = 2; i < words.length; i++) {
name += words[i]; name += words[i];
if (i + 1 < words.length) if (i + 1 < words.length)
name += ""; name += "";
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throwbackError(pc, throwbackError(pc,
"Failed to parse supplied contractID or level to an Integer."); "Failed to parse supplied contractID or level to an Integer.");
return; // NaN return; // NaN
} }
Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID); Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
if (contract == null || level < 1 || level > 75) { if (contract == null || level < 1 || level > 75) {
throwbackError(pc, throwbackError(pc,
"Invalid addNPC Command. Need contract ID, and level"); "Invalid addNPC Command. Need contract ID, and level");
return; // NaN return; // NaN
} }
// Pick a random name // Pick a random name
if (name.isEmpty()) if (name.isEmpty())
name = NPCManager.getPirateName(contract.getMobbaseID()); name = NPCManager.getPirateName(contract.getMobbaseID());
Zone zone = ZoneManager.findSmallestZone(pc.getLoc()); Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (zone == null) { if (zone == null) {
throwbackError(pc, "Failed to find zone to place npc in."); throwbackError(pc, "Failed to find zone to place npc in.");
return; return;
} }
Building building = null;
if (target != null) if (target != null)
if (target.getObjectType() == GameObjectType.Building) { if (target.getObjectType() == GameObjectType.Building) {
Building parentBuilding = (Building) target; building = (Building)target;
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
return;
} }
NPC created;
NPC npc = NPC.createNPC(name, contractID, Guild guild = null;
pc.getLoc(), null, zone, (short) level, null); Vector3fImmutable loc;
if(building != null){
if (npc != null) { guild = building.getGuild();
WorldGrid.addObject(npc, pc); loc = building.loc;
ChatManager.chatSayInfo(pc, } else{
"NPC with ID " + npc.getDBID() + " added"); loc = pc.loc;
this.setResult(String.valueOf(npc.getDBID())); }
} else { created = NPC.createNPC(name, contractID, loc, guild, zone, (short)level, building);
throwbackError(pc, "Failed to create npc of contract type " created.bindLoc = loc;
+ contractID); if(building != null) {
Logger.error( created.buildingUUID = building.getObjectUUID();
"Failed to create npc of contract type " + contractID); created.building = building;
NPCManager.slotCharacterInBuilding(created);
} }
created.setLoc(created.bindLoc);
created.updateDatabase();
throwbackInfo(pc, "Created NPC with UUID: " + created.getObjectUUID());
} }
@Override @Override

17
src/engine/net/client/ClientMessagePump.java

@ -560,12 +560,19 @@ public class ClientMessagePump implements NetMsgHandler {
if (!itemManager.inventoryContains(i)) if (!itemManager.inventoryContains(i))
return; return;
//cannot delete gold
if(i.getItemBaseID() == 7)
return;
if (i.isCanDestroy()) if (i.isCanDestroy())
if (itemManager.delete(i) == true) { if (itemManager.delete(i)) {
int goldValue = i.getItemBase().getBaseValue(); int goldValue = i.getBaseValue();
if(i.getItemBase().isRune()) if(i.getItemBase().isRune())
goldValue = 500000; goldValue = 500000;
if(i.getItemBaseID() == 980066)
goldValue = 0;
if(goldValue > 0) if(goldValue > 0)
itemManager.addGoldToInventory(goldValue,false); itemManager.addGoldToInventory(goldValue,false);
@ -1251,6 +1258,8 @@ public class ClientMessagePump implements NetMsgHandler {
cost = sell.getBaseValue(); cost = sell.getBaseValue();
if(sell.getItemBaseID() == 980066)
cost = 0;
//apply damaged value reduction //apply damaged value reduction
float durabilityCurrent = sell.getDurabilityCurrent(); float durabilityCurrent = sell.getDurabilityCurrent();
@ -1450,7 +1459,7 @@ public class ClientMessagePump implements NetMsgHandler {
if(me.getItemBase().getType().equals(ItemType.RESOURCE) && npc.getContractID() == 900){ if(me.getItemBase().getType().equals(ItemType.RESOURCE) && npc.getContractID() == 900){
handleResourcePurchase(me,itemMan,sourcePlayer,ib); handleResourcePurchase(me,itemMan,sourcePlayer,ib);
}else { }else {
buy = Item.createItemForPlayer(sourcePlayer, ib); buy = Item.createItemForPlayer(sourcePlayer, ib, me.fromNoob);
if (buy != null) { if (buy != null) {
me.transferEnchants(buy); me.transferEnchants(buy);
itemMan.addItemToInventory(buy); itemMan.addItemToInventory(buy);
@ -1584,7 +1593,7 @@ public class ClientMessagePump implements NetMsgHandler {
} }
} }
if(!stacked){ if(!stacked){
Item buy = Item.createItemForPlayer(sourcePlayer, ib); Item buy = Item.createItemForPlayer(sourcePlayer, ib, false);
if (buy != null) { if (buy != null) {
me.transferEnchants(buy); me.transferEnchants(buy);
itemMan.addItemToInventory(buy); itemMan.addItemToInventory(buy);

8
src/engine/objects/Contract.java

@ -214,6 +214,7 @@ public class Contract extends AbstractGameObject {
} }
} }
} }
if(this.getObjectUUID() == 1202){ //rune merchant if(this.getObjectUUID() == 1202){ //rune merchant
for(MobEquipment me : this.sellInventory){ for(MobEquipment me : this.sellInventory){
switch(me.getItemBase().getUUID()){ switch(me.getItemBase().getUUID()){
@ -272,6 +273,7 @@ public class Contract extends AbstractGameObject {
} }
} }
} }
if(this.getObjectUUID() == 1201){ //disc merchant if(this.getObjectUUID() == 1201){ //disc merchant
for(MobEquipment me : this.sellInventory){ for(MobEquipment me : this.sellInventory){
if(me.getItemBase().getName().equals("Prospector")){ if(me.getItemBase().getName().equals("Prospector")){
@ -281,6 +283,12 @@ public class Contract extends AbstractGameObject {
} }
} }
} }
if(this.getObjectUUID() == 1502041) {//noob helper{
for(MobEquipment me : this.sellInventory){
me.magicValue = 1;
}
}
return this.sellInventory; return this.sellInventory;
} }

4
src/engine/objects/Item.java

@ -233,7 +233,6 @@ public class Item extends AbstractWorldObject {
this.value = rs.getInt("item_value"); this.value = rs.getInt("item_value");
this.customName = rs.getString("item_name"); this.customName = rs.getString("item_name");
} }
public static void _serializeForClientMsg(Item item, ByteBufferWriter writer) public static void _serializeForClientMsg(Item item, ByteBufferWriter writer)
@ -609,7 +608,7 @@ public class Item extends AbstractWorldObject {
writer.putIntAt(serialized, indexPosition); writer.putIntAt(serialized, indexPosition);
} }
public static Item createItemForPlayer(PlayerCharacter pc, ItemBase ib) { public static Item createItemForPlayer(PlayerCharacter pc, ItemBase ib, boolean fromNoob) {
Item item = null; Item item = null;
byte charges = 0; byte charges = 0;
@ -1206,6 +1205,7 @@ public class Item extends AbstractWorldObject {
} }
public int getBaseValue() { public int getBaseValue() {
if (this.getItemBase() != null) if (this.getItemBase() != null)
return this.getItemBase().getBaseValue(); return this.getItemBase().getBaseValue();
return 0; return 0;

2
src/engine/objects/MobEquipment.java

@ -35,6 +35,7 @@ public class MobEquipment extends AbstractGameObject {
private int pValue; private int pValue;
private int sValue; private int sValue;
int magicValue; int magicValue;
public boolean fromNoob = false;
private float dropChance = 0; private float dropChance = 0;
@ -106,7 +107,6 @@ public class MobEquipment extends AbstractGameObject {
public static void serializeForVendor(MobEquipment mobEquipment, ByteBufferWriter writer, float percent) throws SerializationException { public static void serializeForVendor(MobEquipment mobEquipment, ByteBufferWriter writer, float percent) throws SerializationException {
_serializeForClientMsg(mobEquipment, writer, false); _serializeForClientMsg(mobEquipment, writer, false);
int baseValue = mobEquipment.itemBase.getBaseValue() + mobEquipment.itemBase.getMagicValue();
writer.putInt(mobEquipment.magicValue); writer.putInt(mobEquipment.magicValue);
writer.putInt(mobEquipment.magicValue); writer.putInt(mobEquipment.magicValue);
} }

Loading…
Cancel
Save