Exemplo n.º 1
0
		public GroupMember(Character character, GroupMemberFlags flags)
		{
			m_lowId = character.EntityId.Low;
			m_characterName = character.Name;
			Flags = flags;
			Character = character;
		}
Exemplo n.º 2
0
        public void GiveReward(Character character)
        {
            // Wrong gender
            if (character.Gender != Gender && Gender != GenderType.Neutral)
                return;

            if (character.FactionGroup == FactionGroup.Alliance && AllianceTitle != 0)
            {
                character.SetTitle(AllianceTitle,false);
            }
            else if (character.FactionGroup == FactionGroup.Horde && HordeTitle != 0)
            {
                character.SetTitle(HordeTitle, false);
            }

            if (Item != 0)
            {
				var mailMessage = new MailMessage(Subjects.Localize(character.Locale), Bodies.Localize(character.Locale))
            	                  	{
            	                  		ReceiverId = character.EntityId.Low,
            	                  		DeliveryTime = DateTime.Now,
            	                  		SendTime = DateTime.Now,
            	                  		ExpireTime = DateTime.Now.AddMonths(1),
            	                  		MessageStationary = MailStationary.Normal
            	                  	};
            	mailMessage.AddItem(Item);
            	MailMgr.SendMail(mailMessage);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Tries to use this Object and returns whether the user succeeded using it.
        /// </summary>
        public bool TryUse(Character user)
        {
            if (!CanBeUsedBy(user))
            {
                return false;
            }

            // can't use objects that are in use
            if (m_go.Flags.HasFlag(GameObjectFlags.InUse))
            {
                return false;
            }

            if (!m_go.Entry.AllowMounted)
            {
                user.Dismount();
            }

            var lck = m_go.Entry.Lock;
            if (lck != null)
            {
                if (lck.RequiresAttack)
                {
                    // TODO: Attack Swing
                }
                else if (lck.RequiresKneeling)
                {
                    user.StandState = StandState.Kneeling;
                }
            }
            return m_go.CanOpen(user) && DoUse(user);
        }
Exemplo n.º 4
0
        public static void Send_SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA(Character chr)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0))
            {
				chr.Send(packet);
            }
        }
Exemplo n.º 5
0
		/// <summary>
		/// Creates gossip conversation by its fields
		/// </summary>
		/// <param name="menu">starting menu</param>
		/// <param name="chr">character which started the conversation</param>
		/// <param name="speaker">respondent</param>
		public GossipConversation(GossipMenu menu, Character chr, WorldObject speaker, bool keepOpen)
		{
			CurrentMenu = menu;
			Character = chr;
			Speaker = speaker;
			StayOpen = keepOpen;
		}
Exemplo n.º 6
0
        /// <summary>
        /// Sets the Character's selected GameObject
        /// </summary>
        internal GameObject this[Character chr]
        {
            get
            {
                return chr.ExtraInfo.SelectedGO;
            }
            set
            {
                var info = chr.ExtraInfo;
                Deselect(info);

                if (value != null)
                {
                    var selection = new GOSelection(value);
                    if (MarkerId != SpellId.None)
                    {
                        var marker = new DynamicObject(chr, MarkerId, MarkerRadius, value.Map, value.Position);
                        selection.Marker = marker;

                        // also delete marker
                        marker.CallPeriodically(2000, obj =>
                                                    {
                                                        if (!chr.IsInWorld || chr.Map != marker.Map || selection.GO == null || !selection.GO.IsInWorld)
                                                        {
                                                            marker.Delete();
                                                        }
                                                    });
                    }
                    info.m_goSelection = selection;
                }
            }
        }
Exemplo n.º 7
0
		public override bool Use(Character user)
		{
			var entry = m_go.Entry as GODoorEntry;

			m_go.IsState = !m_go.IsState;
			return true;
		}
Exemplo n.º 8
0
		public void WithdrawMoney(Character withdrawer, GameObject bank, uint withdrawl)
		{
			if (withdrawl == 0) return;
			if (!bank.CanInteractWith(withdrawer)) return;
			if (withdrawer.Guild == null || withdrawer.GuildMember == null) return;
			if (withdrawer.Guild != Guild) return;
			if (Guild.Money < withdrawl) return;

			var member = withdrawer.GuildMember;
			if (!member.HasRight(GuildPrivileges.WITHDRAW_GOLD) ||
				member.HasRight(GuildPrivileges.WITHDRAW_GOLD_LOCK))
			{
				return;
			}
			if (member.BankMoneyWithdrawlAllowance < withdrawl)
			{
				return;
			}

			Guild.Money -= withdrawl;
			withdrawer.Money += withdrawl;
			member.BankMoneyWithdrawlAllowance -= withdrawl;

			BankLog.LogEvent(GuildBankLogEntryType.WithdrawMoney, withdrawer, withdrawl, null, 0, null);

			GuildHandler.SendMemberRemainingDailyWithdrawlAllowance(withdrawer, member.BankMoneyWithdrawlAllowance);
			GuildHandler.SendGuildBankTabNames(withdrawer, bank);
			GuildHandler.SendGuildBankTabContents(withdrawer, bank, 0);
			GuildHandler.SendGuildBankMoneyUpdate(withdrawer, bank);
		}
