public S_KILL_MESSAGE(Account p, FragInfos kills) { this._room = p.getRoom(); this._kills = kills; this._player = p; this.makeme(); }
public BATTLE_DEATH_PAK(Room r,FragInfos kills,SLOT killer,bool isBotMode) { this.room = r; this.kills = kills; this.killer = killer; this.isBotMode = isBotMode; }
public static void genDeath(Room room,SLOT killer,FragInfos kills,bool isSuicide) { bool isBotMode = room.isBotMode(); int score; Net_Room_Death.RegistryFragInfos(room,killer,out score,isBotMode,isSuicide,kills); if (isBotMode) { killer.Score += killer.killsOnLife + (int)room.IngameAiLevel + score; if (killer.Score > (int)ushort.MaxValue) { killer.Score = (int)ushort.MaxValue; Logger.warning("[PlayerId: " + (object)killer._id + "] chegou a pontuação máxima do modo BOT."); } kills.Score = killer.Score; } else { killer.Score += score; AllUtils.CompleteMission(room,killer,kills,MISSION_TYPE.NA,0); kills.Score = score; } using (BATTLE_DEATH_PAK battleDeathPak = new BATTLE_DEATH_PAK(room,kills,killer,isBotMode)) room.SendPacketToPlayers((SendPacket)battleDeathPak,SLOT_STATE.BATTLE,0); Net_Room_Death.EndBattleByDeath(room,killer,isBotMode,isSuicide); }
public PROTOCOL_BATTLE_DEATH_ACK(Account p, FragInfos kills) { this._room = p.getRoom(); this._kills = kills; this._player = p; base.makeme(); }
public static void genDeath(Room room,SLOT killer,FragInfos kills,bool isSuicide) { int score; bool isBotMode = room.isBotMode(); Net_Room_Death.RegistryFragInfos(room,killer,out score,isBotMode,isSuicide,kills); if (isBotMode) { killer.Score += killer.killsOnLife + room.IngameAiLevel + score; if (killer.Score > 65535) // 65535 { killer.Score = 65535; SaveLog.LogAbuse("{2} [PlayerId: " + killer._id + "] chegou a pontuação máxima do modo BOT."); } kills.Score = killer.Score; } else { killer.Score += score; AllUtils.CompleteMission(room,killer,kills,MISSION_TYPE.NA,0); kills.Score = score; } using (BATTLE_DEATH_PAK packet = new BATTLE_DEATH_PAK(room,kills,killer,isBotMode)) room.SendPacketToPlayers(packet,SLOT_STATE.BATTLE,0); Net_Room_Death.EndBattleByDeath(room,killer,isBotMode,isSuicide); }
protected internal override void read() { this._kills = new FragInfos(); int num = (int)base.readH(); this._kills.victimIdx = (int)base.readC(); this._kills.killsCount = (int)base.readC(); this._kills.killerIdx = (int)base.readC(); this._kills.weapon = base.readD(); this._kills.bytes13 = base.readB(13); int num2 = this._kills.killsCount - 1; for (int i = 0; i <= num2; i++) { Frag item = new Frag { unk_c_1 = (int)base.readC(), hitspotNum = (int)base.readC(), unk_c_3 = (int)base.readC(), unk_c_4 = (int)base.readC(), bytes131 = base.readB(13) }; this._kills.frags.Add(item); } }
/// <summary> /// <seealso cref="FieldFragList.Add(int, int, IList{WeightedPhraseInfo})"/> /// </summary> public override void Add(int startOffset, int endOffset, IList <WeightedPhraseInfo> phraseInfoList) { float totalBoost = 0; List <SubInfo> subInfos = new List <SubInfo>(); foreach (WeightedPhraseInfo phraseInfo in phraseInfoList) { subInfos.Add(new SubInfo(phraseInfo.GetText(), phraseInfo.TermsOffsets, phraseInfo.Seqnum, phraseInfo.Boost)); totalBoost += phraseInfo.Boost; } FragInfos.Add(new WeightedFragInfo(startOffset, endOffset, subInfos, totalBoost)); }
protected internal override void read() { this._kills = new FragInfos(); base.readH(); this._kills.unkCount = (int)base.readC(); this._kills.killsCount = (int)base.readC(); this._kills.killer = (int)base.readC(); this._kills.weapon = base.readD(); this._kills.bytes13 = base.readB(13); this._kills.unk_c_1 = (int)base.readC(); this._kills.unk_c_2 = (int)base.readC(); this._kills.unk_c_3 = (int)base.readC(); this._kills.unk_c_4 = (int)base.readC(); this._kills.bytes131 = base.readB(13); }
/// <summary> /// <seealso cref="FieldFragList.Add(int, int, IList{WeightedPhraseInfo})"/>. /// </summary> public override void Add(int startOffset, int endOffset, IList <WeightedPhraseInfo> phraseInfoList) { List <SubInfo> tempSubInfos = new List <SubInfo>(); List <SubInfo> realSubInfos = new List <SubInfo>(); HashSet <string> distinctTerms = new HashSet <string>(); int length = 0; foreach (WeightedPhraseInfo phraseInfo in phraseInfoList) { float phraseTotalBoost = 0; foreach (TermInfo ti in phraseInfo.TermsInfos) { if (distinctTerms.Add(ti.Text)) { phraseTotalBoost += ti.Weight * phraseInfo.Boost; } length++; } tempSubInfos.Add(new SubInfo(phraseInfo.GetText(), phraseInfo.TermsOffsets, phraseInfo.Seqnum, phraseTotalBoost)); } // We want that terms per fragment (length) is included into the weight. Otherwise a one-word-query // would cause an equal weight for all fragments regardless of how much words they contain. // To avoid that fragments containing a high number of words possibly "outrank" more relevant fragments // we "bend" the length with a standard-normalization a little bit. float norm = length * (1 / (float)Math.Sqrt(length)); float totalBoost = 0; foreach (SubInfo tempSubInfo in tempSubInfos) { float subInfoBoost = tempSubInfo.Boost * norm; realSubInfos.Add(new SubInfo(tempSubInfo.Text, tempSubInfo.TermsOffsets, tempSubInfo.Seqnum, subInfoBoost)); totalBoost += subInfoBoost; } FragInfos.Add(new WeightedFragInfo(startOffset, endOffset, realSubInfos, totalBoost)); }
public static void RegistryFragInfos(Room room,SLOT killer,out int score,bool isBotMode,bool isSuicide,FragInfos kills) { score = 0; ITEM_CLASS idStatics = (ITEM_CLASS)ComDiv.getIdStatics(kills.weapon,1); for (int index = 0; index < kills.frags.Count; ++index) { Frag frag = kills.frags[index]; CharaDeath charaDeath = (CharaDeath)((int)frag.hitspotInfo >> 4); if ((int)kills.killsCount - (isSuicide ? 1 : 0) > 1) { frag.killFlag |= charaDeath == CharaDeath.BOOM || charaDeath == CharaDeath.OBJECT_EXPLOSION || (charaDeath == CharaDeath.POISON || charaDeath == CharaDeath.HOWL) || (charaDeath == CharaDeath.TRAMPLED || idStatics == ITEM_CLASS.SHOTGUN) ? KillingMessage.MassKill : KillingMessage.PiercingShot; } else { int num1 = 0; switch (charaDeath) { case CharaDeath.DEFAULT: if (idStatics == ITEM_CLASS.KNIFE) { num1 = 6; break; } break; case CharaDeath.HEADSHOT: num1 = 4; break; } if (num1 > 0) { int num2 = killer.lastKillState >> 12; switch (num1) { case 4: if (num2 != 4) { killer.repeatLastState = false; } killer.lastKillState = num1 << 12 | killer.killsOnLife + 1; if (killer.repeatLastState) { frag.killFlag |= (killer.lastKillState & 16383) <= 1 ? KillingMessage.Headshot : KillingMessage.ChainHeadshot; break; } frag.killFlag |= KillingMessage.Headshot; killer.repeatLastState = true; break; case 6: if (num2 != 6) { killer.repeatLastState = false; } killer.lastKillState = num1 << 12 | killer.killsOnLife + 1; if (killer.repeatLastState && (killer.lastKillState & 16383) > 1) { frag.killFlag |= KillingMessage.ChainSlugger; break; } killer.repeatLastState = true; break; } } else { killer.lastKillState = 0; killer.repeatLastState = false; } } int victimSlot = frag.VictimSlot; SLOT slot = room._slots[victimSlot]; if (slot.killsOnLife > 3) { frag.killFlag |= KillingMessage.ChainStopper; } if ((kills.weapon != 19016 && kills.weapon != 19022 || (int)kills.killerIdx != victimSlot) && !slot.specGM) { ++slot.allDeaths; } if (killer._team != slot._team) { score += AllUtils.getKillScore(frag.killFlag); ++killer.allKills; if (killer._deathState == DeadEnum.isAlive) { ++killer.killsOnLife; } if (slot._team == 0) { ++room._redDeaths; ++room._blueKills; } else { ++room._blueDeaths; ++room._redKills; } if (room.room_type == (byte)7) { if (killer._team == 0) { room.red_dino += 4; } else { room.blue_dino += 4; } } } slot.lastKillState = 0; slot.killsOnLife = 0; slot.repeatLastState = false; slot.passSequence = 0; slot._deathState = DeadEnum.isDead; if (!isBotMode) { AllUtils.CompleteMission(room,slot,MISSION_TYPE.DEATH,0); } if (charaDeath == CharaDeath.HEADSHOT) { ++killer.headshots; } } }
public static void Load(ReceiveGPacket p) { int id1 = (int)p.readH(); int id2 = (int)p.readH(); byte num1 = p.readC(); byte num2 = p.readC(); int num3 = p.readD(); float num4 = p.readT(); float num5 = p.readT(); float num6 = p.readT(); byte num7 = p.readC(); int num8 = (int)num7 * 15; if (p.getBuffer().Length > 25 + num8) { Logger.warning("[Invalid DEATH: " + BitConverter.ToString(p.getBuffer()) + "]"); } Channel channel = ChannelsXML.getChannel(id2); if (channel == null) { return; } Room room = channel.getRoom(id1); if (room == null || room.round.Timer != null || room._state != RoomState.Battle) { return; } SLOT slot1 = room.getSlot((int)num1); if (slot1 == null || slot1.state != SLOT_STATE.BATTLE) { return; } FragInfos kills = new FragInfos() { killerIdx = num1, killingType = CharaKillType.DEFAULT, weapon = num3, x = num4, y = num5, z = num6, flag = num2 }; bool isSuicide = false; for (int index = 0; index < (int)num7; ++index) { byte num9 = p.readC(); byte hitspotInfo = p.readC(); float num10 = p.readT(); float num11 = p.readT(); float num12 = p.readT(); int num13 = (int)p.readC(); int slotIdx = (int)hitspotInfo & 15; SLOT slot2 = room.getSlot(slotIdx); if (slot2 != null && slot2.state == SLOT_STATE.BATTLE) { Frag frag = new Frag(hitspotInfo) { flag = (byte)num13, victimWeaponClass = num9, x = num10, y = num11, z = num12 }; if ((int)kills.killerIdx == slotIdx) { isSuicide = true; } kills.frags.Add(frag); } } kills.killsCount = (byte)kills.frags.Count; Game_SyncNet.genDeath(room,slot1,kills,isSuicide); }
public PROTOCOL_BATTLE_FRAG_INFO_ACK(Room room, FragInfos fragInfos) { this.room = room; this.fragInfos = fragInfos; }
public static void RegistryFragInfos(Room room,SLOT killer,out int score,bool isBotMode,bool isSuicide,FragInfos kills) { score = 0; ITEM_CLASS weaponClass = (ITEM_CLASS)ComDiv.getIdStatics(kills.weapon,1); for (int i = 0; i < kills.frags.Count; i++) { Frag frag = kills.frags[i]; CharaDeath deathType = (CharaDeath)(frag.hitspotInfo >> 4); if (kills.killsCount - (isSuicide ? 1 : 0) > 1) { frag.killFlag |= deathType == CharaDeath.BOOM || deathType == CharaDeath.OBJECT_EXPLOSION || deathType == CharaDeath.POISON || deathType == CharaDeath.HOWL || deathType == CharaDeath.TRAMPLED || weaponClass == ITEM_CLASS.SHOTGUN ? KillingMessage.MassKill : KillingMessage.PiercingShot; } else { int num2 = 0; if (deathType == CharaDeath.HEADSHOT) { num2 = 4; } else if (deathType == CharaDeath.DEFAULT && weaponClass == ITEM_CLASS.KNIFE) { num2 = 6; } if (num2 > 0) { int num3 = killer.lastKillState >> 12; if (num2 == 4) { if (num3 != 4) { killer.repeatLastState = false; } killer.lastKillState = num2 << 12 | (killer.killsOnLife + 1); if (killer.repeatLastState) { frag.killFlag |= (killer.lastKillState & 16383) <= 1 ? KillingMessage.Headshot : KillingMessage.ChainHeadshot; } else { frag.killFlag |= KillingMessage.Headshot; killer.repeatLastState = true; } } else if (num2 == 6) { if (num3 != 6) { killer.repeatLastState = false; } killer.lastKillState = num2 << 12 | (killer.killsOnLife + 1); if (killer.repeatLastState && (killer.lastKillState & 16383) > 1) { frag.killFlag |= KillingMessage.ChainSlugger; } else { killer.repeatLastState = true; } } } else { killer.lastKillState = 0; killer.repeatLastState = false; } } int victimId = frag.VictimSlot; SLOT victimSlot = room._slots[victimId]; if (victimSlot.killsOnLife > 3) { frag.killFlag |= KillingMessage.ChainStopper; } if ((kills.weapon == 19016 || kills.weapon == 19022) && kills.killerIdx == victimId || victimSlot.specGM) { } else { victimSlot.allDeaths++; //exprosao acid } if (killer._team != victimSlot._team) { score += AllUtils.getKillScore(frag.killFlag); killer.allKills++; if (killer._deathState == DeadEnum.isAlive) { killer.killsOnLife++; } if (victimSlot._team == 0) { room._redDeaths++; room._blueKills++; } else { room._blueDeaths++; room._redKills++; } if (room.room_type == 7) { if (killer._team == 0) { room.red_dino += 4; } else { room.blue_dino += 4; } } } victimSlot.lastKillState = 0; victimSlot.killsOnLife = 0; victimSlot.repeatLastState = false; victimSlot.passSequence = 0; victimSlot._deathState = DeadEnum.isDead; if (!isBotMode) { AllUtils.CompleteMission(room,victimSlot,MISSION_TYPE.DEATH,0); } if (deathType == CharaDeath.HEADSHOT) { killer.headshots++; } } }
public static void Load(ReceiveGPacket p) { int roomId = p.readH(); int channelId = p.readH(); byte killerId = p.readC(); byte dieObjectId = p.readC(); int weaponId = p.readD(); float killerX = p.readT(); float killerY = p.readT(); float killerZ = p.readT(); byte killsCount = p.readC(); int estimado = (killsCount * 15); if (p.getBuffer().Length > (25 + estimado)) { SaveLog.warning("[Invalid DEATH] Lenght > " + (25 + estimado) + " KillerId " + killerId + " Packet:" + BitConverter.ToString(p.getBuffer()) + "]"); Printf.warning("Invalid death Killer Id " + killerId); } Channel ch = ChannelsXML.getChannel(channelId); if (ch == null) { return; } Room room = ch.getRoom(roomId); if (room != null && room.round.Timer == null && room._state == RoomState.Battle) { SLOT killer = room.getSlot(killerId); if (killer != null && killer.state == SLOT_STATE.BATTLE) { FragInfos info = new FragInfos { killerIdx = killerId, killingType = 0, //1 - piercing | 2 - mass weapon = weaponId, x = killerX, y = killerY, z = killerZ, flag = dieObjectId }; bool isSuicide = false; for (int i = 0; i < killsCount; i++) { byte weaponClass = p.readC(); byte deathInfo = p.readC(); float vicX = p.readT(); float vicY = p.readT(); float vicZ = p.readT(); int vicFlag = p.readC(); int victimId = deathInfo & 15; SLOT victim = room.getSlot(victimId); if (victim != null && victim.state == SLOT_STATE.BATTLE) { Frag frag = new Frag(deathInfo) { flag = (byte)vicFlag,victimWeaponClass = weaponClass,x = vicX,y = vicY,z = vicZ }; if (info.killerIdx == victimId) { isSuicide = true; } info.frags.Add(frag); } } info.killsCount = (byte)info.frags.Count; Game_SyncNet.genDeath(room,killer,info,isSuicide); } } }
public override void RunImplement() { try { Account player = client.SessionPlayer; Room room = player != null ? player.room : null; if (room == null || room.round.Timer != null || room.state < RoomStateEnum.Battle) { return; } bool isBotMode = room.IsBotMode(); Slot killer = room.GetSlot(kills.killerIdx); if (/*!isBotMode && Settings.UdpType > UdpStateEnum.CLIENT || */ killer == null || (!isBotMode && (killer.state < SlotStateEnum.BATTLE || killer.Id != player.slotId))) { return; } ushort score = 0; ItemClassEnum weaponClass = (ItemClassEnum)Utilities.GetIdStatics(kills.weaponId, 1); for (int i = 0; i < kills.frags.Count; i++) { Frag frag = kills.frags[i]; CharaDeathEnum deathType = (CharaDeathEnum)(frag.hitspotInfo >> 4); if (kills.killsCount - (isSuicide ? 1 : 0) > 1) { frag.killFlag |= deathType == CharaDeathEnum.BOOM || deathType == CharaDeathEnum.OBJECT_EXPLOSION || deathType == CharaDeathEnum.POISON || deathType == CharaDeathEnum.HOWL || deathType == CharaDeathEnum.TRAMPLED || weaponClass == ItemClassEnum.SHOTGUN ? KillingMessageEnum.MassKill : KillingMessageEnum.PiercingShot; } else { int type = 0; if (deathType == CharaDeathEnum.HEADSHOT) { type = 4; } else if (deathType == CharaDeathEnum.DEFAULT && weaponClass == ItemClassEnum.KNIFE) { type = 6; } if (type > 0) { int lastState = killer.lastKillState >> 12; if (type == 4) { if (lastState != 4) { killer.repeatLastState = false; } killer.lastKillState = type << 12 | (killer.killsOnLife + 1); if (killer.repeatLastState) { frag.killFlag |= (killer.lastKillState & 16383) <= 1 ? KillingMessageEnum.Headshot : KillingMessageEnum.ChainHeadshot; } else { frag.killFlag |= KillingMessageEnum.Headshot; killer.repeatLastState = true; } } else if (type == 6) { if (lastState != 6) { killer.repeatLastState = false; } killer.lastKillState = type << 12 | (killer.killsOnLife + 1); if (killer.repeatLastState && (killer.lastKillState & 16383) > 1) { frag.killFlag |= KillingMessageEnum.ChainSlugger; } else { killer.repeatLastState = true; } } } else { killer.lastKillState = 0; killer.repeatLastState = false; } } int victimId = frag.VictimSlot; Slot victimSlot = room.slots[victimId]; if (victimSlot.killsOnLife > 3) { frag.killFlag |= KillingMessageEnum.ChainStopper; } if (!((kills.weaponId == 19016 || kills.weaponId == 19022) && kills.killerIdx == victimId) || !victimSlot.specGM) { victimSlot.allDeaths++; //explosao acid } if (killer.teamId != victimSlot.teamId) { score += GetKillScore(frag.killFlag); killer.allKills++; if (killer.deathState == DeadEnum.isAlive) { killer.killsOnLife++; } if (victimSlot.teamId == 0) { room.redDeaths++; room.blueKills++; } else { room.blueDeaths++; room.redKills++; } if (room.mode == RoomTypeEnum.Dino) { if (killer.teamId == 0) { room.redDino += 4; } else { room.blueDino += 4; } } } victimSlot.lastKillState = 0; victimSlot.killsOnLife = 0; victimSlot.repeatLastState = false; victimSlot.passSequence = 0; victimSlot.deathState = DeadEnum.isDead; if (!isBotMode) { room.MissionCompleteBase(room.GetPlayerBySlot(victimSlot), victimSlot, MissionTypeEnum.DEATH, 0); } if (deathType == CharaDeathEnum.HEADSHOT) { killer.headshots++; } } if (isBotMode) { killer.score += (ushort)(killer.killsOnLife + room.IngameAiLevel + score); if (killer.score > 65535) { killer.score = 65535; Logger.Warning($" [GAME] [BATTLE_DEATH_REQ] Foi atingido o limite de pontuação no Modo Challenge. Nick: {player.nickname} PlayerId: {player.playerId}"); } kills.Score = killer.score; } else { killer.score += score; room.MissionCompleteBase(player, killer, kills, MissionTypeEnum.NA, 0); kills.Score = score; } using (BATTLE_DEATH_PAK packet = new BATTLE_DEATH_PAK(room, kills, killer, isBotMode)) { room.SendPacketToPlayers(packet, SlotStateEnum.BATTLE, 0); } if ((room.mode == RoomTypeEnum.DeathMatch || room.mode == RoomTypeEnum.HeadHunter || room.mode == RoomTypeEnum.Chaos) && !isBotMode) { room.BattleEndKills(isBotMode); } else if (!killer.specGM && (room.mode == RoomTypeEnum.Destruction || room.mode == RoomTypeEnum.Suppression)) //Destruição e Supressão { room.GetPlayingPlayers(true, out int allRed, out int allBlue, out int redDeaths, out int blueDeaths); int winner = 0; if (redDeaths == allRed && killer.teamId == 0 && isSuicide && !room.PlantedBombC4) { winner = 1; room.blueRounds++; room.BattleEndRound(winner, true); } else if (blueDeaths == allBlue && killer.teamId == 1) { room.redRounds++; room.BattleEndRound(winner, true); } else if (redDeaths == allRed && killer.teamId == 1) { if (!room.PlantedBombC4) { winner = 1; room.blueRounds++; } else if (isSuicide) { room.redRounds++; } room.BattleEndRound(winner, false); } else if (blueDeaths == allBlue && killer.teamId == 0) { if (!isSuicide || !room.PlantedBombC4) { room.redRounds++; } else { winner = 1; room.blueRounds++; } room.BattleEndRound(winner, true); } } kills = null; } catch (Exception ex) { PacketLog(ex); } }