Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 package npc.model.residences.fortress;
- 2
- 3 import org.mmocore.commons.dao.JdbcEntityState;
- 4 import org.mmocore.gameserver.data.xml.holder.NpcHolder;
- 5 import org.mmocore.gameserver.model.Player;
- 6 import org.mmocore.gameserver.model.entity.residence.Fortress;
- 7 import org.mmocore.gameserver.model.instances.NpcInstance;
- 8 import org.mmocore.gameserver.scripts.Functions;
- 9 import org.mmocore.gameserver.serverpackets.NpcHtmlMessage;
- 10 import org.mmocore.gameserver.templates.npc.NpcTemplate;
- 11 import org.mmocore.gameserver.utils.Location;
- 12
- 13 /**
- 14 * @author VISTALL
- 15 */
- 16 public class LogisticsOfficerInstance extends FacilityManagerInstance {
- 17 private static final int[] SUPPLY_NPC = new int[]
- 18 {
- 19 35665,
- 20 35697,
- 21 35734,
- 22 35766,
- 23 35803,
- 24 35834
- 25 };
- 26
- 27 private static final int ITEM_ID = 9910; // Blood Oath
- 28
- 29 public LogisticsOfficerInstance(int objectId, NpcTemplate template) {
- 30 super(objectId, template);
- 31 }
- 32
- 33 @Override
- 34 public void onBypassFeedback(Player player, String command) {
- 35 if (!canBypassCheck(player, this))
- 36 return;
- 37
- 38 Fortress fortress = getFortress();
- 39
- 40 if (!player.isClanLeader() || fortress.getOwnerId() != player.getClanId()) {
- 41 showChatWindow(player, "residence2/fortress/fortress_not_authorized.htm");
- 42 return;
- 43 }
- 44
- 45 if (command.equalsIgnoreCase("guardInfo")) {
- 46 if (fortress.getContractState() != Fortress.CONTRACT_WITH_CASTLE) {
- 47 showChatWindow(player, "residence2/fortress/fortress_supply_officer005.htm");
- 48 return;
- 49 }
- 50
- 51 showChatWindow(player, "residence2/fortress/fortress_supply_officer002.htm", "%guard_buff_level%", fortress.getFacilityLevel(Fortress.GUARD_BUFF));
- 52 } else if (command.equalsIgnoreCase("supplyInfo")) {
- 53 if (fortress.getContractState() != Fortress.CONTRACT_WITH_CASTLE) {
- 54 showChatWindow(player, "residence2/fortress/fortress_supply_officer005.htm");
- 55 return;
- 56 }
- 57
- 58 showChatWindow(player, "residence2/fortress/fortress_supply_officer009.htm", "%supply_count%", fortress.getSupplyCount());
- 59 } else if (command.equalsIgnoreCase("rewardInfo")) {
- 60 showChatWindow(player, "residence2/fortress/fortress_supply_officer010.htm", "%blood_oaths%", fortress.getRewardCount());
- 61 } else if (command.equalsIgnoreCase("receiveSupply")) {
- 62 String filename;
- 63 if (fortress.getSupplyCount() > 0 && player.getVar("supplyBox") == null) {
- 64 filename = "residence2/fortress/fortress_supply_officer016.htm";
- 65
- 66 NpcInstance npc = NpcHolder.getInstance().getTemplate(SUPPLY_NPC[fortress.getSupplyCount() - 1]).getNewInstance();
- 67 npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());
- 68 npc.spawnMe(new Location(getX() - 23, getY() + 41, getZ()));
- 69 player.setVar("supplyBox", "LogisticsOfficerFort", 43200000);
- 70 } else
- 71 filename = "residence2/fortress/fortress_supply_officer017.htm";
- 72
- 73 NpcHtmlMessage html = new NpcHtmlMessage(player, this);
- 74 html.setFile(filename);
- 75 player.sendPacket(html);
- 76 } else if (command.equalsIgnoreCase("receiveRewards")) {
- 77 String filename;
- 78 int count = fortress.getRewardCount();
- 79 if (count > 0) {
- 80 filename = "residence2/fortress/fortress_supply_officer013.htm";
- 81 fortress.setRewardCount(0);
- 82 fortress.setJdbcState(JdbcEntityState.UPDATED);
- 83 fortress.update();
- 84
- 85 Functions.addItem(player, ITEM_ID, count);
- 86 } else
- 87 filename = "residence2/fortress/fortress_supply_officer014.htm";
- 88
- 89 NpcHtmlMessage html = new NpcHtmlMessage(player, this);
- 90 html.setFile(filename);
- 91 player.sendPacket(html);
- 92 } else if (command.equalsIgnoreCase("toLevel1"))
- 93 buyFacility(player, Fortress.GUARD_BUFF, 1, 100000);
- 94 else if (command.equalsIgnoreCase("toLevel2"))
- 95 buyFacility(player, Fortress.GUARD_BUFF, 2, 150000);
- 96 else
- 97 super.onBypassFeedback(player, command);
- 98 }
- 99
- 100 @Override
- 101 public void showChatWindow(Player player, int val, Object... arg) {
- 102 showChatWindow(player, "residence2/fortress/fortress_supply_officer001.htm");
- 103 }
- 104 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement