mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 00:32:06 +00:00
Cats/kalphite queen/random (#313)
- Did some work with the kalphite queen
This commit is contained in:
committed by
Daniel Ginovker
parent
17e5e7ea5c
commit
c5c1c2fc35
@@ -23,6 +23,7 @@ public class Npc {
|
||||
public int summonedBy, size;
|
||||
public int focusPointX, focusPointY, masterId;
|
||||
public boolean turnUpdateRequired;
|
||||
public int chasingRat = -1;
|
||||
|
||||
/**
|
||||
* attackType: 0 = melee, 1 = range, 2 = mage
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.rebotted.game.content.skills.core.Fishing;
|
||||
import com.rebotted.game.content.skills.crafting.Tanning;
|
||||
import com.rebotted.game.content.skills.thieving.Pickpocket;
|
||||
import com.rebotted.game.content.traveling.Sailing;
|
||||
import com.rebotted.game.npcs.impl.Pets;
|
||||
import com.rebotted.game.players.Player;
|
||||
import com.rebotted.game.players.PlayerAssistant;
|
||||
import com.rebotted.game.shops.ShopAssistant;
|
||||
@@ -21,6 +22,7 @@ public class NpcActions {
|
||||
|
||||
public void firstClickNpc(int npcType) {
|
||||
c.clickNpcType = 0;
|
||||
c.rememberNpcIndex = c.npcClickIndex;
|
||||
c.npcClickIndex = 0;
|
||||
Shops.dialogueShop(c, npcType);
|
||||
if (Pickpocket.isNPC(c, npcType)) {
|
||||
@@ -30,6 +32,15 @@ public class NpcActions {
|
||||
if (Fishing.fishingNPC(c, npcType)) {
|
||||
Fishing.fishingNPC(c, 1, npcType);
|
||||
}
|
||||
if (Pets.isCat(npcType)) {
|
||||
if (NpcHandler.npcs[c.rememberNpcIndex].spawnedBy == c.playerId) {
|
||||
c.getSummon().pickUpPet(c, c.summonId);
|
||||
c.hasNpc = false;
|
||||
c.summonId = -1;
|
||||
} else {
|
||||
c.getPacketSender().sendMessage("This is not your pet.");
|
||||
}
|
||||
}
|
||||
switch (npcType) {
|
||||
case 209:
|
||||
c.getDialogueHandler().sendDialogues(3500, 209);
|
||||
@@ -814,28 +825,6 @@ public class NpcActions {
|
||||
}
|
||||
break;
|
||||
|
||||
case 3506:
|
||||
case 3507:
|
||||
case 761:
|
||||
case 760:
|
||||
case 762:
|
||||
case 763:
|
||||
case 764:
|
||||
case 765:
|
||||
case 766:
|
||||
case 767:
|
||||
case 768:
|
||||
case 769:
|
||||
case 770:
|
||||
case 771:
|
||||
case 772:
|
||||
case 773:
|
||||
case 3505:
|
||||
c.getSummon().pickUpClean(c, c.summonId);
|
||||
c.hasNpc = false;
|
||||
c.summonId = 0;
|
||||
break;
|
||||
|
||||
case 804:
|
||||
case 1041:
|
||||
Tanning.sendTanningInterface(c);
|
||||
@@ -996,9 +985,12 @@ public class NpcActions {
|
||||
if (Fishing.fishingNPC(c, npcType)) {
|
||||
Fishing.fishingNPC(c, 2, npcType);
|
||||
}
|
||||
if (npcType >= 761 && npcType <= 773 || npcType > 3504
|
||||
&& npcType < 3508 && npcType != 767) {
|
||||
c.getDialogueHandler().sendDialogues(908, npcType);
|
||||
if (Pets.isCat(npcType)) {
|
||||
if (NpcHandler.npcs[c.rememberNpcIndex].spawnedBy == c.playerId) {
|
||||
c.getDialogueHandler().sendDialogues(908, npcType);
|
||||
} else {
|
||||
c.getPacketSender().sendMessage("This is not your pet.");
|
||||
}
|
||||
}
|
||||
|
||||
switch (npcType) {
|
||||
@@ -1141,11 +1133,12 @@ public class NpcActions {
|
||||
Pickpocket.attemptPickpocket(c, npcType);
|
||||
return;
|
||||
}
|
||||
if (npcType >= 761 && npcType <= 773 && npcType != 767) {
|
||||
if (NpcHandler.npcs[c.rememberNpcIndex].spawnedBy == c.playerId)
|
||||
if (Pets.isCat(npcType)) {
|
||||
if (NpcHandler.npcs[c.rememberNpcIndex].spawnedBy == c.playerId) {
|
||||
c.getDialogueHandler().sendDialogues(910, npcType);
|
||||
else
|
||||
c.getPacketSender().sendMessage("This isn't your cat.");
|
||||
} else {
|
||||
c.getPacketSender().sendMessage("This is not your pet.");
|
||||
}
|
||||
}
|
||||
switch (npcType) {
|
||||
|
||||
|
||||
@@ -54,14 +54,6 @@ public class NpcData {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* public static boolean isAggressive(int i) { if
|
||||
* (NPCHandler.npcs[i].aggressive && !onlyMage(NPCHandler.npcs[i].npcType))
|
||||
* { return true; } if (NPCHandler.npcs[i].inWild() &&
|
||||
* NPCHandler.npcs[i].MaxHP > 0 && !onlyMage(NPCHandler.npcs[i].npcType)) {
|
||||
* return true; } return false; }
|
||||
*/
|
||||
|
||||
public static int getNpcKillerId(int npcId) {
|
||||
int oldDamage = 0;
|
||||
int killerId = 0;
|
||||
@@ -256,6 +248,9 @@ public class NpcData {
|
||||
**/
|
||||
public static int getRespawnTime(int i) {
|
||||
switch (NpcHandler.npcs[i].npcType) {
|
||||
case 1158:
|
||||
case 1160:
|
||||
return -1;
|
||||
case 2881:
|
||||
case 2882:
|
||||
case 2883:
|
||||
|
||||
@@ -7,6 +7,9 @@ import java.io.IOException;
|
||||
|
||||
import com.rebotted.GameConstants;
|
||||
import com.rebotted.GameEngine;
|
||||
import com.rebotted.event.CycleEvent;
|
||||
import com.rebotted.event.CycleEventContainer;
|
||||
import com.rebotted.event.CycleEventHandler;
|
||||
import com.rebotted.game.content.combat.CombatConstants;
|
||||
import com.rebotted.game.content.combat.npcs.NpcAggressive;
|
||||
import com.rebotted.game.content.combat.npcs.NpcCombat;
|
||||
@@ -19,6 +22,7 @@ import com.rebotted.game.content.randomevents.RandomEventHandler;
|
||||
import com.rebotted.game.content.randomevents.RiverTroll;
|
||||
import com.rebotted.game.npcs.drops.ItemDrop;
|
||||
import com.rebotted.game.npcs.drops.NPCDropsHandler;
|
||||
import com.rebotted.game.npcs.impl.Pets;
|
||||
import com.rebotted.game.players.Client;
|
||||
import com.rebotted.game.players.Player;
|
||||
import com.rebotted.game.players.PlayerHandler;
|
||||
@@ -33,6 +37,101 @@ public class NpcHandler {
|
||||
public static int maxListedNPCs = 4000;
|
||||
public static Npc npcs[] = new Npc[MAX_NPCS];
|
||||
public static NpcList NpcList[] = new NpcList[maxListedNPCs];
|
||||
|
||||
public void spawnSecondForm(Player c, final int i) {
|
||||
// npcs[i].gfx0(1055);
|
||||
CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
|
||||
@Override
|
||||
public void execute(CycleEventContainer container) {
|
||||
spawnNpc2(1160, npcs[i].absX, npcs[i].absY, 0, 1, 230, 45, 500, 300, true);
|
||||
container.stop();
|
||||
}
|
||||
@Override
|
||||
public void stop() {
|
||||
|
||||
}
|
||||
}, 15);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* kq respawn first form
|
||||
*/
|
||||
public void spawnFirstForm(Player c, final int i) {
|
||||
CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
|
||||
@Override
|
||||
public void execute(CycleEventContainer container) {
|
||||
spawnNpc2(1158, npcs[i].absX, npcs[i].absY, 0, 1, 230, 45, 500, 300, true);
|
||||
container.stop();
|
||||
}
|
||||
@Override
|
||||
public void stop() {
|
||||
|
||||
}
|
||||
}, 15);
|
||||
}
|
||||
|
||||
|
||||
public void catchRat(final int npcIndex) {
|
||||
int foundRat = -1;
|
||||
for (int i = 0; i < MAX_NPCS; i++) {
|
||||
if (npcs[i] == null || foundRat != -1) {
|
||||
continue;
|
||||
}
|
||||
if(npcs[i].npcType == 47 && !npcs[i].isDead) {
|
||||
if(goodDistance(npcs[npcIndex].absX, npcs[npcIndex].absY, npcs[i].absX, npcs[i].absY, 5)) {
|
||||
foundRat = i;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
final Client slaveOwner = (PlayerHandler.players[npcs[npcIndex].summonedBy] != null ? (Client) PlayerHandler.players[npcs[npcIndex].summonedBy] : null);
|
||||
if(foundRat == -1) {
|
||||
if(slaveOwner != null) {
|
||||
slaveOwner.getPacketSender().sendMessage("The " + getNpcListName(NpcHandler.npcs[npcIndex].npcType) + " can't seem to find any rats nearby.");
|
||||
}
|
||||
} else {
|
||||
npcs[npcIndex].chasingRat = foundRat;
|
||||
boolean beatChance = (Misc.random(2) == 1 ? true : false);
|
||||
CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() {
|
||||
@Override
|
||||
public void execute(CycleEventContainer container) {
|
||||
if(npcs[npcIndex].absX == npcs[npcs[npcIndex].chasingRat].absX && npcs[npcIndex].absY == npcs[npcs[npcIndex].chasingRat].absY && (beatChance || npcs[npcIndex].npcType >= 768 && npcs[npcIndex].npcType <= 773)) {
|
||||
npcs[npcs[npcIndex].chasingRat].isDead = true;
|
||||
npcs[npcs[npcIndex].chasingRat].forceChat("Eek!");
|
||||
npcs[npcIndex].forceChat("Meow!");
|
||||
//startAnimation(9163, npcIndex);
|
||||
slaveOwner.getPacketSender().sendMessage("The " + getNpcListName(NpcHandler.npcs[npcIndex].npcType) + " caught a rat!");
|
||||
if(npcs[npcIndex].npcType >= 761 && npcs[npcIndex].npcType <= 766)
|
||||
slaveOwner.ratsCaught++;
|
||||
if(slaveOwner.ratsCaught == Pets.RATS_NEEDED_TO_GROW) {
|
||||
slaveOwner.getPacketSender().sendMessage("Your kitten has grown into a cat!");
|
||||
int newNpcId = npcs[npcIndex].npcType+7;
|
||||
int[] coords = {npcs[npcIndex].absX, npcs[npcIndex].absY, npcs[npcIndex].heightLevel};
|
||||
spawnNpc3(slaveOwner, newNpcId, coords[0], coords[1], coords[2], 0, 120, 25, 200, 200, true, false, true);
|
||||
npcs[npcIndex].absX = 0;
|
||||
npcs[npcIndex].absY = 0;
|
||||
npcs[npcIndex] = null;
|
||||
//Spawns grown cat in spot of kitten.
|
||||
slaveOwner.summonId = Pets.summonItemId(newNpcId);
|
||||
slaveOwner.ratsCaught = 0;
|
||||
}
|
||||
npcs[npcIndex].chasingRat = -1;
|
||||
} else {
|
||||
if(slaveOwner != null)
|
||||
slaveOwner.getPacketSender().sendMessage("The " + getNpcListName(NpcHandler.npcs[npcIndex].npcType) + " failed to catch the rat.");
|
||||
npcs[npcIndex].chasingRat = -1;
|
||||
}
|
||||
container.stop();
|
||||
}
|
||||
@Override
|
||||
public void stop() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}, 4);
|
||||
}
|
||||
}
|
||||
|
||||
public NpcHandler() {
|
||||
for (int i = 0; i < MAX_NPCS; i++) {
|
||||
@@ -139,15 +238,6 @@ public class NpcHandler {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int npcSize(int i) {
|
||||
switch (npcs[i].npcType) {
|
||||
case 2883:
|
||||
case 2882:
|
||||
case 2881:
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summon npc, barrows, etc
|
||||
@@ -201,7 +291,7 @@ public class NpcHandler {
|
||||
npcs[slot] = newNPC;
|
||||
}
|
||||
|
||||
public void spawnNpc2(int npcType, int x, int y, int heightLevel, int WalkingType, int HP, int maxHit, int attack, int defence) {
|
||||
public void spawnNpc2(int npcType, int x, int y, int heightLevel, int WalkingType, int HP, int maxHit, int attack, int defence, boolean attackPlayer) {
|
||||
// first, search for a free slot
|
||||
int slot = -1;
|
||||
for (int i = 1; i < MAX_NPCS; i++) {
|
||||
@@ -225,6 +315,9 @@ public class NpcHandler {
|
||||
newNPC.MaxHP = HP;
|
||||
newNPC.maxHit = maxHit;
|
||||
newNPC.attack = attack;
|
||||
if (attackPlayer) {
|
||||
newNPC.underAttack = true;
|
||||
}
|
||||
newNPC.defence = defence;
|
||||
npcs[slot] = newNPC;
|
||||
}
|
||||
@@ -356,6 +449,13 @@ public class NpcHandler {
|
||||
npcs[i].absX = slaveOwner.absX;
|
||||
npcs[i].absY = slaveOwner.absY - 1;
|
||||
}
|
||||
|
||||
if (slaveOwner != null && slaveOwner.hasNpc && npcs[i].summoner) {
|
||||
if (slaveOwner.goodDistance(npcs[i].absX, npcs[i].absY, slaveOwner.absX, slaveOwner.absY, 15)) {
|
||||
NpcHandler.followPlayer(i, slaveOwner.playerId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (npcs[i].actionTimer > 0) {
|
||||
npcs[i].actionTimer--;
|
||||
@@ -385,7 +485,7 @@ public class NpcHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (npcs[i].spawnedBy > 0) { // delete summons npc
|
||||
if (npcs[i].spawnedBy > 0) {
|
||||
if (PlayerHandler.players[npcs[i].spawnedBy] == null
|
||||
|| PlayerHandler.players[npcs[i].spawnedBy].heightLevel != npcs[i].heightLevel
|
||||
|| PlayerHandler.players[npcs[i].spawnedBy].respawnTimer > 0
|
||||
@@ -393,11 +493,10 @@ public class NpcHandler {
|
||||
|
||||
if (npcs[i].npcType == FightCaves.YT_HURKOT) {
|
||||
Player c = ((Client)PlayerHandler.players[npcs[i].spawnedBy]);
|
||||
int ranHeal = Misc.random(19);
|
||||
if (ranHeal == 19)
|
||||
int ranHeal = Misc.random(10);
|
||||
if (ranHeal == 10)
|
||||
FightCaves.healJad(c, i);
|
||||
}
|
||||
|
||||
if (PlayerHandler.players[npcs[i].spawnedBy] != null) {
|
||||
for (int o = 0; o < PlayerHandler.players[npcs[i].spawnedBy].barrowsNpcs.length; o++) {
|
||||
if (npcs[i].npcType == PlayerHandler.players[npcs[i].spawnedBy].barrowsNpcs[o][0]) {
|
||||
@@ -552,12 +651,11 @@ public class NpcHandler {
|
||||
&& npcs[i].needRespawn == false) {
|
||||
npcs[i].updateRequired = true;
|
||||
npcs[i].facePlayer(0);
|
||||
if (npcs[i].killedBy <= 0)
|
||||
npcs[i].killedBy = NpcData.getNpcKillerId(i);
|
||||
npcs[i].animNumber = NpcEmotes.getDeadEmote(i); // dead
|
||||
// emote
|
||||
Player c = (Client) PlayerHandler.players[npcs[i].killedBy];
|
||||
if (c != null) {
|
||||
if (npcs[i].killedBy <= 0)
|
||||
npcs[i].killedBy = NpcData.getNpcKillerId(i);
|
||||
npcs[i].animNumber = NpcEmotes.getDeadEmote(c, i); // dead emote
|
||||
if (CombatConstants.COMBAT_SOUNDS
|
||||
&& NpcHandler.npcs[i].npcType < 3177
|
||||
&& NpcHandler.npcs[i].npcType > 3180) {
|
||||
@@ -653,8 +751,7 @@ public class NpcHandler {
|
||||
GameEngine.objectManager.removeObject(npcs[i].absX,
|
||||
npcs[i].absY);
|
||||
}
|
||||
} else if (npcs[i].actionTimer == 0
|
||||
&& npcs[i].needRespawn == true) {
|
||||
} else if (npcs[i].actionTimer == 0 && npcs[i].needRespawn == true && npcs[i].npcType != 1158) {
|
||||
if (npcs[i].spawnedBy > 0) {
|
||||
npcs[i] = null;
|
||||
} else {
|
||||
@@ -735,6 +832,12 @@ public class NpcHandler {
|
||||
|
||||
public static boolean multiAttacks(int i) {
|
||||
switch (npcs[i].npcType) {
|
||||
case 1158: //kq
|
||||
if (npcs[i].attackType == 2)
|
||||
return true;
|
||||
case 1160: //kq
|
||||
if (npcs[i].attackType == 1)
|
||||
return true;
|
||||
case 2558:
|
||||
return true;
|
||||
case 2562:
|
||||
@@ -1200,7 +1303,8 @@ public class NpcHandler {
|
||||
}
|
||||
|
||||
public static void handleSpecialEffects(Player c, int i, int damage) {
|
||||
if (npcs[i].npcType == 2892 || npcs[i].npcType == 2894) {
|
||||
if (npcs[i].npcType == 2892 || npcs[i].npcType == 2894 || npcs[i].npcType == 1158
|
||||
|| npcs[i].npcType == 1160) {
|
||||
if (damage > 0) {
|
||||
if (c != null) {
|
||||
if (c.playerLevel[5] > 0) {
|
||||
@@ -1226,6 +1330,8 @@ public class NpcHandler {
|
||||
|
||||
public static int getMaxHit(int i) {
|
||||
switch (npcs[i].npcType) {
|
||||
case 1158:
|
||||
return 30;
|
||||
case 2558:
|
||||
if (npcs[i].attackType == 2) {
|
||||
return 28;
|
||||
@@ -1338,7 +1444,7 @@ public class NpcHandler {
|
||||
for (int i = 0; i < maxListedNPCs; i++) {
|
||||
if (NpcList[i] != null) {
|
||||
if (NpcList[i].npcId == npcId) {
|
||||
return NpcList[i].npcName;
|
||||
return NpcList[i].npcName.replace("_", " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1408,6 +1514,9 @@ public class NpcHandler {
|
||||
public boolean getNpcListAggressive(int npcId) {
|
||||
return NPCDefinition.forId(npcId).isAggressive();
|
||||
}
|
||||
|
||||
|
||||
public int getNpcSize(int npcId) {
|
||||
return NPCDefinition.forId(npcId).getSize();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,91 +1,126 @@
|
||||
package com.rebotted.game.npcs.impl;
|
||||
|
||||
import com.rebotted.GameEngine;
|
||||
import com.rebotted.game.npcs.Npc;
|
||||
import com.rebotted.game.npcs.NpcHandler;
|
||||
import com.rebotted.game.players.Client;
|
||||
import com.rebotted.game.players.Player;
|
||||
import com.rebotted.game.players.PlayerSave;
|
||||
import com.rebotted.world.clip.Region;
|
||||
|
||||
public class Pets {
|
||||
|
||||
public static final int RATS_NEEDED_TO_GROW = 10;
|
||||
|
||||
private final int[][] catArray = { { 3505, 7583 }, { 3506, 7584 },
|
||||
{ 766, 1560 }, { 3507, 7585 }, { 765, 1559 }, { 764, 1558 },
|
||||
{ 763, 1557 }, { 762, 1556 }, { 761, 1555 }, { 768, 1561 },
|
||||
{ 769, 1562 }, { 770, 1563 }, { 771, 1564 }, { 772, 1565 },
|
||||
{ 773, 1566 } };
|
||||
//npc id, item id
|
||||
private final static int[][] CATS = {
|
||||
{ 3504, 7583 }, //hell kitten
|
||||
{ 3506, 7584 }, //lazy hell kitten
|
||||
{ 766, 1560 }, //pet kitten
|
||||
{ 3507, 7585 }, //wily hellcat
|
||||
{ 765, 1559 }, //pet kitten
|
||||
{ 764, 1558 }, //pet kitten
|
||||
{ 763, 1557 }, //pet kitten
|
||||
{ 762, 1556 }, //pet kitten
|
||||
{ 761, 1555 }, //pet kitten
|
||||
{ 768, 1561 }, //pet cat
|
||||
{ 769, 1562 }, //pet cat
|
||||
{ 770, 1563 }, //pet cat
|
||||
{ 771, 1564 }, //pet cat
|
||||
{ 772, 1565 },//pet cat
|
||||
{ 773, 1566 } //pet cat
|
||||
};
|
||||
|
||||
public static final int[] CAT_ITEMS = { 1555, 1556, 1557, 1558, 1559, 1560,
|
||||
1561, 1562, 1563, 1564, 1565, 7585, 7584 };
|
||||
|
||||
public void pickUp(Client c, int Type) {
|
||||
for (Npc i : NpcHandler.npcs) {
|
||||
if (i == null) {
|
||||
continue;
|
||||
public static final int[] CAT_ITEMS = {
|
||||
1555, 1556, 1557, 1558, 1559, 1560,
|
||||
1561, 1562, 1563, 1564, 1565, 7585, 7583, 7584
|
||||
};
|
||||
|
||||
public static boolean isCatItem(int itemId) {
|
||||
for (int i = 0; i < CAT_ITEMS.length; i++) {
|
||||
if (itemId == CAT_ITEMS[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (Npc i : NpcHandler.npcs) {
|
||||
if (i != null) {
|
||||
if (i.npcType == Type) {
|
||||
if (i.spawnedBy == c.playerId && i.spawnedBy > 0) {
|
||||
i.absX = 0;
|
||||
i.absY = 0;
|
||||
i = null;
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isCat(int npcId) {
|
||||
for (int i = 0; i < CATS.length; i++) {
|
||||
if (npcId == CATS[i][0]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static void dropPet(Player player, int itemId, int slot) {
|
||||
if (player.hasNpc) {
|
||||
player.getPacketSender().sendMessage("You already dropped your " + NpcHandler.getNpcListName(summonItemId(itemId)) + ".");
|
||||
return;
|
||||
}
|
||||
player.getItemAssistant().deleteItem(itemId, slot, player.playerItemsN[slot]);
|
||||
player.hasNpc = true;
|
||||
player.getPacketSender().sendMessage("You drop your " + NpcHandler.getNpcListName(summonItemId(itemId)) + ".");
|
||||
int offsetX = 0;
|
||||
int offsetY = 0;
|
||||
if (Region.getClipping(player.getX() - 1, player.getY(), player.heightLevel, -1, 0)) {
|
||||
offsetX = -1;
|
||||
} else if (Region.getClipping(player.getX() + 1, player.getY(), player.heightLevel, 1, 0)) {
|
||||
offsetX = 1;
|
||||
} else if (Region.getClipping(player.getX(), player.getY() - 1, player.heightLevel, 0, -1)) {
|
||||
offsetY = -1;
|
||||
} else if (Region.getClipping(player.getX(), player.getY() + 1, player.heightLevel, 0, 1)) {
|
||||
offsetY = 1;
|
||||
}
|
||||
GameEngine.npcHandler.spawnNpc3(player, summonItemId(itemId), player.absX+offsetX, player.absY+offsetY, player.heightLevel, 0, 120, 25, 200, 200, false, false, true);
|
||||
PlayerSave.saveGame(player);
|
||||
}
|
||||
|
||||
public void quickPickup(Player player, int id) {
|
||||
for (Npc i : NpcHandler.npcs) {
|
||||
if (i == null) {
|
||||
continue;
|
||||
}
|
||||
if (i.npcType == id) {
|
||||
i.absX = 0;
|
||||
i.absY = 0;
|
||||
i = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void pickUpPet(Player player, int id) {
|
||||
if (player.getItemAssistant().hasFreeSlots(1)) {
|
||||
for (Npc i : NpcHandler.npcs) {
|
||||
if (i == null) {
|
||||
continue;
|
||||
}
|
||||
if (i.npcType == id) {
|
||||
player.startAnimation(827);
|
||||
i.absX = 0;
|
||||
i.absY = 0;
|
||||
i = null;
|
||||
for (int[] element : CATS) {
|
||||
if (element[0] == id) {
|
||||
player.getItemAssistant().addItem(element[1], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.getPacketSender().sendMessage("You do not have enough space in your inventory to do that.");
|
||||
}
|
||||
}
|
||||
|
||||
public void pickUpClean(Player c, int id) {
|
||||
for (int[] element : catArray) {
|
||||
if (element[0] == id) {
|
||||
c.getItemAssistant().addItem(element[1], 1);
|
||||
}
|
||||
}
|
||||
for (Npc i : NpcHandler.npcs) {
|
||||
if (i == null) {
|
||||
continue;
|
||||
}
|
||||
if (i.npcType == id) {
|
||||
i.absX = 0;
|
||||
i.absY = 0;
|
||||
}
|
||||
}
|
||||
c.hasNpc = false;
|
||||
}
|
||||
|
||||
public static int summonItemId(int itemId) {
|
||||
if (itemId == 1555) {
|
||||
return 761;
|
||||
} else if (itemId == 1556) {
|
||||
return 762;
|
||||
} else if (itemId == 1557) {
|
||||
return 763;
|
||||
} else if (itemId == 1558) {
|
||||
return 764;
|
||||
} else if (itemId == 1559) {
|
||||
return 765;
|
||||
} else if (itemId == 1560) {
|
||||
return 766;
|
||||
} else if (itemId == 1561) {
|
||||
return 768;
|
||||
} else if (itemId == 1562) {
|
||||
return 769;
|
||||
} else if (itemId == 1563) {
|
||||
return 770;
|
||||
} else if (itemId == 1564) {
|
||||
return 771;
|
||||
} else if (itemId == 1565) {
|
||||
return 772;
|
||||
} else if (itemId == 1566) {
|
||||
return 773;
|
||||
} else if (itemId == 7585) {
|
||||
return 3507;
|
||||
} else if (itemId == 7584) {
|
||||
return 3506;
|
||||
} else if (itemId == 7583) {
|
||||
return 3505;
|
||||
for (int i = 0; i < CATS.length; i++) {
|
||||
if (itemId == CATS[i][1]) {
|
||||
return CATS[i][0];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user