Browse Source

noob island gear

lakebane-new
FatBoy-DOTC 4 months ago
parent
commit
c0cb856961
  1. 45
      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

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

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

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

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

8
src/engine/objects/Contract.java

@ -214,6 +214,7 @@ public class Contract extends AbstractGameObject { @@ -214,6 +214,7 @@ public class Contract extends AbstractGameObject {
}
}
}
if(this.getObjectUUID() == 1202){ //rune merchant
for(MobEquipment me : this.sellInventory){
switch(me.getItemBase().getUUID()){
@ -272,6 +273,7 @@ public class Contract extends AbstractGameObject { @@ -272,6 +273,7 @@ public class Contract extends AbstractGameObject {
}
}
}
if(this.getObjectUUID() == 1201){ //disc merchant
for(MobEquipment me : this.sellInventory){
if(me.getItemBase().getName().equals("Prospector")){
@ -281,6 +283,12 @@ public class Contract extends AbstractGameObject { @@ -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;
}

4
src/engine/objects/Item.java

@ -233,7 +233,6 @@ public class Item extends AbstractWorldObject { @@ -233,7 +233,6 @@ public class Item extends AbstractWorldObject {
this.value = rs.getInt("item_value");
this.customName = rs.getString("item_name");
}
public static void _serializeForClientMsg(Item item, ByteBufferWriter writer)
@ -609,7 +608,7 @@ public class Item extends AbstractWorldObject { @@ -609,7 +608,7 @@ public class Item extends AbstractWorldObject {
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;
byte charges = 0;
@ -1206,6 +1205,7 @@ public class Item extends AbstractWorldObject { @@ -1206,6 +1205,7 @@ public class Item extends AbstractWorldObject {
}
public int getBaseValue() {
if (this.getItemBase() != null)
return this.getItemBase().getBaseValue();
return 0;

2
src/engine/objects/MobEquipment.java

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

Loading…
Cancel
Save