Exemplo n.º 9
0
		/// <summary>
		/// The availability of the spell for the spell list filter.
		/// </summary>
		/// <returns>Available, Unavailable, AlreadyKnown</returns>
		public TrainerSpellState GetTrainerSpellState(Character character)
		{
			var spell = Spell;
			if (spell.IsTeachSpell)
			{
				spell = spell.LearnSpell;
			}

			if (character.Spells.Contains(spell.Id))
			{
				return TrainerSpellState.AlreadyLearned;
			}

			if (spell.PreviousRank != null && !character.Spells.Contains(spell.PreviousRank.Id))
			{
				return TrainerSpellState.Unavailable;
			}

			if (spell.Ability == null || RequiredLevel > 0 && character.Level < RequiredLevel)
			{
				return TrainerSpellState.Unavailable;
			}

			if (RequiredSpellId != 0 && !character.Spells.Contains(RequiredSpellId))
				return TrainerSpellState.Unavailable;

			if (RequiredSkillId != 0 && !character.Skills.CheckSkill(RequiredSkillId, (int)RequiredSkillAmount))
				return TrainerSpellState.Unavailable;

			if (Spell.IsProfession && Spell.TeachesApprenticeAbility && character.Skills.FreeProfessions == 0)
				return TrainerSpellState.Unavailable;

			return TrainerSpellState.Available;
		}
Exemplo n.º 10
0
		public static void SendInBounds(Character duelist)
		{
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_INBOUNDS,4))
            {
                duelist.Send(packet);
            }
		}
Exemplo n.º 11
0
        public override bool Use(Character user)
        {
            var entry = m_go.Entry as GODoorEntry;

            m_go.AnimationProgress = m_go.AnimationProgress == 100 ? (byte)0 : (byte)100;
            return true;
        }
Exemplo n.º 12
0
 private static bool Blastenheimer5000Used(GameObject go, Character user)
 {
     var cast = user.SpellCast;
     cast.Start(CannonPrepId);
     user.IncMechanicCount(SpellMechanic.Rooted);
     switch (go.EntryId)
     {
         case (uint)Blastenheimer5000ElwynnId:
             {
                 user.TeleportTo(ElwynnTelePosition, ElwynnTeleOrientation);
             } break;
         case (uint)Blastenheimer5000TerokkarId:
             {
                 user.TeleportTo(TerokkarTelePosition, TerokkarTeleOrientation);
             } break;
         case (uint)Blastenheimer5000MulgoreId:
             {
                 user.TeleportTo(MulgoreTelePosition, MulgoreTeleOrientation);
             } break;
         default:
             {
                 user.DecMechanicCount(SpellMechanic.Rooted);
                 return false;
             }
     }
     go.PlaySound(8476);
     
     user.CallDelayed(2000, obj => FireCannon(user));
     return true;
 }
Exemplo n.º 13
0
		internal static SpecProfile[] LoadAllOfCharacter(Character chr)
		{
			//ICriterion[] query = { Expression.Eq("_characterGuid", (int)chr.EntityId.Low) };

			var specs = RealmWorldDBMgr.DatabaseProvider.Query<SpecProfile>().Where(specProfile => specProfile.CharacterGuid == chr.EntityId.Low).OrderBy(specProfile => specProfile.SpecIndex).ToArray(); //FindAll(order, query);
			var i = 0;

			foreach (var spec in specs)
			{
				// ensure correct index
				if (spec.SpecIndex != i)
				{
					LogManager.GetCurrentClassLogger().Warn("Found SpecProfile for \"{0}\" with invalid SpecIndex {1} (should be {2})", spec.SpecIndex, i);
					spec.SpecIndex = i;
					RealmWorldDBMgr.DatabaseProvider.SaveOrUpdate(spec);
				}

				// ensure correct ActionButtons
				if (spec.ActionButtons == null)
				{
					// make sure to create the array, if loading or the last save failed
					spec.ActionButtons = (byte[])chr.Archetype.ActionButtons.Clone();
				}
				else if (spec.ActionButtons.Length != chr.Archetype.ActionButtons.Length)
				{
					var buts = spec.ActionButtons;
					Array.Resize(ref buts, chr.Archetype.ActionButtons.Length);
					spec.ActionButtons = buts;
				}
				i++;
			}
			return specs;
		}
