public override void Process(Level level) { if (m_vSearchString.Length > 15) { ResourcesManager.DisconnectClient(Client); } else { List <Alliance> alliances = ObjectManager.GetInMemoryAlliances(); List <Alliance> joinableAlliances = new List <Alliance>(); int i = 0; int j = 0; while (j < m_vAllianceLimit && i < alliances.Count) { if (alliances[i].GetAllianceMembers().Count != 0) { if (alliances[i].GetAllianceName().Contains(m_vSearchString, StringComparison.OrdinalIgnoreCase)) { joinableAlliances.Add(alliances[i]); j++; } i++; } } joinableAlliances = joinableAlliances.ToList(); AllianceListMessage p = new AllianceListMessage(Client); p.SetAlliances(joinableAlliances); p.SetSearchString(m_vSearchString); PacketProcessor.Send(p); } }
internal override async void Process() { try { long id = this.Device.Player.Avatar.UserId; Level l = await ResourcesManager.GetPlayer(id); if (l != null) { if (PlayerName.Length > 15) { ResourcesManager.DisconnectClient(Device); } else { l.Avatar.SetName(PlayerName); AvatarNameChangeOkMessage p = new AvatarNameChangeOkMessage(l.Client) { AvatarName = PlayerName }; p.Send(); } } } catch (Exception) { } }
public override async void Execute(Level level) { try { ClientAvatar p = level.GetPlayerAvatar(); if (p.State == ClientAvatar.UserState.PVP || p.State == ClientAvatar.UserState.PVE) { ResourcesManager.DisconnectClient(level.GetClient()); } else { /*if (level.GetPlayerAvatar().GetUnits().Count < 10) * { * for (int i = 0; i < 31; i++) * { * Data unitData = CSVManager.DataTables.GetDataById(4000000 + i); * CharacterData combatData = (CharacterData)unitData; * int maxLevel = combatData.GetUpgradeLevelCount(); * DataSlot unitSlot = new DataSlot(unitData, 1000); * * level.GetPlayerAvatar().GetUnits().Add(unitSlot); * level.GetPlayerAvatar().SetUnitUpgradeLevel(combatData, maxLevel - 1); * } * * for (int i = 0; i < 18; i++) * { * Data spellData = CSVManager.DataTables.GetDataById(26000000 + i); * SpellData combatData = (SpellData)spellData; * int maxLevel = combatData.GetUpgradeLevelCount(); * DataSlot spellSlot = new DataSlot(spellData, 1000); * * level.GetPlayerAvatar().GetSpells().Add(spellSlot); * level.GetPlayerAvatar().SetUnitUpgradeLevel(combatData, maxLevel - 1); * } * }*/ // New Method p.State = ClientAvatar.UserState.Searching; Level Defender = await ObjectManager.GetRandomOnlinePlayerWithoutShield(); if (Defender != null) { Defender.Tick(); PacketProcessor.Send(new EnemyHomeDataMessage(level.GetClient(), Defender, level)); } else { PacketProcessor.Send(new OutOfSyncMessage(level.GetClient())); } } } catch (Exception) { } }
internal override async void Process() { try { if (this.Device.PlayerState == State.IN_BATTLE) { ResourcesManager.DisconnectClient(this.Device); } else { /*if (level.Avatar.GetUnits().Count < 10) * { * for (int i = 0; i < 31; i++) * { * Data unitData = CSVManager.DataTables.GetDataById(4000000 + i); * CharacterData combatData = (CharacterData)unitData; * int maxLevel = combatData.GetUpgradeLevelCount(); * DataSlot unitSlot = new DataSlot(unitData, 1000); * * level.Avatar.GetUnits().Add(unitSlot); * level.Avatar.SetUnitUpgradeLevel(combatData, maxLevel - 1); * } * * for (int i = 0; i < 18; i++) * { * Data spellData = CSVManager.DataTables.GetDataById(26000000 + i); * SpellData combatData = (SpellData)spellData; * int maxLevel = combatData.GetUpgradeLevelCount(); * DataSlot spellSlot = new DataSlot(spellData, 1000); * * level.Avatar.GetSpells().Add(spellSlot); * level.Avatar.SetUnitUpgradeLevel(combatData, maxLevel - 1); * } * }*/ // New Method this.Device.PlayerState = State.SEARCH_BATTLE; Level Defender = ObjectManager.GetRandomOnlinePlayer(); if (Defender != null) { Defender.Tick(); new EnemyHomeDataMessage(this.Device, Defender, this.Device.Player).Send(); } else { new OutOfSyncMessage(this.Device).Send(); } } } catch (Exception) { } }
internal async void Process() { try { if (this.Device.PlayerState == Logic.Enums.State.IN_BATTLE) { ResourcesManager.DisconnectClient(Device); } else { if (ID > 0) { this.Device.PlayerState = Logic.Enums.State.IN_BATTLE; Alliance a = ObjectManager.GetAlliance(this.Device.Player.Avatar.AllianceId); Level defender = await ResourcesManager.GetPlayer(a.m_vChatMessages.Find(c => c.ID == ID).SenderID); if (defender != null) { defender.Tick(); new ChallangeAttackDataMessage(Device, defender).Send(); } else { new OwnHomeDataMessage(Device, this.Device.Player).Send(); } Alliance alliance = ObjectManager.GetAlliance(this.Device.Player.Avatar.AllianceId); StreamEntry s = alliance.m_vChatMessages.Find(c => c.m_vType == 12); if (s != null) { alliance.m_vChatMessages.RemoveAll(t => t == s); foreach (AllianceMemberEntry op in alliance.GetAllianceMembers()) { Level playera = await ResourcesManager.GetPlayer(op.AvatarId); if (playera.Client != null) { new AllianceStreamEntryMessage(playera.Client) { StreamEntry = s }.Send(); } } } } else { new OutOfSyncMessage(this.Device).Send(); } } } catch (Exception) { } }
internal override void Process() { if (m_vAllianceName == null) { m_vAllianceName = "Clan"; } if (m_vAllianceName.Length < 16 || m_vAllianceName.Length < 1) { if (m_vAllianceDescription.Length < 259 || m_vAllianceDescription.Length < 0) { Alliance alliance = ObjectManager.CreateAlliance(0); alliance.m_vAllianceName = m_vAllianceName; alliance.m_vAllianceDescription = m_vAllianceDescription; alliance.m_vAllianceType = m_vAllianceType; alliance.m_vRequiredScore = m_vRequiredScore; alliance.m_vAllianceBadgeData = m_vAllianceBadgeData; alliance.m_vAllianceOrigin = m_vAllianceOrigin; alliance.m_vWarFrequency = m_vWarFrequency; alliance.SetWarAndFriendlytStatus(m_vWarAndFriendlyStatus); this.Device.Player.Avatar.AllianceId = alliance.m_vAllianceId; AllianceMemberEntry member = new AllianceMemberEntry(this.Device.Player.Avatar.UserId) { Role = 2 }; alliance.AddAllianceMember(member); JoinedAllianceCommand b = new JoinedAllianceCommand(this.Device); b.SetAlliance(alliance); AllianceRoleUpdateCommand d = new AllianceRoleUpdateCommand(this.Device); d.SetAlliance(alliance); d.SetRole(2); d.Tick(this.Device.Player); new AvailableServerCommandMessage(this.Device, b.Handle()).Send(); new AvailableServerCommandMessage(this.Device, d.Handle()).Send(); } else { ResourcesManager.DisconnectClient(Device); } } else { ResourcesManager.DisconnectClient(Device); } }
public override void Process(Level level) { if (string.IsNullOrEmpty(PlayerName) || PlayerName.Length > 15) { ResourcesManager.DisconnectClient(Client); } else { level.GetPlayerAvatar().SetName(PlayerName); new AvatarNameChangeOkMessage(Client) { AvatarName = level.GetPlayerAvatar().GetAvatarName() }.Send(); } }
public override void Process(Level level) { if (string.IsNullOrEmpty(PlayerName) || PlayerName.Length > 15) { ResourcesManager.DisconnectClient(Client); } else { level.GetPlayerAvatar().SetName(PlayerName); AvatarNameChangeOkMessage p = new AvatarNameChangeOkMessage(Client); p.SetAvatarName(level.GetPlayerAvatar().GetAvatarName()); PacketProcessor.Send(p); } //new RequestConfirmChangeNameMessage(Client, PlayerName); }
public override async void Process(Level level) { try { if (level.GetPlayerAvatar().State == ClientAvatar.UserState.CHA) { ResourcesManager.DisconnectClient(Client); } else { level.GetPlayerAvatar().State = ClientAvatar.UserState.CHA; Alliance a = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); Level defender = await ResourcesManager.GetPlayer(a.GetChatMessages().Find(c => c.GetId() == ID).GetSenderId()); if (defender != null) { defender.Tick(); PacketProcessor.Send(new ChallangeAttackDataMessage(Client, defender)); } else { new OwnHomeDataMessage(Client, level); } Alliance alliance = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); StreamEntry s = alliance.GetChatMessages().Find(c => c.GetStreamEntryType() == 12); if (s != null) { alliance.GetChatMessages().RemoveAll(t => t == s); foreach (AllianceMemberEntry op in alliance.GetAllianceMembers()) { Level playera = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (playera.GetClient() != null) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(playera.GetClient()); p.SetStreamEntry(s); PacketProcessor.Send(p); } } } } } catch (Exception) { } }
internal override void Process() { if (string.IsNullOrEmpty(PlayerName) || PlayerName.Length > 15) { ResourcesManager.DisconnectClient(Device); } else { this.Device.Player.Avatar.SetName(PlayerName); this.Device.Player.Avatar.m_vNameChangingLeft--; AvatarNameChangeOkMessage p = new AvatarNameChangeOkMessage(this.Device) { AvatarName = this.Device.Player.Avatar.AvatarName }; p.Send(); } //new RequestConfirmChangeNameMessage(Client, PlayerName); }
public override void Process(Level level) { ClientAvatar p = level.GetPlayerAvatar(); if (p.State == ClientAvatar.UserState.PVE || p.State == ClientAvatar.UserState.PVP) { ResourcesManager.DisconnectClient(Client); } else { if (LevelId > 0 || LevelId < 1000000) { /*if (level.GetPlayerAvatar().GetUnits().Count < 10) * { * for (int i = 0; i < 31; i++) * { * Data unitData = CSVManager.DataTables.GetDataById(4000000 + i); * CharacterData combatData = (CharacterData)unitData; * int maxLevel = combatData.GetUpgradeLevelCount(); * DataSlot unitSlot = new DataSlot(unitData, 1000); * * level.GetPlayerAvatar().GetUnits().Add(unitSlot); * level.GetPlayerAvatar().SetUnitUpgradeLevel(combatData, maxLevel - 1); * } * * for (int i = 0; i < 18; i++) * { * Data spellData = CSVManager.DataTables.GetDataById(26000000 + i); * SpellData combatData = (SpellData)spellData; * int maxLevel = combatData.GetUpgradeLevelCount(); * DataSlot spellSlot = new DataSlot(spellData, 1000); * * level.GetPlayerAvatar().GetSpells().Add(spellSlot); * level.GetPlayerAvatar().SetUnitUpgradeLevel(combatData, maxLevel - 1); * } * }*/ p.State = ClientAvatar.UserState.PVE; PacketProcessor.Send(new NpcDataMessage(Client, level, this)); } } }
internal override void Process() { if (this.Device.PlayerState == State.IN_BATTLE) { ResourcesManager.DisconnectClient(Device); } else { if (LevelId > 0 || LevelId < 1000000) { /*if (level.Avatar.GetUnits().Count < 10) * { * for (int i = 0; i < 31; i++) * { * Data unitData = CSVManager.DataTables.GetDataById(4000000 + i); * CharacterData combatData = (CharacterData)unitData; * int maxLevel = combatData.GetUpgradeLevelCount(); * DataSlot unitSlot = new DataSlot(unitData, 1000); * * level.Avatar.GetUnits().Add(unitSlot); * level.Avatar.SetUnitUpgradeLevel(combatData, maxLevel - 1); * } * * for (int i = 0; i < 18; i++) * { * Data spellData = CSVManager.DataTables.GetDataById(26000000 + i); * SpellData combatData = (SpellData)spellData; * int maxLevel = combatData.GetUpgradeLevelCount(); * DataSlot spellSlot = new DataSlot(spellData, 1000); * * level.Avatar.GetSpells().Add(spellSlot); * level.Avatar.SetUnitUpgradeLevel(combatData, maxLevel - 1); * } * }*/ this.Device.PlayerState = State.SEARCH_BATTLE; new NpcDataMessage(Device, this.Device.Player, this).Send(); } } }
public override async void Process(Level level) { try { long id = level.GetPlayerAvatar().GetId(); Level l = await ResourcesManager.GetPlayer(id); if (l != null) { if (PlayerName.Length > 15) { ResourcesManager.DisconnectClient(Client); } else { l.GetPlayerAvatar().SetName(PlayerName); AvatarNameChangeOkMessage p = new AvatarNameChangeOkMessage(l.GetClient()); p.SetAvatarName(PlayerName); PacketProcessor.Send(p); } } } catch (Exception) { } }
public override void Process(Level level) { Level player = ResourcesManager.GetPlayer(level.GetPlayerAvatar().GetId(), false); if (player == null) { return; } if (PlayerName.Length > 15) { ResourcesManager.DisconnectClient(Client); } else { player.GetPlayerAvatar().SetName(PlayerName); new AvatarNameChangeOkMessage(Client) { AvatarName = PlayerName }.Send(); } }
internal override void Process() { if (m_vSearchString.Length < 15) { ResourcesManager.DisconnectClient(Device); } else { List <Alliance> joinableAlliances = new List <Alliance>(); foreach (Alliance _Alliance in ResourcesManager.m_vInMemoryAlliances.Values) { if (_Alliance.m_vAllianceName.Contains(m_vSearchString, StringComparison.OrdinalIgnoreCase)) { joinableAlliances.Add(_Alliance); } } AllianceListMessage p = new AllianceListMessage(Device); p.m_vAlliances = joinableAlliances; p.m_vSearchString = m_vSearchString; p.Send(); } }
internal override async void Process() { try { if (Message.Length > 0 && Message.Length < 100) { ClientAvatar player = this.Device.Player.Avatar; Alliance all = ObjectManager.GetAlliance(ID); InvitationStreamEntry cm = new InvitationStreamEntry { ID = all.m_vChatMessages.Count + 1 }; cm.SetSender(player); cm.SetMessage(Message); cm.SetState(1); all.AddChatMessage(cm); foreach (AllianceMemberEntry op in all.GetAllianceMembers()) { Level playera = await ResourcesManager.GetPlayer(op.AvatarId); if (playera.Client != null) { new AllianceStreamEntryMessage(playera.Client) { StreamEntry = cm }.Send(); } } } else { ResourcesManager.DisconnectClient(this.Device); } } catch (Exception) { } }
public override void Process(Level level) { EditClanSettingsMessage clanSettingsMessage = this; try { Alliance alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance != null) { if (clanSettingsMessage.m_vAllianceDescription.Length < 259 || clanSettingsMessage.m_vAllianceDescription.Length < 0) { if (clanSettingsMessage.m_vAllianceBadgeData < 1 || (long)clanSettingsMessage.m_vAllianceBadgeData < 10000000000L) { if (clanSettingsMessage.m_vAllianceType < 0 || clanSettingsMessage.m_vAllianceType < 10) { if (clanSettingsMessage.m_vRequiredScore < 0 || clanSettingsMessage.m_vRequiredScore < 4201) { if (clanSettingsMessage.m_vWarFrequency < 0 || clanSettingsMessage.m_vWarFrequency < 10) { if (clanSettingsMessage.m_vAllianceOrigin < 0 || clanSettingsMessage.m_vAllianceOrigin < 42000000) { if ((int)clanSettingsMessage.m_vWarAndFriendlyStatus < 0 || (int)clanSettingsMessage.m_vWarAndFriendlyStatus < 5) { alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetWarFrequency(m_vWarFrequency); alliance.SetAllianceOrigin(m_vAllianceOrigin); alliance.SetWarAndFriendlytStatus(m_vWarAndFriendlyStatus); ClientAvatar avatar = level.GetPlayerAvatar(); avatar.GetAllianceId(); AllianceEventStreamEntry eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); eventStreamEntry.SetSender(avatar); eventStreamEntry.SetEventType(10); eventStreamEntry.SetAvatarId(avatar.GetId()); eventStreamEntry.SetAvatarName(avatar.GetAvatarName()); eventStreamEntry.SetSenderId(avatar.GetId()); eventStreamEntry.SetSenderName(avatar.GetAvatarName()); alliance.AddChatMessage(eventStreamEntry); AllianceSettingChangedCommand Command = new AllianceSettingChangedCommand(); Command.SetAlliance(alliance); Command.SetPlayer(level); var availableServerCommandMessage = new AvailableServerCommandMessage(level.GetClient()); availableServerCommandMessage.SetCommandId(6); availableServerCommandMessage.SetCommand(Command); availableServerCommandMessage.Send(); foreach (AllianceMemberEntry allianceMember in alliance.GetAllianceMembers()) { Level player = ResourcesManager.GetPlayer(allianceMember.GetAvatarId(), false); if (ResourcesManager.IsPlayerOnline(player)) { var p = new AllianceStreamEntryMessage(player.GetClient()); AllianceEventStreamEntry eventStreamEntry1 = eventStreamEntry; p.SetStreamEntry(eventStreamEntry1); p.Send(); } } List <AllianceMemberEntry> .Enumerator enumerator = new List <AllianceMemberEntry> .Enumerator(); DatabaseManager.Instance.Save(alliance); eventStreamEntry = (AllianceEventStreamEntry)null; } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } alliance = (Alliance)null; } catch (Exception ex) { } }
public override async void Process(Level level) { try { Alliance alliance = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance != null) { if (m_vAllianceDescription.Length < 259 || m_vAllianceDescription.Length < 0) { if (m_vAllianceBadgeData < 1 || m_vAllianceBadgeData < 10000000000) { if (m_vAllianceType < 0 || m_vAllianceType < 10) { if (m_vRequiredScore < 0 || m_vRequiredScore < 4201) { if (m_vWarFrequency < 0 || m_vWarFrequency < 10) { if (m_vAllianceOrigin < 0 || m_vAllianceOrigin < 42000000) { if (m_vWarAndFriendlyStatus < 0 || m_vWarAndFriendlyStatus < 5) { alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetWarFrequency(m_vWarFrequency); alliance.SetAllianceOrigin(m_vAllianceOrigin); alliance.SetWarAndFriendlytStatus(m_vWarAndFriendlyStatus); ClientAvatar avatar = level.GetPlayerAvatar(); long allianceId = avatar.GetAllianceId(); AllianceEventStreamEntry eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); eventStreamEntry.SetSender(avatar); eventStreamEntry.SetEventType(10); eventStreamEntry.SetAvatarId(avatar.GetId()); eventStreamEntry.SetAvatarName(avatar.GetAvatarName()); eventStreamEntry.SetSenderId(avatar.GetId()); eventStreamEntry.SetSenderName(avatar.GetAvatarName()); alliance.AddChatMessage(eventStreamEntry); AllianceSettingChangedCommand edit = new AllianceSettingChangedCommand(); edit.SetAlliance(alliance); edit.SetPlayer(level); AvailableServerCommandMessage availableServerCommandMessage = new AvailableServerCommandMessage(level.GetClient()); availableServerCommandMessage.SetCommandId(6); availableServerCommandMessage.SetCommand(edit); PacketProcessor.Send(availableServerCommandMessage); foreach (AllianceMemberEntry op in alliance.GetAllianceMembers()) { Level user = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (ResourcesManager.IsPlayerOnline(user)) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(user.GetClient()); p.SetStreamEntry(eventStreamEntry); PacketProcessor.Send(p); } } DatabaseManager.Single().Save(alliance); } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } } catch (Exception) { } }
internal override async void Process() { try { Alliance alliance = ObjectManager.GetAlliance(this.Device.Player.Avatar.AllianceId); if (alliance != null) { if (m_vAllianceDescription.Length < 259 || m_vAllianceDescription.Length < 0) { alliance.m_vAllianceDescription = m_vAllianceDescription; alliance.m_vAllianceBadgeData = m_vAllianceBadgeData; alliance.m_vAllianceType = m_vAllianceType; alliance.m_vRequiredScore = m_vRequiredScore; alliance.m_vWarFrequency = m_vWarFrequency; alliance.m_vAllianceOrigin = m_vAllianceOrigin; alliance.SetWarAndFriendlytStatus(m_vWarAndFriendlyStatus); ClientAvatar avatar = this.Device.Player.Avatar; long allianceId = avatar.AllianceId; AllianceEventStreamEntry eventStreamEntry = new AllianceEventStreamEntry { ID = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)) .TotalSeconds }; eventStreamEntry.SetSender(avatar); eventStreamEntry.EventType = 10; eventStreamEntry.SetSender(avatar); alliance.AddChatMessage(eventStreamEntry); AllianceSettingChangedCommand edit = new AllianceSettingChangedCommand(this.Device); edit.SetAlliance(alliance); edit.SetPlayer(this.Device.Player); new AvailableServerCommandMessage(this.Device, edit.Handle()).Send(); foreach (AllianceMemberEntry op in alliance.GetAllianceMembers()) { Level user = await ResourcesManager.GetPlayer(op.AvatarId); if (ResourcesManager.IsPlayerOnline(user)) { new AllianceStreamEntryMessage(user.Client) { StreamEntry = eventStreamEntry }.Send(); } } Resources.DatabaseManager.Save(alliance); } else { ResourcesManager.DisconnectClient(Device); } } else { ResourcesManager.DisconnectClient(Device); } } catch { //Exception } }
internal override async void Process() { try { ClientAvatar player = this.Device.Player.Avatar; /*if (player.State == UserState.PVP) * { * var info = default(ClientAvatar.AttackInfo); * if (!level.Avatar.AttackingInfo.TryGetValue(level.Avatar.GetId(), out info)) * { * Logger.Write("Unable to obtain attack info."); * } * else * { * Level defender = info.Defender; * Level attacker = info.Attacker; * * int lost = info.Lost; * int reward = info.Reward; * * List<DataSlot> usedtroop = info.UsedTroop; * * int attackerscore = attacker.Avatar.GetScore(); * int defenderscore = defender.Avatar.GetScore(); * * if (defender.Avatar.GetScore() > 0) * defender.Avatar.SetScore(defenderscore -= lost); * * Logger.Write("Used troop type: " + usedtroop.Count); * foreach(DataSlot a in usedtroop) * { * Logger.Write("Troop Name: " + a.Data.GetName()); * Logger.Write("Troop Used Value: " + a.Value); * } * attacker.Avatar.SetScore(attackerscore += reward); * attacker.Avatar.AttackingInfo.Clear(); //Since we use userid for now,We need to clear to prevent overlapping * Resources(attacker); * * Resources.DatabaseManager.Save(attacker); * Resources.DatabaseManager.Save(defender); * } * player.State = UserState.Home; * }*/ if (State == 1) { this.Device.PlayerState = Logic.Enums.State.WAR_EMODE; this.Device.Player.Tick(); new OwnHomeDataMessage(this.Device, this.Device.Player).Send(); } else if (this.Device.PlayerState == Logic.Enums.State.LOGGED) { ResourcesManager.DisconnectClient(Device); } else { this.Device.PlayerState = Logic.Enums.State.LOGGED; this.Device.Player.Tick(); Alliance alliance = ObjectManager.GetAlliance(this.Device.Player.Avatar.AllianceId); new OwnHomeDataMessage(Device, this.Device.Player).Send(); if (alliance != null) { new AllianceStreamMessage(Device, alliance).Send(); } } } catch (Exception) { } }
public override void Process(Level level) { if (m_vAllianceName == null) { m_vAllianceName = "Clan"; } if (m_vAllianceName.Length < 16 || m_vAllianceName.Length < 1) { if (m_vAllianceDescription.Length < 259 || m_vAllianceDescription.Length < 0) { if (m_vAllianceBadgeData < 1 || (long)m_vAllianceBadgeData < 10000000000L) { if (m_vAllianceType < 0 || m_vAllianceType < 10) { if (m_vRequiredScore < 0 || m_vRequiredScore < 4201) { if (m_vWarFrequency < 0 || m_vWarFrequency < 10) { if (m_vAllianceOrigin < 0 || m_vAllianceOrigin < 42000000) { if ((int)m_vWarAndFriendlyStatus < 0 || (int)m_vWarAndFriendlyStatus < 5) { Alliance alliance = ObjectManager.CreateAlliance(); alliance.SetAllianceName(m_vAllianceName); alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceOrigin(m_vAllianceOrigin); alliance.SetWarFrequency(m_vWarFrequency); alliance.SetWarAndFriendlytStatus(m_vWarAndFriendlyStatus); level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId()); AllianceMemberEntry entry = new AllianceMemberEntry(level.GetPlayerAvatar().GetId()); entry.SetRole(2); alliance.AddAllianceMember(entry); JoinedAllianceCommand Command1 = new JoinedAllianceCommand(); Command1.SetAlliance(alliance); AllianceRoleUpdateCommand Command2 = new AllianceRoleUpdateCommand(); Command2.SetAlliance(alliance); Command2.SetRole(2); Command2.Tick(level); var a = new AvailableServerCommandMessage(Client); a.SetCommandId(1); a.SetCommand(Command1); var c = new AvailableServerCommandMessage(Client); c.SetCommandId(8); c.SetCommand(Command2); a.Send(); c.Send(); } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } }
public override async void Process(Level level) { try { ClientAvatar player = level.GetPlayerAvatar(); /*if (player.State == UserState.PVP) * { * var info = default(ClientAvatar.AttackInfo); * if (!level.GetPlayerAvatar().AttackingInfo.TryGetValue(level.GetPlayerAvatar().GetId(), out info)) * { * Logger.Write("Unable to obtain attack info."); * } * else * { * Level defender = info.Defender; * Level attacker = info.Attacker; * * int lost = info.Lost; * int reward = info.Reward; * * List<DataSlot> usedtroop = info.UsedTroop; * * int attackerscore = attacker.GetPlayerAvatar().GetScore(); * int defenderscore = defender.GetPlayerAvatar().GetScore(); * * if (defender.GetPlayerAvatar().GetScore() > 0) * defender.GetPlayerAvatar().SetScore(defenderscore -= lost); * * Logger.Write("Used troop type: " + usedtroop.Count); * foreach(DataSlot a in usedtroop) * { * Logger.Write("Troop Name: " + a.Data.GetName()); * Logger.Write("Troop Used Value: " + a.Value); * } * attacker.GetPlayerAvatar().SetScore(attackerscore += reward); * attacker.GetPlayerAvatar().AttackingInfo.Clear(); //Since we use userid for now,We need to clear to prevent overlapping * Resources(attacker); * * DatabaseManager.Single().Save(attacker); * DatabaseManager.Single().Save(defender); * } * player.State = UserState.Home; * }*/ if (State == 1) { player.State = UserState.Editmode; level.Tick(); PacketProcessor.Send(new OwnHomeDataMessage(Client, level)); } else if (player.State == UserState.Home) { ResourcesManager.DisconnectClient(Client); } else { player.State = UserState.Home; level.Tick(); Alliance alliance = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); PacketProcessor.Send(new OwnHomeDataMessage(Client, level)); if (alliance != null) { PacketProcessor.Send(new AllianceStreamMessage(Client, alliance)); } } } catch (Exception) { } }