public int BlackImbue(Equipment Item, ref ImbueStat stat, ImbueItem imbueitem, int success) { int value = (int)(Item.RequiredLevel) + imbueitem.IncreaseValue; value += (int)(((value * 0.1) * Item.Plus) + ((imbueitem.ImbueChance / 5) * Item.Plus)); value *= success; if (Item is Hand) { Item.Damage += (short)value; stat = ImbueStat.Damage; } if (Item is Cape) { if (Item.Damage > 0 && Item.Defence > 0) { Item.Defence += (short)value; Item.Damage += (short)value; stat = ImbueStat.DefenseAndDamage; } else { Item.Defence += (short)value; stat = ImbueStat.Defense; } } if (Item is Head) { Item.AttackRating += (short)value; stat = ImbueStat.AttackRating; } if (Item is Body) { Item.Defence += (short)value; stat = ImbueStat.Defense; } if (Item is Feet) { value = (int)(Math.Round((double)(value / 50))) + 1; Item.Critical += (short)value; stat = ImbueStat.CriticalHit; } if (Item is Ring) { Item.IncMaxLife += (short)value; stat = ImbueStat.MaxLife; } if (Item is Necklace) { Item.IncMaxMana += (short)value; stat = ImbueStat.MaxMana; } return(value); }
public int BlackImbue(Equipment Item, ref ImbueStat stat, ImbueItem imbueitem, int success) { int value = (int)(Item.RequiredLevel) + imbueitem.IncreaseValue; value += (int)(((value * 0.1) * Item.Plus) + ((imbueitem.ImbueChance / 5) * Item.Plus)); value *= success; if (Item is Hand) { Item.Damage += (short)value; stat = ImbueStat.Damage; } if (Item is Cape) { if (Item.Damage > 0 && Item.Defence > 0) { Item.Defence += (short)value; Item.Damage += (short)value; stat = ImbueStat.DefenseAndDamage; } else { Item.Defence += (short)value; stat = ImbueStat.Defense; } } if (Item is Head) { Item.AttackRating += (short)value; stat = ImbueStat.AttackRating; } if (Item is Body) { Item.Defence += (short)value; stat = ImbueStat.Defense; } if (Item is Feet) { value = (int)(Math.Round((double)(value / 50))) + 1; Item.Critical += (short)value; stat = ImbueStat.CriticalHit; } if (Item is Ring) { Item.IncMaxLife += (short)value; stat = ImbueStat.MaxLife; } if (Item is Necklace) { Item.IncMaxMana += (short)value; stat = ImbueStat.MaxMana; } return value; }
public BaseItem PickupItem(int mapItemId, Client c, short mapItemAmount) { MapItem m = null; try { m = mapItems.Where(x => x.MapItemID == mapItemId).First(); } catch (Exception) { return(null); } BaseItem item = null; if (m.DroppedByCharacterID == 0 || m.DroppedByCharacterID == c.MyCharacter.CharacterId) { if (m.bType != (byte)bType.Jeon) { if (m.ItemID != 0) { item = itemDataManager.GetItemByItemID(m.ItemID); } else { item = itemDataManager.GetItemByReferenceID(m.ReferenceID); } BagSlot bagSlot = gameEngine.TryPickToBags(c.MyCharacter.Bags.ToArray(), item); item.Slot = bagSlot.Slot; item.Bag = bagSlot.Bag; mapItemManager.DeleteMapItem(m.MapItemID, 0); mapItems.Remove(m); item.OwnerID = c.MyCharacter.CharacterId; if (item.ItemID != 0) { itemDataManager.UpdateItem(item); } else { item.ItemID = itemDataManager.InsertItem(item); if (item is Equipment) { // later add chance to get these items blabla Equipment Item = item as Equipment; ImbueStat stat = ImbueStat.None; ImbueItem imbueitem = new ImbueItem { ImbueChance = 1, IncreaseValue = 1, }; // Possible plus for drop if (XiahRandom.PercentSuccess(40)) { int plus = gameEngine.RandomChance(0, 5); for (int i = 0; i < plus; i++) { gameEngine.BlackImbue(Item, ref stat, imbueitem, 1); Item.Plus++; } } if (XiahRandom.PercentSuccess(40)) { // Possible slvl for drop int slvl = gameEngine.RandomChance(0, 5); for (int i = 0; i < slvl && !(Item is Cape); i++) { gameEngine.WhiteImbue(Item, ref stat, imbueitem); Item.Slvl++; } } item = Item; itemDataManager.UpdateItem(item); } } } else { item = itemDataManager.GetItemByReferenceID(m.ReferenceID); mapItemManager.DeleteMapItem(m.MapItemID, 0); mapItems.Remove(m); item.Amount = mapItemAmount; } } else { c.Send(PacketEngine.PacketManager.SendPickUpText(0, 0, 0)); // send pickuperror blabal } return(item); }
public static byte[] SendImbueMessage(ImbueError error, ImbueStat stat, int value, Equipment item) { Packet p = new Packet(5); p.WriteByte((byte)error); // Error message p.WriteByte((byte)stat); // Stat p.WriteInt(value); p.WriteHexString("00"); p.WriteShort(item.ReferenceID); p.WriteByte(item.Plus); p.WriteByte(item.Slvl); return p.GetWrittenBuffer(PacketIds.SendImbueMessage); }
public int WhiteImbue(Equipment Item, ref ImbueStat stat, ImbueItem imbueitem) { int value = (int)(Item.RequiredLevel); value += (int)(((value * 0.1) * Item.Slvl) + ((imbueitem.ImbueChance / 5) * Item.Slvl)); List <ImbueStat> WhiteStats = new List <ImbueStat>(); WhiteStats.Add(ImbueStat.Damage); WhiteStats.Add(ImbueStat.Defense); WhiteStats.Add(ImbueStat.AttackRating); WhiteStats.Add(ImbueStat.MaxLife); WhiteStats.Add(ImbueStat.MaxMana); WhiteStats.Add(ImbueStat.LifeReg); WhiteStats.Add(ImbueStat.ManaReg); WhiteStats.Add(ImbueStat.CriticalHit); if (Item is Cape) { WhiteStats.Remove(ImbueStat.Damage); WhiteStats.Remove(ImbueStat.Defense); } if (Item is Hand) { Hand weapon = Item as Hand; WhiteStats.Remove(weapon.NotWithWhite); } if (Item is Head) { Head hat = Item as Head; WhiteStats.Remove(hat.NotWithWhite); } if (Item is Body) { Body armor = Item as Body; WhiteStats.Remove(armor.NotWithWhite); } if (Item is Ring) { Ring ring = Item as Ring; value *= (int)2.94; } if (Item is Necklace) { Necklace neck = Item as Necklace; value *= (int)1.85; } if (imbueitem.ImbueData == 0) { int randomStat = Random.Next(0, WhiteStats.Count); stat = WhiteStats[randomStat]; } else { switch (imbueitem.ImbueData) { case 2: stat = ImbueStat.Damage; break; case 3: stat = ImbueStat.Defense; break; case 4: stat = ImbueStat.AttackRating; break; case 5: stat = ImbueStat.CriticalHit; break; case 6: stat = ImbueStat.MaxLife; break; case 7: stat = ImbueStat.MaxMana; break; case 8: stat = ImbueStat.LifeReg; break; case 9: stat = ImbueStat.ManaReg; break; default: stat = ImbueStat.CriticalHit; break; } } switch (stat) { case ImbueStat.Damage: Item.Damage += (short)value; break; case ImbueStat.Defense: Item.Defence += (short)value; break; case ImbueStat.AttackRating: Item.AttackRating += (short)value; break; case ImbueStat.MaxLife: Item.IncMaxLife += (short)value; break; case ImbueStat.MaxMana: Item.IncMaxMana += (short)value; break; case ImbueStat.LifeReg: Item.IncLifeRegen += (short)value; break; case ImbueStat.ManaReg: Item.IncManaRegen += (short)value; break; case ImbueStat.CriticalHit: value = (int)(Math.Round((double)(value / 50))) + 1; Item.Critical += (short)value; break; } return(value); }
public void RedImbue(Equipment Item, ImbueStat stat, ref int value, bool success, ref ImbueError error) { if (success) { error = ImbueError.Success; } else { error = ImbueError.FailedToRemake; if (PercentSuccess(30)) { value *= -1; } else { value *= 0; } } switch (stat) { case ImbueStat.RequiredLevel: if (Item.RequiredLevel >= -value) { Item.RequiredLevel += (short)value; } else { Item.RequiredLevel = 0; } return; case ImbueStat.RequiredStrength: if (Item.RequiredStrength >= -value) { Item.RequiredStrength += (short)value; } else { Item.RequiredStrength = 0; } return; case ImbueStat.RequiredStamina: if (Item.RequiredStamina >= -value) { Item.RequiredStamina += (short)value; } else { Item.RequiredStamina = 0; } return; case ImbueStat.RequiredDexterity: if (Item.RequiredDexterity >= -value) { Item.RequiredDexterity += (short)value; } else { Item.RequiredDexterity = 0; } return; case ImbueStat.RequiredEnergy: if (Item.RequiredEnergy >= -value) { Item.RequiredEnergy += (short)value; } else { Item.RequiredEnergy = 0; } return; default: stat = ImbueStat.None; return; } }
void c_ClientAcceptImbueItemInfo(object sender, ClientAcceptImbueItemEventArgs e) { Client c = (Client)sender; AcceptImbueItem i = e.Info; Equipment Item = null; BaseItem item = null; BaseItem imbueItem1 = null; ImbueError error; ImbueStat stat = ImbueStat.CriticalHit; try { item = c.MyCharacter.Bags[i.ToImbueItemBag - 1].Items.Single(x => (x.ItemID == i.ToImbueItemID && x.Slot == i.ToImbueItemSlot)); if (item is Equipment) { Item = item as Equipment; } imbueItem1 = c.MyCharacter.Bags[i.ImbueItem1Bag - 1].Items.Single(x => (x.ItemID == i.ImbueItem1ID)); double SuccessChance = 33.3f; // flat 1/3 chance as there chance to success, fail, and drop so :/ if (Item.Plus == 0 && imbueItem1 is Black) { SuccessChance = 100; } if (imbueItem1 is ImbueItem) { ImbueItem imbueitem = imbueItem1 as ImbueItem; SuccessChance += (double)imbueitem.ImbueChance; } // ADD UBER LEET REMOVE FROM BAG & SAVE DATABASE YOU LOST THE ITEM PLXO int value = 0; if (itemDataManager.PercentSuccess(SuccessChance)) { value = 1; // just - value to decrease xd Item.Damage += (short)value; Item.Plus++; error = ImbueError.Success; stat = ImbueStat.Damage; } else { if (Item.Plus >= 4 && itemDataManager.PercentSuccess(30)) { // I DROP YO STATS } error = ImbueError.FailedToRemake; stat = ImbueStat.None; value = 0; } c.Send(PacketManager.SendImbueMessage(error, stat, value, Item)); c.Send(PacketManager.SendRemoveItem(i.ImbueItem1Bag, i.ImbueItem1Slot)); Item.ImbueTries++; c.Send(PacketManager.SendImbuedItem((BaseItem)Item)); itemDataManager.UpdateItem((BaseItem)Item); } catch { } }
public int WhiteImbue(Equipment Item, ref ImbueStat stat, ImbueItem imbueitem) { int value = (int)(Item.RequiredLevel); value += (int)(((value * 0.1) * Item.Slvl) + ((imbueitem.ImbueChance / 5) * Item.Slvl)); List<ImbueStat> WhiteStats = new List<ImbueStat>(); WhiteStats.Add(ImbueStat.Damage); WhiteStats.Add(ImbueStat.Defense); WhiteStats.Add(ImbueStat.AttackRating); WhiteStats.Add(ImbueStat.MaxLife); WhiteStats.Add(ImbueStat.MaxMana); WhiteStats.Add(ImbueStat.LifeReg); WhiteStats.Add(ImbueStat.ManaReg); WhiteStats.Add(ImbueStat.CriticalHit); if (Item is Cape) { WhiteStats.Remove(ImbueStat.Damage); WhiteStats.Remove(ImbueStat.Defense); } if (Item is Hand) { Hand weapon = Item as Hand; WhiteStats.Remove(weapon.NotWithWhite); } if (Item is Head) { Head hat = Item as Head; WhiteStats.Remove(hat.NotWithWhite); } if (Item is Body) { Body armor = Item as Body; WhiteStats.Remove(armor.NotWithWhite); } if (Item is Ring) { Ring ring = Item as Ring; value *= (int)2.94; } if (Item is Necklace) { Necklace neck = Item as Necklace; value *= (int)1.85; } if (imbueitem.ImbueData == 0) { int randomStat = Random.Next(0, WhiteStats.Count); stat = WhiteStats[randomStat]; } else { switch (imbueitem.ImbueData) { case 2: stat = ImbueStat.Damage; break; case 3: stat = ImbueStat.Defense; break; case 4: stat = ImbueStat.AttackRating; break; case 5: stat = ImbueStat.CriticalHit; break; case 6: stat = ImbueStat.MaxLife; break; case 7: stat = ImbueStat.MaxMana; break; case 8: stat = ImbueStat.LifeReg; break; case 9: stat = ImbueStat.ManaReg; break; default: stat = ImbueStat.CriticalHit; break; } } switch (stat) { case ImbueStat.Damage: Item.Damage += (short)value; break; case ImbueStat.Defense: Item.Defence += (short)value; break; case ImbueStat.AttackRating: Item.AttackRating += (short)value; break; case ImbueStat.MaxLife: Item.IncMaxLife += (short)value; break; case ImbueStat.MaxMana: Item.IncMaxMana += (short)value; break; case ImbueStat.LifeReg: Item.IncLifeRegen += (short)value; break; case ImbueStat.ManaReg: Item.IncManaRegen += (short)value; break; case ImbueStat.CriticalHit: value = (int)(Math.Round((double)(value / 50))) + 1; Item.Critical += (short)value; break; } return value; }
public void RedImbue(Equipment Item, ImbueStat stat, ref int value, bool success, ref ImbueError error) { if (success) error = ImbueError.Success; else { error = ImbueError.FailedToRemake; if (PercentSuccess(30)) { value *= -1; } else { value *= 0; } } switch (stat) { case ImbueStat.RequiredLevel: if (Item.RequiredLevel >= -value) Item.RequiredLevel += (short)value; else Item.RequiredLevel = 0; return; case ImbueStat.RequiredStrength: if (Item.RequiredStrength >= -value) Item.RequiredStrength += (short)value; else Item.RequiredStrength = 0; return; case ImbueStat.RequiredStamina: if (Item.RequiredStamina >= -value) Item.RequiredStamina += (short)value; else Item.RequiredStamina = 0; return; case ImbueStat.RequiredDexterity: if (Item.RequiredDexterity >= -value) Item.RequiredDexterity += (short)value; else Item.RequiredDexterity = 0; return; case ImbueStat.RequiredEnergy: if (Item.RequiredEnergy >= -value) Item.RequiredEnergy += (short)value; else Item.RequiredEnergy = 0; return; default: stat = ImbueStat.None; return; } }