public override async void Execute(Level level) { if (level.Avatar.AccountPrivileges >= GetRequiredAccountPrivileges()) { if (m_vArgs.Length >= 2) { try { long id = Convert.ToInt64(m_vArgs[1]); Level l = await ResourcesManager.GetPlayer(id); if (l != null) { ClientAvatar acc = l.Avatar; Message = "Player Info : \n\n" + "ID = " + id + "\nName = " + acc.AvatarName + "\nCreation Date : " + acc.m_vAccountCreationDate + "\nRegion : " + acc.Region + "\nIP Address : " + l.Avatar.IPAddress; if (acc.AllianceId != 0) { Alliance a = ObjectManager.GetAlliance(acc.AllianceId); Message = Message + "\nClan Name : " + a.m_vAllianceName; switch (await acc.GetAllianceRole()) { case 1: Message = Message + "\nClan Role : Member"; break; case 2: Message = Message + "\nClan Role : Leader"; break; case 3: Message = Message + "\nClan Role : Elder"; break; case 4: Message = Message + "\nClan Role : Co-Leader"; break; default: Message = Message + "\nClan Role : Unknown"; break; } } Message = Message + "\nLevel : " + acc.m_vAvatarLevel + "\nTrophies : " + acc.GetScore() + "\nTown Hall Level : " + (acc.m_vTownHallLevel + 1) + "\nAlliance Castle Level : " + (acc.GetAllianceCastleLevel() + 1); var avatar = level.Avatar; AllianceMailStreamEntry mail = new AllianceMailStreamEntry(); mail.SenderId = avatar.UserId; mail.m_vSenderName = avatar.AvatarName; mail.IsNew = 2; mail.AllianceId = 0; mail.AllianceBadgeData = 1526735450; mail.AllianceName = "UCS Server Information"; mail.Message = Message; mail.m_vSenderLevel = avatar.m_vAvatarLevel; mail.m_vSenderLeagueId = avatar.m_vLeagueId; AvatarStreamEntryMessage p = new AvatarStreamEntryMessage(level.Client); p.SetAvatarStreamEntry(mail); Processor.Send(p); } } catch (Exception) { GlobalChatLineMessage c = new GlobalChatLineMessage(level.Client) { Message = "Command Failed, Wrong Format Or User Doesn't Exist (/accinfo id).", HomeId = level.Avatar.UserId, CurrentHomeId = level.Avatar.UserId, LeagueId = 22, PlayerName = "Ultrapower Clash Server AI" }; Processor.Send(c); return; } } else { GlobalChatLineMessage b = new GlobalChatLineMessage(level.Client) { Message = "Command Failed, Wrong Format (/accinfo id).", HomeId = level.Avatar.UserId, CurrentHomeId = level.Avatar.UserId, LeagueId = 22, PlayerName = "Ultrapower Clash Server AI" }; Processor.Send(b); } } }
public override void Execute(Level level) { if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges()) { if (m_vArgs.Length >= 2) { try { long id = Convert.ToInt64(m_vArgs[1]); Level l = ResourcesManager.GetPlayer(id); if (l != null) { ClientAvatar acc = l.GetPlayerAvatar(); Message = "Player Info : \n\n" + "ID = " + id + "\nName = " + acc.GetAvatarName() + "\nCreation Date : " + acc.GetAccountCreationDate() + "\nRegion : " + acc.GetUserRegion() + "\nIP Address : " + l.GetIPAddress(); if (acc.GetAllianceId() != 0) { Message = Message + "\nClan Name : " + ObjectManager.GetAlliance(acc.GetAllianceId()).GetAllianceName(); switch (acc.GetAllianceRole()) { case 1: Message = Message + "\nClan Role : Member"; break; case 2: Message = Message + "\nClan Role : Leader"; break; case 3: Message = Message + "\nClan Role : Elder"; break; case 4: Message = Message + "\nClan Role : Co-Leader"; break; default: Message = Message + "\nClan Role : Unknown"; break; } } Message = Message + "\nLevel : " + acc.GetAvatarLevel() + "\nTrophy : " + acc.GetScore() + "\nTown Hall Level : " + (acc.GetTownHallLevel() + 1) + "\nAlliance Castle Level : " + (acc.GetAllianceCastleLevel() + 1); var avatar = level.GetPlayerAvatar(); AllianceMailStreamEntry mail = new AllianceMailStreamEntry(); mail.SetSenderId(avatar.GetId()); mail.SetSenderAvatarId(avatar.GetId()); mail.SetSenderName(avatar.GetAvatarName()); mail.SetIsNew(2); mail.SetAllianceId(0); mail.SetAllianceBadgeData(1526735450); mail.SetAllianceName("UCS Server Information"); mail.SetMessage(Message); mail.SetSenderLevel(avatar.GetAvatarLevel()); mail.SetSenderLeagueId(avatar.GetLeagueId()); AvatarStreamEntryMessage p = new AvatarStreamEntryMessage(level.GetClient()); p.SetAvatarStreamEntry(mail); p.Send(); } } catch (Exception) { GlobalChatLineMessage c = new GlobalChatLineMessage(level.GetClient()); c.SetChatMessage("Command Failed, Wrong Format Or User Doesn't Exist (/accinfo id)."); c.SetPlayerId(level.GetPlayerAvatar().GetId()); c.SetLeagueId(22); c.SetPlayerName("Ultrapowa Clash Server"); c.Send(); return; } } else { GlobalChatLineMessage b = new GlobalChatLineMessage(level.GetClient()); b.SetChatMessage("Command Failed, Wrong Format (/accinfo id)."); b.SetPlayerId(level.GetPlayerAvatar().GetId()); b.SetLeagueId(22); b.SetPlayerName("Ultrapowa Clash Server"); b.Send(); } } }
public override void Execute(Level level) { ClientAvatar avatar = level.GetPlayerAvatar(); ConstructionItem gameObjectById = (ConstructionItem)level.GameObjectManager.GetGameObjectByID(BuildingId); BuildingData constructionItemData = (BuildingData)gameObjectById.GetConstructionItemData(); if (!avatar.HasEnoughResources(constructionItemData.GetBuildResource(gameObjectById.GetUpgradeLevel()), constructionItemData.GetBuildCost(gameObjectById.GetUpgradeLevel()))) { return; } string name = level.GameObjectManager.GetGameObjectByID(BuildingId).GetData().GetName(); Logger.Write("Unlocking Building: " + name + " (" + BuildingId + ')'); if (string.Equals(name, "Alliance Castle")) { avatar.IncrementAllianceCastleLevel(); BuildingData buildingData = ((Building)level.GameObjectManager.GetGameObjectByID(BuildingId)).GetBuildingData(); avatar.SetAllianceCastleTotalCapacity(buildingData.GetUnitStorageCapacity(avatar.GetAllianceCastleLevel())); } ResourceData buildResource = constructionItemData.GetBuildResource(gameObjectById.GetUpgradeLevel()); avatar.SetResourceCount(buildResource, avatar.GetResourceCount(buildResource) - constructionItemData.GetBuildCost(gameObjectById.GetUpgradeLevel())); gameObjectById.Unlock(); }
public override void Execute(Level level) { ClientAvatar avatar = level.GetPlayerAvatar(); GameObject gameObjectById = level.GameObjectManager.GetGameObjectByID(BuildingId); if (gameObjectById == null) { return; } ConstructionItem constructionItem = (ConstructionItem)gameObjectById; if (!constructionItem.CanUpgrade()) { return; } ConstructionItemData constructionItemData = constructionItem.GetConstructionItemData(); if (!avatar.HasEnoughResources(constructionItemData.GetBuildResource(constructionItem.GetUpgradeLevel() + 1), constructionItemData.GetBuildCost(constructionItem.GetUpgradeLevel() + 1)) || !level.HasFreeWorkers()) { return; } string name = level.GameObjectManager.GetGameObjectByID(BuildingId).GetData().GetName(); Logger.Write("Building To Upgrade : " + name + " (" + BuildingId + ')'); if (string.Equals(name, "Alliance Castle")) { avatar.IncrementAllianceCastleLevel(); BuildingData buildingData = ((Building)level.GameObjectManager.GetGameObjectByID(BuildingId)).GetBuildingData(); avatar.SetAllianceCastleTotalCapacity(buildingData.GetUnitStorageCapacity(avatar.GetAllianceCastleLevel())); } else if (string.Equals(name, "Town Hall")) { avatar.IncrementTownHallLevel(); } ResourceData buildResource = constructionItemData.GetBuildResource(constructionItem.GetUpgradeLevel() + 1); avatar.SetResourceCount(buildResource, avatar.GetResourceCount(buildResource) - constructionItemData.GetBuildCost(constructionItem.GetUpgradeLevel() + 1)); constructionItem.StartUpgrading(); }
public override void Execute(Level level) { GameObject gameObjectById = level.GameObjectManager.GetGameObjectByID(BuildingId); if (gameObjectById == null) { return; } if (gameObjectById.ClassId == 0 || gameObjectById.ClassId == 4) { ConstructionItem constructionItem = (ConstructionItem)gameObjectById; if (!constructionItem.IsConstructing()) { return; } ClientAvatar avatar = level.GetPlayerAvatar(); string name = level.GameObjectManager.GetGameObjectByID(BuildingId).GetData().GetName(); Logger.Write("Canceling Building Upgrade: " + name + " (" + BuildingId + ')'); if (string.Equals(name, "Alliance Castle")) { avatar.DeIncrementAllianceCastleLevel(); BuildingData buildingData = ((Building)gameObjectById).GetBuildingData(); avatar.SetAllianceCastleTotalCapacity(buildingData.GetUnitStorageCapacity(avatar.GetAllianceCastleLevel() - 1)); } else if (string.Equals(name, "Town Hall")) { avatar.DeIncrementTownHallLevel(); } constructionItem.CancelConstruction(); } else { int classId = gameObjectById.ClassId; } }