Exemplo n.º 1
0
 public override bool ReceiveItem(GameLiving source, InventoryItem item)
 {
     GamePlayer player = source as GamePlayer;
     if (player == null || item == null) return false;
     bool output = false;
     #region messages
     if (player.BountyPoints < 300)
     {
         SendReply(player, "You need 300 bounty points to use my service!");
         return false;
     }
     if (WorldMgr.GetDistance(this, player) > WorldMgr.INTERACT_DISTANCE)
     {
         player.Out.SendMessage("You are too far away to give anything to " + GetName(0, false) + ".", eChatType.CT_System, eChatLoc.CL_SystemWindow);
         return false;
     }
     if ((player.TempProperties.getProperty<InventoryItem>(TempProperty)) != null)
     {
         item = player.TempProperties.getProperty<InventoryItem>(TempProperty);
         SendReply(player, "You already gave me an item! What was it again?");
         output = true;
     }
     SendReply(player, "Ok, now whisper me the model ID.");
     player.TempProperties.setProperty(TempProperty, item);
     return true;
     #endregion messages
 }
Exemplo n.º 2
0
		/// <summary>
		/// This function is called when player accept the combine
		/// </summary>
		/// <param name="player"></param>
		/// <param name="item"></param>
		public override bool IsAllowedToCombine(GamePlayer player, InventoryItem item)
		{
			if (!base.IsAllowedToCombine(player, item)) 
                return false;
			
			if (((InventoryItem)player.TradeWindow.TradeItems[0]).Object_Type != 
                (int)eObjectType.AlchemyTincture)
			{
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, 
                    "Alchemy.IsAllowedToCombine.AlchemyTinctures"), PacketHandler.eChatType.CT_System, 
                    PacketHandler.eChatLoc.CL_SystemWindow);
				
                return false;
			}

			if (player.TradeWindow.ItemsCount > 1)
			{
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language,
                    "Alchemy.IsAllowedToCombine.OneTincture"), PacketHandler.eChatType.CT_System, 
                    PacketHandler.eChatLoc.CL_SystemWindow);

				return false;
			}

			if (item.ProcSpellID != 0 || item.SpellID != 0)
			{
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, 
                    "Alchemy.IsAllowedToCombine.AlreadyImbued", item.Name), 
                    PacketHandler.eChatType.CT_System, PacketHandler.eChatLoc.CL_SystemWindow);

				return false;
			}

			return true;
		}
