本文整理汇总了C#中RunescapeServer.player.Player.getInventory方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getInventory方法的具体用法?C# Player.getInventory怎么用?C# Player.getInventory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RunescapeServer.player.Player
的用法示例。
在下文中一共展示了Player.getInventory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: execute
public void execute(Player player, string[] arguments) {
if (arguments.Length == 0)
{
player.getPackets().sendMessage("[Pickup command]: ::item itemId amount or just ::item itemId");
return;
}
int itemId = 0;
if (!int.TryParse(arguments[0], out itemId))
itemId = 0;
int amount = 0;
if(arguments.Length >= 2 && !int.TryParse(arguments[1], out amount))
amount = 0;
if (!player.inCombat()) {
if (amount > 1 && !ItemData.forId(itemId).isNoted() && !ItemData.forId(itemId).isStackable())
{
for (int i = 0; i < amount; i++) {
if (!player.getInventory().addItem(itemId))
{
break;
}
}
} else if(amount == 0) {
player.getInventory().addItem(itemId);
} else {
player.getInventory().addItem(itemId, amount);
}
}
}
示例2: tagPillar
public static void tagPillar(Player p, int pillarIndex) {
AreaEvent tagPillarAreaEvent = new AreaEvent(p, AGILITY_ARENA_PILLARS[pillarIndex][1]-1, AGILITY_ARENA_PILLARS[pillarIndex][2]-1, AGILITY_ARENA_PILLARS[pillarIndex][1]+1, AGILITY_ARENA_PILLARS[pillarIndex][2]+1);
tagPillarAreaEvent.setAction(() => {
if (p.getLocation().getZ() == 3) {
p.setFaceLocation(new Location(AGILITY_ARENA_PILLARS[pillarIndex][1], AGILITY_ARENA_PILLARS[pillarIndex][2], 3));
if (pillarIndex != currentPillar) {
p.getPackets().sendMessage("You can only get a ticket when the flashing arrow is above the pillar!");
return;
}
if (p.isTaggedLastAgilityPillar())
{
p.getPackets().sendMessage("You have already tagged this pillar, wait until the arrow moves again.");
return;
}
int currentStatus = p.getAgilityArenaStatus();
if (currentStatus == 0) {
p.getPackets().sendConfig(309, 4);
p.getPackets().sendMessage("You get tickets by tagging more than one pillar in a row. Tag the next pillar!");
} else {
p.getInventory().addItem(2996);
p.getPackets().sendMessage("You recieve an Agility Arena ticket!");
}
p.setAgilityArenaStatus(currentStatus == 0 ? 1 : 1);
p.setTaggedLastAgilityPillar(true);
}
});
Server.registerCoordinateEvent(tagPillarAreaEvent);
}
示例3: getProtectedItem1
public static int[] getProtectedItem1(Player p) {
int[] protectedItem = new int[2];
protectedItem[0] = -1;
foreach (Item item in p.getInventory().getItems()) {
if(item.getItemId() == -1) continue;
int price = item.getDefinition().getPrice().getMaximumPrice();
if ((price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice()))
{
protectedItem[0] = item.getItemId();
protectedItem[1] = INVENTORY;
}
}
foreach(Item item in p.getEquipment().getEquipment()) {
if (item.getItemId() == -1) continue;
int price = item.getDefinition().getPrice().getMaximumPrice();
if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice())
{
protectedItem[0] = item.getItemId();
protectedItem[1] = EQUIPMENT;
}
}
return protectedItem;
}
示例4: createdAnimatedArmour
protected static void createdAnimatedArmour(Player p, int index) {
if (p.getTemporaryAttribute("warriorGuildAnimator") == null) {
return;
}
p.setLastAnimation(new Animation(827));
p.setTemporaryAttribute("unmovable", true);
for (int i = 0; i < ARMOUR_SETS[index].Length; i++) {
p.getInventory().deleteItem(ARMOUR_SETS[index][i]);
}
p.getPackets().sendChatboxInterface(211);
p.getPackets().modifyText("You place the armour onto the platform where it", 211, 1);
p.getPackets().modifyText("dissapears...", 211, 2);
int animatorIndex = (int) p.getTemporaryAttribute("warriorGuildAnimator");
Event createAnimatedArmourEvent = new Event(1500);
int createAnimatedArmourCounter = 0;
Npc npc = null;
createAnimatedArmourEvent.setAction(() => {
if (createAnimatedArmourCounter == 0)
{
p.getPackets().sendChatboxInterface(211);
p.getPackets().modifyText("The animator hums, something appears to be working.", 211, 1);
p.getPackets().modifyText("You stand back.", 211, 2);
createAnimatedArmourEvent.setTick(500);
}
else if (createAnimatedArmourCounter == 1)
{
p.getWalkingQueue().forceWalk(0, + 3);
createAnimatedArmourEvent.setTick(2000);
}
else if (createAnimatedArmourCounter == 2)
{
createAnimatedArmourEvent.setTick(500);
Location minCoords = new Location(2849, 3534, 0);
Location maxCoords = new Location(2861, 3545, 0);
npc = new Npc(ANIMATED_ARMOUR[index]);
npc.setMinimumCoords(minCoords);
npc.setMaximumCoords(maxCoords);
npc.setLocation(new Location(ANIMATOR_LOCATIONS[animatorIndex][0], ANIMATOR_LOCATIONS[animatorIndex][1], 0));
npc.setWalkType(WalkType.STATIC);
npc.setForceText("I'm ALIVE!");
npc.setLastAnimation(new Animation(4166));
npc.setEntityFocus(p.getClientIndex());
npc.setOwner(p);
npc.setTarget(p);
p.getPackets().setArrowOnEntity(1, npc.getClientIndex());
Server.getNpcList().Add(npc);
} else {
p.setEntityFocus(npc.getClientIndex());
p.getPackets().softCloseInterfaces();
createAnimatedArmourEvent.stop();
p.removeTemporaryAttribute("unmovable");
npc.getFollow().setFollowing(p);
}
createAnimatedArmourCounter++;
});
Server.registerEvent(createAnimatedArmourEvent);
}
示例5: execute
public void execute(Player player, string[] arguments)
{
int price = 0;
for (int i = 0; i < player.getInventory().getItems().Length; i++)
{
if (player.getInventory().getItemInSlot(i) > 0)
{
price += (player.getInventory().getSlot(i).getDefinition().getPrice().getNormalPrice() * player.getInventory().getAmountInSlot(i));
if (player.getInventory().getItemInSlot(i) == 995) //gold itself.
price += player.getInventory().getAmountInSlot(i);
}
}
player.getPackets().sendMessage("Value of inventory: " + price.ToString("#,##0") + " in gold.");
}
示例6: handleClickFour
private void handleClickFour(Player player, Packet packet) {
int interfaceId = packet.readUShort();
int child = packet.readUShort();
int slot = packet.readUShort();
Console.WriteLine("InterfaceOption 4: interfaceId: " + interfaceId);
switch(interfaceId) {
case 763: // Bank inventory - Custom amount.
player.getBank().deposit(slot, player.getBank().getLastXAmount());
player.getBank().refreshBank();
break;
case 762: // Bank - Custom amount.
player.getBank().withdraw(slot, player.getBank().getLastXAmount());
player.getBank().refreshBank();
break;
case 154: // Craft normal leather.
player.getPackets().displayEnterAmount();
player.setTemporaryAttribute("interfaceVariable", new EnterVariable(154, child));
break;
case 542: // Glassblowing.
switch(child) {
case 40: // Make X beer glass.
case 41: // Make X candle lantern.
case 42: // Make X oil lamp.
case 38: // Make X vial.
case 44: // Make X Fishbowl
case 39: // Make X orb.
case 43: // Make X lantern lens
case 45: // Make X dorgeshuun light orb.
player.getPackets().displayEnterAmount();
player.setTemporaryAttribute("interfaceVariable", new EnterVariable(542, child));
break;
}
break;
case 336: // Trade/stake inventory - trade all.
if (player.getTrade() != null) {
player.getTrade().tradeItem(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot)));
break;
}
if (player.getDuel() != null) {
player.getDuel().stakeItem(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot)));
break;
}
break;
case 335: // Trade interface - remove all.
player.getTrade().removeItem(slot, player.getTrade().getItemAmount(player.getTrade().getItemInSlot(slot)));
break;
case 631: // Duel interface - remove All
if (player.getDuel() != null) {
player.getDuel().removeItem(slot, player.getDuel().getItemAmount(player.getDuel().getItemInSlot(slot)));
break;
}
break;
case 620: // Shop - buy 10.
player.getShopSession().buyItem(slot, 10);
break;
case 621: // Shop - sell 10.
player.getShopSession().sellItem(slot, 10);
break;
case 590: // Clan chat setup
Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
if (clan == null) {
player.getPackets().sendMessage("Please create your clan chat before changing settings.");
break;
}
switch(child) {
case 23: // "Who can enter chat" - corporal.
clan.setEnterRights(Clan.ClanRank.CORPORAL);
player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
break;
case 24: // "Who can talk in chat" - corporal.
clan.setTalkRights(Clan.ClanRank.CORPORAL);
player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
break;
case 25: // // "Who can kick in chat" - corporal.
clan.setKickRights(Clan.ClanRank.CORPORAL);
player.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25);
break;
case 26: // "Who can share loot" - corporal.
clan.setLootRights(Clan.ClanRank.CORPORAL);
player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
break;
}
break;
}
}
示例7: handleClickThree
private void handleClickThree(Player player, Packet packet) {
int interfaceId = packet.readUShort();
int child = packet.readUShort();
int slot = packet.readUShort();
Console.WriteLine("InterfaceOption 3: interfaceId: " + interfaceId);
switch(interfaceId) {
case 154: // Craft normal leather.
Leather.craftNormalLeather(player, child, player.getInventory().getItemAmount(1741), true);
break;
case 542: // Glassblowing.
int totalGlass = player.getInventory().getItemAmount(1775);
switch(child) {
case 40: // Make all beer glass.
Glass.craftGlass(player, totalGlass, 0, true);
break;
case 41: // Make all candle lantern.
Glass.craftGlass(player, totalGlass, 1, true);
break;
case 42: // Make all oil lamp.
Glass.craftGlass(player, totalGlass, 2, true);
break;
case 38: // Make all vial.
Glass.craftGlass(player, totalGlass, 3, true);
break;
case 44: // Make all Fishbowl
Glass.craftGlass(player, totalGlass, 4, true);
break;
case 39: // Make all orb.
Glass.craftGlass(player, totalGlass, 5, true);
break;
case 43: // Make all lantern lens
Glass.craftGlass(player, totalGlass, 6, true);
break;
case 45: // Make all dorgeshuun light orb.
Glass.craftGlass(player, totalGlass, 7, true);
break;
}
break;
case 763: // Bank inventory - 10.
player.getBank().deposit(slot, 10);
player.getBank().refreshBank();
break;
case 762: // Bank - 10.
player.getBank().withdraw(slot, 10);
player.getBank().refreshBank();
break;
case 336: // Trade/stake inventory - trade 10.
if (player.getTrade() != null) {
player.getTrade().tradeItem(slot, 10);
break;
}
if (player.getDuel() != null) {
player.getDuel().stakeItem(slot, 10);
break;
}
break;
case 335: // Trade interface - remove 10.
player.getTrade().removeItem(slot, 10);
break;
case 631: // Duel interface - remove 10.
if (player.getDuel() != null) {
player.getDuel().removeItem(slot, 5);
break;
}
break;
case 620: // Shop - buy 5.
player.getShopSession().buyItem(slot, 5);
break;
case 621: // Shop - sell 5.
player.getShopSession().sellItem(slot, 5);
break;
case 590: // Clan chat setup
Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
if (clan == null) {
player.getPackets().sendMessage("Please create your clan chat before changing settings.");
break;
}
switch(child) {
case 23: // "Who can enter chat" - recruit.
clan.setEnterRights(Clan.ClanRank.RECRUIT);
player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
break;
case 24: // "Who can talk in chat" - recruit.
//.........这里部分代码省略.........
示例8: handleItemOnObject
private void handleItemOnObject(Player player, Packet packet) {
int objectX = packet.readShortA();
int item = packet.readUShort();
int objectY = packet.readLEShort();
int slot = packet.readUShort();
int interfaceId = packet.readLEShort();
int child = packet.readUShort();
int objectId = packet.readShortA();
if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
Console.WriteLine("Item on object = " + objectId + " " + objectX + " " + objectY);
SkillHandler.resetAllSkills(player);
player.getPackets().closeInterfaces();
player.setFaceLocation(new Location(objectX, objectY, player.getLocation().getZ()));
if (player.getInventory().getItemInSlot(slot) == item) {
if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) {
return;
} else if (Farming.interactWithPatch(player, objectId, objectX, objectY, player.getInventory().getItemInSlot(slot))) {
return;
} else if (WarriorGuild.useAnimator(player, player.getInventory().getItemInSlot(slot), objectId, objectX, objectY)) {
return;
}
if (player.getInventory().getItemInSlot(slot) == 7936) {
if (RuneCraft.wantToRunecraft(player, objectId, objectX, objectY)) {
return;
}
if (RuneCraft.useTalisman(player, objectId, objectX, objectY)) {
return;
}
}
switch(objectId) {
case 6: // Cannon:
DwarfCannon cannon = player.getCannon();
Location l = new Location(objectX, objectY, player.getLocation().getZ());
if (cannon == null || (cannon != null & !l.withinDistance(cannon.getLocation(), 2))) {
player.getPackets().sendMessage("This isn't your cannon!");
break;
}
cannon.loadCannon();
break;
case 36781: // Lumbridge fountain.
case 24214: // Fountain in east Varrock.
case 24265: // Varrock main fountain.
case 11661: // Falador waterpump.
case 11759: // Falador south fountain.
case 879: // Camelot fountains.
case 29529: // Sink.
case 874: // Sink.
if (FillVial.fillingVial(player, new Location(objectX, objectY, player.getLocation().getZ())) && player.getInventory().getItemInSlot(slot) == 229) {
break;
}
break;
case 2728: // Range in Catherby
if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), false, -1, -1)) {
break;
}
break;
case 2732: // Fire
if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), true, objectX, objectY)) {
break;
}
break;
case 36956: // Lumbridge furnace
case 11666: // Falador furnace
if (Smelting.wantToSmelt(player, player.getInventory().getItemInSlot(slot))) {
break;
} else if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) {
break;
}
break;
case 2783: // Anvil
if (Smithing.wantToSmithOnAnvil(player, player.getInventory().getItemInSlot(slot), new Location(objectX, objectY, player.getLocation().getZ()))) {
break;
}
break;
default:
player.getPackets().sendMessage("Nothing interesting happens.");
break;
}
}
}
示例9: pickupItem
public void pickupItem(Player p, int id, Location location) {
GroundItem item = itemExists(location, id);
if (item != null && p.getSprites().getPrimarySprite() == -1 && p.getSprites().getSecondarySprite() == -1) {
if (item.getDefinition().isPlayerBound() && !item.getOwner().Equals(p)) {
return;
}
if (!p.getInventory().addItem(item.getItemId(), item.getItemAmount())) {
return;
}
clearGlobalItem(item);
if (item.isRespawn()) {
GroundItem i = item;
Event itemRespawnEvent = new Event(60000);
itemRespawnEvent.setAction(() => {
GroundItem respawn = new GroundItem(i.getItemId(), i.getItemAmount(), i.getLocation(), null);
respawn.setRespawn(true);
respawn.setGlobal(true);
newGlobalItem(respawn);
itemRespawnEvent.stop();
});
}
}
}
示例10: hasRunes
public static bool hasRunes(Player p, int[] runes, int[] amount)
{
for (int i = 0; i < runes.Length; i++)
{
if (checkForStaffs(p, runes[i]) != -1)
{
if (!p.getInventory().hasItemAmount(runes[i], amount[i]))
{
return false;
}
}
}
return true;
}
示例11: doDialogue
//.........这里部分代码省略.........
if (p.hasPaidAgilityArena()) {
message = "Ye've already paid, so down ye goes...";
} else {
message = "Aye, Entrance be " + AGILITY_ARENA_PRICE.ToString("#,##0") + " coins.";
newStatus = 26;
}
p.getPackets().sendNPCHead(437, 241, 2);
p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3);
p.getPackets().modifyText(message, 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
p.getPackets().sendChatboxInterface2(241);
break;
case 26:
p.getPackets().sendNPCHead(4535, 241, 1);
p.getPackets().modifyText("Parrot", 241, 3);
p.getPackets().modifyText("Pieces of eight!", 241, 4);
p.getPackets().animateInterface(9827, 241, 1);
p.getPackets().sendChatboxInterface2(241);
newStatus = 27;
break;
case 27:
p.getPackets().sendNPCHead(437, 242, 2);
p.getPackets().modifyText("Cap'n Izzy No-Beard", 242, 3);
p.getPackets().modifyText("A word of warning me hearty! There are dangerous", 242, 4);
p.getPackets().modifyText("traps down there!", 242, 5);
p.getPackets().animateInterface(9827, 242, 2);
p.getPackets().sendChatboxInterface2(242);
newStatus = 28;
break;
case 28:
if (!p.getInventory().hasItemAmount(995, AGILITY_ARENA_PRICE)) {
p.getPackets().sendPlayerHead(64, 2);
p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
p.getPackets().modifyText("I don't have enough money on me at the moment..", 64, 4);
p.getPackets().animateInterface(9827, 64, 2);
p.getPackets().sendChatboxInterface2(64);
newStatus = 31;
break;
}
p.getPackets().modifyText("Ok, here's " + AGILITY_ARENA_PRICE.ToString("#,##0") + " coins.", 228, 2);
p.getPackets().modifyText("Never mind.", 228, 3);
p.getPackets().sendChatboxInterface(228);
newStatus = 29;
break;
case 29:
if (p.getInventory().deleteItem(995, AGILITY_ARENA_PRICE)) {
p.setPaidAgilityArena(true);
}
p.getPackets().sendPlayerHead(64, 2);
p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
p.getPackets().modifyText("Ok, here's " + AGILITY_ARENA_PRICE.ToString("#,##0") + " coins.", 64, 4);
p.getPackets().animateInterface(9827, 64, 2);
p.getPackets().sendChatboxInterface2(64);
newStatus = 30;
break;
case 30:
p.getPackets().sendMessage("You pay Cap'n Izzy " + AGILITY_ARENA_PRICE.ToString("#,##0") + " coins.");
p.getPackets().sendNPCHead(437, 241, 2);
p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3);
p.getPackets().modifyText("May the wind be in ye sails!", 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
示例12: handleExamineItemGE
private void handleExamineItemGE(Player player, Packet packet)
{
//6 in size.
int someInt = packet.readInt();
ushort inventorySlot = packet.readUShort();
if (inventorySlot < 0 || inventorySlot > 28 || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
int itemId = player.getInventory().getItemInSlot(inventorySlot);
if (itemId < 0 || itemId > Constants.MAX_ITEMS)
{
return;
}
string examine = ItemData.forId(itemId).getExamine();
player.getPackets().sendMessage("[GE someInt]: " + someInt + " if it's not 7012370, then tell me what you did");
player.getPackets().sendMessage("[GE Sell]: " + examine);
}
示例13: handleEquipItem
private void handleEquipItem(Player player, Packet packet) {
int item = packet.readLEShort();
int slot = packet.readShortA();
int interfaceId = packet.readInt();
if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
SkillHandler.resetAllSkills(player);
if (player.getInventory().getItemInSlot(slot) == item) {
//player.getPackets().closeInterfaces();
if (RuneCraft.emptyPouch(player, (RuneCraftData.POUCHES)player.getInventory().getItemInSlot(slot))) {
return;
}
player.getEquipment().equipItem(player.getInventory().getItemInSlot(slot), slot);
}
}
示例14: handleRightClickOne
private void handleRightClickOne(Player player, Packet packet) {
int childId = packet.readLEShort();
int interfaceId = packet.readLEShort();
int item = packet.readLEShortA();
int slot = packet.readLEShortA();
if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
SkillHandler.resetAllSkills(player);
if (player.getInventory().getItemInSlot(slot) == item) {
player.getPackets().closeInterfaces();
if (interfaceId == 149 && childId == 0) {
if (Herblore.emptyPotion(player, player.getInventory().getItemInSlot(slot), slot)) {
return;
} else if (JewelleryTeleport.useJewellery(player, player.getInventory().getItemInSlot(slot), slot, false)) {
return;
}
}
}
}
示例15: handleRightClickTwo
private void handleRightClickTwo(Player player, Packet packet) {
int childId = packet.readLEShort();
int interfaceId = packet.readLEShort();
int slot = packet.readLEShort();
int item = packet.readLEShort();
if (slot < 0 || slot > 28 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
SkillHandler.resetAllSkills(player);
if (player.getInventory().getItemInSlot(slot) == item) {
player.getPackets().closeInterfaces();
switch(player.getInventory().getItemInSlot(slot)) {
case 5509: // Small pouch.
player.getPackets().sendMessage("There is " + player.getSmallPouchAmount() + " Pure essence in your small pouch. (holds 3).");
break;
case 5510: // Medium pouch.
player.getPackets().sendMessage("There is " + player.getMediumPouchAmount() + " Pure essence in your medium pouch. (holds 6).");
break;
case 5512: // Large pouch.
player.getPackets().sendMessage("There is " + player.getLargePouchAmount() + " Pure essence in your large pouch. (holds 9).");
break;
case 5514: // Giant pouch.
player.getPackets().sendMessage("There is " + player.getGiantPouchAmount() + " Pure essence in your giant pouch. (holds 12).");
break;
}
}
}