Exemplo n.º 14
0
		/// <summary>
		/// Teleports into an instance
		/// </summary>
		/// <param name="chr"></param>
		/// <param name="trigger"></param>
		/// <returns></returns>
		public static bool HandleTeleport(Character chr, AreaTrigger trigger)
		{
			var regionInfo = World.GetRegionTemplate(trigger.Template.TargetMap);
#if DEBUG
			chr.SendSystemMessage("Target location: {0}", trigger.Template.TargetMap);
#endif

			if (regionInfo.IsInstance)
			{
				if (regionInfo.Type == MapType.Normal)
				{
					InstanceMgr.LeaveInstance(chr, regionInfo, trigger.Template.TargetPos);
					return true;
				}
				else
				{
					return InstanceMgr.EnterInstance(chr, regionInfo, trigger.Template.TargetPos);
				}
			}
			else if (regionInfo.BGTemplate == null)
			{
				var rgn = World.GetRegion(regionInfo.Id);
				if (rgn != null)
				{
					chr.TeleportTo(rgn, trigger.Template.TargetPos, trigger.Template.TargetOrientation);
					return true;
				}
				else
				{
					ContentMgr.OnInvalidDBData("Invalid Region: " + rgn);
				}
			}
			return true;
		}
Exemplo n.º 15
0
        /// <summary>
        /// Gets the Highest Status of any quest newly available or continuable for the given Character
        /// </summary>
        /// <param name="chr">The character which is status calculated with.</param>
        /// <returns></returns>
        public QuestStatus GetHighestQuestGiverStatus(Character chr)
        {
            var highestStatus = QuestStatus.NotAvailable;
            if (QuestStarts != null)
            {
                foreach (var qt in QuestStarts)
                {
                    var qs = qt.GetStartStatus(this, chr);
                    if (qs > highestStatus)
                    {
                        highestStatus = qs;
                    }
                }
            }

            if (QuestEnds != null)
            {
                foreach (var qt in QuestEnds)
                {
                    var qs = qt.GetEndStatus(chr);
                    if (qs > highestStatus)
                    {
                        highestStatus = qs;
                    }
                }
            }
            return highestStatus;
        }
Exemplo n.º 16
0
        public AchievementCollection(Character chr)
        {
            m_owner = chr;
            ClassSpecificAchievementId[(int)ClassId.PetTalents] = 0;
            ClassSpecificAchievementId[(int)ClassId.Warrior] = 459;
            ClassSpecificAchievementId[(int)ClassId.Paladin] = 465;
            ClassSpecificAchievementId[(int)ClassId.Hunter] = 462;
            ClassSpecificAchievementId[(int)ClassId.Rogue] = 458;
            ClassSpecificAchievementId[(int)ClassId.Priest] = 464;
            ClassSpecificAchievementId[(int)ClassId.DeathKnight] = 461;
            ClassSpecificAchievementId[(int)ClassId.Shaman] = 467;
            ClassSpecificAchievementId[(int)ClassId.Mage] = 460;
            ClassSpecificAchievementId[(int)ClassId.Warlock] = 463;
            //??	= 10
            ClassSpecificAchievementId[(int)ClassId.Druid] = 466;

            RaceSpecificAchievementId[(int)RaceId.None] = 0;
            RaceSpecificAchievementId[(int)RaceId.Human] = 1408;
            RaceSpecificAchievementId[(int)RaceId.Orc] = 1410;
            RaceSpecificAchievementId[(int)RaceId.Dwarf] = 1407;
            RaceSpecificAchievementId[(int)RaceId.NightElf] = 1409;
            RaceSpecificAchievementId[(int)RaceId.Undead] = 1413;
            RaceSpecificAchievementId[(int)RaceId.Tauren] = 1411;
            RaceSpecificAchievementId[(int)RaceId.Gnome] = 1404;
            RaceSpecificAchievementId[(int)RaceId.Troll] = 1412;
            RaceSpecificAchievementId[(int)RaceId.Goblin] = 0;
            RaceSpecificAchievementId[(int)RaceId.BloodElf] = 1405;
            RaceSpecificAchievementId[(int)RaceId.Draenei] = 1406;
            RaceSpecificAchievementId[(int)RaceId.FelOrc] = 0;
            RaceSpecificAchievementId[(int)RaceId.Naga] = 0;
            RaceSpecificAchievementId[(int)RaceId.Broken] = 0;
            RaceSpecificAchievementId[(int)RaceId.Skeleton] = 0;
        }
Exemplo n.º 17
0
		public override bool Use(Character user)
		{
			var entry = m_go.Entry as GODoorEntry;

			m_go.IsEnabled = !m_go.IsEnabled;
			return true;
		}