Exemplo n.º 3
0
        /// <summary>
        /// Creates a new GameInventoryItem based on an
        /// InventoryTemplateID. Will disappear after 3 minutes if
        /// added to the world
        /// </summary>
        /// <param name="item">The InventoryItem to load and create an item from</param>
        /// <returns>Found item or null</returns>
        public static WorldInventoryItem CreateFromTemplate(InventoryItem item)
        {
            if (item.Template is ItemUnique)
                return null;

            return CreateFromTemplate(item.Id_nb);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Handle an item given to the scholar.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="item"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
        {
            if (base.ReceiveItem(source, target, item))
                return true;

            GamePlayer player = source as GamePlayer;
            Scholar scholar = target as Scholar;
            if (player == null || scholar == null)
                return false;

            if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
            {
                scholar.TurnTo(player);
                if (RemoveItem(player, item))
                {
                    String reply = String.Format("You now have a decision to make, {0}. {1} {2} {3} {4} {5}",
                        player.CharacterClass.Name,
                        "I can unlock your Battler so it uses [slashing] skills or so it uses",
                        "[crushing] skills. In both cases, I can unlock it as a one-handed weapon",
                        "or a two-handed one. All you must do is decide which kind of damage you",
                        "would like to do to your enemies. Once you have chosen, you cannot change",
                        "your mind.");
                    scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
                    Step = 3;
                    return true;
                }
            }

            return false;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Handle an item given to the scholar.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="item"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
        {
            GamePlayer player = source as GamePlayer;
            Scholar scholar = target as Scholar;
            if (player == null || scholar == null)
                return false;

            if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
            {
                Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
                    (eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

                IDictionaryEnumerator versionsEnum = versions.GetEnumerator();
                versionsEnum.MoveNext();

                if (versions.Count > 0 && RemoveItem(player, item))
                {
                    GiveItem(scholar, player, ArtifactID, versionsEnum.Value as ItemTemplate);
                    String reply = String.Format("Thank you! Here, take this cloak. {0}",
                        "I hope you find it useful. Please don't lose it, I can't replace it!");
                    scholar.TurnTo(player);
                    scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
                    FinishQuest();
                    return true;
                }
            }

            return base.ReceiveItem(source, target, item);
        }
Exemplo n.º 6
0
		/// <summary>
		/// Handle an item given to the scholar.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <param name="target"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
		{
			if (base.ReceiveItem(source, target, item))
				return true;

			GamePlayer player = source as GamePlayer;
			Scholar scholar = target as Scholar;
			if (player == null || scholar == null)
				return false;

			if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
			{
				Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
					(eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

				if (versions.Count > 0 && RemoveItem(player, item))
				{
					GiveItem(scholar, player, ArtifactID, versions[";;"]);
					String reply = String.Format("Great! Thanks! This should help us in {0} {1}",
						"our studies. We've found several other references to this shield. Don't know how",
						"much this book will help, but it certainly can't hurt!");
					scholar.TurnTo(player);
					scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
					FinishQuest();
					return true;
				}
			}

			return false;
		}
Exemplo n.º 7
0
		/// <summary>
		/// Invoked when scholar receives an item.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, InventoryItem item)
		{
			GamePlayer player = source as GamePlayer;

			if (player != null)
			{
				lock (QuestListToGive.SyncRoot)
				{
					foreach (AbstractQuest quest in player.QuestList)
					{
						if (quest is ArtifactTurnInQuest)
						{
							ArtifactTurnInQuest aquest = quest as ArtifactTurnInQuest;

							if (HasQuest(aquest.GetType()) != null && aquest.ReceiveItem(player, this, item))
							{
								return true;
							}
						}
					}
				}
			}

			return base.ReceiveItem(source, item);
		}
Exemplo n.º 8
0
		/// <summary>
		/// Handle an item given to the scholar.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <param name="target"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
		{
			if (base.ReceiveItem(source, target, item))
				return true;

			GamePlayer player = source as GamePlayer;
			Scholar scholar = target as Scholar;
			if (player == null || scholar == null)
				return false;

			if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
			{
				Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
					(eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

				if (versions.Count > 0 && RemoveItem(player, item))
				{
					GiveItem(scholar, player, ArtifactID, versions[";;"]);
					String reply = String.Format("Here is the Healer's Embrace Cloak, {0} {1} {2} {3}, {4}!",
						"restored to its original power. It is a fine cloak and I wish I could keep",
						"it, but it is for you and you alone. Do not destroy it because you will never",
						"have access to its full power again. Take care of it and it shall aid you in",
						"the trials",
						player.CharacterClass.Name);
					scholar.TurnTo(player);
					scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
					FinishQuest();
					return true;
				}
			}

			return false;
		}
Exemplo n.º 9
0
		/// <summary>
		/// Called when player try to use a secondary crafting skill
		/// </summary>
		/// <param name="item"></param>
		/// <param name="player"></param>
		/// <returns></returns>
		public static int BeginWork(GamePlayer player, InventoryItem item)
		{
			if (!IsAllowedToBeginWork(player, item, 50))
			{
				return 0;
			}

			GamePlayer tradePartner = null;
			if (player.TradeWindow != null) tradePartner = player.TradeWindow.Partner;
			
			if (player.IsMoving || player.IsStrafing)
			{
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Repair.BeginWork.StopRepair1", item.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
				if (tradePartner != null) tradePartner.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Repair.BeginWork.StopRepair2", player.Name, item.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return 0;
			}

			player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Repair.BeginWork.BeginRepairing2", item.Name, CalculateSuccessChances(player, item).ToString()), eChatType.CT_System, eChatLoc.CL_SystemWindow);
			if (tradePartner != null) tradePartner.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Repair.BeginWork.BeginRepairing2", player.Name, item.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);

			int workDuration = GetRepairTime(player, item);
			player.Out.SendTimerWindow(LanguageMgr.GetTranslation(player.Client.Account.Language, "Repair.BeginWork.Repairing", item.Name), workDuration);
			player.CraftTimer = new RegionTimer(player);
			player.CraftTimer.Callback = new RegionTimerCallback(Proceed);
			player.CraftTimer.Properties.setProperty(AbstractCraftingSkill.PLAYER_CRAFTER, player);
			player.CraftTimer.Properties.setProperty(PLAYER_PARTNER, tradePartner);
			player.CraftTimer.Properties.setProperty(AbstractCraftingSkill.RECIPE_BEING_CRAFTED, item);
			player.CraftTimer.Start(workDuration * 1000);
			return 1;
		}
Exemplo n.º 10
0
		/// <summary>
		/// Handle an item given to the scholar.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <param name="target"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
		{
			if (base.ReceiveItem(source, target, item))
				return true;

			GamePlayer player = source as GamePlayer;
			Scholar scholar = target as Scholar;
			if (player == null || scholar == null)
				return false;

			if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
			{
				Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
					(eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

				if (versions.Count > 0 && RemoveItem(player, item))
				{
					GiveItem(scholar, player, ArtifactID, versions[";;"]);
					String reply = String.Format("Ahh. This is a tale about some great {0} {1} {2} {3}.",
						"crazy champion named Remus. There's not much known about him, or his father,",
						"except what is in this tale. I've read pieces of it, but never did we find all",
						"the letters. It's a great find. Thank you,",
						player.Name);
					scholar.TurnTo(player);
					scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
					FinishQuest();
					return true;
				}
			}

			return false;
		}
Exemplo n.º 11
0
		/// <summary>
		/// Handle an item given to the scholar.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <param name="target"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
		{
			if (base.ReceiveItem(source, target, item))
				return true;

			GamePlayer player = source as GamePlayer;
			Scholar scholar = target as Scholar;
			if (player == null || scholar == null)
				return false;

			if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
			{
				Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
					(eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

				if (versions.Count > 0 && RemoveItem(player, item))
				{
					IDictionaryEnumerator versionsEnum = versions.GetEnumerator();
					versionsEnum.MoveNext();
					GiveItem(scholar, player, ArtifactID, versionsEnum.Value as ItemTemplate);
					String reply = String.Format("Here is your gloves. Do not lose it, it is irreplaceable.");
					scholar.TurnTo(player);
					scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
					FinishQuest();
					return true;
				}
			}

			return false;
		}
Exemplo n.º 12
0
		public override bool ReceiveItem(GameLiving source, InventoryItem item)
		{
			GamePlayer t = source as GamePlayer;
			if (t == null || item == null)
				return false;

			if (item.Level >= 10 && item.IsCrafted)
			{
				if (item.Object_Type != (int) eObjectType.Magical && item.Object_Type != (int) eObjectType.Bolt && item.Object_Type != (int) eObjectType.Poison)
				{
					if (item.Bonus == 0)
					{
						t.TempProperties.setProperty(ENCHANT_ITEM_WEAK, new WeakRef(item));
                        t.Client.Out.SendCustomDialog(LanguageMgr.GetTranslation(t.Client, "Enchanter.ReceiveItem.Text1", Money.GetString(CalculEnchantPrice(item))), new CustomDialogResponse(EnchanterDialogResponse));
                    }
					else
                        SayTo(t, eChatLoc.CL_SystemWindow, LanguageMgr.GetTranslation(t.Client, "Enchanter.ReceiveItem.Text2"));
                }
				else
                    SayTo(t, eChatLoc.CL_SystemWindow, LanguageMgr.GetTranslation(t.Client, "Enchanter.ReceiveItem.Text3"));
            }
			else
                SayTo(t, eChatLoc.CL_SystemWindow, LanguageMgr.GetTranslation(t.Client, "Enchanter.ReceiveItem.Text4"));

			return false;
		}
Exemplo n.º 13
0
		/// <summary>
		/// Handle an item given to the scholar.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <param name="target"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
		{
			if (base.ReceiveItem(source, target, item))
				return true;

			GamePlayer player = source as GamePlayer;
			Scholar scholar = target as Scholar;
			if (player == null || scholar == null)
				return false;

			if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
			{
				Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
					(eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);
				
				if (versions.Count > 0 && RemoveItem(player, item))
				{
					GiveItem(scholar, player, ArtifactID, versions[";;"]);
					String reply = String.Format("Brilliant, thank you! Here, take the artifact. {0} {1} {2}",
						"I've unlocked its powers for you. As I've said before, I'm more interested",
						"in the stories and the history behind these artifacts than the actual items",
						"themselves.");
					scholar.TurnTo(player);
					scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
					FinishQuest();
					return true;
				}
			}

			return false;
		}
Exemplo n.º 14
0
 public override double AttackDamage(InventoryItem weapon)
 {
     if (this.Name.ToLower().Contains("air"))
         return (base.AttackDamage(weapon) * 0.6 * ServerProperties.Properties.THEURGIST_PET_DAMAGE_MULTIFLIER);
     else if (this.Name.ToLower().Contains("ice"))
         return (base.AttackDamage(weapon) * 0.8 * ServerProperties.Properties.THEURGIST_PET_DAMAGE_MULTIFLIER);
     return (base.AttackDamage(weapon) * 1.0 * ServerProperties.Properties.THEURGIST_PET_DAMAGE_MULTIFLIER); 
 }
Exemplo n.º 15
0
		public override bool ReceiveItem(GameLiving source, InventoryItem item)
		{
			GamePlayer player = source as GamePlayer;
			if (player == null || item == null)
				return false;

			if (item.Count != 1)
			{
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language,
				                                                  "Scripts.Blacksmith.StackedObjets", GetName(0, false)),
				                       eChatType.CT_System, eChatLoc.CL_SystemWindow);

				return false;
			}

			switch (item.Object_Type)
			{
				case (int)eObjectType.GenericItem:
				case (int)eObjectType.Magical:
				case (int)eObjectType.Instrument:
				case (int)eObjectType.Poison:
					SayTo(player, LanguageMgr.GetTranslation(player.Client.Account.Language,
					                                         "Scripts.Blacksmith.CantRepairThat"));

					return false;
			}

			if (item.Condition < item.MaxCondition)
			{
				if (item.Durability <= 0)
				{
					player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language,
					                                                  "Scripts.Blacksmith.ObjectCantRepaired"), eChatType.CT_System,
					                       eChatLoc.CL_SystemWindow);

					return false;
				}
				else
				{
					player.TempProperties.setProperty(REPAIR_ITEM_WEAK, new WeakRef(item));
					player.Client.Out.SendCustomDialog(LanguageMgr.GetTranslation(player.Client.Account.Language,
					                                                              "Scripts.Blacksmith.RepairCostAccept",
					                                                              Money.GetString(item.RepairCost), item.Name),
					                                   new CustomDialogResponse(BlacksmithDialogResponse));
				}
			}
			else
			{
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language,
				                                                  "Scripts.Blacksmith.NoNeedRepair"), eChatType.CT_System,
				                       eChatLoc.CL_SystemWindow);
			}

			return false;

		}
Exemplo n.º 16
0
		public override bool ReceiveItem(GameLiving source, InventoryItem item)
		{
			GamePlayer t = source as GamePlayer;
			if (t == null || item == null)
				return false;
			
			if (item.Emblem != 0)
			{
				t.Out.SendMessage("This item already has an emblem on it.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return false;
			}

			if (item.Object_Type == (int) eObjectType.Shield
				|| item.Item_Type == Slot.CLOAK)
			{
				if (t.Guild == null)
				{
					t.Out.SendMessage("You have no guild.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
					return false;
				}
				if (t.Guild.Emblem == 0)
				{
					t.Out.SendMessage("Your guild has no emblem.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
					return false;
				}
				if (t.Level < 20) //if level of player < 20 so can not put emblem
				{
					if (t.CraftingPrimarySkill == eCraftingSkill.NoCrafting)
					{
						t.Out.SendMessage("You have to be at least level 20 or have 400 in a tradeskill to be able to wear an emblem.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
						return false;
					}
					else
					{
						if (t.GetCraftingSkillValue(t.CraftingPrimarySkill) < 400)
						{
							t.Out.SendMessage("You have to be at least level 20 or have 400 in a tradeskill to be able to wear an emblem.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
							return false;
						}
					}

				}

				if (!t.Guild.HasRank(t, Guild.eRank.Emblem))
				{
					t.Out.SendMessage("You do not have enough privileges for that.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
					return false;
				}
				t.TempProperties.setProperty(EMBLEMIZE_ITEM_WEAK, new WeakRef(item));
				t.Out.SendCustomDialog("Do you agree to put an emblem on this object?", new CustomDialogResponse(EmblemerDialogResponse));
			}
			else
				t.Out.SendMessage("I can not put an emblem on this item.", eChatType.CT_System, eChatLoc.CL_SystemWindow);

			return false;
		}
Exemplo n.º 17
0
		public override bool ReceiveItem(GameLiving source, InventoryItem item)
		{
			GamePlayer player = source as GamePlayer;
			if (player == null || item == null)
				return false;

			if (item.Count != 1)
			{
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Scripts.Recharger.ReceiveItem.StackedObjects",
                    GetName(0, false, player.Client.Account.Language, this)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return false;
			}

			if((item.SpellID == 0 && item.SpellID1 == 0) ||
				(item.Object_Type == (int)eObjectType.Poison) ||
				(item.Object_Type == (int)eObjectType.Magical && (item.Item_Type == 40 || item.Item_Type == 41)))
			{
				SayTo(player, LanguageMgr.GetTranslation(player.Client.Account.Language, "Scripts.Recharger.ReceiveItem.CantThat"));
				return false;
			}

            // WHRIA
            if (item.SpellID != 0 && item.MaxCharges==0
                || item.SpellID1 != 0 && item.MaxCharges1 == 0)
            {
                SayTo(player, "MaxCharge should be greater than 0 !!! Report to GM");
                return false;
            }
            // END

            if(item.Charges == item.MaxCharges && item.Charges1 == item.MaxCharges1)
			{
				SayTo(player, LanguageMgr.GetTranslation(player.Client.Account.Language, "Scripts.Recharger.ReceiveItem.FullyCharged"));
				return false;
			}

			long NeededMoney=0;
			if (item.Charges < item.MaxCharges)
			{
				player.TempProperties.setProperty(RECHARGE_ITEM_WEAK, new WeakRef(item));
				NeededMoney += (item.MaxCharges - item.Charges)*Money.GetMoney(0,0,10,0,0);
			}
			if (item.Charges1 < item.MaxCharges1)
			{
				player.TempProperties.setProperty(RECHARGE_ITEM_WEAK, new WeakRef(item));
				NeededMoney += (item.MaxCharges1 - item.Charges1)*Money.GetMoney(0,0,10,0,0);
			}
			if(NeededMoney > 0)
			{
				player.Client.Out.SendCustomDialog(LanguageMgr.GetTranslation(player.Client.Account.Language, "Scripts.Recharger.ReceiveItem.Cost", Money.GetString(NeededMoney)), new CustomDialogResponse(RechargerDialogResponse));
				return true;
			}
			return false;
		}
Exemplo n.º 18
0
		public SelfCraftWindow(GamePlayer owner, InventoryItem item)
		{
			if (owner == null)
				throw new ArgumentNullException("owner");
			
			m_owner = owner;
			m_tradeItems = new ArrayList(10);

			m_itemToCombine = new ArrayList(1);
			m_itemToCombine.Add(item);
		}
Exemplo n.º 19
0
		/// <summary>
		/// Called when the living is about to get an item from someone
		/// else
		/// </summary>
		/// <param name="source">Source from where to get the item</param>
		/// <param name="item">Item to get</param>
		/// <returns>true if the item was successfully received</returns>
		public override bool ReceiveItem(GameLiving source, InventoryItem item)
		{
			if (source == null || item == null) return false;

			if (source is GamePlayer)
			{
				GamePlayer player = (GamePlayer)source;

                if (item.Name.ToLower().StartsWith(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "GameStableMaster.ReceiveItem.TicketTo")) && item.Item_Type == 40)
				{
					foreach (GameNPC npc in GetNPCsInRadius(1500))
					{
						if (npc is GameTaxiBoat)
						{
                            player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameBoatStableMaster.ReceiveItem.Departed", this.Name), eChatType.CT_System, eChatLoc.CL_PopupWindow);
                            return false;
						}
					}

                    String destination = item.Name.Substring(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "GameStableMaster.ReceiveItem.TicketTo").Length);
					PathPoint path = MovementMgr.LoadPath(item.Id_nb);
					//PathPoint path = MovementMgr.Instance.LoadPath(this.Name + "=>" + destination);
                    if ((path != null) && ((Math.Abs(path.X - this.X)) < 500) && ((Math.Abs(path.Y - this.Y)) < 500))
					{
						player.Inventory.RemoveCountFromStack(item, 1);
                        InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Merchant, item.Template);

						GameTaxiBoat boat = new GameTaxiBoat();
						boat.Name = "Boat to " + destination;
						boat.Realm = source.Realm;
						boat.X = path.X;
						boat.Y = path.Y;
						boat.Z = path.Z;
						boat.CurrentRegion = CurrentRegion;
                        boat.Heading = path.GetHeading( path.Next );
						boat.AddToWorld();
						boat.CurrentWayPoint = path;
						GameEventMgr.AddHandler(boat, GameNPCEvent.PathMoveEnds, new DOLEventHandler(OnHorseAtPathEnd));
						//new MountHorseAction(player, boat).Start(400);
						new HorseRideAction(boat).Start(30 * 1000);

                        player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameBoatStableMaster.ReceiveItem.SummonedBoat", this.Name, destination), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                        return true;
					}
					else
					{
                        player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameBoatStableMaster.ReceiveItem.UnknownWay", this.Name, destination), eChatType.CT_System, eChatLoc.CL_SystemWindow);
					}
				}
			}

			return base.ReceiveItem(source, item);
		}
Exemplo n.º 20
0
        public override bool ReceiveItem(GameLiving source, InventoryItem item)
        {
            GamePlayer player = source as GamePlayer;
            if (player == null)
            {
                return false;
            }

            Refund(item, player);

            return false;
        }
Exemplo n.º 21
0
        /// <summary>
        /// Handle an item given to the scholar.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="item"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
        {
            if (base.ReceiveItem(source, target, item))
                return true;

            GamePlayer player = source as GamePlayer;
            Scholar scholar = target as Scholar;
            if (player == null || scholar == null)
                return false;

            if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
            {
                String armorType = GlobalConstants.ArmorLevelToName(player.BestArmorLevel,
                    (eRealm)player.Realm);
                ItemTemplate template = null;
                Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
                    (eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

                foreach (String versionKey in versions.Keys)
                {
                    String[] serializedKey = versionKey.Split(';');
                    if (serializedKey[0] == armorType)
                    {
                        template = versions[versionKey];
                        break;
                    }
                }

                if (template != null && RemoveItem(player, item))
                {
                    GiveItem(scholar, player, ArtifactID, template);
                    String reply = String.Format("I feel fortunate to {0} {1} {2} {3} {4}. {5} {6} {7} {8}.",
                        "be able to study some of these artifacts that have survived from the days of the",
                        "Atlanteans. I am only sad that I shall never get to meet the people that created",
                        "wonderful objects like the Arms of the Winds. The magic in them has been",
                        "reawakened for you,",
                        player.CharacterClass.Name,
                        "You must take care of these sleeves because I cannot do it again. If you lose them",
                        "or they are  destroyed, the Arms of the Winds will be forever lost to you. I hope",
                        "they serve you well,",
                        player.CharacterClass.Name);
                    scholar.TurnTo(player);
                    scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
                    FinishQuest();
                    return true;
                }
            }

            return false;
        }
Exemplo n.º 22
0
		/// <summary>
		/// Handle an item given to the scholar.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <param name="target"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
		{
			if (base.ReceiveItem(source, target, item))
				return true;

			GamePlayer player = source as GamePlayer;
			Scholar scholar = target as Scholar;
			if (player == null || scholar == null)
				return false;

			if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
			{
				scholar.TurnTo(player);
				if (RemoveItem(player, item))
				{
					Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID, (eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

					String reply = "";

					if (versions.Count > 1)
					{
						reply = "Great! ";
						DisplayStep3(scholar, player, reply);
						Step = 3;
						return true;
					}
					else
					{
						reply = String.Format("The magic of Eirene's Chestpiece is unlocked {0} {1}. {2} {3} {4} {5}, {1}!",
							"and linked now to you,", player.CharacterClass.Name,
							"Please know that if you lose or destroy this Chestpiece, it will be gone",
							"from you forever. I hope it will help you succeed in the trials.",
							"Bring glory to", GlobalConstants.RealmToName(player.Realm));

						Dictionary<String, ItemTemplate>.Enumerator venum = versions.GetEnumerator();
						venum.MoveNext();

						if (GiveItem(scholar, player, ArtifactID, venum.Current.Value))
						{
							scholar.TurnTo(player);
							scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
							FinishQuest();
							return true;
						}
					}
				}
			}

			return false;
		}
Exemplo n.º 23
0
 public void Refund(InventoryItem item, GamePlayer player)
 {
     bool can = false;
     if (item.PackageID.ToLower().Contains("art"))
     {
         can = true;
     }
     if (item.Name.Contains("Special"))
     {
         can = true;
     }
     if (item.Name.Contains("Dragon"))
     {
         can = true;
     }
     if (item.Name.Contains("Pyroc"))
     {
         can = true;
     }
     if (item.Name.Contains("Lith"))
     {
         can = true;
     }
     if (item.Name.Contains("Benth"))
     {
         can = true;
     }
     if (item.Name.Contains("Tempest"))
     {
         can = true;
     }
     if (item.Name.Contains("Dragonslayer"))
     {
         can = true;
     }
     switch (item.PackageID)
     {
         case "LabWeaps":
         case "Artifacts":
         case "Bounty Jewlery":
         case "DragonWeapons":
             can = true;
             break;
     }
     if (can == true)
     {
         player.Inventory.RemoveItem(item);
         player.GainBountyPoints(item.Price, false);
     }
 }
Exemplo n.º 24
0
		/// <summary>
		/// Constructs a GameInventoryItem based on an
		/// InventoryItem. Will disappear after WORLD_ITEM_DECAY_TIME if
		/// added to the world
		/// </summary>
		/// <param name="item">the InventoryItem to put into this class</param>
		public WorldInventoryItem(InventoryItem item) : this()
		{
			m_item = item;
			m_item.SlotPosition = 0;
			m_item.OwnerID = null;
			m_item.AllowAdd = true;
			this.Level = (byte)item.Level;
			this.Model = (ushort)item.Model;
			this.Emblem = item.Emblem;
			this.Name = item.Name;

			if (item.Template is ItemUnique && item.Template.IsPersisted == false)
			{
				GameServer.Database.AddObject(item.Template as ItemUnique);
			}
		}
Exemplo n.º 25
0
        /// <summary>
        /// Handle an item given to the scholar.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="item"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
        {
            if (base.ReceiveItem(source, target, item))
                return true;

            GamePlayer player = source as GamePlayer;
            Scholar scholar = target as Scholar;
            if (player == null || scholar == null)
                return false;

            if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
            {
                String armorType = GlobalConstants.ArmorLevelToName(player.BestArmorLevel,
                    (eRealm)player.Realm);
                ItemTemplate template = null;
                Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
                    (eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

                foreach (String versionKey in versions.Keys)
                {
                    String[] serializedKey = versionKey.Split(';');
                    if (serializedKey[0] == armorType)
                    {
                        template = versions[versionKey];
                        break;
                    }
                }

                if (template != null && RemoveItem(player, item))
                {
                    GiveItem(scholar, player, ArtifactID, template);
                    String reply = String.Format("The spell is complete and the magic {0} {1}! {2} {3} {4}",
                        "of the Leggings has been reawakened from its long sleep! But heed this warning,",
                        player.CharacterClass.Name,
                        "Take good care of these leggings, because the magic contained within them is",
                        "fragile and if the leggings are lost or destroyed, the magic will be gone forever.",
                        "May these leggings serve you well as you travel through the trial planes.");
                    scholar.TurnTo(player);
                    scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
                    FinishQuest();
                    return true;
                }
            }

            return false;
        }
Exemplo n.º 26
0
        public override bool ReceiveItem(GameLiving source, InventoryItem item)
        {
            if (source == null || item == null)
                return false;

            GamePlayer player = source as GamePlayer;
            if (player == null)
                return false;

            if (item.Id_nb == "Music_Ticket")
            {
                TargetObject = player;
                CastSpell(SkillBase.GetSpellByID(GameHastener.SPEEDOFTHEREALMID), SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
                player.Inventory.RemoveItem(item);
                InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Merchant, item.Template, item.Count);
            }
            return true;
        }
Exemplo n.º 27
0
		/// <summary>
		/// Handle an item given to the scholar.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <param name="target"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
		{
			if (base.ReceiveItem(source, target, item))
				return true;

			GamePlayer player = source as GamePlayer;
			Scholar scholar = target as Scholar;
			if (player == null || scholar == null)
				return false;

			if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
			{
				String armorType = GlobalConstants.ArmorLevelToName(player.BestArmorLevel,
					(eRealm)player.Realm);
				ItemTemplate template = null;
				Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
					(eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

				foreach (String versionKey in versions.Keys)
				{
					String[] serializedKey = versionKey.Split(';');
					if (serializedKey[0] == armorType)
					{
						template = versions[versionKey];
						break;
					}
				}

				if (template != null && RemoveItem(player, item))
				{
					GiveItem(scholar, player, ArtifactID, template);
					String reply = String.Format("Here, take these boots! I hope you find {0}",
						"them useful. Don't lose them, I can only unlock their power for you once!");
					scholar.TurnTo(player);
					scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
					FinishQuest();
					return true;
				}
			}

			return false;
		}
Exemplo n.º 28
0
 public override bool ReceiveItem(GameLiving source, InventoryItem item)
 {
     GamePlayer player = source as GamePlayer;
     if (player == null || item == null) return false;
     bool output = false;
     #region messages
     if (WorldMgr.GetDistance(this, player) > WorldMgr.INTERACT_DISTANCE)
     {
         player.Out.SendMessage("You are too far away to give anything to " + GetName(0, false) + ".", eChatType.CT_System, eChatLoc.CL_SystemWindow);
         return false;
     }
     if ((player.TempProperties.getProperty<InventoryItem>(TempProperty)) != null)
     {
         item = player.TempProperties.getProperty<InventoryItem>(TempProperty);
         SendReply(player, "You already gave me an item! What was it again?");
         output = true;
     }
     SendReply(player, "Ok, which proc do you want to remove? \n Proc [1] or Proc [2] ?");
     player.TempProperties.setProperty(TempProperty, item);
     return true;
     #endregion messages
 }
Exemplo n.º 29
0
        /// <summary>
        /// Add an item to the market cache
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public static bool AddItem(InventoryItem item)
        {
            bool added = false;

            if (item != null && item.OwnerID != null)
            {
                lock (CacheLock)
                {
                    if (m_itemCache.ContainsKey(item.ObjectId) == false)
                    {
                        m_itemCache.Add(item.ObjectId, item);
                        added = true;
                    }
                    else
                    {
                        log.Error("Attempted to add duplicate item to Market Cache " + item.ObjectId);
                    }
                }
            }

            return added;
        }
Exemplo n.º 30
0
		public override void OnEffectStart(GameSpellEffect effect)
		{
			effect.Owner.StartInterruptTimer(effect.Owner.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
			player = effect.Owner as GamePlayer;
			if (player == null) return;
			int slot=Util.Random(0, 2);
			m_slot = slots[slot];
			string msg = GlobalConstants.SlotToName((int)m_slot);
			MessageToCaster("You debuff " + effect.Owner.Name + "'s " + msg+"", eChatType.CT_Spell);
			foreach (GamePlayer visPlayer in player.GetPlayersInRadius((ushort)WorldMgr.VISIBILITY_DISTANCE))
				visPlayer.Out.SendSpellEffectAnimation(player, player, (ushort)(13180+slot), 0, false, 0x01);

			item = player.Inventory.GetItem((eInventorySlot)m_slot);
			
			if(item!=null)
			{
				old_item_af=item.DPS_AF;
				old_item_abs=item.SPD_ABS;
				item.DPS_AF -= (int)Spell.Value;
				item.SPD_ABS -= (int)Spell.ResurrectMana;
				if(item.DPS_AF<0) item.DPS_AF=0;
				if(item.SPD_ABS<0) item.SPD_ABS=0;
			
				player.Client.Out.SendInventoryItemsUpdate(new InventoryItem[] { item });
				player.Out.SendCharStatsUpdate();
				player.UpdatePlayerStatus();
				player.Out.SendUpdatePlayer();
				player.Out.SendUpdateWeaponAndArmorStats();
				player.Out.SendCharResistsUpdate();
				
				GameEventMgr.AddHandler(player,GamePlayerEvent.Linkdeath, new DOLEventHandler(EventAction));
				GameEventMgr.AddHandler(player,GamePlayerEvent.Quit, new DOLEventHandler(EventAction));
				GameEventMgr.AddHandler(player,GamePlayerEvent.RegionChanged, new DOLEventHandler(EventAction));
				GameEventMgr.AddHandler(player,GameLivingEvent.Dying, new DOLEventHandler(EventAction));
			}

			base.OnEffectStart(effect);
		}
Exemplo n.º 31
0
 public override bool ReceiveItem(GameLiving source, DOL.Database.InventoryItem item)
 {
     //todo check if bullet
     return(base.ReceiveItem(source, item));
 }