本文整理汇总了C#中WorldServer.player.Player.getSkills方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getSkills方法的具体用法?C# Player.getSkills怎么用?C# Player.getSkills使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldServer.player.Player
的用法示例。
在下文中一共展示了Player.getSkills方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: castCharge
public static void castCharge(Player p)
{
p.removeTemporaryAttribute("autoCasting");
if (p.getSkills().getCurLevel(Skills.SKILL.MAGIC) < 80) {
p.getPackets().sendMessage("You need a Magic level of 80 to cast Charge.");
return;
}
if (!hasRunes(p, CHARGE_RUNES, CHARGE_RUNE_AMOUNT)) {
p.getPackets().sendMessage("You do not have enough runes to cast Charge.");
return;
}
if (p.getTemporaryAttribute("godCharged") != null) {
p.getPackets().sendMessage("You have already charged your god spells.");
return;
}
if (hasGodCapeAndStaff(p)) {
p.getPackets().sendMessage("You must wear a God cape and wield the matching staff to cast Charge.");
return;
}
if (!deleteRunes(p, CHARGE_RUNES, CHARGE_RUNE_AMOUNT)) {
return;
}
p.setTemporaryAttribute("godCharged", true);
p.setLastGraphics(new Graphics(308, 800, 90));
p.setLastAnimation(new Animation(811));
p.getPackets().sendMessage("You feel charged with magical power..");
int delay = 60000 + misc.random(120000); //60 seconds + possible 120 seconds so, 1 minute to 2 minutes.
Event removeGodChargeEvent = new Event(delay);
removeGodChargeEvent.setAction(() => {
removeGodChargeEvent.stop();
p.removeTemporaryAttribute("godCharged");
p.getPackets().sendMessage("Your magical charge fades away.");
});
Server.registerEvent(removeGodChargeEvent);
}
示例2: execute
public void execute(Player player, string[] arguments)
{
if (arguments.Length < 2)
{
player.getPackets().sendMessage("[SetLevel command]: ::setLevel skillId level or ::setLevel skillName level");
return;
}
int skillId = -1;
int newLevel = 1;
if (!int.TryParse(arguments[1], out newLevel)) {
player.getPackets().sendMessage("[SetLevel command]: ::setLevel skillId level or ::setLevel skillName level");
return;
}
if (newLevel > 99) newLevel = 99;
if (!int.TryParse(arguments[0], out skillId))
{
//string based skills
arguments[0] = arguments[0].ToUpper();
if(!Enum.IsDefined(typeof(Skills.SKILL), arguments[0])) {
player.getPackets().sendMessage("[SetLevel command]: wrong.. try like ::setlevel attack 99 or ::setlevel 0 99");
return;
}
try
{
Skills.SKILL skillName = (Skills.SKILL)Enum.Parse(typeof(Skills.SKILL), arguments[0], true);
player.getSkills().setXp(skillName, 0);
player.getSkills().setCurLevel(skillName, newLevel);
player.getSkills().addXp(skillName, Skills.getXpForLevel(newLevel));
player.getPackets().sendSkillLevel(skillName);
} catch (ArgumentException) {
player.getPackets().sendMessage("[SetLevel command]: wrong.. try like ::setlevel attack 99 or ::setlevel 0 99");
}
} else {
if(!Enum.IsDefined(typeof(Skills.SKILL), skillId)) {
player.getPackets().sendMessage("[SetLevel command]: wrong.. try like ::setlevel attack 99 or ::setlevel 0 99");
return;
}
Skills.SKILL skillName = (Skills.SKILL)skillId;
player.getSkills().setXp(skillName, 0);
player.getSkills().setCurLevel(skillName, newLevel);
player.getSkills().addXp(skillName, Skills.getXpForLevel(newLevel));
player.getPackets().sendSkillLevel(skillName);
}
}
示例3: getMeleeAttack
public static double getMeleeAttack(Player p)
{
int attBonus = getHighestAttBonus(p);
int attLevel = p.getSkills().getCurLevel(Skills.SKILL.ATTACK);
double power = (attLevel + attBonus) * 0.01365;
double amount = 1.260;
power *= (attLevel * (power * 0.12)) + (attBonus * amount) * (power * 0.009);
if (p.getPrayers().getAttackPrayer() == 1) {
power *= 1.05;
} else if (p.getPrayers().getAttackPrayer() == 2) {
power *= 1.10;
} else if (p.getPrayers().getAttackPrayer() == 3 || p.getPrayers().getSuperPrayer() == 1) {
power *= 1.15;
} else if (p.getPrayers().getSuperPrayer() == 2) {
power *= 1.20;
}
if (wearingMeleeVoid(p)) {
power *= 1.10;
}
return power;
}
示例4: levelUp
public static void levelUp(Player player, SKILL skill)
{
int skillIndex = Convert.ToInt32(skill);
String s = "<br><br><br>";
String s1 = "<br><br><br><br>";
if (player.getTemporaryAttribute("teleporting") == null)
{
player.setLastGraphics(new Graphics(199, 0, 100));
}
int skillFlashFlags = (int)(player.getTemporaryAttribute("skillFlashFlags") == null ? 0 : (int)player.getTemporaryAttribute("skillFlashFlags"));
skillFlashFlags |= SKILL_FLASH_BITMASKS[skillIndex];
player.setTemporaryAttribute("skillFlashFlags", skillFlashFlags);
player.getPackets().sendMessage("You've just advanced a " + SKILL_NAME[skillIndex] + " level! You have reached level " + player.getSkills().getMaxLevel(skillIndex) + ".");
player.getPackets().modifyText(s + "Congratulations, you have just advanced a " + SKILL_NAME[skillIndex] + " level!", 740, 0);
player.getPackets().modifyText(s1 + "You have now reached level " + player.getSkills().getMaxLevel(skillIndex) + ".", 740, 1);
player.getPackets().modifyText("", 740, 2);
player.getPackets().sendConfig(1179, SKILL_ICON_BITMASKS[skillIndex] | skillFlashFlags); //start flashing appropriate skill icons
player.getPackets().sendChatboxInterface2(740);
player.getUpdateFlags().setAppearanceUpdateRequired(true);
}
示例5: applyBoltGraphic
private static int applyBoltGraphic(Player killer, Entity target, int damage, int bolt)
{
int hit = misc.random(10);
if (hit != 0 || getBowType(killer) != BOW_TYPE.CROSSBOW) {
return damage;
}
double maxDamage = getDamage((Player)killer, target, ((Player)killer).getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON), bolt);
switch(bolt) {
case 9236: // Opal.
target.setLastGraphics(new Graphics(749));
maxDamage *= 1.25;
break;
case 9237: // Jade.
target.setLastGraphics(new Graphics(756));
//TODO Falling emote
break;
case 9238: // Pearl.
target.setLastGraphics(new Graphics(750));
break;
case 9239: // Topaz.
target.setLastGraphics(new Graphics(757, 0, 0));
if (target is Player) {
int magicLevel = ((Player) target).getSkills().getCurLevel(Skills.SKILL.MAGIC);
if (magicLevel == 1)
return (int)maxDamage;
int magicLevelDeduction = misc.random(1,10);
magicLevelDeduction = Math.Min(magicLevelDeduction, (magicLevel - 1));
string s = magicLevelDeduction == 1 ? "" : "s";
((Player)target).getSkills().setCurLevel(Skills.SKILL.MAGIC, magicLevel - magicLevelDeduction);
((Player)target).getPackets().sendSkillLevel(Skills.SKILL.MAGIC);
((Player)target).getPackets().sendMessage("Your Magic level has been reduced by " + magicLevelDeduction + " level" + s + " !");
}
break;
case 9240: // Sapphire.
target.setLastGraphics(new Graphics(751));
if (target is Player) {
int prayerLevel = ((Player)target).getSkills().getCurLevel(Skills.SKILL.PRAYER);
if (prayerLevel == 1)
return (int)maxDamage;
int prayerLevelDeduction = misc.random(1, 10);
prayerLevelDeduction = Math.Min(prayerLevelDeduction, (prayerLevel - 1));
string s = prayerLevelDeduction == 1 ? "" : "s";
((Player)target).getSkills().setCurLevel(Skills.SKILL.PRAYER, prayerLevel - prayerLevelDeduction);
((Player)target).getPackets().sendSkillLevel(Skills.SKILL.PRAYER);
((Player)target).getPackets().sendMessage("Your Prayer level has been lowered by " + prayerLevelDeduction + " level" + s + " !");
killer.getPackets().sendMessage("You steal " + prayerLevelDeduction + " Prayer point" + s + " from your opponent!");
int prayerLevelObtained = Math.Min(killer.getSkills().getCurLevel(Skills.SKILL.PRAYER)+prayerLevelDeduction, killer.getSkills().getMaxLevel(Skills.SKILL.PRAYER));
killer.getSkills().setCurLevel(Skills.SKILL.PRAYER, prayerLevelObtained);
killer.getPackets().sendSkillLevel(Skills.SKILL.PRAYER);
}
break;
case 9241: // Emerald.
if (!target.isPoisoned()) {
Server.registerEvent(new PoisonEvent(target, 6));
target.setLastGraphics(new Graphics(752));
}
break;
case 9242: // Ruby
target.setLastGraphics(new Graphics(754));
int currentHP = killer.getHp();
bool has11Percent = (currentHP * 0.11) < currentHP;
int removeFromOpponent = (int) (target.getHp() * 0.20); //20% off opponents HP.
if (has11Percent) {
killer.hit((int)(currentHP * 0.10));
target.hit(removeFromOpponent);
killer.getPackets().sendMessage("You sacrifice some of your own health to deal more damage to your opponent!");
}
break;
case 9243: // Diamond.
target.setLastGraphics(new Graphics(758));
maxDamage *= 1.15;
//TODO this affects opponents range defence for X minutes.
break;
case 9244: // Dragon.
bool hitsFire = true;
if (target is Player) {
int shield = ((Player)target).getEquipment().getItemInSlot(ItemData.EQUIP.SHIELD);
/*
* Opponent has anti-fire shield.
*/
if (shield == 11283 || shield == 1540) {
hitsFire = false;
}
} else {
int id = ((Npc)target).getId();
/*
* NPC is a dragon
*/
if ((id >= 50 && id <= 55) || id == 941 || (id >= 1589 && id <= 1592) || id == 2642 || id == 3376
|| id == 3588 || id == 3590 || (id >= 4665 && id <= 4684) || id == 5178 || id == 5362 || id == 5363) {
hitsFire = false;
//.........这里部分代码省略.........
示例6: canCastSpell2
private static bool canCastSpell2(Player p, Entity target, int i, bool fakeNPC)
{
// fakeNPC is used to keep location when autocasting.
if (fakeNPC) {
return !p.isDead();
}
if (target.isDead() || p.isDead() || target.isDestroyed() || p.isDestroyed()) {
return false;
}
if (target is Npc) {
if (((Npc)target).getHp() <= 0)
{
return false;
}
}
if ((target is Player) && (p is Player)) {
if (Location.inFightPits(target.getLocation()) && Location.inFightPits(target.getLocation()))
{
if (!Server.getMinigames().getFightPits().hasGameStarted()) {
return false;
}
return true;
}
if (p.getDuel() != null) {
if (((Player)target).getDuel() != null) {
if (p.getDuel().getPlayer2().Equals(((Player) target)) && ((Player) target).getDuel().getPlayer2().Equals(p)) {
if (p.getDuel().ruleEnabled(DuelSession.RULE.NO_MAGIC)) {
return false;
}
if (p.getDuel().getStatus() == 6 && ((Player) target).getDuel().getStatus() == 6) {
return true;
}
}
}
return false;
}
if (!Location.inWilderness(target.getLocation()) && !Location.inWilderness(p.getLocation()))
return false;
int killerWildLevel = p.getLocation().wildernessLevel();
int targetWildLevel = ((Player)target).getLocation().wildernessLevel();
int killerCombatLevel = p.getSkills().getCombatLevel();
int targetCombatLevel = ((Player)target).getSkills().getCombatLevel();
int highest = killerCombatLevel > targetCombatLevel ? killerCombatLevel : targetCombatLevel;
int lowest = highest == killerCombatLevel ? targetCombatLevel : killerCombatLevel;
int difference = (highest - lowest);
if (difference > killerWildLevel || difference > targetWildLevel) {
return false;
}
}
return true;
}
示例7: canCastSpell
private static bool canCastSpell(Player p, Entity target, int i, bool fakeNPC)
{
// fakeNPC is used to keep location when autocasting.
if (fakeNPC) {
return !p.isDead();
}
if (target.isDead() || p.isDead() || target.isDestroyed() || p.isDestroyed()) {
return false;
}
if (target is Npc) {
if (((Npc) target).getHp() <= 0) {
return false;
}
if (i == 47) {
p.getPackets().sendMessage("You cannot cast Teleblock upon an NPC.");
return false;
}
}
if ((target is Player) && (p is Player)) {
if (Location.inFightPits(target.getLocation()) && Location.inFightPits(target.getLocation()))
{
if (!Server.getMinigames().getFightPits().hasGameStarted()) {
return false;
}
return true;
}
if (p.getDuel() != null) {
if (((Player)target).getDuel() != null) {
if (p.getDuel().getPlayer2().Equals(((Player) target)) && ((Player) target).getDuel().getPlayer2().Equals(p)) {
if (p.getDuel().ruleEnabled(DuelSession.RULE.NO_MAGIC)) {
p.getPackets().sendMessage("Magical combat has been disabled in this duel!");
return false;
}
if (p.getDuel().getStatus() == 6 && ((Player) target).getDuel().getStatus() == 6) {
return true;
}
}
}
p.getPackets().sendMessage("That isn't your opponent.");
return false;
}
if (i == 47) {
if (((Player)target).getTemporaryAttribute("teleblocked") != null) {
p.getPackets().sendMessage("That player already has a teleportation block upon them.");
return false;
}
}
if (!Location.inWilderness(target.getLocation())) {
p.getPackets().sendMessage("That player isn't in the wilderness.");
return false;
}
if (!Location.inWilderness(p.getLocation()))
{
p.getPackets().sendMessage("You aren't in the wilderness.");
return false;
}
int killerWildLevel = p.getLocation().wildernessLevel();
int targetWildLevel = ((Player)target).getLocation().wildernessLevel();
int killerCombatLevel = p.getSkills().getCombatLevel();
int targetCombatLevel = ((Player)target).getSkills().getCombatLevel();
int highest = killerCombatLevel > targetCombatLevel ? killerCombatLevel : targetCombatLevel;
int lowest = highest == killerCombatLevel ? targetCombatLevel : killerCombatLevel;
int difference = (highest - lowest);
if (difference > killerWildLevel || difference > targetWildLevel) {
((Player) p).getPackets().sendMessage("You must move deeper into the wilderness to attack that player.");
return false;
}
}
if (!Location.inMultiCombat(target.getLocation())) {
if (p.getAttacker() != null && !p.getAttacker().Equals(target)) {
p.getPackets().sendMessage("You are already in combat!");
return false;
}
if (target.getAttacker() != null && !target.getAttacker().Equals(p)) {
string type = target is Player ? "player" : "npc";
p.getPackets().sendMessage("That " + type + " is already in combat.");
return false;
}
}
if (p.getSkills().getCurLevel(Skills.SKILL.MAGIC) < SPELL_LEVEL[i]) {
p.getPackets().sendMessage("You need a Magic level of " + SPELL_LEVEL[i] + " to cast that spell.");
return false;
}
if (!hasRunes(p, RUNES[i], RUNE_AMOUNTS[i])) {
p.getPackets().sendMessage("You do not have enough runes to cast that spell.");
return false;
}
if (NEEDS_STAFF[i]) {
if ((i != 38 && p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) != STAFF[i]) || (i == 38 && p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) != 8841 && p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) != STAFF[i]))
{
p.getPackets().sendMessage("You need to wield " + STAFF_NAME[i] + " to cast this spell.");
return false;
}
}
if (i == 37) {
if (p.getEquipment().getItemInSlot(ItemData.EQUIP.CAPE) != 2412)
{
p.getPackets().sendMessage("You need to wear the Cape of Saradomin to be able to cast Saradomin Strike.");
return false;
}
//.........这里部分代码省略.........
示例8: addMagicXp
protected static void addMagicXp(Player p, Entity target, double hit, int index, bool baseXp)
{
if (target is Npc) {
double xp = 0;
switch(index) {
case 0: xp = 5.5; break; // Wind strike.
case 1: xp = 7.5; break;// Water strike
case 2: xp = 9.5; break;// Earth strike.
case 3: xp = 11.5; break;// Fire strike.
case 4: xp = 13.5; break;// Wind bolt.
case 5: xp = 16.5; break;// Water bolt.
case 6: xp = 19.5; break;// Earth bolt.
case 7: xp = 21.5; break;// Fire bolt.
case 8: xp = 25.5; break;// Wind blast.
case 9: xp = 28.5; break;// Water blast.
case 10: xp = 31.5; break;// Earth blast.
case 11: xp = 34.5; break;// Fire blast.
case 12: xp = 36.0; break;// Wind wave.
case 13: xp = 37.5; break;// Water wave.
case 14: xp = 40.0; break;// Earth wave.
case 15: xp = 42.5; break;// Fire wave.
case 32: xp = 24.5; break;// Crumble undead.
case 33: xp = 30.0; break;// Slayer dart.
case 34: xp = 30.0; break;// Bind.
case 35: xp = 30.0; break;// Iban blast.
case 36: xp = 60.0; break;// Snare.
case 37: xp = 61.0; break;// Saradomin strike.
case 38: xp = 61.0; break;// Claws of Guthix.
case 39: xp = 61.0; break;// Flames of Zamorak.
case 40: xp = 89.0; break;// Entangle.
case 41: xp = 13.0; break;// Confuse.
case 42: xp = 21.0; break;// Weaken.
case 43: xp = 29.0; break;// Curse.
case 44: xp = 83.0; break;// Enfeeble.
case 45: xp = 90.0; break;// Stun.
case 46: xp = 76.0; break;// Vulnerability.
case 47: xp = 80.0; break;// Teleblock.
case 16: xp = 30.0; break;// Smoke rush.
case 17: xp = 31.0; break;// Shadow rush.
case 18: xp = 33.0; break;// Blood rush.
case 19: xp = 34.0; break;// Ice rush.
case 20: xp = 36.0; break;// Smoke burst.
case 21: xp = 37.0; break;// Shadow burst.
case 22: xp = 39.0; break;// Blood burst.
case 23: xp = 40.0; break;// Ice burst.
case 24: xp = 42.0; break;// Smoke blitz.
case 25: xp = 43.0; break;// Shadow blitz.
case 26: xp = 45.0; break;// Blood blitz.
case 27: xp = 46.0; break;// Ice blitz.
case 28: xp = 48.0; break;// Smoke barrage.
case 29: xp = 48.0; break;// Shadow barrage.
case 30: xp = 51.0; break;// Blood barrage.
case 31: xp = 52.0; break;// Ice barrage.
case 48: xp = 36.0; break;// Miasmic rush.
case 49: xp = 42.0; break;// Miasmic burst.
case 50: xp = 48.0; break;// Miasmic blitz.
case 51: xp = 54.0; break;// Miasmic barrage.
}
double finalXp = baseXp ? (xp + (hit * 2)) : (hit * 2);
p.getSkills().addXp(Skills.SKILL.MAGIC, finalXp);
p.getSkills().addXp(Skills.SKILL.HITPOINTS, hit * 1.33);
target.addToHitCount(p, hit);
} else if (target != null) {
target.addToHitCount(p, hit);
}
}
示例9: savePlayer
public bool savePlayer(Player p)
{
if (p == null) return false;
try
{
string username = p.getLoginDetails().getUsername().ToLower();
/* Character saving code goes here */
XmlTextWriter writer = new XmlTextWriter(misc.getServerPath() + @"\accounts\" + username + ".xml", null);
writer.Formatting = Formatting.Indented;
writer.WriteStartElement("Player");
writer.WriteStartElement("Login");
writer.WriteElementString("Password", p.getLoginDetails().getPassword());
writer.WriteElementString("Rights", p.getRights().ToString());
writer.WriteElementString("BankPin", p.getBank().getBankPin());
writer.WriteEndElement();
writer.WriteStartElement("Position");
writer.WriteElementString("X", p.getLocation().getX().ToString());
writer.WriteElementString("Y", p.getLocation().getY().ToString());
writer.WriteElementString("Z", p.getLocation().getZ().ToString());
writer.WriteEndElement();
writer.WriteStartElement("Settings");
writer.WriteElementString("RunEnergy", p.getRunEnergy().ToString());
writer.WriteStartElement("PrivacySettings");
writer.WriteElementString("Public", p.getFriends().getPrivacyOption(0).ToString());
writer.WriteElementString("Private", p.getFriends().getPrivacyOption(1).ToString());
writer.WriteElementString("Trade", p.getFriends().getPrivacyOption(2).ToString());
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteStartElement("Friends");
foreach(long friend in p.getFriends().getFriendsList())
writer.WriteElementString("Friend", friend.ToString());
writer.WriteEndElement();
writer.WriteStartElement("Ignores");
foreach (long ignore in p.getFriends().getIgnoresList())
writer.WriteElementString("Ignore", ignore.ToString());
writer.WriteEndElement();
writer.WriteStartElement("Stats");
foreach (Skills.SKILL skill in Enum.GetValues(typeof(Skills.SKILL))) {
writer.WriteStartElement(skill.ToString()); //skill name.
writer.WriteElementString("CurrentLevel", p.getSkills().getCurLevel(skill).ToString());
writer.WriteElementString("XP", p.getSkills().getXp(skill).ToString());
writer.WriteEndElement();
}
writer.WriteEndElement();
Item item;
writer.WriteStartElement("EquipmentItems");
foreach (ItemData.EQUIP equip in Enum.GetValues(typeof(ItemData.EQUIP))) {
if (equip == ItemData.EQUIP.NOTHING) continue;
item = p.getEquipment().getSlot(equip);
if (item.getItemId() == -1) continue; //empty slot.
writer.WriteStartElement(equip.ToString());
writer.WriteElementString("Id", item.getItemId().ToString());
writer.WriteElementString("Amount", item.getItemAmount().ToString());
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteStartElement("InventoryItems");
for (int i = 0; i < Inventory.MAX_INVENTORY_SLOTS; i++) {
item = p.getInventory().getSlot(i);
if (item.getItemId() == -1) continue; //empty slot.
writer.WriteStartElement("Item");
writer.WriteElementString("Slot", i.ToString());
writer.WriteElementString("Id", item.getItemId().ToString());
writer.WriteElementString("Amount", item.getItemAmount().ToString());
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteStartElement("BankItems");
for (int i = 0; i < Bank.MAX_BANK_SLOTS; i++)
{
item = p.getBank().getSlot(i);
if (item.getItemId() == -1) continue; //empty slot.
writer.WriteStartElement("Item");
writer.WriteElementString("Slot", i.ToString());
writer.WriteElementString("Id", item.getItemId().ToString());
writer.WriteElementString("Amount", item.getItemAmount().ToString());
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndElement();
//Write the XML to file and close the writer
writer.Close();
}
catch (Exception)
{
return false;
}
//.........这里部分代码省略.........
示例10: appendHitUpdate
private static void appendHitUpdate(Player p, PacketBuilder updateBlock)
{
int ratio = p.getSkills().getCurLevel(Skills.SKILL.HITPOINTS) * 255 / p.getSkills().getMaxLevel(Skills.SKILL.HITPOINTS);
if (p.getSkills().getCurLevel(Skills.SKILL.HITPOINTS) > p.getSkills().getMaxLevel(Skills.SKILL.HITPOINTS))
{
ratio = p.getSkills().getMaxLevel(3) * 255 / p.getSkills().getCurLevel(Skills.SKILL.HITPOINTS);
}
if(p.getHits().getHitDamage1() < 128) //damage can be either addByte [for damage less then 128 otherwise UShort]
updateBlock.addByte((byte)p.getHits().getHitDamage1());
else
updateBlock.addUShort(p.getHits().getHitDamage1() + 0x8000);
updateBlock.addByteA((byte)p.getHits().getHitType1());
updateBlock.addByteS(ratio);
}
示例11: appendAppearanceUpdate
private static void appendAppearanceUpdate(Player p, PacketBuilder updateBlock)
{
PacketBuilder playerProps = new PacketBuilder().setSize(Packet.Size.Bare);
Appearance app = p.getAppearance();
playerProps.addByte((byte) (app.getGender() & 0xFF));
if((app.getGender() & 0x2) == 2) {
playerProps.addByte((byte) 0);
playerProps.addByte((byte) 0);
}
playerProps.addByte((byte) p.getPrayers().getPkIcon());
playerProps.addByte((byte) p.getPrayers().getHeadIcon());
if (!app.isInvisible()) {
if(!app.isNpc()) {
for(int i = 0; i < 4; i++) {
if(p.getEquipment().getItemInSlot((ItemData.EQUIP)i) != -1) {
playerProps.addUShort(32768 + p.getEquipment().getSlot((ItemData.EQUIP)i).getDefinition().getEquipId());
} else {
playerProps.addByte((byte) 0);
}
}
if (p.getEquipment().getItemInSlot(ItemData.EQUIP.CHEST) != -1)
{
playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.CHEST).getDefinition().getEquipId());
} else {
playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.AMULET));
}
if (p.getEquipment().getItemInSlot(ItemData.EQUIP.SHIELD) != -1)
{
playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.SHIELD).getDefinition().getEquipId());
} else {
playerProps.addByte((byte) 0);
}
Item chest = p.getEquipment().getSlot(ItemData.EQUIP.CHEST);
if (chest != null && chest.getDefinition() != null)
{
if(!ItemData.isFullBody(chest.getDefinition())) {
playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
} else {
playerProps.addByte((byte) 0);
}
} else {
playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
}
if (p.getEquipment().getItemInSlot(ItemData.EQUIP.LEGS) != -1)
{
playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.LEGS).getDefinition().getEquipId());
} else {
playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.SHIELD));
}
Item hat = p.getEquipment().getSlot(ItemData.EQUIP.HAT);
if (hat != null && hat.getDefinition() != null)
{
if(!ItemData.isFullHat(hat.getDefinition()) && !ItemData.isFullMask(hat.getDefinition())) {
playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
} else {
playerProps.addByte((byte) 0);
}
} else {
playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
}
if (p.getEquipment().getItemInSlot(ItemData.EQUIP.HANDS) != -1)
{
playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.HANDS).getDefinition().getEquipId());
} else {
playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CHEST));
}
if (p.getEquipment().getItemInSlot(ItemData.EQUIP.FEET) != -1)
{
playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.FEET).getDefinition().getEquipId());
} else {
playerProps.addUShort(0x100 + app.getLook(6));
}
if (hat != null && hat.getDefinition() != null)
{
if(!ItemData.isFullMask(hat.getDefinition())) {
playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
} else {
playerProps.addByte((byte) 0);
}
} else {
playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
}
} else {
playerProps.addUShort(-1);
playerProps.addUShort(app.getNpcId());
playerProps.addByte((byte) 255);
}
} else {
for (int i = 0; i < 12; i++) {
playerProps.addByte((byte) 0);
}
}
foreach(int colour in app.getColoursArray()) {
playerProps.addByte((byte) colour);
}
playerProps.addUShort(p.getEquipment().getStandWalkAnimation());
playerProps.addLong(p.getLoginDetails().getLongName());
playerProps.addByte((byte) p.getSkills().getCombatLevel());
playerProps.addUShort(0);
//.........这里部分代码省略.........
示例12: getMagicAttack
private static double getMagicAttack(Player p)
{
int magicBonus = p.getEquipment().getBonus(Equipment.BONUS.MAGIC_ATTACK);
double magicLevel = Convert.ToDouble(p.getSkills().getCurLevel(Skills.SKILL.MAGIC));
double power = 1.800;
double amount = 0.0205;
if (magicBonus >= 80) { // equivalent of max mage w/ zerker+whip
amount = 0.0500;
} else if (magicBonus >= 90) { // equivalent of max mage w/whip or mystic + ancient staff
amount = 0.0780;
} else if (magicBonus >= 105) { // equivalent of max mage w/ ancient staff
amount = 0.920;
} else if (magicBonus >= 115) { // equivalent of max mage w/ wand or better
amount = 0.1110;
}
power *= (magicBonus * amount) + (magicLevel *= 0.0120);
int prayer = p.getPrayers().getMagicPrayer();
if (prayer > 0) {
if (prayer == 1) {
power *= 1.05;
} else if (prayer == 2) {
power *= 1.10;
} else if (prayer == 3) {
power *= 1.15;
}
}
return power;
}
示例13: getRangeMaxHit
public static double getRangeMaxHit(Player p, int bow, int arrow)
{
double hit = 0;
double a = p.getSkills().getCurLevel(Skills.SKILL.RANGE);
double b = 1.00;
double c = 0;
int d = getRangeStrength(p);
int prayer = p.getPrayers().getRangePrayer();
if (prayer == 1) {
b *= 1.05;
} else if (prayer == 2) {
b *= 1.10;
} else if (prayer == 3) {
b *= 1.15;
}
if (wearingRangeVoid(p)) {
b *= 1.15;
}
c = (a * b);
if (p.getAttackStyle().getStyle().Equals(AttackStyle.CombatStyle.RANGE_ACCURATE)) {
c += 3.00;
}
hit = ((c + 8) * (d + 64) / 640);
return Math.Floor(hit);
}
示例14: getPlayerMaxHit
public static double getPlayerMaxHit(Player player, int strBonusIncrease)
{
AttackStyle.CombatSkill fightType = player.getAttackStyle().getSkill();
double myCurStrength = (double)player.getSkills().getCurLevel(Skills.SKILL.STRENGTH);
double myEquipStrengthBonus = (double)(player.getEquipment().getBonus(Equipment.BONUS.STRENGTH) + strBonusIncrease);
double fightingStyle = 0;
double powerMultiplier = 1;
double dharokModifier = 1;
double damageMultiplier = 1;
int strPrayer = player.getPrayers().getStrengthPrayer();
if (strPrayer == 1)
{
powerMultiplier += 0.05;
}
else if (strPrayer == 2)
{
powerMultiplier += 0.1;
}
else if (strPrayer == 3)
{
powerMultiplier += 0.15;
}
else if (player.getPrayers().getSuperPrayer() == 1)
{
powerMultiplier += 0.18;
}
else if (player.getPrayers().getSuperPrayer() == 2)
{
powerMultiplier += 0.23;
}
if (wearingMeleeVoid(player))
{
damageMultiplier += 0.1;
}
else if (wearingDharok(player) && misc.random(3) == 0)
{
dharokModifier = misc.random((int)((player.getSkills().getGreaterLevel(Skills.SKILL.HITPOINTS) - player.getSkills().getCurLevel(Skills.SKILL.HITPOINTS)) * 0.1));
}
if (fightType.Equals(AttackStyle.CombatSkill.AGGRESSIVE))
{
fightingStyle = 3;
} else if (fightType.Equals(AttackStyle.CombatSkill.CONTROLLED))
{
fightingStyle = 1;
}
double cumulativeStrength = ((myCurStrength) * (powerMultiplier) + fightingStyle) * dharokModifier;
double maxHit = ((13 + (cumulativeStrength) + (myEquipStrengthBonus / 8) + ((cumulativeStrength * myEquipStrengthBonus) / 64)) * damageMultiplier); // NEW MAX HIT FORMULA
maxHit = maxHit / 10; //this is temporary because I haven't yet fully implemented the huge damage system.
return maxHit;
}
示例15: showBentleyDialogue
public static void showBentleyDialogue(Player p, int status)
{
int newStatus = -1;
p.getPackets().softCloseInterfaces();
if (p.getTemporaryAttribute("unmovable") != null) {
return;
}
switch(status) {
case 240:
p.getPackets().sendNPCHead(4540, 241, 2);
p.getPackets().modifyText("Captain Bentley", 241, 3);
p.getPackets().modifyText("Well, hello there " + p.getLoginDetails().getUsername() + ", ready to set sail?", 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
p.getPackets().sendChatboxInterface2(241);
newStatus = 241;
break;
case 241:
p.getPackets().modifyText("I'd like to travel to..", 235, 1);
p.getPackets().modifyText("Canifis", 235, 2);
p.getPackets().modifyText("Waterbirth Isle", 235, 3);
p.getPackets().modifyText("Pest Control", 235, 4);
p.getPackets().modifyText("Warrior Guild", 235, 5);
p.getPackets().modifyText("Fremmenik Shore", 235, 6);
p.getPackets().sendChatboxInterface2(235);
newStatus = 242;
break;
case 242: // Canifis
travel(p, 0, false);
break;
case 243: // Waterbirth isle
travel(p, 1, false);
break;
case 244: // Pest control
travel(p, 2, false);
break;
case 245: // Warrior guild
int attackLevel = p.getSkills().getMaxLevel(Skills.SKILL.ATTACK);
int strengthLevel = p.getSkills().getMaxLevel(Skills.SKILL.STRENGTH);
bool hasA99 = attackLevel == 99 || strengthLevel == 99;
if (((attackLevel + strengthLevel) >= 130) || hasA99) {
travel(p, 3, false);
} else {
p.getPackets().sendNPCHead(4540, 243, 2);
p.getPackets().modifyText("Captain Bentley", 243, 3);
p.getPackets().modifyText("I'm sorry " + p.getLoginDetails().getUsername() + ", I cannot take you there.", 243, 4);
p.getPackets().modifyText("A combined Attack & Strength level of 130 is ", 243, 5);
p.getPackets().modifyText("required to use The Warrior Guild.", 243, 6);
p.getPackets().animateInterface(9827, 243, 2);
p.getPackets().sendChatboxInterface2(243);
}
break;
case 246: // Fremmenik shore
travel(p, 4, false);
break;
}
if (newStatus != -1) {
p.setTemporaryAttribute("dialogue", newStatus);
}
}