Exemplo n.º 18
0
        /// <summary>
        /// Sends the packet to show the battleground window
        /// </summary>
        /// <param name="client"></param>
        /// <param name="speaker"></param>
        /// <param name="character"></param>
        /// <returns></returns>
        public bool SendBattlegroundWindow(IRealmClient client, NPC speaker, Character character)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_LIST))
            {
                packet.WriteULong(speaker != null ? speaker.EntityId.Full : 0);
                packet.WriteUInt((uint)m_bgqueue.Template.BgID);
                packet.WriteByte(m_battlegroupId); //Battle group
				// TODO: Add sync'ing?
                //m_syncLock.EnterReadLock();
                try
                {
                    packet.WriteUInt(m_battlegrounds.Count); //Count

                    foreach (var bg in m_battlegrounds.Values)
                    {
                        packet.WriteUInt(bg.InstanceId);
                    }
                }
                finally
                {
                    //m_syncLock.ExitReadLock();
                }
                client.Send(packet);
                return true;
            }
        }
Exemplo n.º 19
0
 public static void FireCannon(Character user)
 {
     user.DecMechanicCount(SpellMechanic.Rooted);
     var cast = user.SpellCast;
     if (cast != null)
         cast.TriggerSelf(MagicWingsId);
 }
Exemplo n.º 20
0
 public static void StopEditing(Character chr)
 {
     var architect = GetArchitectInfo(chr);
     if (architect != null)
     {
         architect.Editor.Leave(chr);
     }
 }
Exemplo n.º 21
0
		public bool CanSelltoChar( Character character )
		{
			if( ( ( Template.RequiredClassMask & character.ClassMask ) == 0 ) &&
				( Template.BondType == ItemBondType.OnPickup ) &&
				( !character.IsGameMaster ) )
				return false;
			return true;
		}
Exemplo n.º 22
0
		public override UpdateFieldFlags GetUpdateFieldVisibilityFor(Character chr)
		{
			if (chr == m_master)
			{
				return UpdateFieldFlags.OwnerOnly | UpdateFieldFlags.Public;
			}
			return UpdateFieldFlags.Public;
		}
Exemplo n.º 23
0
        /// <summary>
        /// Character starts a trade-session with this Vendor
        /// </summary>
        /// <param name="chr"></param>
        public void UseVendor(Character chr)
        {
            if (!CheckVendorInteraction(chr))
                return;

            chr.OnInteract(NPC);
            NPCHandler.SendVendorInventoryList(chr, NPC, ItemsForSale);
        }
Exemplo n.º 24
0
		public override UpdateFieldFlags GetVisibilityFor(Character chr)
		{
			if (chr == m_owner)
			{
				return UpdateFieldFlags.Private | UpdateFieldFlags.OwnerOnly | UpdateFieldFlags.GroupOnly | UpdateFieldFlags.Public;
			}
			return UpdateFieldFlags.Public;
		}
Exemplo n.º 25
0
		public static void SendOutOfBounds(Character duelist, uint cancelDelayMillis)
		{
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_OUTOFBOUNDS, 4))
            {
                packet.Write(cancelDelayMillis);

                duelist.Send(packet);
            }
		}
Exemplo n.º 26
0
		public static void SendCountdown(Character duelist, uint millis)
		{
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_COUNTDOWN, 4))
            {
                packet.Write(millis);

                duelist.Send(packet);
            }
		}
Exemplo n.º 27
0
		private static void Teleport(GameObject go, Character chr)
		{
			if (go.Handler.CanBeUsedBy(chr))
			{
				// We need to enqueue a message when moving/removing/adding Objects in this method
				var portal = (Portal)go;
				chr.AddMessage(() => chr.TeleportTo(portal.Target));
			}
		}
Exemplo n.º 28
0
Arquivo: AVTower.cs Projeto: NVN/WCell
        private void BurnTower(Character character)
        {
            Warmaster.Delete();
            // Notify the BG, remove this warmaster from the AIGroup.
            ChatMgr.SendSystemMessage(Instance.Characters, Name + " has been destroyed by the " + BaseOwner);

            // Check this: (the flag/tower should burn and become unusable)
            FlagStand.FirstSpawn.AnimProgress = 255;
        }
Exemplo n.º 29
0
		/// <summary>
		/// Calculates the amount of power regeneration for the class at a specific level and Spirit.
		/// </summary>
		/// <param name="level">the player's level</param>
		/// <param name="spirit">the player's Spirit</param>
		/// <returns>the total power regeneration amount</returns>
		public override int CalculatePowerRegen(Character chr)
		{
			// 1 Rage in the client is a value of 10
			if (chr.IsInCombat)
			{
				return 0;
			}
			return -50;
		}
Exemplo n.º 30
0
 public static void SendTitleEarned(Character character, CharacterTitleEntry titleEntry, bool lost)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_TITLE_EARNED, 4 + 4))
     {
         packet.WriteUInt((uint) titleEntry.BitIndex);
         packet.WriteUInt(lost ? 0 : 1);
         character.Send(packet);
     }
 }